@platform-x-shp/shopify-adapter 0.2.0 → 0.4.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/src/cart.d.ts +9 -0
- package/dist/src/cart.d.ts.map +1 -1
- package/dist/src/cart.js +29 -0
- package/dist/src/cart.js.map +1 -1
- package/dist/src/customers.d.ts +46 -0
- package/dist/src/customers.d.ts.map +1 -1
- package/dist/src/customers.js +195 -0
- package/dist/src/customers.js.map +1 -1
- package/dist/src/index.d.ts +5 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +21 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/orders.d.ts +135 -0
- package/dist/src/orders.d.ts.map +1 -1
- package/dist/src/orders.js +303 -0
- package/dist/src/orders.js.map +1 -1
- package/package.json +1 -1
package/dist/src/cart.d.ts
CHANGED
|
@@ -33,6 +33,15 @@ export declare function getCart(siteName: string, cartId: string): Promise<Shopi
|
|
|
33
33
|
export declare function addCartLines(siteName: string, cartId: string, lines: CartLineInput[]): Promise<ShopifyCart>;
|
|
34
34
|
/** Update the quantity of existing cart lines. */
|
|
35
35
|
export declare function updateCartLines(siteName: string, cartId: string, lines: CartLineUpdateInput[]): Promise<ShopifyCart>;
|
|
36
|
+
/**
|
|
37
|
+
* Links a cart to a signed-in customer so the resulting order carries their
|
|
38
|
+
* identity. Shopify's own `cartBuyerIdentityUpdate` wants a real Storefront
|
|
39
|
+
* `customerAccessToken`, which a PlatformX/Keycloak bearer isn't — so, same
|
|
40
|
+
* as shp-cart-service's `linkCartToCustomer`, this records it as a
|
|
41
|
+
* `customer_id` cart attribute instead, which carries through onto the
|
|
42
|
+
* resulting order's custom attributes.
|
|
43
|
+
*/
|
|
44
|
+
export declare function linkCartToCustomer(siteName: string, cartId: string, customerId: string): Promise<ShopifyCart>;
|
|
36
45
|
/** Remove lines from a cart by line ID. */
|
|
37
46
|
export declare function removeCartLines(siteName: string, cartId: string, lineIds: string[]): Promise<ShopifyCart>;
|
|
38
47
|
//# sourceMappingURL=cart.d.ts.map
|
package/dist/src/cart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.d.ts","sourceRoot":"","sources":["../../src/cart.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,YAAY,GAAG,IAAI,CAAC;IACjC,KAAK,EAAE,eAAe,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB;AAwED,wDAAwD;AACxD,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAoBhG;AAED,+FAA+F;AAC/F,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAU3F;AAED,iDAAiD;AACjD,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,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MAAM,EAAE,KAAK,CAAC,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAoBhG;AAED,+FAA+F;AAC/F,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAU3F;AAED,iDAAiD;AACjD,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAqBjH;AAED,kDAAkD;AAClD,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,mBAAmB,EAAE,GAC3B,OAAO,CAAC,WAAW,CAAC,CAqBtB;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAqBnH;AAED,2CAA2C;AAC3C,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAqB/G"}
|
package/dist/src/cart.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.createCart = createCart;
|
|
|
4
4
|
exports.getCart = getCart;
|
|
5
5
|
exports.addCartLines = addCartLines;
|
|
6
6
|
exports.updateCartLines = updateCartLines;
|
|
7
|
+
exports.linkCartToCustomer = linkCartToCustomer;
|
|
7
8
|
exports.removeCartLines = removeCartLines;
|
|
8
9
|
const client_1 = require("./client");
|
|
9
10
|
const errors_1 = require("./errors");
|
|
@@ -126,6 +127,34 @@ async function updateCartLines(siteName, cartId, lines) {
|
|
|
126
127
|
}
|
|
127
128
|
return mapCart(data.cartLinesUpdate.cart);
|
|
128
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Links a cart to a signed-in customer so the resulting order carries their
|
|
132
|
+
* identity. Shopify's own `cartBuyerIdentityUpdate` wants a real Storefront
|
|
133
|
+
* `customerAccessToken`, which a PlatformX/Keycloak bearer isn't — so, same
|
|
134
|
+
* as shp-cart-service's `linkCartToCustomer`, this records it as a
|
|
135
|
+
* `customer_id` cart attribute instead, which carries through onto the
|
|
136
|
+
* resulting order's custom attributes.
|
|
137
|
+
*/
|
|
138
|
+
async function linkCartToCustomer(siteName, cartId, customerId) {
|
|
139
|
+
const mutation = `
|
|
140
|
+
${CART_FRAGMENT}
|
|
141
|
+
mutation CartAttributesUpdate($cartId: ID!, $attributes: [AttributeInput!]!) {
|
|
142
|
+
cartAttributesUpdate(cartId: $cartId, attributes: $attributes) {
|
|
143
|
+
cart { ...CartFields }
|
|
144
|
+
userErrors { field message }
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
`;
|
|
148
|
+
const data = await (0, client_1.storefrontGraphql)(siteName, mutation, {
|
|
149
|
+
cartId,
|
|
150
|
+
attributes: [{ key: 'customer_id', value: customerId }],
|
|
151
|
+
});
|
|
152
|
+
ensureNoUserErrors(data.cartAttributesUpdate.userErrors, 'Failed to link cart to customer');
|
|
153
|
+
if (!data.cartAttributesUpdate.cart) {
|
|
154
|
+
throw new errors_1.ShopifyUserErrorsError('Failed to link cart to customer', data.cartAttributesUpdate.userErrors);
|
|
155
|
+
}
|
|
156
|
+
return mapCart(data.cartAttributesUpdate.cart);
|
|
157
|
+
}
|
|
129
158
|
/** Remove lines from a cart by line ID. */
|
|
130
159
|
async function removeCartLines(siteName, cartId, lineIds) {
|
|
131
160
|
const mutation = `
|
package/dist/src/cart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.js","sourceRoot":"","sources":["../../src/cart.ts"],"names":[],"mappings":";;AA0GA,gCAoBC;AAGD,0BAUC;AAGD,oCAqBC;AAGD,0CAyBC;AAGD,0C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AC,UAAU,EAAE,iCAAiC,CAAC,CAAC;IAC5F,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,CAAC;QACpC,MAAM,IAAI,+BAAsB,CAAC,iCAAiC,EAAE,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC5G,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC;AAED,2CAA2C;AACpC,KAAK,UAAU,eAAe,CAAC,QAAgB,EAAE,MAAc,EAAE,OAAiB;IACvF,MAAM,QAAQ,GAAG;MACb,aAAa;;;;;;;GAOhB,CAAC;IAEF,MAAM,IAAI,GAAG,MAAM,IAAA,0BAAiB,EAA2C,QAAQ,EAAE,QAAQ,EAAE;QACjG,MAAM;QACN,OAAO;KACR,CAAC,CAAC;IAEH,kBAAkB,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,6BAA6B,CAAC,CAAC;IACnF,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;QAC/B,MAAM,IAAI,+BAAsB,CAAC,6BAA6B,EAAE,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;IACnG,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC"}
|
package/dist/src/customers.d.ts
CHANGED
|
@@ -9,6 +9,38 @@ export interface ShopifyCustomer {
|
|
|
9
9
|
updatedAt?: string;
|
|
10
10
|
defaultAddressId?: string;
|
|
11
11
|
}
|
|
12
|
+
export interface CustomerUpdateInput {
|
|
13
|
+
firstName?: string;
|
|
14
|
+
lastName?: string;
|
|
15
|
+
email?: string;
|
|
16
|
+
phone?: string;
|
|
17
|
+
acceptsMarketing?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface ShopifyAddress {
|
|
20
|
+
shopifyId: string;
|
|
21
|
+
firstName?: string;
|
|
22
|
+
lastName?: string;
|
|
23
|
+
address1?: string;
|
|
24
|
+
address2?: string;
|
|
25
|
+
city?: string;
|
|
26
|
+
province?: string;
|
|
27
|
+
country?: string;
|
|
28
|
+
zip?: string;
|
|
29
|
+
phone?: string;
|
|
30
|
+
isDefault: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface AddressInput {
|
|
33
|
+
firstName?: string;
|
|
34
|
+
lastName?: string;
|
|
35
|
+
address1?: string;
|
|
36
|
+
address2?: string;
|
|
37
|
+
city?: string;
|
|
38
|
+
province?: string;
|
|
39
|
+
country?: string;
|
|
40
|
+
zip?: string;
|
|
41
|
+
phone?: string;
|
|
42
|
+
setAsDefault?: boolean;
|
|
43
|
+
}
|
|
12
44
|
/** Fetch a customer by Shopify ID; `null` if missing. */
|
|
13
45
|
export declare function getCustomerById(siteName: string, customerId: string): Promise<ShopifyCustomer | null>;
|
|
14
46
|
/**
|
|
@@ -16,4 +48,18 @@ export declare function getCustomerById(siteName: string, customerId: string): P
|
|
|
16
48
|
* auth principal's email claim rather than a Shopify customer GID.
|
|
17
49
|
*/
|
|
18
50
|
export declare function getCustomerByEmail(siteName: string, email: string): Promise<ShopifyCustomer | null>;
|
|
51
|
+
/** Update a customer's profile fields. `acceptsMarketing` goes through a separate consent mutation, same as shp-customer-service. */
|
|
52
|
+
export declare function updateCustomer(siteName: string, customerId: string, input: CustomerUpdateInput): Promise<ShopifyCustomer>;
|
|
53
|
+
/** List a customer's addresses, each flagged with whether it's the default — `null` if the customer doesn't exist. */
|
|
54
|
+
export declare function listCustomerAddresses(siteName: string, customerId: string): Promise<ShopifyAddress[] | null>;
|
|
55
|
+
/** Fetch a single address by ID (numeric or full GID) — `null` if the customer or address doesn't exist. */
|
|
56
|
+
export declare function getCustomerAddress(siteName: string, customerId: string, addressId: string): Promise<ShopifyAddress | null>;
|
|
57
|
+
/** Add a new address to a customer, optionally setting it as their default. */
|
|
58
|
+
export declare function createCustomerAddress(siteName: string, customerId: string, input: AddressInput): Promise<ShopifyAddress>;
|
|
59
|
+
/** Update an existing address's fields, optionally setting it as the default. `null` if the address doesn't exist. */
|
|
60
|
+
export declare function updateCustomerAddress(siteName: string, customerId: string, addressId: string, input: AddressInput): Promise<ShopifyAddress | null>;
|
|
61
|
+
/** Remove an address from a customer, returning its resolved ID — `null` if it doesn't exist. */
|
|
62
|
+
export declare function deleteCustomerAddress(siteName: string, customerId: string, addressId: string): Promise<string | null>;
|
|
63
|
+
/** Set an existing address as the customer's default — `null` if it doesn't exist. */
|
|
64
|
+
export declare function setDefaultCustomerAddress(siteName: string, customerId: string, addressId: string): Promise<ShopifyCustomer | null>;
|
|
19
65
|
//# sourceMappingURL=customers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../src/customers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../src/customers.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,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,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,CAmBlH;AAED,4GAA4G;AAC5G,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAOhC;AAED,+EAA+E;AAC/E,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,cAAc,CAAC,CAwBzB;AAED,sHAAsH;AACtH,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA2BhC;AAED,iGAAiG;AACjG,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiBxB;AAED,sFAAsF;AACtF,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CA2BjC"}
|
package/dist/src/customers.js
CHANGED
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCustomerById = getCustomerById;
|
|
4
4
|
exports.getCustomerByEmail = getCustomerByEmail;
|
|
5
|
+
exports.updateCustomer = updateCustomer;
|
|
6
|
+
exports.listCustomerAddresses = listCustomerAddresses;
|
|
7
|
+
exports.getCustomerAddress = getCustomerAddress;
|
|
8
|
+
exports.createCustomerAddress = createCustomerAddress;
|
|
9
|
+
exports.updateCustomerAddress = updateCustomerAddress;
|
|
10
|
+
exports.deleteCustomerAddress = deleteCustomerAddress;
|
|
11
|
+
exports.setDefaultCustomerAddress = setDefaultCustomerAddress;
|
|
5
12
|
const client_1 = require("./client");
|
|
13
|
+
const errors_1 = require("./errors");
|
|
6
14
|
const CUSTOMER_FIELDS = `
|
|
7
15
|
id
|
|
8
16
|
firstName
|
|
@@ -20,6 +28,32 @@ function toAcceptsMarketing(node) {
|
|
|
20
28
|
function normalizeCustomerId(customerId) {
|
|
21
29
|
return customerId.startsWith('gid://shopify/Customer/') ? customerId : `gid://shopify/Customer/${customerId}`;
|
|
22
30
|
}
|
|
31
|
+
/** The trailing numeric segment of a GID (strips any `?`-suffixed query Shopify sometimes appends to address GIDs). */
|
|
32
|
+
function extractNumericId(gid) {
|
|
33
|
+
const last = gid.split('/').pop() ?? gid;
|
|
34
|
+
return last.split('?')[0] ?? last;
|
|
35
|
+
}
|
|
36
|
+
function ensureNoUserErrors(errors, message) {
|
|
37
|
+
if (errors && errors.length > 0) {
|
|
38
|
+
throw new errors_1.ShopifyUserErrorsError(message, errors);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function mapAddress(node, isDefault) {
|
|
42
|
+
return {
|
|
43
|
+
shopifyId: node.id,
|
|
44
|
+
firstName: node.firstName ?? undefined,
|
|
45
|
+
lastName: node.lastName ?? undefined,
|
|
46
|
+
address1: node.address1 ?? undefined,
|
|
47
|
+
address2: node.address2 ?? undefined,
|
|
48
|
+
city: node.city ?? undefined,
|
|
49
|
+
province: node.province ?? undefined,
|
|
50
|
+
country: node.country ?? undefined,
|
|
51
|
+
zip: node.zip ?? undefined,
|
|
52
|
+
phone: node.phone ?? undefined,
|
|
53
|
+
isDefault,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const ADDRESS_FIELDS = `id firstName lastName address1 address2 city province country zip phone`;
|
|
23
57
|
function mapCustomer(node) {
|
|
24
58
|
return {
|
|
25
59
|
shopifyId: node.id,
|
|
@@ -59,4 +93,165 @@ async function getCustomerByEmail(siteName, email) {
|
|
|
59
93
|
const customer = data.customers.nodes[0];
|
|
60
94
|
return customer ? mapCustomer(customer) : null;
|
|
61
95
|
}
|
|
96
|
+
async function updateCustomerEmailMarketingConsent(siteName, customerId, acceptsMarketing) {
|
|
97
|
+
const mutation = `
|
|
98
|
+
mutation UpdateCustomerEmailMarketingConsent($input: CustomerEmailMarketingConsentUpdateInput!) {
|
|
99
|
+
customerEmailMarketingConsentUpdate(input: $input) {
|
|
100
|
+
userErrors { field message }
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
104
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, {
|
|
105
|
+
input: {
|
|
106
|
+
customerId: normalizeCustomerId(customerId),
|
|
107
|
+
emailMarketingConsent: {
|
|
108
|
+
marketingState: acceptsMarketing ? 'SUBSCRIBED' : 'UNSUBSCRIBED',
|
|
109
|
+
marketingOptInLevel: 'SINGLE_OPT_IN',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
ensureNoUserErrors(data.customerEmailMarketingConsentUpdate.userErrors, 'Failed to update marketing consent');
|
|
114
|
+
}
|
|
115
|
+
/** Update a customer's profile fields. `acceptsMarketing` goes through a separate consent mutation, same as shp-customer-service. */
|
|
116
|
+
async function updateCustomer(siteName, customerId, input) {
|
|
117
|
+
const { acceptsMarketing, ...rest } = input;
|
|
118
|
+
const mutation = `
|
|
119
|
+
mutation UpdateCustomer($input: CustomerInput!) {
|
|
120
|
+
customerUpdate(input: $input) {
|
|
121
|
+
customer { id }
|
|
122
|
+
userErrors { field message }
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
`;
|
|
126
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, { input: { id: normalizeCustomerId(customerId), ...rest } });
|
|
127
|
+
ensureNoUserErrors(data.customerUpdate.userErrors, 'Failed to update customer');
|
|
128
|
+
if (typeof acceptsMarketing === 'boolean') {
|
|
129
|
+
await updateCustomerEmailMarketingConsent(siteName, customerId, acceptsMarketing);
|
|
130
|
+
}
|
|
131
|
+
const updated = await getCustomerById(siteName, customerId);
|
|
132
|
+
if (!updated) {
|
|
133
|
+
throw new errors_1.ShopifyNotFoundError('Customer not found', { customerId });
|
|
134
|
+
}
|
|
135
|
+
return updated;
|
|
136
|
+
}
|
|
137
|
+
/** List a customer's addresses, each flagged with whether it's the default — `null` if the customer doesn't exist. */
|
|
138
|
+
async function listCustomerAddresses(siteName, customerId) {
|
|
139
|
+
const query = `
|
|
140
|
+
query CustomerAddresses($id: ID!) {
|
|
141
|
+
customer(id: $id) {
|
|
142
|
+
defaultAddress { id }
|
|
143
|
+
addresses { ${ADDRESS_FIELDS} }
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
`;
|
|
147
|
+
const data = await (0, client_1.adminGraphql)(siteName, query, { id: normalizeCustomerId(customerId) });
|
|
148
|
+
if (!data.customer) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
const defaultNumericId = data.customer.defaultAddress ? extractNumericId(data.customer.defaultAddress.id) : null;
|
|
152
|
+
return (data.customer.addresses ?? []).map((node) => mapAddress(node, defaultNumericId !== null && extractNumericId(node.id) === defaultNumericId));
|
|
153
|
+
}
|
|
154
|
+
/** Fetch a single address by ID (numeric or full GID) — `null` if the customer or address doesn't exist. */
|
|
155
|
+
async function getCustomerAddress(siteName, customerId, addressId) {
|
|
156
|
+
const addresses = await listCustomerAddresses(siteName, customerId);
|
|
157
|
+
if (!addresses) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
const target = extractNumericId(addressId);
|
|
161
|
+
return addresses.find((address) => extractNumericId(address.shopifyId) === target) ?? null;
|
|
162
|
+
}
|
|
163
|
+
/** Add a new address to a customer, optionally setting it as their default. */
|
|
164
|
+
async function createCustomerAddress(siteName, customerId, input) {
|
|
165
|
+
const { setAsDefault, ...address } = input;
|
|
166
|
+
const mutation = `
|
|
167
|
+
mutation CreateCustomerAddress($customerId: ID!, $address: MailingAddressInput!) {
|
|
168
|
+
customerAddressCreate(customerId: $customerId, address: $address) {
|
|
169
|
+
address { ${ADDRESS_FIELDS} }
|
|
170
|
+
userErrors { field message }
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
`;
|
|
174
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, { customerId: normalizeCustomerId(customerId), address });
|
|
175
|
+
ensureNoUserErrors(data.customerAddressCreate.userErrors, 'Failed to create customer address');
|
|
176
|
+
if (!data.customerAddressCreate.address) {
|
|
177
|
+
throw new errors_1.ShopifyUserErrorsError('Failed to create customer address', data.customerAddressCreate.userErrors);
|
|
178
|
+
}
|
|
179
|
+
if (setAsDefault) {
|
|
180
|
+
await setDefaultCustomerAddress(siteName, customerId, data.customerAddressCreate.address.id);
|
|
181
|
+
const updated = await getCustomerAddress(siteName, customerId, data.customerAddressCreate.address.id);
|
|
182
|
+
if (updated)
|
|
183
|
+
return updated;
|
|
184
|
+
}
|
|
185
|
+
return mapAddress(data.customerAddressCreate.address, false);
|
|
186
|
+
}
|
|
187
|
+
/** Update an existing address's fields, optionally setting it as the default. `null` if the address doesn't exist. */
|
|
188
|
+
async function updateCustomerAddress(siteName, customerId, addressId, input) {
|
|
189
|
+
const resolved = await getCustomerAddress(siteName, customerId, addressId);
|
|
190
|
+
if (!resolved) {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
const { setAsDefault, ...address } = input;
|
|
194
|
+
const mutation = `
|
|
195
|
+
mutation UpdateCustomerAddress($customerId: ID!, $addressId: ID!, $address: MailingAddressInput!) {
|
|
196
|
+
customerAddressUpdate(customerId: $customerId, addressId: $addressId, address: $address) {
|
|
197
|
+
address { ${ADDRESS_FIELDS} }
|
|
198
|
+
userErrors { field message }
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
`;
|
|
202
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, {
|
|
203
|
+
customerId: normalizeCustomerId(customerId),
|
|
204
|
+
addressId: resolved.shopifyId,
|
|
205
|
+
address,
|
|
206
|
+
});
|
|
207
|
+
ensureNoUserErrors(data.customerAddressUpdate.userErrors, 'Failed to update customer address');
|
|
208
|
+
if (setAsDefault) {
|
|
209
|
+
await setDefaultCustomerAddress(siteName, customerId, resolved.shopifyId);
|
|
210
|
+
}
|
|
211
|
+
return getCustomerAddress(siteName, customerId, resolved.shopifyId);
|
|
212
|
+
}
|
|
213
|
+
/** Remove an address from a customer, returning its resolved ID — `null` if it doesn't exist. */
|
|
214
|
+
async function deleteCustomerAddress(siteName, customerId, addressId) {
|
|
215
|
+
const resolved = await getCustomerAddress(siteName, customerId, addressId);
|
|
216
|
+
if (!resolved) {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
const mutation = `
|
|
220
|
+
mutation DeleteCustomerAddress($customerId: ID!, $addressId: ID!) {
|
|
221
|
+
customerAddressDelete(customerId: $customerId, addressId: $addressId) {
|
|
222
|
+
userErrors { field message }
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
`;
|
|
226
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, { customerId: normalizeCustomerId(customerId), addressId: resolved.shopifyId });
|
|
227
|
+
ensureNoUserErrors(data.customerAddressDelete.userErrors, 'Failed to delete customer address');
|
|
228
|
+
return resolved.shopifyId;
|
|
229
|
+
}
|
|
230
|
+
/** Set an existing address as the customer's default — `null` if it doesn't exist. */
|
|
231
|
+
async function setDefaultCustomerAddress(siteName, customerId, addressId) {
|
|
232
|
+
const resolved = await getCustomerAddress(siteName, customerId, addressId);
|
|
233
|
+
if (!resolved) {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
const mutation = `
|
|
237
|
+
mutation SetDefaultCustomerAddress($customerId: ID!, $addressId: ID!, $address: MailingAddressInput!, $setAsDefault: Boolean) {
|
|
238
|
+
customerAddressUpdate(
|
|
239
|
+
customerId: $customerId
|
|
240
|
+
addressId: $addressId
|
|
241
|
+
address: $address
|
|
242
|
+
setAsDefault: $setAsDefault
|
|
243
|
+
) {
|
|
244
|
+
userErrors { field message }
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
`;
|
|
248
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, {
|
|
249
|
+
customerId: normalizeCustomerId(customerId),
|
|
250
|
+
addressId: resolved.shopifyId,
|
|
251
|
+
address: {},
|
|
252
|
+
setAsDefault: true,
|
|
253
|
+
});
|
|
254
|
+
ensureNoUserErrors(data.customerAddressUpdate.userErrors, 'Failed to set default customer address');
|
|
255
|
+
return getCustomerById(siteName, customerId);
|
|
256
|
+
}
|
|
62
257
|
//# sourceMappingURL=customers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customers.js","sourceRoot":"","sources":["../../src/customers.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"customers.js","sourceRoot":"","sources":["../../src/customers.ts"],"names":[],"mappings":";;AAmHA,0CASC;AAMD,gDAYC;AA6BD,wCA4BC;AAGD,sDAmBC;AAGD,gDAWC;AAGD,sDA4BC;AAGD,sDAgCC;AAGD,sDAqBC;AAGD,8DA+BC;AAvWD,qCAAwC;AACxC,qCAA+F;AAiD/F,MAAM,eAAe,GAAG;;;;;;;;;;CAUvB,CAAC;AAEF,SAAS,kBAAkB,CAAC,IAA6D;IACvF,OAAO,IAAI,CAAC,qBAAqB,EAAE,cAAc,KAAK,YAAY,CAAC;AACrE,CAAC;AAED,SAAS,mBAAmB,CAAC,UAAkB;IAC7C,OAAO,UAAU,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,0BAA0B,UAAU,EAAE,CAAC;AAChH,CAAC;AAED,uHAAuH;AACvH,SAAS,gBAAgB,CAAC,GAAW;IACnC,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,GAAG,CAAC;IACzC,OAAO,I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AAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,QAAQ,GAAG;;;;;;;;;;;GAWhB,CAAC;IACF,MAAM,IAAI,GAAG,MAAM,IAAA,qBAAY,EAE5B,QAAQ,EAAE,QAAQ,EAAE;QACrB,UAAU,EAAE,mBAAmB,CAAC,UAAU,CAAC;QAC3C,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,OAAO,EAAE,EAAE;QACX,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;IACH,kBAAkB,CAAC,IAAI,CAAC,qBAAqB,CAAC,UAAU,EAAE,wCAAwC,CAAC,CAAC;IACpG,OAAO,eAAe,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAC/C,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -22,12 +22,12 @@ export { ShopifyAdapterError, ShopifyNotFoundError, ShopifyUserErrorsError } fro
|
|
|
22
22
|
export type { ShopifyUserError } from './errors';
|
|
23
23
|
export { fetchProducts, fetchProductById, fetchProductByIdOrThrow, } from './products';
|
|
24
24
|
export type { ShopifyProduct, ProductsPage, PageInfo } from './products';
|
|
25
|
-
export { createCart, getCart, addCartLines, updateCartLines, removeCartLines, } from './cart';
|
|
25
|
+
export { createCart, getCart, addCartLines, updateCartLines, removeCartLines, linkCartToCustomer, } from './cart';
|
|
26
26
|
export type { ShopifyCart, ShopifyCartLine, ShopifyMoney, CartLineInput, CartLineUpdateInput } from './cart';
|
|
27
|
-
export { listOrders, getOrderById } from './orders';
|
|
28
|
-
export type { ShopifyOrder, ShopifyOrderSummary, ShopifyOrderLineItem, ShopifyOrderAddress, OrdersPage, OrdersPageInfo, } from './orders';
|
|
29
|
-
export { getCustomerById, getCustomerByEmail } from './customers';
|
|
30
|
-
export type { ShopifyCustomer } from './customers';
|
|
27
|
+
export { listOrders, getOrderById, updateOrder, cancelOrder, closeOrder, reopenOrder, captureOrderPayment, markOrderAsPaid, calculateRefund, createRefund, createDraftOrder, completeDraftOrder, sendDraftOrderInvoice, } from './orders';
|
|
28
|
+
export type { ShopifyOrder, ShopifyOrderSummary, ShopifyOrderLineItem, ShopifyOrderAddress, OrdersPage, OrdersPageInfo, OrderUpdateInput, OrderCancelInput, OrderCancelResult, OrderCaptureInput, ShopifyOrderTransaction, RefundLineItemInput, CalculateRefundInput, SuggestedRefund, SuggestedRefundLineItem, RefundInput, ShopifyRefund, DraftOrderLineItemInput, DraftOrderInput, ShopifyDraftOrder, DraftOrderCompleteInput, EmailInput, } from './orders';
|
|
29
|
+
export { getCustomerById, getCustomerByEmail, updateCustomer, listCustomerAddresses, getCustomerAddress, createCustomerAddress, updateCustomerAddress, deleteCustomerAddress, setDefaultCustomerAddress, } from './customers';
|
|
30
|
+
export type { ShopifyCustomer, CustomerUpdateInput, ShopifyAddress, AddressInput } from './customers';
|
|
31
31
|
export { cartCreatedEvent } from './messaging';
|
|
32
32
|
export type { ShopifyDomainEvent, CartCreatedEvent, Publish } from './messaging';
|
|
33
33
|
export { ORDER_WEBHOOK_TOPICS, shopifyTopicToRoutingKey } from './webhookTopics';
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC3D,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAC7F,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EACL,UAA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AAiB,EACjB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,+BAA+B,EAC/B,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC7G,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
* shopify-adapter stack.
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.
|
|
22
|
-
exports.Logger = exports.requirePlatformXAuth = exports.platformXSigningConfigForTenant = exports.platformXConfigForTenant = void 0;
|
|
21
|
+
exports.getGraphQLClient = exports.HepSecretProvider = exports.createConfigProvider = exports.buildSecretId = exports.extractSiteName = exports.getClientTenantDetails = exports.setConfigProvider = exports.clearTenantCache = exports.getTenantConfig = exports.registerShopifyWebhooks = exports.createShopifyWebhookRouter = exports.shopifyTopicToRoutingKey = exports.ORDER_WEBHOOK_TOPICS = exports.cartCreatedEvent = exports.setDefaultCustomerAddress = exports.deleteCustomerAddress = exports.updateCustomerAddress = exports.createCustomerAddress = exports.getCustomerAddress = exports.listCustomerAddresses = exports.updateCustomer = exports.getCustomerByEmail = exports.getCustomerById = exports.sendDraftOrderInvoice = exports.completeDraftOrder = exports.createDraftOrder = exports.createRefund = exports.calculateRefund = exports.markOrderAsPaid = exports.captureOrderPayment = exports.reopenOrder = exports.closeOrder = exports.cancelOrder = exports.updateOrder = exports.getOrderById = exports.listOrders = exports.linkCartToCustomer = exports.removeCartLines = exports.updateCartLines = exports.addCartLines = exports.getCart = exports.createCart = exports.fetchProductByIdOrThrow = exports.fetchProductById = exports.fetchProducts = exports.ShopifyUserErrorsError = exports.ShopifyNotFoundError = exports.ShopifyAdapterError = exports.storefrontGraphql = exports.adminGraphql = void 0;
|
|
22
|
+
exports.Logger = exports.requirePlatformXAuth = exports.platformXSigningConfigForTenant = exports.platformXConfigForTenant = exports.verifyPlatformXToken = exports.signPlatformXToken = exports.requireKeycloakAuth = exports.keycloakConfigForTenant = exports.verifyKeycloakToken = exports.extractBearer = exports.UnauthorizedError = exports.TokenInvalidError = exports.TokenExpiredError = exports.SecretNotFoundError = exports.TenantNotFoundError = exports.CircuitOpenError = exports.TimeoutError = exports.CircuitBreaker = exports.withTimeout = exports.withRetry = exports.ClientError = exports.gql = exports.clearGraphQLClientCache = void 0;
|
|
23
23
|
var client_1 = require("./client");
|
|
24
24
|
Object.defineProperty(exports, "adminGraphql", { enumerable: true, get: function () { return client_1.adminGraphql; } });
|
|
25
25
|
Object.defineProperty(exports, "storefrontGraphql", { enumerable: true, get: function () { return client_1.storefrontGraphql; } });
|
|
@@ -37,12 +37,31 @@ Object.defineProperty(exports, "getCart", { enumerable: true, get: function () {
|
|
|
37
37
|
Object.defineProperty(exports, "addCartLines", { enumerable: true, get: function () { return cart_1.addCartLines; } });
|
|
38
38
|
Object.defineProperty(exports, "updateCartLines", { enumerable: true, get: function () { return cart_1.updateCartLines; } });
|
|
39
39
|
Object.defineProperty(exports, "removeCartLines", { enumerable: true, get: function () { return cart_1.removeCartLines; } });
|
|
40
|
+
Object.defineProperty(exports, "linkCartToCustomer", { enumerable: true, get: function () { return cart_1.linkCartToCustomer; } });
|
|
40
41
|
var orders_1 = require("./orders");
|
|
41
42
|
Object.defineProperty(exports, "listOrders", { enumerable: true, get: function () { return orders_1.listOrders; } });
|
|
42
43
|
Object.defineProperty(exports, "getOrderById", { enumerable: true, get: function () { return orders_1.getOrderById; } });
|
|
44
|
+
Object.defineProperty(exports, "updateOrder", { enumerable: true, get: function () { return orders_1.updateOrder; } });
|
|
45
|
+
Object.defineProperty(exports, "cancelOrder", { enumerable: true, get: function () { return orders_1.cancelOrder; } });
|
|
46
|
+
Object.defineProperty(exports, "closeOrder", { enumerable: true, get: function () { return orders_1.closeOrder; } });
|
|
47
|
+
Object.defineProperty(exports, "reopenOrder", { enumerable: true, get: function () { return orders_1.reopenOrder; } });
|
|
48
|
+
Object.defineProperty(exports, "captureOrderPayment", { enumerable: true, get: function () { return orders_1.captureOrderPayment; } });
|
|
49
|
+
Object.defineProperty(exports, "markOrderAsPaid", { enumerable: true, get: function () { return orders_1.markOrderAsPaid; } });
|
|
50
|
+
Object.defineProperty(exports, "calculateRefund", { enumerable: true, get: function () { return orders_1.calculateRefund; } });
|
|
51
|
+
Object.defineProperty(exports, "createRefund", { enumerable: true, get: function () { return orders_1.createRefund; } });
|
|
52
|
+
Object.defineProperty(exports, "createDraftOrder", { enumerable: true, get: function () { return orders_1.createDraftOrder; } });
|
|
53
|
+
Object.defineProperty(exports, "completeDraftOrder", { enumerable: true, get: function () { return orders_1.completeDraftOrder; } });
|
|
54
|
+
Object.defineProperty(exports, "sendDraftOrderInvoice", { enumerable: true, get: function () { return orders_1.sendDraftOrderInvoice; } });
|
|
43
55
|
var customers_1 = require("./customers");
|
|
44
56
|
Object.defineProperty(exports, "getCustomerById", { enumerable: true, get: function () { return customers_1.getCustomerById; } });
|
|
45
57
|
Object.defineProperty(exports, "getCustomerByEmail", { enumerable: true, get: function () { return customers_1.getCustomerByEmail; } });
|
|
58
|
+
Object.defineProperty(exports, "updateCustomer", { enumerable: true, get: function () { return customers_1.updateCustomer; } });
|
|
59
|
+
Object.defineProperty(exports, "listCustomerAddresses", { enumerable: true, get: function () { return customers_1.listCustomerAddresses; } });
|
|
60
|
+
Object.defineProperty(exports, "getCustomerAddress", { enumerable: true, get: function () { return customers_1.getCustomerAddress; } });
|
|
61
|
+
Object.defineProperty(exports, "createCustomerAddress", { enumerable: true, get: function () { return customers_1.createCustomerAddress; } });
|
|
62
|
+
Object.defineProperty(exports, "updateCustomerAddress", { enumerable: true, get: function () { return customers_1.updateCustomerAddress; } });
|
|
63
|
+
Object.defineProperty(exports, "deleteCustomerAddress", { enumerable: true, get: function () { return customers_1.deleteCustomerAddress; } });
|
|
64
|
+
Object.defineProperty(exports, "setDefaultCustomerAddress", { enumerable: true, get: function () { return customers_1.setDefaultCustomerAddress; } });
|
|
46
65
|
var messaging_1 = require("./messaging");
|
|
47
66
|
Object.defineProperty(exports, "cartCreatedEvent", { enumerable: true, get: function () { return messaging_1.cartCreatedEvent; } });
|
|
48
67
|
var webhookTopics_1 = require("./webhookTopics");
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;AAEH,mCAA2D;AAAlD,sGAAA,YAAY,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAExC,mCAA6F;AAApF,6GAAA,mBAAmB,OAAA;AAAE,8GAAA,oBAAoB,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AAE1E,uCAIoB;AAHlB,yGAAA,aAAa,OAAA;AACb,4GAAA,gBAAgB,OAAA;AAChB,mHAAA,uBAAuB,OAAA;AAGzB,+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;AAEH,mCAA2D;AAAlD,sGAAA,YAAY,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAExC,mCAA6F;AAApF,6GAAA,mBAAmB,OA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HAAA,sBAAsB,OAAA;AACrF,yDAAqE;AAA5D,oHAAA,eAAe,OAAA;AAAE,kHAAA,aAAa,OAAA;AACvC,qDAAyD;AAAhD,uHAAA,oBAAoB,OAAA;AAE7B,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA;AAC1B,mDAA+F;AAAtF,kHAAA,gBAAgB,OAAA;AAAE,yHAAA,uBAAuB,OAAA;AAAE,qGAAA,GAAG,OAAA;AAAE,6GAAA,WAAW,OAAA;AACpE,2CAAsG;AAA7F,uGAAA,SAAS,OAAA;AAAE,yGAAA,WAAW,OAAA;AAAE,4GAAA,cAAc,OAAA;AAAE,0GAAA,YAAY,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AAC/E,iDAMyB;AALvB,oHAAA,mBAAmB,OAAA;AACnB,oHAAA,mBAAmB,OAAA;AACnB,kHAAA,iBAAiB,OAAA;AACjB,kHAAA,iBAAiB,OAAA;AACjB,kHAAA,iBAAiB,OAAA;AAUnB,iDAKyB;AAJvB,8GAAA,aAAa,OAAA;AACb,oHAAA,mBAAmB,OAAA;AACnB,wHAAA,uBAAuB,OAAA;AACvB,oHAAA,mBAAmB,OAAA;AAGrB,mDAM0B;AALxB,oHAAA,kBAAkB,OAAA;AAClB,sHAAA,oBAAoB,OAAA;AACpB,0HAAA,wBAAwB,OAAA;AACxB,iIAAA,+BAA+B,OAAA;AAC/B,sHAAA,oBAAoB,OAAA;AAGtB,yCAAwC;AAA/B,gGAAA,MAAM,OAAA"}
|
package/dist/src/orders.d.ts
CHANGED
|
@@ -46,6 +46,114 @@ export interface OrdersPage {
|
|
|
46
46
|
items: ShopifyOrderSummary[];
|
|
47
47
|
pageInfo: OrdersPageInfo;
|
|
48
48
|
}
|
|
49
|
+
export interface OrderUpdateInput {
|
|
50
|
+
note?: string;
|
|
51
|
+
email?: string;
|
|
52
|
+
tags?: string[];
|
|
53
|
+
shippingAddress?: ShopifyOrderAddress;
|
|
54
|
+
}
|
|
55
|
+
export interface OrderCancelInput {
|
|
56
|
+
reason?: 'CUSTOMER' | 'DECLINED' | 'FRAUD' | 'INVENTORY' | 'STAFF' | 'OTHER';
|
|
57
|
+
refund?: boolean;
|
|
58
|
+
restock?: boolean;
|
|
59
|
+
notifyCustomer?: boolean;
|
|
60
|
+
staffNote?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface OrderCancelResult {
|
|
63
|
+
jobId?: string;
|
|
64
|
+
done?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface OrderCaptureInput {
|
|
67
|
+
parentTransactionId: string;
|
|
68
|
+
amount: string;
|
|
69
|
+
currency?: string;
|
|
70
|
+
finalCapture?: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface ShopifyOrderTransaction {
|
|
73
|
+
id: string;
|
|
74
|
+
kind?: string;
|
|
75
|
+
status?: string;
|
|
76
|
+
amount?: ShopifyMoney;
|
|
77
|
+
}
|
|
78
|
+
export interface RefundLineItemInput {
|
|
79
|
+
lineItemId: string;
|
|
80
|
+
quantity: number;
|
|
81
|
+
restockType?: string;
|
|
82
|
+
locationId?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface CalculateRefundInput {
|
|
85
|
+
refundLineItems?: RefundLineItemInput[];
|
|
86
|
+
refundShipping?: boolean;
|
|
87
|
+
shippingAmount?: string;
|
|
88
|
+
suggestFullRefund?: boolean;
|
|
89
|
+
}
|
|
90
|
+
export interface SuggestedRefundLineItem {
|
|
91
|
+
quantity: number;
|
|
92
|
+
restockType?: string;
|
|
93
|
+
lineItemId: string;
|
|
94
|
+
lineItemTitle?: string;
|
|
95
|
+
lineItemSku?: string;
|
|
96
|
+
price?: ShopifyMoney;
|
|
97
|
+
subtotal?: ShopifyMoney;
|
|
98
|
+
totalTax?: ShopifyMoney;
|
|
99
|
+
}
|
|
100
|
+
export interface SuggestedRefund {
|
|
101
|
+
amount?: ShopifyMoney;
|
|
102
|
+
subtotal?: ShopifyMoney;
|
|
103
|
+
totalTax?: ShopifyMoney;
|
|
104
|
+
maximumRefundable?: ShopifyMoney;
|
|
105
|
+
shippingAmount?: ShopifyMoney;
|
|
106
|
+
refundLineItems: SuggestedRefundLineItem[];
|
|
107
|
+
}
|
|
108
|
+
export interface RefundInput {
|
|
109
|
+
note?: string;
|
|
110
|
+
notify?: boolean;
|
|
111
|
+
shipping?: {
|
|
112
|
+
amount?: string;
|
|
113
|
+
fullRefund?: boolean;
|
|
114
|
+
};
|
|
115
|
+
refundLineItems?: RefundLineItemInput[];
|
|
116
|
+
}
|
|
117
|
+
export interface ShopifyRefund {
|
|
118
|
+
shopifyId: string;
|
|
119
|
+
createdAt?: Date;
|
|
120
|
+
note?: string;
|
|
121
|
+
totalRefunded?: ShopifyMoney;
|
|
122
|
+
}
|
|
123
|
+
export interface DraftOrderLineItemInput {
|
|
124
|
+
variantId?: string;
|
|
125
|
+
quantity: number;
|
|
126
|
+
title?: string;
|
|
127
|
+
originalUnitPrice?: string;
|
|
128
|
+
}
|
|
129
|
+
export interface DraftOrderInput {
|
|
130
|
+
lineItems: DraftOrderLineItemInput[];
|
|
131
|
+
customerId?: string;
|
|
132
|
+
email?: string;
|
|
133
|
+
note?: string;
|
|
134
|
+
shippingAddress?: ShopifyOrderAddress;
|
|
135
|
+
}
|
|
136
|
+
export interface ShopifyDraftOrder {
|
|
137
|
+
shopifyId: string;
|
|
138
|
+
name: string;
|
|
139
|
+
status?: string;
|
|
140
|
+
invoiceUrl?: string;
|
|
141
|
+
invoiceSentAt?: Date;
|
|
142
|
+
totalPrice?: ShopifyMoney;
|
|
143
|
+
orderId?: string;
|
|
144
|
+
}
|
|
145
|
+
export interface DraftOrderCompleteInput {
|
|
146
|
+
paymentPending?: boolean;
|
|
147
|
+
paymentGatewayId?: string;
|
|
148
|
+
sourceName?: string;
|
|
149
|
+
}
|
|
150
|
+
export interface EmailInput {
|
|
151
|
+
to?: string;
|
|
152
|
+
from?: string;
|
|
153
|
+
subject?: string;
|
|
154
|
+
customMessage?: string;
|
|
155
|
+
bcc?: string[];
|
|
156
|
+
}
|
|
49
157
|
/** List orders with an optional Shopify search `query` filter and cursor pagination. */
|
|
50
158
|
export declare function listOrders(siteName: string, opts?: {
|
|
51
159
|
first?: number;
|
|
@@ -54,4 +162,31 @@ export declare function listOrders(siteName: string, opts?: {
|
|
|
54
162
|
}): Promise<OrdersPage>;
|
|
55
163
|
/** Fetch a single order by Shopify ID, with line items; throws if not found. */
|
|
56
164
|
export declare function getOrderById(siteName: string, orderId: string): Promise<ShopifyOrder>;
|
|
165
|
+
/** Update an order's note, email, tags, or shipping address. */
|
|
166
|
+
export declare function updateOrder(siteName: string, orderId: string, input: OrderUpdateInput): Promise<ShopifyOrder>;
|
|
167
|
+
/** Cancel an order — defaults to reason OTHER, no refund, no restock, matching shp-order-service's precedent. */
|
|
168
|
+
export declare function cancelOrder(siteName: string, orderId: string, input?: OrderCancelInput): Promise<OrderCancelResult>;
|
|
169
|
+
/** Close an order (mark as archived/complete) without cancelling it. */
|
|
170
|
+
export declare function closeOrder(siteName: string, orderId: string): Promise<ShopifyOrder>;
|
|
171
|
+
/** Reopen a previously closed order. */
|
|
172
|
+
export declare function reopenOrder(siteName: string, orderId: string): Promise<ShopifyOrder>;
|
|
173
|
+
/** Capture a previously authorized payment on an order. */
|
|
174
|
+
export declare function captureOrderPayment(siteName: string, orderId: string, input: OrderCaptureInput): Promise<ShopifyOrderTransaction>;
|
|
175
|
+
/** Mark a manual/unpaid order as paid. */
|
|
176
|
+
export declare function markOrderAsPaid(siteName: string, orderId: string): Promise<ShopifyOrder>;
|
|
177
|
+
/** Preview a refund via Shopify's `suggestedRefund` field — doesn't create anything. */
|
|
178
|
+
export declare function calculateRefund(siteName: string, orderId: string, input?: CalculateRefundInput): Promise<SuggestedRefund>;
|
|
179
|
+
/**
|
|
180
|
+
* Create a refund against an order. Requires Shopify's `@idempotent` directive
|
|
181
|
+
* (enforced at runtime as of the 2026-04 API version) — the key must be a
|
|
182
|
+
* string literal in the query, so it's interpolated rather than passed as a
|
|
183
|
+
* variable, same as shp-order-service's `createRefund`.
|
|
184
|
+
*/
|
|
185
|
+
export declare function createRefund(siteName: string, orderId: string, input: RefundInput, idempotencyKey?: string): Promise<ShopifyRefund>;
|
|
186
|
+
/** Create a draft order — used for manual/offline orders (e.g. phone, in-person). */
|
|
187
|
+
export declare function createDraftOrder(siteName: string, input: DraftOrderInput): Promise<ShopifyDraftOrder>;
|
|
188
|
+
/** Complete a draft order, converting it into a real order. */
|
|
189
|
+
export declare function completeDraftOrder(siteName: string, draftOrderId: string, input?: DraftOrderCompleteInput): Promise<ShopifyDraftOrder>;
|
|
190
|
+
/** Send (or resend) a draft order's invoice email. */
|
|
191
|
+
export declare function sendDraftOrderInvoice(siteName: string, draftOrderId: string, email?: EmailInput): Promise<ShopifyDraftOrder>;
|
|
57
192
|
//# sourceMappingURL=orders.d.ts.map
|
package/dist/src/orders.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders.d.ts","sourceRoot":"","sources":["../../src/orders.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG3C,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,YAAY,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ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B,YAAY,EAAE,MAAM,EACpB,KAAK,GAAE,uBAA4B,GAClC,OAAO,CAAC,iBAAiB,CAAC,CA2B5B;AAED,sDAAsD;AACtD,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,UAAU,GACjB,OAAO,CAAC,iBAAiB,CAAC,CAiB5B"}
|
package/dist/src/orders.js
CHANGED
|
@@ -2,11 +2,32 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.listOrders = listOrders;
|
|
4
4
|
exports.getOrderById = getOrderById;
|
|
5
|
+
exports.updateOrder = updateOrder;
|
|
6
|
+
exports.cancelOrder = cancelOrder;
|
|
7
|
+
exports.closeOrder = closeOrder;
|
|
8
|
+
exports.reopenOrder = reopenOrder;
|
|
9
|
+
exports.captureOrderPayment = captureOrderPayment;
|
|
10
|
+
exports.markOrderAsPaid = markOrderAsPaid;
|
|
11
|
+
exports.calculateRefund = calculateRefund;
|
|
12
|
+
exports.createRefund = createRefund;
|
|
13
|
+
exports.createDraftOrder = createDraftOrder;
|
|
14
|
+
exports.completeDraftOrder = completeDraftOrder;
|
|
15
|
+
exports.sendDraftOrderInvoice = sendDraftOrderInvoice;
|
|
5
16
|
const client_1 = require("./client");
|
|
6
17
|
const errors_1 = require("./errors");
|
|
7
18
|
function normalizeOrderId(orderId) {
|
|
8
19
|
return orderId.startsWith('gid://shopify/Order/') ? orderId : `gid://shopify/Order/${orderId}`;
|
|
9
20
|
}
|
|
21
|
+
function normalizeDraftOrderId(draftOrderId) {
|
|
22
|
+
return draftOrderId.startsWith('gid://shopify/DraftOrder/')
|
|
23
|
+
? draftOrderId
|
|
24
|
+
: `gid://shopify/DraftOrder/${draftOrderId}`;
|
|
25
|
+
}
|
|
26
|
+
function ensureNoUserErrors(errors, message) {
|
|
27
|
+
if (errors && errors.length > 0) {
|
|
28
|
+
throw new errors_1.ShopifyUserErrorsError(message, errors);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
10
31
|
function mapOrderSummary(node) {
|
|
11
32
|
return {
|
|
12
33
|
shopifyId: node.id,
|
|
@@ -109,4 +130,286 @@ async function getOrderById(siteName, orderId) {
|
|
|
109
130
|
})),
|
|
110
131
|
};
|
|
111
132
|
}
|
|
133
|
+
/** Update an order's note, email, tags, or shipping address. */
|
|
134
|
+
async function updateOrder(siteName, orderId, input) {
|
|
135
|
+
const mutation = `
|
|
136
|
+
mutation OrderUpdate($input: OrderInput!) {
|
|
137
|
+
orderUpdate(input: $input) {
|
|
138
|
+
order { id }
|
|
139
|
+
userErrors { field message }
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
`;
|
|
143
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, { input: { id: normalizeOrderId(orderId), ...input } });
|
|
144
|
+
ensureNoUserErrors(data.orderUpdate.userErrors, 'Failed to update order');
|
|
145
|
+
return getOrderById(siteName, orderId);
|
|
146
|
+
}
|
|
147
|
+
/** Cancel an order — defaults to reason OTHER, no refund, no restock, matching shp-order-service's precedent. */
|
|
148
|
+
async function cancelOrder(siteName, orderId, input = {}) {
|
|
149
|
+
const mutation = `
|
|
150
|
+
mutation OrderCancel(
|
|
151
|
+
$orderId: ID!
|
|
152
|
+
$reason: OrderCancelReason!
|
|
153
|
+
$refund: Boolean!
|
|
154
|
+
$restock: Boolean!
|
|
155
|
+
$notifyCustomer: Boolean
|
|
156
|
+
$staffNote: String
|
|
157
|
+
) {
|
|
158
|
+
orderCancel(
|
|
159
|
+
orderId: $orderId
|
|
160
|
+
reason: $reason
|
|
161
|
+
refund: $refund
|
|
162
|
+
restock: $restock
|
|
163
|
+
notifyCustomer: $notifyCustomer
|
|
164
|
+
staffNote: $staffNote
|
|
165
|
+
) {
|
|
166
|
+
job { id done }
|
|
167
|
+
orderCancelUserErrors { field message }
|
|
168
|
+
userErrors { field message }
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
`;
|
|
172
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, {
|
|
173
|
+
orderId: normalizeOrderId(orderId),
|
|
174
|
+
reason: input.reason ?? 'OTHER',
|
|
175
|
+
refund: input.refund ?? false,
|
|
176
|
+
restock: input.restock ?? false,
|
|
177
|
+
notifyCustomer: input.notifyCustomer ?? false,
|
|
178
|
+
staffNote: input.staffNote,
|
|
179
|
+
});
|
|
180
|
+
ensureNoUserErrors([...data.orderCancel.orderCancelUserErrors, ...data.orderCancel.userErrors], 'Failed to cancel order');
|
|
181
|
+
return { jobId: data.orderCancel.job?.id, done: data.orderCancel.job?.done };
|
|
182
|
+
}
|
|
183
|
+
/** Close an order (mark as archived/complete) without cancelling it. */
|
|
184
|
+
async function closeOrder(siteName, orderId) {
|
|
185
|
+
const mutation = `
|
|
186
|
+
mutation OrderClose($input: OrderCloseInput!) {
|
|
187
|
+
orderClose(input: $input) {
|
|
188
|
+
order { id }
|
|
189
|
+
userErrors { field message }
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
`;
|
|
193
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, { input: { id: normalizeOrderId(orderId) } });
|
|
194
|
+
ensureNoUserErrors(data.orderClose.userErrors, 'Failed to close order');
|
|
195
|
+
return getOrderById(siteName, orderId);
|
|
196
|
+
}
|
|
197
|
+
/** Reopen a previously closed order. */
|
|
198
|
+
async function reopenOrder(siteName, orderId) {
|
|
199
|
+
const mutation = `
|
|
200
|
+
mutation OrderOpen($input: OrderOpenInput!) {
|
|
201
|
+
orderOpen(input: $input) {
|
|
202
|
+
order { id }
|
|
203
|
+
userErrors { field message }
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
`;
|
|
207
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, { input: { id: normalizeOrderId(orderId) } });
|
|
208
|
+
ensureNoUserErrors(data.orderOpen.userErrors, 'Failed to reopen order');
|
|
209
|
+
return getOrderById(siteName, orderId);
|
|
210
|
+
}
|
|
211
|
+
/** Capture a previously authorized payment on an order. */
|
|
212
|
+
async function captureOrderPayment(siteName, orderId, input) {
|
|
213
|
+
const mutation = `
|
|
214
|
+
mutation OrderCapture($input: OrderCaptureInput!) {
|
|
215
|
+
orderCapture(input: $input) {
|
|
216
|
+
transaction {
|
|
217
|
+
id
|
|
218
|
+
kind
|
|
219
|
+
status
|
|
220
|
+
amountSet { shopMoney { amount currencyCode } }
|
|
221
|
+
}
|
|
222
|
+
userErrors { field message }
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
`;
|
|
226
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, { input: { id: normalizeOrderId(orderId), ...input } });
|
|
227
|
+
ensureNoUserErrors(data.orderCapture.userErrors, 'Failed to capture order payment');
|
|
228
|
+
const t = data.orderCapture.transaction;
|
|
229
|
+
return { id: t?.id, kind: t?.kind ?? undefined, status: t?.status ?? undefined, amount: t?.amountSet?.shopMoney };
|
|
230
|
+
}
|
|
231
|
+
/** Mark a manual/unpaid order as paid. */
|
|
232
|
+
async function markOrderAsPaid(siteName, orderId) {
|
|
233
|
+
const mutation = `
|
|
234
|
+
mutation OrderMarkAsPaid($input: OrderMarkAsPaidInput!) {
|
|
235
|
+
orderMarkAsPaid(input: $input) {
|
|
236
|
+
order { id }
|
|
237
|
+
userErrors { field message }
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
`;
|
|
241
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, { input: { id: normalizeOrderId(orderId) } });
|
|
242
|
+
ensureNoUserErrors(data.orderMarkAsPaid.userErrors, 'Failed to mark order as paid');
|
|
243
|
+
return getOrderById(siteName, orderId);
|
|
244
|
+
}
|
|
245
|
+
/** Preview a refund via Shopify's `suggestedRefund` field — doesn't create anything. */
|
|
246
|
+
async function calculateRefund(siteName, orderId, input = {}) {
|
|
247
|
+
const suggestFullRefund = input.suggestFullRefund ?? (input.refundLineItems?.length ? false : true);
|
|
248
|
+
const gql = `
|
|
249
|
+
query SuggestedRefund(
|
|
250
|
+
$id: ID!
|
|
251
|
+
$refundLineItems: [RefundLineItemInput!]
|
|
252
|
+
$refundShipping: Boolean
|
|
253
|
+
$shippingAmount: Money
|
|
254
|
+
$suggestFullRefund: Boolean
|
|
255
|
+
) {
|
|
256
|
+
order(id: $id) {
|
|
257
|
+
suggestedRefund(
|
|
258
|
+
refundLineItems: $refundLineItems
|
|
259
|
+
refundShipping: $refundShipping
|
|
260
|
+
shippingAmount: $shippingAmount
|
|
261
|
+
suggestFullRefund: $suggestFullRefund
|
|
262
|
+
) {
|
|
263
|
+
amountSet { shopMoney { amount currencyCode } }
|
|
264
|
+
subtotalSet { shopMoney { amount currencyCode } }
|
|
265
|
+
totalTaxSet { shopMoney { amount currencyCode } }
|
|
266
|
+
maximumRefundableSet { shopMoney { amount currencyCode } }
|
|
267
|
+
shipping { amountSet { shopMoney { amount currencyCode } } }
|
|
268
|
+
refundLineItems {
|
|
269
|
+
quantity
|
|
270
|
+
restockType
|
|
271
|
+
lineItem { id title sku }
|
|
272
|
+
priceSet { shopMoney { amount currencyCode } }
|
|
273
|
+
subtotalSet { shopMoney { amount currencyCode } }
|
|
274
|
+
totalTaxSet { shopMoney { amount currencyCode } }
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
`;
|
|
280
|
+
const data = await (0, client_1.adminGraphql)(siteName, gql, {
|
|
281
|
+
id: normalizeOrderId(orderId),
|
|
282
|
+
refundLineItems: input.refundLineItems,
|
|
283
|
+
refundShipping: input.refundShipping,
|
|
284
|
+
shippingAmount: input.shippingAmount,
|
|
285
|
+
suggestFullRefund,
|
|
286
|
+
});
|
|
287
|
+
if (!data.order) {
|
|
288
|
+
throw new errors_1.ShopifyNotFoundError('Order not found', { orderId });
|
|
289
|
+
}
|
|
290
|
+
const r = data.order.suggestedRefund;
|
|
291
|
+
return {
|
|
292
|
+
amount: r.amountSet?.shopMoney,
|
|
293
|
+
subtotal: r.subtotalSet?.shopMoney,
|
|
294
|
+
totalTax: r.totalTaxSet?.shopMoney,
|
|
295
|
+
maximumRefundable: r.maximumRefundableSet?.shopMoney,
|
|
296
|
+
shippingAmount: r.shipping?.amountSet?.shopMoney,
|
|
297
|
+
refundLineItems: (r.refundLineItems ?? []).map((li) => ({
|
|
298
|
+
quantity: li.quantity,
|
|
299
|
+
restockType: li.restockType ?? undefined,
|
|
300
|
+
lineItemId: li.lineItem?.id,
|
|
301
|
+
lineItemTitle: li.lineItem?.title ?? undefined,
|
|
302
|
+
lineItemSku: li.lineItem?.sku ?? undefined,
|
|
303
|
+
price: li.priceSet?.shopMoney,
|
|
304
|
+
subtotal: li.subtotalSet?.shopMoney,
|
|
305
|
+
totalTax: li.totalTaxSet?.shopMoney,
|
|
306
|
+
})),
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Create a refund against an order. Requires Shopify's `@idempotent` directive
|
|
311
|
+
* (enforced at runtime as of the 2026-04 API version) — the key must be a
|
|
312
|
+
* string literal in the query, so it's interpolated rather than passed as a
|
|
313
|
+
* variable, same as shp-order-service's `createRefund`.
|
|
314
|
+
*/
|
|
315
|
+
async function createRefund(siteName, orderId, input, idempotencyKey) {
|
|
316
|
+
const key = idempotencyKey ?? `${orderId}-${Date.now()}`;
|
|
317
|
+
const mutation = `
|
|
318
|
+
mutation RefundCreate($input: RefundInput!) {
|
|
319
|
+
refundCreate(input: $input) @idempotent(key: "${key}") {
|
|
320
|
+
refund {
|
|
321
|
+
id
|
|
322
|
+
createdAt
|
|
323
|
+
note
|
|
324
|
+
totalRefundedSet { shopMoney { amount currencyCode } }
|
|
325
|
+
}
|
|
326
|
+
userErrors { field message }
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
`;
|
|
330
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, { input: { orderId: normalizeOrderId(orderId), ...input } });
|
|
331
|
+
ensureNoUserErrors(data.refundCreate.userErrors, 'Failed to create refund');
|
|
332
|
+
if (!data.refundCreate.refund) {
|
|
333
|
+
throw new errors_1.ShopifyUserErrorsError('Failed to create refund', data.refundCreate.userErrors);
|
|
334
|
+
}
|
|
335
|
+
const r = data.refundCreate.refund;
|
|
336
|
+
return {
|
|
337
|
+
shopifyId: r.id,
|
|
338
|
+
createdAt: r.createdAt ? new Date(r.createdAt) : undefined,
|
|
339
|
+
note: r.note ?? undefined,
|
|
340
|
+
totalRefunded: r.totalRefundedSet?.shopMoney,
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
function mapDraftOrder(node) {
|
|
344
|
+
return {
|
|
345
|
+
shopifyId: node.id,
|
|
346
|
+
name: node.name,
|
|
347
|
+
status: node.status ?? undefined,
|
|
348
|
+
invoiceUrl: node.invoiceUrl ?? undefined,
|
|
349
|
+
invoiceSentAt: node.invoiceSentAt ? new Date(node.invoiceSentAt) : undefined,
|
|
350
|
+
totalPrice: node.totalPriceSet?.shopMoney ?? undefined,
|
|
351
|
+
orderId: node.order?.id ?? undefined,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
/** Create a draft order — used for manual/offline orders (e.g. phone, in-person). */
|
|
355
|
+
async function createDraftOrder(siteName, input) {
|
|
356
|
+
const mutation = `
|
|
357
|
+
mutation DraftOrderCreate($input: DraftOrderInput!) {
|
|
358
|
+
draftOrderCreate(input: $input) {
|
|
359
|
+
draftOrder { id name status invoiceUrl totalPriceSet { shopMoney { amount currencyCode } } }
|
|
360
|
+
userErrors { field message }
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
`;
|
|
364
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, { input });
|
|
365
|
+
ensureNoUserErrors(data.draftOrderCreate.userErrors, 'Failed to create draft order');
|
|
366
|
+
if (!data.draftOrderCreate.draftOrder) {
|
|
367
|
+
throw new errors_1.ShopifyUserErrorsError('Failed to create draft order', data.draftOrderCreate.userErrors);
|
|
368
|
+
}
|
|
369
|
+
return mapDraftOrder(data.draftOrderCreate.draftOrder);
|
|
370
|
+
}
|
|
371
|
+
/** Complete a draft order, converting it into a real order. */
|
|
372
|
+
async function completeDraftOrder(siteName, draftOrderId, input = {}) {
|
|
373
|
+
const mutation = `
|
|
374
|
+
mutation DraftOrderComplete($id: ID!, $paymentPending: Boolean, $paymentGatewayId: ID, $sourceName: String) {
|
|
375
|
+
draftOrderComplete(
|
|
376
|
+
id: $id
|
|
377
|
+
paymentPending: $paymentPending
|
|
378
|
+
paymentGatewayId: $paymentGatewayId
|
|
379
|
+
sourceName: $sourceName
|
|
380
|
+
) {
|
|
381
|
+
draftOrder { id name status order { id } }
|
|
382
|
+
userErrors { field message }
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
`;
|
|
386
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, {
|
|
387
|
+
id: normalizeDraftOrderId(draftOrderId),
|
|
388
|
+
paymentPending: input.paymentPending,
|
|
389
|
+
paymentGatewayId: input.paymentGatewayId,
|
|
390
|
+
sourceName: input.sourceName,
|
|
391
|
+
});
|
|
392
|
+
ensureNoUserErrors(data.draftOrderComplete.userErrors, 'Failed to complete draft order');
|
|
393
|
+
if (!data.draftOrderComplete.draftOrder) {
|
|
394
|
+
throw new errors_1.ShopifyUserErrorsError('Failed to complete draft order', data.draftOrderComplete.userErrors);
|
|
395
|
+
}
|
|
396
|
+
return mapDraftOrder(data.draftOrderComplete.draftOrder);
|
|
397
|
+
}
|
|
398
|
+
/** Send (or resend) a draft order's invoice email. */
|
|
399
|
+
async function sendDraftOrderInvoice(siteName, draftOrderId, email) {
|
|
400
|
+
const mutation = `
|
|
401
|
+
mutation DraftOrderInvoiceSend($id: ID!, $email: EmailInput) {
|
|
402
|
+
draftOrderInvoiceSend(id: $id, email: $email) {
|
|
403
|
+
draftOrder { id name invoiceSentAt }
|
|
404
|
+
userErrors { field message }
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
`;
|
|
408
|
+
const data = await (0, client_1.adminGraphql)(siteName, mutation, { id: normalizeDraftOrderId(draftOrderId), email });
|
|
409
|
+
ensureNoUserErrors(data.draftOrderInvoiceSend.userErrors, 'Failed to send draft order invoice');
|
|
410
|
+
if (!data.draftOrderInvoiceSend.draftOrder) {
|
|
411
|
+
throw new errors_1.ShopifyUserErrorsError('Failed to send draft order invoice', data.draftOrderInvoiceSend.userErrors);
|
|
412
|
+
}
|
|
413
|
+
return mapDraftOrder(data.draftOrderInvoiceSend.draftOrder);
|
|
414
|
+
}
|
|
112
415
|
//# sourceMappingURL=orders.js.map
|
package/dist/src/orders.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders.js","sourceRoot":"","sources":["../../src/orders.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"orders.js","sourceRoot":"","sources":["../../src/orders.ts"],"names":[],"mappings":";;AA+MA,gCA+BC;AAGD,oCAiEC;AAGD,kCAgBC;AAGD,kCA+CC;AAGD,gCAgBC;AAGD,kCAgBC;AAGD,kDAwBC;AAGD,0CAcC;AAGD,0CAkEC;AAQD,oCAkCC;AAeD,4CAiBC;AAGD,gDA+BC;AAGD,sDAqBC;AAlpBD,qCAAwC;AAExC,qCAA+F;AAgL/F,SAAS,gBAAgB,CAAC,OAAe;IACvC,OAAO,OAAO,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAuB,OAAO,EAAE,CAAC;AACjG,CAAC;AAED,SAAS,qBAAqB,CAAC,YAAoB;IACjD,OAAO,YAAY,CAAC,UAAU,CAAC,2BAA2B,CAAC;QACzD,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,4BAA4B,YAAY,EAAE,CAAC;AACjD,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAsC,EAAE,OAAe;IACjF,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,+BAAsB,CAAC,OAAO,EAAE,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|
|
4
4
|
"description": "Shopify commerce adapter — Admin API client, read-model mappers, tenant-config resolution, and Keycloak/PlatformX auth verification, consumed by hep-ecommerce-service. Self-contained: does not depend on shp-auth-client.",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|