@scryme/sdk 9.66.0 → 9.68.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/dist/server.js CHANGED
@@ -649,6 +649,12 @@ var getScrymeV3API = (axiosInstance = import_axios.default) => {
649
649
  options
650
650
  );
651
651
  };
652
+ const catalogGetProduct = (orgSlug, idOrSlug, options) => {
653
+ return axiosInstance.get(
654
+ `/v3/${orgSlug}/catalog/products/${idOrSlug}`,
655
+ options
656
+ );
657
+ };
652
658
  const catalogGetServices = (orgSlug, params, options) => {
653
659
  return axiosInstance.get(
654
660
  `/v3/${orgSlug}/catalog/services`,
@@ -688,6 +694,29 @@ var getScrymeV3API = (axiosInstance = import_axios.default) => {
688
694
  options
689
695
  );
690
696
  };
697
+ const catalogCreateReview = (orgSlug, productId, createProductReviewDto, options) => {
698
+ return axiosInstance.post(
699
+ `/v3/${orgSlug}/catalog/products/${productId}/reviews`,
700
+ createProductReviewDto,
701
+ options
702
+ );
703
+ };
704
+ const catalogUpdateReview = (orgSlug, reviewId, updateProductReviewDto, options) => {
705
+ return axiosInstance.patch(
706
+ `/v3/${orgSlug}/catalog/reviews/${reviewId}`,
707
+ updateProductReviewDto,
708
+ options
709
+ );
710
+ };
711
+ const catalogDeleteReview = (orgSlug, reviewId, params, options) => {
712
+ return axiosInstance.delete(
713
+ `/v3/${orgSlug}/catalog/reviews/${reviewId}`,
714
+ {
715
+ ...options,
716
+ params: { ...params, ...options?.params }
717
+ }
718
+ );
719
+ };
691
720
  const servicesCreateCategory = (orgSlug, createServiceCategoryDto, options) => {
692
721
  return axiosInstance.post(
693
722
  `/v3/${orgSlug}/services/categories`,
@@ -925,13 +954,6 @@ var getScrymeV3API = (axiosInstance = import_axios.default) => {
925
954
  options
926
955
  );
927
956
  };
928
- const customersProvisionZitadel = (orgSlug, provisionZitadelDto, options) => {
929
- return axiosInstance.post(
930
- `/v3/${orgSlug}/customers/zitadel/provision`,
931
- provisionZitadelDto,
932
- options
933
- );
934
- };
935
957
  const customersGetCustomers = (orgSlug, params, options) => {
936
958
  return axiosInstance.get(
937
959
  `/v3/${orgSlug}/customers`,
@@ -948,6 +970,13 @@ var getScrymeV3API = (axiosInstance = import_axios.default) => {
948
970
  options
949
971
  );
950
972
  };
973
+ const customerRegister = (orgSlug, registerCustomerDto, options) => {
974
+ return axiosInstance.post(
975
+ `/v3/${orgSlug}/customers/../customer/register`,
976
+ registerCustomerDto,
977
+ options
978
+ );
979
+ };
951
980
  const customersLogin = (orgSlug, customerLoginDto, options) => {
952
981
  return axiosInstance.post(
953
982
  `/v3/${orgSlug}/customers/auth/login`,
@@ -955,6 +984,13 @@ var getScrymeV3API = (axiosInstance = import_axios.default) => {
955
984
  options
956
985
  );
957
986
  };
987
+ const customersRefreshSession = (orgSlug, options) => {
988
+ return axiosInstance.post(
989
+ `/v3/${orgSlug}/customers/auth/refresh`,
990
+ void 0,
991
+ options
992
+ );
993
+ };
958
994
  const customersGetCurrentSession = (orgSlug, options) => {
959
995
  return axiosInstance.get(
960
996
  `/v3/${orgSlug}/customers/auth/session`,
@@ -1893,7 +1929,7 @@ var getScrymeV3API = (axiosInstance = import_axios.default) => {
1893
1929
  }
1894
1930
  );
1895
1931
  };
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 };
1932
+ 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, catalogGetProduct, catalogGetServices, catalogUpdateProduct, catalogUpdateSupplierVariant, catalogGetPriceChangeRequests, catalogReviewPriceChangeRequest, catalogCreateReview, catalogUpdateReview, catalogDeleteReview, 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, 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, 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 };
1897
1933
  };
1898
1934
 
1899
1935
  // src/base.ts
@@ -1932,12 +1968,16 @@ var methodsWithOrgSlugSet = /* @__PURE__ */ new Set([
1932
1968
  "webhooksList",
1933
1969
  "webhooksDelete",
1934
1970
  "catalogGetProducts",
1971
+ "catalogGetProduct",
1935
1972
  "catalogCreateProduct",
1936
1973
  "catalogGetServices",
1937
1974
  "catalogUpdateProduct",
1938
1975
  "catalogUpdateSupplierVariant",
1939
1976
  "catalogGetPriceChangeRequests",
1940
1977
  "catalogReviewPriceChangeRequest",
1978
+ "catalogCreateReview",
1979
+ "catalogUpdateReview",
1980
+ "catalogDeleteReview",
1941
1981
  "servicesCreateCategory",
1942
1982
  "servicesGetCategories",
1943
1983
  "servicesUpdateCategory",
@@ -1965,7 +2005,6 @@ var methodsWithOrgSlugSet = /* @__PURE__ */ new Set([
1965
2005
  "servicesGetUtilization",
1966
2006
  "servicesGetPerformance",
1967
2007
  "servicesGetFunnel",
1968
- "customersProvisionZitadel",
1969
2008
  "customersGetCustomers",
1970
2009
  "customersRegister",
1971
2010
  "customersUpdate",
@@ -1974,6 +2013,10 @@ var methodsWithOrgSlugSet = /* @__PURE__ */ new Set([
1974
2013
  "customersGetAddresses",
1975
2014
  "customersAddAddress",
1976
2015
  "customersGetCurrentSession",
2016
+ "customersGetSessions",
2017
+ "customersRevokeSession",
2018
+ "customersRevokeAllSessions",
2019
+ "customersRefreshSession",
1977
2020
  "businessAccountControllerCreate",
1978
2021
  "businessAccountControllerGetOne",
1979
2022
  "crmControllerCreateRecord",
@@ -2042,12 +2085,16 @@ var methodsWithOrgSlugSet = /* @__PURE__ */ new Set([
2042
2085
  ]);
2043
2086
  var catalogMapping = {
2044
2087
  getProducts: "catalogGetProducts",
2088
+ getProduct: "catalogGetProduct",
2045
2089
  createProduct: "catalogCreateProduct",
2046
2090
  getServices: "catalogGetServices",
2047
2091
  updateProduct: "catalogUpdateProduct",
2048
2092
  updateSupplierVariant: "catalogUpdateSupplierVariant",
2049
2093
  getPriceChangeRequests: "catalogGetPriceChangeRequests",
2050
2094
  reviewPriceChangeRequest: "catalogReviewPriceChangeRequest",
2095
+ createReview: "catalogCreateReview",
2096
+ updateReview: "catalogUpdateReview",
2097
+ deleteReview: "catalogDeleteReview",
2051
2098
  createServiceCategory: "servicesCreateCategory",
2052
2099
  getServiceCategories: "servicesGetCategories",
2053
2100
  updateServiceCategory: "servicesUpdateCategory",
@@ -2340,7 +2387,6 @@ var adminMapping = {
2340
2387
  handleWindmillApprovalCallback: "windmillCallbackControllerHandleApprovalCallback",
2341
2388
  handleWindmillBakeryDisposalCallback: "windmillCallbackControllerHandleBakeryDisposalCallback",
2342
2389
  handleWindmillOutcomeCallback: "windmillCallbackControllerHandleOutcomeCallback",
2343
- provisionZitadel: "customersProvisionZitadel",
2344
2390
  getCustomers: "customersGetCustomers",
2345
2391
  registerCustomer: "customersRegister",
2346
2392
  updateCustomer: "customersUpdate",
@@ -2395,8 +2441,6 @@ function getJwtExpiry(token) {
2395
2441
  // src/client.tsx
2396
2442
  var import_react = require("react");
2397
2443
  var import_axios2 = __toESM(require("axios"));
2398
- var import_jsx_runtime = require("react/jsx-runtime");
2399
- var AuthContext = (0, import_react.createContext)(void 0);
2400
2444
 
2401
2445
  // src/index.ts
2402
2446
  function getEnvOrgSlug() {
@@ -2520,7 +2564,7 @@ var ScrymeServerSDK = class {
2520
2564
  return this.activeAuthPromise;
2521
2565
  };
2522
2566
  this.axiosInstance.interceptors.request.use(async (req) => {
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"));
2567
+ const isAuthTokenRequest = req.url && (req.url.endsWith("/auth/token") || req.url.includes("/auth/token") || req.url.includes("/customers/auth/refresh"));
2524
2568
  if (!isAuthTokenRequest && !config.apiKey) {
2525
2569
  const isExpired = !this.token || this.expiresAt && Date.now() >= this.expiresAt - 3e4;
2526
2570
  if (isExpired) {
@@ -2555,7 +2599,7 @@ var ScrymeServerSDK = class {
2555
2599
  (response) => response,
2556
2600
  async (error) => {
2557
2601
  const originalRequest = error.config;
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"));
2602
+ const isAuthTokenRequest = originalRequest && originalRequest.url && (originalRequest.url.endsWith("/auth/token") || originalRequest.url.includes("/auth/token") || originalRequest.url.includes("/customers/auth/refresh"));
2559
2603
  if (error.response && error.response.status === 401 && originalRequest && !originalRequest._retry && !isAuthTokenRequest && !config.apiKey) {
2560
2604
  originalRequest._retry = true;
2561
2605
  try {
@@ -2581,7 +2625,54 @@ var ScrymeServerSDK = class {
2581
2625
  }
2582
2626
  );
2583
2627
  this.api = getScrymeV3API2(this.axiosInstance, config.orgSlug);
2584
- this.catalog = buildModule(this.api, config.orgSlug, catalogMapping);
2628
+ const baseCatalog = buildModule(this.api, config.orgSlug, catalogMapping);
2629
+ this.catalog = {
2630
+ ...baseCatalog,
2631
+ getProduct: async (idOrSlug, options) => {
2632
+ const response = await this.catalog.getProducts(void 0, options);
2633
+ const products = response.data || [];
2634
+ const product = products.find((p) => {
2635
+ if (typeof idOrSlug === "string") {
2636
+ return p.id === idOrSlug || p.slug === idOrSlug;
2637
+ } else {
2638
+ const { id, slug } = idOrSlug;
2639
+ if (id && p.id === id) return true;
2640
+ if (slug && p.slug === slug) return true;
2641
+ return false;
2642
+ }
2643
+ });
2644
+ if (!product) {
2645
+ const criteria = typeof idOrSlug === "string" ? idOrSlug : JSON.stringify(idOrSlug);
2646
+ throw new Error(`Product not found matching criteria: ${criteria}`);
2647
+ }
2648
+ return {
2649
+ ...response,
2650
+ data: product
2651
+ };
2652
+ },
2653
+ getService: async (idOrSlug, options) => {
2654
+ const response = await this.catalog.getServices(void 0, options);
2655
+ const services = response.data || [];
2656
+ const service = services.find((s) => {
2657
+ if (typeof idOrSlug === "string") {
2658
+ return s.id === idOrSlug || s.slug === idOrSlug;
2659
+ } else {
2660
+ const { id, slug } = idOrSlug;
2661
+ if (id && s.id === id) return true;
2662
+ if (slug && s.slug === slug) return true;
2663
+ return false;
2664
+ }
2665
+ });
2666
+ if (!service) {
2667
+ const criteria = typeof idOrSlug === "string" ? idOrSlug : JSON.stringify(idOrSlug);
2668
+ throw new Error(`Service not found matching criteria: ${criteria}`);
2669
+ }
2670
+ return {
2671
+ ...response,
2672
+ data: service
2673
+ };
2674
+ }
2675
+ };
2585
2676
  this.inventory = buildModule(this.api, config.orgSlug, inventoryMapping);
2586
2677
  this.orders = buildModule(this.api, config.orgSlug, ordersMapping);
2587
2678
  this.crm = buildModule(this.api, config.orgSlug, crmMapping);
@@ -2593,7 +2684,9 @@ var ScrymeServerSDK = class {
2593
2684
  this.services = buildModule(this.api, config.orgSlug, servicesMapping);
2594
2685
  this.cart = {
2595
2686
  get: async (params) => {
2596
- return this.orders.getCart(params || {});
2687
+ return this.orders.getCart(
2688
+ params
2689
+ );
2597
2690
  },
2598
2691
  add: async (dto) => {
2599
2692
  return this.orders.addToCart(dto);
@@ -2602,11 +2695,11 @@ var ScrymeServerSDK = class {
2602
2695
  return this.orders.removeFromCart(dto);
2603
2696
  },
2604
2697
  clear: async (params) => {
2605
- return this.orders.clearCart(params || {});
2698
+ return this.orders.clearCart(params);
2606
2699
  },
2607
2700
  update: async (dto) => {
2608
2701
  const response = await this.orders.getCart({
2609
- sessionId: dto.sessionId
2702
+ sessionId: dto.sessionId || ""
2610
2703
  });
2611
2704
  const data = response.data;
2612
2705
  const items = data?.data?.items || data?.items || [];
@@ -2627,7 +2720,7 @@ var ScrymeServerSDK = class {
2627
2720
  productId: dto.productId,
2628
2721
  variantId: dto.variantId,
2629
2722
  serviceId: dto.serviceId,
2630
- sessionId: dto.sessionId,
2723
+ sessionId: dto.sessionId || "",
2631
2724
  customerId: dto.customerId
2632
2725
  });
2633
2726
  } else {
@@ -2647,12 +2740,16 @@ var ScrymeServerSDK = class {
2647
2740
  }
2648
2741
  },
2649
2742
  getItems: async (params) => {
2650
- const res = await this.orders.getCart(params || {});
2743
+ const res = await this.orders.getCart(
2744
+ params
2745
+ );
2651
2746
  const data = res?.data || res;
2652
2747
  return data?.items || data?.data?.items || [];
2653
2748
  },
2654
2749
  getTotals: async (params) => {
2655
- const res = await this.orders.getCart(params || {});
2750
+ const res = await this.orders.getCart(
2751
+ params
2752
+ );
2656
2753
  const data = res?.data || res;
2657
2754
  const items = data?.items || data?.data?.items || [];
2658
2755
  const itemsCount = items.reduce(
@@ -2706,6 +2803,72 @@ var ScrymeServerSDK = class {
2706
2803
  },
2707
2804
  addAddress: async (customerId, dto) => {
2708
2805
  return this.admin.addCustomerAddress(customerId, dto);
2806
+ },
2807
+ auth: {
2808
+ signUp: async (dto) => {
2809
+ const res = await this.api.customersRegister(config.orgSlug, dto);
2810
+ if (dto.password) {
2811
+ try {
2812
+ await this.customer.auth.signIn({
2813
+ email: dto.email,
2814
+ password: dto.password
2815
+ });
2816
+ } catch (e) {
2817
+ console.error("Auto sign-in after sign-up failed on server SDK:", e);
2818
+ }
2819
+ }
2820
+ return res;
2821
+ },
2822
+ signIn: async (credentials) => {
2823
+ const response = await this.axiosInstance.post(
2824
+ "/auth/sign-in/email",
2825
+ credentials
2826
+ );
2827
+ const data = response.data;
2828
+ const token = data?.session?.token || data?.token || null;
2829
+ if (token) {
2830
+ this.token = token;
2831
+ this.expiresAt = getJwtExpiry(token);
2832
+ this.axiosInstance.defaults.headers.common["Authorization"] = `Bearer ${token}`;
2833
+ }
2834
+ return data;
2835
+ },
2836
+ getCurrentSession: async (headers) => {
2837
+ const requestConfig = {};
2838
+ if (headers) {
2839
+ const requestHeaders = {};
2840
+ if (typeof headers.forEach === "function") {
2841
+ headers.forEach((value, key) => {
2842
+ requestHeaders[key] = value;
2843
+ });
2844
+ } else {
2845
+ for (const [key, value] of Object.entries(headers)) {
2846
+ if (value !== void 0) {
2847
+ requestHeaders[key] = Array.isArray(value) ? value.join(", ") : String(value);
2848
+ }
2849
+ }
2850
+ }
2851
+ requestConfig.headers = requestHeaders;
2852
+ }
2853
+ const response = await this.axiosInstance.get(
2854
+ `/${config.orgSlug}/customers/auth/session`,
2855
+ requestConfig
2856
+ );
2857
+ return response.data?.data || response.data;
2858
+ },
2859
+ refreshSession: async () => {
2860
+ const response = await this.axiosInstance.post(
2861
+ `/${config.orgSlug}/customers/auth/refresh`
2862
+ );
2863
+ const data = response.data?.data || response.data;
2864
+ const token = data?.token || null;
2865
+ if (token) {
2866
+ this.token = token;
2867
+ this.expiresAt = getJwtExpiry(token);
2868
+ this.axiosInstance.defaults.headers.common["Authorization"] = `Bearer ${token}`;
2869
+ }
2870
+ return data;
2871
+ }
2709
2872
  }
2710
2873
  };
2711
2874
  this.bookings = {
@@ -2728,58 +2891,21 @@ var ScrymeServerSDK = class {
2728
2891
  const baseAuth = buildModule(this.api, config.orgSlug, authMapping);
2729
2892
  this.auth = {
2730
2893
  ...baseAuth,
2731
- signUp: async (dto) => {
2732
- return this.api.customersRegister(config.orgSlug, dto);
2733
- },
2894
+ ...this.customer.auth,
2734
2895
  authenticate: async () => {
2735
2896
  return performExchange();
2736
2897
  },
2898
+ signUp: async (dto) => {
2899
+ return this.customer.auth.signUp(dto);
2900
+ },
2737
2901
  signIn: async (credentials) => {
2738
- const response = await this.axiosInstance.post(
2739
- "/auth/sign-in/email",
2740
- credentials
2741
- );
2742
- const data = response.data;
2743
- const token = data?.session?.token || data?.token || null;
2744
- if (token) {
2745
- this.token = token;
2746
- this.expiresAt = getJwtExpiry(token);
2747
- this.axiosInstance.defaults.headers.common["Authorization"] = `Bearer ${token}`;
2748
- }
2749
- return data;
2902
+ return this.customer.auth.signIn(credentials);
2750
2903
  },
2751
- getCurrentSession: async () => {
2752
- const response = await this.axiosInstance.get(
2753
- `/${config.orgSlug}/customers/auth/session`
2754
- );
2755
- return response.data?.data || response.data;
2904
+ getCurrentSession: async (headers) => {
2905
+ return this.customer.auth.getCurrentSession(headers);
2756
2906
  },
2757
2907
  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;
2908
+ return this.customer.auth.refreshSession();
2783
2909
  }
2784
2910
  };
2785
2911
  }
package/dist/server.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ScrymeServerSDK,
3
3
  createServerSDK
4
- } from "./chunk-PPNV4D3M.mjs";
4
+ } from "./chunk-SYGBIPUK.mjs";
5
5
  export {
6
6
  ScrymeServerSDK,
7
7
  createServerSDK
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scryme/sdk",
3
- "version": "9.66.0",
3
+ "version": "9.68.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },