@drawbridge/drawbridge-utils 0.0.176 → 0.0.178

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.
Files changed (69) hide show
  1. package/dist/admin-B9ZaLvan.d.cts +697 -0
  2. package/dist/admin-C3HtEM6h.d.ts +697 -0
  3. package/dist/billing-Bc4yo9XG.d.cts +175 -0
  4. package/dist/billing-mNsKflmQ.d.ts +175 -0
  5. package/dist/billing.d.cts +1 -1
  6. package/dist/billing.d.ts +1 -1
  7. package/dist/connections/index.cjs +3391 -271
  8. package/dist/connections/index.d.cts +13 -4
  9. package/dist/connections/index.d.ts +13 -4
  10. package/dist/connections/index.js +3388 -270
  11. package/dist/features.cjs +3080 -241
  12. package/dist/features.d.cts +13 -4
  13. package/dist/features.d.ts +13 -4
  14. package/dist/features.js +3120 -275
  15. package/dist/http.cjs +10 -1
  16. package/dist/http.d.cts +10 -1
  17. package/dist/http.d.ts +10 -1
  18. package/dist/http.js +10 -1
  19. package/dist/{index-qY18QITf.d.cts → index-C2rxasGZ.d.cts} +2670 -354
  20. package/dist/{index-B8JhYfvU.d.ts → index-DOYCXtd7.d.ts} +2670 -354
  21. package/dist/oauth/index.d.cts +1 -1
  22. package/dist/oauth/index.d.ts +1 -1
  23. package/dist/oauth-BJDh0sdM.d.cts +527 -0
  24. package/dist/oauth-DveZMLHx.d.ts +527 -0
  25. package/dist/partner-BOZltuh2.d.ts +94 -0
  26. package/dist/partner-ed2OfW1J.d.cts +94 -0
  27. package/dist/plans.cjs +3079 -240
  28. package/dist/plans.d.cts +13 -4
  29. package/dist/plans.d.ts +13 -4
  30. package/dist/plans.js +3120 -275
  31. package/dist/pricing.cjs +3112 -273
  32. package/dist/pricing.d.cts +13 -4
  33. package/dist/pricing.d.ts +13 -4
  34. package/dist/pricing.js +3117 -272
  35. package/dist/providers.cjs +3082 -262
  36. package/dist/providers.d.cts +12 -3
  37. package/dist/providers.d.ts +12 -3
  38. package/dist/providers.js +3086 -260
  39. package/dist/sendgrid.cjs +10 -1
  40. package/dist/sendgrid.js +10 -1
  41. package/dist/shopify/admin.cjs +562 -0
  42. package/dist/shopify/admin.d.cts +3 -0
  43. package/dist/shopify/admin.d.ts +3 -0
  44. package/dist/shopify/admin.js +528 -0
  45. package/dist/shopify/billing.cjs +166 -0
  46. package/dist/shopify/billing.d.cts +3 -0
  47. package/dist/shopify/billing.d.ts +3 -0
  48. package/dist/shopify/billing.js +140 -0
  49. package/dist/shopify/constants.cjs +63 -0
  50. package/dist/shopify/constants.d.cts +58 -0
  51. package/dist/shopify/constants.d.ts +58 -0
  52. package/dist/shopify/constants.js +32 -0
  53. package/dist/shopify/oauth.cjs +509 -0
  54. package/dist/shopify/oauth.d.cts +7 -0
  55. package/dist/shopify/oauth.d.ts +7 -0
  56. package/dist/shopify/oauth.js +466 -0
  57. package/dist/shopify/partner.cjs +156 -0
  58. package/dist/shopify/partner.d.cts +3 -0
  59. package/dist/shopify/partner.d.ts +3 -0
  60. package/dist/shopify/partner.js +130 -0
  61. package/dist/shopify/storefront.cjs +611 -0
  62. package/dist/shopify/storefront.d.cts +3 -0
  63. package/dist/shopify/storefront.d.ts +3 -0
  64. package/dist/shopify/storefront.js +576 -0
  65. package/dist/storefront-C8FKOGeD.d.cts +659 -0
  66. package/dist/storefront-DJFGLqPl.d.ts +659 -0
  67. package/dist/twilio.cjs +10 -1
  68. package/dist/twilio.js +10 -1
  69. package/package.json +98 -68
@@ -0,0 +1,611 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // lib/shopify/storefront.js
20
+ var storefront_exports = {};
21
+ __export(storefront_exports, {
22
+ cartCreate: () => cartCreate,
23
+ cartGet: () => cartGet,
24
+ cartLinesAdd: () => cartLinesAdd,
25
+ cartLinesRemove: () => cartLinesRemove,
26
+ cartLinesUpdate: () => cartLinesUpdate,
27
+ createCheckoutToken: () => createCheckoutToken,
28
+ getProduct: () => getProduct,
29
+ getProductVariantsPage: () => getProductVariantsPage,
30
+ getProducts: () => getProducts,
31
+ probeVariantsOutOfStock: () => probeVariantsOutOfStock
32
+ });
33
+ module.exports = __toCommonJS(storefront_exports);
34
+
35
+ // lib/http.js
36
+ var DEFAULT_TIMEOUT_MS = 15e3;
37
+ var request = async ({
38
+ body,
39
+ // THE TRANSPORT, injectable and defaulted to the real one.
40
+ //
41
+ // Every other vendor client in this package takes a `fetcher` — it is how
42
+ // klaviyo, mailchimp and attentive are tested without a network, and it is a
43
+ // declared HOOK_OPTION. The Shopify client had no seam at all, so the only way
44
+ // to test a hook that used it was to inject the whole SDK namespace; that
45
+ // injection existed to work around an import cycle, and when the cycle went
46
+ // the tests lost their only hold. This is the seam they should have had.
47
+ fetcher = fetch,
48
+ headers = {},
49
+ method = "GET",
50
+ query,
51
+ timeout = DEFAULT_TIMEOUT_MS,
52
+ type = "json",
53
+ url
54
+ }) => {
55
+ const fullUrl = new URL(url);
56
+ if (query) {
57
+ Object.entries(query).forEach(([k, v]) => fullUrl.searchParams.set(k, v));
58
+ }
59
+ ;
60
+ const isForm = type === "form";
61
+ const response = await fetcher(fullUrl.toString(), {
62
+ method,
63
+ headers: {
64
+ "Content-Type": isForm ? "application/x-www-form-urlencoded" : "application/json",
65
+ ...headers
66
+ },
67
+ signal: AbortSignal.timeout(timeout),
68
+ ...body !== void 0 && {
69
+ body: isForm ? new URLSearchParams(body).toString() : JSON.stringify(body)
70
+ }
71
+ });
72
+ if (!response.ok) {
73
+ const text2 = await response.text().catch(() => "");
74
+ const error = new Error(text2 || response.statusText);
75
+ error.status = response.status;
76
+ throw error;
77
+ }
78
+ ;
79
+ const text = await response.text();
80
+ try {
81
+ return text ? JSON.parse(text) : null;
82
+ } catch {
83
+ return null;
84
+ }
85
+ };
86
+
87
+ // lib/shopify/constants.js
88
+ var SHOPIFY_STOREFRONT_API_VERSION = "2025-01";
89
+ var REFRESH_TOKEN_LIFETIME_MS = 90 * 24 * 60 * 60 * 1e3;
90
+ var ACCESS_TOKEN_REFRESH_BUFFER_MS = 5 * 60 * 1e3;
91
+ var PARTNER_API_VERSION = process.env.SHOPIFY_PARTNER_API_VERSION || "2026-07";
92
+
93
+ // lib/shopify/storefront.js
94
+ var SORT_KEY_MAP = {
95
+ bestSelling: "BEST_SELLING",
96
+ createdAt: "CREATED_AT",
97
+ id: "ID",
98
+ price: "PRICE",
99
+ productType: "PRODUCT_TYPE",
100
+ title: "TITLE",
101
+ updatedAt: "UPDATED_AT",
102
+ vendor: "VENDOR"
103
+ };
104
+ var resolveProductSort = (sort) => {
105
+ const entry = sort && Object.entries(sort)[0];
106
+ if (!entry) return null;
107
+ const [field, direction] = entry;
108
+ const sortKey = SORT_KEY_MAP[field];
109
+ if (!sortKey) return null;
110
+ return {
111
+ sortKey,
112
+ reverse: Number(direction) < 0
113
+ };
114
+ };
115
+ var storefrontUrl = (domain) => `https://${domain}/api/${SHOPIFY_STOREFRONT_API_VERSION}/graphql.json`;
116
+ var storefrontFetch = async ({ fetcher, domain, storefrontAccessToken, query, variables }) => {
117
+ return request({
118
+ method: "POST",
119
+ url: storefrontUrl(domain),
120
+ headers: {
121
+ "X-Shopify-Storefront-Access-Token": storefrontAccessToken
122
+ },
123
+ body: {
124
+ query,
125
+ ...variables && { variables }
126
+ }
127
+ });
128
+ };
129
+ var shopCountryCache = {};
130
+ var getShopCountry = async ({ domain, fetcher, storefrontAccessToken }) => {
131
+ var _a, _b;
132
+ if (shopCountryCache[domain]) return shopCountryCache[domain];
133
+ const { data } = await storefrontFetch({
134
+ fetcher,
135
+ domain,
136
+ storefrontAccessToken,
137
+ query: `{
138
+ shop {
139
+ paymentSettings {
140
+ countryCode
141
+ }
142
+ }
143
+ }`
144
+ });
145
+ const countryCode = ((_b = (_a = data == null ? void 0 : data.shop) == null ? void 0 : _a.paymentSettings) == null ? void 0 : _b.countryCode) || null;
146
+ if (countryCode) shopCountryCache[domain] = countryCode;
147
+ return countryCode;
148
+ };
149
+ var OUT_OF_STOCK_WARNING_CODES = [
150
+ "MERCHANDISE_OUT_OF_STOCK",
151
+ "MERCHANDISE_NOT_ENOUGH_STOCK"
152
+ ];
153
+ var probeVariantsOutOfStock = async ({ fetcher, domain, storefrontAccessToken, variantIds, countryCode }) => {
154
+ var _a, _b;
155
+ if (!(variantIds == null ? void 0 : variantIds.length)) return [];
156
+ const resolvedCountry = countryCode || await getShopCountry({ domain, fetcher, storefrontAccessToken });
157
+ const { data, errors } = await storefrontFetch({
158
+ fetcher,
159
+ domain,
160
+ storefrontAccessToken,
161
+ query: `
162
+ mutation probe( $input : CartInput! ){
163
+ cartCreate( input : $input ){
164
+ cart {
165
+ lines( first : 250 ){
166
+ edges {
167
+ node {
168
+ id
169
+ merchandise {
170
+ ... on ProductVariant {
171
+ id
172
+ }
173
+ }
174
+ }
175
+ }
176
+ }
177
+ }
178
+ warnings {
179
+ code
180
+ message
181
+ target
182
+ }
183
+ }
184
+ }
185
+ `,
186
+ variables: {
187
+ input: {
188
+ lines: variantIds.map((merchandiseId) => ({
189
+ merchandiseId,
190
+ quantity: 1
191
+ })),
192
+ ...resolvedCountry && {
193
+ buyerIdentity: {
194
+ countryCode: resolvedCountry
195
+ }
196
+ }
197
+ }
198
+ }
199
+ });
200
+ if (errors) return [];
201
+ const payload = data == null ? void 0 : data.cartCreate;
202
+ const soldOut = new Set(
203
+ ((payload == null ? void 0 : payload.warnings) || []).filter((warning) => OUT_OF_STOCK_WARNING_CODES.includes(warning == null ? void 0 : warning.code) && (warning == null ? void 0 : warning.target)).map((warning) => warning.target)
204
+ );
205
+ return (((_b = (_a = payload == null ? void 0 : payload.cart) == null ? void 0 : _a.lines) == null ? void 0 : _b.edges) || []).filter(({ node }) => soldOut.has(node.id)).map(({ node }) => {
206
+ var _a2;
207
+ return (_a2 = node == null ? void 0 : node.merchandise) == null ? void 0 : _a2.id;
208
+ }).filter(Boolean);
209
+ };
210
+ var productsQuery = (search, cursor, limit, sort) => {
211
+ const resolved = resolveProductSort(sort);
212
+ const sortArgs = resolved ? `, sortKey: ${resolved.sortKey}, reverse: ${resolved.reverse}` : "";
213
+ return `{
214
+ products(first: ${limit}${search ? `, query: "title:*${search}*"` : ""}${cursor ? `, after: "${cursor}"` : ""}${sortArgs}) {
215
+ edges {
216
+ node {
217
+ id
218
+ title
219
+ description
220
+ handle
221
+ productType
222
+ featuredImage {
223
+ url
224
+ }
225
+ variants(first: 10) {
226
+ edges {
227
+ node {
228
+ id
229
+ title
230
+ image {
231
+ url
232
+ }
233
+ price {
234
+ amount
235
+ currencyCode
236
+ }
237
+ compareAtPrice {
238
+ amount
239
+ currencyCode
240
+ }
241
+ availableForSale
242
+ requiresShipping
243
+ }
244
+ }
245
+ }
246
+ }
247
+ }
248
+ pageInfo {
249
+ endCursor
250
+ hasNextPage
251
+ hasPreviousPage
252
+ startCursor
253
+ }
254
+ }
255
+ }`;
256
+ };
257
+ var productQuery = (productId) => `{
258
+ product(id: "${productId}") {
259
+ id
260
+ title
261
+ description
262
+ handle
263
+ productType
264
+ featuredImage {
265
+ url
266
+ }
267
+ variants(first: 10) {
268
+ edges {
269
+ node {
270
+ id
271
+ title
272
+ image {
273
+ url
274
+ }
275
+ price {
276
+ amount
277
+ currencyCode
278
+ }
279
+ compareAtPrice {
280
+ amount
281
+ currencyCode
282
+ }
283
+ availableForSale
284
+ requiresShipping
285
+ }
286
+ }
287
+ }
288
+ }
289
+ }`;
290
+ var variantsQuery = (productId, cursor) => `{
291
+ product(id: "${productId}") {
292
+ variants(first: 250${cursor ? `, after: "${cursor}"` : ""}) {
293
+ edges {
294
+ node {
295
+ id
296
+ title
297
+ image {
298
+ url
299
+ }
300
+ price {
301
+ amount
302
+ currencyCode
303
+ }
304
+ compareAtPrice {
305
+ amount
306
+ currencyCode
307
+ }
308
+ availableForSale
309
+ requiresShipping
310
+ }
311
+ }
312
+ pageInfo {
313
+ hasNextPage
314
+ endCursor
315
+ }
316
+ }
317
+ }
318
+ }`;
319
+ var getProducts = async ({ fetcher, domain, storefrontAccessToken, search, cursor, limit, sort }) => {
320
+ const { data, errors } = await storefrontFetch({
321
+ fetcher,
322
+ domain,
323
+ storefrontAccessToken,
324
+ query: productsQuery(search, cursor, limit, sort)
325
+ });
326
+ if (errors) {
327
+ throw new Error("Failed to fetch Shopify products");
328
+ }
329
+ ;
330
+ return data == null ? void 0 : data.products;
331
+ };
332
+ var getProduct = async ({ fetcher, domain, storefrontAccessToken, productId }) => {
333
+ var _a;
334
+ const { data, errors } = await storefrontFetch({
335
+ fetcher,
336
+ domain,
337
+ storefrontAccessToken,
338
+ query: productQuery(productId)
339
+ });
340
+ if (errors) {
341
+ throw new Error("Shopify storefront error: " + ((_a = errors[0]) == null ? void 0 : _a.message));
342
+ }
343
+ ;
344
+ if (!(data == null ? void 0 : data.product)) {
345
+ throw new Error("Shopify product not found");
346
+ }
347
+ ;
348
+ return data.product;
349
+ };
350
+ var getProductVariantsPage = async ({ fetcher, domain, storefrontAccessToken, productId, cursor }) => {
351
+ var _a;
352
+ const { data, errors } = await storefrontFetch({
353
+ fetcher,
354
+ domain,
355
+ storefrontAccessToken,
356
+ query: variantsQuery(productId, cursor)
357
+ });
358
+ if (errors) {
359
+ throw new Error("Shopify storefront error: " + ((_a = errors[0]) == null ? void 0 : _a.message));
360
+ }
361
+ ;
362
+ if (!(data == null ? void 0 : data.product)) {
363
+ throw new Error("Shopify product not found");
364
+ }
365
+ ;
366
+ return data.product.variants;
367
+ };
368
+ var CART_FIELDS = `
369
+ id
370
+ checkoutUrl
371
+ lines(first: 100) {
372
+ edges {
373
+ node {
374
+ id
375
+ quantity
376
+ merchandise {
377
+ ... on ProductVariant {
378
+ id
379
+ title
380
+ availableForSale
381
+ image {
382
+ url
383
+ }
384
+ price {
385
+ amount
386
+ currencyCode
387
+ }
388
+ product {
389
+ title
390
+ }
391
+ }
392
+ }
393
+ }
394
+ }
395
+ }
396
+ `;
397
+ var mapCart = (cart) => {
398
+ var _a;
399
+ if (!cart) return null;
400
+ return {
401
+ checkoutUrl: cart.checkoutUrl,
402
+ id: cart.id,
403
+ lines: (((_a = cart.lines) == null ? void 0 : _a.edges) || []).map(({ node }) => {
404
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
405
+ return {
406
+ availableForSale: ((_a2 = node == null ? void 0 : node.merchandise) == null ? void 0 : _a2.availableForSale) ?? true,
407
+ currency: ((_c = (_b = node == null ? void 0 : node.merchandise) == null ? void 0 : _b.price) == null ? void 0 : _c.currencyCode) || null,
408
+ id: node.id,
409
+ image: ((_e = (_d = node == null ? void 0 : node.merchandise) == null ? void 0 : _d.image) == null ? void 0 : _e.url) || null,
410
+ price: ((_g = (_f = node == null ? void 0 : node.merchandise) == null ? void 0 : _f.price) == null ? void 0 : _g.amount) || null,
411
+ productTitle: ((_i = (_h = node == null ? void 0 : node.merchandise) == null ? void 0 : _h.product) == null ? void 0 : _i.title) || null,
412
+ quantity: node.quantity,
413
+ variantId: (_j = node == null ? void 0 : node.merchandise) == null ? void 0 : _j.id,
414
+ variantTitle: ((_k = node == null ? void 0 : node.merchandise) == null ? void 0 : _k.title) || null
415
+ };
416
+ })
417
+ };
418
+ };
419
+ var firstUserError = (userErrors) => {
420
+ const error = userErrors == null ? void 0 : userErrors[0];
421
+ if (!error) return null;
422
+ const message = new Error(error.message || "Shopify cart error");
423
+ message.userError = true;
424
+ return message;
425
+ };
426
+ var createCheckoutToken = async ({ fetcher, clientId, clientSecret } = {}) => {
427
+ if (!clientId || !clientSecret) {
428
+ throw new Error("createCheckoutToken requires clientId and clientSecret");
429
+ }
430
+ ;
431
+ const response = await request({
432
+ fetcher,
433
+ method: "POST",
434
+ url: "https://api.shopify.com/auth/access_token",
435
+ body: {
436
+ client_id: clientId,
437
+ client_secret: clientSecret,
438
+ grant_type: "client_credentials"
439
+ }
440
+ });
441
+ const token = response == null ? void 0 : response.access_token;
442
+ if (!token) {
443
+ throw new Error("Failed to create Shopify checkout token");
444
+ }
445
+ ;
446
+ return token;
447
+ };
448
+ var cartCreate = async ({ fetcher, domain, storefrontAccessToken, lines }) => {
449
+ var _a, _b;
450
+ const { data, errors } = await storefrontFetch({
451
+ fetcher,
452
+ domain,
453
+ storefrontAccessToken,
454
+ query: `
455
+ mutation cartCreate($input: CartInput!) {
456
+ cartCreate(input: $input) {
457
+ cart {
458
+ ${CART_FIELDS}
459
+ }
460
+ userErrors {
461
+ field
462
+ message
463
+ }
464
+ }
465
+ }
466
+ `,
467
+ variables: {
468
+ input: {
469
+ lines
470
+ }
471
+ }
472
+ });
473
+ if (errors) {
474
+ throw new Error("Failed to create Shopify cart");
475
+ }
476
+ ;
477
+ const userError = firstUserError((_a = data == null ? void 0 : data.cartCreate) == null ? void 0 : _a.userErrors);
478
+ if (userError) throw userError;
479
+ return mapCart((_b = data == null ? void 0 : data.cartCreate) == null ? void 0 : _b.cart);
480
+ };
481
+ var cartGet = async ({ fetcher, domain, storefrontAccessToken, cartId }) => {
482
+ const { data, errors } = await storefrontFetch({
483
+ fetcher,
484
+ domain,
485
+ storefrontAccessToken,
486
+ query: `
487
+ query cart($id: ID!) {
488
+ cart(id: $id) {
489
+ ${CART_FIELDS}
490
+ }
491
+ }
492
+ `,
493
+ variables: {
494
+ id: cartId
495
+ }
496
+ });
497
+ if (errors) {
498
+ throw new Error("Failed to fetch Shopify cart");
499
+ }
500
+ ;
501
+ return mapCart(data == null ? void 0 : data.cart);
502
+ };
503
+ var cartLinesAdd = async ({ fetcher, domain, storefrontAccessToken, cartId, lines }) => {
504
+ var _a, _b;
505
+ const { data, errors } = await storefrontFetch({
506
+ fetcher,
507
+ domain,
508
+ storefrontAccessToken,
509
+ query: `
510
+ mutation cartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {
511
+ cartLinesAdd(cartId: $cartId, lines: $lines) {
512
+ cart {
513
+ ${CART_FIELDS}
514
+ }
515
+ userErrors {
516
+ field
517
+ message
518
+ }
519
+ }
520
+ }
521
+ `,
522
+ variables: {
523
+ cartId,
524
+ lines
525
+ }
526
+ });
527
+ if (errors) {
528
+ throw new Error("Failed to add Shopify cart lines");
529
+ }
530
+ ;
531
+ const userError = firstUserError((_a = data == null ? void 0 : data.cartLinesAdd) == null ? void 0 : _a.userErrors);
532
+ if (userError) throw userError;
533
+ return mapCart((_b = data == null ? void 0 : data.cartLinesAdd) == null ? void 0 : _b.cart);
534
+ };
535
+ var cartLinesRemove = async ({ fetcher, domain, storefrontAccessToken, cartId, lineIds }) => {
536
+ var _a, _b;
537
+ const { data, errors } = await storefrontFetch({
538
+ fetcher,
539
+ domain,
540
+ storefrontAccessToken,
541
+ query: `
542
+ mutation cartLinesRemove($cartId: ID!, $lineIds: [ID!]!) {
543
+ cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {
544
+ cart {
545
+ ${CART_FIELDS}
546
+ }
547
+ userErrors {
548
+ field
549
+ message
550
+ }
551
+ }
552
+ }
553
+ `,
554
+ variables: {
555
+ cartId,
556
+ lineIds
557
+ }
558
+ });
559
+ if (errors) {
560
+ throw new Error("Failed to remove Shopify cart lines");
561
+ }
562
+ ;
563
+ const userError = firstUserError((_a = data == null ? void 0 : data.cartLinesRemove) == null ? void 0 : _a.userErrors);
564
+ if (userError) throw userError;
565
+ return mapCart((_b = data == null ? void 0 : data.cartLinesRemove) == null ? void 0 : _b.cart);
566
+ };
567
+ var cartLinesUpdate = async ({ fetcher, domain, storefrontAccessToken, cartId, lines }) => {
568
+ var _a, _b;
569
+ const { data, errors } = await storefrontFetch({
570
+ fetcher,
571
+ domain,
572
+ storefrontAccessToken,
573
+ query: `
574
+ mutation cartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) {
575
+ cartLinesUpdate(cartId: $cartId, lines: $lines) {
576
+ cart {
577
+ ${CART_FIELDS}
578
+ }
579
+ userErrors {
580
+ field
581
+ message
582
+ }
583
+ }
584
+ }
585
+ `,
586
+ variables: {
587
+ cartId,
588
+ lines
589
+ }
590
+ });
591
+ if (errors) {
592
+ throw new Error("Failed to update Shopify cart lines");
593
+ }
594
+ ;
595
+ const userError = firstUserError((_a = data == null ? void 0 : data.cartLinesUpdate) == null ? void 0 : _a.userErrors);
596
+ if (userError) throw userError;
597
+ return mapCart((_b = data == null ? void 0 : data.cartLinesUpdate) == null ? void 0 : _b.cart);
598
+ };
599
+ // Annotate the CommonJS export names for ESM import in node:
600
+ 0 && (module.exports = {
601
+ cartCreate,
602
+ cartGet,
603
+ cartLinesAdd,
604
+ cartLinesRemove,
605
+ cartLinesUpdate,
606
+ createCheckoutToken,
607
+ getProduct,
608
+ getProductVariantsPage,
609
+ getProducts,
610
+ probeVariantsOutOfStock
611
+ });
@@ -0,0 +1,3 @@
1
+ import '../http.cjs';
2
+ import './constants.cjs';
3
+ export { c as cartCreate, a as cartGet, b as cartLinesAdd, d as cartLinesRemove, e as cartLinesUpdate, f as createCheckoutToken, g as getProduct, h as getProductVariantsPage, i as getProducts, p as probeVariantsOutOfStock } from '../storefront-C8FKOGeD.cjs';
@@ -0,0 +1,3 @@
1
+ import '../http.js';
2
+ import './constants.js';
3
+ export { c as cartCreate, a as cartGet, b as cartLinesAdd, d as cartLinesRemove, e as cartLinesUpdate, f as createCheckoutToken, g as getProduct, h as getProductVariantsPage, i as getProducts, p as probeVariantsOutOfStock } from '../storefront-DJFGLqPl.js';