@ticketapp-dev/shop-sdk 1.0.27 → 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -60,22 +60,22 @@ function et(e) {
60
60
  }
61
61
  function Re(e, t) {
62
62
  const n = e.locationOffset.column - 1, r = "".padStart(n) + e.body, i = t.line - 1, s = e.locationOffset.line - 1, o = t.line + s, u = t.line === 1 ? n : 0, h = t.column + u, p = `${e.name}:${o}:${h}
63
- `, c = r.split(/\r\n|[\n\r]/g), g = c[i];
64
- if (g.length > 120) {
65
- const m = Math.floor(h / 80), y = h % 80, I = [];
66
- for (let T = 0; T < g.length; T += 80)
67
- I.push(g.slice(T, T + 80));
63
+ `, c = r.split(/\r\n|[\n\r]/g), m = c[i];
64
+ if (m.length > 120) {
65
+ const g = Math.floor(h / 80), y = h % 80, I = [];
66
+ for (let O = 0; O < m.length; O += 80)
67
+ I.push(m.slice(O, O + 80));
68
68
  return p + he([
69
69
  [`${o} |`, I[0]],
70
- ...I.slice(1, m + 1).map((T) => ["|", T]),
70
+ ...I.slice(1, g + 1).map((O) => ["|", O]),
71
71
  ["|", "^".padStart(y)],
72
- ["|", I[m + 1]]
72
+ ["|", I[g + 1]]
73
73
  ]);
74
74
  }
75
75
  return p + he([
76
76
  // Lines specified like this: ["prefix", "string"],
77
77
  [`${o - 1} |`, c[i - 1]],
78
- [`${o} |`, g],
78
+ [`${o} |`, m],
79
79
  ["|", "^".padStart(h)],
80
80
  [`${o + 1} |`, c[i + 1]]
81
81
  ]);
@@ -137,18 +137,18 @@ class ue extends Error {
137
137
  */
138
138
  constructor(t, ...n) {
139
139
  var r, i, s;
140
- const { nodes: o, source: u, positions: h, path: p, originalError: c, extensions: g } = tt(n);
140
+ const { nodes: o, source: u, positions: h, path: p, originalError: c, extensions: m } = tt(n);
141
141
  super(t), this.name = "GraphQLError", this.path = p ?? void 0, this.originalError = c ?? void 0, this.nodes = fe(
142
142
  Array.isArray(o) ? o : o ? [o] : void 0
143
143
  );
144
- const m = fe(
144
+ const g = fe(
145
145
  (r = this.nodes) === null || r === void 0 ? void 0 : r.map((I) => I.loc).filter((I) => I != null)
146
146
  );
147
- this.source = u ?? (m == null || (i = m[0]) === null || i === void 0 ? void 0 : i.source), this.positions = h ?? m?.map((I) => I.start), this.locations = h && u ? h.map((I) => se(u, I)) : m?.map((I) => se(I.source, I.start));
147
+ this.source = u ?? (g == null || (i = g[0]) === null || i === void 0 ? void 0 : i.source), this.positions = h ?? g?.map((I) => I.start), this.locations = h && u ? h.map((I) => se(u, I)) : g?.map((I) => se(I.source, I.start));
148
148
  const y = Ke(
149
149
  c?.extensions
150
150
  ) ? c?.extensions : void 0;
151
- this.extensions = (s = g ?? y) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
151
+ this.extensions = (s = m ?? y) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
152
152
  message: {
153
153
  writable: !0,
154
154
  enumerable: !0
@@ -205,7 +205,7 @@ class ue extends Error {
205
205
  function fe(e) {
206
206
  return e === void 0 || e.length === 0 ? void 0 : e;
207
207
  }
208
- function A(e, t, n) {
208
+ function k(e, t, n) {
209
209
  return new ue(`Syntax Error: ${n}`, {
210
210
  source: e,
211
211
  positions: [t]
@@ -370,7 +370,7 @@ const we = {
370
370
  DirectiveCoordinate: ["name"],
371
371
  DirectiveArgumentCoordinate: ["name", "argumentName"]
372
372
  }, rt = new Set(Object.keys(we));
373
- function ge(e) {
373
+ function me(e) {
374
374
  const t = e?.kind;
375
375
  return typeof t == "string" && rt.has(t);
376
376
  }
@@ -426,11 +426,11 @@ function at(e, t) {
426
426
  // add leading and trailing new lines only if it improves readability
427
427
  !i || e.length > 70 || p || s || o
428
428
  );
429
- let g = "";
430
- const m = i && ae(e.charCodeAt(0));
431
- return (c && !m || s) && (g += `
432
- `), g += n, (c || p) && (g += `
433
- `), '"""' + g + '"""';
429
+ let m = "";
430
+ const g = i && ae(e.charCodeAt(0));
431
+ return (c && !g || s) && (m += `
432
+ `), m += n, (c || p) && (m += `
433
+ `), '"""' + m + '"""';
434
434
  }
435
435
  var a;
436
436
  (function(e) {
@@ -597,7 +597,7 @@ function ut(e, t) {
597
597
  return pt(e, i, s);
598
598
  if (Be(s))
599
599
  return Et(e, i);
600
- throw A(
600
+ throw k(
601
601
  e.source,
602
602
  i,
603
603
  s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : $(s) || W(n, i) ? `Unexpected character: ${F(e, i)}.` : `Invalid character: ${F(e, i)}.`
@@ -632,7 +632,7 @@ function pt(e, t, n) {
632
632
  let i = t, s = n, o = !1;
633
633
  if (s === 45 && (s = r.charCodeAt(++i)), s === 48) {
634
634
  if (s = r.charCodeAt(++i), M(s))
635
- throw A(
635
+ throw k(
636
636
  e.source,
637
637
  i,
638
638
  `Invalid number, unexpected digit after 0: ${F(
@@ -643,7 +643,7 @@ function pt(e, t, n) {
643
643
  } else
644
644
  i = ne(e, i, s), s = r.charCodeAt(i);
645
645
  if (s === 46 && (o = !0, s = r.charCodeAt(++i), i = ne(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 = ne(e, i, s), s = r.charCodeAt(i)), s === 46 || Be(s))
646
- throw A(
646
+ throw k(
647
647
  e.source,
648
648
  i,
649
649
  `Invalid number, expected digit but got: ${F(
@@ -661,7 +661,7 @@ function pt(e, t, n) {
661
661
  }
662
662
  function ne(e, t, n) {
663
663
  if (!M(n))
664
- throw A(
664
+ throw k(
665
665
  e.source,
666
666
  t,
667
667
  `Invalid number, expected digit but got: ${F(
@@ -684,7 +684,7 @@ function ht(e, t) {
684
684
  return o += n.slice(s, i), v(e, a.STRING, t, i + 1, o);
685
685
  if (u === 92) {
686
686
  o += n.slice(s, i);
687
- const h = n.charCodeAt(i + 1) === 117 ? n.charCodeAt(i + 2) === 123 ? ft(e, i) : gt(e, i) : mt(e, i);
687
+ const h = n.charCodeAt(i + 1) === 117 ? n.charCodeAt(i + 2) === 123 ? ft(e, i) : mt(e, i) : gt(e, i);
688
688
  o += h.value, i += h.size, s = i;
689
689
  continue;
690
690
  }
@@ -695,7 +695,7 @@ function ht(e, t) {
695
695
  else if (W(n, i))
696
696
  i += 2;
697
697
  else
698
- throw A(
698
+ throw k(
699
699
  e.source,
700
700
  i,
701
701
  `Invalid character within String: ${F(
@@ -704,7 +704,7 @@ function ht(e, t) {
704
704
  )}.`
705
705
  );
706
706
  }
707
- throw A(e.source, i, "Unterminated string.");
707
+ throw k(e.source, i, "Unterminated string.");
708
708
  }
709
709
  function ft(e, t) {
710
710
  const n = e.source.body;
@@ -722,7 +722,7 @@ function ft(e, t) {
722
722
  if (r = r << 4 | U(s), r < 0)
723
723
  break;
724
724
  }
725
- throw A(
725
+ throw k(
726
726
  e.source,
727
727
  t,
728
728
  `Invalid Unicode escape sequence: "${n.slice(
@@ -731,34 +731,34 @@ function ft(e, t) {
731
731
  )}".`
732
732
  );
733
733
  }
734
- function gt(e, t) {
735
- const n = e.source.body, r = me(n, t + 2);
734
+ function mt(e, t) {
735
+ const n = e.source.body, r = ge(n, t + 2);
736
736
  if ($(r))
737
737
  return {
738
738
  value: String.fromCodePoint(r),
739
739
  size: 6
740
740
  };
741
741
  if (Ve(r) && n.charCodeAt(t + 6) === 92 && n.charCodeAt(t + 7) === 117) {
742
- const i = me(n, t + 8);
742
+ const i = ge(n, t + 8);
743
743
  if (Ue(i))
744
744
  return {
745
745
  value: String.fromCodePoint(r, i),
746
746
  size: 12
747
747
  };
748
748
  }
749
- throw A(
749
+ throw k(
750
750
  e.source,
751
751
  t,
752
752
  `Invalid Unicode escape sequence: "${n.slice(t, t + 6)}".`
753
753
  );
754
754
  }
755
- function me(e, t) {
755
+ function ge(e, t) {
756
756
  return U(e.charCodeAt(t)) << 12 | U(e.charCodeAt(t + 1)) << 8 | U(e.charCodeAt(t + 2)) << 4 | U(e.charCodeAt(t + 3));
757
757
  }
758
758
  function U(e) {
759
759
  return e >= 48 && e <= 57 ? e - 48 : e >= 65 && e <= 70 ? e - 55 : e >= 97 && e <= 102 ? e - 87 : -1;
760
760
  }
761
- function mt(e, t) {
761
+ function gt(e, t) {
762
762
  const n = e.source.body;
763
763
  switch (n.charCodeAt(t + 1)) {
764
764
  case 34:
@@ -803,7 +803,7 @@ function mt(e, t) {
803
803
  size: 2
804
804
  };
805
805
  }
806
- throw A(
806
+ throw k(
807
807
  e.source,
808
808
  t,
809
809
  `Invalid character escape sequence: "${n.slice(
@@ -844,7 +844,7 @@ function It(e, t) {
844
844
  else if (W(n, s))
845
845
  s += 2;
846
846
  else
847
- throw A(
847
+ throw k(
848
848
  e.source,
849
849
  s,
850
850
  `Invalid character within String: ${F(
@@ -853,7 +853,7 @@ function It(e, t) {
853
853
  )}.`
854
854
  );
855
855
  }
856
- throw A(e.source, s, "Unterminated string.");
856
+ throw k(e.source, s, "Unterminated string.");
857
857
  }
858
858
  function Et(e, t) {
859
859
  const n = e.source.body, r = n.length;
@@ -895,24 +895,24 @@ function vt(e, t) {
895
895
  if (t.includes(e))
896
896
  return "[Circular]";
897
897
  const n = [...t, e];
898
- if (At(e)) {
898
+ if (kt(e)) {
899
899
  const r = e.toJSON();
900
900
  if (r !== e)
901
901
  return typeof r == "string" ? r : Z(r, n);
902
902
  } else if (Array.isArray(e))
903
- return Tt(e, n);
904
- return kt(e, n);
903
+ return Ot(e, n);
904
+ return At(e, n);
905
905
  }
906
- function At(e) {
906
+ function kt(e) {
907
907
  return typeof e.toJSON == "function";
908
908
  }
909
- function kt(e, t) {
909
+ function At(e, t) {
910
910
  const n = Object.entries(e);
911
- return n.length === 0 ? "{}" : t.length > Me ? "[" + Ot(e) + "]" : "{ " + n.map(
911
+ return n.length === 0 ? "{}" : t.length > Me ? "[" + Tt(e) + "]" : "{ " + n.map(
912
912
  ([i, s]) => i + ": " + Z(s, t)
913
913
  ).join(", ") + " }";
914
914
  }
915
- function Tt(e, t) {
915
+ function Ot(e, t) {
916
916
  if (e.length === 0)
917
917
  return "[]";
918
918
  if (t.length > Me)
@@ -922,7 +922,7 @@ function Tt(e, t) {
922
922
  i.push(Z(e[s], t));
923
923
  return r === 1 ? i.push("... 1 more item") : r > 1 && i.push(`... ${r} more items`), "[" + i.join(", ") + "]";
924
924
  }
925
- function Ot(e) {
925
+ function Tt(e) {
926
926
  const t = Object.prototype.toString.call(e).replace(/^\[object /, "").replace(/]$/, "");
927
927
  if (t === "Object" && typeof e.constructor == "function") {
928
928
  const n = e.constructor.name;
@@ -1058,7 +1058,7 @@ class bt {
1058
1058
  return this.parseOperationDefinition();
1059
1059
  const t = this.peekDescription(), n = t ? this._lexer.lookahead() : this._lexer.token;
1060
1060
  if (t && n.kind === a.BRACE_L)
1061
- throw A(
1061
+ throw k(
1062
1062
  this._lexer.source,
1063
1063
  this._lexer.token.start,
1064
1064
  "Unexpected description, descriptions are not supported on shorthand queries."
@@ -1091,7 +1091,7 @@ class bt {
1091
1091
  return this.parseFragmentDefinition();
1092
1092
  }
1093
1093
  if (t)
1094
- throw A(
1094
+ throw k(
1095
1095
  this._lexer.source,
1096
1096
  this._lexer.token.start,
1097
1097
  "Unexpected description, only GraphQL definitions support descriptions."
@@ -1362,7 +1362,7 @@ class bt {
1362
1362
  if (t)
1363
1363
  if (this.expectToken(a.DOLLAR), this._lexer.token.kind === a.NAME) {
1364
1364
  const r = this._lexer.token.value;
1365
- throw A(
1365
+ throw k(
1366
1366
  this._lexer.source,
1367
1367
  n.start,
1368
1368
  `Unexpected variable "$${r}" in constant value.`
@@ -1709,7 +1709,7 @@ class bt {
1709
1709
  */
1710
1710
  parseEnumValueName() {
1711
1711
  if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null")
1712
- throw A(
1712
+ throw k(
1713
1713
  this._lexer.source,
1714
1714
  this._lexer.token.start,
1715
1715
  `${z(
@@ -2037,7 +2037,7 @@ class bt {
2037
2037
  const n = this._lexer.token;
2038
2038
  if (n.kind === t)
2039
2039
  return this.advanceLexer(), n;
2040
- throw A(
2040
+ throw k(
2041
2041
  this._lexer.source,
2042
2042
  n.start,
2043
2043
  `Expected ${ze(t)}, found ${z(n)}.`
@@ -2059,7 +2059,7 @@ class bt {
2059
2059
  if (n.kind === a.NAME && n.value === t)
2060
2060
  this.advanceLexer();
2061
2061
  else
2062
- throw A(
2062
+ throw k(
2063
2063
  this._lexer.source,
2064
2064
  n.start,
2065
2065
  `Expected "${t}", found ${z(n)}.`
@@ -2078,7 +2078,7 @@ class bt {
2078
2078
  */
2079
2079
  unexpected(t) {
2080
2080
  const n = t ?? this._lexer.token;
2081
- return A(
2081
+ return k(
2082
2082
  this._lexer.source,
2083
2083
  n.start,
2084
2084
  `Unexpected ${z(n)}.`
@@ -2141,7 +2141,7 @@ class bt {
2141
2141
  advanceLexer() {
2142
2142
  const { maxTokens: t } = this._options, n = this._lexer.advance();
2143
2143
  if (n.kind !== a.EOF && (++this._tokenCounter, t !== void 0 && this._tokenCounter > t))
2144
- throw A(
2144
+ throw k(
2145
2145
  this._lexer.source,
2146
2146
  n.start,
2147
2147
  `Document contains more that ${t} tokens. Parsing aborted.`
@@ -2331,64 +2331,64 @@ const Lt = [
2331
2331
  ], Rt = Object.freeze({});
2332
2332
  function Ft(e, t, n = we) {
2333
2333
  const r = /* @__PURE__ */ new Map();
2334
- for (const O of Object.values(l))
2335
- r.set(O, wt(t, O));
2336
- let i, s = Array.isArray(e), o = [e], u = -1, h = [], p = e, c, g;
2337
- const m = [], y = [];
2334
+ for (const T of Object.values(l))
2335
+ r.set(T, wt(t, T));
2336
+ let i, s = Array.isArray(e), o = [e], u = -1, h = [], p = e, c, m;
2337
+ const g = [], y = [];
2338
2338
  do {
2339
2339
  u++;
2340
- const O = u === o.length, L = O && h.length !== 0;
2341
- if (O) {
2342
- if (c = y.length === 0 ? void 0 : m[m.length - 1], p = g, g = y.pop(), L)
2340
+ const T = u === o.length, L = T && h.length !== 0;
2341
+ if (T) {
2342
+ if (c = y.length === 0 ? void 0 : g[g.length - 1], p = m, m = y.pop(), L)
2343
2343
  if (s) {
2344
2344
  p = p.slice();
2345
- let P = 0;
2346
- for (const [D, b] of h) {
2347
- const S = D - P;
2348
- b === null ? (p.splice(S, 1), P++) : p[S] = b;
2345
+ let N = 0;
2346
+ for (const [D, P] of h) {
2347
+ const b = D - N;
2348
+ P === null ? (p.splice(b, 1), N++) : p[b] = P;
2349
2349
  }
2350
2350
  } else {
2351
2351
  p = { ...p };
2352
- for (const [P, D] of h)
2353
- p[P] = D;
2352
+ for (const [N, D] of h)
2353
+ p[N] = D;
2354
2354
  }
2355
2355
  u = i.index, o = i.keys, h = i.edits, s = i.inArray, i = i.prev;
2356
- } else if (g) {
2357
- if (c = s ? u : o[u], p = g[c], p == null)
2356
+ } else if (m) {
2357
+ if (c = s ? u : o[u], p = m[c], p == null)
2358
2358
  continue;
2359
- m.push(c);
2359
+ g.push(c);
2360
2360
  }
2361
- let k;
2361
+ let A;
2362
2362
  if (!Array.isArray(p)) {
2363
- var I, T;
2364
- ge(p) || G(!1, `Invalid AST Node: ${le(p)}.`);
2365
- const P = O ? (I = r.get(p.kind)) === null || I === void 0 ? void 0 : I.leave : (T = r.get(p.kind)) === null || T === void 0 ? void 0 : T.enter;
2366
- if (k = P?.call(t, p, c, g, m, y), k === Rt)
2363
+ var I, O;
2364
+ me(p) || G(!1, `Invalid AST Node: ${le(p)}.`);
2365
+ const N = T ? (I = r.get(p.kind)) === null || I === void 0 ? void 0 : I.leave : (O = r.get(p.kind)) === null || O === void 0 ? void 0 : O.enter;
2366
+ if (A = N?.call(t, p, c, m, g, y), A === Rt)
2367
2367
  break;
2368
- if (k === !1) {
2369
- if (!O) {
2370
- m.pop();
2368
+ if (A === !1) {
2369
+ if (!T) {
2370
+ g.pop();
2371
2371
  continue;
2372
2372
  }
2373
- } else if (k !== void 0 && (h.push([c, k]), !O))
2374
- if (ge(k))
2375
- p = k;
2373
+ } else if (A !== void 0 && (h.push([c, A]), !T))
2374
+ if (me(A))
2375
+ p = A;
2376
2376
  else {
2377
- m.pop();
2377
+ g.pop();
2378
2378
  continue;
2379
2379
  }
2380
2380
  }
2381
- if (k === void 0 && L && h.push([c, p]), O)
2382
- m.pop();
2381
+ if (A === void 0 && L && h.push([c, p]), T)
2382
+ g.pop();
2383
2383
  else {
2384
- var N;
2384
+ var x;
2385
2385
  i = {
2386
2386
  inArray: s,
2387
2387
  index: u,
2388
2388
  keys: o,
2389
2389
  edits: h,
2390
2390
  prev: i
2391
- }, s = Array.isArray(p), o = s ? p : (N = n[p.kind]) !== null && N !== void 0 ? N : [], u = -1, h = [], g && y.push(g), g = p;
2391
+ }, s = Array.isArray(p), o = s ? p : (x = n[p.kind]) !== null && x !== void 0 ? x : [], u = -1, h = [], m && y.push(m), m = p;
2392
2392
  }
2393
2393
  } while (i !== void 0);
2394
2394
  return h.length !== 0 ? h[h.length - 1][1] : e;
@@ -2441,7 +2441,7 @@ const Bt = 80, Vt = {
2441
2441
  `) + e + ": " + t + f(" = ", n) + f(" ", d(r, " "))
2442
2442
  },
2443
2443
  SelectionSet: {
2444
- leave: ({ selections: e }) => C(e)
2444
+ leave: ({ selections: e }) => S(e)
2445
2445
  },
2446
2446
  Field: {
2447
2447
  leave({ alias: e, name: t, arguments: n, directives: r, selectionSet: i }) {
@@ -2529,7 +2529,7 @@ const Bt = 80, Vt = {
2529
2529
  // Type System Definitions
2530
2530
  SchemaDefinition: {
2531
2531
  leave: ({ description: e, directives: t, operationTypes: n }) => f("", e, `
2532
- `) + d(["schema", d(t, " "), C(n)], " ")
2532
+ `) + d(["schema", d(t, " "), S(n)], " ")
2533
2533
  },
2534
2534
  OperationTypeDefinition: {
2535
2535
  leave: ({ operation: e, type: t }) => e + ": " + t
@@ -2546,7 +2546,7 @@ const Bt = 80, Vt = {
2546
2546
  t,
2547
2547
  f("implements ", d(n, " & ")),
2548
2548
  d(r, " "),
2549
- C(i)
2549
+ S(i)
2550
2550
  ],
2551
2551
  " "
2552
2552
  )
@@ -2573,7 +2573,7 @@ const Bt = 80, Vt = {
2573
2573
  t,
2574
2574
  f("implements ", d(n, " & ")),
2575
2575
  d(r, " "),
2576
- C(i)
2576
+ S(i)
2577
2577
  ],
2578
2578
  " "
2579
2579
  )
@@ -2587,7 +2587,7 @@ const Bt = 80, Vt = {
2587
2587
  },
2588
2588
  EnumTypeDefinition: {
2589
2589
  leave: ({ description: e, name: t, directives: n, values: r }) => f("", e, `
2590
- `) + d(["enum", t, d(n, " "), C(r)], " ")
2590
+ `) + d(["enum", t, d(n, " "), S(r)], " ")
2591
2591
  },
2592
2592
  EnumValueDefinition: {
2593
2593
  leave: ({ description: e, name: t, directives: n }) => f("", e, `
@@ -2595,7 +2595,7 @@ const Bt = 80, Vt = {
2595
2595
  },
2596
2596
  InputObjectTypeDefinition: {
2597
2597
  leave: ({ description: e, name: t, directives: n, fields: r }) => f("", e, `
2598
- `) + d(["input", t, d(n, " "), C(r)], " ")
2598
+ `) + d(["input", t, d(n, " "), S(r)], " ")
2599
2599
  },
2600
2600
  DirectiveDefinition: {
2601
2601
  leave: ({ description: e, name: t, arguments: n, repeatable: r, locations: i }) => f("", e, `
@@ -2606,7 +2606,7 @@ const Bt = 80, Vt = {
2606
2606
  },
2607
2607
  SchemaExtension: {
2608
2608
  leave: ({ directives: e, operationTypes: t }) => d(
2609
- ["extend schema", d(e, " "), C(t)],
2609
+ ["extend schema", d(e, " "), S(t)],
2610
2610
  " "
2611
2611
  )
2612
2612
  },
@@ -2620,7 +2620,7 @@ const Bt = 80, Vt = {
2620
2620
  e,
2621
2621
  f("implements ", d(t, " & ")),
2622
2622
  d(n, " "),
2623
- C(r)
2623
+ S(r)
2624
2624
  ],
2625
2625
  " "
2626
2626
  )
@@ -2632,7 +2632,7 @@ const Bt = 80, Vt = {
2632
2632
  e,
2633
2633
  f("implements ", d(t, " & ")),
2634
2634
  d(n, " "),
2635
- C(r)
2635
+ S(r)
2636
2636
  ],
2637
2637
  " "
2638
2638
  )
@@ -2649,10 +2649,10 @@ const Bt = 80, Vt = {
2649
2649
  )
2650
2650
  },
2651
2651
  EnumTypeExtension: {
2652
- leave: ({ name: e, directives: t, values: n }) => d(["extend enum", e, d(t, " "), C(n)], " ")
2652
+ leave: ({ name: e, directives: t, values: n }) => d(["extend enum", e, d(t, " "), S(n)], " ")
2653
2653
  },
2654
2654
  InputObjectTypeExtension: {
2655
- leave: ({ name: e, directives: t, fields: n }) => d(["extend input", e, d(t, " "), C(n)], " ")
2655
+ leave: ({ name: e, directives: t, fields: n }) => d(["extend input", e, d(t, " "), S(n)], " ")
2656
2656
  },
2657
2657
  // Schema Coordinates
2658
2658
  TypeCoordinate: {
@@ -2675,7 +2675,7 @@ function d(e, t = "") {
2675
2675
  var n;
2676
2676
  return (n = e?.filter((r) => r).join(t)) !== null && n !== void 0 ? n : "";
2677
2677
  }
2678
- function C(e) {
2678
+ function S(e) {
2679
2679
  return f(`{
2680
2680
  `, Y(d(e, `
2681
2681
  `)), `
@@ -2856,6 +2856,37 @@ const Qt = E`
2856
2856
  }
2857
2857
  }
2858
2858
  `, Jt = E`
2859
+ query findOrderById($id: String, $reference: String) {
2860
+ findOrder(id: $id, reference: $reference) {
2861
+ id
2862
+ reference
2863
+ organization {
2864
+ name
2865
+ paymentBanner
2866
+ }
2867
+ currency
2868
+ items {
2869
+ id
2870
+ name
2871
+ price
2872
+ depositPrice
2873
+ discountedPrice
2874
+ amount
2875
+ type
2876
+ event {
2877
+ name
2878
+ startAt
2879
+ banner
2880
+ }
2881
+ package {
2882
+ name
2883
+ banner
2884
+ }
2885
+ }
2886
+ downloadCode
2887
+ }
2888
+ }
2889
+ `, Xt = E`
2859
2890
  mutation addToOrder($orderId: ID!, $productId: ID!, $shopId: ID, $additionalData: AdditionalDataInput, $trackerId: ID, $amount: Int) {
2860
2891
  reserveProduct(
2861
2892
  input: {orderId: $orderId, productId: $productId, additionalData: $additionalData, trackerId: $trackerId, shopId: $shopId, amountToIncrease: $amount}
@@ -2865,7 +2896,7 @@ const Qt = E`
2865
2896
  amountReserved
2866
2897
  }
2867
2898
  }
2868
- `, Xt = E`
2899
+ `, Kt = E`
2869
2900
  mutation removeFromOrder($orderId: ID!, $productId: ID!, $additionalData: AdditionalDataInput, $amount: Int) {
2870
2901
  releaseProduct(
2871
2902
  input: {orderId: $orderId, productId: $productId, additionalData: $additionalData, amountToRelease: $amount}
@@ -2874,7 +2905,7 @@ const Qt = E`
2874
2905
  amountReleased
2875
2906
  }
2876
2907
  }
2877
- `, Kt = E`
2908
+ `, Wt = E`
2878
2909
  mutation configurePackage($orderId: ID!, $packageId: ID!, $amount: Int!, $items: [ReservedItem!]!, $shopId: ID, $trackerId: ID) {
2879
2910
  configurePackage(
2880
2911
  input: {orderId: $orderId, shopId: $shopId, trackerId: $trackerId, packageId: $packageId, amount: $amount, items: $items}
@@ -2884,7 +2915,7 @@ const Qt = E`
2884
2915
  amountReserved
2885
2916
  }
2886
2917
  }
2887
- `, Wt = E`
2918
+ `, Zt = E`
2888
2919
  mutation reserveAdditionalPackageItem($amount: Int!, $orderId: ID!, $packageId: ID!, $eventId: ID!, $packageItemId: ID!) {
2889
2920
  reserveAdditionalPackageItem(
2890
2921
  input: {amount: $amount, eventId: $eventId, orderId: $orderId, packageId: $packageId, packageItemId: $packageItemId}
@@ -2894,57 +2925,67 @@ const Qt = E`
2894
2925
  amountReserved
2895
2926
  }
2896
2927
  }
2897
- `, Zt = E`
2928
+ `, en = E`
2898
2929
  mutation configureOrderDeliveryOption($orderId: ID!, $productId: ID) {
2899
2930
  configureDeliveryOption(input: {orderId: $orderId, productId: $productId})
2900
2931
  }
2901
- `, en = E`
2932
+ `, tn = E`
2902
2933
  mutation createOrderCustomer($orderId: ID!, $countryCode: String, $customer: CreateCustomerInput!) {
2903
2934
  createOrderCustomer(
2904
2935
  input: {id: $orderId, countryCode: $countryCode, customer: $customer}
2905
2936
  )
2906
2937
  }
2907
- `, tn = E`
2938
+ `, nn = E`
2908
2939
  mutation deleteOrder($orderId: ID!) {
2909
2940
  cancelOrder(id: $orderId)
2910
2941
  }
2911
- `, nn = (e, t, n, r) => e();
2912
- function rn(e, t = nn) {
2942
+ `, rn = (e, t, n, r) => e();
2943
+ function sn(e, t = rn) {
2913
2944
  return {
2914
2945
  findActiveOrderById(n, r, i) {
2915
2946
  return t((s) => e.request({ document: Qt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findActiveOrderById", "query", n);
2916
2947
  },
2948
+ findOrderById(n, r, i) {
2949
+ return t((s) => e.request({ document: Jt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findOrderById", "query", n);
2950
+ },
2917
2951
  addToOrder(n, r, i) {
2918
- return t((s) => e.request({ document: Jt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "addToOrder", "mutation", n);
2952
+ return t((s) => e.request({ document: Xt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "addToOrder", "mutation", n);
2919
2953
  },
2920
2954
  removeFromOrder(n, r, i) {
2921
- return t((s) => e.request({ document: Xt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "removeFromOrder", "mutation", n);
2955
+ return t((s) => e.request({ document: Kt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "removeFromOrder", "mutation", n);
2922
2956
  },
2923
2957
  configurePackage(n, r, i) {
2924
- return t((s) => e.request({ document: Kt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "configurePackage", "mutation", n);
2958
+ return t((s) => e.request({ document: Wt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "configurePackage", "mutation", n);
2925
2959
  },
2926
2960
  reserveAdditionalPackageItem(n, r, i) {
2927
- return t((s) => e.request({ document: Wt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "reserveAdditionalPackageItem", "mutation", n);
2961
+ return t((s) => e.request({ document: Zt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "reserveAdditionalPackageItem", "mutation", n);
2928
2962
  },
2929
2963
  configureOrderDeliveryOption(n, r, i) {
2930
- return t((s) => e.request({ document: Zt, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "configureOrderDeliveryOption", "mutation", n);
2964
+ return t((s) => e.request({ document: en, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "configureOrderDeliveryOption", "mutation", n);
2931
2965
  },
2932
2966
  createOrderCustomer(n, r, i) {
2933
- return t((s) => e.request({ document: en, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "createOrderCustomer", "mutation", n);
2967
+ return t((s) => e.request({ document: tn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "createOrderCustomer", "mutation", n);
2934
2968
  },
2935
2969
  deleteOrder(n, r, i) {
2936
- return t((s) => e.request({ document: tn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "deleteOrder", "mutation", n);
2970
+ return t((s) => e.request({ document: nn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "deleteOrder", "mutation", n);
2937
2971
  }
2938
2972
  };
2939
2973
  }
2940
2974
  const Ie = {
2941
2975
  order: null,
2942
2976
  processing: !1,
2943
- error: null
2977
+ error: null,
2978
+ initialized: !0
2944
2979
  }, Ye = Qe({
2945
2980
  name: "basket",
2946
- initialState: Ie,
2981
+ initialState: {
2982
+ ...Ie,
2983
+ initialized: !1
2984
+ },
2947
2985
  reducers: {
2986
+ setInitialized: (e, t) => {
2987
+ e.initialized = t.payload;
2988
+ },
2948
2989
  setProcessing: (e, t) => {
2949
2990
  e.processing = t.payload;
2950
2991
  },
@@ -3090,17 +3131,18 @@ const Ie = {
3090
3131
  clearBasket: () => Ie
3091
3132
  }
3092
3133
  }), {
3093
- setProcessing: x,
3134
+ setInitialized: on,
3135
+ setProcessing: C,
3094
3136
  initializeOrder: j,
3095
3137
  addProduct: Ee,
3096
- removeProduct: sn,
3138
+ removeProduct: an,
3097
3139
  configurePackage: ye,
3098
- configureDelivery: on,
3140
+ configureDelivery: cn,
3099
3141
  configureCustomer: ve,
3100
- reserveAdditionalPackageItem: an,
3101
- clearBasket: Ae
3142
+ reserveAdditionalPackageItem: dn,
3143
+ clearBasket: ke
3102
3144
  } = Ye.actions;
3103
- class cn {
3145
+ class un {
3104
3146
  orderIdKey = "ORDER_ID";
3105
3147
  config;
3106
3148
  sdk;
@@ -3110,8 +3152,8 @@ class cn {
3110
3152
  reducer: {
3111
3153
  basket: Ye.reducer
3112
3154
  }
3113
- }), this.sdk = rn(new de(t.apiUrl)), this.restoreOrderFromSession().then(() => {
3114
- this.debugLog("Restore order from session");
3155
+ }), this.sdk = sn(new de(t.apiUrl)), this.restoreOrderFromSession().then(() => {
3156
+ this.debugLog("Restore order from session"), this.store.dispatch(on(!0));
3115
3157
  });
3116
3158
  }
3117
3159
  // Store functions
@@ -3136,7 +3178,7 @@ class cn {
3136
3178
  }
3137
3179
  // Basket update functions
3138
3180
  async addProduct(t) {
3139
- this.store.dispatch(x(!0));
3181
+ this.store.dispatch(C(!0));
3140
3182
  try {
3141
3183
  const r = this.getState().order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId();
3142
3184
  this.debugLog("Adding product", {
@@ -3178,13 +3220,13 @@ class cn {
3178
3220
  } catch (n) {
3179
3221
  throw this.debugLog("Error adding product", n), this.handleError(n), n;
3180
3222
  } finally {
3181
- this.store.dispatch(x(!1));
3223
+ this.store.dispatch(C(!1));
3182
3224
  }
3183
3225
  }
3184
3226
  async removeProduct(t) {
3185
3227
  const r = this.getState().order;
3186
3228
  if (r) {
3187
- this.store.dispatch(x(!0));
3229
+ this.store.dispatch(C(!0));
3188
3230
  try {
3189
3231
  this.debugLog("Removing product", {
3190
3232
  productId: t.id,
@@ -3205,7 +3247,7 @@ class cn {
3205
3247
  if (i?.releaseProduct) {
3206
3248
  const { amountReleased: s } = i.releaseProduct;
3207
3249
  this.debugLog("Product removed successfully", i.releaseProduct), this.store.dispatch(
3208
- sn({
3250
+ an({
3209
3251
  id: t.id,
3210
3252
  amountReleased: s,
3211
3253
  seatId: t.seat?.id
@@ -3217,12 +3259,12 @@ class cn {
3217
3259
  } catch (i) {
3218
3260
  throw this.debugLog("Error removing product", i), this.handleError(i), i;
3219
3261
  } finally {
3220
- this.store.dispatch(x(!1));
3262
+ this.store.dispatch(C(!1));
3221
3263
  }
3222
3264
  }
3223
3265
  }
3224
3266
  async configurePackage(t) {
3225
- this.store.dispatch(x(!0));
3267
+ this.store.dispatch(C(!0));
3226
3268
  try {
3227
3269
  const r = this.store.getState().basket.order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId(), i = t.items.map((o) => ({
3228
3270
  packageItemId: o.packageItemId,
@@ -3263,17 +3305,17 @@ class cn {
3263
3305
  } catch (n) {
3264
3306
  return this.debugLog("Error configuring package", n), this.handleError(n), { error: n };
3265
3307
  } finally {
3266
- this.store.dispatch(x(!1));
3308
+ this.store.dispatch(C(!1));
3267
3309
  }
3268
3310
  }
3269
3311
  async configureDelivery(t) {
3270
- this.store.dispatch(x(!0));
3312
+ this.store.dispatch(C(!0));
3271
3313
  try {
3272
- this.store.dispatch(on(t));
3314
+ this.store.dispatch(cn(t));
3273
3315
  } catch (n) {
3274
3316
  throw this.debugLog("Error setting delivery", n), this.handleError(n), n;
3275
3317
  } finally {
3276
- this.store.dispatch(x(!1));
3318
+ this.store.dispatch(C(!1));
3277
3319
  }
3278
3320
  }
3279
3321
  async configureCustomer(t) {
@@ -3292,7 +3334,7 @@ class cn {
3292
3334
  }
3293
3335
  }
3294
3336
  async reserveAdditionalPackageItem(t) {
3295
- this.store.dispatch(x(!0));
3337
+ this.store.dispatch(C(!0));
3296
3338
  try {
3297
3339
  const r = this.store.getState().basket.order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId();
3298
3340
  this.debugLog("reserve additional packageItem", {
@@ -3318,7 +3360,7 @@ class cn {
3318
3360
  expiredAt: o
3319
3361
  })
3320
3362
  ), this.store.dispatch(
3321
- an({
3363
+ dn({
3322
3364
  input: t,
3323
3365
  amountReserved: u,
3324
3366
  expiredAt: o
@@ -3329,7 +3371,7 @@ class cn {
3329
3371
  } catch (n) {
3330
3372
  return this.debugLog("Error configuring package", n), this.handleError(n), { error: n };
3331
3373
  } finally {
3332
- this.store.dispatch(x(!1));
3374
+ this.store.dispatch(C(!1));
3333
3375
  }
3334
3376
  }
3335
3377
  // Cancel and clear order functions
@@ -3338,20 +3380,27 @@ class cn {
3338
3380
  t && (this.debugLog("Cancelling order", { orderId: t }), await this.sdk.deleteOrder({ orderId: t }), this.clearOrderFromSession(), this.debugLog("Order cancelled successfully"));
3339
3381
  }
3340
3382
  clearOrderFromSession() {
3341
- this.debugLog("Clearing order from session"), sessionStorage.removeItem(this.orderIdKey), this.store.dispatch(Ae());
3383
+ this.debugLog("Clearing order from session"), sessionStorage.removeItem(this.orderIdKey), this.store.dispatch(ke());
3342
3384
  }
3343
3385
  // Private functions for fetching the current order from a session
3344
3386
  async restoreOrderFromSession() {
3345
3387
  const t = sessionStorage.getItem(this.orderIdKey);
3346
- if (this.store.dispatch(x(!0)), t) {
3388
+ if (t) {
3347
3389
  this.debugLog("Found existing order ID in session, restoring...", { orderId: t });
3348
3390
  try {
3349
- await this.fetchOrder(t), this.debugLog("Order restored successfully"), this.store.dispatch(x(!1));
3391
+ await this.fetchOrder(t), this.debugLog("Order restored successfully"), this.store.dispatch(C(!1));
3350
3392
  } catch (n) {
3351
3393
  this.debugLog("Failed to restore order, clearing session", n), this.clearOrderFromSession();
3352
3394
  }
3353
3395
  }
3354
3396
  }
3397
+ async findOrder(t, n) {
3398
+ try {
3399
+ return await this.sdk.findOrderById({ id: t, reference: n });
3400
+ } catch (r) {
3401
+ return this.debugLog("Error finding order", r), this.handleError(r), null;
3402
+ }
3403
+ }
3355
3404
  async fetchOrder(t) {
3356
3405
  this.debugLog("Fetching order from server", { orderId: t });
3357
3406
  try {
@@ -3363,10 +3412,10 @@ class cn {
3363
3412
  const r = n.findOrder;
3364
3413
  this.debugLog("Order fetched successfully", r);
3365
3414
  const i = r.items, s = i.filter((c) => c.product != null && c.amount > 0).map((c) => {
3366
- let g = _.PRODUCT;
3367
- return c.product.type === "PROMOTER" ? g = _.ADD_ONS : c.product.type === "PICKUP" ? g = _.PICKUP : c.product.type === "DELIVERY" && (g = _.DELIVERY), {
3415
+ let m = _.PRODUCT;
3416
+ return c.product.type === "PROMOTER" ? m = _.ADD_ONS : c.product.type === "PICKUP" ? m = _.PICKUP : c.product.type === "DELIVERY" && (m = _.DELIVERY), {
3368
3417
  id: c.product.id,
3369
- type: g,
3418
+ type: m,
3370
3419
  name: c.product.name,
3371
3420
  icon: c.product.icon,
3372
3421
  description: c.product.description,
@@ -3375,42 +3424,42 @@ class cn {
3375
3424
  depositPrice: c.depositPrice ?? 0,
3376
3425
  originalPrice: c.originalPrice ?? 0,
3377
3426
  serviceFee: c.serviceFee ?? 0,
3378
- seats: c.seats?.map((m) => ({
3379
- id: m.id,
3380
- label: m.label
3427
+ seats: c.seats?.map((g) => ({
3428
+ id: g.id,
3429
+ label: g.label
3381
3430
  }))
3382
3431
  };
3383
- }), o = i.filter((c) => c.packageItem != null && c.amount > 0).reduce((c, g) => {
3432
+ }), o = i.filter((c) => c.packageItem != null && c.amount > 0).reduce((c, m) => {
3384
3433
  const {
3385
- packageItem: m,
3434
+ packageItem: g,
3386
3435
  event: y,
3387
3436
  amount: I,
3388
- price: T,
3389
- serviceFee: N,
3390
- depositPrice: O,
3437
+ price: O,
3438
+ serviceFee: x,
3439
+ depositPrice: T,
3391
3440
  originalPrice: L
3392
- } = g, k = m.package.id;
3393
- c[k] ? (c[k].price += T ?? 0, c[k].serviceFee += N ?? 0, c[k].originalPrice += L ?? 0, c[k].depositPrice += O ?? T ?? 0) : c[k] = {
3394
- id: k,
3441
+ } = m, A = g.package.id;
3442
+ c[A] ? (c[A].price += O ?? 0, c[A].serviceFee += x ?? 0, c[A].originalPrice += L ?? 0, c[A].depositPrice += T ?? O ?? 0) : c[A] = {
3443
+ id: A,
3395
3444
  type: _.PACKAGE,
3396
- name: m.package.name,
3445
+ name: g.package.name,
3397
3446
  amount: I,
3398
- price: T ?? 0,
3399
- serviceFee: N ?? 0,
3400
- depositPrice: O ?? T ?? 0,
3447
+ price: O ?? 0,
3448
+ serviceFee: x ?? 0,
3449
+ depositPrice: T ?? O ?? 0,
3401
3450
  originalPrice: L ?? 0,
3402
3451
  packageItems: []
3403
3452
  };
3404
- const P = R.fromISO(y.startAt, {
3453
+ const N = R.fromISO(y.startAt, {
3405
3454
  zone: y.timezone
3406
3455
  }), D = R.fromISO(y.endAt, {
3407
3456
  zone: y.timezone
3408
3457
  });
3409
- return c[k].packageItems.push({
3410
- packageItemId: m.id,
3458
+ return c[A].packageItems.push({
3459
+ packageItemId: g.id,
3411
3460
  eventId: y.id,
3412
3461
  name: y.name,
3413
- startAt: P.toJSDate().toISOString(),
3462
+ startAt: N.toJSDate().toISOString(),
3414
3463
  endAt: D.toJSDate().toISOString()
3415
3464
  }), c;
3416
3465
  }, {}), u = [
@@ -3427,7 +3476,7 @@ class cn {
3427
3476
  return;
3428
3477
  }
3429
3478
  const p = R.fromMillis(Math.min(...h));
3430
- this.store.dispatch(Ae()), this.store.dispatch(
3479
+ this.store.dispatch(ke()), this.store.dispatch(
3431
3480
  j({
3432
3481
  id: r.id,
3433
3482
  currency: r.currency,
@@ -3506,7 +3555,7 @@ class cn {
3506
3555
  return this.store.getState().basket;
3507
3556
  }
3508
3557
  }
3509
- const dn = E`
3558
+ const ln = E`
3510
3559
  query EventOverviewPage($organizationId: ID!, $hostingIds: [String!], $trackerId: String, $filterEventStatuses: [EventStatus!], $dateRange: DateRangeInput, $page: PageInput, $sorts: [SortInput!], $searchTerm: String, $priceRange: PriceRangeInput) {
3511
3560
  findAllPublicEventByOrganizationId(
3512
3561
  id: $organizationId
@@ -3544,7 +3593,7 @@ const dn = E`
3544
3593
  count
3545
3594
  }
3546
3595
  }
3547
- `, un = E`
3596
+ `, pn = E`
3548
3597
  query EventDetailPage($eventId: ID!) {
3549
3598
  findPublicEventById(id: $eventId) {
3550
3599
  id
@@ -3571,7 +3620,7 @@ const dn = E`
3571
3620
  startingPrice
3572
3621
  }
3573
3622
  }
3574
- `, ln = E`
3623
+ `, hn = E`
3575
3624
  query findProductsByEventId($eventId: ID!, $promoCode: String, $trackerId: String, $productTypes: [ProductType!]) {
3576
3625
  findPublicProductsByEventId(
3577
3626
  eventId: $eventId
@@ -3605,27 +3654,27 @@ const dn = E`
3605
3654
  showEndSalesAtTag
3606
3655
  }
3607
3656
  }
3608
- `, pn = (e, t, n, r) => e();
3609
- function hn(e, t = pn) {
3657
+ `, fn = (e, t, n, r) => e();
3658
+ function mn(e, t = fn) {
3610
3659
  return {
3611
3660
  EventOverviewPage(n, r, i) {
3612
- return t((s) => e.request({ document: dn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "EventOverviewPage", "query", n);
3661
+ return t((s) => e.request({ document: ln, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "EventOverviewPage", "query", n);
3613
3662
  },
3614
3663
  EventDetailPage(n, r, i) {
3615
- return t((s) => e.request({ document: un, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "EventDetailPage", "query", n);
3664
+ return t((s) => e.request({ document: pn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "EventDetailPage", "query", n);
3616
3665
  },
3617
3666
  findProductsByEventId(n, r, i) {
3618
- return t((s) => e.request({ document: ln, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findProductsByEventId", "query", n);
3667
+ return t((s) => e.request({ document: hn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findProductsByEventId", "query", n);
3619
3668
  }
3620
3669
  };
3621
3670
  }
3622
- function fn(e) {
3671
+ function gn(e) {
3623
3672
  const t = /(query|mutation|subscription)\s+(\w+)/.exec(e);
3624
3673
  if (!t) return { type: "unknown" };
3625
3674
  const n = t[1], r = t[2];
3626
3675
  return { type: n, name: r };
3627
3676
  }
3628
- async function gn(e) {
3677
+ async function In(e) {
3629
3678
  if (typeof globalThis < "u" && globalThis.crypto?.subtle) {
3630
3679
  const n = new TextEncoder().encode(e), r = await globalThis.crypto.subtle.digest("SHA-256", n);
3631
3680
  return Array.from(new Uint8Array(r)).map((i) => i.toString(16).padStart(2, "0")).join("");
@@ -3637,45 +3686,45 @@ async function gn(e) {
3637
3686
  throw new Error("SHA-256 is not available in this environment");
3638
3687
  }
3639
3688
  }
3640
- function mn(e) {
3689
+ function En(e) {
3641
3690
  const t = { "content-type": "application/json" };
3642
3691
  if (e)
3643
3692
  for (const [n, r] of Object.entries(e))
3644
3693
  typeof r < "u" && (t[n] = String(r));
3645
3694
  return t;
3646
3695
  }
3647
- function ke(e, t) {
3696
+ function Ae(e, t) {
3648
3697
  return e?.length ? e.some((n) => t.includes(n?.extensions?.code) || t.includes(n?.message)) : !1;
3649
3698
  }
3650
- function Te(e, t, n, r, i) {
3699
+ function Oe(e, t, n, r, i) {
3651
3700
  const s = new Error(e);
3652
3701
  return s.response = { data: i.json?.data, errors: i.json?.errors, status: i.status }, s.request = { query: t, variables: n, operationName: r }, s.graphQLErrors = i.json?.errors, s;
3653
3702
  }
3654
3703
  function ie(e, t, n, r, i) {
3655
3704
  if (i.json?.errors?.length)
3656
- throw Te(`GraphQL request failed${e ? ` (${e})` : ""}`, t, n, r, i);
3705
+ throw Oe(`GraphQL request failed${e ? ` (${e})` : ""}`, t, n, r, i);
3657
3706
  if (typeof i.json?.data > "u")
3658
- throw Te("GraphQL request failed: no data received", t, n, r, i);
3707
+ throw Oe("GraphQL request failed: no data received", t, n, r, i);
3659
3708
  return i.json.data;
3660
3709
  }
3661
3710
  class ee extends de {
3662
3711
  async request(t, ...n) {
3663
3712
  let r = t, i, s, o;
3664
3713
  t && typeof t == "object" && "document" in t ? (r = t.document, i = t.variables, s = t.requestHeaders, o = t.signal) : (i = n[0], s = n[1]);
3665
- const u = typeof r == "string" ? r : $t(r), { type: h, name: p } = fn(u), c = await gn(u), g = i ?? {}, m = this.url ?? this.endpoint ?? "", y = mn(s), I = async (D) => {
3666
- const b = await fetch(m, { method: "POST", headers: y, body: JSON.stringify(D), signal: o });
3667
- let S = null;
3714
+ const u = typeof r == "string" ? r : $t(r), { type: h, name: p } = gn(u), c = await In(u), m = i ?? {}, g = this.url ?? this.endpoint ?? "", y = En(s), I = async (D) => {
3715
+ const P = await fetch(g, { method: "POST", headers: y, body: JSON.stringify(D), signal: o });
3716
+ let b = null;
3668
3717
  try {
3669
- S = await b.json();
3718
+ b = await P.json();
3670
3719
  } catch {
3671
- S = null;
3720
+ b = null;
3672
3721
  }
3673
- return { status: b.status, json: S };
3674
- }, T = async (D) => {
3675
- const b = new URLSearchParams();
3722
+ return { status: P.status, json: b };
3723
+ }, O = async (D) => {
3724
+ const P = new URLSearchParams();
3676
3725
  for (const [He, q] of Object.entries(D))
3677
- typeof q > "u" || b.set(He, typeof q == "string" ? q : JSON.stringify(q));
3678
- const S = m.includes("?") ? "&" : "?", B = `${m}${S}${b.toString()}`, pe = await fetch(B, { method: "GET", headers: y, signal: o });
3726
+ typeof q > "u" || P.set(He, typeof q == "string" ? q : JSON.stringify(q));
3727
+ const b = g.includes("?") ? "&" : "?", B = `${g}${b}${P.toString()}`, pe = await fetch(B, { method: "GET", headers: y, signal: o });
3679
3728
  let te = null;
3680
3729
  try {
3681
3730
  te = await pe.json();
@@ -3683,34 +3732,34 @@ class ee extends de {
3683
3732
  te = null;
3684
3733
  }
3685
3734
  return { status: pe.status, json: te };
3686
- }, N = {
3735
+ }, x = {
3687
3736
  operationName: p,
3688
- variables: g,
3737
+ variables: m,
3689
3738
  extensions: { persistedQuery: { version: 1, sha256Hash: c } }
3690
- }, O = async (D, b, S) => {
3691
- if (ke(D.json?.errors, ["PERSISTED_QUERY_NOT_FOUND", "PersistedQueryNotFound"])) {
3692
- const B = await b();
3693
- return ie("APQ register", u, g, p, B);
3739
+ }, T = async (D, P, b) => {
3740
+ if (Ae(D.json?.errors, ["PERSISTED_QUERY_NOT_FOUND", "PersistedQueryNotFound"])) {
3741
+ const B = await P();
3742
+ return ie("APQ register", u, m, p, B);
3694
3743
  }
3695
- if (ke(D.json?.errors, ["PERSISTED_QUERY_NOT_SUPPORTED"])) {
3696
- const B = await S();
3697
- return ie("no APQ support", u, g, p, B);
3744
+ if (Ae(D.json?.errors, ["PERSISTED_QUERY_NOT_SUPPORTED"])) {
3745
+ const B = await b();
3746
+ return ie("no APQ support", u, m, p, B);
3698
3747
  }
3699
- return ie("", u, g, p, D);
3748
+ return ie("", u, m, p, D);
3700
3749
  };
3701
3750
  if (h === "query") {
3702
- const D = await T(N);
3703
- return O(D, () => I({ ...N, query: u }), () => I({ operationName: p, variables: g, query: u }));
3751
+ const D = await O(x);
3752
+ return T(D, () => I({ ...x, query: u }), () => I({ operationName: p, variables: m, query: u }));
3704
3753
  }
3705
- const L = await I(N);
3706
- return O(L, () => I({ ...N, query: u }), () => I({ operationName: p, variables: g, query: u }));
3754
+ const L = await I(x);
3755
+ return T(L, () => I({ ...x, query: u }), () => I({ operationName: p, variables: m, query: u }));
3707
3756
  }
3708
3757
  }
3709
- class In {
3758
+ class yn {
3710
3759
  config;
3711
3760
  sdk;
3712
3761
  constructor(t) {
3713
- this.config = t, this.sdk = hn(new ee(t.apiUrl));
3762
+ this.config = t, this.sdk = mn(new ee(t.apiUrl));
3714
3763
  }
3715
3764
  async fetchEvents(t = {}) {
3716
3765
  try {
@@ -3862,7 +3911,7 @@ class In {
3862
3911
  this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${t}`, n || "");
3863
3912
  }
3864
3913
  }
3865
- const En = E`
3914
+ const vn = E`
3866
3915
  query findPaymentMethods($orderId: ID!, $orderItemId: String, $amountOfTickets: Int, $paymentMethodId: String) {
3867
3916
  findPaymentDetails(
3868
3917
  orderId: $orderId
@@ -3890,26 +3939,26 @@ const En = E`
3890
3939
  paymentSpesificTransactionFee
3891
3940
  }
3892
3941
  }
3893
- `, yn = E`
3942
+ `, kn = E`
3894
3943
  mutation createDigitalPayment($input: CreateDigitalOrderPaymentInput!) {
3895
3944
  createDigitalOrderPayment(input: $input)
3896
3945
  }
3897
- `, vn = (e, t, n, r) => e();
3898
- function An(e, t = vn) {
3946
+ `, An = (e, t, n, r) => e();
3947
+ function On(e, t = An) {
3899
3948
  return {
3900
3949
  findPaymentMethods(n, r, i) {
3901
- return t((s) => e.request({ document: En, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findPaymentMethods", "query", n);
3950
+ return t((s) => e.request({ document: vn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findPaymentMethods", "query", n);
3902
3951
  },
3903
3952
  createDigitalPayment(n, r, i) {
3904
- return t((s) => e.request({ document: yn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "createDigitalPayment", "mutation", n);
3953
+ return t((s) => e.request({ document: kn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "createDigitalPayment", "mutation", n);
3905
3954
  }
3906
3955
  };
3907
3956
  }
3908
- class kn {
3957
+ class Tn {
3909
3958
  config;
3910
3959
  sdk;
3911
3960
  constructor(t) {
3912
- this.config = t, this.sdk = An(new de(t.apiUrl));
3961
+ this.config = t, this.sdk = On(new de(t.apiUrl));
3913
3962
  }
3914
3963
  async getPaymentDetails(t) {
3915
3964
  this.debugLog("Fetching payment methods", t);
@@ -3983,7 +4032,7 @@ class kn {
3983
4032
  this.config.debug && console.log(`[PaymentService] ${t}`, n || "");
3984
4033
  }
3985
4034
  }
3986
- const Tn = E`
4035
+ const Dn = E`
3987
4036
  query findAllPublicPackagesByOrganizationId($organizationId: ID!) {
3988
4037
  findAllPublicPackagesByOrganizationId(organizationId: $organizationId) {
3989
4038
  data {
@@ -4008,7 +4057,7 @@ const Tn = E`
4008
4057
  count
4009
4058
  }
4010
4059
  }
4011
- `, On = E`
4060
+ `, xn = E`
4012
4061
  query findPublicPackageById($packageId: ID!) {
4013
4062
  findPublicPackageById(id: $packageId) {
4014
4063
  id
@@ -4034,7 +4083,7 @@ const Tn = E`
4034
4083
  }
4035
4084
  }
4036
4085
  }
4037
- `, Dn = E`
4086
+ `, Nn = E`
4038
4087
  query findPublicItemsByPackageId($packageId: ID!, $types: [PackageItemType!], $page: PageInput) {
4039
4088
  findPublicItemsByPackageId(packageId: $packageId, types: $types, page: $page) {
4040
4089
  data {
@@ -4069,25 +4118,25 @@ const Tn = E`
4069
4118
  count
4070
4119
  }
4071
4120
  }
4072
- `, xn = (e, t, n, r) => e();
4073
- function Nn(e, t = xn) {
4121
+ `, Pn = (e, t, n, r) => e();
4122
+ function bn(e, t = Pn) {
4074
4123
  return {
4075
4124
  findAllPublicPackagesByOrganizationId(n, r, i) {
4076
- return t((s) => e.request({ document: Tn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findAllPublicPackagesByOrganizationId", "query", n);
4125
+ return t((s) => e.request({ document: Dn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findAllPublicPackagesByOrganizationId", "query", n);
4077
4126
  },
4078
4127
  findPublicPackageById(n, r, i) {
4079
- return t((s) => e.request({ document: On, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findPublicPackageById", "query", n);
4128
+ return t((s) => e.request({ document: xn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findPublicPackageById", "query", n);
4080
4129
  },
4081
4130
  findPublicItemsByPackageId(n, r, i) {
4082
- return t((s) => e.request({ document: Dn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findPublicItemsByPackageId", "query", n);
4131
+ return t((s) => e.request({ document: Nn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findPublicItemsByPackageId", "query", n);
4083
4132
  }
4084
4133
  };
4085
4134
  }
4086
- class Pn {
4135
+ class Sn {
4087
4136
  config;
4088
4137
  sdk;
4089
4138
  constructor(t) {
4090
- this.config = t, this.sdk = Nn(new ee(t.apiUrl));
4139
+ this.config = t, this.sdk = bn(new ee(t.apiUrl));
4091
4140
  }
4092
4141
  debugLog(t, n) {
4093
4142
  this.config.debug && console.log(`[PackageService] ${t}`, n || "");
@@ -4155,7 +4204,7 @@ class Pn {
4155
4204
  }
4156
4205
  }
4157
4206
  }
4158
- const bn = E`
4207
+ const Cn = E`
4159
4208
  query findAllPublicCategoriesByOrganizationId($organizationId: ID!, $dateRange: DateRangeInput) {
4160
4209
  findAllPublicHostingsByOrganizationId(id: $organizationId) {
4161
4210
  data {
@@ -4167,7 +4216,7 @@ const bn = E`
4167
4216
  count
4168
4217
  }
4169
4218
  }
4170
- `, Sn = E`
4219
+ `, _n = E`
4171
4220
  query findPublicCategoryById($hostingId: ID!, $dateRange: DateRangeInput) {
4172
4221
  findPublicHostingById(id: $hostingId) {
4173
4222
  id
@@ -4176,22 +4225,22 @@ const bn = E`
4176
4225
  amountOfActiveEvents(input: $dateRange)
4177
4226
  }
4178
4227
  }
4179
- `, Cn = (e, t, n, r) => e();
4180
- function _n(e, t = Cn) {
4228
+ `, Ln = (e, t, n, r) => e();
4229
+ function Rn(e, t = Ln) {
4181
4230
  return {
4182
4231
  findAllPublicCategoriesByOrganizationId(n, r, i) {
4183
- return t((s) => e.request({ document: bn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findAllPublicCategoriesByOrganizationId", "query", n);
4232
+ return t((s) => e.request({ document: Cn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findAllPublicCategoriesByOrganizationId", "query", n);
4184
4233
  },
4185
4234
  findPublicCategoryById(n, r, i) {
4186
- return t((s) => e.request({ document: Sn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findPublicCategoryById", "query", n);
4235
+ return t((s) => e.request({ document: _n, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "findPublicCategoryById", "query", n);
4187
4236
  }
4188
4237
  };
4189
4238
  }
4190
- class Ln {
4239
+ class Fn {
4191
4240
  config;
4192
4241
  sdk;
4193
4242
  constructor(t) {
4194
- this.config = t, this.sdk = _n(new ee(t.apiUrl));
4243
+ this.config = t, this.sdk = Rn(new ee(t.apiUrl));
4195
4244
  }
4196
4245
  debugLog(t, n) {
4197
4246
  this.config.debug && console.log(`[CategoryService] ${t}`, n || "");
@@ -4223,37 +4272,37 @@ class Ln {
4223
4272
  }
4224
4273
  }
4225
4274
  }
4226
- const Rn = E`
4275
+ const wn = E`
4227
4276
  mutation CreateShopView($id: ID!, $trackerLinkId: ID) {
4228
4277
  createShopView(id: $id, trackerId: $trackerLinkId)
4229
4278
  }
4230
- `, Fn = E`
4279
+ `, $n = E`
4231
4280
  mutation CreateEventView($id: ID!, $shopId: ID, $trackerLinkId: ID) {
4232
4281
  createEventView(id: $id, shopId: $shopId, trackerId: $trackerLinkId)
4233
4282
  }
4234
- `, wn = E`
4283
+ `, Bn = E`
4235
4284
  mutation CreatePackageView($id: ID!, $shopId: ID, $trackerLinkId: ID) {
4236
4285
  createPackageView(id: $id, shopId: $shopId, trackerId: $trackerLinkId)
4237
4286
  }
4238
- `, $n = (e, t, n, r) => e();
4239
- function Bn(e, t = $n) {
4287
+ `, Vn = (e, t, n, r) => e();
4288
+ function Un(e, t = Vn) {
4240
4289
  return {
4241
4290
  CreateShopView(n, r, i) {
4242
- return t((s) => e.request({ document: Rn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "CreateShopView", "mutation", n);
4291
+ return t((s) => e.request({ document: wn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "CreateShopView", "mutation", n);
4243
4292
  },
4244
4293
  CreateEventView(n, r, i) {
4245
- return t((s) => e.request({ document: Fn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "CreateEventView", "mutation", n);
4294
+ return t((s) => e.request({ document: $n, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "CreateEventView", "mutation", n);
4246
4295
  },
4247
4296
  CreatePackageView(n, r, i) {
4248
- return t((s) => e.request({ document: wn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "CreatePackageView", "mutation", n);
4297
+ return t((s) => e.request({ document: Bn, variables: n, requestHeaders: { ...r, ...s }, signal: i }), "CreatePackageView", "mutation", n);
4249
4298
  }
4250
4299
  };
4251
4300
  }
4252
- class Vn {
4301
+ class Mn {
4253
4302
  config;
4254
4303
  sdk;
4255
4304
  constructor(t) {
4256
- this.config = t, this.sdk = Bn(new ee(t.apiUrl));
4305
+ this.config = t, this.sdk = Un(new ee(t.apiUrl));
4257
4306
  }
4258
4307
  createMetric = async (t, n, r) => {
4259
4308
  switch (!n && !r && await this.sdk.CreateShopView({
@@ -4279,8 +4328,8 @@ class Vn {
4279
4328
  }
4280
4329
  };
4281
4330
  }
4282
- const Un = "https://api.ticketapp.com/graphql", Oe = "TIC_TRACKER_ID";
4283
- class jn {
4331
+ const qn = "https://api.ticketapp.com/graphql", Te = "TIC_TRACKER_ID";
4332
+ class Yn {
4284
4333
  basket;
4285
4334
  event;
4286
4335
  payment;
@@ -4290,8 +4339,8 @@ class jn {
4290
4339
  // Attach selected public types to the SDK class
4291
4340
  static Types = Xe;
4292
4341
  constructor(t) {
4293
- const { organizationId: n, debug: r = !1, apiUrl: i = Un } = t, s = this.getOrInitTrackerId();
4294
- this.basket = new cn({ debug: r, apiUrl: i, shopId: t.shopId, trackerId: s }), this.event = new In({ organizationId: n, debug: r, apiUrl: i, trackerId: s }), this.payment = new kn({ debug: r, apiUrl: i }), this.package = new Pn({ organizationId: n, debug: r, apiUrl: i }), this.category = new Ln({ organizationId: n, debug: r, apiUrl: i }), this.metric = new Vn({ apiUrl: i, trackerId: s });
4342
+ const { organizationId: n, debug: r = !1, apiUrl: i = qn } = t, s = this.getOrInitTrackerId();
4343
+ this.basket = new un({ debug: r, apiUrl: i, shopId: t.shopId, trackerId: s }), this.event = new yn({ organizationId: n, debug: r, apiUrl: i, trackerId: s }), this.payment = new Tn({ debug: r, apiUrl: i }), this.package = new Sn({ organizationId: n, debug: r, apiUrl: i }), this.category = new Fn({ organizationId: n, debug: r, apiUrl: i }), this.metric = new Mn({ apiUrl: i, trackerId: s });
4295
4344
  }
4296
4345
  // Resolve tracker id from (in order): explicit config, URL query, or session storage
4297
4346
  // Persist to session when found via config or URL for subsequent page loads
@@ -4304,13 +4353,13 @@ class jn {
4304
4353
  } catch {
4305
4354
  }
4306
4355
  try {
4307
- t = window.sessionStorage?.getItem(Oe) ?? null;
4356
+ t = window.sessionStorage?.getItem(Te) ?? null;
4308
4357
  } catch {
4309
4358
  }
4310
4359
  }
4311
4360
  if (n && n.trim().length > 0) {
4312
4361
  try {
4313
- typeof window < "u" && window.sessionStorage && sessionStorage.setItem(Oe, n);
4362
+ typeof window < "u" && window.sessionStorage && sessionStorage.setItem(Te, n);
4314
4363
  } catch {
4315
4364
  }
4316
4365
  return n;
@@ -4344,5 +4393,5 @@ export {
4344
4393
  be as ProductStatus,
4345
4394
  Se as ProductType,
4346
4395
  Pe as SortOrder,
4347
- jn as TicketappSDK
4396
+ Yn as TicketappSDK
4348
4397
  };