@storepecker/storefront-core 2.9.1 → 2.10.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.
Files changed (65) hide show
  1. package/dist/address-BdIB6IuI.d.cts +42 -0
  2. package/dist/address-BdIB6IuI.d.ts +42 -0
  3. package/dist/api/index.cjs +16 -12
  4. package/dist/api/index.d.cts +13 -3
  5. package/dist/api/index.d.ts +13 -3
  6. package/dist/api/index.js +2 -2
  7. package/dist/{buy-now-BqVWXyy8.d.cts → buy-now-B_15RUVT.d.cts} +1 -1
  8. package/dist/{buy-now-DFdnuLjO.d.ts → buy-now-kII0KrhP.d.ts} +1 -1
  9. package/dist/checkout/index.cjs +108 -15
  10. package/dist/checkout/index.d.cts +25 -1
  11. package/dist/checkout/index.d.ts +25 -1
  12. package/dist/checkout/index.js +3 -2
  13. package/dist/{chunk-IG4BW3ZB.cjs → chunk-32X4SWN4.cjs} +3 -3
  14. package/dist/{chunk-RDUT4W3B.cjs → chunk-6APRQ2ED.cjs} +4 -1
  15. package/dist/{chunk-ICKTXS6B.js → chunk-6IXTFZFS.js} +3 -3
  16. package/dist/{chunk-7M5CVYZJ.js → chunk-A7EI7XLU.js} +8 -1
  17. package/dist/{chunk-CBKJ3Y2I.js → chunk-EWZ7TGI7.js} +11 -1
  18. package/dist/{chunk-5XVHYPOC.js → chunk-FF5N7PTB.js} +1 -1
  19. package/dist/{chunk-XFOUNOKO.cjs → chunk-KNG4OMS5.cjs} +8 -0
  20. package/dist/chunk-QED6QJZC.cjs +603 -0
  21. package/dist/{chunk-W6BDMNSU.js → chunk-QVO56X4E.js} +1 -1
  22. package/dist/{chunk-6LS5F4R3.cjs → chunk-SGJUMI3M.cjs} +11 -0
  23. package/dist/{chunk-YLLAP3H2.cjs → chunk-SGKLMS7W.cjs} +2 -2
  24. package/dist/{chunk-ZGMLOLTC.js → chunk-VRZRV2BR.js} +4 -1
  25. package/dist/{chunk-IVKJJLG7.cjs → chunk-WWJAPKRQ.cjs} +8 -8
  26. package/dist/chunk-Y4RNRPBC.js +545 -0
  27. package/dist/components/address-form.cjs +6 -6
  28. package/dist/components/address-form.d.cts +10 -6
  29. package/dist/components/address-form.d.ts +10 -6
  30. package/dist/components/address-form.js +5 -5
  31. package/dist/components/index.cjs +8 -8
  32. package/dist/components/index.d.cts +3 -3
  33. package/dist/components/index.d.ts +3 -3
  34. package/dist/components/index.js +6 -6
  35. package/dist/components/search-dropdown.d.cts +4 -4
  36. package/dist/components/search-dropdown.d.ts +4 -4
  37. package/dist/components/share-button.cjs +3 -3
  38. package/dist/components/share-button.js +2 -2
  39. package/dist/components/theme-data-initializer.d.cts +1 -1
  40. package/dist/components/theme-data-initializer.d.ts +1 -1
  41. package/dist/hooks/index.cjs +644 -20
  42. package/dist/hooks/index.d.cts +233 -9
  43. package/dist/hooks/index.d.ts +233 -9
  44. package/dist/hooks/index.js +624 -8
  45. package/dist/models/index.d.cts +3 -2
  46. package/dist/models/index.d.ts +3 -2
  47. package/dist/pincode-8u7yWLpQ.d.cts +29 -0
  48. package/dist/pincode-8u7yWLpQ.d.ts +29 -0
  49. package/dist/pincode-CHM-ZD3H.d.ts +179 -0
  50. package/dist/pincode-Ch3bZSJz.d.cts +179 -0
  51. package/dist/{pixelEvents-BtEO5QAR.d.cts → pixelEvents-COqZIgTu.d.cts} +1 -0
  52. package/dist/{pixelEvents-LsealscG.d.ts → pixelEvents-Ds6fwS9t.d.ts} +1 -0
  53. package/dist/store/index.d.cts +1 -1
  54. package/dist/store/index.d.ts +1 -1
  55. package/dist/{useAddressForm-DGbEn91-.d.cts → useAddressForm-fMOb5Z-a.d.ts} +6 -1
  56. package/dist/{useAddressForm-cO3Au33k.d.ts → useAddressForm-wleIo78M.d.cts} +6 -1
  57. package/dist/utils/index.cjs +58 -54
  58. package/dist/utils/index.d.cts +12 -3
  59. package/dist/utils/index.d.ts +12 -3
  60. package/dist/utils/index.js +3 -3
  61. package/package.json +1 -1
  62. package/dist/address-DwBZHzbI.d.cts +0 -19
  63. package/dist/address-DwBZHzbI.d.ts +0 -19
  64. package/dist/chunk-34Y7Y5FU.cjs +0 -246
  65. package/dist/chunk-VPTN4YXD.js +0 -232
@@ -4,9 +4,9 @@ var chunk57UU7IJ2_cjs = require('../chunk-57UU7IJ2.cjs');
4
4
  var chunk2AHH3XBW_cjs = require('../chunk-2AHH3XBW.cjs');
5
5
  var chunkNQZ5GUOG_cjs = require('../chunk-NQZ5GUOG.cjs');
6
6
  var chunkNSAHGMS7_cjs = require('../chunk-NSAHGMS7.cjs');
7
- var chunkLJUGNSQQ_cjs = require('../chunk-LJUGNSQQ.cjs');
8
- var chunk6LS5F4R3_cjs = require('../chunk-6LS5F4R3.cjs');
7
+ var chunkSGJUMI3M_cjs = require('../chunk-SGJUMI3M.cjs');
9
8
  var chunkBBRB475I_cjs = require('../chunk-BBRB475I.cjs');
9
+ var chunkLJUGNSQQ_cjs = require('../chunk-LJUGNSQQ.cjs');
10
10
  var chunkBBRXE57K_cjs = require('../chunk-BBRXE57K.cjs');
11
11
  var chunkNE3ZHELZ_cjs = require('../chunk-NE3ZHELZ.cjs');
12
12
  var chunkN3CTXRFT_cjs = require('../chunk-N3CTXRFT.cjs');
@@ -87,7 +87,7 @@ var constructPaymentPayload = async (amount, orderId, userId, phoneNumber, merch
87
87
  const dataPayload = JSON.stringify(paymentPayload);
88
88
  console.log(dataPayload);
89
89
  const dataBase64 = Buffer.from(dataPayload).toString("base64");
90
- const checksum = await chunk6LS5F4R3_cjs.digestMessage(`${dataBase64}/pg/v1/pay${saltKey}`);
90
+ const checksum = await chunkSGJUMI3M_cjs.digestMessage(`${dataBase64}/pg/v1/pay${saltKey}`);
91
91
  const finalChecksum = `${checksum}###${saltIndex}`;
92
92
  return {
93
93
  base64Payload: dataBase64,
@@ -95,7 +95,7 @@ var constructPaymentPayload = async (amount, orderId, userId, phoneNumber, merch
95
95
  };
96
96
  };
97
97
  var createXVerifyHeader = async (merchantId, transactionId, saltKey, saltIndex) => {
98
- const checksum = await chunk6LS5F4R3_cjs.digestMessage(
98
+ const checksum = await chunkSGJUMI3M_cjs.digestMessage(
99
99
  `/pg/v1/status/${merchantId}/${transactionId}${saltKey}`
100
100
  );
101
101
  const finalChecksum = `${checksum}###${saltIndex}`;
@@ -361,97 +361,65 @@ Object.defineProperty(exports, "pixelEvents", {
361
361
  enumerable: true,
362
362
  get: function () { return chunkNSAHGMS7_cjs.pixelEvents; }
363
363
  });
364
- Object.defineProperty(exports, "CacheManager", {
365
- enumerable: true,
366
- get: function () { return chunkLJUGNSQQ_cjs.CacheManager; }
367
- });
368
- Object.defineProperty(exports, "cache", {
369
- enumerable: true,
370
- get: function () { return chunkLJUGNSQQ_cjs.cache; }
371
- });
372
- Object.defineProperty(exports, "clearCache", {
373
- enumerable: true,
374
- get: function () { return chunkLJUGNSQQ_cjs.clearCache; }
375
- });
376
- Object.defineProperty(exports, "deleteCache", {
377
- enumerable: true,
378
- get: function () { return chunkLJUGNSQQ_cjs.deleteCache; }
379
- });
380
- Object.defineProperty(exports, "generateCacheKey", {
381
- enumerable: true,
382
- get: function () { return chunkLJUGNSQQ_cjs.generateCacheKey; }
383
- });
384
- Object.defineProperty(exports, "getCache", {
385
- enumerable: true,
386
- get: function () { return chunkLJUGNSQQ_cjs.getCache; }
387
- });
388
- Object.defineProperty(exports, "hasCache", {
389
- enumerable: true,
390
- get: function () { return chunkLJUGNSQQ_cjs.hasCache; }
391
- });
392
- Object.defineProperty(exports, "invalidateCache", {
393
- enumerable: true,
394
- get: function () { return chunkLJUGNSQQ_cjs.invalidateCache; }
395
- });
396
- Object.defineProperty(exports, "setCache", {
397
- enumerable: true,
398
- get: function () { return chunkLJUGNSQQ_cjs.setCache; }
399
- });
400
364
  Object.defineProperty(exports, "constructFilter", {
401
365
  enumerable: true,
402
- get: function () { return chunk6LS5F4R3_cjs.constructFilter; }
366
+ get: function () { return chunkSGJUMI3M_cjs.constructFilter; }
403
367
  });
404
368
  Object.defineProperty(exports, "convertObjectToParams", {
405
369
  enumerable: true,
406
- get: function () { return chunk6LS5F4R3_cjs.convertObjectToParams; }
370
+ get: function () { return chunkSGJUMI3M_cjs.convertObjectToParams; }
407
371
  });
408
372
  Object.defineProperty(exports, "convertToCurrency", {
409
373
  enumerable: true,
410
- get: function () { return chunk6LS5F4R3_cjs.convertToCurrency; }
374
+ get: function () { return chunkSGJUMI3M_cjs.convertToCurrency; }
411
375
  });
412
376
  Object.defineProperty(exports, "digestMessage", {
413
377
  enumerable: true,
414
- get: function () { return chunk6LS5F4R3_cjs.digestMessage; }
378
+ get: function () { return chunkSGJUMI3M_cjs.digestMessage; }
379
+ });
380
+ Object.defineProperty(exports, "focusFirstInvalidField", {
381
+ enumerable: true,
382
+ get: function () { return chunkSGJUMI3M_cjs.focusFirstInvalidField; }
415
383
  });
416
384
  Object.defineProperty(exports, "formatDateTime", {
417
385
  enumerable: true,
418
- get: function () { return chunk6LS5F4R3_cjs.formatDateTime; }
386
+ get: function () { return chunkSGJUMI3M_cjs.formatDateTime; }
419
387
  });
420
388
  Object.defineProperty(exports, "formatPostalLabel", {
421
389
  enumerable: true,
422
- get: function () { return chunk6LS5F4R3_cjs.formatPostalLabel; }
390
+ get: function () { return chunkSGJUMI3M_cjs.formatPostalLabel; }
423
391
  });
424
392
  Object.defineProperty(exports, "getAddressMeta", {
425
393
  enumerable: true,
426
- get: function () { return chunk6LS5F4R3_cjs.getAddressMeta; }
394
+ get: function () { return chunkSGJUMI3M_cjs.getAddressMeta; }
427
395
  });
428
396
  Object.defineProperty(exports, "getDelayInMilliseconds", {
429
397
  enumerable: true,
430
- get: function () { return chunk6LS5F4R3_cjs.getDelayInMilliseconds; }
398
+ get: function () { return chunkSGJUMI3M_cjs.getDelayInMilliseconds; }
431
399
  });
432
400
  Object.defineProperty(exports, "getOrderStatus", {
433
401
  enumerable: true,
434
- get: function () { return chunk6LS5F4R3_cjs.getOrderStatus; }
402
+ get: function () { return chunkSGJUMI3M_cjs.getOrderStatus; }
435
403
  });
436
404
  Object.defineProperty(exports, "getParamsFromURL", {
437
405
  enumerable: true,
438
- get: function () { return chunk6LS5F4R3_cjs.getParamsFromURL; }
406
+ get: function () { return chunkSGJUMI3M_cjs.getParamsFromURL; }
439
407
  });
440
408
  Object.defineProperty(exports, "getQueryParams", {
441
409
  enumerable: true,
442
- get: function () { return chunk6LS5F4R3_cjs.getQueryParams; }
410
+ get: function () { return chunkSGJUMI3M_cjs.getQueryParams; }
443
411
  });
444
412
  Object.defineProperty(exports, "pluralize", {
445
413
  enumerable: true,
446
- get: function () { return chunk6LS5F4R3_cjs.pluralize; }
414
+ get: function () { return chunkSGJUMI3M_cjs.pluralize; }
447
415
  });
448
416
  Object.defineProperty(exports, "pushParamsToURL", {
449
417
  enumerable: true,
450
- get: function () { return chunk6LS5F4R3_cjs.pushParamsToURL; }
418
+ get: function () { return chunkSGJUMI3M_cjs.pushParamsToURL; }
451
419
  });
452
420
  Object.defineProperty(exports, "shareLink", {
453
421
  enumerable: true,
454
- get: function () { return chunk6LS5F4R3_cjs.shareLink; }
422
+ get: function () { return chunkSGJUMI3M_cjs.shareLink; }
455
423
  });
456
424
  Object.defineProperty(exports, "isExpired", {
457
425
  enumerable: true,
@@ -461,6 +429,42 @@ Object.defineProperty(exports, "timeFromNow", {
461
429
  enumerable: true,
462
430
  get: function () { return chunkBBRB475I_cjs.timeFromNow; }
463
431
  });
432
+ Object.defineProperty(exports, "CacheManager", {
433
+ enumerable: true,
434
+ get: function () { return chunkLJUGNSQQ_cjs.CacheManager; }
435
+ });
436
+ Object.defineProperty(exports, "cache", {
437
+ enumerable: true,
438
+ get: function () { return chunkLJUGNSQQ_cjs.cache; }
439
+ });
440
+ Object.defineProperty(exports, "clearCache", {
441
+ enumerable: true,
442
+ get: function () { return chunkLJUGNSQQ_cjs.clearCache; }
443
+ });
444
+ Object.defineProperty(exports, "deleteCache", {
445
+ enumerable: true,
446
+ get: function () { return chunkLJUGNSQQ_cjs.deleteCache; }
447
+ });
448
+ Object.defineProperty(exports, "generateCacheKey", {
449
+ enumerable: true,
450
+ get: function () { return chunkLJUGNSQQ_cjs.generateCacheKey; }
451
+ });
452
+ Object.defineProperty(exports, "getCache", {
453
+ enumerable: true,
454
+ get: function () { return chunkLJUGNSQQ_cjs.getCache; }
455
+ });
456
+ Object.defineProperty(exports, "hasCache", {
457
+ enumerable: true,
458
+ get: function () { return chunkLJUGNSQQ_cjs.hasCache; }
459
+ });
460
+ Object.defineProperty(exports, "invalidateCache", {
461
+ enumerable: true,
462
+ get: function () { return chunkLJUGNSQQ_cjs.invalidateCache; }
463
+ });
464
+ Object.defineProperty(exports, "setCache", {
465
+ enumerable: true,
466
+ get: function () { return chunkLJUGNSQQ_cjs.setCache; }
467
+ });
464
468
  Object.defineProperty(exports, "Auth", {
465
469
  enumerable: true,
466
470
  get: function () { return chunkBBRXE57K_cjs.auth_default; }
@@ -2,8 +2,8 @@ import { f as ProductDetail, O as OperatingHours, T as TimeSlot, A as Attributes
2
2
  export { h as ADDRESS_FORM_SESSION_KEY, i as ALLOWED_COUNTRIES, D as DEFAULT_TOAST_CONFIG, j as PRODUCT_STATUSES, g as SLICE_STATUS, U as USER_CART, k as USER_CREDENTIALS, l as USER_CRED_REFRESH_TOKEN, m as USER_CRED_TOKEN, p as pathNameMap } from '../product-D9liEtl4.cjs';
3
3
  import { C as Cart } from '../cart-DwMFBmpC.cjs';
4
4
  export { S as SnapstoreConfig, g as getApiEndpoint, a as getCloudFront, b as getConfig, c as getPhonePeApiEndpoint, d as getPublicApiEndpoint, e as getSecretKey, f as getStoreId, i as initConfig } from '../index-DTyIuLuI.cjs';
5
- import { S as SectionFilters } from '../pixelEvents-BtEO5QAR.cjs';
6
- export { A as AvailableFilter, B as Banner, a as Blogs, C as Category, b as CategoryHighlights, c as Collections, d as ColorScheme, F as FilterOption, e as FilterType, f as Footer, H as HeaderCategory, g as Hero, h as HomePageContents, I as ImageWithText, L as LocationData, i as Logo, M as Menuitem, N as NavBar, j as NavElement, k as NavElementOld, P as PageHeaderProps, l as PageMeta, m as PageProps, n as PagePropsFull, o as PreFooter, p as ProductCollection, q as ProductHighlight, R as RibbonBar, r as RibbonMessage, s as Section, t as SectionType, u as SliderSettings, v as SocialLinks, w as SocialMedia, x as StoreReview, y as SubCategory, z as SubCategorySection, T as TemplateTheme, D as Theme, V as ValueHighlights, E as pixelEvents, G as preFooterContent } from '../pixelEvents-BtEO5QAR.cjs';
5
+ import { S as SectionFilters } from '../pixelEvents-COqZIgTu.cjs';
6
+ export { A as AvailableFilter, B as Banner, a as Blogs, C as Category, b as CategoryHighlights, c as Collections, d as ColorScheme, F as FilterOption, e as FilterType, f as Footer, H as HeaderCategory, g as Hero, h as HomePageContents, I as ImageWithText, L as LocationData, i as Logo, M as Menuitem, N as NavBar, j as NavElement, k as NavElementOld, P as PageHeaderProps, l as PageMeta, m as PageProps, n as PagePropsFull, o as PreFooter, p as ProductCollection, q as ProductHighlight, R as RibbonBar, r as RibbonMessage, s as Section, t as SectionType, u as SliderSettings, v as SocialLinks, w as SocialMedia, x as StoreReview, y as SubCategory, z as SubCategorySection, T as TemplateTheme, D as Theme, V as ValueHighlights, E as pixelEvents, G as preFooterContent } from '../pixelEvents-COqZIgTu.cjs';
7
7
  import { O as Order } from '../orders-B3G4CyhH.cjs';
8
8
  import { AxiosResponse } from 'axios';
9
9
  import { a as PhonePe } from '../phonepe-dWMLZel6.cjs';
@@ -84,7 +84,9 @@ declare function pluralize(strings: TemplateStringsArray, count: number, singula
84
84
  declare function digestMessage(message: string): Promise<string>;
85
85
  declare const constructFilter: (filter: SectionFilters[]) => CustomObject;
86
86
  declare const getDelayInMilliseconds: (value: number, unit: "hours" | "days" | "weeks" | "months" | "minutes" | "seconds") => number;
87
+ /** @deprecated Use `buildAddressFormat` / `loadAddressFormat` from `/checkout` (`postalLabel`). */
87
88
  declare function formatPostalLabel(zipNameType?: string): string;
89
+ /** @deprecated Use `useAddressFormat` (`/hooks`) or `loadAddressFormat` (`/checkout`), which cache the metadata and add per-country overrides. */
88
90
  declare function getAddressMeta(countryCode: string): Promise<{
89
91
  regionLabel: any;
90
92
  postalLabel: string;
@@ -94,6 +96,13 @@ declare function getOrderStatus(order: Order.Root | Order.OrderSummary): {
94
96
  title: string;
95
97
  info?: string;
96
98
  };
99
+ /**
100
+ * Scrolls to and focuses the first form control whose `name` has an error.
101
+ * Fields absent from the DOM (e.g. a hidden postcode) are skipped.
102
+ *
103
+ * @param root Element to search in (e.g. the form); defaults to the document.
104
+ */
105
+ declare function focusFirstInvalidField(errors: Record<string, unknown>, root?: ParentNode | null): void;
97
106
 
98
107
  declare class PhonepePayment {
99
108
  private readonly amount;
@@ -212,4 +221,4 @@ declare function isProductCustomized(customizationInputs: Array<{
212
221
  [key: string]: any;
213
222
  }> | undefined, productId: number): boolean;
214
223
 
215
- export { Auth, CacheManager, LocalCart, PhonepePayment, SectionFilters, authRoutes, cache, calculateDiscountPercent, clearCache, constructFilter, convertObjectToParams, convertToCurrency, cropImage, debounce, deleteCache, digestMessage, findMatchingVariant, findSimilarVariant, formatBookingDateTime, formatDateTime, formatPostalLabel, generateCacheKey, generateTimeOptions, getAddressMeta, getAvailableDaysText, getCache, getDelayInMilliseconds, getNextAvailableDate, getOrderStatus, getParamsFromURL, getQueryParams, getTimeConstraints, getUniqueId, hasCache, invalidateCache, isAvailableDay, isColorVariantType, isExpired, isProductCustomized, isVariantCombinationAvailable, pluralize, protectedRoutes, publicRoutes, pushParamsToURL, setAuthTokenChangeCallback, setCache, shareLink, timeFromNow, urls };
224
+ export { Auth, CacheManager, LocalCart, PhonepePayment, SectionFilters, authRoutes, cache, calculateDiscountPercent, clearCache, constructFilter, convertObjectToParams, convertToCurrency, cropImage, debounce, deleteCache, digestMessage, findMatchingVariant, findSimilarVariant, focusFirstInvalidField, formatBookingDateTime, formatDateTime, formatPostalLabel, generateCacheKey, generateTimeOptions, getAddressMeta, getAvailableDaysText, getCache, getDelayInMilliseconds, getNextAvailableDate, getOrderStatus, getParamsFromURL, getQueryParams, getTimeConstraints, getUniqueId, hasCache, invalidateCache, isAvailableDay, isColorVariantType, isExpired, isProductCustomized, isVariantCombinationAvailable, pluralize, protectedRoutes, publicRoutes, pushParamsToURL, setAuthTokenChangeCallback, setCache, shareLink, timeFromNow, urls };
@@ -2,8 +2,8 @@ import { f as ProductDetail, O as OperatingHours, T as TimeSlot, A as Attributes
2
2
  export { h as ADDRESS_FORM_SESSION_KEY, i as ALLOWED_COUNTRIES, D as DEFAULT_TOAST_CONFIG, j as PRODUCT_STATUSES, g as SLICE_STATUS, U as USER_CART, k as USER_CREDENTIALS, l as USER_CRED_REFRESH_TOKEN, m as USER_CRED_TOKEN, p as pathNameMap } from '../product-D9liEtl4.js';
3
3
  import { C as Cart } from '../cart-DZq1ZEnE.js';
4
4
  export { S as SnapstoreConfig, g as getApiEndpoint, a as getCloudFront, b as getConfig, c as getPhonePeApiEndpoint, d as getPublicApiEndpoint, e as getSecretKey, f as getStoreId, i as initConfig } from '../index-DTyIuLuI.js';
5
- import { S as SectionFilters } from '../pixelEvents-LsealscG.js';
6
- export { A as AvailableFilter, B as Banner, a as Blogs, C as Category, b as CategoryHighlights, c as Collections, d as ColorScheme, F as FilterOption, e as FilterType, f as Footer, H as HeaderCategory, g as Hero, h as HomePageContents, I as ImageWithText, L as LocationData, i as Logo, M as Menuitem, N as NavBar, j as NavElement, k as NavElementOld, P as PageHeaderProps, l as PageMeta, m as PageProps, n as PagePropsFull, o as PreFooter, p as ProductCollection, q as ProductHighlight, R as RibbonBar, r as RibbonMessage, s as Section, t as SectionType, u as SliderSettings, v as SocialLinks, w as SocialMedia, x as StoreReview, y as SubCategory, z as SubCategorySection, T as TemplateTheme, D as Theme, V as ValueHighlights, E as pixelEvents, G as preFooterContent } from '../pixelEvents-LsealscG.js';
5
+ import { S as SectionFilters } from '../pixelEvents-Ds6fwS9t.js';
6
+ export { A as AvailableFilter, B as Banner, a as Blogs, C as Category, b as CategoryHighlights, c as Collections, d as ColorScheme, F as FilterOption, e as FilterType, f as Footer, H as HeaderCategory, g as Hero, h as HomePageContents, I as ImageWithText, L as LocationData, i as Logo, M as Menuitem, N as NavBar, j as NavElement, k as NavElementOld, P as PageHeaderProps, l as PageMeta, m as PageProps, n as PagePropsFull, o as PreFooter, p as ProductCollection, q as ProductHighlight, R as RibbonBar, r as RibbonMessage, s as Section, t as SectionType, u as SliderSettings, v as SocialLinks, w as SocialMedia, x as StoreReview, y as SubCategory, z as SubCategorySection, T as TemplateTheme, D as Theme, V as ValueHighlights, E as pixelEvents, G as preFooterContent } from '../pixelEvents-Ds6fwS9t.js';
7
7
  import { O as Order } from '../orders-Bl-Slh72.js';
8
8
  import { AxiosResponse } from 'axios';
9
9
  import { a as PhonePe } from '../phonepe-dWMLZel6.js';
@@ -84,7 +84,9 @@ declare function pluralize(strings: TemplateStringsArray, count: number, singula
84
84
  declare function digestMessage(message: string): Promise<string>;
85
85
  declare const constructFilter: (filter: SectionFilters[]) => CustomObject;
86
86
  declare const getDelayInMilliseconds: (value: number, unit: "hours" | "days" | "weeks" | "months" | "minutes" | "seconds") => number;
87
+ /** @deprecated Use `buildAddressFormat` / `loadAddressFormat` from `/checkout` (`postalLabel`). */
87
88
  declare function formatPostalLabel(zipNameType?: string): string;
89
+ /** @deprecated Use `useAddressFormat` (`/hooks`) or `loadAddressFormat` (`/checkout`), which cache the metadata and add per-country overrides. */
88
90
  declare function getAddressMeta(countryCode: string): Promise<{
89
91
  regionLabel: any;
90
92
  postalLabel: string;
@@ -94,6 +96,13 @@ declare function getOrderStatus(order: Order.Root | Order.OrderSummary): {
94
96
  title: string;
95
97
  info?: string;
96
98
  };
99
+ /**
100
+ * Scrolls to and focuses the first form control whose `name` has an error.
101
+ * Fields absent from the DOM (e.g. a hidden postcode) are skipped.
102
+ *
103
+ * @param root Element to search in (e.g. the form); defaults to the document.
104
+ */
105
+ declare function focusFirstInvalidField(errors: Record<string, unknown>, root?: ParentNode | null): void;
97
106
 
98
107
  declare class PhonepePayment {
99
108
  private readonly amount;
@@ -212,4 +221,4 @@ declare function isProductCustomized(customizationInputs: Array<{
212
221
  [key: string]: any;
213
222
  }> | undefined, productId: number): boolean;
214
223
 
215
- export { Auth, CacheManager, LocalCart, PhonepePayment, SectionFilters, authRoutes, cache, calculateDiscountPercent, clearCache, constructFilter, convertObjectToParams, convertToCurrency, cropImage, debounce, deleteCache, digestMessage, findMatchingVariant, findSimilarVariant, formatBookingDateTime, formatDateTime, formatPostalLabel, generateCacheKey, generateTimeOptions, getAddressMeta, getAvailableDaysText, getCache, getDelayInMilliseconds, getNextAvailableDate, getOrderStatus, getParamsFromURL, getQueryParams, getTimeConstraints, getUniqueId, hasCache, invalidateCache, isAvailableDay, isColorVariantType, isExpired, isProductCustomized, isVariantCombinationAvailable, pluralize, protectedRoutes, publicRoutes, pushParamsToURL, setAuthTokenChangeCallback, setCache, shareLink, timeFromNow, urls };
224
+ export { Auth, CacheManager, LocalCart, PhonepePayment, SectionFilters, authRoutes, cache, calculateDiscountPercent, clearCache, constructFilter, convertObjectToParams, convertToCurrency, cropImage, debounce, deleteCache, digestMessage, findMatchingVariant, findSimilarVariant, focusFirstInvalidField, formatBookingDateTime, formatDateTime, formatPostalLabel, generateCacheKey, generateTimeOptions, getAddressMeta, getAvailableDaysText, getCache, getDelayInMilliseconds, getNextAvailableDate, getOrderStatus, getParamsFromURL, getQueryParams, getTimeConstraints, getUniqueId, hasCache, invalidateCache, isAvailableDay, isColorVariantType, isExpired, isProductCustomized, isVariantCombinationAvailable, pluralize, protectedRoutes, publicRoutes, pushParamsToURL, setAuthTokenChangeCallback, setCache, shareLink, timeFromNow, urls };
@@ -2,10 +2,10 @@ export { authRoutes, protectedRoutes, publicRoutes, routes_default as urls } fro
2
2
  export { findMatchingVariant, findSimilarVariant, isColorVariantType, isVariantCombinationAvailable } from '../chunk-HEFA67WK.js';
3
3
  export { cart_default as LocalCart } from '../chunk-TH7OAMGC.js';
4
4
  export { pixelEvents } from '../chunk-VAU5OL72.js';
5
- export { CacheManager, cache, clearCache, deleteCache, generateCacheKey, getCache, hasCache, invalidateCache, setCache } from '../chunk-OSM73ETC.js';
6
- import { digestMessage } from '../chunk-CBKJ3Y2I.js';
7
- export { constructFilter, convertObjectToParams, convertToCurrency, digestMessage, formatDateTime, formatPostalLabel, getAddressMeta, getDelayInMilliseconds, getOrderStatus, getParamsFromURL, getQueryParams, pluralize, pushParamsToURL, shareLink } from '../chunk-CBKJ3Y2I.js';
5
+ import { digestMessage } from '../chunk-EWZ7TGI7.js';
6
+ export { constructFilter, convertObjectToParams, convertToCurrency, digestMessage, focusFirstInvalidField, formatDateTime, formatPostalLabel, getAddressMeta, getDelayInMilliseconds, getOrderStatus, getParamsFromURL, getQueryParams, pluralize, pushParamsToURL, shareLink } from '../chunk-EWZ7TGI7.js';
8
7
  export { isExpired, timeFromNow } from '../chunk-HSF2D56O.js';
8
+ export { CacheManager, cache, clearCache, deleteCache, generateCacheKey, getCache, hasCache, invalidateCache, setCache } from '../chunk-OSM73ETC.js';
9
9
  export { auth_default as Auth, setAuthTokenChangeCallback } from '../chunk-WEMNXIRS.js';
10
10
  export { ADDRESS_FORM_SESSION_KEY, ALLOWED_COUNTRIES, DEFAULT_TOAST_CONFIG, PRODUCT_STATUSES, SLICE_STATUS, USER_CART, USER_CREDENTIALS, USER_CRED_REFRESH_TOKEN, USER_CRED_TOKEN, pathNameMap } from '../chunk-BQ256JKN.js';
11
11
  import { getPhonePeApiEndpoint, getPublicApiEndpoint } from '../chunk-JQMLHRWL.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storepecker/storefront-core",
3
- "version": "2.9.1",
3
+ "version": "2.10.0",
4
4
  "description": "Shared logic and utilities for Snapstore themes",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,19 +0,0 @@
1
- interface Address {
2
- id: number;
3
- customer: number;
4
- address: string;
5
- city: string;
6
- state: string;
7
- state_obj: string;
8
- customer_email: string;
9
- country: string;
10
- pincode: string;
11
- latitude: number | null;
12
- longitude: number | null;
13
- is_default: boolean;
14
- customer_name: string;
15
- customer_phone: string;
16
- customer_country_code: string;
17
- }
18
-
19
- export type { Address as A };
@@ -1,19 +0,0 @@
1
- interface Address {
2
- id: number;
3
- customer: number;
4
- address: string;
5
- city: string;
6
- state: string;
7
- state_obj: string;
8
- customer_email: string;
9
- country: string;
10
- pincode: string;
11
- latitude: number | null;
12
- longitude: number | null;
13
- is_default: boolean;
14
- customer_name: string;
15
- customer_phone: string;
16
- customer_country_code: string;
17
- }
18
-
19
- export type { Address as A };
@@ -1,246 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkXFOUNOKO_cjs = require('./chunk-XFOUNOKO.cjs');
4
- var chunkNSAHGMS7_cjs = require('./chunk-NSAHGMS7.cjs');
5
- var chunkH6FJYRO3_cjs = require('./chunk-H6FJYRO3.cjs');
6
- var chunkN3CTXRFT_cjs = require('./chunk-N3CTXRFT.cjs');
7
- var axios = require('axios');
8
-
9
- // src/checkout/payment.ts
10
- function openRazorpayCheckout(order, callbacks, paymentOptions) {
11
- if (!order) return;
12
- chunkNSAHGMS7_cjs.pixelEvents.initiateCheckout(order, "razorpay");
13
- const {
14
- razorpay_order_id,
15
- razorpay_public_token,
16
- total_amount,
17
- razorpay_order_currency,
18
- store_color_scheme,
19
- store_logo,
20
- store_name,
21
- customer_name,
22
- customer_phone,
23
- customer_email
24
- } = order;
25
- const cloudFront = chunkN3CTXRFT_cjs.getCloudFront();
26
- const options = {
27
- key: razorpay_public_token,
28
- amount: Number(total_amount) * 100,
29
- currency: razorpay_order_currency,
30
- name: store_name,
31
- image: cloudFront ? `${cloudFront}${store_logo}` : store_logo,
32
- order_id: razorpay_order_id,
33
- handler: async (response) => {
34
- handleRazorpaySuccess(
35
- {
36
- razorpay_payment_id: response.razorpay_payment_id,
37
- razorpay_subscription_id: response.razorpay_subscription_id,
38
- razorpay_signature: response.razorpay_signature,
39
- order_id: order.id,
40
- razorpay_order_id,
41
- payment_id: response.razorpay_payment_id
42
- },
43
- order,
44
- callbacks,
45
- paymentOptions
46
- );
47
- },
48
- theme: {
49
- color: store_color_scheme?.primary,
50
- accent: store_color_scheme?.secondary
51
- },
52
- prefill: {
53
- name: customer_name,
54
- email: customer_email?.endsWith("@test.com") ? void 0 : customer_email,
55
- phone: customer_phone
56
- },
57
- modal: {
58
- ondismiss: () => handleRazorpayFail(
59
- order,
60
- callbacks,
61
- {
62
- description: "User cancelled the payment manually",
63
- reason: "user_cancelled_payment_manually"
64
- },
65
- { isPublic: paymentOptions?.isPublic }
66
- )
67
- }
68
- };
69
- const paymentObject = new window.Razorpay(options);
70
- paymentObject.on("payment.failed", (response) => {
71
- handleRazorpayFail(order, callbacks, response?.error, {
72
- isPublic: paymentOptions?.isPublic
73
- });
74
- });
75
- paymentObject.open();
76
- }
77
- async function handleRazorpaySuccess(data, order, callbacks, options) {
78
- try {
79
- callbacks.onPaymentStart?.();
80
- if (options?.isPublic) {
81
- await chunkH6FJYRO3_cjs.razorpayPublicOrderSuccess(data);
82
- } else {
83
- await chunkH6FJYRO3_cjs.razorpayOrderSuccess(data);
84
- }
85
- chunkNSAHGMS7_cjs.pixelEvents.purchase(order);
86
- chunkNSAHGMS7_cjs.pixelEvents.checkoutCompleted(order);
87
- callbacks.onCartReset();
88
- callbacks.onSuccess(order);
89
- } catch {
90
- callbacks.onFailure(order);
91
- } finally {
92
- callbacks.onPaymentEnd?.();
93
- }
94
- }
95
- async function handleRazorpayFail(order, callbacks, error, options) {
96
- try {
97
- const payload = {
98
- order_id: order.id,
99
- razorpay_order_id: order.razorpay_order_id,
100
- error
101
- };
102
- options?.isPublic ? await chunkH6FJYRO3_cjs.publicRazorpayOrderFailure(payload) : await chunkH6FJYRO3_cjs.razorpayOrderFail(payload);
103
- } catch {
104
- }
105
- callbacks.onFailure(order);
106
- }
107
- function handlePhonepePayment(order, callbacks) {
108
- if (!order) return;
109
- chunkNSAHGMS7_cjs.pixelEvents.initiateCheckout(order, "phonepe");
110
- if (!order.phonepe_redirect_url) {
111
- callbacks.onFailure(order);
112
- return;
113
- }
114
- callbacks.onRedirect(order.phonepe_redirect_url);
115
- }
116
- function handleTabbyPayment(order, callbacks) {
117
- if (!order) return;
118
- chunkNSAHGMS7_cjs.pixelEvents.initiateCheckout(order, "tabby");
119
- if (!order.tabby_redirect_url) {
120
- callbacks.onFailure(order);
121
- return;
122
- }
123
- callbacks.onRedirect(order.tabby_redirect_url);
124
- }
125
- async function handleCODPayment(order, callbacks, options) {
126
- if (!order) return;
127
- try {
128
- callbacks.onPaymentStart?.();
129
- chunkNSAHGMS7_cjs.pixelEvents.initiateCheckout(order, "cod");
130
- if (options?.isPublic) {
131
- await chunkH6FJYRO3_cjs.publicMakeCODOrder(order.order_number, {
132
- customer_phone: order.customer_phone,
133
- customer_email: order.customer_email
134
- });
135
- } else {
136
- await chunkH6FJYRO3_cjs.makeCODOrder(order.id);
137
- }
138
- chunkNSAHGMS7_cjs.pixelEvents.purchase(order);
139
- chunkNSAHGMS7_cjs.pixelEvents.checkoutCompleted(order);
140
- callbacks.onCartReset();
141
- callbacks.onSuccess(order);
142
- } catch {
143
- callbacks.onFailure(order);
144
- } finally {
145
- callbacks.onPaymentEnd?.();
146
- }
147
- }
148
- function handleStripePayment(order, callbacks) {
149
- if (!order) return;
150
- chunkNSAHGMS7_cjs.pixelEvents.initiateCheckout(order, "stripe");
151
- if (order.stripe_payment_link_url) {
152
- callbacks.onRedirect(order.stripe_payment_link_url);
153
- return;
154
- }
155
- if (order.stripe_client_secret) {
156
- callbacks.onStripeModalOpen?.(order);
157
- return;
158
- }
159
- callbacks.onFailure(order);
160
- }
161
- async function handleStripeSuccess(order, paymentIntentId, callbacks, options) {
162
- try {
163
- callbacks.onPaymentStart?.();
164
- const stripeSuccessPayload = {
165
- order_id: order.id,
166
- payment_intent_id: paymentIntentId
167
- };
168
- if (options?.isPublic) {
169
- await chunkH6FJYRO3_cjs.stripePublicOrderSuccess(stripeSuccessPayload);
170
- } else {
171
- await chunkH6FJYRO3_cjs.stripeOrderSuccess(stripeSuccessPayload);
172
- }
173
- chunkNSAHGMS7_cjs.pixelEvents.purchase(order);
174
- chunkNSAHGMS7_cjs.pixelEvents.checkoutCompleted(order);
175
- callbacks.onCartReset();
176
- callbacks.onSuccess(order);
177
- } catch {
178
- callbacks.onFailure(order);
179
- } finally {
180
- callbacks.onPaymentEnd?.();
181
- }
182
- }
183
- function processPayment(order, paymentMethod, callbacks, options) {
184
- if (paymentMethod === "cod") {
185
- handleCODPayment(order, callbacks, options);
186
- return;
187
- }
188
- if (order.tabby_redirect_url) {
189
- handleTabbyPayment(order, callbacks);
190
- return;
191
- }
192
- if (order.stripe_client_secret || order.stripe_payment_link_url) {
193
- handleStripePayment(order, callbacks);
194
- return;
195
- }
196
- if (order.razorpay_public_token) {
197
- openRazorpayCheckout(order, callbacks, options);
198
- return;
199
- }
200
- handlePhonepePayment(order, callbacks);
201
- }
202
- async function fetchAvailableCoupons() {
203
- const response = await chunkXFOUNOKO_cjs.getCoupons();
204
- return response.data;
205
- }
206
- async function fetchAppliedCoupon() {
207
- try {
208
- const response = await chunkXFOUNOKO_cjs.getAppliedCoupon();
209
- return response.data || null;
210
- } catch {
211
- return null;
212
- }
213
- }
214
- async function applyCheckoutCoupon(code, callbacks) {
215
- try {
216
- const response = await chunkXFOUNOKO_cjs.applyCoupon(code);
217
- if (response.data?.coupon) {
218
- await callbacks.onCartRefresh();
219
- return response.data.coupon;
220
- }
221
- throw new Error("Failed to apply coupon");
222
- } catch (error) {
223
- if (error instanceof axios.AxiosError) {
224
- throw new Error(error.response?.data?.detail || "Failed to apply coupon");
225
- }
226
- throw error;
227
- }
228
- }
229
- async function removeCheckoutCoupon(couponCode, callbacks) {
230
- await chunkXFOUNOKO_cjs.removeCoupon(couponCode);
231
- await callbacks.onCartRefresh();
232
- }
233
-
234
- exports.applyCheckoutCoupon = applyCheckoutCoupon;
235
- exports.fetchAppliedCoupon = fetchAppliedCoupon;
236
- exports.fetchAvailableCoupons = fetchAvailableCoupons;
237
- exports.handleCODPayment = handleCODPayment;
238
- exports.handlePhonepePayment = handlePhonepePayment;
239
- exports.handleRazorpayFail = handleRazorpayFail;
240
- exports.handleRazorpaySuccess = handleRazorpaySuccess;
241
- exports.handleStripePayment = handleStripePayment;
242
- exports.handleStripeSuccess = handleStripeSuccess;
243
- exports.handleTabbyPayment = handleTabbyPayment;
244
- exports.openRazorpayCheckout = openRazorpayCheckout;
245
- exports.processPayment = processPayment;
246
- exports.removeCheckoutCoupon = removeCheckoutCoupon;