@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
@@ -23736,11 +23736,14 @@ type CheckoutWidgetsConfig = {
23736
23736
  /**
23737
23737
  * Represents the configuration options for instantiating the Checkout Widgets factory.
23738
23738
  * @property {WidgetConfiguration} config - global configuration options for the widgets.
23739
- * @property {SemanticVersion | undefined} version - version of the Checkout widgets bundle (default latest version will be used).
23739
+ * @property {SemanticVersion | undefined} version - version of the Checkout widgets bundle(default latest version will be used).
23740
+ * @property {boolean | undefined} useEsModules - Set to true to use the esm build of the widgets.
23740
23741
  */
23741
23742
  type WidgetsInit = {
23742
23743
  config: WidgetConfiguration;
23743
23744
  version?: SemanticVersion;
23745
+ /** Loads separate parts of the widget script as required for performance improvements. */
23746
+ useEsModules?: boolean;
23744
23747
  };
23745
23748
 
23746
23749
  declare class Checkout {
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.5.3';
142
+ const SDK_VERSION$1 = '1.5.4-alpha.1';
143
143
  const getReferrer$1 = () => {
144
144
  if (isNode$1()) {
145
145
  return '';
@@ -17478,7 +17478,7 @@ const flattenProperties = (properties) => {
17478
17478
  };
17479
17479
 
17480
17480
  // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
17481
- const SDK_VERSION = '1.5.3';
17481
+ const SDK_VERSION = '1.5.4-alpha.1';
17482
17482
  const getReferrer = () => {
17483
17483
  if (isNode()) {
17484
17484
  return '';
@@ -27715,7 +27715,7 @@ class APIError extends Error {
27715
27715
 
27716
27716
  /* eslint-disable implicit-arrow-linebreak */
27717
27717
  const defaultHeaders = {
27718
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.5.3',
27718
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.5.4-alpha.1',
27719
27719
  };
27720
27720
  /**
27721
27721
  * createAPIConfiguration to create a custom Configuration
@@ -29082,7 +29082,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
29082
29082
  maxPriorityFeePerGas: BigNumber$1.from(10e9),
29083
29083
  };
29084
29084
 
29085
- const SDK_VERSION_MARKER = '1.5.3';
29085
+ const SDK_VERSION_MARKER = '1.5.4-alpha.1';
29086
29086
  // This SDK version is replaced by the `yarn build` command ran on the root level
29087
29087
  const globalPackageVersion = () => SDK_VERSION_MARKER;
29088
29088
 
@@ -32697,7 +32697,8 @@ function validateAndBuildVersion(version) {
32697
32697
  return validatedVersion;
32698
32698
  }
32699
32699
 
32700
- function loadUnresolved(version) {
32700
+ // Loads the checkout widgets bundle from the CDN and appends the script to the document head
32701
+ function loadUnresolvedBundle(version) {
32701
32702
  if (window === undefined) {
32702
32703
  throw new Error('missing window object: please run Checkout client side');
32703
32704
  }
@@ -32719,6 +32720,12 @@ function loadUnresolved(version) {
32719
32720
  document.head.appendChild(tag);
32720
32721
  return { loaded: false, element: tag };
32721
32722
  }
32723
+ // Gets the CDN url for the split checkout widgets bundle
32724
+ function getCdnUrl(version) {
32725
+ const validVersion = validateAndBuildVersion(version);
32726
+ let cdnUrl = `https://cdn.jsdelivr.net/npm/@imtbl/sdk@${validVersion}/dist/browser/checkout/widgets-esm.js`;
32727
+ return cdnUrl;
32728
+ }
32722
32729
 
32723
32730
  const PUBLISHABLE_KEY_PREFIX = 'pk_imapik-';
32724
32731
  const publishableKeyDomainAllowlist = [
@@ -32826,6 +32833,23 @@ class Checkout {
32826
32833
  const checkout = this;
32827
32834
  // Preload the configurations
32828
32835
  await checkout.config.remote.getConfig();
32836
+ // Resolves the factory for the esm build of the widgets
32837
+ if (init.useEsModules) {
32838
+ const cdnUrl = getCdnUrl(init.version);
32839
+ // WebpackIgnore comment required to prevent webpack modifying the import statement and
32840
+ // breaking the dynamic import in certain applications integrating checkout
32841
+ const checkoutWidgetsModule = await import(/* webpackIgnore: true */ cdnUrl);
32842
+ const factory = new Promise((resolve, reject) => {
32843
+ if (checkoutWidgetsModule && checkoutWidgetsModule.WidgetsFactory) {
32844
+ resolve(new checkoutWidgetsModule.WidgetsFactory(checkout, init.config));
32845
+ }
32846
+ else {
32847
+ reject(new CheckoutError('Unable to resolve the WidgetsFactory from the checkout widgets module', CheckoutErrorType.WIDGETS_SCRIPT_LOAD_ERROR));
32848
+ }
32849
+ });
32850
+ return factory;
32851
+ }
32852
+ // Resolves the factory for the umd build of the widgets
32829
32853
  const factory = new Promise((resolve, reject) => {
32830
32854
  function checkForWidgetsBundleLoaded() {
32831
32855
  if (typeof ImmutableCheckoutWidgets !== 'undefined') {
@@ -32839,7 +32863,7 @@ class Checkout {
32839
32863
  }
32840
32864
  }
32841
32865
  try {
32842
- const script = loadUnresolved(init.version);
32866
+ const script = loadUnresolvedBundle(init.version);
32843
32867
  if (script.loaded && typeof ImmutableCheckoutWidgets !== 'undefined') {
32844
32868
  resolve(new ImmutableCheckoutWidgets.WidgetsFactory(checkout, init.config));
32845
32869
  }
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.5.3';
131
+ const SDK_VERSION = '1.5.4-alpha.1';
132
132
  const getReferrer = () => {
133
133
  if (isNode()) {
134
134
  return '';