@atlas-kitchen/atlas-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +8 -0
- package/CLAUDE.md +135 -0
- package/README.md +161 -0
- package/dist/auth.d.ts +24 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +78 -0
- package/dist/auth.js.map +1 -0
- package/dist/client.d.ts +22 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +1142 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +83 -0
- package/dist/index.js.map +1 -0
- package/dist/polyfills.d.ts +2 -0
- package/dist/polyfills.d.ts.map +1 -0
- package/dist/tools/auth.d.ts +11 -0
- package/dist/tools/auth.d.ts.map +1 -0
- package/dist/tools/auth.js +155 -0
- package/dist/tools/auth.js.map +1 -0
- package/dist/tools/menu.d.ts +11 -0
- package/dist/tools/menu.d.ts.map +1 -0
- package/dist/tools/menu.js +161 -0
- package/dist/tools/menu.js.map +1 -0
- package/dist/tools/orders.d.ts +11 -0
- package/dist/tools/orders.d.ts.map +1 -0
- package/dist/tools/orders.js +170 -0
- package/dist/tools/orders.js.map +1 -0
- package/dist/tools/reports.d.ts +11 -0
- package/dist/tools/reports.d.ts.map +1 -0
- package/dist/tools/reports.js +151 -0
- package/dist/tools/reports.js.map +1 -0
- package/dist/types/atlas.d.ts +125 -0
- package/dist/types/atlas.d.ts.map +1 -0
- package/dist/types/atlas.js +2 -0
- package/dist/types/atlas.js.map +1 -0
- package/package.json +55 -0
package/dist/client.js
ADDED
|
@@ -0,0 +1,1142 @@
|
|
|
1
|
+
import { GraphQLClient } from 'graphql-request';
|
|
2
|
+
export class AtlasClient {
|
|
3
|
+
restaurantClient;
|
|
4
|
+
accountClient;
|
|
5
|
+
authManager;
|
|
6
|
+
baseUrl;
|
|
7
|
+
constructor(authManager) {
|
|
8
|
+
this.authManager = authManager;
|
|
9
|
+
this.baseUrl = process.env.ATLAS_GRAPHQL_ENDPOINT || 'https://api.atlas.kitchen';
|
|
10
|
+
// Create separate clients for different graph contexts
|
|
11
|
+
this.restaurantClient = new GraphQLClient(`${this.baseUrl}/v1/restaurants/graphql`);
|
|
12
|
+
this.accountClient = new GraphQLClient(`${this.baseUrl}/v1/accounts/graphql`);
|
|
13
|
+
}
|
|
14
|
+
async request(query, variables, context = 'restaurants') {
|
|
15
|
+
const client = context === 'accounts' ? this.accountClient : this.restaurantClient;
|
|
16
|
+
try {
|
|
17
|
+
// Set headers for this request
|
|
18
|
+
const headers = this.authManager.getHeaders();
|
|
19
|
+
return await client.request(query, variables, headers);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
// Handle GraphQL errors
|
|
23
|
+
if (error.response?.errors) {
|
|
24
|
+
const graphqlError = error.response.errors[0];
|
|
25
|
+
throw new Error(`GraphQL Error: ${graphqlError.message}`);
|
|
26
|
+
}
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async login(email, password) {
|
|
31
|
+
const query = `
|
|
32
|
+
mutation AccountLogin($email: String!, $password: String!) {
|
|
33
|
+
accountLogin(input: { email: $email, password: $password }) {
|
|
34
|
+
refreshToken
|
|
35
|
+
accessToken
|
|
36
|
+
account {
|
|
37
|
+
id
|
|
38
|
+
email
|
|
39
|
+
}
|
|
40
|
+
merchants {
|
|
41
|
+
identifier
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
const response = await this.request(query, { email, password }, 'accounts');
|
|
47
|
+
return response.accountLogin;
|
|
48
|
+
}
|
|
49
|
+
async logout() {
|
|
50
|
+
const query = `
|
|
51
|
+
mutation AccountLogout {
|
|
52
|
+
accountLogout {
|
|
53
|
+
success
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
const response = await this.request(query, {}, 'accounts');
|
|
58
|
+
return response.accountLogout;
|
|
59
|
+
}
|
|
60
|
+
async refreshToken(refreshToken) {
|
|
61
|
+
// Temporarily set the refresh token as the access token for this request
|
|
62
|
+
const currentToken = this.authManager.getAccessToken();
|
|
63
|
+
this.authManager.setTokens({ accessToken: refreshToken, refreshToken: refreshToken });
|
|
64
|
+
try {
|
|
65
|
+
const query = `
|
|
66
|
+
mutation GenerateAccessToken {
|
|
67
|
+
accountGenerateAccessToken {
|
|
68
|
+
accessToken
|
|
69
|
+
refreshToken
|
|
70
|
+
account {
|
|
71
|
+
id
|
|
72
|
+
email
|
|
73
|
+
name
|
|
74
|
+
username
|
|
75
|
+
isVerified
|
|
76
|
+
requireSetPassword
|
|
77
|
+
merchants {
|
|
78
|
+
id
|
|
79
|
+
identifier
|
|
80
|
+
name
|
|
81
|
+
}
|
|
82
|
+
merchantAccounts {
|
|
83
|
+
id
|
|
84
|
+
merchantId
|
|
85
|
+
role
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
merchants {
|
|
89
|
+
id
|
|
90
|
+
identifier
|
|
91
|
+
name
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
`;
|
|
96
|
+
const response = await this.request(query, {}, 'accounts');
|
|
97
|
+
return response.accountGenerateAccessToken;
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
// Restore the original token if the refresh failed
|
|
101
|
+
if (currentToken) {
|
|
102
|
+
this.authManager.setTokens({ accessToken: currentToken, refreshToken: refreshToken });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async getOrders(filters = {}) {
|
|
107
|
+
const query = `
|
|
108
|
+
query GetOrders($filter: OrderFilter) {
|
|
109
|
+
allOrders(filter: $filter) {
|
|
110
|
+
totalCount
|
|
111
|
+
page
|
|
112
|
+
perPage
|
|
113
|
+
metadata
|
|
114
|
+
orders {
|
|
115
|
+
state
|
|
116
|
+
identifier
|
|
117
|
+
servingDate
|
|
118
|
+
createdAt
|
|
119
|
+
addressLine1
|
|
120
|
+
addressLine2
|
|
121
|
+
postalCode
|
|
122
|
+
brand {
|
|
123
|
+
label
|
|
124
|
+
}
|
|
125
|
+
timeslotRange
|
|
126
|
+
fulfilmentType
|
|
127
|
+
fulfilmentSubType
|
|
128
|
+
fulfilmentState
|
|
129
|
+
isContactless
|
|
130
|
+
isCutleryRequired
|
|
131
|
+
notes
|
|
132
|
+
paymentBreakdown {
|
|
133
|
+
total
|
|
134
|
+
totalIncludingTax
|
|
135
|
+
tip
|
|
136
|
+
}
|
|
137
|
+
table {
|
|
138
|
+
name
|
|
139
|
+
}
|
|
140
|
+
outlet {
|
|
141
|
+
label
|
|
142
|
+
labelForPickup
|
|
143
|
+
}
|
|
144
|
+
id
|
|
145
|
+
sourceLabel
|
|
146
|
+
servedByName
|
|
147
|
+
externalOrderShortCode
|
|
148
|
+
topLevelItems {
|
|
149
|
+
name
|
|
150
|
+
quantity
|
|
151
|
+
}
|
|
152
|
+
contactName
|
|
153
|
+
contactEmail
|
|
154
|
+
contactNumber
|
|
155
|
+
isGift
|
|
156
|
+
recipientName
|
|
157
|
+
recipientContactNumber
|
|
158
|
+
giftMessage
|
|
159
|
+
currentTrip {
|
|
160
|
+
externalLogisticsId
|
|
161
|
+
externalLogisticsCode
|
|
162
|
+
externalLogisticsType
|
|
163
|
+
merchantLogisticsCost
|
|
164
|
+
}
|
|
165
|
+
orderPayments {
|
|
166
|
+
paymentType {
|
|
167
|
+
label
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
`;
|
|
174
|
+
// Transform filters to match OrderFilter structure
|
|
175
|
+
const filter = {};
|
|
176
|
+
if (filters.startDate || filters.endDate) {
|
|
177
|
+
filter.dateRange = {};
|
|
178
|
+
if (filters.startDate)
|
|
179
|
+
filter.dateRange.startDate = filters.startDate;
|
|
180
|
+
if (filters.endDate)
|
|
181
|
+
filter.dateRange.endDate = filters.endDate;
|
|
182
|
+
}
|
|
183
|
+
if (filters.state)
|
|
184
|
+
filter.state = filters.state;
|
|
185
|
+
if (filters.first)
|
|
186
|
+
filter.perPage = filters.first;
|
|
187
|
+
if (filters.after)
|
|
188
|
+
filter.page = filters.after; // This might need adjustment based on actual cursor structure
|
|
189
|
+
const response = await this.request(query, { filter });
|
|
190
|
+
return response.allOrders;
|
|
191
|
+
}
|
|
192
|
+
async getOrder(orderId) {
|
|
193
|
+
const query = `
|
|
194
|
+
query GetOrder($id: Int!) {
|
|
195
|
+
order(id: $id) {
|
|
196
|
+
id
|
|
197
|
+
identifier
|
|
198
|
+
state
|
|
199
|
+
servingDate
|
|
200
|
+
prepareBy
|
|
201
|
+
isContactless
|
|
202
|
+
isCutleryRequired
|
|
203
|
+
fulfilmentType
|
|
204
|
+
fulfilmentSubType
|
|
205
|
+
fulfilmentState
|
|
206
|
+
notes
|
|
207
|
+
buzzerIdentifier
|
|
208
|
+
chargeId
|
|
209
|
+
stripeAccountId
|
|
210
|
+
isAdyenEnabled
|
|
211
|
+
sourceLabel
|
|
212
|
+
externalOrderShortCode
|
|
213
|
+
contactName
|
|
214
|
+
contactNumber
|
|
215
|
+
contactEmail
|
|
216
|
+
contactAccessCode
|
|
217
|
+
isGift
|
|
218
|
+
recipientName
|
|
219
|
+
recipientContactNumber
|
|
220
|
+
giftMessage
|
|
221
|
+
promoCode
|
|
222
|
+
stationId
|
|
223
|
+
isPostTaxDiscount
|
|
224
|
+
recipientOrganisationName
|
|
225
|
+
invoices {
|
|
226
|
+
id
|
|
227
|
+
paymentStatus
|
|
228
|
+
totalPaid
|
|
229
|
+
totalRefunded
|
|
230
|
+
amountOutstanding
|
|
231
|
+
invoicePayments {
|
|
232
|
+
id
|
|
233
|
+
createdAt
|
|
234
|
+
amount
|
|
235
|
+
paymentType {
|
|
236
|
+
label
|
|
237
|
+
}
|
|
238
|
+
reference
|
|
239
|
+
referenceType
|
|
240
|
+
notes
|
|
241
|
+
invoicePaymentRefunds {
|
|
242
|
+
id
|
|
243
|
+
createdAt
|
|
244
|
+
amount
|
|
245
|
+
reason
|
|
246
|
+
reference
|
|
247
|
+
referenceType
|
|
248
|
+
paymentType {
|
|
249
|
+
label
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
pointProgram {
|
|
255
|
+
currencyNames
|
|
256
|
+
isCustomCurrency
|
|
257
|
+
label
|
|
258
|
+
type
|
|
259
|
+
}
|
|
260
|
+
promotion {
|
|
261
|
+
id
|
|
262
|
+
type
|
|
263
|
+
label
|
|
264
|
+
description
|
|
265
|
+
valueType
|
|
266
|
+
}
|
|
267
|
+
orderDiscounts {
|
|
268
|
+
id
|
|
269
|
+
discountType
|
|
270
|
+
value
|
|
271
|
+
quantity
|
|
272
|
+
reason
|
|
273
|
+
promoCode
|
|
274
|
+
targetType
|
|
275
|
+
sourceType
|
|
276
|
+
sourceId
|
|
277
|
+
}
|
|
278
|
+
createdAt
|
|
279
|
+
externalOrderedAt
|
|
280
|
+
payAtStation
|
|
281
|
+
serveByOverride
|
|
282
|
+
servedByName
|
|
283
|
+
table {
|
|
284
|
+
name
|
|
285
|
+
}
|
|
286
|
+
address {
|
|
287
|
+
id
|
|
288
|
+
line1
|
|
289
|
+
line2
|
|
290
|
+
postalCode
|
|
291
|
+
notes
|
|
292
|
+
}
|
|
293
|
+
brand {
|
|
294
|
+
label
|
|
295
|
+
}
|
|
296
|
+
timeslotId
|
|
297
|
+
timeslotType
|
|
298
|
+
timeslotRange
|
|
299
|
+
currentTrip {
|
|
300
|
+
externalLogisticsId
|
|
301
|
+
externalLogisticsCode
|
|
302
|
+
externalLogisticsType
|
|
303
|
+
externalLogisticsTrackingUrl
|
|
304
|
+
isCancelled
|
|
305
|
+
logisticsDriverInfo
|
|
306
|
+
logisticsStatus
|
|
307
|
+
}
|
|
308
|
+
topLevelItems {
|
|
309
|
+
id
|
|
310
|
+
name
|
|
311
|
+
quantity
|
|
312
|
+
notes
|
|
313
|
+
subtotal
|
|
314
|
+
itemModifierGroupId
|
|
315
|
+
paid
|
|
316
|
+
amountPaid
|
|
317
|
+
discount
|
|
318
|
+
refunds
|
|
319
|
+
refundableAmount
|
|
320
|
+
unitPriceFractional
|
|
321
|
+
unitLabel
|
|
322
|
+
customIdentifier
|
|
323
|
+
item {
|
|
324
|
+
id
|
|
325
|
+
isConfigurable
|
|
326
|
+
idBreadcrumb
|
|
327
|
+
horizontalImageUrl
|
|
328
|
+
}
|
|
329
|
+
isOpenItem
|
|
330
|
+
adjustmentReason {
|
|
331
|
+
id
|
|
332
|
+
label
|
|
333
|
+
}
|
|
334
|
+
sortedSubItems {
|
|
335
|
+
id
|
|
336
|
+
idBreadcrumb
|
|
337
|
+
label
|
|
338
|
+
subItems {
|
|
339
|
+
id
|
|
340
|
+
name
|
|
341
|
+
quantity
|
|
342
|
+
subtotal
|
|
343
|
+
unitLabel
|
|
344
|
+
customIdentifier
|
|
345
|
+
item {
|
|
346
|
+
id
|
|
347
|
+
isConfigurable
|
|
348
|
+
idBreadcrumb
|
|
349
|
+
horizontalImageUrl
|
|
350
|
+
}
|
|
351
|
+
adjustmentReason {
|
|
352
|
+
id
|
|
353
|
+
label
|
|
354
|
+
}
|
|
355
|
+
sortedSubItems {
|
|
356
|
+
id
|
|
357
|
+
idBreadcrumb
|
|
358
|
+
label
|
|
359
|
+
subItems {
|
|
360
|
+
id
|
|
361
|
+
name
|
|
362
|
+
quantity
|
|
363
|
+
subtotal
|
|
364
|
+
unitLabel
|
|
365
|
+
customIdentifier
|
|
366
|
+
item {
|
|
367
|
+
id
|
|
368
|
+
isConfigurable
|
|
369
|
+
idBreadcrumb
|
|
370
|
+
horizontalImageUrl
|
|
371
|
+
}
|
|
372
|
+
adjustmentReason {
|
|
373
|
+
id
|
|
374
|
+
label
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
subItems {
|
|
381
|
+
id
|
|
382
|
+
modifierId
|
|
383
|
+
itemModifierGroupId
|
|
384
|
+
name
|
|
385
|
+
quantity
|
|
386
|
+
subtotal
|
|
387
|
+
unitLabel
|
|
388
|
+
perUnitQuantity
|
|
389
|
+
customIdentifier
|
|
390
|
+
adjustmentReason {
|
|
391
|
+
id
|
|
392
|
+
label
|
|
393
|
+
}
|
|
394
|
+
unitPriceFractional
|
|
395
|
+
subItems {
|
|
396
|
+
id
|
|
397
|
+
modifierId
|
|
398
|
+
itemModifierGroupId
|
|
399
|
+
name
|
|
400
|
+
quantity
|
|
401
|
+
subtotal
|
|
402
|
+
unitLabel
|
|
403
|
+
perUnitQuantity
|
|
404
|
+
customIdentifier
|
|
405
|
+
adjustmentReason {
|
|
406
|
+
id
|
|
407
|
+
label
|
|
408
|
+
}
|
|
409
|
+
unitPriceFractional
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
appliedDiscounts {
|
|
413
|
+
id
|
|
414
|
+
value
|
|
415
|
+
percentValue
|
|
416
|
+
quantity
|
|
417
|
+
reason
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
user {
|
|
421
|
+
id
|
|
422
|
+
userId
|
|
423
|
+
name
|
|
424
|
+
email
|
|
425
|
+
mobileNumber
|
|
426
|
+
isGuest
|
|
427
|
+
addresses {
|
|
428
|
+
id
|
|
429
|
+
line1
|
|
430
|
+
line2
|
|
431
|
+
nearestOutlet {
|
|
432
|
+
id
|
|
433
|
+
label
|
|
434
|
+
labelForPickup
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
outlet {
|
|
439
|
+
id
|
|
440
|
+
label
|
|
441
|
+
labelForPickup
|
|
442
|
+
useAutoBookLogistics
|
|
443
|
+
stations {
|
|
444
|
+
id
|
|
445
|
+
name
|
|
446
|
+
posEnabled
|
|
447
|
+
printers {
|
|
448
|
+
id
|
|
449
|
+
name
|
|
450
|
+
}
|
|
451
|
+
paymentTerminals {
|
|
452
|
+
id
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
paymentBreakdown {
|
|
457
|
+
subtotal
|
|
458
|
+
merchantTotalIncludingTax
|
|
459
|
+
merchantTax
|
|
460
|
+
totalIncludingTax
|
|
461
|
+
tax
|
|
462
|
+
taxInclusivePrices
|
|
463
|
+
cashVouchersAmount
|
|
464
|
+
surcharge
|
|
465
|
+
surchargeLabel
|
|
466
|
+
serviceCharge
|
|
467
|
+
serviceChargeDiscount
|
|
468
|
+
donationAmount
|
|
469
|
+
donationLabel
|
|
470
|
+
pointsAmount
|
|
471
|
+
pointsValue
|
|
472
|
+
tip
|
|
473
|
+
discount
|
|
474
|
+
platformDiscount
|
|
475
|
+
adminDiscount
|
|
476
|
+
deliveryFee
|
|
477
|
+
platformDeliveryFee
|
|
478
|
+
amountUnpaid
|
|
479
|
+
rounding
|
|
480
|
+
}
|
|
481
|
+
minimumVehicleType
|
|
482
|
+
minimumVehicleTypeItemLabel
|
|
483
|
+
minimumVehicleTypeOrderValue
|
|
484
|
+
paymentLinkId
|
|
485
|
+
paymentLinkUrl
|
|
486
|
+
paymentTypeId
|
|
487
|
+
paymentTypeLabel
|
|
488
|
+
paymentType {
|
|
489
|
+
id
|
|
490
|
+
label
|
|
491
|
+
subType
|
|
492
|
+
paymentTypeImageUrl
|
|
493
|
+
paymentMethodId
|
|
494
|
+
}
|
|
495
|
+
cart {
|
|
496
|
+
id
|
|
497
|
+
bills {
|
|
498
|
+
id
|
|
499
|
+
capturedAt
|
|
500
|
+
total
|
|
501
|
+
paymentType {
|
|
502
|
+
id
|
|
503
|
+
label
|
|
504
|
+
subType
|
|
505
|
+
paymentTypeImageUrl
|
|
506
|
+
paymentMethodId
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
capturedAmount
|
|
510
|
+
uncapturedAmount
|
|
511
|
+
cartCashVouchers {
|
|
512
|
+
id
|
|
513
|
+
quantity
|
|
514
|
+
voucherReference
|
|
515
|
+
cashVoucher {
|
|
516
|
+
id
|
|
517
|
+
label
|
|
518
|
+
value
|
|
519
|
+
code
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
orderPayments {
|
|
524
|
+
id
|
|
525
|
+
amount
|
|
526
|
+
tip
|
|
527
|
+
isCaptured
|
|
528
|
+
captureId
|
|
529
|
+
paymentType {
|
|
530
|
+
id
|
|
531
|
+
label
|
|
532
|
+
subType
|
|
533
|
+
paymentTypeImageUrl
|
|
534
|
+
paymentMethodId
|
|
535
|
+
}
|
|
536
|
+
cardLast4
|
|
537
|
+
orderRefunds {
|
|
538
|
+
id
|
|
539
|
+
type
|
|
540
|
+
amount
|
|
541
|
+
reason
|
|
542
|
+
isSuccessful
|
|
543
|
+
responseReason
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
`;
|
|
549
|
+
// Convert string ID to integer if needed
|
|
550
|
+
const id = parseInt(orderId, 10);
|
|
551
|
+
const response = await this.request(query, { id });
|
|
552
|
+
return response.order;
|
|
553
|
+
}
|
|
554
|
+
async getCart(cartId) {
|
|
555
|
+
const query = `
|
|
556
|
+
query GetPosCartOptimised($cartId: Int!) {
|
|
557
|
+
getPosCartOptimised(cartId: $cartId) {
|
|
558
|
+
id
|
|
559
|
+
archived
|
|
560
|
+
isCheckedOut
|
|
561
|
+
promoCode
|
|
562
|
+
promoCodeError
|
|
563
|
+
platform
|
|
564
|
+
payAtStation
|
|
565
|
+
posUserValidated
|
|
566
|
+
promotion {
|
|
567
|
+
id
|
|
568
|
+
type
|
|
569
|
+
label
|
|
570
|
+
description
|
|
571
|
+
value
|
|
572
|
+
valueType
|
|
573
|
+
}
|
|
574
|
+
cartDiscounts {
|
|
575
|
+
id
|
|
576
|
+
discountType
|
|
577
|
+
value
|
|
578
|
+
quantity
|
|
579
|
+
reason
|
|
580
|
+
promoCode
|
|
581
|
+
targetType
|
|
582
|
+
sourceType
|
|
583
|
+
sourceId
|
|
584
|
+
}
|
|
585
|
+
cartCashVouchers {
|
|
586
|
+
id
|
|
587
|
+
cashVoucherId
|
|
588
|
+
voucherReference
|
|
589
|
+
quantity
|
|
590
|
+
cashVoucher {
|
|
591
|
+
id
|
|
592
|
+
code
|
|
593
|
+
value
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
cashVouchers {
|
|
597
|
+
id
|
|
598
|
+
code
|
|
599
|
+
value
|
|
600
|
+
}
|
|
601
|
+
donationId
|
|
602
|
+
isPostTaxDiscount
|
|
603
|
+
serviceChargeable
|
|
604
|
+
paymentBreakdown {
|
|
605
|
+
deliveryFee
|
|
606
|
+
surcharge
|
|
607
|
+
surchargeLabel
|
|
608
|
+
discount
|
|
609
|
+
donationAmount
|
|
610
|
+
cashVouchersAmount
|
|
611
|
+
tax
|
|
612
|
+
subtotal
|
|
613
|
+
serviceCharge
|
|
614
|
+
serviceChargeDiscount
|
|
615
|
+
totalIncludingTax
|
|
616
|
+
taxInclusivePrices
|
|
617
|
+
rounding
|
|
618
|
+
cashRounding
|
|
619
|
+
pointsValue
|
|
620
|
+
pointsAmount
|
|
621
|
+
usePoints
|
|
622
|
+
}
|
|
623
|
+
notes
|
|
624
|
+
buzzerIdentifier
|
|
625
|
+
userId
|
|
626
|
+
user {
|
|
627
|
+
id
|
|
628
|
+
userId
|
|
629
|
+
name
|
|
630
|
+
email
|
|
631
|
+
mobileNumber
|
|
632
|
+
isGuest
|
|
633
|
+
}
|
|
634
|
+
pax
|
|
635
|
+
paxKids
|
|
636
|
+
paymentTypeId
|
|
637
|
+
paymentTypeLabel
|
|
638
|
+
lastBilledAt
|
|
639
|
+
topLevelItems {
|
|
640
|
+
id
|
|
641
|
+
name
|
|
642
|
+
quantity
|
|
643
|
+
notes
|
|
644
|
+
subtotal
|
|
645
|
+
serviceChargeable
|
|
646
|
+
itemModifierGroupId
|
|
647
|
+
sentAt
|
|
648
|
+
unitLabel
|
|
649
|
+
customIdentifier
|
|
650
|
+
seatId
|
|
651
|
+
cartItemGroup {
|
|
652
|
+
id
|
|
653
|
+
label
|
|
654
|
+
createdAt
|
|
655
|
+
groupType
|
|
656
|
+
}
|
|
657
|
+
adjustmentReason {
|
|
658
|
+
id
|
|
659
|
+
label
|
|
660
|
+
}
|
|
661
|
+
appliedDiscounts {
|
|
662
|
+
id
|
|
663
|
+
value
|
|
664
|
+
percentValue
|
|
665
|
+
quantity
|
|
666
|
+
reason
|
|
667
|
+
sourceType
|
|
668
|
+
sourceId
|
|
669
|
+
}
|
|
670
|
+
itemId
|
|
671
|
+
item {
|
|
672
|
+
id
|
|
673
|
+
idBreadcrumb
|
|
674
|
+
horizontalImageUrl
|
|
675
|
+
}
|
|
676
|
+
isOpenItem
|
|
677
|
+
sortedSubItems {
|
|
678
|
+
idBreadcrumb
|
|
679
|
+
label
|
|
680
|
+
subItems {
|
|
681
|
+
id
|
|
682
|
+
itemId
|
|
683
|
+
name
|
|
684
|
+
notes
|
|
685
|
+
quantity
|
|
686
|
+
subtotal
|
|
687
|
+
unitLabel
|
|
688
|
+
customIdentifier
|
|
689
|
+
adjustmentReason {
|
|
690
|
+
id
|
|
691
|
+
label
|
|
692
|
+
}
|
|
693
|
+
sortedSubItems {
|
|
694
|
+
idBreadcrumb
|
|
695
|
+
label
|
|
696
|
+
subItems {
|
|
697
|
+
id
|
|
698
|
+
itemId
|
|
699
|
+
name
|
|
700
|
+
notes
|
|
701
|
+
quantity
|
|
702
|
+
subtotal
|
|
703
|
+
unitLabel
|
|
704
|
+
customIdentifier
|
|
705
|
+
adjustmentReason {
|
|
706
|
+
id
|
|
707
|
+
label
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
subItems {
|
|
714
|
+
id
|
|
715
|
+
itemId
|
|
716
|
+
modifierId
|
|
717
|
+
itemModifierGroupId
|
|
718
|
+
name
|
|
719
|
+
notes
|
|
720
|
+
quantity
|
|
721
|
+
subtotal
|
|
722
|
+
unitLabel
|
|
723
|
+
customIdentifier
|
|
724
|
+
adjustmentReason {
|
|
725
|
+
id
|
|
726
|
+
label
|
|
727
|
+
}
|
|
728
|
+
subItems {
|
|
729
|
+
id
|
|
730
|
+
itemId
|
|
731
|
+
modifierId
|
|
732
|
+
itemModifierGroupId
|
|
733
|
+
name
|
|
734
|
+
notes
|
|
735
|
+
quantity
|
|
736
|
+
subtotal
|
|
737
|
+
unitLabel
|
|
738
|
+
customIdentifier
|
|
739
|
+
adjustmentReason {
|
|
740
|
+
id
|
|
741
|
+
label
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
qrHash
|
|
747
|
+
tableId
|
|
748
|
+
tableName
|
|
749
|
+
fulfilmentType
|
|
750
|
+
outletId
|
|
751
|
+
servingDate
|
|
752
|
+
timeslotType
|
|
753
|
+
timeslot {
|
|
754
|
+
id
|
|
755
|
+
rangeLabel
|
|
756
|
+
}
|
|
757
|
+
address {
|
|
758
|
+
id
|
|
759
|
+
line1
|
|
760
|
+
line2
|
|
761
|
+
postalCode
|
|
762
|
+
notes
|
|
763
|
+
}
|
|
764
|
+
hasUnsentItems
|
|
765
|
+
hasSentItems
|
|
766
|
+
hasHeldItems
|
|
767
|
+
bills {
|
|
768
|
+
id
|
|
769
|
+
billItemsCount
|
|
770
|
+
capturedAt
|
|
771
|
+
discount
|
|
772
|
+
donation
|
|
773
|
+
paymentTypeId
|
|
774
|
+
paymentType {
|
|
775
|
+
id
|
|
776
|
+
label
|
|
777
|
+
}
|
|
778
|
+
tax
|
|
779
|
+
total
|
|
780
|
+
type
|
|
781
|
+
billItems {
|
|
782
|
+
id
|
|
783
|
+
cartItemId
|
|
784
|
+
cartItem {
|
|
785
|
+
id
|
|
786
|
+
name
|
|
787
|
+
quantity
|
|
788
|
+
notes
|
|
789
|
+
}
|
|
790
|
+
quantity
|
|
791
|
+
total
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
capturedAmount
|
|
795
|
+
uncapturedAmount
|
|
796
|
+
splitAmount
|
|
797
|
+
unsplitAmount
|
|
798
|
+
uncapturedCartItems {
|
|
799
|
+
id
|
|
800
|
+
name
|
|
801
|
+
quantity
|
|
802
|
+
subtotal
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
`;
|
|
807
|
+
// Convert string ID to integer if needed
|
|
808
|
+
const id = parseInt(cartId, 10);
|
|
809
|
+
const response = await this.request(query, { cartId: id });
|
|
810
|
+
return response.getPosCartOptimised;
|
|
811
|
+
}
|
|
812
|
+
async getOpenPosCarts() {
|
|
813
|
+
const query = `
|
|
814
|
+
query GetOpenPosCarts {
|
|
815
|
+
allOpenPosCarts {
|
|
816
|
+
id
|
|
817
|
+
paymentTypeId
|
|
818
|
+
paymentTypeLabel
|
|
819
|
+
platform
|
|
820
|
+
payAtStation
|
|
821
|
+
buzzerIdentifier
|
|
822
|
+
fulfilmentType
|
|
823
|
+
tableId
|
|
824
|
+
tableName
|
|
825
|
+
hasUnsentItems
|
|
826
|
+
lastBilledAt
|
|
827
|
+
hasSentItems
|
|
828
|
+
hasHeldItems
|
|
829
|
+
notes
|
|
830
|
+
pax
|
|
831
|
+
paxKids
|
|
832
|
+
createdAt
|
|
833
|
+
subtotal
|
|
834
|
+
user {
|
|
835
|
+
id
|
|
836
|
+
name
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
`;
|
|
841
|
+
const response = await this.request(query);
|
|
842
|
+
return response.allOpenPosCarts;
|
|
843
|
+
}
|
|
844
|
+
async getMenus(outletId, servingDate, timeslotType) {
|
|
845
|
+
const query = `
|
|
846
|
+
query GetMenus($outletId: Int, $servingDate: ISO8601Date, $timeslotType: String) {
|
|
847
|
+
menus(outletId: $outletId, servingDate: $servingDate, timeslotType: $timeslotType) {
|
|
848
|
+
id
|
|
849
|
+
state
|
|
850
|
+
label
|
|
851
|
+
identifier
|
|
852
|
+
startDate
|
|
853
|
+
endDate
|
|
854
|
+
createdAt
|
|
855
|
+
updatedAt
|
|
856
|
+
brandId
|
|
857
|
+
tagList
|
|
858
|
+
imageUrl
|
|
859
|
+
brand {
|
|
860
|
+
label
|
|
861
|
+
}
|
|
862
|
+
outletBrands {
|
|
863
|
+
outletId
|
|
864
|
+
brandId
|
|
865
|
+
grabFoodMerchantId
|
|
866
|
+
foodpandaMerchantId
|
|
867
|
+
}
|
|
868
|
+
brandOutletMenus {
|
|
869
|
+
outletId
|
|
870
|
+
brandId
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
`;
|
|
875
|
+
const response = await this.request(query, { outletId, servingDate, timeslotType });
|
|
876
|
+
return response.menus;
|
|
877
|
+
}
|
|
878
|
+
async getOptimizedMenus(outletId, servingDate) {
|
|
879
|
+
const query = `
|
|
880
|
+
query GetOptimisedMenus($outletId: Int!, $servingDate: ISO8601Date!) {
|
|
881
|
+
menusOptimised(outletId: $outletId, servingDate: $servingDate) {
|
|
882
|
+
id
|
|
883
|
+
label
|
|
884
|
+
startDate
|
|
885
|
+
endDate
|
|
886
|
+
sections {
|
|
887
|
+
id
|
|
888
|
+
label
|
|
889
|
+
description
|
|
890
|
+
displayOrder
|
|
891
|
+
items {
|
|
892
|
+
id
|
|
893
|
+
label
|
|
894
|
+
description
|
|
895
|
+
displayOrder
|
|
896
|
+
unitPriceFractional
|
|
897
|
+
currency
|
|
898
|
+
isConfigurable
|
|
899
|
+
horizontalImageUrl
|
|
900
|
+
idBreadcrumb
|
|
901
|
+
modifierGroups {
|
|
902
|
+
id
|
|
903
|
+
label
|
|
904
|
+
selectionRequiredMin
|
|
905
|
+
selectionRequiredMax
|
|
906
|
+
displayOrder
|
|
907
|
+
isFixed
|
|
908
|
+
maxQuantityPerModifier
|
|
909
|
+
idBreadcrumb
|
|
910
|
+
modifiers {
|
|
911
|
+
id
|
|
912
|
+
label
|
|
913
|
+
description
|
|
914
|
+
displayOrder
|
|
915
|
+
itemId
|
|
916
|
+
unitPriceFractional
|
|
917
|
+
currency
|
|
918
|
+
isConfigurable
|
|
919
|
+
horizontalImageUrl
|
|
920
|
+
idBreadcrumb
|
|
921
|
+
defaultQuantity
|
|
922
|
+
unitLabel
|
|
923
|
+
perUnitQuantity
|
|
924
|
+
modifierGroups {
|
|
925
|
+
id
|
|
926
|
+
label
|
|
927
|
+
selectionRequiredMin
|
|
928
|
+
selectionRequiredMax
|
|
929
|
+
displayOrder
|
|
930
|
+
isFixed
|
|
931
|
+
maxQuantityPerModifier
|
|
932
|
+
idBreadcrumb
|
|
933
|
+
modifiers {
|
|
934
|
+
id
|
|
935
|
+
label
|
|
936
|
+
description
|
|
937
|
+
displayOrder
|
|
938
|
+
itemId
|
|
939
|
+
unitPriceFractional
|
|
940
|
+
currency
|
|
941
|
+
isConfigurable
|
|
942
|
+
horizontalImageUrl
|
|
943
|
+
idBreadcrumb
|
|
944
|
+
defaultQuantity
|
|
945
|
+
unitLabel
|
|
946
|
+
perUnitQuantity
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
subSections {
|
|
953
|
+
id
|
|
954
|
+
label
|
|
955
|
+
description
|
|
956
|
+
displayOrder
|
|
957
|
+
items {
|
|
958
|
+
id
|
|
959
|
+
label
|
|
960
|
+
description
|
|
961
|
+
displayOrder
|
|
962
|
+
unitPriceFractional
|
|
963
|
+
currency
|
|
964
|
+
isConfigurable
|
|
965
|
+
horizontalImageUrl
|
|
966
|
+
idBreadcrumb
|
|
967
|
+
modifierGroups {
|
|
968
|
+
id
|
|
969
|
+
label
|
|
970
|
+
selectionRequiredMin
|
|
971
|
+
selectionRequiredMax
|
|
972
|
+
displayOrder
|
|
973
|
+
isFixed
|
|
974
|
+
maxQuantityPerModifier
|
|
975
|
+
idBreadcrumb
|
|
976
|
+
modifiers {
|
|
977
|
+
id
|
|
978
|
+
label
|
|
979
|
+
description
|
|
980
|
+
displayOrder
|
|
981
|
+
itemId
|
|
982
|
+
unitPriceFractional
|
|
983
|
+
currency
|
|
984
|
+
isConfigurable
|
|
985
|
+
horizontalImageUrl
|
|
986
|
+
idBreadcrumb
|
|
987
|
+
defaultQuantity
|
|
988
|
+
unitLabel
|
|
989
|
+
perUnitQuantity
|
|
990
|
+
modifierGroups {
|
|
991
|
+
id
|
|
992
|
+
label
|
|
993
|
+
selectionRequiredMin
|
|
994
|
+
selectionRequiredMax
|
|
995
|
+
displayOrder
|
|
996
|
+
isFixed
|
|
997
|
+
maxQuantityPerModifier
|
|
998
|
+
idBreadcrumb
|
|
999
|
+
modifiers {
|
|
1000
|
+
id
|
|
1001
|
+
label
|
|
1002
|
+
description
|
|
1003
|
+
displayOrder
|
|
1004
|
+
itemId
|
|
1005
|
+
unitPriceFractional
|
|
1006
|
+
currency
|
|
1007
|
+
isConfigurable
|
|
1008
|
+
horizontalImageUrl
|
|
1009
|
+
idBreadcrumb
|
|
1010
|
+
defaultQuantity
|
|
1011
|
+
unitLabel
|
|
1012
|
+
perUnitQuantity
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
`;
|
|
1023
|
+
const response = await this.request(query, { outletId, servingDate });
|
|
1024
|
+
return response.menusOptimised;
|
|
1025
|
+
}
|
|
1026
|
+
async getItems(filter) {
|
|
1027
|
+
const query = `
|
|
1028
|
+
query GetItems($filter: ItemFilter) {
|
|
1029
|
+
allItems(filter: $filter) {
|
|
1030
|
+
totalCount
|
|
1031
|
+
page
|
|
1032
|
+
perPage
|
|
1033
|
+
items {
|
|
1034
|
+
id
|
|
1035
|
+
type
|
|
1036
|
+
archivedAt
|
|
1037
|
+
identifier
|
|
1038
|
+
label
|
|
1039
|
+
internalLabel
|
|
1040
|
+
description
|
|
1041
|
+
unitPriceFractional
|
|
1042
|
+
unitCostFractional
|
|
1043
|
+
unitLabel
|
|
1044
|
+
perUnitQuantity
|
|
1045
|
+
currency
|
|
1046
|
+
serviceChargeable
|
|
1047
|
+
isConfigurable
|
|
1048
|
+
horizontalImageUrl
|
|
1049
|
+
brandId
|
|
1050
|
+
kitchenTagList
|
|
1051
|
+
tagList
|
|
1052
|
+
reportCategory
|
|
1053
|
+
promotionalLabelText
|
|
1054
|
+
promotionalLabelFontColor
|
|
1055
|
+
promotionalLabelBgColor
|
|
1056
|
+
availabilityConditionGroups {
|
|
1057
|
+
id
|
|
1058
|
+
startDate
|
|
1059
|
+
endDate
|
|
1060
|
+
hidden
|
|
1061
|
+
disabledReason
|
|
1062
|
+
availableByDefault
|
|
1063
|
+
availabilityConditions {
|
|
1064
|
+
id
|
|
1065
|
+
outletIds
|
|
1066
|
+
daysOfWeek
|
|
1067
|
+
fulfilmentTypes
|
|
1068
|
+
startTime
|
|
1069
|
+
endTime
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
`;
|
|
1076
|
+
const response = await this.request(query, { filter });
|
|
1077
|
+
return response.allItems;
|
|
1078
|
+
}
|
|
1079
|
+
async getSalesReport(filters, dateRange) {
|
|
1080
|
+
const query = `
|
|
1081
|
+
query GetSalesSummaryReport($filters: ReportFilter, $dateRange: DateRange, $dateRangeType: DateRangeField) {
|
|
1082
|
+
getSalesSummaryReport(filters: $filters, dateRange: $dateRange, dateRangeType: $dateRangeType) {
|
|
1083
|
+
metadata
|
|
1084
|
+
salesSummary
|
|
1085
|
+
netSalesByDay
|
|
1086
|
+
netSalesByHour
|
|
1087
|
+
paymentSummary
|
|
1088
|
+
underpaymentSummary
|
|
1089
|
+
outletSummary
|
|
1090
|
+
diningOptionSummary
|
|
1091
|
+
tableSummary
|
|
1092
|
+
orderSourceSummary
|
|
1093
|
+
promotionSummary
|
|
1094
|
+
brandSummary
|
|
1095
|
+
salesCategorySummary
|
|
1096
|
+
shiftSummary
|
|
1097
|
+
tipSummary
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
`;
|
|
1101
|
+
const response = await this.request(query, { filters, dateRange, dateRangeType: "ORDER_SERVING_DATE" });
|
|
1102
|
+
return response.getSalesSummaryReport;
|
|
1103
|
+
}
|
|
1104
|
+
async getProductInsights(params) {
|
|
1105
|
+
const query = `
|
|
1106
|
+
query GetProductInsights(
|
|
1107
|
+
$brandIds: [Int!]!
|
|
1108
|
+
$outletIds: [Int!]!
|
|
1109
|
+
$itemTypes: [String!]!
|
|
1110
|
+
$fulfilmentTypes: [String!]!
|
|
1111
|
+
$servingDateBetween: DateRange!
|
|
1112
|
+
$sources: [String!]
|
|
1113
|
+
$itemTagIds: [Int!]
|
|
1114
|
+
$searchQuery: String
|
|
1115
|
+
$itemsToVisualize: [String!]
|
|
1116
|
+
) {
|
|
1117
|
+
getProductInsights(
|
|
1118
|
+
brandIds: $brandIds
|
|
1119
|
+
outletIds: $outletIds
|
|
1120
|
+
itemTypes: $itemTypes
|
|
1121
|
+
fulfilmentTypes: $fulfilmentTypes
|
|
1122
|
+
servingDateBetween: $servingDateBetween
|
|
1123
|
+
sources: $sources
|
|
1124
|
+
itemTagIds: $itemTagIds
|
|
1125
|
+
searchQuery: $searchQuery
|
|
1126
|
+
itemsToVisualize: $itemsToVisualize
|
|
1127
|
+
) {
|
|
1128
|
+
top20ProductsByCount
|
|
1129
|
+
top20ProductsBySales
|
|
1130
|
+
bottom20ProductsByCount
|
|
1131
|
+
bottom20ProductsBySales
|
|
1132
|
+
allItemsByPopularity
|
|
1133
|
+
allProductsPurchased
|
|
1134
|
+
rawData
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
`;
|
|
1138
|
+
const response = await this.request(query, params);
|
|
1139
|
+
return response.getProductInsights;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
//# sourceMappingURL=client.js.map
|