@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/dist/index.mjs CHANGED
@@ -141,6 +141,14 @@ function getCustomerDisplayName(user) {
141
141
  const fromParts = buildFullName(user.firstname, user.lastname);
142
142
  return fromParts || user.full_name || user.email.split("@")[0];
143
143
  }
144
+ function getStorefrontUrl(businessId, customDomain) {
145
+ if (customDomain && customDomain.trim()) {
146
+ const cleanDomain = customDomain.trim().replace(/^https?:\/\//, "");
147
+ return `https://${cleanDomain}`;
148
+ }
149
+ const cleanBid = (businessId || "store").toLowerCase().trim();
150
+ return `https://${cleanBid}.kasuvia.com`;
151
+ }
144
152
 
145
153
  // src/utils/checkout.ts
146
154
  function buildDeliveryAddress(customer, location) {
@@ -184,7 +192,7 @@ var BACKEND_URLS = {
184
192
  store: "https://127.0.0.1:8001/api/v1",
185
193
  payment: "https://127.0.0.1:8002/api/v1",
186
194
  notifications: "https://127.0.0.1:8007/api/v1",
187
- cms: "https://127.0.0.1:8003/api/v1"
195
+ cms: "https://127.0.0.1:8009/api/v1"
188
196
  };
189
197
  function initSdk(config) {
190
198
  runtimeConfig = {
@@ -3119,6 +3127,70 @@ function useDeleteCmsEntry(modelSlug) {
3119
3127
  error: mutation.error
3120
3128
  };
3121
3129
  }
3130
+
3131
+ // src/utils/storage.ts
3132
+ function getPrefixedKey(key) {
3133
+ const config = getRuntimeConfig();
3134
+ const bid = config.businessId;
3135
+ const cleanKey = key.startsWith("luxe_") ? key.substring(5) : key;
3136
+ return bid ? `luxe-sf-${bid}-${cleanKey}` : `luxe-sf-anon-${cleanKey}`;
3137
+ }
3138
+ var sessionStore = {
3139
+ get: (key) => {
3140
+ if (typeof window === "undefined") return null;
3141
+ return sessionStorage.getItem(getPrefixedKey(key));
3142
+ },
3143
+ set: (key, value) => {
3144
+ if (typeof window === "undefined") return;
3145
+ sessionStorage.setItem(getPrefixedKey(key), value);
3146
+ },
3147
+ remove: (key) => {
3148
+ if (typeof window === "undefined") return;
3149
+ sessionStorage.removeItem(getPrefixedKey(key));
3150
+ },
3151
+ getJSON: (key) => {
3152
+ if (typeof window === "undefined") return null;
3153
+ const value = sessionStorage.getItem(getPrefixedKey(key));
3154
+ if (!value) return null;
3155
+ try {
3156
+ return JSON.parse(value);
3157
+ } catch {
3158
+ return null;
3159
+ }
3160
+ },
3161
+ setJSON: (key, value) => {
3162
+ if (typeof window === "undefined") return;
3163
+ sessionStorage.setItem(getPrefixedKey(key), JSON.stringify(value));
3164
+ }
3165
+ };
3166
+ var localStore = {
3167
+ get: (key) => {
3168
+ if (typeof window === "undefined") return null;
3169
+ return localStorage.getItem(getPrefixedKey(key));
3170
+ },
3171
+ set: (key, value) => {
3172
+ if (typeof window === "undefined") return;
3173
+ localStorage.setItem(getPrefixedKey(key), value);
3174
+ },
3175
+ remove: (key) => {
3176
+ if (typeof window === "undefined") return;
3177
+ localStorage.removeItem(getPrefixedKey(key));
3178
+ },
3179
+ getJSON: (key) => {
3180
+ if (typeof window === "undefined") return null;
3181
+ const value = localStorage.getItem(getPrefixedKey(key));
3182
+ if (!value) return null;
3183
+ try {
3184
+ return JSON.parse(value);
3185
+ } catch {
3186
+ return null;
3187
+ }
3188
+ },
3189
+ setJSON: (key, value) => {
3190
+ if (typeof window === "undefined") return;
3191
+ localStorage.setItem(getPrefixedKey(key), JSON.stringify(value));
3192
+ }
3193
+ };
3122
3194
  export {
3123
3195
  AuthCtx,
3124
3196
  AuthProvider,
@@ -3193,6 +3265,7 @@ export {
3193
3265
  getStorefrontCollections,
3194
3266
  getStorefrontProductBySlug,
3195
3267
  getStorefrontProducts,
3268
+ getStorefrontUrl,
3196
3269
  getSupportedCurrencies,
3197
3270
  getSupportedCurrenciesList,
3198
3271
  getSupportedLanguages,
@@ -3204,6 +3277,7 @@ export {
3204
3277
  initiatePayment,
3205
3278
  isInitialized,
3206
3279
  listCmsEntries,
3280
+ localStore,
3207
3281
  logger,
3208
3282
  loginCustomer,
3209
3283
  logisticsService,
@@ -3232,6 +3306,7 @@ export {
3232
3306
  sendContactEmail,
3233
3307
  sendMessage,
3234
3308
  serviceBookingService,
3309
+ sessionStore,
3235
3310
  setEnvironmentMode,
3236
3311
  setLoggerEnvironmentMode,
3237
3312
  silentRefresh,