@scryme/sdk 10.1.41 → 10.1.42

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/server.mjs CHANGED
@@ -1,7 +1,3008 @@
1
- import {
2
- ScrymeServerSDK,
3
- createServerSDK
4
- } from "./chunk-TNAWGB5N.mjs";
1
+ // src/server.ts
2
+ import axios2 from "axios";
3
+
4
+ // src/generated/scryme.ts
5
+ import axios from "axios";
6
+ var getScrymeV3API = (axiosInstance = axios) => {
7
+ const servicesCreateCategory = (orgSlug, createServiceCategoryDto, options) => {
8
+ return axiosInstance.post(
9
+ `/v3/${orgSlug}/services/categories`,
10
+ createServiceCategoryDto,
11
+ options
12
+ );
13
+ };
14
+ const servicesGetCategories = (orgSlug, options) => {
15
+ return axiosInstance.get(
16
+ `/v3/${orgSlug}/services/categories`,
17
+ options
18
+ );
19
+ };
20
+ const servicesUpdateCategory = (orgSlug, id, updateServiceCategoryDto, options) => {
21
+ return axiosInstance.patch(
22
+ `/v3/${orgSlug}/services/categories/${id}`,
23
+ updateServiceCategoryDto,
24
+ options
25
+ );
26
+ };
27
+ const servicesDeleteCategory = (orgSlug, id, options) => {
28
+ return axiosInstance.post(
29
+ `/v3/${orgSlug}/services/categories/${id}/delete`,
30
+ void 0,
31
+ options
32
+ );
33
+ };
34
+ const servicesCreateService = (orgSlug, createServiceDto, options) => {
35
+ return axiosInstance.post(
36
+ `/v3/${orgSlug}/services`,
37
+ createServiceDto,
38
+ options
39
+ );
40
+ };
41
+ const servicesGetServices = (orgSlug, options) => {
42
+ return axiosInstance.get(
43
+ `/v3/${orgSlug}/services`,
44
+ options
45
+ );
46
+ };
47
+ const servicesGetCurrentMemberShifts = (orgSlug, options) => {
48
+ return axiosInstance.get(
49
+ `/v3/${orgSlug}/services/shifts/me`,
50
+ options
51
+ );
52
+ };
53
+ const servicesGetShifts = (orgSlug, params, options) => {
54
+ return axiosInstance.get(
55
+ `/v3/${orgSlug}/services/shifts`,
56
+ {
57
+ ...options,
58
+ params: { ...params, ...options?.params }
59
+ }
60
+ );
61
+ };
62
+ const servicesGetService = (orgSlug, id, options) => {
63
+ return axiosInstance.get(
64
+ `/v3/${orgSlug}/services/${id}`,
65
+ options
66
+ );
67
+ };
68
+ const servicesUpdateService = (orgSlug, id, updateServiceDto, options) => {
69
+ return axiosInstance.patch(
70
+ `/v3/${orgSlug}/services/${id}`,
71
+ updateServiceDto,
72
+ options
73
+ );
74
+ };
75
+ const servicesGetAvailability = (orgSlug, id, params, options) => {
76
+ return axiosInstance.get(
77
+ `/v3/${orgSlug}/services/${id}/availability`,
78
+ {
79
+ ...options,
80
+ params: { ...params, ...options?.params }
81
+ }
82
+ );
83
+ };
84
+ const servicesDeleteService = (orgSlug, id, options) => {
85
+ return axiosInstance.post(
86
+ `/v3/${orgSlug}/services/${id}/delete`,
87
+ void 0,
88
+ options
89
+ );
90
+ };
91
+ const servicesCreateResource = (orgSlug, createServiceResourceDto, options) => {
92
+ return axiosInstance.post(
93
+ `/v3/${orgSlug}/services/resources`,
94
+ createServiceResourceDto,
95
+ options
96
+ );
97
+ };
98
+ const servicesGetResources = (orgSlug, options) => {
99
+ return axiosInstance.get(
100
+ `/v3/${orgSlug}/services/resources`,
101
+ options
102
+ );
103
+ };
104
+ const servicesUpdateResource = (orgSlug, id, updateServiceResourceDto, options) => {
105
+ return axiosInstance.patch(
106
+ `/v3/${orgSlug}/services/resources/${id}`,
107
+ updateServiceResourceDto,
108
+ options
109
+ );
110
+ };
111
+ const servicesDeleteResource = (orgSlug, id, options) => {
112
+ return axiosInstance.post(
113
+ `/v3/${orgSlug}/services/resources/${id}/delete`,
114
+ void 0,
115
+ options
116
+ );
117
+ };
118
+ const servicesCreateBooking = (orgSlug, createBookingDto, options) => {
119
+ return axiosInstance.post(
120
+ `/v3/${orgSlug}/services/bookings`,
121
+ createBookingDto,
122
+ options
123
+ );
124
+ };
125
+ const servicesGetBookings = (orgSlug, options) => {
126
+ return axiosInstance.get(
127
+ `/v3/${orgSlug}/services/bookings`,
128
+ options
129
+ );
130
+ };
131
+ const servicesGetBooking = (orgSlug, id, options) => {
132
+ return axiosInstance.get(
133
+ `/v3/${orgSlug}/services/bookings/${id}`,
134
+ options
135
+ );
136
+ };
137
+ const servicesUpdateBookingStatus = (orgSlug, id, servicesUpdateBookingStatusBody, options) => {
138
+ return axiosInstance.patch(
139
+ `/v3/${orgSlug}/services/bookings/${id}/status`,
140
+ servicesUpdateBookingStatusBody,
141
+ options
142
+ );
143
+ };
144
+ const servicesCompleteBooking = (orgSlug, id, completeBookingDto, options) => {
145
+ return axiosInstance.patch(
146
+ `/v3/${orgSlug}/services/bookings/${id}/complete`,
147
+ completeBookingDto,
148
+ options
149
+ );
150
+ };
151
+ const servicesCancelBookingSeries = (orgSlug, recurrenceId, options) => {
152
+ return axiosInstance.post(
153
+ `/v3/${orgSlug}/services/bookings/recurrence/${recurrenceId}/cancel`,
154
+ void 0,
155
+ options
156
+ );
157
+ };
158
+ const servicesCreateShift = (orgSlug, memberId, servicesCreateShiftBody, options) => {
159
+ return axiosInstance.post(
160
+ `/v3/${orgSlug}/services/staff/${memberId}/shifts`,
161
+ servicesCreateShiftBody,
162
+ options
163
+ );
164
+ };
165
+ const servicesGetStaffShifts = (orgSlug, memberId, options) => {
166
+ return axiosInstance.get(
167
+ `/v3/${orgSlug}/services/staff/${memberId}/shifts`,
168
+ options
169
+ );
170
+ };
171
+ const servicesAddBreak = (orgSlug, shiftId, servicesAddBreakBody, options) => {
172
+ return axiosInstance.post(
173
+ `/v3/${orgSlug}/services/shifts/${shiftId}/breaks`,
174
+ servicesAddBreakBody,
175
+ options
176
+ );
177
+ };
178
+ const servicesRegisterCustomerApp = (orgSlug, servicesRegisterCustomerAppBody, options) => {
179
+ return axiosInstance.post(
180
+ `/v3/${orgSlug}/services/register-customer-app`,
181
+ servicesRegisterCustomerAppBody,
182
+ options
183
+ );
184
+ };
185
+ const servicesGetUtilization = (orgSlug, params, options) => {
186
+ return axiosInstance.get(
187
+ `/v3/${orgSlug}/services/analytics/utilization`,
188
+ {
189
+ ...options,
190
+ params: { ...params, ...options?.params }
191
+ }
192
+ );
193
+ };
194
+ const servicesGetPerformance = (orgSlug, params, options) => {
195
+ return axiosInstance.get(
196
+ `/v3/${orgSlug}/services/analytics/performance`,
197
+ {
198
+ ...options,
199
+ params: { ...params, ...options?.params }
200
+ }
201
+ );
202
+ };
203
+ const servicesGetFunnel = (orgSlug, params, options) => {
204
+ return axiosInstance.get(
205
+ `/v3/${orgSlug}/services/analytics/funnel`,
206
+ {
207
+ ...options,
208
+ params: { ...params, ...options?.params }
209
+ }
210
+ );
211
+ };
212
+ const publicServicesListServices = (orgSlug, options) => {
213
+ return axiosInstance.get(
214
+ `/v3/public/${orgSlug}/services`,
215
+ options
216
+ );
217
+ };
218
+ const publicServicesGetCategories = (orgSlug, options) => {
219
+ return axiosInstance.get(
220
+ `/v3/public/${orgSlug}/services/categories`,
221
+ options
222
+ );
223
+ };
224
+ const publicServicesGetService = (orgSlug, id, options) => {
225
+ return axiosInstance.get(
226
+ `/v3/public/${orgSlug}/services/${id}`,
227
+ options
228
+ );
229
+ };
230
+ const publicServicesGetAvailability = (orgSlug, id, params, options) => {
231
+ return axiosInstance.get(
232
+ `/v3/public/${orgSlug}/services/${id}/availability`,
233
+ {
234
+ ...options,
235
+ params: { ...params, ...options?.params }
236
+ }
237
+ );
238
+ };
239
+ const publicServicesRequestOtp = (orgSlug, requestOtpDto, options) => {
240
+ return axiosInstance.post(
241
+ `/v3/public/${orgSlug}/services/otp/request`,
242
+ requestOtpDto,
243
+ options
244
+ );
245
+ };
246
+ const publicServicesVerifyOtp = (orgSlug, verifyOtpDto, options) => {
247
+ return axiosInstance.post(
248
+ `/v3/public/${orgSlug}/services/otp/verify`,
249
+ verifyOtpDto,
250
+ options
251
+ );
252
+ };
253
+ const publicServicesCreatePublicBooking = (orgSlug, publicBookingDto, options) => {
254
+ return axiosInstance.post(
255
+ `/v3/public/${orgSlug}/services/bookings`,
256
+ publicBookingDto,
257
+ options
258
+ );
259
+ };
260
+ const inventoryVerifyIntegrity = (orgSlug, options) => {
261
+ return axiosInstance.get(
262
+ `/v3/${orgSlug}/inventory/integrity/verify`,
263
+ options
264
+ );
265
+ };
266
+ const inventoryFixIntegrity = (orgSlug, variantId, params, options) => {
267
+ return axiosInstance.post(
268
+ `/v3/${orgSlug}/inventory/integrity/fix/${variantId}`,
269
+ void 0,
270
+ {
271
+ ...options,
272
+ params: { ...params, ...options?.params }
273
+ }
274
+ );
275
+ };
276
+ const inventoryGetInventory = (orgSlug, params, options) => {
277
+ return axiosInstance.get(
278
+ `/v3/${orgSlug}/inventory`,
279
+ {
280
+ ...options,
281
+ params: { ...params, ...options?.params }
282
+ }
283
+ );
284
+ };
285
+ const inventoryTraceBatch = (orgSlug, identifier, options) => {
286
+ return axiosInstance.get(
287
+ `/v3/${orgSlug}/inventory/trace/${identifier}`,
288
+ options
289
+ );
290
+ };
291
+ const inventorySplitBatch = (orgSlug, id, options) => {
292
+ return axiosInstance.post(
293
+ `/v3/${orgSlug}/inventory/batches/${id}/split`,
294
+ void 0,
295
+ options
296
+ );
297
+ };
298
+ const inventoryMergeBatches = (orgSlug, options) => {
299
+ return axiosInstance.post(
300
+ `/v3/${orgSlug}/inventory/batches/merge`,
301
+ void 0,
302
+ options
303
+ );
304
+ };
305
+ const inventoryCreateAssembly = (orgSlug, options) => {
306
+ return axiosInstance.post(
307
+ `/v3/${orgSlug}/inventory/assemblies`,
308
+ void 0,
309
+ options
310
+ );
311
+ };
312
+ const inventoryCompleteAssembly = (orgSlug, id, options) => {
313
+ return axiosInstance.post(
314
+ `/v3/${orgSlug}/inventory/assemblies/${id}/complete`,
315
+ void 0,
316
+ options
317
+ );
318
+ };
319
+ const inventoryRequestAdjustment = (orgSlug, options) => {
320
+ return axiosInstance.post(
321
+ `/v3/${orgSlug}/inventory/adjustments/request`,
322
+ void 0,
323
+ options
324
+ );
325
+ };
326
+ const inventoryGetAdjustments = (orgSlug, params, options) => {
327
+ return axiosInstance.get(
328
+ `/v3/${orgSlug}/inventory/adjustments`,
329
+ {
330
+ ...options,
331
+ params: { ...params, ...options?.params }
332
+ }
333
+ );
334
+ };
335
+ const inventoryApproveAdjustment = (orgSlug, id, options) => {
336
+ return axiosInstance.patch(
337
+ `/v3/${orgSlug}/inventory/adjustments/${id}/approve`,
338
+ void 0,
339
+ options
340
+ );
341
+ };
342
+ const inventoryRejectAdjustment = (orgSlug, id, options) => {
343
+ return axiosInstance.patch(
344
+ `/v3/${orgSlug}/inventory/adjustments/${id}/reject`,
345
+ void 0,
346
+ options
347
+ );
348
+ };
349
+ const inventoryGetLeadTime = (orgSlug, params, options) => {
350
+ return axiosInstance.get(
351
+ `/v3/${orgSlug}/inventory/analytics/supplier-lead-time`,
352
+ {
353
+ ...options,
354
+ params: { ...params, ...options?.params }
355
+ }
356
+ );
357
+ };
358
+ const inventoryGetWasteAnalysis = (orgSlug, params, options) => {
359
+ return axiosInstance.get(
360
+ `/v3/${orgSlug}/inventory/analytics/waste`,
361
+ {
362
+ ...options,
363
+ params: { ...params, ...options?.params }
364
+ }
365
+ );
366
+ };
367
+ const inventoryCheckB2BAvailability = (orgSlug, checkB2BAvailabilityDto, options) => {
368
+ return axiosInstance.post(
369
+ `/v3/${orgSlug}/inventory/b2b/availability`,
370
+ checkB2BAvailabilityDto,
371
+ options
372
+ );
373
+ };
374
+ const inventoryUnpackBatch = (orgSlug, id, options) => {
375
+ return axiosInstance.post(
376
+ `/v3/${orgSlug}/inventory/batches/${id}/unpack`,
377
+ void 0,
378
+ options
379
+ );
380
+ };
381
+ const inventoryScanUnpackBatch = (orgSlug, options) => {
382
+ return axiosInstance.post(
383
+ `/v3/${orgSlug}/inventory/batches/scan-unpack`,
384
+ void 0,
385
+ options
386
+ );
387
+ };
388
+ const inventoryQuickStockInquiry = (orgSlug, options) => {
389
+ return axiosInstance.post(
390
+ `/v3/${orgSlug}/inventory/b2b/quick-inquiry`,
391
+ void 0,
392
+ options
393
+ );
394
+ };
395
+ const expenseControllerCreateExpense = (createExpenseDto, options) => {
396
+ return axiosInstance.post(
397
+ `/v3/finance/expenses`,
398
+ createExpenseDto,
399
+ options
400
+ );
401
+ };
402
+ const expenseControllerGetExpenses = (params, options) => {
403
+ return axiosInstance.get(
404
+ `/v3/finance/expenses`,
405
+ {
406
+ ...options,
407
+ params: { ...params, ...options?.params }
408
+ }
409
+ );
410
+ };
411
+ const expenseControllerGetExpenseCategories = (options) => {
412
+ return axiosInstance.get(
413
+ `/v3/finance/expenses/categories`,
414
+ options
415
+ );
416
+ };
417
+ const expenseControllerGetExpense = (id, options) => {
418
+ return axiosInstance.get(
419
+ `/v3/finance/expenses/${id}`,
420
+ options
421
+ );
422
+ };
423
+ const pettyCashControllerCreateFund = (createPettyCashFundDto, options) => {
424
+ return axiosInstance.post(
425
+ `/v3/finance/petty-cash`,
426
+ createPettyCashFundDto,
427
+ options
428
+ );
429
+ };
430
+ const pettyCashControllerGetFunds = (options) => {
431
+ return axiosInstance.get(
432
+ `/v3/finance/petty-cash`,
433
+ options
434
+ );
435
+ };
436
+ const pettyCashControllerGetFund = (id, options) => {
437
+ return axiosInstance.get(
438
+ `/v3/finance/petty-cash/${id}`,
439
+ options
440
+ );
441
+ };
442
+ const pettyCashControllerTopUpFund = (id, topUpPettyCashFundDto, options) => {
443
+ return axiosInstance.post(
444
+ `/v3/finance/petty-cash/${id}/top-up`,
445
+ topUpPettyCashFundDto,
446
+ options
447
+ );
448
+ };
449
+ const pettyCashControllerGetFundTransactions = (id, options) => {
450
+ return axiosInstance.get(
451
+ `/v3/finance/petty-cash/${id}/transactions`,
452
+ options
453
+ );
454
+ };
455
+ const utilityAccountControllerCreateAccount = (createUtilityAccountDto, options) => {
456
+ return axiosInstance.post(
457
+ `/v3/finance/utility-accounts`,
458
+ createUtilityAccountDto,
459
+ options
460
+ );
461
+ };
462
+ const utilityAccountControllerGetAccounts = (options) => {
463
+ return axiosInstance.get(
464
+ `/v3/finance/utility-accounts`,
465
+ options
466
+ );
467
+ };
468
+ const utilityAccountControllerGetAccount = (id, options) => {
469
+ return axiosInstance.get(
470
+ `/v3/finance/utility-accounts/${id}`,
471
+ options
472
+ );
473
+ };
474
+ const accountingInitialize = (orgSlug, options) => {
475
+ return axiosInstance.post(
476
+ `/v3/${orgSlug}/finance/accounting/initialize`,
477
+ void 0,
478
+ options
479
+ );
480
+ };
481
+ const accountingGetProfitLoss = (orgSlug, params, options) => {
482
+ return axiosInstance.get(
483
+ `/v3/${orgSlug}/finance/accounting/reports/profit-loss`,
484
+ {
485
+ ...options,
486
+ params: { ...params, ...options?.params }
487
+ }
488
+ );
489
+ };
490
+ const accountingGetBalanceSheet = (orgSlug, params, options) => {
491
+ return axiosInstance.get(
492
+ `/v3/${orgSlug}/finance/accounting/reports/balance-sheet`,
493
+ {
494
+ ...options,
495
+ params: { ...params, ...options?.params }
496
+ }
497
+ );
498
+ };
499
+ const accountingGetCashFlow = (orgSlug, params, options) => {
500
+ return axiosInstance.get(
501
+ `/v3/${orgSlug}/finance/accounting/reports/cash-flow`,
502
+ {
503
+ ...options,
504
+ params: { ...params, ...options?.params }
505
+ }
506
+ );
507
+ };
508
+ const accountingGetTaxSummary = (orgSlug, params, options) => {
509
+ return axiosInstance.get(
510
+ `/v3/${orgSlug}/finance/accounting/reports/tax-summary`,
511
+ {
512
+ ...options,
513
+ params: { ...params, ...options?.params }
514
+ }
515
+ );
516
+ };
517
+ const invoiceControllerCreateInvoice = (createInvoiceDto, options) => {
518
+ return axiosInstance.post(
519
+ `/v3/finance/invoices`,
520
+ createInvoiceDto,
521
+ options
522
+ );
523
+ };
524
+ const invoiceControllerGetInvoices = (options) => {
525
+ return axiosInstance.get(
526
+ `/v3/finance/invoices`,
527
+ options
528
+ );
529
+ };
530
+ const invoiceControllerGetInvoice = (id, options) => {
531
+ return axiosInstance.get(
532
+ `/v3/finance/invoices/${id}`,
533
+ options
534
+ );
535
+ };
536
+ const invoiceControllerUpdateInvoice = (id, updateInvoiceDto, options) => {
537
+ return axiosInstance.put(
538
+ `/v3/finance/invoices/${id}`,
539
+ updateInvoiceDto,
540
+ options
541
+ );
542
+ };
543
+ const invoiceControllerDeleteInvoice = (id, options) => {
544
+ return axiosInstance.delete(
545
+ `/v3/finance/invoices/${id}`,
546
+ options
547
+ );
548
+ };
549
+ const invoiceControllerFinalizeInvoice = (id, options) => {
550
+ return axiosInstance.post(
551
+ `/v3/finance/invoices/${id}/finalize`,
552
+ void 0,
553
+ options
554
+ );
555
+ };
556
+ const invoiceControllerGetTemplates = (options) => {
557
+ return axiosInstance.get(
558
+ `/v3/finance/invoices/templates`,
559
+ options
560
+ );
561
+ };
562
+ const invoiceControllerCreateTemplate = (createInvoiceTemplateDto, options) => {
563
+ return axiosInstance.post(
564
+ `/v3/finance/invoices/templates`,
565
+ createInvoiceTemplateDto,
566
+ options
567
+ );
568
+ };
569
+ const invoiceControllerGetConfig = (options) => {
570
+ return axiosInstance.get(
571
+ `/v3/finance/invoices/config`,
572
+ options
573
+ );
574
+ };
575
+ const invoiceControllerUpdateConfig = (invoiceConfigDto, options) => {
576
+ return axiosInstance.put(
577
+ `/v3/finance/invoices/config`,
578
+ invoiceConfigDto,
579
+ options
580
+ );
581
+ };
582
+ const publicInvoiceControllerDownloadInvoice = (id, params, options) => {
583
+ return axiosInstance.get(
584
+ `/v3/public-invoices/${id}/download`,
585
+ {
586
+ ...options,
587
+ params: { ...params, ...options?.params }
588
+ }
589
+ );
590
+ };
591
+ const publicInvoiceControllerDownloadInvoiceByTransaction = (transactionId, params, options) => {
592
+ return axiosInstance.get(
593
+ `/v3/public-invoices/transactions/${transactionId}/download`,
594
+ {
595
+ ...options,
596
+ params: { ...params, ...options?.params }
597
+ }
598
+ );
599
+ };
600
+ const publicInvoiceControllerDownloadReceipt = (transactionId, params, options) => {
601
+ return axiosInstance.get(
602
+ `/v3/public-invoices/receipts/${transactionId}/download`,
603
+ {
604
+ ...options,
605
+ params: { ...params, ...options?.params }
606
+ }
607
+ );
608
+ };
609
+ const publicInvoiceControllerGeneratePublicLink = (transactionId, params, options) => {
610
+ return axiosInstance.post(
611
+ `/v3/public-invoices/transactions/${transactionId}/generate-public-link`,
612
+ void 0,
613
+ {
614
+ ...options,
615
+ params: { ...params, ...options?.params }
616
+ }
617
+ );
618
+ };
619
+ const authExchangeToken = (tokenRequestDto, options) => {
620
+ return axiosInstance.post(
621
+ `/v3/auth/token`,
622
+ tokenRequestDto,
623
+ options
624
+ );
625
+ };
626
+ const authCreateOAuthClient = (createOAuthClientDto, options) => {
627
+ return axiosInstance.post(
628
+ `/v3/auth/oauth/clients`,
629
+ createOAuthClientDto,
630
+ options
631
+ );
632
+ };
633
+ const authListOAuthClients = (options) => {
634
+ return axiosInstance.get(
635
+ `/v3/auth/oauth/clients`,
636
+ options
637
+ );
638
+ };
639
+ const authGetOAuthClient = (id, options) => {
640
+ return axiosInstance.get(
641
+ `/v3/auth/oauth/clients/${id}`,
642
+ options
643
+ );
644
+ };
645
+ const authUpdateOAuthClient = (id, updateOAuthClientDto, options) => {
646
+ return axiosInstance.put(
647
+ `/v3/auth/oauth/clients/${id}`,
648
+ updateOAuthClientDto,
649
+ options
650
+ );
651
+ };
652
+ const authDeleteOAuthClient = (id, options) => {
653
+ return axiosInstance.delete(
654
+ `/v3/auth/oauth/clients/${id}`,
655
+ options
656
+ );
657
+ };
658
+ const authControllerHandleOAuth2 = (path, options) => {
659
+ return axiosInstance.get(
660
+ `/v3/auth/oauth2/${path}`,
661
+ options
662
+ );
663
+ };
664
+ const adminControllerGetStats = (options) => {
665
+ return axiosInstance.get(
666
+ `/v3/admin/stats`,
667
+ options
668
+ );
669
+ };
670
+ const adminControllerListOrganizations = (options) => {
671
+ return axiosInstance.get(
672
+ `/v3/admin/organizations`,
673
+ options
674
+ );
675
+ };
676
+ const adminControllerCreateOrganization = (createOrganizationDto, options) => {
677
+ return axiosInstance.post(
678
+ `/v3/admin/organizations`,
679
+ createOrganizationDto,
680
+ options
681
+ );
682
+ };
683
+ const adminControllerGetOrganizationDetails = (id, options) => {
684
+ return axiosInstance.get(
685
+ `/v3/admin/organizations/${id}`,
686
+ options
687
+ );
688
+ };
689
+ const adminControllerUpdateOrganization = (id, updateOrganizationDto, options) => {
690
+ return axiosInstance.patch(
691
+ `/v3/admin/organizations/${id}`,
692
+ updateOrganizationDto,
693
+ options
694
+ );
695
+ };
696
+ const adminControllerDeleteOrganization = (id, options) => {
697
+ return axiosInstance.delete(
698
+ `/v3/admin/organizations/${id}`,
699
+ options
700
+ );
701
+ };
702
+ const adminControllerSuspendOrganization = (id, suspendOrganizationDto, options) => {
703
+ return axiosInstance.post(
704
+ `/v3/admin/organizations/${id}/suspend`,
705
+ suspendOrganizationDto,
706
+ options
707
+ );
708
+ };
709
+ const adminControllerReactivateOrganization = (id, options) => {
710
+ return axiosInstance.post(
711
+ `/v3/admin/organizations/${id}/reactivate`,
712
+ void 0,
713
+ options
714
+ );
715
+ };
716
+ const adminControllerGetEffectiveQuota = (id, options) => {
717
+ return axiosInstance.get(
718
+ `/v3/admin/organizations/${id}/quota`,
719
+ options
720
+ );
721
+ };
722
+ const adminControllerSetQuotaOverrides = (id, setQuotaOverridesDto, options) => {
723
+ return axiosInstance.put(
724
+ `/v3/admin/organizations/${id}/quota-overrides`,
725
+ setQuotaOverridesDto,
726
+ options
727
+ );
728
+ };
729
+ const adminControllerListMembers = (params, options) => {
730
+ return axiosInstance.get(
731
+ `/v3/admin/members`,
732
+ {
733
+ ...options,
734
+ params: { ...params, ...options?.params }
735
+ }
736
+ );
737
+ };
738
+ const adminControllerListUsers = (options) => {
739
+ return axiosInstance.get(
740
+ `/v3/admin/users`,
741
+ options
742
+ );
743
+ };
744
+ const adminControllerBanUser = (id, banUserDto, options) => {
745
+ return axiosInstance.post(
746
+ `/v3/admin/users/${id}/ban`,
747
+ banUserDto,
748
+ options
749
+ );
750
+ };
751
+ const adminControllerUnbanUser = (id, options) => {
752
+ return axiosInstance.post(
753
+ `/v3/admin/users/${id}/unban`,
754
+ void 0,
755
+ options
756
+ );
757
+ };
758
+ const adminControllerListConnectedApps = (options) => {
759
+ return axiosInstance.get(
760
+ `/v3/admin/connected-apps`,
761
+ options
762
+ );
763
+ };
764
+ const adminControllerListSystemLogs = (options) => {
765
+ return axiosInstance.get(
766
+ `/v3/admin/system-logs`,
767
+ options
768
+ );
769
+ };
770
+ const adminControllerListGlobalSettings = (options) => {
771
+ return axiosInstance.get(
772
+ `/v3/admin/settings`,
773
+ options
774
+ );
775
+ };
776
+ const adminControllerSetGlobalSetting = (setGlobalSettingDto, options) => {
777
+ return axiosInstance.post(
778
+ `/v3/admin/settings`,
779
+ setGlobalSettingDto,
780
+ options
781
+ );
782
+ };
783
+ const adminControllerDeleteGlobalSetting = (key, options) => {
784
+ return axiosInstance.delete(
785
+ `/v3/admin/settings/${key}`,
786
+ options
787
+ );
788
+ };
789
+ const adminControllerListTiers = (options) => {
790
+ return axiosInstance.get(
791
+ `/v3/admin/tiers`,
792
+ options
793
+ );
794
+ };
795
+ const adminControllerDefineTier = (defineTierDto, options) => {
796
+ return axiosInstance.post(
797
+ `/v3/admin/tiers`,
798
+ defineTierDto,
799
+ options
800
+ );
801
+ };
802
+ const adminControllerDeleteTier = (slug, options) => {
803
+ return axiosInstance.delete(
804
+ `/v3/admin/tiers/${slug}`,
805
+ options
806
+ );
807
+ };
808
+ const adminControllerGetOrganizationSubscription = (id, options) => {
809
+ return axiosInstance.get(
810
+ `/v3/admin/organizations/${id}/subscription`,
811
+ options
812
+ );
813
+ };
814
+ const adminControllerUpdateOrganizationSubscription = (id, updateSubscriptionDto, options) => {
815
+ return axiosInstance.put(
816
+ `/v3/admin/organizations/${id}/subscription`,
817
+ updateSubscriptionDto,
818
+ options
819
+ );
820
+ };
821
+ const adminControllerListSystemPayments = (options) => {
822
+ return axiosInstance.get(
823
+ `/v3/admin/payments`,
824
+ options
825
+ );
826
+ };
827
+ const adminControllerRecordCustomPayment = (recordCustomPaymentDto, options) => {
828
+ return axiosInstance.post(
829
+ `/v3/admin/payments/record`,
830
+ recordCustomPaymentDto,
831
+ options
832
+ );
833
+ };
834
+ const adminControllerListIntegrationDefinitions = (options) => {
835
+ return axiosInstance.get(
836
+ `/v3/admin/integrations/definitions`,
837
+ options
838
+ );
839
+ };
840
+ const adminControllerCreateIntegrationDefinition = (createIntegrationDefinitionDto, options) => {
841
+ return axiosInstance.post(
842
+ `/v3/admin/integrations/definitions`,
843
+ createIntegrationDefinitionDto,
844
+ options
845
+ );
846
+ };
847
+ const adminControllerUpdateIntegrationDefinition = (id, updateIntegrationDefinitionDto, options) => {
848
+ return axiosInstance.patch(
849
+ `/v3/admin/integrations/definitions/${id}`,
850
+ updateIntegrationDefinitionDto,
851
+ options
852
+ );
853
+ };
854
+ const adminControllerDeleteIntegrationDefinition = (id, options) => {
855
+ return axiosInstance.delete(
856
+ `/v3/admin/integrations/definitions/${id}`,
857
+ options
858
+ );
859
+ };
860
+ const adminControllerListActiveOrganizationIntegrations = (options) => {
861
+ return axiosInstance.get(
862
+ `/v3/admin/integrations/active`,
863
+ options
864
+ );
865
+ };
866
+ const webhooksCreate = (orgSlug, createWebhookDto, options) => {
867
+ return axiosInstance.post(
868
+ `/v3/${orgSlug}/webhooks`,
869
+ createWebhookDto,
870
+ options
871
+ );
872
+ };
873
+ const webhooksList = (orgSlug, options) => {
874
+ return axiosInstance.get(
875
+ `/v3/${orgSlug}/webhooks`,
876
+ options
877
+ );
878
+ };
879
+ const webhooksDelete = (orgSlug, id, options) => {
880
+ return axiosInstance.delete(
881
+ `/v3/${orgSlug}/webhooks/${id}`,
882
+ options
883
+ );
884
+ };
885
+ const catalogGetProducts = (orgSlug, params, options) => {
886
+ return axiosInstance.get(
887
+ `/v3/${orgSlug}/catalog/products`,
888
+ {
889
+ ...options,
890
+ params: { ...params, ...options?.params }
891
+ }
892
+ );
893
+ };
894
+ const catalogCreateProduct = (orgSlug, createProductDto, options) => {
895
+ return axiosInstance.post(
896
+ `/v3/${orgSlug}/catalog/products`,
897
+ createProductDto,
898
+ options
899
+ );
900
+ };
901
+ const catalogGetProduct = (orgSlug, idOrSlug, options) => {
902
+ return axiosInstance.get(
903
+ `/v3/${orgSlug}/catalog/products/${idOrSlug}`,
904
+ options
905
+ );
906
+ };
907
+ const catalogGetServices = (orgSlug, params, options) => {
908
+ return axiosInstance.get(
909
+ `/v3/${orgSlug}/catalog/services`,
910
+ {
911
+ ...options,
912
+ params: { ...params, ...options?.params }
913
+ }
914
+ );
915
+ };
916
+ const catalogUpdateProduct = (orgSlug, id, updateProductDto, options) => {
917
+ return axiosInstance.patch(
918
+ `/v3/${orgSlug}/catalog/products/${id}`,
919
+ updateProductDto,
920
+ options
921
+ );
922
+ };
923
+ const catalogUpdateSupplierVariant = (orgSlug, supplierId, variantId, updateSupplierProductDto, options) => {
924
+ return axiosInstance.patch(
925
+ `/v3/${orgSlug}/catalog/suppliers/${supplierId}/variants/${variantId}`,
926
+ updateSupplierProductDto,
927
+ options
928
+ );
929
+ };
930
+ const catalogGetPriceChangeRequests = (orgSlug, params, options) => {
931
+ return axiosInstance.get(
932
+ `/v3/${orgSlug}/catalog/price-change-requests`,
933
+ {
934
+ ...options,
935
+ params: { ...params, ...options?.params }
936
+ }
937
+ );
938
+ };
939
+ const catalogReviewPriceChangeRequest = (orgSlug, id, reviewPriceChangeDto, options) => {
940
+ return axiosInstance.post(
941
+ `/v3/${orgSlug}/catalog/price-change-requests/${id}/review`,
942
+ reviewPriceChangeDto,
943
+ options
944
+ );
945
+ };
946
+ const catalogCreateReview = (orgSlug, productId, createProductReviewDto, options) => {
947
+ return axiosInstance.post(
948
+ `/v3/${orgSlug}/catalog/products/${productId}/reviews`,
949
+ createProductReviewDto,
950
+ options
951
+ );
952
+ };
953
+ const catalogUpdateReview = (orgSlug, reviewId, updateProductReviewDto, options) => {
954
+ return axiosInstance.patch(
955
+ `/v3/${orgSlug}/catalog/reviews/${reviewId}`,
956
+ updateProductReviewDto,
957
+ options
958
+ );
959
+ };
960
+ const catalogDeleteReview = (orgSlug, reviewId, params, options) => {
961
+ return axiosInstance.delete(
962
+ `/v3/${orgSlug}/catalog/reviews/${reviewId}`,
963
+ {
964
+ ...options,
965
+ params: { ...params, ...options?.params }
966
+ }
967
+ );
968
+ };
969
+ const customersGetCustomers = (orgSlug, params, options) => {
970
+ return axiosInstance.get(
971
+ `/v3/${orgSlug}/customers`,
972
+ {
973
+ ...options,
974
+ params: { ...params, ...options?.params }
975
+ }
976
+ );
977
+ };
978
+ const customersRegister = (orgSlug, registerCustomerDto, options) => {
979
+ return axiosInstance.post(
980
+ `/v3/${orgSlug}/customers/register`,
981
+ registerCustomerDto,
982
+ options
983
+ );
984
+ };
985
+ const customerRegister = (orgSlug, registerCustomerDto, options) => {
986
+ return axiosInstance.post(
987
+ `/v3/${orgSlug}/customers/../customer/register`,
988
+ registerCustomerDto,
989
+ options
990
+ );
991
+ };
992
+ const customersLogin = (orgSlug, customerLoginDto, options) => {
993
+ return axiosInstance.post(
994
+ `/v3/${orgSlug}/customers/auth/login`,
995
+ customerLoginDto,
996
+ options
997
+ );
998
+ };
999
+ const customersRefreshSession = (orgSlug, options) => {
1000
+ return axiosInstance.post(
1001
+ `/v3/${orgSlug}/customers/auth/refresh`,
1002
+ void 0,
1003
+ options
1004
+ );
1005
+ };
1006
+ const customersGetCurrentSession = (orgSlug, options) => {
1007
+ return axiosInstance.get(
1008
+ `/v3/${orgSlug}/customers/auth/session`,
1009
+ options
1010
+ );
1011
+ };
1012
+ const customersGetSessions = (orgSlug, options) => {
1013
+ return axiosInstance.get(
1014
+ `/v3/${orgSlug}/customers/auth/sessions`,
1015
+ options
1016
+ );
1017
+ };
1018
+ const customersRevokeAllSessions = (orgSlug, params, options) => {
1019
+ return axiosInstance.delete(
1020
+ `/v3/${orgSlug}/customers/auth/sessions`,
1021
+ {
1022
+ ...options,
1023
+ params: { ...params, ...options?.params }
1024
+ }
1025
+ );
1026
+ };
1027
+ const customersRevokeSession = (orgSlug, id, options) => {
1028
+ return axiosInstance.delete(
1029
+ `/v3/${orgSlug}/customers/auth/sessions/${id}`,
1030
+ options
1031
+ );
1032
+ };
1033
+ const customersUpdate = (orgSlug, id, updateCustomerDto, options) => {
1034
+ return axiosInstance.patch(
1035
+ `/v3/${orgSlug}/customers/${id}`,
1036
+ updateCustomerDto,
1037
+ options
1038
+ );
1039
+ };
1040
+ const customersGetCustomerById = (orgSlug, id, options) => {
1041
+ return axiosInstance.get(
1042
+ `/v3/${orgSlug}/customers/${id}`,
1043
+ options
1044
+ );
1045
+ };
1046
+ const customersDelete = (orgSlug, id, options) => {
1047
+ return axiosInstance.delete(
1048
+ `/v3/${orgSlug}/customers/${id}`,
1049
+ options
1050
+ );
1051
+ };
1052
+ const customersGetAddresses = (orgSlug, id, options) => {
1053
+ return axiosInstance.get(
1054
+ `/v3/${orgSlug}/customers/${id}/addresses`,
1055
+ options
1056
+ );
1057
+ };
1058
+ const customersAddAddress = (orgSlug, id, addressDto, options) => {
1059
+ return axiosInstance.post(
1060
+ `/v3/${orgSlug}/customers/${id}/addresses`,
1061
+ addressDto,
1062
+ options
1063
+ );
1064
+ };
1065
+ const businessAccountControllerCreate = (orgSlug, createBusinessAccountDto, options) => {
1066
+ return axiosInstance.post(
1067
+ `/v3/${orgSlug}/business-accounts`,
1068
+ createBusinessAccountDto,
1069
+ options
1070
+ );
1071
+ };
1072
+ const businessAccountControllerGetOne = (orgSlug, id, options) => {
1073
+ return axiosInstance.get(
1074
+ `/v3/${orgSlug}/business-accounts/${id}`,
1075
+ options
1076
+ );
1077
+ };
1078
+ const crmControllerCreateRecord = (orgSlug, createCrmRecordDto, options) => {
1079
+ return axiosInstance.post(
1080
+ `/v3/${orgSlug}/crm/records`,
1081
+ createCrmRecordDto,
1082
+ options
1083
+ );
1084
+ };
1085
+ const crmControllerGetRecord = (orgSlug, id, options) => {
1086
+ return axiosInstance.get(
1087
+ `/v3/${orgSlug}/crm/records/${id}`,
1088
+ options
1089
+ );
1090
+ };
1091
+ const crmControllerUpdateRecord = (orgSlug, id, updateCrmRecordDto, options) => {
1092
+ return axiosInstance.patch(
1093
+ `/v3/${orgSlug}/crm/records/${id}`,
1094
+ updateCrmRecordDto,
1095
+ options
1096
+ );
1097
+ };
1098
+ const crmControllerCreateNote = (orgSlug, createCrmNoteDto, options) => {
1099
+ return axiosInstance.post(
1100
+ `/v3/${orgSlug}/crm/notes`,
1101
+ createCrmNoteDto,
1102
+ options
1103
+ );
1104
+ };
1105
+ const crmControllerGetRecordNotes = (orgSlug, id, options) => {
1106
+ return axiosInstance.get(
1107
+ `/v3/${orgSlug}/crm/records/${id}/notes`,
1108
+ options
1109
+ );
1110
+ };
1111
+ const crmControllerCreateActivity = (orgSlug, createCrmActivityDto, options) => {
1112
+ return axiosInstance.post(
1113
+ `/v3/${orgSlug}/crm/activities`,
1114
+ createCrmActivityDto,
1115
+ options
1116
+ );
1117
+ };
1118
+ const crmControllerGetTimeline = (orgSlug, id, options) => {
1119
+ return axiosInstance.get(
1120
+ `/v3/${orgSlug}/crm/records/${id}/timeline`,
1121
+ options
1122
+ );
1123
+ };
1124
+ const crmControllerCreateObject = (orgSlug, createCrmObjectDto, options) => {
1125
+ return axiosInstance.post(
1126
+ `/v3/${orgSlug}/crm/objects`,
1127
+ createCrmObjectDto,
1128
+ options
1129
+ );
1130
+ };
1131
+ const crmControllerListObjects = (orgSlug, options) => {
1132
+ return axiosInstance.get(
1133
+ `/v3/${orgSlug}/crm/objects`,
1134
+ options
1135
+ );
1136
+ };
1137
+ const crmControllerCreateField = (orgSlug, objectId, createCrmFieldDto, options) => {
1138
+ return axiosInstance.post(
1139
+ `/v3/${orgSlug}/crm/objects/${objectId}/fields`,
1140
+ createCrmFieldDto,
1141
+ options
1142
+ );
1143
+ };
1144
+ const crmControllerListFields = (orgSlug, objectId, options) => {
1145
+ return axiosInstance.get(
1146
+ `/v3/${orgSlug}/crm/objects/${objectId}/fields`,
1147
+ options
1148
+ );
1149
+ };
1150
+ const crmControllerCreateRelationship = (orgSlug, createCrmRelationshipDto, options) => {
1151
+ return axiosInstance.post(
1152
+ `/v3/${orgSlug}/crm/relationships`,
1153
+ createCrmRelationshipDto,
1154
+ options
1155
+ );
1156
+ };
1157
+ const crmControllerListRelationships = (orgSlug, options) => {
1158
+ return axiosInstance.get(
1159
+ `/v3/${orgSlug}/crm/relationships`,
1160
+ options
1161
+ );
1162
+ };
1163
+ const crmControllerCreateAssociation = (orgSlug, createCrmAssociationDto, options) => {
1164
+ return axiosInstance.post(
1165
+ `/v3/${orgSlug}/crm/associations`,
1166
+ createCrmAssociationDto,
1167
+ options
1168
+ );
1169
+ };
1170
+ const crmControllerListRecordAssociations = (orgSlug, id, options) => {
1171
+ return axiosInstance.get(
1172
+ `/v3/${orgSlug}/crm/records/${id}/associations`,
1173
+ options
1174
+ );
1175
+ };
1176
+ const loyaltyRedeemReward = (orgSlug, redeemRewardDto, options) => {
1177
+ return axiosInstance.post(
1178
+ `/v3/${orgSlug}/loyalty/vouchers/redeem`,
1179
+ redeemRewardDto,
1180
+ options
1181
+ );
1182
+ };
1183
+ const loyaltyGetCustomerStatus = (orgSlug, id, options) => {
1184
+ return axiosInstance.get(
1185
+ `/v3/${orgSlug}/loyalty/customers/${id}/status`,
1186
+ options
1187
+ );
1188
+ };
1189
+ const loyaltyValidateVoucher = (orgSlug, validateVoucherDto, options) => {
1190
+ return axiosInstance.post(
1191
+ `/v3/${orgSlug}/loyalty/vouchers/validate`,
1192
+ validateVoucherDto,
1193
+ options
1194
+ );
1195
+ };
1196
+ const ordersCreateOrder = (orgSlug, createOrderDto, options) => {
1197
+ return axiosInstance.post(
1198
+ `/v3/${orgSlug}/orders`,
1199
+ createOrderDto,
1200
+ options
1201
+ );
1202
+ };
1203
+ const ordersGetOrders = (orgSlug, params, options) => {
1204
+ return axiosInstance.get(
1205
+ `/v3/${orgSlug}/orders`,
1206
+ {
1207
+ ...options,
1208
+ params: { ...params, ...options?.params }
1209
+ }
1210
+ );
1211
+ };
1212
+ const ordersUpdateStatus = (orgSlug, id, updateOrderStatusDto, options) => {
1213
+ return axiosInstance.post(
1214
+ `/v3/${orgSlug}/orders/${id}/status`,
1215
+ updateOrderStatusDto,
1216
+ options
1217
+ );
1218
+ };
1219
+ const ordersRequestB2BQuote = (orgSlug, requestB2BQuoteDto, options) => {
1220
+ return axiosInstance.post(
1221
+ `/v3/${orgSlug}/orders/b2b/quotes`,
1222
+ requestB2BQuoteDto,
1223
+ options
1224
+ );
1225
+ };
1226
+ const ordersConvertQuoteToOrder = (orgSlug, id, options) => {
1227
+ return axiosInstance.post(
1228
+ `/v3/${orgSlug}/orders/b2b/quotes/${id}/convert`,
1229
+ void 0,
1230
+ options
1231
+ );
1232
+ };
1233
+ const paymentsCheckout = (orgSlug, checkoutDto, options) => {
1234
+ return axiosInstance.post(
1235
+ `/v3/${orgSlug}/payments/checkout`,
1236
+ checkoutDto,
1237
+ options
1238
+ );
1239
+ };
1240
+ const paymentsControllerHandleStkCallback = (orgSlug, paymentId, options) => {
1241
+ return axiosInstance.post(
1242
+ `/v3/${orgSlug}/payments/webhooks/mpesa/stkpush/${paymentId}`,
1243
+ void 0,
1244
+ options
1245
+ );
1246
+ };
1247
+ const pOSProvision = (orgSlug, provisionDeviceDto, options) => {
1248
+ return axiosInstance.post(
1249
+ `/v3/${orgSlug}/pos/provision`,
1250
+ provisionDeviceDto,
1251
+ options
1252
+ );
1253
+ };
1254
+ const pOSLogin = (orgSlug, posLoginDto, options) => {
1255
+ return axiosInstance.post(
1256
+ `/v3/${orgSlug}/pos/login`,
1257
+ posLoginDto,
1258
+ options
1259
+ );
1260
+ };
1261
+ const pOSGetMe = (orgSlug, options) => {
1262
+ return axiosInstance.get(
1263
+ `/v3/${orgSlug}/pos/me`,
1264
+ options
1265
+ );
1266
+ };
1267
+ const pOSProcessSale = (orgSlug, processSaleDto, options) => {
1268
+ return axiosInstance.post(
1269
+ `/v3/${orgSlug}/pos/sale`,
1270
+ processSaleDto,
1271
+ options
1272
+ );
1273
+ };
1274
+ const pOSSync = (orgSlug, options) => {
1275
+ return axiosInstance.get(
1276
+ `/v3/${orgSlug}/pos/sync`,
1277
+ options
1278
+ );
1279
+ };
1280
+ const pOSGetTransactions = (orgSlug, options) => {
1281
+ return axiosInstance.get(
1282
+ `/v3/${orgSlug}/pos/transactions`,
1283
+ options
1284
+ );
1285
+ };
1286
+ const pOSRegisterPettyCash = (orgSlug, registerPettyCashDto, options) => {
1287
+ return axiosInstance.post(
1288
+ `/v3/${orgSlug}/pos/petty-cash`,
1289
+ registerPettyCashDto,
1290
+ options
1291
+ );
1292
+ };
1293
+ const pOSGetPettyCashFunds = (orgSlug, options) => {
1294
+ return axiosInstance.get(
1295
+ `/v3/${orgSlug}/pos/petty-cash/funds`,
1296
+ options
1297
+ );
1298
+ };
1299
+ const pOSGetPettyCashTransactions = (orgSlug, params, options) => {
1300
+ return axiosInstance.get(
1301
+ `/v3/${orgSlug}/pos/petty-cash/transactions`,
1302
+ {
1303
+ ...options,
1304
+ params: { ...params, ...options?.params }
1305
+ }
1306
+ );
1307
+ };
1308
+ const pOSCreatePairingSession = (options) => {
1309
+ return axiosInstance.post(
1310
+ `/v3/pos/pairing/session`,
1311
+ void 0,
1312
+ options
1313
+ );
1314
+ };
1315
+ const pOSGetPairingSessionStatus = (sessionId, options) => {
1316
+ return axiosInstance.get(
1317
+ `/v3/pos/pairing/session/${sessionId}/status`,
1318
+ options
1319
+ );
1320
+ };
1321
+ const pOSAuthorizePairingSession = (sessionId, options) => {
1322
+ return axiosInstance.post(
1323
+ `/v3/pos/pairing/session/${sessionId}/authorize`,
1324
+ void 0,
1325
+ options
1326
+ );
1327
+ };
1328
+ const membersControllerGetMembers = (orgSlug, params, options) => {
1329
+ return axiosInstance.get(
1330
+ `/v3/${orgSlug}/members`,
1331
+ {
1332
+ ...options,
1333
+ params: { ...params, ...options?.params }
1334
+ }
1335
+ );
1336
+ };
1337
+ const membersControllerCreateMember = (orgSlug, createMemberDto, options) => {
1338
+ return axiosInstance.post(
1339
+ `/v3/${orgSlug}/members`,
1340
+ createMemberDto,
1341
+ options
1342
+ );
1343
+ };
1344
+ const membersControllerGetMember = (orgSlug, id, options) => {
1345
+ return axiosInstance.get(
1346
+ `/v3/${orgSlug}/members/${id}`,
1347
+ options
1348
+ );
1349
+ };
1350
+ const membersControllerUpdateMember = (orgSlug, id, updateMemberDto, options) => {
1351
+ return axiosInstance.patch(
1352
+ `/v3/${orgSlug}/members/${id}`,
1353
+ updateMemberDto,
1354
+ options
1355
+ );
1356
+ };
1357
+ const membersControllerDeleteMember = (orgSlug, id, options) => {
1358
+ return axiosInstance.delete(
1359
+ `/v3/${orgSlug}/members/${id}`,
1360
+ options
1361
+ );
1362
+ };
1363
+ const membersControllerGetMemberActivity = (orgSlug, id, options) => {
1364
+ return axiosInstance.get(
1365
+ `/v3/${orgSlug}/members/${id}/activity`,
1366
+ options
1367
+ );
1368
+ };
1369
+ const membersControllerUpdateStatus = (orgSlug, id, options) => {
1370
+ return axiosInstance.patch(
1371
+ `/v3/${orgSlug}/members/${id}/status`,
1372
+ void 0,
1373
+ options
1374
+ );
1375
+ };
1376
+ const membersControllerAdminCheckOut = (orgSlug, memberId, checkOutDto, options) => {
1377
+ return axiosInstance.post(
1378
+ `/v3/${orgSlug}/members/${memberId}/attendance/check-out`,
1379
+ checkOutDto,
1380
+ options
1381
+ );
1382
+ };
1383
+ const terminalMembersControllerLogin = (terminalLoginDto, options) => {
1384
+ return axiosInstance.post(
1385
+ `/v3/members/login`,
1386
+ terminalLoginDto,
1387
+ options
1388
+ );
1389
+ };
1390
+ const invitationsList = (orgSlug, params, options) => {
1391
+ return axiosInstance.get(
1392
+ `/v3/${orgSlug}/members/invitations`,
1393
+ {
1394
+ ...options,
1395
+ params: { ...params, ...options?.params }
1396
+ }
1397
+ );
1398
+ };
1399
+ const invitationsCreate = (orgSlug, createInvitationDto, options) => {
1400
+ return axiosInstance.post(
1401
+ `/v3/${orgSlug}/members/invitations`,
1402
+ createInvitationDto,
1403
+ options
1404
+ );
1405
+ };
1406
+ const invitationsRevoke = (orgSlug, id, options) => {
1407
+ return axiosInstance.delete(
1408
+ `/v3/${orgSlug}/members/invitations/${id}`,
1409
+ options
1410
+ );
1411
+ };
1412
+ const invitationsAccept = (orgSlug, acceptInvitationDto, options) => {
1413
+ return axiosInstance.post(
1414
+ `/v3/${orgSlug}/members/invitations/accept`,
1415
+ acceptInvitationDto,
1416
+ options
1417
+ );
1418
+ };
1419
+ const roleManagementControllerGetCustomRoles = (orgSlug, params, options) => {
1420
+ return axiosInstance.get(
1421
+ `/v3/${orgSlug}/members/roles/custom`,
1422
+ {
1423
+ ...options,
1424
+ params: { ...params, ...options?.params }
1425
+ }
1426
+ );
1427
+ };
1428
+ const roleManagementControllerCreateCustomRole = (orgSlug, createCustomRoleDto, options) => {
1429
+ return axiosInstance.post(
1430
+ `/v3/${orgSlug}/members/roles/custom`,
1431
+ createCustomRoleDto,
1432
+ options
1433
+ );
1434
+ };
1435
+ const roleManagementControllerUpdateCustomRole = (orgSlug, id, updateCustomRoleDto, options) => {
1436
+ return axiosInstance.patch(
1437
+ `/v3/${orgSlug}/members/roles/custom/${id}`,
1438
+ updateCustomRoleDto,
1439
+ options
1440
+ );
1441
+ };
1442
+ const roleManagementControllerDeleteCustomRole = (orgSlug, id, options) => {
1443
+ return axiosInstance.delete(
1444
+ `/v3/${orgSlug}/members/roles/custom/${id}`,
1445
+ options
1446
+ );
1447
+ };
1448
+ const roleManagementControllerGetPermissionSets = (orgSlug, options) => {
1449
+ return axiosInstance.get(
1450
+ `/v3/${orgSlug}/members/roles/permission-sets`,
1451
+ options
1452
+ );
1453
+ };
1454
+ const roleManagementControllerCreatePermissionSet = (orgSlug, createPermissionSetDto, options) => {
1455
+ return axiosInstance.post(
1456
+ `/v3/${orgSlug}/members/roles/permission-sets`,
1457
+ createPermissionSetDto,
1458
+ options
1459
+ );
1460
+ };
1461
+ const roleManagementControllerGetRoleGroups = (orgSlug, options) => {
1462
+ return axiosInstance.get(
1463
+ `/v3/${orgSlug}/members/roles/groups`,
1464
+ options
1465
+ );
1466
+ };
1467
+ const roleManagementControllerCreateRoleGroup = (orgSlug, createRoleGroupDto, options) => {
1468
+ return axiosInstance.post(
1469
+ `/v3/${orgSlug}/members/roles/groups`,
1470
+ createRoleGroupDto,
1471
+ options
1472
+ );
1473
+ };
1474
+ const roleManagementControllerAssignRoles = (orgSlug, memberId, options) => {
1475
+ return axiosInstance.post(
1476
+ `/v3/${orgSlug}/members/roles/member/${memberId}/assign`,
1477
+ void 0,
1478
+ options
1479
+ );
1480
+ };
1481
+ const roleManagementControllerRemoveRoles = (orgSlug, memberId, options) => {
1482
+ return axiosInstance.post(
1483
+ `/v3/${orgSlug}/members/roles/member/${memberId}/remove`,
1484
+ void 0,
1485
+ options
1486
+ );
1487
+ };
1488
+ const departmentsList = (orgSlug, params, options) => {
1489
+ return axiosInstance.get(
1490
+ `/v3/${orgSlug}/members/departments`,
1491
+ {
1492
+ ...options,
1493
+ params: { ...params, ...options?.params }
1494
+ }
1495
+ );
1496
+ };
1497
+ const departmentsCreate = (orgSlug, createDepartmentDto, options) => {
1498
+ return axiosInstance.post(
1499
+ `/v3/${orgSlug}/members/departments`,
1500
+ createDepartmentDto,
1501
+ options
1502
+ );
1503
+ };
1504
+ const departmentsGet = (orgSlug, id, options) => {
1505
+ return axiosInstance.get(
1506
+ `/v3/${orgSlug}/members/departments/${id}`,
1507
+ options
1508
+ );
1509
+ };
1510
+ const departmentsUpdate = (orgSlug, id, updateDepartmentDto, options) => {
1511
+ return axiosInstance.patch(
1512
+ `/v3/${orgSlug}/members/departments/${id}`,
1513
+ updateDepartmentDto,
1514
+ options
1515
+ );
1516
+ };
1517
+ const departmentsDelete = (orgSlug, id, options) => {
1518
+ return axiosInstance.delete(
1519
+ `/v3/${orgSlug}/members/departments/${id}`,
1520
+ options
1521
+ );
1522
+ };
1523
+ const departmentsAddMember = (orgSlug, id, addDepartmentMemberDto, options) => {
1524
+ return axiosInstance.post(
1525
+ `/v3/${orgSlug}/members/departments/${id}/members`,
1526
+ addDepartmentMemberDto,
1527
+ options
1528
+ );
1529
+ };
1530
+ const departmentsRemoveMember = (orgSlug, id, memberId, options) => {
1531
+ return axiosInstance.delete(
1532
+ `/v3/${orgSlug}/members/departments/${id}/members/${memberId}`,
1533
+ options
1534
+ );
1535
+ };
1536
+ const attendanceControllerGetLogs = (orgSlug, params, options) => {
1537
+ return axiosInstance.get(
1538
+ `/v3/${orgSlug}/members/attendance/logs`,
1539
+ {
1540
+ ...options,
1541
+ params: { ...params, ...options?.params }
1542
+ }
1543
+ );
1544
+ };
1545
+ const attendanceControllerCheckIn = (orgSlug, checkInDto, options) => {
1546
+ return axiosInstance.post(
1547
+ `/v3/${orgSlug}/members/attendance/check-in`,
1548
+ checkInDto,
1549
+ options
1550
+ );
1551
+ };
1552
+ const attendanceControllerCheckOut = (orgSlug, checkOutDto, options) => {
1553
+ return axiosInstance.post(
1554
+ `/v3/${orgSlug}/members/attendance/check-out`,
1555
+ checkOutDto,
1556
+ options
1557
+ );
1558
+ };
1559
+ const attendanceControllerGetMyStatus = (orgSlug, options) => {
1560
+ return axiosInstance.get(
1561
+ `/v3/${orgSlug}/members/attendance/me/status`,
1562
+ options
1563
+ );
1564
+ };
1565
+ const attendanceControllerGetStatus = (orgSlug, memberId, options) => {
1566
+ return axiosInstance.get(
1567
+ `/v3/${orgSlug}/members/attendance/${memberId}/status`,
1568
+ options
1569
+ );
1570
+ };
1571
+ const announcementControllerBroadcastAnnouncement = (orgSlug, announcementDto, options) => {
1572
+ return axiosInstance.post(
1573
+ `/v3/${orgSlug}/announcements`,
1574
+ announcementDto,
1575
+ options
1576
+ );
1577
+ };
1578
+ const cartControllerGetCart = (orgSlug, params, options) => {
1579
+ return axiosInstance.get(
1580
+ `/v3/${orgSlug}/cart`,
1581
+ {
1582
+ ...options,
1583
+ params: { ...params, ...options?.params }
1584
+ }
1585
+ );
1586
+ };
1587
+ const cartControllerClearCart = (orgSlug, params, options) => {
1588
+ return axiosInstance.delete(
1589
+ `/v3/${orgSlug}/cart`,
1590
+ {
1591
+ ...options,
1592
+ params: { ...params, ...options?.params }
1593
+ }
1594
+ );
1595
+ };
1596
+ const cartControllerAddToCart = (orgSlug, addToCartDto, options) => {
1597
+ return axiosInstance.post(
1598
+ `/v3/${orgSlug}/cart/items`,
1599
+ addToCartDto,
1600
+ options
1601
+ );
1602
+ };
1603
+ const cartControllerRemoveFromCart = (orgSlug, removeFromCartDto, options) => {
1604
+ return axiosInstance.delete(
1605
+ `/v3/${orgSlug}/cart/items`,
1606
+ { data: removeFromCartDto, ...options }
1607
+ );
1608
+ };
1609
+ const favoritesControllerGetFavorites = (orgSlug, options) => {
1610
+ return axiosInstance.get(
1611
+ `/v3/${orgSlug}/favorites`,
1612
+ options
1613
+ );
1614
+ };
1615
+ const favoritesControllerAddFavorite = (orgSlug, favoriteDto, options) => {
1616
+ return axiosInstance.post(
1617
+ `/v3/${orgSlug}/favorites`,
1618
+ favoriteDto,
1619
+ options
1620
+ );
1621
+ };
1622
+ const favoritesControllerRemoveFavorite = (orgSlug, favoriteDto, options) => {
1623
+ return axiosInstance.delete(
1624
+ `/v3/${orgSlug}/favorites`,
1625
+ { data: favoriteDto, ...options }
1626
+ );
1627
+ };
1628
+ const stockingGetPurchases = (orgSlug, params, options) => {
1629
+ return axiosInstance.get(
1630
+ `/v3/${orgSlug}/stocking/purchases`,
1631
+ {
1632
+ ...options,
1633
+ params: { ...params, ...options?.params }
1634
+ }
1635
+ );
1636
+ };
1637
+ const stockingCreatePurchase = (orgSlug, createPurchaseDto, options) => {
1638
+ return axiosInstance.post(
1639
+ `/v3/${orgSlug}/stocking/purchases`,
1640
+ createPurchaseDto,
1641
+ options
1642
+ );
1643
+ };
1644
+ const stockingReceivePurchase = (orgSlug, id, receivePurchaseDto, options) => {
1645
+ return axiosInstance.post(
1646
+ `/v3/${orgSlug}/stocking/purchases/${id}/receive`,
1647
+ receivePurchaseDto,
1648
+ options
1649
+ );
1650
+ };
1651
+ const stockingGetTransfers = (orgSlug, params, options) => {
1652
+ return axiosInstance.get(
1653
+ `/v3/${orgSlug}/stocking/transfers`,
1654
+ {
1655
+ ...options,
1656
+ params: { ...params, ...options?.params }
1657
+ }
1658
+ );
1659
+ };
1660
+ const stockingCreateTransfer = (orgSlug, createTransferDto, options) => {
1661
+ return axiosInstance.post(
1662
+ `/v3/${orgSlug}/stocking/transfers`,
1663
+ createTransferDto,
1664
+ options
1665
+ );
1666
+ };
1667
+ const stockingShipTransfer = (orgSlug, id, shipTransferDto, options) => {
1668
+ return axiosInstance.post(
1669
+ `/v3/${orgSlug}/stocking/transfers/${id}/ship`,
1670
+ shipTransferDto,
1671
+ options
1672
+ );
1673
+ };
1674
+ const stockingReceiveTransfer = (orgSlug, id, receiveTransferDto, options) => {
1675
+ return axiosInstance.post(
1676
+ `/v3/${orgSlug}/stocking/transfers/${id}/receive`,
1677
+ receiveTransferDto,
1678
+ options
1679
+ );
1680
+ };
1681
+ const stockingGetRequests = (orgSlug, params, options) => {
1682
+ return axiosInstance.get(
1683
+ `/v3/${orgSlug}/stocking/requests`,
1684
+ {
1685
+ ...options,
1686
+ params: { ...params, ...options?.params }
1687
+ }
1688
+ );
1689
+ };
1690
+ const stockingGetPendingDispatch = (orgSlug, params, options) => {
1691
+ return axiosInstance.get(
1692
+ `/v3/${orgSlug}/stocking/reconciliation/pending-dispatch`,
1693
+ {
1694
+ ...options,
1695
+ params: { ...params, ...options?.params }
1696
+ }
1697
+ );
1698
+ };
1699
+ const stockingDispatchOrders = (orgSlug, dispatchOrderDto, options) => {
1700
+ return axiosInstance.post(
1701
+ `/v3/${orgSlug}/stocking/reconciliation/dispatch`,
1702
+ dispatchOrderDto,
1703
+ options
1704
+ );
1705
+ };
1706
+ const stockingGetActiveDeliveries = (orgSlug, params, options) => {
1707
+ return axiosInstance.get(
1708
+ `/v3/${orgSlug}/stocking/reconciliation/active-deliveries`,
1709
+ {
1710
+ ...options,
1711
+ params: { ...params, ...options?.params }
1712
+ }
1713
+ );
1714
+ };
1715
+ const stockingReconcilePod = (orgSlug, reconcilePodDto, options) => {
1716
+ return axiosInstance.post(
1717
+ `/v3/${orgSlug}/stocking/reconciliation/reconcile-pod`,
1718
+ reconcilePodDto,
1719
+ options
1720
+ );
1721
+ };
1722
+ const stockingGetPhysicalReconciliations = (orgSlug, params, options) => {
1723
+ return axiosInstance.get(
1724
+ `/v3/${orgSlug}/stocking/physical-reconciliations`,
1725
+ {
1726
+ ...options,
1727
+ params: { ...params, ...options?.params }
1728
+ }
1729
+ );
1730
+ };
1731
+ const stockingSubmitPhysicalReconciliation = (orgSlug, submitReconciliationDto, options) => {
1732
+ return axiosInstance.post(
1733
+ `/v3/${orgSlug}/stocking/physical-reconciliations`,
1734
+ submitReconciliationDto,
1735
+ options
1736
+ );
1737
+ };
1738
+ const stockingGetReconciliationReport = (orgSlug, id, options) => {
1739
+ return axiosInstance.get(
1740
+ `/v3/${orgSlug}/stocking/physical-reconciliations/${id}/report`,
1741
+ options
1742
+ );
1743
+ };
1744
+ const stockingGetPartners = (orgSlug, options) => {
1745
+ return axiosInstance.get(
1746
+ `/v3/${orgSlug}/stocking/partners`,
1747
+ options
1748
+ );
1749
+ };
1750
+ const stockingCreatePartner = (orgSlug, createPartnerDto, options) => {
1751
+ return axiosInstance.post(
1752
+ `/v3/${orgSlug}/stocking/partners`,
1753
+ createPartnerDto,
1754
+ options
1755
+ );
1756
+ };
1757
+ const stockingGetPartner = (orgSlug, id, options) => {
1758
+ return axiosInstance.get(
1759
+ `/v3/${orgSlug}/stocking/partners/${id}`,
1760
+ options
1761
+ );
1762
+ };
1763
+ const stockingUpdatePartner = (orgSlug, id, updatePartnerDto, options) => {
1764
+ return axiosInstance.patch(
1765
+ `/v3/${orgSlug}/stocking/partners/${id}`,
1766
+ updatePartnerDto,
1767
+ options
1768
+ );
1769
+ };
1770
+ const stockingAdjustPartnerWallet = (orgSlug, id, partnerWalletActionDto, options) => {
1771
+ return axiosInstance.post(
1772
+ `/v3/${orgSlug}/stocking/partners/${id}/wallet/adjust`,
1773
+ partnerWalletActionDto,
1774
+ options
1775
+ );
1776
+ };
1777
+ const standalonePosControllerCreateSetupKey = (createSetupKeyDto, options) => {
1778
+ return axiosInstance.post(
1779
+ `/v3/standalone-pos/setup-keys`,
1780
+ createSetupKeyDto,
1781
+ options
1782
+ );
1783
+ };
1784
+ const standalonePosControllerActivateDevice = (activateDeviceDto, options) => {
1785
+ return axiosInstance.post(
1786
+ `/v3/standalone-pos/activate`,
1787
+ activateDeviceDto,
1788
+ options
1789
+ );
1790
+ };
1791
+ const standalonePosControllerValidateKey = (options) => {
1792
+ return axiosInstance.get(
1793
+ `/v3/standalone-pos/validate`,
1794
+ options
1795
+ );
1796
+ };
1797
+ const standalonePosControllerLinkOrganization = (linkOrganizationDto, options) => {
1798
+ return axiosInstance.patch(
1799
+ `/v3/standalone-pos/link-org`,
1800
+ linkOrganizationDto,
1801
+ options
1802
+ );
1803
+ };
1804
+ const b2BGetCatalog = (orgSlug, params, options) => {
1805
+ return axiosInstance.get(
1806
+ `/v3/${orgSlug}/b2b/catalog`,
1807
+ {
1808
+ ...options,
1809
+ params: { ...params, ...options?.params }
1810
+ }
1811
+ );
1812
+ };
1813
+ const b2BGetInvoices = (orgSlug, options) => {
1814
+ return axiosInstance.get(
1815
+ `/v3/${orgSlug}/b2b/invoices`,
1816
+ options
1817
+ );
1818
+ };
1819
+ const b2BGetOrders = (orgSlug, options) => {
1820
+ return axiosInstance.get(
1821
+ `/v3/${orgSlug}/b2b/orders`,
1822
+ options
1823
+ );
1824
+ };
1825
+ const b2BCreateOrder = (orgSlug, createB2BOrderDto, options) => {
1826
+ return axiosInstance.post(
1827
+ `/v3/${orgSlug}/b2b/orders`,
1828
+ createB2BOrderDto,
1829
+ options
1830
+ );
1831
+ };
1832
+ const b2BCreateQuote = (orgSlug, createB2BOrderDto, options) => {
1833
+ return axiosInstance.post(
1834
+ `/v3/${orgSlug}/b2b/quotes`,
1835
+ createB2BOrderDto,
1836
+ options
1837
+ );
1838
+ };
1839
+ const crmIntegrationsGetAuthUrl = (orgSlug, provider, options) => {
1840
+ return axiosInstance.get(
1841
+ `/v3/${orgSlug}/crm-integrations/${provider}/auth`,
1842
+ options
1843
+ );
1844
+ };
1845
+ const crmIntegrationsHandleCallback = (orgSlug, provider, params, options) => {
1846
+ return axiosInstance.get(
1847
+ `/v3/${orgSlug}/crm-integrations/${provider}/callback`,
1848
+ {
1849
+ ...options,
1850
+ params: { ...params, ...options?.params }
1851
+ }
1852
+ );
1853
+ };
1854
+ const crmIntegrationsHandleWebhook = (orgSlug, provider, options) => {
1855
+ return axiosInstance.post(
1856
+ `/v3/${orgSlug}/crm-integrations/${provider}/webhook`,
1857
+ void 0,
1858
+ options
1859
+ );
1860
+ };
1861
+ const crmIntegrationsReplyToActivity = (orgSlug, id, options) => {
1862
+ return axiosInstance.post(
1863
+ `/v3/${orgSlug}/crm-integrations/activities/${id}/reply`,
1864
+ void 0,
1865
+ options
1866
+ );
1867
+ };
1868
+ const unitsGetUnits = (orgSlug, params, options) => {
1869
+ return axiosInstance.get(
1870
+ `/v3/${orgSlug}/units`,
1871
+ {
1872
+ ...options,
1873
+ params: { ...params, ...options?.params }
1874
+ }
1875
+ );
1876
+ };
1877
+ const strapiCreateConnection = (orgSlug, createStrapiConnectionDto, options) => {
1878
+ return axiosInstance.post(
1879
+ `/v3/${orgSlug}/strapi/connections`,
1880
+ createStrapiConnectionDto,
1881
+ options
1882
+ );
1883
+ };
1884
+ const strapiListConnections = (orgSlug, options) => {
1885
+ return axiosInstance.get(
1886
+ `/v3/${orgSlug}/strapi/connections`,
1887
+ options
1888
+ );
1889
+ };
1890
+ const strapiGetConnection = (orgSlug, connectionId, options) => {
1891
+ return axiosInstance.get(
1892
+ `/v3/${orgSlug}/strapi/connections/${connectionId}`,
1893
+ options
1894
+ );
1895
+ };
1896
+ const strapiUpdateConnection = (orgSlug, connectionId, updateStrapiConnectionDto, options) => {
1897
+ return axiosInstance.patch(
1898
+ `/v3/${orgSlug}/strapi/connections/${connectionId}`,
1899
+ updateStrapiConnectionDto,
1900
+ options
1901
+ );
1902
+ };
1903
+ const strapiDeleteConnection = (orgSlug, connectionId, options) => {
1904
+ return axiosInstance.delete(
1905
+ `/v3/${orgSlug}/strapi/connections/${connectionId}`,
1906
+ options
1907
+ );
1908
+ };
1909
+ const strapiTriggerSync = (orgSlug, connectionId, triggerSyncDto, options) => {
1910
+ return axiosInstance.post(
1911
+ `/v3/${orgSlug}/strapi/connections/${connectionId}/sync`,
1912
+ triggerSyncDto,
1913
+ options
1914
+ );
1915
+ };
1916
+ const strapiEnqueueSync = (orgSlug, connectionId, triggerSyncDto, options) => {
1917
+ return axiosInstance.post(
1918
+ `/v3/${orgSlug}/strapi/connections/${connectionId}/sync/queue`,
1919
+ triggerSyncDto,
1920
+ options
1921
+ );
1922
+ };
1923
+ const strapiGetWebhookLogs = (orgSlug, connectionId, options) => {
1924
+ return axiosInstance.get(
1925
+ `/v3/${orgSlug}/strapi/connections/${connectionId}/webhook-logs`,
1926
+ options
1927
+ );
1928
+ };
1929
+ const strapiGetSyncLogs = (orgSlug, connectionId, options) => {
1930
+ return axiosInstance.get(
1931
+ `/v3/${orgSlug}/strapi/connections/${connectionId}/sync-logs`,
1932
+ options
1933
+ );
1934
+ };
1935
+ const strapiExchangeCustomerToken = (orgSlug, connectionId, options) => {
1936
+ return axiosInstance.post(
1937
+ `/v3/${orgSlug}/strapi/connections/${connectionId}/customers/exchange-token`,
1938
+ void 0,
1939
+ options
1940
+ );
1941
+ };
1942
+ const strapiRegisterCustomer = (orgSlug, connectionId, options) => {
1943
+ return axiosInstance.post(
1944
+ `/v3/${orgSlug}/strapi/connections/${connectionId}/customers/register`,
1945
+ void 0,
1946
+ options
1947
+ );
1948
+ };
1949
+ const strapiReceiveWebhook = (connectionId, options) => {
1950
+ return axiosInstance.post(
1951
+ `/v3/webhooks/strapi/${connectionId}`,
1952
+ void 0,
1953
+ options
1954
+ );
1955
+ };
1956
+ const analyticsControllerGetDashboardAnalytics = (orgSlug, options) => {
1957
+ return axiosInstance.get(
1958
+ `/v3/${orgSlug}/analytics/dashboard`,
1959
+ options
1960
+ );
1961
+ };
1962
+ const analyticsControllerGetResourceUtilization = (orgSlug, params, options) => {
1963
+ return axiosInstance.get(
1964
+ `/v3/${orgSlug}/analytics/utilization`,
1965
+ {
1966
+ ...options,
1967
+ params: { ...params, ...options?.params }
1968
+ }
1969
+ );
1970
+ };
1971
+ return { servicesCreateCategory, servicesGetCategories, servicesUpdateCategory, servicesDeleteCategory, servicesCreateService, servicesGetServices, servicesGetCurrentMemberShifts, servicesGetShifts, servicesGetService, servicesUpdateService, servicesGetAvailability, servicesDeleteService, servicesCreateResource, servicesGetResources, servicesUpdateResource, servicesDeleteResource, servicesCreateBooking, servicesGetBookings, servicesGetBooking, servicesUpdateBookingStatus, servicesCompleteBooking, servicesCancelBookingSeries, servicesCreateShift, servicesGetStaffShifts, servicesAddBreak, servicesRegisterCustomerApp, servicesGetUtilization, servicesGetPerformance, servicesGetFunnel, publicServicesListServices, publicServicesGetCategories, publicServicesGetService, publicServicesGetAvailability, publicServicesRequestOtp, publicServicesVerifyOtp, publicServicesCreatePublicBooking, inventoryVerifyIntegrity, inventoryFixIntegrity, inventoryGetInventory, inventoryTraceBatch, inventorySplitBatch, inventoryMergeBatches, inventoryCreateAssembly, inventoryCompleteAssembly, inventoryRequestAdjustment, inventoryGetAdjustments, inventoryApproveAdjustment, inventoryRejectAdjustment, inventoryGetLeadTime, inventoryGetWasteAnalysis, inventoryCheckB2BAvailability, inventoryUnpackBatch, inventoryScanUnpackBatch, inventoryQuickStockInquiry, expenseControllerCreateExpense, expenseControllerGetExpenses, expenseControllerGetExpenseCategories, expenseControllerGetExpense, pettyCashControllerCreateFund, pettyCashControllerGetFunds, pettyCashControllerGetFund, pettyCashControllerTopUpFund, pettyCashControllerGetFundTransactions, utilityAccountControllerCreateAccount, utilityAccountControllerGetAccounts, utilityAccountControllerGetAccount, accountingInitialize, accountingGetProfitLoss, accountingGetBalanceSheet, accountingGetCashFlow, accountingGetTaxSummary, invoiceControllerCreateInvoice, invoiceControllerGetInvoices, invoiceControllerGetInvoice, invoiceControllerUpdateInvoice, invoiceControllerDeleteInvoice, invoiceControllerFinalizeInvoice, invoiceControllerGetTemplates, invoiceControllerCreateTemplate, invoiceControllerGetConfig, invoiceControllerUpdateConfig, publicInvoiceControllerDownloadInvoice, publicInvoiceControllerDownloadInvoiceByTransaction, publicInvoiceControllerDownloadReceipt, publicInvoiceControllerGeneratePublicLink, authExchangeToken, authCreateOAuthClient, authListOAuthClients, authGetOAuthClient, authUpdateOAuthClient, authDeleteOAuthClient, authControllerHandleOAuth2, adminControllerGetStats, adminControllerListOrganizations, adminControllerCreateOrganization, adminControllerGetOrganizationDetails, adminControllerUpdateOrganization, adminControllerDeleteOrganization, adminControllerSuspendOrganization, adminControllerReactivateOrganization, adminControllerGetEffectiveQuota, adminControllerSetQuotaOverrides, adminControllerListMembers, adminControllerListUsers, adminControllerBanUser, adminControllerUnbanUser, adminControllerListConnectedApps, adminControllerListSystemLogs, adminControllerListGlobalSettings, adminControllerSetGlobalSetting, adminControllerDeleteGlobalSetting, adminControllerListTiers, adminControllerDefineTier, adminControllerDeleteTier, adminControllerGetOrganizationSubscription, adminControllerUpdateOrganizationSubscription, adminControllerListSystemPayments, adminControllerRecordCustomPayment, adminControllerListIntegrationDefinitions, adminControllerCreateIntegrationDefinition, adminControllerUpdateIntegrationDefinition, adminControllerDeleteIntegrationDefinition, adminControllerListActiveOrganizationIntegrations, webhooksCreate, webhooksList, webhooksDelete, catalogGetProducts, catalogCreateProduct, catalogGetProduct, catalogGetServices, catalogUpdateProduct, catalogUpdateSupplierVariant, catalogGetPriceChangeRequests, catalogReviewPriceChangeRequest, catalogCreateReview, catalogUpdateReview, catalogDeleteReview, customersGetCustomers, customersRegister, customerRegister, customersLogin, customersRefreshSession, customersGetCurrentSession, customersGetSessions, customersRevokeAllSessions, customersRevokeSession, customersUpdate, customersGetCustomerById, customersDelete, customersGetAddresses, customersAddAddress, businessAccountControllerCreate, businessAccountControllerGetOne, crmControllerCreateRecord, crmControllerGetRecord, crmControllerUpdateRecord, crmControllerCreateNote, crmControllerGetRecordNotes, crmControllerCreateActivity, crmControllerGetTimeline, crmControllerCreateObject, crmControllerListObjects, crmControllerCreateField, crmControllerListFields, crmControllerCreateRelationship, crmControllerListRelationships, crmControllerCreateAssociation, crmControllerListRecordAssociations, loyaltyRedeemReward, loyaltyGetCustomerStatus, loyaltyValidateVoucher, ordersCreateOrder, ordersGetOrders, ordersUpdateStatus, ordersRequestB2BQuote, ordersConvertQuoteToOrder, paymentsCheckout, paymentsControllerHandleStkCallback, pOSProvision, pOSLogin, pOSGetMe, pOSProcessSale, pOSSync, pOSGetTransactions, pOSRegisterPettyCash, pOSGetPettyCashFunds, pOSGetPettyCashTransactions, pOSCreatePairingSession, pOSGetPairingSessionStatus, pOSAuthorizePairingSession, membersControllerGetMembers, membersControllerCreateMember, membersControllerGetMember, membersControllerUpdateMember, membersControllerDeleteMember, membersControllerGetMemberActivity, membersControllerUpdateStatus, membersControllerAdminCheckOut, terminalMembersControllerLogin, invitationsList, invitationsCreate, invitationsRevoke, invitationsAccept, roleManagementControllerGetCustomRoles, roleManagementControllerCreateCustomRole, roleManagementControllerUpdateCustomRole, roleManagementControllerDeleteCustomRole, roleManagementControllerGetPermissionSets, roleManagementControllerCreatePermissionSet, roleManagementControllerGetRoleGroups, roleManagementControllerCreateRoleGroup, roleManagementControllerAssignRoles, roleManagementControllerRemoveRoles, departmentsList, departmentsCreate, departmentsGet, departmentsUpdate, departmentsDelete, departmentsAddMember, departmentsRemoveMember, attendanceControllerGetLogs, attendanceControllerCheckIn, attendanceControllerCheckOut, attendanceControllerGetMyStatus, attendanceControllerGetStatus, announcementControllerBroadcastAnnouncement, cartControllerGetCart, cartControllerClearCart, cartControllerAddToCart, cartControllerRemoveFromCart, favoritesControllerGetFavorites, favoritesControllerAddFavorite, favoritesControllerRemoveFavorite, stockingGetPurchases, stockingCreatePurchase, stockingReceivePurchase, stockingGetTransfers, stockingCreateTransfer, stockingShipTransfer, stockingReceiveTransfer, stockingGetRequests, stockingGetPendingDispatch, stockingDispatchOrders, stockingGetActiveDeliveries, stockingReconcilePod, stockingGetPhysicalReconciliations, stockingSubmitPhysicalReconciliation, stockingGetReconciliationReport, stockingGetPartners, stockingCreatePartner, stockingGetPartner, stockingUpdatePartner, stockingAdjustPartnerWallet, standalonePosControllerCreateSetupKey, standalonePosControllerActivateDevice, standalonePosControllerValidateKey, standalonePosControllerLinkOrganization, b2BGetCatalog, b2BGetInvoices, b2BGetOrders, b2BCreateOrder, b2BCreateQuote, crmIntegrationsGetAuthUrl, crmIntegrationsHandleCallback, crmIntegrationsHandleWebhook, crmIntegrationsReplyToActivity, unitsGetUnits, strapiCreateConnection, strapiListConnections, strapiGetConnection, strapiUpdateConnection, strapiDeleteConnection, strapiTriggerSync, strapiEnqueueSync, strapiGetWebhookLogs, strapiGetSyncLogs, strapiExchangeCustomerToken, strapiRegisterCustomer, strapiReceiveWebhook, analyticsControllerGetDashboardAnalytics, analyticsControllerGetResourceUtilization };
1972
+ };
1973
+
1974
+ // src/proxy.ts
1975
+ function getEnvOrgSlug() {
1976
+ if (typeof process !== "undefined" && process.env) {
1977
+ const slug = process.env.SCRYME_ORG_SLUG || process.env.NEXT_PUBLIC_SCRYME_ORG_SLUG;
1978
+ if (slug) return slug;
1979
+ }
1980
+ try {
1981
+ const getMeta = new Function("return typeof import.meta !== 'undefined' ? import.meta : undefined");
1982
+ const meta = getMeta();
1983
+ if (meta && meta.env) {
1984
+ const slug = meta.env.VITE_SCRYME_ORG_SLUG || meta.env.SCRYME_ORG_SLUG;
1985
+ if (slug) return slug;
1986
+ }
1987
+ } catch (e) {
1988
+ }
1989
+ return void 0;
1990
+ }
1991
+ function expectsOrgSlug(fn) {
1992
+ const fnStr = fn.toString();
1993
+ const match = fnStr.match(/^\s*(?:async\s+)?\(([^)]+)\)/);
1994
+ if (!match) {
1995
+ const singleMatch = fnStr.match(/^\s*(\w+)\s*=>/);
1996
+ return singleMatch ? singleMatch[1] === "orgSlug" : false;
1997
+ }
1998
+ const firstParam = match[1].split(",")[0].split(":")[0].trim();
1999
+ return firstParam === "orgSlug";
2000
+ }
2001
+ function getStringParamCount(fn) {
2002
+ const fnStr = fn.toString();
2003
+ const match = fnStr.match(/^\s*(?:async\s+)?\(([^)]+)\)/);
2004
+ if (!match) return 0;
2005
+ const params = match[1].split(",").map((p) => p.trim());
2006
+ let count = 0;
2007
+ for (const param of params) {
2008
+ const cleanParam = param.split(":")[0].split("=")[0].trim();
2009
+ const lower = cleanParam.toLowerCase();
2010
+ if (lower === "params" || lower === "options" || lower.endsWith("dto") || lower.endsWith("body") || lower.endsWith("payload")) {
2011
+ break;
2012
+ }
2013
+ count++;
2014
+ }
2015
+ return count;
2016
+ }
2017
+ var getScrymeV3API2 = (axiosInstance, defaultOrgSlug) => {
2018
+ const api = getScrymeV3API(axiosInstance);
2019
+ return new Proxy(api, {
2020
+ get(target, prop, receiver) {
2021
+ const originalValue = Reflect.get(target, prop, receiver);
2022
+ if (typeof originalValue === "function") {
2023
+ if (expectsOrgSlug(originalValue)) {
2024
+ return function(...args) {
2025
+ const stringParamsExpected = getStringParamCount(originalValue);
2026
+ const stringArgsPassed = args.filter((arg) => typeof arg === "string").length;
2027
+ if (stringArgsPassed < stringParamsExpected) {
2028
+ const envSlug = defaultOrgSlug || getEnvOrgSlug() || "default-org";
2029
+ return originalValue.apply(this, [envSlug, ...args]);
2030
+ }
2031
+ return originalValue.apply(this, args);
2032
+ };
2033
+ }
2034
+ }
2035
+ return originalValue;
2036
+ }
2037
+ });
2038
+ };
2039
+
2040
+ // src/base.ts
2041
+ var methodsWithOrgSlugSet = /* @__PURE__ */ new Set([
2042
+ "publicServicesListServices",
2043
+ "publicServicesGetCategories",
2044
+ "publicServicesGetService",
2045
+ "publicServicesGetAvailability",
2046
+ "publicServicesRequestOtp",
2047
+ "publicServicesVerifyOtp",
2048
+ "publicServicesCreatePublicBooking",
2049
+ "inventoryVerifyIntegrity",
2050
+ "inventoryFixIntegrity",
2051
+ "inventoryGetInventory",
2052
+ "inventoryTraceBatch",
2053
+ "inventorySplitBatch",
2054
+ "inventoryMergeBatches",
2055
+ "inventoryCreateAssembly",
2056
+ "inventoryCompleteAssembly",
2057
+ "inventoryRequestAdjustment",
2058
+ "inventoryGetAdjustments",
2059
+ "inventoryApproveAdjustment",
2060
+ "inventoryRejectAdjustment",
2061
+ "inventoryGetLeadTime",
2062
+ "inventoryGetWasteAnalysis",
2063
+ "inventoryCheckB2BAvailability",
2064
+ "inventoryUnpackBatch",
2065
+ "inventoryScanUnpackBatch",
2066
+ "inventoryQuickStockInquiry",
2067
+ "accountingInitialize",
2068
+ "accountingGetProfitLoss",
2069
+ "accountingGetBalanceSheet",
2070
+ "accountingGetCashFlow",
2071
+ "accountingGetTaxSummary",
2072
+ "webhooksCreate",
2073
+ "webhooksList",
2074
+ "webhooksDelete",
2075
+ "paymentsCheckout",
2076
+ "catalogGetProducts",
2077
+ "catalogGetProduct",
2078
+ "catalogCreateProduct",
2079
+ "catalogGetServices",
2080
+ "catalogUpdateProduct",
2081
+ "catalogUpdateSupplierVariant",
2082
+ "catalogGetPriceChangeRequests",
2083
+ "catalogReviewPriceChangeRequest",
2084
+ "catalogCreateReview",
2085
+ "catalogUpdateReview",
2086
+ "catalogDeleteReview",
2087
+ "servicesCreateCategory",
2088
+ "servicesGetCategories",
2089
+ "servicesUpdateCategory",
2090
+ "servicesDeleteCategory",
2091
+ "servicesCreateService",
2092
+ "servicesGetServices",
2093
+ "servicesGetCurrentMemberShifts",
2094
+ "servicesGetShifts",
2095
+ "servicesGetService",
2096
+ "servicesUpdateService",
2097
+ "servicesDeleteService",
2098
+ "servicesCreateResource",
2099
+ "servicesGetResources",
2100
+ "servicesUpdateResource",
2101
+ "servicesDeleteResource",
2102
+ "servicesCreateBooking",
2103
+ "servicesGetBookings",
2104
+ "servicesGetBooking",
2105
+ "servicesGetAvailability",
2106
+ "servicesUpdateBookingStatus",
2107
+ "servicesCompleteBooking",
2108
+ "servicesCancelBookingSeries",
2109
+ "servicesCreateShift",
2110
+ "servicesGetStaffShifts",
2111
+ "servicesAddBreak",
2112
+ "servicesRegisterCustomerApp",
2113
+ "servicesGetUtilization",
2114
+ "servicesGetPerformance",
2115
+ "servicesGetFunnel",
2116
+ "customersGetCustomers",
2117
+ "customersRegister",
2118
+ "customersUpdate",
2119
+ "customersGetCustomerById",
2120
+ "customersDelete",
2121
+ "customersGetAddresses",
2122
+ "customersAddAddress",
2123
+ "customersGetCurrentSession",
2124
+ "customersGetSessions",
2125
+ "customersRevokeSession",
2126
+ "customersRevokeAllSessions",
2127
+ "customersRefreshSession",
2128
+ "businessAccountControllerCreate",
2129
+ "businessAccountControllerGetOne",
2130
+ "crmControllerCreateRecord",
2131
+ "crmControllerGetRecord",
2132
+ "crmControllerUpdateRecord",
2133
+ "crmControllerCreateNote",
2134
+ "crmControllerGetRecordNotes",
2135
+ "crmControllerCreateActivity",
2136
+ "crmControllerGetTimeline",
2137
+ "crmControllerCreateObject",
2138
+ "crmControllerListObjects",
2139
+ "crmControllerCreateField",
2140
+ "crmControllerListFields",
2141
+ "crmControllerCreateRelationship",
2142
+ "crmControllerListRelationships",
2143
+ "crmControllerCreateAssociation",
2144
+ "crmControllerListRecordAssociations",
2145
+ "loyaltyRedeemReward",
2146
+ "loyaltyGetCustomerStatus",
2147
+ "loyaltyValidateVoucher",
2148
+ "ordersCreateOrder",
2149
+ "ordersGetOrders",
2150
+ "ordersUpdateStatus",
2151
+ "ordersRequestB2BQuote",
2152
+ "ordersConvertQuoteToOrder",
2153
+ "paymentsControllerHandleStkCallback",
2154
+ "pOSProvision",
2155
+ "pOSLogin",
2156
+ "pOSGetMe",
2157
+ "pOSProcessSale",
2158
+ "pOSSync",
2159
+ "pOSGetTransactions",
2160
+ "pOSRegisterPettyCash",
2161
+ "pOSGetPettyCashFunds",
2162
+ "pOSGetPettyCashTransactions",
2163
+ "membersControllerGetMembers",
2164
+ "membersControllerCreateMember",
2165
+ "membersControllerGetMember",
2166
+ "membersControllerUpdateMember",
2167
+ "membersControllerDeleteMember",
2168
+ "membersControllerGetMemberActivity",
2169
+ "membersControllerUpdateStatus",
2170
+ "membersControllerAdminCheckOut",
2171
+ "invitationsList",
2172
+ "invitationsCreate",
2173
+ "invitationsRevoke",
2174
+ "invitationsAccept",
2175
+ "roleManagementControllerGetCustomRoles",
2176
+ "roleManagementControllerCreateCustomRole",
2177
+ "roleManagementControllerUpdateCustomRole",
2178
+ "roleManagementControllerDeleteCustomRole",
2179
+ "roleManagementControllerGetPermissionSets",
2180
+ "roleManagementControllerCreatePermissionSet",
2181
+ "roleManagementControllerGetRoleGroups",
2182
+ "roleManagementControllerCreateRoleGroup",
2183
+ "roleManagementControllerAssignRoles",
2184
+ "roleManagementControllerRemoveRoles",
2185
+ "departmentsList",
2186
+ "cartControllerGetCart",
2187
+ "cartControllerClearCart",
2188
+ "cartControllerAddToCart",
2189
+ "cartControllerRemoveFromCart",
2190
+ "favoritesControllerGetFavorites",
2191
+ "favoritesControllerAddFavorite",
2192
+ "favoritesControllerRemoveFavorite"
2193
+ ]);
2194
+ var catalogMapping = {
2195
+ getProducts: "catalogGetProducts",
2196
+ getProduct: "catalogGetProduct",
2197
+ createProduct: "catalogCreateProduct",
2198
+ getServices: "catalogGetServices",
2199
+ updateProduct: "catalogUpdateProduct",
2200
+ updateSupplierVariant: "catalogUpdateSupplierVariant",
2201
+ getPriceChangeRequests: "catalogGetPriceChangeRequests",
2202
+ reviewPriceChangeRequest: "catalogReviewPriceChangeRequest",
2203
+ createReview: "catalogCreateReview",
2204
+ updateReview: "catalogUpdateReview",
2205
+ deleteReview: "catalogDeleteReview",
2206
+ createServiceCategory: "servicesCreateCategory",
2207
+ getServiceCategories: "servicesGetCategories",
2208
+ updateServiceCategory: "servicesUpdateCategory",
2209
+ deleteServiceCategory: "servicesDeleteCategory",
2210
+ createService: "servicesCreateService",
2211
+ getServicesList: "servicesGetServices",
2212
+ getCurrentMemberShifts: "servicesGetCurrentMemberShifts",
2213
+ getShifts: "servicesGetShifts",
2214
+ getService: "servicesGetService",
2215
+ updateService: "servicesUpdateService",
2216
+ deleteService: "servicesDeleteService",
2217
+ createResource: "servicesCreateResource",
2218
+ getResources: "servicesGetResources",
2219
+ updateResource: "servicesUpdateResource",
2220
+ deleteResource: "servicesDeleteResource",
2221
+ createBooking: "servicesCreateBooking",
2222
+ getBookings: "servicesGetBookings",
2223
+ getBooking: "servicesGetBooking",
2224
+ updateBookingStatus: "servicesUpdateBookingStatus",
2225
+ completeBooking: "servicesCompleteBooking",
2226
+ createShift: "servicesCreateShift",
2227
+ getStaffShifts: "servicesGetStaffShifts",
2228
+ addBreak: "servicesAddBreak",
2229
+ registerCustomerApp: "servicesRegisterCustomerApp",
2230
+ getServiceUtilization: "servicesGetUtilization",
2231
+ getServicePerformance: "servicesGetPerformance",
2232
+ getServiceFunnel: "servicesGetFunnel"
2233
+ };
2234
+ var authMapping = {
2235
+ exchangeToken: "authExchangeToken",
2236
+ createOAuthClient: "authCreateOAuthClient",
2237
+ listOAuthClients: "authListOAuthClients",
2238
+ getOAuthClient: "authGetOAuthClient",
2239
+ updateOAuthClient: "authUpdateOAuthClient",
2240
+ deleteOAuthClient: "authDeleteOAuthClient",
2241
+ handleOAuth2: "authControllerHandleOAuth2"
2242
+ };
2243
+ var inventoryMapping = {
2244
+ verifyIntegrity: "inventoryVerifyIntegrity",
2245
+ fixIntegrity: "inventoryFixIntegrity",
2246
+ getInventory: "inventoryGetInventory",
2247
+ traceBatch: "inventoryTraceBatch",
2248
+ splitBatch: "inventorySplitBatch",
2249
+ mergeBatches: "inventoryMergeBatches",
2250
+ createAssembly: "inventoryCreateAssembly",
2251
+ completeAssembly: "inventoryCompleteAssembly",
2252
+ requestAdjustment: "inventoryRequestAdjustment",
2253
+ getAdjustments: "inventoryGetAdjustments",
2254
+ approveAdjustment: "inventoryApproveAdjustment",
2255
+ rejectAdjustment: "inventoryRejectAdjustment",
2256
+ getLeadTime: "inventoryGetLeadTime",
2257
+ getWasteAnalysis: "inventoryGetWasteAnalysis",
2258
+ checkB2BAvailability: "inventoryCheckB2BAvailability",
2259
+ unpackBatch: "inventoryUnpackBatch",
2260
+ scanUnpackBatch: "inventoryScanUnpackBatch",
2261
+ quickStockInquiry: "inventoryQuickStockInquiry",
2262
+ getPurchases: "stockingGetPurchases",
2263
+ createPurchase: "stockingCreatePurchase",
2264
+ receivePurchase: "stockingReceivePurchase",
2265
+ getTransfers: "stockingGetTransfers",
2266
+ createTransfer: "stockingCreateTransfer",
2267
+ shipTransfer: "stockingShipTransfer",
2268
+ receiveTransfer: "stockingReceiveTransfer",
2269
+ getRequests: "stockingGetRequests",
2270
+ getPendingDispatch: "stockingGetPendingDispatch",
2271
+ dispatchOrders: "stockingDispatchOrders",
2272
+ getActiveDeliveries: "stockingGetActiveDeliveries",
2273
+ reconcilePod: "stockingReconcilePod",
2274
+ getPhysicalReconciliations: "stockingGetPhysicalReconciliations",
2275
+ submitPhysicalReconciliation: "stockingSubmitPhysicalReconciliation",
2276
+ getReconciliationReport: "stockingGetReconciliationReport",
2277
+ getPartners: "stockingGetPartners",
2278
+ createPartner: "stockingCreatePartner",
2279
+ getPartner: "stockingGetPartner",
2280
+ updatePartner: "stockingUpdatePartner",
2281
+ adjustPartnerWallet: "stockingAdjustPartnerWallet",
2282
+ getUnits: "unitsGetUnits"
2283
+ };
2284
+ var ordersMapping = {
2285
+ createOrder: "ordersCreateOrder",
2286
+ getOrders: "ordersGetOrders",
2287
+ updateStatus: "ordersUpdateStatus",
2288
+ requestB2BQuote: "ordersRequestB2BQuote",
2289
+ convertQuoteToOrder: "ordersConvertQuoteToOrder",
2290
+ getCatalog: "b2BGetCatalog",
2291
+ getInvoices: "b2BGetInvoices",
2292
+ createQuote: "b2BCreateQuote",
2293
+ getB2BCatalog: "b2BGetCatalog",
2294
+ getB2BInvoices: "b2BGetInvoices",
2295
+ getB2BOrders: "b2BGetOrders",
2296
+ createB2BOrder: "b2BCreateOrder",
2297
+ createB2BQuote: "b2BCreateQuote",
2298
+ getCart: "cartControllerGetCart",
2299
+ clearCart: "cartControllerClearCart",
2300
+ addToCart: "cartControllerAddToCart",
2301
+ removeFromCart: "cartControllerRemoveFromCart",
2302
+ checkout: "paymentsCheckout",
2303
+ handleStkCallback: "paymentsControllerHandleStkCallback"
2304
+ };
2305
+ var webhooksMapping = {
2306
+ create: "webhooksCreate",
2307
+ list: "webhooksList",
2308
+ delete: "webhooksDelete"
2309
+ };
2310
+ var crmMapping = {
2311
+ createRecord: "crmControllerCreateRecord",
2312
+ getRecord: "crmControllerGetRecord",
2313
+ updateRecord: "crmControllerUpdateRecord",
2314
+ createNote: "crmControllerCreateNote",
2315
+ getRecordNotes: "crmControllerGetRecordNotes",
2316
+ createActivity: "crmControllerCreateActivity",
2317
+ getTimeline: "crmControllerGetTimeline",
2318
+ createObject: "crmControllerCreateObject",
2319
+ listObjects: "crmControllerListObjects",
2320
+ createField: "crmControllerCreateField",
2321
+ listFields: "crmControllerListFields",
2322
+ createRelationship: "crmControllerCreateRelationship",
2323
+ listRelationships: "crmControllerListRelationships",
2324
+ createAssociation: "crmControllerCreateAssociation",
2325
+ listRecordAssociations: "crmControllerListRecordAssociations",
2326
+ getIntegrationsAuthUrl: "crmIntegrationsGetAuthUrl",
2327
+ handleIntegrationsCallback: "crmIntegrationsHandleCallback",
2328
+ handleIntegrationsWebhook: "crmIntegrationsHandleWebhook",
2329
+ replyToIntegrationsActivity: "crmIntegrationsReplyToActivity",
2330
+ createStrapiConnection: "strapiCreateConnection",
2331
+ listStrapiConnections: "strapiListConnections",
2332
+ getStrapiConnection: "strapiGetConnection",
2333
+ updateStrapiConnection: "strapiUpdateConnection",
2334
+ deleteStrapiConnection: "strapiDeleteConnection",
2335
+ triggerStrapiSync: "strapiTriggerSync",
2336
+ enqueueStrapiSync: "strapiEnqueueSync",
2337
+ getStrapiWebhookLogs: "strapiGetWebhookLogs",
2338
+ getStrapiSyncLogs: "strapiGetSyncLogs",
2339
+ exchangeStrapiCustomerToken: "strapiExchangeCustomerToken",
2340
+ registerStrapiCustomer: "strapiRegisterCustomer",
2341
+ receiveStrapiWebhook: "strapiReceiveWebhook"
2342
+ };
2343
+ var posMapping = {
2344
+ provision: "pOSProvision",
2345
+ login: "pOSLogin",
2346
+ getMe: "pOSGetMe",
2347
+ processSale: "pOSProcessSale",
2348
+ sync: "pOSSync",
2349
+ getTransactions: "pOSGetTransactions",
2350
+ registerPettyCash: "pOSRegisterPettyCash",
2351
+ getPettyCashFunds: "pOSGetPettyCashFunds",
2352
+ getPettyCashTransactions: "pOSGetPettyCashTransactions",
2353
+ createSetupKey: "standalonePosControllerCreateSetupKey",
2354
+ activateDevice: "standalonePosControllerActivateDevice",
2355
+ validateKey: "standalonePosControllerValidateKey",
2356
+ linkOrganization: "standalonePosControllerLinkOrganization"
2357
+ };
2358
+ var accountingMapping = {
2359
+ createExpense: "expenseControllerCreateExpense",
2360
+ getExpenses: "expenseControllerGetExpenses",
2361
+ getExpenseCategories: "expenseControllerGetExpenseCategories",
2362
+ getExpense: "expenseControllerGetExpense",
2363
+ createPettyCashFund: "pettyCashControllerCreateFund",
2364
+ getPettyCashFunds: "pettyCashControllerGetFunds",
2365
+ getPettyCashFund: "pettyCashControllerGetFund",
2366
+ topUpPettyCashFund: "pettyCashControllerTopUpFund",
2367
+ getPettyCashFundTransactions: "pettyCashControllerGetFundTransactions",
2368
+ createUtilityAccount: "utilityAccountControllerCreateAccount",
2369
+ getUtilityAccounts: "utilityAccountControllerGetAccounts",
2370
+ getUtilityAccount: "utilityAccountControllerGetAccount",
2371
+ initialize: "accountingInitialize",
2372
+ getProfitLoss: "accountingGetProfitLoss",
2373
+ getBalanceSheet: "accountingGetBalanceSheet",
2374
+ getCashFlow: "accountingGetCashFlow",
2375
+ getTaxSummary: "accountingGetTaxSummary",
2376
+ createInvoice: "invoiceControllerCreateInvoice",
2377
+ getInvoices: "invoiceControllerGetInvoices",
2378
+ getInvoice: "invoiceControllerGetInvoice",
2379
+ updateInvoice: "invoiceControllerUpdateInvoice",
2380
+ deleteInvoice: "invoiceControllerDeleteInvoice",
2381
+ finalizeInvoice: "invoiceControllerFinalizeInvoice",
2382
+ getTemplates: "invoiceControllerGetTemplates",
2383
+ createTemplate: "invoiceControllerCreateTemplate",
2384
+ getInvoiceConfig: "invoiceControllerGetConfig",
2385
+ updateInvoiceConfig: "invoiceControllerUpdateConfig",
2386
+ downloadInvoice: "publicInvoiceControllerDownloadInvoice",
2387
+ downloadInvoiceByTransaction: "publicInvoiceControllerDownloadInvoiceByTransaction",
2388
+ downloadReceipt: "publicInvoiceControllerDownloadReceipt",
2389
+ generatePublicLink: "publicInvoiceControllerGeneratePublicLink"
2390
+ };
2391
+ var loyaltyMapping = {
2392
+ redeemReward: "loyaltyRedeemReward",
2393
+ getCustomerStatus: "loyaltyGetCustomerStatus",
2394
+ validateVoucher: "loyaltyValidateVoucher",
2395
+ getFavorites: "favoritesControllerGetFavorites",
2396
+ addFavorite: "favoritesControllerAddFavorite",
2397
+ removeFavorite: "favoritesControllerRemoveFavorite"
2398
+ };
2399
+ var membersMapping = {
2400
+ getMembers: "membersControllerGetMembers",
2401
+ createMember: "membersControllerCreateMember",
2402
+ getMember: "membersControllerGetMember",
2403
+ updateMember: "membersControllerUpdateMember",
2404
+ deleteMember: "membersControllerDeleteMember",
2405
+ getMemberActivity: "membersControllerGetMemberActivity",
2406
+ updateStatus: "membersControllerUpdateStatus",
2407
+ adminCheckOut: "membersControllerAdminCheckOut",
2408
+ terminalLogin: "terminalMembersControllerLogin",
2409
+ listInvitations: "invitationsList",
2410
+ createInvitation: "invitationsCreate",
2411
+ revokeInvitation: "invitationsRevoke",
2412
+ acceptInvitation: "invitationsAccept",
2413
+ getCustomRoles: "roleManagementControllerGetCustomRoles",
2414
+ createCustomRole: "roleManagementControllerCreateCustomRole",
2415
+ updateCustomRole: "roleManagementControllerUpdateCustomRole",
2416
+ deleteCustomRole: "roleManagementControllerDeleteCustomRole",
2417
+ getPermissionSets: "roleManagementControllerGetPermissionSets",
2418
+ createPermissionSet: "roleManagementControllerCreatePermissionSet",
2419
+ getRoleGroups: "roleManagementControllerGetRoleGroups",
2420
+ createRoleGroup: "roleManagementControllerCreateRoleGroup",
2421
+ assignRoles: "roleManagementControllerAssignRoles",
2422
+ removeRoles: "roleManagementControllerRemoveRoles",
2423
+ listDepartments: "departmentsList",
2424
+ createDepartment: "departmentsCreate",
2425
+ getDepartment: "departmentsGet",
2426
+ updateDepartment: "departmentsUpdate",
2427
+ deleteDepartment: "departmentsDelete",
2428
+ addDepartmentMember: "departmentsAddMember",
2429
+ removeDepartmentMember: "departmentsRemoveMember",
2430
+ getAttendanceLogs: "attendanceControllerGetLogs",
2431
+ checkIn: "attendanceControllerCheckIn",
2432
+ checkOut: "attendanceControllerCheckOut",
2433
+ getMyAttendanceStatus: "attendanceControllerGetMyStatus",
2434
+ getAttendanceStatus: "attendanceControllerGetStatus",
2435
+ broadcastAnnouncement: "announcementControllerBroadcastAnnouncement"
2436
+ };
2437
+ var publicServicesMapping = {
2438
+ listServices: "publicServicesListServices",
2439
+ getCategories: "publicServicesGetCategories",
2440
+ getService: "publicServicesGetService",
2441
+ getAvailability: "publicServicesGetAvailability",
2442
+ requestOtp: "publicServicesRequestOtp",
2443
+ verifyOtp: "publicServicesVerifyOtp",
2444
+ createBooking: "publicServicesCreatePublicBooking"
2445
+ };
2446
+ var servicesMapping = {
2447
+ ...publicServicesMapping,
2448
+ // Admin / Staff scheduling endpoints
2449
+ createCategory: "servicesCreateCategory",
2450
+ getCategoriesAdmin: "servicesGetCategories",
2451
+ updateCategory: "servicesUpdateCategory",
2452
+ deleteCategory: "servicesDeleteCategory",
2453
+ createService: "servicesCreateService",
2454
+ getServicesAdmin: "servicesGetServices",
2455
+ getCurrentMemberShifts: "servicesGetCurrentMemberShifts",
2456
+ getShifts: "servicesGetShifts",
2457
+ getServiceAdmin: "servicesGetService",
2458
+ updateService: "servicesUpdateService",
2459
+ deleteService: "servicesDeleteService",
2460
+ createResource: "servicesCreateResource",
2461
+ getResources: "servicesGetResources",
2462
+ updateResource: "servicesUpdateResource",
2463
+ deleteResource: "servicesDeleteResource",
2464
+ createBookingAdmin: "servicesCreateBooking",
2465
+ getBookings: "servicesGetBookings",
2466
+ getBookingAdmin: "servicesGetBooking",
2467
+ getAvailabilityAdmin: "servicesGetAvailability",
2468
+ updateBookingStatus: "servicesUpdateBookingStatus",
2469
+ completeBooking: "servicesCompleteBooking",
2470
+ cancelBookingSeries: "servicesCancelBookingSeries",
2471
+ createShift: "servicesCreateShift",
2472
+ getStaffShifts: "servicesGetStaffShifts",
2473
+ addBreak: "servicesAddBreak",
2474
+ registerCustomerApp: "servicesRegisterCustomerApp",
2475
+ getServiceUtilization: "servicesGetUtilization",
2476
+ getServicePerformance: "servicesGetPerformance",
2477
+ getServiceFunnel: "servicesGetFunnel"
2478
+ };
2479
+ var adminMapping = {
2480
+ getStats: "adminControllerGetStats",
2481
+ listOrganizations: "adminControllerListOrganizations",
2482
+ createOrganization: "adminControllerCreateOrganization",
2483
+ getOrganizationDetails: "adminControllerGetOrganizationDetails",
2484
+ updateOrganization: "adminControllerUpdateOrganization",
2485
+ deleteOrganization: "adminControllerDeleteOrganization",
2486
+ suspendOrganization: "adminControllerSuspendOrganization",
2487
+ reactivateOrganization: "adminControllerReactivateOrganization",
2488
+ getEffectiveQuota: "adminControllerGetEffectiveQuota",
2489
+ setQuotaOverrides: "adminControllerSetQuotaOverrides",
2490
+ listMembers: "adminControllerListMembers",
2491
+ listUsers: "adminControllerListUsers",
2492
+ banUser: "adminControllerBanUser",
2493
+ unbanUser: "adminControllerUnbanUser",
2494
+ listConnectedApps: "adminControllerListConnectedApps",
2495
+ listSystemLogs: "adminControllerListSystemLogs",
2496
+ listGlobalSettings: "adminControllerListGlobalSettings",
2497
+ setGlobalSetting: "adminControllerSetGlobalSetting",
2498
+ deleteGlobalSetting: "adminControllerDeleteGlobalSetting",
2499
+ listTiers: "adminControllerListTiers",
2500
+ defineTier: "adminControllerDefineTier",
2501
+ deleteTier: "adminControllerDeleteTier",
2502
+ getOrganizationSubscription: "adminControllerGetOrganizationSubscription",
2503
+ updateOrganizationSubscription: "adminControllerUpdateOrganizationSubscription",
2504
+ listSystemPayments: "adminControllerListSystemPayments",
2505
+ recordCustomPayment: "adminControllerRecordCustomPayment",
2506
+ listIntegrationDefinitions: "adminControllerListIntegrationDefinitions",
2507
+ createIntegrationDefinition: "adminControllerCreateIntegrationDefinition",
2508
+ updateIntegrationDefinition: "adminControllerUpdateIntegrationDefinition",
2509
+ deleteIntegrationDefinition: "adminControllerDeleteIntegrationDefinition",
2510
+ listActiveOrganizationIntegrations: "adminControllerListActiveOrganizationIntegrations",
2511
+ createWebhook: "webhooksCreate",
2512
+ listWebhooks: "webhooksList",
2513
+ deleteWebhook: "webhooksDelete",
2514
+ getCustomers: "customersGetCustomers",
2515
+ registerCustomer: "customersRegister",
2516
+ updateCustomer: "customersUpdate",
2517
+ getCustomerById: "customersGetCustomerById",
2518
+ deleteCustomer: "customersDelete",
2519
+ getCustomerAddresses: "customersGetAddresses",
2520
+ addCustomerAddress: "customersAddAddress",
2521
+ createBusinessAccount: "businessAccountControllerCreate",
2522
+ getBusinessAccount: "businessAccountControllerGetOne",
2523
+ getDashboardAnalytics: "analyticsControllerGetDashboardAnalytics",
2524
+ getResourceUtilization: "analyticsControllerGetResourceUtilization"
2525
+ };
2526
+ function buildModule(api, orgSlug, mapping) {
2527
+ const result = {};
2528
+ for (const [key, rawMethodName] of Object.entries(mapping)) {
2529
+ const rawFn = api[rawMethodName];
2530
+ if (typeof rawFn === "function") {
2531
+ if (methodsWithOrgSlugSet.has(rawMethodName)) {
2532
+ result[key] = function(...args) {
2533
+ return rawFn.apply(this, [orgSlug, ...args]);
2534
+ };
2535
+ } else {
2536
+ result[key] = function(...args) {
2537
+ return rawFn.apply(this, args);
2538
+ };
2539
+ }
2540
+ }
2541
+ }
2542
+ return result;
2543
+ }
2544
+ function getJwtExpiry(token) {
2545
+ try {
2546
+ const parts = token.split(".");
2547
+ if (parts.length !== 3) return null;
2548
+ let payloadStr = "";
2549
+ if (typeof Buffer !== "undefined") {
2550
+ payloadStr = Buffer.from(parts[1], "base64").toString("utf-8");
2551
+ } else if (typeof window !== "undefined" && typeof window.atob === "function") {
2552
+ payloadStr = window.atob(parts[1]);
2553
+ } else {
2554
+ payloadStr = atob(parts[1]);
2555
+ }
2556
+ const payload = JSON.parse(payloadStr);
2557
+ if (payload && typeof payload.exp === "number") {
2558
+ return payload.exp * 1e3;
2559
+ }
2560
+ } catch (e) {
2561
+ }
2562
+ return null;
2563
+ }
2564
+
2565
+ // src/server.ts
2566
+ var ScrymeServerSDK = class {
2567
+ constructor(config) {
2568
+ this.token = null;
2569
+ this.expiresAt = null;
2570
+ this.activeAuthPromise = null;
2571
+ if (!config || !config.clientId || !config.clientSecret || !config.orgSlug) {
2572
+ throw new Error(
2573
+ "clientId, clientSecret, and orgSlug are required to initialize the SDK."
2574
+ );
2575
+ }
2576
+ let finalBaseURL = config.baseURL || "https://api.scryme.tech";
2577
+ if (finalBaseURL && !finalBaseURL.includes("/api") && !finalBaseURL.endsWith("/api")) {
2578
+ finalBaseURL = finalBaseURL.replace(/\/$/, "") + "/api";
2579
+ }
2580
+ this.axiosInstance = axios2.create({
2581
+ baseURL: finalBaseURL
2582
+ });
2583
+ if (config.token) {
2584
+ this.token = config.token;
2585
+ this.expiresAt = getJwtExpiry(config.token);
2586
+ this.axiosInstance.defaults.headers.common["Authorization"] = `Bearer ${config.token}`;
2587
+ }
2588
+ if (config.apiKey) {
2589
+ this.axiosInstance.defaults.headers.common["x-api-key"] = config.apiKey;
2590
+ }
2591
+ const performExchange = async () => {
2592
+ if (this.activeAuthPromise) {
2593
+ return this.activeAuthPromise;
2594
+ }
2595
+ this.activeAuthPromise = (async () => {
2596
+ try {
2597
+ const response = await this.api.authExchangeToken({
2598
+ clientId: config.clientId,
2599
+ clientSecret: config.clientSecret
2600
+ });
2601
+ const tokenData = response.data?.data;
2602
+ const accessToken = tokenData?.access_token;
2603
+ const expiresIn = tokenData?.expires_in;
2604
+ if (accessToken) {
2605
+ this.token = accessToken;
2606
+ if (expiresIn) {
2607
+ this.expiresAt = Date.now() + expiresIn * 1e3;
2608
+ } else {
2609
+ this.expiresAt = getJwtExpiry(accessToken);
2610
+ }
2611
+ this.axiosInstance.defaults.headers.common["Authorization"] = `Bearer ${accessToken}`;
2612
+ }
2613
+ return response.data;
2614
+ } finally {
2615
+ this.activeAuthPromise = null;
2616
+ }
2617
+ })();
2618
+ return this.activeAuthPromise;
2619
+ };
2620
+ this.axiosInstance.interceptors.request.use(async (req) => {
2621
+ const isAuthTokenRequest = req.url && (req.url.endsWith("/auth/token") || req.url.includes("/auth/token") || req.url.includes("/customers/auth/refresh"));
2622
+ if (!isAuthTokenRequest && !config.apiKey) {
2623
+ const isExpired = !this.token || this.expiresAt && Date.now() >= this.expiresAt - 3e4;
2624
+ if (isExpired) {
2625
+ const isCustomerToken = this.token && getJwtExpiry(this.token) && !config.clientSecret;
2626
+ if (isCustomerToken || this.token && !config.clientSecret) {
2627
+ try {
2628
+ await this.auth.refreshSession();
2629
+ } catch (e) {
2630
+ console.error(
2631
+ "Proactive customer session refresh failed in request interceptor:",
2632
+ e
2633
+ );
2634
+ }
2635
+ } else if (config.clientId && config.clientSecret) {
2636
+ try {
2637
+ await performExchange();
2638
+ } catch (e) {
2639
+ console.error(
2640
+ "Auto-authentication failed in request interceptor:",
2641
+ e
2642
+ );
2643
+ }
2644
+ }
2645
+ }
2646
+ }
2647
+ if (this.token) {
2648
+ req.headers["Authorization"] = `Bearer ${this.token}`;
2649
+ }
2650
+ return req;
2651
+ });
2652
+ this.axiosInstance.interceptors.response.use(
2653
+ (response) => response,
2654
+ async (error) => {
2655
+ const originalRequest = error.config;
2656
+ const isAuthTokenRequest = originalRequest && originalRequest.url && (originalRequest.url.endsWith("/auth/token") || originalRequest.url.includes("/auth/token") || originalRequest.url.includes("/customers/auth/refresh"));
2657
+ if (error.response && error.response.status === 401 && originalRequest && !originalRequest._retry && !isAuthTokenRequest && !config.apiKey) {
2658
+ originalRequest._retry = true;
2659
+ try {
2660
+ const isCustomerToken = this.token && getJwtExpiry(this.token) && !config.clientSecret;
2661
+ if (isCustomerToken || this.token && !config.clientSecret) {
2662
+ await this.auth.refreshSession();
2663
+ if (this.token) {
2664
+ originalRequest.headers["Authorization"] = `Bearer ${this.token}`;
2665
+ }
2666
+ return this.axiosInstance(originalRequest);
2667
+ } else if (config.clientId && config.clientSecret) {
2668
+ await performExchange();
2669
+ if (this.token) {
2670
+ originalRequest.headers["Authorization"] = `Bearer ${this.token}`;
2671
+ }
2672
+ return this.axiosInstance(originalRequest);
2673
+ }
2674
+ } catch (e) {
2675
+ return Promise.reject(error);
2676
+ }
2677
+ }
2678
+ return Promise.reject(error);
2679
+ }
2680
+ );
2681
+ this.api = getScrymeV3API2(this.axiosInstance, config.orgSlug);
2682
+ const baseCatalog = buildModule(this.api, config.orgSlug, catalogMapping);
2683
+ this.catalog = {
2684
+ ...baseCatalog,
2685
+ getProduct: async (idOrSlug, options) => {
2686
+ const response = await this.catalog.getProducts(void 0, options);
2687
+ const products = response.data || [];
2688
+ const product = products.find((p) => {
2689
+ if (typeof idOrSlug === "string") {
2690
+ return p.id === idOrSlug || p.slug === idOrSlug;
2691
+ } else {
2692
+ const { id, slug } = idOrSlug;
2693
+ if (id && p.id === id) return true;
2694
+ if (slug && p.slug === slug) return true;
2695
+ return false;
2696
+ }
2697
+ });
2698
+ if (!product) {
2699
+ const criteria = typeof idOrSlug === "string" ? idOrSlug : JSON.stringify(idOrSlug);
2700
+ throw new Error(`Product not found matching criteria: ${criteria}`);
2701
+ }
2702
+ return {
2703
+ ...response,
2704
+ data: product
2705
+ };
2706
+ },
2707
+ getService: async (idOrSlug, options) => {
2708
+ const response = await this.catalog.getServices(void 0, options);
2709
+ const services = response.data || [];
2710
+ const service = services.find((s) => {
2711
+ if (typeof idOrSlug === "string") {
2712
+ return s.id === idOrSlug || s.slug === idOrSlug;
2713
+ } else {
2714
+ const { id, slug } = idOrSlug;
2715
+ if (id && s.id === id) return true;
2716
+ if (slug && s.slug === slug) return true;
2717
+ return false;
2718
+ }
2719
+ });
2720
+ if (!service) {
2721
+ const criteria = typeof idOrSlug === "string" ? idOrSlug : JSON.stringify(idOrSlug);
2722
+ throw new Error(`Service not found matching criteria: ${criteria}`);
2723
+ }
2724
+ return {
2725
+ ...response,
2726
+ data: service
2727
+ };
2728
+ }
2729
+ };
2730
+ this.inventory = buildModule(this.api, config.orgSlug, inventoryMapping);
2731
+ this.orders = buildModule(this.api, config.orgSlug, ordersMapping);
2732
+ this.b2b = this.orders;
2733
+ this.crm = buildModule(this.api, config.orgSlug, crmMapping);
2734
+ this.pos = buildModule(this.api, config.orgSlug, posMapping);
2735
+ this.accounting = buildModule(this.api, config.orgSlug, accountingMapping);
2736
+ this.loyalty = buildModule(this.api, config.orgSlug, loyaltyMapping);
2737
+ this.members = buildModule(this.api, config.orgSlug, membersMapping);
2738
+ this.admin = buildModule(this.api, config.orgSlug, adminMapping);
2739
+ this.webhooks = buildModule(this.api, config.orgSlug, webhooksMapping);
2740
+ this.services = buildModule(this.api, config.orgSlug, servicesMapping);
2741
+ this.cart = {
2742
+ get: async (params) => {
2743
+ return this.orders.getCart(
2744
+ params
2745
+ );
2746
+ },
2747
+ add: async (dto) => {
2748
+ return this.orders.addToCart(dto);
2749
+ },
2750
+ remove: async (dto) => {
2751
+ return this.orders.removeFromCart(dto);
2752
+ },
2753
+ clear: async (params) => {
2754
+ return this.orders.clearCart(params);
2755
+ },
2756
+ update: async (dto) => {
2757
+ const response = await this.orders.getCart({
2758
+ sessionId: dto.sessionId || ""
2759
+ });
2760
+ const data = response.data;
2761
+ const items = data?.data?.items || data?.items || [];
2762
+ let existingItem = null;
2763
+ if (dto.productId) {
2764
+ existingItem = items.find(
2765
+ (item) => item.productId === dto.productId && (item.variantId || null) === (dto.variantId || null)
2766
+ );
2767
+ } else if (dto.serviceId) {
2768
+ existingItem = items.find(
2769
+ (item) => item.serviceId === dto.serviceId
2770
+ );
2771
+ }
2772
+ if (existingItem) {
2773
+ const currentQty = existingItem.quantity || 0;
2774
+ if (dto.quantity <= 0) {
2775
+ return this.orders.removeFromCart({
2776
+ productId: dto.productId,
2777
+ variantId: dto.variantId,
2778
+ serviceId: dto.serviceId,
2779
+ sessionId: dto.sessionId || "",
2780
+ customerId: dto.customerId
2781
+ });
2782
+ } else {
2783
+ const diff = dto.quantity - currentQty;
2784
+ if (diff !== 0) {
2785
+ return this.orders.addToCart({
2786
+ ...dto,
2787
+ quantity: diff
2788
+ });
2789
+ }
2790
+ return response;
2791
+ }
2792
+ } else {
2793
+ if (dto.quantity > 0) {
2794
+ return this.orders.addToCart(dto);
2795
+ }
2796
+ }
2797
+ },
2798
+ getItems: async (params) => {
2799
+ const res = await this.orders.getCart(
2800
+ params
2801
+ );
2802
+ const data = res?.data || res;
2803
+ return data?.items || data?.data?.items || [];
2804
+ },
2805
+ getTotals: async (params) => {
2806
+ const res = await this.orders.getCart(
2807
+ params
2808
+ );
2809
+ const data = res?.data || res;
2810
+ const items = data?.items || data?.data?.items || [];
2811
+ const itemsCount = items.reduce(
2812
+ (sum, item) => sum + (item.quantity || 0),
2813
+ 0
2814
+ );
2815
+ return {
2816
+ itemsCount,
2817
+ items,
2818
+ raw: data
2819
+ };
2820
+ },
2821
+ checkout: async (params) => {
2822
+ if (params.phoneNumber) {
2823
+ const res = await this.orders.checkout({
2824
+ cartId: params.cartId,
2825
+ sessionId: params.sessionId,
2826
+ phoneNumber: params.phoneNumber,
2827
+ locationId: params.locationId,
2828
+ notes: params.notes
2829
+ });
2830
+ return res?.data || res;
2831
+ }
2832
+ if (!params.customerId)
2833
+ throw new Error("customerId is required for server checkout.");
2834
+ const items = await this.cart.getItems({
2835
+ sessionId: params.sessionId,
2836
+ customerId: params.customerId
2837
+ });
2838
+ if (!items || items.length === 0) {
2839
+ throw new Error("Cannot checkout an empty cart.");
2840
+ }
2841
+ const orderItems = items.map((item) => ({
2842
+ variantId: item.variantId || "",
2843
+ quantity: item.quantity,
2844
+ unitPrice: item.unitPrice
2845
+ }));
2846
+ const orderResponse = await this.orders.createOrder({
2847
+ customerId: params.customerId,
2848
+ locationId: params.locationId,
2849
+ items: orderItems,
2850
+ notes: params.notes,
2851
+ channel: params.channel
2852
+ });
2853
+ await this.cart.clear({
2854
+ sessionId: params.sessionId || "",
2855
+ customerId: params.customerId
2856
+ });
2857
+ return orderResponse?.data || orderResponse;
2858
+ }
2859
+ };
2860
+ this.customer = {
2861
+ getProfile: async (customerId) => {
2862
+ return this.admin.getCustomerById(customerId);
2863
+ },
2864
+ updateProfile: async (customerId, dto) => {
2865
+ return this.admin.updateCustomer(customerId, dto);
2866
+ },
2867
+ getAddresses: async (customerId) => {
2868
+ return this.admin.getCustomerAddresses(customerId);
2869
+ },
2870
+ addAddress: async (customerId, dto) => {
2871
+ return this.admin.addCustomerAddress(customerId, dto);
2872
+ },
2873
+ auth: {
2874
+ signUp: async (dto) => {
2875
+ const res = await this.api.customersRegister(config.orgSlug, dto);
2876
+ if (dto.password) {
2877
+ try {
2878
+ await this.customer.auth.signIn({
2879
+ email: dto.email,
2880
+ password: dto.password
2881
+ });
2882
+ } catch (e) {
2883
+ console.error("Auto sign-in after sign-up failed on server SDK:", e);
2884
+ }
2885
+ }
2886
+ return res;
2887
+ },
2888
+ signIn: async (credentials) => {
2889
+ const response = await this.axiosInstance.post(
2890
+ "/auth/sign-in/email",
2891
+ credentials
2892
+ );
2893
+ const data = response.data;
2894
+ const token = data?.session?.token || data?.token || null;
2895
+ if (token) {
2896
+ this.token = token;
2897
+ this.expiresAt = getJwtExpiry(token);
2898
+ this.axiosInstance.defaults.headers.common["Authorization"] = `Bearer ${token}`;
2899
+ }
2900
+ return data;
2901
+ },
2902
+ getCurrentSession: async (headers) => {
2903
+ const requestConfig = {};
2904
+ if (headers) {
2905
+ const requestHeaders = {};
2906
+ if (typeof headers.forEach === "function") {
2907
+ headers.forEach((value, key) => {
2908
+ requestHeaders[key] = value;
2909
+ });
2910
+ } else {
2911
+ for (const [key, value] of Object.entries(headers)) {
2912
+ if (value !== void 0) {
2913
+ requestHeaders[key] = Array.isArray(value) ? value.join(", ") : String(value);
2914
+ }
2915
+ }
2916
+ }
2917
+ requestConfig.headers = requestHeaders;
2918
+ }
2919
+ const response = await this.axiosInstance.get(
2920
+ `/${config.orgSlug}/customers/auth/session`,
2921
+ requestConfig
2922
+ );
2923
+ return response.data?.data || response.data;
2924
+ },
2925
+ refreshSession: async () => {
2926
+ const response = await this.axiosInstance.post(
2927
+ `/${config.orgSlug}/customers/auth/refresh`
2928
+ );
2929
+ const data = response.data?.data || response.data;
2930
+ const token = data?.token || null;
2931
+ if (token) {
2932
+ this.token = token;
2933
+ this.expiresAt = getJwtExpiry(token);
2934
+ this.axiosInstance.defaults.headers.common["Authorization"] = `Bearer ${token}`;
2935
+ }
2936
+ return data;
2937
+ }
2938
+ }
2939
+ };
2940
+ this.bookings = {
2941
+ create: async (dto) => {
2942
+ return this.catalog.createBooking(dto);
2943
+ },
2944
+ get: async (id) => {
2945
+ return this.catalog.getBooking(id);
2946
+ },
2947
+ list: async () => {
2948
+ return this.catalog.getBookings();
2949
+ },
2950
+ updateStatus: async (id, status) => {
2951
+ return this.catalog.updateBookingStatus(id, status);
2952
+ },
2953
+ cancel: async (id) => {
2954
+ return this.catalog.updateBookingStatus(id, "CANCELLED");
2955
+ },
2956
+ cancelSeries: async (recurrenceId) => {
2957
+ return this.api.servicesCancelBookingSeries(config.orgSlug, recurrenceId);
2958
+ },
2959
+ complete: async (id, dto) => {
2960
+ return this.catalog.completeBooking(id, dto);
2961
+ },
2962
+ getAvailability: async (serviceId, date) => {
2963
+ return this.api.publicServicesGetAvailability(config.orgSlug, serviceId, date ? { date } : void 0);
2964
+ },
2965
+ requestOtp: async (dto) => {
2966
+ return this.api.publicServicesRequestOtp(config.orgSlug, dto);
2967
+ },
2968
+ verifyOtp: async (dto) => {
2969
+ return this.api.publicServicesVerifyOtp(config.orgSlug, dto);
2970
+ },
2971
+ createPublicBooking: async (dto) => {
2972
+ return this.api.publicServicesCreatePublicBooking(config.orgSlug, dto);
2973
+ }
2974
+ };
2975
+ const baseAuth = buildModule(this.api, config.orgSlug, authMapping);
2976
+ this.auth = {
2977
+ ...baseAuth,
2978
+ ...this.customer.auth,
2979
+ authenticate: async () => {
2980
+ return performExchange();
2981
+ },
2982
+ signUp: async (dto) => {
2983
+ return this.customer.auth.signUp(dto);
2984
+ },
2985
+ signIn: async (credentials) => {
2986
+ return this.customer.auth.signIn(credentials);
2987
+ },
2988
+ getCurrentSession: async (headers) => {
2989
+ return this.customer.auth.getCurrentSession(headers);
2990
+ },
2991
+ refreshSession: async () => {
2992
+ return this.customer.auth.refreshSession();
2993
+ }
2994
+ };
2995
+ }
2996
+ };
2997
+ function createServerSDK(config = {}) {
2998
+ const finalConfig = {
2999
+ clientId: config.clientId || "mock-client-id",
3000
+ clientSecret: config.clientSecret || "mock-client-secret",
3001
+ orgSlug: config.orgSlug || "mock-org-slug",
3002
+ ...config
3003
+ };
3004
+ return new ScrymeServerSDK(finalConfig);
3005
+ }
5
3006
  export {
6
3007
  ScrymeServerSDK,
7
3008
  createServerSDK