@imtbl/sdk 1.5.3 → 1.5.4-alpha.1

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.
Files changed (36) hide show
  1. package/dist/blockchain_data.js +2 -2
  2. package/dist/browser/checkout/BridgeWidget-895c2ff8.js +1 -0
  3. package/dist/browser/checkout/OnRampWidget-93e6c462.js +1 -0
  4. package/dist/browser/checkout/SaleWidget-af43a403.js +2 -0
  5. package/dist/browser/checkout/SpendingCapHero-03968ac0.js +1 -0
  6. package/dist/browser/checkout/SwapWidget-61e779d8.js +1 -0
  7. package/dist/browser/checkout/TopUpView-09a61709.js +1 -0
  8. package/dist/browser/checkout/WalletWidget-68b65814.js +1 -0
  9. package/dist/browser/checkout/auto-track-7c8945e1.js +1 -0
  10. package/dist/browser/checkout/balance-5343fb20.js +1 -0
  11. package/dist/browser/checkout/index-2657c3d3.js +1 -0
  12. package/dist/browser/checkout/index-2c059c42.js +1 -0
  13. package/dist/browser/checkout/index-3ef57b96.js +1 -0
  14. package/dist/browser/checkout/index-8130cf40.js +106 -0
  15. package/dist/browser/checkout/index-a12ebc45.js +1 -0
  16. package/dist/browser/checkout/index-d949d325.js +1 -0
  17. package/dist/browser/checkout/index-f2726576.js +773 -0
  18. package/dist/browser/checkout/index.umd-31af21e6.js +1 -0
  19. package/dist/browser/checkout/is-plan-event-enabled-80f76ce6.js +1 -0
  20. package/dist/browser/checkout/retry-07d04bc8.js +1 -0
  21. package/dist/browser/checkout/sdk.js +4 -4
  22. package/dist/browser/checkout/useTransakEvents-33875f8a.js +2 -0
  23. package/dist/browser/checkout/widgets-esm.js +1 -0
  24. package/dist/browser/checkout/widgets.js +50 -51
  25. package/dist/checkout.d.ts +4 -1
  26. package/dist/checkout.js +30 -6
  27. package/dist/config.js +1 -1
  28. package/dist/index.browser.js +4 -4
  29. package/dist/index.browser.js.map +1 -1
  30. package/dist/index.cjs +32 -8
  31. package/dist/index.d.ts +4 -1
  32. package/dist/index.js +32 -8
  33. package/dist/orderbook.js +1 -1
  34. package/dist/passport.js +3 -3
  35. package/dist/x.js +2 -2
  36. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -174,7 +174,7 @@ const flattenProperties$1 = (properties) => {
174
174
  };
175
175
 
176
176
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
177
- const SDK_VERSION$1 = '1.5.3';
177
+ const SDK_VERSION$1 = '1.5.4-alpha.1';
178
178
  const getReferrer$1 = () => {
179
179
  if (isNode$1()) {
180
180
  return '';
@@ -11289,7 +11289,7 @@ class MultiRollupApiClients {
11289
11289
  }
11290
11290
 
11291
11291
  // eslint-disable-next-line @typescript-eslint/naming-convention
11292
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.5.3' };
11292
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.5.4-alpha.1' };
11293
11293
  const createConfig = ({ basePath, headers, }) => {
11294
11294
  if (!basePath.trim()) {
11295
11295
  throw Error('basePath can not be empty');
@@ -11361,7 +11361,7 @@ class APIError extends Error {
11361
11361
 
11362
11362
  /* eslint-disable implicit-arrow-linebreak */
11363
11363
  const defaultHeaders = {
11364
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.5.3',
11364
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.5.4-alpha.1',
11365
11365
  };
11366
11366
  /**
11367
11367
  * createAPIConfiguration to create a custom Configuration
@@ -11794,7 +11794,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
11794
11794
  chainID,
11795
11795
  coreContractAddress,
11796
11796
  registrationContractAddress,
11797
- sdkVersion: 'ts-immutable-sdk-1.5.3',
11797
+ sdkVersion: 'ts-immutable-sdk-1.5.4-alpha.1',
11798
11798
  });
11799
11799
  /**
11800
11800
  * Sets `sdkVersion` at the time of build
@@ -37448,7 +37448,7 @@ const flattenProperties = (properties) => {
37448
37448
  };
37449
37449
 
37450
37450
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
37451
- const SDK_VERSION = '1.5.3';
37451
+ const SDK_VERSION = '1.5.4-alpha.1';
37452
37452
  const getReferrer = () => {
37453
37453
  if (isNode()) {
37454
37454
  return '';
@@ -42615,7 +42615,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
42615
42615
  maxPriorityFeePerGas: ethers.BigNumber.from(10e9),
42616
42616
  };
42617
42617
 
42618
- const SDK_VERSION_MARKER = '1.5.3';
42618
+ const SDK_VERSION_MARKER = '1.5.4-alpha.1';
42619
42619
  // This SDK version is replaced by the `yarn build` command ran on the root level
42620
42620
  const globalPackageVersion = () => SDK_VERSION_MARKER;
42621
42621
 
@@ -46230,7 +46230,8 @@ function validateAndBuildVersion(version) {
46230
46230
  return validatedVersion;
46231
46231
  }
46232
46232
 
46233
- function loadUnresolved(version) {
46233
+ // Loads the checkout widgets bundle from the CDN and appends the script to the document head
46234
+ function loadUnresolvedBundle(version) {
46234
46235
  if (window === undefined) {
46235
46236
  throw new Error('missing window object: please run Checkout client side');
46236
46237
  }
@@ -46252,6 +46253,12 @@ function loadUnresolved(version) {
46252
46253
  document.head.appendChild(tag);
46253
46254
  return { loaded: false, element: tag };
46254
46255
  }
46256
+ // Gets the CDN url for the split checkout widgets bundle
46257
+ function getCdnUrl(version) {
46258
+ const validVersion = validateAndBuildVersion(version);
46259
+ let cdnUrl = `https://cdn.jsdelivr.net/npm/@imtbl/sdk@${validVersion}/dist/browser/checkout/widgets-esm.js`;
46260
+ return cdnUrl;
46261
+ }
46255
46262
 
46256
46263
  const PUBLISHABLE_KEY_PREFIX = 'pk_imapik-';
46257
46264
  const publishableKeyDomainAllowlist = [
@@ -46359,6 +46366,23 @@ class Checkout {
46359
46366
  const checkout = this;
46360
46367
  // Preload the configurations
46361
46368
  await checkout.config.remote.getConfig();
46369
+ // Resolves the factory for the esm build of the widgets
46370
+ if (init.useEsModules) {
46371
+ const cdnUrl = getCdnUrl(init.version);
46372
+ // WebpackIgnore comment required to prevent webpack modifying the import statement and
46373
+ // breaking the dynamic import in certain applications integrating checkout
46374
+ const checkoutWidgetsModule = await import(/* webpackIgnore: true */ cdnUrl);
46375
+ const factory = new Promise((resolve, reject) => {
46376
+ if (checkoutWidgetsModule && checkoutWidgetsModule.WidgetsFactory) {
46377
+ resolve(new checkoutWidgetsModule.WidgetsFactory(checkout, init.config));
46378
+ }
46379
+ else {
46380
+ reject(new CheckoutError('Unable to resolve the WidgetsFactory from the checkout widgets module', CheckoutErrorType.WIDGETS_SCRIPT_LOAD_ERROR));
46381
+ }
46382
+ });
46383
+ return factory;
46384
+ }
46385
+ // Resolves the factory for the umd build of the widgets
46362
46386
  const factory = new Promise((resolve, reject) => {
46363
46387
  function checkForWidgetsBundleLoaded() {
46364
46388
  if (typeof ImmutableCheckoutWidgets !== 'undefined') {
@@ -46372,7 +46396,7 @@ class Checkout {
46372
46396
  }
46373
46397
  }
46374
46398
  try {
46375
- const script = loadUnresolved(init.version);
46399
+ const script = loadUnresolvedBundle(init.version);
46376
46400
  if (script.loaded && typeof ImmutableCheckoutWidgets !== 'undefined') {
46377
46401
  resolve(new ImmutableCheckoutWidgets.WidgetsFactory(checkout, init.config));
46378
46402
  }
package/dist/index.d.ts CHANGED
@@ -32213,11 +32213,14 @@ type CheckoutWidgetsConfig = {
32213
32213
  /**
32214
32214
  * Represents the configuration options for instantiating the Checkout Widgets factory.
32215
32215
  * @property {WidgetConfiguration} config - global configuration options for the widgets.
32216
- * @property {SemanticVersion | undefined} version - version of the Checkout widgets bundle (default latest version will be used).
32216
+ * @property {SemanticVersion | undefined} version - version of the Checkout widgets bundle(default latest version will be used).
32217
+ * @property {boolean | undefined} useEsModules - Set to true to use the esm build of the widgets.
32217
32218
  */
32218
32219
  type WidgetsInit = {
32219
32220
  config: WidgetConfiguration;
32220
32221
  version?: SemanticVersion;
32222
+ /** Loads separate parts of the widget script as required for performance improvements. */
32223
+ useEsModules?: boolean;
32221
32224
  };
32222
32225
 
32223
32226
  declare class Checkout {
package/dist/index.js CHANGED
@@ -152,7 +152,7 @@ const flattenProperties$1 = (properties) => {
152
152
  };
153
153
 
154
154
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
155
- const SDK_VERSION$1 = '1.5.3';
155
+ const SDK_VERSION$1 = '1.5.4-alpha.1';
156
156
  const getReferrer$1 = () => {
157
157
  if (isNode$1()) {
158
158
  return '';
@@ -11267,7 +11267,7 @@ class MultiRollupApiClients {
11267
11267
  }
11268
11268
 
11269
11269
  // eslint-disable-next-line @typescript-eslint/naming-convention
11270
- const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.5.3' };
11270
+ const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.5.4-alpha.1' };
11271
11271
  const createConfig = ({ basePath, headers, }) => {
11272
11272
  if (!basePath.trim()) {
11273
11273
  throw Error('basePath can not be empty');
@@ -11339,7 +11339,7 @@ class APIError extends Error {
11339
11339
 
11340
11340
  /* eslint-disable implicit-arrow-linebreak */
11341
11341
  const defaultHeaders = {
11342
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.5.3',
11342
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.5.4-alpha.1',
11343
11343
  };
11344
11344
  /**
11345
11345
  * createAPIConfiguration to create a custom Configuration
@@ -11772,7 +11772,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
11772
11772
  chainID,
11773
11773
  coreContractAddress,
11774
11774
  registrationContractAddress,
11775
- sdkVersion: 'ts-immutable-sdk-1.5.3',
11775
+ sdkVersion: 'ts-immutable-sdk-1.5.4-alpha.1',
11776
11776
  });
11777
11777
  /**
11778
11778
  * Sets `sdkVersion` at the time of build
@@ -37426,7 +37426,7 @@ const flattenProperties = (properties) => {
37426
37426
  };
37427
37427
 
37428
37428
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
37429
- const SDK_VERSION = '1.5.3';
37429
+ const SDK_VERSION = '1.5.4-alpha.1';
37430
37430
  const getReferrer = () => {
37431
37431
  if (isNode()) {
37432
37432
  return '';
@@ -42593,7 +42593,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
42593
42593
  maxPriorityFeePerGas: BigNumber$1.from(10e9),
42594
42594
  };
42595
42595
 
42596
- const SDK_VERSION_MARKER = '1.5.3';
42596
+ const SDK_VERSION_MARKER = '1.5.4-alpha.1';
42597
42597
  // This SDK version is replaced by the `yarn build` command ran on the root level
42598
42598
  const globalPackageVersion = () => SDK_VERSION_MARKER;
42599
42599
 
@@ -46208,7 +46208,8 @@ function validateAndBuildVersion(version) {
46208
46208
  return validatedVersion;
46209
46209
  }
46210
46210
 
46211
- function loadUnresolved(version) {
46211
+ // Loads the checkout widgets bundle from the CDN and appends the script to the document head
46212
+ function loadUnresolvedBundle(version) {
46212
46213
  if (window === undefined) {
46213
46214
  throw new Error('missing window object: please run Checkout client side');
46214
46215
  }
@@ -46230,6 +46231,12 @@ function loadUnresolved(version) {
46230
46231
  document.head.appendChild(tag);
46231
46232
  return { loaded: false, element: tag };
46232
46233
  }
46234
+ // Gets the CDN url for the split checkout widgets bundle
46235
+ function getCdnUrl(version) {
46236
+ const validVersion = validateAndBuildVersion(version);
46237
+ let cdnUrl = `https://cdn.jsdelivr.net/npm/@imtbl/sdk@${validVersion}/dist/browser/checkout/widgets-esm.js`;
46238
+ return cdnUrl;
46239
+ }
46233
46240
 
46234
46241
  const PUBLISHABLE_KEY_PREFIX = 'pk_imapik-';
46235
46242
  const publishableKeyDomainAllowlist = [
@@ -46337,6 +46344,23 @@ class Checkout {
46337
46344
  const checkout = this;
46338
46345
  // Preload the configurations
46339
46346
  await checkout.config.remote.getConfig();
46347
+ // Resolves the factory for the esm build of the widgets
46348
+ if (init.useEsModules) {
46349
+ const cdnUrl = getCdnUrl(init.version);
46350
+ // WebpackIgnore comment required to prevent webpack modifying the import statement and
46351
+ // breaking the dynamic import in certain applications integrating checkout
46352
+ const checkoutWidgetsModule = await import(/* webpackIgnore: true */ cdnUrl);
46353
+ const factory = new Promise((resolve, reject) => {
46354
+ if (checkoutWidgetsModule && checkoutWidgetsModule.WidgetsFactory) {
46355
+ resolve(new checkoutWidgetsModule.WidgetsFactory(checkout, init.config));
46356
+ }
46357
+ else {
46358
+ reject(new CheckoutError('Unable to resolve the WidgetsFactory from the checkout widgets module', CheckoutErrorType.WIDGETS_SCRIPT_LOAD_ERROR));
46359
+ }
46360
+ });
46361
+ return factory;
46362
+ }
46363
+ // Resolves the factory for the umd build of the widgets
46340
46364
  const factory = new Promise((resolve, reject) => {
46341
46365
  function checkForWidgetsBundleLoaded() {
46342
46366
  if (typeof ImmutableCheckoutWidgets !== 'undefined') {
@@ -46350,7 +46374,7 @@ class Checkout {
46350
46374
  }
46351
46375
  }
46352
46376
  try {
46353
- const script = loadUnresolved(init.version);
46377
+ const script = loadUnresolvedBundle(init.version);
46354
46378
  if (script.loaded && typeof ImmutableCheckoutWidgets !== 'undefined') {
46355
46379
  resolve(new ImmutableCheckoutWidgets.WidgetsFactory(checkout, init.config));
46356
46380
  }
package/dist/orderbook.js CHANGED
@@ -131,7 +131,7 @@ const flattenProperties = (properties) => {
131
131
  };
132
132
 
133
133
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
134
- const SDK_VERSION = '1.5.3';
134
+ const SDK_VERSION = '1.5.4-alpha.1';
135
135
  const getReferrer = () => {
136
136
  if (isNode()) {
137
137
  return '';
package/dist/passport.js CHANGED
@@ -9138,7 +9138,7 @@ class MultiRollupApiClients {
9138
9138
  }
9139
9139
 
9140
9140
  // eslint-disable-next-line @typescript-eslint/naming-convention
9141
- const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.5.3' };
9141
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.5.4-alpha.1' };
9142
9142
  const createConfig = ({ basePath, headers, }) => {
9143
9143
  if (!basePath.trim()) {
9144
9144
  throw Error('basePath can not be empty');
@@ -9317,7 +9317,7 @@ const flattenProperties = (properties) => {
9317
9317
  };
9318
9318
 
9319
9319
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
9320
- const SDK_VERSION = '1.5.3';
9320
+ const SDK_VERSION = '1.5.4-alpha.1';
9321
9321
  const getReferrer = () => {
9322
9322
  if (isNode()) {
9323
9323
  return '';
@@ -9529,7 +9529,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
9529
9529
  chainID,
9530
9530
  coreContractAddress,
9531
9531
  registrationContractAddress,
9532
- sdkVersion: 'ts-immutable-sdk-1.5.3',
9532
+ sdkVersion: 'ts-immutable-sdk-1.5.4-alpha.1',
9533
9533
  });
9534
9534
  /**
9535
9535
  * Sets `sdkVersion` at the time of build
package/dist/x.js CHANGED
@@ -136,7 +136,7 @@ const flattenProperties = (properties) => {
136
136
  };
137
137
 
138
138
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
139
- const SDK_VERSION = '1.5.3';
139
+ const SDK_VERSION = '1.5.4-alpha.1';
140
140
  const getReferrer = () => {
141
141
  if (isNode()) {
142
142
  return '';
@@ -327,7 +327,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
327
327
  chainID,
328
328
  coreContractAddress,
329
329
  registrationContractAddress,
330
- sdkVersion: 'ts-immutable-sdk-1.5.3',
330
+ sdkVersion: 'ts-immutable-sdk-1.5.4-alpha.1',
331
331
  });
332
332
  /**
333
333
  * Sets `sdkVersion` at the time of build
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imtbl/sdk",
3
3
  "description": "Immutable Unified SDK",
4
- "version": "1.5.3",
4
+ "version": "1.5.4-alpha.1",
5
5
  "author": "Immutable",
6
6
  "browser": "./dist/index.browser.js",
7
7
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",