@scryme/sdk 10.1.40 → 10.1.42

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