@rechargeapps/storefront-client 1.62.0 → 1.64.0
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/cjs/api/auth.js +1 -1
- package/dist/cjs/api/bundleData.js +4 -1
- package/dist/cjs/api/bundleData.js.map +1 -1
- package/dist/cjs/utils/request.js +1 -1
- package/dist/esm/api/auth.js +1 -1
- package/dist/esm/api/bundleData.js +4 -1
- package/dist/esm/api/bundleData.js.map +1 -1
- package/dist/esm/utils/request.js +1 -1
- package/dist/index.d.ts +54 -30
- package/dist/umd/recharge-client.min.js +6 -6
- package/package.json +1 -1
package/dist/cjs/api/auth.js
CHANGED
|
@@ -181,7 +181,7 @@ async function rechargeAdminRequest(method, url, { id, query, data, headers } =
|
|
|
181
181
|
...storefrontAccessToken ? { "X-Recharge-Storefront-Access-Token": storefrontAccessToken } : {},
|
|
182
182
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
183
183
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
184
|
-
"X-Recharge-Sdk-Version": "1.
|
|
184
|
+
"X-Recharge-Sdk-Version": "1.64.0",
|
|
185
185
|
...headers ? headers : {}
|
|
186
186
|
};
|
|
187
187
|
return request.request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
|
|
@@ -12,9 +12,12 @@ async function loadBundleData(id, options) {
|
|
|
12
12
|
return loadFromOnlineStore(id, options?.country_code);
|
|
13
13
|
}
|
|
14
14
|
async function loadFromOnlineStore(id, country_code) {
|
|
15
|
+
const { appName, appVersion } = options.getOptions();
|
|
15
16
|
const headers = {
|
|
16
17
|
"X-Recharge-Sdk-Fn": "loadFromOnlineStore",
|
|
17
|
-
"X-Recharge-Sdk-Version": "1.
|
|
18
|
+
"X-Recharge-Sdk-Version": "1.64.0",
|
|
19
|
+
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
20
|
+
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {}
|
|
18
21
|
};
|
|
19
22
|
if (!country_code) {
|
|
20
23
|
const data = await request.shopifyAppProxyRequest("get", `/bundle-data/${id}`, { headers });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundleData.js","sources":["../../../src/api/bundleData.ts"],"sourcesContent":["import { Options, PublicBundleData, ShopifyStorefrontOptions } from '../types/bundleData';\nimport { getOptions } from '../utils/options';\nimport { SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { BundleData as StorefrontBundleData } from '../types/bundle';\nimport { request, shopifyAppProxyRequest } from '../utils/request';\nimport { mapOnlineStoreToPublicBundleData } from '../utils/bundleData';\n\n/**\n * Load bundle data from the specified source\n *\n * @param id - The external product ID (Shopify product ID)\n * @param options - Configuration for data source and parameters\n * @param options.source - The source of the data (online_store or shopify_storefront)\n * @param options.country_code - The country code for the online store\n * @param options.storefront_access_token - The storefront access token for the Shopify Storefront API\n * @returns Promise resolving to bundle data result with success/error handling\n *\n * @example\n * ```typescript\n * // Load from online store\n * const result = await loadBundleData({\n * source: 'online_store',\n * external_product_id: '123456789',\n * country_code: 'US'\n * });\n *\n * if (result.success) {\n * console.log('Bundle data:', result.data);\n * } else {\n * console.error('Error:', result.error.message);\n * }\n *\n * // Load from Shopify Storefront API\n * const result2 = await loadBundleData({\n * source: 'shopify_storefront',\n * external_product_id: '123456789',\n * country_code: 'US',\n * shopify_storefront_access_token: 'your-token-here'\n * });\n * ```\n */\nexport async function loadBundleData(id: string, options?: Options): Promise<PublicBundleData> {\n if (options?.source === 'shopify_storefront') {\n return loadFromShopifyStorefrontApi(id, options);\n }\n\n return loadFromOnlineStore(id, options?.country_code);\n}\n\n/**\n * Load bundle data from the online store endpoint\n */\nasync function loadFromOnlineStore(id: string, country_code?: string): Promise<PublicBundleData> {\n const headers = {\n 'X-Recharge-Sdk-Fn': 'loadFromOnlineStore',\n 'X-Recharge-Sdk-Version': '__SDK_VERSION__',\n };\n\n if (!country_code) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`, { headers });\n return mapOnlineStoreToPublicBundleData(data);\n }\n\n const payload = new FormData();\n payload.append('form_type', 'localization');\n payload.append('_method', 'put');\n payload.append('return_to', `${SHOPIFY_APP_PROXY_URL}/bundle-data/${id}`);\n payload.append('country_code', country_code);\n\n try {\n const data = await request<StorefrontBundleData>('post', '/localization', {\n headers: { 'Content-Type': 'multipart/form-data', ...headers },\n data: payload,\n });\n return mapOnlineStoreToPublicBundleData(data);\n } catch (error) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`, {\n headers,\n });\n return mapOnlineStoreToPublicBundleData(data);\n }\n}\n\n/**\n * Load bundle data from Shopify Storefront API\n */\nasync function loadFromShopifyStorefrontApi(id: string, options: ShopifyStorefrontOptions): Promise<PublicBundleData> {\n const opts = getOptions();\n\n if (!opts.storeIdentifier) {\n throw new Error('Store identifier is required for Shopify Storefront API requests');\n }\n\n // Request data from Shopify Storefront API\n return {} as PublicBundleData;\n}\n"],"names":["shopifyAppProxyRequest","mapOnlineStoreToPublicBundleData","SHOPIFY_APP_PROXY_URL","request","options"
|
|
1
|
+
{"version":3,"file":"bundleData.js","sources":["../../../src/api/bundleData.ts"],"sourcesContent":["import { Options, PublicBundleData, ShopifyStorefrontOptions } from '../types/bundleData';\nimport { getOptions } from '../utils/options';\nimport { SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { BundleData as StorefrontBundleData } from '../types/bundle';\nimport { request, shopifyAppProxyRequest } from '../utils/request';\nimport { mapOnlineStoreToPublicBundleData } from '../utils/bundleData';\n\n/**\n * Load bundle data from the specified source\n *\n * @param id - The external product ID (Shopify product ID)\n * @param options - Configuration for data source and parameters\n * @param options.source - The source of the data (online_store or shopify_storefront)\n * @param options.country_code - The country code for the online store\n * @param options.storefront_access_token - The storefront access token for the Shopify Storefront API\n * @returns Promise resolving to bundle data result with success/error handling\n *\n * @example\n * ```typescript\n * // Load from online store\n * const result = await loadBundleData({\n * source: 'online_store',\n * external_product_id: '123456789',\n * country_code: 'US'\n * });\n *\n * if (result.success) {\n * console.log('Bundle data:', result.data);\n * } else {\n * console.error('Error:', result.error.message);\n * }\n *\n * // Load from Shopify Storefront API\n * const result2 = await loadBundleData({\n * source: 'shopify_storefront',\n * external_product_id: '123456789',\n * country_code: 'US',\n * shopify_storefront_access_token: 'your-token-here'\n * });\n * ```\n */\nexport async function loadBundleData(id: string, options?: Options): Promise<PublicBundleData> {\n if (options?.source === 'shopify_storefront') {\n return loadFromShopifyStorefrontApi(id, options);\n }\n\n return loadFromOnlineStore(id, options?.country_code);\n}\n\n/**\n * Load bundle data from the online store endpoint\n */\nasync function loadFromOnlineStore(id: string, country_code?: string): Promise<PublicBundleData> {\n const { appName, appVersion } = getOptions();\n const headers = {\n 'X-Recharge-Sdk-Fn': 'loadFromOnlineStore',\n 'X-Recharge-Sdk-Version': '__SDK_VERSION__',\n ...(appName ? { 'X-Recharge-Sdk-App-Name': appName } : {}),\n ...(appVersion ? { 'X-Recharge-Sdk-App-Version': appVersion } : {}),\n };\n\n if (!country_code) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`, { headers });\n return mapOnlineStoreToPublicBundleData(data);\n }\n\n const payload = new FormData();\n payload.append('form_type', 'localization');\n payload.append('_method', 'put');\n payload.append('return_to', `${SHOPIFY_APP_PROXY_URL}/bundle-data/${id}`);\n payload.append('country_code', country_code);\n\n try {\n const data = await request<StorefrontBundleData>('post', '/localization', {\n headers: { 'Content-Type': 'multipart/form-data', ...headers },\n data: payload,\n });\n return mapOnlineStoreToPublicBundleData(data);\n } catch (error) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`, {\n headers,\n });\n return mapOnlineStoreToPublicBundleData(data);\n }\n}\n\n/**\n * Load bundle data from Shopify Storefront API\n */\nasync function loadFromShopifyStorefrontApi(id: string, options: ShopifyStorefrontOptions): Promise<PublicBundleData> {\n const opts = getOptions();\n\n if (!opts.storeIdentifier) {\n throw new Error('Store identifier is required for Shopify Storefront API requests');\n }\n\n // Request data from Shopify Storefront API\n return {} as PublicBundleData;\n}\n"],"names":["getOptions","shopifyAppProxyRequest","mapOnlineStoreToPublicBundleData","SHOPIFY_APP_PROXY_URL","request","options"],"mappings":";;;;;;;AAyCsB,eAAA,cAAA,CAAe,IAAY,OAA8C,EAAA;AAC7F,EAAI,IAAA,OAAA,EAAS,WAAW,oBAAsB,EAAA;AAC5C,IAAO,OAAA,4BAAA,CAAwC,CAAA,CAAA;AAAA,GACjD;AAEA,EAAO,OAAA,mBAAA,CAAoB,EAAI,EAAA,OAAA,EAAS,YAAY,CAAA,CAAA;AACtD,CAAA;AAKA,eAAe,mBAAA,CAAoB,IAAY,YAAkD,EAAA;AAC/F,EAAA,MAAM,EAAE,OAAA,EAAS,UAAW,EAAA,GAAIA,kBAAW,EAAA,CAAA;AAC3C,EAAA,MAAM,OAAU,GAAA;AAAA,IACd,mBAAqB,EAAA,qBAAA;AAAA,IACrB,wBAA0B,EAAA,QAAA;AAAA,IAC1B,GAAI,OAAU,GAAA,EAAE,yBAA2B,EAAA,OAAA,KAAY,EAAC;AAAA,IACxD,GAAI,UAAa,GAAA,EAAE,4BAA8B,EAAA,UAAA,KAAe,EAAC;AAAA,GACnE,CAAA;AAEA,EAAA,IAAI,CAAC,YAAc,EAAA;AACjB,IAAM,MAAA,IAAA,GAAO,MAAMC,8BAA6C,CAAA,KAAA,EAAO,gBAAgB,EAAE,CAAA,CAAA,EAAI,EAAE,OAAA,EAAS,CAAA,CAAA;AACxG,IAAA,OAAOC,4CAAiC,IAAI,CAAA,CAAA;AAAA,GAC9C;AAEA,EAAM,MAAA,OAAA,GAAU,IAAI,QAAS,EAAA,CAAA;AAC7B,EAAQ,OAAA,CAAA,MAAA,CAAO,aAAa,cAAc,CAAA,CAAA;AAC1C,EAAQ,OAAA,CAAA,MAAA,CAAO,WAAW,KAAK,CAAA,CAAA;AAC/B,EAAA,OAAA,CAAQ,OAAO,WAAa,EAAA,CAAA,EAAGC,yBAAqB,CAAA,aAAA,EAAgB,EAAE,CAAE,CAAA,CAAA,CAAA;AACxE,EAAQ,OAAA,CAAA,MAAA,CAAO,gBAAgB,YAAY,CAAA,CAAA;AAE3C,EAAI,IAAA;AACF,IAAA,MAAM,IAAO,GAAA,MAAMC,eAA8B,CAAA,MAAA,EAAQ,eAAiB,EAAA;AAAA,MACxE,OAAS,EAAA,EAAE,cAAgB,EAAA,qBAAA,EAAuB,GAAG,OAAQ,EAAA;AAAA,MAC7D,IAAM,EAAA,OAAA;AAAA,KACP,CAAA,CAAA;AACD,IAAA,OAAOF,4CAAiC,IAAI,CAAA,CAAA;AAAA,WACrC,KAAO,EAAA;AACd,IAAA,MAAM,OAAO,MAAMD,8BAAA,CAA6C,KAAO,EAAA,CAAA,aAAA,EAAgB,EAAE,CAAI,CAAA,EAAA;AAAA,MAC3F,OAAA;AAAA,KACD,CAAA,CAAA;AACD,IAAA,OAAOC,4CAAiC,IAAI,CAAA,CAAA;AAAA,GAC9C;AACF,CAAA;AAKA,eAAe,4BAAA,CAA6B,IAAYG,SAA8D,EAAA;AACpH,EAAA,MAAM,OAAOL,kBAAW,EAAA,CAAA;AAExB,EAAI,IAAA,CAAC,KAAK,eAAiB,EAAA;AACzB,IAAM,MAAA,IAAI,MAAM,kEAAkE,CAAA,CAAA;AAAA,GACpF;AAGA,EAAA,OAAO,EAAC,CAAA;AACV;;;;"}
|
|
@@ -49,7 +49,7 @@ async function rechargeApiRequest(method, url, { id, query, data, headers } = {}
|
|
|
49
49
|
"X-Recharge-Sdk-Fn": session.internalFnCall,
|
|
50
50
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
51
51
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
52
|
-
"X-Recharge-Sdk-Version": "1.
|
|
52
|
+
"X-Recharge-Sdk-Version": "1.64.0",
|
|
53
53
|
"X-Request-Id": session.internalRequestId,
|
|
54
54
|
...session.tmp_fn_identifier ? { "X-Recharge-Sdk-Fn-Identifier": session.tmp_fn_identifier } : {},
|
|
55
55
|
...headers ? headers : {}
|
package/dist/esm/api/auth.js
CHANGED
|
@@ -179,7 +179,7 @@ async function rechargeAdminRequest(method, url, { id, query, data, headers } =
|
|
|
179
179
|
...storefrontAccessToken ? { "X-Recharge-Storefront-Access-Token": storefrontAccessToken } : {},
|
|
180
180
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
181
181
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
182
|
-
"X-Recharge-Sdk-Version": "1.
|
|
182
|
+
"X-Recharge-Sdk-Version": "1.64.0",
|
|
183
183
|
...headers ? headers : {}
|
|
184
184
|
};
|
|
185
185
|
return request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
|
|
@@ -10,9 +10,12 @@ async function loadBundleData(id, options) {
|
|
|
10
10
|
return loadFromOnlineStore(id, options?.country_code);
|
|
11
11
|
}
|
|
12
12
|
async function loadFromOnlineStore(id, country_code) {
|
|
13
|
+
const { appName, appVersion } = getOptions();
|
|
13
14
|
const headers = {
|
|
14
15
|
"X-Recharge-Sdk-Fn": "loadFromOnlineStore",
|
|
15
|
-
"X-Recharge-Sdk-Version": "1.
|
|
16
|
+
"X-Recharge-Sdk-Version": "1.64.0",
|
|
17
|
+
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
18
|
+
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {}
|
|
16
19
|
};
|
|
17
20
|
if (!country_code) {
|
|
18
21
|
const data = await shopifyAppProxyRequest("get", `/bundle-data/${id}`, { headers });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundleData.js","sources":["../../../src/api/bundleData.ts"],"sourcesContent":["import { Options, PublicBundleData, ShopifyStorefrontOptions } from '../types/bundleData';\nimport { getOptions } from '../utils/options';\nimport { SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { BundleData as StorefrontBundleData } from '../types/bundle';\nimport { request, shopifyAppProxyRequest } from '../utils/request';\nimport { mapOnlineStoreToPublicBundleData } from '../utils/bundleData';\n\n/**\n * Load bundle data from the specified source\n *\n * @param id - The external product ID (Shopify product ID)\n * @param options - Configuration for data source and parameters\n * @param options.source - The source of the data (online_store or shopify_storefront)\n * @param options.country_code - The country code for the online store\n * @param options.storefront_access_token - The storefront access token for the Shopify Storefront API\n * @returns Promise resolving to bundle data result with success/error handling\n *\n * @example\n * ```typescript\n * // Load from online store\n * const result = await loadBundleData({\n * source: 'online_store',\n * external_product_id: '123456789',\n * country_code: 'US'\n * });\n *\n * if (result.success) {\n * console.log('Bundle data:', result.data);\n * } else {\n * console.error('Error:', result.error.message);\n * }\n *\n * // Load from Shopify Storefront API\n * const result2 = await loadBundleData({\n * source: 'shopify_storefront',\n * external_product_id: '123456789',\n * country_code: 'US',\n * shopify_storefront_access_token: 'your-token-here'\n * });\n * ```\n */\nexport async function loadBundleData(id: string, options?: Options): Promise<PublicBundleData> {\n if (options?.source === 'shopify_storefront') {\n return loadFromShopifyStorefrontApi(id, options);\n }\n\n return loadFromOnlineStore(id, options?.country_code);\n}\n\n/**\n * Load bundle data from the online store endpoint\n */\nasync function loadFromOnlineStore(id: string, country_code?: string): Promise<PublicBundleData> {\n const headers = {\n 'X-Recharge-Sdk-Fn': 'loadFromOnlineStore',\n 'X-Recharge-Sdk-Version': '__SDK_VERSION__',\n };\n\n if (!country_code) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`, { headers });\n return mapOnlineStoreToPublicBundleData(data);\n }\n\n const payload = new FormData();\n payload.append('form_type', 'localization');\n payload.append('_method', 'put');\n payload.append('return_to', `${SHOPIFY_APP_PROXY_URL}/bundle-data/${id}`);\n payload.append('country_code', country_code);\n\n try {\n const data = await request<StorefrontBundleData>('post', '/localization', {\n headers: { 'Content-Type': 'multipart/form-data', ...headers },\n data: payload,\n });\n return mapOnlineStoreToPublicBundleData(data);\n } catch (error) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`, {\n headers,\n });\n return mapOnlineStoreToPublicBundleData(data);\n }\n}\n\n/**\n * Load bundle data from Shopify Storefront API\n */\nasync function loadFromShopifyStorefrontApi(id: string, options: ShopifyStorefrontOptions): Promise<PublicBundleData> {\n const opts = getOptions();\n\n if (!opts.storeIdentifier) {\n throw new Error('Store identifier is required for Shopify Storefront API requests');\n }\n\n // Request data from Shopify Storefront API\n return {} as PublicBundleData;\n}\n"],"names":[],"mappings":";;;;;AAyCsB,eAAA,cAAA,CAAe,IAAY,OAA8C,EAAA;AAC7F,EAAI,IAAA,OAAA,EAAS,WAAW,oBAAsB,EAAA;AAC5C,IAAO,OAAA,4BAAA,CAAwC,CAAA,CAAA;AAAA,GACjD;AAEA,EAAO,OAAA,mBAAA,CAAoB,EAAI,EAAA,OAAA,EAAS,YAAY,CAAA,CAAA;AACtD,CAAA;AAKA,eAAe,mBAAA,CAAoB,IAAY,YAAkD,EAAA;AAC/F,EAAA,MAAM,OAAU,GAAA;AAAA,IACd,mBAAqB,EAAA,qBAAA;AAAA,IACrB,wBAA0B,EAAA,QAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"bundleData.js","sources":["../../../src/api/bundleData.ts"],"sourcesContent":["import { Options, PublicBundleData, ShopifyStorefrontOptions } from '../types/bundleData';\nimport { getOptions } from '../utils/options';\nimport { SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { BundleData as StorefrontBundleData } from '../types/bundle';\nimport { request, shopifyAppProxyRequest } from '../utils/request';\nimport { mapOnlineStoreToPublicBundleData } from '../utils/bundleData';\n\n/**\n * Load bundle data from the specified source\n *\n * @param id - The external product ID (Shopify product ID)\n * @param options - Configuration for data source and parameters\n * @param options.source - The source of the data (online_store or shopify_storefront)\n * @param options.country_code - The country code for the online store\n * @param options.storefront_access_token - The storefront access token for the Shopify Storefront API\n * @returns Promise resolving to bundle data result with success/error handling\n *\n * @example\n * ```typescript\n * // Load from online store\n * const result = await loadBundleData({\n * source: 'online_store',\n * external_product_id: '123456789',\n * country_code: 'US'\n * });\n *\n * if (result.success) {\n * console.log('Bundle data:', result.data);\n * } else {\n * console.error('Error:', result.error.message);\n * }\n *\n * // Load from Shopify Storefront API\n * const result2 = await loadBundleData({\n * source: 'shopify_storefront',\n * external_product_id: '123456789',\n * country_code: 'US',\n * shopify_storefront_access_token: 'your-token-here'\n * });\n * ```\n */\nexport async function loadBundleData(id: string, options?: Options): Promise<PublicBundleData> {\n if (options?.source === 'shopify_storefront') {\n return loadFromShopifyStorefrontApi(id, options);\n }\n\n return loadFromOnlineStore(id, options?.country_code);\n}\n\n/**\n * Load bundle data from the online store endpoint\n */\nasync function loadFromOnlineStore(id: string, country_code?: string): Promise<PublicBundleData> {\n const { appName, appVersion } = getOptions();\n const headers = {\n 'X-Recharge-Sdk-Fn': 'loadFromOnlineStore',\n 'X-Recharge-Sdk-Version': '__SDK_VERSION__',\n ...(appName ? { 'X-Recharge-Sdk-App-Name': appName } : {}),\n ...(appVersion ? { 'X-Recharge-Sdk-App-Version': appVersion } : {}),\n };\n\n if (!country_code) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`, { headers });\n return mapOnlineStoreToPublicBundleData(data);\n }\n\n const payload = new FormData();\n payload.append('form_type', 'localization');\n payload.append('_method', 'put');\n payload.append('return_to', `${SHOPIFY_APP_PROXY_URL}/bundle-data/${id}`);\n payload.append('country_code', country_code);\n\n try {\n const data = await request<StorefrontBundleData>('post', '/localization', {\n headers: { 'Content-Type': 'multipart/form-data', ...headers },\n data: payload,\n });\n return mapOnlineStoreToPublicBundleData(data);\n } catch (error) {\n const data = await shopifyAppProxyRequest<StorefrontBundleData>('get', `/bundle-data/${id}`, {\n headers,\n });\n return mapOnlineStoreToPublicBundleData(data);\n }\n}\n\n/**\n * Load bundle data from Shopify Storefront API\n */\nasync function loadFromShopifyStorefrontApi(id: string, options: ShopifyStorefrontOptions): Promise<PublicBundleData> {\n const opts = getOptions();\n\n if (!opts.storeIdentifier) {\n throw new Error('Store identifier is required for Shopify Storefront API requests');\n }\n\n // Request data from Shopify Storefront API\n return {} as PublicBundleData;\n}\n"],"names":[],"mappings":";;;;;AAyCsB,eAAA,cAAA,CAAe,IAAY,OAA8C,EAAA;AAC7F,EAAI,IAAA,OAAA,EAAS,WAAW,oBAAsB,EAAA;AAC5C,IAAO,OAAA,4BAAA,CAAwC,CAAA,CAAA;AAAA,GACjD;AAEA,EAAO,OAAA,mBAAA,CAAoB,EAAI,EAAA,OAAA,EAAS,YAAY,CAAA,CAAA;AACtD,CAAA;AAKA,eAAe,mBAAA,CAAoB,IAAY,YAAkD,EAAA;AAC/F,EAAA,MAAM,EAAE,OAAA,EAAS,UAAW,EAAA,GAAI,UAAW,EAAA,CAAA;AAC3C,EAAA,MAAM,OAAU,GAAA;AAAA,IACd,mBAAqB,EAAA,qBAAA;AAAA,IACrB,wBAA0B,EAAA,QAAA;AAAA,IAC1B,GAAI,OAAU,GAAA,EAAE,yBAA2B,EAAA,OAAA,KAAY,EAAC;AAAA,IACxD,GAAI,UAAa,GAAA,EAAE,4BAA8B,EAAA,UAAA,KAAe,EAAC;AAAA,GACnE,CAAA;AAEA,EAAA,IAAI,CAAC,YAAc,EAAA;AACjB,IAAM,MAAA,IAAA,GAAO,MAAM,sBAA6C,CAAA,KAAA,EAAO,gBAAgB,EAAE,CAAA,CAAA,EAAI,EAAE,OAAA,EAAS,CAAA,CAAA;AACxG,IAAA,OAAO,iCAAiC,IAAI,CAAA,CAAA;AAAA,GAC9C;AAEA,EAAM,MAAA,OAAA,GAAU,IAAI,QAAS,EAAA,CAAA;AAC7B,EAAQ,OAAA,CAAA,MAAA,CAAO,aAAa,cAAc,CAAA,CAAA;AAC1C,EAAQ,OAAA,CAAA,MAAA,CAAO,WAAW,KAAK,CAAA,CAAA;AAC/B,EAAA,OAAA,CAAQ,OAAO,WAAa,EAAA,CAAA,EAAG,qBAAqB,CAAA,aAAA,EAAgB,EAAE,CAAE,CAAA,CAAA,CAAA;AACxE,EAAQ,OAAA,CAAA,MAAA,CAAO,gBAAgB,YAAY,CAAA,CAAA;AAE3C,EAAI,IAAA;AACF,IAAA,MAAM,IAAO,GAAA,MAAM,OAA8B,CAAA,MAAA,EAAQ,eAAiB,EAAA;AAAA,MACxE,OAAS,EAAA,EAAE,cAAgB,EAAA,qBAAA,EAAuB,GAAG,OAAQ,EAAA;AAAA,MAC7D,IAAM,EAAA,OAAA;AAAA,KACP,CAAA,CAAA;AACD,IAAA,OAAO,iCAAiC,IAAI,CAAA,CAAA;AAAA,WACrC,KAAO,EAAA;AACd,IAAA,MAAM,OAAO,MAAM,sBAAA,CAA6C,KAAO,EAAA,CAAA,aAAA,EAAgB,EAAE,CAAI,CAAA,EAAA;AAAA,MAC3F,OAAA;AAAA,KACD,CAAA,CAAA;AACD,IAAA,OAAO,iCAAiC,IAAI,CAAA,CAAA;AAAA,GAC9C;AACF,CAAA;AAKA,eAAe,4BAAA,CAA6B,IAAY,OAA8D,EAAA;AACpH,EAAA,MAAM,OAAO,UAAW,EAAA,CAAA;AAExB,EAAI,IAAA,CAAC,KAAK,eAAiB,EAAA;AACzB,IAAM,MAAA,IAAI,MAAM,kEAAkE,CAAA,CAAA;AAAA,GACpF;AAGA,EAAA,OAAO,EAAC,CAAA;AACV;;;;"}
|
|
@@ -47,7 +47,7 @@ async function rechargeApiRequest(method, url, { id, query, data, headers } = {}
|
|
|
47
47
|
"X-Recharge-Sdk-Fn": session.internalFnCall,
|
|
48
48
|
...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
|
|
49
49
|
...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {},
|
|
50
|
-
"X-Recharge-Sdk-Version": "1.
|
|
50
|
+
"X-Recharge-Sdk-Version": "1.64.0",
|
|
51
51
|
"X-Request-Id": session.internalRequestId,
|
|
52
52
|
...session.tmp_fn_identifier ? { "X-Recharge-Sdk-Fn-Identifier": session.tmp_fn_identifier } : {},
|
|
53
53
|
...headers ? headers : {}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ interface ChannelSettings {
|
|
|
5
5
|
checkout_page: {
|
|
6
6
|
display: boolean;
|
|
7
7
|
};
|
|
8
|
+
checkout_page_experiment: {
|
|
9
|
+
display: boolean;
|
|
10
|
+
};
|
|
8
11
|
customer_portal: {
|
|
9
12
|
display: boolean;
|
|
10
13
|
};
|
|
@@ -123,7 +126,7 @@ interface ExternalId {
|
|
|
123
126
|
}
|
|
124
127
|
interface ExternalTransactionId {
|
|
125
128
|
/** The ID of the associated transaction in a payment processor system (like Stripe). */
|
|
126
|
-
payment_processor: number | null;
|
|
129
|
+
payment_processor: number | string | null;
|
|
127
130
|
}
|
|
128
131
|
interface AssociatedAddress {
|
|
129
132
|
address1: string;
|
|
@@ -283,12 +286,12 @@ interface ShippingLine {
|
|
|
283
286
|
source: string;
|
|
284
287
|
/** The status the shipping_line. */
|
|
285
288
|
status?: 'active' | 'pending' | 'queued';
|
|
286
|
-
/** The title of the shipping_line. */
|
|
287
|
-
title: string;
|
|
288
|
-
/** A boolean indicating if the shipping_line is taxable. */
|
|
289
|
-
taxable: boolean;
|
|
290
289
|
/** An array of tax lines associated with the shipping_line. */
|
|
291
290
|
tax_lines: TaxLine[];
|
|
291
|
+
/** A boolean indicating if the shipping_line is taxable. */
|
|
292
|
+
taxable: boolean;
|
|
293
|
+
/** The title of the shipping_line. */
|
|
294
|
+
title: string;
|
|
292
295
|
}
|
|
293
296
|
type OrderStatus = 'success' | 'error' | 'queued' | 'cancelled' | 'pending_charge_status';
|
|
294
297
|
type OrderType = 'checkout' | 'recurring';
|
|
@@ -313,7 +316,7 @@ interface Order {
|
|
|
313
316
|
/** Details of the access method used by the purchase. */
|
|
314
317
|
client_details: {
|
|
315
318
|
/** The IP address of the buyer as detected in Checkout. */
|
|
316
|
-
browser_ip: string;
|
|
319
|
+
browser_ip: string | null;
|
|
317
320
|
/** The user agent detected during Checkout. */
|
|
318
321
|
user_agent: string | null;
|
|
319
322
|
};
|
|
@@ -755,6 +758,8 @@ interface BundleSelection {
|
|
|
755
758
|
/** The variant id as it appears in the external e-commerce platform. The external_variant_id of the Product record in Recharge, linking the BundleSelection to a Product associated with a Bundle. */
|
|
756
759
|
external_variant_id: string;
|
|
757
760
|
is_fallback: boolean;
|
|
761
|
+
charge_id: number | null;
|
|
762
|
+
order_id: number | null;
|
|
758
763
|
items: BundleSelectionItem[];
|
|
759
764
|
/** The date and time at which the BundleSelection was most recently updated. */
|
|
760
765
|
updated_at: IsoDateString;
|
|
@@ -1341,8 +1346,8 @@ interface DeliveryLineItem extends Omit<LineItem, 'external_inventory_policy' |
|
|
|
1341
1346
|
/** The subtotal price (sum of all line items * their quantity) of the order less discounts. */
|
|
1342
1347
|
subtotal_price: string;
|
|
1343
1348
|
}
|
|
1344
|
-
interface DeliveryPaymentMethod extends Omit<PaymentMethod, 'created_at' | 'customer_id' | 'default' | 'payment_type' | 'processor_customer_token' | 'processor_name' | 'processor_payment_method_token' | 'status_reason' | 'status' | 'updated_at'> {
|
|
1345
|
-
payment_details: PaymentDetails;
|
|
1349
|
+
interface DeliveryPaymentMethod extends Omit<PaymentMethod, 'created_at' | 'customer_id' | 'default' | 'payment_type' | 'payment_details' | 'processor_customer_token' | 'processor_name' | 'processor_payment_method_token' | 'status_reason' | 'status' | 'updated_at'> {
|
|
1350
|
+
payment_details: PaymentDetails | null;
|
|
1346
1351
|
payment_type: PaymentType;
|
|
1347
1352
|
billing_address: AssociatedAddress;
|
|
1348
1353
|
}
|
|
@@ -1404,9 +1409,9 @@ interface Charge {
|
|
|
1404
1409
|
/** Details of the access method used by the purchaser. */
|
|
1405
1410
|
client_details: {
|
|
1406
1411
|
/** The IP address of the buyer as detected in Checkout. */
|
|
1407
|
-
browser_ip: string;
|
|
1412
|
+
browser_ip: string | null;
|
|
1408
1413
|
/** The user agent detected during Checkout. */
|
|
1409
|
-
user_agent: string;
|
|
1414
|
+
user_agent: string | null;
|
|
1410
1415
|
};
|
|
1411
1416
|
/** The date and time when the transaction was created. */
|
|
1412
1417
|
created_at: IsoDateString;
|
|
@@ -1419,7 +1424,7 @@ interface Charge {
|
|
|
1419
1424
|
/** The user email. */
|
|
1420
1425
|
email: string;
|
|
1421
1426
|
/** An object containing customer information associated with this charge. */
|
|
1422
|
-
external_customer_id:
|
|
1427
|
+
external_customer_id: ExternalId;
|
|
1423
1428
|
/** The hash of the Customer associated with the Charge. */
|
|
1424
1429
|
hash: string;
|
|
1425
1430
|
};
|
|
@@ -1433,8 +1438,10 @@ interface Charge {
|
|
|
1433
1438
|
has_uncommited_changes?: boolean;
|
|
1434
1439
|
/** A list of line_item objects, each containing information about a distinct purchase item. */
|
|
1435
1440
|
line_items: LineItem[];
|
|
1441
|
+
/** The date and time when the Charge was merged (if applicable). */
|
|
1442
|
+
merged_at?: IsoDateString | null;
|
|
1436
1443
|
/** Notes associated with the Charge. */
|
|
1437
|
-
note: string;
|
|
1444
|
+
note: string | null;
|
|
1438
1445
|
/** An array of name-value pairs of order attributes on the Charge. */
|
|
1439
1446
|
order_attributes: Property[];
|
|
1440
1447
|
/** The number of Orders generated from this Charge (>1 for prepaid Subscriptions). */
|
|
@@ -1487,15 +1494,15 @@ interface Charge {
|
|
|
1487
1494
|
subscriptions?: Subscription[];
|
|
1488
1495
|
};
|
|
1489
1496
|
/** Error reason as sentence text (typically returned direct from the payment processor). e.g. "error": "Customer needs to update credit card" */
|
|
1490
|
-
error?: string;
|
|
1497
|
+
error?: string | null;
|
|
1491
1498
|
/** Structured reason why the charge failed such as CUSTOMER_NEEDS_TO_UPDATE_CARD. */
|
|
1492
|
-
error_type?: string;
|
|
1499
|
+
error_type?: string | null;
|
|
1493
1500
|
/** Shows how many times an attempt to charge was placed. */
|
|
1494
1501
|
charge_attempts?: number;
|
|
1495
1502
|
/** Indicates if Recharge was able to find the external_variant_id from the Charge. */
|
|
1496
1503
|
external_variant_id_not_found?: boolean;
|
|
1497
1504
|
/** The date when the next attempt will be placed. */
|
|
1498
|
-
retry_date?: IsoDateString;
|
|
1505
|
+
retry_date?: IsoDateString | null;
|
|
1499
1506
|
}
|
|
1500
1507
|
interface ChargeResponse {
|
|
1501
1508
|
charge: Charge;
|
|
@@ -1646,11 +1653,11 @@ interface Address {
|
|
|
1646
1653
|
/** The street associated with the Address. */
|
|
1647
1654
|
address1: string;
|
|
1648
1655
|
/** Any additional information associated with the Address. */
|
|
1649
|
-
address2?: string;
|
|
1656
|
+
address2?: string | null;
|
|
1650
1657
|
/** The city associated with the address. */
|
|
1651
1658
|
city: string;
|
|
1652
1659
|
/** The company associated with the address. */
|
|
1653
|
-
company: string;
|
|
1660
|
+
company: string | null;
|
|
1654
1661
|
/** 2-letter country code. */
|
|
1655
1662
|
country_code: string;
|
|
1656
1663
|
/** Unique numeric identifier for the customer associated with the address. */
|
|
@@ -1670,7 +1677,7 @@ interface Address {
|
|
|
1670
1677
|
/** Unique numeric identifier for the Payment Method associated to the Address. */
|
|
1671
1678
|
payment_method_id: number;
|
|
1672
1679
|
/** The phone number associated with the address. */
|
|
1673
|
-
phone: string;
|
|
1680
|
+
phone: string | null;
|
|
1674
1681
|
/** The currency on the subscription contract in Shopify. Only set if the currency is different from the store-level currency. Else, will be null. */
|
|
1675
1682
|
presentment_currency: string | null;
|
|
1676
1683
|
/** The state or province associated with the address. */
|
|
@@ -2168,7 +2175,7 @@ interface ProductVariant_2022_06 {
|
|
|
2168
2175
|
external_metafields: Record<string, unknown>;
|
|
2169
2176
|
external_product_id: string;
|
|
2170
2177
|
external_variant_id: string;
|
|
2171
|
-
fulfillment_service: 'manual';
|
|
2178
|
+
fulfillment_service: 'manual' | string;
|
|
2172
2179
|
image?: ProductImage | null;
|
|
2173
2180
|
inventory: {
|
|
2174
2181
|
level: number | null;
|
|
@@ -2731,6 +2738,8 @@ interface CreditAccount {
|
|
|
2731
2738
|
store_id: number;
|
|
2732
2739
|
/** Current balance of the credit account */
|
|
2733
2740
|
available_balance: string;
|
|
2741
|
+
/** Starting balance of the credit account */
|
|
2742
|
+
initial_balance: string;
|
|
2734
2743
|
/** When the credit account was created */
|
|
2735
2744
|
created_at: IsoDateString;
|
|
2736
2745
|
/** Currency of the credit account */
|
|
@@ -2819,7 +2828,7 @@ interface GiftPurchase {
|
|
|
2819
2828
|
/** Note attached to the gift by the sender. */
|
|
2820
2829
|
gift_note: string;
|
|
2821
2830
|
/** An ISO date for when the gift was redeemed */
|
|
2822
|
-
redeemed_at?: IsoDateString;
|
|
2831
|
+
redeemed_at?: IsoDateString | null;
|
|
2823
2832
|
/**
|
|
2824
2833
|
* URI for the gift redemption page.
|
|
2825
2834
|
* This link includes an authenticated customer token. Login will be required if the token expires.
|
|
@@ -2834,7 +2843,7 @@ interface GiftPurchase {
|
|
|
2834
2843
|
/** ISO date for when the gift was created. */
|
|
2835
2844
|
created_at: IsoDateString;
|
|
2836
2845
|
/** A Recharge collection id that specifies which products this gift can be redeemed for. */
|
|
2837
|
-
redeemable_collection_id?: number;
|
|
2846
|
+
redeemable_collection_id?: number | null;
|
|
2838
2847
|
}
|
|
2839
2848
|
interface GiftPurchasesResponse {
|
|
2840
2849
|
next_cursor: null | string;
|
|
@@ -2852,17 +2861,32 @@ interface GiftPurchasesParams {
|
|
|
2852
2861
|
type MembershipStatus = 'active' | 'inactive';
|
|
2853
2862
|
/** @internal */
|
|
2854
2863
|
interface Membership {
|
|
2855
|
-
id:
|
|
2856
|
-
|
|
2864
|
+
id: number;
|
|
2865
|
+
address_id: number;
|
|
2857
2866
|
customer_id: number;
|
|
2858
2867
|
membership_program_id: number;
|
|
2859
|
-
purchase_item_id: number
|
|
2860
|
-
|
|
2868
|
+
purchase_item_id: number;
|
|
2869
|
+
cancellation_reason: string | null;
|
|
2870
|
+
cancellation_reason_comments: string | null;
|
|
2871
|
+
cancelled_at: IsoDateString | null;
|
|
2872
|
+
charge_interval_frequency: string;
|
|
2873
|
+
charge_interval_unit: string;
|
|
2861
2874
|
created_at: IsoDateString;
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2875
|
+
expires_at: IsoDateString;
|
|
2876
|
+
external_product_id: number;
|
|
2877
|
+
external_variant_id: number;
|
|
2878
|
+
has_queued_charges: boolean;
|
|
2879
|
+
next_charge_scheduled_at: IsoDateString;
|
|
2880
|
+
presentment_currency: string;
|
|
2881
|
+
price: number;
|
|
2882
|
+
product_title: string;
|
|
2883
|
+
purchase_item_status: string;
|
|
2884
|
+
purchase_item_type: 'membership_subscription';
|
|
2885
|
+
quantity: number;
|
|
2886
|
+
status: MembershipStatus;
|
|
2887
|
+
type: 'membership_subscription';
|
|
2888
|
+
updated_at: IsoDateString;
|
|
2889
|
+
variant_title: string;
|
|
2866
2890
|
}
|
|
2867
2891
|
/** @internal */
|
|
2868
2892
|
interface MembershipResponse {
|
|
@@ -3031,7 +3055,7 @@ interface Onetime {
|
|
|
3031
3055
|
/** The number of items in the Onetime purchase. */
|
|
3032
3056
|
quantity: number;
|
|
3033
3057
|
/** A unique identifier of the item in the fulfillment. */
|
|
3034
|
-
sku: string;
|
|
3058
|
+
sku: string | null;
|
|
3035
3059
|
/** Flag that is automatically updated to true when SKU is passed on POST or PUT. */
|
|
3036
3060
|
sku_override: boolean;
|
|
3037
3061
|
/** The time the Onetime purchase was last updated. */
|