@rechargeapps/storefront-client 1.63.0 → 1.65.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/api/customerSurveys.js +36 -0
- package/dist/cjs/api/customerSurveys.js.map +1 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/index.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/api/customerSurveys.js +32 -0
- package/dist/esm/api/customerSurveys.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/request.js +1 -1
- package/dist/index.d.ts +85 -1
- package/dist/umd/recharge-client.min.js +8 -8
- 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.65.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.65.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;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var request = require('../utils/request.js');
|
|
4
|
+
|
|
5
|
+
async function getCustomerSurveyReasons(session, customerId, subscriptionId) {
|
|
6
|
+
const customerSurveysReasonsResponse = await request.rechargeApiRequest(
|
|
7
|
+
"post",
|
|
8
|
+
`/customer_surveys/cancellation_prevention`,
|
|
9
|
+
{ data: { customer_id: customerId, subscription_id: subscriptionId } },
|
|
10
|
+
request.getInternalSession(session, "getCustomerSurveyReasons")
|
|
11
|
+
);
|
|
12
|
+
return customerSurveysReasonsResponse;
|
|
13
|
+
}
|
|
14
|
+
async function getCustomerSurveyOffers(session, customerId, customerSurveyId, responseId) {
|
|
15
|
+
const customerSurveysOffersResponse = await request.rechargeApiRequest(
|
|
16
|
+
"post",
|
|
17
|
+
`/customer_surveys/${customerSurveyId}/customer_response`,
|
|
18
|
+
{ data: { customer_id: customerId, response_id: responseId } },
|
|
19
|
+
request.getInternalSession(session, "getCustomerSurveyOffers")
|
|
20
|
+
);
|
|
21
|
+
return customerSurveysOffersResponse;
|
|
22
|
+
}
|
|
23
|
+
async function claimOfferCustomerSurvey(session, payload) {
|
|
24
|
+
await request.rechargeApiRequest(
|
|
25
|
+
"post",
|
|
26
|
+
`/offers/claim`,
|
|
27
|
+
{ data: payload },
|
|
28
|
+
request.getInternalSession(session, "claimOfferCustomerSurvey")
|
|
29
|
+
);
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
exports.claimOfferCustomerSurvey = claimOfferCustomerSurvey;
|
|
34
|
+
exports.getCustomerSurveyOffers = getCustomerSurveyOffers;
|
|
35
|
+
exports.getCustomerSurveyReasons = getCustomerSurveyReasons;
|
|
36
|
+
//# sourceMappingURL=customerSurveys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customerSurveys.js","sources":["../../../src/api/customerSurveys.ts"],"sourcesContent":["import {\n Session,\n CustomerSurveyOffersResponse,\n CustomerSurveyReasonsResponse,\n CustomerSurveyOfferParams,\n} from '../types';\nimport { getInternalSession, rechargeApiRequest } from '../utils/request';\n\nexport async function getCustomerSurveyReasons(session: Session, customerId: number, subscriptionId: number) {\n const customerSurveysReasonsResponse = await rechargeApiRequest<CustomerSurveyReasonsResponse>(\n 'post',\n `/customer_surveys/cancellation_prevention`,\n { data: { customer_id: customerId, subscription_id: subscriptionId } },\n getInternalSession(session, 'getCustomerSurveyReasons')\n );\n return customerSurveysReasonsResponse;\n}\n\nexport async function getCustomerSurveyOffers(\n session: Session,\n customerId: number,\n customerSurveyId: number,\n responseId: number\n) {\n const customerSurveysOffersResponse = await rechargeApiRequest<CustomerSurveyOffersResponse>(\n 'post',\n `/customer_surveys/${customerSurveyId}/customer_response`,\n { data: { customer_id: customerId, response_id: responseId } },\n getInternalSession(session, 'getCustomerSurveyOffers')\n );\n return customerSurveysOffersResponse;\n}\n\nexport async function claimOfferCustomerSurvey(session: Session, payload: CustomerSurveyOfferParams) {\n await rechargeApiRequest(\n 'post',\n `/offers/claim`,\n { data: payload },\n getInternalSession(session, 'claimOfferCustomerSurvey')\n );\n return {};\n}\n"],"names":["rechargeApiRequest","getInternalSession"],"mappings":";;;;AAQsB,eAAA,wBAAA,CAAyB,OAAkB,EAAA,UAAA,EAAoB,cAAwB,EAAA;AAC3G,EAAA,MAAM,iCAAiC,MAAMA,0BAAA;AAAA,IAC3C,MAAA;AAAA,IACA,CAAA,yCAAA,CAAA;AAAA,IACA,EAAE,IAAM,EAAA,EAAE,aAAa,UAAY,EAAA,eAAA,EAAiB,gBAAiB,EAAA;AAAA,IACrEC,0BAAA,CAAmB,SAAS,0BAA0B,CAAA;AAAA,GACxD,CAAA;AACA,EAAO,OAAA,8BAAA,CAAA;AACT,CAAA;AAEA,eAAsB,uBACpB,CAAA,OAAA,EACA,UACA,EAAA,gBAAA,EACA,UACA,EAAA;AACA,EAAA,MAAM,gCAAgC,MAAMD,0BAAA;AAAA,IAC1C,MAAA;AAAA,IACA,qBAAqB,gBAAgB,CAAA,kBAAA,CAAA;AAAA,IACrC,EAAE,IAAM,EAAA,EAAE,aAAa,UAAY,EAAA,WAAA,EAAa,YAAa,EAAA;AAAA,IAC7DC,0BAAA,CAAmB,SAAS,yBAAyB,CAAA;AAAA,GACvD,CAAA;AACA,EAAO,OAAA,6BAAA,CAAA;AACT,CAAA;AAEsB,eAAA,wBAAA,CAAyB,SAAkB,OAAoC,EAAA;AACnG,EAAM,MAAAD,0BAAA;AAAA,IACJ,MAAA;AAAA,IACA,CAAA,aAAA,CAAA;AAAA,IACA,EAAE,MAAM,OAAQ,EAAA;AAAA,IAChBC,0BAAA,CAAmB,SAAS,0BAA0B,CAAA;AAAA,GACxD,CAAA;AACA,EAAA,OAAO,EAAC,CAAA;AACV;;;;;;"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -9,6 +9,7 @@ var charge = require('./api/charge.js');
|
|
|
9
9
|
var collection = require('./api/collection.js');
|
|
10
10
|
var credit = require('./api/credit.js');
|
|
11
11
|
var customer = require('./api/customer.js');
|
|
12
|
+
var customerSurveys = require('./api/customerSurveys.js');
|
|
12
13
|
var gift = require('./api/gift.js');
|
|
13
14
|
var membership = require('./api/membership.js');
|
|
14
15
|
var membershipProgram = require('./api/membershipProgram.js');
|
|
@@ -84,6 +85,9 @@ exports.getFailedPaymentMethodRecoveryLandingPageURL = customer.getFailedPayment
|
|
|
84
85
|
exports.getGiftRedemptionLandingPageURL = customer.getGiftRedemptionLandingPageURL;
|
|
85
86
|
exports.sendCustomerNotification = customer.sendCustomerNotification;
|
|
86
87
|
exports.updateCustomer = customer.updateCustomer;
|
|
88
|
+
exports.claimOfferCustomerSurvey = customerSurveys.claimOfferCustomerSurvey;
|
|
89
|
+
exports.getCustomerSurveyOffers = customerSurveys.getCustomerSurveyOffers;
|
|
90
|
+
exports.getCustomerSurveyReasons = customerSurveys.getCustomerSurveyReasons;
|
|
87
91
|
exports.getGiftPurchase = gift.getGiftPurchase;
|
|
88
92
|
exports.listGiftPurchases = gift.listGiftPurchases;
|
|
89
93
|
exports.activateMembership = membership.activateMembership;
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -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.65.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.65.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.65.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;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { rechargeApiRequest, getInternalSession } from '../utils/request.js';
|
|
2
|
+
|
|
3
|
+
async function getCustomerSurveyReasons(session, customerId, subscriptionId) {
|
|
4
|
+
const customerSurveysReasonsResponse = await rechargeApiRequest(
|
|
5
|
+
"post",
|
|
6
|
+
`/customer_surveys/cancellation_prevention`,
|
|
7
|
+
{ data: { customer_id: customerId, subscription_id: subscriptionId } },
|
|
8
|
+
getInternalSession(session, "getCustomerSurveyReasons")
|
|
9
|
+
);
|
|
10
|
+
return customerSurveysReasonsResponse;
|
|
11
|
+
}
|
|
12
|
+
async function getCustomerSurveyOffers(session, customerId, customerSurveyId, responseId) {
|
|
13
|
+
const customerSurveysOffersResponse = await rechargeApiRequest(
|
|
14
|
+
"post",
|
|
15
|
+
`/customer_surveys/${customerSurveyId}/customer_response`,
|
|
16
|
+
{ data: { customer_id: customerId, response_id: responseId } },
|
|
17
|
+
getInternalSession(session, "getCustomerSurveyOffers")
|
|
18
|
+
);
|
|
19
|
+
return customerSurveysOffersResponse;
|
|
20
|
+
}
|
|
21
|
+
async function claimOfferCustomerSurvey(session, payload) {
|
|
22
|
+
await rechargeApiRequest(
|
|
23
|
+
"post",
|
|
24
|
+
`/offers/claim`,
|
|
25
|
+
{ data: payload },
|
|
26
|
+
getInternalSession(session, "claimOfferCustomerSurvey")
|
|
27
|
+
);
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { claimOfferCustomerSurvey, getCustomerSurveyOffers, getCustomerSurveyReasons };
|
|
32
|
+
//# sourceMappingURL=customerSurveys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customerSurveys.js","sources":["../../../src/api/customerSurveys.ts"],"sourcesContent":["import {\n Session,\n CustomerSurveyOffersResponse,\n CustomerSurveyReasonsResponse,\n CustomerSurveyOfferParams,\n} from '../types';\nimport { getInternalSession, rechargeApiRequest } from '../utils/request';\n\nexport async function getCustomerSurveyReasons(session: Session, customerId: number, subscriptionId: number) {\n const customerSurveysReasonsResponse = await rechargeApiRequest<CustomerSurveyReasonsResponse>(\n 'post',\n `/customer_surveys/cancellation_prevention`,\n { data: { customer_id: customerId, subscription_id: subscriptionId } },\n getInternalSession(session, 'getCustomerSurveyReasons')\n );\n return customerSurveysReasonsResponse;\n}\n\nexport async function getCustomerSurveyOffers(\n session: Session,\n customerId: number,\n customerSurveyId: number,\n responseId: number\n) {\n const customerSurveysOffersResponse = await rechargeApiRequest<CustomerSurveyOffersResponse>(\n 'post',\n `/customer_surveys/${customerSurveyId}/customer_response`,\n { data: { customer_id: customerId, response_id: responseId } },\n getInternalSession(session, 'getCustomerSurveyOffers')\n );\n return customerSurveysOffersResponse;\n}\n\nexport async function claimOfferCustomerSurvey(session: Session, payload: CustomerSurveyOfferParams) {\n await rechargeApiRequest(\n 'post',\n `/offers/claim`,\n { data: payload },\n getInternalSession(session, 'claimOfferCustomerSurvey')\n );\n return {};\n}\n"],"names":[],"mappings":";;AAQsB,eAAA,wBAAA,CAAyB,OAAkB,EAAA,UAAA,EAAoB,cAAwB,EAAA;AAC3G,EAAA,MAAM,iCAAiC,MAAM,kBAAA;AAAA,IAC3C,MAAA;AAAA,IACA,CAAA,yCAAA,CAAA;AAAA,IACA,EAAE,IAAM,EAAA,EAAE,aAAa,UAAY,EAAA,eAAA,EAAiB,gBAAiB,EAAA;AAAA,IACrE,kBAAA,CAAmB,SAAS,0BAA0B,CAAA;AAAA,GACxD,CAAA;AACA,EAAO,OAAA,8BAAA,CAAA;AACT,CAAA;AAEA,eAAsB,uBACpB,CAAA,OAAA,EACA,UACA,EAAA,gBAAA,EACA,UACA,EAAA;AACA,EAAA,MAAM,gCAAgC,MAAM,kBAAA;AAAA,IAC1C,MAAA;AAAA,IACA,qBAAqB,gBAAgB,CAAA,kBAAA,CAAA;AAAA,IACrC,EAAE,IAAM,EAAA,EAAE,aAAa,UAAY,EAAA,WAAA,EAAa,YAAa,EAAA;AAAA,IAC7D,kBAAA,CAAmB,SAAS,yBAAyB,CAAA;AAAA,GACvD,CAAA;AACA,EAAO,OAAA,6BAAA,CAAA;AACT,CAAA;AAEsB,eAAA,wBAAA,CAAyB,SAAkB,OAAoC,EAAA;AACnG,EAAM,MAAA,kBAAA;AAAA,IACJ,MAAA;AAAA,IACA,CAAA,aAAA,CAAA;AAAA,IACA,EAAE,MAAM,OAAQ,EAAA;AAAA,IAChB,kBAAA,CAAmB,SAAS,0BAA0B,CAAA;AAAA,GACxD,CAAA;AACA,EAAA,OAAO,EAAC,CAAA;AACV;;;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { applyDiscountToCharge, getCharge, listCharges, processCharge, removeDis
|
|
|
7
7
|
export { getCollection, listCollectionProducts, listCollections } from './api/collection.js';
|
|
8
8
|
export { getCreditSummary, listCreditAccounts, setApplyCreditsToNextCharge } from './api/credit.js';
|
|
9
9
|
export { getActiveChurnLandingPageURL, getCustomer, getCustomerPortalAccess, getDeliverySchedule, getFailedPaymentMethodRecoveryLandingPageURL, getGiftRedemptionLandingPageURL, sendCustomerNotification, updateCustomer } from './api/customer.js';
|
|
10
|
+
export { claimOfferCustomerSurvey, getCustomerSurveyOffers, getCustomerSurveyReasons } from './api/customerSurveys.js';
|
|
10
11
|
export { getGiftPurchase, listGiftPurchases } from './api/gift.js';
|
|
11
12
|
export { activateMembership, cancelMembership, changeMembership, getMembership, listMemberships } from './api/membership.js';
|
|
12
13
|
export { getMembershipProgram, listMembershipPrograms } from './api/membershipProgram.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -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.65.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
|
@@ -2795,6 +2795,86 @@ interface ApplyCreditOptions {
|
|
|
2795
2795
|
recurring?: boolean;
|
|
2796
2796
|
}
|
|
2797
2797
|
|
|
2798
|
+
/** @internal */
|
|
2799
|
+
interface CustomerSurveyReason {
|
|
2800
|
+
id: number;
|
|
2801
|
+
ga_id: string;
|
|
2802
|
+
reason: string;
|
|
2803
|
+
}
|
|
2804
|
+
/** @internal */
|
|
2805
|
+
interface DelayOption {
|
|
2806
|
+
delay: number;
|
|
2807
|
+
delay_unit: string;
|
|
2808
|
+
label?: string;
|
|
2809
|
+
nextShipmentDate?: string;
|
|
2810
|
+
}
|
|
2811
|
+
/** @internal */
|
|
2812
|
+
interface CustomerSurveyOfferResponse {
|
|
2813
|
+
claim_id: string;
|
|
2814
|
+
ga_id: string;
|
|
2815
|
+
display_metadata: unknown;
|
|
2816
|
+
offer_metadata: {
|
|
2817
|
+
change_frequency?: {
|
|
2818
|
+
frequency?: number;
|
|
2819
|
+
frequency_unit?: string;
|
|
2820
|
+
change_frequency_type?: string;
|
|
2821
|
+
};
|
|
2822
|
+
collection_ids?: number[];
|
|
2823
|
+
delay_options?: DelayOption[];
|
|
2824
|
+
discount_code?: string;
|
|
2825
|
+
discount_data?: {
|
|
2826
|
+
discount_percent: string;
|
|
2827
|
+
};
|
|
2828
|
+
discount_percent?: string;
|
|
2829
|
+
external_variant_id?: string;
|
|
2830
|
+
free_gift_data?: {
|
|
2831
|
+
external_product_id: number;
|
|
2832
|
+
external_variant_id: number;
|
|
2833
|
+
quantity: number;
|
|
2834
|
+
};
|
|
2835
|
+
product_id?: number;
|
|
2836
|
+
swap_data?: {
|
|
2837
|
+
collection_ids: number[];
|
|
2838
|
+
swap_type: string;
|
|
2839
|
+
};
|
|
2840
|
+
swap_type?: string;
|
|
2841
|
+
variant_id?: number;
|
|
2842
|
+
};
|
|
2843
|
+
offer_type: string;
|
|
2844
|
+
}
|
|
2845
|
+
/** @internal */
|
|
2846
|
+
interface CustomerSurveyOfferParams {
|
|
2847
|
+
change_frequency?: {
|
|
2848
|
+
frequency: string;
|
|
2849
|
+
frequency_unit: string;
|
|
2850
|
+
};
|
|
2851
|
+
claim_id: string;
|
|
2852
|
+
customer_id?: number;
|
|
2853
|
+
delay_option?: {
|
|
2854
|
+
delay: number;
|
|
2855
|
+
delay_unit: string;
|
|
2856
|
+
label?: string;
|
|
2857
|
+
nextShipmentDate?: string;
|
|
2858
|
+
};
|
|
2859
|
+
external_variant_id?: string;
|
|
2860
|
+
swap_data?: {
|
|
2861
|
+
plan_id: number;
|
|
2862
|
+
quantity: number;
|
|
2863
|
+
};
|
|
2864
|
+
}
|
|
2865
|
+
/** @internal */
|
|
2866
|
+
interface CustomerSurveyReasonsResponse {
|
|
2867
|
+
id: number;
|
|
2868
|
+
responses: CustomerSurveyReason[];
|
|
2869
|
+
}
|
|
2870
|
+
/** @internal */
|
|
2871
|
+
interface CustomerSurveyOffersResponse {
|
|
2872
|
+
response_offer_lookup: {
|
|
2873
|
+
response_id: number;
|
|
2874
|
+
offers: CustomerSurveyOfferResponse[];
|
|
2875
|
+
};
|
|
2876
|
+
}
|
|
2877
|
+
|
|
2798
2878
|
/** A gift given to a customer. */
|
|
2799
2879
|
interface GiftPurchase {
|
|
2800
2880
|
/** Unique numeric identifier for the Gift. */
|
|
@@ -3612,6 +3692,10 @@ declare function getFailedPaymentMethodRecoveryLandingPageURL(session: Session):
|
|
|
3612
3692
|
declare function getGiftRedemptionLandingPageURL(session: Session, giftId: string | number, redirectURL: string): Promise<string>;
|
|
3613
3693
|
declare function sendCustomerNotification<T extends CustomerNotification>(session: Session, notification: CustomerNotification, options?: CustomerNotificationOptions<T>): Promise<void>;
|
|
3614
3694
|
|
|
3695
|
+
declare function getCustomerSurveyReasons(session: Session, customerId: number, subscriptionId: number): Promise<CustomerSurveyReasonsResponse>;
|
|
3696
|
+
declare function getCustomerSurveyOffers(session: Session, customerId: number, customerSurveyId: number, responseId: number): Promise<CustomerSurveyOffersResponse>;
|
|
3697
|
+
declare function claimOfferCustomerSurvey(session: Session, payload: CustomerSurveyOfferParams): Promise<{}>;
|
|
3698
|
+
|
|
3615
3699
|
declare function listGiftPurchases(session: Session, options?: GiftPurchasesParams): Promise<GiftPurchasesResponse>;
|
|
3616
3700
|
declare function getGiftPurchase(session: Session, id: string | number): Promise<GiftPurchase>;
|
|
3617
3701
|
|
|
@@ -3747,4 +3831,4 @@ declare const api: {
|
|
|
3747
3831
|
};
|
|
3748
3832
|
declare function initRecharge(opt?: InitOptions): void;
|
|
3749
3833
|
|
|
3750
|
-
export { type ActivateMembershipRequest, type AddToCartCallbackSettings, type AddonProduct, type AddonSettings, type AddonsSection, type Address, type AddressIncludes, type AddressListParams, type AddressListResponse, type AddressResponse, type AddressSortBy, type AnalyticsData, type Announcement, type ApplyCreditOptions, type AssociatedAddress, type BaseProduct, type BaseProductVariant, type BaseVariant, type BasicSubscriptionParams, type BooleanLike, type BooleanNumbers, type BooleanString, type BooleanStringNumbers, type BulkSubscriptionParams, type BundleAppProxy, type BundleData, type BundleDataBaseProduct, type BundleDataCollection, type BundleDataSellingPlan, type BundleDataSellingPlanGroup, type BundleDataVariant, type BundlePriceRule, type BundleProduct, type BundleProductLayoutSettings, type BundlePurchaseItem, type BundlePurchaseItemParams, type BundleSelection, type BundleSelectionAppProxy, type BundleSelectionItem, type BundleSelectionItemRequiredCreateProps, type BundleSelectionListParams, type BundleSelectionsResponse, type BundleSelectionsSortBy, type BundleSettings, type BundleTemplateSettings, type BundleTemplateType, type BundleTranslations, type BundleVariant, type BundleVariantOptionSource, type BundleVariantRange, type BundleVariantSelectionDefault, type CDNBaseWidgetSettings, type CDNBundleSettings, type CDNBundleVariant, type CDNBundleVariantOptionSource, type CDNPlan, type CDNProduct, type CDNProductAndSettings, type CDNProductKeyObject, type CDNProductQuery_2020_12, type CDNProductQuery_2022_06, type CDNProductRaw, type CDNProductResource, type CDNProductResponseType, type CDNProductType, type CDNProductVariant_2022_06, type CDNProduct_2022_06, type CDNProductsAndSettings, type CDNProductsAndSettingsResource, type CDNStoreSettings, type CDNSubscriptionOption, type CDNVariant, type CDNVersion, type CDNWidgetSettings, type CDNWidgetSettingsRaw, type CDNWidgetSettingsResource, type CRUDRequestOptions, type CancelMembershipRequest, type CancelSubscriptionRequest, type ChangeMembershipRequest, type ChannelSettings, type Charge, type ChargeIncludes, type ChargeListParams, type ChargeListResponse, type ChargeResponse, type ChargeSortBy, type ChargeStatus, type Collection, type CollectionBinding, type CollectionListParams, type CollectionTypes, type CollectionsResponse, type CollectionsSortBy, type ColorString, type CreateAddressRequest, type CreateBundleSelectionRequest, type CreateMetafieldRequest, type CreateOnetimeRequest, type CreatePaymentMethodRequest, type CreateRecipientAddress, type CreateSubscriptionRequest, type CreateSubscriptionsParams, type CreateSubscriptionsRequest, type CreditAccount, type CreditAccountIncludes, type CreditAccountListParams, type CreditAccountType, type CreditAccountsResponse, type CreditAccountsSortBy, type CreditSummaryIncludes, type CrossSellsSection, type CrossSellsSettings, type CurrencyPriceSet, type Customer, type CustomerCreditSummary, type CustomerDeliveryScheduleParams, type CustomerDeliveryScheduleResponse, type CustomerIncludes, type CustomerNotification, type CustomerNotificationOptions, type CustomerNotificationTemplate, type CustomerNotificationType, type CustomerPortalAccessOptions, type CustomerPortalAccessResponse, type CustomerPortalSettings, type DefaultProduct, type DefaultSelection, type DefaultVariant, type DeleteSubscriptionsParams, type DeleteSubscriptionsRequest, type Delivery, type DeliveryLineItem, type DeliveryOrder, type DeliveryPaymentMethod, type Discount, type DiscountType, type DynamicBundleItemAppProxy, type DynamicBundlePropertiesAppProxy, type EligibleChargeType, type EligibleLineItemType, type ExternalAttributeSchema, type ExternalId, type ExternalProductStatus, type ExternalTransactionId, type FirstOption, type GetAddressOptions, type GetChargeOptions, type GetCreditSummaryOptions, type GetCustomerOptions, type GetMembershipProgramOptions, type GetPaymentMethodOptions, type GetRequestOptions, type GetSubscriptionOptions, type GiftPurchase, type GiftPurchasesParams, type GiftPurchasesResponse, type HTMLString, type Incentives, type InitOptions, type InternalSession, type IntervalUnit, type InventoryPolicy, type IsoDateString, type LineItem, type ListParams, type LoginResponse, type Membership, type MembershipBenefit, type MembershipIncludes, type MembershipListParams, type MembershipListResponse, type MembershipProgram, type MembershipProgramIncludes, type MembershipProgramListParams, type MembershipProgramListResponse, type MembershipProgramResponse, type MembershipProgramSortBy, type MembershipProgramStatus, type MembershipResponse, type MembershipStatus, type MembershipsSortBy, type MergeAddressesRequest, type Metafield, type MetafieldOptionalCreateProps, type MetafieldOwnerResource, type MetafieldRequiredCreateProps, type Method, type Modifier, type MultiStepSettings, type OfferAttributes, type OnePageSettings, type Onetime, type OnetimeIncludes, type OnetimeListParams, type OnetimeOptionalCreateProps, type OnetimeRequiredCreateProps, type OnetimeSubscription, type OnetimesResponse, type OnetimesSortBy, type OnlineStoreOptions, type Options, type Order, type OrderIncludes, type OrderListParams, type OrderSortBy, type OrderStatus, type OrderType, type OrdersResponse, type PasswordlessCodeResponse, type PasswordlessOptions, type PasswordlessValidateResponse, type PaymentDetails, type PaymentMethod, type PaymentMethodIncludes, type PaymentMethodListParams, type PaymentMethodOptionalCreateProps, type PaymentMethodRequiredCreateProps, type PaymentMethodSortBy, type PaymentMethodStatus, type PaymentMethodsResponse, type PaymentType, type Plan, type PlanListParams, type PlanSortBy, type PlanType, type PlansResponse, type PriceRange, type PriceRule, type PriceSet, type ProcessorName, type Product, type ProductImage, type ProductInclude, type ProductListResponse, type ProductOption, type ProductSearchParams_2020_12, type ProductSearchParams_2022_06, type ProductSearchResponse_2020_12, type ProductSearchResponse_2022_06, type ProductSearchType, type ProductSource, type ProductValueOption, type ProductVariant_2020_12, type ProductVariant_2022_06, type Product_2020_12, type Product_2022_06, type Property, type PublicBundleData, type PublishStatus, type QuantityRange, type RecurringSubscription, type ReferralInfo, type ReferralUrl, type Request, type RequestHeaders, type RequestOptions, type SellingPlan, type SellingPlanAllocation, type SellingPlanGroup, type Session, type ShippingCountriesOptions, type ShippingCountriesResponse, type ShippingCountry, type ShippingLine, type ShippingProvince, type ShopifyStorefrontOptions, type ShopifyUpdatePaymentInfoOptions, type SkipChargeParams, type SkipFutureChargeAddressRequest, type SkipFutureChargeAddressResponse, type SortBy, type SortField, type SortKeys, type StepSettings, type StepSettingsCommon, type StepSettingsTypes, type StoreSettings, type StorefrontEnvironment, type StorefrontOptions, type StorefrontPurchaseOption, type SubType, type Subscription, type SubscriptionBase, type SubscriptionCancelled, type SubscriptionIncludes, type SubscriptionListParams, type SubscriptionOption, type SubscriptionOptionalCreateProps, type SubscriptionPreferences, type SubscriptionRequiredCreateProps, type SubscriptionSortBy, type SubscriptionStatus, type Subscription_2021_01, type SubscriptionsResponse, type TaxLine, type Tier, type TieredDiscount, type TieredDiscountStatus, type Translations, type UpdateAddressParams, type UpdateAddressRequest, type UpdateBundlePurchaseItem, type UpdateBundleSelectionRequest, type UpdateCustomerRequest, type UpdateMetafieldRequest, type UpdateOnetimeRequest, type UpdatePaymentMethodRequest, type UpdateSubscriptionChargeDateParams, type UpdateSubscriptionParams, type UpdateSubscriptionRequest, type UpdateSubscriptionsParams, type UpdateSubscriptionsRequest, type Variant, type VariantSelector, type VariantSelectorStepSetting, type WidgetIconColor, type WidgetTemplateType, type WidgetVisibility, activateMembership, activateSubscription, api, applyDiscountToAddress, applyDiscountToCharge, cancelMembership, cancelSubscription, changeMembership, createAddress, createBundleSelection, createMetafield, createOnetime, createPaymentMethod, createSubscription, createSubscriptions, delayOrder, deleteAddress, deleteBundleSelection, deleteMetafield, deleteOnetime, deleteSubscriptions, getActiveChurnLandingPageURL, getAddress, getBundleId, getBundleSelection, getBundleSelectionId, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCollection, getCreditSummary, getCustomer, getCustomerPortalAccess, getDeliverySchedule, getDynamicBundleItems, getFailedPaymentMethodRecoveryLandingPageURL, getGiftPurchase, getGiftRedemptionLandingPageURL, getMembership, getMembershipProgram, getOnetime, getOrder, getPaymentMethod, getPlan, getShippingCountries, getStoreSettings, getSubscription, initRecharge, type intervalUnit, listAddresses, listBundleSelections, listCharges, listCollectionProducts, listCollections, listCreditAccounts, listGiftPurchases, listMembershipPrograms, listMemberships, listOnetimes, listOrders, listPaymentMethods, listPlans, listSubscriptions, loadBundleData, loginCustomerPortal, loginShopifyApi, loginShopifyAppProxy, loginWithShopifyCustomerAccount, loginWithShopifyStorefront, type membershipIncludes, mergeAddresses, processCharge, productSearch, removeDiscountsFromAddress, removeDiscountsFromCharge, resetCDNCache, sendCustomerNotification, sendPasswordlessCode, sendPasswordlessCodeAppProxy, setApplyCreditsToNextCharge, skipCharge, skipFutureCharge, skipGiftSubscriptionCharge, skipSubscriptionCharge, unskipCharge, updateAddress, updateBundle, updateBundleSelection, updateCustomer, updateMetafield, updateOnetime, updatePaymentMethod, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, updateSubscriptions, validateBundle, validateBundleSelection, validateDynamicBundle, validatePasswordlessCode, validatePasswordlessCodeAppProxy };
|
|
3834
|
+
export { type ActivateMembershipRequest, type AddToCartCallbackSettings, type AddonProduct, type AddonSettings, type AddonsSection, type Address, type AddressIncludes, type AddressListParams, type AddressListResponse, type AddressResponse, type AddressSortBy, type AnalyticsData, type Announcement, type ApplyCreditOptions, type AssociatedAddress, type BaseProduct, type BaseProductVariant, type BaseVariant, type BasicSubscriptionParams, type BooleanLike, type BooleanNumbers, type BooleanString, type BooleanStringNumbers, type BulkSubscriptionParams, type BundleAppProxy, type BundleData, type BundleDataBaseProduct, type BundleDataCollection, type BundleDataSellingPlan, type BundleDataSellingPlanGroup, type BundleDataVariant, type BundlePriceRule, type BundleProduct, type BundleProductLayoutSettings, type BundlePurchaseItem, type BundlePurchaseItemParams, type BundleSelection, type BundleSelectionAppProxy, type BundleSelectionItem, type BundleSelectionItemRequiredCreateProps, type BundleSelectionListParams, type BundleSelectionsResponse, type BundleSelectionsSortBy, type BundleSettings, type BundleTemplateSettings, type BundleTemplateType, type BundleTranslations, type BundleVariant, type BundleVariantOptionSource, type BundleVariantRange, type BundleVariantSelectionDefault, type CDNBaseWidgetSettings, type CDNBundleSettings, type CDNBundleVariant, type CDNBundleVariantOptionSource, type CDNPlan, type CDNProduct, type CDNProductAndSettings, type CDNProductKeyObject, type CDNProductQuery_2020_12, type CDNProductQuery_2022_06, type CDNProductRaw, type CDNProductResource, type CDNProductResponseType, type CDNProductType, type CDNProductVariant_2022_06, type CDNProduct_2022_06, type CDNProductsAndSettings, type CDNProductsAndSettingsResource, type CDNStoreSettings, type CDNSubscriptionOption, type CDNVariant, type CDNVersion, type CDNWidgetSettings, type CDNWidgetSettingsRaw, type CDNWidgetSettingsResource, type CRUDRequestOptions, type CancelMembershipRequest, type CancelSubscriptionRequest, type ChangeMembershipRequest, type ChannelSettings, type Charge, type ChargeIncludes, type ChargeListParams, type ChargeListResponse, type ChargeResponse, type ChargeSortBy, type ChargeStatus, type Collection, type CollectionBinding, type CollectionListParams, type CollectionTypes, type CollectionsResponse, type CollectionsSortBy, type ColorString, type CreateAddressRequest, type CreateBundleSelectionRequest, type CreateMetafieldRequest, type CreateOnetimeRequest, type CreatePaymentMethodRequest, type CreateRecipientAddress, type CreateSubscriptionRequest, type CreateSubscriptionsParams, type CreateSubscriptionsRequest, type CreditAccount, type CreditAccountIncludes, type CreditAccountListParams, type CreditAccountType, type CreditAccountsResponse, type CreditAccountsSortBy, type CreditSummaryIncludes, type CrossSellsSection, type CrossSellsSettings, type CurrencyPriceSet, type Customer, type CustomerCreditSummary, type CustomerDeliveryScheduleParams, type CustomerDeliveryScheduleResponse, type CustomerIncludes, type CustomerNotification, type CustomerNotificationOptions, type CustomerNotificationTemplate, type CustomerNotificationType, type CustomerPortalAccessOptions, type CustomerPortalAccessResponse, type CustomerPortalSettings, type CustomerSurveyOfferParams, type CustomerSurveyOfferResponse, type CustomerSurveyOffersResponse, type CustomerSurveyReason, type CustomerSurveyReasonsResponse, type DefaultProduct, type DefaultSelection, type DefaultVariant, type DelayOption, type DeleteSubscriptionsParams, type DeleteSubscriptionsRequest, type Delivery, type DeliveryLineItem, type DeliveryOrder, type DeliveryPaymentMethod, type Discount, type DiscountType, type DynamicBundleItemAppProxy, type DynamicBundlePropertiesAppProxy, type EligibleChargeType, type EligibleLineItemType, type ExternalAttributeSchema, type ExternalId, type ExternalProductStatus, type ExternalTransactionId, type FirstOption, type GetAddressOptions, type GetChargeOptions, type GetCreditSummaryOptions, type GetCustomerOptions, type GetMembershipProgramOptions, type GetPaymentMethodOptions, type GetRequestOptions, type GetSubscriptionOptions, type GiftPurchase, type GiftPurchasesParams, type GiftPurchasesResponse, type HTMLString, type Incentives, type InitOptions, type InternalSession, type IntervalUnit, type InventoryPolicy, type IsoDateString, type LineItem, type ListParams, type LoginResponse, type Membership, type MembershipBenefit, type MembershipIncludes, type MembershipListParams, type MembershipListResponse, type MembershipProgram, type MembershipProgramIncludes, type MembershipProgramListParams, type MembershipProgramListResponse, type MembershipProgramResponse, type MembershipProgramSortBy, type MembershipProgramStatus, type MembershipResponse, type MembershipStatus, type MembershipsSortBy, type MergeAddressesRequest, type Metafield, type MetafieldOptionalCreateProps, type MetafieldOwnerResource, type MetafieldRequiredCreateProps, type Method, type Modifier, type MultiStepSettings, type OfferAttributes, type OnePageSettings, type Onetime, type OnetimeIncludes, type OnetimeListParams, type OnetimeOptionalCreateProps, type OnetimeRequiredCreateProps, type OnetimeSubscription, type OnetimesResponse, type OnetimesSortBy, type OnlineStoreOptions, type Options, type Order, type OrderIncludes, type OrderListParams, type OrderSortBy, type OrderStatus, type OrderType, type OrdersResponse, type PasswordlessCodeResponse, type PasswordlessOptions, type PasswordlessValidateResponse, type PaymentDetails, type PaymentMethod, type PaymentMethodIncludes, type PaymentMethodListParams, type PaymentMethodOptionalCreateProps, type PaymentMethodRequiredCreateProps, type PaymentMethodSortBy, type PaymentMethodStatus, type PaymentMethodsResponse, type PaymentType, type Plan, type PlanListParams, type PlanSortBy, type PlanType, type PlansResponse, type PriceRange, type PriceRule, type PriceSet, type ProcessorName, type Product, type ProductImage, type ProductInclude, type ProductListResponse, type ProductOption, type ProductSearchParams_2020_12, type ProductSearchParams_2022_06, type ProductSearchResponse_2020_12, type ProductSearchResponse_2022_06, type ProductSearchType, type ProductSource, type ProductValueOption, type ProductVariant_2020_12, type ProductVariant_2022_06, type Product_2020_12, type Product_2022_06, type Property, type PublicBundleData, type PublishStatus, type QuantityRange, type RecurringSubscription, type ReferralInfo, type ReferralUrl, type Request, type RequestHeaders, type RequestOptions, type SellingPlan, type SellingPlanAllocation, type SellingPlanGroup, type Session, type ShippingCountriesOptions, type ShippingCountriesResponse, type ShippingCountry, type ShippingLine, type ShippingProvince, type ShopifyStorefrontOptions, type ShopifyUpdatePaymentInfoOptions, type SkipChargeParams, type SkipFutureChargeAddressRequest, type SkipFutureChargeAddressResponse, type SortBy, type SortField, type SortKeys, type StepSettings, type StepSettingsCommon, type StepSettingsTypes, type StoreSettings, type StorefrontEnvironment, type StorefrontOptions, type StorefrontPurchaseOption, type SubType, type Subscription, type SubscriptionBase, type SubscriptionCancelled, type SubscriptionIncludes, type SubscriptionListParams, type SubscriptionOption, type SubscriptionOptionalCreateProps, type SubscriptionPreferences, type SubscriptionRequiredCreateProps, type SubscriptionSortBy, type SubscriptionStatus, type Subscription_2021_01, type SubscriptionsResponse, type TaxLine, type Tier, type TieredDiscount, type TieredDiscountStatus, type Translations, type UpdateAddressParams, type UpdateAddressRequest, type UpdateBundlePurchaseItem, type UpdateBundleSelectionRequest, type UpdateCustomerRequest, type UpdateMetafieldRequest, type UpdateOnetimeRequest, type UpdatePaymentMethodRequest, type UpdateSubscriptionChargeDateParams, type UpdateSubscriptionParams, type UpdateSubscriptionRequest, type UpdateSubscriptionsParams, type UpdateSubscriptionsRequest, type Variant, type VariantSelector, type VariantSelectorStepSetting, type WidgetIconColor, type WidgetTemplateType, type WidgetVisibility, activateMembership, activateSubscription, api, applyDiscountToAddress, applyDiscountToCharge, cancelMembership, cancelSubscription, changeMembership, claimOfferCustomerSurvey, createAddress, createBundleSelection, createMetafield, createOnetime, createPaymentMethod, createSubscription, createSubscriptions, delayOrder, deleteAddress, deleteBundleSelection, deleteMetafield, deleteOnetime, deleteSubscriptions, getActiveChurnLandingPageURL, getAddress, getBundleId, getBundleSelection, getBundleSelectionId, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCollection, getCreditSummary, getCustomer, getCustomerPortalAccess, getCustomerSurveyOffers, getCustomerSurveyReasons, getDeliverySchedule, getDynamicBundleItems, getFailedPaymentMethodRecoveryLandingPageURL, getGiftPurchase, getGiftRedemptionLandingPageURL, getMembership, getMembershipProgram, getOnetime, getOrder, getPaymentMethod, getPlan, getShippingCountries, getStoreSettings, getSubscription, initRecharge, type intervalUnit, listAddresses, listBundleSelections, listCharges, listCollectionProducts, listCollections, listCreditAccounts, listGiftPurchases, listMembershipPrograms, listMemberships, listOnetimes, listOrders, listPaymentMethods, listPlans, listSubscriptions, loadBundleData, loginCustomerPortal, loginShopifyApi, loginShopifyAppProxy, loginWithShopifyCustomerAccount, loginWithShopifyStorefront, type membershipIncludes, mergeAddresses, processCharge, productSearch, removeDiscountsFromAddress, removeDiscountsFromCharge, resetCDNCache, sendCustomerNotification, sendPasswordlessCode, sendPasswordlessCodeAppProxy, setApplyCreditsToNextCharge, skipCharge, skipFutureCharge, skipGiftSubscriptionCharge, skipSubscriptionCharge, unskipCharge, updateAddress, updateBundle, updateBundleSelection, updateCustomer, updateMetafield, updateOnetime, updatePaymentMethod, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, updateSubscriptions, validateBundle, validateBundleSelection, validateDynamicBundle, validatePasswordlessCode, validatePasswordlessCodeAppProxy };
|