@scryme/sdk 9.64.2 → 9.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +1 -1
- package/dist/{base-DZXCyXwH.d.mts → base-DZWqHn_L.d.mts} +234 -51
- package/dist/{base-DZXCyXwH.d.ts → base-DZWqHn_L.d.ts} +234 -51
- package/dist/{chunk-CBV4VTNE.mjs → chunk-PPNV4D3M.mjs} +875 -44
- package/dist/client.d.mts +105 -8
- package/dist/client.d.ts +105 -8
- package/dist/client.js +661 -31
- package/dist/client.mjs +7 -3
- package/dist/index.d.mts +18 -5
- package/dist/index.d.ts +18 -5
- package/dist/index.js +880 -45
- package/dist/index.mjs +11 -3
- package/dist/server.d.mts +54 -5
- package/dist/server.d.ts +54 -5
- package/dist/server.js +361 -20
- package/dist/server.mjs +1 -1
- package/package.json +13 -3
package/dist/server.js
CHANGED
|
@@ -341,10 +341,10 @@ var getScrymeV3API = (axiosInstance = import_axios.default) => {
|
|
|
341
341
|
options
|
|
342
342
|
);
|
|
343
343
|
};
|
|
344
|
-
const invoiceControllerCreateTemplate = (options) => {
|
|
344
|
+
const invoiceControllerCreateTemplate = (createInvoiceTemplateDto, options) => {
|
|
345
345
|
return axiosInstance.post(
|
|
346
346
|
`/v3/finance/invoices/templates`,
|
|
347
|
-
|
|
347
|
+
createInvoiceTemplateDto,
|
|
348
348
|
options
|
|
349
349
|
);
|
|
350
350
|
};
|
|
@@ -877,6 +877,54 @@ var getScrymeV3API = (axiosInstance = import_axios.default) => {
|
|
|
877
877
|
}
|
|
878
878
|
);
|
|
879
879
|
};
|
|
880
|
+
const publicServicesListServices = (orgSlug, options) => {
|
|
881
|
+
return axiosInstance.get(
|
|
882
|
+
`/v3/public/${orgSlug}/services`,
|
|
883
|
+
options
|
|
884
|
+
);
|
|
885
|
+
};
|
|
886
|
+
const publicServicesGetCategories = (orgSlug, options) => {
|
|
887
|
+
return axiosInstance.get(
|
|
888
|
+
`/v3/public/${orgSlug}/services/categories`,
|
|
889
|
+
options
|
|
890
|
+
);
|
|
891
|
+
};
|
|
892
|
+
const publicServicesGetService = (orgSlug, id, options) => {
|
|
893
|
+
return axiosInstance.get(
|
|
894
|
+
`/v3/public/${orgSlug}/services/${id}`,
|
|
895
|
+
options
|
|
896
|
+
);
|
|
897
|
+
};
|
|
898
|
+
const publicServicesGetAvailability = (orgSlug, id, params, options) => {
|
|
899
|
+
return axiosInstance.get(
|
|
900
|
+
`/v3/public/${orgSlug}/services/${id}/availability`,
|
|
901
|
+
{
|
|
902
|
+
...options,
|
|
903
|
+
params: { ...params, ...options?.params }
|
|
904
|
+
}
|
|
905
|
+
);
|
|
906
|
+
};
|
|
907
|
+
const publicServicesRequestOtp = (orgSlug, requestOtpDto, options) => {
|
|
908
|
+
return axiosInstance.post(
|
|
909
|
+
`/v3/public/${orgSlug}/services/otp/request`,
|
|
910
|
+
requestOtpDto,
|
|
911
|
+
options
|
|
912
|
+
);
|
|
913
|
+
};
|
|
914
|
+
const publicServicesVerifyOtp = (orgSlug, verifyOtpDto, options) => {
|
|
915
|
+
return axiosInstance.post(
|
|
916
|
+
`/v3/public/${orgSlug}/services/otp/verify`,
|
|
917
|
+
verifyOtpDto,
|
|
918
|
+
options
|
|
919
|
+
);
|
|
920
|
+
};
|
|
921
|
+
const publicServicesCreatePublicBooking = (orgSlug, publicBookingDto, options) => {
|
|
922
|
+
return axiosInstance.post(
|
|
923
|
+
`/v3/public/${orgSlug}/services/bookings`,
|
|
924
|
+
publicBookingDto,
|
|
925
|
+
options
|
|
926
|
+
);
|
|
927
|
+
};
|
|
880
928
|
const customersProvisionZitadel = (orgSlug, provisionZitadelDto, options) => {
|
|
881
929
|
return axiosInstance.post(
|
|
882
930
|
`/v3/${orgSlug}/customers/zitadel/provision`,
|
|
@@ -900,6 +948,40 @@ var getScrymeV3API = (axiosInstance = import_axios.default) => {
|
|
|
900
948
|
options
|
|
901
949
|
);
|
|
902
950
|
};
|
|
951
|
+
const customersLogin = (orgSlug, customerLoginDto, options) => {
|
|
952
|
+
return axiosInstance.post(
|
|
953
|
+
`/v3/${orgSlug}/customers/auth/login`,
|
|
954
|
+
customerLoginDto,
|
|
955
|
+
options
|
|
956
|
+
);
|
|
957
|
+
};
|
|
958
|
+
const customersGetCurrentSession = (orgSlug, options) => {
|
|
959
|
+
return axiosInstance.get(
|
|
960
|
+
`/v3/${orgSlug}/customers/auth/session`,
|
|
961
|
+
options
|
|
962
|
+
);
|
|
963
|
+
};
|
|
964
|
+
const customersGetSessions = (orgSlug, options) => {
|
|
965
|
+
return axiosInstance.get(
|
|
966
|
+
`/v3/${orgSlug}/customers/auth/sessions`,
|
|
967
|
+
options
|
|
968
|
+
);
|
|
969
|
+
};
|
|
970
|
+
const customersRevokeAllSessions = (orgSlug, params, options) => {
|
|
971
|
+
return axiosInstance.delete(
|
|
972
|
+
`/v3/${orgSlug}/customers/auth/sessions`,
|
|
973
|
+
{
|
|
974
|
+
...options,
|
|
975
|
+
params: { ...params, ...options?.params }
|
|
976
|
+
}
|
|
977
|
+
);
|
|
978
|
+
};
|
|
979
|
+
const customersRevokeSession = (orgSlug, id, options) => {
|
|
980
|
+
return axiosInstance.delete(
|
|
981
|
+
`/v3/${orgSlug}/customers/auth/sessions/${id}`,
|
|
982
|
+
options
|
|
983
|
+
);
|
|
984
|
+
};
|
|
903
985
|
const customersUpdate = (orgSlug, id, updateCustomerDto, options) => {
|
|
904
986
|
return axiosInstance.patch(
|
|
905
987
|
`/v3/${orgSlug}/customers/${id}`,
|
|
@@ -1811,11 +1893,18 @@ var getScrymeV3API = (axiosInstance = import_axios.default) => {
|
|
|
1811
1893
|
}
|
|
1812
1894
|
);
|
|
1813
1895
|
};
|
|
1814
|
-
return { 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, authControllerHandleOAuth2, adminControllerGetStats, adminControllerListOrganizations, adminControllerCreateOrganization, adminControllerGetOrganizationDetails, adminControllerUpdateOrganization, adminControllerDeleteOrganization, adminControllerListMembers, adminControllerListUsers, adminControllerBanUser, adminControllerUnbanUser, adminControllerListConnectedApps, adminControllerListSystemLogs, adminControllerListGlobalSettings, adminControllerSetGlobalSetting, adminControllerDeleteGlobalSetting, adminControllerListTiers, adminControllerDefineTier, adminControllerDeleteTier, adminControllerGetOrganizationSubscription, adminControllerUpdateOrganizationSubscription, adminControllerListSystemPayments, adminControllerRecordCustomPayment, adminControllerListIntegrationDefinitions, adminControllerCreateIntegrationDefinition, adminControllerUpdateIntegrationDefinition, adminControllerDeleteIntegrationDefinition, adminControllerListActiveOrganizationIntegrations, webhooksCreate, webhooksList, webhooksDelete, windmillCallbackControllerHandleCallback, windmillCallbackControllerHandleApprovalCallback, windmillCallbackControllerHandleBakeryDisposalCallback, windmillCallbackControllerHandleOutcomeCallback, catalogGetProducts, catalogCreateProduct, catalogGetServices, catalogUpdateProduct, catalogUpdateSupplierVariant, catalogGetPriceChangeRequests, catalogReviewPriceChangeRequest, servicesCreateCategory, servicesGetCategories, servicesUpdateCategory, servicesDeleteCategory, servicesCreateService, servicesGetServices, servicesGetCurrentMemberShifts, servicesGetShifts, servicesGetService, servicesUpdateService, servicesDeleteService, servicesCreateResource, servicesGetResources, servicesUpdateResource, servicesDeleteResource, servicesCreateBooking, servicesGetBookings, servicesGetBooking, servicesUpdateBookingStatus, servicesCompleteBooking, servicesCreateShift, servicesGetStaffShifts, servicesAddBreak, servicesRegisterCustomerApp, servicesGetUtilization, servicesGetPerformance, servicesGetFunnel, customersProvisionZitadel, customersGetCustomers, customersRegister, 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, paymentsControllerHandleStkCallback, pOSProvision, pOSLogin, pOSGetMe, pOSProcessSale, pOSSync, pOSGetTransactions, pOSRegisterPettyCash, pOSGetPettyCashFunds, pOSGetPettyCashTransactions, 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 };
|
|
1896
|
+
return { 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, authControllerHandleOAuth2, adminControllerGetStats, adminControllerListOrganizations, adminControllerCreateOrganization, adminControllerGetOrganizationDetails, adminControllerUpdateOrganization, adminControllerDeleteOrganization, adminControllerListMembers, adminControllerListUsers, adminControllerBanUser, adminControllerUnbanUser, adminControllerListConnectedApps, adminControllerListSystemLogs, adminControllerListGlobalSettings, adminControllerSetGlobalSetting, adminControllerDeleteGlobalSetting, adminControllerListTiers, adminControllerDefineTier, adminControllerDeleteTier, adminControllerGetOrganizationSubscription, adminControllerUpdateOrganizationSubscription, adminControllerListSystemPayments, adminControllerRecordCustomPayment, adminControllerListIntegrationDefinitions, adminControllerCreateIntegrationDefinition, adminControllerUpdateIntegrationDefinition, adminControllerDeleteIntegrationDefinition, adminControllerListActiveOrganizationIntegrations, webhooksCreate, webhooksList, webhooksDelete, windmillCallbackControllerHandleCallback, windmillCallbackControllerHandleApprovalCallback, windmillCallbackControllerHandleBakeryDisposalCallback, windmillCallbackControllerHandleOutcomeCallback, catalogGetProducts, catalogCreateProduct, catalogGetServices, catalogUpdateProduct, catalogUpdateSupplierVariant, catalogGetPriceChangeRequests, catalogReviewPriceChangeRequest, servicesCreateCategory, servicesGetCategories, servicesUpdateCategory, servicesDeleteCategory, servicesCreateService, servicesGetServices, servicesGetCurrentMemberShifts, servicesGetShifts, servicesGetService, servicesUpdateService, servicesDeleteService, servicesCreateResource, servicesGetResources, servicesUpdateResource, servicesDeleteResource, servicesCreateBooking, servicesGetBookings, servicesGetBooking, servicesUpdateBookingStatus, servicesCompleteBooking, servicesCreateShift, servicesGetStaffShifts, servicesAddBreak, servicesRegisterCustomerApp, servicesGetUtilization, servicesGetPerformance, servicesGetFunnel, publicServicesListServices, publicServicesGetCategories, publicServicesGetService, publicServicesGetAvailability, publicServicesRequestOtp, publicServicesVerifyOtp, publicServicesCreatePublicBooking, customersProvisionZitadel, customersGetCustomers, customersRegister, customersLogin, 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, paymentsControllerHandleStkCallback, pOSProvision, pOSLogin, pOSGetMe, pOSProcessSale, pOSSync, pOSGetTransactions, pOSRegisterPettyCash, pOSGetPettyCashFunds, pOSGetPettyCashTransactions, 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 };
|
|
1815
1897
|
};
|
|
1816
1898
|
|
|
1817
1899
|
// src/base.ts
|
|
1818
1900
|
var methodsWithOrgSlugSet = /* @__PURE__ */ new Set([
|
|
1901
|
+
"publicServicesListServices",
|
|
1902
|
+
"publicServicesGetCategories",
|
|
1903
|
+
"publicServicesGetService",
|
|
1904
|
+
"publicServicesGetAvailability",
|
|
1905
|
+
"publicServicesRequestOtp",
|
|
1906
|
+
"publicServicesVerifyOtp",
|
|
1907
|
+
"publicServicesCreatePublicBooking",
|
|
1819
1908
|
"inventoryVerifyIntegrity",
|
|
1820
1909
|
"inventoryFixIntegrity",
|
|
1821
1910
|
"inventoryGetInventory",
|
|
@@ -1884,6 +1973,7 @@ var methodsWithOrgSlugSet = /* @__PURE__ */ new Set([
|
|
|
1884
1973
|
"customersDelete",
|
|
1885
1974
|
"customersGetAddresses",
|
|
1886
1975
|
"customersAddAddress",
|
|
1976
|
+
"customersGetCurrentSession",
|
|
1887
1977
|
"businessAccountControllerCreate",
|
|
1888
1978
|
"businessAccountControllerGetOne",
|
|
1889
1979
|
"crmControllerCreateRecord",
|
|
@@ -1941,7 +2031,14 @@ var methodsWithOrgSlugSet = /* @__PURE__ */ new Set([
|
|
|
1941
2031
|
"roleManagementControllerCreateRoleGroup",
|
|
1942
2032
|
"roleManagementControllerAssignRoles",
|
|
1943
2033
|
"roleManagementControllerRemoveRoles",
|
|
1944
|
-
"departmentsList"
|
|
2034
|
+
"departmentsList",
|
|
2035
|
+
"cartControllerGetCart",
|
|
2036
|
+
"cartControllerClearCart",
|
|
2037
|
+
"cartControllerAddToCart",
|
|
2038
|
+
"cartControllerRemoveFromCart",
|
|
2039
|
+
"favoritesControllerGetFavorites",
|
|
2040
|
+
"favoritesControllerAddFavorite",
|
|
2041
|
+
"favoritesControllerRemoveFavorite"
|
|
1945
2042
|
]);
|
|
1946
2043
|
var catalogMapping = {
|
|
1947
2044
|
getProducts: "catalogGetProducts",
|
|
@@ -2168,6 +2265,46 @@ var membersMapping = {
|
|
|
2168
2265
|
getAttendanceStatus: "attendanceControllerGetStatus",
|
|
2169
2266
|
broadcastAnnouncement: "announcementControllerBroadcastAnnouncement"
|
|
2170
2267
|
};
|
|
2268
|
+
var publicServicesMapping = {
|
|
2269
|
+
listServices: "publicServicesListServices",
|
|
2270
|
+
getCategories: "publicServicesGetCategories",
|
|
2271
|
+
getService: "publicServicesGetService",
|
|
2272
|
+
getAvailability: "publicServicesGetAvailability",
|
|
2273
|
+
requestOtp: "publicServicesRequestOtp",
|
|
2274
|
+
verifyOtp: "publicServicesVerifyOtp",
|
|
2275
|
+
createBooking: "publicServicesCreatePublicBooking"
|
|
2276
|
+
};
|
|
2277
|
+
var servicesMapping = {
|
|
2278
|
+
...publicServicesMapping,
|
|
2279
|
+
// Admin / Staff scheduling endpoints
|
|
2280
|
+
createCategory: "servicesCreateCategory",
|
|
2281
|
+
getCategoriesAdmin: "servicesGetCategories",
|
|
2282
|
+
updateCategory: "servicesUpdateCategory",
|
|
2283
|
+
deleteCategory: "servicesDeleteCategory",
|
|
2284
|
+
createService: "servicesCreateService",
|
|
2285
|
+
getServicesAdmin: "servicesGetServices",
|
|
2286
|
+
getCurrentMemberShifts: "servicesGetCurrentMemberShifts",
|
|
2287
|
+
getShifts: "servicesGetShifts",
|
|
2288
|
+
getServiceAdmin: "servicesGetService",
|
|
2289
|
+
updateService: "servicesUpdateService",
|
|
2290
|
+
deleteService: "servicesDeleteService",
|
|
2291
|
+
createResource: "servicesCreateResource",
|
|
2292
|
+
getResources: "servicesGetResources",
|
|
2293
|
+
updateResource: "servicesUpdateResource",
|
|
2294
|
+
deleteResource: "servicesDeleteResource",
|
|
2295
|
+
createBookingAdmin: "servicesCreateBooking",
|
|
2296
|
+
getBookings: "servicesGetBookings",
|
|
2297
|
+
getBookingAdmin: "servicesGetBooking",
|
|
2298
|
+
updateBookingStatus: "servicesUpdateBookingStatus",
|
|
2299
|
+
completeBooking: "servicesCompleteBooking",
|
|
2300
|
+
createShift: "servicesCreateShift",
|
|
2301
|
+
getStaffShifts: "servicesGetStaffShifts",
|
|
2302
|
+
addBreak: "servicesAddBreak",
|
|
2303
|
+
registerCustomerApp: "servicesRegisterCustomerApp",
|
|
2304
|
+
getServiceUtilization: "servicesGetUtilization",
|
|
2305
|
+
getServicePerformance: "servicesGetPerformance",
|
|
2306
|
+
getServiceFunnel: "servicesGetFunnel"
|
|
2307
|
+
};
|
|
2171
2308
|
var adminMapping = {
|
|
2172
2309
|
getStats: "adminControllerGetStats",
|
|
2173
2310
|
listOrganizations: "adminControllerListOrganizations",
|
|
@@ -2255,8 +2392,11 @@ function getJwtExpiry(token) {
|
|
|
2255
2392
|
return null;
|
|
2256
2393
|
}
|
|
2257
2394
|
|
|
2258
|
-
// src/client.
|
|
2395
|
+
// src/client.tsx
|
|
2396
|
+
var import_react = require("react");
|
|
2259
2397
|
var import_axios2 = __toESM(require("axios"));
|
|
2398
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
2399
|
+
var AuthContext = (0, import_react.createContext)(void 0);
|
|
2260
2400
|
|
|
2261
2401
|
// src/index.ts
|
|
2262
2402
|
function getEnvOrgSlug() {
|
|
@@ -2331,10 +2471,16 @@ var ScrymeServerSDK = class {
|
|
|
2331
2471
|
this.expiresAt = null;
|
|
2332
2472
|
this.activeAuthPromise = null;
|
|
2333
2473
|
if (!config || !config.clientId || !config.clientSecret || !config.orgSlug) {
|
|
2334
|
-
throw new Error(
|
|
2474
|
+
throw new Error(
|
|
2475
|
+
"clientId, clientSecret, and orgSlug are required to initialize the SDK."
|
|
2476
|
+
);
|
|
2477
|
+
}
|
|
2478
|
+
let finalBaseURL = config.baseURL || "https://api.scryme.tech";
|
|
2479
|
+
if (finalBaseURL && !finalBaseURL.includes("/api") && !finalBaseURL.endsWith("/api")) {
|
|
2480
|
+
finalBaseURL = finalBaseURL.replace(/\/$/, "") + "/api";
|
|
2335
2481
|
}
|
|
2336
2482
|
this.axiosInstance = import_axios3.default.create({
|
|
2337
|
-
baseURL:
|
|
2483
|
+
baseURL: finalBaseURL
|
|
2338
2484
|
});
|
|
2339
2485
|
if (config.token) {
|
|
2340
2486
|
this.token = config.token;
|
|
@@ -2374,14 +2520,29 @@ var ScrymeServerSDK = class {
|
|
|
2374
2520
|
return this.activeAuthPromise;
|
|
2375
2521
|
};
|
|
2376
2522
|
this.axiosInstance.interceptors.request.use(async (req) => {
|
|
2377
|
-
const isAuthTokenRequest = req.url && (req.url.endsWith("/auth/token") || req.url.includes("/auth/token"));
|
|
2523
|
+
const isAuthTokenRequest = req.url && (req.url.endsWith("/auth/token") || req.url.includes("/auth/token") || req.url.includes("/customers/auth/refresh") || req.url.includes("/customers/auth/swap-zitadel"));
|
|
2378
2524
|
if (!isAuthTokenRequest && !config.apiKey) {
|
|
2379
2525
|
const isExpired = !this.token || this.expiresAt && Date.now() >= this.expiresAt - 3e4;
|
|
2380
|
-
if (isExpired
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2526
|
+
if (isExpired) {
|
|
2527
|
+
const isCustomerToken = this.token && getJwtExpiry(this.token) && !config.clientSecret;
|
|
2528
|
+
if (isCustomerToken || this.token && !config.clientSecret) {
|
|
2529
|
+
try {
|
|
2530
|
+
await this.auth.refreshSession();
|
|
2531
|
+
} catch (e) {
|
|
2532
|
+
console.error(
|
|
2533
|
+
"Proactive customer session refresh failed in request interceptor:",
|
|
2534
|
+
e
|
|
2535
|
+
);
|
|
2536
|
+
}
|
|
2537
|
+
} else if (config.clientId && config.clientSecret) {
|
|
2538
|
+
try {
|
|
2539
|
+
await performExchange();
|
|
2540
|
+
} catch (e) {
|
|
2541
|
+
console.error(
|
|
2542
|
+
"Auto-authentication failed in request interceptor:",
|
|
2543
|
+
e
|
|
2544
|
+
);
|
|
2545
|
+
}
|
|
2385
2546
|
}
|
|
2386
2547
|
}
|
|
2387
2548
|
}
|
|
@@ -2394,15 +2555,24 @@ var ScrymeServerSDK = class {
|
|
|
2394
2555
|
(response) => response,
|
|
2395
2556
|
async (error) => {
|
|
2396
2557
|
const originalRequest = error.config;
|
|
2397
|
-
const isAuthTokenRequest = originalRequest && originalRequest.url && (originalRequest.url.endsWith("/auth/token") || originalRequest.url.includes("/auth/token"));
|
|
2398
|
-
if (error.response && error.response.status === 401 && originalRequest && !originalRequest._retry && !isAuthTokenRequest && !config.apiKey
|
|
2558
|
+
const isAuthTokenRequest = originalRequest && originalRequest.url && (originalRequest.url.endsWith("/auth/token") || originalRequest.url.includes("/auth/token") || originalRequest.url.includes("/customers/auth/refresh") || originalRequest.url.includes("/customers/auth/swap-zitadel"));
|
|
2559
|
+
if (error.response && error.response.status === 401 && originalRequest && !originalRequest._retry && !isAuthTokenRequest && !config.apiKey) {
|
|
2399
2560
|
originalRequest._retry = true;
|
|
2400
2561
|
try {
|
|
2401
|
-
|
|
2402
|
-
if (this.token) {
|
|
2403
|
-
|
|
2562
|
+
const isCustomerToken = this.token && getJwtExpiry(this.token) && !config.clientSecret;
|
|
2563
|
+
if (isCustomerToken || this.token && !config.clientSecret) {
|
|
2564
|
+
await this.auth.refreshSession();
|
|
2565
|
+
if (this.token) {
|
|
2566
|
+
originalRequest.headers["Authorization"] = `Bearer ${this.token}`;
|
|
2567
|
+
}
|
|
2568
|
+
return this.axiosInstance(originalRequest);
|
|
2569
|
+
} else if (config.clientId && config.clientSecret) {
|
|
2570
|
+
await performExchange();
|
|
2571
|
+
if (this.token) {
|
|
2572
|
+
originalRequest.headers["Authorization"] = `Bearer ${this.token}`;
|
|
2573
|
+
}
|
|
2574
|
+
return this.axiosInstance(originalRequest);
|
|
2404
2575
|
}
|
|
2405
|
-
return this.axiosInstance(originalRequest);
|
|
2406
2576
|
} catch (e) {
|
|
2407
2577
|
return Promise.reject(error);
|
|
2408
2578
|
}
|
|
@@ -2420,6 +2590,141 @@ var ScrymeServerSDK = class {
|
|
|
2420
2590
|
this.loyalty = buildModule(this.api, config.orgSlug, loyaltyMapping);
|
|
2421
2591
|
this.members = buildModule(this.api, config.orgSlug, membersMapping);
|
|
2422
2592
|
this.admin = buildModule(this.api, config.orgSlug, adminMapping);
|
|
2593
|
+
this.services = buildModule(this.api, config.orgSlug, servicesMapping);
|
|
2594
|
+
this.cart = {
|
|
2595
|
+
get: async (params) => {
|
|
2596
|
+
return this.orders.getCart(params || {});
|
|
2597
|
+
},
|
|
2598
|
+
add: async (dto) => {
|
|
2599
|
+
return this.orders.addToCart(dto);
|
|
2600
|
+
},
|
|
2601
|
+
remove: async (dto) => {
|
|
2602
|
+
return this.orders.removeFromCart(dto);
|
|
2603
|
+
},
|
|
2604
|
+
clear: async (params) => {
|
|
2605
|
+
return this.orders.clearCart(params || {});
|
|
2606
|
+
},
|
|
2607
|
+
update: async (dto) => {
|
|
2608
|
+
const response = await this.orders.getCart({
|
|
2609
|
+
sessionId: dto.sessionId
|
|
2610
|
+
});
|
|
2611
|
+
const data = response.data;
|
|
2612
|
+
const items = data?.data?.items || data?.items || [];
|
|
2613
|
+
let existingItem = null;
|
|
2614
|
+
if (dto.productId) {
|
|
2615
|
+
existingItem = items.find(
|
|
2616
|
+
(item) => item.productId === dto.productId && (item.variantId || null) === (dto.variantId || null)
|
|
2617
|
+
);
|
|
2618
|
+
} else if (dto.serviceId) {
|
|
2619
|
+
existingItem = items.find(
|
|
2620
|
+
(item) => item.serviceId === dto.serviceId
|
|
2621
|
+
);
|
|
2622
|
+
}
|
|
2623
|
+
if (existingItem) {
|
|
2624
|
+
const currentQty = existingItem.quantity || 0;
|
|
2625
|
+
if (dto.quantity <= 0) {
|
|
2626
|
+
return this.orders.removeFromCart({
|
|
2627
|
+
productId: dto.productId,
|
|
2628
|
+
variantId: dto.variantId,
|
|
2629
|
+
serviceId: dto.serviceId,
|
|
2630
|
+
sessionId: dto.sessionId,
|
|
2631
|
+
customerId: dto.customerId
|
|
2632
|
+
});
|
|
2633
|
+
} else {
|
|
2634
|
+
const diff = dto.quantity - currentQty;
|
|
2635
|
+
if (diff !== 0) {
|
|
2636
|
+
return this.orders.addToCart({
|
|
2637
|
+
...dto,
|
|
2638
|
+
quantity: diff
|
|
2639
|
+
});
|
|
2640
|
+
}
|
|
2641
|
+
return response;
|
|
2642
|
+
}
|
|
2643
|
+
} else {
|
|
2644
|
+
if (dto.quantity > 0) {
|
|
2645
|
+
return this.orders.addToCart(dto);
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
},
|
|
2649
|
+
getItems: async (params) => {
|
|
2650
|
+
const res = await this.orders.getCart(params || {});
|
|
2651
|
+
const data = res?.data || res;
|
|
2652
|
+
return data?.items || data?.data?.items || [];
|
|
2653
|
+
},
|
|
2654
|
+
getTotals: async (params) => {
|
|
2655
|
+
const res = await this.orders.getCart(params || {});
|
|
2656
|
+
const data = res?.data || res;
|
|
2657
|
+
const items = data?.items || data?.data?.items || [];
|
|
2658
|
+
const itemsCount = items.reduce(
|
|
2659
|
+
(sum, item) => sum + (item.quantity || 0),
|
|
2660
|
+
0
|
|
2661
|
+
);
|
|
2662
|
+
return {
|
|
2663
|
+
itemsCount,
|
|
2664
|
+
items,
|
|
2665
|
+
raw: data
|
|
2666
|
+
};
|
|
2667
|
+
},
|
|
2668
|
+
checkout: async (params) => {
|
|
2669
|
+
if (!params.customerId)
|
|
2670
|
+
throw new Error("customerId is required for server checkout.");
|
|
2671
|
+
const items = await this.cart.getItems({
|
|
2672
|
+
sessionId: params.sessionId,
|
|
2673
|
+
customerId: params.customerId
|
|
2674
|
+
});
|
|
2675
|
+
if (!items || items.length === 0) {
|
|
2676
|
+
throw new Error("Cannot checkout an empty cart.");
|
|
2677
|
+
}
|
|
2678
|
+
const orderItems = items.map((item) => ({
|
|
2679
|
+
variantId: item.variantId || "",
|
|
2680
|
+
quantity: item.quantity,
|
|
2681
|
+
unitPrice: item.unitPrice
|
|
2682
|
+
}));
|
|
2683
|
+
const orderResponse = await this.orders.createOrder({
|
|
2684
|
+
customerId: params.customerId,
|
|
2685
|
+
locationId: params.locationId,
|
|
2686
|
+
items: orderItems,
|
|
2687
|
+
notes: params.notes,
|
|
2688
|
+
channel: params.channel
|
|
2689
|
+
});
|
|
2690
|
+
await this.cart.clear({
|
|
2691
|
+
sessionId: params.sessionId || "",
|
|
2692
|
+
customerId: params.customerId
|
|
2693
|
+
});
|
|
2694
|
+
return orderResponse?.data || orderResponse;
|
|
2695
|
+
}
|
|
2696
|
+
};
|
|
2697
|
+
this.customer = {
|
|
2698
|
+
getProfile: async (customerId) => {
|
|
2699
|
+
return this.admin.getCustomerById(customerId);
|
|
2700
|
+
},
|
|
2701
|
+
updateProfile: async (customerId, dto) => {
|
|
2702
|
+
return this.admin.updateCustomer(customerId, dto);
|
|
2703
|
+
},
|
|
2704
|
+
getAddresses: async (customerId) => {
|
|
2705
|
+
return this.admin.getCustomerAddresses(customerId);
|
|
2706
|
+
},
|
|
2707
|
+
addAddress: async (customerId, dto) => {
|
|
2708
|
+
return this.admin.addCustomerAddress(customerId, dto);
|
|
2709
|
+
}
|
|
2710
|
+
};
|
|
2711
|
+
this.bookings = {
|
|
2712
|
+
create: async (dto) => {
|
|
2713
|
+
return this.catalog.createBooking(dto);
|
|
2714
|
+
},
|
|
2715
|
+
get: async (id) => {
|
|
2716
|
+
return this.catalog.getBooking(id);
|
|
2717
|
+
},
|
|
2718
|
+
list: async () => {
|
|
2719
|
+
return this.catalog.getBookings();
|
|
2720
|
+
},
|
|
2721
|
+
cancel: async (id) => {
|
|
2722
|
+
return this.catalog.updateBookingStatus(id, "CANCELLED");
|
|
2723
|
+
},
|
|
2724
|
+
complete: async (id, dto) => {
|
|
2725
|
+
return this.catalog.completeBooking(id, dto);
|
|
2726
|
+
}
|
|
2727
|
+
};
|
|
2423
2728
|
const baseAuth = buildModule(this.api, config.orgSlug, authMapping);
|
|
2424
2729
|
this.auth = {
|
|
2425
2730
|
...baseAuth,
|
|
@@ -2430,7 +2735,10 @@ var ScrymeServerSDK = class {
|
|
|
2430
2735
|
return performExchange();
|
|
2431
2736
|
},
|
|
2432
2737
|
signIn: async (credentials) => {
|
|
2433
|
-
const response = await this.axiosInstance.post(
|
|
2738
|
+
const response = await this.axiosInstance.post(
|
|
2739
|
+
"/auth/sign-in/email",
|
|
2740
|
+
credentials
|
|
2741
|
+
);
|
|
2434
2742
|
const data = response.data;
|
|
2435
2743
|
const token = data?.session?.token || data?.token || null;
|
|
2436
2744
|
if (token) {
|
|
@@ -2439,6 +2747,39 @@ var ScrymeServerSDK = class {
|
|
|
2439
2747
|
this.axiosInstance.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
2440
2748
|
}
|
|
2441
2749
|
return data;
|
|
2750
|
+
},
|
|
2751
|
+
getCurrentSession: async () => {
|
|
2752
|
+
const response = await this.axiosInstance.get(
|
|
2753
|
+
`/${config.orgSlug}/customers/auth/session`
|
|
2754
|
+
);
|
|
2755
|
+
return response.data?.data || response.data;
|
|
2756
|
+
},
|
|
2757
|
+
refreshSession: async () => {
|
|
2758
|
+
const response = await this.axiosInstance.post(
|
|
2759
|
+
`/${config.orgSlug}/customers/auth/refresh`
|
|
2760
|
+
);
|
|
2761
|
+
const data = response.data?.data || response.data;
|
|
2762
|
+
const token = data?.token || null;
|
|
2763
|
+
if (token) {
|
|
2764
|
+
this.token = token;
|
|
2765
|
+
this.expiresAt = getJwtExpiry(token);
|
|
2766
|
+
this.axiosInstance.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
2767
|
+
}
|
|
2768
|
+
return data;
|
|
2769
|
+
},
|
|
2770
|
+
swapZitadel: async (zitadelToken) => {
|
|
2771
|
+
const response = await this.axiosInstance.post(
|
|
2772
|
+
`/${config.orgSlug}/customers/auth/swap-zitadel`,
|
|
2773
|
+
{ zitadelToken }
|
|
2774
|
+
);
|
|
2775
|
+
const data = response.data?.data || response.data;
|
|
2776
|
+
const token = data?.token || null;
|
|
2777
|
+
if (token) {
|
|
2778
|
+
this.token = token;
|
|
2779
|
+
this.expiresAt = getJwtExpiry(token);
|
|
2780
|
+
this.axiosInstance.defaults.headers.common["Authorization"] = `Bearer ${token}`;
|
|
2781
|
+
}
|
|
2782
|
+
return data;
|
|
2442
2783
|
}
|
|
2443
2784
|
};
|
|
2444
2785
|
}
|
package/dist/server.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scryme/sdk",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.65.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -40,10 +40,20 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"axios": "^1.18.1"
|
|
42
42
|
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependenciesMeta": {
|
|
47
|
+
"react": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
43
51
|
"devDependencies": {
|
|
44
52
|
"@types/jest": "^29.5.14",
|
|
53
|
+
"@types/react": "^19.2.14",
|
|
45
54
|
"jest": "^29.7.0",
|
|
46
55
|
"orval": "^8.23.0",
|
|
56
|
+
"react": "^19.2.14",
|
|
47
57
|
"ts-jest": "^29.1.1",
|
|
48
58
|
"tsup": "^8.5.1",
|
|
49
59
|
"typescript": "5.7.3",
|
|
@@ -51,8 +61,8 @@
|
|
|
51
61
|
},
|
|
52
62
|
"scripts": {
|
|
53
63
|
"generate": "orval",
|
|
54
|
-
"build": "tsup src/index.ts src/client.
|
|
55
|
-
"dev": "tsup src/index.ts src/client.
|
|
64
|
+
"build": "tsup src/index.ts src/client.tsx src/server.ts --format cjs,esm --dts",
|
|
65
|
+
"dev": "tsup src/index.ts src/client.tsx src/server.ts --format cjs,esm --dts --watch",
|
|
56
66
|
"test": "jest"
|
|
57
67
|
}
|
|
58
68
|
}
|