@rechargeapps/storefront-client 0.7.0 → 0.8.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/address.js.map +1 -1
- package/dist/cjs/api/auth.js +2 -2
- package/dist/cjs/api/auth.js.map +1 -1
- package/dist/cjs/api/charge.js +0 -10
- package/dist/cjs/api/charge.js.map +1 -1
- package/dist/cjs/api/{user.js → customer.js} +8 -8
- package/dist/cjs/api/customer.js.map +1 -0
- package/dist/cjs/index.js +4 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/request.js +6 -10
- package/dist/cjs/utils/request.js.map +1 -1
- package/dist/esm/api/address.js.map +1 -1
- package/dist/esm/api/auth.js +2 -2
- package/dist/esm/api/auth.js.map +1 -1
- package/dist/esm/api/charge.js +1 -9
- package/dist/esm/api/charge.js.map +1 -1
- package/dist/esm/api/{user.js → customer.js} +7 -7
- package/dist/esm/api/customer.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/utils/request.js +6 -10
- package/dist/esm/utils/request.js.map +1 -1
- package/dist/index.d.ts +9 -20
- package/dist/umd/recharge-storefront-client.min.js +7 -7
- package/dist/umd/recharge-storefront-client.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/api/user.js.map +0 -1
- package/dist/esm/api/user.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.js","sources":["../../../src/api/address.ts"],"sourcesContent":["import { rechargeApiRequest } from '../utils/request';\nimport {\n AddressResponse,\n AddressListParams,\n CreateAddressRequest,\n UpdateAddressRequest,\n AddressListResponse,\n MergeAddressesRequest,\n SkipFutureChargeAddressRequest,\n SkipFutureChargeAddressResponse,\n} from '../types/address';\nimport { Session } from '../types/session';\n\n/** Returns all addresses from the store, or addresses for the
|
|
1
|
+
{"version":3,"file":"address.js","sources":["../../../src/api/address.ts"],"sourcesContent":["import { rechargeApiRequest } from '../utils/request';\nimport {\n AddressResponse,\n AddressListParams,\n CreateAddressRequest,\n UpdateAddressRequest,\n AddressListResponse,\n MergeAddressesRequest,\n SkipFutureChargeAddressRequest,\n SkipFutureChargeAddressResponse,\n} from '../types/address';\nimport { Session } from '../types/session';\n\n/** Returns all addresses from the store, or addresses for the customer given in the parameter. */\nexport function listAddresses(session: Session, query?: AddressListParams) {\n return rechargeApiRequest<AddressListResponse>('get', `/addresses`, { query }, session);\n}\n\n/** Retrieves address for customer based on specified address id. */\nexport async function getAddress(session: Session, id: string | number) {\n const { address } = await rechargeApiRequest<AddressResponse>('get', `/addresses`, { id }, session);\n return address;\n}\n\n/** Create a new address for a customer. */\nexport async function createAddress(session: Session, createRequest: CreateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>('post', `/addresses`, { data: createRequest }, session);\n return address;\n}\n\n/** Updates an existing address to match the specified parameters. */\nexport async function updateAddress(session: Session, id: string | number, updateRequest: UpdateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'put',\n `/addresses`,\n { id, data: updateRequest },\n session\n );\n return address;\n}\n\n/** Deletes an address. Only Addresses with no active Subscriptions can be deleted. */\nexport function deleteAddress(session: Session, id: string | number) {\n return rechargeApiRequest<void>('delete', `/addresses`, { id }, session);\n}\n\n/**\n * Merges up to 10 source addresses into 1 target address.\n */\nexport async function mergeAddresses(session: Session, mergeRequest: MergeAddressesRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'post',\n `/addresses/merge`,\n {\n data: mergeRequest,\n },\n session\n );\n return address;\n}\n\n/**\n * Skip a Charge in the future for one or multiple Subscriptions associated with the Address.\n */\nexport async function skipFutureCharge(\n session: Session,\n id: string | number,\n skipRequest: SkipFutureChargeAddressRequest\n) {\n const { charge } = await rechargeApiRequest<SkipFutureChargeAddressResponse>(\n 'post',\n `/addresses/${id}/charges/skip`,\n {\n data: skipRequest,\n },\n session\n );\n return charge;\n}\n"],"names":["rechargeApiRequest"],"mappings":";;;;;;AACO,SAAS,aA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E,IAAI,IAAI,EAAE,YAAY;AACtB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACM,eAAe,gBAAgB,CAAC,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE;AACjE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE;AACvF,IAAI,IAAI,EAAE,WAAW;AACrB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,MAAM,CAAC;AAChB;;;;;;;;;;"}
|
package/dist/cjs/api/auth.js
CHANGED
|
@@ -8,7 +8,7 @@ var api = require('../constants/api.js');
|
|
|
8
8
|
|
|
9
9
|
async function loginShopifyAppProxy() {
|
|
10
10
|
const response = await request.shopifyAppProxyRequest("get", "/logged_in_customer_poc");
|
|
11
|
-
return response.api_token ? { apiToken: response.api_token,
|
|
11
|
+
return response.api_token ? { apiToken: response.api_token, customerId: response.customer_id } : null;
|
|
12
12
|
}
|
|
13
13
|
async function loginShopifyApi(customerAccessToken, storefrontAccessToken) {
|
|
14
14
|
const opts = options.getOptions();
|
|
@@ -23,7 +23,7 @@ async function loginShopifyApi(customerAccessToken, storefrontAccessToken) {
|
|
|
23
23
|
"X-Recharge-App": "storefront-client"
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
return response.api_token ? { apiToken: response.api_token,
|
|
26
|
+
return response.api_token ? { apiToken: response.api_token, customerId: response.customer_id } : null;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
exports.loginShopifyApi = loginShopifyApi;
|
package/dist/cjs/api/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sources":["../../../src/api/auth.ts"],"sourcesContent":["import { request as baseRequest, shopifyAppProxyRequest } from '../utils/request';\nimport { LoginResponse } from '../types/auth';\nimport { getOptions } from '../utils/options';\nimport { RECHARGE_ADMIN_URL } from '../constants/api';\nimport { Session } from '../types/session';\n\nexport async function loginShopifyAppProxy(): Promise<Session | null> {\n const response = await shopifyAppProxyRequest<LoginResponse>('get', '/logged_in_customer_poc');\n\n return response.api_token ? { apiToken: response.api_token,
|
|
1
|
+
{"version":3,"file":"auth.js","sources":["../../../src/api/auth.ts"],"sourcesContent":["import { request as baseRequest, shopifyAppProxyRequest } from '../utils/request';\nimport { LoginResponse } from '../types/auth';\nimport { getOptions } from '../utils/options';\nimport { RECHARGE_ADMIN_URL } from '../constants/api';\nimport { Session } from '../types/session';\n\nexport async function loginShopifyAppProxy(): Promise<Session | null> {\n const response = await shopifyAppProxyRequest<LoginResponse>('get', '/logged_in_customer_poc');\n\n return response.api_token ? { apiToken: response.api_token, customerId: response.customer_id } : null;\n}\n\nexport async function loginShopifyApi(\n customerAccessToken: string,\n storefrontAccessToken: string\n): Promise<Session | null> {\n const opts = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(opts.environment);\n const response = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/hydrogen_login_poc`, {\n data: {\n customer_token: customerAccessToken,\n storefront_token: storefrontAccessToken,\n shop_url: opts.storeIdentifier,\n },\n headers: {\n 'X-Recharge-App': 'storefront-client',\n },\n });\n\n return response.api_token ? { apiToken: response.api_token, customerId: response.customer_id } : null;\n}\n"],"names":["shopifyAppProxyRequest","getOptions","RECHARGE_ADMIN_URL","baseRequest"],"mappings":";;;;;;;;AAGO,eAAe,oBAAoB,GAAG;AAC7C,EAAE,MAAM,QAAQ,GAAG,MAAMA,8BAAsB,CAAC,KAAK,EAAE,yBAAyB,CAAC,CAAC;AAClF,EAAE,OAAO,QAAQ,CAAC,SAAS,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;AACxG,CAAC;AACM,eAAe,eAAe,CAAC,mBAAmB,EAAE,qBAAqB,EAAE;AAClF,EAAE,MAAM,IAAI,GAAGC,kBAAU,EAAE,CAAC;AAC5B,EAAE,MAAM,eAAe,GAAGC,sBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAC/D,EAAE,MAAM,QAAQ,GAAG,MAAMC,eAAW,CAAC,MAAM,EAAE,CAAC,EAAE,eAAe,CAAC,mBAAmB,CAAC,EAAE;AACtF,IAAI,IAAI,EAAE;AACV,MAAM,cAAc,EAAE,mBAAmB;AACzC,MAAM,gBAAgB,EAAE,qBAAqB;AAC7C,MAAM,QAAQ,EAAE,IAAI,CAAC,eAAe;AACpC,KAAK;AACL,IAAI,OAAO,EAAE;AACb,MAAM,gBAAgB,EAAE,mBAAmB;AAC3C,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,QAAQ,CAAC,SAAS,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;AACxG;;;;;"}
|
package/dist/cjs/api/charge.js
CHANGED
|
@@ -29,25 +29,15 @@ async function unskipCharge(session, id) {
|
|
|
29
29
|
const { charge } = await request.rechargeApiRequest("post", `/charges/${id}/unskip`, {}, session);
|
|
30
30
|
return charge;
|
|
31
31
|
}
|
|
32
|
-
async function refundCharge(session, id, refundRequest) {
|
|
33
|
-
const { charge } = await request.rechargeApiRequest("post", `/charges/${id}/refund`, { data: refundRequest }, session);
|
|
34
|
-
return charge;
|
|
35
|
-
}
|
|
36
32
|
async function processCharge(session, id) {
|
|
37
33
|
const { charge } = await request.rechargeApiRequest("post", `/charges/${id}/process`, {}, session);
|
|
38
34
|
return charge;
|
|
39
35
|
}
|
|
40
|
-
async function captureCharge(session, id) {
|
|
41
|
-
const { charge } = await request.rechargeApiRequest("post", `/charges/${id}/capture_payment`, {}, session);
|
|
42
|
-
return charge;
|
|
43
|
-
}
|
|
44
36
|
|
|
45
37
|
exports.applyDiscount = applyDiscount;
|
|
46
|
-
exports.captureCharge = captureCharge;
|
|
47
38
|
exports.getCharge = getCharge;
|
|
48
39
|
exports.listCharges = listCharges;
|
|
49
40
|
exports.processCharge = processCharge;
|
|
50
|
-
exports.refundCharge = refundCharge;
|
|
51
41
|
exports.removeDiscount = removeDiscount;
|
|
52
42
|
exports.skipCharge = skipCharge;
|
|
53
43
|
exports.unskipCharge = unskipCharge;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charge.js","sources":["../../../src/api/charge.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"charge.js","sources":["../../../src/api/charge.ts"],"sourcesContent":["import { ApplyDiscountRequest, ChargeListParams, ChargeListResponse, ChargeResponse } from '../types/charge';\nimport { Session } from '../types/session';\nimport { rechargeApiRequest } from '../utils/request';\n\n/* Retrieve a Charge using the charge_id. */\nexport async function getCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('get', `/charges`, { id }, session);\n return charge;\n}\n\n/** Lists charges */\nexport function listCharges(session: Session, query?: ChargeListParams) {\n return rechargeApiRequest<ChargeListResponse>('get', `/charges`, { query }, session);\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 * You can provide either discount_id or discount_code. If both parameters are passed, the value for discount_id will take precedence.\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 applyDiscount(session: Session, id: number | string, applyRequest: ApplyDiscountRequest) {\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/apply_discount`,\n {\n data: applyRequest,\n },\n session\n );\n return charge;\n}\n\n/**\n * Remove a Discount 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 removeDiscount(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/remove_discount`, {}, session);\n return charge;\n}\n\n/* Skip a Charge. */\nexport async function skipCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/skip`, {}, session);\n return charge;\n}\n\n/* Unskip a Charge. */\nexport async function unskipCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/unskip`, {}, session);\n return charge;\n}\n\n/** The charge processing route can be used to process Charges that are in a queued or error status. */\nexport async function processCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/process`, {}, session);\n return charge;\n}\n"],"names":["rechargeApiRequest"],"mappings":";;;;;;AACO,eAAe,SAAS,CAAC,OAAO,EAAE,EAAE,EAAE;AAC7C,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMA,0BAAkB,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAClF,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,SAAS,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE;AAC5C,EAAE,OAAOA,0BAAkB,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC;AACM,eAAe,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE;AAC/D,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE;AACvF,IAAI,IAAI,EAAE,YAAY;AACtB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,eAAe,cAAc,CAAC,OAAO,EAAE,EAAE,EAAE;AAClD,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AACrG,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,eAAe,UAAU,CAAC,OAAO,EAAE,EAAE,EAAE;AAC9C,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC1F,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,eAAe,YAAY,CAAC,OAAO,EAAE,EAAE,EAAE;AAChD,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC5F,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,eAAe,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE;AACjD,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAMA,0BAAkB,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC7F,EAAE,OAAO,MAAM,CAAC;AAChB;;;;;;;;;;"}
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var request = require('../utils/request.js');
|
|
6
6
|
|
|
7
|
-
async function
|
|
8
|
-
const id = session.
|
|
7
|
+
async function getCustomer(session) {
|
|
8
|
+
const id = session.customerId;
|
|
9
9
|
if (!id) {
|
|
10
10
|
throw new Error("Not logged in.");
|
|
11
11
|
}
|
|
@@ -14,8 +14,8 @@ async function getUser(session) {
|
|
|
14
14
|
}, session);
|
|
15
15
|
return customer;
|
|
16
16
|
}
|
|
17
|
-
async function
|
|
18
|
-
const id = session.
|
|
17
|
+
async function updateCustomer(session, updateRequest) {
|
|
18
|
+
const id = session.customerId;
|
|
19
19
|
if (!id) {
|
|
20
20
|
throw new Error("Not logged in.");
|
|
21
21
|
}
|
|
@@ -23,7 +23,7 @@ async function updateUser(session, updateRequest) {
|
|
|
23
23
|
return customer;
|
|
24
24
|
}
|
|
25
25
|
async function getDeliverySchedule(session, query) {
|
|
26
|
-
const id = session.
|
|
26
|
+
const id = session.customerId;
|
|
27
27
|
if (!id) {
|
|
28
28
|
throw new Error("Not logged in.");
|
|
29
29
|
}
|
|
@@ -31,7 +31,7 @@ async function getDeliverySchedule(session, query) {
|
|
|
31
31
|
return deliveries;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
exports.getCustomer = getCustomer;
|
|
34
35
|
exports.getDeliverySchedule = getDeliverySchedule;
|
|
35
|
-
exports.
|
|
36
|
-
|
|
37
|
-
//# sourceMappingURL=user.js.map
|
|
36
|
+
exports.updateCustomer = updateCustomer;
|
|
37
|
+
//# sourceMappingURL=customer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customer.js","sources":["../../../src/api/customer.ts"],"sourcesContent":["import { Session } from '../types/session';\nimport {\n Customer,\n CustomerDeliveryScheduleParams,\n CustomerDeliveryScheduleResponse,\n Delivery,\n UpdateCustomerRequest,\n} from '../types/customer';\nimport { rechargeApiRequest } from '../utils/request';\n\nexport async function getCustomer(session: Session): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'get',\n `/customers`,\n {\n id,\n },\n session\n );\n return customer;\n}\n\nexport async function updateCustomer(session: Session, updateRequest: UpdateCustomerRequest): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'put',\n `/customers`,\n { id, data: updateRequest },\n session\n );\n return customer;\n}\n\nexport async function getDeliverySchedule(\n session: Session,\n query?: CustomerDeliveryScheduleParams\n): Promise<Delivery[]> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { deliveries } = await rechargeApiRequest<CustomerDeliveryScheduleResponse>(\n 'get',\n `/customers/${id}/delivery_schedule`,\n { query },\n session\n );\n return deliveries;\n}\n"],"names":["rechargeApiRequest"],"mappings":";;;;;;AACO,eAAe,WAAW,CAAC,OAAO,EAAE;AAC3C,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;AAChC,EAAE,IAAI,CAAC,EAAE,EAAE;AACX,IAAI,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACtC,GAAG;AACH,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAMA,0BAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE;AACrE,IAAI,EAAE;AACN,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,QAAQ,CAAC;AAClB,CAAC;AACM,eAAe,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE;AAC7D,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;AAChC,EAAE,IAAI,CAAC,EAAE,EAAE;AACX,IAAI,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACtC,GAAG;AACH,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAMA,0BAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;AAC3G,EAAE,OAAO,QAAQ,CAAC;AAClB,CAAC;AACM,eAAe,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAE;AAC1D,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;AAChC,EAAE,IAAI,CAAC,EAAE,EAAE;AACX,IAAI,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACtC,GAAG;AACH,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAMA,0BAAkB,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AACnH,EAAE,OAAO,UAAU,CAAC;AACpB;;;;;;"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var memberships = require('./api/memberships.js');
|
|
|
11
11
|
var onetime = require('./api/onetime.js');
|
|
12
12
|
var order = require('./api/order.js');
|
|
13
13
|
var subscription = require('./api/subscription.js');
|
|
14
|
-
var
|
|
14
|
+
var customer = require('./api/customer.js');
|
|
15
15
|
var init = require('./utils/init.js');
|
|
16
16
|
|
|
17
17
|
|
|
@@ -26,11 +26,9 @@ exports.updateAddress = address.updateAddress;
|
|
|
26
26
|
exports.loginShopifyApi = auth.loginShopifyApi;
|
|
27
27
|
exports.loginShopifyAppProxy = auth.loginShopifyAppProxy;
|
|
28
28
|
exports.applyDiscount = charge.applyDiscount;
|
|
29
|
-
exports.captureCharge = charge.captureCharge;
|
|
30
29
|
exports.getCharge = charge.getCharge;
|
|
31
30
|
exports.listCharges = charge.listCharges;
|
|
32
31
|
exports.processCharge = charge.processCharge;
|
|
33
|
-
exports.refundCharge = charge.refundCharge;
|
|
34
32
|
exports.removeDiscount = charge.removeDiscount;
|
|
35
33
|
exports.skipCharge = charge.skipCharge;
|
|
36
34
|
exports.unskipCharge = charge.unskipCharge;
|
|
@@ -63,9 +61,9 @@ exports.listSubscriptions = subscription.listSubscriptions;
|
|
|
63
61
|
exports.updateSubscription = subscription.updateSubscription;
|
|
64
62
|
exports.updateSubscriptionAddress = subscription.updateSubscriptionAddress;
|
|
65
63
|
exports.updateSubscriptionChargeDate = subscription.updateSubscriptionChargeDate;
|
|
66
|
-
exports.
|
|
67
|
-
exports.
|
|
68
|
-
exports.
|
|
64
|
+
exports.getCustomer = customer.getCustomer;
|
|
65
|
+
exports.getDeliverySchedule = customer.getDeliverySchedule;
|
|
66
|
+
exports.updateCustomer = customer.updateCustomer;
|
|
69
67
|
exports.api = init.api;
|
|
70
68
|
exports.initRecharge = init.initRecharge;
|
|
71
69
|
//# sourceMappingURL=index.js.map
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -39,22 +39,16 @@ async function rechargeApiRequest(method, url, { id, query, data, headers } = {}
|
|
|
39
39
|
const token = session.apiToken;
|
|
40
40
|
const rechargeBaseUrl = api.RECHARGE_API_URL(opts.environment);
|
|
41
41
|
const reqHeaders = __spreadValues({
|
|
42
|
-
"Content-Type": "application/json",
|
|
43
42
|
"X-Recharge-Access-Token": token,
|
|
44
|
-
"X-Recharge-Version": "2021-11"
|
|
45
|
-
"X-Recharge-App": "storefront-client"
|
|
43
|
+
"X-Recharge-Version": "2021-11"
|
|
46
44
|
}, headers ? headers : {});
|
|
47
45
|
const localQuery = __spreadValues({
|
|
48
46
|
shop_url: opts.storeIdentifier
|
|
49
47
|
}, query);
|
|
50
48
|
return request(method, `${rechargeBaseUrl}${url}`, { id, query: localQuery, data, headers: reqHeaders });
|
|
51
49
|
}
|
|
52
|
-
async function shopifyAppProxyRequest(method, url,
|
|
53
|
-
|
|
54
|
-
"Content-Type": "application/json",
|
|
55
|
-
"X-Recharge-App": "storefront-client"
|
|
56
|
-
}, headers ? headers : {});
|
|
57
|
-
return request(method, `${api.SHOPIFY_APP_PROXY_URL}${url}`, { id, query, data, headers: reqHeaders });
|
|
50
|
+
async function shopifyAppProxyRequest(method, url, requestOptions = {}) {
|
|
51
|
+
return request(method, `${api.SHOPIFY_APP_PROXY_URL}${url}`, requestOptions);
|
|
58
52
|
}
|
|
59
53
|
async function request(method, url, { id, query, data, headers } = {}) {
|
|
60
54
|
let reqUrl = url.trim();
|
|
@@ -72,7 +66,9 @@ async function request(method, url, { id, query, data, headers } = {}) {
|
|
|
72
66
|
reqBody = JSON.stringify(data);
|
|
73
67
|
}
|
|
74
68
|
const reqHeaders = __spreadValues({
|
|
75
|
-
Accept: "application/json"
|
|
69
|
+
Accept: "application/json",
|
|
70
|
+
"Content-Type": "application/json",
|
|
71
|
+
"X-Recharge-App": "storefront-client"
|
|
76
72
|
}, headers ? headers : {});
|
|
77
73
|
const response = await fetch(reqUrl, {
|
|
78
74
|
method,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sources":["../../../src/utils/request.ts"],"sourcesContent":["import 'isomorphic-fetch';\n\nimport { stringify } from 'qs';\n\nimport { Method, RequestHeaders, RequestOptions } from '../types';\nimport { getOptions } from './options';\nimport { RECHARGE_API_URL, RECHARGE_CDN_URL, SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { Session } from '../types/session';\n\nfunction stringifyQuery(str: unknown): string {\n return stringify(str, {\n encode: false,\n indices: false,\n arrayFormat: 'comma',\n });\n}\n\nexport async function cdnRequest<T>(method: Method, url: string, requestOptions: RequestOptions = {}): Promise<T> {\n const opts = getOptions();\n return request(method, `${RECHARGE_CDN_URL(opts.environment)}/store/${opts.storeIdentifier}${url}`, requestOptions);\n}\n\nexport async function rechargeApiRequest<T>(\n method: Method,\n url: string,\n { id, query, data, headers }: RequestOptions = {},\n session: Session\n): Promise<T> {\n const opts = getOptions();\n const token = session.apiToken;\n const rechargeBaseUrl = RECHARGE_API_URL(opts.environment);\n const reqHeaders: RequestHeaders = {\n '
|
|
1
|
+
{"version":3,"file":"request.js","sources":["../../../src/utils/request.ts"],"sourcesContent":["import 'isomorphic-fetch';\n\nimport { stringify } from 'qs';\n\nimport { Method, RequestHeaders, RequestOptions } from '../types';\nimport { getOptions } from './options';\nimport { RECHARGE_API_URL, RECHARGE_CDN_URL, SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { Session } from '../types/session';\n\nfunction stringifyQuery(str: unknown): string {\n return stringify(str, {\n encode: false,\n indices: false,\n arrayFormat: 'comma',\n });\n}\n\nexport async function cdnRequest<T>(method: Method, url: string, requestOptions: RequestOptions = {}): Promise<T> {\n const opts = getOptions();\n return request(method, `${RECHARGE_CDN_URL(opts.environment)}/store/${opts.storeIdentifier}${url}`, requestOptions);\n}\n\nexport async function rechargeApiRequest<T>(\n method: Method,\n url: string,\n { id, query, data, headers }: RequestOptions = {},\n session: Session\n): Promise<T> {\n const opts = getOptions();\n const token = session.apiToken;\n const rechargeBaseUrl = RECHARGE_API_URL(opts.environment);\n const reqHeaders: RequestHeaders = {\n 'X-Recharge-Access-Token': token,\n 'X-Recharge-Version': '2021-11',\n ...(headers ? headers : {}),\n };\n\n const localQuery = {\n shop_url: opts.storeIdentifier,\n ...(query as any),\n };\n\n return request(method, `${rechargeBaseUrl}${url}`, { id, query: localQuery, data, headers: reqHeaders });\n}\n\nexport async function shopifyAppProxyRequest<T>(\n method: Method,\n url: string,\n requestOptions: RequestOptions = {}\n): Promise<T> {\n return request(method, `${SHOPIFY_APP_PROXY_URL}${url}`, requestOptions);\n}\n\nexport async function request<T>(\n method: Method,\n url: string,\n { id, query, data, headers }: RequestOptions = {}\n): Promise<T> {\n let reqUrl = url.trim();\n\n if (id) {\n reqUrl = [reqUrl, `${id}`.trim()].join('/');\n }\n\n if (query) {\n let exQuery;\n [reqUrl, exQuery] = reqUrl.split('?');\n const fullQuery = [exQuery, stringifyQuery(query)].join('&').replace(/^&/, '');\n reqUrl = `${reqUrl}${fullQuery ? `?${fullQuery}` : ''}`;\n }\n\n let reqBody;\n if (data && method !== 'get') {\n reqBody = JSON.stringify(data);\n }\n\n const reqHeaders: RequestHeaders = {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'X-Recharge-App': 'storefront-client',\n ...(headers ? headers : {}),\n };\n\n const response = await fetch(reqUrl, {\n method,\n headers: reqHeaders,\n body: reqBody,\n mode: 'cors',\n });\n\n let result;\n try {\n result = await response.json();\n } catch (e) {\n // If we get here, it means we were a no content response.\n }\n\n if (!response.ok) {\n if (result && result.error) {\n throw new Error(`${response.status}: ${result.error}`);\n } else {\n throw new Error('A connection error occurred while making the request');\n }\n }\n\n return result as T;\n}\n"],"names":["stringify","getOptions","RECHARGE_CDN_URL","RECHARGE_API_URL","SHOPIFY_APP_PROXY_URL"],"mappings":";;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAA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AAK,MAAM;AACX,MAAM,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;AAC9E,KAAK;AACL,GAAG;AACH,EAAE,OAAO,MAAM,CAAC;AAChB;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.js","sources":["../../../src/api/address.ts"],"sourcesContent":["import { rechargeApiRequest } from '../utils/request';\nimport {\n AddressResponse,\n AddressListParams,\n CreateAddressRequest,\n UpdateAddressRequest,\n AddressListResponse,\n MergeAddressesRequest,\n SkipFutureChargeAddressRequest,\n SkipFutureChargeAddressResponse,\n} from '../types/address';\nimport { Session } from '../types/session';\n\n/** Returns all addresses from the store, or addresses for the
|
|
1
|
+
{"version":3,"file":"address.js","sources":["../../../src/api/address.ts"],"sourcesContent":["import { rechargeApiRequest } from '../utils/request';\nimport {\n AddressResponse,\n AddressListParams,\n CreateAddressRequest,\n UpdateAddressRequest,\n AddressListResponse,\n MergeAddressesRequest,\n SkipFutureChargeAddressRequest,\n SkipFutureChargeAddressResponse,\n} from '../types/address';\nimport { Session } from '../types/session';\n\n/** Returns all addresses from the store, or addresses for the customer given in the parameter. */\nexport function listAddresses(session: Session, query?: AddressListParams) {\n return rechargeApiRequest<AddressListResponse>('get', `/addresses`, { query }, session);\n}\n\n/** Retrieves address for customer based on specified address id. */\nexport async function getAddress(session: Session, id: string | number) {\n const { address } = await rechargeApiRequest<AddressResponse>('get', `/addresses`, { id }, session);\n return address;\n}\n\n/** Create a new address for a customer. */\nexport async function createAddress(session: Session, createRequest: CreateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>('post', `/addresses`, { data: createRequest }, session);\n return address;\n}\n\n/** Updates an existing address to match the specified parameters. */\nexport async function updateAddress(session: Session, id: string | number, updateRequest: UpdateAddressRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'put',\n `/addresses`,\n { id, data: updateRequest },\n session\n );\n return address;\n}\n\n/** Deletes an address. Only Addresses with no active Subscriptions can be deleted. */\nexport function deleteAddress(session: Session, id: string | number) {\n return rechargeApiRequest<void>('delete', `/addresses`, { id }, session);\n}\n\n/**\n * Merges up to 10 source addresses into 1 target address.\n */\nexport async function mergeAddresses(session: Session, mergeRequest: MergeAddressesRequest) {\n const { address } = await rechargeApiRequest<AddressResponse>(\n 'post',\n `/addresses/merge`,\n {\n data: mergeRequest,\n },\n session\n );\n return address;\n}\n\n/**\n * Skip a Charge in the future for one or multiple Subscriptions associated with the Address.\n */\nexport async function skipFutureCharge(\n session: Session,\n id: string | number,\n skipRequest: SkipFutureChargeAddressRequest\n) {\n const { charge } = await rechargeApiRequest<SkipFutureChargeAddressResponse>(\n 'post',\n `/addresses/${id}/charges/skip`,\n {\n data: skipRequest,\n },\n session\n );\n return charge;\n}\n"],"names":[],"mappings":";;AACO,SAAS,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE;AAC9C,EAAE,OAAO,kBAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC;AACM,eAAe,UAAU,CAAC,OAAO,EAAE,EAAE,EAAE;AAC9C,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AACrF,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACM,eAAe,aAAa,CAAC,OAAO,EAAE,aAAa,EAAE;AAC5D,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;AACvG,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACM,eAAe,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE;AAChE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;AAC1G,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACM,SAAS,aAAa,CAAC,OAAO,EAAE,EAAE,EAAE;AAC3C,EAAE,OAAO,kBAAkB,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC;AACM,eAAe,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE;AAC5D,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,CAAC,gBAAgB,CAAC,EAAE;AAC3E,IAAI,IAAI,EAAE,YAAY;AACtB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,OAAO,CAAC;AACjB,CAAC;AACM,eAAe,gBAAgB,CAAC,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE;AACjE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE;AACvF,IAAI,IAAI,EAAE,WAAW;AACrB,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}
|
package/dist/esm/api/auth.js
CHANGED
|
@@ -4,7 +4,7 @@ import { RECHARGE_ADMIN_URL } from '../constants/api.js';
|
|
|
4
4
|
|
|
5
5
|
async function loginShopifyAppProxy() {
|
|
6
6
|
const response = await shopifyAppProxyRequest("get", "/logged_in_customer_poc");
|
|
7
|
-
return response.api_token ? { apiToken: response.api_token,
|
|
7
|
+
return response.api_token ? { apiToken: response.api_token, customerId: response.customer_id } : null;
|
|
8
8
|
}
|
|
9
9
|
async function loginShopifyApi(customerAccessToken, storefrontAccessToken) {
|
|
10
10
|
const opts = getOptions();
|
|
@@ -19,7 +19,7 @@ async function loginShopifyApi(customerAccessToken, storefrontAccessToken) {
|
|
|
19
19
|
"X-Recharge-App": "storefront-client"
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
return response.api_token ? { apiToken: response.api_token,
|
|
22
|
+
return response.api_token ? { apiToken: response.api_token, customerId: response.customer_id } : null;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export { loginShopifyApi, loginShopifyAppProxy };
|
package/dist/esm/api/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sources":["../../../src/api/auth.ts"],"sourcesContent":["import { request as baseRequest, shopifyAppProxyRequest } from '../utils/request';\nimport { LoginResponse } from '../types/auth';\nimport { getOptions } from '../utils/options';\nimport { RECHARGE_ADMIN_URL } from '../constants/api';\nimport { Session } from '../types/session';\n\nexport async function loginShopifyAppProxy(): Promise<Session | null> {\n const response = await shopifyAppProxyRequest<LoginResponse>('get', '/logged_in_customer_poc');\n\n return response.api_token ? { apiToken: response.api_token,
|
|
1
|
+
{"version":3,"file":"auth.js","sources":["../../../src/api/auth.ts"],"sourcesContent":["import { request as baseRequest, shopifyAppProxyRequest } from '../utils/request';\nimport { LoginResponse } from '../types/auth';\nimport { getOptions } from '../utils/options';\nimport { RECHARGE_ADMIN_URL } from '../constants/api';\nimport { Session } from '../types/session';\n\nexport async function loginShopifyAppProxy(): Promise<Session | null> {\n const response = await shopifyAppProxyRequest<LoginResponse>('get', '/logged_in_customer_poc');\n\n return response.api_token ? { apiToken: response.api_token, customerId: response.customer_id } : null;\n}\n\nexport async function loginShopifyApi(\n customerAccessToken: string,\n storefrontAccessToken: string\n): Promise<Session | null> {\n const opts = getOptions();\n const rechargeBaseUrl = RECHARGE_ADMIN_URL(opts.environment);\n const response = await baseRequest<LoginResponse>('post', `${rechargeBaseUrl}/hydrogen_login_poc`, {\n data: {\n customer_token: customerAccessToken,\n storefront_token: storefrontAccessToken,\n shop_url: opts.storeIdentifier,\n },\n headers: {\n 'X-Recharge-App': 'storefront-client',\n },\n });\n\n return response.api_token ? { apiToken: response.api_token, customerId: response.customer_id } : null;\n}\n"],"names":["baseRequest"],"mappings":";;;;AAGO,eAAe,oBAAoB,GAAG;AAC7C,EAAE,MAAM,QAAQ,GAAG,MAAM,sBAAsB,CAAC,KAAK,EAAE,yBAAyB,CAAC,CAAC;AAClF,EAAE,OAAO,QAAQ,CAAC,SAAS,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;AACxG,CAAC;AACM,eAAe,eAAe,CAAC,mBAAmB,EAAE,qBAAqB,EAAE;AAClF,EAAE,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC;AAC5B,EAAE,MAAM,eAAe,GAAG,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAC/D,EAAE,MAAM,QAAQ,GAAG,MAAMA,OAAW,CAAC,MAAM,EAAE,CAAC,EAAE,eAAe,CAAC,mBAAmB,CAAC,EAAE;AACtF,IAAI,IAAI,EAAE;AACV,MAAM,cAAc,EAAE,mBAAmB;AACzC,MAAM,gBAAgB,EAAE,qBAAqB;AAC7C,MAAM,QAAQ,EAAE,IAAI,CAAC,eAAe;AACpC,KAAK;AACL,IAAI,OAAO,EAAE;AACb,MAAM,gBAAgB,EAAE,mBAAmB;AAC3C,KAAK;AACL,GAAG,CAAC,CAAC;AACL,EAAE,OAAO,QAAQ,CAAC,SAAS,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;AACxG;;;;"}
|
package/dist/esm/api/charge.js
CHANGED
|
@@ -25,18 +25,10 @@ async function unskipCharge(session, id) {
|
|
|
25
25
|
const { charge } = await rechargeApiRequest("post", `/charges/${id}/unskip`, {}, session);
|
|
26
26
|
return charge;
|
|
27
27
|
}
|
|
28
|
-
async function refundCharge(session, id, refundRequest) {
|
|
29
|
-
const { charge } = await rechargeApiRequest("post", `/charges/${id}/refund`, { data: refundRequest }, session);
|
|
30
|
-
return charge;
|
|
31
|
-
}
|
|
32
28
|
async function processCharge(session, id) {
|
|
33
29
|
const { charge } = await rechargeApiRequest("post", `/charges/${id}/process`, {}, session);
|
|
34
30
|
return charge;
|
|
35
31
|
}
|
|
36
|
-
async function captureCharge(session, id) {
|
|
37
|
-
const { charge } = await rechargeApiRequest("post", `/charges/${id}/capture_payment`, {}, session);
|
|
38
|
-
return charge;
|
|
39
|
-
}
|
|
40
32
|
|
|
41
|
-
export { applyDiscount,
|
|
33
|
+
export { applyDiscount, getCharge, listCharges, processCharge, removeDiscount, skipCharge, unskipCharge };
|
|
42
34
|
//# sourceMappingURL=charge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charge.js","sources":["../../../src/api/charge.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"charge.js","sources":["../../../src/api/charge.ts"],"sourcesContent":["import { ApplyDiscountRequest, ChargeListParams, ChargeListResponse, ChargeResponse } from '../types/charge';\nimport { Session } from '../types/session';\nimport { rechargeApiRequest } from '../utils/request';\n\n/* Retrieve a Charge using the charge_id. */\nexport async function getCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('get', `/charges`, { id }, session);\n return charge;\n}\n\n/** Lists charges */\nexport function listCharges(session: Session, query?: ChargeListParams) {\n return rechargeApiRequest<ChargeListResponse>('get', `/charges`, { query }, session);\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 * You can provide either discount_id or discount_code. If both parameters are passed, the value for discount_id will take precedence.\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 applyDiscount(session: Session, id: number | string, applyRequest: ApplyDiscountRequest) {\n const { charge } = await rechargeApiRequest<ChargeResponse>(\n 'post',\n `/charges/${id}/apply_discount`,\n {\n data: applyRequest,\n },\n session\n );\n return charge;\n}\n\n/**\n * Remove a Discount 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 removeDiscount(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/remove_discount`, {}, session);\n return charge;\n}\n\n/* Skip a Charge. */\nexport async function skipCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/skip`, {}, session);\n return charge;\n}\n\n/* Unskip a Charge. */\nexport async function unskipCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/unskip`, {}, session);\n return charge;\n}\n\n/** The charge processing route can be used to process Charges that are in a queued or error status. */\nexport async function processCharge(session: Session, id: number | string) {\n const { charge } = await rechargeApiRequest<ChargeResponse>('post', `/charges/${id}/process`, {}, session);\n return charge;\n}\n"],"names":[],"mappings":";;AACO,eAAe,SAAS,CAAC,OAAO,EAAE,EAAE,EAAE;AAC7C,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAClF,EAAE,OAAO,MAAM,CAAC;AAChB,CAAC;AACM,SAAS,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE;AAC5C,EAAE,OAAO,kBAAkB,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,KAA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AAE,EAAE,EAAE,OAAO,CAAC,CAAC;AAC7F,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { rechargeApiRequest } from '../utils/request.js';
|
|
2
2
|
|
|
3
|
-
async function
|
|
4
|
-
const id = session.
|
|
3
|
+
async function getCustomer(session) {
|
|
4
|
+
const id = session.customerId;
|
|
5
5
|
if (!id) {
|
|
6
6
|
throw new Error("Not logged in.");
|
|
7
7
|
}
|
|
@@ -10,8 +10,8 @@ async function getUser(session) {
|
|
|
10
10
|
}, session);
|
|
11
11
|
return customer;
|
|
12
12
|
}
|
|
13
|
-
async function
|
|
14
|
-
const id = session.
|
|
13
|
+
async function updateCustomer(session, updateRequest) {
|
|
14
|
+
const id = session.customerId;
|
|
15
15
|
if (!id) {
|
|
16
16
|
throw new Error("Not logged in.");
|
|
17
17
|
}
|
|
@@ -19,7 +19,7 @@ async function updateUser(session, updateRequest) {
|
|
|
19
19
|
return customer;
|
|
20
20
|
}
|
|
21
21
|
async function getDeliverySchedule(session, query) {
|
|
22
|
-
const id = session.
|
|
22
|
+
const id = session.customerId;
|
|
23
23
|
if (!id) {
|
|
24
24
|
throw new Error("Not logged in.");
|
|
25
25
|
}
|
|
@@ -27,5 +27,5 @@ async function getDeliverySchedule(session, query) {
|
|
|
27
27
|
return deliveries;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export {
|
|
31
|
-
//# sourceMappingURL=
|
|
30
|
+
export { getCustomer, getDeliverySchedule, updateCustomer };
|
|
31
|
+
//# sourceMappingURL=customer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customer.js","sources":["../../../src/api/customer.ts"],"sourcesContent":["import { Session } from '../types/session';\nimport {\n Customer,\n CustomerDeliveryScheduleParams,\n CustomerDeliveryScheduleResponse,\n Delivery,\n UpdateCustomerRequest,\n} from '../types/customer';\nimport { rechargeApiRequest } from '../utils/request';\n\nexport async function getCustomer(session: Session): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'get',\n `/customers`,\n {\n id,\n },\n session\n );\n return customer;\n}\n\nexport async function updateCustomer(session: Session, updateRequest: UpdateCustomerRequest): Promise<Customer> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { customer } = await rechargeApiRequest<{ customer: Customer }>(\n 'put',\n `/customers`,\n { id, data: updateRequest },\n session\n );\n return customer;\n}\n\nexport async function getDeliverySchedule(\n session: Session,\n query?: CustomerDeliveryScheduleParams\n): Promise<Delivery[]> {\n const id = session.customerId;\n if (!id) {\n throw new Error('Not logged in.');\n }\n const { deliveries } = await rechargeApiRequest<CustomerDeliveryScheduleResponse>(\n 'get',\n `/customers/${id}/delivery_schedule`,\n { query },\n session\n );\n return deliveries;\n}\n"],"names":[],"mappings":";;AACO,eAAe,WAAW,CAAC,OAAO,EAAE;AAC3C,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;AAChC,EAAE,IAAI,CAAC,EAAE,EAAE;AACX,IAAI,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACtC,GAAG;AACH,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE;AACrE,IAAI,EAAE;AACN,GAAG,EAAE,OAAO,CAAC,CAAC;AACd,EAAE,OAAO,QAAQ,CAAC;AAClB,CAAC;AACM,eAAe,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE;AAC7D,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;AAChC,EAAE,IAAI,CAAC,EAAE,EAAE;AACX,IAAI,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACtC,GAAG;AACH,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;AAC3G,EAAE,OAAO,QAAQ,CAAC;AAClB,CAAC;AACM,eAAe,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAE;AAC1D,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;AAChC,EAAE,IAAI,CAAC,EAAE,EAAE;AACX,IAAI,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACtC,GAAG;AACH,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AACnH,EAAE,OAAO,UAAU,CAAC;AACpB;;;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { createAddress, deleteAddress, getAddress, listAddresses, mergeAddresses, skipFutureCharge, updateAddress } from './api/address.js';
|
|
2
2
|
export { loginShopifyApi, loginShopifyAppProxy } from './api/auth.js';
|
|
3
|
-
export { applyDiscount,
|
|
3
|
+
export { applyDiscount, getCharge, listCharges, processCharge, removeDiscount, skipCharge, unskipCharge } from './api/charge.js';
|
|
4
4
|
export { getBundleSettings, getProduct, getProductAndSettings, getProducts, getProductsAndSettings, getStoreSettings, getWidgetSettings, resetCache } from './api/cdn.js';
|
|
5
5
|
export { getBundleId, validateBundle } from './api/bundle.js';
|
|
6
6
|
export { activateMembership, cancelMembership, getMembership, listMemberships } from './api/memberships.js';
|
|
7
7
|
export { createOnetime, deleteOnetime, getOnetime, listOnetimes, updateOnetime } from './api/onetime.js';
|
|
8
8
|
export { getOrder, listOrders } from './api/order.js';
|
|
9
9
|
export { activateSubscription, cancelSubscription, createSubscription, getSubscription, listSubscriptions, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate } from './api/subscription.js';
|
|
10
|
-
export {
|
|
10
|
+
export { getCustomer, getDeliverySchedule, updateCustomer } from './api/customer.js';
|
|
11
11
|
export { api, initRecharge } from './utils/init.js';
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -35,22 +35,16 @@ async function rechargeApiRequest(method, url, { id, query, data, headers } = {}
|
|
|
35
35
|
const token = session.apiToken;
|
|
36
36
|
const rechargeBaseUrl = RECHARGE_API_URL(opts.environment);
|
|
37
37
|
const reqHeaders = __spreadValues({
|
|
38
|
-
"Content-Type": "application/json",
|
|
39
38
|
"X-Recharge-Access-Token": token,
|
|
40
|
-
"X-Recharge-Version": "2021-11"
|
|
41
|
-
"X-Recharge-App": "storefront-client"
|
|
39
|
+
"X-Recharge-Version": "2021-11"
|
|
42
40
|
}, headers ? headers : {});
|
|
43
41
|
const localQuery = __spreadValues({
|
|
44
42
|
shop_url: opts.storeIdentifier
|
|
45
43
|
}, query);
|
|
46
44
|
return request(method, `${rechargeBaseUrl}${url}`, { id, query: localQuery, data, headers: reqHeaders });
|
|
47
45
|
}
|
|
48
|
-
async function shopifyAppProxyRequest(method, url,
|
|
49
|
-
|
|
50
|
-
"Content-Type": "application/json",
|
|
51
|
-
"X-Recharge-App": "storefront-client"
|
|
52
|
-
}, headers ? headers : {});
|
|
53
|
-
return request(method, `${SHOPIFY_APP_PROXY_URL}${url}`, { id, query, data, headers: reqHeaders });
|
|
46
|
+
async function shopifyAppProxyRequest(method, url, requestOptions = {}) {
|
|
47
|
+
return request(method, `${SHOPIFY_APP_PROXY_URL}${url}`, requestOptions);
|
|
54
48
|
}
|
|
55
49
|
async function request(method, url, { id, query, data, headers } = {}) {
|
|
56
50
|
let reqUrl = url.trim();
|
|
@@ -68,7 +62,9 @@ async function request(method, url, { id, query, data, headers } = {}) {
|
|
|
68
62
|
reqBody = JSON.stringify(data);
|
|
69
63
|
}
|
|
70
64
|
const reqHeaders = __spreadValues({
|
|
71
|
-
Accept: "application/json"
|
|
65
|
+
Accept: "application/json",
|
|
66
|
+
"Content-Type": "application/json",
|
|
67
|
+
"X-Recharge-App": "storefront-client"
|
|
72
68
|
}, headers ? headers : {});
|
|
73
69
|
const response = await fetch(reqUrl, {
|
|
74
70
|
method,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sources":["../../../src/utils/request.ts"],"sourcesContent":["import 'isomorphic-fetch';\n\nimport { stringify } from 'qs';\n\nimport { Method, RequestHeaders, RequestOptions } from '../types';\nimport { getOptions } from './options';\nimport { RECHARGE_API_URL, RECHARGE_CDN_URL, SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { Session } from '../types/session';\n\nfunction stringifyQuery(str: unknown): string {\n return stringify(str, {\n encode: false,\n indices: false,\n arrayFormat: 'comma',\n });\n}\n\nexport async function cdnRequest<T>(method: Method, url: string, requestOptions: RequestOptions = {}): Promise<T> {\n const opts = getOptions();\n return request(method, `${RECHARGE_CDN_URL(opts.environment)}/store/${opts.storeIdentifier}${url}`, requestOptions);\n}\n\nexport async function rechargeApiRequest<T>(\n method: Method,\n url: string,\n { id, query, data, headers }: RequestOptions = {},\n session: Session\n): Promise<T> {\n const opts = getOptions();\n const token = session.apiToken;\n const rechargeBaseUrl = RECHARGE_API_URL(opts.environment);\n const reqHeaders: RequestHeaders = {\n '
|
|
1
|
+
{"version":3,"file":"request.js","sources":["../../../src/utils/request.ts"],"sourcesContent":["import 'isomorphic-fetch';\n\nimport { stringify } from 'qs';\n\nimport { Method, RequestHeaders, RequestOptions } from '../types';\nimport { getOptions } from './options';\nimport { RECHARGE_API_URL, RECHARGE_CDN_URL, SHOPIFY_APP_PROXY_URL } from '../constants/api';\nimport { Session } from '../types/session';\n\nfunction stringifyQuery(str: unknown): string {\n return stringify(str, {\n encode: false,\n indices: false,\n arrayFormat: 'comma',\n });\n}\n\nexport async function cdnRequest<T>(method: Method, url: string, requestOptions: RequestOptions = {}): Promise<T> {\n const opts = getOptions();\n return request(method, `${RECHARGE_CDN_URL(opts.environment)}/store/${opts.storeIdentifier}${url}`, requestOptions);\n}\n\nexport async function rechargeApiRequest<T>(\n method: Method,\n url: string,\n { id, query, data, headers }: RequestOptions = {},\n session: Session\n): Promise<T> {\n const opts = getOptions();\n const token = session.apiToken;\n const rechargeBaseUrl = RECHARGE_API_URL(opts.environment);\n const reqHeaders: RequestHeaders = {\n 'X-Recharge-Access-Token': token,\n 'X-Recharge-Version': '2021-11',\n ...(headers ? headers : {}),\n };\n\n const localQuery = {\n shop_url: opts.storeIdentifier,\n ...(query as any),\n };\n\n return request(method, `${rechargeBaseUrl}${url}`, { id, query: localQuery, data, headers: reqHeaders });\n}\n\nexport async function shopifyAppProxyRequest<T>(\n method: Method,\n url: string,\n requestOptions: RequestOptions = {}\n): Promise<T> {\n return request(method, `${SHOPIFY_APP_PROXY_URL}${url}`, requestOptions);\n}\n\nexport async function request<T>(\n method: Method,\n url: string,\n { id, query, data, headers }: RequestOptions = {}\n): Promise<T> {\n let reqUrl = url.trim();\n\n if (id) {\n reqUrl = [reqUrl, `${id}`.trim()].join('/');\n }\n\n if (query) {\n let exQuery;\n [reqUrl, exQuery] = reqUrl.split('?');\n const fullQuery = [exQuery, stringifyQuery(query)].join('&').replace(/^&/, '');\n reqUrl = `${reqUrl}${fullQuery ? `?${fullQuery}` : ''}`;\n }\n\n let reqBody;\n if (data && method !== 'get') {\n reqBody = JSON.stringify(data);\n }\n\n const reqHeaders: RequestHeaders = {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n 'X-Recharge-App': 'storefront-client',\n ...(headers ? headers : {}),\n };\n\n const response = await fetch(reqUrl, {\n method,\n headers: reqHeaders,\n body: reqBody,\n mode: 'cors',\n });\n\n let result;\n try {\n result = await response.json();\n } catch (e) {\n // If we get here, it means we were a no content response.\n }\n\n if (!response.ok) {\n if (result && result.error) {\n throw new Error(`${response.status}: ${result.error}`);\n } else {\n throw new Error('A connection error occurred while making the request');\n }\n }\n\n return result as T;\n}\n"],"names":[],"mappings":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AI,gBAAgB,EAAE,mBAAmB;AACzC,GAAG,EAAE,OAAO,GAAG,OAAO,GAAG,EAAE,CAAC,CAAC;AAC7B,EAAE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,EAAE;AACvC,IAAI,MAAM;AACV,IAAI,OAAO,EAAE,UAAU;AACvB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,IAAI,EAAE,MAAM;AAChB,GAAG,CAAC,CAAC;AACL,EAAE,IAAI,MAAM,CAAC;AACb,EAAE,IAAI;AACN,IAAI,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;AACnC,GAAG,CAAC,OAAO,CAAC,EAAE;AACd,GAAG;AACH,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;AACpB,IAAI,IAAI,MAAM,IAAI,MAAM,CAAC,KAAK,EAAE;AAChC,MAAM,MAAM,IAAI,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC7D,KAAK,MAAM;AACX,MAAM,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;AAC9E,KAAK;AACL,GAAG;AACH,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -346,12 +346,6 @@ interface ApplyDiscountRequest {
|
|
|
346
346
|
/** ID of the Discount you want to apply to a Charge. */
|
|
347
347
|
discount_id?: number;
|
|
348
348
|
}
|
|
349
|
-
interface RefundChargeRequest {
|
|
350
|
-
/** Amount of money that will be refunded. It can be fully or partially refunded. */
|
|
351
|
-
amount: string;
|
|
352
|
-
/** If this parameter has value true, the Charge will be totally refunded. */
|
|
353
|
-
full_refund?: boolean;
|
|
354
|
-
}
|
|
355
349
|
declare type ChargeSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc' | 'scheduled_at-asc' | 'scheduled_at-desc';
|
|
356
350
|
interface ChargeListParams extends ListParams<ChargeSortBy> {
|
|
357
351
|
/** Filter Charges by Address. */
|
|
@@ -525,10 +519,10 @@ interface AddressListParams extends ListParams<AddressSortBy> {
|
|
|
525
519
|
|
|
526
520
|
interface Session {
|
|
527
521
|
apiToken: string;
|
|
528
|
-
|
|
522
|
+
customerId: string;
|
|
529
523
|
}
|
|
530
524
|
|
|
531
|
-
/** Returns all addresses from the store, or addresses for the
|
|
525
|
+
/** Returns all addresses from the store, or addresses for the customer given in the parameter. */
|
|
532
526
|
declare function listAddresses(session: Session, query?: AddressListParams): Promise<AddressListResponse>;
|
|
533
527
|
/** Retrieves address for customer based on specified address id. */
|
|
534
528
|
declare function getAddress(session: Session, id: string | number): Promise<Address>;
|
|
@@ -569,13 +563,8 @@ declare function applyDiscount(session: Session, id: number | string, applyReque
|
|
|
569
563
|
declare function removeDiscount(session: Session, id: number | string): Promise<Charge>;
|
|
570
564
|
declare function skipCharge(session: Session, id: number | string): Promise<Charge>;
|
|
571
565
|
declare function unskipCharge(session: Session, id: number | string): Promise<Charge>;
|
|
572
|
-
declare function refundCharge(session: Session, id: number | string, refundRequest: RefundChargeRequest): Promise<Charge>;
|
|
573
566
|
/** The charge processing route can be used to process Charges that are in a queued or error status. */
|
|
574
567
|
declare function processCharge(session: Session, id: number | string): Promise<Charge>;
|
|
575
|
-
/**
|
|
576
|
-
* If you are leveraging the authorize/capture workflow with Recharge, the charge/{id}/capture_payment endpoint is how to capture the funds of a previously authorized Charge.
|
|
577
|
-
*/
|
|
578
|
-
declare function captureCharge(session: Session, id: number | string): Promise<Charge>;
|
|
579
568
|
|
|
580
569
|
declare type Method = 'get' | 'post' | 'put' | 'delete';
|
|
581
570
|
declare type Request = <T>(method: Method, url: string, options?: RequestOptions) => Promise<T>;
|
|
@@ -1240,7 +1229,7 @@ declare function cancelSubscription(session: Session, id: string | number, cance
|
|
|
1240
1229
|
*/
|
|
1241
1230
|
declare function activateSubscription(session: Session, id: string | number): Promise<Subscription>;
|
|
1242
1231
|
|
|
1243
|
-
interface
|
|
1232
|
+
interface Customer {
|
|
1244
1233
|
/** Unique numeric identifier for the Customer. */
|
|
1245
1234
|
id: number;
|
|
1246
1235
|
/** An object containing analytics data associated with the customer. */
|
|
@@ -1271,8 +1260,8 @@ interface User {
|
|
|
1271
1260
|
updated_at: IsoDateString;
|
|
1272
1261
|
}
|
|
1273
1262
|
declare type OptionalUpdateProps = 'email' | 'first_name' | 'last_name' | 'external_customer_id';
|
|
1274
|
-
declare type
|
|
1275
|
-
interface
|
|
1263
|
+
declare type UpdateCustomerRequest = Partial<Pick<Customer, OptionalUpdateProps>>;
|
|
1264
|
+
interface CustomerDeliveryScheduleParams {
|
|
1276
1265
|
delivery_count_future?: number;
|
|
1277
1266
|
future_internal?: number;
|
|
1278
1267
|
date_max?: IsoDateString;
|
|
@@ -1282,9 +1271,9 @@ interface Delivery {
|
|
|
1282
1271
|
orders: Order[];
|
|
1283
1272
|
}
|
|
1284
1273
|
|
|
1285
|
-
declare function
|
|
1286
|
-
declare function
|
|
1287
|
-
declare function getDeliverySchedule(session: Session, query?:
|
|
1274
|
+
declare function getCustomer(session: Session): Promise<Customer>;
|
|
1275
|
+
declare function updateCustomer(session: Session, updateRequest: UpdateCustomerRequest): Promise<Customer>;
|
|
1276
|
+
declare function getDeliverySchedule(session: Session, query?: CustomerDeliveryScheduleParams): Promise<Delivery[]>;
|
|
1288
1277
|
|
|
1289
1278
|
declare type InitOptions = Omit<Partial<StorefrontOptions>, 'environment'>;
|
|
1290
1279
|
declare const api: {
|
|
@@ -1295,4 +1284,4 @@ declare const api: {
|
|
|
1295
1284
|
};
|
|
1296
1285
|
declare function initRecharge(opt?: InitOptions): void;
|
|
1297
1286
|
|
|
1298
|
-
export { Bundle, BundleSelection, BundleTranslations, CDNBaseWidgetSettings, CDNBundleLayoutSettings, CDNBundleSettings, CDNBundleStep, CDNBundleStepOption, CDNBundleVariant, CDNBundleVariantOptionSource, CDNBundleVariantSelectionDefault, CDNPrices, CDNProduct, CDNProductAndSettings, CDNProductKeyObject, CDNProductOption, CDNProductOptionValue, CDNProductRaw, CDNProductResource, CDNProductsAndSettings, CDNProductsAndSettingsResource, CDNSellingPlan, CDNSellingPlanAllocations, CDNSellingPlanGroup, CDNStoreSettings, CDNSubscriptionOption, CDNVariant, CDNVariantOptionValue, CDNWidgetSettings, CDNWidgetSettingsRaw, CDNWidgetSettingsResource, CRUDRequestOptions, FirstOption, GetRequestOptions, InitOptions, IntervalUnit, Method, PriceAdjustmentsType, Request, RequestHeaders, RequestOptions, RequestOptionsHeaders, StorefrontEnvironment, StorefrontOptions, StorefrontPurchaseOption, Translations, WidgetIconColor, WidgetTemplateType, activateMembership, activateSubscription, api, applyDiscount, cancelMembership, cancelSubscription,
|
|
1287
|
+
export { Bundle, BundleSelection, BundleTranslations, CDNBaseWidgetSettings, CDNBundleLayoutSettings, CDNBundleSettings, CDNBundleStep, CDNBundleStepOption, CDNBundleVariant, CDNBundleVariantOptionSource, CDNBundleVariantSelectionDefault, CDNPrices, CDNProduct, CDNProductAndSettings, CDNProductKeyObject, CDNProductOption, CDNProductOptionValue, CDNProductRaw, CDNProductResource, CDNProductsAndSettings, CDNProductsAndSettingsResource, CDNSellingPlan, CDNSellingPlanAllocations, CDNSellingPlanGroup, CDNStoreSettings, CDNSubscriptionOption, CDNVariant, CDNVariantOptionValue, CDNWidgetSettings, CDNWidgetSettingsRaw, CDNWidgetSettingsResource, CRUDRequestOptions, FirstOption, GetRequestOptions, InitOptions, IntervalUnit, Method, PriceAdjustmentsType, Request, RequestHeaders, RequestOptions, RequestOptionsHeaders, StorefrontEnvironment, StorefrontOptions, StorefrontPurchaseOption, Translations, WidgetIconColor, WidgetTemplateType, activateMembership, activateSubscription, api, applyDiscount, cancelMembership, cancelSubscription, createAddress, createOnetime, createSubscription, deleteAddress, deleteOnetime, getAddress, getBundleId, getBundleSettings, getCharge, getCustomer, getDeliverySchedule, getMembership, getOnetime, getOrder, getProduct, getProductAndSettings, getProducts, getProductsAndSettings, getStoreSettings, getSubscription, getWidgetSettings, initRecharge, listAddresses, listCharges, listMemberships, listOnetimes, listOrders, listSubscriptions, loginShopifyApi, loginShopifyAppProxy, mergeAddresses, processCharge, removeDiscount, resetCache, skipCharge, skipFutureCharge, unskipCharge, updateAddress, updateCustomer, updateOnetime, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, validateBundle };
|