@scryme/sdk 10.1.41 → 10.1.43

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