@rechargeapps/storefront-client 1.64.0 → 1.66.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.
@@ -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.64.0",
184
+ "X-Recharge-Sdk-Version": "1.66.0",
185
185
  ...headers ? headers : {}
186
186
  };
187
187
  return request.request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
@@ -15,7 +15,7 @@ async function loadFromOnlineStore(id, country_code) {
15
15
  const { appName, appVersion } = options.getOptions();
16
16
  const headers = {
17
17
  "X-Recharge-Sdk-Fn": "loadFromOnlineStore",
18
- "X-Recharge-Sdk-Version": "1.64.0",
18
+ "X-Recharge-Sdk-Version": "1.66.0",
19
19
  ...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
20
20
  ...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {}
21
21
  };
@@ -100,12 +100,27 @@ async function processCharge(session, id) {
100
100
  );
101
101
  return charge;
102
102
  }
103
+ async function rescheduleCharge(session, id, date) {
104
+ if (id === void 0 || id === "") {
105
+ throw new Error("ID is required");
106
+ }
107
+ const { charge } = await request.rechargeApiRequest(
108
+ "post",
109
+ `/charges/${id}/change_next_charge_date`,
110
+ {
111
+ data: { next_charge_date: date }
112
+ },
113
+ request.getInternalSession(session, "rescheduleCharge")
114
+ );
115
+ return charge;
116
+ }
103
117
 
104
118
  exports.applyDiscountToCharge = applyDiscountToCharge;
105
119
  exports.getCharge = getCharge;
106
120
  exports.listCharges = listCharges;
107
121
  exports.processCharge = processCharge;
108
122
  exports.removeDiscountsFromCharge = removeDiscountsFromCharge;
123
+ exports.rescheduleCharge = rescheduleCharge;
109
124
  exports.skipCharge = skipCharge;
110
125
  exports.unskipCharge = unskipCharge;
111
126
  //# sourceMappingURL=charge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"charge.js","sources":["../../../src/api/charge.ts"],"sourcesContent":["import {\n ChargeListParams,\n ChargeListResponse,\n ChargeResponse,\n GetChargeOptions,\n Session,\n SkipChargeParams,\n} from '../types';\nimport { getInternalSession, rechargeApiRequest } from '../utils/request';\n\n/* Retrieve a Charge using the charge_id. */\nexport async function getCharge(session: Session, id: number | string, options?: GetChargeOptions) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'get',\n `/charges`,\n { id, query: { include: options?.include } },\n getInternalSession(session, 'getCharge')\n );\n return charge;\n}\n\n/** Lists charges */\nexport function listCharges(session: Session, query?: ChargeListParams) {\n return rechargeApiRequest<ChargeListResponse>(\n 'get',\n `/charges`,\n { query },\n getInternalSession(session, 'listCharges')\n );\n}\n\n/**\n * You cannot add a Discount to an existing queued Charge if the Charge or the associated Address already has one.\n * If a Charge has a Discount and it gets updated, or a regeneration occurs, the Discount will be lost. Regeneration is a process that refreshes the Charge JSON with new data in the case of the Subscription or Address being updated.\n */\nexport async function applyDiscountToCharge(session: Session, id: number | string, discountCode: string) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/apply_discount`,\n {\n data: { discount_code: discountCode },\n },\n getInternalSession(session, 'applyDiscountToCharge')\n );\n return charge;\n}\n\n/**\n * Remove all Discounts from a Charge without destroying the Discount.\n * In most cases the Discount should be removed from the Address. When the Discount is removed from the Address, the Discount is also removed from any future Charges.\n * If the Discount is on the parent Address, you cannot remove it using charge_id.\n * When removing your Discount, it is preferable to pass the address_id so that the Discount stays removed if the Charge is regenerated. Only pass charge_id in edge cases in which there are two or more Charges on a parent Address and you only want to remove the Discount from one Charge.\n * If you pass both parameters, it will remove the Discount from the Address.\n */\nexport async function removeDiscountsFromCharge(session: Session, id: number | string) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/remove_discount`,\n {},\n getInternalSession(session, 'removeDiscountsFromCharge')\n );\n return charge;\n}\n\n/* Skip a Charge. */\nexport async function skipCharge(\n session: Session,\n id: number | string,\n purchaseItemIds: (string | number)[],\n query?: SkipChargeParams\n) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n if (purchaseItemIds === undefined || purchaseItemIds.length === 0) {\n throw new Error('Purchase item IDs are required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/skip`,\n {\n query,\n data: {\n purchase_item_ids: purchaseItemIds.map(id => Number(id)),\n },\n },\n getInternalSession(session, 'skipCharge')\n );\n return charge;\n}\n\n/* Unskip a Charge. */\nexport async function unskipCharge(\n session: Session,\n id: number | string,\n purchaseItemIds: (string | number)[],\n query?: SkipChargeParams\n) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n if (purchaseItemIds === undefined || purchaseItemIds.length === 0) {\n throw new Error('Purchase item IDs are required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/unskip`,\n {\n query,\n data: {\n purchase_item_ids: purchaseItemIds.map(id => Number(id)),\n },\n },\n getInternalSession(session, 'unskipCharge')\n );\n return charge;\n}\n\n/* Process a Charge. */\nexport async function processCharge(session: Session, id: number | string) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/process`,\n {},\n getInternalSession(session, 'processCharge')\n );\n return charge;\n}\n"],"names":["rechargeApiRequest","getInternalSession","id"],"mappings":";;;;AAWsB,eAAA,SAAA,CAAU,OAAkB,EAAA,EAAA,EAAqB,OAA4B,EAAA;AACjG,EAAI,IA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AAA,CAAA;AAAA,GAClC;AACA,EAAA,IAAI,eAAoB,KAAA,KAAA,CAAA,IAAa,eAAgB,CAAA,MAAA,KAAW,CAAG,EAAA;AACjE,IAAM,MAAA,IAAI,MAAM,gCAAgC,CAAA,CAAA;AAAA,GAClD;AACA,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,MAAMD,0BAAA;AAAA,IACvB,MAAA;AAAA,IACA,YAAY,EAAE,CAAA,OAAA,CAAA;AAAA,IACd;AAAA,MACE,KAAA;AAAA,MACA,IAAM,EAAA;AAAA,QACJ,mBAAmB,eAAgB,CAAA,GAAA,CAAI,CAAAE,GAAM,KAAA,MAAA,CAAOA,GAAE,CAAC,CAAA;AAAA,OACzD;AAAA,KACF;AAAA,IACAD,0BAAA,CAAmB,SAAS,cAAc,CAAA;AAAA,GAC5C,CAAA;AACA,EAAO,OAAA,MAAA,CAAA;AACT,CAAA;AAGsB,eAAA,aAAA,CAAc,SAAkB,EAAqB,EAAA;AACzE,EAAI,IAAA,EAAA,KAAO,KAAa,CAAA,IAAA,EAAA,KAAO,EAAI,EAAA;AACjC,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,MAAMD,0BAAA;AAAA,IACvB,MAAA;AAAA,IACA,YAAY,EAAE,CAAA,QAAA,CAAA;AAAA,IACd,EAAC;AAAA,IACDC,0BAAA,CAAmB,SAAS,eAAe,CAAA;AAAA,GAC7C,CAAA;AACA,EAAO,OAAA,MAAA,CAAA;AACT;;;;;;;;;;"}
1
+ {"version":3,"file":"charge.js","sources":["../../../src/api/charge.ts"],"sourcesContent":["import {\n ChargeListParams,\n ChargeListResponse,\n ChargeResponse,\n GetChargeOptions,\n IsoDateString,\n Session,\n SkipChargeParams,\n} from '../types';\nimport { getInternalSession, rechargeApiRequest } from '../utils/request';\n\n/* Retrieve a Charge using the charge_id. */\nexport async function getCharge(session: Session, id: number | string, options?: GetChargeOptions) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'get',\n `/charges`,\n { id, query: { include: options?.include } },\n getInternalSession(session, 'getCharge')\n );\n return charge;\n}\n\n/** Lists charges */\nexport function listCharges(session: Session, query?: ChargeListParams) {\n return rechargeApiRequest<ChargeListResponse>(\n 'get',\n `/charges`,\n { query },\n getInternalSession(session, 'listCharges')\n );\n}\n\n/**\n * You cannot add a Discount to an existing queued Charge if the Charge or the associated Address already has one.\n * If a Charge has a Discount and it gets updated, or a regeneration occurs, the Discount will be lost. Regeneration is a process that refreshes the Charge JSON with new data in the case of the Subscription or Address being updated.\n */\nexport async function applyDiscountToCharge(session: Session, id: number | string, discountCode: string) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/apply_discount`,\n {\n data: { discount_code: discountCode },\n },\n getInternalSession(session, 'applyDiscountToCharge')\n );\n return charge;\n}\n\n/**\n * Remove all Discounts from a Charge without destroying the Discount.\n * In most cases the Discount should be removed from the Address. When the Discount is removed from the Address, the Discount is also removed from any future Charges.\n * If the Discount is on the parent Address, you cannot remove it using charge_id.\n * When removing your Discount, it is preferable to pass the address_id so that the Discount stays removed if the Charge is regenerated. Only pass charge_id in edge cases in which there are two or more Charges on a parent Address and you only want to remove the Discount from one Charge.\n * If you pass both parameters, it will remove the Discount from the Address.\n */\nexport async function removeDiscountsFromCharge(session: Session, id: number | string) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/remove_discount`,\n {},\n getInternalSession(session, 'removeDiscountsFromCharge')\n );\n return charge;\n}\n\n/* Skip a Charge. */\nexport async function skipCharge(\n session: Session,\n id: number | string,\n purchaseItemIds: (string | number)[],\n query?: SkipChargeParams\n) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n if (purchaseItemIds === undefined || purchaseItemIds.length === 0) {\n throw new Error('Purchase item IDs are required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/skip`,\n {\n query,\n data: {\n purchase_item_ids: purchaseItemIds.map(id => Number(id)),\n },\n },\n getInternalSession(session, 'skipCharge')\n );\n return charge;\n}\n\n/* Unskip a Charge. */\nexport async function unskipCharge(\n session: Session,\n id: number | string,\n purchaseItemIds: (string | number)[],\n query?: SkipChargeParams\n) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n if (purchaseItemIds === undefined || purchaseItemIds.length === 0) {\n throw new Error('Purchase item IDs are required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/unskip`,\n {\n query,\n data: {\n purchase_item_ids: purchaseItemIds.map(id => Number(id)),\n },\n },\n getInternalSession(session, 'unskipCharge')\n );\n return charge;\n}\n\n/* Process a Charge. */\nexport async function processCharge(session: Session, id: number | string) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/process`,\n {},\n getInternalSession(session, 'processCharge')\n );\n return charge;\n}\n\n/* Reschedule all items associated with a Charge. */\nexport async function rescheduleCharge(session: Session, id: number | string, date: IsoDateString) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/change_next_charge_date`,\n {\n data: { next_charge_date: date },\n },\n getInternalSession(session, 'rescheduleCharge')\n );\n return charge;\n}\n"],"names":["rechargeApiRequest","getInternalSession","id"],"mappings":";;;;AAYsB,eAAA,SAAA,CAAU,OAAkB,EAAA,EAAA,EAAqB,OAA4B,EAAA;AACjG,EAAI,IAAA,EAAA,KAAO,KAAa,CAAA,IAAA,EAAA,KAAO,EAAI,EAAA;AACjC,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,E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AAA,KACjC;AAAA,IACAC,0BAAA,CAAmB,SAAS,kBAAkB,CAAA;AAAA,GAChD,CAAA;AACA,EAAO,OAAA,MAAA,CAAA;AACT;;;;;;;;;;;"}
@@ -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');
@@ -68,6 +69,7 @@ exports.getCharge = charge.getCharge;
68
69
  exports.listCharges = charge.listCharges;
69
70
  exports.processCharge = charge.processCharge;
70
71
  exports.removeDiscountsFromCharge = charge.removeDiscountsFromCharge;
72
+ exports.rescheduleCharge = charge.rescheduleCharge;
71
73
  exports.skipCharge = charge.skipCharge;
72
74
  exports.unskipCharge = charge.unskipCharge;
73
75
  exports.getCollection = collection.getCollection;
@@ -84,6 +86,9 @@ exports.getFailedPaymentMethodRecoveryLandingPageURL = customer.getFailedPayment
84
86
  exports.getGiftRedemptionLandingPageURL = customer.getGiftRedemptionLandingPageURL;
85
87
  exports.sendCustomerNotification = customer.sendCustomerNotification;
86
88
  exports.updateCustomer = customer.updateCustomer;
89
+ exports.claimOfferCustomerSurvey = customerSurveys.claimOfferCustomerSurvey;
90
+ exports.getCustomerSurveyOffers = customerSurveys.getCustomerSurveyOffers;
91
+ exports.getCustomerSurveyReasons = customerSurveys.getCustomerSurveyReasons;
87
92
  exports.getGiftPurchase = gift.getGiftPurchase;
88
93
  exports.listGiftPurchases = gift.listGiftPurchases;
89
94
  exports.activateMembership = membership.activateMembership;
@@ -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.64.0",
52
+ "X-Recharge-Sdk-Version": "1.66.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 : {}
@@ -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.64.0",
182
+ "X-Recharge-Sdk-Version": "1.66.0",
183
183
  ...headers ? headers : {}
184
184
  };
185
185
  return request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
@@ -13,7 +13,7 @@ async function loadFromOnlineStore(id, country_code) {
13
13
  const { appName, appVersion } = getOptions();
14
14
  const headers = {
15
15
  "X-Recharge-Sdk-Fn": "loadFromOnlineStore",
16
- "X-Recharge-Sdk-Version": "1.64.0",
16
+ "X-Recharge-Sdk-Version": "1.66.0",
17
17
  ...appName ? { "X-Recharge-Sdk-App-Name": appName } : {},
18
18
  ...appVersion ? { "X-Recharge-Sdk-App-Version": appVersion } : {}
19
19
  };
@@ -98,6 +98,20 @@ async function processCharge(session, id) {
98
98
  );
99
99
  return charge;
100
100
  }
101
+ async function rescheduleCharge(session, id, date) {
102
+ if (id === void 0 || id === "") {
103
+ throw new Error("ID is required");
104
+ }
105
+ const { charge } = await rechargeApiRequest(
106
+ "post",
107
+ `/charges/${id}/change_next_charge_date`,
108
+ {
109
+ data: { next_charge_date: date }
110
+ },
111
+ getInternalSession(session, "rescheduleCharge")
112
+ );
113
+ return charge;
114
+ }
101
115
 
102
- export { applyDiscountToCharge, getCharge, listCharges, processCharge, removeDiscountsFromCharge, skipCharge, unskipCharge };
116
+ export { applyDiscountToCharge, getCharge, listCharges, processCharge, removeDiscountsFromCharge, rescheduleCharge, skipCharge, unskipCharge };
103
117
  //# sourceMappingURL=charge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"charge.js","sources":["../../../src/api/charge.ts"],"sourcesContent":["import {\n ChargeListParams,\n ChargeListResponse,\n ChargeResponse,\n GetChargeOptions,\n Session,\n SkipChargeParams,\n} from '../types';\nimport { getInternalSession, rechargeApiRequest } from '../utils/request';\n\n/* Retrieve a Charge using the charge_id. */\nexport async function getCharge(session: Session, id: number | string, options?: GetChargeOptions) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'get',\n `/charges`,\n { id, query: { include: options?.include } },\n getInternalSession(session, 'getCharge')\n );\n return charge;\n}\n\n/** Lists charges */\nexport function listCharges(session: Session, query?: ChargeListParams) {\n return rechargeApiRequest<ChargeListResponse>(\n 'get',\n `/charges`,\n { query },\n getInternalSession(session, 'listCharges')\n );\n}\n\n/**\n * You cannot add a Discount to an existing queued Charge if the Charge or the associated Address already has one.\n * If a Charge has a Discount and it gets updated, or a regeneration occurs, the Discount will be lost. Regeneration is a process that refreshes the Charge JSON with new data in the case of the Subscription or Address being updated.\n */\nexport async function applyDiscountToCharge(session: Session, id: number | string, discountCode: string) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/apply_discount`,\n {\n data: { discount_code: discountCode },\n },\n getInternalSession(session, 'applyDiscountToCharge')\n );\n return charge;\n}\n\n/**\n * Remove all Discounts from a Charge without destroying the Discount.\n * In most cases the Discount should be removed from the Address. When the Discount is removed from the Address, the Discount is also removed from any future Charges.\n * If the Discount is on the parent Address, you cannot remove it using charge_id.\n * When removing your Discount, it is preferable to pass the address_id so that the Discount stays removed if the Charge is regenerated. Only pass charge_id in edge cases in which there are two or more Charges on a parent Address and you only want to remove the Discount from one Charge.\n * If you pass both parameters, it will remove the Discount from the Address.\n */\nexport async function removeDiscountsFromCharge(session: Session, id: number | string) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/remove_discount`,\n {},\n getInternalSession(session, 'removeDiscountsFromCharge')\n );\n return charge;\n}\n\n/* Skip a Charge. */\nexport async function skipCharge(\n session: Session,\n id: number | string,\n purchaseItemIds: (string | number)[],\n query?: SkipChargeParams\n) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n if (purchaseItemIds === undefined || purchaseItemIds.length === 0) {\n throw new Error('Purchase item IDs are required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/skip`,\n {\n query,\n data: {\n purchase_item_ids: purchaseItemIds.map(id => Number(id)),\n },\n },\n getInternalSession(session, 'skipCharge')\n );\n return charge;\n}\n\n/* Unskip a Charge. */\nexport async function unskipCharge(\n session: Session,\n id: number | string,\n purchaseItemIds: (string | number)[],\n query?: SkipChargeParams\n) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n if (purchaseItemIds === undefined || purchaseItemIds.length === 0) {\n throw new Error('Purchase item IDs are required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/unskip`,\n {\n query,\n data: {\n purchase_item_ids: purchaseItemIds.map(id => Number(id)),\n },\n },\n getInternalSession(session, 'unskipCharge')\n );\n return charge;\n}\n\n/* Process a Charge. */\nexport async function processCharge(session: Session, id: number | string) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/process`,\n {},\n getInternalSession(session, 'processCharge')\n );\n return charge;\n}\n"],"names":["id"],"mappings":";;AAWsB,eAAA,SAAA,CAAU,OAAkB,EAAA,EAAA,EAAqB,OAA4B,EAAA;AACjG,EAAI,IAAA,EAAA,KAAO,KAAa,CAAA,IAAA,EAAA,KAAO,EAAI,EAAA;AACjC,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,MAAM,kBAAA;AAAA,IACvB,KAAA;AAAA,IACA,CAAA,QAAA,CAAA;AAAA,IACA,EAAE,EAAI,EAAA,KAAA,EAAO,EAAE,OAAS,EAAA,OAAA,EAAS,SAAU,EAAA;AAAA,IAC3C,kBAAA,CAAmB,SAAS,WAAW,CAAA;AAAA,GACzC,CAAA;AACA,EAAO,OAAA,MAAA,CAAA;AACT,CAAA;AAGgB,SAAA,WAAA,CAAY,SAAkB,KAA0B,EAAA;AACtE,EAAO,OAAA,kBAAA;AAAA,IACL,KAAA;AAAA,IACA,CAAA,QAAA,CAAA;AAAA,IACA,EAAE,KAAM,EAAA;AAAA,IACR,kBAAA,CAAmB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AAqB,EAAA;AACzE,EAAI,IAAA,EAAA,KAAO,KAAa,CAAA,IAAA,EAAA,KAAO,EAAI,EAAA;AACjC,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,MAAM,kBAAA;AAAA,IACvB,MAAA;AAAA,IACA,YAAY,EAAE,CAAA,QAAA,CAAA;AAAA,IACd,EAAC;AAAA,IACD,kBAAA,CAAmB,SAAS,eAAe,CAAA;AAAA,GAC7C,CAAA;AACA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"charge.js","sources":["../../../src/api/charge.ts"],"sourcesContent":["import {\n ChargeListParams,\n ChargeListResponse,\n ChargeResponse,\n GetChargeOptions,\n IsoDateString,\n Session,\n SkipChargeParams,\n} from '../types';\nimport { getInternalSession, rechargeApiRequest } from '../utils/request';\n\n/* Retrieve a Charge using the charge_id. */\nexport async function getCharge(session: Session, id: number | string, options?: GetChargeOptions) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'get',\n `/charges`,\n { id, query: { include: options?.include } },\n getInternalSession(session, 'getCharge')\n );\n return charge;\n}\n\n/** Lists charges */\nexport function listCharges(session: Session, query?: ChargeListParams) {\n return rechargeApiRequest<ChargeListResponse>(\n 'get',\n `/charges`,\n { query },\n getInternalSession(session, 'listCharges')\n );\n}\n\n/**\n * You cannot add a Discount to an existing queued Charge if the Charge or the associated Address already has one.\n * If a Charge has a Discount and it gets updated, or a regeneration occurs, the Discount will be lost. Regeneration is a process that refreshes the Charge JSON with new data in the case of the Subscription or Address being updated.\n */\nexport async function applyDiscountToCharge(session: Session, id: number | string, discountCode: string) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/apply_discount`,\n {\n data: { discount_code: discountCode },\n },\n getInternalSession(session, 'applyDiscountToCharge')\n );\n return charge;\n}\n\n/**\n * Remove all Discounts from a Charge without destroying the Discount.\n * In most cases the Discount should be removed from the Address. When the Discount is removed from the Address, the Discount is also removed from any future Charges.\n * If the Discount is on the parent Address, you cannot remove it using charge_id.\n * When removing your Discount, it is preferable to pass the address_id so that the Discount stays removed if the Charge is regenerated. Only pass charge_id in edge cases in which there are two or more Charges on a parent Address and you only want to remove the Discount from one Charge.\n * If you pass both parameters, it will remove the Discount from the Address.\n */\nexport async function removeDiscountsFromCharge(session: Session, id: number | string) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/remove_discount`,\n {},\n getInternalSession(session, 'removeDiscountsFromCharge')\n );\n return charge;\n}\n\n/* Skip a Charge. */\nexport async function skipCharge(\n session: Session,\n id: number | string,\n purchaseItemIds: (string | number)[],\n query?: SkipChargeParams\n) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n if (purchaseItemIds === undefined || purchaseItemIds.length === 0) {\n throw new Error('Purchase item IDs are required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/skip`,\n {\n query,\n data: {\n purchase_item_ids: purchaseItemIds.map(id => Number(id)),\n },\n },\n getInternalSession(session, 'skipCharge')\n );\n return charge;\n}\n\n/* Unskip a Charge. */\nexport async function unskipCharge(\n session: Session,\n id: number | string,\n purchaseItemIds: (string | number)[],\n query?: SkipChargeParams\n) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n if (purchaseItemIds === undefined || purchaseItemIds.length === 0) {\n throw new Error('Purchase item IDs are required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/unskip`,\n {\n query,\n data: {\n purchase_item_ids: purchaseItemIds.map(id => Number(id)),\n },\n },\n getInternalSession(session, 'unskipCharge')\n );\n return charge;\n}\n\n/* Process a Charge. */\nexport async function processCharge(session: Session, id: number | string) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/process`,\n {},\n getInternalSession(session, 'processCharge')\n );\n return charge;\n}\n\n/* Reschedule all items associated with a Charge. */\nexport async function rescheduleCharge(session: Session, id: number | string, date: IsoDateString) {\n if (id === undefined || id === '') {\n throw new Error('ID is required');\n }\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/change_next_charge_date`,\n {\n data: { next_charge_date: date },\n },\n getInternalSession(session, 'rescheduleCharge')\n );\n return charge;\n}\n"],"names":["id"],"mappings":";;AAYsB,eAAA,SAAA,CAAU,OAAkB,EAAA,EAAA,EAAqB,OAA4B,EAAA;AACjG,EAAI,IAAA,EAAA,KAAO,KAAa,CAAA,IAAA,EAAA,KAAO,EAAI,EAAA;AACjC,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,MAAM,kBAAA;AAAA,IACvB,KAAA;AAAA,IACA,CAAA,QAAA,CAAA;AAAA,IACA,EAAE,EAAI,EAAA,KAAA,EAAO,EAAE,OAAS,EAAA,OAAA,EAAS,SAAU,EAAA;AAAA,IAC3C,kBAAA,CAAmB,SAAS,WAAW,CAAA;AAAA,GACzC,CAAA;AACA,EAAO,OAAA,MAAA,CAAA;AACT,CAAA;AAGgB,SAAA,WAAA,CAAY,SAAkB,KAA0B,EAAA;AACtE,EAAO,OAAA,kBAAA;AAAA,IACL,KAAA;AAAA,IACA,CAAA,QAAA,CAAA;AAAA,IACA,EAAE,KAAM,EAAA;AAAA,IACR,kBAAA,CAAmB,SAAS,aAAa,CAAA;AAAA,GAC3C,CAAA;AACF,CAAA;AAMsB,eAAA,qBAAA,CAAsB,OAAkB,EAAA,EAAA,EAAqB,YAAsB,EAAA;AACvG,EAAI,IAAA,EAAA,KAAO,KAAa,CAAA,IAAA,EAAA,KA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O,EAAA,GAAI,MAAM,kBAAA;AAAA,IACvB,MAAA;AAAA,IACA,YAAY,EAAE,CAAA,QAAA,CAAA;AAAA,IACd,EAAC;AAAA,IACD,kBAAA,CAAmB,SAAS,eAAe,CAAA;AAAA,GAC7C,CAAA;AACA,EAAO,OAAA,MAAA,CAAA;AACT,CAAA;AAGsB,eAAA,gBAAA,CAAiB,OAAkB,EAAA,EAAA,EAAqB,IAAqB,EAAA;AACjG,EAAI,IAAA,EAAA,KAAO,KAAa,CAAA,IAAA,EAAA,KAAO,EAAI,EAAA;AACjC,IAAM,MAAA,IAAI,MAAM,gBAAgB,CAAA,CAAA;AAAA,GAClC;AACA,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,MAAM,kBAAA;AAAA,IACvB,MAAA;AAAA,IACA,YAAY,EAAE,CAAA,wBAAA,CAAA;AAAA,IACd;AAAA,MACE,IAAA,EAAM,EAAE,gBAAA,EAAkB,IAAK,EAAA;AAAA,KACjC;AAAA,IACA,kBAAA,CAAmB,SAAS,kBAAkB,CAAA;AAAA,GAChD,CAAA;AACA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
@@ -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
@@ -3,10 +3,11 @@ export { loginCustomerPortal, loginShopifyApi, loginShopifyAppProxy, loginWithSh
3
3
  export { createBundleSelection, deleteBundleSelection, getBundleId, getBundleSelection, getBundleSelectionId, getDynamicBundleItems, listBundleSelections, updateBundle, updateBundleSelection, validateBundle, validateBundleSelection, validateDynamicBundle } from './api/bundle.js';
4
4
  export { loadBundleData } from './api/bundleData.js';
5
5
  export { getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, resetCDNCache } from './api/cdn.js';
6
- export { applyDiscountToCharge, getCharge, listCharges, processCharge, removeDiscountsFromCharge, skipCharge, unskipCharge } from './api/charge.js';
6
+ export { applyDiscountToCharge, getCharge, listCharges, processCharge, removeDiscountsFromCharge, rescheduleCharge, skipCharge, unskipCharge } from './api/charge.js';
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';
@@ -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.64.0",
50
+ "X-Recharge-Sdk-Version": "1.66.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. */
@@ -3589,6 +3669,7 @@ declare function removeDiscountsFromCharge(session: Session, id: number | string
3589
3669
  declare function skipCharge(session: Session, id: number | string, purchaseItemIds: (string | number)[], query?: SkipChargeParams): Promise<Charge>;
3590
3670
  declare function unskipCharge(session: Session, id: number | string, purchaseItemIds: (string | number)[], query?: SkipChargeParams): Promise<Charge>;
3591
3671
  declare function processCharge(session: Session, id: number | string): Promise<Charge>;
3672
+ declare function rescheduleCharge(session: Session, id: number | string, date: IsoDateString): Promise<Charge>;
3592
3673
 
3593
3674
  type ProductListResponse<T extends ProductSearchParams_2020_12 | ProductSearchParams_2022_06> = T extends ProductSearchParams_2020_12 ? {
3594
3675
  products: Product_2020_12[];
@@ -3612,6 +3693,10 @@ declare function getFailedPaymentMethodRecoveryLandingPageURL(session: Session):
3612
3693
  declare function getGiftRedemptionLandingPageURL(session: Session, giftId: string | number, redirectURL: string): Promise<string>;
3613
3694
  declare function sendCustomerNotification<T extends CustomerNotification>(session: Session, notification: CustomerNotification, options?: CustomerNotificationOptions<T>): Promise<void>;
3614
3695
 
3696
+ declare function getCustomerSurveyReasons(session: Session, customerId: number, subscriptionId: number): Promise<CustomerSurveyReasonsResponse>;
3697
+ declare function getCustomerSurveyOffers(session: Session, customerId: number, customerSurveyId: number, responseId: number): Promise<CustomerSurveyOffersResponse>;
3698
+ declare function claimOfferCustomerSurvey(session: Session, payload: CustomerSurveyOfferParams): Promise<{}>;
3699
+
3615
3700
  declare function listGiftPurchases(session: Session, options?: GiftPurchasesParams): Promise<GiftPurchasesResponse>;
3616
3701
  declare function getGiftPurchase(session: Session, id: string | number): Promise<GiftPurchase>;
3617
3702
 
@@ -3747,4 +3832,4 @@ declare const api: {
3747
3832
  };
3748
3833
  declare function initRecharge(opt?: InitOptions): void;
3749
3834
 
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 };
3835
+ 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, rescheduleCharge, 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 };