@usethrottle/storefront-react 0.0.0-stage → 0.1.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 (122) hide show
  1. package/CLAUDE.md +67 -0
  2. package/README.md +119 -2
  3. package/dist/StorefrontProvider-Br4wUHui.d.cts +559 -0
  4. package/dist/StorefrontProvider-DLEPEjg6.d.ts +559 -0
  5. package/dist/account/index.cjs +69 -0
  6. package/dist/account/index.cjs.map +1 -0
  7. package/dist/account/index.d.cts +23 -0
  8. package/dist/account/index.d.ts +23 -0
  9. package/dist/account/index.js +68 -0
  10. package/dist/account/index.js.map +1 -0
  11. package/dist/chunk-2LCPIY2P.cjs +16 -0
  12. package/dist/chunk-2LCPIY2P.cjs.map +1 -0
  13. package/dist/chunk-3A72UY6T.js +2126 -0
  14. package/dist/chunk-3A72UY6T.js.map +1 -0
  15. package/dist/chunk-3JMIVAHN.js +185 -0
  16. package/dist/chunk-3JMIVAHN.js.map +1 -0
  17. package/dist/chunk-4J6AGWNC.cjs +24 -0
  18. package/dist/chunk-4J6AGWNC.cjs.map +1 -0
  19. package/dist/chunk-4U6MYDZV.js +17 -0
  20. package/dist/chunk-4U6MYDZV.js.map +1 -0
  21. package/dist/chunk-66HDJVPS.js +22 -0
  22. package/dist/chunk-66HDJVPS.js.map +1 -0
  23. package/dist/chunk-6X2OZSNV.cjs +83 -0
  24. package/dist/chunk-6X2OZSNV.cjs.map +1 -0
  25. package/dist/chunk-6ZMMZ245.cjs +2127 -0
  26. package/dist/chunk-6ZMMZ245.cjs.map +1 -0
  27. package/dist/chunk-7R37CVAB.cjs +23 -0
  28. package/dist/chunk-7R37CVAB.cjs.map +1 -0
  29. package/dist/chunk-A3IFWQUV.js +368 -0
  30. package/dist/chunk-A3IFWQUV.js.map +1 -0
  31. package/dist/chunk-AYC2YK4E.cjs +95 -0
  32. package/dist/chunk-AYC2YK4E.cjs.map +1 -0
  33. package/dist/chunk-AZV5U7YB.cjs +18 -0
  34. package/dist/chunk-AZV5U7YB.cjs.map +1 -0
  35. package/dist/chunk-CE2SKNQP.cjs +71 -0
  36. package/dist/chunk-CE2SKNQP.cjs.map +1 -0
  37. package/dist/chunk-D76CRI4X.js +2175 -0
  38. package/dist/chunk-D76CRI4X.js.map +1 -0
  39. package/dist/chunk-DOAII637.cjs +186 -0
  40. package/dist/chunk-DOAII637.cjs.map +1 -0
  41. package/dist/chunk-DYHHAOMG.cjs +17 -0
  42. package/dist/chunk-DYHHAOMG.cjs.map +1 -0
  43. package/dist/chunk-EYSVU5SJ.js +196 -0
  44. package/dist/chunk-EYSVU5SJ.js.map +1 -0
  45. package/dist/chunk-HSUUDZWS.js +37 -0
  46. package/dist/chunk-HSUUDZWS.js.map +1 -0
  47. package/dist/chunk-HZ6VEN6Q.cjs +101 -0
  48. package/dist/chunk-HZ6VEN6Q.cjs.map +1 -0
  49. package/dist/chunk-IJOTLGPT.js +16 -0
  50. package/dist/chunk-IJOTLGPT.js.map +1 -0
  51. package/dist/chunk-ISDATHVC.js +219 -0
  52. package/dist/chunk-ISDATHVC.js.map +1 -0
  53. package/dist/chunk-LW2A6USV.js +100 -0
  54. package/dist/chunk-LW2A6USV.js.map +1 -0
  55. package/dist/chunk-M4YXSLRG.cjs +369 -0
  56. package/dist/chunk-M4YXSLRG.cjs.map +1 -0
  57. package/dist/chunk-NDUEJJLP.cjs +2176 -0
  58. package/dist/chunk-NDUEJJLP.cjs.map +1 -0
  59. package/dist/chunk-NNE4FYRT.js +820 -0
  60. package/dist/chunk-NNE4FYRT.js.map +1 -0
  61. package/dist/chunk-NW3EFHY2.js +15 -0
  62. package/dist/chunk-NW3EFHY2.js.map +1 -0
  63. package/dist/chunk-NZRUQUN5.js +167 -0
  64. package/dist/chunk-NZRUQUN5.js.map +1 -0
  65. package/dist/chunk-P6HHE57S.cjs +38 -0
  66. package/dist/chunk-P6HHE57S.cjs.map +1 -0
  67. package/dist/chunk-PHY7AY27.cjs +197 -0
  68. package/dist/chunk-PHY7AY27.cjs.map +1 -0
  69. package/dist/chunk-PNJOFFTL.cjs +128 -0
  70. package/dist/chunk-PNJOFFTL.cjs.map +1 -0
  71. package/dist/chunk-PXZQ4ONA.js +127 -0
  72. package/dist/chunk-PXZQ4ONA.js.map +1 -0
  73. package/dist/chunk-Q3VTUBPP.js +82 -0
  74. package/dist/chunk-Q3VTUBPP.js.map +1 -0
  75. package/dist/chunk-Q3XFD5UI.js +45 -0
  76. package/dist/chunk-Q3XFD5UI.js.map +1 -0
  77. package/dist/chunk-QM7KTT7F.js +94 -0
  78. package/dist/chunk-QM7KTT7F.js.map +1 -0
  79. package/dist/chunk-RLWZOLXL.js +70 -0
  80. package/dist/chunk-RLWZOLXL.js.map +1 -0
  81. package/dist/chunk-SV53BRP2.js +23 -0
  82. package/dist/chunk-SV53BRP2.js.map +1 -0
  83. package/dist/chunk-VWXJO427.cjs +821 -0
  84. package/dist/chunk-VWXJO427.cjs.map +1 -0
  85. package/dist/chunk-WIIOJDHR.cjs +220 -0
  86. package/dist/chunk-WIIOJDHR.cjs.map +1 -0
  87. package/dist/chunk-XQHGFWLG.cjs +46 -0
  88. package/dist/chunk-XQHGFWLG.cjs.map +1 -0
  89. package/dist/chunk-ZHCXI2ZZ.cjs +168 -0
  90. package/dist/chunk-ZHCXI2ZZ.cjs.map +1 -0
  91. package/dist/index-RSj2Rg62.d.cts +8 -0
  92. package/dist/index-RSj2Rg62.d.ts +8 -0
  93. package/dist/index.cjs +2829 -0
  94. package/dist/index.cjs.map +1 -0
  95. package/dist/index.d.cts +1718 -0
  96. package/dist/index.d.ts +1718 -0
  97. package/dist/index.js +2828 -0
  98. package/dist/index.js.map +1 -0
  99. package/dist/metadata-QhKw-tvz.d.cts +188 -0
  100. package/dist/metadata-QhKw-tvz.d.ts +188 -0
  101. package/dist/next/client.cjs +84 -0
  102. package/dist/next/client.cjs.map +1 -0
  103. package/dist/next/client.d.cts +40 -0
  104. package/dist/next/client.d.ts +40 -0
  105. package/dist/next/client.js +83 -0
  106. package/dist/next/client.js.map +1 -0
  107. package/dist/next/index.cjs +1090 -0
  108. package/dist/next/index.cjs.map +1 -0
  109. package/dist/next/index.d.cts +218 -0
  110. package/dist/next/index.d.ts +218 -0
  111. package/dist/next/index.js +1049 -0
  112. package/dist/next/index.js.map +1 -0
  113. package/dist/server/index.cjs +994 -0
  114. package/dist/server/index.cjs.map +1 -0
  115. package/dist/server/index.d.cts +229 -0
  116. package/dist/server/index.d.ts +229 -0
  117. package/dist/server/index.js +951 -0
  118. package/dist/server/index.js.map +1 -0
  119. package/dist/styles.css +2111 -0
  120. package/dist/use-part-DCfFk7kf.d.ts +24 -0
  121. package/dist/use-part-DgjPBL_O.d.cts +24 -0
  122. package/package.json +121 -3
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/app-throttle/app-throttle/packages/storefront-react/dist/chunk-VWXJO427.cjs","../src/unstyled.tsx","../src/parts/use-part.ts","../src/parts/sync.ts","../src/parts/frame.ts","../src/parts/merch.ts","../src/parts/pages.ts","../src/parts/pieces.ts","../src/parts/product.ts","../src/parts/shop.ts","../src/parts/shopper.ts","../src/parts/site.ts","../src/parts/index.ts","../src/strings/frame.ts","../src/strings/merch.ts","../src/strings/pages.ts","../src/strings/pieces.ts","../src/strings/product.ts","../src/strings/shop.ts","../src/strings/shopper.ts","../src/strings/en.ts","../src/provider/context.ts","../src/strings/localization.ts"],"names":[],"mappings":"AAAA,6rBAAY;AACZ;AACA;ACFA,8BAA0C;AAajC,+CAAA;AATF,IAAM,gBAAA,EAAkB,kCAAA,KAAmB,CAAA;AAG3C,SAAS,WAAA,CAAA,EAAuB;AACrC,EAAA,OAAO,+BAAA,eAA0B,CAAA;AACnC;AAGO,SAAS,QAAA,CAAS,KAAA,EAAiC;AACxD,EAAA,uBAAO,6BAAA,eAAC,CAAgB,QAAA,EAAhB,EAAyB,KAAA,EAAO,IAAA,EAAO,QAAA,EAAA,KAAA,CAAM,SAAA,CAAS,CAAA;AAChE;AD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AAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACF;AJqD0C;AACA;AKhHf;AACzB,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACF;ALkH0C;AACA;AMrKf;AACzB,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACF;ANuK0C;AACA;AOvLd;AAC1B,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACF;APyL0C;AACA;AQ3Nb;AAC3B,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACF;AR6N0C;AACA;ASvUhB;AACxB,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACF;ATyU0C;AACA;AU3Zb;AAC3B,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AACA,E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BmlB0C;AACA;AkBjrBd;AACT,EAAA;AACP,EAAA;AACG,EAAA;AACA,EAAA;AACO,EAAA;AACN,EAAA;AACL,EAAA;AACE,EAAA;AACE,EAAA;AACC,EAAA;AACF,EAAA;AACG,EAAA;AACD,EAAA;AACA,EAAA;AACH,EAAA;AACA,EAAA;AACD,EAAA;AACA,EAAA;AACI,EAAA;AACF,EAAA;AACP,EAAA;AACQ,EAAA;AACI,EAAA;AACN,EAAA;AACG,EAAA;AACP,EAAA;AACU,EAAA;AACR,EAAA;AACX;AlBmrB0C;AACA;AmB7sBX;AACvB,EAAA;AACG,IAAA;AACA,IAAA;AACE,IAAA;AACC,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACF,IAAA;AACI,IAAA;AACH,IAAA;AACA,IAAA;AACC,IAAA;AACG,IAAA;AACC,IAAA;AACE,IAAA;AACD,IAAA;AACF,IAAA;AACf,EAAA;AACU,EAAA;AACA,IAAA;AACG,IAAA;AACH,IAAA;AACG,IAAA;AACD,IAAA;AACH,IAAA;AACC,IAAA;AACK,IAAA;AACf,EAAA;AACW,EAAA;AACF,IAAA;AACO,IAAA;AACD,IAAA;AACD,IAAA;AACF,IAAA;AACZ,EAAA;AACQ,EAAA;AACC,IAAA;AACT,EAAA;AACS,EAAA;AACC,IAAA;AACG,IAAA;AACL,IAAA;AACC,IAAA;AACE,IAAA;AACF,IAAA;AACC,IAAA;AACE,IAAA;AACJ,IAAA;AACC,IAAA;AACO,IAAA;AACP,IAAA;AACC,IAAA;AACF,IAAA;AACM,IAAA;AACd,EAAA;AACF;AnB+sB0C;AACA;AoBnwBb;AACnB,EAAA;AACF,EAAA;AACG,EAAA;AACF,EAAA;AACA,EAAA;AACE,EAAA;AACF,EAAA;AACT;ApBqwB0C;AACA;AqBvxBlB;AAgCsD;AAGtB;AAC7B,EAAA;AACG,EAAA;AACrB,EAAA;AACT;ArBwvB0C;AACA;AsBlyBP;AAIE;AtBiyBK;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/app-throttle/app-throttle/packages/storefront-react/dist/chunk-VWXJO427.cjs","sourcesContent":[null,"import { createContext, useContext } from 'react';\nimport type { ReactNode } from 'react';\n\n/** True under `<Unstyled>` or a component's `unstyled` prop: parts drop their `tsf-<key>` base class. */\nexport const UnstyledContext = createContext(false);\n\n/** Whether the base `tsf-<part>` classes are dropped here (inside `<Unstyled>`). */\nexport function useUnstyled(): boolean {\n return useContext(UnstyledContext);\n}\n\n/** Renders its children with the package's base classes removed; `data-throttle-part` stays. */\nexport function Unstyled(props: { children?: ReactNode }) {\n return <UnstyledContext.Provider value={true}>{props.children}</UnstyledContext.Provider>;\n}\n","import { useAppearance } from '@usethrottle/ui';\nimport { useUnstyled } from '../unstyled';\nimport type { StorefrontPartKey } from './index';\n\n/** The part class prefix. A constant, not `useClassPrefix()`: a part's class must not change under a nested auth provider. */\nconst PART_PREFIX = 'tsf-';\n\n/** Extra class names keyed by part key (`{ 'product-card-title': 'text-lg' }`). Appended after the part's own classes, so they win. */\nexport type PartClassNames = Partial<Record<StorefrontPartKey, string>>;\n\n/** The styling props every storefront component takes and hands to `usePart`. */\nexport type UsePartLocal = {\n /** Extra class names per part, keyed by part key. Applied after `appearance.parts`. */\n classNames?: PartClassNames;\n /** Extra class names for the component's root element, applied last. */\n className?: string;\n /** Overrides the ambient `<Unstyled>` for this part. */\n unstyled?: boolean;\n};\n\n/**\n * The attributes of one part. The class order is the base `tsf-<key>` (dropped\n * when unstyled), then `appearance.parts[key]`, then `classNames[key]`, then\n * `className`, so the most local one is last.\n */\nexport function usePart(\n key: StorefrontPartKey,\n local?: UsePartLocal,\n): { className: string | undefined; 'data-throttle-part': StorefrontPartKey } {\n const { parts } = useAppearance();\n const ambient = useUnstyled();\n const unstyled = local?.unstyled ?? ambient;\n const className =\n [unstyled ? undefined : `${PART_PREFIX}${key}`, parts[key], local?.classNames?.[key], local?.className]\n .filter(Boolean)\n .join(' ') || undefined;\n return { className, 'data-throttle-part': key };\n}\n","/**\n * The DOM attributes that are part of the storefront-react contract (R2): the\n * Phase 1 `SEL` set a store's sync tests read. Components emit them natively,\n * so any store built on them stays sync-testable. Home attributes\n * (`hero-heading`, home shelves) belong to the store's own home.\n */\nexport const SYNC_ATTRIBUTES = [\n 'data-throttle-setting',\n 'data-theme-accent',\n 'data-theme-radius',\n 'data-menu',\n 'data-listing',\n 'data-listing-page-size',\n 'data-sort-option',\n 'data-product-card',\n 'data-product-handle',\n 'data-card-rating',\n 'data-badge',\n 'data-stock-words',\n 'data-section',\n 'data-section-title',\n 'data-string-key',\n 'data-filter-key',\n 'data-filter-display',\n 'data-filter-label',\n 'data-locale-option',\n 'data-currency-option',\n 'data-collection-title',\n 'data-category-handle',\n 'data-category-parent',\n 'data-review-id',\n] as const;\n\n/** The name of a `data-*` attribute components emit so an automated sync test can find them. */\nexport type SyncAttribute = (typeof SYNC_ATTRIBUTES)[number];\n","/** Part keys of the store frame. */\nexport const FRAME_PARTS = [\n 'skip-link',\n 'store-frame',\n 'store-frame-main',\n 'announcement-bar',\n 'announcement-bar-text',\n 'announcement-bar-dismiss',\n 'header',\n 'header-bar',\n 'header-menu-button',\n 'header-brand',\n 'header-logo',\n 'header-store-name',\n 'header-search',\n 'header-actions',\n 'header-nav-row',\n 'header-prefs',\n 'header-drawer-top',\n 'header-drawer-title',\n 'header-drawer-close',\n 'category-nav',\n 'category-nav-list',\n 'category-nav-item',\n 'category-nav-link',\n 'category-nav-toggle',\n 'category-nav-panel',\n 'category-nav-child',\n 'search-box',\n 'search-box-input',\n 'search-box-panel',\n 'search-box-list',\n 'search-box-group',\n 'search-box-group-label',\n 'search-box-option',\n 'search-box-thumb',\n 'search-box-option-name',\n 'search-box-option-meta',\n 'search-box-all',\n 'search-box-none',\n 'search-box-status',\n 'locale-switch',\n 'locale-switch-label',\n 'locale-switch-select',\n 'currency-switch',\n 'currency-switch-label',\n 'currency-switch-select',\n 'cart-button',\n 'cart-button-count',\n 'account-button',\n 'footer',\n 'footer-brand',\n 'footer-extra',\n 'footer-nav',\n 'footer-list',\n 'footer-item',\n 'footer-link',\n 'footer-sublist',\n 'footer-copyright',\n] as const;\n","/** Part keys of the merchandising sections. */\nexport const MERCH_PARTS = [\n 'merch-skeleton',\n 'merch-skeleton-item',\n 'collection-shelf',\n 'collection-shelf-header',\n 'collection-shelf-eyebrow',\n 'collection-shelf-title',\n 'collection-shelf-link',\n 'collection-shelf-grid',\n 'collection-shelf-item',\n 'featured-product',\n 'featured-product-media',\n 'featured-product-media-link',\n 'featured-product-placeholder',\n 'featured-product-body',\n 'featured-product-title',\n 'featured-product-rating',\n 'featured-product-price',\n 'featured-product-from',\n 'featured-product-description',\n 'featured-product-link',\n 'product-carousel',\n 'product-carousel-header',\n 'product-carousel-eyebrow',\n 'product-carousel-title',\n 'product-carousel-controls',\n 'product-carousel-prev',\n 'product-carousel-next',\n 'product-carousel-track',\n 'product-carousel-item',\n 'category-directory',\n 'category-directory-list',\n 'category-directory-item',\n 'category-directory-link',\n 'category-directory-image',\n 'category-directory-name',\n 'category-directory-count',\n 'category-directory-children',\n 'reviews-list',\n 'reviews-list-items',\n 'reviews-list-item',\n 'reviews-list-head',\n 'reviews-list-title',\n 'reviews-list-body',\n 'reviews-list-meta',\n 'reviews-list-author',\n 'reviews-list-verified',\n 'reviews-list-date',\n 'reviews-list-product',\n 'reviews-list-reply',\n] as const;\n","/** Part keys of the pages (search, not-found, account). */\nexport const PAGES_PARTS = [\n 'search-results',\n 'search-results-title',\n 'search-results-prompt',\n 'not-found',\n 'not-found-code',\n 'not-found-title',\n 'not-found-body',\n 'not-found-actions',\n 'not-found-link',\n 'account-page',\n 'account-page-title',\n 'account-page-setup-notice',\n 'account-page-setup-title',\n 'account-page-setup-body',\n] as const;\n","/** Part keys of the pieces. */\nexport const PIECES_PARTS = [\n 'product-card',\n 'product-card-row',\n 'product-card-media',\n 'product-card-media-link',\n 'product-card-image',\n 'product-card-image-alt',\n 'product-card-placeholder',\n 'product-card-badges',\n 'product-card-actions',\n 'product-card-body',\n 'product-card-brand',\n 'product-card-title',\n 'product-card-title-link',\n 'product-card-swatches',\n 'product-card-swatch-more',\n 'product-card-rating',\n 'product-card-price',\n 'product-card-from',\n 'product-card-unpriced',\n 'star-rating',\n 'star-rating-stars',\n 'star-rating-count',\n 'product-badge',\n 'swatch',\n 'money',\n 'money-compare',\n 'price',\n 'price-label',\n 'price-hint',\n 'image',\n 'rich-text',\n 'link',\n] as const;\n","/** Part keys of the product area, `<component>-<part>`. A drift test keeps this list and what renders equal. */\nexport const PRODUCT_PARTS = [\n 'add-to-cart',\n 'add-to-cart-button',\n 'add-to-cart-message',\n 'buy-box',\n 'buy-box-actions',\n 'buy-box-kicker',\n 'buy-box-price',\n 'buy-box-rating',\n 'buy-box-sku',\n 'buy-box-summary',\n 'buy-box-title',\n 'category-list',\n 'category-list-item',\n 'category-list-link',\n 'gallery',\n 'gallery-counter',\n 'gallery-enlarge',\n 'gallery-item',\n 'gallery-next',\n 'gallery-placeholder',\n 'gallery-previous',\n 'gallery-stage',\n 'gallery-thumb',\n 'gallery-thumbs',\n 'gallery-thumbs-item',\n 'gallery-video',\n 'lightbox',\n 'lightbox-counter',\n 'lightbox-next',\n 'lightbox-previous',\n 'lightbox-stage',\n 'lightbox-title',\n 'product-breadcrumbs',\n 'product-breadcrumbs-current',\n 'product-breadcrumbs-item',\n 'product-breadcrumbs-link',\n 'product-breadcrumbs-list',\n 'product-page',\n 'product-page-main',\n 'product-review',\n 'product-review-author',\n 'product-review-body',\n 'product-review-date',\n 'product-review-header',\n 'product-review-reply',\n 'product-review-title',\n 'product-reviews',\n 'product-reviews-average',\n 'product-reviews-clear',\n 'product-reviews-controls',\n 'product-reviews-empty',\n 'product-reviews-error',\n 'product-reviews-gate',\n 'product-reviews-histogram',\n 'product-reviews-histogram-bar',\n 'product-reviews-histogram-count',\n 'product-reviews-histogram-fill',\n 'product-reviews-histogram-row',\n 'product-reviews-list',\n 'product-reviews-load-more',\n 'product-reviews-main',\n 'product-reviews-summary',\n 'product-section',\n 'product-section-body',\n 'product-section-title',\n 'product-section-trigger',\n 'product-sections',\n 'product-specs',\n 'product-specs-label',\n 'product-specs-row',\n 'product-specs-value',\n 'quantity-decrease',\n 'quantity-field',\n 'quantity-increase',\n 'quantity-input',\n 'related-products',\n 'related-products-item',\n 'review-form',\n 'review-form-error',\n 'review-form-field',\n 'review-form-star',\n 'review-form-star-input',\n 'review-form-stars',\n 'review-form-submit',\n 'review-form-textarea',\n 'review-form-thanks',\n 'review-form-title',\n 'shipping-section',\n 'sticky-add-to-cart',\n 'sticky-add-to-cart-button',\n 'sticky-add-to-cart-price',\n 'sticky-add-to-cart-title',\n 'stock-status',\n 'tag-list',\n 'tag-list-item',\n 'tag-list-link',\n 'variant-option',\n 'variant-option-chosen',\n 'variant-option-legend',\n 'variant-option-name',\n 'variant-option-values',\n 'variant-picker',\n 'variant-value',\n 'variant-value-label',\n] as const;\n","/** Part keys of the shop-all sections. */\nexport const SHOP_PARTS = [\n 'shop-all',\n 'shop-all-heading',\n 'shop-all-description',\n 'shop-all-breadcrumbs',\n 'shop-all-breadcrumb-list',\n 'shop-all-breadcrumb',\n 'shop-all-breadcrumb-link',\n 'shop-all-controls',\n 'shop-all-tools',\n 'shop-all-body',\n 'shop-all-main',\n 'live-region',\n 'result-count',\n 'sort-select',\n 'sort-select-label',\n 'sort-select-input',\n 'filter-sidebar',\n 'filter-sidebar-head',\n 'filter-sidebar-title',\n 'filter-clear',\n 'filter-bar',\n 'filter-bar-more',\n 'filter-drawer-trigger',\n 'filter-drawer-count',\n 'filter-drawer-head',\n 'filter-drawer-title',\n 'filter-drawer-close',\n 'filter-drawer-body',\n 'filter-drawer-foot',\n 'filter-drawer-apply',\n 'facet',\n 'facet-heading',\n 'facet-toggle',\n 'facet-trigger',\n 'facet-panel',\n 'facet-label',\n 'facet-selected',\n 'facet-body',\n 'facet-search',\n 'facet-fieldset',\n 'facet-legend',\n 'facet-options',\n 'facet-option',\n 'facet-option-label',\n 'facet-option-input',\n 'facet-option-text',\n 'facet-option-count',\n 'facet-empty',\n 'facet-show-all',\n 'facet-select',\n 'facet-boolean',\n 'facet-range',\n 'facet-range-fields',\n 'facet-range-field',\n 'facet-range-input',\n 'facet-range-error',\n 'facet-range-hint',\n 'facet-range-actions',\n 'facet-range-apply',\n 'facet-range-clear',\n 'active-filters',\n 'active-filter',\n 'active-filter-remove',\n 'active-filters-clear',\n 'product-grid',\n 'product-grid-pages',\n 'product-grid-item',\n 'product-grid-skeleton',\n 'product-grid-skeleton-item',\n 'product-grid-empty',\n 'product-grid-error',\n 'product-grid-retry',\n 'pagination',\n 'pagination-list',\n 'pagination-item',\n 'pagination-link',\n 'pagination-step',\n 'pagination-gap',\n 'pagination-more',\n 'pagination-crawl',\n] as const;\n","/** Part keys of the shopper areas: cart drawer, quick add, quick view, recently viewed and compare. */\nexport const SHOPPER_PARTS = [\n 'cart-drawer',\n 'cart-drawer-top',\n 'cart-drawer-title',\n 'cart-drawer-close',\n 'cart-drawer-body',\n 'cart-status',\n 'cart-error',\n 'cart-loading',\n 'cart-empty',\n 'cart-empty-text',\n 'cart-lines',\n 'cart-line',\n 'cart-line-media',\n 'cart-line-body',\n 'cart-line-name',\n 'cart-line-price',\n 'cart-line-note',\n 'cart-line-quantity',\n 'cart-line-decrease',\n 'cart-line-count',\n 'cart-line-increase',\n 'cart-line-total',\n 'cart-line-remove',\n 'cart-footer',\n 'cart-subtotal',\n 'cart-subtotal-label',\n 'cart-subtotal-amount',\n 'cart-checkout',\n 'cart-continue',\n 'quick-add',\n 'quick-add-button',\n 'quick-add-panel',\n 'quick-add-title',\n 'quick-add-message',\n 'quick-view',\n 'quick-view-title',\n 'quick-view-body',\n 'quick-view-gallery',\n 'quick-view-details',\n 'quick-view-link',\n 'quick-view-message',\n 'recently-viewed',\n 'recently-viewed-title',\n 'recently-viewed-list',\n 'recently-viewed-item',\n 'compare',\n 'compare-header',\n 'compare-title',\n 'compare-clear',\n 'compare-scroll',\n 'compare-table',\n 'compare-caption',\n 'compare-row',\n 'compare-label',\n 'compare-product',\n 'compare-product-media',\n 'compare-product-link',\n 'compare-product-remove',\n 'compare-cell',\n 'compare-empty',\n 'compare-button',\n] as const;\n","/** Part keys of the site-level pieces the provider and outlets render. */\nexport const SITE_PARTS = ['storefront-root', 'slot-outlet'] as const;\n","import { FRAME_PARTS } from './frame';\nimport { MERCH_PARTS } from './merch';\nimport { PAGES_PARTS } from './pages';\nimport { PIECES_PARTS } from './pieces';\nimport { PRODUCT_PARTS } from './product';\nimport { SHOP_PARTS } from './shop';\nimport { SHOPPER_PARTS } from './shopper';\nimport { SITE_PARTS } from './site';\n\n/** Every part key, kebab-case `<component>-<part>`. A drift test keeps what renders and what is listed equal. */\nexport const STOREFRONT_PART_KEYS = [\n ...SITE_PARTS,\n ...PIECES_PARTS,\n ...SHOP_PARTS,\n ...PRODUCT_PARTS,\n ...FRAME_PARTS,\n ...MERCH_PARTS,\n ...SHOPPER_PARTS,\n ...PAGES_PARTS,\n] as const;\n\n/**\n * One part key: `data-throttle-part=\"<key>\"` and the class `tsf-<key>`. A versioned contract: a key is never renamed in a minor release.\n */\nexport type StorefrontPartKey = (typeof STOREFRONT_PART_KEYS)[number];\n\nexport { usePart } from './use-part';\nexport type { PartClassNames, UsePartLocal } from './use-part';\nexport { SYNC_ATTRIBUTES } from './sync';\nexport type { SyncAttribute } from './sync';\n","/** English text of the store frame. A key reads `frame.<group>.<name>`, such as `frame.search.label`. */\nexport const FRAME_STRINGS = {\n skipLink: 'Skip to main content',\n announcement: {\n label: 'Announcement',\n dismiss: 'Dismiss announcement',\n },\n header: {\n mainNav: 'Main',\n categoriesNav: 'Categories',\n closeMenu: 'Close menu',\n home: '{store}, home',\n homeNoName: 'Home',\n },\n nav: {\n submenu: '{name} submenu',\n },\n search: {\n label: 'Search the shop',\n suggestions: 'Search suggestions',\n products: 'Products',\n categories: 'Categories',\n brands: 'Brands',\n tags: 'Tags',\n collections: 'Collections',\n searchFor: 'Search for “{q}”',\n none: 'No quick matches for “{q}”.',\n announceNone: 'No quick matches.',\n announceOne: '1 suggestion',\n announceMany: '{count} suggestions',\n productCount: '{count} products',\n productCountOne: '1 product',\n },\n locale: { label: 'Language' },\n currency: { label: 'Currency' },\n cart: {\n label: 'Cart, {count} items',\n labelOne: 'Cart, 1 item',\n },\n footer: { label: 'Footer' },\n} as const;\n","/** English text of the merchandising sections. A key reads `merch.<group>.<name>`, such as `merch.carousel.next`. */\nexport const MERCH_STRINGS = {\n viewAll: 'View all',\n viewAllNamed: 'View all {title}',\n viewProduct: 'View product',\n carousel: {\n label: 'Products',\n previous: 'Previous products',\n next: 'Next products',\n slide: '{n} of {total}',\n },\n categories: {\n label: 'Categories',\n count: '{count} products',\n countOne: '1 product',\n },\n reviews: {\n label: 'Reviews',\n verified: 'Verified purchase',\n reply: 'Reply from the store',\n forProduct: 'on {product}',\n },\n} as const;\n","/** English text of the pages. A key reads `pages.<group>.<name>`, such as `pages.notFound.body`. */\nexport const PAGES_STRINGS = {\n notFound: {\n code: '404',\n body: 'It may have moved, or it may never have existed.',\n shop: 'Browse the shop',\n home: 'Home',\n },\n search: {\n prompt: 'Type something to search the shop.',\n },\n account: {\n signIn: 'Sign in',\n signUp: 'Create an account',\n setupTitle: 'Account pages are not set up yet',\n setupBody:\n 'Sign-in and account pages need your Throttle publishable key. Add it under Connections in the Builder, or pass throttlePublishableKey to the StorefrontProvider.',\n },\n} as const;\n","/** English text of the pieces. A key reads `pieces.<group>.<name>`, such as `pieces.rating.label`. */\nexport const PIECES_STRINGS = {\n rating: {\n label: '{value} out of 5 stars',\n labelWithCount: '{value} out of 5 stars, {count} reviews',\n labelWithOne: '{value} out of 5 stars, 1 review',\n count: '({count})',\n },\n price: {\n customer: 'Your price',\n verifyEmail: 'Verify your email to see your price',\n compareAt: 'Original price',\n from: 'From',\n unavailable: 'Not sold in this currency',\n },\n card: {\n moreSwatches: '+{count}',\n moreSwatchesLabel: '{count} more colours',\n },\n} as const;\n","/**\n * English text of the product page. A key reads `product.<group>.<name>`, such\n * as `product.gallery.next`. The group names avoid the catalog's own\n * `product.*` strings (`product.quantity`, `product.reviews`, ...) so the two never collide.\n */\nexport const PRODUCT_STRINGS = {\n gallery: {\n label: '{title}: photos',\n photoAlt: '{title}, photo {n}',\n thumbs: 'Photo thumbnails',\n showPhoto: 'Show photo {n} of {count}',\n previous: 'Previous photo',\n next: 'Next photo',\n enlarge: 'Enlarge photo',\n close: 'Close',\n counter: '{n} / {count}',\n lightboxTitle: '{title}: enlarged photos',\n video: '{title}, video',\n },\n options: {\n soldOut: ', sold out',\n unavailableWith: ', not made with {others}',\n chooseOne: 'Choose {option}',\n },\n stockStatus: {\n noCurrency: 'Not available in {currency}',\n noCurrencyAny: 'Not available',\n noCombination: 'This combination is not available',\n },\n quantityInput: {\n decrease: 'One fewer',\n increase: 'One more',\n },\n cartAdd: {\n adding: 'Adding…',\n added: 'Added {quantity} × {title} to your cart',\n onlyLeft: 'Only {count} left',\n outOfStock: 'Out of stock',\n failed: 'We could not add this to your cart. Try again in a moment.',\n },\n sections: {\n label: 'Product details',\n },\n crumbs: {\n label: 'Breadcrumb',\n home: 'Home',\n },\n sticky: {\n label: 'Add to cart',\n },\n reviewList: {\n ratingsByStars: 'Ratings by stars',\n filterRating: 'Show {rating}-star reviews, {count} in all',\n clearFilter: 'Show all reviews',\n sortLabel: 'Sort by',\n sortNewest: 'Newest',\n sortHighest: 'Highest rated',\n sortLowest: 'Lowest rated',\n loadMore: 'Load more reviews',\n loading: 'Loading reviews',\n loadFailed: 'We could not load the reviews. Try again in a moment.',\n verified: 'Verified buyer',\n reply: 'Reply from the store',\n noneForRating: 'No reviews with this rating.',\n average: '{value} out of 5',\n ratingLabel: 'Rated {rating} out of 5',\n gateSignIn: 'Sign in to write a review.',\n gateReviewsDisabled: 'Reviews are closed for this shop.',\n gateEmailNotVerified: 'Verify your email address to write a review.',\n gateAlreadyReviewed: 'You have reviewed this one already. Thank you.',\n gateNotVerifiedBuyer: 'Reviews come from customers who bought this. Once your order is paid, you can write one.',\n gateUnknown: 'You cannot review this product.',\n gateFailed: 'We could not check whether you can review this just now.',\n },\n reviewForm: {\n rating: 'Your rating',\n star: '{n} stars',\n starOne: '1 star',\n title: 'Title (optional)',\n body: 'Your review',\n name: 'Name shown',\n submit: 'Send review',\n sending: 'Sending…',\n thanksPending: 'Thanks, your review is awaiting moderation.',\n thanksLive: 'Thanks, your review is live.',\n needRating: 'Choose a rating from 1 to 5 stars.',\n needBody: 'Write a few words about it.',\n needName: 'Add the name to show with your review.',\n errorAlready: 'You have reviewed this one already.',\n errorNotBuyer: 'Only customers who bought this can review it.',\n errorEmail: 'Verify your email address first.',\n errorBusy: 'Too many reviews at once. Try again in a few minutes.',\n errorGeneric: 'Your review did not send. Try again in a moment.',\n },\n} as const;\n","/** English text of the shop-all sections. A key reads `shop.<name>`, such as `shop.resultsAnnounce`. */\nexport const SHOP_STRINGS = {\n resultsAnnounce: '{count} results',\n countOne: '{count} product',\n moreFilters: 'More filters',\n showResults: 'Show {count} results',\n showResultsLoading: 'Show results',\n closeFilters: 'Close filters',\n showAll: 'Show all ({count})',\n showFewer: 'Show fewer',\n searchFacet: 'Search {name}',\n noFacetMatch: 'No matches',\n valueCount: '{count} products',\n selectedCount: '{count} selected',\n removeFilter: 'Remove filter: {label}',\n rangeBetween: '{min} to {max}',\n rangeFrom: '{min} and up',\n rangeUpTo: 'up to {max}',\n rangeMin: 'Min',\n rangeMax: 'Max',\n rangeInvalid: 'Enter numbers only.',\n rangeClear: 'Clear',\n any: 'Any',\n breadcrumbs: 'Breadcrumb',\n paginationLabel: 'Pagination',\n pageLabel: 'Page {page}',\n errorLoading: 'We could not load the products.',\n retry: 'Try again',\n loadingProducts: 'Loading products',\n pastEnd: 'There are no products on this page.',\n} as const;\n","/**\n * English text of the cart drawer, quick add, quick view, recently viewed and compare. A key reads\n * `shopper.<group>.<name>`, such as `shopper.cart.subtotal`. The cart title, checkout and continue\n * shopping words are the catalog's own (`cart.title`, `cart.checkout`, `cart.continueShopping`, `empty.cart`).\n */\nexport const SHOPPER_STRINGS = {\n cart: {\n close: 'Close cart',\n lines: 'Items in your cart',\n loading: 'Loading your cart',\n subtotal: 'Subtotal',\n decrease: 'Decrease quantity of {name}',\n increase: 'Increase quantity of {name}',\n quantity: 'Quantity of {name}',\n remove: 'Remove {name}',\n removeText: 'Remove',\n removed: 'Removed {name} from your cart.',\n updated: 'Quantity of {name} is now {quantity}.',\n onlyLeft: 'Only {count} available',\n unavailable: 'No longer available',\n updateFailed: 'We could not update your cart. Try again.',\n checkoutFailed: 'We could not start checkout. Try again.',\n pricesChanged: 'Some prices changed. Review your cart, then check out again.',\n checkingOut: 'Taking you to checkout',\n },\n quickAdd: {\n button: 'Quick add',\n buttonFor: 'Quick add {title}',\n choose: 'Choose options',\n chooseFor: 'Choose options for {title}',\n panelFor: 'Options for {title}',\n added: 'Added {title} to your cart.',\n failed: 'We could not add this. Try again.',\n unavailable: 'This product is not available.',\n },\n quickView: {\n title: 'Quick view: {title}',\n loadingTitle: 'Quick view',\n viewDetails: 'View full details',\n closeLabel: 'Close quick view',\n notFound: 'This product is not available.',\n },\n recent: {\n title: 'Recently viewed',\n },\n compare: {\n button: 'Compare',\n buttonFor: 'Compare {title}',\n full: 'You can compare up to {max} products.',\n title: 'Compare products',\n caption: 'Comparison of {count} products',\n clear: 'Clear all',\n remove: 'Remove {title} from the comparison',\n needMore: 'Choose at least 2 products to compare.',\n spec: 'Specification',\n price: 'Price',\n availability: 'Availability',\n brand: 'Brand',\n rating: 'Rating',\n none: '–',\n loadFailed: 'We could not load these products. Try again.',\n },\n} as const;\n","import { FRAME_STRINGS } from './frame';\nimport { MERCH_STRINGS } from './merch';\nimport { PAGES_STRINGS } from './pages';\nimport { PIECES_STRINGS } from './pieces';\nimport { PRODUCT_STRINGS } from './product';\nimport { SHOP_STRINGS } from './shop';\nimport { SHOPPER_STRINGS } from './shopper';\nimport type { DeepPartial } from '@usethrottle/ui';\nimport type { StringKey } from '@usethrottle/catalog';\n\n/** The package's own English text, one object per area; a key reads `<area>.<name>`, such as `shop.resultsAnnounce`. */\nexport const SF_STRINGS_EN = {\n pieces: PIECES_STRINGS,\n shop: SHOP_STRINGS,\n product: PRODUCT_STRINGS,\n frame: FRAME_STRINGS,\n merch: MERCH_STRINGS,\n shopper: SHOPPER_STRINGS,\n pages: PAGES_STRINGS,\n};\n\n/** The English table with every leaf widened from its literal, so a translation is any string. */\nexport type SfStrings = Widen<typeof SF_STRINGS_EN>;\ntype Widen<T> = { -readonly [K in keyof T]: T[K] extends string ? string : Widen<T[K]> };\n\ntype Leaves<T, Prefix extends string = ''> = {\n [K in keyof T & string]: T[K] extends string ? `${Prefix}${K}` : Leaves<T[K], `${Prefix}${K}.`>;\n}[keyof T & string];\n\n/** The dotted leaf paths of `SF_STRINGS_EN`, for example `'shop.resultsAnnounce'`. */\nexport type SfLocalKey = Leaves<typeof SF_STRINGS_EN>;\n\n/** A catalog string (`cart.title`) or one of this package's own. */\nexport type SfStringKey = StringKey | SfLocalKey;\n\ntype Head<K> = K extends `${infer H}.${string}` ? H : never;\n/** A catalog key's override, nested by its dotted path: `{ cart: { title: 'Basket' } }`. */\ntype CatalogLocalization = {\n [H in Head<StringKey>]?: { [K in StringKey as K extends `${H}.${infer T}` ? T : never]?: string };\n};\n\n/** What the `localization` prop takes: any subset of the English table, plus any catalog string by its dotted path. */\nexport type StorefrontLocalization = DeepPartial<SfStrings> & CatalogLocalization;\n","import type { CatalogClient } from '@usethrottle/catalog';\nimport type { ThrottleAppearance } from '@usethrottle/ui';\nimport { createContext, useContext } from 'react';\nimport type { StorefrontAnalytics } from '../analytics/types';\nimport type { LinkComponent } from '../link';\nimport type { StorefrontPartKey } from '../parts';\nimport type { NormalizedSettings } from '../settings/normalize';\nimport type { ResolvedSiteDesign } from '../site/resolve';\nimport type { StorefrontRouter } from './router';\n\n/** Appearance for the storefront: `parts` take storefront part keys, `elements` reach auth components inside. Its `variables` / `darkVariables` override the theme mapping. */\nexport type StorefrontAppearance = ThrottleAppearance<string, StorefrontPartKey>;\n\n/** Where analytics events go. */\nexport type AnalyticsSink = StorefrontAnalytics;\n\n/** Everything `StorefrontProvider` resolved, as `useStorefront()` returns it. */\nexport type StorefrontContextValue = {\n settings: NormalizedSettings;\n site: ResolvedSiteDesign;\n preset: ResolvedSiteDesign['preset'];\n scheme: ResolvedSiteDesign['scheme'];\n dir: 'ltr' | 'rtl';\n locale: string;\n currency: string | undefined;\n client: CatalogClient;\n router: StorefrontRouter;\n analytics: AnalyticsSink;\n Link: LinkComponent;\n /** Whether the catalog's lists carry ratings; a card shows its rating only when this and `card.showRating` hold. */\n reviewsOnLists: boolean;\n throttlePublishableKey: string | null;\n};\n\nexport const StorefrontContext = createContext<StorefrontContextValue | null>(null);\n\n/** Everything the provider resolved. Throws outside a `StorefrontProvider`. */\nexport function useStorefront(): StorefrontContextValue {\n const value = useContext(StorefrontContext);\n if (!value) throw new Error('useStorefront() was called outside a <StorefrontProvider>.');\n return value;\n}\n","import { createLocalization } from '@usethrottle/ui';\nimport { SF_STRINGS_EN, type SfStrings } from './en';\n\n/** This package's copy contexts (private: auth has its own, so a store can localise each separately). */\nexport const { LocalizationProvider: SfLocalizationProvider, useCopy: useSfCopy } =\n createLocalization<SfStrings>(SF_STRINGS_EN as SfStrings);\n"]}
@@ -0,0 +1,220 @@
1
+ "use client";
2
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
3
+
4
+
5
+
6
+ var _chunkAYC2YK4Ecjs = require('./chunk-AYC2YK4E.cjs');
7
+
8
+
9
+ var _chunk2LCPIY2Pcjs = require('./chunk-2LCPIY2P.cjs');
10
+
11
+
12
+ var _chunkDYHHAOMGcjs = require('./chunk-DYHHAOMG.cjs');
13
+ require('./chunk-P6HHE57S.cjs');
14
+
15
+
16
+ var _chunkXQHGFWLGcjs = require('./chunk-XQHGFWLG.cjs');
17
+
18
+
19
+
20
+ var _chunkVWXJO427cjs = require('./chunk-VWXJO427.cjs');
21
+
22
+ // src/shopper/CartDrawerBody.tsx
23
+ var _catalog = require('@usethrottle/catalog');
24
+ var _react = require('@usethrottle/catalog/react');
25
+ var _money = require('@usethrottle/money');
26
+ var _ui = require('@usethrottle/ui');
27
+ var _react3 = require('react');
28
+ var _jsxruntime = require('react/jsx-runtime');
29
+ var decimal = (minor, currency) => Number(_money.toDecimalString.call(void 0, minor, currency));
30
+ function CartView({ onContinue, urls, ...local }) {
31
+ const { currency, settings, Link: Anchor } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
32
+ const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
33
+ const track = _chunkDYHHAOMGcjs.useTrack.call(void 0, );
34
+ const cart = _react.useCart.call(void 0, currency ? { currency } : void 0);
35
+ const lines = _nullishCoalesce(_optionalChain([cart, 'access', _ => _.cart, 'optionalAccess', _2 => _2.lineItems]), () => ( []));
36
+ const cartCurrency = _nullishCoalesce(_optionalChain([cart, 'access', _3 => _3.cart, 'optionalAccess', _4 => _4.currency]), () => ( currency));
37
+ const [error, setError] = _react3.useState.call(void 0, null);
38
+ const [notice, setNotice] = _react3.useState.call(void 0, "");
39
+ const [checkingOut, setCheckingOut] = _react3.useState.call(void 0, false);
40
+ const body = _chunkVWXJO427cjs.usePart.call(void 0, "cart-drawer-body", local);
41
+ const status = _chunkVWXJO427cjs.usePart.call(void 0, "cart-status", local);
42
+ const errorPart = _chunkVWXJO427cjs.usePart.call(void 0, "cart-error", local);
43
+ const loading = _chunkVWXJO427cjs.usePart.call(void 0, "cart-loading", local);
44
+ const empty = _chunkVWXJO427cjs.usePart.call(void 0, "cart-empty", local);
45
+ const emptyText = _chunkVWXJO427cjs.usePart.call(void 0, "cart-empty-text", local);
46
+ const list = _chunkVWXJO427cjs.usePart.call(void 0, "cart-lines", local);
47
+ const footer = _chunkVWXJO427cjs.usePart.call(void 0, "cart-footer", local);
48
+ const subtotal = _chunkVWXJO427cjs.usePart.call(void 0, "cart-subtotal", local);
49
+ const subtotalLabel = _chunkVWXJO427cjs.usePart.call(void 0, "cart-subtotal-label", local);
50
+ const subtotalAmount = _chunkVWXJO427cjs.usePart.call(void 0, "cart-subtotal-amount", local);
51
+ const checkoutPart = _chunkVWXJO427cjs.usePart.call(void 0, "cart-checkout", local);
52
+ const continuePart = _chunkVWXJO427cjs.usePart.call(void 0, "cart-continue", local);
53
+ const viewed = _react3.useRef.call(void 0, false);
54
+ _react3.useEffect.call(void 0, () => {
55
+ if (viewed.current || !cart.cart || lines.length === 0 || !cartCurrency) return;
56
+ viewed.current = true;
57
+ track("view_cart", {
58
+ currency: cartCurrency,
59
+ value: decimal(cart.cart.subtotal, cartCurrency),
60
+ items: lines.map((line) => _chunkAYC2YK4Ecjs.lineToGa4Item.call(void 0, line, cartCurrency))
61
+ });
62
+ }, [cart.cart, lines, cartCurrency, track]);
63
+ _react3.useEffect.call(void 0, () => {
64
+ const onShow = (event) => {
65
+ if (event.persisted) setCheckingOut(false);
66
+ };
67
+ window.addEventListener("pageshow", onShow);
68
+ return () => window.removeEventListener("pageshow", onShow);
69
+ }, []);
70
+ const change = _react3.useCallback.call(void 0,
71
+ async (work) => {
72
+ setError(null);
73
+ setNotice("");
74
+ try {
75
+ await work();
76
+ } catch (caught) {
77
+ if (caught instanceof DOMException && caught.name === "AbortError") return;
78
+ setError(t("shopper.cart.updateFailed"));
79
+ }
80
+ },
81
+ [t]
82
+ );
83
+ const checkout = async () => {
84
+ if (checkingOut || lines.length === 0) return;
85
+ setError(null);
86
+ setCheckingOut(true);
87
+ try {
88
+ const { checkoutUrl } = await cart.checkout({
89
+ returnUrl: _nullishCoalesce(_optionalChain([urls, 'optionalAccess', _5 => _5.returnUrl]), () => ( `${window.location.origin}/`)),
90
+ cancelUrl: _nullishCoalesce(_optionalChain([urls, 'optionalAccess', _6 => _6.cancelUrl]), () => ( window.location.href.split("#")[0]))
91
+ });
92
+ if (cartCurrency && cart.cart) {
93
+ track("begin_checkout", {
94
+ currency: cartCurrency,
95
+ value: decimal(cart.cart.subtotal, cartCurrency),
96
+ items: lines.map((line) => _chunkAYC2YK4Ecjs.lineToGa4Item.call(void 0, line, cartCurrency))
97
+ });
98
+ }
99
+ window.location.assign(checkoutUrl);
100
+ } catch (caught) {
101
+ setCheckingOut(false);
102
+ if (caught instanceof DOMException && caught.name === "AbortError") return;
103
+ setError(
104
+ _catalog.isCatalogError.call(void 0, caught) && caught.code === "cart_prices_changed" ? t("shopper.cart.pricesChanged") : t("shopper.cart.checkoutFailed")
105
+ );
106
+ }
107
+ };
108
+ const continueLabel = t("cart.continueShopping");
109
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...body, "data-cart-status": cart.status, children: [
110
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...status, role: "status", "aria-live": "polite", children: notice }),
111
+ error ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...errorPart, role: "alert", children: error }) : null,
112
+ cart.status === "loading" && !cart.cart ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...loading, "aria-busy": "true", "aria-label": t("shopper.cart.loading"), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Skeleton, { count: 3 }) }) : lines.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...empty, children: [
113
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...emptyText, children: t("empty.cart") }),
114
+ onContinue ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", ...continuePart, onClick: onContinue, children: continueLabel }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Anchor, { ...continuePart, href: settings.routes.shop, children: continueLabel })
115
+ ] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
116
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { ...list, "aria-label": t("shopper.cart.lines"), children: lines.map((line) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
117
+ _chunkAYC2YK4Ecjs.CartLine,
118
+ {
119
+ line,
120
+ format: cart.format,
121
+ busy: cart.pending,
122
+ onQuantity: (quantity) => void change(async () => {
123
+ await cart.update(line.id, quantity);
124
+ setNotice(t("shopper.cart.updated", { name: line.name, quantity }));
125
+ }),
126
+ onRemove: () => void change(async () => {
127
+ await cart.remove(line.id);
128
+ setNotice(t("shopper.cart.removed", { name: line.name }));
129
+ if (cartCurrency) {
130
+ track("remove_from_cart", {
131
+ currency: cartCurrency,
132
+ value: decimal(line.unitPrice * line.quantity, cartCurrency),
133
+ items: [_chunkAYC2YK4Ecjs.lineToGa4Item.call(void 0, line, cartCurrency)]
134
+ });
135
+ }
136
+ }),
137
+ ...local
138
+ },
139
+ line.id
140
+ )) }),
141
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...footer, children: [
142
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { ...subtotal, children: [
143
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...subtotalLabel, children: t("shopper.cart.subtotal") }),
144
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ...subtotalAmount, "data-minor": _optionalChain([cart, 'access', _7 => _7.cart, 'optionalAccess', _8 => _8.subtotal]), children: cart.format(_nullishCoalesce(_optionalChain([cart, 'access', _9 => _9.cart, 'optionalAccess', _10 => _10.subtotal]), () => ( 0))) })
145
+ ] }),
146
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
147
+ "button",
148
+ {
149
+ type: "button",
150
+ ...checkoutPart,
151
+ disabled: cart.pending && !checkingOut,
152
+ "aria-disabled": checkingOut || void 0,
153
+ "aria-busy": checkingOut || void 0,
154
+ "data-checking-out": checkingOut ? "true" : void 0,
155
+ onClick: () => void checkout(),
156
+ children: checkingOut ? t("shopper.cart.checkingOut") : t("cart.checkout")
157
+ }
158
+ ),
159
+ onContinue ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", ...continuePart, onClick: onContinue, children: continueLabel }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Anchor, { ...continuePart, href: settings.routes.shop, children: continueLabel })
160
+ ] })
161
+ ] })
162
+ ] });
163
+ }
164
+ function DrawerCart({ className, checkoutUrls, ...local }) {
165
+ const { open, setOpen } = _chunk2LCPIY2Pcjs.useCartDrawer.call(void 0, );
166
+ const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
167
+ const titleId = _react3.useId.call(void 0, );
168
+ const sentinel = _react3.useRef.call(void 0, null);
169
+ const [target, setTarget] = _react3.useState.call(void 0, null);
170
+ _react3.useLayoutEffect.call(void 0, () => {
171
+ if (!open) {
172
+ setTarget(null);
173
+ return;
174
+ }
175
+ const root2 = _nullishCoalesce(_optionalChain([sentinel, 'access', _11 => _11.current, 'optionalAccess', _12 => _12.closest, 'call', _13 => _13(".tsf-root")]), () => ( null));
176
+ setTarget({ container: root2, opener: _nullishCoalesce(_optionalChain([root2, 'optionalAccess', _14 => _14.querySelector, 'call', _15 => _15('[data-throttle-part="cart-button"]')]), () => ( null)) });
177
+ }, [open]);
178
+ const root = _chunkVWXJO427cjs.usePart.call(void 0, "cart-drawer", { ...local, className });
179
+ const top = _chunkVWXJO427cjs.usePart.call(void 0, "cart-drawer-top", local);
180
+ const title = _chunkVWXJO427cjs.usePart.call(void 0, "cart-drawer-title", local);
181
+ const close = _chunkVWXJO427cjs.usePart.call(void 0, "cart-drawer-close", local);
182
+ const closeDrawer = () => setOpen(false);
183
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
184
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ref: sentinel, hidden: true }),
185
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
186
+ _ui.Drawer,
187
+ {
188
+ open: open && target !== null,
189
+ onClose: closeDrawer,
190
+ labelledBy: titleId,
191
+ container: _nullishCoalesce(_optionalChain([target, 'optionalAccess', _16 => _16.container]), () => ( null)),
192
+ restoreFocusTo: _nullishCoalesce(_optionalChain([target, 'optionalAccess', _17 => _17.opener]), () => ( void 0)),
193
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...root, children: [
194
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...top, children: [
195
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { ...title, id: titleId, children: t("cart.title") }),
196
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", ...close, "aria-label": t("shopper.cart.close"), onClick: closeDrawer, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: "close", size: 22 }) })
197
+ ] }),
198
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CartView, { onContinue: closeDrawer, urls: checkoutUrls, ...local })
199
+ ] })
200
+ }
201
+ )
202
+ ] });
203
+ }
204
+ function InlineCart({ className, checkoutUrls, ...local }) {
205
+ const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
206
+ const titleId = _react3.useId.call(void 0, );
207
+ const root = _chunkVWXJO427cjs.usePart.call(void 0, "cart-drawer", { ...local, className });
208
+ const title = _chunkVWXJO427cjs.usePart.call(void 0, "cart-drawer-title", local);
209
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { ...root, "data-inline": "", "aria-labelledby": titleId, children: [
210
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { ...title, id: titleId, "data-inline": "", children: t("cart.title") }),
211
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CartView, { urls: checkoutUrls, ...local })
212
+ ] });
213
+ }
214
+ function CartDrawerBody({ inline, ...local }) {
215
+ return inline ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InlineCart, { ...local }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DrawerCart, { ...local });
216
+ }
217
+
218
+
219
+ exports.CartDrawerBody = CartDrawerBody;
220
+ //# sourceMappingURL=chunk-WIIOJDHR.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/app-throttle/app-throttle/packages/storefront-react/dist/chunk-WIIOJDHR.cjs","../src/shopper/CartDrawerBody.tsx"],"names":[],"mappings":"AAAA,6rBAAY;AACZ;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACpBA,+CAA+B;AAC/B,mDAAwB;AACxB,2CAAgC;AAChC,qCAAuC;AACvC,+BAAiF;AA2G3E,+CAAA;AAhGN,IAAM,QAAA,EAAU,CAAC,KAAA,EAAe,QAAA,EAAA,GAA6B,MAAA,CAAO,oCAAA,KAAgB,EAAO,QAAQ,CAAC,CAAA;AAGpG,SAAS,QAAA,CAAS,EAAE,UAAA,EAAY,IAAA,EAAM,GAAG,MAAM,CAAA,EAAgF;AAC7H,EAAA,MAAM,EAAE,QAAA,EAAU,QAAA,EAAU,IAAA,EAAM,OAAO,EAAA,EAAI,6CAAA,CAAc;AAC3D,EAAA,MAAM,EAAE,EAAE,EAAA,EAAI,0CAAA,CAAW;AACzB,EAAA,MAAM,MAAA,EAAQ,wCAAA,CAAS;AACvB,EAAA,MAAM,KAAA,EAAO,4BAAA,SAAQ,EAAW,EAAE,SAAS,EAAA,EAAI,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,sBAAA;AACA,wBAAA;AACJ,0BAAA;AACA,0BAAA;AACH,QAAA;AACA,wBAAA;AAAC,UAAA;AAAA,UAAA;AACM,YAAA;AACD,YAAA;AACuB,YAAA;AACZ,YAAA;AACJ,YAAA;AACQ,YAAA;AACC,YAAA;AAEH,YAAA;AAA+C,UAAA;AAClE,QAAA;AAEE,QAAA;AAIJ,MAAA;AACF,IAAA;AAEJ,EAAA;AAEJ;AAGiC;AACL,EAAA;AACD,EAAA;AACH,EAAA;AACuB,EAAA;AAE8D,EAAA;AACrF,EAAA;AACT,IAAA;AACK,MAAA;AACd,MAAA;AACF,IAAA;AAC+B,IAAA;AACF,IAAA;AACtB,EAAA;AAE2B,EAAA;AAChB,EAAA;AACE,EAAA;AACA,EAAA;AACY,EAAA;AAGhC,EAAA;AACa,oBAAA;AACX,oBAAA;AAAC,MAAA;AAAA,MAAA;AAC0B,QAAA;AAChB,QAAA;AACG,QAAA;AACO,QAAA;AACK,QAAA;AAEvB,QAAA;AACE,0BAAA;AACE,4BAAA;AACA,4BAAA;AAGH,UAAA;AACC,0BAAA;AACH,QAAA;AAAA,MAAA;AACF,IAAA;AACF,EAAA;AAEJ;AAEiC;AACN,EAAA;AACH,EAAA;AACc,EAAA;AACd,EAAA;AAEnB,EAAA;AACS,oBAAA;AACE,oBAAA;AACZ,EAAA;AAEJ;AAG4C;AACzB,EAAA;AACnB;ADlCuC;AACA;AACA","file":"/home/runner/work/app-throttle/app-throttle/packages/storefront-react/dist/chunk-WIIOJDHR.cjs","sourcesContent":[null,"import { isCatalogError } from '@usethrottle/catalog';\nimport { useCart } from '@usethrottle/catalog/react';\nimport { toDecimalString } from '@usethrottle/money';\nimport { Drawer, Icon, Skeleton } from '@usethrottle/ui';\nimport { useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from 'react';\nimport { useTrack } from '../analytics/use-track';\nimport { usePart } from '../parts';\nimport { useCartDrawer } from '../provider/cart-drawer';\nimport { useStorefront } from '../provider/context';\nimport { useStrings } from '../strings';\nimport type { CartDrawerProps } from './CartDrawer';\nimport { CartLine, lineToGa4Item, type CartLineData } from './CartLine';\n\ntype Local = Pick<CartDrawerProps, 'classNames' | 'unstyled'>;\n\nconst decimal = (minor: number, currency: string): number => Number(toDecimalString(minor, currency));\n\n/** The lines, the subtotal and the checkout button: what the drawer and the inline cart share. */\nfunction CartView({ onContinue, urls, ...local }: Local & { onContinue?: () => void; urls?: CartDrawerProps['checkoutUrls'] }) {\n const { currency, settings, Link: Anchor } = useStorefront();\n const { t } = useStrings();\n const track = useTrack();\n const cart = useCart(currency ? { currency } : undefined);\n const lines: CartLineData[] = cart.cart?.lineItems ?? [];\n const cartCurrency = cart.cart?.currency ?? currency;\n const [error, setError] = useState<string | null>(null);\n const [notice, setNotice] = useState('');\n const [checkingOut, setCheckingOut] = useState(false);\n\n const body = usePart('cart-drawer-body', local);\n const status = usePart('cart-status', local);\n const errorPart = usePart('cart-error', local);\n const loading = usePart('cart-loading', local);\n const empty = usePart('cart-empty', local);\n const emptyText = usePart('cart-empty-text', local);\n const list = usePart('cart-lines', local);\n const footer = usePart('cart-footer', local);\n const subtotal = usePart('cart-subtotal', local);\n const subtotalLabel = usePart('cart-subtotal-label', local);\n const subtotalAmount = usePart('cart-subtotal-amount', local);\n const checkoutPart = usePart('cart-checkout', local);\n const continuePart = usePart('cart-continue', local);\n\n // view_cart: once, when the lines first show.\n const viewed = useRef(false);\n useEffect(() => {\n if (viewed.current || !cart.cart || lines.length === 0 || !cartCurrency) return;\n viewed.current = true;\n track('view_cart', {\n currency: cartCurrency,\n value: decimal(cart.cart.subtotal, cartCurrency),\n items: lines.map((line) => lineToGa4Item(line, cartCurrency)),\n });\n }, [cart.cart, lines, cartCurrency, track]);\n\n // A page restored from the back/forward cache comes back mid hand-off: let the button work again.\n useEffect(() => {\n const onShow = (event: PageTransitionEvent) => {\n if (event.persisted) setCheckingOut(false);\n };\n window.addEventListener('pageshow', onShow);\n return () => window.removeEventListener('pageshow', onShow);\n }, []);\n\n const change = useCallback(\n async (work: () => Promise<void>) => {\n setError(null);\n // Emptied first, so the same words said twice in a row are read twice.\n setNotice('');\n try {\n await work();\n } catch (caught) {\n // A sign-out cancels the change; there is nothing to say.\n if (caught instanceof DOMException && caught.name === 'AbortError') return;\n setError(t('shopper.cart.updateFailed'));\n }\n },\n [t],\n );\n\n const checkout = async () => {\n if (checkingOut || lines.length === 0) return;\n setError(null);\n setCheckingOut(true);\n try {\n const { checkoutUrl } = await cart.checkout({\n returnUrl: urls?.returnUrl ?? `${window.location.origin}/`,\n cancelUrl: urls?.cancelUrl ?? window.location.href.split('#')[0]!,\n });\n if (cartCurrency && cart.cart) {\n track('begin_checkout', {\n currency: cartCurrency,\n value: decimal(cart.cart.subtotal, cartCurrency),\n items: lines.map((line) => lineToGa4Item(line, cartCurrency)),\n });\n }\n window.location.assign(checkoutUrl);\n } catch (caught) {\n setCheckingOut(false);\n if (caught instanceof DOMException && caught.name === 'AbortError') return;\n setError(\n isCatalogError(caught) && caught.code === 'cart_prices_changed'\n ? t('shopper.cart.pricesChanged')\n : t('shopper.cart.checkoutFailed'),\n );\n }\n };\n\n const continueLabel = t('cart.continueShopping');\n return (\n <div {...body} data-cart-status={cart.status}>\n <p {...status} role=\"status\" aria-live=\"polite\">{notice}</p>\n {error ? <p {...errorPart} role=\"alert\">{error}</p> : null}\n {cart.status === 'loading' && !cart.cart ? (\n <div {...loading} aria-busy=\"true\" aria-label={t('shopper.cart.loading')}>\n <Skeleton count={3} />\n </div>\n ) : lines.length === 0 ? (\n <div {...empty}>\n <p {...emptyText}>{t('empty.cart')}</p>\n {onContinue ? (\n <button type=\"button\" {...continuePart} onClick={onContinue}>{continueLabel}</button>\n ) : (\n <Anchor {...continuePart} href={settings.routes.shop}>{continueLabel}</Anchor>\n )}\n </div>\n ) : (\n <>\n <ul {...list} aria-label={t('shopper.cart.lines')}>\n {lines.map((line) => (\n <CartLine\n key={line.id}\n line={line}\n format={cart.format}\n busy={cart.pending}\n onQuantity={(quantity) =>\n void change(async () => {\n await cart.update(line.id, quantity);\n setNotice(t('shopper.cart.updated', { name: line.name, quantity }));\n })\n }\n onRemove={() =>\n void change(async () => {\n await cart.remove(line.id);\n setNotice(t('shopper.cart.removed', { name: line.name }));\n if (cartCurrency) {\n track('remove_from_cart', {\n currency: cartCurrency,\n value: decimal(line.unitPrice * line.quantity, cartCurrency),\n items: [lineToGa4Item(line, cartCurrency)],\n });\n }\n })\n }\n {...local}\n />\n ))}\n </ul>\n <div {...footer}>\n <p {...subtotal}>\n <span {...subtotalLabel}>{t('shopper.cart.subtotal')}</span>\n <span {...subtotalAmount} data-minor={cart.cart?.subtotal}>{cart.format(cart.cart?.subtotal ?? 0)}</span>\n </p>\n <button\n type=\"button\"\n {...checkoutPart}\n disabled={cart.pending && !checkingOut}\n aria-disabled={checkingOut || undefined}\n aria-busy={checkingOut || undefined}\n data-checking-out={checkingOut ? 'true' : undefined}\n onClick={() => void checkout()}\n >\n {checkingOut ? t('shopper.cart.checkingOut') : t('cart.checkout')}\n </button>\n {onContinue ? (\n <button type=\"button\" {...continuePart} onClick={onContinue}>{continueLabel}</button>\n ) : (\n <Anchor {...continuePart} href={settings.routes.shop}>{continueLabel}</Anchor>\n )}\n </div>\n </>\n )}\n </div>\n );\n}\n\n/** The drawer: a dialog in the storefront root, opened and closed by `useCartDrawer`. */\nfunction DrawerCart({ className, checkoutUrls, ...local }: Local & { className?: string; checkoutUrls?: CartDrawerProps['checkoutUrls'] }) {\n const { open, setOpen } = useCartDrawer();\n const { t } = useStrings();\n const titleId = useId();\n const sentinel = useRef<HTMLSpanElement>(null);\n // Found when it opens: the root it goes into (so the preset and theme apply) and the cart button, which gets focus back.\n const [target, setTarget] = useState<{ container: HTMLElement | null; opener: HTMLElement | null } | null>(null);\n useLayoutEffect(() => {\n if (!open) {\n setTarget(null);\n return;\n }\n const root = sentinel.current?.closest<HTMLElement>('.tsf-root') ?? null;\n setTarget({ container: root, opener: root?.querySelector<HTMLElement>('[data-throttle-part=\"cart-button\"]') ?? null });\n }, [open]);\n\n const root = usePart('cart-drawer', { ...local, className });\n const top = usePart('cart-drawer-top', local);\n const title = usePart('cart-drawer-title', local);\n const close = usePart('cart-drawer-close', local);\n const closeDrawer = () => setOpen(false);\n\n return (\n <>\n <span ref={sentinel} hidden />\n <Drawer\n open={open && target !== null}\n onClose={closeDrawer}\n labelledBy={titleId}\n container={target?.container ?? null}\n restoreFocusTo={target?.opener ?? undefined}\n >\n <div {...root}>\n <div {...top}>\n <h2 {...title} id={titleId}>{t('cart.title')}</h2>\n <button type=\"button\" {...close} aria-label={t('shopper.cart.close')} onClick={closeDrawer}>\n <Icon name=\"close\" size={22} />\n </button>\n </div>\n <CartView onContinue={closeDrawer} urls={checkoutUrls} {...local} />\n </div>\n </Drawer>\n </>\n );\n}\n\nfunction InlineCart({ className, checkoutUrls, ...local }: Local & { className?: string; checkoutUrls?: CartDrawerProps['checkoutUrls'] }) {\n const { t } = useStrings();\n const titleId = useId();\n const root = usePart('cart-drawer', { ...local, className });\n const title = usePart('cart-drawer-title', local);\n return (\n <section {...root} data-inline=\"\" aria-labelledby={titleId}>\n <h2 {...title} id={titleId} data-inline=\"\">{t('cart.title')}</h2>\n <CartView urls={checkoutUrls} {...local} />\n </section>\n );\n}\n\n/** The cart panel. `CartDrawer` loads this file the first time the cart opens or is drawn. */\nexport function CartDrawerBody({ inline, ...local }: CartDrawerProps) {\n return inline ? <InlineCart {...local} /> : <DrawerCart {...local} />;\n}\n"]}
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }"use client";
3
+
4
+
5
+
6
+ var _chunkVWXJO427cjs = require('./chunk-VWXJO427.cjs');
7
+
8
+ // src/strings/use-strings.ts
9
+ var _catalog = require('@usethrottle/catalog');
10
+ var _react = require('react');
11
+ var isCatalogKey = (key) => Object.hasOwn(_catalog.DEFAULT_STRINGS, key);
12
+ function lookup(table, key) {
13
+ let at = table;
14
+ for (const part of key.split(".")) {
15
+ if (typeof at !== "object" || at === null || !Object.hasOwn(at, part)) return void 0;
16
+ at = at[part];
17
+ }
18
+ return typeof at === "string" && at !== "" ? at : void 0;
19
+ }
20
+ function interpolate(text, vars) {
21
+ if (!vars) return text;
22
+ return text.replace(/\{(\w+)\}/g, (whole, name) => name in vars ? String(vars[name]) : whole);
23
+ }
24
+ function useStrings() {
25
+ const { settings, site } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
26
+ const copy = _chunkVWXJO427cjs.useSfCopy.call(void 0, );
27
+ const t = _react.useCallback.call(void 0,
28
+ (key, vars) => {
29
+ const fromSite = Object.hasOwn(site.builderStrings, key) ? site.builderStrings[key] : void 0;
30
+ if (typeof fromSite === "string" && fromSite !== "") return interpolate(fromSite, vars);
31
+ const local = lookup(copy, key);
32
+ if (isCatalogKey(key)) {
33
+ return interpolate(_nullishCoalesce(local, () => ( (settings.strings[key] || _catalog.DEFAULT_STRINGS[key]))), vars);
34
+ }
35
+ return interpolate(_nullishCoalesce(local, () => ( key)), vars);
36
+ },
37
+ [site.builderStrings, settings.strings, copy]
38
+ );
39
+ const keyAttr = _react.useCallback.call(void 0, (key) => ({ "data-string-key": key }), []);
40
+ return _react.useMemo.call(void 0, () => ({ t, keyAttr }), [t, keyAttr]);
41
+ }
42
+
43
+
44
+
45
+ exports.useStrings = useStrings;
46
+ //# sourceMappingURL=chunk-XQHGFWLG.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/app-throttle/app-throttle/packages/storefront-react/dist/chunk-XQHGFWLG.cjs","../src/strings/use-strings.ts"],"names":[],"mappings":"AAAA,yLAAY;AACZ;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACNA,+CAAgC;AAChC,8BAAqC;AAKrC,IAAM,aAAA,EAAe,CAAC,GAAA,EAAA,GAAqD,MAAA,CAAO,MAAA,CAAO,wBAAA,EAAiB,GAAG,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Aa,EAAA,EAAI,OAAO,WAAA,CAAY,QAAA,EAAU,IAAI,CAAA;AAEtF,MAAA,MAAM,MAAA,EAAQ,MAAA,CAAO,IAAA,EAAM,GAAG,CAAA;AAC9B,MAAA,GAAA,CAAI,YAAA,CAAa,GAAG,CAAA,EAAG;AACrB,QAAA,OAAO,WAAA,kBAAY,KAAA,UAAA,CAAU,QAAA,CAAS,OAAA,CAAQ,GAAG,EAAA,GAAK,wBAAA,CAAgB,GAAG,CAAA,GAAA,EAAI,IAAI,CAAA;AAAA,MACnF;AACA,MAAA,OAAO,WAAA,kBAAY,KAAA,UAAS,KAAA,EAAK,IAAI,CAAA;AAAA,IACvC,CAAA;AAAA,IACA,CAAC,IAAA,CAAK,cAAA,EAAgB,QAAA,CAAS,OAAA,EAAS,IAAI;AAAA,EAC9C,CAAA;AACA,EAAA,MAAM,QAAA,EAAU,gCAAA,CAAa,GAAA,EAAA,GAAA,CAAsB,EAAE,iBAAA,EAAmB,IAAc,CAAA,CAAA,EAAI,CAAC,CAAC,CAAA;AAC5F,EAAA,OAAO,4BAAA,CAAQ,EAAA,GAAA,CAAO,EAAE,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,CAAC,CAAA,EAAG,OAAO,CAAC,CAAA;AACrD;ADhBA;AACA;AACE;AACF,gCAAC","file":"/home/runner/work/app-throttle/app-throttle/packages/storefront-react/dist/chunk-XQHGFWLG.cjs","sourcesContent":[null,"import { DEFAULT_STRINGS } from '@usethrottle/catalog';\nimport { useCallback, useMemo } from 'react';\nimport { useStorefront } from '../provider/context';\nimport { useSfCopy } from './localization';\nimport type { SfStringKey } from './en';\n\nconst isCatalogKey = (key: string): key is keyof typeof DEFAULT_STRINGS => Object.hasOwn(DEFAULT_STRINGS, key);\n\nfunction lookup(table: unknown, key: string): string | undefined {\n let at: unknown = table;\n for (const part of key.split('.')) {\n if (typeof at !== 'object' || at === null || !Object.hasOwn(at, part)) return undefined;\n at = (at as Record<string, unknown>)[part];\n }\n return typeof at === 'string' && at !== '' ? at : undefined;\n}\n\nfunction interpolate(text: string, vars?: Record<string, string | number>): string {\n if (!vars) return text;\n return text.replace(/\\{(\\w+)\\}/g, (whole, name: string) => (name in vars ? String(vars[name]) : whole));\n}\n\n/**\n * Text lookup. A key resolves, first match wins, through:\n * 1. the Builder's strings (`site.builderStrings[key]`); the catalog adapter's site strings are catalog text and rank with step 3;\n * 2. the `localization` prop (a package key by `<area>.<name>`, a catalog key by\n * its dotted path, such as `{ cart: { title: 'Basket' } }`): the developer's\n * own text beats what the catalog sends;\n * 3. for a catalog key, the catalog settings' `strings`;\n * 4. the package's English (`SF_STRINGS_EN`), or for a catalog key the SDK's `DEFAULT_STRINGS`.\n *\n * `{name}` placeholders fill from `vars`; one with no value stays as written.\n * `keyAttr(key)` is the `data-string-key` attribute the sync tests read.\n */\nexport function useStrings(): {\n t(key: SfStringKey, vars?: Record<string, string | number>): string;\n keyAttr(key: SfStringKey): { 'data-string-key': string };\n} {\n const { settings, site } = useStorefront();\n const copy = useSfCopy();\n\n const t = useCallback(\n (key: SfStringKey, vars?: Record<string, string | number>): string => {\n const fromSite = Object.hasOwn(site.builderStrings, key) ? site.builderStrings[key] : undefined;\n if (typeof fromSite === 'string' && fromSite !== '') return interpolate(fromSite, vars);\n // `copy` is English merged under the prop, so a catalog key (absent from English) is found only if the prop gave it.\n const local = lookup(copy, key);\n if (isCatalogKey(key)) {\n return interpolate(local ?? (settings.strings[key] || DEFAULT_STRINGS[key]), vars);\n }\n return interpolate(local ?? key, vars);\n },\n [site.builderStrings, settings.strings, copy],\n );\n const keyAttr = useCallback((key: SfStringKey) => ({ 'data-string-key': key as string }), []);\n return useMemo(() => ({ t, keyAttr }), [t, keyAttr]);\n}\n"]}
@@ -0,0 +1,168 @@
1
+ "use client";
2
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
3
+
4
+
5
+ var _chunkPNJOFFTLcjs = require('./chunk-PNJOFFTL.cjs');
6
+
7
+
8
+
9
+ var _chunkDOAII637cjs = require('./chunk-DOAII637.cjs');
10
+
11
+
12
+
13
+
14
+ var _chunkHZ6VEN6Qcjs = require('./chunk-HZ6VEN6Q.cjs');
15
+ require('./chunk-DYHHAOMG.cjs');
16
+
17
+
18
+ var _chunkP6HHE57Scjs = require('./chunk-P6HHE57S.cjs');
19
+
20
+
21
+ var _chunkXQHGFWLGcjs = require('./chunk-XQHGFWLG.cjs');
22
+
23
+
24
+
25
+ var _chunkVWXJO427cjs = require('./chunk-VWXJO427.cjs');
26
+
27
+ // src/shopper/CompareTable.tsx
28
+ var _react = require('@usethrottle/catalog/react');
29
+ var _ui = require('@usethrottle/ui');
30
+ var _react3 = require('react');
31
+ var _jsxruntime = require('react/jsx-runtime');
32
+
33
+ var humanise = (key) => {
34
+ const words = key.replace(/_/g, " ").trim();
35
+ return words.charAt(0).toUpperCase() + words.slice(1);
36
+ };
37
+ function attributeRows(products) {
38
+ const rows = /* @__PURE__ */ new Map();
39
+ for (const product of products) {
40
+ for (const variant of _nullishCoalesce(product.variants, () => ( []))) {
41
+ const labels = variant.attributeLabels;
42
+ for (const key of Object.keys(_nullishCoalesce(variant.attributes, () => ( {})))) {
43
+ if (!rows.has(key)) rows.set(key, { key, label: _nullishCoalesce(_optionalChain([labels, 'optionalAccess', _ => _[key]]), () => ( humanise(key))) });
44
+ }
45
+ }
46
+ }
47
+ return [...rows.values()];
48
+ }
49
+ function attributeValues(product, key, yes, no) {
50
+ const out = [];
51
+ for (const variant of _nullishCoalesce(product.variants, () => ( []))) {
52
+ const value = _optionalChain([variant, 'access', _2 => _2.attributes, 'optionalAccess', _3 => _3[key]]);
53
+ if (value === void 0) continue;
54
+ const text = typeof value === "boolean" ? value ? yes : no : String(value);
55
+ if (!out.includes(text)) out.push(text);
56
+ }
57
+ return out;
58
+ }
59
+ function Cell({ children, ...local }) {
60
+ const part = _chunkVWXJO427cjs.usePart.call(void 0, "compare-cell", local);
61
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { ...part, children });
62
+ }
63
+ function CompareTable(props) {
64
+ const { classNames, unstyled, className } = props;
65
+ const local = { classNames, unstyled };
66
+ const { t } = _chunkXQHGFWLGcjs.useStrings.call(void 0, );
67
+ const { settings, Link: Anchor, reviewsOnLists } = _chunkVWXJO427cjs.useStorefront.call(void 0, );
68
+ const { items, toggle, clear } = _chunkPNJOFFTLcjs.useCompare.call(void 0, );
69
+ const ready = items.length >= 2;
70
+ const query = _react.useProducts.call(void 0,
71
+ { handles: items, limit: Math.max(1, items.length), fields: "full" },
72
+ { enabled: ready, staleTimeMs: _chunkDOAII637cjs.MERCH_STALE_MS }
73
+ );
74
+ const products = _react3.useMemo.call(void 0, () => ready && query.data ? _chunkDOAII637cjs.orderByHandles.call(void 0, query.data.products, items) : [], [ready, query.data, items]);
75
+ const rows = _react3.useMemo.call(void 0, () => attributeRows(products), [products]);
76
+ const root = _chunkVWXJO427cjs.usePart.call(void 0, "compare", { ...local, className });
77
+ const header = _chunkVWXJO427cjs.usePart.call(void 0, "compare-header", local);
78
+ const title = _chunkVWXJO427cjs.usePart.call(void 0, "compare-title", local);
79
+ const clearPart = _chunkVWXJO427cjs.usePart.call(void 0, "compare-clear", local);
80
+ const scroll = _chunkVWXJO427cjs.usePart.call(void 0, "compare-scroll", local);
81
+ const table = _chunkVWXJO427cjs.usePart.call(void 0, "compare-table", local);
82
+ const caption = _chunkVWXJO427cjs.usePart.call(void 0, "compare-caption", local);
83
+ const row = _chunkVWXJO427cjs.usePart.call(void 0, "compare-row", local);
84
+ const label = _chunkVWXJO427cjs.usePart.call(void 0, "compare-label", local);
85
+ const product = _chunkVWXJO427cjs.usePart.call(void 0, "compare-product", local);
86
+ const media = _chunkVWXJO427cjs.usePart.call(void 0, "compare-product-media", local);
87
+ const link = _chunkVWXJO427cjs.usePart.call(void 0, "compare-product-link", local);
88
+ const remove = _chunkVWXJO427cjs.usePart.call(void 0, "compare-product-remove", local);
89
+ const empty = _chunkVWXJO427cjs.usePart.call(void 0, "compare-empty", local);
90
+ const heading = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...header, children: [
91
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { ...title, children: t("shopper.compare.title") }),
92
+ items.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", ...clearPart, onClick: clear, children: t("shopper.compare.clear") }) : null
93
+ ] });
94
+ if (!ready) {
95
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { ...root, "data-section": "compare", "data-section-title": t("shopper.compare.title"), children: [
96
+ heading,
97
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...empty, children: t("shopper.compare.needMore") })
98
+ ] });
99
+ }
100
+ if (query.error && !query.data) {
101
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { ...root, "data-section": "compare", "data-section-title": t("shopper.compare.title"), children: [
102
+ heading,
103
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...empty, role: "alert", children: t("shopper.compare.loadFailed") })
104
+ ] });
105
+ }
106
+ if (!query.data) return null;
107
+ if (products.length < 2) {
108
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { ...root, "data-section": "compare", "data-section-title": t("shopper.compare.title"), children: [
109
+ heading,
110
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { ...empty, children: t("shopper.compare.needMore") })
111
+ ] });
112
+ }
113
+ const words = settings.stock.words;
114
+ const availability = (p) => p.availability === "in_stock" ? words.inStock : p.availability === "out_of_stock" ? words.outOfStock : p.availability === "backorder" ? words.backorder : p.availability === "preorder" ? words.preorder : "";
115
+ const showRating = reviewsOnLists && settings.card.showRating && products.some((p) => p.rating && p.rating.count > 0);
116
+ const showBrand = products.some((p) => p.brand);
117
+ const none = t("shopper.compare.none");
118
+ const yes = t("boolean.yes");
119
+ const no = t("boolean.no");
120
+ const labelRow = (text, key, cell) => /* @__PURE__ */ _react3.createElement.call(void 0, "tr", { ...row, key, "data-compare-row": key }, /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "th", { ...label, scope: "row", children: text }), products.map((p) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Cell, { ...local, children: cell(p) }, p.handle)));
121
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "section", { ...root, "data-section": "compare", "data-section-title": t("shopper.compare.title"), children: [
122
+ heading,
123
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...scroll, tabIndex: 0, role: "region", "aria-label": t("shopper.compare.title"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "table", { ...table, children: [
124
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "caption", { ...caption, children: t("shopper.compare.caption", { count: products.length }) }),
125
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "thead", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { ...row, children: [
126
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "th", { ...label, scope: "col", children: t("shopper.compare.spec") }),
127
+ products.map((p) => {
128
+ const name = _nullishCoalesce(p.title, () => ( p.handle));
129
+ const image = _optionalChain([p, 'access', _4 => _4.images, 'optionalAccess', _5 => _5[0]]);
130
+ return /* @__PURE__ */ _react3.createElement.call(void 0, "th", { ...product, key: p.handle, scope: "col", "data-compare-handle": p.handle }, image ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...media, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkP6HHE57Scjs.Image, { src: image.url, alt: "", aspectRatio: 1, ...local }) }) : null, /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Anchor, { ...link, href: _chunkHZ6VEN6Qcjs.routeHref.call(void 0, settings, "product", p.handle), children: name }), /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
131
+ "button",
132
+ {
133
+ type: "button",
134
+ ...remove,
135
+ "aria-label": t("shopper.compare.remove", { title: name }),
136
+ onClick: () => toggle(p.handle),
137
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ui.Icon, { name: "close", size: 16 })
138
+ }
139
+ ));
140
+ })
141
+ ] }) }),
142
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tbody", { children: [
143
+ labelRow(
144
+ t("shopper.compare.price"),
145
+ "price",
146
+ (p) => p.priceRange ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHZ6VEN6Qcjs.Price, { minor: p.priceRange.minMinor, currency: p.priceRange.currency, ...local }) : none
147
+ ),
148
+ labelRow(t("shopper.compare.availability"), "availability", (p) => availability(p) || none),
149
+ showBrand ? labelRow(t("shopper.compare.brand"), "brand", (p) => p.brand || none) : null,
150
+ showRating ? labelRow(
151
+ t("shopper.compare.rating"),
152
+ "rating",
153
+ (p) => p.rating && p.rating.count > 0 && p.rating.average !== null ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHZ6VEN6Qcjs.StarRating, { value: p.rating.average, count: p.rating.count, size: "sm", ...local }) : none
154
+ ) : null,
155
+ rows.map(
156
+ (r) => labelRow(r.label, `attr:${r.key}`, (p) => {
157
+ const values = attributeValues(p, r.key, yes, no);
158
+ return values.length > 0 ? values.join(", ") : none;
159
+ })
160
+ )
161
+ ] })
162
+ ] }) })
163
+ ] });
164
+ }
165
+
166
+
167
+ exports.CompareTable = CompareTable;
168
+ //# sourceMappingURL=chunk-ZHCXI2ZZ.cjs.map