@imtbl/sdk 1.7.3-alpha.1 → 1.7.3-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blockchain_data.d.ts +288 -449
- package/dist/blockchain_data.js +2 -149
- package/dist/browser/checkout/BridgeWidget-85db50d2.js +1 -0
- package/dist/browser/checkout/OnRampWidget-58400404.js +1 -0
- package/dist/browser/checkout/SaleWidget-549f0f75.js +2 -0
- package/dist/browser/checkout/SpendingCapHero-24fed6d2.js +1 -0
- package/dist/browser/checkout/SwapWidget-9eecba27.js +1 -0
- package/dist/browser/checkout/TopUpView-26964a9e.js +1 -0
- package/dist/browser/checkout/WalletWidget-7e6fed9c.js +1 -0
- package/dist/browser/checkout/auto-track-da38e5a8.js +1 -0
- package/dist/browser/checkout/balance-310539bb.js +1 -0
- package/dist/browser/checkout/index-392bc434.js +1 -0
- package/dist/browser/checkout/index-3d847e0c.js +1 -0
- package/dist/browser/checkout/index-4e77760b.js +773 -0
- package/dist/browser/checkout/index-8184ffea.js +1 -0
- package/dist/browser/checkout/index-919a5df1.js +1 -0
- package/dist/browser/checkout/index-e6159023.js +1 -0
- package/dist/browser/checkout/index-eb42cd09.js +106 -0
- package/dist/browser/checkout/index.umd-c2e32802.js +1 -0
- package/dist/browser/checkout/is-plan-event-enabled-80f76ce6.js +1 -0
- package/dist/browser/checkout/retry-355e44f2.js +1 -0
- package/dist/browser/checkout/sdk.js +4 -4
- package/dist/browser/checkout/useTransakEvents-c6a83ea5.js +2 -0
- package/dist/browser/checkout/widgets-esm.js +1 -0
- package/dist/browser/checkout/widgets.js +50 -51
- package/dist/checkout.d.ts +3 -1
- package/dist/checkout.js +65 -179
- package/dist/config.js +1 -1
- package/dist/index.browser.js +7 -7
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +200 -290
- package/dist/index.d.ts +291 -450
- package/dist/index.js +200 -290
- package/dist/orderbook.js +1 -1
- package/dist/passport.js +136 -239
- package/dist/x.js +2 -2
- package/package.json +1 -1
package/dist/checkout.d.ts
CHANGED
|
@@ -23749,7 +23749,7 @@ type CheckoutWidgetsConfig = {
|
|
|
23749
23749
|
/**
|
|
23750
23750
|
* Represents the configuration options for instantiating the Checkout Widgets factory.
|
|
23751
23751
|
* @property {WidgetConfiguration} config - global configuration options for the widgets.
|
|
23752
|
-
* @property {SemanticVersion | undefined} version - version of the Checkout widgets bundle
|
|
23752
|
+
* @property {SemanticVersion | undefined} version - version of the Checkout widgets bundle(default latest version will be used).
|
|
23753
23753
|
*/
|
|
23754
23754
|
type WidgetsInit = {
|
|
23755
23755
|
config: WidgetConfiguration;
|
|
@@ -23773,6 +23773,8 @@ declare class Checkout {
|
|
|
23773
23773
|
* @param {WidgetsInit} init - The initialisation parameters for loading the widgets bundle and applying configuration
|
|
23774
23774
|
*/
|
|
23775
23775
|
widgets(init: WidgetsInit): Promise<ImmutableCheckoutWidgets.WidgetsFactory>;
|
|
23776
|
+
private loadUmdBundle;
|
|
23777
|
+
private loadEsModules;
|
|
23776
23778
|
/**
|
|
23777
23779
|
* Creates a provider using the given parameters.
|
|
23778
23780
|
* @param {CreateProviderParams} params - The parameters for creating the provider.
|
package/dist/checkout.js
CHANGED
|
@@ -139,7 +139,7 @@ const flattenProperties$1 = (properties) => {
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
142
|
-
const SDK_VERSION$1 = '1.7.3-alpha.
|
|
142
|
+
const SDK_VERSION$1 = '1.7.3-alpha.2';
|
|
143
143
|
const getReferrer$1 = () => {
|
|
144
144
|
if (isNode$1()) {
|
|
145
145
|
return '';
|
|
@@ -17479,7 +17479,7 @@ const flattenProperties = (properties) => {
|
|
|
17479
17479
|
};
|
|
17480
17480
|
|
|
17481
17481
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
17482
|
-
const SDK_VERSION = '1.7.3-alpha.
|
|
17482
|
+
const SDK_VERSION = '1.7.3-alpha.2';
|
|
17483
17483
|
const getReferrer = () => {
|
|
17484
17484
|
if (isNode()) {
|
|
17485
17485
|
return '';
|
|
@@ -24948,85 +24948,6 @@ class NftOwnersApi extends BaseAPI {
|
|
|
24948
24948
|
*/
|
|
24949
24949
|
const NftsApiAxiosParamCreator = function (configuration) {
|
|
24950
24950
|
return {
|
|
24951
|
-
/**
|
|
24952
|
-
* Create a mint request to mint a set of NFTs for a given collection
|
|
24953
|
-
* @summary Mint NFTs
|
|
24954
|
-
* @param {string} contractAddress The address of contract
|
|
24955
|
-
* @param {string} chainName The name of chain
|
|
24956
|
-
* @param {CreateMintRequestRequest} createMintRequestRequest the request body
|
|
24957
|
-
* @param {*} [options] Override http request option.
|
|
24958
|
-
* @throws {RequiredError}
|
|
24959
|
-
*/
|
|
24960
|
-
createMintRequest: async (contractAddress, chainName, createMintRequestRequest, options = {}) => {
|
|
24961
|
-
// verify required parameter 'contractAddress' is not null or undefined
|
|
24962
|
-
assertParamExists('createMintRequest', 'contractAddress', contractAddress);
|
|
24963
|
-
// verify required parameter 'chainName' is not null or undefined
|
|
24964
|
-
assertParamExists('createMintRequest', 'chainName', chainName);
|
|
24965
|
-
// verify required parameter 'createMintRequestRequest' is not null or undefined
|
|
24966
|
-
assertParamExists('createMintRequest', 'createMintRequestRequest', createMintRequestRequest);
|
|
24967
|
-
const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/nfts/mint-requests`
|
|
24968
|
-
.replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
|
|
24969
|
-
.replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
|
|
24970
|
-
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
24971
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
24972
|
-
let baseOptions;
|
|
24973
|
-
if (configuration) {
|
|
24974
|
-
baseOptions = configuration.baseOptions;
|
|
24975
|
-
}
|
|
24976
|
-
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
24977
|
-
const localVarHeaderParameter = {};
|
|
24978
|
-
const localVarQueryParameter = {};
|
|
24979
|
-
// authentication ImmutableApiKey required
|
|
24980
|
-
await setApiKeyToObject(localVarHeaderParameter, "x-immutable-api-key", configuration);
|
|
24981
|
-
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
24982
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
24983
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
24984
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
24985
|
-
localVarRequestOptions.data = serializeDataIfNeeded(createMintRequestRequest, localVarRequestOptions, configuration);
|
|
24986
|
-
return {
|
|
24987
|
-
url: toPathString(localVarUrlObj),
|
|
24988
|
-
options: localVarRequestOptions,
|
|
24989
|
-
};
|
|
24990
|
-
},
|
|
24991
|
-
/**
|
|
24992
|
-
* Retrieve the status of a mint request identified by its reference_id
|
|
24993
|
-
* @summary Mint NFTs
|
|
24994
|
-
* @param {string} contractAddress The address of contract
|
|
24995
|
-
* @param {string} chainName The name of chain
|
|
24996
|
-
* @param {string} referenceId The ID of the mint request
|
|
24997
|
-
* @param {*} [options] Override http request option.
|
|
24998
|
-
* @throws {RequiredError}
|
|
24999
|
-
*/
|
|
25000
|
-
getMintRequest: async (contractAddress, chainName, referenceId, options = {}) => {
|
|
25001
|
-
// verify required parameter 'contractAddress' is not null or undefined
|
|
25002
|
-
assertParamExists('getMintRequest', 'contractAddress', contractAddress);
|
|
25003
|
-
// verify required parameter 'chainName' is not null or undefined
|
|
25004
|
-
assertParamExists('getMintRequest', 'chainName', chainName);
|
|
25005
|
-
// verify required parameter 'referenceId' is not null or undefined
|
|
25006
|
-
assertParamExists('getMintRequest', 'referenceId', referenceId);
|
|
25007
|
-
const localVarPath = `/v1/chains/{chain_name}/collections/{contract_address}/nfts/mint-requests/{reference_id}`
|
|
25008
|
-
.replace(`{${"contract_address"}}`, encodeURIComponent(String(contractAddress)))
|
|
25009
|
-
.replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)))
|
|
25010
|
-
.replace(`{${"reference_id"}}`, encodeURIComponent(String(referenceId)));
|
|
25011
|
-
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
25012
|
-
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
25013
|
-
let baseOptions;
|
|
25014
|
-
if (configuration) {
|
|
25015
|
-
baseOptions = configuration.baseOptions;
|
|
25016
|
-
}
|
|
25017
|
-
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
|
|
25018
|
-
const localVarHeaderParameter = {};
|
|
25019
|
-
const localVarQueryParameter = {};
|
|
25020
|
-
// authentication ImmutableApiKey required
|
|
25021
|
-
await setApiKeyToObject(localVarHeaderParameter, "x-immutable-api-key", configuration);
|
|
25022
|
-
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
25023
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
25024
|
-
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
25025
|
-
return {
|
|
25026
|
-
url: toPathString(localVarUrlObj),
|
|
25027
|
-
options: localVarRequestOptions,
|
|
25028
|
-
};
|
|
25029
|
-
},
|
|
25030
24951
|
/**
|
|
25031
24952
|
* Get NFT by token ID
|
|
25032
24953
|
* @summary Get NFT by token ID
|
|
@@ -25212,32 +25133,6 @@ const NftsApiAxiosParamCreator = function (configuration) {
|
|
|
25212
25133
|
const NftsApiFp = function (configuration) {
|
|
25213
25134
|
const localVarAxiosParamCreator = NftsApiAxiosParamCreator(configuration);
|
|
25214
25135
|
return {
|
|
25215
|
-
/**
|
|
25216
|
-
* Create a mint request to mint a set of NFTs for a given collection
|
|
25217
|
-
* @summary Mint NFTs
|
|
25218
|
-
* @param {string} contractAddress The address of contract
|
|
25219
|
-
* @param {string} chainName The name of chain
|
|
25220
|
-
* @param {CreateMintRequestRequest} createMintRequestRequest the request body
|
|
25221
|
-
* @param {*} [options] Override http request option.
|
|
25222
|
-
* @throws {RequiredError}
|
|
25223
|
-
*/
|
|
25224
|
-
async createMintRequest(contractAddress, chainName, createMintRequestRequest, options) {
|
|
25225
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.createMintRequest(contractAddress, chainName, createMintRequestRequest, options);
|
|
25226
|
-
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
25227
|
-
},
|
|
25228
|
-
/**
|
|
25229
|
-
* Retrieve the status of a mint request identified by its reference_id
|
|
25230
|
-
* @summary Mint NFTs
|
|
25231
|
-
* @param {string} contractAddress The address of contract
|
|
25232
|
-
* @param {string} chainName The name of chain
|
|
25233
|
-
* @param {string} referenceId The ID of the mint request
|
|
25234
|
-
* @param {*} [options] Override http request option.
|
|
25235
|
-
* @throws {RequiredError}
|
|
25236
|
-
*/
|
|
25237
|
-
async getMintRequest(contractAddress, chainName, referenceId, options) {
|
|
25238
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.getMintRequest(contractAddress, chainName, referenceId, options);
|
|
25239
|
-
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
25240
|
-
},
|
|
25241
25136
|
/**
|
|
25242
25137
|
* Get NFT by token ID
|
|
25243
25138
|
* @summary Get NFT by token ID
|
|
@@ -25305,26 +25200,6 @@ const NftsApiFp = function (configuration) {
|
|
|
25305
25200
|
const NftsApiFactory = function (configuration, basePath, axios) {
|
|
25306
25201
|
const localVarFp = NftsApiFp(configuration);
|
|
25307
25202
|
return {
|
|
25308
|
-
/**
|
|
25309
|
-
* Create a mint request to mint a set of NFTs for a given collection
|
|
25310
|
-
* @summary Mint NFTs
|
|
25311
|
-
* @param {NftsApiCreateMintRequestRequest} requestParameters Request parameters.
|
|
25312
|
-
* @param {*} [options] Override http request option.
|
|
25313
|
-
* @throws {RequiredError}
|
|
25314
|
-
*/
|
|
25315
|
-
createMintRequest(requestParameters, options) {
|
|
25316
|
-
return localVarFp.createMintRequest(requestParameters.contractAddress, requestParameters.chainName, requestParameters.createMintRequestRequest, options).then((request) => request(axios, basePath));
|
|
25317
|
-
},
|
|
25318
|
-
/**
|
|
25319
|
-
* Retrieve the status of a mint request identified by its reference_id
|
|
25320
|
-
* @summary Mint NFTs
|
|
25321
|
-
* @param {NftsApiGetMintRequestRequest} requestParameters Request parameters.
|
|
25322
|
-
* @param {*} [options] Override http request option.
|
|
25323
|
-
* @throws {RequiredError}
|
|
25324
|
-
*/
|
|
25325
|
-
getMintRequest(requestParameters, options) {
|
|
25326
|
-
return localVarFp.getMintRequest(requestParameters.contractAddress, requestParameters.chainName, requestParameters.referenceId, options).then((request) => request(axios, basePath));
|
|
25327
|
-
},
|
|
25328
25203
|
/**
|
|
25329
25204
|
* Get NFT by token ID
|
|
25330
25205
|
* @summary Get NFT by token ID
|
|
@@ -25374,28 +25249,6 @@ const NftsApiFactory = function (configuration, basePath, axios) {
|
|
|
25374
25249
|
* @extends {BaseAPI}
|
|
25375
25250
|
*/
|
|
25376
25251
|
class NftsApi extends BaseAPI {
|
|
25377
|
-
/**
|
|
25378
|
-
* Create a mint request to mint a set of NFTs for a given collection
|
|
25379
|
-
* @summary Mint NFTs
|
|
25380
|
-
* @param {NftsApiCreateMintRequestRequest} requestParameters Request parameters.
|
|
25381
|
-
* @param {*} [options] Override http request option.
|
|
25382
|
-
* @throws {RequiredError}
|
|
25383
|
-
* @memberof NftsApi
|
|
25384
|
-
*/
|
|
25385
|
-
createMintRequest(requestParameters, options) {
|
|
25386
|
-
return NftsApiFp(this.configuration).createMintRequest(requestParameters.contractAddress, requestParameters.chainName, requestParameters.createMintRequestRequest, options).then((request) => request(this.axios, this.basePath));
|
|
25387
|
-
}
|
|
25388
|
-
/**
|
|
25389
|
-
* Retrieve the status of a mint request identified by its reference_id
|
|
25390
|
-
* @summary Mint NFTs
|
|
25391
|
-
* @param {NftsApiGetMintRequestRequest} requestParameters Request parameters.
|
|
25392
|
-
* @param {*} [options] Override http request option.
|
|
25393
|
-
* @throws {RequiredError}
|
|
25394
|
-
* @memberof NftsApi
|
|
25395
|
-
*/
|
|
25396
|
-
getMintRequest(requestParameters, options) {
|
|
25397
|
-
return NftsApiFp(this.configuration).getMintRequest(requestParameters.contractAddress, requestParameters.chainName, requestParameters.referenceId, options).then((request) => request(this.axios, this.basePath));
|
|
25398
|
-
}
|
|
25399
25252
|
/**
|
|
25400
25253
|
* Get NFT by token ID
|
|
25401
25254
|
* @summary Get NFT by token ID
|
|
@@ -27872,7 +27725,7 @@ class APIError extends Error {
|
|
|
27872
27725
|
|
|
27873
27726
|
/* eslint-disable implicit-arrow-linebreak */
|
|
27874
27727
|
const defaultHeaders = {
|
|
27875
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.7.3-alpha.
|
|
27728
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.7.3-alpha.2',
|
|
27876
27729
|
};
|
|
27877
27730
|
/**
|
|
27878
27731
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -29239,7 +29092,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
29239
29092
|
maxPriorityFeePerGas: BigNumber$1.from(10e9),
|
|
29240
29093
|
};
|
|
29241
29094
|
|
|
29242
|
-
const SDK_VERSION_MARKER = '1.7.3-alpha.
|
|
29095
|
+
const SDK_VERSION_MARKER = '1.7.3-alpha.2';
|
|
29243
29096
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
29244
29097
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
29245
29098
|
|
|
@@ -32859,27 +32712,25 @@ function validateAndBuildVersion(version) {
|
|
|
32859
32712
|
return validatedVersion;
|
|
32860
32713
|
}
|
|
32861
32714
|
|
|
32862
|
-
|
|
32715
|
+
// Loads the checkout widgets bundle from the CDN and appends the script to the document head
|
|
32716
|
+
function loadUnresolvedBundle(tag, scriptId, validVersion) {
|
|
32863
32717
|
if (window === undefined) {
|
|
32864
32718
|
throw new Error('missing window object: please run Checkout client side');
|
|
32865
32719
|
}
|
|
32866
32720
|
if (document === undefined) {
|
|
32867
32721
|
throw new Error('missing document object: please run Checkout client side');
|
|
32868
32722
|
}
|
|
32869
|
-
const scriptId = 'immutable-checkout-widgets-bundle';
|
|
32870
|
-
const validVersion = validateAndBuildVersion(version);
|
|
32871
|
-
// Prevent the script to be loaded more than once
|
|
32872
|
-
// by checking the presence of the script and its version.
|
|
32873
|
-
const initScript = document.getElementById(scriptId);
|
|
32874
|
-
if (initScript)
|
|
32875
|
-
return { loaded: true, element: initScript };
|
|
32876
|
-
const tag = document.createElement('script');
|
|
32877
32723
|
let cdnUrl = `https://cdn.jsdelivr.net/npm/@imtbl/sdk@${validVersion}/dist/browser/checkout/widgets.js`;
|
|
32878
32724
|
tag.setAttribute('id', scriptId);
|
|
32879
32725
|
tag.setAttribute('data-version', validVersion);
|
|
32880
32726
|
tag.setAttribute('src', cdnUrl);
|
|
32881
32727
|
document.head.appendChild(tag);
|
|
32882
|
-
|
|
32728
|
+
}
|
|
32729
|
+
// Gets the CDN url for the split checkout widgets bundle
|
|
32730
|
+
function getWidgetsEsmUrl(version) {
|
|
32731
|
+
const validVersion = validateAndBuildVersion(version);
|
|
32732
|
+
let cdnUrl = `https://cdn.jsdelivr.net/npm/@imtbl/sdk@${validVersion}/dist/browser/checkout/widgets-esm.js`;
|
|
32733
|
+
return cdnUrl;
|
|
32883
32734
|
}
|
|
32884
32735
|
|
|
32885
32736
|
const PUBLISHABLE_KEY_PREFIX = 'pk_imapik-';
|
|
@@ -32958,7 +32809,6 @@ const SANDBOX_CONFIGURATION = {
|
|
|
32958
32809
|
},
|
|
32959
32810
|
passport: undefined,
|
|
32960
32811
|
};
|
|
32961
|
-
const WIDGETS_SCRIPT_TIMEOUT = 100;
|
|
32962
32812
|
// Checkout SDK
|
|
32963
32813
|
class Checkout {
|
|
32964
32814
|
readOnlyProviders;
|
|
@@ -32988,26 +32838,44 @@ class Checkout {
|
|
|
32988
32838
|
const checkout = this;
|
|
32989
32839
|
// Preload the configurations
|
|
32990
32840
|
await checkout.config.remote.getConfig();
|
|
32841
|
+
try {
|
|
32842
|
+
const factory = await this.loadEsModules(init.config, init.version);
|
|
32843
|
+
return factory;
|
|
32844
|
+
}
|
|
32845
|
+
catch (err) {
|
|
32846
|
+
throw new CheckoutError('Failed to load widgets script', CheckoutErrorType.WIDGETS_SCRIPT_LOAD_ERROR, { error: err });
|
|
32847
|
+
}
|
|
32848
|
+
}
|
|
32849
|
+
async loadUmdBundle(config, version) {
|
|
32850
|
+
const checkout = this;
|
|
32991
32851
|
const factory = new Promise((resolve, reject) => {
|
|
32992
|
-
function checkForWidgetsBundleLoaded() {
|
|
32993
|
-
if (typeof ImmutableCheckoutWidgets !== 'undefined') {
|
|
32994
|
-
resolve(new ImmutableCheckoutWidgets.WidgetsFactory(checkout, init.config));
|
|
32995
|
-
}
|
|
32996
|
-
else {
|
|
32997
|
-
// If ImmutableCheckoutWidgets is not defined, wait for set amount of time.
|
|
32998
|
-
// When time has elapsed, check again if ImmutableCheckoutWidgets is defined.
|
|
32999
|
-
// Once it's defined, the promise will resolve and setTimeout won't be called again.
|
|
33000
|
-
setTimeout(checkForWidgetsBundleLoaded, WIDGETS_SCRIPT_TIMEOUT);
|
|
33001
|
-
}
|
|
33002
|
-
}
|
|
33003
32852
|
try {
|
|
33004
|
-
const
|
|
33005
|
-
|
|
33006
|
-
|
|
33007
|
-
|
|
33008
|
-
|
|
33009
|
-
|
|
32853
|
+
const scriptId = 'immutable-checkout-widgets-bundle';
|
|
32854
|
+
const validVersion = validateAndBuildVersion(version);
|
|
32855
|
+
// Prevent the script to be loaded more than once
|
|
32856
|
+
// by checking the presence of the script and its version.
|
|
32857
|
+
const initScript = document.getElementById(scriptId);
|
|
32858
|
+
if (initScript) {
|
|
32859
|
+
if (typeof ImmutableCheckoutWidgets !== 'undefined') {
|
|
32860
|
+
resolve(new ImmutableCheckoutWidgets.WidgetsFactory(checkout, config));
|
|
32861
|
+
}
|
|
32862
|
+
else {
|
|
32863
|
+
reject(new CheckoutError('Failed to find ImmutableCheckoutWidgets script', CheckoutErrorType.WIDGETS_SCRIPT_LOAD_ERROR));
|
|
32864
|
+
}
|
|
33010
32865
|
}
|
|
32866
|
+
const tag = document.createElement('script');
|
|
32867
|
+
tag.addEventListener('load', () => {
|
|
32868
|
+
if (typeof ImmutableCheckoutWidgets !== 'undefined') {
|
|
32869
|
+
resolve(new ImmutableCheckoutWidgets.WidgetsFactory(checkout, config));
|
|
32870
|
+
}
|
|
32871
|
+
else {
|
|
32872
|
+
reject(new CheckoutError('Failed to find ImmutableCheckoutWidgets script', CheckoutErrorType.WIDGETS_SCRIPT_LOAD_ERROR));
|
|
32873
|
+
}
|
|
32874
|
+
});
|
|
32875
|
+
tag.addEventListener('error', (err) => {
|
|
32876
|
+
reject(new CheckoutError('Failed to load widgets script', CheckoutErrorType.WIDGETS_SCRIPT_LOAD_ERROR, { error: err }));
|
|
32877
|
+
});
|
|
32878
|
+
loadUnresolvedBundle(tag, scriptId, validVersion);
|
|
33011
32879
|
}
|
|
33012
32880
|
catch (err) {
|
|
33013
32881
|
reject(new CheckoutError('Failed to load widgets script', CheckoutErrorType.WIDGETS_SCRIPT_LOAD_ERROR, { error: err }));
|
|
@@ -33015,6 +32883,24 @@ class Checkout {
|
|
|
33015
32883
|
});
|
|
33016
32884
|
return factory;
|
|
33017
32885
|
}
|
|
32886
|
+
async loadEsModules(config, version) {
|
|
32887
|
+
const checkout = this;
|
|
32888
|
+
try {
|
|
32889
|
+
const cdnUrl = getWidgetsEsmUrl(version);
|
|
32890
|
+
// WebpackIgnore comment required to prevent webpack modifying the import statement and
|
|
32891
|
+
// breaking the dynamic import in certain applications integrating checkout
|
|
32892
|
+
const checkoutWidgetsModule = await import(/* webpackIgnore: true */ cdnUrl);
|
|
32893
|
+
if (checkoutWidgetsModule && checkoutWidgetsModule.WidgetsFactory) {
|
|
32894
|
+
return new checkoutWidgetsModule.WidgetsFactory(checkout, config);
|
|
32895
|
+
}
|
|
32896
|
+
}
|
|
32897
|
+
catch (err) {
|
|
32898
|
+
// eslint-disable-next-line no-console
|
|
32899
|
+
console.warn(`Failed to resolve checkout widgets module, falling back to UMD bundle. Error: ${err.message}`);
|
|
32900
|
+
}
|
|
32901
|
+
// Fallback to UMD bundle if esm bundle fails to load
|
|
32902
|
+
return await checkout.loadUmdBundle(config, version);
|
|
32903
|
+
}
|
|
33018
32904
|
/**
|
|
33019
32905
|
* Creates a provider using the given parameters.
|
|
33020
32906
|
* @param {CreateProviderParams} params - The parameters for creating the provider.
|
package/dist/config.js
CHANGED
|
@@ -128,7 +128,7 @@ const flattenProperties = (properties) => {
|
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
131
|
-
const SDK_VERSION = '1.7.3-alpha.
|
|
131
|
+
const SDK_VERSION = '1.7.3-alpha.2';
|
|
132
132
|
const getReferrer = () => {
|
|
133
133
|
if (isNode()) {
|
|
134
134
|
return '';
|