@ticketapp-dev/shop-sdk 1.0.14
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.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3618 -0
- package/dist/sdk.d.ts +23 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/services/basket/basket.service.d.ts +39 -0
- package/dist/services/basket/basket.service.d.ts.map +1 -0
- package/dist/services/basket/basket.service.generated.d.ts +202 -0
- package/dist/services/basket/basket.service.generated.d.ts.map +1 -0
- package/dist/services/category/category.service.d.ts +15 -0
- package/dist/services/category/category.service.d.ts.map +1 -0
- package/dist/services/category/category.service.generated.d.ts +41 -0
- package/dist/services/category/category.service.generated.d.ts.map +1 -0
- package/dist/services/event/event.service.d.ts +31 -0
- package/dist/services/event/event.service.d.ts.map +1 -0
- package/dist/services/event/event.service.generated.d.ts +122 -0
- package/dist/services/event/event.service.generated.d.ts.map +1 -0
- package/dist/services/package/package.service.d.ts +29 -0
- package/dist/services/package/package.service.d.ts.map +1 -0
- package/dist/services/package/package.service.generated.d.ts +122 -0
- package/dist/services/package/package.service.generated.d.ts.map +1 -0
- package/dist/services/payment/payment.service.d.ts +14 -0
- package/dist/services/payment/payment.service.d.ts.map +1 -0
- package/dist/services/payment/payment.service.generated.d.ts +53 -0
- package/dist/services/payment/payment.service.generated.d.ts.map +1 -0
- package/dist/store/store.d.ts +3133 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/types/index.d.ts +380 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +51 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3618 @@
|
|
|
1
|
+
import { GraphQLClient as C } from "graphql-request";
|
|
2
|
+
import { createSlice as Ce, configureStore as _e } from "@reduxjs/toolkit";
|
|
3
|
+
import { DateTime as y } from "luxon";
|
|
4
|
+
var F = function() {
|
|
5
|
+
return F = Object.assign || function(e) {
|
|
6
|
+
for (var t, i = 1, n = arguments.length; i < n; i++) {
|
|
7
|
+
t = arguments[i];
|
|
8
|
+
for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && (e[s] = t[s]);
|
|
9
|
+
}
|
|
10
|
+
return e;
|
|
11
|
+
}, F.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
function M(r, e) {
|
|
14
|
+
if (!!!r)
|
|
15
|
+
throw new Error(e);
|
|
16
|
+
}
|
|
17
|
+
function Le(r) {
|
|
18
|
+
return typeof r == "object" && r !== null;
|
|
19
|
+
}
|
|
20
|
+
function Re(r, e) {
|
|
21
|
+
if (!!!r)
|
|
22
|
+
throw new Error(
|
|
23
|
+
"Unexpected invariant triggered."
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
const Fe = /\r\n|[\n\r]/g;
|
|
27
|
+
function z(r, e) {
|
|
28
|
+
let t = 0, i = 1;
|
|
29
|
+
for (const n of r.body.matchAll(Fe)) {
|
|
30
|
+
if (typeof n.index == "number" || Re(!1), n.index >= e)
|
|
31
|
+
break;
|
|
32
|
+
t = n.index + n[0].length, i += 1;
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
line: i,
|
|
36
|
+
column: e + 1 - t
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function we(r) {
|
|
40
|
+
return ie(
|
|
41
|
+
r.source,
|
|
42
|
+
z(r.source, r.start)
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
function ie(r, e) {
|
|
46
|
+
const t = r.locationOffset.column - 1, i = "".padStart(t) + r.body, n = e.line - 1, s = r.locationOffset.line - 1, o = e.line + s, u = e.line === 1 ? t : 0, l = e.column + u, f = `${r.name}:${o}:${l}
|
|
47
|
+
`, c = i.split(/\r\n|[\n\r]/g), E = c[n];
|
|
48
|
+
if (E.length > 120) {
|
|
49
|
+
const m = Math.floor(l / 80), O = l % 80, I = [];
|
|
50
|
+
for (let A = 0; A < E.length; A += 80)
|
|
51
|
+
I.push(E.slice(A, A + 80));
|
|
52
|
+
return f + J([
|
|
53
|
+
[`${o} |`, I[0]],
|
|
54
|
+
...I.slice(1, m + 1).map((A) => ["|", A]),
|
|
55
|
+
["|", "^".padStart(O)],
|
|
56
|
+
["|", I[m + 1]]
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
return f + J([
|
|
60
|
+
// Lines specified like this: ["prefix", "string"],
|
|
61
|
+
[`${o - 1} |`, c[n - 1]],
|
|
62
|
+
[`${o} |`, E],
|
|
63
|
+
["|", "^".padStart(l)],
|
|
64
|
+
[`${o + 1} |`, c[n + 1]]
|
|
65
|
+
]);
|
|
66
|
+
}
|
|
67
|
+
function J(r) {
|
|
68
|
+
const e = r.filter(([i, n]) => n !== void 0), t = Math.max(...e.map(([i]) => i.length));
|
|
69
|
+
return e.map(([i, n]) => i.padStart(t) + (n ? " " + n : "")).join(`
|
|
70
|
+
`);
|
|
71
|
+
}
|
|
72
|
+
function Be(r) {
|
|
73
|
+
const e = r[0];
|
|
74
|
+
return e == null || "kind" in e || "length" in e ? {
|
|
75
|
+
nodes: e,
|
|
76
|
+
source: r[1],
|
|
77
|
+
positions: r[2],
|
|
78
|
+
path: r[3],
|
|
79
|
+
originalError: r[4],
|
|
80
|
+
extensions: r[5]
|
|
81
|
+
} : e;
|
|
82
|
+
}
|
|
83
|
+
class j extends Error {
|
|
84
|
+
/**
|
|
85
|
+
* An array of `{ line, column }` locations within the source GraphQL document
|
|
86
|
+
* which correspond to this error.
|
|
87
|
+
*
|
|
88
|
+
* Errors during validation often contain multiple locations, for example to
|
|
89
|
+
* point out two things with the same name. Errors during execution include a
|
|
90
|
+
* single location, the field which produced the error.
|
|
91
|
+
*
|
|
92
|
+
* Enumerable, and appears in the result of JSON.stringify().
|
|
93
|
+
*/
|
|
94
|
+
/**
|
|
95
|
+
* An array describing the JSON-path into the execution response which
|
|
96
|
+
* corresponds to this error. Only included for errors during execution.
|
|
97
|
+
*
|
|
98
|
+
* Enumerable, and appears in the result of JSON.stringify().
|
|
99
|
+
*/
|
|
100
|
+
/**
|
|
101
|
+
* An array of GraphQL AST Nodes corresponding to this error.
|
|
102
|
+
*/
|
|
103
|
+
/**
|
|
104
|
+
* The source GraphQL document for the first location of this error.
|
|
105
|
+
*
|
|
106
|
+
* Note that if this Error represents more than one node, the source may not
|
|
107
|
+
* represent nodes after the first node.
|
|
108
|
+
*/
|
|
109
|
+
/**
|
|
110
|
+
* An array of character offsets within the source GraphQL document
|
|
111
|
+
* which correspond to this error.
|
|
112
|
+
*/
|
|
113
|
+
/**
|
|
114
|
+
* The original error thrown from a field resolver during execution.
|
|
115
|
+
*/
|
|
116
|
+
/**
|
|
117
|
+
* Extension fields to add to the formatted error.
|
|
118
|
+
*/
|
|
119
|
+
/**
|
|
120
|
+
* @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.
|
|
121
|
+
*/
|
|
122
|
+
constructor(e, ...t) {
|
|
123
|
+
var i, n, s;
|
|
124
|
+
const { nodes: o, source: u, positions: l, path: f, originalError: c, extensions: E } = Be(t);
|
|
125
|
+
super(e), this.name = "GraphQLError", this.path = f ?? void 0, this.originalError = c ?? void 0, this.nodes = X(
|
|
126
|
+
Array.isArray(o) ? o : o ? [o] : void 0
|
|
127
|
+
);
|
|
128
|
+
const m = X(
|
|
129
|
+
(i = this.nodes) === null || i === void 0 ? void 0 : i.map((I) => I.loc).filter((I) => I != null)
|
|
130
|
+
);
|
|
131
|
+
this.source = u ?? (m == null || (n = m[0]) === null || n === void 0 ? void 0 : n.source), this.positions = l ?? m?.map((I) => I.start), this.locations = l && u ? l.map((I) => z(u, I)) : m?.map((I) => z(I.source, I.start));
|
|
132
|
+
const O = Le(
|
|
133
|
+
c?.extensions
|
|
134
|
+
) ? c?.extensions : void 0;
|
|
135
|
+
this.extensions = (s = E ?? O) !== null && s !== void 0 ? s : /* @__PURE__ */ Object.create(null), Object.defineProperties(this, {
|
|
136
|
+
message: {
|
|
137
|
+
writable: !0,
|
|
138
|
+
enumerable: !0
|
|
139
|
+
},
|
|
140
|
+
name: {
|
|
141
|
+
enumerable: !1
|
|
142
|
+
},
|
|
143
|
+
nodes: {
|
|
144
|
+
enumerable: !1
|
|
145
|
+
},
|
|
146
|
+
source: {
|
|
147
|
+
enumerable: !1
|
|
148
|
+
},
|
|
149
|
+
positions: {
|
|
150
|
+
enumerable: !1
|
|
151
|
+
},
|
|
152
|
+
originalError: {
|
|
153
|
+
enumerable: !1
|
|
154
|
+
}
|
|
155
|
+
}), c != null && c.stack ? Object.defineProperty(this, "stack", {
|
|
156
|
+
value: c.stack,
|
|
157
|
+
writable: !0,
|
|
158
|
+
configurable: !0
|
|
159
|
+
}) : Error.captureStackTrace ? Error.captureStackTrace(this, j) : Object.defineProperty(this, "stack", {
|
|
160
|
+
value: Error().stack,
|
|
161
|
+
writable: !0,
|
|
162
|
+
configurable: !0
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
get [Symbol.toStringTag]() {
|
|
166
|
+
return "GraphQLError";
|
|
167
|
+
}
|
|
168
|
+
toString() {
|
|
169
|
+
let e = this.message;
|
|
170
|
+
if (this.nodes)
|
|
171
|
+
for (const t of this.nodes)
|
|
172
|
+
t.loc && (e += `
|
|
173
|
+
|
|
174
|
+
` + we(t.loc));
|
|
175
|
+
else if (this.source && this.locations)
|
|
176
|
+
for (const t of this.locations)
|
|
177
|
+
e += `
|
|
178
|
+
|
|
179
|
+
` + ie(this.source, t);
|
|
180
|
+
return e;
|
|
181
|
+
}
|
|
182
|
+
toJSON() {
|
|
183
|
+
const e = {
|
|
184
|
+
message: this.message
|
|
185
|
+
};
|
|
186
|
+
return this.locations != null && (e.locations = this.locations), this.path != null && (e.path = this.path), this.extensions != null && Object.keys(this.extensions).length > 0 && (e.extensions = this.extensions), e;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function X(r) {
|
|
190
|
+
return r === void 0 || r.length === 0 ? void 0 : r;
|
|
191
|
+
}
|
|
192
|
+
function g(r, e, t) {
|
|
193
|
+
return new j(`Syntax Error: ${t}`, {
|
|
194
|
+
source: r,
|
|
195
|
+
positions: [e]
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
class $e {
|
|
199
|
+
/**
|
|
200
|
+
* The character offset at which this Node begins.
|
|
201
|
+
*/
|
|
202
|
+
/**
|
|
203
|
+
* The character offset at which this Node ends.
|
|
204
|
+
*/
|
|
205
|
+
/**
|
|
206
|
+
* The Token at which this Node begins.
|
|
207
|
+
*/
|
|
208
|
+
/**
|
|
209
|
+
* The Token at which this Node ends.
|
|
210
|
+
*/
|
|
211
|
+
/**
|
|
212
|
+
* The Source document the AST represents.
|
|
213
|
+
*/
|
|
214
|
+
constructor(e, t, i) {
|
|
215
|
+
this.start = e.start, this.end = t.end, this.startToken = e, this.endToken = t, this.source = i;
|
|
216
|
+
}
|
|
217
|
+
get [Symbol.toStringTag]() {
|
|
218
|
+
return "Location";
|
|
219
|
+
}
|
|
220
|
+
toJSON() {
|
|
221
|
+
return {
|
|
222
|
+
start: this.start,
|
|
223
|
+
end: this.end
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
class se {
|
|
228
|
+
/**
|
|
229
|
+
* The kind of Token.
|
|
230
|
+
*/
|
|
231
|
+
/**
|
|
232
|
+
* The character offset at which this Node begins.
|
|
233
|
+
*/
|
|
234
|
+
/**
|
|
235
|
+
* The character offset at which this Node ends.
|
|
236
|
+
*/
|
|
237
|
+
/**
|
|
238
|
+
* The 1-indexed line number on which this Token appears.
|
|
239
|
+
*/
|
|
240
|
+
/**
|
|
241
|
+
* The 1-indexed column number at which this Token begins.
|
|
242
|
+
*/
|
|
243
|
+
/**
|
|
244
|
+
* For non-punctuation tokens, represents the interpreted value of the token.
|
|
245
|
+
*
|
|
246
|
+
* Note: is undefined for punctuation tokens, but typed as string for
|
|
247
|
+
* convenience in the parser.
|
|
248
|
+
*/
|
|
249
|
+
/**
|
|
250
|
+
* Tokens exist as nodes in a double-linked-list amongst all tokens
|
|
251
|
+
* including ignored tokens. <SOF> is always the first node and <EOF>
|
|
252
|
+
* the last.
|
|
253
|
+
*/
|
|
254
|
+
constructor(e, t, i, n, s, o) {
|
|
255
|
+
this.kind = e, this.start = t, this.end = i, this.line = n, this.column = s, this.value = o, this.prev = null, this.next = null;
|
|
256
|
+
}
|
|
257
|
+
get [Symbol.toStringTag]() {
|
|
258
|
+
return "Token";
|
|
259
|
+
}
|
|
260
|
+
toJSON() {
|
|
261
|
+
return {
|
|
262
|
+
kind: this.kind,
|
|
263
|
+
value: this.value,
|
|
264
|
+
line: this.line,
|
|
265
|
+
column: this.column
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const Ue = {
|
|
270
|
+
Name: [],
|
|
271
|
+
Document: ["definitions"],
|
|
272
|
+
OperationDefinition: [
|
|
273
|
+
"description",
|
|
274
|
+
"name",
|
|
275
|
+
"variableDefinitions",
|
|
276
|
+
"directives",
|
|
277
|
+
"selectionSet"
|
|
278
|
+
],
|
|
279
|
+
VariableDefinition: [
|
|
280
|
+
"description",
|
|
281
|
+
"variable",
|
|
282
|
+
"type",
|
|
283
|
+
"defaultValue",
|
|
284
|
+
"directives"
|
|
285
|
+
],
|
|
286
|
+
Variable: ["name"],
|
|
287
|
+
SelectionSet: ["selections"],
|
|
288
|
+
Field: ["alias", "name", "arguments", "directives", "selectionSet"],
|
|
289
|
+
Argument: ["name", "value"],
|
|
290
|
+
FragmentSpread: ["name", "directives"],
|
|
291
|
+
InlineFragment: ["typeCondition", "directives", "selectionSet"],
|
|
292
|
+
FragmentDefinition: [
|
|
293
|
+
"description",
|
|
294
|
+
"name",
|
|
295
|
+
// Note: fragment variable definitions are deprecated and will removed in v17.0.0
|
|
296
|
+
"variableDefinitions",
|
|
297
|
+
"typeCondition",
|
|
298
|
+
"directives",
|
|
299
|
+
"selectionSet"
|
|
300
|
+
],
|
|
301
|
+
IntValue: [],
|
|
302
|
+
FloatValue: [],
|
|
303
|
+
StringValue: [],
|
|
304
|
+
BooleanValue: [],
|
|
305
|
+
NullValue: [],
|
|
306
|
+
EnumValue: [],
|
|
307
|
+
ListValue: ["values"],
|
|
308
|
+
ObjectValue: ["fields"],
|
|
309
|
+
ObjectField: ["name", "value"],
|
|
310
|
+
Directive: ["name", "arguments"],
|
|
311
|
+
NamedType: ["name"],
|
|
312
|
+
ListType: ["type"],
|
|
313
|
+
NonNullType: ["type"],
|
|
314
|
+
SchemaDefinition: ["description", "directives", "operationTypes"],
|
|
315
|
+
OperationTypeDefinition: ["type"],
|
|
316
|
+
ScalarTypeDefinition: ["description", "name", "directives"],
|
|
317
|
+
ObjectTypeDefinition: [
|
|
318
|
+
"description",
|
|
319
|
+
"name",
|
|
320
|
+
"interfaces",
|
|
321
|
+
"directives",
|
|
322
|
+
"fields"
|
|
323
|
+
],
|
|
324
|
+
FieldDefinition: ["description", "name", "arguments", "type", "directives"],
|
|
325
|
+
InputValueDefinition: [
|
|
326
|
+
"description",
|
|
327
|
+
"name",
|
|
328
|
+
"type",
|
|
329
|
+
"defaultValue",
|
|
330
|
+
"directives"
|
|
331
|
+
],
|
|
332
|
+
InterfaceTypeDefinition: [
|
|
333
|
+
"description",
|
|
334
|
+
"name",
|
|
335
|
+
"interfaces",
|
|
336
|
+
"directives",
|
|
337
|
+
"fields"
|
|
338
|
+
],
|
|
339
|
+
UnionTypeDefinition: ["description", "name", "directives", "types"],
|
|
340
|
+
EnumTypeDefinition: ["description", "name", "directives", "values"],
|
|
341
|
+
EnumValueDefinition: ["description", "name", "directives"],
|
|
342
|
+
InputObjectTypeDefinition: ["description", "name", "directives", "fields"],
|
|
343
|
+
DirectiveDefinition: ["description", "name", "arguments", "locations"],
|
|
344
|
+
SchemaExtension: ["directives", "operationTypes"],
|
|
345
|
+
ScalarTypeExtension: ["name", "directives"],
|
|
346
|
+
ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
347
|
+
InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
348
|
+
UnionTypeExtension: ["name", "directives", "types"],
|
|
349
|
+
EnumTypeExtension: ["name", "directives", "values"],
|
|
350
|
+
InputObjectTypeExtension: ["name", "directives", "fields"],
|
|
351
|
+
TypeCoordinate: ["name"],
|
|
352
|
+
MemberCoordinate: ["name", "memberName"],
|
|
353
|
+
ArgumentCoordinate: ["name", "fieldName", "argumentName"],
|
|
354
|
+
DirectiveCoordinate: ["name"],
|
|
355
|
+
DirectiveArgumentCoordinate: ["name", "argumentName"]
|
|
356
|
+
};
|
|
357
|
+
new Set(Object.keys(Ue));
|
|
358
|
+
var x;
|
|
359
|
+
(function(r) {
|
|
360
|
+
r.QUERY = "query", r.MUTATION = "mutation", r.SUBSCRIPTION = "subscription";
|
|
361
|
+
})(x || (x = {}));
|
|
362
|
+
var q;
|
|
363
|
+
(function(r) {
|
|
364
|
+
r.QUERY = "QUERY", r.MUTATION = "MUTATION", r.SUBSCRIPTION = "SUBSCRIPTION", r.FIELD = "FIELD", r.FRAGMENT_DEFINITION = "FRAGMENT_DEFINITION", r.FRAGMENT_SPREAD = "FRAGMENT_SPREAD", r.INLINE_FRAGMENT = "INLINE_FRAGMENT", r.VARIABLE_DEFINITION = "VARIABLE_DEFINITION", r.SCHEMA = "SCHEMA", r.SCALAR = "SCALAR", r.OBJECT = "OBJECT", r.FIELD_DEFINITION = "FIELD_DEFINITION", r.ARGUMENT_DEFINITION = "ARGUMENT_DEFINITION", r.INTERFACE = "INTERFACE", r.UNION = "UNION", r.ENUM = "ENUM", r.ENUM_VALUE = "ENUM_VALUE", r.INPUT_OBJECT = "INPUT_OBJECT", r.INPUT_FIELD_DEFINITION = "INPUT_FIELD_DEFINITION";
|
|
365
|
+
})(q || (q = {}));
|
|
366
|
+
var d;
|
|
367
|
+
(function(r) {
|
|
368
|
+
r.NAME = "Name", r.DOCUMENT = "Document", r.OPERATION_DEFINITION = "OperationDefinition", r.VARIABLE_DEFINITION = "VariableDefinition", r.SELECTION_SET = "SelectionSet", r.FIELD = "Field", r.ARGUMENT = "Argument", r.FRAGMENT_SPREAD = "FragmentSpread", r.INLINE_FRAGMENT = "InlineFragment", r.FRAGMENT_DEFINITION = "FragmentDefinition", r.VARIABLE = "Variable", r.INT = "IntValue", r.FLOAT = "FloatValue", r.STRING = "StringValue", r.BOOLEAN = "BooleanValue", r.NULL = "NullValue", r.ENUM = "EnumValue", r.LIST = "ListValue", r.OBJECT = "ObjectValue", r.OBJECT_FIELD = "ObjectField", r.DIRECTIVE = "Directive", r.NAMED_TYPE = "NamedType", r.LIST_TYPE = "ListType", r.NON_NULL_TYPE = "NonNullType", r.SCHEMA_DEFINITION = "SchemaDefinition", r.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", r.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", r.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", r.FIELD_DEFINITION = "FieldDefinition", r.INPUT_VALUE_DEFINITION = "InputValueDefinition", r.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", r.UNION_TYPE_DEFINITION = "UnionTypeDefinition", r.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", r.ENUM_VALUE_DEFINITION = "EnumValueDefinition", r.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", r.DIRECTIVE_DEFINITION = "DirectiveDefinition", r.SCHEMA_EXTENSION = "SchemaExtension", r.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", r.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", r.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", r.UNION_TYPE_EXTENSION = "UnionTypeExtension", r.ENUM_TYPE_EXTENSION = "EnumTypeExtension", r.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension", r.TYPE_COORDINATE = "TypeCoordinate", r.MEMBER_COORDINATE = "MemberCoordinate", r.ARGUMENT_COORDINATE = "ArgumentCoordinate", r.DIRECTIVE_COORDINATE = "DirectiveCoordinate", r.DIRECTIVE_ARGUMENT_COORDINATE = "DirectiveArgumentCoordinate";
|
|
369
|
+
})(d || (d = {}));
|
|
370
|
+
function Me(r) {
|
|
371
|
+
return r === 9 || r === 32;
|
|
372
|
+
}
|
|
373
|
+
function S(r) {
|
|
374
|
+
return r >= 48 && r <= 57;
|
|
375
|
+
}
|
|
376
|
+
function oe(r) {
|
|
377
|
+
return r >= 97 && r <= 122 || // A-Z
|
|
378
|
+
r >= 65 && r <= 90;
|
|
379
|
+
}
|
|
380
|
+
function ae(r) {
|
|
381
|
+
return oe(r) || r === 95;
|
|
382
|
+
}
|
|
383
|
+
function Ve(r) {
|
|
384
|
+
return oe(r) || S(r) || r === 95;
|
|
385
|
+
}
|
|
386
|
+
function ze(r) {
|
|
387
|
+
var e;
|
|
388
|
+
let t = Number.MAX_SAFE_INTEGER, i = null, n = -1;
|
|
389
|
+
for (let o = 0; o < r.length; ++o) {
|
|
390
|
+
var s;
|
|
391
|
+
const u = r[o], l = qe(u);
|
|
392
|
+
l !== u.length && (i = (s = i) !== null && s !== void 0 ? s : o, n = o, o !== 0 && l < t && (t = l));
|
|
393
|
+
}
|
|
394
|
+
return r.map((o, u) => u === 0 ? o : o.slice(t)).slice(
|
|
395
|
+
(e = i) !== null && e !== void 0 ? e : 0,
|
|
396
|
+
n + 1
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
function qe(r) {
|
|
400
|
+
let e = 0;
|
|
401
|
+
for (; e < r.length && Me(r.charCodeAt(e)); )
|
|
402
|
+
++e;
|
|
403
|
+
return e;
|
|
404
|
+
}
|
|
405
|
+
var a;
|
|
406
|
+
(function(r) {
|
|
407
|
+
r.SOF = "<SOF>", r.EOF = "<EOF>", r.BANG = "!", r.DOLLAR = "$", r.AMP = "&", r.PAREN_L = "(", r.PAREN_R = ")", r.DOT = ".", r.SPREAD = "...", r.COLON = ":", r.EQUALS = "=", r.AT = "@", r.BRACKET_L = "[", r.BRACKET_R = "]", r.BRACE_L = "{", r.PIPE = "|", r.BRACE_R = "}", r.NAME = "Name", r.INT = "Int", r.FLOAT = "Float", r.STRING = "String", r.BLOCK_STRING = "BlockString", r.COMMENT = "Comment";
|
|
408
|
+
})(a || (a = {}));
|
|
409
|
+
class Ge {
|
|
410
|
+
/**
|
|
411
|
+
* The previously focused non-ignored token.
|
|
412
|
+
*/
|
|
413
|
+
/**
|
|
414
|
+
* The currently focused non-ignored token.
|
|
415
|
+
*/
|
|
416
|
+
/**
|
|
417
|
+
* The (1-indexed) line containing the current token.
|
|
418
|
+
*/
|
|
419
|
+
/**
|
|
420
|
+
* The character offset at which the current line begins.
|
|
421
|
+
*/
|
|
422
|
+
constructor(e) {
|
|
423
|
+
const t = new se(a.SOF, 0, 0, 0, 0);
|
|
424
|
+
this.source = e, this.lastToken = t, this.token = t, this.line = 1, this.lineStart = 0;
|
|
425
|
+
}
|
|
426
|
+
get [Symbol.toStringTag]() {
|
|
427
|
+
return "Lexer";
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Advances the token stream to the next non-ignored token.
|
|
431
|
+
*/
|
|
432
|
+
advance() {
|
|
433
|
+
return this.lastToken = this.token, this.token = this.lookahead();
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Looks ahead and returns the next non-ignored token, but does not change
|
|
437
|
+
* the state of Lexer.
|
|
438
|
+
*/
|
|
439
|
+
lookahead() {
|
|
440
|
+
let e = this.token;
|
|
441
|
+
if (e.kind !== a.EOF)
|
|
442
|
+
do
|
|
443
|
+
if (e.next)
|
|
444
|
+
e = e.next;
|
|
445
|
+
else {
|
|
446
|
+
const t = Ye(this, e.end);
|
|
447
|
+
e.next = t, t.prev = e, e = t;
|
|
448
|
+
}
|
|
449
|
+
while (e.kind === a.COMMENT);
|
|
450
|
+
return e;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
function je(r) {
|
|
454
|
+
return r === a.BANG || r === a.DOLLAR || r === a.AMP || r === a.PAREN_L || r === a.PAREN_R || r === a.DOT || r === a.SPREAD || r === a.COLON || r === a.EQUALS || r === a.AT || r === a.BRACKET_L || r === a.BRACKET_R || r === a.BRACE_L || r === a.PIPE || r === a.BRACE_R;
|
|
455
|
+
}
|
|
456
|
+
function D(r) {
|
|
457
|
+
return r >= 0 && r <= 55295 || r >= 57344 && r <= 1114111;
|
|
458
|
+
}
|
|
459
|
+
function $(r, e) {
|
|
460
|
+
return ce(r.charCodeAt(e)) && de(r.charCodeAt(e + 1));
|
|
461
|
+
}
|
|
462
|
+
function ce(r) {
|
|
463
|
+
return r >= 55296 && r <= 56319;
|
|
464
|
+
}
|
|
465
|
+
function de(r) {
|
|
466
|
+
return r >= 56320 && r <= 57343;
|
|
467
|
+
}
|
|
468
|
+
function N(r, e) {
|
|
469
|
+
const t = r.source.body.codePointAt(e);
|
|
470
|
+
if (t === void 0)
|
|
471
|
+
return a.EOF;
|
|
472
|
+
if (t >= 32 && t <= 126) {
|
|
473
|
+
const i = String.fromCodePoint(t);
|
|
474
|
+
return i === '"' ? `'"'` : `"${i}"`;
|
|
475
|
+
}
|
|
476
|
+
return "U+" + t.toString(16).toUpperCase().padStart(4, "0");
|
|
477
|
+
}
|
|
478
|
+
function h(r, e, t, i, n) {
|
|
479
|
+
const s = r.line, o = 1 + t - r.lineStart;
|
|
480
|
+
return new se(e, t, i, s, o, n);
|
|
481
|
+
}
|
|
482
|
+
function Ye(r, e) {
|
|
483
|
+
const t = r.source.body, i = t.length;
|
|
484
|
+
let n = e;
|
|
485
|
+
for (; n < i; ) {
|
|
486
|
+
const s = t.charCodeAt(n);
|
|
487
|
+
switch (s) {
|
|
488
|
+
// Ignored ::
|
|
489
|
+
// - UnicodeBOM
|
|
490
|
+
// - WhiteSpace
|
|
491
|
+
// - LineTerminator
|
|
492
|
+
// - Comment
|
|
493
|
+
// - Comma
|
|
494
|
+
//
|
|
495
|
+
// UnicodeBOM :: "Byte Order Mark (U+FEFF)"
|
|
496
|
+
//
|
|
497
|
+
// WhiteSpace ::
|
|
498
|
+
// - "Horizontal Tab (U+0009)"
|
|
499
|
+
// - "Space (U+0020)"
|
|
500
|
+
//
|
|
501
|
+
// Comma :: ,
|
|
502
|
+
case 65279:
|
|
503
|
+
// <BOM>
|
|
504
|
+
case 9:
|
|
505
|
+
// \t
|
|
506
|
+
case 32:
|
|
507
|
+
// <space>
|
|
508
|
+
case 44:
|
|
509
|
+
++n;
|
|
510
|
+
continue;
|
|
511
|
+
// LineTerminator ::
|
|
512
|
+
// - "New Line (U+000A)"
|
|
513
|
+
// - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"]
|
|
514
|
+
// - "Carriage Return (U+000D)" "New Line (U+000A)"
|
|
515
|
+
case 10:
|
|
516
|
+
++n, ++r.line, r.lineStart = n;
|
|
517
|
+
continue;
|
|
518
|
+
case 13:
|
|
519
|
+
t.charCodeAt(n + 1) === 10 ? n += 2 : ++n, ++r.line, r.lineStart = n;
|
|
520
|
+
continue;
|
|
521
|
+
// Comment
|
|
522
|
+
case 35:
|
|
523
|
+
return He(r, n);
|
|
524
|
+
// Token ::
|
|
525
|
+
// - Punctuator
|
|
526
|
+
// - Name
|
|
527
|
+
// - IntValue
|
|
528
|
+
// - FloatValue
|
|
529
|
+
// - StringValue
|
|
530
|
+
//
|
|
531
|
+
// Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }
|
|
532
|
+
case 33:
|
|
533
|
+
return h(r, a.BANG, n, n + 1);
|
|
534
|
+
case 36:
|
|
535
|
+
return h(r, a.DOLLAR, n, n + 1);
|
|
536
|
+
case 38:
|
|
537
|
+
return h(r, a.AMP, n, n + 1);
|
|
538
|
+
case 40:
|
|
539
|
+
return h(r, a.PAREN_L, n, n + 1);
|
|
540
|
+
case 41:
|
|
541
|
+
return h(r, a.PAREN_R, n, n + 1);
|
|
542
|
+
case 46:
|
|
543
|
+
if (t.charCodeAt(n + 1) === 46 && t.charCodeAt(n + 2) === 46)
|
|
544
|
+
return h(r, a.SPREAD, n, n + 3);
|
|
545
|
+
break;
|
|
546
|
+
case 58:
|
|
547
|
+
return h(r, a.COLON, n, n + 1);
|
|
548
|
+
case 61:
|
|
549
|
+
return h(r, a.EQUALS, n, n + 1);
|
|
550
|
+
case 64:
|
|
551
|
+
return h(r, a.AT, n, n + 1);
|
|
552
|
+
case 91:
|
|
553
|
+
return h(r, a.BRACKET_L, n, n + 1);
|
|
554
|
+
case 93:
|
|
555
|
+
return h(r, a.BRACKET_R, n, n + 1);
|
|
556
|
+
case 123:
|
|
557
|
+
return h(r, a.BRACE_L, n, n + 1);
|
|
558
|
+
case 124:
|
|
559
|
+
return h(r, a.PIPE, n, n + 1);
|
|
560
|
+
case 125:
|
|
561
|
+
return h(r, a.BRACE_R, n, n + 1);
|
|
562
|
+
// StringValue
|
|
563
|
+
case 34:
|
|
564
|
+
return t.charCodeAt(n + 1) === 34 && t.charCodeAt(n + 2) === 34 ? Ze(r, n) : Je(r, n);
|
|
565
|
+
}
|
|
566
|
+
if (S(s) || s === 45)
|
|
567
|
+
return Qe(r, n, s);
|
|
568
|
+
if (ae(s))
|
|
569
|
+
return et(r, n);
|
|
570
|
+
throw g(
|
|
571
|
+
r.source,
|
|
572
|
+
n,
|
|
573
|
+
s === 39 ? `Unexpected single quote character ('), did you mean to use a double quote (")?` : D(s) || $(t, n) ? `Unexpected character: ${N(r, n)}.` : `Invalid character: ${N(r, n)}.`
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
return h(r, a.EOF, i, i);
|
|
577
|
+
}
|
|
578
|
+
function He(r, e) {
|
|
579
|
+
const t = r.source.body, i = t.length;
|
|
580
|
+
let n = e + 1;
|
|
581
|
+
for (; n < i; ) {
|
|
582
|
+
const s = t.charCodeAt(n);
|
|
583
|
+
if (s === 10 || s === 13)
|
|
584
|
+
break;
|
|
585
|
+
if (D(s))
|
|
586
|
+
++n;
|
|
587
|
+
else if ($(t, n))
|
|
588
|
+
n += 2;
|
|
589
|
+
else
|
|
590
|
+
break;
|
|
591
|
+
}
|
|
592
|
+
return h(
|
|
593
|
+
r,
|
|
594
|
+
a.COMMENT,
|
|
595
|
+
e,
|
|
596
|
+
n,
|
|
597
|
+
t.slice(e + 1, n)
|
|
598
|
+
);
|
|
599
|
+
}
|
|
600
|
+
function Qe(r, e, t) {
|
|
601
|
+
const i = r.source.body;
|
|
602
|
+
let n = e, s = t, o = !1;
|
|
603
|
+
if (s === 45 && (s = i.charCodeAt(++n)), s === 48) {
|
|
604
|
+
if (s = i.charCodeAt(++n), S(s))
|
|
605
|
+
throw g(
|
|
606
|
+
r.source,
|
|
607
|
+
n,
|
|
608
|
+
`Invalid number, unexpected digit after 0: ${N(
|
|
609
|
+
r,
|
|
610
|
+
n
|
|
611
|
+
)}.`
|
|
612
|
+
);
|
|
613
|
+
} else
|
|
614
|
+
n = V(r, n, s), s = i.charCodeAt(n);
|
|
615
|
+
if (s === 46 && (o = !0, s = i.charCodeAt(++n), n = V(r, n, s), s = i.charCodeAt(n)), (s === 69 || s === 101) && (o = !0, s = i.charCodeAt(++n), (s === 43 || s === 45) && (s = i.charCodeAt(++n)), n = V(r, n, s), s = i.charCodeAt(n)), s === 46 || ae(s))
|
|
616
|
+
throw g(
|
|
617
|
+
r.source,
|
|
618
|
+
n,
|
|
619
|
+
`Invalid number, expected digit but got: ${N(
|
|
620
|
+
r,
|
|
621
|
+
n
|
|
622
|
+
)}.`
|
|
623
|
+
);
|
|
624
|
+
return h(
|
|
625
|
+
r,
|
|
626
|
+
o ? a.FLOAT : a.INT,
|
|
627
|
+
e,
|
|
628
|
+
n,
|
|
629
|
+
i.slice(e, n)
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
function V(r, e, t) {
|
|
633
|
+
if (!S(t))
|
|
634
|
+
throw g(
|
|
635
|
+
r.source,
|
|
636
|
+
e,
|
|
637
|
+
`Invalid number, expected digit but got: ${N(
|
|
638
|
+
r,
|
|
639
|
+
e
|
|
640
|
+
)}.`
|
|
641
|
+
);
|
|
642
|
+
const i = r.source.body;
|
|
643
|
+
let n = e + 1;
|
|
644
|
+
for (; S(i.charCodeAt(n)); )
|
|
645
|
+
++n;
|
|
646
|
+
return n;
|
|
647
|
+
}
|
|
648
|
+
function Je(r, e) {
|
|
649
|
+
const t = r.source.body, i = t.length;
|
|
650
|
+
let n = e + 1, s = n, o = "";
|
|
651
|
+
for (; n < i; ) {
|
|
652
|
+
const u = t.charCodeAt(n);
|
|
653
|
+
if (u === 34)
|
|
654
|
+
return o += t.slice(s, n), h(r, a.STRING, e, n + 1, o);
|
|
655
|
+
if (u === 92) {
|
|
656
|
+
o += t.slice(s, n);
|
|
657
|
+
const l = t.charCodeAt(n + 1) === 117 ? t.charCodeAt(n + 2) === 123 ? Xe(r, n) : Ke(r, n) : We(r, n);
|
|
658
|
+
o += l.value, n += l.size, s = n;
|
|
659
|
+
continue;
|
|
660
|
+
}
|
|
661
|
+
if (u === 10 || u === 13)
|
|
662
|
+
break;
|
|
663
|
+
if (D(u))
|
|
664
|
+
++n;
|
|
665
|
+
else if ($(t, n))
|
|
666
|
+
n += 2;
|
|
667
|
+
else
|
|
668
|
+
throw g(
|
|
669
|
+
r.source,
|
|
670
|
+
n,
|
|
671
|
+
`Invalid character within String: ${N(
|
|
672
|
+
r,
|
|
673
|
+
n
|
|
674
|
+
)}.`
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
throw g(r.source, n, "Unterminated string.");
|
|
678
|
+
}
|
|
679
|
+
function Xe(r, e) {
|
|
680
|
+
const t = r.source.body;
|
|
681
|
+
let i = 0, n = 3;
|
|
682
|
+
for (; n < 12; ) {
|
|
683
|
+
const s = t.charCodeAt(e + n++);
|
|
684
|
+
if (s === 125) {
|
|
685
|
+
if (n < 5 || !D(i))
|
|
686
|
+
break;
|
|
687
|
+
return {
|
|
688
|
+
value: String.fromCodePoint(i),
|
|
689
|
+
size: n
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
if (i = i << 4 | P(s), i < 0)
|
|
693
|
+
break;
|
|
694
|
+
}
|
|
695
|
+
throw g(
|
|
696
|
+
r.source,
|
|
697
|
+
e,
|
|
698
|
+
`Invalid Unicode escape sequence: "${t.slice(
|
|
699
|
+
e,
|
|
700
|
+
e + n
|
|
701
|
+
)}".`
|
|
702
|
+
);
|
|
703
|
+
}
|
|
704
|
+
function Ke(r, e) {
|
|
705
|
+
const t = r.source.body, i = K(t, e + 2);
|
|
706
|
+
if (D(i))
|
|
707
|
+
return {
|
|
708
|
+
value: String.fromCodePoint(i),
|
|
709
|
+
size: 6
|
|
710
|
+
};
|
|
711
|
+
if (ce(i) && t.charCodeAt(e + 6) === 92 && t.charCodeAt(e + 7) === 117) {
|
|
712
|
+
const n = K(t, e + 8);
|
|
713
|
+
if (de(n))
|
|
714
|
+
return {
|
|
715
|
+
value: String.fromCodePoint(i, n),
|
|
716
|
+
size: 12
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
throw g(
|
|
720
|
+
r.source,
|
|
721
|
+
e,
|
|
722
|
+
`Invalid Unicode escape sequence: "${t.slice(e, e + 6)}".`
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
function K(r, e) {
|
|
726
|
+
return P(r.charCodeAt(e)) << 12 | P(r.charCodeAt(e + 1)) << 8 | P(r.charCodeAt(e + 2)) << 4 | P(r.charCodeAt(e + 3));
|
|
727
|
+
}
|
|
728
|
+
function P(r) {
|
|
729
|
+
return r >= 48 && r <= 57 ? r - 48 : r >= 65 && r <= 70 ? r - 55 : r >= 97 && r <= 102 ? r - 87 : -1;
|
|
730
|
+
}
|
|
731
|
+
function We(r, e) {
|
|
732
|
+
const t = r.source.body;
|
|
733
|
+
switch (t.charCodeAt(e + 1)) {
|
|
734
|
+
case 34:
|
|
735
|
+
return {
|
|
736
|
+
value: '"',
|
|
737
|
+
size: 2
|
|
738
|
+
};
|
|
739
|
+
case 92:
|
|
740
|
+
return {
|
|
741
|
+
value: "\\",
|
|
742
|
+
size: 2
|
|
743
|
+
};
|
|
744
|
+
case 47:
|
|
745
|
+
return {
|
|
746
|
+
value: "/",
|
|
747
|
+
size: 2
|
|
748
|
+
};
|
|
749
|
+
case 98:
|
|
750
|
+
return {
|
|
751
|
+
value: "\b",
|
|
752
|
+
size: 2
|
|
753
|
+
};
|
|
754
|
+
case 102:
|
|
755
|
+
return {
|
|
756
|
+
value: "\f",
|
|
757
|
+
size: 2
|
|
758
|
+
};
|
|
759
|
+
case 110:
|
|
760
|
+
return {
|
|
761
|
+
value: `
|
|
762
|
+
`,
|
|
763
|
+
size: 2
|
|
764
|
+
};
|
|
765
|
+
case 114:
|
|
766
|
+
return {
|
|
767
|
+
value: "\r",
|
|
768
|
+
size: 2
|
|
769
|
+
};
|
|
770
|
+
case 116:
|
|
771
|
+
return {
|
|
772
|
+
value: " ",
|
|
773
|
+
size: 2
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
throw g(
|
|
777
|
+
r.source,
|
|
778
|
+
e,
|
|
779
|
+
`Invalid character escape sequence: "${t.slice(
|
|
780
|
+
e,
|
|
781
|
+
e + 2
|
|
782
|
+
)}".`
|
|
783
|
+
);
|
|
784
|
+
}
|
|
785
|
+
function Ze(r, e) {
|
|
786
|
+
const t = r.source.body, i = t.length;
|
|
787
|
+
let n = r.lineStart, s = e + 3, o = s, u = "";
|
|
788
|
+
const l = [];
|
|
789
|
+
for (; s < i; ) {
|
|
790
|
+
const f = t.charCodeAt(s);
|
|
791
|
+
if (f === 34 && t.charCodeAt(s + 1) === 34 && t.charCodeAt(s + 2) === 34) {
|
|
792
|
+
u += t.slice(o, s), l.push(u);
|
|
793
|
+
const c = h(
|
|
794
|
+
r,
|
|
795
|
+
a.BLOCK_STRING,
|
|
796
|
+
e,
|
|
797
|
+
s + 3,
|
|
798
|
+
// Return a string of the lines joined with U+000A.
|
|
799
|
+
ze(l).join(`
|
|
800
|
+
`)
|
|
801
|
+
);
|
|
802
|
+
return r.line += l.length - 1, r.lineStart = n, c;
|
|
803
|
+
}
|
|
804
|
+
if (f === 92 && t.charCodeAt(s + 1) === 34 && t.charCodeAt(s + 2) === 34 && t.charCodeAt(s + 3) === 34) {
|
|
805
|
+
u += t.slice(o, s), o = s + 1, s += 4;
|
|
806
|
+
continue;
|
|
807
|
+
}
|
|
808
|
+
if (f === 10 || f === 13) {
|
|
809
|
+
u += t.slice(o, s), l.push(u), f === 13 && t.charCodeAt(s + 1) === 10 ? s += 2 : ++s, u = "", o = s, n = s;
|
|
810
|
+
continue;
|
|
811
|
+
}
|
|
812
|
+
if (D(f))
|
|
813
|
+
++s;
|
|
814
|
+
else if ($(t, s))
|
|
815
|
+
s += 2;
|
|
816
|
+
else
|
|
817
|
+
throw g(
|
|
818
|
+
r.source,
|
|
819
|
+
s,
|
|
820
|
+
`Invalid character within String: ${N(
|
|
821
|
+
r,
|
|
822
|
+
s
|
|
823
|
+
)}.`
|
|
824
|
+
);
|
|
825
|
+
}
|
|
826
|
+
throw g(r.source, s, "Unterminated string.");
|
|
827
|
+
}
|
|
828
|
+
function et(r, e) {
|
|
829
|
+
const t = r.source.body, i = t.length;
|
|
830
|
+
let n = e + 1;
|
|
831
|
+
for (; n < i; ) {
|
|
832
|
+
const s = t.charCodeAt(n);
|
|
833
|
+
if (Ve(s))
|
|
834
|
+
++n;
|
|
835
|
+
else
|
|
836
|
+
break;
|
|
837
|
+
}
|
|
838
|
+
return h(
|
|
839
|
+
r,
|
|
840
|
+
a.NAME,
|
|
841
|
+
e,
|
|
842
|
+
n,
|
|
843
|
+
t.slice(e, n)
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
const tt = 10, ue = 2;
|
|
847
|
+
function le(r) {
|
|
848
|
+
return U(r, []);
|
|
849
|
+
}
|
|
850
|
+
function U(r, e) {
|
|
851
|
+
switch (typeof r) {
|
|
852
|
+
case "string":
|
|
853
|
+
return JSON.stringify(r);
|
|
854
|
+
case "function":
|
|
855
|
+
return r.name ? `[function ${r.name}]` : "[function]";
|
|
856
|
+
case "object":
|
|
857
|
+
return rt(r, e);
|
|
858
|
+
default:
|
|
859
|
+
return String(r);
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
function rt(r, e) {
|
|
863
|
+
if (r === null)
|
|
864
|
+
return "null";
|
|
865
|
+
if (e.includes(r))
|
|
866
|
+
return "[Circular]";
|
|
867
|
+
const t = [...e, r];
|
|
868
|
+
if (nt(r)) {
|
|
869
|
+
const i = r.toJSON();
|
|
870
|
+
if (i !== r)
|
|
871
|
+
return typeof i == "string" ? i : U(i, t);
|
|
872
|
+
} else if (Array.isArray(r))
|
|
873
|
+
return st(r, t);
|
|
874
|
+
return it(r, t);
|
|
875
|
+
}
|
|
876
|
+
function nt(r) {
|
|
877
|
+
return typeof r.toJSON == "function";
|
|
878
|
+
}
|
|
879
|
+
function it(r, e) {
|
|
880
|
+
const t = Object.entries(r);
|
|
881
|
+
return t.length === 0 ? "{}" : e.length > ue ? "[" + ot(r) + "]" : "{ " + t.map(
|
|
882
|
+
([n, s]) => n + ": " + U(s, e)
|
|
883
|
+
).join(", ") + " }";
|
|
884
|
+
}
|
|
885
|
+
function st(r, e) {
|
|
886
|
+
if (r.length === 0)
|
|
887
|
+
return "[]";
|
|
888
|
+
if (e.length > ue)
|
|
889
|
+
return "[Array]";
|
|
890
|
+
const t = Math.min(tt, r.length), i = r.length - t, n = [];
|
|
891
|
+
for (let s = 0; s < t; ++s)
|
|
892
|
+
n.push(U(r[s], e));
|
|
893
|
+
return i === 1 ? n.push("... 1 more item") : i > 1 && n.push(`... ${i} more items`), "[" + n.join(", ") + "]";
|
|
894
|
+
}
|
|
895
|
+
function ot(r) {
|
|
896
|
+
const e = Object.prototype.toString.call(r).replace(/^\[object /, "").replace(/]$/, "");
|
|
897
|
+
if (e === "Object" && typeof r.constructor == "function") {
|
|
898
|
+
const t = r.constructor.name;
|
|
899
|
+
if (typeof t == "string" && t !== "")
|
|
900
|
+
return t;
|
|
901
|
+
}
|
|
902
|
+
return e;
|
|
903
|
+
}
|
|
904
|
+
const at = globalThis.process && // eslint-disable-next-line no-undef
|
|
905
|
+
process.env.NODE_ENV === "production", ct = (
|
|
906
|
+
/* c8 ignore next 6 */
|
|
907
|
+
// FIXME: https://github.com/graphql/graphql-js/issues/2317
|
|
908
|
+
at ? function(e, t) {
|
|
909
|
+
return e instanceof t;
|
|
910
|
+
} : function(e, t) {
|
|
911
|
+
if (e instanceof t)
|
|
912
|
+
return !0;
|
|
913
|
+
if (typeof e == "object" && e !== null) {
|
|
914
|
+
var i;
|
|
915
|
+
const n = t.prototype[Symbol.toStringTag], s = (
|
|
916
|
+
// We still need to support constructor's name to detect conflicts with older versions of this library.
|
|
917
|
+
Symbol.toStringTag in e ? e[Symbol.toStringTag] : (i = e.constructor) === null || i === void 0 ? void 0 : i.name
|
|
918
|
+
);
|
|
919
|
+
if (n === s) {
|
|
920
|
+
const o = le(e);
|
|
921
|
+
throw new Error(`Cannot use ${n} "${o}" from another module or realm.
|
|
922
|
+
|
|
923
|
+
Ensure that there is only one instance of "graphql" in the node_modules
|
|
924
|
+
directory. If different versions of "graphql" are the dependencies of other
|
|
925
|
+
relied on modules, use "resolutions" to ensure only one version is installed.
|
|
926
|
+
|
|
927
|
+
https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
928
|
+
|
|
929
|
+
Duplicate "graphql" modules cannot be used at the same time since different
|
|
930
|
+
versions may have different capabilities and behavior. The data from one
|
|
931
|
+
version used in the function from another could produce confusing and
|
|
932
|
+
spurious results.`);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
return !1;
|
|
936
|
+
}
|
|
937
|
+
);
|
|
938
|
+
class pe {
|
|
939
|
+
constructor(e, t = "GraphQL request", i = {
|
|
940
|
+
line: 1,
|
|
941
|
+
column: 1
|
|
942
|
+
}) {
|
|
943
|
+
typeof e == "string" || M(!1, `Body must be a string. Received: ${le(e)}.`), this.body = e, this.name = t, this.locationOffset = i, this.locationOffset.line > 0 || M(
|
|
944
|
+
!1,
|
|
945
|
+
"line in locationOffset is 1-indexed and must be positive."
|
|
946
|
+
), this.locationOffset.column > 0 || M(
|
|
947
|
+
!1,
|
|
948
|
+
"column in locationOffset is 1-indexed and must be positive."
|
|
949
|
+
);
|
|
950
|
+
}
|
|
951
|
+
get [Symbol.toStringTag]() {
|
|
952
|
+
return "Source";
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
function dt(r) {
|
|
956
|
+
return ct(r, pe);
|
|
957
|
+
}
|
|
958
|
+
function ut(r, e) {
|
|
959
|
+
const t = new lt(r, e), i = t.parseDocument();
|
|
960
|
+
return Object.defineProperty(i, "tokenCount", {
|
|
961
|
+
enumerable: !1,
|
|
962
|
+
value: t.tokenCount
|
|
963
|
+
}), i;
|
|
964
|
+
}
|
|
965
|
+
class lt {
|
|
966
|
+
constructor(e, t = {}) {
|
|
967
|
+
const { lexer: i, ...n } = t;
|
|
968
|
+
if (i)
|
|
969
|
+
this._lexer = i;
|
|
970
|
+
else {
|
|
971
|
+
const s = dt(e) ? e : new pe(e);
|
|
972
|
+
this._lexer = new Ge(s);
|
|
973
|
+
}
|
|
974
|
+
this._options = n, this._tokenCounter = 0;
|
|
975
|
+
}
|
|
976
|
+
get tokenCount() {
|
|
977
|
+
return this._tokenCounter;
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* Converts a name lex token into a name parse node.
|
|
981
|
+
*/
|
|
982
|
+
parseName() {
|
|
983
|
+
const e = this.expectToken(a.NAME);
|
|
984
|
+
return this.node(e, {
|
|
985
|
+
kind: d.NAME,
|
|
986
|
+
value: e.value
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
// Implements the parsing rules in the Document section.
|
|
990
|
+
/**
|
|
991
|
+
* Document : Definition+
|
|
992
|
+
*/
|
|
993
|
+
parseDocument() {
|
|
994
|
+
return this.node(this._lexer.token, {
|
|
995
|
+
kind: d.DOCUMENT,
|
|
996
|
+
definitions: this.many(
|
|
997
|
+
a.SOF,
|
|
998
|
+
this.parseDefinition,
|
|
999
|
+
a.EOF
|
|
1000
|
+
)
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* Definition :
|
|
1005
|
+
* - ExecutableDefinition
|
|
1006
|
+
* - TypeSystemDefinition
|
|
1007
|
+
* - TypeSystemExtension
|
|
1008
|
+
*
|
|
1009
|
+
* ExecutableDefinition :
|
|
1010
|
+
* - OperationDefinition
|
|
1011
|
+
* - FragmentDefinition
|
|
1012
|
+
*
|
|
1013
|
+
* TypeSystemDefinition :
|
|
1014
|
+
* - SchemaDefinition
|
|
1015
|
+
* - TypeDefinition
|
|
1016
|
+
* - DirectiveDefinition
|
|
1017
|
+
*
|
|
1018
|
+
* TypeDefinition :
|
|
1019
|
+
* - ScalarTypeDefinition
|
|
1020
|
+
* - ObjectTypeDefinition
|
|
1021
|
+
* - InterfaceTypeDefinition
|
|
1022
|
+
* - UnionTypeDefinition
|
|
1023
|
+
* - EnumTypeDefinition
|
|
1024
|
+
* - InputObjectTypeDefinition
|
|
1025
|
+
*/
|
|
1026
|
+
parseDefinition() {
|
|
1027
|
+
if (this.peek(a.BRACE_L))
|
|
1028
|
+
return this.parseOperationDefinition();
|
|
1029
|
+
const e = this.peekDescription(), t = e ? this._lexer.lookahead() : this._lexer.token;
|
|
1030
|
+
if (e && t.kind === a.BRACE_L)
|
|
1031
|
+
throw g(
|
|
1032
|
+
this._lexer.source,
|
|
1033
|
+
this._lexer.token.start,
|
|
1034
|
+
"Unexpected description, descriptions are not supported on shorthand queries."
|
|
1035
|
+
);
|
|
1036
|
+
if (t.kind === a.NAME) {
|
|
1037
|
+
switch (t.value) {
|
|
1038
|
+
case "schema":
|
|
1039
|
+
return this.parseSchemaDefinition();
|
|
1040
|
+
case "scalar":
|
|
1041
|
+
return this.parseScalarTypeDefinition();
|
|
1042
|
+
case "type":
|
|
1043
|
+
return this.parseObjectTypeDefinition();
|
|
1044
|
+
case "interface":
|
|
1045
|
+
return this.parseInterfaceTypeDefinition();
|
|
1046
|
+
case "union":
|
|
1047
|
+
return this.parseUnionTypeDefinition();
|
|
1048
|
+
case "enum":
|
|
1049
|
+
return this.parseEnumTypeDefinition();
|
|
1050
|
+
case "input":
|
|
1051
|
+
return this.parseInputObjectTypeDefinition();
|
|
1052
|
+
case "directive":
|
|
1053
|
+
return this.parseDirectiveDefinition();
|
|
1054
|
+
}
|
|
1055
|
+
switch (t.value) {
|
|
1056
|
+
case "query":
|
|
1057
|
+
case "mutation":
|
|
1058
|
+
case "subscription":
|
|
1059
|
+
return this.parseOperationDefinition();
|
|
1060
|
+
case "fragment":
|
|
1061
|
+
return this.parseFragmentDefinition();
|
|
1062
|
+
}
|
|
1063
|
+
if (e)
|
|
1064
|
+
throw g(
|
|
1065
|
+
this._lexer.source,
|
|
1066
|
+
this._lexer.token.start,
|
|
1067
|
+
"Unexpected description, only GraphQL definitions support descriptions."
|
|
1068
|
+
);
|
|
1069
|
+
if (t.value === "extend")
|
|
1070
|
+
return this.parseTypeSystemExtension();
|
|
1071
|
+
}
|
|
1072
|
+
throw this.unexpected(t);
|
|
1073
|
+
}
|
|
1074
|
+
// Implements the parsing rules in the Operations section.
|
|
1075
|
+
/**
|
|
1076
|
+
* OperationDefinition :
|
|
1077
|
+
* - SelectionSet
|
|
1078
|
+
* - OperationType Name? VariableDefinitions? Directives? SelectionSet
|
|
1079
|
+
*/
|
|
1080
|
+
parseOperationDefinition() {
|
|
1081
|
+
const e = this._lexer.token;
|
|
1082
|
+
if (this.peek(a.BRACE_L))
|
|
1083
|
+
return this.node(e, {
|
|
1084
|
+
kind: d.OPERATION_DEFINITION,
|
|
1085
|
+
operation: x.QUERY,
|
|
1086
|
+
description: void 0,
|
|
1087
|
+
name: void 0,
|
|
1088
|
+
variableDefinitions: [],
|
|
1089
|
+
directives: [],
|
|
1090
|
+
selectionSet: this.parseSelectionSet()
|
|
1091
|
+
});
|
|
1092
|
+
const t = this.parseDescription(), i = this.parseOperationType();
|
|
1093
|
+
let n;
|
|
1094
|
+
return this.peek(a.NAME) && (n = this.parseName()), this.node(e, {
|
|
1095
|
+
kind: d.OPERATION_DEFINITION,
|
|
1096
|
+
operation: i,
|
|
1097
|
+
description: t,
|
|
1098
|
+
name: n,
|
|
1099
|
+
variableDefinitions: this.parseVariableDefinitions(),
|
|
1100
|
+
directives: this.parseDirectives(!1),
|
|
1101
|
+
selectionSet: this.parseSelectionSet()
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* OperationType : one of query mutation subscription
|
|
1106
|
+
*/
|
|
1107
|
+
parseOperationType() {
|
|
1108
|
+
const e = this.expectToken(a.NAME);
|
|
1109
|
+
switch (e.value) {
|
|
1110
|
+
case "query":
|
|
1111
|
+
return x.QUERY;
|
|
1112
|
+
case "mutation":
|
|
1113
|
+
return x.MUTATION;
|
|
1114
|
+
case "subscription":
|
|
1115
|
+
return x.SUBSCRIPTION;
|
|
1116
|
+
}
|
|
1117
|
+
throw this.unexpected(e);
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* VariableDefinitions : ( VariableDefinition+ )
|
|
1121
|
+
*/
|
|
1122
|
+
parseVariableDefinitions() {
|
|
1123
|
+
return this.optionalMany(
|
|
1124
|
+
a.PAREN_L,
|
|
1125
|
+
this.parseVariableDefinition,
|
|
1126
|
+
a.PAREN_R
|
|
1127
|
+
);
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* VariableDefinition : Variable : Type DefaultValue? Directives[Const]?
|
|
1131
|
+
*/
|
|
1132
|
+
parseVariableDefinition() {
|
|
1133
|
+
return this.node(this._lexer.token, {
|
|
1134
|
+
kind: d.VARIABLE_DEFINITION,
|
|
1135
|
+
description: this.parseDescription(),
|
|
1136
|
+
variable: this.parseVariable(),
|
|
1137
|
+
type: (this.expectToken(a.COLON), this.parseTypeReference()),
|
|
1138
|
+
defaultValue: this.expectOptionalToken(a.EQUALS) ? this.parseConstValueLiteral() : void 0,
|
|
1139
|
+
directives: this.parseConstDirectives()
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Variable : $ Name
|
|
1144
|
+
*/
|
|
1145
|
+
parseVariable() {
|
|
1146
|
+
const e = this._lexer.token;
|
|
1147
|
+
return this.expectToken(a.DOLLAR), this.node(e, {
|
|
1148
|
+
kind: d.VARIABLE,
|
|
1149
|
+
name: this.parseName()
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
/**
|
|
1153
|
+
* ```
|
|
1154
|
+
* SelectionSet : { Selection+ }
|
|
1155
|
+
* ```
|
|
1156
|
+
*/
|
|
1157
|
+
parseSelectionSet() {
|
|
1158
|
+
return this.node(this._lexer.token, {
|
|
1159
|
+
kind: d.SELECTION_SET,
|
|
1160
|
+
selections: this.many(
|
|
1161
|
+
a.BRACE_L,
|
|
1162
|
+
this.parseSelection,
|
|
1163
|
+
a.BRACE_R
|
|
1164
|
+
)
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Selection :
|
|
1169
|
+
* - Field
|
|
1170
|
+
* - FragmentSpread
|
|
1171
|
+
* - InlineFragment
|
|
1172
|
+
*/
|
|
1173
|
+
parseSelection() {
|
|
1174
|
+
return this.peek(a.SPREAD) ? this.parseFragment() : this.parseField();
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* Field : Alias? Name Arguments? Directives? SelectionSet?
|
|
1178
|
+
*
|
|
1179
|
+
* Alias : Name :
|
|
1180
|
+
*/
|
|
1181
|
+
parseField() {
|
|
1182
|
+
const e = this._lexer.token, t = this.parseName();
|
|
1183
|
+
let i, n;
|
|
1184
|
+
return this.expectOptionalToken(a.COLON) ? (i = t, n = this.parseName()) : n = t, this.node(e, {
|
|
1185
|
+
kind: d.FIELD,
|
|
1186
|
+
alias: i,
|
|
1187
|
+
name: n,
|
|
1188
|
+
arguments: this.parseArguments(!1),
|
|
1189
|
+
directives: this.parseDirectives(!1),
|
|
1190
|
+
selectionSet: this.peek(a.BRACE_L) ? this.parseSelectionSet() : void 0
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Arguments[Const] : ( Argument[?Const]+ )
|
|
1195
|
+
*/
|
|
1196
|
+
parseArguments(e) {
|
|
1197
|
+
const t = e ? this.parseConstArgument : this.parseArgument;
|
|
1198
|
+
return this.optionalMany(a.PAREN_L, t, a.PAREN_R);
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* Argument[Const] : Name : Value[?Const]
|
|
1202
|
+
*/
|
|
1203
|
+
parseArgument(e = !1) {
|
|
1204
|
+
const t = this._lexer.token, i = this.parseName();
|
|
1205
|
+
return this.expectToken(a.COLON), this.node(t, {
|
|
1206
|
+
kind: d.ARGUMENT,
|
|
1207
|
+
name: i,
|
|
1208
|
+
value: this.parseValueLiteral(e)
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
parseConstArgument() {
|
|
1212
|
+
return this.parseArgument(!0);
|
|
1213
|
+
}
|
|
1214
|
+
// Implements the parsing rules in the Fragments section.
|
|
1215
|
+
/**
|
|
1216
|
+
* Corresponds to both FragmentSpread and InlineFragment in the spec.
|
|
1217
|
+
*
|
|
1218
|
+
* FragmentSpread : ... FragmentName Directives?
|
|
1219
|
+
*
|
|
1220
|
+
* InlineFragment : ... TypeCondition? Directives? SelectionSet
|
|
1221
|
+
*/
|
|
1222
|
+
parseFragment() {
|
|
1223
|
+
const e = this._lexer.token;
|
|
1224
|
+
this.expectToken(a.SPREAD);
|
|
1225
|
+
const t = this.expectOptionalKeyword("on");
|
|
1226
|
+
return !t && this.peek(a.NAME) ? this.node(e, {
|
|
1227
|
+
kind: d.FRAGMENT_SPREAD,
|
|
1228
|
+
name: this.parseFragmentName(),
|
|
1229
|
+
directives: this.parseDirectives(!1)
|
|
1230
|
+
}) : this.node(e, {
|
|
1231
|
+
kind: d.INLINE_FRAGMENT,
|
|
1232
|
+
typeCondition: t ? this.parseNamedType() : void 0,
|
|
1233
|
+
directives: this.parseDirectives(!1),
|
|
1234
|
+
selectionSet: this.parseSelectionSet()
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
/**
|
|
1238
|
+
* FragmentDefinition :
|
|
1239
|
+
* - fragment FragmentName on TypeCondition Directives? SelectionSet
|
|
1240
|
+
*
|
|
1241
|
+
* TypeCondition : NamedType
|
|
1242
|
+
*/
|
|
1243
|
+
parseFragmentDefinition() {
|
|
1244
|
+
const e = this._lexer.token, t = this.parseDescription();
|
|
1245
|
+
return this.expectKeyword("fragment"), this._options.allowLegacyFragmentVariables === !0 ? this.node(e, {
|
|
1246
|
+
kind: d.FRAGMENT_DEFINITION,
|
|
1247
|
+
description: t,
|
|
1248
|
+
name: this.parseFragmentName(),
|
|
1249
|
+
variableDefinitions: this.parseVariableDefinitions(),
|
|
1250
|
+
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
1251
|
+
directives: this.parseDirectives(!1),
|
|
1252
|
+
selectionSet: this.parseSelectionSet()
|
|
1253
|
+
}) : this.node(e, {
|
|
1254
|
+
kind: d.FRAGMENT_DEFINITION,
|
|
1255
|
+
description: t,
|
|
1256
|
+
name: this.parseFragmentName(),
|
|
1257
|
+
typeCondition: (this.expectKeyword("on"), this.parseNamedType()),
|
|
1258
|
+
directives: this.parseDirectives(!1),
|
|
1259
|
+
selectionSet: this.parseSelectionSet()
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* FragmentName : Name but not `on`
|
|
1264
|
+
*/
|
|
1265
|
+
parseFragmentName() {
|
|
1266
|
+
if (this._lexer.token.value === "on")
|
|
1267
|
+
throw this.unexpected();
|
|
1268
|
+
return this.parseName();
|
|
1269
|
+
}
|
|
1270
|
+
// Implements the parsing rules in the Values section.
|
|
1271
|
+
/**
|
|
1272
|
+
* Value[Const] :
|
|
1273
|
+
* - [~Const] Variable
|
|
1274
|
+
* - IntValue
|
|
1275
|
+
* - FloatValue
|
|
1276
|
+
* - StringValue
|
|
1277
|
+
* - BooleanValue
|
|
1278
|
+
* - NullValue
|
|
1279
|
+
* - EnumValue
|
|
1280
|
+
* - ListValue[?Const]
|
|
1281
|
+
* - ObjectValue[?Const]
|
|
1282
|
+
*
|
|
1283
|
+
* BooleanValue : one of `true` `false`
|
|
1284
|
+
*
|
|
1285
|
+
* NullValue : `null`
|
|
1286
|
+
*
|
|
1287
|
+
* EnumValue : Name but not `true`, `false` or `null`
|
|
1288
|
+
*/
|
|
1289
|
+
parseValueLiteral(e) {
|
|
1290
|
+
const t = this._lexer.token;
|
|
1291
|
+
switch (t.kind) {
|
|
1292
|
+
case a.BRACKET_L:
|
|
1293
|
+
return this.parseList(e);
|
|
1294
|
+
case a.BRACE_L:
|
|
1295
|
+
return this.parseObject(e);
|
|
1296
|
+
case a.INT:
|
|
1297
|
+
return this.advanceLexer(), this.node(t, {
|
|
1298
|
+
kind: d.INT,
|
|
1299
|
+
value: t.value
|
|
1300
|
+
});
|
|
1301
|
+
case a.FLOAT:
|
|
1302
|
+
return this.advanceLexer(), this.node(t, {
|
|
1303
|
+
kind: d.FLOAT,
|
|
1304
|
+
value: t.value
|
|
1305
|
+
});
|
|
1306
|
+
case a.STRING:
|
|
1307
|
+
case a.BLOCK_STRING:
|
|
1308
|
+
return this.parseStringLiteral();
|
|
1309
|
+
case a.NAME:
|
|
1310
|
+
switch (this.advanceLexer(), t.value) {
|
|
1311
|
+
case "true":
|
|
1312
|
+
return this.node(t, {
|
|
1313
|
+
kind: d.BOOLEAN,
|
|
1314
|
+
value: !0
|
|
1315
|
+
});
|
|
1316
|
+
case "false":
|
|
1317
|
+
return this.node(t, {
|
|
1318
|
+
kind: d.BOOLEAN,
|
|
1319
|
+
value: !1
|
|
1320
|
+
});
|
|
1321
|
+
case "null":
|
|
1322
|
+
return this.node(t, {
|
|
1323
|
+
kind: d.NULL
|
|
1324
|
+
});
|
|
1325
|
+
default:
|
|
1326
|
+
return this.node(t, {
|
|
1327
|
+
kind: d.ENUM,
|
|
1328
|
+
value: t.value
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
case a.DOLLAR:
|
|
1332
|
+
if (e)
|
|
1333
|
+
if (this.expectToken(a.DOLLAR), this._lexer.token.kind === a.NAME) {
|
|
1334
|
+
const i = this._lexer.token.value;
|
|
1335
|
+
throw g(
|
|
1336
|
+
this._lexer.source,
|
|
1337
|
+
t.start,
|
|
1338
|
+
`Unexpected variable "$${i}" in constant value.`
|
|
1339
|
+
);
|
|
1340
|
+
} else
|
|
1341
|
+
throw this.unexpected(t);
|
|
1342
|
+
return this.parseVariable();
|
|
1343
|
+
default:
|
|
1344
|
+
throw this.unexpected();
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
parseConstValueLiteral() {
|
|
1348
|
+
return this.parseValueLiteral(!0);
|
|
1349
|
+
}
|
|
1350
|
+
parseStringLiteral() {
|
|
1351
|
+
const e = this._lexer.token;
|
|
1352
|
+
return this.advanceLexer(), this.node(e, {
|
|
1353
|
+
kind: d.STRING,
|
|
1354
|
+
value: e.value,
|
|
1355
|
+
block: e.kind === a.BLOCK_STRING
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* ListValue[Const] :
|
|
1360
|
+
* - [ ]
|
|
1361
|
+
* - [ Value[?Const]+ ]
|
|
1362
|
+
*/
|
|
1363
|
+
parseList(e) {
|
|
1364
|
+
const t = () => this.parseValueLiteral(e);
|
|
1365
|
+
return this.node(this._lexer.token, {
|
|
1366
|
+
kind: d.LIST,
|
|
1367
|
+
values: this.any(a.BRACKET_L, t, a.BRACKET_R)
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
/**
|
|
1371
|
+
* ```
|
|
1372
|
+
* ObjectValue[Const] :
|
|
1373
|
+
* - { }
|
|
1374
|
+
* - { ObjectField[?Const]+ }
|
|
1375
|
+
* ```
|
|
1376
|
+
*/
|
|
1377
|
+
parseObject(e) {
|
|
1378
|
+
const t = () => this.parseObjectField(e);
|
|
1379
|
+
return this.node(this._lexer.token, {
|
|
1380
|
+
kind: d.OBJECT,
|
|
1381
|
+
fields: this.any(a.BRACE_L, t, a.BRACE_R)
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* ObjectField[Const] : Name : Value[?Const]
|
|
1386
|
+
*/
|
|
1387
|
+
parseObjectField(e) {
|
|
1388
|
+
const t = this._lexer.token, i = this.parseName();
|
|
1389
|
+
return this.expectToken(a.COLON), this.node(t, {
|
|
1390
|
+
kind: d.OBJECT_FIELD,
|
|
1391
|
+
name: i,
|
|
1392
|
+
value: this.parseValueLiteral(e)
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
// Implements the parsing rules in the Directives section.
|
|
1396
|
+
/**
|
|
1397
|
+
* Directives[Const] : Directive[?Const]+
|
|
1398
|
+
*/
|
|
1399
|
+
parseDirectives(e) {
|
|
1400
|
+
const t = [];
|
|
1401
|
+
for (; this.peek(a.AT); )
|
|
1402
|
+
t.push(this.parseDirective(e));
|
|
1403
|
+
return t;
|
|
1404
|
+
}
|
|
1405
|
+
parseConstDirectives() {
|
|
1406
|
+
return this.parseDirectives(!0);
|
|
1407
|
+
}
|
|
1408
|
+
/**
|
|
1409
|
+
* ```
|
|
1410
|
+
* Directive[Const] : @ Name Arguments[?Const]?
|
|
1411
|
+
* ```
|
|
1412
|
+
*/
|
|
1413
|
+
parseDirective(e) {
|
|
1414
|
+
const t = this._lexer.token;
|
|
1415
|
+
return this.expectToken(a.AT), this.node(t, {
|
|
1416
|
+
kind: d.DIRECTIVE,
|
|
1417
|
+
name: this.parseName(),
|
|
1418
|
+
arguments: this.parseArguments(e)
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
// Implements the parsing rules in the Types section.
|
|
1422
|
+
/**
|
|
1423
|
+
* Type :
|
|
1424
|
+
* - NamedType
|
|
1425
|
+
* - ListType
|
|
1426
|
+
* - NonNullType
|
|
1427
|
+
*/
|
|
1428
|
+
parseTypeReference() {
|
|
1429
|
+
const e = this._lexer.token;
|
|
1430
|
+
let t;
|
|
1431
|
+
if (this.expectOptionalToken(a.BRACKET_L)) {
|
|
1432
|
+
const i = this.parseTypeReference();
|
|
1433
|
+
this.expectToken(a.BRACKET_R), t = this.node(e, {
|
|
1434
|
+
kind: d.LIST_TYPE,
|
|
1435
|
+
type: i
|
|
1436
|
+
});
|
|
1437
|
+
} else
|
|
1438
|
+
t = this.parseNamedType();
|
|
1439
|
+
return this.expectOptionalToken(a.BANG) ? this.node(e, {
|
|
1440
|
+
kind: d.NON_NULL_TYPE,
|
|
1441
|
+
type: t
|
|
1442
|
+
}) : t;
|
|
1443
|
+
}
|
|
1444
|
+
/**
|
|
1445
|
+
* NamedType : Name
|
|
1446
|
+
*/
|
|
1447
|
+
parseNamedType() {
|
|
1448
|
+
return this.node(this._lexer.token, {
|
|
1449
|
+
kind: d.NAMED_TYPE,
|
|
1450
|
+
name: this.parseName()
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
// Implements the parsing rules in the Type Definition section.
|
|
1454
|
+
peekDescription() {
|
|
1455
|
+
return this.peek(a.STRING) || this.peek(a.BLOCK_STRING);
|
|
1456
|
+
}
|
|
1457
|
+
/**
|
|
1458
|
+
* Description : StringValue
|
|
1459
|
+
*/
|
|
1460
|
+
parseDescription() {
|
|
1461
|
+
if (this.peekDescription())
|
|
1462
|
+
return this.parseStringLiteral();
|
|
1463
|
+
}
|
|
1464
|
+
/**
|
|
1465
|
+
* ```
|
|
1466
|
+
* SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }
|
|
1467
|
+
* ```
|
|
1468
|
+
*/
|
|
1469
|
+
parseSchemaDefinition() {
|
|
1470
|
+
const e = this._lexer.token, t = this.parseDescription();
|
|
1471
|
+
this.expectKeyword("schema");
|
|
1472
|
+
const i = this.parseConstDirectives(), n = this.many(
|
|
1473
|
+
a.BRACE_L,
|
|
1474
|
+
this.parseOperationTypeDefinition,
|
|
1475
|
+
a.BRACE_R
|
|
1476
|
+
);
|
|
1477
|
+
return this.node(e, {
|
|
1478
|
+
kind: d.SCHEMA_DEFINITION,
|
|
1479
|
+
description: t,
|
|
1480
|
+
directives: i,
|
|
1481
|
+
operationTypes: n
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* OperationTypeDefinition : OperationType : NamedType
|
|
1486
|
+
*/
|
|
1487
|
+
parseOperationTypeDefinition() {
|
|
1488
|
+
const e = this._lexer.token, t = this.parseOperationType();
|
|
1489
|
+
this.expectToken(a.COLON);
|
|
1490
|
+
const i = this.parseNamedType();
|
|
1491
|
+
return this.node(e, {
|
|
1492
|
+
kind: d.OPERATION_TYPE_DEFINITION,
|
|
1493
|
+
operation: t,
|
|
1494
|
+
type: i
|
|
1495
|
+
});
|
|
1496
|
+
}
|
|
1497
|
+
/**
|
|
1498
|
+
* ScalarTypeDefinition : Description? scalar Name Directives[Const]?
|
|
1499
|
+
*/
|
|
1500
|
+
parseScalarTypeDefinition() {
|
|
1501
|
+
const e = this._lexer.token, t = this.parseDescription();
|
|
1502
|
+
this.expectKeyword("scalar");
|
|
1503
|
+
const i = this.parseName(), n = this.parseConstDirectives();
|
|
1504
|
+
return this.node(e, {
|
|
1505
|
+
kind: d.SCALAR_TYPE_DEFINITION,
|
|
1506
|
+
description: t,
|
|
1507
|
+
name: i,
|
|
1508
|
+
directives: n
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
/**
|
|
1512
|
+
* ObjectTypeDefinition :
|
|
1513
|
+
* Description?
|
|
1514
|
+
* type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?
|
|
1515
|
+
*/
|
|
1516
|
+
parseObjectTypeDefinition() {
|
|
1517
|
+
const e = this._lexer.token, t = this.parseDescription();
|
|
1518
|
+
this.expectKeyword("type");
|
|
1519
|
+
const i = this.parseName(), n = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1520
|
+
return this.node(e, {
|
|
1521
|
+
kind: d.OBJECT_TYPE_DEFINITION,
|
|
1522
|
+
description: t,
|
|
1523
|
+
name: i,
|
|
1524
|
+
interfaces: n,
|
|
1525
|
+
directives: s,
|
|
1526
|
+
fields: o
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
/**
|
|
1530
|
+
* ImplementsInterfaces :
|
|
1531
|
+
* - implements `&`? NamedType
|
|
1532
|
+
* - ImplementsInterfaces & NamedType
|
|
1533
|
+
*/
|
|
1534
|
+
parseImplementsInterfaces() {
|
|
1535
|
+
return this.expectOptionalKeyword("implements") ? this.delimitedMany(a.AMP, this.parseNamedType) : [];
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* ```
|
|
1539
|
+
* FieldsDefinition : { FieldDefinition+ }
|
|
1540
|
+
* ```
|
|
1541
|
+
*/
|
|
1542
|
+
parseFieldsDefinition() {
|
|
1543
|
+
return this.optionalMany(
|
|
1544
|
+
a.BRACE_L,
|
|
1545
|
+
this.parseFieldDefinition,
|
|
1546
|
+
a.BRACE_R
|
|
1547
|
+
);
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* FieldDefinition :
|
|
1551
|
+
* - Description? Name ArgumentsDefinition? : Type Directives[Const]?
|
|
1552
|
+
*/
|
|
1553
|
+
parseFieldDefinition() {
|
|
1554
|
+
const e = this._lexer.token, t = this.parseDescription(), i = this.parseName(), n = this.parseArgumentDefs();
|
|
1555
|
+
this.expectToken(a.COLON);
|
|
1556
|
+
const s = this.parseTypeReference(), o = this.parseConstDirectives();
|
|
1557
|
+
return this.node(e, {
|
|
1558
|
+
kind: d.FIELD_DEFINITION,
|
|
1559
|
+
description: t,
|
|
1560
|
+
name: i,
|
|
1561
|
+
arguments: n,
|
|
1562
|
+
type: s,
|
|
1563
|
+
directives: o
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
/**
|
|
1567
|
+
* ArgumentsDefinition : ( InputValueDefinition+ )
|
|
1568
|
+
*/
|
|
1569
|
+
parseArgumentDefs() {
|
|
1570
|
+
return this.optionalMany(
|
|
1571
|
+
a.PAREN_L,
|
|
1572
|
+
this.parseInputValueDef,
|
|
1573
|
+
a.PAREN_R
|
|
1574
|
+
);
|
|
1575
|
+
}
|
|
1576
|
+
/**
|
|
1577
|
+
* InputValueDefinition :
|
|
1578
|
+
* - Description? Name : Type DefaultValue? Directives[Const]?
|
|
1579
|
+
*/
|
|
1580
|
+
parseInputValueDef() {
|
|
1581
|
+
const e = this._lexer.token, t = this.parseDescription(), i = this.parseName();
|
|
1582
|
+
this.expectToken(a.COLON);
|
|
1583
|
+
const n = this.parseTypeReference();
|
|
1584
|
+
let s;
|
|
1585
|
+
this.expectOptionalToken(a.EQUALS) && (s = this.parseConstValueLiteral());
|
|
1586
|
+
const o = this.parseConstDirectives();
|
|
1587
|
+
return this.node(e, {
|
|
1588
|
+
kind: d.INPUT_VALUE_DEFINITION,
|
|
1589
|
+
description: t,
|
|
1590
|
+
name: i,
|
|
1591
|
+
type: n,
|
|
1592
|
+
defaultValue: s,
|
|
1593
|
+
directives: o
|
|
1594
|
+
});
|
|
1595
|
+
}
|
|
1596
|
+
/**
|
|
1597
|
+
* InterfaceTypeDefinition :
|
|
1598
|
+
* - Description? interface Name Directives[Const]? FieldsDefinition?
|
|
1599
|
+
*/
|
|
1600
|
+
parseInterfaceTypeDefinition() {
|
|
1601
|
+
const e = this._lexer.token, t = this.parseDescription();
|
|
1602
|
+
this.expectKeyword("interface");
|
|
1603
|
+
const i = this.parseName(), n = this.parseImplementsInterfaces(), s = this.parseConstDirectives(), o = this.parseFieldsDefinition();
|
|
1604
|
+
return this.node(e, {
|
|
1605
|
+
kind: d.INTERFACE_TYPE_DEFINITION,
|
|
1606
|
+
description: t,
|
|
1607
|
+
name: i,
|
|
1608
|
+
interfaces: n,
|
|
1609
|
+
directives: s,
|
|
1610
|
+
fields: o
|
|
1611
|
+
});
|
|
1612
|
+
}
|
|
1613
|
+
/**
|
|
1614
|
+
* UnionTypeDefinition :
|
|
1615
|
+
* - Description? union Name Directives[Const]? UnionMemberTypes?
|
|
1616
|
+
*/
|
|
1617
|
+
parseUnionTypeDefinition() {
|
|
1618
|
+
const e = this._lexer.token, t = this.parseDescription();
|
|
1619
|
+
this.expectKeyword("union");
|
|
1620
|
+
const i = this.parseName(), n = this.parseConstDirectives(), s = this.parseUnionMemberTypes();
|
|
1621
|
+
return this.node(e, {
|
|
1622
|
+
kind: d.UNION_TYPE_DEFINITION,
|
|
1623
|
+
description: t,
|
|
1624
|
+
name: i,
|
|
1625
|
+
directives: n,
|
|
1626
|
+
types: s
|
|
1627
|
+
});
|
|
1628
|
+
}
|
|
1629
|
+
/**
|
|
1630
|
+
* UnionMemberTypes :
|
|
1631
|
+
* - = `|`? NamedType
|
|
1632
|
+
* - UnionMemberTypes | NamedType
|
|
1633
|
+
*/
|
|
1634
|
+
parseUnionMemberTypes() {
|
|
1635
|
+
return this.expectOptionalToken(a.EQUALS) ? this.delimitedMany(a.PIPE, this.parseNamedType) : [];
|
|
1636
|
+
}
|
|
1637
|
+
/**
|
|
1638
|
+
* EnumTypeDefinition :
|
|
1639
|
+
* - Description? enum Name Directives[Const]? EnumValuesDefinition?
|
|
1640
|
+
*/
|
|
1641
|
+
parseEnumTypeDefinition() {
|
|
1642
|
+
const e = this._lexer.token, t = this.parseDescription();
|
|
1643
|
+
this.expectKeyword("enum");
|
|
1644
|
+
const i = this.parseName(), n = this.parseConstDirectives(), s = this.parseEnumValuesDefinition();
|
|
1645
|
+
return this.node(e, {
|
|
1646
|
+
kind: d.ENUM_TYPE_DEFINITION,
|
|
1647
|
+
description: t,
|
|
1648
|
+
name: i,
|
|
1649
|
+
directives: n,
|
|
1650
|
+
values: s
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1653
|
+
/**
|
|
1654
|
+
* ```
|
|
1655
|
+
* EnumValuesDefinition : { EnumValueDefinition+ }
|
|
1656
|
+
* ```
|
|
1657
|
+
*/
|
|
1658
|
+
parseEnumValuesDefinition() {
|
|
1659
|
+
return this.optionalMany(
|
|
1660
|
+
a.BRACE_L,
|
|
1661
|
+
this.parseEnumValueDefinition,
|
|
1662
|
+
a.BRACE_R
|
|
1663
|
+
);
|
|
1664
|
+
}
|
|
1665
|
+
/**
|
|
1666
|
+
* EnumValueDefinition : Description? EnumValue Directives[Const]?
|
|
1667
|
+
*/
|
|
1668
|
+
parseEnumValueDefinition() {
|
|
1669
|
+
const e = this._lexer.token, t = this.parseDescription(), i = this.parseEnumValueName(), n = this.parseConstDirectives();
|
|
1670
|
+
return this.node(e, {
|
|
1671
|
+
kind: d.ENUM_VALUE_DEFINITION,
|
|
1672
|
+
description: t,
|
|
1673
|
+
name: i,
|
|
1674
|
+
directives: n
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* EnumValue : Name but not `true`, `false` or `null`
|
|
1679
|
+
*/
|
|
1680
|
+
parseEnumValueName() {
|
|
1681
|
+
if (this._lexer.token.value === "true" || this._lexer.token.value === "false" || this._lexer.token.value === "null")
|
|
1682
|
+
throw g(
|
|
1683
|
+
this._lexer.source,
|
|
1684
|
+
this._lexer.token.start,
|
|
1685
|
+
`${_(
|
|
1686
|
+
this._lexer.token
|
|
1687
|
+
)} is reserved and cannot be used for an enum value.`
|
|
1688
|
+
);
|
|
1689
|
+
return this.parseName();
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* InputObjectTypeDefinition :
|
|
1693
|
+
* - Description? input Name Directives[Const]? InputFieldsDefinition?
|
|
1694
|
+
*/
|
|
1695
|
+
parseInputObjectTypeDefinition() {
|
|
1696
|
+
const e = this._lexer.token, t = this.parseDescription();
|
|
1697
|
+
this.expectKeyword("input");
|
|
1698
|
+
const i = this.parseName(), n = this.parseConstDirectives(), s = this.parseInputFieldsDefinition();
|
|
1699
|
+
return this.node(e, {
|
|
1700
|
+
kind: d.INPUT_OBJECT_TYPE_DEFINITION,
|
|
1701
|
+
description: t,
|
|
1702
|
+
name: i,
|
|
1703
|
+
directives: n,
|
|
1704
|
+
fields: s
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* ```
|
|
1709
|
+
* InputFieldsDefinition : { InputValueDefinition+ }
|
|
1710
|
+
* ```
|
|
1711
|
+
*/
|
|
1712
|
+
parseInputFieldsDefinition() {
|
|
1713
|
+
return this.optionalMany(
|
|
1714
|
+
a.BRACE_L,
|
|
1715
|
+
this.parseInputValueDef,
|
|
1716
|
+
a.BRACE_R
|
|
1717
|
+
);
|
|
1718
|
+
}
|
|
1719
|
+
/**
|
|
1720
|
+
* TypeSystemExtension :
|
|
1721
|
+
* - SchemaExtension
|
|
1722
|
+
* - TypeExtension
|
|
1723
|
+
*
|
|
1724
|
+
* TypeExtension :
|
|
1725
|
+
* - ScalarTypeExtension
|
|
1726
|
+
* - ObjectTypeExtension
|
|
1727
|
+
* - InterfaceTypeExtension
|
|
1728
|
+
* - UnionTypeExtension
|
|
1729
|
+
* - EnumTypeExtension
|
|
1730
|
+
* - InputObjectTypeDefinition
|
|
1731
|
+
*/
|
|
1732
|
+
parseTypeSystemExtension() {
|
|
1733
|
+
const e = this._lexer.lookahead();
|
|
1734
|
+
if (e.kind === a.NAME)
|
|
1735
|
+
switch (e.value) {
|
|
1736
|
+
case "schema":
|
|
1737
|
+
return this.parseSchemaExtension();
|
|
1738
|
+
case "scalar":
|
|
1739
|
+
return this.parseScalarTypeExtension();
|
|
1740
|
+
case "type":
|
|
1741
|
+
return this.parseObjectTypeExtension();
|
|
1742
|
+
case "interface":
|
|
1743
|
+
return this.parseInterfaceTypeExtension();
|
|
1744
|
+
case "union":
|
|
1745
|
+
return this.parseUnionTypeExtension();
|
|
1746
|
+
case "enum":
|
|
1747
|
+
return this.parseEnumTypeExtension();
|
|
1748
|
+
case "input":
|
|
1749
|
+
return this.parseInputObjectTypeExtension();
|
|
1750
|
+
}
|
|
1751
|
+
throw this.unexpected(e);
|
|
1752
|
+
}
|
|
1753
|
+
/**
|
|
1754
|
+
* ```
|
|
1755
|
+
* SchemaExtension :
|
|
1756
|
+
* - extend schema Directives[Const]? { OperationTypeDefinition+ }
|
|
1757
|
+
* - extend schema Directives[Const]
|
|
1758
|
+
* ```
|
|
1759
|
+
*/
|
|
1760
|
+
parseSchemaExtension() {
|
|
1761
|
+
const e = this._lexer.token;
|
|
1762
|
+
this.expectKeyword("extend"), this.expectKeyword("schema");
|
|
1763
|
+
const t = this.parseConstDirectives(), i = this.optionalMany(
|
|
1764
|
+
a.BRACE_L,
|
|
1765
|
+
this.parseOperationTypeDefinition,
|
|
1766
|
+
a.BRACE_R
|
|
1767
|
+
);
|
|
1768
|
+
if (t.length === 0 && i.length === 0)
|
|
1769
|
+
throw this.unexpected();
|
|
1770
|
+
return this.node(e, {
|
|
1771
|
+
kind: d.SCHEMA_EXTENSION,
|
|
1772
|
+
directives: t,
|
|
1773
|
+
operationTypes: i
|
|
1774
|
+
});
|
|
1775
|
+
}
|
|
1776
|
+
/**
|
|
1777
|
+
* ScalarTypeExtension :
|
|
1778
|
+
* - extend scalar Name Directives[Const]
|
|
1779
|
+
*/
|
|
1780
|
+
parseScalarTypeExtension() {
|
|
1781
|
+
const e = this._lexer.token;
|
|
1782
|
+
this.expectKeyword("extend"), this.expectKeyword("scalar");
|
|
1783
|
+
const t = this.parseName(), i = this.parseConstDirectives();
|
|
1784
|
+
if (i.length === 0)
|
|
1785
|
+
throw this.unexpected();
|
|
1786
|
+
return this.node(e, {
|
|
1787
|
+
kind: d.SCALAR_TYPE_EXTENSION,
|
|
1788
|
+
name: t,
|
|
1789
|
+
directives: i
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1792
|
+
/**
|
|
1793
|
+
* ObjectTypeExtension :
|
|
1794
|
+
* - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
|
|
1795
|
+
* - extend type Name ImplementsInterfaces? Directives[Const]
|
|
1796
|
+
* - extend type Name ImplementsInterfaces
|
|
1797
|
+
*/
|
|
1798
|
+
parseObjectTypeExtension() {
|
|
1799
|
+
const e = this._lexer.token;
|
|
1800
|
+
this.expectKeyword("extend"), this.expectKeyword("type");
|
|
1801
|
+
const t = this.parseName(), i = this.parseImplementsInterfaces(), n = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1802
|
+
if (i.length === 0 && n.length === 0 && s.length === 0)
|
|
1803
|
+
throw this.unexpected();
|
|
1804
|
+
return this.node(e, {
|
|
1805
|
+
kind: d.OBJECT_TYPE_EXTENSION,
|
|
1806
|
+
name: t,
|
|
1807
|
+
interfaces: i,
|
|
1808
|
+
directives: n,
|
|
1809
|
+
fields: s
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* InterfaceTypeExtension :
|
|
1814
|
+
* - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition
|
|
1815
|
+
* - extend interface Name ImplementsInterfaces? Directives[Const]
|
|
1816
|
+
* - extend interface Name ImplementsInterfaces
|
|
1817
|
+
*/
|
|
1818
|
+
parseInterfaceTypeExtension() {
|
|
1819
|
+
const e = this._lexer.token;
|
|
1820
|
+
this.expectKeyword("extend"), this.expectKeyword("interface");
|
|
1821
|
+
const t = this.parseName(), i = this.parseImplementsInterfaces(), n = this.parseConstDirectives(), s = this.parseFieldsDefinition();
|
|
1822
|
+
if (i.length === 0 && n.length === 0 && s.length === 0)
|
|
1823
|
+
throw this.unexpected();
|
|
1824
|
+
return this.node(e, {
|
|
1825
|
+
kind: d.INTERFACE_TYPE_EXTENSION,
|
|
1826
|
+
name: t,
|
|
1827
|
+
interfaces: i,
|
|
1828
|
+
directives: n,
|
|
1829
|
+
fields: s
|
|
1830
|
+
});
|
|
1831
|
+
}
|
|
1832
|
+
/**
|
|
1833
|
+
* UnionTypeExtension :
|
|
1834
|
+
* - extend union Name Directives[Const]? UnionMemberTypes
|
|
1835
|
+
* - extend union Name Directives[Const]
|
|
1836
|
+
*/
|
|
1837
|
+
parseUnionTypeExtension() {
|
|
1838
|
+
const e = this._lexer.token;
|
|
1839
|
+
this.expectKeyword("extend"), this.expectKeyword("union");
|
|
1840
|
+
const t = this.parseName(), i = this.parseConstDirectives(), n = this.parseUnionMemberTypes();
|
|
1841
|
+
if (i.length === 0 && n.length === 0)
|
|
1842
|
+
throw this.unexpected();
|
|
1843
|
+
return this.node(e, {
|
|
1844
|
+
kind: d.UNION_TYPE_EXTENSION,
|
|
1845
|
+
name: t,
|
|
1846
|
+
directives: i,
|
|
1847
|
+
types: n
|
|
1848
|
+
});
|
|
1849
|
+
}
|
|
1850
|
+
/**
|
|
1851
|
+
* EnumTypeExtension :
|
|
1852
|
+
* - extend enum Name Directives[Const]? EnumValuesDefinition
|
|
1853
|
+
* - extend enum Name Directives[Const]
|
|
1854
|
+
*/
|
|
1855
|
+
parseEnumTypeExtension() {
|
|
1856
|
+
const e = this._lexer.token;
|
|
1857
|
+
this.expectKeyword("extend"), this.expectKeyword("enum");
|
|
1858
|
+
const t = this.parseName(), i = this.parseConstDirectives(), n = this.parseEnumValuesDefinition();
|
|
1859
|
+
if (i.length === 0 && n.length === 0)
|
|
1860
|
+
throw this.unexpected();
|
|
1861
|
+
return this.node(e, {
|
|
1862
|
+
kind: d.ENUM_TYPE_EXTENSION,
|
|
1863
|
+
name: t,
|
|
1864
|
+
directives: i,
|
|
1865
|
+
values: n
|
|
1866
|
+
});
|
|
1867
|
+
}
|
|
1868
|
+
/**
|
|
1869
|
+
* InputObjectTypeExtension :
|
|
1870
|
+
* - extend input Name Directives[Const]? InputFieldsDefinition
|
|
1871
|
+
* - extend input Name Directives[Const]
|
|
1872
|
+
*/
|
|
1873
|
+
parseInputObjectTypeExtension() {
|
|
1874
|
+
const e = this._lexer.token;
|
|
1875
|
+
this.expectKeyword("extend"), this.expectKeyword("input");
|
|
1876
|
+
const t = this.parseName(), i = this.parseConstDirectives(), n = this.parseInputFieldsDefinition();
|
|
1877
|
+
if (i.length === 0 && n.length === 0)
|
|
1878
|
+
throw this.unexpected();
|
|
1879
|
+
return this.node(e, {
|
|
1880
|
+
kind: d.INPUT_OBJECT_TYPE_EXTENSION,
|
|
1881
|
+
name: t,
|
|
1882
|
+
directives: i,
|
|
1883
|
+
fields: n
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* ```
|
|
1888
|
+
* DirectiveDefinition :
|
|
1889
|
+
* - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations
|
|
1890
|
+
* ```
|
|
1891
|
+
*/
|
|
1892
|
+
parseDirectiveDefinition() {
|
|
1893
|
+
const e = this._lexer.token, t = this.parseDescription();
|
|
1894
|
+
this.expectKeyword("directive"), this.expectToken(a.AT);
|
|
1895
|
+
const i = this.parseName(), n = this.parseArgumentDefs(), s = this.expectOptionalKeyword("repeatable");
|
|
1896
|
+
this.expectKeyword("on");
|
|
1897
|
+
const o = this.parseDirectiveLocations();
|
|
1898
|
+
return this.node(e, {
|
|
1899
|
+
kind: d.DIRECTIVE_DEFINITION,
|
|
1900
|
+
description: t,
|
|
1901
|
+
name: i,
|
|
1902
|
+
arguments: n,
|
|
1903
|
+
repeatable: s,
|
|
1904
|
+
locations: o
|
|
1905
|
+
});
|
|
1906
|
+
}
|
|
1907
|
+
/**
|
|
1908
|
+
* DirectiveLocations :
|
|
1909
|
+
* - `|`? DirectiveLocation
|
|
1910
|
+
* - DirectiveLocations | DirectiveLocation
|
|
1911
|
+
*/
|
|
1912
|
+
parseDirectiveLocations() {
|
|
1913
|
+
return this.delimitedMany(a.PIPE, this.parseDirectiveLocation);
|
|
1914
|
+
}
|
|
1915
|
+
/*
|
|
1916
|
+
* DirectiveLocation :
|
|
1917
|
+
* - ExecutableDirectiveLocation
|
|
1918
|
+
* - TypeSystemDirectiveLocation
|
|
1919
|
+
*
|
|
1920
|
+
* ExecutableDirectiveLocation : one of
|
|
1921
|
+
* `QUERY`
|
|
1922
|
+
* `MUTATION`
|
|
1923
|
+
* `SUBSCRIPTION`
|
|
1924
|
+
* `FIELD`
|
|
1925
|
+
* `FRAGMENT_DEFINITION`
|
|
1926
|
+
* `FRAGMENT_SPREAD`
|
|
1927
|
+
* `INLINE_FRAGMENT`
|
|
1928
|
+
*
|
|
1929
|
+
* TypeSystemDirectiveLocation : one of
|
|
1930
|
+
* `SCHEMA`
|
|
1931
|
+
* `SCALAR`
|
|
1932
|
+
* `OBJECT`
|
|
1933
|
+
* `FIELD_DEFINITION`
|
|
1934
|
+
* `ARGUMENT_DEFINITION`
|
|
1935
|
+
* `INTERFACE`
|
|
1936
|
+
* `UNION`
|
|
1937
|
+
* `ENUM`
|
|
1938
|
+
* `ENUM_VALUE`
|
|
1939
|
+
* `INPUT_OBJECT`
|
|
1940
|
+
* `INPUT_FIELD_DEFINITION`
|
|
1941
|
+
*/
|
|
1942
|
+
parseDirectiveLocation() {
|
|
1943
|
+
const e = this._lexer.token, t = this.parseName();
|
|
1944
|
+
if (Object.prototype.hasOwnProperty.call(q, t.value))
|
|
1945
|
+
return t;
|
|
1946
|
+
throw this.unexpected(e);
|
|
1947
|
+
}
|
|
1948
|
+
// Schema Coordinates
|
|
1949
|
+
/**
|
|
1950
|
+
* SchemaCoordinate :
|
|
1951
|
+
* - Name
|
|
1952
|
+
* - Name . Name
|
|
1953
|
+
* - Name . Name ( Name : )
|
|
1954
|
+
* - \@ Name
|
|
1955
|
+
* - \@ Name ( Name : )
|
|
1956
|
+
*/
|
|
1957
|
+
parseSchemaCoordinate() {
|
|
1958
|
+
const e = this._lexer.token, t = this.expectOptionalToken(a.AT), i = this.parseName();
|
|
1959
|
+
let n;
|
|
1960
|
+
!t && this.expectOptionalToken(a.DOT) && (n = this.parseName());
|
|
1961
|
+
let s;
|
|
1962
|
+
return (t || n) && this.expectOptionalToken(a.PAREN_L) && (s = this.parseName(), this.expectToken(a.COLON), this.expectToken(a.PAREN_R)), t ? s ? this.node(e, {
|
|
1963
|
+
kind: d.DIRECTIVE_ARGUMENT_COORDINATE,
|
|
1964
|
+
name: i,
|
|
1965
|
+
argumentName: s
|
|
1966
|
+
}) : this.node(e, {
|
|
1967
|
+
kind: d.DIRECTIVE_COORDINATE,
|
|
1968
|
+
name: i
|
|
1969
|
+
}) : n ? s ? this.node(e, {
|
|
1970
|
+
kind: d.ARGUMENT_COORDINATE,
|
|
1971
|
+
name: i,
|
|
1972
|
+
fieldName: n,
|
|
1973
|
+
argumentName: s
|
|
1974
|
+
}) : this.node(e, {
|
|
1975
|
+
kind: d.MEMBER_COORDINATE,
|
|
1976
|
+
name: i,
|
|
1977
|
+
memberName: n
|
|
1978
|
+
}) : this.node(e, {
|
|
1979
|
+
kind: d.TYPE_COORDINATE,
|
|
1980
|
+
name: i
|
|
1981
|
+
});
|
|
1982
|
+
}
|
|
1983
|
+
// Core parsing utility functions
|
|
1984
|
+
/**
|
|
1985
|
+
* Returns a node that, if configured to do so, sets a "loc" field as a
|
|
1986
|
+
* location object, used to identify the place in the source that created a
|
|
1987
|
+
* given parsed object.
|
|
1988
|
+
*/
|
|
1989
|
+
node(e, t) {
|
|
1990
|
+
return this._options.noLocation !== !0 && (t.loc = new $e(
|
|
1991
|
+
e,
|
|
1992
|
+
this._lexer.lastToken,
|
|
1993
|
+
this._lexer.source
|
|
1994
|
+
)), t;
|
|
1995
|
+
}
|
|
1996
|
+
/**
|
|
1997
|
+
* Determines if the next token is of a given kind
|
|
1998
|
+
*/
|
|
1999
|
+
peek(e) {
|
|
2000
|
+
return this._lexer.token.kind === e;
|
|
2001
|
+
}
|
|
2002
|
+
/**
|
|
2003
|
+
* If the next token is of the given kind, return that token after advancing the lexer.
|
|
2004
|
+
* Otherwise, do not change the parser state and throw an error.
|
|
2005
|
+
*/
|
|
2006
|
+
expectToken(e) {
|
|
2007
|
+
const t = this._lexer.token;
|
|
2008
|
+
if (t.kind === e)
|
|
2009
|
+
return this.advanceLexer(), t;
|
|
2010
|
+
throw g(
|
|
2011
|
+
this._lexer.source,
|
|
2012
|
+
t.start,
|
|
2013
|
+
`Expected ${he(e)}, found ${_(t)}.`
|
|
2014
|
+
);
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2017
|
+
* If the next token is of the given kind, return "true" after advancing the lexer.
|
|
2018
|
+
* Otherwise, do not change the parser state and return "false".
|
|
2019
|
+
*/
|
|
2020
|
+
expectOptionalToken(e) {
|
|
2021
|
+
return this._lexer.token.kind === e ? (this.advanceLexer(), !0) : !1;
|
|
2022
|
+
}
|
|
2023
|
+
/**
|
|
2024
|
+
* If the next token is a given keyword, advance the lexer.
|
|
2025
|
+
* Otherwise, do not change the parser state and throw an error.
|
|
2026
|
+
*/
|
|
2027
|
+
expectKeyword(e) {
|
|
2028
|
+
const t = this._lexer.token;
|
|
2029
|
+
if (t.kind === a.NAME && t.value === e)
|
|
2030
|
+
this.advanceLexer();
|
|
2031
|
+
else
|
|
2032
|
+
throw g(
|
|
2033
|
+
this._lexer.source,
|
|
2034
|
+
t.start,
|
|
2035
|
+
`Expected "${e}", found ${_(t)}.`
|
|
2036
|
+
);
|
|
2037
|
+
}
|
|
2038
|
+
/**
|
|
2039
|
+
* If the next token is a given keyword, return "true" after advancing the lexer.
|
|
2040
|
+
* Otherwise, do not change the parser state and return "false".
|
|
2041
|
+
*/
|
|
2042
|
+
expectOptionalKeyword(e) {
|
|
2043
|
+
const t = this._lexer.token;
|
|
2044
|
+
return t.kind === a.NAME && t.value === e ? (this.advanceLexer(), !0) : !1;
|
|
2045
|
+
}
|
|
2046
|
+
/**
|
|
2047
|
+
* Helper function for creating an error when an unexpected lexed token is encountered.
|
|
2048
|
+
*/
|
|
2049
|
+
unexpected(e) {
|
|
2050
|
+
const t = e ?? this._lexer.token;
|
|
2051
|
+
return g(
|
|
2052
|
+
this._lexer.source,
|
|
2053
|
+
t.start,
|
|
2054
|
+
`Unexpected ${_(t)}.`
|
|
2055
|
+
);
|
|
2056
|
+
}
|
|
2057
|
+
/**
|
|
2058
|
+
* Returns a possibly empty list of parse nodes, determined by the parseFn.
|
|
2059
|
+
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2060
|
+
* Advances the parser to the next lex token after the closing token.
|
|
2061
|
+
*/
|
|
2062
|
+
any(e, t, i) {
|
|
2063
|
+
this.expectToken(e);
|
|
2064
|
+
const n = [];
|
|
2065
|
+
for (; !this.expectOptionalToken(i); )
|
|
2066
|
+
n.push(t.call(this));
|
|
2067
|
+
return n;
|
|
2068
|
+
}
|
|
2069
|
+
/**
|
|
2070
|
+
* Returns a list of parse nodes, determined by the parseFn.
|
|
2071
|
+
* It can be empty only if open token is missing otherwise it will always return non-empty list
|
|
2072
|
+
* that begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2073
|
+
* Advances the parser to the next lex token after the closing token.
|
|
2074
|
+
*/
|
|
2075
|
+
optionalMany(e, t, i) {
|
|
2076
|
+
if (this.expectOptionalToken(e)) {
|
|
2077
|
+
const n = [];
|
|
2078
|
+
do
|
|
2079
|
+
n.push(t.call(this));
|
|
2080
|
+
while (!this.expectOptionalToken(i));
|
|
2081
|
+
return n;
|
|
2082
|
+
}
|
|
2083
|
+
return [];
|
|
2084
|
+
}
|
|
2085
|
+
/**
|
|
2086
|
+
* Returns a non-empty list of parse nodes, determined by the parseFn.
|
|
2087
|
+
* This list begins with a lex token of openKind and ends with a lex token of closeKind.
|
|
2088
|
+
* Advances the parser to the next lex token after the closing token.
|
|
2089
|
+
*/
|
|
2090
|
+
many(e, t, i) {
|
|
2091
|
+
this.expectToken(e);
|
|
2092
|
+
const n = [];
|
|
2093
|
+
do
|
|
2094
|
+
n.push(t.call(this));
|
|
2095
|
+
while (!this.expectOptionalToken(i));
|
|
2096
|
+
return n;
|
|
2097
|
+
}
|
|
2098
|
+
/**
|
|
2099
|
+
* Returns a non-empty list of parse nodes, determined by the parseFn.
|
|
2100
|
+
* This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.
|
|
2101
|
+
* Advances the parser to the next lex token after last item in the list.
|
|
2102
|
+
*/
|
|
2103
|
+
delimitedMany(e, t) {
|
|
2104
|
+
this.expectOptionalToken(e);
|
|
2105
|
+
const i = [];
|
|
2106
|
+
do
|
|
2107
|
+
i.push(t.call(this));
|
|
2108
|
+
while (this.expectOptionalToken(e));
|
|
2109
|
+
return i;
|
|
2110
|
+
}
|
|
2111
|
+
advanceLexer() {
|
|
2112
|
+
const { maxTokens: e } = this._options, t = this._lexer.advance();
|
|
2113
|
+
if (t.kind !== a.EOF && (++this._tokenCounter, e !== void 0 && this._tokenCounter > e))
|
|
2114
|
+
throw g(
|
|
2115
|
+
this._lexer.source,
|
|
2116
|
+
t.start,
|
|
2117
|
+
`Document contains more that ${e} tokens. Parsing aborted.`
|
|
2118
|
+
);
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
function _(r) {
|
|
2122
|
+
const e = r.value;
|
|
2123
|
+
return he(r.kind) + (e != null ? ` "${e}"` : "");
|
|
2124
|
+
}
|
|
2125
|
+
function he(r) {
|
|
2126
|
+
return je(r) ? `"${r}"` : r;
|
|
2127
|
+
}
|
|
2128
|
+
var R = /* @__PURE__ */ new Map(), G = /* @__PURE__ */ new Map(), me = !0, w = !1;
|
|
2129
|
+
function ge(r) {
|
|
2130
|
+
return r.replace(/[\s,]+/g, " ").trim();
|
|
2131
|
+
}
|
|
2132
|
+
function pt(r) {
|
|
2133
|
+
return ge(r.source.body.substring(r.start, r.end));
|
|
2134
|
+
}
|
|
2135
|
+
function ht(r) {
|
|
2136
|
+
var e = /* @__PURE__ */ new Set(), t = [];
|
|
2137
|
+
return r.definitions.forEach(function(i) {
|
|
2138
|
+
if (i.kind === "FragmentDefinition") {
|
|
2139
|
+
var n = i.name.value, s = pt(i.loc), o = G.get(n);
|
|
2140
|
+
o && !o.has(s) ? me && console.warn("Warning: fragment with name " + n + ` already exists.
|
|
2141
|
+
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
2142
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`) : o || G.set(n, o = /* @__PURE__ */ new Set()), o.add(s), e.has(s) || (e.add(s), t.push(i));
|
|
2143
|
+
} else
|
|
2144
|
+
t.push(i);
|
|
2145
|
+
}), F(F({}, r), { definitions: t });
|
|
2146
|
+
}
|
|
2147
|
+
function mt(r) {
|
|
2148
|
+
var e = new Set(r.definitions);
|
|
2149
|
+
e.forEach(function(i) {
|
|
2150
|
+
i.loc && delete i.loc, Object.keys(i).forEach(function(n) {
|
|
2151
|
+
var s = i[n];
|
|
2152
|
+
s && typeof s == "object" && e.add(s);
|
|
2153
|
+
});
|
|
2154
|
+
});
|
|
2155
|
+
var t = r.loc;
|
|
2156
|
+
return t && (delete t.startToken, delete t.endToken), r;
|
|
2157
|
+
}
|
|
2158
|
+
function gt(r) {
|
|
2159
|
+
var e = ge(r);
|
|
2160
|
+
if (!R.has(e)) {
|
|
2161
|
+
var t = ut(r, {
|
|
2162
|
+
experimentalFragmentVariables: w,
|
|
2163
|
+
allowLegacyFragmentVariables: w
|
|
2164
|
+
});
|
|
2165
|
+
if (!t || t.kind !== "Document")
|
|
2166
|
+
throw new Error("Not a valid GraphQL document.");
|
|
2167
|
+
R.set(e, mt(ht(t)));
|
|
2168
|
+
}
|
|
2169
|
+
return R.get(e);
|
|
2170
|
+
}
|
|
2171
|
+
function p(r) {
|
|
2172
|
+
for (var e = [], t = 1; t < arguments.length; t++)
|
|
2173
|
+
e[t - 1] = arguments[t];
|
|
2174
|
+
typeof r == "string" && (r = [r]);
|
|
2175
|
+
var i = r[0];
|
|
2176
|
+
return e.forEach(function(n, s) {
|
|
2177
|
+
n && n.kind === "Document" ? i += n.loc.source.body : i += n, i += r[s + 1];
|
|
2178
|
+
}), gt(i);
|
|
2179
|
+
}
|
|
2180
|
+
function ft() {
|
|
2181
|
+
R.clear(), G.clear();
|
|
2182
|
+
}
|
|
2183
|
+
function It() {
|
|
2184
|
+
me = !1;
|
|
2185
|
+
}
|
|
2186
|
+
function Et() {
|
|
2187
|
+
w = !0;
|
|
2188
|
+
}
|
|
2189
|
+
function yt() {
|
|
2190
|
+
w = !1;
|
|
2191
|
+
}
|
|
2192
|
+
var b = {
|
|
2193
|
+
gql: p,
|
|
2194
|
+
resetCaches: ft,
|
|
2195
|
+
disableFragmentWarnings: It,
|
|
2196
|
+
enableExperimentalFragmentVariables: Et,
|
|
2197
|
+
disableExperimentalFragmentVariables: yt
|
|
2198
|
+
};
|
|
2199
|
+
(function(r) {
|
|
2200
|
+
r.gql = b.gql, r.resetCaches = b.resetCaches, r.disableFragmentWarnings = b.disableFragmentWarnings, r.enableExperimentalFragmentVariables = b.enableExperimentalFragmentVariables, r.disableExperimentalFragmentVariables = b.disableExperimentalFragmentVariables;
|
|
2201
|
+
})(p || (p = {}));
|
|
2202
|
+
p.default = p;
|
|
2203
|
+
const At = p`
|
|
2204
|
+
query EventOverviewPage($organizationId: ID!, $hostingIds: [String!], $trackerId: String, $filterEventStatuses: [EventStatus!], $dateRange: DateRangeInput, $page: PageInput, $sorts: [SortInput!]) {
|
|
2205
|
+
findAllPublicEventByOrganizationId(
|
|
2206
|
+
id: $organizationId
|
|
2207
|
+
hostingIds: $hostingIds
|
|
2208
|
+
trackerLinkId: $trackerId
|
|
2209
|
+
filterEventStatuses: $filterEventStatuses
|
|
2210
|
+
date: $dateRange
|
|
2211
|
+
page: $page
|
|
2212
|
+
sorts: $sorts
|
|
2213
|
+
) {
|
|
2214
|
+
data {
|
|
2215
|
+
id
|
|
2216
|
+
name
|
|
2217
|
+
icon
|
|
2218
|
+
banner
|
|
2219
|
+
description
|
|
2220
|
+
addonDescription
|
|
2221
|
+
startSalesAt
|
|
2222
|
+
endSalesAt
|
|
2223
|
+
startAt
|
|
2224
|
+
endAt
|
|
2225
|
+
timezone
|
|
2226
|
+
slug
|
|
2227
|
+
status
|
|
2228
|
+
location {
|
|
2229
|
+
id
|
|
2230
|
+
name
|
|
2231
|
+
address
|
|
2232
|
+
}
|
|
2233
|
+
infoDescription
|
|
2234
|
+
}
|
|
2235
|
+
count
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
`, Ot = p`
|
|
2239
|
+
query EventDetailPage($eventId: ID!) {
|
|
2240
|
+
findPublicEventById(id: $eventId) {
|
|
2241
|
+
id
|
|
2242
|
+
name
|
|
2243
|
+
icon
|
|
2244
|
+
banner
|
|
2245
|
+
description
|
|
2246
|
+
addonDescription
|
|
2247
|
+
startAt
|
|
2248
|
+
endAt
|
|
2249
|
+
startSalesAt
|
|
2250
|
+
endSalesAt
|
|
2251
|
+
facebookPixelId
|
|
2252
|
+
timezone
|
|
2253
|
+
slug
|
|
2254
|
+
status
|
|
2255
|
+
location {
|
|
2256
|
+
id
|
|
2257
|
+
name
|
|
2258
|
+
address
|
|
2259
|
+
}
|
|
2260
|
+
infoDescription
|
|
2261
|
+
maxAmountOfTicketsPerOrder
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
`, Tt = p`
|
|
2265
|
+
query findProductsByEventId($eventId: ID!, $promoCode: String, $trackerId: String, $productTypes: [ProductType!]) {
|
|
2266
|
+
findPublicProductsByEventId(
|
|
2267
|
+
eventId: $eventId
|
|
2268
|
+
promoCode: $promoCode
|
|
2269
|
+
trackerLinkId: $trackerId
|
|
2270
|
+
filterProductTypes: $productTypes
|
|
2271
|
+
) {
|
|
2272
|
+
id
|
|
2273
|
+
icon
|
|
2274
|
+
name
|
|
2275
|
+
description
|
|
2276
|
+
currency
|
|
2277
|
+
price
|
|
2278
|
+
depositPrice
|
|
2279
|
+
discountPrice
|
|
2280
|
+
serviceFee
|
|
2281
|
+
type
|
|
2282
|
+
startSalesAt
|
|
2283
|
+
endSalesAt
|
|
2284
|
+
category {
|
|
2285
|
+
id
|
|
2286
|
+
name
|
|
2287
|
+
description
|
|
2288
|
+
order
|
|
2289
|
+
}
|
|
2290
|
+
status
|
|
2291
|
+
maxAmountOfAddons
|
|
2292
|
+
minAmountOfAddons
|
|
2293
|
+
seatsCategory
|
|
2294
|
+
maxAmountPerOrder
|
|
2295
|
+
showEndSalesAtTag
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
`, kt = (r, e, t, i) => r();
|
|
2299
|
+
function vt(r, e = kt) {
|
|
2300
|
+
return {
|
|
2301
|
+
EventOverviewPage(t, i, n) {
|
|
2302
|
+
return e((s) => r.request({ document: At, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "EventOverviewPage", "query", t);
|
|
2303
|
+
},
|
|
2304
|
+
EventDetailPage(t, i, n) {
|
|
2305
|
+
return e((s) => r.request({ document: Ot, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "EventDetailPage", "query", t);
|
|
2306
|
+
},
|
|
2307
|
+
findProductsByEventId(t, i, n) {
|
|
2308
|
+
return e((s) => r.request({ document: Tt, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "findProductsByEventId", "query", t);
|
|
2309
|
+
}
|
|
2310
|
+
};
|
|
2311
|
+
}
|
|
2312
|
+
class fe {
|
|
2313
|
+
config;
|
|
2314
|
+
sdk;
|
|
2315
|
+
constructor(e) {
|
|
2316
|
+
this.config = e, this.sdk = vt(new C(e.apiUrl));
|
|
2317
|
+
}
|
|
2318
|
+
async fetchEvents(e = {}) {
|
|
2319
|
+
try {
|
|
2320
|
+
e.page && (e.page = {
|
|
2321
|
+
index: e.page.index ?? 0,
|
|
2322
|
+
size: e.page.size ?? 20
|
|
2323
|
+
}), this.debugLog("Fetching events with parameters", {
|
|
2324
|
+
organizationId: this.config.organizationId,
|
|
2325
|
+
hostingIds: e.hostingIds,
|
|
2326
|
+
filterEventStatuses: e.statuses,
|
|
2327
|
+
dateRange: e.dateRange,
|
|
2328
|
+
page: e.page,
|
|
2329
|
+
sorts: e.sorts,
|
|
2330
|
+
trackerId: this.config.trackerId
|
|
2331
|
+
});
|
|
2332
|
+
const t = await this.sdk.EventOverviewPage({
|
|
2333
|
+
organizationId: this.config.organizationId,
|
|
2334
|
+
hostingIds: e.hostingIds,
|
|
2335
|
+
filterEventStatuses: e.statuses,
|
|
2336
|
+
dateRange: e.dateRange && e.dateRange.from && e.dateRange.till ? {
|
|
2337
|
+
from: e.dateRange.from.toISO(),
|
|
2338
|
+
till: e.dateRange.till.toISO()
|
|
2339
|
+
} : void 0,
|
|
2340
|
+
page: e.page,
|
|
2341
|
+
sorts: e.sorts,
|
|
2342
|
+
trackerId: this.config.trackerId
|
|
2343
|
+
});
|
|
2344
|
+
if (this.debugLog("Raw GraphQL response", t), t?.findAllPublicEventByOrganizationId?.data) {
|
|
2345
|
+
const i = t.findAllPublicEventByOrganizationId.data.map((n) => ({
|
|
2346
|
+
id: n.id,
|
|
2347
|
+
name: n.name,
|
|
2348
|
+
icon: n.icon,
|
|
2349
|
+
banner: n.banner,
|
|
2350
|
+
description: n.description,
|
|
2351
|
+
addonDescription: n.addonDescription,
|
|
2352
|
+
startAt: y.fromISO(n.startAt, { zone: n.timezone }),
|
|
2353
|
+
endAt: y.fromISO(n.endAt, { zone: n.timezone }),
|
|
2354
|
+
timezone: n.timezone,
|
|
2355
|
+
startSalesAt: null,
|
|
2356
|
+
endSalesAt: null,
|
|
2357
|
+
slug: n.slug ?? "ERROR",
|
|
2358
|
+
facebookPixelId: null,
|
|
2359
|
+
status: n.status,
|
|
2360
|
+
location: n.location ? {
|
|
2361
|
+
id: n.location.id,
|
|
2362
|
+
name: n.location.name,
|
|
2363
|
+
address: n.location.address
|
|
2364
|
+
} : void 0,
|
|
2365
|
+
infoDescription: n.infoDescription
|
|
2366
|
+
}));
|
|
2367
|
+
return this.debugLog("Processed events", { events: i, count: i.length }), [i, t.findAllPublicEventByOrganizationId.count ?? 0];
|
|
2368
|
+
} else
|
|
2369
|
+
return this.debugLog("No events found in response"), [[], 0];
|
|
2370
|
+
} catch (t) {
|
|
2371
|
+
throw this.debugLog("Error fetching events", t), t;
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
async fetchEvent(e) {
|
|
2375
|
+
try {
|
|
2376
|
+
this.debugLog("Fetching single event", { eventId: e });
|
|
2377
|
+
const t = await this.sdk.EventDetailPage({ eventId: e });
|
|
2378
|
+
if (this.debugLog("Raw GraphQL response", t), t?.findPublicEventById) {
|
|
2379
|
+
const i = t.findPublicEventById, n = {
|
|
2380
|
+
id: i.id,
|
|
2381
|
+
name: i.name,
|
|
2382
|
+
icon: i.icon,
|
|
2383
|
+
banner: i.banner,
|
|
2384
|
+
description: i.description,
|
|
2385
|
+
addonDescription: i.addonDescription,
|
|
2386
|
+
startAt: y.fromISO(i.startAt, { zone: i.timezone }),
|
|
2387
|
+
endAt: y.fromISO(i.endAt, { zone: i.timezone }),
|
|
2388
|
+
timezone: i.timezone,
|
|
2389
|
+
startSalesAt: i.startSalesAt,
|
|
2390
|
+
endSalesAt: i.endSalesAt,
|
|
2391
|
+
slug: i.slug ?? "ERROR",
|
|
2392
|
+
facebookPixelId: i.facebookPixelId,
|
|
2393
|
+
status: i.status,
|
|
2394
|
+
location: i.location ? {
|
|
2395
|
+
id: i.location.id,
|
|
2396
|
+
name: i.location.name,
|
|
2397
|
+
address: i.location.address
|
|
2398
|
+
} : void 0,
|
|
2399
|
+
infoDescription: i.infoDescription
|
|
2400
|
+
};
|
|
2401
|
+
return this.debugLog("Processed single event", n), n;
|
|
2402
|
+
} else {
|
|
2403
|
+
this.debugLog("No event found for id", e);
|
|
2404
|
+
return;
|
|
2405
|
+
}
|
|
2406
|
+
} catch (t) {
|
|
2407
|
+
throw this.debugLog("Error fetching single event", t), t;
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
async fetchProducts(e, t, i) {
|
|
2411
|
+
try {
|
|
2412
|
+
this.debugLog("Fetching products for event", {
|
|
2413
|
+
eventId: e,
|
|
2414
|
+
promoCode: i,
|
|
2415
|
+
trackerId: this.config.trackerId,
|
|
2416
|
+
productTypes: t
|
|
2417
|
+
});
|
|
2418
|
+
const n = await this.sdk.findProductsByEventId({
|
|
2419
|
+
eventId: e,
|
|
2420
|
+
promoCode: i,
|
|
2421
|
+
trackerId: this.config.trackerId,
|
|
2422
|
+
productTypes: t
|
|
2423
|
+
});
|
|
2424
|
+
if (n?.findPublicProductsByEventId) {
|
|
2425
|
+
const s = n.findPublicProductsByEventId.map((o) => ({
|
|
2426
|
+
id: o.id,
|
|
2427
|
+
name: o.name,
|
|
2428
|
+
category: o.category ? {
|
|
2429
|
+
id: o.category.id,
|
|
2430
|
+
name: o.category.name,
|
|
2431
|
+
description: o.category.description
|
|
2432
|
+
} : void 0,
|
|
2433
|
+
currency: o.currency,
|
|
2434
|
+
depositPrice: o.depositPrice,
|
|
2435
|
+
description: o.description,
|
|
2436
|
+
discountPrice: o.discountPrice,
|
|
2437
|
+
startSalesAt: o.startSalesAt,
|
|
2438
|
+
endSalesAt: o.endSalesAt,
|
|
2439
|
+
icon: o.icon,
|
|
2440
|
+
maxAmountOfAddons: o.maxAmountOfAddons,
|
|
2441
|
+
minAmountOfAddons: o.minAmountOfAddons,
|
|
2442
|
+
maxAmountPerOrder: o.maxAmountPerOrder,
|
|
2443
|
+
price: o.price,
|
|
2444
|
+
serviceFee: o.serviceFee,
|
|
2445
|
+
showEndSalesAtTag: o.showEndSalesAtTag,
|
|
2446
|
+
status: o.status,
|
|
2447
|
+
type: o.type
|
|
2448
|
+
}));
|
|
2449
|
+
return this.debugLog("Products fetched", {
|
|
2450
|
+
eventId: e,
|
|
2451
|
+
count: s.length,
|
|
2452
|
+
types: s.map((o) => o.type)
|
|
2453
|
+
}), s;
|
|
2454
|
+
}
|
|
2455
|
+
return;
|
|
2456
|
+
} catch (n) {
|
|
2457
|
+
throw this.debugLog("Error fetching products", { eventId: e, error: n }), n;
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
debugLog(e, t) {
|
|
2461
|
+
this.config.debug && console.log(`[EventService:${this.config.organizationId}] ${e}`, t || "");
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
const Nt = p`
|
|
2465
|
+
query findPaymentMethods($orderId: ID!, $orderItemId: String, $amountOfTickets: Int, $paymentMethodId: String) {
|
|
2466
|
+
findPaymentDetails(
|
|
2467
|
+
orderId: $orderId
|
|
2468
|
+
orderItemId: $orderItemId
|
|
2469
|
+
amountOfTickets: $amountOfTickets
|
|
2470
|
+
paymentMethodId: $paymentMethodId
|
|
2471
|
+
) {
|
|
2472
|
+
methods {
|
|
2473
|
+
id
|
|
2474
|
+
name
|
|
2475
|
+
fee {
|
|
2476
|
+
type
|
|
2477
|
+
value
|
|
2478
|
+
}
|
|
2479
|
+
issuers {
|
|
2480
|
+
id
|
|
2481
|
+
name
|
|
2482
|
+
image
|
|
2483
|
+
}
|
|
2484
|
+
image
|
|
2485
|
+
}
|
|
2486
|
+
transactionFee
|
|
2487
|
+
transactionPrice
|
|
2488
|
+
transactionDiscount
|
|
2489
|
+
paymentSpesificTransactionFee
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
`, xt = p`
|
|
2493
|
+
mutation createDigitalPayment($input: CreateDigitalOrderPaymentInput!) {
|
|
2494
|
+
createDigitalOrderPayment(input: $input)
|
|
2495
|
+
}
|
|
2496
|
+
`, Dt = (r, e, t, i) => r();
|
|
2497
|
+
function bt(r, e = Dt) {
|
|
2498
|
+
return {
|
|
2499
|
+
findPaymentMethods(t, i, n) {
|
|
2500
|
+
return e((s) => r.request({ document: Nt, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "findPaymentMethods", "query", t);
|
|
2501
|
+
},
|
|
2502
|
+
createDigitalPayment(t, i, n) {
|
|
2503
|
+
return e((s) => r.request({ document: xt, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "createDigitalPayment", "mutation", t);
|
|
2504
|
+
}
|
|
2505
|
+
};
|
|
2506
|
+
}
|
|
2507
|
+
class Ie {
|
|
2508
|
+
config;
|
|
2509
|
+
sdk;
|
|
2510
|
+
constructor(e) {
|
|
2511
|
+
this.config = e, this.sdk = bt(new C(e.apiUrl));
|
|
2512
|
+
}
|
|
2513
|
+
async getPaymentDetails(e) {
|
|
2514
|
+
this.debugLog("Fetching payment methods", e);
|
|
2515
|
+
try {
|
|
2516
|
+
const t = await this.sdk.findPaymentMethods({
|
|
2517
|
+
orderId: e.orderId,
|
|
2518
|
+
orderItemId: e.orderItemId,
|
|
2519
|
+
amountOfTickets: e.amountOfTickets,
|
|
2520
|
+
paymentMethodId: e.paymentMethodId
|
|
2521
|
+
});
|
|
2522
|
+
if (!t?.findPaymentDetails)
|
|
2523
|
+
throw this.debugLog("No payment details found"), new Error("No payment details found for this order");
|
|
2524
|
+
const i = t.findPaymentDetails;
|
|
2525
|
+
return this.debugLog("Payment methods fetched successfully", {
|
|
2526
|
+
methodCount: i.methods?.length ?? 0,
|
|
2527
|
+
transactionPrice: i.transactionPrice,
|
|
2528
|
+
transactionDiscount: i.transactionDiscount,
|
|
2529
|
+
transactionFee: i.transactionFee,
|
|
2530
|
+
paymentSpesificTransactionFee: i.paymentSpesificTransactionFee
|
|
2531
|
+
}), {
|
|
2532
|
+
transactionPrice: i.transactionPrice,
|
|
2533
|
+
transactionDiscount: i.transactionPrice,
|
|
2534
|
+
transactionFee: i.transactionFee ?? null,
|
|
2535
|
+
paymentSpesificTransactionFee: i.paymentSpesificTransactionFee ?? null,
|
|
2536
|
+
methods: i.methods?.map((n) => ({
|
|
2537
|
+
id: n.id,
|
|
2538
|
+
name: n.name,
|
|
2539
|
+
image: n.image,
|
|
2540
|
+
fee: n.fee ? {
|
|
2541
|
+
type: n.fee.type,
|
|
2542
|
+
value: n.fee.value
|
|
2543
|
+
} : null,
|
|
2544
|
+
issuers: n.issuers?.map((s) => ({
|
|
2545
|
+
id: s.id,
|
|
2546
|
+
name: s.name,
|
|
2547
|
+
image: s.image
|
|
2548
|
+
})) ?? null
|
|
2549
|
+
})) ?? null
|
|
2550
|
+
};
|
|
2551
|
+
} catch (t) {
|
|
2552
|
+
throw this.debugLog("Error fetching payment methods", t), t;
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
async createPayment(e) {
|
|
2556
|
+
this.debugLog("Creating payment", e);
|
|
2557
|
+
try {
|
|
2558
|
+
const t = {
|
|
2559
|
+
orderId: e.orderId,
|
|
2560
|
+
paymentMethodId: e.paymentMethodId,
|
|
2561
|
+
issuerId: e.issuerId,
|
|
2562
|
+
redirectUrl: e.redirectUrl,
|
|
2563
|
+
// For payment links this input in used
|
|
2564
|
+
initiatedByUserId: e.initiatedByUserId,
|
|
2565
|
+
initiatedByTeamId: e.initiatedByTeamId,
|
|
2566
|
+
amountOfTickets: e.amountOfTickets,
|
|
2567
|
+
orderItemId: e.orderItemId
|
|
2568
|
+
};
|
|
2569
|
+
e.customer && (t.customer = e.customer), e.products && (t.products = e.products), e.description && (t.description = e.description), e.reference && (t.reference = e.reference), e.ipAddress && (t.ipAddress = e.ipAddress);
|
|
2570
|
+
const i = await this.sdk.createDigitalPayment({
|
|
2571
|
+
input: t
|
|
2572
|
+
});
|
|
2573
|
+
if (!i?.createDigitalOrderPayment)
|
|
2574
|
+
throw this.debugLog("Failed to create payment"), new Error("Failed to create payment for this order");
|
|
2575
|
+
const n = i.createDigitalOrderPayment;
|
|
2576
|
+
return this.debugLog("Payment created successfully", { paymentUrl: n }), { paymentUrl: n };
|
|
2577
|
+
} catch (t) {
|
|
2578
|
+
throw this.debugLog("Error creating payment", t), t;
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
debugLog(e, t) {
|
|
2582
|
+
this.config.debug && console.log(`[PaymentService] ${e}`, t || "");
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
const Pt = p`
|
|
2586
|
+
query findAllPublicPackagesByOrganizationId($organizationId: ID!) {
|
|
2587
|
+
findAllPublicPackagesByOrganizationId(organizationId: $organizationId) {
|
|
2588
|
+
data {
|
|
2589
|
+
id
|
|
2590
|
+
slug
|
|
2591
|
+
status
|
|
2592
|
+
name
|
|
2593
|
+
description
|
|
2594
|
+
shortTitle
|
|
2595
|
+
shortDescription
|
|
2596
|
+
icon
|
|
2597
|
+
banner
|
|
2598
|
+
currency
|
|
2599
|
+
amountOfEvents
|
|
2600
|
+
prices {
|
|
2601
|
+
price
|
|
2602
|
+
deposit
|
|
2603
|
+
discount
|
|
2604
|
+
serviceFee
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
count
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
`, St = p`
|
|
2611
|
+
query findPublicPackageById($packageId: ID!) {
|
|
2612
|
+
findPublicPackageById(id: $packageId) {
|
|
2613
|
+
id
|
|
2614
|
+
slug
|
|
2615
|
+
status
|
|
2616
|
+
name
|
|
2617
|
+
description
|
|
2618
|
+
shortTitle
|
|
2619
|
+
shortDescription
|
|
2620
|
+
startAvailabilityAt
|
|
2621
|
+
endAvailabilityAt
|
|
2622
|
+
maxAmountOfPersonsPerOrder
|
|
2623
|
+
icon
|
|
2624
|
+
banner
|
|
2625
|
+
currency
|
|
2626
|
+
amountOfEvents
|
|
2627
|
+
amountOfAddons
|
|
2628
|
+
prices {
|
|
2629
|
+
price
|
|
2630
|
+
deposit
|
|
2631
|
+
discount
|
|
2632
|
+
serviceFee
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
`, Ct = p`
|
|
2637
|
+
query findPublicItemsByPackageId($packageId: ID!, $types: [PackageItemType!], $page: PageInput) {
|
|
2638
|
+
findPublicItemsByPackageId(packageId: $packageId, types: $types, page: $page) {
|
|
2639
|
+
data {
|
|
2640
|
+
id
|
|
2641
|
+
name
|
|
2642
|
+
description
|
|
2643
|
+
type
|
|
2644
|
+
price
|
|
2645
|
+
depositPrice
|
|
2646
|
+
discountPrice
|
|
2647
|
+
serviceFee
|
|
2648
|
+
banner
|
|
2649
|
+
package {
|
|
2650
|
+
id
|
|
2651
|
+
name
|
|
2652
|
+
}
|
|
2653
|
+
activeEvents {
|
|
2654
|
+
id
|
|
2655
|
+
name
|
|
2656
|
+
startAt
|
|
2657
|
+
endAt
|
|
2658
|
+
timezone
|
|
2659
|
+
icon
|
|
2660
|
+
banner
|
|
2661
|
+
location {
|
|
2662
|
+
id
|
|
2663
|
+
name
|
|
2664
|
+
address
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
count
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
`, _t = (r, e, t, i) => r();
|
|
2672
|
+
function Lt(r, e = _t) {
|
|
2673
|
+
return {
|
|
2674
|
+
findAllPublicPackagesByOrganizationId(t, i, n) {
|
|
2675
|
+
return e((s) => r.request({ document: Pt, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "findAllPublicPackagesByOrganizationId", "query", t);
|
|
2676
|
+
},
|
|
2677
|
+
findPublicPackageById(t, i, n) {
|
|
2678
|
+
return e((s) => r.request({ document: St, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "findPublicPackageById", "query", t);
|
|
2679
|
+
},
|
|
2680
|
+
findPublicItemsByPackageId(t, i, n) {
|
|
2681
|
+
return e((s) => r.request({ document: Ct, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "findPublicItemsByPackageId", "query", t);
|
|
2682
|
+
}
|
|
2683
|
+
};
|
|
2684
|
+
}
|
|
2685
|
+
class Ee {
|
|
2686
|
+
config;
|
|
2687
|
+
sdk;
|
|
2688
|
+
constructor(e) {
|
|
2689
|
+
if (!e.organizationId)
|
|
2690
|
+
throw new Error("organizationId is required for public package queries");
|
|
2691
|
+
this.config = e, this.sdk = Lt(new C(e.apiUrl));
|
|
2692
|
+
}
|
|
2693
|
+
debugLog(e, t) {
|
|
2694
|
+
this.config.debug && console.log(`[PackageService] ${e}`, t || "");
|
|
2695
|
+
}
|
|
2696
|
+
async getPackages(e = {}) {
|
|
2697
|
+
try {
|
|
2698
|
+
let t;
|
|
2699
|
+
e.page && (t = {
|
|
2700
|
+
index: e.page.index ?? 0,
|
|
2701
|
+
size: e.page.size ?? 20
|
|
2702
|
+
}), this.debugLog("Fetching public packages", {
|
|
2703
|
+
organizationId: this.config.organizationId,
|
|
2704
|
+
page: t,
|
|
2705
|
+
tab: e.tab,
|
|
2706
|
+
statuses: e.statuses
|
|
2707
|
+
});
|
|
2708
|
+
const i = await this.sdk.findAllPublicPackagesByOrganizationId({
|
|
2709
|
+
organizationId: this.config.organizationId
|
|
2710
|
+
});
|
|
2711
|
+
if (i?.findAllPublicPackagesByOrganizationId) {
|
|
2712
|
+
const n = i.findAllPublicPackagesByOrganizationId;
|
|
2713
|
+
return this.debugLog("Public packages fetched", {
|
|
2714
|
+
count: n.count,
|
|
2715
|
+
dataLength: n.data.length
|
|
2716
|
+
}), n;
|
|
2717
|
+
}
|
|
2718
|
+
return null;
|
|
2719
|
+
} catch (t) {
|
|
2720
|
+
throw this.debugLog("Error fetching public packages", t), t;
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
async getPackage(e) {
|
|
2724
|
+
try {
|
|
2725
|
+
this.debugLog("Fetching public packages", {
|
|
2726
|
+
packageId: e
|
|
2727
|
+
});
|
|
2728
|
+
const t = await this.sdk.findPublicPackageById({ packageId: e });
|
|
2729
|
+
if (t?.findPublicPackageById) {
|
|
2730
|
+
const i = t.findPublicPackageById;
|
|
2731
|
+
return this.debugLog("Public package fetched"), i;
|
|
2732
|
+
}
|
|
2733
|
+
return null;
|
|
2734
|
+
} catch (t) {
|
|
2735
|
+
throw this.debugLog("Error fetching public packages", t), t;
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
async getPackageItems(e, t = [B.Regular, B.AdditionalEvent]) {
|
|
2739
|
+
try {
|
|
2740
|
+
this.debugLog("Fetching public package items", { packageId: e, types: t });
|
|
2741
|
+
const i = await this.sdk.findPublicItemsByPackageId({
|
|
2742
|
+
packageId: e,
|
|
2743
|
+
types: t,
|
|
2744
|
+
page: { index: 0, size: 100 }
|
|
2745
|
+
});
|
|
2746
|
+
if (i?.findPublicItemsByPackageId) {
|
|
2747
|
+
const n = i.findPublicItemsByPackageId;
|
|
2748
|
+
return this.debugLog("Public package items fetched", {
|
|
2749
|
+
count: n.count,
|
|
2750
|
+
dataLength: n.data.length
|
|
2751
|
+
}), n;
|
|
2752
|
+
}
|
|
2753
|
+
return null;
|
|
2754
|
+
} catch (i) {
|
|
2755
|
+
throw this.debugLog("Error fetching public package items", i), i;
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
const Rt = p`
|
|
2760
|
+
query findAllPublicCategoriesByOrganizationId($organizationId: ID!) {
|
|
2761
|
+
findAllPublicHostingsByOrganizationId(id: $organizationId) {
|
|
2762
|
+
data {
|
|
2763
|
+
id
|
|
2764
|
+
name
|
|
2765
|
+
icon
|
|
2766
|
+
}
|
|
2767
|
+
count
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
`, Ft = p`
|
|
2771
|
+
query findPublicCategoryById($hostingId: ID!) {
|
|
2772
|
+
findPublicHostingById(id: $hostingId) {
|
|
2773
|
+
id
|
|
2774
|
+
name
|
|
2775
|
+
icon
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
`, wt = (r, e, t, i) => r();
|
|
2779
|
+
function Bt(r, e = wt) {
|
|
2780
|
+
return {
|
|
2781
|
+
findAllPublicCategoriesByOrganizationId(t, i, n) {
|
|
2782
|
+
return e((s) => r.request({ document: Rt, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "findAllPublicCategoriesByOrganizationId", "query", t);
|
|
2783
|
+
},
|
|
2784
|
+
findPublicCategoryById(t, i, n) {
|
|
2785
|
+
return e((s) => r.request({ document: Ft, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "findPublicCategoryById", "query", t);
|
|
2786
|
+
}
|
|
2787
|
+
};
|
|
2788
|
+
}
|
|
2789
|
+
class ye {
|
|
2790
|
+
config;
|
|
2791
|
+
sdk;
|
|
2792
|
+
constructor(e) {
|
|
2793
|
+
if (!e.organizationId)
|
|
2794
|
+
throw new Error("organizationId is required for category queries");
|
|
2795
|
+
this.config = e, this.sdk = Bt(new C(e.apiUrl));
|
|
2796
|
+
}
|
|
2797
|
+
debugLog(e, t) {
|
|
2798
|
+
this.config.debug && console.log(`[CategoryService] ${e}`, t || "");
|
|
2799
|
+
}
|
|
2800
|
+
async getCategories() {
|
|
2801
|
+
try {
|
|
2802
|
+
this.debugLog("Fetching all categories", { organizationId: this.config.organizationId });
|
|
2803
|
+
const e = await this.sdk.findAllPublicCategoriesByOrganizationId({ organizationId: this.config.organizationId });
|
|
2804
|
+
if (e?.findAllPublicHostingsByOrganizationId) {
|
|
2805
|
+
const t = e.findAllPublicHostingsByOrganizationId;
|
|
2806
|
+
return this.debugLog("Categories fetched", { count: t.count, dataLength: t.data.length }), t.data.map((i) => ({ id: i.id, name: i.name, icon: i.icon }));
|
|
2807
|
+
}
|
|
2808
|
+
return [];
|
|
2809
|
+
} catch (e) {
|
|
2810
|
+
throw this.debugLog("Error fetching categories", e), e;
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
async getCategory(e) {
|
|
2814
|
+
try {
|
|
2815
|
+
this.debugLog("Fetching category", { categoryId: e });
|
|
2816
|
+
const t = await this.sdk.findPublicCategoryById({ hostingId: e });
|
|
2817
|
+
if (t?.findPublicHostingById) {
|
|
2818
|
+
const i = t.findPublicHostingById;
|
|
2819
|
+
return this.debugLog("Category fetched", i), { id: i.id, name: i.name, icon: i.icon };
|
|
2820
|
+
}
|
|
2821
|
+
return null;
|
|
2822
|
+
} catch (t) {
|
|
2823
|
+
throw this.debugLog("Error fetching category", t), t;
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
var k = /* @__PURE__ */ ((r) => (r.PACKAGE = "PACKAGE", r.PRODUCT = "PRODUCT", r.ADD_ONS = "ADD_ONS", r.DELIVERY = "DELIVERY", r.PICKUP = "PICKUP", r))(k || {}), B = /* @__PURE__ */ ((r) => (r.AdditionalEvent = "ADDITIONAL_EVENT", r.Addon = "ADDON", r.Regular = "REGULAR", r))(B || {}), Ae = /* @__PURE__ */ ((r) => (r.Active = "ACTIVE", r.Concept = "CONCEPT", r.Paused = "PAUSED", r.SoldOut = "SOLD_OUT", r))(Ae || {}), Oe = /* @__PURE__ */ ((r) => (r.Active = "ACTIVE", r.Inactive = "INACTIVE", r))(Oe || {}), Te = /* @__PURE__ */ ((r) => (r.Active = "ACTIVE", r.Inactive = "INACTIVE", r.Paused = "PAUSED", r.SoldOut = "SOLD_OUT", r))(Te || {}), ke = /* @__PURE__ */ ((r) => (r.Asc = "ASC", r.Desc = "DESC", r))(ke || {}), ve = /* @__PURE__ */ ((r) => (r.AllReserved = "ALL_RESERVED", r.Available = "AVAILABLE", r.SoldOut = "SOLD_OUT", r))(ve || {}), Ne = /* @__PURE__ */ ((r) => (r.Addon = "ADDON", r.Delivery = "DELIVERY", r.Door = "DOOR", r.Friend = "FRIEND", r.Guest = "GUEST", r.Pickup = "PICKUP", r.Promoter = "PROMOTER", r.Ticket = "TICKET", r))(Ne || {}), xe = /* @__PURE__ */ ((r) => (r.FIXED = "FIXED", r.PERCENTAGE = "PERCENTAGE", r))(xe || {});
|
|
2828
|
+
const $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2829
|
+
__proto__: null,
|
|
2830
|
+
BasketOrderType: k,
|
|
2831
|
+
BasketService: be,
|
|
2832
|
+
CategoryService: ye,
|
|
2833
|
+
EventService: fe,
|
|
2834
|
+
EventStatus: Te,
|
|
2835
|
+
PackageItemType: B,
|
|
2836
|
+
PackageService: Ee,
|
|
2837
|
+
PackageStatus: Ae,
|
|
2838
|
+
PackageTabType: Oe,
|
|
2839
|
+
PaymentMethodFeeType: xe,
|
|
2840
|
+
PaymentService: Ie,
|
|
2841
|
+
ProductStatus: ve,
|
|
2842
|
+
ProductType: Ne,
|
|
2843
|
+
SortOrder: ke
|
|
2844
|
+
}, Symbol.toStringTag, { value: "Module" })), Ut = p`
|
|
2845
|
+
query findActiveOrderById($id: String) {
|
|
2846
|
+
findOrder(id: $id) {
|
|
2847
|
+
id
|
|
2848
|
+
soldAt
|
|
2849
|
+
mainBooker {
|
|
2850
|
+
firstName
|
|
2851
|
+
lastName
|
|
2852
|
+
email
|
|
2853
|
+
age
|
|
2854
|
+
gender
|
|
2855
|
+
residence
|
|
2856
|
+
extraInfo {
|
|
2857
|
+
key
|
|
2858
|
+
value
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
soldByUser {
|
|
2862
|
+
id
|
|
2863
|
+
firstName
|
|
2864
|
+
lastName
|
|
2865
|
+
avatar
|
|
2866
|
+
}
|
|
2867
|
+
organization {
|
|
2868
|
+
id
|
|
2869
|
+
name
|
|
2870
|
+
paymentBanner
|
|
2871
|
+
}
|
|
2872
|
+
currency
|
|
2873
|
+
items {
|
|
2874
|
+
id
|
|
2875
|
+
price
|
|
2876
|
+
depositPrice
|
|
2877
|
+
originalPrice
|
|
2878
|
+
serviceFee
|
|
2879
|
+
amount
|
|
2880
|
+
amountPending
|
|
2881
|
+
expiredAt
|
|
2882
|
+
event {
|
|
2883
|
+
id
|
|
2884
|
+
name
|
|
2885
|
+
startAt
|
|
2886
|
+
endAt
|
|
2887
|
+
timezone
|
|
2888
|
+
icon
|
|
2889
|
+
banner
|
|
2890
|
+
location {
|
|
2891
|
+
id
|
|
2892
|
+
name
|
|
2893
|
+
address
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
product {
|
|
2897
|
+
id
|
|
2898
|
+
name
|
|
2899
|
+
icon
|
|
2900
|
+
description
|
|
2901
|
+
type
|
|
2902
|
+
discountPrice
|
|
2903
|
+
}
|
|
2904
|
+
packageItem {
|
|
2905
|
+
id
|
|
2906
|
+
package {
|
|
2907
|
+
id
|
|
2908
|
+
name
|
|
2909
|
+
}
|
|
2910
|
+
}
|
|
2911
|
+
seats {
|
|
2912
|
+
id
|
|
2913
|
+
label
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
`, Mt = p`
|
|
2919
|
+
mutation addToOrder($orderId: ID!, $productId: ID!, $shopId: ID, $additionalData: AdditionalDataInput, $trackerId: ID, $amount: Int) {
|
|
2920
|
+
reserveProduct(
|
|
2921
|
+
input: {orderId: $orderId, productId: $productId, additionalData: $additionalData, trackerId: $trackerId, shopId: $shopId, amountToIncrease: $amount}
|
|
2922
|
+
) {
|
|
2923
|
+
orderId
|
|
2924
|
+
expiredAt
|
|
2925
|
+
amountReserved
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
`, Vt = p`
|
|
2929
|
+
mutation removeFromOrder($orderId: ID!, $productId: ID!, $additionalData: AdditionalDataInput, $amount: Int) {
|
|
2930
|
+
releaseProduct(
|
|
2931
|
+
input: {orderId: $orderId, productId: $productId, additionalData: $additionalData, amountToRelease: $amount}
|
|
2932
|
+
) {
|
|
2933
|
+
orderId
|
|
2934
|
+
amountReleased
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
`, zt = p`
|
|
2938
|
+
mutation configurePackage($orderId: ID!, $packageId: ID!, $amount: Int!, $items: [ReservedItem!]!, $shopId: ID, $trackerId: ID) {
|
|
2939
|
+
configurePackage(
|
|
2940
|
+
input: {orderId: $orderId, shopId: $shopId, trackerId: $trackerId, packageId: $packageId, amount: $amount, items: $items}
|
|
2941
|
+
) {
|
|
2942
|
+
orderId
|
|
2943
|
+
expiredAt
|
|
2944
|
+
amountReserved
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
`, qt = p`
|
|
2948
|
+
mutation reserveAdditionalPackageItem($amount: Int!, $orderId: ID!, $packageId: ID!, $eventId: ID!, $packageItemId: ID!) {
|
|
2949
|
+
reserveAdditionalPackageItem(
|
|
2950
|
+
input: {amount: $amount, eventId: $eventId, orderId: $orderId, packageId: $packageId, packageItemId: $packageItemId}
|
|
2951
|
+
) {
|
|
2952
|
+
orderId
|
|
2953
|
+
expiredAt
|
|
2954
|
+
amountReserved
|
|
2955
|
+
}
|
|
2956
|
+
}
|
|
2957
|
+
`, Gt = p`
|
|
2958
|
+
mutation configureOrderDeliveryOption($orderId: ID!, $productId: ID) {
|
|
2959
|
+
configureDeliveryOption(input: {orderId: $orderId, productId: $productId})
|
|
2960
|
+
}
|
|
2961
|
+
`, jt = p`
|
|
2962
|
+
mutation createOrderCustomer($orderId: ID!, $countryCode: String, $customer: CreateCustomerInput!) {
|
|
2963
|
+
createOrderCustomer(
|
|
2964
|
+
input: {id: $orderId, countryCode: $countryCode, customer: $customer}
|
|
2965
|
+
)
|
|
2966
|
+
}
|
|
2967
|
+
`, Yt = p`
|
|
2968
|
+
mutation deleteOrder($orderId: ID!) {
|
|
2969
|
+
cancelOrder(id: $orderId)
|
|
2970
|
+
}
|
|
2971
|
+
`, Ht = (r, e, t, i) => r();
|
|
2972
|
+
function Qt(r, e = Ht) {
|
|
2973
|
+
return {
|
|
2974
|
+
findActiveOrderById(t, i, n) {
|
|
2975
|
+
return e((s) => r.request({ document: Ut, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "findActiveOrderById", "query", t);
|
|
2976
|
+
},
|
|
2977
|
+
addToOrder(t, i, n) {
|
|
2978
|
+
return e((s) => r.request({ document: Mt, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "addToOrder", "mutation", t);
|
|
2979
|
+
},
|
|
2980
|
+
removeFromOrder(t, i, n) {
|
|
2981
|
+
return e((s) => r.request({ document: Vt, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "removeFromOrder", "mutation", t);
|
|
2982
|
+
},
|
|
2983
|
+
configurePackage(t, i, n) {
|
|
2984
|
+
return e((s) => r.request({ document: zt, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "configurePackage", "mutation", t);
|
|
2985
|
+
},
|
|
2986
|
+
reserveAdditionalPackageItem(t, i, n) {
|
|
2987
|
+
return e((s) => r.request({ document: qt, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "reserveAdditionalPackageItem", "mutation", t);
|
|
2988
|
+
},
|
|
2989
|
+
configureOrderDeliveryOption(t, i, n) {
|
|
2990
|
+
return e((s) => r.request({ document: Gt, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "configureOrderDeliveryOption", "mutation", t);
|
|
2991
|
+
},
|
|
2992
|
+
createOrderCustomer(t, i, n) {
|
|
2993
|
+
return e((s) => r.request({ document: jt, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "createOrderCustomer", "mutation", t);
|
|
2994
|
+
},
|
|
2995
|
+
deleteOrder(t, i, n) {
|
|
2996
|
+
return e((s) => r.request({ document: Yt, variables: t, requestHeaders: { ...i, ...s }, signal: n }), "deleteOrder", "mutation", t);
|
|
2997
|
+
}
|
|
2998
|
+
};
|
|
2999
|
+
}
|
|
3000
|
+
const W = {
|
|
3001
|
+
order: null,
|
|
3002
|
+
processing: !1,
|
|
3003
|
+
error: null
|
|
3004
|
+
}, De = Ce({
|
|
3005
|
+
name: "basket",
|
|
3006
|
+
initialState: W,
|
|
3007
|
+
reducers: {
|
|
3008
|
+
setProcessing: (r, e) => {
|
|
3009
|
+
r.processing = e.payload;
|
|
3010
|
+
},
|
|
3011
|
+
setError: (r, e) => {
|
|
3012
|
+
r.error = e.payload;
|
|
3013
|
+
},
|
|
3014
|
+
setOrder: (r, e) => {
|
|
3015
|
+
r.order = e.payload;
|
|
3016
|
+
},
|
|
3017
|
+
initializeOrder: (r, e) => {
|
|
3018
|
+
r.order || (r.order = {
|
|
3019
|
+
id: e.payload.id,
|
|
3020
|
+
currency: e.payload.currency,
|
|
3021
|
+
items: [],
|
|
3022
|
+
expiredAt: e.payload.expiredAt
|
|
3023
|
+
});
|
|
3024
|
+
},
|
|
3025
|
+
addProduct: (r, e) => {
|
|
3026
|
+
const { input: t, amountReserved: i, expiredAt: n } = e.payload;
|
|
3027
|
+
if (!r.order)
|
|
3028
|
+
return;
|
|
3029
|
+
const s = r.order.items.findIndex((o) => t.seat ? o.id === t.id && o.seats?.some((u) => u.id === t.seat?.id) : o.id === t.id);
|
|
3030
|
+
if (s >= 0)
|
|
3031
|
+
r.order.items[s].amount += i;
|
|
3032
|
+
else {
|
|
3033
|
+
const o = {
|
|
3034
|
+
id: t.id,
|
|
3035
|
+
type: "PRODUCT",
|
|
3036
|
+
name: t.name,
|
|
3037
|
+
amount: i,
|
|
3038
|
+
price: t.price,
|
|
3039
|
+
depositPrice: t.depositPrice,
|
|
3040
|
+
serviceFee: t.serviceFee,
|
|
3041
|
+
originalPrice: t.price,
|
|
3042
|
+
seats: t.seat ? [{ id: t.seat.id, label: t.seat.label }] : void 0
|
|
3043
|
+
};
|
|
3044
|
+
r.order.items.push(o);
|
|
3045
|
+
}
|
|
3046
|
+
r.order.expiredAt = n;
|
|
3047
|
+
},
|
|
3048
|
+
removeProduct: (r, e) => {
|
|
3049
|
+
if (!r.order) return;
|
|
3050
|
+
const { id: t, amountReleased: i, seatId: n } = e.payload, s = r.order.items.findIndex(
|
|
3051
|
+
(o) => o.type === "PRODUCT" && o.id === t
|
|
3052
|
+
);
|
|
3053
|
+
if (s !== -1) {
|
|
3054
|
+
const o = r.order.items[s];
|
|
3055
|
+
if (o.amount -= i, o.amount <= 0)
|
|
3056
|
+
r.order.items.splice(s, 1);
|
|
3057
|
+
else if (o.seats && n) {
|
|
3058
|
+
const u = o.seats.findIndex((l) => l.id === n);
|
|
3059
|
+
u !== -1 && o.seats.splice(u, 1);
|
|
3060
|
+
}
|
|
3061
|
+
}
|
|
3062
|
+
r.order.items.length === 0 && (r.order = null);
|
|
3063
|
+
},
|
|
3064
|
+
configurePackage: (r, e) => {
|
|
3065
|
+
const { input: t, amountReserved: i, expiredAt: n } = e.payload;
|
|
3066
|
+
r.order || (r.order = {
|
|
3067
|
+
id: "",
|
|
3068
|
+
currency: t.currency,
|
|
3069
|
+
items: [],
|
|
3070
|
+
expiredAt: n
|
|
3071
|
+
});
|
|
3072
|
+
const s = r.order.items.find(
|
|
3073
|
+
(o) => o.type === "PACKAGE" && o.id === t.id
|
|
3074
|
+
);
|
|
3075
|
+
s ? (s.amount = i, s.packageItems = t.items) : r.order.items.push({
|
|
3076
|
+
id: t.id,
|
|
3077
|
+
type: "PACKAGE",
|
|
3078
|
+
name: t.name,
|
|
3079
|
+
amount: i,
|
|
3080
|
+
price: t.discountPrice ?? t.price,
|
|
3081
|
+
depositPrice: t.depositPrice,
|
|
3082
|
+
originalPrice: t.price,
|
|
3083
|
+
serviceFee: t.serviceFee,
|
|
3084
|
+
packageItems: t.items
|
|
3085
|
+
});
|
|
3086
|
+
},
|
|
3087
|
+
reserveAdditionalPackageItem: (r, e) => {
|
|
3088
|
+
const { input: t, amountReserved: i, expiredAt: n } = e.payload;
|
|
3089
|
+
r.order || (r.order = {
|
|
3090
|
+
id: "",
|
|
3091
|
+
currency: t.currency,
|
|
3092
|
+
items: [],
|
|
3093
|
+
expiredAt: n
|
|
3094
|
+
});
|
|
3095
|
+
const s = r.order.items.findIndex(
|
|
3096
|
+
(u) => u.id === t.packageItemId
|
|
3097
|
+
), o = r.order.items[s];
|
|
3098
|
+
o ? (o.amount = i, o.packageItems = [
|
|
3099
|
+
{
|
|
3100
|
+
packageItemId: t.packageItemId,
|
|
3101
|
+
eventId: t.eventId,
|
|
3102
|
+
name: t.name,
|
|
3103
|
+
startAt: t.startAt,
|
|
3104
|
+
endAt: t.endAt
|
|
3105
|
+
}
|
|
3106
|
+
], o.amount === 0 && r.order.items.splice(s, 1)) : r.order.items.push({
|
|
3107
|
+
id: t.packageItemId,
|
|
3108
|
+
type: k.ADD_ONS,
|
|
3109
|
+
name: t.name,
|
|
3110
|
+
amount: i,
|
|
3111
|
+
price: t.discountPrice ?? t.price,
|
|
3112
|
+
depositPrice: t.depositPrice,
|
|
3113
|
+
originalPrice: t.price,
|
|
3114
|
+
serviceFee: t.serviceFee,
|
|
3115
|
+
packageItems: [
|
|
3116
|
+
{
|
|
3117
|
+
packageItemId: t.packageItemId,
|
|
3118
|
+
eventId: t.eventId,
|
|
3119
|
+
name: t.name,
|
|
3120
|
+
startAt: t.startAt,
|
|
3121
|
+
endAt: t.endAt
|
|
3122
|
+
}
|
|
3123
|
+
]
|
|
3124
|
+
});
|
|
3125
|
+
},
|
|
3126
|
+
configureDelivery: (r, e) => {
|
|
3127
|
+
if (!r.order) return;
|
|
3128
|
+
const t = e.payload, i = r.order.items.findIndex(
|
|
3129
|
+
(n) => n.type === "DELIVERY"
|
|
3130
|
+
);
|
|
3131
|
+
if (t)
|
|
3132
|
+
if (i !== -1) {
|
|
3133
|
+
const n = r.order.items[i];
|
|
3134
|
+
n.id = t.id, n.name = t.name, n.price = t.price, n.serviceFee = t.serviceFee;
|
|
3135
|
+
} else
|
|
3136
|
+
r.order.items.push({
|
|
3137
|
+
id: t.id,
|
|
3138
|
+
type: "PRODUCT",
|
|
3139
|
+
name: t.name,
|
|
3140
|
+
amount: 1,
|
|
3141
|
+
price: t.price,
|
|
3142
|
+
originalPrice: t.price,
|
|
3143
|
+
serviceFee: t.serviceFee
|
|
3144
|
+
});
|
|
3145
|
+
else i !== -1 && r.order.items.splice(i, 1);
|
|
3146
|
+
},
|
|
3147
|
+
configureCustomer: (r, e) => {
|
|
3148
|
+
r.order && (r.order.customer = e.payload);
|
|
3149
|
+
},
|
|
3150
|
+
clearBasket: () => W
|
|
3151
|
+
}
|
|
3152
|
+
}), {
|
|
3153
|
+
setProcessing: T,
|
|
3154
|
+
initializeOrder: L,
|
|
3155
|
+
addProduct: Z,
|
|
3156
|
+
removeProduct: Jt,
|
|
3157
|
+
configurePackage: ee,
|
|
3158
|
+
configureDelivery: Xt,
|
|
3159
|
+
configureCustomer: te,
|
|
3160
|
+
reserveAdditionalPackageItem: Kt,
|
|
3161
|
+
clearBasket: re
|
|
3162
|
+
} = De.actions;
|
|
3163
|
+
class be {
|
|
3164
|
+
orderIdKey = "ORDER_ID";
|
|
3165
|
+
config;
|
|
3166
|
+
sdk;
|
|
3167
|
+
store;
|
|
3168
|
+
constructor(e) {
|
|
3169
|
+
this.config = e, this.store = _e({
|
|
3170
|
+
reducer: {
|
|
3171
|
+
basket: De.reducer
|
|
3172
|
+
}
|
|
3173
|
+
}), this.sdk = Qt(new C(e.apiUrl)), this.restoreOrderFromSession().then(() => {
|
|
3174
|
+
this.debugLog("Restore order from session");
|
|
3175
|
+
});
|
|
3176
|
+
}
|
|
3177
|
+
// Store functions
|
|
3178
|
+
subscribe(e) {
|
|
3179
|
+
return this.store.subscribe(e);
|
|
3180
|
+
}
|
|
3181
|
+
getCurrentOrder() {
|
|
3182
|
+
const e = this.getState();
|
|
3183
|
+
if (!e.order)
|
|
3184
|
+
return null;
|
|
3185
|
+
const t = e.order.items.reduce((i, n) => i + (n.amount || 0), 0);
|
|
3186
|
+
return {
|
|
3187
|
+
...e.order,
|
|
3188
|
+
count: t
|
|
3189
|
+
};
|
|
3190
|
+
}
|
|
3191
|
+
getSelectedPackageEvent() {
|
|
3192
|
+
return this.getState().order?.items.flatMap((t) => t.packageItems?.map((i) => i.eventId) ?? []) ?? [];
|
|
3193
|
+
}
|
|
3194
|
+
// Basket update functions
|
|
3195
|
+
async addProduct(e) {
|
|
3196
|
+
this.store.dispatch(T(!0));
|
|
3197
|
+
try {
|
|
3198
|
+
const i = this.getState().order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId();
|
|
3199
|
+
this.debugLog("Adding product", {
|
|
3200
|
+
productId: e.id,
|
|
3201
|
+
orderId: i,
|
|
3202
|
+
amount: e.amount,
|
|
3203
|
+
seat: e.seat
|
|
3204
|
+
});
|
|
3205
|
+
const n = await this.sdk.addToOrder({
|
|
3206
|
+
productId: e.id,
|
|
3207
|
+
orderId: i,
|
|
3208
|
+
additionalData: e.seat ? {
|
|
3209
|
+
seat: {
|
|
3210
|
+
seatId: e.seat.id,
|
|
3211
|
+
seatLabel: e.seat.label,
|
|
3212
|
+
holdToken: e.seat.holdToken
|
|
3213
|
+
}
|
|
3214
|
+
} : null,
|
|
3215
|
+
trackerId: this.config.trackerId,
|
|
3216
|
+
shopId: this.config.shopId,
|
|
3217
|
+
amount: e.amount
|
|
3218
|
+
});
|
|
3219
|
+
if (n?.reserveProduct) {
|
|
3220
|
+
const { orderId: s, expiredAt: o, amountReserved: u } = n.reserveProduct;
|
|
3221
|
+
this.debugLog("Product added successfully", n.reserveProduct), sessionStorage.setItem(this.orderIdKey, i), this.store.dispatch(
|
|
3222
|
+
L({
|
|
3223
|
+
id: s,
|
|
3224
|
+
currency: e.currency,
|
|
3225
|
+
expiredAt: o ? y.fromISO(o) : void 0
|
|
3226
|
+
})
|
|
3227
|
+
), this.store.dispatch(
|
|
3228
|
+
Z({
|
|
3229
|
+
input: e,
|
|
3230
|
+
amountReserved: u,
|
|
3231
|
+
expiredAt: o ? y.fromISO(o) : void 0
|
|
3232
|
+
})
|
|
3233
|
+
);
|
|
3234
|
+
}
|
|
3235
|
+
} catch (t) {
|
|
3236
|
+
throw this.debugLog("Error adding product", t), this.handleError(t), t;
|
|
3237
|
+
} finally {
|
|
3238
|
+
this.store.dispatch(T(!1));
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
async removeProduct(e) {
|
|
3242
|
+
const i = this.getState().order;
|
|
3243
|
+
if (i) {
|
|
3244
|
+
this.store.dispatch(T(!0));
|
|
3245
|
+
try {
|
|
3246
|
+
this.debugLog("Removing product", {
|
|
3247
|
+
productId: e.id,
|
|
3248
|
+
orderId: i.id,
|
|
3249
|
+
amount: e.amount
|
|
3250
|
+
});
|
|
3251
|
+
const n = await this.sdk.removeFromOrder({
|
|
3252
|
+
productId: e.id,
|
|
3253
|
+
orderId: i.id,
|
|
3254
|
+
additionalData: e.seat ? {
|
|
3255
|
+
seat: {
|
|
3256
|
+
seatId: e.seat.id,
|
|
3257
|
+
seatLabel: e.seat.label
|
|
3258
|
+
}
|
|
3259
|
+
} : null,
|
|
3260
|
+
amount: e.amount
|
|
3261
|
+
});
|
|
3262
|
+
if (n?.releaseProduct) {
|
|
3263
|
+
const { amountReleased: s } = n.releaseProduct;
|
|
3264
|
+
this.debugLog("Product removed successfully", n.releaseProduct), this.store.dispatch(
|
|
3265
|
+
Jt({
|
|
3266
|
+
id: e.id,
|
|
3267
|
+
amountReleased: s,
|
|
3268
|
+
seatId: e.seat?.id
|
|
3269
|
+
})
|
|
3270
|
+
);
|
|
3271
|
+
const o = this.getState();
|
|
3272
|
+
(!o.order || o.order.items.length === 0) && (this.debugLog("Basket is now empty, cancelling order and clearing session"), await this.cancelOrder());
|
|
3273
|
+
}
|
|
3274
|
+
} catch (n) {
|
|
3275
|
+
throw this.debugLog("Error removing product", n), this.handleError(n), n;
|
|
3276
|
+
} finally {
|
|
3277
|
+
this.store.dispatch(T(!1));
|
|
3278
|
+
}
|
|
3279
|
+
}
|
|
3280
|
+
}
|
|
3281
|
+
async configurePackage(e) {
|
|
3282
|
+
this.store.dispatch(T(!0));
|
|
3283
|
+
try {
|
|
3284
|
+
const i = this.store.getState().basket.order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId(), n = e.items.map((o) => ({
|
|
3285
|
+
packageItemId: o.packageItemId,
|
|
3286
|
+
eventId: o.eventId
|
|
3287
|
+
}));
|
|
3288
|
+
this.debugLog("Configuring package", {
|
|
3289
|
+
packageId: e.id,
|
|
3290
|
+
orderId: i,
|
|
3291
|
+
amount: e.amount,
|
|
3292
|
+
items: n,
|
|
3293
|
+
shopId: this.config.shopId
|
|
3294
|
+
});
|
|
3295
|
+
const s = await this.sdk.configurePackage({
|
|
3296
|
+
trackerId: this.config.trackerId,
|
|
3297
|
+
shopId: this.config.shopId,
|
|
3298
|
+
packageId: e.id,
|
|
3299
|
+
orderId: i,
|
|
3300
|
+
amount: e.amount,
|
|
3301
|
+
items: n
|
|
3302
|
+
});
|
|
3303
|
+
if (this.debugLog("Configure package response", s), s?.configurePackage && s.configurePackage.amountReserved > 0) {
|
|
3304
|
+
const { orderId: o, expiredAt: u, amountReserved: l } = s.configurePackage;
|
|
3305
|
+
return this.debugLog("Package configured successfully"), sessionStorage.setItem(this.orderIdKey, i), this.store.dispatch(
|
|
3306
|
+
L({
|
|
3307
|
+
id: o,
|
|
3308
|
+
currency: e.currency,
|
|
3309
|
+
expiredAt: u ? y.fromISO(u) : void 0
|
|
3310
|
+
})
|
|
3311
|
+
), this.store.dispatch(
|
|
3312
|
+
ee({
|
|
3313
|
+
input: e,
|
|
3314
|
+
amountReserved: l,
|
|
3315
|
+
expiredAt: u ? y.fromISO(u) : void 0
|
|
3316
|
+
})
|
|
3317
|
+
), null;
|
|
3318
|
+
} else
|
|
3319
|
+
return this.debugLog("Package configuration failed - no amount reserved"), { error: "Failed to configure package - no items reserved" };
|
|
3320
|
+
} catch (t) {
|
|
3321
|
+
return this.debugLog("Error configuring package", t), this.handleError(t), { error: t };
|
|
3322
|
+
} finally {
|
|
3323
|
+
this.store.dispatch(T(!1));
|
|
3324
|
+
}
|
|
3325
|
+
}
|
|
3326
|
+
async configureDelivery(e) {
|
|
3327
|
+
this.store.dispatch(T(!0));
|
|
3328
|
+
try {
|
|
3329
|
+
this.store.dispatch(Xt(e));
|
|
3330
|
+
} catch (t) {
|
|
3331
|
+
throw this.debugLog("Error setting delivery", t), this.handleError(t), t;
|
|
3332
|
+
} finally {
|
|
3333
|
+
this.store.dispatch(T(!1));
|
|
3334
|
+
}
|
|
3335
|
+
}
|
|
3336
|
+
async configureCustomer(e) {
|
|
3337
|
+
const i = this.getState().order;
|
|
3338
|
+
if (!i)
|
|
3339
|
+
throw new Error("No active order. Add items to basket first.");
|
|
3340
|
+
this.debugLog("Creating/replacing customer", { orderId: i.id, email: e.email });
|
|
3341
|
+
try {
|
|
3342
|
+
const n = await this.sdk.createOrderCustomer({
|
|
3343
|
+
orderId: i.id,
|
|
3344
|
+
customer: e
|
|
3345
|
+
});
|
|
3346
|
+
this.debugLog("Customer set successfully", n), this.store.dispatch(te(e));
|
|
3347
|
+
} catch (n) {
|
|
3348
|
+
throw this.debugLog("Failed to set customer", n), new Error(`Failed to set customer: ${n.message}`);
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
async reserveAdditionalPackageItem(e) {
|
|
3352
|
+
this.store.dispatch(T(!0));
|
|
3353
|
+
try {
|
|
3354
|
+
const i = this.store.getState().basket.order?.id ?? sessionStorage.getItem(this.orderIdKey) ?? this.generateOrderId();
|
|
3355
|
+
this.debugLog("reserve additional packageItem", {
|
|
3356
|
+
orderId: i,
|
|
3357
|
+
eventId: e.eventId,
|
|
3358
|
+
amount: e.amount,
|
|
3359
|
+
packageId: e.packageId,
|
|
3360
|
+
packageItemId: e.packageItemId
|
|
3361
|
+
});
|
|
3362
|
+
const n = await this.sdk.reserveAdditionalPackageItem({
|
|
3363
|
+
orderId: i,
|
|
3364
|
+
eventId: e.eventId,
|
|
3365
|
+
amount: e.amount,
|
|
3366
|
+
packageId: e.packageId,
|
|
3367
|
+
packageItemId: e.packageItemId
|
|
3368
|
+
});
|
|
3369
|
+
if (this.debugLog("reserve additional packageItem", n), n?.reserveAdditionalPackageItem && n.reserveAdditionalPackageItem.amountReserved > 0) {
|
|
3370
|
+
const { orderId: s, expiredAt: o, amountReserved: u } = n.reserveAdditionalPackageItem;
|
|
3371
|
+
return this.debugLog("Reserve configured successfully"), sessionStorage.setItem(this.orderIdKey, i), this.store.dispatch(
|
|
3372
|
+
L({
|
|
3373
|
+
id: s,
|
|
3374
|
+
currency: e.currency,
|
|
3375
|
+
expiredAt: o ? y.fromISO(o) : void 0
|
|
3376
|
+
})
|
|
3377
|
+
), this.store.dispatch(
|
|
3378
|
+
Kt({
|
|
3379
|
+
input: e,
|
|
3380
|
+
amountReserved: u,
|
|
3381
|
+
expiredAt: o ? y.fromISO(o) : void 0
|
|
3382
|
+
})
|
|
3383
|
+
), null;
|
|
3384
|
+
} else
|
|
3385
|
+
return this.debugLog("Package configuration failed - no amount reserved"), { error: "Failed to configure package - no items reserved" };
|
|
3386
|
+
} catch (t) {
|
|
3387
|
+
return this.debugLog("Error configuring package", t), this.handleError(t), { error: t };
|
|
3388
|
+
} finally {
|
|
3389
|
+
this.store.dispatch(T(!1));
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3392
|
+
// Cancel and clear order functions
|
|
3393
|
+
async cancelOrder() {
|
|
3394
|
+
const e = sessionStorage.getItem(this.orderIdKey);
|
|
3395
|
+
e && (this.debugLog("Cancelling order", { orderId: e }), await this.sdk.deleteOrder({ orderId: e }), this.clearOrderFromSession(), this.debugLog("Order cancelled successfully"));
|
|
3396
|
+
}
|
|
3397
|
+
clearOrderFromSession() {
|
|
3398
|
+
this.debugLog("Clearing order from session"), sessionStorage.removeItem(this.orderIdKey), this.store.dispatch(re());
|
|
3399
|
+
}
|
|
3400
|
+
// Private functions for fetching the current order from a session
|
|
3401
|
+
async restoreOrderFromSession() {
|
|
3402
|
+
const e = sessionStorage.getItem(this.orderIdKey);
|
|
3403
|
+
if (e) {
|
|
3404
|
+
this.debugLog("Found existing order ID in session, restoring...", { orderId: e });
|
|
3405
|
+
try {
|
|
3406
|
+
await this.fetchOrder(e), this.debugLog("Order restored successfully");
|
|
3407
|
+
} catch (t) {
|
|
3408
|
+
this.debugLog("Failed to restore order, clearing session", t), this.clearOrderFromSession();
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
async fetchOrder(e) {
|
|
3413
|
+
this.debugLog("Fetching order from server", { orderId: e });
|
|
3414
|
+
try {
|
|
3415
|
+
const t = await this.sdk.findActiveOrderById({ id: e });
|
|
3416
|
+
if (!t?.findOrder) {
|
|
3417
|
+
this.debugLog("Order not found"), this.clearOrderFromSession();
|
|
3418
|
+
return;
|
|
3419
|
+
}
|
|
3420
|
+
const i = t.findOrder;
|
|
3421
|
+
this.debugLog("Order fetched successfully", i);
|
|
3422
|
+
const n = i.items, s = n.filter((c) => c.product != null && c.amount > 0).map((c) => {
|
|
3423
|
+
let E = k.PRODUCT;
|
|
3424
|
+
return c.product.type === "PROMOTER" ? E = k.ADD_ONS : c.product.type === "PICKUP" ? E = k.PICKUP : c.product.type === "DELIVERY" && (E = k.DELIVERY), {
|
|
3425
|
+
id: c.product.id,
|
|
3426
|
+
type: E,
|
|
3427
|
+
name: c.product.name,
|
|
3428
|
+
icon: c.product.icon,
|
|
3429
|
+
description: c.product.description,
|
|
3430
|
+
amount: c.amount,
|
|
3431
|
+
price: c.price ?? 0,
|
|
3432
|
+
depositPrice: c.depositPrice ?? 0,
|
|
3433
|
+
originalPrice: c.originalPrice ?? 0,
|
|
3434
|
+
serviceFee: c.serviceFee ?? 0,
|
|
3435
|
+
seats: c.seats?.map((m) => ({
|
|
3436
|
+
id: m.id,
|
|
3437
|
+
label: m.label
|
|
3438
|
+
}))
|
|
3439
|
+
};
|
|
3440
|
+
}), o = n.filter((c) => c.packageItem != null && c.amount > 0).reduce((c, E) => {
|
|
3441
|
+
const {
|
|
3442
|
+
packageItem: m,
|
|
3443
|
+
event: O,
|
|
3444
|
+
amount: I,
|
|
3445
|
+
price: A,
|
|
3446
|
+
serviceFee: Y,
|
|
3447
|
+
depositPrice: H,
|
|
3448
|
+
originalPrice: Q
|
|
3449
|
+
} = E, v = m.package.id;
|
|
3450
|
+
c[v] ? (c[v].price += A ?? 0, c[v].serviceFee += Y ?? 0, c[v].originalPrice += Q ?? 0, c[v].depositPrice += H ?? A ?? 0) : c[v] = {
|
|
3451
|
+
id: v,
|
|
3452
|
+
type: k.PACKAGE,
|
|
3453
|
+
name: m.package.name,
|
|
3454
|
+
amount: I,
|
|
3455
|
+
price: A ?? 0,
|
|
3456
|
+
serviceFee: Y ?? 0,
|
|
3457
|
+
depositPrice: H ?? A ?? 0,
|
|
3458
|
+
originalPrice: Q ?? 0,
|
|
3459
|
+
packageItems: []
|
|
3460
|
+
};
|
|
3461
|
+
const Pe = y.fromISO(O.startAt, {
|
|
3462
|
+
zone: O.timezone
|
|
3463
|
+
}), Se = y.fromISO(O.endAt, {
|
|
3464
|
+
zone: O.timezone
|
|
3465
|
+
});
|
|
3466
|
+
return c[v].packageItems.push({
|
|
3467
|
+
packageItemId: m.id,
|
|
3468
|
+
eventId: O.id,
|
|
3469
|
+
name: O.name,
|
|
3470
|
+
startAt: Pe,
|
|
3471
|
+
endAt: Se
|
|
3472
|
+
}), c;
|
|
3473
|
+
}, {}), u = [
|
|
3474
|
+
...s,
|
|
3475
|
+
...Object.values(o)
|
|
3476
|
+
];
|
|
3477
|
+
if (u.length === 0) {
|
|
3478
|
+
this.debugLog("All order items have zero or negative amounts, clearing session"), this.clearOrderFromSession();
|
|
3479
|
+
return;
|
|
3480
|
+
}
|
|
3481
|
+
const l = n.filter((c) => c.amount > 0).map((c) => new Date(c.expiredAt).getTime());
|
|
3482
|
+
if (l.length === 0) {
|
|
3483
|
+
this.debugLog("No valid items with expiration times, clearing session"), this.clearOrderFromSession();
|
|
3484
|
+
return;
|
|
3485
|
+
}
|
|
3486
|
+
const f = y.fromMillis(Math.min(...l));
|
|
3487
|
+
this.store.dispatch(re()), this.store.dispatch(
|
|
3488
|
+
L({
|
|
3489
|
+
id: i.id,
|
|
3490
|
+
currency: i.currency,
|
|
3491
|
+
expiredAt: f
|
|
3492
|
+
})
|
|
3493
|
+
), u.forEach((c) => {
|
|
3494
|
+
c.type === k.PACKAGE ? this.store.dispatch(
|
|
3495
|
+
ee({
|
|
3496
|
+
input: {
|
|
3497
|
+
id: c.id,
|
|
3498
|
+
name: c.name,
|
|
3499
|
+
currency: i.currency,
|
|
3500
|
+
price: c.originalPrice ?? 0,
|
|
3501
|
+
depositPrice: c.depositPrice,
|
|
3502
|
+
serviceFee: c.serviceFee ?? 0,
|
|
3503
|
+
amount: c.amount,
|
|
3504
|
+
items: c.packageItems || []
|
|
3505
|
+
},
|
|
3506
|
+
amountReserved: c.amount,
|
|
3507
|
+
expiredAt: f
|
|
3508
|
+
})
|
|
3509
|
+
) : this.store.dispatch(
|
|
3510
|
+
Z({
|
|
3511
|
+
input: {
|
|
3512
|
+
id: c.id,
|
|
3513
|
+
name: c.name,
|
|
3514
|
+
price: c.originalPrice,
|
|
3515
|
+
depositPrice: c.depositPrice,
|
|
3516
|
+
serviceFee: c.serviceFee,
|
|
3517
|
+
currency: i.currency,
|
|
3518
|
+
amount: c.amount
|
|
3519
|
+
},
|
|
3520
|
+
amountReserved: c.amount,
|
|
3521
|
+
expiredAt: f
|
|
3522
|
+
})
|
|
3523
|
+
);
|
|
3524
|
+
}), i.mainBooker && (this.debugLog("Order has customer (mainBooker)", i.mainBooker), this.store.dispatch(
|
|
3525
|
+
te({
|
|
3526
|
+
firstName: i.mainBooker.firstName ?? void 0,
|
|
3527
|
+
lastName: i.mainBooker.lastName ?? void 0,
|
|
3528
|
+
email: i.mainBooker.email ?? void 0,
|
|
3529
|
+
age: i.mainBooker.age ?? void 0
|
|
3530
|
+
})
|
|
3531
|
+
)), this.debugLog("Order state fully synced", this.getState());
|
|
3532
|
+
} catch (t) {
|
|
3533
|
+
throw this.debugLog("Error fetching order", t), t;
|
|
3534
|
+
}
|
|
3535
|
+
}
|
|
3536
|
+
// Private helper functions
|
|
3537
|
+
generateOrderId() {
|
|
3538
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
|
|
3539
|
+
const t = Math.random() * 16 | 0;
|
|
3540
|
+
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
3541
|
+
});
|
|
3542
|
+
}
|
|
3543
|
+
debugLog(e, t) {
|
|
3544
|
+
this.config.debug && console.log(`[BasketService] ${e}`, t || "");
|
|
3545
|
+
}
|
|
3546
|
+
handleError(e) {
|
|
3547
|
+
const t = e;
|
|
3548
|
+
if (t.graphQLErrors && t.graphQLErrors.length > 0) {
|
|
3549
|
+
const i = t.graphQLErrors[0];
|
|
3550
|
+
i.extensions?.status === "RATE_LIMIT" && console.error("Rate Limit reached"), i.extensions?.status === "SOLD_OUT" && console.error("Product sold out");
|
|
3551
|
+
}
|
|
3552
|
+
if (t.response?.errors && t.response.errors.length > 0) {
|
|
3553
|
+
const i = t.response.errors[0];
|
|
3554
|
+
console.error("GraphQL Error:", i.message), i.extensions?.code && console.error("Error Code:", i.extensions.code);
|
|
3555
|
+
}
|
|
3556
|
+
}
|
|
3557
|
+
getState() {
|
|
3558
|
+
return this.store.getState().basket;
|
|
3559
|
+
}
|
|
3560
|
+
}
|
|
3561
|
+
const Wt = "https://api.ticketapp.com/graphql", ne = "TIC_TRACKER_ID";
|
|
3562
|
+
class rr {
|
|
3563
|
+
basket;
|
|
3564
|
+
event;
|
|
3565
|
+
payment;
|
|
3566
|
+
package;
|
|
3567
|
+
category;
|
|
3568
|
+
// Attach selected public types to the SDK class
|
|
3569
|
+
static Types = $t;
|
|
3570
|
+
constructor(e) {
|
|
3571
|
+
const { organizationId: t, debug: i = !1, apiUrl: n = Wt } = e, s = this.getOrInitTrackerId();
|
|
3572
|
+
this.basket = new be({ debug: i, apiUrl: n, shopId: e.shopId, trackerId: s }), this.event = new fe({ organizationId: t, debug: i, apiUrl: n, trackerId: s }), this.payment = new Ie({ debug: i, apiUrl: n }), this.package = new Ee({ organizationId: t, debug: i, apiUrl: n }), this.category = new ye({ organizationId: t, debug: i, apiUrl: n });
|
|
3573
|
+
}
|
|
3574
|
+
// Resolve tracker id from (in order): explicit config, URL query, or session storage
|
|
3575
|
+
// Persist to session when found via config or URL for subsequent page loads
|
|
3576
|
+
getOrInitTrackerId() {
|
|
3577
|
+
try {
|
|
3578
|
+
let e = null, t = null;
|
|
3579
|
+
if (typeof window < "u") {
|
|
3580
|
+
try {
|
|
3581
|
+
t = new URL(window.location.href).searchParams.get("trackerId");
|
|
3582
|
+
} catch {
|
|
3583
|
+
}
|
|
3584
|
+
try {
|
|
3585
|
+
e = window.sessionStorage?.getItem(ne) ?? null;
|
|
3586
|
+
} catch {
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
if (t && t.trim().length > 0) {
|
|
3590
|
+
try {
|
|
3591
|
+
typeof window < "u" && window.sessionStorage && sessionStorage.setItem(ne, t);
|
|
3592
|
+
} catch {
|
|
3593
|
+
}
|
|
3594
|
+
return t;
|
|
3595
|
+
}
|
|
3596
|
+
return e && e.trim().length > 0 ? e : void 0;
|
|
3597
|
+
} catch {
|
|
3598
|
+
return;
|
|
3599
|
+
}
|
|
3600
|
+
}
|
|
3601
|
+
}
|
|
3602
|
+
export {
|
|
3603
|
+
k as BasketOrderType,
|
|
3604
|
+
be as BasketService,
|
|
3605
|
+
ye as CategoryService,
|
|
3606
|
+
fe as EventService,
|
|
3607
|
+
Te as EventStatus,
|
|
3608
|
+
B as PackageItemType,
|
|
3609
|
+
Ee as PackageService,
|
|
3610
|
+
Ae as PackageStatus,
|
|
3611
|
+
Oe as PackageTabType,
|
|
3612
|
+
xe as PaymentMethodFeeType,
|
|
3613
|
+
Ie as PaymentService,
|
|
3614
|
+
ve as ProductStatus,
|
|
3615
|
+
Ne as ProductType,
|
|
3616
|
+
ke as SortOrder,
|
|
3617
|
+
rr as TicketappSDK
|
|
3618
|
+
};
|