@imtbl/sdk 1.5.4 → 1.6.0-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 (37) hide show
  1. package/dist/blockchain_data.d.ts +39 -91
  2. package/dist/blockchain_data.js +15 -7
  3. package/dist/browser/checkout/BridgeWidget-38c8cacb.js +1 -0
  4. package/dist/browser/checkout/OnRampWidget-1c8e54ce.js +1 -0
  5. package/dist/browser/checkout/SaleWidget-cc5aa51c.js +2 -0
  6. package/dist/browser/checkout/SpendingCapHero-fdeb2fc6.js +1 -0
  7. package/dist/browser/checkout/SwapWidget-acbacee2.js +1 -0
  8. package/dist/browser/checkout/TopUpView-a4425aa3.js +1 -0
  9. package/dist/browser/checkout/WalletWidget-4528b0a7.js +1 -0
  10. package/dist/browser/checkout/auto-track-c91d2967.js +1 -0
  11. package/dist/browser/checkout/balance-17fd7166.js +1 -0
  12. package/dist/browser/checkout/index-008f3a1f.js +1 -0
  13. package/dist/browser/checkout/index-1b56d53b.js +1 -0
  14. package/dist/browser/checkout/index-1ba3ec23.js +106 -0
  15. package/dist/browser/checkout/index-21a40c88.js +1 -0
  16. package/dist/browser/checkout/index-5728dc7e.js +1 -0
  17. package/dist/browser/checkout/index-bc18091f.js +773 -0
  18. package/dist/browser/checkout/index-e5599662.js +1 -0
  19. package/dist/browser/checkout/index.umd-fb0326ca.js +1 -0
  20. package/dist/browser/checkout/is-plan-event-enabled-80f76ce6.js +1 -0
  21. package/dist/browser/checkout/retry-2fc63d32.js +1 -0
  22. package/dist/browser/checkout/sdk.js +4 -4
  23. package/dist/browser/checkout/useTransakEvents-140c22fb.js +2 -0
  24. package/dist/browser/checkout/widgets-esm.js +1 -0
  25. package/dist/browser/checkout/widgets.js +50 -51
  26. package/dist/checkout.d.ts +3 -1
  27. package/dist/checkout.js +56 -13
  28. package/dist/config.js +1 -1
  29. package/dist/index.browser.js +4 -4
  30. package/dist/index.browser.js.map +1 -1
  31. package/dist/index.cjs +59 -16
  32. package/dist/index.d.ts +42 -92
  33. package/dist/index.js +59 -16
  34. package/dist/orderbook.js +1 -1
  35. package/dist/passport.js +16 -8
  36. package/dist/x.js +2 -2
  37. package/package.json +1 -1
@@ -23736,7 +23736,7 @@ 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
23740
  */
23741
23741
  type WidgetsInit = {
23742
23742
  config: WidgetConfiguration;
@@ -23760,6 +23760,8 @@ declare class Checkout {
23760
23760
  * @param {WidgetsInit} init - The initialisation parameters for loading the widgets bundle and applying configuration
23761
23761
  */
23762
23762
  widgets(init: WidgetsInit): Promise<ImmutableCheckoutWidgets.WidgetsFactory>;
23763
+ private loadUmdBundle;
23764
+ private loadEsModules;
23763
23765
  /**
23764
23766
  * Creates a provider using the given parameters.
23765
23767
  * @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.5.4';
142
+ const SDK_VERSION$1 = '1.6.0-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.4';
17481
+ const SDK_VERSION = '1.6.0-alpha.1';
17482
17482
  const getReferrer = () => {
17483
17483
  if (isNode()) {
17484
17484
  return '';
@@ -24029,6 +24029,9 @@ const CollectionsApiAxiosParamCreator = function (configuration) {
24029
24029
  const localVarQueryParameter = {};
24030
24030
  // authentication ImmutableApiKey required
24031
24031
  await setApiKeyToObject(localVarHeaderParameter, "x-immutable-api-key", configuration);
24032
+ // authentication BearerAuth required
24033
+ // http bearer authentication required
24034
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
24032
24035
  localVarHeaderParameter['Content-Type'] = 'application/json';
24033
24036
  setSearchParams(localVarUrlObj, localVarQueryParameter);
24034
24037
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -25028,13 +25031,14 @@ const NftsApiAxiosParamCreator = function (configuration) {
25028
25031
  * @summary List NFTs by contract address
25029
25032
  * @param {string} contractAddress Contract address
25030
25033
  * @param {string} chainName The name of chain
25034
+ * @param {Array<string>} [tokenId] List of token IDs to filter by
25031
25035
  * @param {string} [fromUpdatedAt] Datetime to use as the oldest updated timestamp
25032
25036
  * @param {string} [pageCursor] Encoded page cursor to retrieve previous or next page. Use the value returned in the response.
25033
25037
  * @param {number} [pageSize] Maximum number of items to return
25034
25038
  * @param {*} [options] Override http request option.
25035
25039
  * @throws {RequiredError}
25036
25040
  */
25037
- listNFTs: async (contractAddress, chainName, fromUpdatedAt, pageCursor, pageSize, options = {}) => {
25041
+ listNFTs: async (contractAddress, chainName, tokenId, fromUpdatedAt, pageCursor, pageSize, options = {}) => {
25038
25042
  // verify required parameter 'contractAddress' is not null or undefined
25039
25043
  assertParamExists('listNFTs', 'contractAddress', contractAddress);
25040
25044
  // verify required parameter 'chainName' is not null or undefined
@@ -25051,6 +25055,9 @@ const NftsApiAxiosParamCreator = function (configuration) {
25051
25055
  const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
25052
25056
  const localVarHeaderParameter = {};
25053
25057
  const localVarQueryParameter = {};
25058
+ if (tokenId) {
25059
+ localVarQueryParameter['token_id'] = tokenId;
25060
+ }
25054
25061
  if (fromUpdatedAt !== undefined) {
25055
25062
  localVarQueryParameter['from_updated_at'] = (fromUpdatedAt instanceof Date) ?
25056
25063
  fromUpdatedAt.toISOString() :
@@ -25156,14 +25163,15 @@ const NftsApiFp = function (configuration) {
25156
25163
  * @summary List NFTs by contract address
25157
25164
  * @param {string} contractAddress Contract address
25158
25165
  * @param {string} chainName The name of chain
25166
+ * @param {Array<string>} [tokenId] List of token IDs to filter by
25159
25167
  * @param {string} [fromUpdatedAt] Datetime to use as the oldest updated timestamp
25160
25168
  * @param {string} [pageCursor] Encoded page cursor to retrieve previous or next page. Use the value returned in the response.
25161
25169
  * @param {number} [pageSize] Maximum number of items to return
25162
25170
  * @param {*} [options] Override http request option.
25163
25171
  * @throws {RequiredError}
25164
25172
  */
25165
- async listNFTs(contractAddress, chainName, fromUpdatedAt, pageCursor, pageSize, options) {
25166
- const localVarAxiosArgs = await localVarAxiosParamCreator.listNFTs(contractAddress, chainName, fromUpdatedAt, pageCursor, pageSize, options);
25173
+ async listNFTs(contractAddress, chainName, tokenId, fromUpdatedAt, pageCursor, pageSize, options) {
25174
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listNFTs(contractAddress, chainName, tokenId, fromUpdatedAt, pageCursor, pageSize, options);
25167
25175
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
25168
25176
  },
25169
25177
  /**
@@ -25218,7 +25226,7 @@ const NftsApiFactory = function (configuration, basePath, axios) {
25218
25226
  * @throws {RequiredError}
25219
25227
  */
25220
25228
  listNFTs(requestParameters, options) {
25221
- return localVarFp.listNFTs(requestParameters.contractAddress, requestParameters.chainName, requestParameters.fromUpdatedAt, requestParameters.pageCursor, requestParameters.pageSize, options).then((request) => request(axios, basePath));
25229
+ return localVarFp.listNFTs(requestParameters.contractAddress, requestParameters.chainName, requestParameters.tokenId, requestParameters.fromUpdatedAt, requestParameters.pageCursor, requestParameters.pageSize, options).then((request) => request(axios, basePath));
25222
25230
  },
25223
25231
  /**
25224
25232
  * List NFTs by account address
@@ -25270,7 +25278,7 @@ class NftsApi extends BaseAPI {
25270
25278
  * @memberof NftsApi
25271
25279
  */
25272
25280
  listNFTs(requestParameters, options) {
25273
- return NftsApiFp(this.configuration).listNFTs(requestParameters.contractAddress, requestParameters.chainName, requestParameters.fromUpdatedAt, requestParameters.pageCursor, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
25281
+ return NftsApiFp(this.configuration).listNFTs(requestParameters.contractAddress, requestParameters.chainName, requestParameters.tokenId, requestParameters.fromUpdatedAt, requestParameters.pageCursor, requestParameters.pageSize, options).then((request) => request(this.axios, this.basePath));
25274
25282
  }
25275
25283
  /**
25276
25284
  * List NFTs by account address
@@ -27715,7 +27723,7 @@ class APIError extends Error {
27715
27723
 
27716
27724
  /* eslint-disable implicit-arrow-linebreak */
27717
27725
  const defaultHeaders = {
27718
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.5.4',
27726
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.6.0-alpha.1',
27719
27727
  };
27720
27728
  /**
27721
27729
  * createAPIConfiguration to create a custom Configuration
@@ -29082,7 +29090,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
29082
29090
  maxPriorityFeePerGas: BigNumber$1.from(10e9),
29083
29091
  };
29084
29092
 
29085
- const SDK_VERSION_MARKER = '1.5.4';
29093
+ const SDK_VERSION_MARKER = '1.6.0-alpha.1';
29086
29094
  // This SDK version is replaced by the `yarn build` command ran on the root level
29087
29095
  const globalPackageVersion = () => SDK_VERSION_MARKER;
29088
29096
 
@@ -32697,7 +32705,8 @@ function validateAndBuildVersion(version) {
32697
32705
  return validatedVersion;
32698
32706
  }
32699
32707
 
32700
- function loadUnresolved(version) {
32708
+ // Loads the checkout widgets bundle from the CDN and appends the script to the document head
32709
+ function loadUnresolvedBundle(version) {
32701
32710
  if (window === undefined) {
32702
32711
  throw new Error('missing window object: please run Checkout client side');
32703
32712
  }
@@ -32719,6 +32728,12 @@ function loadUnresolved(version) {
32719
32728
  document.head.appendChild(tag);
32720
32729
  return { loaded: false, element: tag };
32721
32730
  }
32731
+ // Gets the CDN url for the split checkout widgets bundle
32732
+ function getWidgetsEsmUrl(version) {
32733
+ const validVersion = validateAndBuildVersion(version);
32734
+ let cdnUrl = `https://cdn.jsdelivr.net/npm/@imtbl/sdk@${validVersion}/dist/browser/checkout/widgets-esm.js`;
32735
+ return cdnUrl;
32736
+ }
32722
32737
 
32723
32738
  const PUBLISHABLE_KEY_PREFIX = 'pk_imapik-';
32724
32739
  const publishableKeyDomainAllowlist = [
@@ -32826,10 +32841,20 @@ class Checkout {
32826
32841
  const checkout = this;
32827
32842
  // Preload the configurations
32828
32843
  await checkout.config.remote.getConfig();
32844
+ try {
32845
+ const factory = await this.loadEsModules(init.config, init.version);
32846
+ return factory;
32847
+ }
32848
+ catch (err) {
32849
+ throw new CheckoutError('Failed to load widgets script', CheckoutErrorType.WIDGETS_SCRIPT_LOAD_ERROR, { error: err });
32850
+ }
32851
+ }
32852
+ async loadUmdBundle(config, version) {
32853
+ const checkout = this;
32829
32854
  const factory = new Promise((resolve, reject) => {
32830
32855
  function checkForWidgetsBundleLoaded() {
32831
32856
  if (typeof ImmutableCheckoutWidgets !== 'undefined') {
32832
- resolve(new ImmutableCheckoutWidgets.WidgetsFactory(checkout, init.config));
32857
+ resolve(new ImmutableCheckoutWidgets.WidgetsFactory(checkout, config));
32833
32858
  }
32834
32859
  else {
32835
32860
  // If ImmutableCheckoutWidgets is not defined, wait for set amount of time.
@@ -32839,9 +32864,9 @@ class Checkout {
32839
32864
  }
32840
32865
  }
32841
32866
  try {
32842
- const script = loadUnresolved(init.version);
32867
+ const script = loadUnresolvedBundle(version);
32843
32868
  if (script.loaded && typeof ImmutableCheckoutWidgets !== 'undefined') {
32844
- resolve(new ImmutableCheckoutWidgets.WidgetsFactory(checkout, init.config));
32869
+ resolve(new ImmutableCheckoutWidgets.WidgetsFactory(checkout, config));
32845
32870
  }
32846
32871
  else {
32847
32872
  checkForWidgetsBundleLoaded();
@@ -32853,6 +32878,24 @@ class Checkout {
32853
32878
  });
32854
32879
  return factory;
32855
32880
  }
32881
+ async loadEsModules(config, version) {
32882
+ const checkout = this;
32883
+ try {
32884
+ const cdnUrl = getWidgetsEsmUrl(version);
32885
+ // WebpackIgnore comment required to prevent webpack modifying the import statement and
32886
+ // breaking the dynamic import in certain applications integrating checkout
32887
+ const checkoutWidgetsModule = await import(/* webpackIgnore: true */ cdnUrl);
32888
+ if (checkoutWidgetsModule && checkoutWidgetsModule.WidgetsFactory) {
32889
+ return new checkoutWidgetsModule.WidgetsFactory(checkout, config);
32890
+ }
32891
+ }
32892
+ catch (err) {
32893
+ // eslint-disable-next-line no-console
32894
+ console.warn(`Failed to resolve checkout widgets module, falling back to UMD bundle. Error: ${err.message}`);
32895
+ }
32896
+ // Fallback to UMD bundle if esm bundle fails to load
32897
+ return await checkout.loadUmdBundle(config, version);
32898
+ }
32856
32899
  /**
32857
32900
  * Creates a provider using the given parameters.
32858
32901
  * @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.5.4';
131
+ const SDK_VERSION = '1.6.0-alpha.1';
132
132
  const getReferrer = () => {
133
133
  if (isNode()) {
134
134
  return '';