@builtbystack/sq-shopify-theme-sdk 0.0.23 → 0.0.25

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.
@@ -17,44 +17,34 @@ function ze(e, t) {
17
17
  }
18
18
  return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }));
19
19
  }
20
- const Ce = JSON, Qe = (e) => e.toUpperCase(), Je = (e) => {
21
- const t = {};
22
- return e.forEach((n, r) => {
23
- t[r] = n;
24
- }), t;
25
- }, Xe = (e, t, n) => e.document ? e : {
26
- document: e,
27
- variables: t,
28
- requestHeaders: n,
29
- signal: void 0
30
- }, We = (e, t, n) => e.query ? e : {
31
- query: e,
32
- variables: t,
33
- requestHeaders: n,
34
- signal: void 0
35
- }, Ke = (e, t) => e.documents ? e : {
36
- documents: e,
37
- requestHeaders: t,
38
- signal: void 0
20
+ var ne = function() {
21
+ return ne = Object.assign || function(t) {
22
+ for (var n, r = 1, i = arguments.length; r < i; r++) {
23
+ n = arguments[r];
24
+ for (var s in n)
25
+ Object.prototype.hasOwnProperty.call(n, s) && (t[s] = n[s]);
26
+ }
27
+ return t;
28
+ }, ne.apply(this, arguments);
39
29
  };
40
30
  function K(e, t) {
41
31
  if (!!!e)
42
32
  throw new Error(t);
43
33
  }
44
- function Ze(e) {
34
+ function Je(e) {
45
35
  return typeof e == "object" && e !== null;
46
36
  }
47
- function et(e, t) {
37
+ function Qe(e, t) {
48
38
  if (!!!e)
49
39
  throw new Error(
50
40
  t ?? "Unexpected invariant triggered."
51
41
  );
52
42
  }
53
- const tt = /\r\n|[\n\r]/g;
54
- function pe(e, t) {
43
+ const Xe = /\r\n|[\n\r]/g;
44
+ function he(e, t) {
55
45
  let n = 0, r = 1;
56
- for (const i of e.body.matchAll(tt)) {
57
- if (typeof i.index == "number" || et(!1), i.index >= t)
46
+ for (const i of e.body.matchAll(Xe)) {
47
+ if (typeof i.index == "number" || Qe(!1), i.index >= t)
58
48
  break;
59
49
  n = i.index + i[0].length, r += 1;
60
50
  }
@@ -63,31 +53,31 @@ function pe(e, t) {
63
53
  column: t + 1 - n
64
54
  };
65
55
  }
66
- function nt(e) {
67
- return Se(
56
+ function We(e) {
57
+ return De(
68
58
  e.source,
69
- pe(e.source, e.start)
59
+ he(e.source, e.start)
70
60
  );
71
61
  }
72
- function Se(e, t) {
73
- const n = e.locationOffset.column - 1, r = "".padStart(n) + e.body, i = t.line - 1, s = e.locationOffset.line - 1, o = t.line + s, c = t.line === 1 ? n : 0, h = t.column + c, p = `${e.name}:${o}:${h}
62
+ function De(e, t) {
63
+ const n = e.locationOffset.column - 1, r = "".padStart(n) + e.body, i = t.line - 1, s = e.locationOffset.line - 1, o = t.line + s, c = t.line === 1 ? n : 0, p = t.column + c, h = `${e.name}:${o}:${p}
74
64
  `, m = r.split(/\r\n|[\n\r]/g), y = m[i];
75
65
  if (y.length > 120) {
76
- const C = Math.floor(h / 80), T = h % 80, g = [];
66
+ const C = Math.floor(p / 80), T = p % 80, g = [];
77
67
  for (let N = 0; N < y.length; N += 80)
78
68
  g.push(y.slice(N, N + 80));
79
- return p + Te([
69
+ return h + Te([
80
70
  [`${o} |`, g[0]],
81
71
  ...g.slice(1, C + 1).map((N) => ["|", N]),
82
72
  ["|", "^".padStart(T)],
83
73
  ["|", g[C + 1]]
84
74
  ]);
85
75
  }
86
- return p + Te([
76
+ return h + Te([
87
77
  // Lines specified like this: ["prefix", "string"],
88
78
  [`${o - 1} |`, m[i - 1]],
89
79
  [`${o} |`, y],
90
- ["|", "^".padStart(h)],
80
+ ["|", "^".padStart(p)],
91
81
  [`${o + 1} |`, m[i + 1]]
92
82
  ]);
93
83
  }
@@ -96,7 +86,7 @@ function Te(e) {
96
86
  return t.map(([r, i]) => r.padStart(n) + (i ? " " + i : "")).join(`
97
87
  `);
98
88
  }
99
- function rt(e) {
89
+ function Ke(e) {
100
90
  const t = e[0];
101
91
  return t == null || "kind" in t || "length" in t ? {
102
92
  nodes: t,
@@ -107,7 +97,7 @@ function rt(e) {
107
97
  extensions: e[5]
108
98
  } : t;
109
99
  }
110
- class Ee extends Error {
100
+ class Ce extends Error {
111
101
  /**
112
102
  * An array of `{ line, column }` locations within the source GraphQL document
113
103
  * which correspond to this error.
@@ -148,15 +138,15 @@ class Ee extends Error {
148
138
  */
149
139
  constructor(t, ...n) {
150
140
  var r, i, s;
151
- const { nodes: o, source: c, positions: h, path: p, originalError: m, extensions: y } = rt(n);
152
- super(t), this.name = "GraphQLError", this.path = p ?? void 0, this.originalError = m ?? void 0, this.nodes = Ne(
141
+ const { nodes: o, source: c, positions: p, path: h, originalError: m, extensions: y } = Ke(n);
142
+ super(t), this.name = "GraphQLError", this.path = h ?? void 0, this.originalError = m ?? void 0, this.nodes = Ne(
153
143
  Array.isArray(o) ? o : o ? [o] : void 0
154
144
  );
155
145
  const C = Ne(
156
146
  (r = this.nodes) === null || r === void 0 ? void 0 : r.map((g) => g.loc).filter((g) => g != null)
157
147
  );
158
- this.source = c ?? (C == null || (i = C[0]) === null || i === void 0 ? void 0 : i.source), this.positions = h ?? (C == null ? void 0 : C.map((g) => g.start)), this.locations = h && c ? h.map((g) => pe(c, g)) : C == null ? void 0 : C.map((g) => pe(g.source, g.start));
159
- const T = Ze(
148
+ this.source = c ?? (C == null || (i = C[0]) === null || i === void 0 ? void 0 : i.source), this.positions = p ?? (C == null ? void 0 : C.map((g) => g.start)), this.locations = p && c ? p.map((g) => he(c, g)) : C == null ? void 0 : C.map((g) => he(g.source, g.start));
149
+ const T = Je(
160
150
  m == null ? void 0 : m.extensions
161
151
  ) ? m == null ? void 0 : m.extensions : void 0;
162
152
  this.extensions = (s = y ?? T) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
@@ -183,7 +173,7 @@ class Ee extends Error {
183
173
  value: m.stack,
184
174
  writable: !0,
185
175
  configurable: !0
186
- }) : Error.captureStackTrace ? Error.captureStackTrace(this, Ee) : Object.defineProperty(this, "stack", {
176
+ }) : Error.captureStackTrace ? Error.captureStackTrace(this, Ce) : Object.defineProperty(this, "stack", {
187
177
  value: Error().stack,
188
178
  writable: !0,
189
179
  configurable: !0
@@ -198,12 +188,12 @@ class Ee extends Error {
198
188
  for (const n of this.nodes)
199
189
  n.loc && (t += `
200
190
 
201
- ` + nt(n.loc));
191
+ ` + We(n.loc));
202
192
  else if (this.source && this.locations)
203
193
  for (const n of this.locations)
204
194
  t += `
205
195
 
206
- ` + Se(this.source, n);
196
+ ` + De(this.source, n);
207
197
  return t;
208
198
  }
209
199
  toJSON() {
@@ -216,13 +206,13 @@ class Ee extends Error {
216
206
  function Ne(e) {
217
207
  return e === void 0 || e.length === 0 ? void 0 : e;
218
208
  }
219
- function b(e, t, n) {
220
- return new Ee(`Syntax Error: ${n}`, {
209
+ function x(e, t, n) {
210
+ return new Ce(`Syntax Error: ${n}`, {
221
211
  source: e,
222
212
  positions: [t]
223
213
  });
224
214
  }
225
- class it {
215
+ class Ze {
226
216
  /**
227
217
  * The character offset at which this Node begins.
228
218
  */
@@ -251,7 +241,7 @@ class it {
251
241
  };
252
242
  }
253
243
  }
254
- class De {
244
+ class Oe {
255
245
  /**
256
246
  * The kind of Token.
257
247
  */
@@ -367,15 +357,15 @@ const ke = {
367
357
  UnionTypeExtension: ["name", "directives", "types"],
368
358
  EnumTypeExtension: ["name", "directives", "values"],
369
359
  InputObjectTypeExtension: ["name", "directives", "fields"]
370
- }, st = new Set(Object.keys(ke));
360
+ }, et = new Set(Object.keys(ke));
371
361
  function Ie(e) {
372
362
  const t = e == null ? void 0 : e.kind;
373
- return typeof t == "string" && st.has(t);
363
+ return typeof t == "string" && et.has(t);
374
364
  }
375
- var M;
365
+ var q;
376
366
  (function(e) {
377
367
  e.QUERY = "query", e.MUTATION = "mutation", e.SUBSCRIPTION = "subscription";
378
- })(M || (M = {}));
368
+ })(q || (q = {}));
379
369
  var fe;
380
370
  (function(e) {
381
371
  e.QUERY = "QUERY", e.MUTATION = "MUTATION", e.SUBSCRIPTION = "SUBSCRIPTION", e.FIELD = "FIELD", e.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", e.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", e.INLINE_FRAGMENT = "INLINE_FRAGMENT", e.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", e.SCHEMA = "SCHEMA", e.SCALAR = "SCALAR", e.OBJECT = "OBJECT", e.FIELD_DEFINITION = "FIELD_DEFINITION", e.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", e.INTERFACE = "INTERFACE", e.UNION = "UNION", e.ENUM = "ENUM", e.ENUM_VALUE = "ENUM_VALUE", e.INPUT_OBJECT = "INPUT_OBJECT", e.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION";
@@ -397,42 +387,42 @@ function Pe(e) {
397
387
  function _e(e) {
398
388
  return Pe(e) || e === 95;
399
389
  }
400
- function ot(e) {
390
+ function tt(e) {
401
391
  return Pe(e) || Y(e) || e === 95;
402
392
  }
403
- function at(e) {
393
+ function nt(e) {
404
394
  var t;
405
395
  let n = Number.MAX_SAFE_INTEGER, r = null, i = -1;
406
396
  for (let o = 0; o < e.length; ++o) {
407
397
  var s;
408
- const c = e[o], h = ut(c);
409
- h !== c.length && (r = (s = r) !== null && s !== void 0 ? s : o, i = o, o !== 0 && h < n && (n = h));
398
+ const c = e[o], p = rt(c);
399
+ p !== c.length && (r = (s = r) !== null && s !== void 0 ? s : o, i = o, o !== 0 && p < n && (n = p));
410
400
  }
411
401
  return e.map((o, c) => c === 0 ? o : o.slice(n)).slice(
412
402
  (t = r) !== null && t !== void 0 ? t : 0,
413
403
  i + 1
414
404
  );
415
405
  }
416
- function ut(e) {
406
+ function rt(e) {
417
407
  let t = 0;
418
408
  for (; t < e.length && me(e.charCodeAt(t)); )
419
409
  ++t;
420
410
  return t;
421
411
  }
422
- function ct(e, t) {
423
- const n = e.replace(/"""/g, '\\"""'), r = n.split(/\r\n|[\n\r]/g), i = r.length === 1, s = r.length > 1 && r.slice(1).every((T) => T.length === 0 || me(T.charCodeAt(0))), o = n.endsWith('\\"""'), c = e.endsWith('"') && !o, h = e.endsWith("\\"), p = c || h, m = !(t != null && t.minimize) && // add leading and trailing new lines only if it improves readability
424
- (!i || e.length > 70 || p || s || o);
412
+ function it(e, t) {
413
+ const n = e.replace(/"""/g, '\\"""'), r = n.split(/\r\n|[\n\r]/g), i = r.length === 1, s = r.length > 1 && r.slice(1).every((T) => T.length === 0 || me(T.charCodeAt(0))), o = n.endsWith('\\"""'), c = e.endsWith('"') && !o, p = e.endsWith("\\"), h = c || p, m = !(t != null && t.minimize) && // add leading and trailing new lines only if it improves readability
414
+ (!i || e.length > 70 || h || s || o);
425
415
  let y = "";
426
416
  const C = i && me(e.charCodeAt(0));
427
417
  return (m && !C || s) && (y += `
428
- `), y += n, (m || p) && (y += `
418
+ `), y += n, (m || h) && (y += `
429
419
  `), '"""' + y + '"""';
430
420
  }
431
421
  var u;
432
422
  (function(e) {
433
423
  e.SOF = "<SOF>", e.EOF = "<EOF>", e.BANG = "!", e.DOLLAR = "$", e.AMP = "&", e.PAREN_L = "(", e.PAREN_R = ")", e.SPREAD = "...", e.COLON = ":", e.EQUALS = "=", e.AT = "@", e.BRACKET_L = "[", e.BRACKET_R = "]", e.BRACE_L = "{", e.PIPE = "|", e.BRACE_R = "}", e.NAME = "Name", e.INT = "Int", e.FLOAT = "Float", e.STRING = "String", e.BLOCK_STRING = "BlockString", e.COMMENT = "Comment";
434
424
  })(u || (u = {}));
435
- class lt {
425
+ class st {
436
426
  /**
437
427
  * The previously focused non-ignored token.
438
428
  */
@@ -446,7 +436,7 @@ class lt {
446
436
  * The character offset at which the current line begins.
447
437
  */
448
438
  constructor(t) {
449
- const n = new De(u.SOF, 0, 0, 0, 0);
439
+ const n = new Oe(u.SOF, 0, 0, 0, 0);
450
440
  this.source = t, this.lastToken = n, this.token = n, this.line = 1, this.lineStart = 0;
451
441
  }
452
442
  get [Symbol.toStringTag]() {
@@ -469,17 +459,17 @@ class lt {
469
459
  if (t.next)
470
460
  t = t.next;
471
461
  else {
472
- const n = ht(this, t.end);
462
+ const n = at(this, t.end);
473
463
  t.next = n, n.prev = t, t = n;
474
464
  }
475
465
  while (t.kind === u.COMMENT);
476
466
  return t;
477
467
  }
478
468
  }
479
- function dt(e) {
469
+ function ot(e) {
480
470
  return e === u.BANG || e === u.DOLLAR || e === u.AMP || e === u.PAREN_L || e === u.PAREN_R || e === u.SPREAD || e === u.COLON || e === u.EQUALS || e === u.AT || e === u.BRACKET_L || e === u.BRACKET_R || e === u.BRACE_L || e === u.PIPE || e === u.BRACE_R;
481
471
  }
482
- function V(e) {
472
+ function G(e) {
483
473
  return e >= 0 && e <= 55295 || e >= 57344 && e <= 1114111;
484
474
  }
485
475
  function se(e, t) {
@@ -503,9 +493,9 @@ function F(e, t) {
503
493
  }
504
494
  function I(e, t, n, r, i) {
505
495
  const s = e.line, o = 1 + n - e.lineStart;
506
- return new De(t, n, r, s, o, i);
496
+ return new Oe(t, n, r, s, o, i);
507
497
  }
508
- function ht(e, t) {
498
+ function at(e, t) {
509
499
  const n = e.source.body, r = n.length;
510
500
  let i = t;
511
501
  for (; i < r; ) {
@@ -524,7 +514,7 @@ function ht(e, t) {
524
514
  n.charCodeAt(i + 1) === 10 ? i += 2 : ++i, ++e.line, e.lineStart = i;
525
515
  continue;
526
516
  case 35:
527
- return pt(e, i);
517
+ return ut(e, i);
528
518
  case 33:
529
519
  return I(e, u.BANG, i, i + 1);
530
520
  case 36:
@@ -556,28 +546,28 @@ function ht(e, t) {
556
546
  case 125:
557
547
  return I(e, u.BRACE_R, i, i + 1);
558
548
  case 34:
559
- return n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34 ? Et(e, i) : mt(e, i);
549
+ return n.charCodeAt(i + 1) === 34 && n.charCodeAt(i + 2) === 34 ? ft(e, i) : lt(e, i);
560
550
  }
561
551
  if (Y(s) || s === 45)
562
- return ft(e, i, s);
552
+ return ct(e, i, s);
563
553
  if (_e(s))
564
- return vt(e, i);
565
- throw b(
554
+ return mt(e, i);
555
+ throw x(
566
556
  e.source,
567
557
  i,
568
- s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : V(s) || se(n, i) ? `Unexpected character: ${F(e, i)}.` : `Invalid character: ${F(e, i)}.`
558
+ s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : G(s) || se(n, i) ? `Unexpected character: ${F(e, i)}.` : `Invalid character: ${F(e, i)}.`
569
559
  );
570
560
  }
571
561
  return I(e, u.EOF, r, r);
572
562
  }
573
- function pt(e, t) {
563
+ function ut(e, t) {
574
564
  const n = e.source.body, r = n.length;
575
565
  let i = t + 1;
576
566
  for (; i < r; ) {
577
567
  const s = n.charCodeAt(i);
578
568
  if (s === 10 || s === 13)
579
569
  break;
580
- if (V(s))
570
+ if (G(s))
581
571
  ++i;
582
572
  else if (se(n, i))
583
573
  i += 2;
@@ -592,12 +582,12 @@ function pt(e, t) {
592
582
  n.slice(t + 1, i)
593
583
  );
594
584
  }
595
- function ft(e, t, n) {
585
+ function ct(e, t, n) {
596
586
  const r = e.source.body;
597
587
  let i = t, s = n, o = !1;
598
588
  if (s === 45 && (s = r.charCodeAt(++i)), s === 48) {
599
589
  if (s = r.charCodeAt(++i), Y(s))
600
- throw b(
590
+ throw x(
601
591
  e.source,
602
592
  i,
603
593
  `Invalid number, unexpected digit after 0: ${F(
@@ -608,7 +598,7 @@ function ft(e, t, n) {
608
598
  } else
609
599
  i = ce(e, i, s), s = r.charCodeAt(i);
610
600
  if (s === 46 && (o = !0, s = r.charCodeAt(++i), i = ce(e, i, s), s = r.charCodeAt(i)), (s === 69 || s === 101) && (o = !0, s = r.charCodeAt(++i), (s === 43 || s === 45) && (s = r.charCodeAt(++i)), i = ce(e, i, s), s = r.charCodeAt(i)), s === 46 || _e(s))
611
- throw b(
601
+ throw x(
612
602
  e.source,
613
603
  i,
614
604
  `Invalid number, expected digit but got: ${F(
@@ -626,7 +616,7 @@ function ft(e, t, n) {
626
616
  }
627
617
  function ce(e, t, n) {
628
618
  if (!Y(n))
629
- throw b(
619
+ throw x(
630
620
  e.source,
631
621
  t,
632
622
  `Invalid number, expected digit but got: ${F(
@@ -640,7 +630,7 @@ function ce(e, t, n) {
640
630
  ++i;
641
631
  return i;
642
632
  }
643
- function mt(e, t) {
633
+ function lt(e, t) {
644
634
  const n = e.source.body, r = n.length;
645
635
  let i = t + 1, s = i, o = "";
646
636
  for (; i < r; ) {
@@ -649,18 +639,18 @@ function mt(e, t) {
649
639
  return o += n.slice(s, i), I(e, u.STRING, t, i + 1, o);
650
640
  if (c === 92) {
651
641
  o += n.slice(s, i);
652
- const h = n.charCodeAt(i + 1) === 117 ? n.charCodeAt(i + 2) === 123 ? gt(e, i) : yt(e, i) : Ct(e, i);
653
- o += h.value, i += h.size, s = i;
642
+ const p = n.charCodeAt(i + 1) === 117 ? n.charCodeAt(i + 2) === 123 ? dt(e, i) : pt(e, i) : ht(e, i);
643
+ o += p.value, i += p.size, s = i;
654
644
  continue;
655
645
  }
656
646
  if (c === 10 || c === 13)
657
647
  break;
658
- if (V(c))
648
+ if (G(c))
659
649
  ++i;
660
650
  else if (se(n, i))
661
651
  i += 2;
662
652
  else
663
- throw b(
653
+ throw x(
664
654
  e.source,
665
655
  i,
666
656
  `Invalid character within String: ${F(
@@ -669,15 +659,15 @@ function mt(e, t) {
669
659
  )}.`
670
660
  );
671
661
  }
672
- throw b(e.source, i, "Unterminated string.");
662
+ throw x(e.source, i, "Unterminated string.");
673
663
  }
674
- function gt(e, t) {
664
+ function dt(e, t) {
675
665
  const n = e.source.body;
676
666
  let r = 0, i = 3;
677
667
  for (; i < 12; ) {
678
668
  const s = n.charCodeAt(t + i++);
679
669
  if (s === 125) {
680
- if (i < 5 || !V(r))
670
+ if (i < 5 || !G(r))
681
671
  break;
682
672
  return {
683
673
  value: String.fromCodePoint(r),
@@ -687,7 +677,7 @@ function gt(e, t) {
687
677
  if (r = r << 4 | j(s), r < 0)
688
678
  break;
689
679
  }
690
- throw b(
680
+ throw x(
691
681
  e.source,
692
682
  t,
693
683
  `Invalid Unicode escape sequence: "${n.slice(
@@ -696,34 +686,34 @@ function gt(e, t) {
696
686
  )}".`
697
687
  );
698
688
  }
699
- function yt(e, t) {
700
- const n = e.source.body, r = be(n, t + 2);
701
- if (V(r))
689
+ function pt(e, t) {
690
+ const n = e.source.body, r = xe(n, t + 2);
691
+ if (G(r))
702
692
  return {
703
693
  value: String.fromCodePoint(r),
704
694
  size: 6
705
695
  };
706
696
  if (Le(r) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
707
- const i = be(n, t + 8);
697
+ const i = xe(n, t + 8);
708
698
  if (we(i))
709
699
  return {
710
700
  value: String.fromCodePoint(r, i),
711
701
  size: 12
712
702
  };
713
703
  }
714
- throw b(
704
+ throw x(
715
705
  e.source,
716
706
  t,
717
707
  `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
718
708
  );
719
709
  }
720
- function be(e, t) {
710
+ function xe(e, t) {
721
711
  return j(e.charCodeAt(t)) << 12 | j(e.charCodeAt(t + 1)) << 8 | j(e.charCodeAt(t + 2)) << 4 | j(e.charCodeAt(t + 3));
722
712
  }
723
713
  function j(e) {
724
714
  return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
725
715
  }
726
- function Ct(e, t) {
716
+ function ht(e, t) {
727
717
  const n = e.source.body;
728
718
  switch (n.charCodeAt(t + 1)) {
729
719
  case 34:
@@ -768,7 +758,7 @@ function Ct(e, t) {
768
758
  size: 2
769
759
  };
770
760
  }
771
- throw b(
761
+ throw x(
772
762
  e.source,
773
763
  t,
774
764
  `Invalid character escape sequence: "${n.slice(
@@ -777,39 +767,39 @@ function Ct(e, t) {
777
767
  )}".`
778
768
  );
779
769
  }
780
- function Et(e, t) {
770
+ function ft(e, t) {
781
771
  const n = e.source.body, r = n.length;
782
772
  let i = e.lineStart, s = t + 3, o = s, c = "";
783
- const h = [];
773
+ const p = [];
784
774
  for (; s < r; ) {
785
- const p = n.charCodeAt(s);
786
- if (p === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
787
- c += n.slice(o, s), h.push(c);
775
+ const h = n.charCodeAt(s);
776
+ if (h === 34 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34) {
777
+ c += n.slice(o, s), p.push(c);
788
778
  const m = I(
789
779
  e,
790
780
  u.BLOCK_STRING,
791
781
  t,
792
782
  s + 3,
793
783
  // Return a string of the lines joined with U+000A.
794
- at(h).join(`
784
+ nt(p).join(`
795
785
  `)
796
786
  );
797
- return e.line += h.length - 1, e.lineStart = i, m;
787
+ return e.line += p.length - 1, e.lineStart = i, m;
798
788
  }
799
- if (p === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) {
789
+ if (h === 92 && n.charCodeAt(s + 1) === 34 && n.charCodeAt(s + 2) === 34 && n.charCodeAt(s + 3) === 34) {
800
790
  c += n.slice(o, s), o = s + 1, s += 4;
801
791
  continue;
802
792
  }
803
- if (p === 10 || p === 13) {
804
- c += n.slice(o, s), h.push(c), p === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, c = "", o = s, i = s;
793
+ if (h === 10 || h === 13) {
794
+ c += n.slice(o, s), p.push(c), h === 13 && n.charCodeAt(s + 1) === 10 ? s += 2 : ++s, c = "", o = s, i = s;
805
795
  continue;
806
796
  }
807
- if (V(p))
797
+ if (G(h))
808
798
  ++s;
809
799
  else if (se(n, s))
810
800
  s += 2;
811
801
  else
812
- throw b(
802
+ throw x(
813
803
  e.source,
814
804
  s,
815
805
  `Invalid character within String: ${F(
@@ -818,14 +808,14 @@ function Et(e, t) {
818
808
  )}.`
819
809
  );
820
810
  }
821
- throw b(e.source, s, "Unterminated string.");
811
+ throw x(e.source, s, "Unterminated string.");
822
812
  }
823
- function vt(e, t) {
813
+ function mt(e, t) {
824
814
  const n = e.source.body, r = n.length;
825
815
  let i = t + 1;
826
816
  for (; i < r; ) {
827
817
  const s = n.charCodeAt(i);
828
- if (ot(s))
818
+ if (tt(s))
829
819
  ++i;
830
820
  else
831
821
  break;
@@ -838,8 +828,8 @@ function vt(e, t) {
838
828
  n.slice(t, i)
839
829
  );
840
830
  }
841
- const At = 10, Fe = 2;
842
- function ve(e) {
831
+ const gt = 10, Fe = 2;
832
+ function Ee(e) {
843
833
  return oe(e, []);
844
834
  }
845
835
  function oe(e, t) {
@@ -849,45 +839,45 @@ function oe(e, t) {
849
839
  case "function":
850
840
  return e.name ? `[function ${e.name}]` : "[function]";
851
841
  case "object":
852
- return Tt(e, t);
842
+ return yt(e, t);
853
843
  default:
854
844
  return String(e);
855
845
  }
856
846
  }
857
- function Tt(e, t) {
847
+ function yt(e, t) {
858
848
  if (e === null)
859
849
  return "null";
860
850
  if (t.includes(e))
861
851
  return "[Circular]";
862
852
  const n = [...t, e];
863
- if (Nt(e)) {
853
+ if (Ct(e)) {
864
854
  const r = e.toJSON();
865
855
  if (r !== e)
866
856
  return typeof r == "string" ? r : oe(r, n);
867
857
  } else if (Array.isArray(e))
868
- return bt(e, n);
869
- return It(e, n);
858
+ return vt(e, n);
859
+ return Et(e, n);
870
860
  }
871
- function Nt(e) {
861
+ function Ct(e) {
872
862
  return typeof e.toJSON == "function";
873
863
  }
874
- function It(e, t) {
864
+ function Et(e, t) {
875
865
  const n = Object.entries(e);
876
- return n.length === 0 ? "{}" : t.length > Fe ? "[" + xt(e) + "]" : "{ " + n.map(
866
+ return n.length === 0 ? "{}" : t.length > Fe ? "[" + At(e) + "]" : "{ " + n.map(
877
867
  ([i, s]) => i + ": " + oe(s, t)
878
868
  ).join(", ") + " }";
879
869
  }
880
- function bt(e, t) {
870
+ function vt(e, t) {
881
871
  if (e.length === 0)
882
872
  return "[]";
883
873
  if (t.length > Fe)
884
874
  return "[Array]";
885
- const n = Math.min(At, e.length), r = e.length - n, i = [];
875
+ const n = Math.min(gt, e.length), r = e.length - n, i = [];
886
876
  for (let s = 0; s < n; ++s)
887
877
  i.push(oe(e[s], t));
888
878
  return r === 1 ? i.push("... 1 more item") : r > 1 && i.push(`... ${r} more items`), "[" + i.join(", ") + "]";
889
879
  }
890
- function xt(e) {
880
+ function At(e) {
891
881
  const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
892
882
  if (t === "Object" && typeof e.constructor == "function") {
893
883
  const n = e.constructor.name;
@@ -896,7 +886,7 @@ function xt(e) {
896
886
  }
897
887
  return t;
898
888
  }
899
- const Rt = (
889
+ const Tt = (
900
890
  /* c8 ignore next 6 */
901
891
  // FIXME: https://github.com/graphql/graphql-js/issues/2317
902
892
  globalThis.process && globalThis.process.env.NODE_ENV === "production" ? function(t, n) {
@@ -911,7 +901,7 @@ const Rt = (
911
901
  Symbol.toStringTag in t ? t[Symbol.toStringTag] : (r = t.constructor) === null || r === void 0 ? void 0 : r.name
912
902
  );
913
903
  if (i === s) {
914
- const o = ve(t);
904
+ const o = Ee(t);
915
905
  throw new Error(`Cannot use ${i} "${o}" from another module or realm.
916
906
 
917
907
  Ensure that there is only one instance of "graphql" in the node_modules
@@ -934,7 +924,7 @@ class Be {
934
924
  line: 1,
935
925
  column: 1
936
926
  }) {
937
- typeof t == "string" || K(!1, `Body must be a string. Received: ${ve(t)}.`), this.body = t, this.name = n, this.locationOffset = r, this.locationOffset.line > 0 || K(
927
+ typeof t == "string" || K(!1, `Body must be a string. Received: ${Ee(t)}.`), this.body = t, this.name = n, this.locationOffset = r, this.locationOffset.line > 0 || K(
938
928
  !1,
939
929
  "line in locationOffset is 1-indexed and must be positive."
940
930
  ), this.locationOffset.column > 0 || K(
@@ -946,16 +936,16 @@ class Be {
946
936
  return "Source";
947
937
  }
948
938
  }
949
- function Ot(e) {
950
- return Rt(e, Be);
939
+ function Nt(e) {
940
+ return Tt(e, Be);
951
941
  }
952
942
  function Ue(e, t) {
953
- return new St(e, t).parseDocument();
943
+ return new It(e, t).parseDocument();
954
944
  }
955
- class St {
945
+ class It {
956
946
  constructor(t, n = {}) {
957
- const r = Ot(t) ? t : new Be(t);
958
- this._lexer = new lt(r), this._options = n, this._tokenCounter = 0;
947
+ const r = Nt(t) ? t : new Be(t);
948
+ this._lexer = new st(r), this._options = n, this._tokenCounter = 0;
959
949
  }
960
950
  /**
961
951
  * Converts a name lex token into a name parse node.
@@ -1028,7 +1018,7 @@ class St {
1028
1018
  return this.parseDirectiveDefinition();
1029
1019
  }
1030
1020
  if (t)
1031
- throw b(
1021
+ throw x(
1032
1022
  this._lexer.source,
1033
1023
  this._lexer.token.start,
1034
1024
  "Unexpected description, descriptions are supported only on type definitions."
@@ -1057,7 +1047,7 @@ class St {
1057
1047
  if (this.peek(u.BRACE_L))
1058
1048
  return this.node(t, {
1059
1049
  kind: f.OPERATION_DEFINITION,
1060
- operation: M.QUERY,
1050
+ operation: q.QUERY,
1061
1051
  name: void 0,
1062
1052
  variableDefinitions: [],
1063
1053
  directives: [],
@@ -1081,11 +1071,11 @@ class St {
1081
1071
  const t = this.expectToken(u.NAME);
1082
1072
  switch (t.value) {
1083
1073
  case "query":
1084
- return M.QUERY;
1074
+ return q.QUERY;
1085
1075
  case "mutation":
1086
- return M.MUTATION;
1076
+ return q.MUTATION;
1087
1077
  case "subscription":
1088
- return M.SUBSCRIPTION;
1078
+ return q.SUBSCRIPTION;
1089
1079
  }
1090
1080
  throw this.unexpected(t);
1091
1081
  }
@@ -1302,7 +1292,7 @@ class St {
1302
1292
  if (t)
1303
1293
  if (this.expectToken(u.DOLLAR), this._lexer.token.kind === u.NAME) {
1304
1294
  const r = this._lexer.token.value;
1305
- throw b(
1295
+ throw x(
1306
1296
  this._lexer.source,
1307
1297
  n.start,
1308
1298
  `Unexpected variable "$${r}" in constant value.`
@@ -1649,7 +1639,7 @@ class St {
1649
1639
  */
1650
1640
  parseEnumValueName() {
1651
1641
  if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null")
1652
- throw b(
1642
+ throw x(
1653
1643
  this._lexer.source,
1654
1644
  this._lexer.token.start,
1655
1645
  `${W(
@@ -1922,7 +1912,7 @@ class St {
1922
1912
  * given parsed object.
1923
1913
  */
1924
1914
  node(t, n) {
1925
- return this._options.noLocation !== !0 && (n.loc = new it(
1915
+ return this._options.noLocation !== !0 && (n.loc = new Ze(
1926
1916
  t,
1927
1917
  this._lexer.lastToken,
1928
1918
  this._lexer.source
@@ -1942,10 +1932,10 @@ class St {
1942
1932
  const n = this._lexer.token;
1943
1933
  if (n.kind === t)
1944
1934
  return this.advanceLexer(), n;
1945
- throw b(
1935
+ throw x(
1946
1936
  this._lexer.source,
1947
1937
  n.start,
1948
- `Expected ${Me(t)}, found ${W(n)}.`
1938
+ `Expected ${qe(t)}, found ${W(n)}.`
1949
1939
  );
1950
1940
  }
1951
1941
  /**
@@ -1964,7 +1954,7 @@ class St {
1964
1954
  if (n.kind === u.NAME && n.value === t)
1965
1955
  this.advanceLexer();
1966
1956
  else
1967
- throw b(
1957
+ throw x(
1968
1958
  this._lexer.source,
1969
1959
  n.start,
1970
1960
  `Expected "${t}", found ${W(n)}.`
@@ -1983,7 +1973,7 @@ class St {
1983
1973
  */
1984
1974
  unexpected(t) {
1985
1975
  const n = t ?? this._lexer.token;
1986
- return b(
1976
+ return x(
1987
1977
  this._lexer.source,
1988
1978
  n.start,
1989
1979
  `Unexpected ${W(n)}.`
@@ -2046,7 +2036,7 @@ class St {
2046
2036
  advanceLexer() {
2047
2037
  const { maxTokens: t } = this._options, n = this._lexer.advance();
2048
2038
  if (t !== void 0 && n.kind !== u.EOF && (++this._tokenCounter, this._tokenCounter > t))
2049
- throw b(
2039
+ throw x(
2050
2040
  this._lexer.source,
2051
2041
  n.start,
2052
2042
  `Document contains more that ${t} tokens. Parsing aborted.`
@@ -2055,19 +2045,19 @@ class St {
2055
2045
  }
2056
2046
  function W(e) {
2057
2047
  const t = e.value;
2058
- return Me(e.kind) + (t != null ? ` "${t}"` : "");
2048
+ return qe(e.kind) + (t != null ? ` "${t}"` : "");
2059
2049
  }
2060
- function Me(e) {
2061
- return dt(e) ? `"${e}"` : e;
2050
+ function qe(e) {
2051
+ return ot(e) ? `"${e}"` : e;
2062
2052
  }
2063
- function Dt(e) {
2064
- return `"${e.replace(kt, Pt)}"`;
2053
+ function xt(e) {
2054
+ return `"${e.replace(St, bt)}"`;
2065
2055
  }
2066
- const kt = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
2067
- function Pt(e) {
2068
- return _t[e.charCodeAt(0)];
2056
+ const St = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
2057
+ function bt(e) {
2058
+ return Rt[e.charCodeAt(0)];
2069
2059
  }
2070
- const _t = [
2060
+ const Rt = [
2071
2061
  "\\u0000",
2072
2062
  "\\u0001",
2073
2063
  "\\u0002",
@@ -2233,75 +2223,75 @@ const _t = [
2233
2223
  "\\u009D",
2234
2224
  "\\u009E",
2235
2225
  "\\u009F"
2236
- ], Lt = Object.freeze({});
2237
- function wt(e, t, n = ke) {
2226
+ ], Dt = Object.freeze({});
2227
+ function Ot(e, t, n = ke) {
2238
2228
  const r = /* @__PURE__ */ new Map();
2239
- for (const D of Object.values(f))
2240
- r.set(D, Ft(t, D));
2241
- let i, s = Array.isArray(e), o = [e], c = -1, h = [], p = e, m, y;
2229
+ for (const O of Object.values(f))
2230
+ r.set(O, kt(t, O));
2231
+ let i, s = Array.isArray(e), o = [e], c = -1, p = [], h = e, m, y;
2242
2232
  const C = [], T = [];
2243
2233
  do {
2244
2234
  c++;
2245
- const D = c === o.length, z = D && h.length !== 0;
2246
- if (D) {
2247
- if (m = T.length === 0 ? void 0 : C[C.length - 1], p = y, y = T.pop(), z)
2235
+ const O = c === o.length, z = O && p.length !== 0;
2236
+ if (O) {
2237
+ if (m = T.length === 0 ? void 0 : C[C.length - 1], h = y, y = T.pop(), z)
2248
2238
  if (s) {
2249
- p = p.slice();
2239
+ h = h.slice();
2250
2240
  let k = 0;
2251
- for (const [B, Q] of h) {
2252
- const J = B - k;
2253
- Q === null ? (p.splice(J, 1), k++) : p[J] = Q;
2241
+ for (const [B, J] of p) {
2242
+ const Q = B - k;
2243
+ J === null ? (h.splice(Q, 1), k++) : h[Q] = J;
2254
2244
  }
2255
2245
  } else {
2256
- p = Object.defineProperties(
2246
+ h = Object.defineProperties(
2257
2247
  {},
2258
- Object.getOwnPropertyDescriptors(p)
2248
+ Object.getOwnPropertyDescriptors(h)
2259
2249
  );
2260
- for (const [k, B] of h)
2261
- p[k] = B;
2250
+ for (const [k, B] of p)
2251
+ h[k] = B;
2262
2252
  }
2263
- c = i.index, o = i.keys, h = i.edits, s = i.inArray, i = i.prev;
2253
+ c = i.index, o = i.keys, p = i.edits, s = i.inArray, i = i.prev;
2264
2254
  } else if (y) {
2265
- if (m = s ? c : o[c], p = y[m], p == null)
2255
+ if (m = s ? c : o[c], h = y[m], h == null)
2266
2256
  continue;
2267
2257
  C.push(m);
2268
2258
  }
2269
2259
  let _;
2270
- if (!Array.isArray(p)) {
2260
+ if (!Array.isArray(h)) {
2271
2261
  var g, N;
2272
- Ie(p) || K(!1, `Invalid AST Node: ${ve(p)}.`);
2273
- const k = D ? (g = r.get(p.kind)) === null || g === void 0 ? void 0 : g.leave : (N = r.get(p.kind)) === null || N === void 0 ? void 0 : N.enter;
2274
- if (_ = k == null ? void 0 : k.call(t, p, m, y, C, T), _ === Lt)
2262
+ Ie(h) || K(!1, `Invalid AST Node: ${Ee(h)}.`);
2263
+ const k = O ? (g = r.get(h.kind)) === null || g === void 0 ? void 0 : g.leave : (N = r.get(h.kind)) === null || N === void 0 ? void 0 : N.enter;
2264
+ if (_ = k == null ? void 0 : k.call(t, h, m, y, C, T), _ === Dt)
2275
2265
  break;
2276
2266
  if (_ === !1) {
2277
- if (!D) {
2267
+ if (!O) {
2278
2268
  C.pop();
2279
2269
  continue;
2280
2270
  }
2281
- } else if (_ !== void 0 && (h.push([m, _]), !D))
2271
+ } else if (_ !== void 0 && (p.push([m, _]), !O))
2282
2272
  if (Ie(_))
2283
- p = _;
2273
+ h = _;
2284
2274
  else {
2285
2275
  C.pop();
2286
2276
  continue;
2287
2277
  }
2288
2278
  }
2289
- if (_ === void 0 && z && h.push([m, p]), D)
2279
+ if (_ === void 0 && z && p.push([m, h]), O)
2290
2280
  C.pop();
2291
2281
  else {
2292
- var S;
2282
+ var D;
2293
2283
  i = {
2294
2284
  inArray: s,
2295
2285
  index: c,
2296
2286
  keys: o,
2297
- edits: h,
2287
+ edits: p,
2298
2288
  prev: i
2299
- }, s = Array.isArray(p), o = s ? p : (S = n[p.kind]) !== null && S !== void 0 ? S : [], c = -1, h = [], y && T.push(y), y = p;
2289
+ }, s = Array.isArray(h), o = s ? h : (D = n[h.kind]) !== null && D !== void 0 ? D : [], c = -1, p = [], y && T.push(y), y = h;
2300
2290
  }
2301
2291
  } while (i !== void 0);
2302
- return h.length !== 0 ? h[h.length - 1][1] : e;
2292
+ return p.length !== 0 ? p[p.length - 1][1] : e;
2303
2293
  }
2304
- function Ft(e, t) {
2294
+ function kt(e, t) {
2305
2295
  const n = e[t];
2306
2296
  return typeof n == "object" ? n : typeof n == "function" ? {
2307
2297
  enter: n,
@@ -2311,10 +2301,10 @@ function Ft(e, t) {
2311
2301
  leave: e.leave
2312
2302
  };
2313
2303
  }
2314
- function Bt(e) {
2315
- return wt(e, Mt);
2304
+ function Pt(e) {
2305
+ return Ot(e, Lt);
2316
2306
  }
2317
- const Ut = 80, Mt = {
2307
+ const _t = 80, Lt = {
2318
2308
  Name: {
2319
2309
  leave: (e) => e.value
2320
2310
  },
@@ -2350,7 +2340,7 @@ const Ut = 80, Mt = {
2350
2340
  leave({ alias: e, name: t, arguments: n, directives: r, selectionSet: i }) {
2351
2341
  const s = v("", e, ": ") + t;
2352
2342
  let o = s + v("(", d(n, ", "), ")");
2353
- return o.length > Ut && (o = s + v(`(
2343
+ return o.length > _t && (o = s + v(`(
2354
2344
  `, Z(d(n, `
2355
2345
  `)), `
2356
2346
  )`)), d([o, d(r, " "), i], " ");
@@ -2388,7 +2378,7 @@ const Ut = 80, Mt = {
2388
2378
  leave: ({ value: e }) => e
2389
2379
  },
2390
2380
  StringValue: {
2391
- leave: ({ value: e, block: t }) => t ? ct(e) : Dt(e)
2381
+ leave: ({ value: e, block: t }) => t ? it(e) : xt(e)
2392
2382
  },
2393
2383
  BooleanValue: {
2394
2384
  leave: ({ value: e }) => e ? "true" : "false"
@@ -2449,7 +2439,7 @@ const Ut = 80, Mt = {
2449
2439
  },
2450
2440
  FieldDefinition: {
2451
2441
  leave: ({ description: e, name: t, arguments: n, type: r, directives: i }) => v("", e, `
2452
- `) + t + (xe(n) ? v(`(
2442
+ `) + t + (Se(n) ? v(`(
2453
2443
  `, Z(d(n, `
2454
2444
  `)), `
2455
2445
  )`) : v("(", d(n, ", "), ")")) + ": " + r + v(" ", d(i, " "))
@@ -2495,7 +2485,7 @@ const Ut = 80, Mt = {
2495
2485
  },
2496
2486
  DirectiveDefinition: {
2497
2487
  leave: ({ description: e, name: t, arguments: n, repeatable: r, locations: i }) => v("", e, `
2498
- `) + "directive @" + t + (xe(n) ? v(`(
2488
+ `) + "directive @" + t + (Se(n) ? v(`(
2499
2489
  `, Z(d(n, `
2500
2490
  `)), `
2501
2491
  )`) : v("(", d(n, ", "), ")")) + (r ? " repeatable" : "") + " on " + d(i, " | ")
@@ -2568,969 +2558,1002 @@ function Z(e) {
2568
2558
  return v(" ", e.replace(/\n/g, `
2569
2559
  `));
2570
2560
  }
2571
- function xe(e) {
2561
+ function Se(e) {
2572
2562
  var t;
2573
2563
  return (t = e == null ? void 0 : e.some((n) => n.includes(`
2574
2564
  `))) !== null && t !== void 0 ? t : !1;
2575
2565
  }
2576
- const Re = (e) => {
2577
- var r, i;
2578
- let t;
2579
- const n = e.definitions.filter((s) => s.kind === "OperationDefinition");
2580
- return n.length === 1 && (t = (i = (r = n[0]) == null ? void 0 : r.name) == null ? void 0 : i.value), t;
2581
- }, le = (e) => {
2582
- if (typeof e == "string") {
2583
- let n;
2584
- try {
2585
- const r = Ue(e);
2586
- n = Re(r);
2587
- } catch {
2588
- }
2589
- return { query: e, operationName: n };
2566
+ var ee = /* @__PURE__ */ new Map(), ge = /* @__PURE__ */ new Map(), Me = !0, re = !1;
2567
+ function Ge(e) {
2568
+ return e.replace(/[\s,]+/g, " ").trim();
2569
+ }
2570
+ function wt(e) {
2571
+ return Ge(e.source.body.substring(e.start, e.end));
2572
+ }
2573
+ function Ft(e) {
2574
+ var t = /* @__PURE__ */ new Set(), n = [];
2575
+ return e.definitions.forEach(function(r) {
2576
+ if (r.kind === "FragmentDefinition") {
2577
+ var i = r.name.value, s = wt(r.loc), o = ge.get(i);
2578
+ o && !o.has(s) ? Me && console.warn("Warning: fragment with name " + i + ` already exists.
2579
+ graphql-tag enforces all fragment names across your application to be unique; read more about
2580
+ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : o || ge.set(i, o = /* @__PURE__ */ new Set()), o.add(s), t.has(s) || (t.add(s), n.push(r));
2581
+ } else
2582
+ n.push(r);
2583
+ }), ne(ne({}, e), { definitions: n });
2584
+ }
2585
+ function Bt(e) {
2586
+ var t = new Set(e.definitions);
2587
+ t.forEach(function(r) {
2588
+ r.loc && delete r.loc, Object.keys(r).forEach(function(i) {
2589
+ var s = r[i];
2590
+ s && typeof s == "object" && t.add(s);
2591
+ });
2592
+ });
2593
+ var n = e.loc;
2594
+ return n && (delete n.startToken, delete n.endToken), e;
2595
+ }
2596
+ function Ut(e) {
2597
+ var t = Ge(e);
2598
+ if (!ee.has(t)) {
2599
+ var n = Ue(e, {
2600
+ experimentalFragmentVariables: re,
2601
+ allowLegacyFragmentVariables: re
2602
+ });
2603
+ if (!n || n.kind !== "Document")
2604
+ throw new Error("Not a valid GraphQL document.");
2605
+ ee.set(t, Bt(Ft(n)));
2590
2606
  }
2591
- const t = Re(e);
2592
- return { query: Bt(e), operationName: t };
2607
+ return ee.get(t);
2608
+ }
2609
+ function M(e) {
2610
+ for (var t = [], n = 1; n < arguments.length; n++)
2611
+ t[n - 1] = arguments[n];
2612
+ typeof e == "string" && (e = [e]);
2613
+ var r = e[0];
2614
+ return t.forEach(function(i, s) {
2615
+ i && i.kind === "Document" ? r += i.loc.source.body : r += i, r += e[s + 1];
2616
+ }), Ut(r);
2617
+ }
2618
+ function qt() {
2619
+ ee.clear(), ge.clear();
2620
+ }
2621
+ function Mt() {
2622
+ Me = !1;
2623
+ }
2624
+ function Gt() {
2625
+ re = !0;
2626
+ }
2627
+ function Vt() {
2628
+ re = !1;
2629
+ }
2630
+ var $ = {
2631
+ gql: M,
2632
+ resetCaches: qt,
2633
+ disableFragmentWarnings: Mt,
2634
+ enableExperimentalFragmentVariables: Gt,
2635
+ disableExperimentalFragmentVariables: Vt
2593
2636
  };
2594
- class H extends Error {
2595
- constructor(t, n) {
2596
- const r = `${H.extractMessage(t)}: ${JSON.stringify({
2597
- response: t,
2598
- request: n
2599
- })}`;
2600
- super(r), Object.setPrototypeOf(this, H.prototype), this.response = t, this.request = n, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, H);
2637
+ (function(e) {
2638
+ e.gql = $.gql, e.resetCaches = $.resetCaches, e.disableFragmentWarnings = $.disableFragmentWarnings, e.enableExperimentalFragmentVariables = $.enableExperimentalFragmentVariables, e.disableExperimentalFragmentVariables = $.disableExperimentalFragmentVariables;
2639
+ })(M || (M = {}));
2640
+ M.default = M;
2641
+ const b = M, $t = b`
2642
+ query GetLocationAvailabilities($sku: String!, $first: Int, $after: String, $isReverse: Boolean! = false) {
2643
+ locationAvailabilities(
2644
+ sku: $sku
2645
+ first: $first
2646
+ after: $after
2647
+ isReverse: $isReverse
2648
+ ) {
2649
+ nodes {
2650
+ location {
2651
+ id
2652
+ name
2653
+ phone
2654
+ mapURL
2655
+ tags
2656
+ address {
2657
+ id
2658
+ countryCode
2659
+ country
2660
+ postalCode
2661
+ provinceCode
2662
+ province
2663
+ city
2664
+ address1
2665
+ address2
2666
+ updatedAt
2667
+ createdAt
2668
+ }
2669
+ }
2670
+ inventoryQuantity
2671
+ }
2672
+ pageInfo {
2673
+ startCursor
2674
+ endCursor
2675
+ hasNextPage
2676
+ hasPreviousPage
2677
+ }
2601
2678
  }
2602
- static extractMessage(t) {
2603
- var n, r;
2604
- return ((r = (n = t.errors) == null ? void 0 : n[0]) == null ? void 0 : r.message) ?? `GraphQL Error (Code: ${t.status})`;
2679
+ }
2680
+ `, jt = b`
2681
+ query GetLocationAvailability($sku: String!, $locationID: ID!) {
2682
+ locationAvailability(sku: $sku, locationID: $locationID) {
2683
+ location {
2684
+ id
2685
+ name
2686
+ phone
2687
+ mapURL
2688
+ tags
2689
+ address {
2690
+ id
2691
+ countryCode
2692
+ country
2693
+ postalCode
2694
+ provinceCode
2695
+ province
2696
+ city
2697
+ address1
2698
+ address2
2699
+ updatedAt
2700
+ createdAt
2701
+ }
2702
+ }
2703
+ inventoryQuantity
2605
2704
  }
2606
2705
  }
2607
- var qt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
2608
- function Vt(e) {
2609
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
2706
+ `, Ht = b`
2707
+ query GetPurchasingCustomerMetafield($namespace: String!, $key: String!) {
2708
+ purchasingCustomerMetafield(namespace: $namespace, key: $key) {
2709
+ id
2710
+ namespace
2711
+ key
2712
+ value
2713
+ }
2610
2714
  }
2611
- var ge = { exports: {} };
2612
- (function(e, t) {
2613
- var n = typeof self < "u" ? self : qt, r = function() {
2614
- function s() {
2615
- this.fetch = !1, this.DOMException = n.DOMException;
2715
+ `, Yt = b`
2716
+ query GetPoints {
2717
+ purchasingCustomer {
2718
+ pointsApproved
2719
+ pointsPending
2720
+ pointsExpiringSoon {
2721
+ points
2722
+ expiresDate
2723
+ availableUntil
2616
2724
  }
2617
- return s.prototype = n, new s();
2618
- }();
2619
- (function(s) {
2620
- (function(o) {
2621
- var c = {
2622
- searchParams: "URLSearchParams" in s,
2623
- iterable: "Symbol" in s && "iterator" in Symbol,
2624
- blob: "FileReader" in s && "Blob" in s && function() {
2625
- try {
2626
- return new Blob(), !0;
2627
- } catch {
2628
- return !1;
2629
- }
2630
- }(),
2631
- formData: "FormData" in s,
2632
- arrayBuffer: "ArrayBuffer" in s
2633
- };
2634
- function h(a) {
2635
- return a && DataView.prototype.isPrototypeOf(a);
2636
- }
2637
- if (c.arrayBuffer)
2638
- var p = [
2639
- "[object Int8Array]",
2640
- "[object Uint8Array]",
2641
- "[object Uint8ClampedArray]",
2642
- "[object Int16Array]",
2643
- "[object Uint16Array]",
2644
- "[object Int32Array]",
2645
- "[object Uint32Array]",
2646
- "[object Float32Array]",
2647
- "[object Float64Array]"
2648
- ], m = ArrayBuffer.isView || function(a) {
2649
- return a && p.indexOf(Object.prototype.toString.call(a)) > -1;
2650
- };
2651
- function y(a) {
2652
- if (typeof a != "string" && (a = String(a)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(a))
2653
- throw new TypeError("Invalid character in header field name");
2654
- return a.toLowerCase();
2655
- }
2656
- function C(a) {
2657
- return typeof a != "string" && (a = String(a)), a;
2725
+ }
2726
+ }
2727
+ `, zt = b`
2728
+ query GetLocations($tag: String, $provinceCodes: [String!], $first: Int, $after: String, $isReverse: Boolean! = false) {
2729
+ locations(
2730
+ first: $first
2731
+ after: $after
2732
+ isReverse: $isReverse
2733
+ filter: {tag: $tag, provinceCodes: $provinceCodes}
2734
+ ) {
2735
+ nodes {
2736
+ id
2737
+ name
2738
+ phone
2739
+ mapURL
2740
+ tags
2741
+ address {
2742
+ id
2743
+ countryCode
2744
+ country
2745
+ postalCode
2746
+ provinceCode
2747
+ province
2748
+ city
2749
+ address1
2750
+ address2
2751
+ updatedAt
2752
+ createdAt
2658
2753
  }
2659
- function T(a) {
2660
- var l = {
2661
- next: function() {
2662
- var E = a.shift();
2663
- return { done: E === void 0, value: E };
2664
- }
2665
- };
2666
- return c.iterable && (l[Symbol.iterator] = function() {
2667
- return l;
2668
- }), l;
2669
- }
2670
- function g(a) {
2671
- this.map = {}, a instanceof g ? a.forEach(function(l, E) {
2672
- this.append(E, l);
2673
- }, this) : Array.isArray(a) ? a.forEach(function(l) {
2674
- this.append(l[0], l[1]);
2675
- }, this) : a && Object.getOwnPropertyNames(a).forEach(function(l) {
2676
- this.append(l, a[l]);
2677
- }, this);
2754
+ }
2755
+ pageInfo {
2756
+ startCursor
2757
+ endCursor
2758
+ hasNextPage
2759
+ hasPreviousPage
2760
+ }
2761
+ }
2762
+ }
2763
+ `, Jt = b`
2764
+ query GetPurchasingCustomerDiscounts($first: Int, $after: String, $isReverse: Boolean! = false) {
2765
+ purchasingCustomer {
2766
+ id
2767
+ orderPriceAdjustmentRules(first: $first, after: $after, isReverse: $isReverse) {
2768
+ nodes {
2769
+ id
2770
+ title
2771
+ status
2772
+ description
2773
+ code
2774
+ customerApplicable
2775
+ shopifyStoreApplicable
2776
+ applicableLocationCount
2777
+ hasApplicableLocations
2778
+ startsAt
2779
+ endsAt
2780
+ createdAt
2781
+ updatedAt
2678
2782
  }
2679
- g.prototype.append = function(a, l) {
2680
- a = y(a), l = C(l);
2681
- var E = this.map[a];
2682
- this.map[a] = E ? E + ", " + l : l;
2683
- }, g.prototype.delete = function(a) {
2684
- delete this.map[y(a)];
2685
- }, g.prototype.get = function(a) {
2686
- return a = y(a), this.has(a) ? this.map[a] : null;
2687
- }, g.prototype.has = function(a) {
2688
- return this.map.hasOwnProperty(y(a));
2689
- }, g.prototype.set = function(a, l) {
2690
- this.map[y(a)] = C(l);
2691
- }, g.prototype.forEach = function(a, l) {
2692
- for (var E in this.map)
2693
- this.map.hasOwnProperty(E) && a.call(l, this.map[E], E, this);
2694
- }, g.prototype.keys = function() {
2695
- var a = [];
2696
- return this.forEach(function(l, E) {
2697
- a.push(E);
2698
- }), T(a);
2699
- }, g.prototype.values = function() {
2700
- var a = [];
2701
- return this.forEach(function(l) {
2702
- a.push(l);
2703
- }), T(a);
2704
- }, g.prototype.entries = function() {
2705
- var a = [];
2706
- return this.forEach(function(l, E) {
2707
- a.push([E, l]);
2708
- }), T(a);
2709
- }, c.iterable && (g.prototype[Symbol.iterator] = g.prototype.entries);
2710
- function N(a) {
2711
- if (a.bodyUsed)
2712
- return Promise.reject(new TypeError("Already read"));
2713
- a.bodyUsed = !0;
2783
+ pageInfo {
2784
+ startCursor
2785
+ endCursor
2786
+ hasNextPage
2787
+ hasPreviousPage
2714
2788
  }
2715
- function S(a) {
2716
- return new Promise(function(l, E) {
2717
- a.onload = function() {
2718
- l(a.result);
2719
- }, a.onerror = function() {
2720
- E(a.error);
2721
- };
2722
- });
2789
+ }
2790
+ }
2791
+ }
2792
+ `, Qt = b`
2793
+ query GetPurchasingCustomerDiscountCodeCount {
2794
+ purchasingCustomer {
2795
+ id
2796
+ orderPriceAdjustmentRuleCount
2797
+ }
2798
+ }
2799
+ `, Xt = b`
2800
+ query GetPurchasingCustomerPointChangeActivities($first: Int, $after: String, $isReverse: Boolean! = false, $sortKeys: PointChangeActivitySortKey! = CREATED_AT) {
2801
+ purchasingCustomer {
2802
+ id
2803
+ pointChangeActivities(
2804
+ first: $first
2805
+ after: $after
2806
+ isReverse: $isReverse
2807
+ sortKeys: $sortKeys
2808
+ ) {
2809
+ nodes {
2810
+ id
2811
+ title
2812
+ tenant {
2813
+ id
2814
+ name
2815
+ }
2816
+ pointChange {
2817
+ id
2818
+ delta
2819
+ availableAt
2820
+ expiresDate
2821
+ availableUntil
2822
+ pointChangeCreatedAt
2823
+ tenant {
2824
+ id
2825
+ name
2826
+ }
2827
+ createdAt
2828
+ }
2829
+ retailLocation {
2830
+ id
2831
+ name
2832
+ phone
2833
+ mapURL
2834
+ tags
2835
+ address {
2836
+ id
2837
+ countryCode
2838
+ country
2839
+ postalCode
2840
+ provinceCode
2841
+ province
2842
+ city
2843
+ address1
2844
+ address2
2845
+ updatedAt
2846
+ createdAt
2847
+ }
2848
+ }
2723
2849
  }
2724
- function D(a) {
2725
- var l = new FileReader(), E = S(l);
2726
- return l.readAsArrayBuffer(a), E;
2850
+ pageInfo {
2851
+ startCursor
2852
+ endCursor
2853
+ hasNextPage
2854
+ hasPreviousPage
2727
2855
  }
2728
- function z(a) {
2729
- var l = new FileReader(), E = S(l);
2730
- return l.readAsText(a), E;
2856
+ }
2857
+ }
2858
+ }
2859
+ `, Wt = b`
2860
+ query GetPurchasingCustomerRank {
2861
+ purchasingCustomer {
2862
+ currentCustomerRank {
2863
+ id
2864
+ name
2865
+ threshold
2866
+ higherRank {
2867
+ id
2868
+ name
2869
+ threshold
2731
2870
  }
2732
- function _(a) {
2733
- for (var l = new Uint8Array(a), E = new Array(l.length), R = 0; R < l.length; R++)
2734
- E[R] = String.fromCharCode(l[R]);
2735
- return E.join("");
2871
+ lowerRank {
2872
+ id
2873
+ name
2874
+ threshold
2736
2875
  }
2737
- function k(a) {
2738
- if (a.slice)
2739
- return a.slice(0);
2740
- var l = new Uint8Array(a.byteLength);
2741
- return l.set(new Uint8Array(a)), l.buffer;
2876
+ earnedPointToRankUp
2877
+ purchasePriceToRankUp
2878
+ calculationCondition {
2879
+ customerRankCalculationPeriod {
2880
+ start
2881
+ end
2882
+ }
2883
+ earnedPoint
2884
+ purchasePrice
2742
2885
  }
2743
- function B() {
2744
- return this.bodyUsed = !1, this._initBody = function(a) {
2745
- this._bodyInit = a, a ? typeof a == "string" ? this._bodyText = a : c.blob && Blob.prototype.isPrototypeOf(a) ? this._bodyBlob = a : c.formData && FormData.prototype.isPrototypeOf(a) ? this._bodyFormData = a : c.searchParams && URLSearchParams.prototype.isPrototypeOf(a) ? this._bodyText = a.toString() : c.arrayBuffer && c.blob && h(a) ? (this._bodyArrayBuffer = k(a.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : c.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(a) || m(a)) ? this._bodyArrayBuffer = k(a) : this._bodyText = a = Object.prototype.toString.call(a) : this._bodyText = "", this.headers.get("content-type") || (typeof a == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : c.searchParams && URLSearchParams.prototype.isPrototypeOf(a) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
2746
- }, c.blob && (this.blob = function() {
2747
- var a = N(this);
2748
- if (a)
2749
- return a;
2750
- if (this._bodyBlob)
2751
- return Promise.resolve(this._bodyBlob);
2752
- if (this._bodyArrayBuffer)
2753
- return Promise.resolve(new Blob([this._bodyArrayBuffer]));
2754
- if (this._bodyFormData)
2755
- throw new Error("could not read FormData body as blob");
2756
- return Promise.resolve(new Blob([this._bodyText]));
2757
- }, this.arrayBuffer = function() {
2758
- return this._bodyArrayBuffer ? N(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(D);
2759
- }), this.text = function() {
2760
- var a = N(this);
2761
- if (a)
2762
- return a;
2763
- if (this._bodyBlob)
2764
- return z(this._bodyBlob);
2765
- if (this._bodyArrayBuffer)
2766
- return Promise.resolve(_(this._bodyArrayBuffer));
2767
- if (this._bodyFormData)
2768
- throw new Error("could not read FormData body as text");
2769
- return Promise.resolve(this._bodyText);
2770
- }, c.formData && (this.formData = function() {
2771
- return this.text().then(Ge);
2772
- }), this.json = function() {
2773
- return this.text().then(JSON.parse);
2774
- }, this;
2886
+ pointMultiplier {
2887
+ id
2888
+ customerRankRule {
2889
+ id
2890
+ name
2891
+ threshold
2892
+ }
2893
+ multiplier
2775
2894
  }
2776
- var Q = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
2777
- function J(a) {
2778
- var l = a.toUpperCase();
2779
- return Q.indexOf(l) > -1 ? l : a;
2895
+ }
2896
+ }
2897
+ }
2898
+ `, Kt = b`
2899
+ query GetSharingPurchasingCustomerCount {
2900
+ purchasingCustomer {
2901
+ id
2902
+ sharingPurchasingCustomerCount
2903
+ }
2904
+ }
2905
+ `, Zt = b`
2906
+ query GetPurchasingCustomerSharing {
2907
+ purchasingCustomer {
2908
+ id
2909
+ customerSharing {
2910
+ id
2911
+ purchasingCustomers {
2912
+ id
2913
+ sharingPurchasingCustomerCount
2914
+ tenant {
2915
+ id
2916
+ name
2917
+ }
2780
2918
  }
2781
- function w(a, l) {
2782
- l = l || {};
2783
- var E = l.body;
2784
- if (a instanceof w) {
2785
- if (a.bodyUsed)
2786
- throw new TypeError("Already read");
2787
- this.url = a.url, this.credentials = a.credentials, l.headers || (this.headers = new g(a.headers)), this.method = a.method, this.mode = a.mode, this.signal = a.signal, !E && a._bodyInit != null && (E = a._bodyInit, a.bodyUsed = !0);
2788
- } else
2789
- this.url = String(a);
2790
- if (this.credentials = l.credentials || this.credentials || "same-origin", (l.headers || !this.headers) && (this.headers = new g(l.headers)), this.method = J(l.method || this.method || "GET"), this.mode = l.mode || this.mode || null, this.signal = l.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && E)
2791
- throw new TypeError("Body not allowed for GET or HEAD requests");
2792
- this._initBody(E);
2793
- }
2794
- w.prototype.clone = function() {
2795
- return new w(this, { body: this._bodyInit });
2796
- };
2797
- function Ge(a) {
2798
- var l = new FormData();
2799
- return a.trim().split("&").forEach(function(E) {
2800
- if (E) {
2801
- var R = E.split("="), x = R.shift().replace(/\+/g, " "), A = R.join("=").replace(/\+/g, " ");
2802
- l.append(decodeURIComponent(x), decodeURIComponent(A));
2803
- }
2804
- }), l;
2805
- }
2806
- function $e(a) {
2807
- var l = new g(), E = a.replace(/\r?\n[\t ]+/g, " ");
2808
- return E.split(/\r?\n/).forEach(function(R) {
2809
- var x = R.split(":"), A = x.shift().trim();
2810
- if (A) {
2811
- var X = x.join(":").trim();
2812
- l.append(A, X);
2813
- }
2814
- }), l;
2815
- }
2816
- B.call(w.prototype);
2817
- function L(a, l) {
2818
- l || (l = {}), this.type = "default", this.status = l.status === void 0 ? 200 : l.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in l ? l.statusText : "OK", this.headers = new g(l.headers), this.url = l.url || "", this._initBody(a);
2819
- }
2820
- B.call(L.prototype), L.prototype.clone = function() {
2821
- return new L(this._bodyInit, {
2822
- status: this.status,
2823
- statusText: this.statusText,
2824
- headers: new g(this.headers),
2825
- url: this.url
2826
- });
2827
- }, L.error = function() {
2828
- var a = new L(null, { status: 0, statusText: "" });
2829
- return a.type = "error", a;
2830
- };
2831
- var je = [301, 302, 303, 307, 308];
2832
- L.redirect = function(a, l) {
2833
- if (je.indexOf(l) === -1)
2834
- throw new RangeError("Invalid status code");
2835
- return new L(null, { status: l, headers: { location: a } });
2836
- }, o.DOMException = s.DOMException;
2837
- try {
2838
- new o.DOMException();
2839
- } catch {
2840
- o.DOMException = function(l, E) {
2841
- this.message = l, this.name = E;
2842
- var R = Error(l);
2843
- this.stack = R.stack;
2844
- }, o.DOMException.prototype = Object.create(Error.prototype), o.DOMException.prototype.constructor = o.DOMException;
2919
+ }
2920
+ }
2921
+ }
2922
+ `, en = b`
2923
+ query GetProduct($id: String!, $first: Int, $after: String, $isReverse: Boolean! = false, $sortKeys: ProductVariantSortKeys! = CREATED_AT) {
2924
+ productByProductShopifyLegacyResourceID(productShopifyLegacyResourceID: $id) {
2925
+ id
2926
+ title
2927
+ hasBackOrderProductVariants
2928
+ isLocalPickupAvailable
2929
+ productVariants(
2930
+ first: $first
2931
+ after: $after
2932
+ isReverse: $isReverse
2933
+ sortKeys: $sortKeys
2934
+ ) {
2935
+ nodes {
2936
+ id
2937
+ title
2938
+ inventoryItem {
2939
+ id
2940
+ sku
2941
+ }
2942
+ isBackOrderEnable
2943
+ isLocalPickupAvailable
2845
2944
  }
2846
- function ae(a, l) {
2847
- return new Promise(function(E, R) {
2848
- var x = new w(a, l);
2849
- if (x.signal && x.signal.aborted)
2850
- return R(new o.DOMException("Aborted", "AbortError"));
2851
- var A = new XMLHttpRequest();
2852
- function X() {
2853
- A.abort();
2854
- }
2855
- A.onload = function() {
2856
- var G = {
2857
- status: A.status,
2858
- statusText: A.statusText,
2859
- headers: $e(A.getAllResponseHeaders() || "")
2860
- };
2861
- G.url = "responseURL" in A ? A.responseURL : G.headers.get("X-Request-URL");
2862
- var ue = "response" in A ? A.response : A.responseText;
2863
- E(new L(ue, G));
2864
- }, A.onerror = function() {
2865
- R(new TypeError("Network request failed"));
2866
- }, A.ontimeout = function() {
2867
- R(new TypeError("Network request failed"));
2868
- }, A.onabort = function() {
2869
- R(new o.DOMException("Aborted", "AbortError"));
2870
- }, A.open(x.method, x.url, !0), x.credentials === "include" ? A.withCredentials = !0 : x.credentials === "omit" && (A.withCredentials = !1), "responseType" in A && c.blob && (A.responseType = "blob"), x.headers.forEach(function(G, ue) {
2871
- A.setRequestHeader(ue, G);
2872
- }), x.signal && (x.signal.addEventListener("abort", X), A.onreadystatechange = function() {
2873
- A.readyState === 4 && x.signal.removeEventListener("abort", X);
2874
- }), A.send(typeof x._bodyInit > "u" ? null : x._bodyInit);
2875
- });
2945
+ pageInfo {
2946
+ startCursor
2947
+ endCursor
2948
+ hasNextPage
2949
+ hasPreviousPage
2876
2950
  }
2877
- return ae.polyfill = !0, s.fetch || (s.fetch = ae, s.Headers = g, s.Request = w, s.Response = L), o.Headers = g, o.Request = w, o.Response = L, o.fetch = ae, Object.defineProperty(o, "__esModule", { value: !0 }), o;
2878
- })({});
2879
- })(r), r.fetch.ponyfill = !0, delete r.fetch.polyfill;
2880
- var i = r;
2881
- t = i.fetch, t.default = i.fetch, t.fetch = i.fetch, t.Headers = i.Headers, t.Request = i.Request, t.Response = i.Response, e.exports = t;
2882
- })(ge, ge.exports);
2883
- var ne = ge.exports;
2884
- const ee = /* @__PURE__ */ Vt(ne), Gt = /* @__PURE__ */ ze({
2885
- __proto__: null,
2886
- default: ee
2887
- }, [ne]), U = (e) => {
2888
- let t = {};
2889
- return e && (typeof Headers < "u" && e instanceof Headers || Gt && ne.Headers && e instanceof ne.Headers ? t = Je(e) : Array.isArray(e) ? e.forEach(([n, r]) => {
2890
- n && r !== void 0 && (t[n] = r);
2891
- }) : t = e), t;
2892
- }, Oe = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), $t = (e) => {
2893
- if (!Array.isArray(e.query)) {
2894
- const r = e, i = [`query=${encodeURIComponent(Oe(r.query))}`];
2895
- return e.variables && i.push(`variables=${encodeURIComponent(r.jsonSerializer.stringify(r.variables))}`), r.operationName && i.push(`operationName=${encodeURIComponent(r.operationName)}`), i.join("&");
2896
- }
2897
- if (typeof e.variables < "u" && !Array.isArray(e.variables))
2898
- throw new Error("Cannot create query with given variable type, array expected");
2899
- const t = e, n = e.query.reduce((r, i, s) => (r.push({
2900
- query: Oe(i),
2901
- variables: t.variables ? t.jsonSerializer.stringify(t.variables[s]) : void 0
2902
- }), r), []);
2903
- return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
2904
- }, jt = (e) => async (t) => {
2905
- const { url: n, query: r, variables: i, operationName: s, fetch: o, fetchOptions: c, middleware: h } = t, p = { ...t.headers };
2906
- let m = "", y;
2907
- e === "POST" ? (y = Yt(r, i, s, c.jsonSerializer), typeof y == "string" && (p["Content-Type"] = "application/json")) : m = $t({
2908
- query: r,
2909
- variables: i,
2910
- operationName: s,
2911
- jsonSerializer: c.jsonSerializer ?? Ce
2912
- });
2913
- const C = {
2914
- method: e,
2915
- headers: p,
2916
- body: y,
2917
- ...c
2918
- };
2919
- let T = n, g = C;
2920
- if (h) {
2921
- const N = await Promise.resolve(h({ ...C, url: n, operationName: s, variables: i })), { url: S, ...D } = N;
2922
- T = S, g = D;
2923
- }
2924
- return m && (T = `${T}?${m}`), await o(T, g);
2925
- };
2926
- class Ht {
2927
- constructor(t, n = {}) {
2928
- this.url = t, this.requestConfig = n, this.rawRequest = async (...r) => {
2929
- const [i, s, o] = r, c = We(i, s, o), { headers: h, fetch: p = ee, method: m = "POST", requestMiddleware: y, responseMiddleware: C, ...T } = this.requestConfig, { url: g } = this;
2930
- c.signal !== void 0 && (T.signal = c.signal);
2931
- const { operationName: N } = le(c.query);
2932
- return de({
2933
- url: g,
2934
- query: c.query,
2935
- variables: c.variables,
2936
- headers: {
2937
- ...U(he(h)),
2938
- ...U(c.requestHeaders)
2939
- },
2940
- operationName: N,
2941
- fetch: p,
2942
- method: m,
2943
- fetchOptions: T,
2944
- middleware: y
2945
- }).then((S) => (C && C(S), S)).catch((S) => {
2946
- throw C && C(S), S;
2947
- });
2948
- };
2949
- }
2950
- async request(t, ...n) {
2951
- const [r, i] = n, s = Xe(t, r, i), { headers: o, fetch: c = ee, method: h = "POST", requestMiddleware: p, responseMiddleware: m, ...y } = this.requestConfig, { url: C } = this;
2952
- s.signal !== void 0 && (y.signal = s.signal);
2953
- const { query: T, operationName: g } = le(s.document);
2954
- return de({
2955
- url: C,
2956
- query: T,
2957
- variables: s.variables,
2958
- headers: {
2959
- ...U(he(o)),
2960
- ...U(s.requestHeaders)
2961
- },
2962
- operationName: g,
2963
- fetch: c,
2964
- method: h,
2965
- fetchOptions: y,
2966
- middleware: p
2967
- }).then((N) => (m && m(N), N.data)).catch((N) => {
2968
- throw m && m(N), N;
2969
- });
2970
- }
2971
- // prettier-ignore
2972
- batchRequests(t, n) {
2973
- const r = Ke(t, n), { headers: i, ...s } = this.requestConfig;
2974
- r.signal !== void 0 && (s.signal = r.signal);
2975
- const o = r.documents.map(({ document: h }) => le(h).query), c = r.documents.map(({ variables: h }) => h);
2976
- return de({
2977
- url: this.url,
2978
- query: o,
2979
- // @ts-expect-error TODO reconcile batch variables into system.
2980
- variables: c,
2981
- headers: {
2982
- ...U(he(i)),
2983
- ...U(r.requestHeaders)
2984
- },
2985
- operationName: void 0,
2986
- fetch: this.requestConfig.fetch ?? ee,
2987
- method: this.requestConfig.method || "POST",
2988
- fetchOptions: s,
2989
- middleware: this.requestConfig.requestMiddleware
2990
- }).then((h) => (this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(h), h.data)).catch((h) => {
2991
- throw this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(h), h;
2992
- });
2993
- }
2994
- setHeaders(t) {
2995
- return this.requestConfig.headers = t, this;
2951
+ }
2996
2952
  }
2997
- /**
2998
- * Attach a header to the client. All subsequent requests will have this header.
2999
- */
3000
- setHeader(t, n) {
3001
- const { headers: r } = this.requestConfig;
3002
- return r ? r[t] = n : this.requestConfig.headers = { [t]: n }, this;
2953
+ }
2954
+ `, tn = b`
2955
+ query GetPointCampaignOrderRuleTargetCustomerRank {
2956
+ pointCampaignOrderRuleTargetCustomerRank {
2957
+ pointCampaignOrderRule {
2958
+ id
2959
+ title
2960
+ }
2961
+ multiplier
2962
+ fixedPoint
3003
2963
  }
3004
- /**
3005
- * Change the client endpoint. All subsequent requests will send to this endpoint.
3006
- */
3007
- setEndpoint(t) {
3008
- return this.url = t, this;
2964
+ }
2965
+ `, nn = b`
2966
+ query GetEstimatedShopifyCartPoint($input: EstimatedShopifyCartPointInput!) {
2967
+ estimatedShopifyCartPoint(input: $input) {
2968
+ pointsEarned
3009
2969
  }
3010
2970
  }
3011
- const de = async (e) => {
3012
- const { query: t, variables: n, fetchOptions: r } = e, i = jt(Qe(e.method ?? "post")), s = Array.isArray(e.query), o = await i(e), c = await zt(o, r.jsonSerializer ?? Ce), h = Array.isArray(c) ? !c.some(({ data: m }) => !m) : !!c.data, p = Array.isArray(c) || !c.errors || Array.isArray(c.errors) && !c.errors.length || r.errorPolicy === "all" || r.errorPolicy === "ignore";
3013
- if (o.ok && p && h) {
3014
- const { errors: m, ...y } = (Array.isArray(c), c), C = r.errorPolicy === "ignore" ? y : c;
3015
- return {
3016
- ...s ? { data: C } : C,
3017
- headers: o.headers,
3018
- status: o.status
3019
- };
3020
- } else {
3021
- const m = typeof c == "string" ? {
3022
- error: c
3023
- } : c;
3024
- throw new H(
3025
- // @ts-expect-error TODO
3026
- { ...m, status: o.status, headers: o.headers },
3027
- { query: t, variables: n }
3028
- );
2971
+ `, rn = b`
2972
+ query GetEstimatedShopifyCartLineItemPoint($input: EstimatedShopifyCartLineItemPointInput!) {
2973
+ estimatedShopifyCartLineItemPoint(input: $input) {
2974
+ pointsEarned
3029
2975
  }
3030
- }, Yt = (e, t, n, r) => {
3031
- const i = r ?? Ce;
3032
- if (!Array.isArray(e))
3033
- return i.stringify({ query: e, variables: t, operationName: n });
3034
- if (typeof t < "u" && !Array.isArray(t))
3035
- throw new Error("Cannot create request body with given variable type, array expected");
3036
- const s = e.reduce((o, c, h) => (o.push({ query: c, variables: t ? t[h] : void 0 }), o), []);
3037
- return i.stringify(s);
3038
- }, zt = async (e, t) => {
3039
- let n;
3040
- return e.headers.forEach((r, i) => {
3041
- i.toLowerCase() === "content-type" && (n = r);
3042
- }), n && (n.toLowerCase().startsWith("application/json") || n.toLowerCase().startsWith("application/graphql+json") || n.toLowerCase().startsWith("application/graphql-response+json")) ? t.parse(await e.text()) : e.text();
3043
- }, he = (e) => typeof e == "function" ? e() : e;
3044
- var re = function() {
3045
- return re = Object.assign || function(t) {
3046
- for (var n, r = 1, i = arguments.length; r < i; r++) {
3047
- n = arguments[r];
3048
- for (var s in n)
3049
- Object.prototype.hasOwnProperty.call(n, s) && (t[s] = n[s]);
3050
- }
3051
- return t;
3052
- }, re.apply(this, arguments);
3053
- };
3054
- var te = /* @__PURE__ */ new Map(), ye = /* @__PURE__ */ new Map(), qe = !0, ie = !1;
3055
- function Ve(e) {
3056
- return e.replace(/[\s,]+/g, " ").trim();
3057
2976
  }
3058
- function Qt(e) {
3059
- return Ve(e.source.body.substring(e.start, e.end));
2977
+ `, sn = b`
2978
+ mutation PurchasingCustomerSendCustomerSharingActivationCode {
2979
+ purchasingCustomerSendCustomerSharingActivationCode {
2980
+ purchasingCustomer {
2981
+ id
2982
+ sharingPurchasingCustomerCount
2983
+ tenant {
2984
+ id
2985
+ name
2986
+ }
2987
+ }
2988
+ customerSharingActivationCode {
2989
+ id
2990
+ }
2991
+ }
3060
2992
  }
3061
- function Jt(e) {
3062
- var t = /* @__PURE__ */ new Set(), n = [];
3063
- return e.definitions.forEach(function(r) {
3064
- if (r.kind === "FragmentDefinition") {
3065
- var i = r.name.value, s = Qt(r.loc), o = ye.get(i);
3066
- o && !o.has(s) ? qe && console.warn("Warning: fragment with name " + i + ` already exists.
3067
- graphql-tag enforces all fragment names across your application to be unique; read more about
3068
- this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : o || ye.set(i, o = /* @__PURE__ */ new Set()), o.add(s), t.has(s) || (t.add(s), n.push(r));
3069
- } else
3070
- n.push(r);
3071
- }), re(re({}, e), { definitions: n });
3072
- }
3073
- function Xt(e) {
3074
- var t = new Set(e.definitions);
3075
- t.forEach(function(r) {
3076
- r.loc && delete r.loc, Object.keys(r).forEach(function(i) {
3077
- var s = r[i];
3078
- s && typeof s == "object" && t.add(s);
3079
- });
3080
- });
3081
- var n = e.loc;
3082
- return n && (delete n.startToken, delete n.endToken), e;
3083
- }
3084
- function Wt(e) {
3085
- var t = Ve(e);
3086
- if (!te.has(t)) {
3087
- var n = Ue(e, {
3088
- experimentalFragmentVariables: ie,
3089
- allowLegacyFragmentVariables: ie
3090
- });
3091
- if (!n || n.kind !== "Document")
3092
- throw new Error("Not a valid GraphQL document.");
3093
- te.set(t, Xt(Jt(n)));
3094
- }
3095
- return te.get(t);
3096
- }
3097
- function q(e) {
3098
- for (var t = [], n = 1; n < arguments.length; n++)
3099
- t[n - 1] = arguments[n];
3100
- typeof e == "string" && (e = [e]);
3101
- var r = e[0];
3102
- return t.forEach(function(i, s) {
3103
- i && i.kind === "Document" ? r += i.loc.source.body : r += i, r += e[s + 1];
3104
- }), Wt(r);
3105
- }
3106
- function Kt() {
3107
- te.clear(), ye.clear();
3108
- }
3109
- function Zt() {
3110
- qe = !1;
3111
- }
3112
- function en() {
3113
- ie = !0;
3114
- }
3115
- function tn() {
3116
- ie = !1;
3117
- }
3118
- var $ = {
3119
- gql: q,
3120
- resetCaches: Kt,
3121
- disableFragmentWarnings: Zt,
3122
- enableExperimentalFragmentVariables: en,
3123
- disableExperimentalFragmentVariables: tn
3124
- };
3125
- (function(e) {
3126
- e.gql = $.gql, e.resetCaches = $.resetCaches, e.disableFragmentWarnings = $.disableFragmentWarnings, e.enableExperimentalFragmentVariables = $.enableExperimentalFragmentVariables, e.disableExperimentalFragmentVariables = $.disableExperimentalFragmentVariables;
3127
- })(q || (q = {}));
3128
- q.default = q;
3129
- const O = q, nn = O`
3130
- query GetLocationAvailabilities($sku: String!, $first: Int, $after: String, $isReverse: Boolean! = false) {
3131
- locationAvailabilities(
3132
- sku: $sku
3133
- first: $first
3134
- after: $after
3135
- isReverse: $isReverse
2993
+ `, on = b`
2994
+ mutation PurchasingCustomerActivateCustomerSharing($email: String!, $activationCode: String!) {
2995
+ purchasingCustomerActivateCustomerSharing(
2996
+ input: {email: $email, activationCode: $activationCode}
3136
2997
  ) {
3137
- nodes {
3138
- location {
2998
+ purchasingCustomer {
2999
+ id
3000
+ sharingPurchasingCustomerCount
3001
+ tenant {
3139
3002
  id
3140
3003
  name
3141
- phone
3142
- mapURL
3143
- tags
3144
- address {
3145
- id
3146
- countryCode
3147
- country
3148
- postalCode
3149
- provinceCode
3150
- province
3151
- city
3152
- address1
3153
- address2
3154
- updatedAt
3155
- createdAt
3156
- }
3157
3004
  }
3158
- inventoryQuantity
3159
- }
3160
- pageInfo {
3161
- startCursor
3162
- endCursor
3163
- hasNextPage
3164
- hasPreviousPage
3165
3005
  }
3166
3006
  }
3167
3007
  }
3168
- `, rn = O`
3169
- query GetLocationAvailability($sku: String!, $locationID: ID!) {
3170
- locationAvailability(sku: $sku, locationID: $locationID) {
3171
- location {
3172
- id
3173
- name
3174
- phone
3175
- mapURL
3176
- tags
3177
- address {
3178
- id
3179
- countryCode
3180
- country
3181
- postalCode
3182
- provinceCode
3183
- province
3184
- city
3185
- address1
3186
- address2
3187
- updatedAt
3188
- createdAt
3189
- }
3008
+ `, an = (e, t, n, r) => e();
3009
+ function un(e, t = an) {
3010
+ return {
3011
+ GetLocationAvailabilities(n, r) {
3012
+ return t((i) => e.request($t, n, { ...r, ...i }), "GetLocationAvailabilities", "query", n);
3013
+ },
3014
+ GetLocationAvailability(n, r) {
3015
+ return t((i) => e.request(jt, n, { ...r, ...i }), "GetLocationAvailability", "query", n);
3016
+ },
3017
+ GetPurchasingCustomerMetafield(n, r) {
3018
+ return t((i) => e.request(Ht, n, { ...r, ...i }), "GetPurchasingCustomerMetafield", "query", n);
3019
+ },
3020
+ GetPoints(n, r) {
3021
+ return t((i) => e.request(Yt, n, { ...r, ...i }), "GetPoints", "query", n);
3022
+ },
3023
+ GetLocations(n, r) {
3024
+ return t((i) => e.request(zt, n, { ...r, ...i }), "GetLocations", "query", n);
3025
+ },
3026
+ GetPurchasingCustomerDiscounts(n, r) {
3027
+ return t((i) => e.request(Jt, n, { ...r, ...i }), "GetPurchasingCustomerDiscounts", "query", n);
3028
+ },
3029
+ GetPurchasingCustomerDiscountCodeCount(n, r) {
3030
+ return t((i) => e.request(Qt, n, { ...r, ...i }), "GetPurchasingCustomerDiscountCodeCount", "query", n);
3031
+ },
3032
+ GetPurchasingCustomerPointChangeActivities(n, r) {
3033
+ return t((i) => e.request(Xt, n, { ...r, ...i }), "GetPurchasingCustomerPointChangeActivities", "query", n);
3034
+ },
3035
+ GetPurchasingCustomerRank(n, r) {
3036
+ return t((i) => e.request(Wt, n, { ...r, ...i }), "GetPurchasingCustomerRank", "query", n);
3037
+ },
3038
+ GetSharingPurchasingCustomerCount(n, r) {
3039
+ return t((i) => e.request(Kt, n, { ...r, ...i }), "GetSharingPurchasingCustomerCount", "query", n);
3040
+ },
3041
+ GetPurchasingCustomerSharing(n, r) {
3042
+ return t((i) => e.request(Zt, n, { ...r, ...i }), "GetPurchasingCustomerSharing", "query", n);
3043
+ },
3044
+ GetProduct(n, r) {
3045
+ return t((i) => e.request(en, n, { ...r, ...i }), "GetProduct", "query", n);
3046
+ },
3047
+ GetPointCampaignOrderRuleTargetCustomerRank(n, r) {
3048
+ return t((i) => e.request(tn, n, { ...r, ...i }), "GetPointCampaignOrderRuleTargetCustomerRank", "query", n);
3049
+ },
3050
+ GetEstimatedShopifyCartPoint(n, r) {
3051
+ return t((i) => e.request(nn, n, { ...r, ...i }), "GetEstimatedShopifyCartPoint", "query", n);
3052
+ },
3053
+ GetEstimatedShopifyCartLineItemPoint(n, r) {
3054
+ return t((i) => e.request(rn, n, { ...r, ...i }), "GetEstimatedShopifyCartLineItemPoint", "query", n);
3055
+ },
3056
+ PurchasingCustomerSendCustomerSharingActivationCode(n, r) {
3057
+ return t((i) => e.request(sn, n, { ...r, ...i }), "PurchasingCustomerSendCustomerSharingActivationCode", "mutation", n);
3058
+ },
3059
+ PurchasingCustomerActivateCustomerSharing(n, r) {
3060
+ return t((i) => e.request(on, n, { ...r, ...i }), "PurchasingCustomerActivateCustomerSharing", "mutation", n);
3190
3061
  }
3191
- inventoryQuantity
3192
- }
3193
- }
3194
- `, sn = O`
3195
- query GetPurchasingCustomerMetafield($namespace: String!, $key: String!) {
3196
- purchasingCustomerMetafield(namespace: $namespace, key: $key) {
3197
- id
3198
- namespace
3199
- key
3200
- value
3201
- }
3202
- }
3203
- `, on = O`
3204
- query GetPoints {
3205
- purchasingCustomer {
3206
- pointsApproved
3207
- pointsPending
3208
- }
3062
+ };
3209
3063
  }
3210
- `, an = O`
3211
- query GetLocations($tag: String, $provinceCodes: [String!], $first: Int, $after: String, $isReverse: Boolean! = false) {
3212
- locations(
3213
- first: $first
3214
- after: $after
3215
- isReverse: $isReverse
3216
- filter: {tag: $tag, provinceCodes: $provinceCodes}
3217
- ) {
3218
- nodes {
3219
- id
3220
- name
3221
- phone
3222
- mapURL
3223
- tags
3224
- address {
3225
- id
3226
- countryCode
3227
- country
3228
- postalCode
3229
- provinceCode
3230
- province
3231
- city
3232
- address1
3233
- address2
3234
- updatedAt
3235
- createdAt
3236
- }
3237
- }
3238
- pageInfo {
3239
- startCursor
3240
- endCursor
3241
- hasNextPage
3242
- hasPreviousPage
3064
+ const ve = JSON, cn = (e) => e.toUpperCase(), ln = (e) => {
3065
+ const t = {};
3066
+ return e.forEach((n, r) => {
3067
+ t[r] = n;
3068
+ }), t;
3069
+ }, dn = (e, t, n) => e.document ? e : {
3070
+ document: e,
3071
+ variables: t,
3072
+ requestHeaders: n,
3073
+ signal: void 0
3074
+ }, pn = (e, t, n) => e.query ? e : {
3075
+ query: e,
3076
+ variables: t,
3077
+ requestHeaders: n,
3078
+ signal: void 0
3079
+ }, hn = (e, t) => e.documents ? e : {
3080
+ documents: e,
3081
+ requestHeaders: t,
3082
+ signal: void 0
3083
+ }, be = (e) => {
3084
+ var r, i;
3085
+ let t;
3086
+ const n = e.definitions.filter((s) => s.kind === "OperationDefinition");
3087
+ return n.length === 1 && (t = (i = (r = n[0]) == null ? void 0 : r.name) == null ? void 0 : i.value), t;
3088
+ }, le = (e) => {
3089
+ if (typeof e == "string") {
3090
+ let n;
3091
+ try {
3092
+ const r = Ue(e);
3093
+ n = be(r);
3094
+ } catch {
3243
3095
  }
3096
+ return { query: e, operationName: n };
3244
3097
  }
3245
- }
3246
- `, un = O`
3247
- query GetPurchasingCustomerDiscounts($first: Int, $after: String, $isReverse: Boolean! = false) {
3248
- purchasingCustomer {
3249
- id
3250
- orderPriceAdjustmentRules(first: $first, after: $after, isReverse: $isReverse) {
3251
- nodes {
3252
- id
3253
- title
3254
- status
3255
- description
3256
- code
3257
- customerApplicable
3258
- shopifyStoreApplicable
3259
- applicableLocationCount
3260
- hasApplicableLocations
3261
- startsAt
3262
- endsAt
3263
- createdAt
3264
- updatedAt
3265
- }
3266
- pageInfo {
3267
- startCursor
3268
- endCursor
3269
- hasNextPage
3270
- hasPreviousPage
3271
- }
3272
- }
3098
+ const t = be(e);
3099
+ return { query: Pt(e), operationName: t };
3100
+ };
3101
+ class H extends Error {
3102
+ constructor(t, n) {
3103
+ const r = `${H.extractMessage(t)}: ${JSON.stringify({
3104
+ response: t,
3105
+ request: n
3106
+ })}`;
3107
+ super(r), Object.setPrototypeOf(this, H.prototype), this.response = t, this.request = n, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, H);
3273
3108
  }
3274
- }
3275
- `, cn = O`
3276
- query GetPurchasingCustomerDiscountCodeCount {
3277
- purchasingCustomer {
3278
- id
3279
- orderPriceAdjustmentRuleCount
3109
+ static extractMessage(t) {
3110
+ var n, r;
3111
+ return ((r = (n = t.errors) == null ? void 0 : n[0]) == null ? void 0 : r.message) ?? `GraphQL Error (Code: ${t.status})`;
3280
3112
  }
3281
3113
  }
3282
- `, ln = O`
3283
- query GetPurchasingCustomerPointChangeActivities($first: Int, $after: String, $isReverse: Boolean! = false, $sortKeys: PointChangeActivitySortKey! = CREATED_AT) {
3284
- purchasingCustomer {
3285
- id
3286
- pointChangeActivities(
3287
- first: $first
3288
- after: $after
3289
- isReverse: $isReverse
3290
- sortKeys: $sortKeys
3291
- ) {
3292
- nodes {
3293
- id
3294
- title
3295
- tenant {
3296
- id
3297
- name
3298
- }
3299
- pointChange {
3300
- id
3301
- delta
3302
- availableAt
3303
- expiresDate
3304
- availableUntil
3305
- pointChangeCreatedAt
3306
- tenant {
3307
- id
3308
- name
3114
+ var fn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
3115
+ function mn(e) {
3116
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
3117
+ }
3118
+ var ye = { exports: {} };
3119
+ (function(e, t) {
3120
+ var n = typeof self < "u" ? self : fn, r = function() {
3121
+ function s() {
3122
+ this.fetch = !1, this.DOMException = n.DOMException;
3123
+ }
3124
+ return s.prototype = n, new s();
3125
+ }();
3126
+ (function(s) {
3127
+ (function(o) {
3128
+ var c = {
3129
+ searchParams: "URLSearchParams" in s,
3130
+ iterable: "Symbol" in s && "iterator" in Symbol,
3131
+ blob: "FileReader" in s && "Blob" in s && function() {
3132
+ try {
3133
+ return new Blob(), !0;
3134
+ } catch {
3135
+ return !1;
3309
3136
  }
3310
- createdAt
3311
- }
3312
- retailLocation {
3313
- id
3314
- name
3315
- phone
3316
- mapURL
3317
- tags
3318
- address {
3319
- id
3320
- countryCode
3321
- country
3322
- postalCode
3323
- provinceCode
3324
- province
3325
- city
3326
- address1
3327
- address2
3328
- updatedAt
3329
- createdAt
3137
+ }(),
3138
+ formData: "FormData" in s,
3139
+ arrayBuffer: "ArrayBuffer" in s
3140
+ };
3141
+ function p(a) {
3142
+ return a && DataView.prototype.isPrototypeOf(a);
3143
+ }
3144
+ if (c.arrayBuffer)
3145
+ var h = [
3146
+ "[object Int8Array]",
3147
+ "[object Uint8Array]",
3148
+ "[object Uint8ClampedArray]",
3149
+ "[object Int16Array]",
3150
+ "[object Uint16Array]",
3151
+ "[object Int32Array]",
3152
+ "[object Uint32Array]",
3153
+ "[object Float32Array]",
3154
+ "[object Float64Array]"
3155
+ ], m = ArrayBuffer.isView || function(a) {
3156
+ return a && h.indexOf(Object.prototype.toString.call(a)) > -1;
3157
+ };
3158
+ function y(a) {
3159
+ if (typeof a != "string" && (a = String(a)), /[^a-z0-9\-#$%&'*+.^_`|~]/i.test(a))
3160
+ throw new TypeError("Invalid character in header field name");
3161
+ return a.toLowerCase();
3162
+ }
3163
+ function C(a) {
3164
+ return typeof a != "string" && (a = String(a)), a;
3165
+ }
3166
+ function T(a) {
3167
+ var l = {
3168
+ next: function() {
3169
+ var E = a.shift();
3170
+ return { done: E === void 0, value: E };
3330
3171
  }
3331
- }
3172
+ };
3173
+ return c.iterable && (l[Symbol.iterator] = function() {
3174
+ return l;
3175
+ }), l;
3332
3176
  }
3333
- pageInfo {
3334
- startCursor
3335
- endCursor
3336
- hasNextPage
3337
- hasPreviousPage
3177
+ function g(a) {
3178
+ this.map = {}, a instanceof g ? a.forEach(function(l, E) {
3179
+ this.append(E, l);
3180
+ }, this) : Array.isArray(a) ? a.forEach(function(l) {
3181
+ this.append(l[0], l[1]);
3182
+ }, this) : a && Object.getOwnPropertyNames(a).forEach(function(l) {
3183
+ this.append(l, a[l]);
3184
+ }, this);
3338
3185
  }
3339
- }
3340
- }
3341
- }
3342
- `, dn = O`
3343
- query GetPurchasingCustomerRank {
3344
- purchasingCustomer {
3345
- currentCustomerRank {
3346
- id
3347
- name
3348
- threshold
3349
- higherRank {
3350
- id
3351
- name
3352
- threshold
3186
+ g.prototype.append = function(a, l) {
3187
+ a = y(a), l = C(l);
3188
+ var E = this.map[a];
3189
+ this.map[a] = E ? E + ", " + l : l;
3190
+ }, g.prototype.delete = function(a) {
3191
+ delete this.map[y(a)];
3192
+ }, g.prototype.get = function(a) {
3193
+ return a = y(a), this.has(a) ? this.map[a] : null;
3194
+ }, g.prototype.has = function(a) {
3195
+ return this.map.hasOwnProperty(y(a));
3196
+ }, g.prototype.set = function(a, l) {
3197
+ this.map[y(a)] = C(l);
3198
+ }, g.prototype.forEach = function(a, l) {
3199
+ for (var E in this.map)
3200
+ this.map.hasOwnProperty(E) && a.call(l, this.map[E], E, this);
3201
+ }, g.prototype.keys = function() {
3202
+ var a = [];
3203
+ return this.forEach(function(l, E) {
3204
+ a.push(E);
3205
+ }), T(a);
3206
+ }, g.prototype.values = function() {
3207
+ var a = [];
3208
+ return this.forEach(function(l) {
3209
+ a.push(l);
3210
+ }), T(a);
3211
+ }, g.prototype.entries = function() {
3212
+ var a = [];
3213
+ return this.forEach(function(l, E) {
3214
+ a.push([E, l]);
3215
+ }), T(a);
3216
+ }, c.iterable && (g.prototype[Symbol.iterator] = g.prototype.entries);
3217
+ function N(a) {
3218
+ if (a.bodyUsed)
3219
+ return Promise.reject(new TypeError("Already read"));
3220
+ a.bodyUsed = !0;
3353
3221
  }
3354
- lowerRank {
3355
- id
3356
- name
3357
- threshold
3222
+ function D(a) {
3223
+ return new Promise(function(l, E) {
3224
+ a.onload = function() {
3225
+ l(a.result);
3226
+ }, a.onerror = function() {
3227
+ E(a.error);
3228
+ };
3229
+ });
3358
3230
  }
3359
- earnedPointToRankUp
3360
- purchasePriceToRankUp
3361
- calculationCondition {
3362
- customerRankCalculationPeriod {
3363
- start
3364
- end
3365
- }
3366
- earnedPoint
3367
- purchasePrice
3231
+ function O(a) {
3232
+ var l = new FileReader(), E = D(l);
3233
+ return l.readAsArrayBuffer(a), E;
3368
3234
  }
3369
- pointMultiplier {
3370
- id
3371
- customerRankRule {
3372
- id
3373
- name
3374
- threshold
3375
- }
3376
- multiplier
3235
+ function z(a) {
3236
+ var l = new FileReader(), E = D(l);
3237
+ return l.readAsText(a), E;
3238
+ }
3239
+ function _(a) {
3240
+ for (var l = new Uint8Array(a), E = new Array(l.length), R = 0; R < l.length; R++)
3241
+ E[R] = String.fromCharCode(l[R]);
3242
+ return E.join("");
3243
+ }
3244
+ function k(a) {
3245
+ if (a.slice)
3246
+ return a.slice(0);
3247
+ var l = new Uint8Array(a.byteLength);
3248
+ return l.set(new Uint8Array(a)), l.buffer;
3249
+ }
3250
+ function B() {
3251
+ return this.bodyUsed = !1, this._initBody = function(a) {
3252
+ this._bodyInit = a, a ? typeof a == "string" ? this._bodyText = a : c.blob && Blob.prototype.isPrototypeOf(a) ? this._bodyBlob = a : c.formData && FormData.prototype.isPrototypeOf(a) ? this._bodyFormData = a : c.searchParams && URLSearchParams.prototype.isPrototypeOf(a) ? this._bodyText = a.toString() : c.arrayBuffer && c.blob && p(a) ? (this._bodyArrayBuffer = k(a.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : c.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(a) || m(a)) ? this._bodyArrayBuffer = k(a) : this._bodyText = a = Object.prototype.toString.call(a) : this._bodyText = "", this.headers.get("content-type") || (typeof a == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : c.searchParams && URLSearchParams.prototype.isPrototypeOf(a) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
3253
+ }, c.blob && (this.blob = function() {
3254
+ var a = N(this);
3255
+ if (a)
3256
+ return a;
3257
+ if (this._bodyBlob)
3258
+ return Promise.resolve(this._bodyBlob);
3259
+ if (this._bodyArrayBuffer)
3260
+ return Promise.resolve(new Blob([this._bodyArrayBuffer]));
3261
+ if (this._bodyFormData)
3262
+ throw new Error("could not read FormData body as blob");
3263
+ return Promise.resolve(new Blob([this._bodyText]));
3264
+ }, this.arrayBuffer = function() {
3265
+ return this._bodyArrayBuffer ? N(this) || Promise.resolve(this._bodyArrayBuffer) : this.blob().then(O);
3266
+ }), this.text = function() {
3267
+ var a = N(this);
3268
+ if (a)
3269
+ return a;
3270
+ if (this._bodyBlob)
3271
+ return z(this._bodyBlob);
3272
+ if (this._bodyArrayBuffer)
3273
+ return Promise.resolve(_(this._bodyArrayBuffer));
3274
+ if (this._bodyFormData)
3275
+ throw new Error("could not read FormData body as text");
3276
+ return Promise.resolve(this._bodyText);
3277
+ }, c.formData && (this.formData = function() {
3278
+ return this.text().then(Ve);
3279
+ }), this.json = function() {
3280
+ return this.text().then(JSON.parse);
3281
+ }, this;
3282
+ }
3283
+ var J = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
3284
+ function Q(a) {
3285
+ var l = a.toUpperCase();
3286
+ return J.indexOf(l) > -1 ? l : a;
3287
+ }
3288
+ function w(a, l) {
3289
+ l = l || {};
3290
+ var E = l.body;
3291
+ if (a instanceof w) {
3292
+ if (a.bodyUsed)
3293
+ throw new TypeError("Already read");
3294
+ this.url = a.url, this.credentials = a.credentials, l.headers || (this.headers = new g(a.headers)), this.method = a.method, this.mode = a.mode, this.signal = a.signal, !E && a._bodyInit != null && (E = a._bodyInit, a.bodyUsed = !0);
3295
+ } else
3296
+ this.url = String(a);
3297
+ if (this.credentials = l.credentials || this.credentials || "same-origin", (l.headers || !this.headers) && (this.headers = new g(l.headers)), this.method = Q(l.method || this.method || "GET"), this.mode = l.mode || this.mode || null, this.signal = l.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && E)
3298
+ throw new TypeError("Body not allowed for GET or HEAD requests");
3299
+ this._initBody(E);
3300
+ }
3301
+ w.prototype.clone = function() {
3302
+ return new w(this, { body: this._bodyInit });
3303
+ };
3304
+ function Ve(a) {
3305
+ var l = new FormData();
3306
+ return a.trim().split("&").forEach(function(E) {
3307
+ if (E) {
3308
+ var R = E.split("="), S = R.shift().replace(/\+/g, " "), A = R.join("=").replace(/\+/g, " ");
3309
+ l.append(decodeURIComponent(S), decodeURIComponent(A));
3310
+ }
3311
+ }), l;
3312
+ }
3313
+ function $e(a) {
3314
+ var l = new g(), E = a.replace(/\r?\n[\t ]+/g, " ");
3315
+ return E.split(/\r?\n/).forEach(function(R) {
3316
+ var S = R.split(":"), A = S.shift().trim();
3317
+ if (A) {
3318
+ var X = S.join(":").trim();
3319
+ l.append(A, X);
3320
+ }
3321
+ }), l;
3322
+ }
3323
+ B.call(w.prototype);
3324
+ function L(a, l) {
3325
+ l || (l = {}), this.type = "default", this.status = l.status === void 0 ? 200 : l.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in l ? l.statusText : "OK", this.headers = new g(l.headers), this.url = l.url || "", this._initBody(a);
3326
+ }
3327
+ B.call(L.prototype), L.prototype.clone = function() {
3328
+ return new L(this._bodyInit, {
3329
+ status: this.status,
3330
+ statusText: this.statusText,
3331
+ headers: new g(this.headers),
3332
+ url: this.url
3333
+ });
3334
+ }, L.error = function() {
3335
+ var a = new L(null, { status: 0, statusText: "" });
3336
+ return a.type = "error", a;
3337
+ };
3338
+ var je = [301, 302, 303, 307, 308];
3339
+ L.redirect = function(a, l) {
3340
+ if (je.indexOf(l) === -1)
3341
+ throw new RangeError("Invalid status code");
3342
+ return new L(null, { status: l, headers: { location: a } });
3343
+ }, o.DOMException = s.DOMException;
3344
+ try {
3345
+ new o.DOMException();
3346
+ } catch {
3347
+ o.DOMException = function(l, E) {
3348
+ this.message = l, this.name = E;
3349
+ var R = Error(l);
3350
+ this.stack = R.stack;
3351
+ }, o.DOMException.prototype = Object.create(Error.prototype), o.DOMException.prototype.constructor = o.DOMException;
3352
+ }
3353
+ function ae(a, l) {
3354
+ return new Promise(function(E, R) {
3355
+ var S = new w(a, l);
3356
+ if (S.signal && S.signal.aborted)
3357
+ return R(new o.DOMException("Aborted", "AbortError"));
3358
+ var A = new XMLHttpRequest();
3359
+ function X() {
3360
+ A.abort();
3361
+ }
3362
+ A.onload = function() {
3363
+ var V = {
3364
+ status: A.status,
3365
+ statusText: A.statusText,
3366
+ headers: $e(A.getAllResponseHeaders() || "")
3367
+ };
3368
+ V.url = "responseURL" in A ? A.responseURL : V.headers.get("X-Request-URL");
3369
+ var ue = "response" in A ? A.response : A.responseText;
3370
+ E(new L(ue, V));
3371
+ }, A.onerror = function() {
3372
+ R(new TypeError("Network request failed"));
3373
+ }, A.ontimeout = function() {
3374
+ R(new TypeError("Network request failed"));
3375
+ }, A.onabort = function() {
3376
+ R(new o.DOMException("Aborted", "AbortError"));
3377
+ }, A.open(S.method, S.url, !0), S.credentials === "include" ? A.withCredentials = !0 : S.credentials === "omit" && (A.withCredentials = !1), "responseType" in A && c.blob && (A.responseType = "blob"), S.headers.forEach(function(V, ue) {
3378
+ A.setRequestHeader(ue, V);
3379
+ }), S.signal && (S.signal.addEventListener("abort", X), A.onreadystatechange = function() {
3380
+ A.readyState === 4 && S.signal.removeEventListener("abort", X);
3381
+ }), A.send(typeof S._bodyInit > "u" ? null : S._bodyInit);
3382
+ });
3377
3383
  }
3378
- }
3384
+ return ae.polyfill = !0, s.fetch || (s.fetch = ae, s.Headers = g, s.Request = w, s.Response = L), o.Headers = g, o.Request = w, o.Response = L, o.fetch = ae, Object.defineProperty(o, "__esModule", { value: !0 }), o;
3385
+ })({});
3386
+ })(r), r.fetch.ponyfill = !0, delete r.fetch.polyfill;
3387
+ var i = r;
3388
+ t = i.fetch, t.default = i.fetch, t.fetch = i.fetch, t.Headers = i.Headers, t.Request = i.Request, t.Response = i.Response, e.exports = t;
3389
+ })(ye, ye.exports);
3390
+ var ie = ye.exports;
3391
+ const te = /* @__PURE__ */ mn(ie), gn = /* @__PURE__ */ ze({
3392
+ __proto__: null,
3393
+ default: te
3394
+ }, [ie]), U = (e) => {
3395
+ let t = {};
3396
+ return e && (typeof Headers < "u" && e instanceof Headers || gn && ie.Headers && e instanceof ie.Headers ? t = ln(e) : Array.isArray(e) ? e.forEach(([n, r]) => {
3397
+ n && r !== void 0 && (t[n] = r);
3398
+ }) : t = e), t;
3399
+ }, Re = (e) => e.replace(/([\s,]|#[^\n\r]+)+/g, " ").trim(), yn = (e) => {
3400
+ if (!Array.isArray(e.query)) {
3401
+ const r = e, i = [`query=${encodeURIComponent(Re(r.query))}`];
3402
+ return e.variables && i.push(`variables=${encodeURIComponent(r.jsonSerializer.stringify(r.variables))}`), r.operationName && i.push(`operationName=${encodeURIComponent(r.operationName)}`), i.join("&");
3379
3403
  }
3380
- }
3381
- `, hn = O`
3382
- query GetSharingPurchasingCustomerCount {
3383
- purchasingCustomer {
3384
- id
3385
- sharingPurchasingCustomerCount
3404
+ if (typeof e.variables < "u" && !Array.isArray(e.variables))
3405
+ throw new Error("Cannot create query with given variable type, array expected");
3406
+ const t = e, n = e.query.reduce((r, i, s) => (r.push({
3407
+ query: Re(i),
3408
+ variables: t.variables ? t.jsonSerializer.stringify(t.variables[s]) : void 0
3409
+ }), r), []);
3410
+ return `query=${encodeURIComponent(t.jsonSerializer.stringify(n))}`;
3411
+ }, Cn = (e) => async (t) => {
3412
+ const { url: n, query: r, variables: i, operationName: s, fetch: o, fetchOptions: c, middleware: p } = t, h = { ...t.headers };
3413
+ let m = "", y;
3414
+ e === "POST" ? (y = vn(r, i, s, c.jsonSerializer), typeof y == "string" && (h["Content-Type"] = "application/json")) : m = yn({
3415
+ query: r,
3416
+ variables: i,
3417
+ operationName: s,
3418
+ jsonSerializer: c.jsonSerializer ?? ve
3419
+ });
3420
+ const C = {
3421
+ method: e,
3422
+ headers: h,
3423
+ body: y,
3424
+ ...c
3425
+ };
3426
+ let T = n, g = C;
3427
+ if (p) {
3428
+ const N = await Promise.resolve(p({ ...C, url: n, operationName: s, variables: i })), { url: D, ...O } = N;
3429
+ T = D, g = O;
3386
3430
  }
3387
- }
3388
- `, pn = O`
3389
- query GetPurchasingCustomerSharing {
3390
- purchasingCustomer {
3391
- id
3392
- customerSharing {
3393
- id
3394
- purchasingCustomers {
3395
- id
3396
- sharingPurchasingCustomerCount
3397
- tenant {
3398
- id
3399
- name
3400
- }
3401
- }
3402
- }
3431
+ return m && (T = `${T}?${m}`), await o(T, g);
3432
+ };
3433
+ class En {
3434
+ constructor(t, n = {}) {
3435
+ this.url = t, this.requestConfig = n, this.rawRequest = async (...r) => {
3436
+ const [i, s, o] = r, c = pn(i, s, o), { headers: p, fetch: h = te, method: m = "POST", requestMiddleware: y, responseMiddleware: C, ...T } = this.requestConfig, { url: g } = this;
3437
+ c.signal !== void 0 && (T.signal = c.signal);
3438
+ const { operationName: N } = le(c.query);
3439
+ return de({
3440
+ url: g,
3441
+ query: c.query,
3442
+ variables: c.variables,
3443
+ headers: {
3444
+ ...U(pe(p)),
3445
+ ...U(c.requestHeaders)
3446
+ },
3447
+ operationName: N,
3448
+ fetch: h,
3449
+ method: m,
3450
+ fetchOptions: T,
3451
+ middleware: y
3452
+ }).then((D) => (C && C(D), D)).catch((D) => {
3453
+ throw C && C(D), D;
3454
+ });
3455
+ };
3403
3456
  }
3404
- }
3405
- `, fn = O`
3406
- query GetProduct($id: String!, $first: Int, $after: String, $isReverse: Boolean! = false, $sortKeys: ProductVariantSortKeys! = CREATED_AT) {
3407
- productByProductShopifyLegacyResourceID(productShopifyLegacyResourceID: $id) {
3408
- id
3409
- title
3410
- hasBackOrderProductVariants
3411
- isLocalPickupAvailable
3412
- productVariants(
3413
- first: $first
3414
- after: $after
3415
- isReverse: $isReverse
3416
- sortKeys: $sortKeys
3417
- ) {
3418
- nodes {
3419
- id
3420
- title
3421
- inventoryItem {
3422
- id
3423
- sku
3424
- }
3425
- isBackOrderEnable
3426
- isLocalPickupAvailable
3427
- }
3428
- pageInfo {
3429
- startCursor
3430
- endCursor
3431
- hasNextPage
3432
- hasPreviousPage
3433
- }
3434
- }
3457
+ async request(t, ...n) {
3458
+ const [r, i] = n, s = dn(t, r, i), { headers: o, fetch: c = te, method: p = "POST", requestMiddleware: h, responseMiddleware: m, ...y } = this.requestConfig, { url: C } = this;
3459
+ s.signal !== void 0 && (y.signal = s.signal);
3460
+ const { query: T, operationName: g } = le(s.document);
3461
+ return de({
3462
+ url: C,
3463
+ query: T,
3464
+ variables: s.variables,
3465
+ headers: {
3466
+ ...U(pe(o)),
3467
+ ...U(s.requestHeaders)
3468
+ },
3469
+ operationName: g,
3470
+ fetch: c,
3471
+ method: p,
3472
+ fetchOptions: y,
3473
+ middleware: h
3474
+ }).then((N) => (m && m(N), N.data)).catch((N) => {
3475
+ throw m && m(N), N;
3476
+ });
3435
3477
  }
3436
- }
3437
- `, mn = O`
3438
- query GetPointCampaignOrderRuleTargetCustomerRank {
3439
- pointCampaignOrderRuleTargetCustomerRank {
3440
- pointCampaignOrderRule {
3441
- id
3442
- title
3443
- }
3444
- multiplier
3445
- fixedPoint
3478
+ // prettier-ignore
3479
+ batchRequests(t, n) {
3480
+ const r = hn(t, n), { headers: i, ...s } = this.requestConfig;
3481
+ r.signal !== void 0 && (s.signal = r.signal);
3482
+ const o = r.documents.map(({ document: p }) => le(p).query), c = r.documents.map(({ variables: p }) => p);
3483
+ return de({
3484
+ url: this.url,
3485
+ query: o,
3486
+ // @ts-expect-error TODO reconcile batch variables into system.
3487
+ variables: c,
3488
+ headers: {
3489
+ ...U(pe(i)),
3490
+ ...U(r.requestHeaders)
3491
+ },
3492
+ operationName: void 0,
3493
+ fetch: this.requestConfig.fetch ?? te,
3494
+ method: this.requestConfig.method || "POST",
3495
+ fetchOptions: s,
3496
+ middleware: this.requestConfig.requestMiddleware
3497
+ }).then((p) => (this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(p), p.data)).catch((p) => {
3498
+ throw this.requestConfig.responseMiddleware && this.requestConfig.responseMiddleware(p), p;
3499
+ });
3446
3500
  }
3447
- }
3448
- `, gn = O`
3449
- mutation PurchasingCustomerSendCustomerSharingActivationCode {
3450
- purchasingCustomerSendCustomerSharingActivationCode {
3451
- purchasingCustomer {
3452
- id
3453
- sharingPurchasingCustomerCount
3454
- tenant {
3455
- id
3456
- name
3457
- }
3458
- }
3459
- customerSharingActivationCode {
3460
- id
3461
- }
3501
+ setHeaders(t) {
3502
+ return this.requestConfig.headers = t, this;
3462
3503
  }
3463
- }
3464
- `, yn = O`
3465
- mutation PurchasingCustomerActivateCustomerSharing($email: String!, $activationCode: String!) {
3466
- purchasingCustomerActivateCustomerSharing(
3467
- input: {email: $email, activationCode: $activationCode}
3468
- ) {
3469
- purchasingCustomer {
3470
- id
3471
- sharingPurchasingCustomerCount
3472
- tenant {
3473
- id
3474
- name
3475
- }
3476
- }
3504
+ /**
3505
+ * Attach a header to the client. All subsequent requests will have this header.
3506
+ */
3507
+ setHeader(t, n) {
3508
+ const { headers: r } = this.requestConfig;
3509
+ return r ? r[t] = n : this.requestConfig.headers = { [t]: n }, this;
3510
+ }
3511
+ /**
3512
+ * Change the client endpoint. All subsequent requests will send to this endpoint.
3513
+ */
3514
+ setEndpoint(t) {
3515
+ return this.url = t, this;
3477
3516
  }
3478
3517
  }
3479
- `, Cn = (e, t, n, r) => e();
3480
- function En(e, t = Cn) {
3481
- return {
3482
- GetLocationAvailabilities(n, r) {
3483
- return t((i) => e.request(nn, n, { ...r, ...i }), "GetLocationAvailabilities", "query", n);
3484
- },
3485
- GetLocationAvailability(n, r) {
3486
- return t((i) => e.request(rn, n, { ...r, ...i }), "GetLocationAvailability", "query", n);
3487
- },
3488
- GetPurchasingCustomerMetafield(n, r) {
3489
- return t((i) => e.request(sn, n, { ...r, ...i }), "GetPurchasingCustomerMetafield", "query", n);
3490
- },
3491
- GetPoints(n, r) {
3492
- return t((i) => e.request(on, n, { ...r, ...i }), "GetPoints", "query", n);
3493
- },
3494
- GetLocations(n, r) {
3495
- return t((i) => e.request(an, n, { ...r, ...i }), "GetLocations", "query", n);
3496
- },
3497
- GetPurchasingCustomerDiscounts(n, r) {
3498
- return t((i) => e.request(un, n, { ...r, ...i }), "GetPurchasingCustomerDiscounts", "query", n);
3499
- },
3500
- GetPurchasingCustomerDiscountCodeCount(n, r) {
3501
- return t((i) => e.request(cn, n, { ...r, ...i }), "GetPurchasingCustomerDiscountCodeCount", "query", n);
3502
- },
3503
- GetPurchasingCustomerPointChangeActivities(n, r) {
3504
- return t((i) => e.request(ln, n, { ...r, ...i }), "GetPurchasingCustomerPointChangeActivities", "query", n);
3505
- },
3506
- GetPurchasingCustomerRank(n, r) {
3507
- return t((i) => e.request(dn, n, { ...r, ...i }), "GetPurchasingCustomerRank", "query", n);
3508
- },
3509
- GetSharingPurchasingCustomerCount(n, r) {
3510
- return t((i) => e.request(hn, n, { ...r, ...i }), "GetSharingPurchasingCustomerCount", "query", n);
3511
- },
3512
- GetPurchasingCustomerSharing(n, r) {
3513
- return t((i) => e.request(pn, n, { ...r, ...i }), "GetPurchasingCustomerSharing", "query", n);
3514
- },
3515
- GetProduct(n, r) {
3516
- return t((i) => e.request(fn, n, { ...r, ...i }), "GetProduct", "query", n);
3517
- },
3518
- GetPointCampaignOrderRuleTargetCustomerRank(n, r) {
3519
- return t((i) => e.request(mn, n, { ...r, ...i }), "GetPointCampaignOrderRuleTargetCustomerRank", "query", n);
3520
- },
3521
- PurchasingCustomerSendCustomerSharingActivationCode(n, r) {
3522
- return t((i) => e.request(gn, n, { ...r, ...i }), "PurchasingCustomerSendCustomerSharingActivationCode", "mutation", n);
3523
- },
3524
- PurchasingCustomerActivateCustomerSharing(n, r) {
3525
- return t((i) => e.request(yn, n, { ...r, ...i }), "PurchasingCustomerActivateCustomerSharing", "mutation", n);
3526
- }
3527
- };
3528
- }
3529
- class An {
3518
+ const de = async (e) => {
3519
+ const { query: t, variables: n, fetchOptions: r } = e, i = Cn(cn(e.method ?? "post")), s = Array.isArray(e.query), o = await i(e), c = await An(o, r.jsonSerializer ?? ve), p = Array.isArray(c) ? !c.some(({ data: m }) => !m) : !!c.data, h = Array.isArray(c) || !c.errors || Array.isArray(c.errors) && !c.errors.length || r.errorPolicy === "all" || r.errorPolicy === "ignore";
3520
+ if (o.ok && h && p) {
3521
+ const { errors: m, ...y } = (Array.isArray(c), c), C = r.errorPolicy === "ignore" ? y : c;
3522
+ return {
3523
+ ...s ? { data: C } : C,
3524
+ headers: o.headers,
3525
+ status: o.status
3526
+ };
3527
+ } else {
3528
+ const m = typeof c == "string" ? {
3529
+ error: c
3530
+ } : c;
3531
+ throw new H(
3532
+ // @ts-expect-error TODO
3533
+ { ...m, status: o.status, headers: o.headers },
3534
+ { query: t, variables: n }
3535
+ );
3536
+ }
3537
+ }, vn = (e, t, n, r) => {
3538
+ const i = r ?? ve;
3539
+ if (!Array.isArray(e))
3540
+ return i.stringify({ query: e, variables: t, operationName: n });
3541
+ if (typeof t < "u" && !Array.isArray(t))
3542
+ throw new Error("Cannot create request body with given variable type, array expected");
3543
+ const s = e.reduce((o, c, p) => (o.push({ query: c, variables: t ? t[p] : void 0 }), o), []);
3544
+ return i.stringify(s);
3545
+ }, An = async (e, t) => {
3546
+ let n;
3547
+ return e.headers.forEach((r, i) => {
3548
+ i.toLowerCase() === "content-type" && (n = r);
3549
+ }), n && (n.toLowerCase().startsWith("application/json") || n.toLowerCase().startsWith("application/graphql+json") || n.toLowerCase().startsWith("application/graphql-response+json")) ? t.parse(await e.text()) : e.text();
3550
+ }, pe = (e) => typeof e == "function" ? e() : e;
3551
+ var Tn = /* @__PURE__ */ ((e) => (e.Eur = "EUR", e.Jpy = "JPY", e.Usd = "USD", e))(Tn || {});
3552
+ class In {
3530
3553
  constructor(t) {
3531
3554
  Ae(this, "api");
3532
- this.api = En(
3533
- new Ht(`${t}/apps/sq-api`, {
3555
+ this.api = un(
3556
+ new En(`${t}/apps/sq-api`, {
3534
3557
  headers: {
3535
3558
  "X-SQ-CLIENT": "ShopifyAppProxy"
3536
3559
  }
@@ -3622,14 +3645,18 @@ class An {
3622
3645
  })).purchasingCustomerMetafield ?? null;
3623
3646
  }
3624
3647
  /**
3625
- * getPoints は、現在の保有ポイントと、獲得予定ポイントを返します。
3626
- * 存在しない場合は0を返します。
3648
+ * getPoints は、Points は SDK から取得できるポイントの情報を返します。
3627
3649
  */
3628
3650
  async getPoints() {
3629
3651
  const t = await this.api.GetPoints();
3630
3652
  return t.purchasingCustomer ? {
3631
3653
  pointsApproved: t.purchasingCustomer.pointsApproved,
3632
- pointsPending: t.purchasingCustomer.pointsPending
3654
+ pointsPending: t.purchasingCustomer.pointsPending,
3655
+ pointsExpiringSoon: t.purchasingCustomer.pointsExpiringSoon ? {
3656
+ points: t.purchasingCustomer.pointsExpiringSoon.points,
3657
+ expiresDate: new Date(t.purchasingCustomer.pointsExpiringSoon.expiresDate),
3658
+ availableUntil: new Date(t.purchasingCustomer.pointsExpiringSoon.availableUntil)
3659
+ } : void 0
3633
3660
  } : null;
3634
3661
  }
3635
3662
  /**
@@ -3883,6 +3910,32 @@ class An {
3883
3910
  fixedPoint: t.pointCampaignOrderRuleTargetCustomerRank.fixedPoint ? t.pointCampaignOrderRuleTargetCustomerRank.fixedPoint : void 0
3884
3911
  } : null;
3885
3912
  }
3913
+ async getEstimatedShopifyCartPoint(t, n, r) {
3914
+ const i = await this.api.GetEstimatedShopifyCartPoint({
3915
+ input: {
3916
+ currencyCode: t,
3917
+ taxesIncluded: n,
3918
+ lineItems: r
3919
+ }
3920
+ });
3921
+ return i.estimatedShopifyCartPoint ? {
3922
+ pointsEarned: i.estimatedShopifyCartPoint.pointsEarned
3923
+ } : null;
3924
+ }
3925
+ async getEstimatedShopifyCartLineItemPoint(t, n, r, i, s) {
3926
+ const o = await this.api.GetEstimatedShopifyCartLineItemPoint({
3927
+ input: {
3928
+ currencyCode: t,
3929
+ taxesIncluded: n,
3930
+ sku: r,
3931
+ quantity: i,
3932
+ unitPrice: s
3933
+ }
3934
+ });
3935
+ return o.estimatedShopifyCartLineItemPoint ? {
3936
+ pointsEarned: o.estimatedShopifyCartLineItemPoint.pointsEarned
3937
+ } : null;
3938
+ }
3886
3939
  /**
3887
3940
  * purchasingCustomerSendCustomerSharingActivationCode はログインしているアカウントのメールアドレスに顧客情報共有のためのアクティベーションコードを送信します。
3888
3941
  */
@@ -3923,5 +3976,6 @@ class An {
3923
3976
  }
3924
3977
  }
3925
3978
  export {
3926
- An as SDK
3979
+ Tn as CurrencyCode,
3980
+ In as SDK
3927
3981
  };