@sixtyninecommerce/client 0.32.0 → 0.33.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/README.md +64 -2
- package/dist/build-client.d.ts.map +1 -1
- package/dist/build-client.js +3 -0
- package/dist/build-client.js.map +1 -1
- package/dist/commerce/checkout.d.ts +4 -2
- package/dist/commerce/checkout.d.ts.map +1 -1
- package/dist/commerce/checkout.js +4 -2
- package/dist/commerce/checkout.js.map +1 -1
- package/dist/commerce/customer.d.ts +253 -5
- package/dist/commerce/customer.d.ts.map +1 -1
- package/dist/commerce/customer.js +83 -29
- package/dist/commerce/customer.js.map +1 -1
- package/dist/commerce/index.d.ts +255 -5
- package/dist/commerce/index.d.ts.map +1 -1
- package/dist/commerce/index.js +6 -0
- package/dist/commerce/index.js.map +1 -1
- package/dist/commerce/money-view.d.ts +33 -0
- package/dist/commerce/money-view.d.ts.map +1 -0
- package/dist/commerce/money-view.js +75 -0
- package/dist/commerce/money-view.js.map +1 -0
- package/dist/commerce/order-access-key.d.ts +29 -0
- package/dist/commerce/order-access-key.d.ts.map +1 -0
- package/dist/commerce/order-access-key.js +38 -0
- package/dist/commerce/order-access-key.js.map +1 -0
- package/dist/commerce/parked-orders.d.ts +3 -3
- package/dist/commerce/parked-orders.d.ts.map +1 -1
- package/dist/commerce/parked-orders.js +34 -5
- package/dist/commerce/parked-orders.js.map +1 -1
- package/dist/commerce/payments.d.ts +2 -1
- package/dist/commerce/payments.d.ts.map +1 -1
- package/dist/commerce/payments.js +2 -1
- package/dist/commerce/payments.js.map +1 -1
- package/dist/commerce/queries.d.ts +18 -3
- package/dist/commerce/queries.d.ts.map +1 -1
- package/dist/commerce/queries.js +118 -7
- package/dist/commerce/queries.js.map +1 -1
- package/dist/core/customer-session.d.ts +34 -0
- package/dist/core/customer-session.d.ts.map +1 -0
- package/dist/core/customer-session.js +48 -0
- package/dist/core/customer-session.js.map +1 -0
- package/dist/core/http.d.ts +9 -0
- package/dist/core/http.d.ts.map +1 -1
- package/dist/core/http.js +64 -25
- package/dist/core/http.js.map +1 -1
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -0
- package/dist/errors.js.map +1 -1
- package/dist/events/payloads.d.ts +1 -1
- package/dist/events/payloads.d.ts.map +1 -1
- package/dist/generated/cms.d.ts +4 -2
- package/dist/generated/cms.d.ts.map +1 -1
- package/dist/generated/shop.d.ts +198 -8
- package/dist/generated/shop.d.ts.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/pricing/index.d.ts +1 -0
- package/dist/pricing/index.d.ts.map +1 -1
- package/dist/pricing/index.js +1 -0
- package/dist/pricing/index.js.map +1 -1
- package/dist/pricing/order-money-rows.d.ts +92 -0
- package/dist/pricing/order-money-rows.d.ts.map +1 -0
- package/dist/pricing/order-money-rows.js +88 -0
- package/dist/pricing/order-money-rows.js.map +1 -0
- package/dist/types.d.ts +231 -23
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { HttpClient } from '../core/http.js';
|
|
2
|
+
import type * as Shop from '../generated/shop.js';
|
|
3
|
+
import type { RequestOptions } from '../types.js';
|
|
4
|
+
import { type OrderAccessKeyOption } from './order-access-key.js';
|
|
5
|
+
/**
|
|
6
|
+
* Which prices a money view shows. `CUSTOMER` (the SDK's default, USER PD1) is how the shop shows
|
|
7
|
+
* prices to the order's own customer: consumers incl. VAT, business customers as the store's
|
|
8
|
+
* price-display settings say. `STORE` follows how the store sets its prices; `GROSS` = incl. VAT,
|
|
9
|
+
* `NET` = excl. VAT. The view answers the one it used, `GROSS` or `NET`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ORDER_MONEY_BASES: readonly ["CUSTOMER", "STORE", "GROSS", "NET"];
|
|
12
|
+
/** Whose money view: the shopper's cart, or a placed order by its code. */
|
|
13
|
+
export type OrderMoneyViewTarget = 'active' | {
|
|
14
|
+
code: string;
|
|
15
|
+
};
|
|
16
|
+
/** Refuse a basis the Shop API would refuse anyway, before a request is spent on it. */
|
|
17
|
+
export declare function assertOrderMoneyBasis(basis: unknown): asserts basis is Shop.OrderMoneyBasis;
|
|
18
|
+
export declare function createMoneyViewMethods(http: HttpClient): {
|
|
19
|
+
/**
|
|
20
|
+
* The order's money as the engine prints it everywhere: rows that add up exactly to the
|
|
21
|
+
* order's own totals. Print them with `orderMoneyRows(view)`, never re-derived.
|
|
22
|
+
*
|
|
23
|
+
* Resolves `null` when there is no view to print: no active order (`'active'`), or an engine
|
|
24
|
+
* before `Order.moneyView` (print the order's own fields, as before). A code the shopper may
|
|
25
|
+
* not read is `NOT_FOUND` (404), exactly as `getOrderByCode`.
|
|
26
|
+
*
|
|
27
|
+
* @effect read
|
|
28
|
+
*/
|
|
29
|
+
getOrderMoneyView(order: OrderMoneyViewTarget, options?: RequestOptions & OrderAccessKeyOption & {
|
|
30
|
+
basis?: Shop.OrderMoneyBasis;
|
|
31
|
+
}): Promise<Shop.OrderMoneyViewFragment | null>;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=money-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money-view.d.ts","sourceRoot":"","sources":["../../src/commerce/money-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,KAAK,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,KAAK,oBAAoB,EAA6B,MAAM,uBAAuB,CAAC;AAQ7F;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,gDAAiD,CAAC;AAEhF,2EAA2E;AAE3E,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/D,wFAAwF;AACxF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,eAAe,CAS3F;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,UAAU;IASnD;;;;;;;;;OASG;6BAEM,oBAAoB,YACjB,cAAc,GAAG,oBAAoB,GAAG;QAAE,KAAK,CAAC,EAAE,IAAI,CAAC,eAAe,CAAA;KAAE,GACjF,OAAO,CAAC,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC;EA8CjD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { isUnknownFieldRejection } from '../core/unknown-field-rejection.js';
|
|
2
|
+
import { StorefrontError } from '../errors.js';
|
|
3
|
+
import { orderAccessKeyCallOptions } from './order-access-key.js';
|
|
4
|
+
import { ACTIVE_ORDER_MONEY_VIEW, ORDER_MONEY_VIEW_BY_CODE, ORDER_MONEY_VIEW_PROBE, } from './queries.js';
|
|
5
|
+
// sdk-owned: the bases `Order.moneyView` takes, as a runtime list the SDK checks before sending.
|
|
6
|
+
/**
|
|
7
|
+
* Which prices a money view shows. `CUSTOMER` (the SDK's default, USER PD1) is how the shop shows
|
|
8
|
+
* prices to the order's own customer: consumers incl. VAT, business customers as the store's
|
|
9
|
+
* price-display settings say. `STORE` follows how the store sets its prices; `GROSS` = incl. VAT,
|
|
10
|
+
* `NET` = excl. VAT. The view answers the one it used, `GROSS` or `NET`.
|
|
11
|
+
*/
|
|
12
|
+
export const ORDER_MONEY_BASES = ['CUSTOMER', 'STORE', 'GROSS', 'NET'];
|
|
13
|
+
/** Refuse a basis the Shop API would refuse anyway, before a request is spent on it. */
|
|
14
|
+
export function assertOrderMoneyBasis(basis) {
|
|
15
|
+
if (!ORDER_MONEY_BASES.includes(basis)) {
|
|
16
|
+
throw new StorefrontError(`The money basis must be one of ${ORDER_MONEY_BASES.join(', ')}.`, 'vendure', 400, 'INVALID_ORDER_MONEY_BASIS');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function createMoneyViewMethods(http) {
|
|
20
|
+
/**
|
|
21
|
+
* Latched once this engine proved it predates `Order.moneyView`, so an older engine costs one
|
|
22
|
+
* refused request per client instance (the quotes pattern). Never un-latches: a client is
|
|
23
|
+
* short-lived relative to a deploy.
|
|
24
|
+
*/
|
|
25
|
+
let unsupported = false;
|
|
26
|
+
return {
|
|
27
|
+
/**
|
|
28
|
+
* The order's money as the engine prints it everywhere: rows that add up exactly to the
|
|
29
|
+
* order's own totals. Print them with `orderMoneyRows(view)`, never re-derived.
|
|
30
|
+
*
|
|
31
|
+
* Resolves `null` when there is no view to print: no active order (`'active'`), or an engine
|
|
32
|
+
* before `Order.moneyView` (print the order's own fields, as before). A code the shopper may
|
|
33
|
+
* not read is `NOT_FOUND` (404), exactly as `getOrderByCode`.
|
|
34
|
+
*
|
|
35
|
+
* @effect read
|
|
36
|
+
*/
|
|
37
|
+
async getOrderMoneyView(order, options) {
|
|
38
|
+
const basis = options?.basis ?? 'CUSTOMER';
|
|
39
|
+
assertOrderMoneyBasis(basis);
|
|
40
|
+
const keyed = orderAccessKeyCallOptions('getOrderMoneyView', options?.accessKey);
|
|
41
|
+
if (order !== 'active' && (typeof order?.code !== 'string' || order.code.trim() === '')) {
|
|
42
|
+
throw new StorefrontError("Name the order: 'active' or { code }.", 'vendure', 400, 'INVALID_ORDER_MONEY_TARGET');
|
|
43
|
+
}
|
|
44
|
+
if (unsupported)
|
|
45
|
+
return null;
|
|
46
|
+
try {
|
|
47
|
+
if (order === 'active') {
|
|
48
|
+
const data = await http.graphql(ACTIVE_ORDER_MONEY_VIEW, { basis }, options);
|
|
49
|
+
return data.activeOrder?.moneyView ?? null;
|
|
50
|
+
}
|
|
51
|
+
const data = await http.graphql(ORDER_MONEY_VIEW_BY_CODE, { code: order.code, basis }, { ...options, ...keyed });
|
|
52
|
+
if (!data.orderByCode) {
|
|
53
|
+
throw new StorefrontError(`Order not found: ${order.code}`, 'vendure', 404, 'NOT_FOUND');
|
|
54
|
+
}
|
|
55
|
+
return data.orderByCode.moneyView;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
if (!isUnknownFieldRejection(error))
|
|
59
|
+
throw error;
|
|
60
|
+
// A body-less 400 (a proxy, a WAF) matches the same test as a validation refusal, so ask
|
|
61
|
+
// the same order without the view: if that runs, this engine lacks the field and the
|
|
62
|
+
// client stops asking; refused too, the refusal was never about the view.
|
|
63
|
+
try {
|
|
64
|
+
await http.graphql(ORDER_MONEY_VIEW_PROBE, {}, options);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
unsupported = true;
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=money-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money-view.js","sourceRoot":"","sources":["../../src/commerce/money-view.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAA6B,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AAEtB,iGAAiG;AACjG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAU,CAAC;AAMhF,wFAAwF;AACxF,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,IAAI,CAAE,iBAAwC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/D,MAAM,IAAI,eAAe,CACvB,kCAAkC,iBAAiB,CAAC,IAAI,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BACtB,MAAM,IAAI,eAAe,CAAC,oBAAoB,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC;gBAC3F,CAAC;gBACD,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC;YACpC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC;oBAAE,MAAM,KAAK,CAAC;gBACjD,yFAAyF;gBACzF,qFAAqF;gBACrF,0EAA0E;gBAC1E,IAAI,CAAC;oBACH,MAAM,IAAI,CAAC,OAAO,CAAgC,sBAAsB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;gBACzF,CAAC;gBAAC,MAAM,CAAC;oBACP,MAAM,KAAK,CAAC;gBACd,CAAC;gBACD,WAAW,GAAG,IAAI,CAAC;gBACnB,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { HttpClient } from '../core/http.js';
|
|
2
|
+
import type { RequestOptions } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* An order's private access key (`Order.accessKey`, or the `key` of the order email's "view your
|
|
5
|
+
* order" link). With it, a caller with NO login reads that one order by its code in any browser:
|
|
6
|
+
* `getOrderByCode`, `getOrderMoneyView({ code })` and `syncMolliePaymentStatus`. It grants
|
|
7
|
+
* nothing else (no payment, no edit), and a signed-in shopper's reads ignore it (their login
|
|
8
|
+
* decides). A wrong, foreign or missing key is answered `FORBIDDEN` like any unreadable code.
|
|
9
|
+
*/
|
|
10
|
+
export interface OrderAccessKeyOption {
|
|
11
|
+
accessKey?: string;
|
|
12
|
+
}
|
|
13
|
+
/** The transport option a call's `accessKey` becomes; refused before sending when malformed. */
|
|
14
|
+
export declare function orderAccessKeyCallOptions(method: string, accessKey: unknown): {
|
|
15
|
+
orderAccessKey?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function createOrderAccessKeyMethods(http: HttpClient): {
|
|
18
|
+
/**
|
|
19
|
+
* The shopper's cart's access key, for the storefront's payment return URL
|
|
20
|
+
* (`/order/{code}?key={accessKey}`), so the confirmation page reads the order even when the
|
|
21
|
+
* payment provider returns the shopper in another browser. `null` without a cart, without
|
|
22
|
+
* keys on the engine, or on an engine before `Order.accessKey`. Treat it as a secret of the
|
|
23
|
+
* shopper: never log it or put it in analytics.
|
|
24
|
+
*
|
|
25
|
+
* @effect read
|
|
26
|
+
*/
|
|
27
|
+
getActiveOrderAccessKey(options?: RequestOptions): Promise<string | null>;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=order-access-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-access-key.d.ts","sourceRoot":"","sources":["../../src/commerce/order-access-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,gGAAgG;AAChG,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,OAAO,GACjB;IAAE,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,CAS7B;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,UAAU;IAExD;;;;;;;;OAQG;sCACqC,cAAc,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;EAclF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { isUnknownFieldRejection } from '../core/unknown-field-rejection.js';
|
|
2
|
+
import { invalidArgument, isNonBlankString } from './arguments.js';
|
|
3
|
+
import { ACTIVE_ORDER_ACCESS_KEY } from './queries.js';
|
|
4
|
+
/** The transport option a call's `accessKey` becomes; refused before sending when malformed. */
|
|
5
|
+
export function orderAccessKeyCallOptions(method, accessKey) {
|
|
6
|
+
if (accessKey === undefined)
|
|
7
|
+
return {};
|
|
8
|
+
if (!isNonBlankString(accessKey)) {
|
|
9
|
+
throw invalidArgument(`${method}: accessKey must be the order's access key (Order.accessKey, or the "key" of ` +
|
|
10
|
+
"the order email's link), or left out.");
|
|
11
|
+
}
|
|
12
|
+
return { orderAccessKey: accessKey.trim() };
|
|
13
|
+
}
|
|
14
|
+
export function createOrderAccessKeyMethods(http) {
|
|
15
|
+
return {
|
|
16
|
+
/**
|
|
17
|
+
* The shopper's cart's access key, for the storefront's payment return URL
|
|
18
|
+
* (`/order/{code}?key={accessKey}`), so the confirmation page reads the order even when the
|
|
19
|
+
* payment provider returns the shopper in another browser. `null` without a cart, without
|
|
20
|
+
* keys on the engine, or on an engine before `Order.accessKey`. Treat it as a secret of the
|
|
21
|
+
* shopper: never log it or put it in analytics.
|
|
22
|
+
*
|
|
23
|
+
* @effect read
|
|
24
|
+
*/
|
|
25
|
+
async getActiveOrderAccessKey(options) {
|
|
26
|
+
try {
|
|
27
|
+
const data = await http.graphql(ACTIVE_ORDER_ACCESS_KEY, {}, options);
|
|
28
|
+
return data.activeOrder?.accessKey ?? null;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
if (isUnknownFieldRejection(error))
|
|
32
|
+
return null;
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=order-access-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-access-key.js","sourceRoot":"","sources":["../../src/commerce/order-access-key.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAG7E,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAcvD,gGAAgG;AAChG,MAAM,UAAU,yBAAyB,CACvC,MAAc,EACd,SAAkB;IAElB,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACvC,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,CAAC;QACjC,MAAM,eAAe,CACnB,GAAG,MAAM,+EAA+E;YACtF,uCAAuC,CAC1C,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,cAAc,EAAE,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,IAAgB;IAC1D,OAAO;QACL;;;;;;;;WAQG;QACH,KAAK,CAAC,uBAAuB,CAAC,OAAwB;YACpD,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAC7B,uBAAuB,EACvB,EAAE,EACF,OAAO,CACR,CAAC;gBACF,OAAO,IAAI,CAAC,WAAW,EAAE,SAAS,IAAI,IAAI,CAAC;YAC7C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,uBAAuB,CAAC,KAAK,CAAC;oBAAE,OAAO,IAAI,CAAC;gBAChD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HttpClient } from '../core/http.js';
|
|
2
2
|
import type * as Shop from '../generated/shop.js';
|
|
3
|
-
import type { RequestOptions } from '../types.js';
|
|
3
|
+
import type { ParkedOrder, ParkedOrderPaymentResult, RequestOptions } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Orders the store is HOLDING for the signed-in shopper.
|
|
6
6
|
*
|
|
@@ -11,10 +11,10 @@ import type { RequestOptions } from '../types.js';
|
|
|
11
11
|
* is the reason a storefront has to ask for these separately.
|
|
12
12
|
*/
|
|
13
13
|
export declare function createParkedOrderMethods(http: HttpClient): {
|
|
14
|
-
getParkedOrders(options?: RequestOptions): Promise<
|
|
14
|
+
getParkedOrders(options?: RequestOptions): Promise<ParkedOrder[]>;
|
|
15
15
|
payParkedOrder(orderCode: string, input: Shop.PayParkedOrderInput, options?: RequestOptions & {
|
|
16
16
|
idempotencyKey?: string;
|
|
17
|
-
}): Promise<
|
|
17
|
+
}): Promise<ParkedOrderPaymentResult>;
|
|
18
18
|
createParkedOrderPaymentIntent(orderCode: string, input: Shop.ParkedOrderPaymentIntentInput, options?: RequestOptions & {
|
|
19
19
|
idempotencyKey?: string;
|
|
20
20
|
}): Promise<Shop.CreateParkedOrderPaymentIntentMutation["createParkedOrderPaymentIntent"]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parked-orders.d.ts","sourceRoot":"","sources":["../../src/commerce/parked-orders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"parked-orders.d.ts","sourceRoot":"","sources":["../../src/commerce/parked-orders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AASzF;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,UAAU;8BAkCrB,cAAc,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;8BAQ1D,MAAM,SACV,IAAI,CAAC,mBAAmB,YACrB,cAAc,GAAG;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GACrD,OAAO,CAAC,wBAAwB,CAAC;8CAwBvB,MAAM,SACV,IAAI,CAAC,6BAA6B,YAC/B,cAAc,GAAG;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GACrD,OAAO,CAAC,IAAI,CAAC,sCAAsC,CAAC,gCAAgC,CAAC,CAAC;EAkB5F"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isUnknownFieldRejection } from '../core/unknown-field-rejection.js';
|
|
2
|
+
import { CREATE_PARKED_ORDER_PAYMENT_INTENT_MUTATION, PARKED_ORDERS_QUERY, PARKED_ORDERS_QUERY_LEGACY, PAY_PARKED_ORDER_MUTATION, PAY_PARKED_ORDER_MUTATION_LEGACY, } from './queries.js';
|
|
2
3
|
/**
|
|
3
4
|
* Orders the store is HOLDING for the signed-in shopper.
|
|
4
5
|
*
|
|
@@ -9,18 +10,46 @@ import { CREATE_PARKED_ORDER_PAYMENT_INTENT_MUTATION, PARKED_ORDERS_QUERY, PAY_P
|
|
|
9
10
|
* is the reason a storefront has to ask for these separately.
|
|
10
11
|
*/
|
|
11
12
|
export function createParkedOrderMethods(http) {
|
|
13
|
+
/**
|
|
14
|
+
* Latched once an engine has proved it predates the position's `creditNoted` and `owed` (the
|
|
15
|
+
* quotes pattern), so the downgrade costs one rejected request per client instance. Never
|
|
16
|
+
* un-latches: a client is short-lived relative to a deploy.
|
|
17
|
+
*/
|
|
18
|
+
let creditFieldsUnsupported = false;
|
|
19
|
+
/**
|
|
20
|
+
* Send `document`, and when this engine refuses it for selecting a field it does not have,
|
|
21
|
+
* send `legacyDocument`: the same operation without `creditNoted` / `owed`, which then arrive
|
|
22
|
+
* `undefined` (that engine caps a payment at `outstanding`). Safe for the payment too: a
|
|
23
|
+
* document refused at VALIDATION never ran, so nothing was paid twice.
|
|
24
|
+
*/
|
|
25
|
+
async function withCreditFieldFallback(document, legacyDocument, variables, options) {
|
|
26
|
+
if (creditFieldsUnsupported)
|
|
27
|
+
return http.graphql(legacyDocument, variables, options);
|
|
28
|
+
try {
|
|
29
|
+
return await http.graphql(document, variables, options);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (!isUnknownFieldRejection(error))
|
|
33
|
+
throw error;
|
|
34
|
+
const data = await http.graphql(legacyDocument, variables, options);
|
|
35
|
+
// Latch only once the legacy shape worked: failing the same way, the refusal was never
|
|
36
|
+
// about these fields.
|
|
37
|
+
creditFieldsUnsupported = true;
|
|
38
|
+
return data;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
12
41
|
return {
|
|
13
42
|
async getParkedOrders(options) {
|
|
14
|
-
const data = await
|
|
43
|
+
const data = await withCreditFieldFallback(PARKED_ORDERS_QUERY, PARKED_ORDERS_QUERY_LEGACY, undefined, options);
|
|
15
44
|
return data.parkedOrders ?? [];
|
|
16
45
|
},
|
|
17
46
|
async payParkedOrder(orderCode, input, options) {
|
|
18
|
-
const data = await
|
|
47
|
+
const data = await withCreditFieldFallback(PAY_PARKED_ORDER_MUTATION, PAY_PARKED_ORDER_MUTATION_LEGACY, {
|
|
19
48
|
orderCode,
|
|
20
49
|
input: {
|
|
21
50
|
method: input.method,
|
|
22
51
|
// `undefined`, never an explicit null: omitting the amount is how a
|
|
23
|
-
// caller says "the
|
|
52
|
+
// caller says "what the order still owes", and an explicit null
|
|
24
53
|
// is a value a future server could read as something else.
|
|
25
54
|
amount: input.amount,
|
|
26
55
|
metadata: input.metadata,
|
|
@@ -35,7 +64,7 @@ export function createParkedOrderMethods(http) {
|
|
|
35
64
|
input: {
|
|
36
65
|
method: input.method,
|
|
37
66
|
redirectUrl: input.redirectUrl,
|
|
38
|
-
// `undefined`, never null — omitted means the
|
|
67
|
+
// `undefined`, never null — omitted means what the order still owes.
|
|
39
68
|
amount: input.amount,
|
|
40
69
|
},
|
|
41
70
|
idempotencyKey: options?.idempotencyKey,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parked-orders.js","sourceRoot":"","sources":["../../src/commerce/parked-orders.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parked-orders.js","sourceRoot":"","sources":["../../src/commerce/parked-orders.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAG7E,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KAAK,CAAC,MAAM;oBACpB,oEAAoE;oBACpE,gEAAgE;oBAChE,2DAA2D;oBAC3D,MAAM,EAAE,KAAK,CAAC,MAAM;oBACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ;iBACzB;gBACD,cAAc,EAAE,OAAO,EAAE,cAAc;aACxC,EACD,OAAO,CACR,CAAC;YACF,OAAO,IAAI,CAAC,cAAc,CAAC;QAC7B,CAAC;QAED,KAAK,CAAC,8BAA8B,CAClC,SAAiB,EACjB,KAAyC,EACzC,OAAsD;YAEtD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAC7B,2CAA2C,EAC3C;gBACE,SAAS;gBACT,KAAK,EAAE;oBACL,MAAM,EAAE,KAAK,CAAC,MAAM;oBACpB,WAAW,EAAE,KAAK,CAAC,WAAW;oBAC9B,qEAAqE;oBACrE,MAAM,EAAE,KAAK,CAAC,MAAM;iBACrB;gBACD,cAAc,EAAE,OAAO,EAAE,cAAc;aACxC,EACD,OAAO,CACR,CAAC;YACF,OAAO,IAAI,CAAC,8BAA8B,CAAC;QAC7C,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { HttpClient } from '../core/http.js';
|
|
2
2
|
import type * as Shop from '../generated/shop.js';
|
|
3
3
|
import type { MolliePaymentIntentResult, RequestOptions, StripePaymentIntentResult } from '../types.js';
|
|
4
|
+
import { type OrderAccessKeyOption } from './order-access-key.js';
|
|
4
5
|
export declare function createPaymentMethods(http: HttpClient): {
|
|
5
6
|
/**
|
|
6
7
|
* See {@link CommerceModule.getActivePaymentMethods}. The Shop API types
|
|
@@ -12,6 +13,6 @@ export declare function createPaymentMethods(http: HttpClient): {
|
|
|
12
13
|
getMolliePaymentMethods(input: Shop.MolliePaymentMethodsInput, options?: RequestOptions): Promise<Shop.MolliePaymentMethodsQuery["molliePaymentMethods"]>;
|
|
13
14
|
getOrderedMolliePaymentMethods(paymentMethodCode: string, options?: RequestOptions): Promise<Shop.OrderedMolliePaymentMethodsQuery["orderedMolliePaymentMethods"]>;
|
|
14
15
|
createMolliePaymentIntent(input: Shop.MolliePaymentIntentInput, options?: RequestOptions): Promise<MolliePaymentIntentResult>;
|
|
15
|
-
syncMolliePaymentStatus(orderCode: string, options?: RequestOptions): Promise<Shop.SyncMolliePaymentStatusMutation["syncMolliePaymentStatus"]>;
|
|
16
|
+
syncMolliePaymentStatus(orderCode: string, options?: RequestOptions & OrderAccessKeyOption): Promise<Shop.SyncMolliePaymentStatusMutation["syncMolliePaymentStatus"]>;
|
|
16
17
|
};
|
|
17
18
|
//# sourceMappingURL=payments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/commerce/payments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,yBAAyB,EAC1B,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/commerce/payments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,KAAK,IAAI,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,yBAAyB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,oBAAoB,EAA6B,MAAM,uBAAuB,CAAC;AAU7F,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU;IAEjD;;;;OAIG;sCAES,cAAc,GACvB,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC;wCAWJ,cAAc,GAAG,OAAO,CAAC,yBAAyB,CAAC;mCAiBpF,IAAI,CAAC,yBAAyB,YAC3B,cAAc,GACvB,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,sBAAsB,CAAC,CAAC;sDAU7C,MAAM,YACf,cAAc,GACvB,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,6BAA6B,CAAC,CAAC;qCAUvE,IAAI,CAAC,wBAAwB,YAC1B,cAAc,GACvB,OAAO,CAAC,yBAAyB,CAAC;uCAiBxB,MAAM,YACP,cAAc,GAAG,oBAAoB,GAC9C,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,yBAAyB,CAAC,CAAC;EAS9E"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MutationError } from '../errors.js';
|
|
2
|
+
import { orderAccessKeyCallOptions } from './order-access-key.js';
|
|
2
3
|
import { ACTIVE_PAYMENT_METHODS, CREATE_MOLLIE_PAYMENT_INTENT, CREATE_STRIPE_PAYMENT_INTENT, MOLLIE_PAYMENT_METHODS, ORDERED_MOLLIE_PAYMENT_METHODS, SYNC_MOLLIE_PAYMENT_STATUS, } from './queries.js';
|
|
3
4
|
export function createPaymentMethods(http) {
|
|
4
5
|
return {
|
|
@@ -39,7 +40,7 @@ export function createPaymentMethods(http) {
|
|
|
39
40
|
return { url: result.url };
|
|
40
41
|
},
|
|
41
42
|
async syncMolliePaymentStatus(orderCode, options) {
|
|
42
|
-
const data = await http.graphql(SYNC_MOLLIE_PAYMENT_STATUS, { orderCode }, options);
|
|
43
|
+
const data = await http.graphql(SYNC_MOLLIE_PAYMENT_STATUS, { orderCode }, { ...options, ...orderAccessKeyCallOptions('syncMolliePaymentStatus', options?.accessKey) });
|
|
43
44
|
return data.syncMolliePaymentStatus;
|
|
44
45
|
},
|
|
45
46
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payments.js","sourceRoot":"","sources":["../../src/commerce/payments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAO7C,OAAO,EACL,sBAAsB,EACtB,4BA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,aAAa,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACpE,CAAC;YACD,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC;QAC7B,CAAC;QAED,KAAK,CAAC,uBAAuB,CAC3B,SAAiB,EACjB,OAA+C;YAE/C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAC7B,0BAA0B,EAC1B,EAAE,SAAS,EAAE,EACb,EAAE,GAAG,OAAO,EAAE,GAAG,yBAAyB,CAAC,yBAAyB,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,CAC5F,CAAC;YACF,OAAO,IAAI,CAAC,uBAAuB,CAAC;QACtC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -232,7 +232,10 @@ export declare const ORDERED_MOLLIE_PAYMENT_METHODS = "\n query OrderedMolliePa
|
|
|
232
232
|
export declare const CREATE_MOLLIE_PAYMENT_INTENT = "\n mutation CreateMolliePaymentIntent($input: MolliePaymentIntentInput!) {\n createMolliePaymentIntent(input: $input) {\n ... on MolliePaymentIntent { url }\n ... on MolliePaymentIntentError { errorCode message }\n }\n }\n";
|
|
233
233
|
export declare const SYNC_MOLLIE_PAYMENT_STATUS = "\n mutation SyncMolliePaymentStatus($orderCode: String!) {\n syncMolliePaymentStatus(orderCode: $orderCode) {\n id\n code\n state\n }\n }\n";
|
|
234
234
|
export declare const PARKED_ORDERS_QUERY: string;
|
|
235
|
-
export declare const
|
|
235
|
+
export declare const PARKED_ORDERS_QUERY_LEGACY: string;
|
|
236
|
+
export declare const PAY_PARKED_ORDER_MUTATION = "\n mutation PayParkedOrder(\n $orderCode: String!\n $input: PayParkedOrderInput!\n $idempotencyKey: String\n ) {\n payParkedOrder(orderCode: $orderCode, input: $input, idempotencyKey: $idempotencyKey) {\n order { id code state }\n payment { id state amount method metadata }\n position { total covered outstanding creditNoted owed currencyCode }\n settled\n }\n }\n";
|
|
237
|
+
/** {@link PAY_PARKED_ORDER_MUTATION} for an engine before `creditNoted` / `owed`. */
|
|
238
|
+
export declare const PAY_PARKED_ORDER_MUTATION_LEGACY = "\n mutation PayParkedOrderLegacy(\n $orderCode: String!\n $input: PayParkedOrderInput!\n $idempotencyKey: String\n ) {\n payParkedOrder(orderCode: $orderCode, input: $input, idempotencyKey: $idempotencyKey) {\n order { id code state }\n payment { id state amount method metadata }\n position { total covered outstanding currencyCode }\n settled\n }\n }\n";
|
|
236
239
|
export declare const CREATE_PARKED_ORDER_PAYMENT_INTENT_MUTATION = "\n mutation CreateParkedOrderPaymentIntent(\n $orderCode: String!\n $input: ParkedOrderPaymentIntentInput!\n $idempotencyKey: String\n ) {\n createParkedOrderPaymentIntent(\n orderCode: $orderCode\n input: $input\n idempotencyKey: $idempotencyKey\n ) {\n provider\n url\n clientSecret\n amount\n currencyCode\n }\n }\n";
|
|
237
240
|
/**
|
|
238
241
|
* A deposit paid in checkout, which parks the active order (W8-13).
|
|
@@ -283,8 +286,9 @@ export declare const UPDATE_ADDRESS = "\n mutation UpdateAddress($input: Update
|
|
|
283
286
|
export declare const DELETE_ADDRESS = "\n mutation DeleteAddress($id: ID!) {\n deleteCustomerAddress(id: $id) {\n success\n }\n }\n";
|
|
284
287
|
export declare const AVAILABLE_COUNTRIES = "\n query AvailableCountries {\n availableCountries {\n id code name\n }\n }\n";
|
|
285
288
|
/**
|
|
286
|
-
* `lines { backorderedQuantity }` is selected HERE and on `GET_CUSTOMER_ORDERS`,
|
|
287
|
-
* and nowhere else
|
|
289
|
+
* `lines { backorderedQuantity expectedArrival }` is selected HERE and on `GET_CUSTOMER_ORDERS`,
|
|
290
|
+
* and nowhere else (`expectedArrival`: when the backordered part is expected, purchase orders
|
|
291
|
+
* step 5.3; null wherever the store's purchasing is off) — the same rule `customFields { paymentIntent }` follows
|
|
288
292
|
* below. In the shared `ORDER_FRAGMENT` fragment it would make every cart read
|
|
289
293
|
* and mutation fail validation against an engine that predates the backorders
|
|
290
294
|
* plugin, taking the whole cart down for a field a cart line never carries a
|
|
@@ -297,6 +301,17 @@ export declare const AVAILABLE_COUNTRIES = "\n query AvailableCountries {\n
|
|
|
297
301
|
* client release carrying it publishes after that engine is deployed.
|
|
298
302
|
*/
|
|
299
303
|
export declare const ORDER_BY_CODE: string;
|
|
304
|
+
export declare const ACTIVE_ORDER_MONEY_VIEW: string;
|
|
305
|
+
export declare const ORDER_MONEY_VIEW_BY_CODE: string;
|
|
306
|
+
/**
|
|
307
|
+
* The money-view read without the view: run after a refusal to tell "this engine has no
|
|
308
|
+
* `Order.moneyView`" from a 400 that was about something else (`commerce/money-view.ts`).
|
|
309
|
+
*/
|
|
310
|
+
/** The cart's access key, for a storefront's payment return URL (`commerce/order-access-key.ts`). */
|
|
311
|
+
export declare const ACTIVE_ORDER_ACCESS_KEY = "\n query ActiveOrderAccessKey {\n activeOrder { id accessKey }\n }\n";
|
|
312
|
+
export declare const ORDER_MONEY_VIEW_PROBE = "\n query OrderMoneyViewProbe {\n activeOrder { id }\n }\n";
|
|
313
|
+
/** {@link GET_CUSTOMER_ORDERS} with each order's money view, for `getCustomerOrders({ moneyView })`. */
|
|
314
|
+
export declare const GET_CUSTOMER_ORDERS_WITH_MONEY_VIEW: string;
|
|
300
315
|
export declare const FAVORITE_VARIANT_IDS = "\n query FavoriteVariantIds {\n favoriteProductVariantIds\n }\n";
|
|
301
316
|
export declare const MY_FAVORITES = "\n query MyFavorites($options: FavoriteListOptions) {\n myFavorites(options: $options) {\n items {\n id\n productVariantId\n createdAt\n productVariant {\n id name sku\n price priceWithTax currencyCode stockLevel\n stockOnHand stockAllocated saleable\n incomingStock projectedSaleable nextExpectedArrival\n backorderAllowance\n availability { state availableFrom orderable }\n priceListName retailPrice retailPriceWithTax taxRateApplied { value }\n priceTiers { minQuantity price priceWithTax discountLabel }\n availabilityByLocation { locationId locationName inStock }\n product {\n id name slug\n featuredAsset {\n source width height\n customFields { altText }\n presets { xs { url webpUrl } m { url webpUrl } l { url webpUrl } }\n }\n }\n options { id name group { name } }\n customFields { minOrderQuantity salesUnit position }\n }\n }\n totalItems\n }\n }\n";
|
|
302
317
|
export declare const TOGGLE_FAVORITE = "\n mutation ToggleFavorite($productVariantId: ID!) {\n toggleFavorite(productVariantId: $productVariantId)\n }\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/commerce/queries.ts"],"names":[],"mappings":"AASA,kFAAkF;AAClF,eAAO,MAAM,6BAA6B,kDAIxC,CAAC;AAEH,eAAO,MAAM,mBAAmB,kDAI9B,CAAC;AAEH,eAAO,MAAM,sCAAsC,kDAIjD,CAAC;AAEH,eAAO,MAAM,oBAAoB,kDAI/B,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,kDAOlC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,kDA0BpC,CAAC;AAEH,uDAAuD;AACvD,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/commerce/queries.ts"],"names":[],"mappings":"AASA,kFAAkF;AAClF,eAAO,MAAM,6BAA6B,kDAIxC,CAAC;AAEH,eAAO,MAAM,mBAAmB,kDAI9B,CAAC;AAEH,eAAO,MAAM,sCAAsC,kDAIjD,CAAC;AAEH,eAAO,MAAM,oBAAoB,kDAI/B,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,kDAOlC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,kDA0BpC,CAAC;AAEH,uDAAuD;AACvD,eAAO,MAAM,wBAAwB,kDA+BpC,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,gBAAgB,kDAsC5B,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB,kDAgCpC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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M,gBAAgB,QAS5B,CAAC;AAEF,eAAO,MAAM,iBAAiB,uLAM7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAS7B,CAAC;AAEF,eAAO,MAAM,eAAe,QAS3B,CAAC;AAEF,eAAO,MAAM,mBAAmB,iNAM/B,CAAC;AAyCF,eAAO,MAAM,SAAS,QAUrB,CAAC;AACF,eAAO,MAAM,gBAAgB,QAU5B,CAAC;AAEF,eAAO,MAAM,QAAQ,QAOpB,CAAC;AACF,eAAO,MAAM,eAAe,QAO3B,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAOhC,CAAC;AACF,eAAO,MAAM,2BAA2B,QAOvC,CAAC;AAEF,eAAO,MAAM,YAAY,QAOxB,CAAC;AAEF,eAAO,MAAM,eAAe,QAO3B,CAAC;AACF,eAAO,MAAM,sBAAsB,QAOlC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,kcA4BxB,CAAC;AAIF,eAAO,MAAM,gCAAgC,uPAW5C,CAAC;AAIF,eAAO,MAAM,iBAAiB,qMAM7B,CAAC;AAEF,eAAO,MAAM,cAAc,4IAM1B,CAAC;AAEF,eAAO,MAAM,2BAA2B,8KAMvC,CAAC;AAIF,eAAO,MAAM,qBAAqB,yNAMjC,CAAC;AAEF,eAAO,MAAM,+BAA+B,gMAM3C,CAAC;AA0BF,eAAO,MAAM,UAAU,QAUtB,CAAC;AAEF,eAAO,MAAM,SAAS,QAOrB,CAAC;AAEF,eAAO,MAAM,cAAc,QAmB1B,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAO5B,CAAC;AAEF,eAAO,MAAM,0BAA0B,ydAatC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iCAAiC,0WAW7C,CAAC"}
|
package/dist/commerce/queries.js
CHANGED
|
@@ -83,6 +83,7 @@ export const PRODUCT_VARIANT_FRAGMENT = fragment(
|
|
|
83
83
|
stockOnHand stockAllocated saleable
|
|
84
84
|
incomingStock projectedSaleable nextExpectedArrival
|
|
85
85
|
backorderAllowance
|
|
86
|
+
dropShip { leadTimeDays }
|
|
86
87
|
availability { ...ProductAvailability }
|
|
87
88
|
forSaleInCurrency
|
|
88
89
|
priceListName retailPrice retailPriceWithTax taxRateApplied { value }
|
|
@@ -1201,12 +1202,28 @@ export const SYNC_MOLLIE_PAYMENT_STATUS = /* GraphQL */ `
|
|
|
1201
1202
|
// --- Parked (held) orders ---
|
|
1202
1203
|
/**
|
|
1203
1204
|
* The money on a held order, as the storefront sees it: what it bills, what is
|
|
1204
|
-
* covered, what is left,
|
|
1205
|
-
*
|
|
1206
|
-
*
|
|
1205
|
+
* covered, what is left, what its credit notes took off its bill and what is
|
|
1206
|
+
* left to pay after them (`owed`, the most a payment may take), and the
|
|
1207
|
+
* currency they are in. Narrower than the merchant's own view of the same
|
|
1208
|
+
* order — settled-vs-authorized and per-payment refunds are bookkeeping a
|
|
1209
|
+
* shopper is not shown.
|
|
1210
|
+
*
|
|
1211
|
+
* `creditNoted` and `owed` are newer than the rest (USER DECISION P2): every
|
|
1212
|
+
* document selecting them has a `Legacy` twin without them, and
|
|
1213
|
+
* `createParkedOrderMethods` retries with it once an engine refuses them.
|
|
1207
1214
|
*/
|
|
1208
1215
|
const PARKED_ORDER_FRAGMENT = fragment(/* GraphQL */ `
|
|
1209
1216
|
fragment ParkedOrder on ParkedOrder {
|
|
1217
|
+
id
|
|
1218
|
+
code
|
|
1219
|
+
state
|
|
1220
|
+
position { total covered outstanding creditNoted owed currencyCode }
|
|
1221
|
+
reason
|
|
1222
|
+
}
|
|
1223
|
+
`);
|
|
1224
|
+
/** {@link PARKED_ORDER_FRAGMENT} for an engine before `creditNoted` / `owed`. */
|
|
1225
|
+
const PARKED_ORDER_LEGACY_FRAGMENT = fragment(/* GraphQL */ `
|
|
1226
|
+
fragment ParkedOrderLegacy on ParkedOrder {
|
|
1210
1227
|
id
|
|
1211
1228
|
code
|
|
1212
1229
|
state
|
|
@@ -1222,11 +1239,34 @@ export const PARKED_ORDERS_QUERY = withFragments(
|
|
|
1222
1239
|
}
|
|
1223
1240
|
}
|
|
1224
1241
|
`, PARKED_ORDER_FRAGMENT);
|
|
1242
|
+
export const PARKED_ORDERS_QUERY_LEGACY = withFragments(
|
|
1243
|
+
/* GraphQL */ `
|
|
1244
|
+
query ParkedOrdersLegacy {
|
|
1245
|
+
parkedOrders {
|
|
1246
|
+
...ParkedOrderLegacy
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
`, PARKED_ORDER_LEGACY_FRAGMENT);
|
|
1225
1250
|
export const PAY_PARKED_ORDER_MUTATION = /* GraphQL */ `
|
|
1226
1251
|
mutation PayParkedOrder(
|
|
1227
1252
|
$orderCode: String!
|
|
1228
1253
|
$input: PayParkedOrderInput!
|
|
1229
1254
|
$idempotencyKey: String
|
|
1255
|
+
) {
|
|
1256
|
+
payParkedOrder(orderCode: $orderCode, input: $input, idempotencyKey: $idempotencyKey) {
|
|
1257
|
+
order { id code state }
|
|
1258
|
+
payment { id state amount method metadata }
|
|
1259
|
+
position { total covered outstanding creditNoted owed currencyCode }
|
|
1260
|
+
settled
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
`;
|
|
1264
|
+
/** {@link PAY_PARKED_ORDER_MUTATION} for an engine before `creditNoted` / `owed`. */
|
|
1265
|
+
export const PAY_PARKED_ORDER_MUTATION_LEGACY = /* GraphQL */ `
|
|
1266
|
+
mutation PayParkedOrderLegacy(
|
|
1267
|
+
$orderCode: String!
|
|
1268
|
+
$input: PayParkedOrderInput!
|
|
1269
|
+
$idempotencyKey: String
|
|
1230
1270
|
) {
|
|
1231
1271
|
payParkedOrder(orderCode: $orderCode, input: $input, idempotencyKey: $idempotencyKey) {
|
|
1232
1272
|
order { id code state }
|
|
@@ -1368,7 +1408,7 @@ export const GET_CUSTOMER_ORDERS = withFragments(
|
|
|
1368
1408
|
orders(options: $options) {
|
|
1369
1409
|
items {
|
|
1370
1410
|
...OrderSummary
|
|
1371
|
-
lines { id backorderedQuantity }
|
|
1411
|
+
lines { id backorderedQuantity expectedArrival { date confirmed source } }
|
|
1372
1412
|
...OrderFulfillmentParcels
|
|
1373
1413
|
}
|
|
1374
1414
|
totalItems
|
|
@@ -1549,8 +1589,9 @@ export const AVAILABLE_COUNTRIES = /* GraphQL */ `
|
|
|
1549
1589
|
}
|
|
1550
1590
|
`;
|
|
1551
1591
|
/**
|
|
1552
|
-
* `lines { backorderedQuantity }` is selected HERE and on `GET_CUSTOMER_ORDERS`,
|
|
1553
|
-
* and nowhere else
|
|
1592
|
+
* `lines { backorderedQuantity expectedArrival }` is selected HERE and on `GET_CUSTOMER_ORDERS`,
|
|
1593
|
+
* and nowhere else (`expectedArrival`: when the backordered part is expected, purchase orders
|
|
1594
|
+
* step 5.3; null wherever the store's purchasing is off) — the same rule `customFields { paymentIntent }` follows
|
|
1554
1595
|
* below. In the shared `ORDER_FRAGMENT` fragment it would make every cart read
|
|
1555
1596
|
* and mutation fail validation against an engine that predates the backorders
|
|
1556
1597
|
* plugin, taking the whole cart down for a field a cart line never carries a
|
|
@@ -1567,7 +1608,7 @@ export const ORDER_BY_CODE = withFragments(
|
|
|
1567
1608
|
query OrderByCode($code: String!) {
|
|
1568
1609
|
orderByCode(code: $code) {
|
|
1569
1610
|
...Order
|
|
1570
|
-
lines { id backorderedQuantity }
|
|
1611
|
+
lines { id backorderedQuantity expectedArrival { date confirmed source } }
|
|
1571
1612
|
customFields { chargedParcelCount }
|
|
1572
1613
|
...OrderFulfillments
|
|
1573
1614
|
...OrderFulfillmentParcels
|
|
@@ -1576,6 +1617,76 @@ export const ORDER_BY_CODE = withFragments(
|
|
|
1576
1617
|
}
|
|
1577
1618
|
}
|
|
1578
1619
|
`, ORDER_FRAGMENT, ORDER_FULFILLMENTS_FRAGMENT, ORDER_FULFILLMENT_PARCELS_FRAGMENT, ORDER_PAYMENT_TERMS_FRAGMENT, ORDER_DELIVERY_TERMS_FRAGMENT);
|
|
1620
|
+
/**
|
|
1621
|
+
* An order's money as the engine prints it (`Order.moneyView`, pricing-display-consistency):
|
|
1622
|
+
* rows that add up exactly to the order's own totals, the same rows the dashboard, the emails
|
|
1623
|
+
* and the invoices print. Every field, at every depth: a storefront prints them as served.
|
|
1624
|
+
*
|
|
1625
|
+
* Kept OUT of `ORDER_FRAGMENT` and `ORDER_SUMMARY_FRAGMENT`: an engine before the field refuses
|
|
1626
|
+
* the WHOLE document at validation, and those fragments feed the cart mutations and the
|
|
1627
|
+
* customer-session read. Only the money-view documents below select it, and their methods fall
|
|
1628
|
+
* back when an older engine refuses them (`commerce/money-view.ts`).
|
|
1629
|
+
*/
|
|
1630
|
+
const ORDER_MONEY_VIEW_FRAGMENT = fragment(/* GraphQL */ `
|
|
1631
|
+
fragment OrderMoneyView on OrderMoneyView {
|
|
1632
|
+
basis currencyCode
|
|
1633
|
+
lines { orderLineId quantity taxRate unitAmount amount }
|
|
1634
|
+
goodsAdjustments { key description amount taxRate }
|
|
1635
|
+
surcharges { key description amount taxRate }
|
|
1636
|
+
subtotal
|
|
1637
|
+
shipping { key description amount taxRate }
|
|
1638
|
+
shippingAdjustments { key description amount taxRate }
|
|
1639
|
+
shippingTotal totalExcludingTax
|
|
1640
|
+
taxes { taxRate base amount }
|
|
1641
|
+
taxIncluded taxTotal rounding total totalBeforeRounding
|
|
1642
|
+
balance { paid giftCard storeCredit credited stillToPay }
|
|
1643
|
+
reconciles
|
|
1644
|
+
}
|
|
1645
|
+
`);
|
|
1646
|
+
export const ACTIVE_ORDER_MONEY_VIEW = withFragments(
|
|
1647
|
+
/* GraphQL */ `
|
|
1648
|
+
query ActiveOrderMoneyView($basis: OrderMoneyBasis!) {
|
|
1649
|
+
activeOrder { id code moneyView(basis: $basis) { ...OrderMoneyView } }
|
|
1650
|
+
}
|
|
1651
|
+
`, ORDER_MONEY_VIEW_FRAGMENT);
|
|
1652
|
+
export const ORDER_MONEY_VIEW_BY_CODE = withFragments(
|
|
1653
|
+
/* GraphQL */ `
|
|
1654
|
+
query OrderMoneyViewByCode($code: String!, $basis: OrderMoneyBasis!) {
|
|
1655
|
+
orderByCode(code: $code) { id code moneyView(basis: $basis) { ...OrderMoneyView } }
|
|
1656
|
+
}
|
|
1657
|
+
`, ORDER_MONEY_VIEW_FRAGMENT);
|
|
1658
|
+
/**
|
|
1659
|
+
* The money-view read without the view: run after a refusal to tell "this engine has no
|
|
1660
|
+
* `Order.moneyView`" from a 400 that was about something else (`commerce/money-view.ts`).
|
|
1661
|
+
*/
|
|
1662
|
+
/** The cart's access key, for a storefront's payment return URL (`commerce/order-access-key.ts`). */
|
|
1663
|
+
export const ACTIVE_ORDER_ACCESS_KEY = /* GraphQL */ `
|
|
1664
|
+
query ActiveOrderAccessKey {
|
|
1665
|
+
activeOrder { id accessKey }
|
|
1666
|
+
}
|
|
1667
|
+
`;
|
|
1668
|
+
export const ORDER_MONEY_VIEW_PROBE = /* GraphQL */ `
|
|
1669
|
+
query OrderMoneyViewProbe {
|
|
1670
|
+
activeOrder { id }
|
|
1671
|
+
}
|
|
1672
|
+
`;
|
|
1673
|
+
/** {@link GET_CUSTOMER_ORDERS} with each order's money view, for `getCustomerOrders({ moneyView })`. */
|
|
1674
|
+
export const GET_CUSTOMER_ORDERS_WITH_MONEY_VIEW = withFragments(
|
|
1675
|
+
/* GraphQL */ `
|
|
1676
|
+
query CustomerOrdersWithMoneyView($options: OrderListOptions, $basis: OrderMoneyBasis!) {
|
|
1677
|
+
activeCustomer {
|
|
1678
|
+
orders(options: $options) {
|
|
1679
|
+
items {
|
|
1680
|
+
...OrderSummary
|
|
1681
|
+
lines { id backorderedQuantity }
|
|
1682
|
+
...OrderFulfillmentParcels
|
|
1683
|
+
moneyView(basis: $basis) { ...OrderMoneyView }
|
|
1684
|
+
}
|
|
1685
|
+
totalItems
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
`, ORDER_FULFILLMENT_PARCELS_FRAGMENT, ORDER_SUMMARY_FRAGMENT, ORDER_MONEY_VIEW_FRAGMENT);
|
|
1579
1690
|
// --- Favorites ---
|
|
1580
1691
|
export const FAVORITE_VARIANT_IDS = /* GraphQL */ `
|
|
1581
1692
|
query FavoriteVariantIds {
|