@kasuvia/sdk 0.0.1 → 0.0.2
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/README.md +1 -1
- package/dist/index.d.mts +40 -2
- package/dist/index.d.ts +40 -2
- package/dist/index.js +79 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/config/index.ts +1 -1
- package/src/index.ts +3 -0
- package/src/types/auth/index.ts +21 -0
- package/src/types/store/index.ts +6 -2
- package/src/utils/customer.ts +14 -0
- package/src/utils/storage.ts +71 -0
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ The SDK includes integration with kasuvia-cms for dynamic content models. Busine
|
|
|
76
76
|
|
|
77
77
|
```ts
|
|
78
78
|
import { useCmsEntries, useCreateCmsEntry } from '@kasuvia/sdk'
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
function BlogPosts() {
|
|
81
81
|
// List entries from a CMS model (requires public_api.read permission)
|
|
82
82
|
const { entries, isLoading } = useCmsEntries('blog-posts', { page: 1, page_size: 10 })
|
package/dist/index.d.mts
CHANGED
|
@@ -159,6 +159,25 @@ interface UpdateProfilePayload {
|
|
|
159
159
|
lastname?: string;
|
|
160
160
|
phone?: string;
|
|
161
161
|
}
|
|
162
|
+
interface NotificationPreferences {
|
|
163
|
+
email_enabled: boolean;
|
|
164
|
+
sms_enabled: boolean;
|
|
165
|
+
whatsapp_enabled: boolean;
|
|
166
|
+
push_enabled: boolean;
|
|
167
|
+
email_order_confirmations: boolean;
|
|
168
|
+
email_delivery_updates: boolean;
|
|
169
|
+
email_low_stock_alerts: boolean;
|
|
170
|
+
email_payment_received: boolean;
|
|
171
|
+
push_order_confirmations: boolean;
|
|
172
|
+
push_delivery_updates: boolean;
|
|
173
|
+
push_low_stock_alerts: boolean;
|
|
174
|
+
push_payment_received: boolean;
|
|
175
|
+
whatsapp_order_confirmations: boolean;
|
|
176
|
+
whatsapp_delivery_updates: boolean;
|
|
177
|
+
whatsapp_payment_received: boolean;
|
|
178
|
+
sms_order_confirmations: boolean;
|
|
179
|
+
sms_delivery_updates: boolean;
|
|
180
|
+
}
|
|
162
181
|
interface BusinessContext {
|
|
163
182
|
id: string;
|
|
164
183
|
business_id: string;
|
|
@@ -252,7 +271,6 @@ interface DeliveryAddress {
|
|
|
252
271
|
}
|
|
253
272
|
|
|
254
273
|
type ProductType = "physical" | "digital" | "service" | "bespoke";
|
|
255
|
-
|
|
256
274
|
interface Address {
|
|
257
275
|
street: string;
|
|
258
276
|
city: string;
|
|
@@ -1873,6 +1891,11 @@ declare function splitFullName(fullName?: string): {
|
|
|
1873
1891
|
lastname: string;
|
|
1874
1892
|
};
|
|
1875
1893
|
declare function getCustomerDisplayName(user: CustomerUser): string;
|
|
1894
|
+
/**
|
|
1895
|
+
* Constructs live storefront URL for a business.
|
|
1896
|
+
* If custom domain is not yet connected/verified, defaults to `https://<business_id>.kasuvia.com`.
|
|
1897
|
+
*/
|
|
1898
|
+
declare function getStorefrontUrl(businessId: string, customDomain?: string | null): string;
|
|
1876
1899
|
|
|
1877
1900
|
declare function buildDeliveryAddress(customer: CheckoutCustomer, location: ShippingLocation): DeliveryAddress;
|
|
1878
1901
|
declare function getCheckoutCustomerName(customer: CheckoutCustomer): string;
|
|
@@ -1888,4 +1911,19 @@ declare function enrichCompletedOrder(order: Order, options: {
|
|
|
1888
1911
|
*/
|
|
1889
1912
|
declare function getErrorMessage(error: unknown, fallback?: string): string;
|
|
1890
1913
|
|
|
1891
|
-
|
|
1914
|
+
declare const sessionStore: {
|
|
1915
|
+
get: (key: string) => string | null;
|
|
1916
|
+
set: (key: string, value: string) => void;
|
|
1917
|
+
remove: (key: string) => void;
|
|
1918
|
+
getJSON: <T = unknown>(key: string) => T | null;
|
|
1919
|
+
setJSON: (key: string, value: unknown) => void;
|
|
1920
|
+
};
|
|
1921
|
+
declare const localStore: {
|
|
1922
|
+
get: (key: string) => string | null;
|
|
1923
|
+
set: (key: string, value: string) => void;
|
|
1924
|
+
remove: (key: string) => void;
|
|
1925
|
+
getJSON: <T = unknown>(key: string) => T | null;
|
|
1926
|
+
setJSON: (key: string, value: unknown) => void;
|
|
1927
|
+
};
|
|
1928
|
+
|
|
1929
|
+
export { type Address, type AppContextValue, type AppState, type AppointmentStatus, type AuthContextValue, AuthCtx, AuthProvider, type AuthUserResponse, type AvailableSlot, type AvatarObject, type BackendLanguage, type BespokeAvailability, type BespokeCapacityConfig, type BespokeSlotBooking, type BespokeStageKey, type BusinessConfig, type BusinessContext, type CartContextValue, CartCtx, type CartItem, type CartItemPayload, CartProvider, type CartResponse, type CheckoutCustomer, type CmsEntry, type CmsEntryListResponse, type CmsField, type CmsIcon, type CmsIconListResponse, type CmsModel, type CmsModelPermissions, type CmsModelPublicApiPermissions, type Collection, type Consultation, type ConsultationCreatePayload, type ConsultationMessage, type ConsultationMessagePayload, type ConsultationProductType, type ConsultationQuoteAcceptPayload, type ConsultationStatus, type ContactFormData, type ConversionQuote, type Country, type CreateCmsEntryParams, type CreateOrderParams, type Currency, type CustomField, type CustomerAuthResponse, type CustomerLoginPayload, type CustomerProfileFields, type CustomerRegisterPayload, type CustomerUser, type DVACreateRequest, type DVADetails, type DeliverableApprovalPayload, type DeliverableStatus, type DeliverableStatusType, type DeliveryAddress, type FindOrderParams, InvalidBaseURLError, type Inventory, type LangCode, type ListCmsEntriesParams, type ListParams, type LogoutPayload, type MediaAsset, type MediaAssetUpdatePayload, type MediaUploadParams, type NotificationPreferences, type OTPVerifyPayload, type Order, type OrderItem, type OrderStatus, type PaginatedResponse, type PaymentInitiateRequest, type PaymentInitiateResponse, type Product, type ProductType, type ProductVariant, type RateAddress, type RefreshTokenResponse, type ResendOTPPayload, type SdkConfig, type ServiceAppointment, type ServiceAppointmentCreatePayload, type ServiceDeliverable, type ServiceLocationType, type ServiceType, type ShippingLocation, type ShippingRate, type ShippingRatesRequest, type ShippingRatesResponse, type SlotBookingStatus, type State, type StorageStats, type SupportedCurrenciesResponse, type SupportedLang, type SupportedLanguagesResponse, type Theme, type TransactionVerifyResponse, type UpdateCmsEntryParams, type UpdateProfilePayload, type UseCartReturn, type UseCmsEntriesReturn, type UseCmsEntryReturn, type UseCreateCmsEntryReturn, type UseDeleteCmsEntryReturn, type UseUpdateCmsEntryReturn, type WishlistCheckResponse, type WishlistItem, type WishlistListResponse, acceptQuote, addToCart, addToGuestCart, addToWishlist, approveDeliverable, authAxios, bespokeService, bookAppointment, buildDeliveryAddress, buildFullName, cancelAppointment, cancelOrder, checkAvailability, checkInWishlist, clearCart, clearGuestCart, clearGuestSessionId, cmsAxios, collectionKeys, configService, configureHttpClients, consultationService, createCmsEntry, createConsultation, createDedicatedAccount, createOrder, deleteCmsEntry, enrichCompletedOrder, findOrder, findOrderByToken, getAppointment, getAppointments, getAuthUser, getAvailableSlots, getBackendUrl, getBusinessConfig, getCacheTier, getCart, getCheckoutCustomerName, getCmsEntry, getConsultation, getConsultations, getCountries, getCustomerDisplayName, getDeliverables, getErrorMessage, getFeaturedProducts, getGraphQLClient, getGuestCart, getGuestCartCount, getGuestCartProductType, getGuestCartSubtotal, getGuestSessionId, getLatestProducts, getMe, getNewProducts, getOrCreateGuestSessionId, getOrders, getPopularProducts, getRecommendedProducts, getRuntimeConfig, getSellerShippingAddress, getShippingRates, getStates, getStorefrontCollectionBySlug, getStorefrontCollections, getStorefrontProductBySlug, getStorefrontProducts, getStorefrontUrl, getSupportedCurrencies, getSupportedCurrenciesList, getSupportedLanguages, getSupportedLanguagesList, getTransactionStatus, getWishlist, googleTranslate, initSdk, initiatePayment, isInitialized, listCmsEntries, localStore, logger, loginCustomer, logisticsService, logout, mapAuthUserToCustomer, mergeGuestCart, mergeGuestCartIfPresent, notificationsService, paymentAxios, paymentService, productKeys, publicStoreAxios, refreshToken, registerCustomer, rejectQuote, removeFromCart, removeFromGuestCart, removeFromWishlist, removeProductFromWishlist, requestQuote, requestRevision, resetConfig, resetGraphQLClient, sanitizeBaseUrl, sendContactConfirmation, sendContactEmail, sendMessage, serviceBookingService, sessionStore, setEnvironmentMode, setLoggerEnvironmentMode, silentRefresh, splitFullName, storeManagementAxios, storeTokens, tokenStore, trackOrder, updateCartItem, updateCmsEntry, updateGuestCartItemQuantity, updateProfile, useAcceptQuote, useAddToWishlist, useAppointment, useAppointments, useApproveDeliverable, useAuth, useAuthUser, useAvailableSlots, useBespokeAvailability, useBookAppointment, useCancelAppointment, useCancelOrder, useCart, useCheckInWishlist, useCmsEntries, useCmsEntry, useConsultation, useConsultationStream, useConsultations, useCountries, useCreateCmsEntry, useCreateConsultation, useCreateDVA, useCreateOrder, useCurrencies, useDeleteCmsEntry, useDeliverables, useFeaturedProducts, useFindOrder, useGoogleTranslate, useInitiatePayment, useIsMounted, useLatestProducts, useLogin, useLogout, useNewProducts, useOrder, useOrderStream, useOrderTracking, useOrders, useOrdersList, usePollTransactionStatus, usePopularProducts, useProduct, useRecommendedProducts, useRegister, useRejectQuote, useRemoveFromWishlist, useRemoveProductFromWishlist, useRequestRevision, useSendMessage, useStates, useStorefrontCollection, useStorefrontCollections, useStorefrontProducts, useSupportedLanguages, useTransactionStatus, useUpdateCmsEntry, useUpdateProfile, useVerifyTransaction, useWishlist, useWishlistCount, validateShippingAddress, verifySocialToken, verifyTransaction, wishlistKeys };
|
package/dist/index.d.ts
CHANGED
|
@@ -159,6 +159,25 @@ interface UpdateProfilePayload {
|
|
|
159
159
|
lastname?: string;
|
|
160
160
|
phone?: string;
|
|
161
161
|
}
|
|
162
|
+
interface NotificationPreferences {
|
|
163
|
+
email_enabled: boolean;
|
|
164
|
+
sms_enabled: boolean;
|
|
165
|
+
whatsapp_enabled: boolean;
|
|
166
|
+
push_enabled: boolean;
|
|
167
|
+
email_order_confirmations: boolean;
|
|
168
|
+
email_delivery_updates: boolean;
|
|
169
|
+
email_low_stock_alerts: boolean;
|
|
170
|
+
email_payment_received: boolean;
|
|
171
|
+
push_order_confirmations: boolean;
|
|
172
|
+
push_delivery_updates: boolean;
|
|
173
|
+
push_low_stock_alerts: boolean;
|
|
174
|
+
push_payment_received: boolean;
|
|
175
|
+
whatsapp_order_confirmations: boolean;
|
|
176
|
+
whatsapp_delivery_updates: boolean;
|
|
177
|
+
whatsapp_payment_received: boolean;
|
|
178
|
+
sms_order_confirmations: boolean;
|
|
179
|
+
sms_delivery_updates: boolean;
|
|
180
|
+
}
|
|
162
181
|
interface BusinessContext {
|
|
163
182
|
id: string;
|
|
164
183
|
business_id: string;
|
|
@@ -252,7 +271,6 @@ interface DeliveryAddress {
|
|
|
252
271
|
}
|
|
253
272
|
|
|
254
273
|
type ProductType = "physical" | "digital" | "service" | "bespoke";
|
|
255
|
-
|
|
256
274
|
interface Address {
|
|
257
275
|
street: string;
|
|
258
276
|
city: string;
|
|
@@ -1873,6 +1891,11 @@ declare function splitFullName(fullName?: string): {
|
|
|
1873
1891
|
lastname: string;
|
|
1874
1892
|
};
|
|
1875
1893
|
declare function getCustomerDisplayName(user: CustomerUser): string;
|
|
1894
|
+
/**
|
|
1895
|
+
* Constructs live storefront URL for a business.
|
|
1896
|
+
* If custom domain is not yet connected/verified, defaults to `https://<business_id>.kasuvia.com`.
|
|
1897
|
+
*/
|
|
1898
|
+
declare function getStorefrontUrl(businessId: string, customDomain?: string | null): string;
|
|
1876
1899
|
|
|
1877
1900
|
declare function buildDeliveryAddress(customer: CheckoutCustomer, location: ShippingLocation): DeliveryAddress;
|
|
1878
1901
|
declare function getCheckoutCustomerName(customer: CheckoutCustomer): string;
|
|
@@ -1888,4 +1911,19 @@ declare function enrichCompletedOrder(order: Order, options: {
|
|
|
1888
1911
|
*/
|
|
1889
1912
|
declare function getErrorMessage(error: unknown, fallback?: string): string;
|
|
1890
1913
|
|
|
1891
|
-
|
|
1914
|
+
declare const sessionStore: {
|
|
1915
|
+
get: (key: string) => string | null;
|
|
1916
|
+
set: (key: string, value: string) => void;
|
|
1917
|
+
remove: (key: string) => void;
|
|
1918
|
+
getJSON: <T = unknown>(key: string) => T | null;
|
|
1919
|
+
setJSON: (key: string, value: unknown) => void;
|
|
1920
|
+
};
|
|
1921
|
+
declare const localStore: {
|
|
1922
|
+
get: (key: string) => string | null;
|
|
1923
|
+
set: (key: string, value: string) => void;
|
|
1924
|
+
remove: (key: string) => void;
|
|
1925
|
+
getJSON: <T = unknown>(key: string) => T | null;
|
|
1926
|
+
setJSON: (key: string, value: unknown) => void;
|
|
1927
|
+
};
|
|
1928
|
+
|
|
1929
|
+
export { type Address, type AppContextValue, type AppState, type AppointmentStatus, type AuthContextValue, AuthCtx, AuthProvider, type AuthUserResponse, type AvailableSlot, type AvatarObject, type BackendLanguage, type BespokeAvailability, type BespokeCapacityConfig, type BespokeSlotBooking, type BespokeStageKey, type BusinessConfig, type BusinessContext, type CartContextValue, CartCtx, type CartItem, type CartItemPayload, CartProvider, type CartResponse, type CheckoutCustomer, type CmsEntry, type CmsEntryListResponse, type CmsField, type CmsIcon, type CmsIconListResponse, type CmsModel, type CmsModelPermissions, type CmsModelPublicApiPermissions, type Collection, type Consultation, type ConsultationCreatePayload, type ConsultationMessage, type ConsultationMessagePayload, type ConsultationProductType, type ConsultationQuoteAcceptPayload, type ConsultationStatus, type ContactFormData, type ConversionQuote, type Country, type CreateCmsEntryParams, type CreateOrderParams, type Currency, type CustomField, type CustomerAuthResponse, type CustomerLoginPayload, type CustomerProfileFields, type CustomerRegisterPayload, type CustomerUser, type DVACreateRequest, type DVADetails, type DeliverableApprovalPayload, type DeliverableStatus, type DeliverableStatusType, type DeliveryAddress, type FindOrderParams, InvalidBaseURLError, type Inventory, type LangCode, type ListCmsEntriesParams, type ListParams, type LogoutPayload, type MediaAsset, type MediaAssetUpdatePayload, type MediaUploadParams, type NotificationPreferences, type OTPVerifyPayload, type Order, type OrderItem, type OrderStatus, type PaginatedResponse, type PaymentInitiateRequest, type PaymentInitiateResponse, type Product, type ProductType, type ProductVariant, type RateAddress, type RefreshTokenResponse, type ResendOTPPayload, type SdkConfig, type ServiceAppointment, type ServiceAppointmentCreatePayload, type ServiceDeliverable, type ServiceLocationType, type ServiceType, type ShippingLocation, type ShippingRate, type ShippingRatesRequest, type ShippingRatesResponse, type SlotBookingStatus, type State, type StorageStats, type SupportedCurrenciesResponse, type SupportedLang, type SupportedLanguagesResponse, type Theme, type TransactionVerifyResponse, type UpdateCmsEntryParams, type UpdateProfilePayload, type UseCartReturn, type UseCmsEntriesReturn, type UseCmsEntryReturn, type UseCreateCmsEntryReturn, type UseDeleteCmsEntryReturn, type UseUpdateCmsEntryReturn, type WishlistCheckResponse, type WishlistItem, type WishlistListResponse, acceptQuote, addToCart, addToGuestCart, addToWishlist, approveDeliverable, authAxios, bespokeService, bookAppointment, buildDeliveryAddress, buildFullName, cancelAppointment, cancelOrder, checkAvailability, checkInWishlist, clearCart, clearGuestCart, clearGuestSessionId, cmsAxios, collectionKeys, configService, configureHttpClients, consultationService, createCmsEntry, createConsultation, createDedicatedAccount, createOrder, deleteCmsEntry, enrichCompletedOrder, findOrder, findOrderByToken, getAppointment, getAppointments, getAuthUser, getAvailableSlots, getBackendUrl, getBusinessConfig, getCacheTier, getCart, getCheckoutCustomerName, getCmsEntry, getConsultation, getConsultations, getCountries, getCustomerDisplayName, getDeliverables, getErrorMessage, getFeaturedProducts, getGraphQLClient, getGuestCart, getGuestCartCount, getGuestCartProductType, getGuestCartSubtotal, getGuestSessionId, getLatestProducts, getMe, getNewProducts, getOrCreateGuestSessionId, getOrders, getPopularProducts, getRecommendedProducts, getRuntimeConfig, getSellerShippingAddress, getShippingRates, getStates, getStorefrontCollectionBySlug, getStorefrontCollections, getStorefrontProductBySlug, getStorefrontProducts, getStorefrontUrl, getSupportedCurrencies, getSupportedCurrenciesList, getSupportedLanguages, getSupportedLanguagesList, getTransactionStatus, getWishlist, googleTranslate, initSdk, initiatePayment, isInitialized, listCmsEntries, localStore, logger, loginCustomer, logisticsService, logout, mapAuthUserToCustomer, mergeGuestCart, mergeGuestCartIfPresent, notificationsService, paymentAxios, paymentService, productKeys, publicStoreAxios, refreshToken, registerCustomer, rejectQuote, removeFromCart, removeFromGuestCart, removeFromWishlist, removeProductFromWishlist, requestQuote, requestRevision, resetConfig, resetGraphQLClient, sanitizeBaseUrl, sendContactConfirmation, sendContactEmail, sendMessage, serviceBookingService, sessionStore, setEnvironmentMode, setLoggerEnvironmentMode, silentRefresh, splitFullName, storeManagementAxios, storeTokens, tokenStore, trackOrder, updateCartItem, updateCmsEntry, updateGuestCartItemQuantity, updateProfile, useAcceptQuote, useAddToWishlist, useAppointment, useAppointments, useApproveDeliverable, useAuth, useAuthUser, useAvailableSlots, useBespokeAvailability, useBookAppointment, useCancelAppointment, useCancelOrder, useCart, useCheckInWishlist, useCmsEntries, useCmsEntry, useConsultation, useConsultationStream, useConsultations, useCountries, useCreateCmsEntry, useCreateConsultation, useCreateDVA, useCreateOrder, useCurrencies, useDeleteCmsEntry, useDeliverables, useFeaturedProducts, useFindOrder, useGoogleTranslate, useInitiatePayment, useIsMounted, useLatestProducts, useLogin, useLogout, useNewProducts, useOrder, useOrderStream, useOrderTracking, useOrders, useOrdersList, usePollTransactionStatus, usePopularProducts, useProduct, useRecommendedProducts, useRegister, useRejectQuote, useRemoveFromWishlist, useRemoveProductFromWishlist, useRequestRevision, useSendMessage, useStates, useStorefrontCollection, useStorefrontCollections, useStorefrontProducts, useSupportedLanguages, useTransactionStatus, useUpdateCmsEntry, useUpdateProfile, useVerifyTransaction, useWishlist, useWishlistCount, validateShippingAddress, verifySocialToken, verifyTransaction, wishlistKeys };
|
package/dist/index.js
CHANGED
|
@@ -103,6 +103,7 @@ __export(index_exports, {
|
|
|
103
103
|
getStorefrontCollections: () => getStorefrontCollections,
|
|
104
104
|
getStorefrontProductBySlug: () => getStorefrontProductBySlug,
|
|
105
105
|
getStorefrontProducts: () => getStorefrontProducts,
|
|
106
|
+
getStorefrontUrl: () => getStorefrontUrl,
|
|
106
107
|
getSupportedCurrencies: () => getSupportedCurrencies,
|
|
107
108
|
getSupportedCurrenciesList: () => getSupportedCurrenciesList,
|
|
108
109
|
getSupportedLanguages: () => getSupportedLanguages,
|
|
@@ -114,6 +115,7 @@ __export(index_exports, {
|
|
|
114
115
|
initiatePayment: () => initiatePayment,
|
|
115
116
|
isInitialized: () => isInitialized,
|
|
116
117
|
listCmsEntries: () => listCmsEntries,
|
|
118
|
+
localStore: () => localStore,
|
|
117
119
|
logger: () => logger,
|
|
118
120
|
loginCustomer: () => loginCustomer,
|
|
119
121
|
logisticsService: () => logisticsService,
|
|
@@ -142,6 +144,7 @@ __export(index_exports, {
|
|
|
142
144
|
sendContactEmail: () => sendContactEmail,
|
|
143
145
|
sendMessage: () => sendMessage,
|
|
144
146
|
serviceBookingService: () => serviceBookingService,
|
|
147
|
+
sessionStore: () => sessionStore,
|
|
145
148
|
setEnvironmentMode: () => setEnvironmentMode,
|
|
146
149
|
setLoggerEnvironmentMode: () => setLoggerEnvironmentMode,
|
|
147
150
|
silentRefresh: () => silentRefresh,
|
|
@@ -366,6 +369,14 @@ function getCustomerDisplayName(user) {
|
|
|
366
369
|
const fromParts = buildFullName(user.firstname, user.lastname);
|
|
367
370
|
return fromParts || user.full_name || user.email.split("@")[0];
|
|
368
371
|
}
|
|
372
|
+
function getStorefrontUrl(businessId, customDomain) {
|
|
373
|
+
if (customDomain && customDomain.trim()) {
|
|
374
|
+
const cleanDomain = customDomain.trim().replace(/^https?:\/\//, "");
|
|
375
|
+
return `https://${cleanDomain}`;
|
|
376
|
+
}
|
|
377
|
+
const cleanBid = (businessId || "store").toLowerCase().trim();
|
|
378
|
+
return `https://${cleanBid}.kasuvia.com`;
|
|
379
|
+
}
|
|
369
380
|
|
|
370
381
|
// src/utils/checkout.ts
|
|
371
382
|
function buildDeliveryAddress(customer, location) {
|
|
@@ -409,7 +420,7 @@ var BACKEND_URLS = {
|
|
|
409
420
|
store: "https://127.0.0.1:8001/api/v1",
|
|
410
421
|
payment: "https://127.0.0.1:8002/api/v1",
|
|
411
422
|
notifications: "https://127.0.0.1:8007/api/v1",
|
|
412
|
-
cms: "https://127.0.0.1:
|
|
423
|
+
cms: "https://127.0.0.1:8009/api/v1"
|
|
413
424
|
};
|
|
414
425
|
function initSdk(config) {
|
|
415
426
|
runtimeConfig = {
|
|
@@ -3344,6 +3355,70 @@ function useDeleteCmsEntry(modelSlug) {
|
|
|
3344
3355
|
error: mutation.error
|
|
3345
3356
|
};
|
|
3346
3357
|
}
|
|
3358
|
+
|
|
3359
|
+
// src/utils/storage.ts
|
|
3360
|
+
function getPrefixedKey(key) {
|
|
3361
|
+
const config = getRuntimeConfig();
|
|
3362
|
+
const bid = config.businessId;
|
|
3363
|
+
const cleanKey = key.startsWith("luxe_") ? key.substring(5) : key;
|
|
3364
|
+
return bid ? `luxe-sf-${bid}-${cleanKey}` : `luxe-sf-anon-${cleanKey}`;
|
|
3365
|
+
}
|
|
3366
|
+
var sessionStore = {
|
|
3367
|
+
get: (key) => {
|
|
3368
|
+
if (typeof window === "undefined") return null;
|
|
3369
|
+
return sessionStorage.getItem(getPrefixedKey(key));
|
|
3370
|
+
},
|
|
3371
|
+
set: (key, value) => {
|
|
3372
|
+
if (typeof window === "undefined") return;
|
|
3373
|
+
sessionStorage.setItem(getPrefixedKey(key), value);
|
|
3374
|
+
},
|
|
3375
|
+
remove: (key) => {
|
|
3376
|
+
if (typeof window === "undefined") return;
|
|
3377
|
+
sessionStorage.removeItem(getPrefixedKey(key));
|
|
3378
|
+
},
|
|
3379
|
+
getJSON: (key) => {
|
|
3380
|
+
if (typeof window === "undefined") return null;
|
|
3381
|
+
const value = sessionStorage.getItem(getPrefixedKey(key));
|
|
3382
|
+
if (!value) return null;
|
|
3383
|
+
try {
|
|
3384
|
+
return JSON.parse(value);
|
|
3385
|
+
} catch {
|
|
3386
|
+
return null;
|
|
3387
|
+
}
|
|
3388
|
+
},
|
|
3389
|
+
setJSON: (key, value) => {
|
|
3390
|
+
if (typeof window === "undefined") return;
|
|
3391
|
+
sessionStorage.setItem(getPrefixedKey(key), JSON.stringify(value));
|
|
3392
|
+
}
|
|
3393
|
+
};
|
|
3394
|
+
var localStore = {
|
|
3395
|
+
get: (key) => {
|
|
3396
|
+
if (typeof window === "undefined") return null;
|
|
3397
|
+
return localStorage.getItem(getPrefixedKey(key));
|
|
3398
|
+
},
|
|
3399
|
+
set: (key, value) => {
|
|
3400
|
+
if (typeof window === "undefined") return;
|
|
3401
|
+
localStorage.setItem(getPrefixedKey(key), value);
|
|
3402
|
+
},
|
|
3403
|
+
remove: (key) => {
|
|
3404
|
+
if (typeof window === "undefined") return;
|
|
3405
|
+
localStorage.removeItem(getPrefixedKey(key));
|
|
3406
|
+
},
|
|
3407
|
+
getJSON: (key) => {
|
|
3408
|
+
if (typeof window === "undefined") return null;
|
|
3409
|
+
const value = localStorage.getItem(getPrefixedKey(key));
|
|
3410
|
+
if (!value) return null;
|
|
3411
|
+
try {
|
|
3412
|
+
return JSON.parse(value);
|
|
3413
|
+
} catch {
|
|
3414
|
+
return null;
|
|
3415
|
+
}
|
|
3416
|
+
},
|
|
3417
|
+
setJSON: (key, value) => {
|
|
3418
|
+
if (typeof window === "undefined") return;
|
|
3419
|
+
localStorage.setItem(getPrefixedKey(key), JSON.stringify(value));
|
|
3420
|
+
}
|
|
3421
|
+
};
|
|
3347
3422
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3348
3423
|
0 && (module.exports = {
|
|
3349
3424
|
AuthCtx,
|
|
@@ -3419,6 +3494,7 @@ function useDeleteCmsEntry(modelSlug) {
|
|
|
3419
3494
|
getStorefrontCollections,
|
|
3420
3495
|
getStorefrontProductBySlug,
|
|
3421
3496
|
getStorefrontProducts,
|
|
3497
|
+
getStorefrontUrl,
|
|
3422
3498
|
getSupportedCurrencies,
|
|
3423
3499
|
getSupportedCurrenciesList,
|
|
3424
3500
|
getSupportedLanguages,
|
|
@@ -3430,6 +3506,7 @@ function useDeleteCmsEntry(modelSlug) {
|
|
|
3430
3506
|
initiatePayment,
|
|
3431
3507
|
isInitialized,
|
|
3432
3508
|
listCmsEntries,
|
|
3509
|
+
localStore,
|
|
3433
3510
|
logger,
|
|
3434
3511
|
loginCustomer,
|
|
3435
3512
|
logisticsService,
|
|
@@ -3458,6 +3535,7 @@ function useDeleteCmsEntry(modelSlug) {
|
|
|
3458
3535
|
sendContactEmail,
|
|
3459
3536
|
sendMessage,
|
|
3460
3537
|
serviceBookingService,
|
|
3538
|
+
sessionStore,
|
|
3461
3539
|
setEnvironmentMode,
|
|
3462
3540
|
setLoggerEnvironmentMode,
|
|
3463
3541
|
silentRefresh,
|