@sixtyninecommerce/client 0.3.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/README.md +117 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5 -1
- package/dist/client.js.map +1 -1
- package/dist/commerce/branding.d.ts +6 -0
- package/dist/commerce/branding.d.ts.map +1 -0
- package/dist/commerce/branding.js +138 -0
- package/dist/commerce/branding.js.map +1 -0
- package/dist/commerce/checkout.d.ts.map +1 -1
- package/dist/commerce/checkout.js +5 -1
- package/dist/commerce/checkout.js.map +1 -1
- package/dist/commerce/customer.d.ts +6 -1
- package/dist/commerce/customer.d.ts.map +1 -1
- package/dist/commerce/customer.js +31 -1
- package/dist/commerce/customer.js.map +1 -1
- package/dist/commerce/index.d.ts +2 -2
- package/dist/commerce/index.d.ts.map +1 -1
- package/dist/commerce/index.js +13 -1
- package/dist/commerce/index.js.map +1 -1
- package/dist/commerce/payments.d.ts +8 -0
- package/dist/commerce/payments.d.ts.map +1 -0
- package/dist/commerce/payments.js +30 -0
- package/dist/commerce/payments.js.map +1 -0
- package/dist/commerce/products.d.ts.map +1 -1
- package/dist/commerce/products.js +67 -6
- package/dist/commerce/products.js.map +1 -1
- package/dist/commerce/queries.d.ts +24 -15
- package/dist/commerce/queries.d.ts.map +1 -1
- package/dist/commerce/queries.js +211 -112
- package/dist/commerce/queries.js.map +1 -1
- package/dist/commerce/quotes.d.ts +10 -0
- package/dist/commerce/quotes.d.ts.map +1 -0
- package/dist/commerce/quotes.js +33 -0
- package/dist/commerce/quotes.js.map +1 -0
- package/dist/commerce/reviews.d.ts +2 -1
- package/dist/commerce/reviews.d.ts.map +1 -1
- package/dist/commerce/reviews.js +9 -0
- package/dist/commerce/reviews.js.map +1 -1
- package/dist/commerce/stock-notifications.d.ts +7 -0
- package/dist/commerce/stock-notifications.d.ts.map +1 -0
- package/dist/commerce/stock-notifications.js +48 -0
- package/dist/commerce/stock-notifications.js.map +1 -0
- package/dist/commerce/subscriptions.d.ts +6 -0
- package/dist/commerce/subscriptions.d.ts.map +1 -1
- package/dist/commerce/subscriptions.js +41 -13
- package/dist/commerce/subscriptions.js.map +1 -1
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +12 -0
- package/dist/constants.js.map +1 -1
- package/dist/content/items.d.ts +2 -1
- package/dist/content/items.d.ts.map +1 -1
- package/dist/content/items.js +20 -0
- package/dist/content/items.js.map +1 -1
- package/dist/content/menus.d.ts.map +1 -1
- package/dist/content/menus.js +25 -7
- package/dist/content/menus.js.map +1 -1
- package/dist/credit/credit-status.d.ts +6 -0
- package/dist/credit/credit-status.d.ts.map +1 -0
- package/dist/credit/credit-status.js +26 -0
- package/dist/credit/credit-status.js.map +1 -0
- package/dist/credit/index.d.ts +4 -0
- package/dist/credit/index.d.ts.map +1 -0
- package/dist/credit/index.js +5 -0
- package/dist/credit/index.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/media/video.d.ts +4 -1
- package/dist/media/video.d.ts.map +1 -1
- package/dist/media/video.js +20 -1
- package/dist/media/video.js.map +1 -1
- package/dist/navigation/routes.js +2 -2
- package/dist/navigation/routes.js.map +1 -1
- package/dist/seo/ai.d.ts +17 -0
- package/dist/seo/ai.d.ts.map +1 -0
- package/dist/seo/ai.js +32 -0
- package/dist/seo/ai.js.map +1 -0
- package/dist/seo/alternates.d.ts +4 -0
- package/dist/seo/alternates.d.ts.map +1 -0
- package/dist/seo/alternates.js +29 -0
- package/dist/seo/alternates.js.map +1 -0
- package/dist/seo/canonical.d.ts +4 -0
- package/dist/seo/canonical.d.ts.map +1 -0
- package/dist/seo/canonical.js +49 -0
- package/dist/seo/canonical.js.map +1 -0
- package/dist/seo/index.d.ts +9 -0
- package/dist/seo/index.d.ts.map +1 -0
- package/dist/seo/index.js +54 -0
- package/dist/seo/index.js.map +1 -0
- package/dist/seo/json-ld.d.ts +25 -0
- package/dist/seo/json-ld.d.ts.map +1 -0
- package/dist/seo/json-ld.js +113 -0
- package/dist/seo/json-ld.js.map +1 -0
- package/dist/seo/meta-tags.d.ts +58 -0
- package/dist/seo/meta-tags.d.ts.map +1 -0
- package/dist/seo/meta-tags.js +194 -0
- package/dist/seo/meta-tags.js.map +1 -0
- package/dist/seo/metadata-parser.d.ts +31 -0
- package/dist/seo/metadata-parser.d.ts.map +1 -0
- package/dist/seo/metadata-parser.js +180 -0
- package/dist/seo/metadata-parser.js.map +1 -0
- package/dist/seo/metadata-types.d.ts +63 -0
- package/dist/seo/metadata-types.d.ts.map +1 -0
- package/dist/seo/metadata-types.js +2 -0
- package/dist/seo/metadata-types.js.map +1 -0
- package/dist/seo/robots.d.ts +21 -0
- package/dist/seo/robots.d.ts.map +1 -0
- package/dist/seo/robots.js +39 -0
- package/dist/seo/robots.js.map +1 -0
- package/dist/seo/types.d.ts +54 -0
- package/dist/seo/types.d.ts.map +1 -0
- package/dist/seo/types.js +2 -0
- package/dist/seo/types.js.map +1 -0
- package/dist/seo/url-builder.d.ts +11 -0
- package/dist/seo/url-builder.d.ts.map +1 -0
- package/dist/seo/url-builder.js +40 -0
- package/dist/seo/url-builder.js.map +1 -0
- package/dist/types.d.ts +361 -7
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/commerce/queries.js
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
const PRODUCT_METADATA_FRAGMENT = `
|
|
2
|
+
metadata {
|
|
3
|
+
seoTitle seoDescription canonicalUrl
|
|
4
|
+
socialTitle socialDescription socialImageAlt socialOgType
|
|
5
|
+
socialImage {
|
|
6
|
+
source name
|
|
7
|
+
customFields { altText }
|
|
8
|
+
presets {
|
|
9
|
+
xs { url webpUrl } m { url webpUrl }
|
|
10
|
+
l { url webpUrl } xl { url webpUrl }
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
twitterCardType twitterTitleOverride twitterDescriptionOverride
|
|
14
|
+
twitterImageOverride {
|
|
15
|
+
source name
|
|
16
|
+
customFields { altText }
|
|
17
|
+
presets {
|
|
18
|
+
xs { url webpUrl } m { url webpUrl }
|
|
19
|
+
l { url webpUrl } xl { url webpUrl }
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
aiSummary qaPairs qaEmitFaqpageJsonld
|
|
23
|
+
breadcrumbOverride hreflangOverrides
|
|
24
|
+
metaRobots resolvedBotDirectives
|
|
25
|
+
includeReviewsInJsonld
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
1
28
|
export const GET_PRODUCT = `
|
|
2
29
|
query GetProduct($slug: String!) {
|
|
3
30
|
product(slug: $slug) {
|
|
@@ -24,8 +51,9 @@ export const GET_PRODUCT = `
|
|
|
24
51
|
price priceWithTax currencyCode stockLevel
|
|
25
52
|
priceListName retailPrice retailPriceWithTax
|
|
26
53
|
priceTiers { minQuantity price priceWithTax discountLabel }
|
|
54
|
+
availabilityByLocation { locationId locationName inStock }
|
|
27
55
|
options { id code name group { id name code } }
|
|
28
|
-
customFields { minOrderQuantity salesUnit }
|
|
56
|
+
customFields { minOrderQuantity salesUnit position }
|
|
29
57
|
featuredAsset {
|
|
30
58
|
source name
|
|
31
59
|
customFields { altText }
|
|
@@ -39,7 +67,17 @@ export const GET_PRODUCT = `
|
|
|
39
67
|
}
|
|
40
68
|
optionGroups { id name code options { id name code } }
|
|
41
69
|
facetValues { id name code facet { id name code } }
|
|
42
|
-
|
|
70
|
+
translations { languageCode name slug description }
|
|
71
|
+
collections {
|
|
72
|
+
id name slug position
|
|
73
|
+
parent { id }
|
|
74
|
+
translations { languageCode name slug }
|
|
75
|
+
customFields { isRoutable isCanonical }
|
|
76
|
+
}
|
|
77
|
+
documents {
|
|
78
|
+
id position title description fileUrl fileMimeType fileSize fileName requiresAuth
|
|
79
|
+
}
|
|
80
|
+
${PRODUCT_METADATA_FRAGMENT}
|
|
43
81
|
}
|
|
44
82
|
}
|
|
45
83
|
`;
|
|
@@ -69,8 +107,9 @@ export const GET_PRODUCT_BY_ID = `
|
|
|
69
107
|
price priceWithTax currencyCode stockLevel
|
|
70
108
|
priceListName retailPrice retailPriceWithTax
|
|
71
109
|
priceTiers { minQuantity price priceWithTax discountLabel }
|
|
110
|
+
availabilityByLocation { locationId locationName inStock }
|
|
72
111
|
options { id code name group { id name code } }
|
|
73
|
-
customFields { minOrderQuantity salesUnit }
|
|
112
|
+
customFields { minOrderQuantity salesUnit position }
|
|
74
113
|
featuredAsset {
|
|
75
114
|
source name
|
|
76
115
|
customFields { altText }
|
|
@@ -84,7 +123,17 @@ export const GET_PRODUCT_BY_ID = `
|
|
|
84
123
|
}
|
|
85
124
|
optionGroups { id name code options { id name code } }
|
|
86
125
|
facetValues { id name code facet { id name code } }
|
|
87
|
-
|
|
126
|
+
translations { languageCode name slug description }
|
|
127
|
+
collections {
|
|
128
|
+
id name slug position
|
|
129
|
+
parent { id }
|
|
130
|
+
translations { languageCode name slug }
|
|
131
|
+
customFields { isRoutable isCanonical }
|
|
132
|
+
}
|
|
133
|
+
documents {
|
|
134
|
+
id position title description fileUrl fileMimeType fileSize fileName requiresAuth
|
|
135
|
+
}
|
|
136
|
+
${PRODUCT_METADATA_FRAGMENT}
|
|
88
137
|
}
|
|
89
138
|
}
|
|
90
139
|
`;
|
|
@@ -102,12 +151,18 @@ export const LIST_PRODUCTS = `
|
|
|
102
151
|
id name sku
|
|
103
152
|
price priceWithTax currencyCode stockLevel
|
|
104
153
|
priceListName retailPrice retailPriceWithTax
|
|
105
|
-
priceTiers { minQuantity price priceWithTax discountLabel }
|
|
106
154
|
priceTiers { minQuantity price priceWithTax discountLabel }
|
|
107
|
-
|
|
155
|
+
availabilityByLocation { locationId locationName inStock }
|
|
156
|
+
customFields { minOrderQuantity salesUnit position }
|
|
108
157
|
}
|
|
109
158
|
facetValues { id name code facet { id name code } }
|
|
110
|
-
|
|
159
|
+
translations { languageCode name slug description }
|
|
160
|
+
collections {
|
|
161
|
+
id name slug position
|
|
162
|
+
parent { id }
|
|
163
|
+
translations { languageCode name slug }
|
|
164
|
+
customFields { isRoutable isCanonical }
|
|
165
|
+
}
|
|
111
166
|
}
|
|
112
167
|
totalItems
|
|
113
168
|
}
|
|
@@ -160,8 +215,9 @@ export const GET_COLLECTION = `
|
|
|
160
215
|
}
|
|
161
216
|
price priceWithTax currencyCode stockLevel
|
|
162
217
|
priceListName retailPrice retailPriceWithTax
|
|
163
|
-
|
|
164
|
-
|
|
218
|
+
priceTiers { minQuantity price priceWithTax discountLabel }
|
|
219
|
+
availabilityByLocation { locationId locationName inStock }
|
|
220
|
+
customFields { minOrderQuantity salesUnit position }
|
|
165
221
|
}
|
|
166
222
|
totalItems
|
|
167
223
|
}
|
|
@@ -178,53 +234,49 @@ export const SEARCH_PRODUCTS = `
|
|
|
178
234
|
currencyCode
|
|
179
235
|
productAsset { preview focalPoint { x y } }
|
|
180
236
|
collectionIds
|
|
237
|
+
inStock
|
|
181
238
|
}
|
|
182
239
|
totalItems
|
|
183
240
|
facetValues { facetValue { id name code facet { id name code } } count }
|
|
184
241
|
}
|
|
185
242
|
}
|
|
186
243
|
`;
|
|
244
|
+
const ORDER_FIELDS = `
|
|
245
|
+
id code state active
|
|
246
|
+
totalQuantity
|
|
247
|
+
subTotal subTotalWithTax
|
|
248
|
+
shipping shippingWithTax
|
|
249
|
+
total totalWithTax
|
|
250
|
+
currencyCode
|
|
251
|
+
lines {
|
|
252
|
+
id quantity
|
|
253
|
+
unitPrice unitPriceWithTax
|
|
254
|
+
linePrice linePriceWithTax
|
|
255
|
+
discountedLinePrice discountedLinePriceWithTax
|
|
256
|
+
discounts { adjustmentSource type description amount amountWithTax }
|
|
257
|
+
productVariant {
|
|
258
|
+
id name sku
|
|
259
|
+
product { id name slug }
|
|
260
|
+
options { id name group { name } }
|
|
261
|
+
}
|
|
262
|
+
featuredAsset { source presets { xs { url webpUrl } } }
|
|
263
|
+
}
|
|
264
|
+
discounts { adjustmentSource type description amount amountWithTax }
|
|
265
|
+
taxSummary { description taxRate taxBase taxTotal }
|
|
266
|
+
promotions { id name couponCode description }
|
|
267
|
+
shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }
|
|
268
|
+
customer { id firstName lastName emailAddress }
|
|
269
|
+
couponCodes
|
|
270
|
+
`;
|
|
187
271
|
export const ACTIVE_ORDER = `
|
|
188
272
|
query ActiveOrder {
|
|
189
|
-
activeOrder {
|
|
190
|
-
id code state active
|
|
191
|
-
totalQuantity
|
|
192
|
-
subTotal subTotalWithTax
|
|
193
|
-
shipping shippingWithTax
|
|
194
|
-
total totalWithTax
|
|
195
|
-
currencyCode
|
|
196
|
-
lines {
|
|
197
|
-
id quantity
|
|
198
|
-
unitPrice unitPriceWithTax
|
|
199
|
-
linePrice linePriceWithTax
|
|
200
|
-
productVariant {
|
|
201
|
-
id name sku
|
|
202
|
-
product { id name slug }
|
|
203
|
-
options { id name group { name } }
|
|
204
|
-
}
|
|
205
|
-
featuredAsset { source presets { xs { url webpUrl } } }
|
|
206
|
-
}
|
|
207
|
-
shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }
|
|
208
|
-
customer { id firstName lastName emailAddress }
|
|
209
|
-
couponCodes
|
|
210
|
-
}
|
|
273
|
+
activeOrder { ${ORDER_FIELDS} }
|
|
211
274
|
}
|
|
212
275
|
`;
|
|
213
276
|
export const ADD_TO_CART = `
|
|
214
277
|
mutation AddToCart($variantId: ID!, $quantity: Int!) {
|
|
215
278
|
addItemToOrder(productVariantId: $variantId, quantity: $quantity) {
|
|
216
|
-
... on Order {
|
|
217
|
-
id code state active totalQuantity
|
|
218
|
-
subTotal subTotalWithTax shipping shippingWithTax total totalWithTax currencyCode
|
|
219
|
-
lines {
|
|
220
|
-
id quantity unitPrice unitPriceWithTax linePrice linePriceWithTax
|
|
221
|
-
productVariant { id name sku product { id name slug } options { id name group { name } } }
|
|
222
|
-
featuredAsset { source presets { xs { url webpUrl } } }
|
|
223
|
-
}
|
|
224
|
-
shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }
|
|
225
|
-
customer { id firstName lastName emailAddress }
|
|
226
|
-
couponCodes
|
|
227
|
-
}
|
|
279
|
+
... on Order { ${ORDER_FIELDS} }
|
|
228
280
|
... on OrderModificationError { errorCode message }
|
|
229
281
|
... on OrderLimitError { errorCode message maxItems }
|
|
230
282
|
... on NegativeQuantityError { errorCode message }
|
|
@@ -235,18 +287,7 @@ export const ADD_TO_CART = `
|
|
|
235
287
|
export const ADJUST_ORDER_LINE = `
|
|
236
288
|
mutation AdjustOrderLine($lineId: ID!, $quantity: Int!) {
|
|
237
289
|
adjustOrderLine(orderLineId: $lineId, quantity: $quantity) {
|
|
238
|
-
... on Order {
|
|
239
|
-
id code state active totalQuantity
|
|
240
|
-
subTotal subTotalWithTax shipping shippingWithTax total totalWithTax currencyCode
|
|
241
|
-
lines {
|
|
242
|
-
id quantity unitPrice unitPriceWithTax linePrice linePriceWithTax
|
|
243
|
-
productVariant { id name sku product { id name slug } options { id name group { name } } }
|
|
244
|
-
featuredAsset { source presets { xs { url webpUrl } } }
|
|
245
|
-
}
|
|
246
|
-
shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }
|
|
247
|
-
customer { id firstName lastName emailAddress }
|
|
248
|
-
couponCodes
|
|
249
|
-
}
|
|
290
|
+
... on Order { ${ORDER_FIELDS} }
|
|
250
291
|
... on OrderModificationError { errorCode message }
|
|
251
292
|
... on OrderLimitError { errorCode message maxItems }
|
|
252
293
|
... on NegativeQuantityError { errorCode message }
|
|
@@ -257,18 +298,7 @@ export const ADJUST_ORDER_LINE = `
|
|
|
257
298
|
export const REMOVE_ORDER_LINE = `
|
|
258
299
|
mutation RemoveOrderLine($lineId: ID!) {
|
|
259
300
|
removeOrderLine(orderLineId: $lineId) {
|
|
260
|
-
... on Order {
|
|
261
|
-
id code state active totalQuantity
|
|
262
|
-
subTotal subTotalWithTax shipping shippingWithTax total totalWithTax currencyCode
|
|
263
|
-
lines {
|
|
264
|
-
id quantity unitPrice unitPriceWithTax linePrice linePriceWithTax
|
|
265
|
-
productVariant { id name sku product { id name slug } options { id name group { name } } }
|
|
266
|
-
featuredAsset { source presets { xs { url webpUrl } } }
|
|
267
|
-
}
|
|
268
|
-
shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }
|
|
269
|
-
customer { id firstName lastName emailAddress }
|
|
270
|
-
couponCodes
|
|
271
|
-
}
|
|
301
|
+
... on Order { ${ORDER_FIELDS} }
|
|
272
302
|
... on OrderModificationError { errorCode message }
|
|
273
303
|
}
|
|
274
304
|
}
|
|
@@ -276,16 +306,7 @@ export const REMOVE_ORDER_LINE = `
|
|
|
276
306
|
export const APPLY_COUPON = `
|
|
277
307
|
mutation ApplyCoupon($code: String!) {
|
|
278
308
|
applyCouponCode(couponCode: $code) {
|
|
279
|
-
... on Order {
|
|
280
|
-
id code state active totalQuantity
|
|
281
|
-
subTotal subTotalWithTax shipping shippingWithTax total totalWithTax currencyCode
|
|
282
|
-
lines {
|
|
283
|
-
id quantity unitPrice unitPriceWithTax linePrice linePriceWithTax
|
|
284
|
-
productVariant { id name sku product { id name slug } options { id name group { name } } }
|
|
285
|
-
featuredAsset { source presets { xs { url webpUrl } } }
|
|
286
|
-
}
|
|
287
|
-
couponCodes
|
|
288
|
-
}
|
|
309
|
+
... on Order { ${ORDER_FIELDS} }
|
|
289
310
|
... on CouponCodeExpiredError { errorCode message couponCode }
|
|
290
311
|
... on CouponCodeInvalidError { errorCode message couponCode }
|
|
291
312
|
... on CouponCodeLimitError { errorCode message couponCode limit }
|
|
@@ -294,16 +315,7 @@ export const APPLY_COUPON = `
|
|
|
294
315
|
`;
|
|
295
316
|
export const REMOVE_COUPON = `
|
|
296
317
|
mutation RemoveCoupon($code: String!) {
|
|
297
|
-
removeCouponCode(couponCode: $code) {
|
|
298
|
-
id code state active totalQuantity
|
|
299
|
-
subTotal subTotalWithTax shipping shippingWithTax total totalWithTax currencyCode
|
|
300
|
-
lines {
|
|
301
|
-
id quantity unitPrice unitPriceWithTax linePrice linePriceWithTax
|
|
302
|
-
productVariant { id name sku product { id name slug } options { id name group { name } } }
|
|
303
|
-
featuredAsset { source presets { xs { url webpUrl } } }
|
|
304
|
-
}
|
|
305
|
-
couponCodes
|
|
306
|
-
}
|
|
318
|
+
removeCouponCode(couponCode: $code) { ${ORDER_FIELDS} }
|
|
307
319
|
}
|
|
308
320
|
`;
|
|
309
321
|
export const SET_CUSTOMER = `
|
|
@@ -386,6 +398,31 @@ export const ADD_PAYMENT = `
|
|
|
386
398
|
}
|
|
387
399
|
}
|
|
388
400
|
`;
|
|
401
|
+
export const CREATE_STRIPE_PAYMENT_INTENT = `
|
|
402
|
+
mutation CreateStripePaymentIntent {
|
|
403
|
+
createStripePaymentIntent
|
|
404
|
+
}
|
|
405
|
+
`;
|
|
406
|
+
export const MOLLIE_PAYMENT_METHODS = `
|
|
407
|
+
query MolliePaymentMethods($input: MolliePaymentMethodsInput!) {
|
|
408
|
+
molliePaymentMethods(input: $input) {
|
|
409
|
+
id
|
|
410
|
+
code
|
|
411
|
+
description
|
|
412
|
+
minimumAmount { value currency }
|
|
413
|
+
maximumAmount { value currency }
|
|
414
|
+
image { size1x size2x svg }
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
`;
|
|
418
|
+
export const CREATE_MOLLIE_PAYMENT_INTENT = `
|
|
419
|
+
mutation CreateMolliePaymentIntent($input: MolliePaymentIntentInput!) {
|
|
420
|
+
createMolliePaymentIntent(input: $input) {
|
|
421
|
+
... on MolliePaymentIntent { url }
|
|
422
|
+
... on MolliePaymentIntentError { errorCode message }
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
`;
|
|
389
426
|
export const LOGIN = `
|
|
390
427
|
mutation Login($email: String!, $password: String!) {
|
|
391
428
|
login(username: $email, password: $password) {
|
|
@@ -555,28 +592,7 @@ export const AVAILABLE_COUNTRIES = `
|
|
|
555
592
|
`;
|
|
556
593
|
export const ORDER_BY_CODE = `
|
|
557
594
|
query OrderByCode($code: String!) {
|
|
558
|
-
orderByCode(code: $code) {
|
|
559
|
-
id code state active
|
|
560
|
-
totalQuantity
|
|
561
|
-
subTotal subTotalWithTax
|
|
562
|
-
shipping shippingWithTax
|
|
563
|
-
total totalWithTax
|
|
564
|
-
currencyCode
|
|
565
|
-
lines {
|
|
566
|
-
id quantity
|
|
567
|
-
unitPrice unitPriceWithTax
|
|
568
|
-
linePrice linePriceWithTax
|
|
569
|
-
productVariant {
|
|
570
|
-
id name sku
|
|
571
|
-
product { id name slug }
|
|
572
|
-
options { id name group { name } }
|
|
573
|
-
}
|
|
574
|
-
featuredAsset { source presets { xs { url webpUrl } } }
|
|
575
|
-
}
|
|
576
|
-
shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }
|
|
577
|
-
customer { id firstName lastName emailAddress }
|
|
578
|
-
couponCodes
|
|
579
|
-
}
|
|
595
|
+
orderByCode(code: $code) { ${ORDER_FIELDS} }
|
|
580
596
|
}
|
|
581
597
|
`;
|
|
582
598
|
export const FAVORITE_VARIANT_IDS = `
|
|
@@ -596,6 +612,7 @@ export const MY_FAVORITES = `
|
|
|
596
612
|
price priceWithTax currencyCode stockLevel
|
|
597
613
|
priceListName retailPrice retailPriceWithTax
|
|
598
614
|
priceTiers { minQuantity price priceWithTax discountLabel }
|
|
615
|
+
availabilityByLocation { locationId locationName inStock }
|
|
599
616
|
product {
|
|
600
617
|
id name slug
|
|
601
618
|
featuredAsset {
|
|
@@ -605,7 +622,7 @@ export const MY_FAVORITES = `
|
|
|
605
622
|
}
|
|
606
623
|
}
|
|
607
624
|
options { id name group { name } }
|
|
608
|
-
customFields { minOrderQuantity salesUnit }
|
|
625
|
+
customFields { minOrderQuantity salesUnit position }
|
|
609
626
|
}
|
|
610
627
|
}
|
|
611
628
|
totalItems
|
|
@@ -622,6 +639,21 @@ export const REMOVE_FAVORITE = `
|
|
|
622
639
|
removeFavorite(productVariantId: $productVariantId)
|
|
623
640
|
}
|
|
624
641
|
`;
|
|
642
|
+
const CHANNEL_CUSTOM_FIELDS_FRAGMENT = `
|
|
643
|
+
customFields {
|
|
644
|
+
businessName businessDescription
|
|
645
|
+
logoAssetId darkLogoAssetId coverAssetId faviconAssetId
|
|
646
|
+
websiteUrl primaryColor
|
|
647
|
+
contactEmail contactPhone
|
|
648
|
+
legalName vatNumber registrationNumber
|
|
649
|
+
addressLine1 addressLine2 city postalCode province country
|
|
650
|
+
socialLinks
|
|
651
|
+
commercePathPrefix commercePathPrefixTranslations
|
|
652
|
+
cdnDomain maintenanceMode
|
|
653
|
+
urlLocaleStrategy urlLocalePrefixDefault
|
|
654
|
+
twitterHandle defaultOgImageId llmsTxtEnabled
|
|
655
|
+
}
|
|
656
|
+
`;
|
|
625
657
|
export const GET_ACTIVE_CHANNEL = `
|
|
626
658
|
query ActiveChannel {
|
|
627
659
|
activeChannel {
|
|
@@ -630,7 +662,7 @@ export const GET_ACTIVE_CHANNEL = `
|
|
|
630
662
|
availableLanguageCodes
|
|
631
663
|
defaultCurrencyCode
|
|
632
664
|
availableCurrencyCodes
|
|
633
|
-
|
|
665
|
+
${CHANNEL_CUSTOM_FIELDS_FRAGMENT}
|
|
634
666
|
}
|
|
635
667
|
}
|
|
636
668
|
`;
|
|
@@ -684,7 +716,8 @@ export const GET_PRODUCT_RECOMMENDATIONS = `
|
|
|
684
716
|
price priceWithTax currencyCode stockLevel
|
|
685
717
|
priceListName retailPrice retailPriceWithTax
|
|
686
718
|
priceTiers { minQuantity price priceWithTax discountLabel }
|
|
687
|
-
|
|
719
|
+
availabilityByLocation { locationId locationName inStock }
|
|
720
|
+
customFields { minOrderQuantity salesUnit position }
|
|
688
721
|
}
|
|
689
722
|
}
|
|
690
723
|
}
|
|
@@ -704,4 +737,70 @@ export const CONVERT_CURRENCY = `
|
|
|
704
737
|
}
|
|
705
738
|
}
|
|
706
739
|
`;
|
|
740
|
+
const QUOTE_FIELDS = `
|
|
741
|
+
id code channelId customerId currencyCode status
|
|
742
|
+
expiresAt salesRepUserId customerNotes convertedOrderId
|
|
743
|
+
createdAt updatedAt
|
|
744
|
+
lines {
|
|
745
|
+
id productVariantId quantity unitPrice discountLabel position
|
|
746
|
+
createdAt updatedAt
|
|
747
|
+
}
|
|
748
|
+
`;
|
|
749
|
+
export const MY_QUOTES = `
|
|
750
|
+
query MyQuotes($options: QuoteListOptions) {
|
|
751
|
+
myQuotes(options: $options) {
|
|
752
|
+
items { ${QUOTE_FIELDS} }
|
|
753
|
+
totalItems
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
`;
|
|
757
|
+
export const MY_QUOTE = `
|
|
758
|
+
query MyQuote($id: ID!) {
|
|
759
|
+
myQuote(id: $id) { ${QUOTE_FIELDS} }
|
|
760
|
+
}
|
|
761
|
+
`;
|
|
762
|
+
export const CREATE_QUOTE_REQUEST = `
|
|
763
|
+
mutation CreateQuoteRequest($input: CreateQuoteRequestInput!) {
|
|
764
|
+
createQuoteRequest(input: $input) { ${QUOTE_FIELDS} }
|
|
765
|
+
}
|
|
766
|
+
`;
|
|
767
|
+
export const ACCEPT_QUOTE = `
|
|
768
|
+
mutation AcceptQuote($id: ID!) {
|
|
769
|
+
acceptQuote(id: $id) { ${ORDER_FIELDS} }
|
|
770
|
+
}
|
|
771
|
+
`;
|
|
772
|
+
export const CANCEL_MY_QUOTE = `
|
|
773
|
+
mutation CancelMyQuote($id: ID!, $reason: String) {
|
|
774
|
+
cancelMyQuote(id: $id, reason: $reason) { ${QUOTE_FIELDS} }
|
|
775
|
+
}
|
|
776
|
+
`;
|
|
777
|
+
export const GET_BRANDING = `
|
|
778
|
+
query GetBranding($ids: [ID!]!) {
|
|
779
|
+
activeChannel {
|
|
780
|
+
id
|
|
781
|
+
defaultLanguageCode
|
|
782
|
+
availableLanguageCodes
|
|
783
|
+
defaultCurrencyCode
|
|
784
|
+
}
|
|
785
|
+
fontResources {
|
|
786
|
+
id
|
|
787
|
+
identifier
|
|
788
|
+
kind
|
|
789
|
+
family
|
|
790
|
+
weights
|
|
791
|
+
files {
|
|
792
|
+
id
|
|
793
|
+
source
|
|
794
|
+
preview
|
|
795
|
+
mimeType
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
brandingAssets(ids: $ids) {
|
|
799
|
+
id
|
|
800
|
+
source
|
|
801
|
+
preview
|
|
802
|
+
mimeType
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
`;
|
|
707
806
|
//# sourceMappingURL=queries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/commerce/queries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/commerce/queries.ts"],"names":[],"mappings":"AAQA,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BjC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAoDnB,yBAAyB;;;CAGhC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAoDzB,yBAAyB;;;CAGhC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B5B,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;CAU1B,CAAC;AAIF,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;CAgB/B,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2B7B,CAAC;AAIF,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;CAgB9B,CAAC;AAOF,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;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CActC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;QAQ1B,8BAA8B;;;CAGrC,CAAC;AAIF,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;CAc9B,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;CAiBjC,CAAC;AAIF,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuB1C,CAAC;AAIF,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;CAMjC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;CAM/B,CAAC;AAIF,MAAM,YAAY,GAAG;;;;;;;;CAQpB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;;;gBAGT,YAAY;;;;CAI3B,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;;yBAEC,YAAY;;CAEpC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;;0CAEM,YAAY;;CAErD,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;;6BAEC,YAAY;;CAExC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG;;gDAEiB,YAAY;;CAE3D,CAAC;AAOF,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B3B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HttpClient } from '../core/http.js';
|
|
2
|
+
import type { CreateQuoteRequestInput, Order, Quote, QuoteList, QuoteListOptions } from '../types.js';
|
|
3
|
+
export declare function createQuotesMethods(http: HttpClient): {
|
|
4
|
+
getMyQuotes(options?: QuoteListOptions): Promise<QuoteList>;
|
|
5
|
+
getMyQuote(id: string): Promise<Quote | null>;
|
|
6
|
+
createQuoteRequest(input: CreateQuoteRequestInput): Promise<Quote>;
|
|
7
|
+
acceptQuote(id: string): Promise<Order>;
|
|
8
|
+
cancelMyQuote(id: string, reason?: string): Promise<Quote>;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=quotes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quotes.d.ts","sourceRoot":"","sources":["../../src/commerce/quotes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EACV,uBAAuB,EACvB,KAAK,EACL,KAAK,EACL,SAAS,EACT,gBAAgB,EACjB,MAAM,aAAa,CAAC;AASrB,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU;0BAEpB,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;mBAO5C,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;8BAKnB,uBAAuB,GAAG,OAAO,CAAC,KAAK,CAAC;oBAOlD,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;sBAKrB,MAAM,WAAW,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;EAQnE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ACCEPT_QUOTE, CANCEL_MY_QUOTE, CREATE_QUOTE_REQUEST, MY_QUOTE, MY_QUOTES, } from './queries.js';
|
|
2
|
+
export function createQuotesMethods(http) {
|
|
3
|
+
return {
|
|
4
|
+
async getMyQuotes(options) {
|
|
5
|
+
const data = await http.graphql(MY_QUOTES, {
|
|
6
|
+
options: options ?? null,
|
|
7
|
+
});
|
|
8
|
+
return data.myQuotes;
|
|
9
|
+
},
|
|
10
|
+
async getMyQuote(id) {
|
|
11
|
+
const data = await http.graphql(MY_QUOTE, { id });
|
|
12
|
+
return data.myQuote;
|
|
13
|
+
},
|
|
14
|
+
async createQuoteRequest(input) {
|
|
15
|
+
const data = await http.graphql(CREATE_QUOTE_REQUEST, {
|
|
16
|
+
input,
|
|
17
|
+
});
|
|
18
|
+
return data.createQuoteRequest;
|
|
19
|
+
},
|
|
20
|
+
async acceptQuote(id) {
|
|
21
|
+
const data = await http.graphql(ACCEPT_QUOTE, { id });
|
|
22
|
+
return data.acceptQuote;
|
|
23
|
+
},
|
|
24
|
+
async cancelMyQuote(id, reason) {
|
|
25
|
+
const data = await http.graphql(CANCEL_MY_QUOTE, {
|
|
26
|
+
id,
|
|
27
|
+
reason,
|
|
28
|
+
});
|
|
29
|
+
return data.cancelMyQuote;
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=quotes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quotes.js","sourceRoot":"","sources":["../../src/commerce/quotes.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,SAAS,GACV,MAAM,cAAc,CAAC;AAEtB,MAAM,UAAU,mBAAmB,CAAC,IAAgB;IAClD,OAAO;QACL,KAAK,CAAC,WAAW,CAAC,OAA0B;YAC1C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAA0B,SAAS,EAAE;gBAClE,OAAO,EAAE,OAAO,IAAI,IAAI;aACzB,CAAC,CAAC;YACH,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;QAED,KAAK,CAAC,UAAU,CAAC,EAAU;YACzB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAA4B,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;YAC7E,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;QAED,KAAK,CAAC,kBAAkB,CAAC,KAA8B;YACrD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAgC,oBAAoB,EAAE;gBACnF,KAAK;aACN,CAAC,CAAC;YACH,OAAO,IAAI,CAAC,kBAAkB,CAAC;QACjC,CAAC;QAED,KAAK,CAAC,WAAW,CAAC,EAAU;YAC1B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAyB,YAAY,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;YAC9E,OAAO,IAAI,CAAC,WAAW,CAAC;QAC1B,CAAC;QAED,KAAK,CAAC,aAAa,CAAC,EAAU,EAAE,MAAe;YAC7C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAA2B,eAAe,EAAE;gBACzE,EAAE;gBACF,MAAM;aACP,CAAC,CAAC;YACH,OAAO,IAAI,CAAC,aAAa,CAAC;QAC5B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { HttpClient } from '../core/http.js';
|
|
2
|
-
import type { CreateReviewInput, CreateReviewResult, ProductReview, ReviewAttribute, ReviewAttributeAggregation, ReviewChannelConfig, ReviewListOptions, ReviewMediaUploadResult, ReviewRatingSummary, UpdateReviewInput } from '../types.js';
|
|
2
|
+
import type { CreateReviewInput, CreateReviewResult, ProductReview, RecentReviewsOptions, ReviewAttribute, ReviewAttributeAggregation, ReviewChannelConfig, ReviewListOptions, ReviewMediaUploadResult, ReviewRatingSummary, UpdateReviewInput } from '../types.js';
|
|
3
3
|
export declare function createReviewMethods(http: HttpClient): {
|
|
4
4
|
getProductReviews(productId: string, options?: ReviewListOptions): Promise<{
|
|
5
5
|
items: ProductReview[];
|
|
6
6
|
totalItems: number;
|
|
7
7
|
nextCursor: string | null;
|
|
8
8
|
}>;
|
|
9
|
+
getRecentProductReviews(options?: RecentReviewsOptions): Promise<ProductReview[]>;
|
|
9
10
|
getReviewRatingSummary(productId: string): Promise<ReviewRatingSummary>;
|
|
10
11
|
getReviewAttributeAggregations(productId: string): Promise<ReviewAttributeAggregation[]>;
|
|
11
12
|
getReviewAttributes(productId?: string): Promise<ReviewAttribute[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviews.d.ts","sourceRoot":"","sources":["../../src/commerce/reviews.ts"],"names":[],"mappings":"AAAA,O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BAKrB,MAAM,aAAa,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;2BAQ3C,MAAM,UAAU,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;6BAQvC,IAAI,EAAE,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC;EAc7E"}
|
package/dist/commerce/reviews.js
CHANGED
|
@@ -15,6 +15,11 @@ const GET_PRODUCT_REVIEWS = `
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
`;
|
|
18
|
+
const GET_RECENT_PRODUCT_REVIEWS = `
|
|
19
|
+
query RecentProductReviews($options: RecentReviewsOptions) {
|
|
20
|
+
recentProductReviews(options: $options) { ${REVIEW_FRAGMENT} }
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
18
23
|
const GET_RATING_SUMMARY = `
|
|
19
24
|
query ProductRatingSummary($productId: ID!) {
|
|
20
25
|
productRatingSummary(productId: $productId) {
|
|
@@ -92,6 +97,10 @@ export function createReviewMethods(http) {
|
|
|
92
97
|
const data = await http.graphql(GET_PRODUCT_REVIEWS, { productId, options });
|
|
93
98
|
return data.productReviews;
|
|
94
99
|
},
|
|
100
|
+
async getRecentProductReviews(options) {
|
|
101
|
+
const data = await http.graphql(GET_RECENT_PRODUCT_REVIEWS, { options });
|
|
102
|
+
return data.recentProductReviews;
|
|
103
|
+
},
|
|
95
104
|
async getReviewRatingSummary(productId) {
|
|
96
105
|
const data = await http.graphql(GET_RATING_SUMMARY, { productId });
|
|
97
106
|
return data.productRatingSummary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reviews.js","sourceRoot":"","sources":["../../src/commerce/reviews.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reviews.js","sourceRoot":"","sources":["../../src/commerce/reviews.ts"],"names":[],"mappings":"AAeA,MAAM,eAAe,GAAG;;;;;;;CAOvB,CAAC;AAEF,MAAM,mBAAmB,GAAG;;;gBAGZ,eAAe;;;;;CAK9B,CAAC;AAEF,MAAM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AC,mBAAmB,CAAC;QAClC,CAAC;QAED,KAAK,CAAC,UAAU,CAAC,QAAgB,EAAE,SAAkB;YACnD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAiC,WAAW,EAAE;gBAC3E,QAAQ;gBACR,SAAS;aACV,CAAC,CAAC;YACH,OAAO,IAAI,CAAC,iBAAiB,CAAC;QAChC,CAAC;QAED,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE,MAAc;YACjD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAmC,aAAa,EAAE;gBAC/E,QAAQ;gBACR,MAAM;aACP,CAAC,CAAC;YACH,OAAO,IAAI,CAAC,mBAAmB,CAAC;QAClC,CAAC;QAED,KAAK,CAAC,iBAAiB,CAAC,KAAa;YACnC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAgB,CAAC;YACxC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;gBAC5B,OAAO,CAAC,GAAG,CAAC,mBAAmB,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;YACxD,CAAC,CAAC,CAAC;YAEH,MAAM,SAAS,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YAEnD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CAElC,mBAAmB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;YAC5C,OAAO,IAAI,CAAC,iBAAiB,CAAC;QAChC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HttpClient } from '../core/http.js';
|
|
2
|
+
import type { StockNotificationSubscriptionResult } from '../types.js';
|
|
3
|
+
export declare function createStockNotificationsMethods(http: HttpClient): {
|
|
4
|
+
subscribeToStockNotification(productVariantId: string, emailAddress?: string): Promise<StockNotificationSubscriptionResult>;
|
|
5
|
+
unsubscribeFromStockNotification(token: string): Promise<boolean>;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=stock-notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stock-notifications.d.ts","sourceRoot":"","sources":["../../src/commerce/stock-notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,aAAa,CAAC;AA2CvE,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,UAAU;mDAUxC,MAAM,iBACT,MAAM,GACpB,OAAO,CAAC,mCAAmC,CAAC;4CAwBD,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;EAQ1E"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { MutationError } from '../errors.js';
|
|
2
|
+
const SUBSCRIBE_TO_STOCK_NOTIFICATION = `
|
|
3
|
+
mutation SubscribeToStockNotification($productVariantId: ID!, $emailAddress: String) {
|
|
4
|
+
subscribeToStockNotification(
|
|
5
|
+
productVariantId: $productVariantId
|
|
6
|
+
emailAddress: $emailAddress
|
|
7
|
+
) {
|
|
8
|
+
__typename
|
|
9
|
+
... on StockNotificationSubscription {
|
|
10
|
+
id
|
|
11
|
+
productVariantId
|
|
12
|
+
emailAddress
|
|
13
|
+
createdAt
|
|
14
|
+
}
|
|
15
|
+
... on ErrorResult {
|
|
16
|
+
errorCode
|
|
17
|
+
message
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
const UNSUBSCRIBE_FROM_STOCK_NOTIFICATION = `
|
|
23
|
+
mutation UnsubscribeFromStockNotification($token: String!) {
|
|
24
|
+
unsubscribeFromStockNotification(token: $token)
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
export function createStockNotificationsMethods(http) {
|
|
28
|
+
return {
|
|
29
|
+
async subscribeToStockNotification(productVariantId, emailAddress) {
|
|
30
|
+
const data = await http.graphql(SUBSCRIBE_TO_STOCK_NOTIFICATION, { productVariantId, emailAddress });
|
|
31
|
+
const result = data.subscribeToStockNotification;
|
|
32
|
+
if (result.__typename === 'StockNotificationSubscription') {
|
|
33
|
+
return {
|
|
34
|
+
id: result.id ?? '',
|
|
35
|
+
productVariantId: result.productVariantId ?? '',
|
|
36
|
+
emailAddress: result.emailAddress ?? '',
|
|
37
|
+
createdAt: result.createdAt ?? '',
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
throw new MutationError(result.errorCode ?? 'STOCK_NOTIFICATION_ERROR', result.message ?? 'Stock notification subscription failed');
|
|
41
|
+
},
|
|
42
|
+
async unsubscribeFromStockNotification(token) {
|
|
43
|
+
const data = await http.graphql(UNSUBSCRIBE_FROM_STOCK_NOTIFICATION, { token });
|
|
44
|
+
return data.unsubscribeFromStockNotification;
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=stock-notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stock-notifications.js","sourceRoot":"","sources":["../../src/commerce/stock-notifications.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;CAmBvC,CAAC;AAEF,MAAM,mCAAmC,GAAG;;;;CAI3C,CAAC;AAgBF,MAAM,UAAU,+BAA+B,CAAC,IAAgB;IAC9D,OAAO;QAQL,KAAK,CAAC,4BAA4B,CAChC,gBAAwB,EACxB,YAAqB;YAErB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAC7B,+BAA+B,EAC/B,EAAE,gBAAgB,EAAE,YAAY,EAAE,CACnC,CAAC;YACF,MAAM,MAAM,GAAG,IAAI,CAAC,4BAA4B,CAAC;YACjD,IAAI,MAAM,CAAC,UAAU,KAAK,+BAA+B,EAAE,CAAC;gBAC1D,OAAO;oBACL,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE;oBACnB,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,IAAI,EAAE;oBAC/C,YAAY,EAAE,MAAM,CAAC,YAAY,IAAI,EAAE;oBACvC,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE;iBAClC,CAAC;YACJ,CAAC;YACD,MAAM,IAAI,aAAa,CACrB,MAAM,CAAC,SAAS,IAAI,0BAA0B,EAC9C,MAAM,CAAC,OAAO,IAAI,wCAAwC,CAC3D,CAAC;QACJ,CAAC;QAMD,KAAK,CAAC,gCAAgC,CAAC,KAAa;YAClD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAC7B,mCAAmC,EACnC,EAAE,KAAK,EAAE,CACV,CAAC;YACF,OAAO,IAAI,CAAC,gCAAgC,CAAC;QAC/C,CAAC;KACF,CAAC;AACJ,CAAC"}
|