@rechargeapps/storefront-client 1.60.0 → 1.62.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.60.0",
184
+ "X-Recharge-Sdk-Version": "1.62.0",
185
185
  ...headers ? headers : {}
186
186
  };
187
187
  return request.request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
@@ -14,7 +14,7 @@ async function loadBundleData(id, options) {
14
14
  async function loadFromOnlineStore(id, country_code) {
15
15
  const headers = {
16
16
  "X-Recharge-Sdk-Fn": "loadFromOnlineStore",
17
- "X-Recharge-Sdk-Version": "1.60.0"
17
+ "X-Recharge-Sdk-Version": "1.62.0"
18
18
  };
19
19
  if (!country_code) {
20
20
  const data = await request.shopifyAppProxyRequest("get", `/bundle-data/${id}`, { headers });
@@ -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.60.0",
52
+ "X-Recharge-Sdk-Version": "1.62.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.60.0",
182
+ "X-Recharge-Sdk-Version": "1.62.0",
183
183
  ...headers ? headers : {}
184
184
  };
185
185
  return request(method, `${rechargeBaseUrl}${url}`, { id, query, data, headers: reqHeaders });
@@ -12,7 +12,7 @@ async function loadBundleData(id, options) {
12
12
  async function loadFromOnlineStore(id, country_code) {
13
13
  const headers = {
14
14
  "X-Recharge-Sdk-Fn": "loadFromOnlineStore",
15
- "X-Recharge-Sdk-Version": "1.60.0"
15
+ "X-Recharge-Sdk-Version": "1.62.0"
16
16
  };
17
17
  if (!country_code) {
18
18
  const data = await shopifyAppProxyRequest("get", `/bundle-data/${id}`, { headers });
@@ -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.60.0",
50
+ "X-Recharge-Sdk-Version": "1.62.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
@@ -272,6 +272,164 @@ interface CreateMetafieldRequest extends SubType<Metafield, MetafieldRequiredCre
272
272
  interface UpdateMetafieldRequest extends Partial<Pick<Metafield, 'description' | 'owner_id' | 'owner_resource' | 'value' | 'value_type'>> {
273
273
  }
274
274
 
275
+ interface ShippingLine {
276
+ /** The code associated with the shipping_line of a Charge. */
277
+ code: string;
278
+ /** The price of the shipping_line. */
279
+ price: string;
280
+ /** The date and time when the shipping_line was retrieved. */
281
+ retrieved_at: IsoDateString | null;
282
+ /** The source of the shipping_line. */
283
+ source: string;
284
+ /** The status the shipping_line. */
285
+ status?: 'active' | 'pending' | 'queued';
286
+ /** The title of the shipping_line. */
287
+ title: string;
288
+ /** A boolean indicating if the shipping_line is taxable. */
289
+ taxable: boolean;
290
+ /** An array of tax lines associated with the shipping_line. */
291
+ tax_lines: TaxLine[];
292
+ }
293
+ type OrderStatus = 'success' | 'error' | 'queued' | 'cancelled' | 'pending_charge_status';
294
+ type OrderType = 'checkout' | 'recurring';
295
+ interface Order {
296
+ /** The unique numeric identifier for the order. */
297
+ id: number;
298
+ /** The id of the associated Address within Recharge. */
299
+ address_id: number;
300
+ /** The billing address at the time the order was created. See Addresses for detailed address information. */
301
+ billing_address: AssociatedAddress;
302
+ /** An object containing parameters of the Charge. */
303
+ charge: {
304
+ /** The id of the charge associated with this order. */
305
+ id: number;
306
+ /** An object containing external transaction ids associated with this charge, as they appear in external platforms. */
307
+ external_transaction_id: ExternalTransactionId;
308
+ /** The name of the payment processor used for this charge. */
309
+ payment_processor_name: string;
310
+ /** The status of the charge. */
311
+ status: ChargeStatus;
312
+ };
313
+ /** Details of the access method used by the purchase. */
314
+ client_details: {
315
+ /** The IP address of the buyer as detected in Checkout. */
316
+ browser_ip: string;
317
+ /** The user agent detected during Checkout. */
318
+ user_agent: string | null;
319
+ };
320
+ /** The date when the order was created. */
321
+ created_at: IsoDateString;
322
+ /** The currency of the payment used to create the order. */
323
+ currency: string;
324
+ /** Object that contains information about the Customer. */
325
+ customer: {
326
+ /** The ID of the associated customer record. */
327
+ id: number;
328
+ /** The user email. */
329
+ email: string;
330
+ /** An object containing customer information associated with this charge. */
331
+ external_customer_id: ExternalId;
332
+ /** The hash of the Customer associated with the Charge. */
333
+ hash: string;
334
+ };
335
+ /** An array of Discounts associated with the Order. */
336
+ discounts: Discount[];
337
+ /** The cart token as it appears in an external system. */
338
+ external_cart_token: string | null;
339
+ /** An object containing external order ids. */
340
+ external_order_id?: ExternalId;
341
+ /** An object containing the external order numbers. */
342
+ external_order_number: ExternalId;
343
+ /** A boolean representing if this Order is generated from a prepaid purchase. */
344
+ is_prepaid?: boolean;
345
+ /** A list of line_item objects. */
346
+ line_items: LineItem[];
347
+ /** Notes associated with the Order. */
348
+ note: string | null;
349
+ /** An array of name value pairs of note attributes on the Order. */
350
+ order_attributes: Property[];
351
+ /** The date time that the associated charge was processed at. */
352
+ processed_at: IsoDateString | null;
353
+ /** The date time of when the associated charge is/was scheduled to process. */
354
+ scheduled_at: IsoDateString;
355
+ /** The shipping address where the order will be shipped. See Addresses for detailed Address information. */
356
+ shipping_address: AssociatedAddress;
357
+ /** An array of shipping lines associated with the order. */
358
+ shipping_lines: ShippingLine[];
359
+ /** The status of creating the Order. */
360
+ status: OrderStatus;
361
+ /** The subtotal price (sum of all line items * their quantity) of the order less discounts. */
362
+ subtotal_price: string;
363
+ /** A comma separated list of tags on the Order. */
364
+ tags: string;
365
+ /** An array of tax lines that apply to the Order. */
366
+ tax_lines: TaxLine[];
367
+ /** A boolean indicator of the taxability of the Order. */
368
+ taxable: boolean;
369
+ /** The total discounted dollar value of the Order. */
370
+ total_discounts: string;
371
+ /** The total price of all line items of the Order. */
372
+ total_line_items_price: string;
373
+ /** The total amount due of the Order. */
374
+ total_price: string;
375
+ /** The total dollar amount of refunds associated with the Order. */
376
+ total_refunds: string;
377
+ /** The total tax due associated with the Order. */
378
+ total_tax: string;
379
+ /** The total weight of the order in grams. */
380
+ total_weight_grams: number;
381
+ /** An indicator of the order’s type. */
382
+ type: OrderType;
383
+ /** The date time at which the order was most recently updated. */
384
+ updated_at: IsoDateString;
385
+ /** Error information about the order if status is 'error' */
386
+ error: string | null;
387
+ /** Additional information as requested */
388
+ include?: {
389
+ customer?: Customer;
390
+ metafields?: Metafield[];
391
+ };
392
+ }
393
+ type OrderIncludes = 'customer' | 'metafields';
394
+ interface OrdersResponse {
395
+ next_cursor: null | string;
396
+ previous_cursor: null | string;
397
+ orders: Order[];
398
+ }
399
+ type OrderSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc' | 'processed_at-asc' | 'processed_at-desc' | 'scheduled_at-asc' | 'scheduled_at-desc';
400
+ interface OrderListParams extends ListParams<OrderSortBy> {
401
+ /** Filter orders by address. */
402
+ address_id?: string | number;
403
+ /** Filter orders by charge. */
404
+ charge_id?: string | number;
405
+ /** Show orders created after the given date. */
406
+ created_at_min?: IsoDateString;
407
+ /** Show orders created before the given date. */
408
+ created_at_max?: IsoDateString;
409
+ /** Filter orders by external_order_id. */
410
+ external_order_id?: string | number;
411
+ /** Filter orders by id. */
412
+ ids?: (string | number)[];
413
+ /** Show orders scheduled before the given date. */
414
+ scheduled_at_max?: IsoDateString;
415
+ /** Show orders scheduled after the given date. */
416
+ scheduled_at_min?: IsoDateString;
417
+ /** Filter orders with/without external_order_id. */
418
+ has_external_order?: boolean;
419
+ /** Filter orders by status. */
420
+ status?: OrderStatus;
421
+ /** Filter orders by type. */
422
+ type?: OrderType;
423
+ /** Filter orders by subscription or onetime. */
424
+ purchase_item_id?: string | number;
425
+ /** Show orders updated before the given date. */
426
+ updated_at_max?: IsoDateString;
427
+ /** Show orders updated after the given date. */
428
+ updated_at_min?: IsoDateString;
429
+ /** Include related data options */
430
+ include?: OrderIncludes[];
431
+ }
432
+
275
433
  interface PaymentDetails {
276
434
  /** Payment_method brand or company powering it. valid for CREDIT_CARD only. */
277
435
  brand?: string;
@@ -815,6 +973,14 @@ interface BundleData {
815
973
  };
816
974
  }
817
975
 
976
+ interface CustomerEntitlement {
977
+ name: string;
978
+ id: number;
979
+ lookup_key: string;
980
+ expires_at?: IsoDateString;
981
+ description?: string;
982
+ }
983
+
818
984
  type SubscriptionStatus = 'active' | 'cancelled' | 'expired' | 'onetime';
819
985
  interface SubscriptionBase {
820
986
  /** Unique numeric identifier for the subscription. */
@@ -847,6 +1013,8 @@ interface SubscriptionBase {
847
1013
  external_variant_id: ExternalId;
848
1014
  /** Retrieves true if there is queued charge. Otherwise, retrieves false. */
849
1015
  has_queued_charges: boolean;
1016
+ /** Value is set to true if it is a digital item. */
1017
+ is_digital: boolean;
850
1018
  /** Value is set to true if it is a prepaid item. */
851
1019
  is_prepaid: boolean;
852
1020
  /** Value is set to true if it is not a prepaid item */
@@ -904,6 +1072,7 @@ interface SubscriptionBase {
904
1072
  metafields?: Metafield[];
905
1073
  bundle_selections?: BundleSelection | null;
906
1074
  bundle_product?: BundleProduct | null;
1075
+ customer_entitlements?: CustomerEntitlement[] | null;
907
1076
  };
908
1077
  }
909
1078
  interface RecurringSubscription extends SubscriptionBase {
@@ -1174,17 +1343,24 @@ interface DeliveryLineItem extends Omit<LineItem, 'external_inventory_policy' |
1174
1343
  }
1175
1344
  interface DeliveryPaymentMethod extends Omit<PaymentMethod, 'created_at' | 'customer_id' | 'default' | 'payment_type' | 'processor_customer_token' | 'processor_name' | 'processor_payment_method_token' | 'status_reason' | 'status' | 'updated_at'> {
1176
1345
  payment_details: PaymentDetails;
1346
+ payment_type: PaymentType;
1177
1347
  billing_address: AssociatedAddress;
1178
1348
  }
1179
1349
  interface DeliveryOrder {
1180
- id: number | null;
1181
1350
  address_id: number;
1182
1351
  charge_id: number | null;
1352
+ currency: string;
1353
+ has_uncommitted_changes: boolean;
1354
+ id: number | null;
1183
1355
  line_items: DeliveryLineItem[];
1356
+ order_subtotal: string;
1184
1357
  payment_method: DeliveryPaymentMethod;
1185
1358
  shipping_address: AssociatedAddress;
1186
- order_subtotal: string;
1187
- currency: string;
1359
+ shipping_lines: ShippingLine[];
1360
+ total_discounts: string;
1361
+ total_duties: string;
1362
+ total_price: string;
1363
+ total_tax: string;
1188
1364
  }
1189
1365
  interface Delivery {
1190
1366
  date: IsoDateString;
@@ -1215,162 +1391,6 @@ interface CustomerPortalAccessResponse {
1215
1391
  temp_token: string;
1216
1392
  }
1217
1393
 
1218
- interface ShippingLine {
1219
- /** The code associated with the shipping_line of a Charge. */
1220
- code: string;
1221
- /** The price of the shipping_line. */
1222
- price: string;
1223
- /** The source of the shipping_line. */
1224
- source: string;
1225
- /** The status the shipping_line. */
1226
- status?: 'active' | 'pending' | 'queued';
1227
- /** The title of the shipping_line. */
1228
- title: string;
1229
- /** A boolean indicating if the shipping_line is taxable. */
1230
- taxable: boolean;
1231
- /** An array of tax lines associated with the shipping_line. */
1232
- tax_lines: TaxLine[];
1233
- }
1234
- type OrderStatus = 'success' | 'error' | 'queued' | 'cancelled' | 'pending_charge_status';
1235
- type OrderType = 'checkout' | 'recurring';
1236
- interface Order {
1237
- /** The unique numeric identifier for the order. */
1238
- id: number;
1239
- /** The id of the associated Address within Recharge. */
1240
- address_id: number;
1241
- /** The billing address at the time the order was created. See Addresses for detailed address information. */
1242
- billing_address: AssociatedAddress;
1243
- /** An object containing parameters of the Charge. */
1244
- charge: {
1245
- /** The id of the charge associated with this order. */
1246
- id: number;
1247
- /** An object containing external transaction ids associated with this charge, as they appear in external platforms. */
1248
- external_transaction_id: ExternalTransactionId;
1249
- /** The name of the payment processor used for this charge. */
1250
- payment_processor_name: string;
1251
- /** The status of the charge. */
1252
- status: ChargeStatus;
1253
- };
1254
- /** Details of the access method used by the purchase. */
1255
- client_details: {
1256
- /** The IP address of the buyer as detected in Checkout. */
1257
- browser_ip: string;
1258
- /** The user agent detected during Checkout. */
1259
- user_agent: string | null;
1260
- };
1261
- /** The date when the order was created. */
1262
- created_at: IsoDateString;
1263
- /** The currency of the payment used to create the order. */
1264
- currency: string;
1265
- /** Object that contains information about the Customer. */
1266
- customer: {
1267
- /** The ID of the associated customer record. */
1268
- id: number;
1269
- /** The user email. */
1270
- email: string;
1271
- /** An object containing customer information associated with this charge. */
1272
- external_customer_id: ExternalId;
1273
- /** The hash of the Customer associated with the Charge. */
1274
- hash: string;
1275
- };
1276
- /** An array of Discounts associated with the Order. */
1277
- discounts: Discount[];
1278
- /** The cart token as it appears in an external system. */
1279
- external_cart_token: string | null;
1280
- /** An object containing external order ids. */
1281
- external_order_id?: ExternalId;
1282
- /** An object containing the external order numbers. */
1283
- external_order_number: ExternalId;
1284
- /** A boolean representing if this Order is generated from a prepaid purchase. */
1285
- is_prepaid?: boolean;
1286
- /** A list of line_item objects. */
1287
- line_items: LineItem[];
1288
- /** Notes associated with the Order. */
1289
- note: string | null;
1290
- /** An array of name value pairs of note attributes on the Order. */
1291
- order_attributes: Property[];
1292
- /** The date time that the associated charge was processed at. */
1293
- processed_at: IsoDateString | null;
1294
- /** The date time of when the associated charge is/was scheduled to process. */
1295
- scheduled_at: IsoDateString;
1296
- /** The shipping address where the order will be shipped. See Addresses for detailed Address information. */
1297
- shipping_address: AssociatedAddress;
1298
- /** An array of shipping lines associated with the order. */
1299
- shipping_lines: ShippingLine[];
1300
- /** The status of creating the Order. */
1301
- status: OrderStatus;
1302
- /** The subtotal price (sum of all line items * their quantity) of the order less discounts. */
1303
- subtotal_price: string;
1304
- /** A comma separated list of tags on the Order. */
1305
- tags: string;
1306
- /** An array of tax lines that apply to the Order. */
1307
- tax_lines: TaxLine[];
1308
- /** A boolean indicator of the taxability of the Order. */
1309
- taxable: boolean;
1310
- /** The total discounted dollar value of the Order. */
1311
- total_discounts: string;
1312
- /** The total price of all line items of the Order. */
1313
- total_line_items_price: string;
1314
- /** The total amount due of the Order. */
1315
- total_price: string;
1316
- /** The total dollar amount of refunds associated with the Order. */
1317
- total_refunds: string;
1318
- /** The total tax due associated with the Order. */
1319
- total_tax: string;
1320
- /** The total weight of the order in grams. */
1321
- total_weight_grams: number;
1322
- /** An indicator of the order’s type. */
1323
- type: OrderType;
1324
- /** The date time at which the order was most recently updated. */
1325
- updated_at: IsoDateString;
1326
- /** Error information about the order if status is 'error' */
1327
- error: string | null;
1328
- /** Additional information as requested */
1329
- include?: {
1330
- customer?: Customer;
1331
- metafields?: Metafield[];
1332
- };
1333
- }
1334
- type OrderIncludes = 'customer' | 'metafields';
1335
- interface OrdersResponse {
1336
- next_cursor: null | string;
1337
- previous_cursor: null | string;
1338
- orders: Order[];
1339
- }
1340
- type OrderSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc' | 'processed_at-asc' | 'processed_at-desc' | 'scheduled_at-asc' | 'scheduled_at-desc';
1341
- interface OrderListParams extends ListParams<OrderSortBy> {
1342
- /** Filter orders by address. */
1343
- address_id?: string | number;
1344
- /** Filter orders by charge. */
1345
- charge_id?: string | number;
1346
- /** Show orders created after the given date. */
1347
- created_at_min?: IsoDateString;
1348
- /** Show orders created before the given date. */
1349
- created_at_max?: IsoDateString;
1350
- /** Filter orders by external_order_id. */
1351
- external_order_id?: string | number;
1352
- /** Filter orders by id. */
1353
- ids?: (string | number)[];
1354
- /** Show orders scheduled before the given date. */
1355
- scheduled_at_max?: IsoDateString;
1356
- /** Show orders scheduled after the given date. */
1357
- scheduled_at_min?: IsoDateString;
1358
- /** Filter orders with/without external_order_id. */
1359
- has_external_order?: boolean;
1360
- /** Filter orders by status. */
1361
- status?: OrderStatus;
1362
- /** Filter orders by type. */
1363
- type?: OrderType;
1364
- /** Filter orders by subscription or onetime. */
1365
- purchase_item_id?: string | number;
1366
- /** Show orders updated before the given date. */
1367
- updated_at_max?: IsoDateString;
1368
- /** Show orders updated after the given date. */
1369
- updated_at_min?: IsoDateString;
1370
- /** Include related data options */
1371
- include?: OrderIncludes[];
1372
- }
1373
-
1374
1394
  type ChargeStatus = 'success' | 'error' | 'queued' | 'skipped' | 'refunded' | 'partially_refunded' | 'pending_manual_payment' | 'pending';
1375
1395
  interface Charge {
1376
1396
  /** The unique numeric identifier for the Charge. */