Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExPlat: Expose all ExPlat Client Functions #50609

Merged
merged 5 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions client/lib/explat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* WordPress dependencies
*/
import { createExPlatClient } from '@automattic/explat-client';
import createExPlatClientReactHelpers from '@automattic/explat-client-react-helpers';

/**
* Internal dependencies
Expand All @@ -13,11 +14,13 @@ import { isDevelopmentMode } from './internals/misc';

initializeAnonId().catch( ( e ) => logError( { message: e.message } ) );

const ExPlatClient = createExPlatClient( {
const exPlatClient = createExPlatClient( {
fetchExperimentAssignment,
getAnonId,
logError,
isDevelopmentMode,
} );

export default ExPlatClient;
export const { loadExperimentAssignment, dangerouslyGetExperimentAssignment } = exPlatClient;
const exPlatClientReactHelpers = createExPlatClientReactHelpers( exPlatClient );
export const { useExperiment, Experiment } = exPlatClientReactHelpers;
2 changes: 1 addition & 1 deletion client/lib/explat/test/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import ExPlatClient from '../index';
import * as ExPlatClient from '../index';

const mockLogError = jest.fn();
jest.mock( '../internals/log-error', () => ( {
Expand Down
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@automattic/data-stores": "^1.0.0-alpha.1",
"@automattic/domain-picker": "^1.0.0-alpha.0",
"@automattic/explat-client": "^0.0.1",
"@automattic/explat-client-react-helpers": "^0.0.1",
"@automattic/format-currency": "^1.0.0-alpha.0",
"@automattic/i18n-utils": "^1.0.0",
"@automattic/js-utils": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/explat-client-react-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"main": "dist/cjs/index.js",
"browser": "dist/esm/index.js",
"module": "dist/esm/index.js",
"calypso:src": "src/index.ts",
"calypso:src": "src/index.tsx",
"types": "dist/types/index.d.ts",
"sideEffects": false,
"repository": {
Expand Down
8 changes: 0 additions & 8 deletions packages/explat-react-client/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions packages/explat-react-client/jest.config.js

This file was deleted.

28 changes: 0 additions & 28 deletions packages/explat-react-client/package.json

This file was deleted.

2 changes: 0 additions & 2 deletions packages/explat-react-client/src/index.ts

This file was deleted.

11 changes: 0 additions & 11 deletions packages/explat-react-client/tsconfig-cjs.json

This file was deleted.

30 changes: 0 additions & 30 deletions packages/explat-react-client/tsconfig.json

This file was deleted.

2 changes: 2 additions & 0 deletions packages/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
{ "path": "./components" },
{ "path": "./composite-checkout" },
{ "path": "./create-calypso-config" },
{ "path": "./explat-client" },
{ "path": "./explat-client-react-helpers" },
{ "path": "./state-utils" },
{ "path": "./data-stores" },
{ "path": "./domain-picker" },
Expand Down