Skip to content

Commit 8371880

Browse files
committed
feat(core): CHECKOUT-9450 Lazy load payment strategies through essential build
1 parent 1b1b8c0 commit 8371880

35 files changed

+1257
-500
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666

6767
build:
6868
<<: *node_executor
69-
resource_class: large
69+
resource_class: xlarge
7070
steps:
7171
- ci/pre-setup
7272
- node/npm-install
@@ -110,7 +110,7 @@ jobs:
110110
111111
build_cdn:
112112
<<: *node_executor
113-
resource_class: medium+
113+
resource_class: xlarge
114114
steps:
115115
- ci/pre-setup
116116
- node/npm-install

package-lock.json

Lines changed: 629 additions & 382 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,26 @@
33
"version": "1.793.0",
44
"description": "BigCommerce Checkout JavaScript SDK",
55
"license": "MIT",
6-
"main": "dist/checkout-sdk.js",
6+
"main": "dist/cjs/checkout-sdk.js",
7+
"module": "dist/esm/checkout-sdk.js",
78
"typings": "dist/checkout-sdk.d.ts",
9+
"exports": {
10+
".": {
11+
"types": "./dist/checkout-sdk.d.ts",
12+
"import": "./dist/esm/checkout-sdk.js",
13+
"require": "./dist/cjs/checkout-sdk.js"
14+
},
15+
"./essential": {
16+
"types": "./dist/checkout-sdk.d.ts",
17+
"import": "./dist/esm/checkout-sdk-essential.js",
18+
"require": "./dist/cjs/checkout-sdk-essential.js"
19+
},
20+
"./integrations": {
21+
"types": "./dist/integrations.d.ts",
22+
"import": "./dist/esm/integrations.js",
23+
"require": "./dist/cjs/integrations.js"
24+
}
25+
},
826
"files": [
927
"dist/",
1028
"docs/"
@@ -32,7 +50,7 @@
3250
"build-cdn": "npx nx run core:build-cdn",
3351
"prebundle": "rm -rf dist",
3452
"bundle": "npx nx run core:build",
35-
"bundle:analyze": "npm run --silent bundle -- --config-name umd --profile --json > webpack-stats.json && webpack-bundle-analyzer webpack-stats.json dist --default-sizes gzip",
53+
"bundle:analyze": "npx nx run core:build-analyze",
3654
"bundle:watch": "export WATCH=true; npx nx run core:build-watch",
3755
"bundle-dts": "npx nx run core:build-dts",
3856
"docs": "npx nx run core:docs",
@@ -53,7 +71,7 @@
5371
},
5472
"dependencies": {
5573
"@bigcommerce/bigpay-client": "^5.28.1",
56-
"@bigcommerce/data-store": "^1.0.1",
74+
"@bigcommerce/data-store": "^1.0.3",
5775
"@bigcommerce/form-poster": "^1.5.0",
5876
"@bigcommerce/memoize": "^1.0.0",
5977
"@bigcommerce/request-sender": "^1.2.4",
@@ -122,7 +140,7 @@
122140
"typedoc": "^0.22.0",
123141
"typedoc-plugin-markdown": "^3.11.0",
124142
"typescript": "^4.7.2",
125-
"webpack": "^5.72.0",
143+
"webpack": "^5.101.3",
126144
"webpack-assets-manifest": "^5.1.0",
127145
"webpack-bundle-analyzer": "^4.5.0",
128146
"webpack-cli": "^4.9.2",

packages/adyen-utils/src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import * as adyenV2Mock from './adyenv2/adyenv2.mock';
2+
import * as adyenV3Mock from './adyenv3/adyenv3.mock';
3+
14
export { default as AdyenV2ScriptLoader } from './adyenv2/adyenv2-script-loader';
25
export { default as AdyenV3ScriptLoader } from './adyenv3/adyenv3-script-loader';
36
export * from './types';
4-
export * as adyenV2Mock from './adyenv2/adyenv2.mock';
5-
export * as adyenV3Mock from './adyenv3/adyenv3.mock';
7+
export { adyenV2Mock, adyenV3Mock };
68
export { WithAdyenV3PaymentInitializeOptions } from './adyenv3/adyenv3-initialize-options';
79
export { default as AdyenV3PaymentInitializeOptions } from './adyenv3/adyenv3-initialize-options';
810
export { WithAdyenV2PaymentInitializeOptions } from './adyenv2/adyenv2-initialize-options';

packages/adyen-utils/src/types.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,7 @@ export interface AdyenAdditionalActionCallbacks {
195195

196196
export interface AdyenAdditionalActionErrorResponse {
197197
provider_data: AdyenAdditionalAction;
198-
errors: [
199-
{
200-
code: string;
201-
},
202-
];
198+
errors: [{ code: string }];
203199
}
204200

205201
export interface AdyenAdditionalActionOptions extends AdyenAdditionalActionCallbacks {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"compiler": {
3+
"configType": "tsconfig",
4+
"rootFolder": "."
5+
},
6+
"project": {
7+
"entryPointSourceFile": "../../temp/core/src/bundles/integrations.d.ts"
8+
},
9+
"validationRules": {
10+
"missingReleaseTags": "allow"
11+
},
12+
"apiReviewFile": {
13+
"enabled": false
14+
},
15+
"apiJsonFile": {
16+
"enabled": false
17+
},
18+
"dtsRollup": {
19+
"enabled": true,
20+
"mainDtsRollupPath": "integrations.d.ts"
21+
}
22+
}

packages/core/project.json

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,30 @@
1919
}
2020
]
2121
},
22+
"build-analyze": {
23+
"executor": "@nrwl/workspace:run-commands",
24+
"options": {
25+
"commands": [
26+
"webpack --config webpack.config.js --config-name esm --profile --json > webpack-stats.json",
27+
"webpack-bundle-analyzer webpack-stats.json dist --default-sizes gzip"
28+
],
29+
"parallel": false
30+
},
31+
"dependsOn": [
32+
{
33+
"target": "generate",
34+
"projects": "self"
35+
},
36+
{
37+
"target": "build",
38+
"projects": "dependencies"
39+
}
40+
]
41+
},
2242
"build-watch": {
2343
"executor": "@nrwl/workspace:run-commands",
2444
"options": {
25-
"command": "webpack --config webpack.config.js --config-name cjs --watch --progress"
45+
"command": "webpack --config webpack.config.js --config-name esm --watch --progress"
2646
},
2747
"dependsOn": [
2848
{
@@ -62,7 +82,7 @@
6282
"parallel": false,
6383
"commands": [
6484
"tsc --outDir ../../temp --declaration --emitDeclarationOnly",
65-
"api-extractor run --config api-extractor/checkout-sdk.json & api-extractor run --config api-extractor/checkout-button.json & api-extractor run --config api-extractor/embedded-checkout.json & api-extractor run --config api-extractor/internal-mappers.json",
85+
"api-extractor run --config api-extractor/checkout-sdk.json & api-extractor run --config api-extractor/integrations.json & api-extractor run --config api-extractor/checkout-button.json & api-extractor run --config api-extractor/embedded-checkout.json & api-extractor run --config api-extractor/internal-mappers.json",
6686
"rm -rf ../../temp",
6787
"nx run hosted-form-v2:build-dts"
6888
]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from '../generated/payment-strategies';
2+
export * from '../generated/customer-strategies';

packages/core/src/checkout-buttons/checkout-button-initializer.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('CheckoutButtonInitializer', () => {
2626

2727
buttonActionCreator = new CheckoutButtonStrategyActionCreator(
2828
createCheckoutButtonRegistry(store, createRequestSender(), createFormPoster(), 'en'),
29-
createCheckoutButtonRegistryV2(createPaymentIntegrationService(store)),
29+
createCheckoutButtonRegistryV2(createPaymentIntegrationService(store), {}),
3030
new PaymentMethodActionCreator(new PaymentMethodRequestSender(createRequestSender())),
3131
);
3232

packages/core/src/checkout-buttons/checkout-button-strategy-action-creator.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('CheckoutButtonStrategyActionCreator', () => {
4848
);
4949
strategy = new MockButtonStrategy();
5050
store = createCheckoutStore();
51-
registryV2 = createCheckoutButtonRegistryV2(createPaymentIntegrationService(store));
51+
registryV2 = createCheckoutButtonRegistryV2(createPaymentIntegrationService(store), {});
5252
registry.register(CheckoutButtonMethodType.MASTERPASS, () => strategy);
5353

5454
jest.spyOn(paymentMethodActionCreator, 'loadPaymentMethod').mockReturnValue(() =>

0 commit comments

Comments
 (0)