@adobe-commerce/elsie 1.0.0-alpha1 → 1.0.0-alpha3

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 (176) hide show
  1. package/.elsie.js +1 -1
  2. package/bin/builders/generate/component/templates/Component.js +1 -1
  3. package/bin/builders/generate/component/templates/unit-test.js +1 -1
  4. package/bin/builders/generate/container/templates/Component.js +1 -1
  5. package/bin/builders/generate/container/templates/unit-test.js +1 -1
  6. package/config/eslint.js +8 -8
  7. package/config/jest.js +3 -3
  8. package/config/storybook/components/FileTree/index.js +1 -1
  9. package/config/storybook/components/Flex/index.js +1 -1
  10. package/config/storybook/components/OptionsTable/index.js +1 -1
  11. package/config/storybook/components/Panel/index.ts +1 -1
  12. package/config/storybook/components/Screenshot/index.js +1 -1
  13. package/config/storybook/components/Steps/index.js +1 -1
  14. package/config/storybook/components/StoryWrapper/index.js +1 -1
  15. package/config/storybook/components/Summary/index.js +1 -1
  16. package/config/storybook/components/Variants/index.js +1 -1
  17. package/config/vite.mjs +12 -12
  18. package/dist/recaptcha.js +2 -2
  19. package/dist/signals.js +1 -1
  20. package/dist/types/elsie/src/components/Icon/Icon.d.ts +1 -1
  21. package/dist/types/event-bus/src/events-catalog.d.ts +16 -0
  22. package/dist/types/event-bus/src/index.d.ts +53 -0
  23. package/dist/types/fetch-graphql/src/index.d.ts +105 -0
  24. package/dist/types/recaptcha/src/configs/index.d.ts +4 -0
  25. package/dist/types/recaptcha/src/configs/message.config.d.ts +8 -0
  26. package/dist/types/recaptcha/src/configs/recaptchaBadgeSelector.config.d.ts +2 -0
  27. package/dist/types/recaptcha/src/configs/typeForms.config.d.ts +2 -0
  28. package/dist/types/recaptcha/src/graphql/recaptchaConfig.graphql.d.ts +2 -0
  29. package/dist/types/recaptcha/src/index.d.ts +42 -0
  30. package/dist/types/recaptcha/src/lib/_checkRecaptchaBadge.d.ts +2 -0
  31. package/dist/types/recaptcha/src/lib/_convertKeysToCamelCase.d.ts +6 -0
  32. package/dist/types/recaptcha/src/lib/_extendConfig.d.ts +4 -0
  33. package/dist/types/recaptcha/src/lib/_storageConfig.d.ts +6 -0
  34. package/dist/types/recaptcha/src/lib/index.d.ts +5 -0
  35. package/dist/types/recaptcha/src/services/recaptcha.service.d.ts +6 -0
  36. package/package.json +2 -3
  37. package/src/components/Accordion/Accordion.stories.tsx +3 -3
  38. package/src/components/Accordion/Accordion.tsx +5 -5
  39. package/src/components/Accordion/index.ts +2 -2
  40. package/src/components/ActionButton/ActionButton.stories.tsx +4 -4
  41. package/src/components/ActionButton/ActionButton.tsx +2 -2
  42. package/src/components/ActionButton/index.ts +1 -1
  43. package/src/components/ActionButtonGroup/ActionButtonGroup.stories.tsx +3 -3
  44. package/src/components/ActionButtonGroup/ActionButtonGroup.tsx +3 -3
  45. package/src/components/ActionButtonGroup/index.ts +1 -1
  46. package/src/components/AlertBanner/AlertBanner.stories.tsx +2 -2
  47. package/src/components/AlertBanner/AlertBanner.tsx +5 -5
  48. package/src/components/AlertBanner/index.ts +2 -2
  49. package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +5 -5
  50. package/src/components/Breadcrumbs/Breadcrumbs.tsx +2 -2
  51. package/src/components/Breadcrumbs/index.ts +2 -2
  52. package/src/components/Button/Button.mdx +2 -2
  53. package/src/components/Button/Button.stories.tsx +4 -4
  54. package/src/components/Button/Button.tsx +2 -2
  55. package/src/components/Button/index.ts +2 -2
  56. package/src/components/Card/Card.stories.tsx +2 -2
  57. package/src/components/Card/Card.tsx +2 -2
  58. package/src/components/Card/index.ts +1 -1
  59. package/src/components/CartItem/CartItem.stories.tsx +2 -2
  60. package/src/components/CartItem/CartItem.tsx +5 -5
  61. package/src/components/CartItem/CartItemSkeleton.tsx +1 -1
  62. package/src/components/CartItem/index.ts +3 -3
  63. package/src/components/CartList/CartList.stories.tsx +1 -1
  64. package/src/components/CartList/CartList.tsx +2 -2
  65. package/src/components/CartList/index.ts +2 -2
  66. package/src/components/Checkbox/Checkbox.stories.tsx +2 -2
  67. package/src/components/Checkbox/Checkbox.tsx +4 -4
  68. package/src/components/Checkbox/index.ts +1 -1
  69. package/src/components/ColorSwatch/ColorSwatch.stories.tsx +2 -2
  70. package/src/components/ColorSwatch/ColorSwatch.tsx +3 -3
  71. package/src/components/ColorSwatch/index.ts +2 -2
  72. package/src/components/ContentGrid/ContentGrid.stories.tsx +1 -1
  73. package/src/components/ContentGrid/ContentGrid.tsx +2 -2
  74. package/src/components/ContentGrid/index.ts +2 -2
  75. package/src/components/Divider/Divider.stories.tsx +1 -1
  76. package/src/components/Divider/Divider.tsx +2 -2
  77. package/src/components/Divider/index.ts +2 -2
  78. package/src/components/Field/Field.stories.tsx +9 -9
  79. package/src/components/Field/Field.tsx +2 -2
  80. package/src/components/Field/index.ts +1 -1
  81. package/src/components/Header/Header.stories.tsx +2 -2
  82. package/src/components/Header/Header.tsx +3 -3
  83. package/src/components/Header/index.ts +2 -2
  84. package/src/components/Icon/Icon.stories.helpers.jsx +1 -1
  85. package/src/components/Icon/Icon.stories.tsx +4 -4
  86. package/src/components/Icon/Icon.tsx +45 -45
  87. package/src/components/Icon/index.ts +1 -1
  88. package/src/components/IllustratedMessage/IllustratedMessage.stories.tsx +4 -4
  89. package/src/components/IllustratedMessage/IllustratedMessage.tsx +3 -3
  90. package/src/components/IllustratedMessage/index.ts +2 -2
  91. package/src/components/Image/Image.stories.tsx +2 -2
  92. package/src/components/Image/Image.tsx +2 -2
  93. package/src/components/Image/index.ts +1 -1
  94. package/src/components/ImageSwatch/ImageSwatch.stories.tsx +2 -2
  95. package/src/components/ImageSwatch/ImageSwatch.tsx +4 -4
  96. package/src/components/ImageSwatch/index.ts +2 -2
  97. package/src/components/InLineAlert/InLineAlert.stories.tsx +4 -4
  98. package/src/components/InLineAlert/InLineAlert.tsx +5 -5
  99. package/src/components/InLineAlert/index.ts +2 -2
  100. package/src/components/Incrementer/Incrementer.stories.tsx +1 -1
  101. package/src/components/Incrementer/Incrementer.tsx +5 -5
  102. package/src/components/Incrementer/index.ts +1 -1
  103. package/src/components/Input/Input.stories.tsx +4 -4
  104. package/src/components/Input/Input.tsx +4 -4
  105. package/src/components/Input/index.ts +2 -2
  106. package/src/components/InputDate/InputDate.stories.tsx +1 -1
  107. package/src/components/InputDate/InputDate.tsx +5 -5
  108. package/src/components/InputDate/index.ts +2 -2
  109. package/src/components/InputPassword/InputPassword.stories.tsx +1 -1
  110. package/src/components/InputPassword/InputPassword.tsx +5 -5
  111. package/src/components/InputPassword/PasswordStatusIndicator/PasswordStatusIndicator.tsx +4 -4
  112. package/src/components/InputPassword/PasswordStatusIndicator/index.ts +2 -2
  113. package/src/components/InputPassword/index.ts +2 -2
  114. package/src/components/Modal/Modal.tsx +4 -4
  115. package/src/components/Modal/index.ts +1 -1
  116. package/src/components/Pagination/Pagination.stories.tsx +2 -2
  117. package/src/components/Pagination/Pagination.tsx +5 -5
  118. package/src/components/Pagination/index.ts +2 -2
  119. package/src/components/Picker/Picker.stories.tsx +2 -2
  120. package/src/components/Picker/Picker.tsx +4 -4
  121. package/src/components/Picker/index.ts +1 -1
  122. package/src/components/Price/Price.stories.tsx +2 -2
  123. package/src/components/Price/Price.tsx +2 -2
  124. package/src/components/Price/index.ts +1 -1
  125. package/src/components/PriceRange/PriceRange.stories.tsx +2 -2
  126. package/src/components/PriceRange/PriceRange.tsx +4 -4
  127. package/src/components/PriceRange/index.ts +2 -2
  128. package/src/components/ProgressSpinner/ProgressSpinner.stories.tsx +3 -3
  129. package/src/components/ProgressSpinner/ProgressSpinner.tsx +3 -3
  130. package/src/components/ProgressSpinner/index.ts +2 -2
  131. package/src/components/RadioButton/RadioButton.stories.tsx +2 -2
  132. package/src/components/RadioButton/RadioButton.tsx +2 -2
  133. package/src/components/RadioButton/index.ts +2 -2
  134. package/src/components/Skeleton/Skeleton.stories.tsx +1 -1
  135. package/src/components/Skeleton/Skeleton.tsx +2 -2
  136. package/src/components/Skeleton/index.ts +1 -1
  137. package/src/components/Tag/Tag.stories.tsx +1 -1
  138. package/src/components/Tag/Tag.tsx +2 -2
  139. package/src/components/Tag/index.ts +2 -2
  140. package/src/components/TextArea/TextArea.stories.tsx +1 -1
  141. package/src/components/TextArea/TextArea.tsx +2 -2
  142. package/src/components/TextArea/index.ts +2 -2
  143. package/src/components/TextSwatch/TextSwatch.stories.tsx +2 -2
  144. package/src/components/TextSwatch/TextSwatch.tsx +3 -3
  145. package/src/components/TextSwatch/index.ts +2 -2
  146. package/src/components/ToggleButton/ToggleButton.stories.tsx +3 -3
  147. package/src/components/ToggleButton/ToggleButton.tsx +3 -3
  148. package/src/components/ToggleButton/index.ts +2 -2
  149. package/src/components/UIProvider/UIProvider.tsx +4 -4
  150. package/src/components/UIProvider/index.ts +1 -1
  151. package/src/components/index.ts +40 -40
  152. package/src/docs/API/event-bus.mdx +1 -1
  153. package/src/docs/API/graphql.mdx +3 -3
  154. package/src/docs/API/initializer.mdx +2 -2
  155. package/src/docs/API/render.mdx +2 -2
  156. package/src/docs/Design/colors.mdx +1 -1
  157. package/src/docs/Design/grid.mdx +2 -2
  158. package/src/docs/Design/overview.mdx +6 -6
  159. package/src/docs/Design/shapes.mdx +3 -3
  160. package/src/docs/Design/spacing.mdx +1 -1
  161. package/src/docs/Design/typography.mdx +1 -1
  162. package/src/docs/Utilities/classList.mdx +2 -2
  163. package/src/docs/Utilities/debounce.mdx +1 -1
  164. package/src/docs/Utilities/getFormErrors.mdx +1 -1
  165. package/src/docs/Utilities/getFormValues.mdx +1 -1
  166. package/src/docs/components/overview.mdx +3 -3
  167. package/src/docs/quick-start.mdx +3 -3
  168. package/src/docs/slots.mdx +1 -1
  169. package/src/docs/welcome.mdx +4 -4
  170. package/src/i18n/index.ts +2 -2
  171. package/src/lib/index.ts +15 -15
  172. package/src/lib/initializer.ts +1 -1
  173. package/src/lib/render.tsx +2 -2
  174. package/src/lib/resolve-image.ts +1 -1
  175. package/src/lib/slot.tsx +2 -2
  176. package/src/lib/tests.tsx +1 -1
package/.elsie.js CHANGED
@@ -4,7 +4,7 @@ module.exports = {
4
4
  {
5
5
  id: 'Components',
6
6
  root: './src/components',
7
- importAliasRoot: '@adobe/elsie/components',
7
+ importAliasRoot: '@adobe-commerce/elsie/components',
8
8
  cssPrefix: 'dropin',
9
9
  default: true,
10
10
  },
@@ -23,7 +23,7 @@ module.exports = ({ basename, importPath = '.', skipCSS, cssPrefix }) => {
23
23
  return `${stripIndent`
24
24
  import { FunctionComponent } from 'preact';
25
25
  import { HTMLAttributes } from 'preact/compat';
26
- import { classes } from '@adobe/elsie/lib';
26
+ import { classes } from '@adobe-commerce/elsie/lib';
27
27
  import '${importPath}/${basename}.css';
28
28
 
29
29
  export interface ${basename}Props extends HTMLAttributes<HTMLDivElement> {}
@@ -4,7 +4,7 @@ module.exports = ({ name, basename, pathname, group, importPath = '.' }) => {
4
4
  return `${source`
5
5
  /** https://preactjs.com/guide/v10/preact-testing-library/ */
6
6
 
7
- import { render } from '@adobe/elsie/lib/tests';
7
+ import { render } from '@adobe-commerce/elsie/lib/tests';
8
8
 
9
9
  import { ${basename} } from '${importPath}';
10
10
 
@@ -3,7 +3,7 @@ const { stripIndent } = require('common-tags');
3
3
  module.exports = ({ basename }) => {
4
4
  return `${stripIndent`
5
5
  import { HTMLAttributes } from 'preact/compat';
6
- import { Container } from '@adobe/elsie/lib';
6
+ import { Container } from '@adobe-commerce/elsie/lib';
7
7
 
8
8
  export interface ${basename}Props extends HTMLAttributes<HTMLDivElement> {}
9
9
 
@@ -4,7 +4,7 @@ module.exports = ({ name, basename, pathname, importPath = '.' }) => {
4
4
  return `${source`
5
5
  /** https://preactjs.com/guide/v10/preact-testing-library/ */
6
6
 
7
- import { render } from '@adobe/elsie/lib/tests';
7
+ import { render } from '@adobe-commerce/elsie/lib/tests';
8
8
 
9
9
  import { ${basename} } from '${importPath}';
10
10
 
package/config/eslint.js CHANGED
@@ -44,18 +44,18 @@ module.exports = {
44
44
  {
45
45
  patterns: [
46
46
  {
47
- group: ['@adobe/elsie/src/*'],
47
+ group: ['@adobe-commerce/elsie/src/*'],
48
48
  message:
49
- 'Please import from "@adobe/elsie" instead of "@adobe/elsie/src/*".',
49
+ 'Please import from "@adobe-commerce/elsie" instead of "@adobe-commerce/elsie/src/*".',
50
50
  },
51
51
  {
52
- group: ['@adobe/elsie/components/*'],
52
+ group: ['@adobe-commerce/elsie/components/*'],
53
53
  message:
54
- 'Please use "@adobe/elsie/components" instead. Otherwise, the component will not be externalized and be included in your bundle instead.',
54
+ 'Please use "@adobe-commerce/elsie/components" instead. Otherwise, the component will not be externalized and be included in your bundle instead.',
55
55
  },
56
56
  {
57
57
  group: ['preact-i18n'],
58
- message: 'Please use "@adobe/elsie/i18n" instead of "preact-i18n".',
58
+ message: 'Please use "@adobe-commerce/elsie/i18n" instead of "preact-i18n".',
59
59
  },
60
60
  ],
61
61
  },
@@ -71,9 +71,9 @@ module.exports = {
71
71
  {
72
72
  patterns: [
73
73
  {
74
- group: ['@adobe/fetch-graphql'],
74
+ group: ['@adobe-commerce/fetch-graphql'],
75
75
  message:
76
- 'Please use your project instance of fetch-graphql "@/<project>/api" instead of "@adobe/fetch-graphql".',
76
+ 'Please use your project instance of fetch-graphql "@/<project>/api" instead of "@adobe-commerce/fetch-graphql".',
77
77
  },
78
78
  ],
79
79
  },
@@ -91,7 +91,7 @@ module.exports = {
91
91
  {
92
92
  group: ['@preact/signals'],
93
93
  message:
94
- 'Please use "@adobe/elsie/lib/signals" instead of "@preact/signals".',
94
+ 'Please use "@adobe-commerce/elsie/lib/signals" instead of "@preact/signals".',
95
95
  },
96
96
  ],
97
97
  },
package/config/jest.js CHANGED
@@ -28,8 +28,8 @@ module.exports = {
28
28
 
29
29
  moduleNameMapper: {
30
30
  '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
31
- '\\.svg': '@adobe/elsie/__mocks__/svg.js',
32
- '^@adobe/elsie/(.*)$': path.resolve(__dirname, '../src/$1'),
31
+ '\\.svg': '@adobe-commerce/elsie/__mocks__/svg.js',
32
+ '^@adobe-commerce/elsie/(.*)$': path.resolve(__dirname, '../src/$1'),
33
33
 
34
34
  // generated mocks.ts uses relative path to types.ts
35
35
  '^\\.{2}/types$': '<rootDir>/src/__generated__/types.ts',
@@ -76,6 +76,6 @@ module.exports = {
76
76
  },
77
77
 
78
78
  transformIgnorePatterns: [
79
- '/node_modules/(?!(@adobe/elsie|@adobe/fetch-graphql|@adobe/event-bus|@adobe/recaptcha)/)',
79
+ '/node_modules/(?!(@adobe-commerce/elsie|@adobe-commerce/fetch-graphql|@adobe-commerce/event-bus|@adobe-commerce/recaptcha)/)',
80
80
  ],
81
81
  };
@@ -1 +1 @@
1
- export * from '@adobe/elsie/config/storybook/components/FileTree/FileTree';
1
+ export * from '@adobe-commerce/elsie/config/storybook/components/FileTree/FileTree';
@@ -1 +1 @@
1
- export * from '@adobe/elsie/config/storybook/components/Flex/Flex';
1
+ export * from '@adobe-commerce/elsie/config/storybook/components/Flex/Flex';
@@ -1 +1 @@
1
- export * from '@adobe/elsie/config/storybook/components/OptionsTable/OptionsTable';
1
+ export * from '@adobe-commerce/elsie/config/storybook/components/OptionsTable/OptionsTable';
@@ -1 +1 @@
1
- export * from '@adobe/elsie/config/storybook/components/Panel/Panel';
1
+ export * from '@adobe-commerce/elsie/config/storybook/components/Panel/Panel';
@@ -1 +1 @@
1
- export * from '@adobe/elsie/config/storybook/components/Screenshot/Screenshot';
1
+ export * from '@adobe-commerce/elsie/config/storybook/components/Screenshot/Screenshot';
@@ -1 +1 @@
1
- export * from '@adobe/elsie/config/storybook/components/Steps/Steps';
1
+ export * from '@adobe-commerce/elsie/config/storybook/components/Steps/Steps';
@@ -1 +1 @@
1
- export * from '@adobe/elsie/config/storybook/components/StoryWrapper/StoryWrapper';
1
+ export * from '@adobe-commerce/elsie/config/storybook/components/StoryWrapper/StoryWrapper';
@@ -1 +1 @@
1
- export * from '@adobe/elsie/config/storybook/components/Summary/Summary';
1
+ export * from '@adobe-commerce/elsie/config/storybook/components/Summary/Summary';
@@ -1 +1 @@
1
- export * from '@adobe/elsie/config/storybook/components/Variants/Variants';
1
+ export * from '@adobe-commerce/elsie/config/storybook/components/Variants/Variants';
package/config/vite.mjs CHANGED
@@ -90,8 +90,8 @@ export default {
90
90
  'react-dom/test-utils': 'preact/test-utils',
91
91
  'react-dom': 'preact/compat', // Must be below test-utils
92
92
  'react/jsx-runtime': 'preact/jsx-runtime',
93
- '@adobe/elsie/config': '@adobe/elsie/config', // storybook
94
- '@adobe/elsie': '@adobe/elsie/src',
93
+ '@adobe-commerce/elsie/config': '@adobe-commerce/elsie/config', // storybook
94
+ '@adobe-commerce/elsie': '@adobe-commerce/elsie/src',
95
95
  },
96
96
  },
97
97
 
@@ -128,15 +128,15 @@ export default {
128
128
  '@preact/signals': '@dropins/tools/signals.js',
129
129
 
130
130
  // SDK Tools
131
- '@adobe/event-bus': '@dropins/tools/event-bus.js',
132
- '@adobe/fetch-graphql': '@dropins/tools/fetch-graphql.js',
133
- '@adobe/recaptcha': '@dropins/tools/recaptcha.js',
131
+ '@adobe-commerce/event-bus': '@dropins/tools/event-bus.js',
132
+ '@adobe-commerce/fetch-graphql': '@dropins/tools/fetch-graphql.js',
133
+ '@adobe-commerce/recaptcha': '@dropins/tools/recaptcha.js',
134
134
 
135
135
  // Lib
136
- '@adobe/elsie/lib': '@dropins/tools/lib.js',
136
+ '@adobe-commerce/elsie/lib': '@dropins/tools/lib.js',
137
137
 
138
138
  // Components
139
- '@adobe/elsie/components': '@dropins/tools/components.js',
139
+ '@adobe-commerce/elsie/components': '@dropins/tools/components.js',
140
140
  },
141
141
  },
142
142
 
@@ -152,15 +152,15 @@ export default {
152
152
  '@preact/signals',
153
153
 
154
154
  // SDK Tools
155
- '@adobe/event-bus',
156
- '@adobe/fetch-graphql',
157
- '@adobe/recaptcha',
155
+ '@adobe-commerce/event-bus',
156
+ '@adobe-commerce/fetch-graphql',
157
+ '@adobe-commerce/recaptcha',
158
158
 
159
159
  // Lib
160
- '@adobe/elsie/lib',
160
+ '@adobe-commerce/elsie/lib',
161
161
 
162
162
  // Components
163
- '@adobe/elsie/components',
163
+ '@adobe-commerce/elsie/components',
164
164
  ],
165
165
  },
166
166
 
package/dist/recaptcha.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- const s={failedFetch:"Failed to fetch config from backend with status:",failedSetStorageConfig:"Failed to set storage config",failedGetStorageConfig:"Configuration could not be loaded.",failedExecutionRecaptcha:"Recaptcha execution failed",failedInitializing:"An error occurred while initializing ReCaptcha:"},_={PLACE_ORDER:"placeOrder",CONTACT:"contactUs",CUSTOMER_LOGIN:"generateCustomerToken",CUSTOMER_FORGOT_PASSWORD:"requestPasswordResetEmail",CUSTOMER_CREATE:"createCustomerV2",CUSTOMER_EDIT:"updateCustomerV2",NEWSLETTER:"subscribeEmailToNewsletter",PRODUCT_REVIEW:"createProductReview",SENDFRIEND:"SENDFRIEND",BRAINTREE:"BRAINTREE"},f=".grecaptcha-badge iframe",w=(i,t)=>{if(i&&i.forms){const e=i.forms.concat(t).map(r=>typeof r!="string"?{...r,enabledBadgePlace:!1}:{badgeId:_[r],enabledBadgePlace:!1});return{...i,forms:[...new Set(e)]}}},p=async(i,t=1,e=1e3)=>{const r=sessionStorage.getItem(i);return r!==null?JSON.parse(r):t>0?(await new Promise(a=>setTimeout(a,e)),p(i,t-1,e)):null},y=(i,t,e)=>{if(!i||!t.websiteKey)return null;try{sessionStorage.setItem(i,JSON.stringify(t))}catch(r){return e&&console.error(s.failedSetStorageConfig,r),null}},E=i=>new Promise((t,e)=>{try{if(document.querySelector(i)){t();return}const r=new MutationObserver(()=>{document.querySelector(i)&&(t(),r.disconnect())});r.observe(document.body,{childList:!0,subtree:!1})}catch(r){e(r)}}),S=async()=>{try{return await E(f),!0}catch{return!1}},R=i=>{const t=e=>e.replace(/_([a-z])/g,(r,a)=>a.toUpperCase());return Object.keys(i).reduce((e,r)=>{const a=t(r);return e[a]=i[r],e},{})},{failedExecutionRecaptcha:g}=s,G=async i=>{if(!window.grecaptcha)return Promise.reject(g);try{return await window.grecaptcha.execute(i,{action:"click"})}catch(t){return Promise.reject(`${g} : ${t}`)}},Q=()=>new Promise(i=>{const t=new MutationObserver((r,a)=>{window.grecaptcha&&(a.disconnect(),i(!0))}),e={childList:!0,subtree:!0,attributes:!0};t.observe(document.body,e)}),H=async(i,t,e)=>(window.grecaptcha||await Q(),grecaptcha.ready(()=>{const r=document.querySelectorAll(`#${i}`);r.length&&(r.forEach(a=>a.id=`${a.id}_${Math.random().toString(36)}`),r.forEach(a=>{if(a.innerHTML==="")try{grecaptcha.render(a.id,{sitekey:t.websiteKey,badge:t.badgePosition,size:"invisible",theme:t.theme??"light"})}catch(n){e&&console.error(n)}}))})),T=`query {
3
+ import{FetchGraphQL as l}from"./fetch-graphql.js";const n={failedFetch:"Failed to fetch config from backend with status:",failedSetStorageConfig:"Failed to set storage config",failedGetStorageConfig:"Configuration could not be loaded.",failedExecutionRecaptcha:"Recaptcha execution failed",failedInitializing:"An error occurred while initializing ReCaptcha:"},u={PLACE_ORDER:"placeOrder",CONTACT:"contactUs",CUSTOMER_LOGIN:"generateCustomerToken",CUSTOMER_FORGOT_PASSWORD:"requestPasswordResetEmail",CUSTOMER_CREATE:"createCustomerV2",CUSTOMER_EDIT:"updateCustomerV2",NEWSLETTER:"subscribeEmailToNewsletter",PRODUCT_REVIEW:"createProductReview",SENDFRIEND:"SENDFRIEND",BRAINTREE:"BRAINTREE"},h=".grecaptcha-badge iframe",f=(o,e)=>{if(o&&o.forms){const t=o.forms.concat(e).map(a=>typeof a!="string"?{...a,enabledBadgePlace:!1}:{badgeId:u[a],enabledBadgePlace:!1});return{...o,forms:[...new Set(t)]}}},g=async(o,e=1,t=1e3)=>{const a=sessionStorage.getItem(o);return a!==null?JSON.parse(a):e>0?(await new Promise(r=>setTimeout(r,t)),g(o,e-1,t)):null},p=(o,e,t)=>{if(!o||!e.websiteKey)return null;try{sessionStorage.setItem(o,JSON.stringify(e))}catch(a){return t&&console.error(n.failedSetStorageConfig,a),null}},C=o=>new Promise((e,t)=>{try{if(document.querySelector(o)){e();return}const a=new MutationObserver(()=>{document.querySelector(o)&&(e(),a.disconnect())});a.observe(document.body,{childList:!0,subtree:!1})}catch(a){t(a)}}),m=async()=>{try{return await C(h),!0}catch{return!1}},b=o=>{const e=t=>t.replace(/_([a-z])/g,(a,r)=>r.toUpperCase());return Object.keys(o).reduce((t,a)=>{const r=e(a);return t[r]=o[a],t},{})},{failedExecutionRecaptcha:d}=n,y=async o=>{if(!window.grecaptcha)return Promise.reject(d);try{return await window.grecaptcha.execute(o,{action:"click"})}catch(e){return Promise.reject(`${d} : ${e}`)}},_=()=>new Promise(o=>{const e=new MutationObserver((a,r)=>{window.grecaptcha&&(r.disconnect(),o(!0))}),t={childList:!0,subtree:!0,attributes:!0};e.observe(document.body,t)}),w=async(o,e,t)=>(window.grecaptcha||await _(),grecaptcha.ready(()=>{const a=document.querySelectorAll(`#${o}`);a.length&&(a.forEach(r=>r.id=`${r.id}_${Math.random().toString(36)}`),a.forEach(r=>{if(r.innerHTML==="")try{grecaptcha.render(r.id,{sitekey:e.websiteKey,badge:e.badgePosition,size:"invisible",theme:e.theme??"light"})}catch(i){t&&console.error(i)}}))})),S=`query {
4
4
  recaptchaV3Config {
5
5
  is_enabled
6
6
  website_key
@@ -11,4 +11,4 @@ const s={failedFetch:"Failed to fetch config from backend with status:",failedSe
11
11
  forms
12
12
  theme
13
13
  }
14
- }`,P={"Content-Type":"application/json",Accept:"application/json"};class u{get endpoint(){return this._endpoint}get fetchGraphQlHeaders(){return this._fetchGraphQlHeaders}setEndpoint(t){this._endpoint=t}setFetchGraphQlHeader(t,e){this._fetchGraphQlHeaders={...this.fetchGraphQlHeaders,[t]:e}}removeFetchGraphQlHeader(t){var e;(e=this._fetchGraphQlHeaders)==null||delete e[t]}setFetchGraphQlHeaders(t){this._fetchGraphQlHeaders={...t}}async fetchGraphQl(t,e){const r=this.endpoint,a=this.fetchGraphQlHeaders;if(!r)throw Error('Missing "url"');const n=(e==null?void 0:e.method)??"POST",c=e==null?void 0:e.cache,m=e==null?void 0:e.signal;let l;const o=new URL(r),C={...P,...a};return n==="POST"&&(l=JSON.stringify({query:t,variables:e==null?void 0:e.variables})),n==="GET"&&(o.searchParams.append("query",v(t)),e!=null&&e.variables&&o.searchParams.append("variables",JSON.stringify(e.variables))),await fetch(o,{method:n,headers:C,body:l,cache:c,signal:m}).then(b=>b.json())}getConfig(){return{endpoint:this.endpoint,fetchGraphQlHeaders:this.fetchGraphQlHeaders}}getMethods(){return{setEndpoint:this.setEndpoint.bind(this),setFetchGraphQlHeader:this.setFetchGraphQlHeader.bind(this),removeFetchGraphQlHeader:this.removeFetchGraphQlHeader.bind(this),setFetchGraphQlHeaders:this.setFetchGraphQlHeaders.bind(this),fetchGraphQl:this.fetchGraphQl.bind(this),getConfig:this.getConfig.bind(this)}}}const d=new u;class F extends u{get endpoint(){return this._endpoint??d.endpoint}get fetchGraphQlHeaders(){return(this._endpoint?this._fetchGraphQlHeaders:{...this._fetchGraphQlHeaders,...d.fetchGraphQlHeaders})||{}}}function v(i){return i=i.replace(/#.*/g,""),i=i.replace(/\s+/g," "),i.trim()}const{setEndpoint:I,setFetchGraphQlHeaders:M,setFetchGraphQlHeader:B,removeFetchGraphQlHeader:L,fetchGraphQl:N,getConfig:$}=d.getMethods(),h=new F().getMethods();class O{constructor(){var t;this._enableReCAPTCHA=!1,this._recaptchaBackendEndpoint=((t=h.getConfig())==null?void 0:t.endpoint)||"",this._recaptchaScriptUrl="https://www.google.com/recaptcha/api.js",this._configStorageKey="recaptchaConfig",this._logger=!1}async _updateBadgePosition(t,e){if(e)if((e==null?void 0:e.badgePosition)==="inline")await H(t,e,this._logger);else{if(!await S())return;const a=document.querySelector(f);e.theme&&a&&!a.src.includes("theme=dark")&&!a.src.includes("theme=light")&&a.setAttribute("src",`${a.src}&theme=${e.theme}`)}}async _addRecaptchaScript(){const t=await this._loadConfig();if(!document.getElementById("recaptchaId")&&t){const e=t.websiteKey,r=t.badgePosition==="inline",a=t.languageCode;if(!e)return;const n=document.createElement("script");n.setAttribute("id","recaptchaId"),n.defer=!0,n.src=r?`${this._recaptchaScriptUrl}?render=${e}&badge=none&hl=${a}`:`${this._recaptchaScriptUrl}?render=${e}&badge=${t.badgePosition}&hl=${a}`,document.head.appendChild(n)}}async _fetchStoreConfig(){var t;try{const e=await h.fetchGraphQl(T,{method:"GET",cache:"force-cache"});if((t=e==null?void 0:e.errors)!=null&&t.length){this._logger&&console.error(e.errors[0].message);return}return e}catch(e){this._logger&&console.error(`${s.failedFetch}:`,e)}}async _loadConfig(){const t=await p(this._configStorageKey);return t?(this._enableReCAPTCHA=!!t.isEnabled,t):(this._logger&&console.error(s.failedGetStorageConfig),null)}setEndpoint(t){t&&(this._recaptchaBackendEndpoint=t,h.setEndpoint(t))}async setConfig(t){var e,r;try{const a=await this._fetchStoreConfig();if(!((e=a==null?void 0:a.data)!=null&&e.recaptchaV3Config)){sessionStorage.removeItem(this._configStorageKey);return}const n=R((r=a==null?void 0:a.data)==null?void 0:r.recaptchaV3Config),c=w(n,t);c&&y(this._configStorageKey,c,this._logger)}catch(a){this._logger&&console.error(s.failedSetStorageConfig,a),sessionStorage.removeItem(this._configStorageKey)}}async initReCaptcha(t=3e3){setTimeout(()=>{(async()=>{try{const e=await this._loadConfig();if(!(e!=null&&e.forms)||!e.isEnabled)return;await this._addRecaptchaScript(),e.badgePosition==="inline"?await Promise.all(e.forms.map(r=>this._updateBadgePosition(r.badgeId,e))):await this._updateBadgePosition("",e)}catch(e){this._logger&&console.error(s.failedInitializing,e)}})()},t)}async verifyReCaptcha(){try{const t=await this._loadConfig();return!(t!=null&&t.forms)||!t.websiteKey||!t.isEnabled?void 0:await G(t.websiteKey)}catch(t){this._logger&&console.error(t)}}enableLogger(t){this._logger=t}getMethods(){return{enableLogger:this.enableLogger.bind(this),setEndpoint:this.setEndpoint.bind(this),setConfig:this.setConfig.bind(this),initReCaptcha:this.initReCaptcha.bind(this),verifyReCaptcha:this.verifyReCaptcha.bind(this)}}}const A=new O,{initReCaptcha:U,verifyReCaptcha:k,setEndpoint:K,setConfig:D,enableLogger:x}=A.getMethods();export{O as RecaptchaModule,x as enableLogger,U as initReCaptcha,h as recaptchaFetchApi,D as setConfig,K as setEndpoint,k as verifyReCaptcha};
14
+ }`,c=new l().getMethods();class R{constructor(){var e;this._enableReCAPTCHA=!1,this._recaptchaBackendEndpoint=((e=c.getConfig())==null?void 0:e.endpoint)||"",this._recaptchaScriptUrl="https://www.google.com/recaptcha/api.js",this._configStorageKey="recaptchaConfig",this._logger=!1}async _updateBadgePosition(e,t){if(t)if((t==null?void 0:t.badgePosition)==="inline")await w(e,t,this._logger);else{if(!await m())return;const r=document.querySelector(h);t.theme&&r&&!r.src.includes("theme=dark")&&!r.src.includes("theme=light")&&r.setAttribute("src",`${r.src}&theme=${t.theme}`)}}async _addRecaptchaScript(){const e=await this._loadConfig();if(!document.getElementById("recaptchaId")&&e){const t=e.websiteKey,a=e.badgePosition==="inline",r=e.languageCode;if(!t)return;const i=document.createElement("script");i.setAttribute("id","recaptchaId"),i.defer=!0,i.src=a?`${this._recaptchaScriptUrl}?render=${t}&badge=none&hl=${r}`:`${this._recaptchaScriptUrl}?render=${t}&badge=${e.badgePosition}&hl=${r}`,document.head.appendChild(i)}}async _fetchStoreConfig(){var e;try{const t=await c.fetchGraphQl(S,{method:"GET",cache:"force-cache"});if((e=t==null?void 0:t.errors)!=null&&e.length){this._logger&&console.error(t.errors[0].message);return}return t}catch(t){this._logger&&console.error(`${n.failedFetch}:`,t)}}async _loadConfig(){const e=await g(this._configStorageKey);return e?(this._enableReCAPTCHA=!!e.isEnabled,e):(this._logger&&console.error(n.failedGetStorageConfig),null)}setEndpoint(e){e&&(this._recaptchaBackendEndpoint=e,c.setEndpoint(e))}async setConfig(e){var t,a;try{const r=await this._fetchStoreConfig();if(!((t=r==null?void 0:r.data)!=null&&t.recaptchaV3Config)){sessionStorage.removeItem(this._configStorageKey);return}const i=b((a=r==null?void 0:r.data)==null?void 0:a.recaptchaV3Config),s=f(i,e);s&&p(this._configStorageKey,s,this._logger)}catch(r){this._logger&&console.error(n.failedSetStorageConfig,r),sessionStorage.removeItem(this._configStorageKey)}}async initReCaptcha(e=3e3){setTimeout(()=>{(async()=>{try{const t=await this._loadConfig();if(!(t!=null&&t.forms)||!t.isEnabled)return;await this._addRecaptchaScript(),t.badgePosition==="inline"?await Promise.all(t.forms.map(a=>this._updateBadgePosition(a.badgeId,t))):await this._updateBadgePosition("",t)}catch(t){this._logger&&console.error(n.failedInitializing,t)}})()},e)}async verifyReCaptcha(){try{const e=await this._loadConfig();return!(e!=null&&e.forms)||!e.websiteKey||!e.isEnabled?void 0:await y(e.websiteKey)}catch(e){this._logger&&console.error(e)}}enableLogger(e){this._logger=e}getMethods(){return{enableLogger:this.enableLogger.bind(this),setEndpoint:this.setEndpoint.bind(this),setConfig:this.setConfig.bind(this),initReCaptcha:this.initReCaptcha.bind(this),verifyReCaptcha:this.verifyReCaptcha.bind(this)}}}const E=new R,{initReCaptcha:P,verifyReCaptcha:I,setEndpoint:O,setConfig:A,enableLogger:v}=E.getMethods();export{R as RecaptchaModule,v as enableLogger,P as initReCaptcha,c as recaptchaFetchApi,A as setConfig,O as setEndpoint,I as verifyReCaptcha};
package/dist/signals.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{b as V,l as N,A as O,T as U,y as q,t as z}from"./chunks/icons/Add.js";var B=Symbol.for("preact-signals");function $(){if(h>1)h--;else{for(var t,i=!1;p!==void 0;){var r=p;for(p=void 0,x++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&j(r))try{r.c()}catch(u){i||(t=u,i=!0)}r=n}}if(x=0,h--,i)throw t}}function K(t){if(h>0)return t();h++;try{return t()}finally{$()}}var e=void 0;function L(t){var i=e;e=void 0;try{return t()}finally{e=i}}var p=void 0,h=0,x=0,y=0;function k(t){if(e!==void 0){var i=t.n;if(i===void 0||i.t!==e)return i={i:0,S:t,p:e.s,n:void 0,t:e,e:void 0,x:void 0,r:i},e.s!==void 0&&(e.s.n=i),e.s=i,t.n=i,32&e.f&&t.S(i),i;if(i.i===-1)return i.i=0,i.n!==void 0&&(i.n.p=i.p,i.p!==void 0&&(i.p.n=i.n),i.p=e.s,i.n=void 0,e.s.n=i,e.s=i),i}}function s(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}s.prototype.brand=B;s.prototype.h=function(){return!0};s.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};s.prototype.U=function(t){if(this.t!==void 0){var i=t.e,r=t.x;i!==void 0&&(i.x=r,t.e=void 0),r!==void 0&&(r.e=i,t.x=void 0),t===this.t&&(this.t=r)}};s.prototype.subscribe=function(t){var i=this;return b(function(){var r=i.value,n=e;e=void 0;try{t(r)}finally{e=n}})};s.prototype.valueOf=function(){return this.value};s.prototype.toString=function(){return this.value+""};s.prototype.toJSON=function(){return this.value};s.prototype.peek=function(){var t=e;e=void 0;try{return this.value}finally{e=t}};Object.defineProperty(s.prototype,"value",{get:function(){var t=k(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(x>100)throw new Error("Cycle detected");this.v=t,this.i++,y++,h++;try{for(var i=this.t;i!==void 0;i=i.x)i.t.N()}finally{$()}}}});function C(t){return new s(t)}function j(t){for(var i=t.s;i!==void 0;i=i.n)if(i.S.i!==i.i||!i.S.h()||i.S.i!==i.i)return!0;return!1}function A(t){for(var i=t.s;i!==void 0;i=i.n){var r=i.S.n;if(r!==void 0&&(i.r=r),i.S.n=i,i.i=-1,i.n===void 0){t.s=i;break}}}function P(t){for(var i=t.s,r=void 0;i!==void 0;){var n=i.p;i.i===-1?(i.S.U(i),n!==void 0&&(n.n=i.n),i.n!==void 0&&(i.n.p=n)):r=i,i.S.n=i.r,i.r!==void 0&&(i.r=void 0),i=n}t.s=r}function c(t){s.call(this,void 0),this.x=t,this.s=void 0,this.g=y-1,this.f=4}(c.prototype=new s).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===y))return!0;if(this.g=y,this.f|=1,this.i>0&&!j(this))return this.f&=-2,!0;var t=e;try{A(this),e=this;var i=this.x();(16&this.f||this.v!==i||this.i===0)&&(this.v=i,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return e=t,P(this),this.f&=-2,!0};c.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var i=this.s;i!==void 0;i=i.n)i.S.S(i)}s.prototype.S.call(this,t)};c.prototype.U=function(t){if(this.t!==void 0&&(s.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var i=this.s;i!==void 0;i=i.n)i.S.U(i)}};c.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(c.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=k(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function T(t){return new c(t)}function G(t){var i=t.u;if(t.u=void 0,typeof i=="function"){h++;var r=e;e=void 0;try{i()}catch(n){throw t.f&=-2,t.f|=8,m(t),n}finally{e=r,$()}}}function m(t){for(var i=t.s;i!==void 0;i=i.n)i.S.U(i);t.x=void 0,t.s=void 0,G(t)}function D(t){if(e!==this)throw new Error("Out-of-order effect");P(this),e=t,this.f&=-2,8&this.f&&m(this),$()}function l(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}l.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var i=this.x();typeof i=="function"&&(this.u=i)}finally{t()}};l.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,G(this),A(this),h++;var t=e;return e=this,D.bind(this,t)};l.prototype.N=function(){2&this.f||(this.f|=2,this.o=p,p=this)};l.prototype.d=function(){this.f|=8,1&this.f||m(this)};function b(t){var i=new l(t);try{i.c()}catch(r){throw i.d(),r}return i.d.bind(i)}var w,g;function d(t,i){N[t]=i.bind(null,N[t]||function(){})}function S(t){g&&g(),g=t&&t.S()}function J(t){var i=this,r=t.data,n=H(r);n.value=r;var u=U(function(){for(var o=i.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return i.__$u.c=function(){var f,v=i.__$u.S(),a=u.value;v(),z(a)||((f=i.base)==null?void 0:f.nodeType)!==3?(i.__$f|=1,i.setState({})):i.base.data=a},T(function(){var f=n.value.value;return f===0?0:f===!0?"":f||""})},[]);return u.value}J.displayName="_st";Object.defineProperties(s.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:J},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});d("__b",function(t,i){if(typeof i.type=="string"){var r,n=i.props;for(var u in n)if(u!=="children"){var o=n[u];o instanceof s&&(r||(i.__np=r={}),r[u]=o,n[u]=o.peek())}}t(i)});d("__r",function(t,i){S();var r,n=i.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(u){var o;return b(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),w=n,S(r),t(i)});d("__e",function(t,i,r,n){S(),w=void 0,t(i,r,n)});d("diffed",function(t,i){S(),w=void 0;var r;if(typeof i.type=="string"&&(r=i.__e)){var n=i.__np,u=i.props;if(n){var o=r.U;if(o)for(var f in o){var v=o[f];v!==void 0&&!(f in n)&&(v.d(),o[f]=void 0)}else r.U=o={};for(var a in n){var _=o[a],E=n[a];_===void 0?(_=F(r,a,E,u),o[a]=_):_.o(E,u)}}}t(i)});function F(t,i,r,n){var u=i in t&&t.ownerSVGElement===void 0,o=C(r);return{o:function(f,v){o.value=f,n=v},d:b(function(){var f=o.value.value;n[i]!==f&&(n[i]=f,u?t[i]=f:f?t.setAttribute(i,f):t.removeAttribute(i))})}}d("unmount",function(t,i){if(typeof i.type=="string"){var r=i.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var u in n){var o=n[u];o&&o.d()}}}}else{var f=i.__c;if(f){var v=f.__$u;v&&(f.__$u=void 0,v.d())}}t(i)});d("__h",function(t,i,r,n){(n<3||n===9)&&(i.__$f|=2),t(i,r,n)});V.prototype.shouldComponentUpdate=function(t,i){var r=this.__$u,n=r&&r.s!==void 0;for(var u in i)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(n||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var o in t)if(o!=="__source"&&t[o]!==this.props[o])return!0;for(var f in this.props)if(!(f in t))return!0;return!1};function H(t){return U(function(){return C(t)},[])}function M(t){var i=O(t);return i.current=t,w.__$f|=4,U(function(){return T(function(){return i.current()})},[])}function Q(t){var i=O(t);i.current=t,q(function(){return b(function(){return i.current()})},[])}export{s as Signal,K as batch,T as computed,b as effect,C as signal,L as untracked,M as useComputed,H as useSignal,Q as useSignalEffect};
3
+ import{b as V,l as E,A as N,T as U,y as q,t as z}from"./chunks/icons/Add.js";var B=Symbol.for("preact-signals");function b(){if(v>1)v--;else{for(var t,i=!1;d!==void 0;){var r=d;for(d=void 0,x++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&j(r))try{r.c()}catch(f){i||(t=f,i=!0)}r=n}}if(x=0,v--,i)throw t}}function K(t){if(v>0)return t();v++;try{return t()}finally{b()}}var o=void 0;function L(t){var i=o;o=void 0;try{return t()}finally{o=i}}var d=void 0,v=0,x=0,y=0;function O(t){if(o!==void 0){var i=t.n;if(i===void 0||i.t!==o)return i={i:0,S:t,p:o.s,n:void 0,t:o,e:void 0,x:void 0,r:i},o.s!==void 0&&(o.s.n=i),o.s=i,t.n=i,32&o.f&&t.S(i),i;if(i.i===-1)return i.i=0,i.n!==void 0&&(i.n.p=i.p,i.p!==void 0&&(i.p.n=i.n),i.p=o.s,i.n=void 0,o.s.n=i,o.s=i),i}}function u(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}u.prototype.brand=B;u.prototype.h=function(){return!0};u.prototype.S=function(t){this.t!==t&&t.e===void 0&&(t.x=this.t,this.t!==void 0&&(this.t.e=t),this.t=t)};u.prototype.U=function(t){if(this.t!==void 0){var i=t.e,r=t.x;i!==void 0&&(i.x=r,t.e=void 0),r!==void 0&&(r.e=i,t.x=void 0),t===this.t&&(this.t=r)}};u.prototype.subscribe=function(t){var i=this;return $(function(){var r=i.value,n=o;o=void 0;try{t(r)}finally{o=n}})};u.prototype.valueOf=function(){return this.value};u.prototype.toString=function(){return this.value+""};u.prototype.toJSON=function(){return this.value};u.prototype.peek=function(){var t=o;o=void 0;try{return this.value}finally{o=t}};Object.defineProperty(u.prototype,"value",{get:function(){var t=O(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(x>100)throw new Error("Cycle detected");this.v=t,this.i++,y++,v++;try{for(var i=this.t;i!==void 0;i=i.x)i.t.N()}finally{b()}}}});function C(t){return new u(t)}function j(t){for(var i=t.s;i!==void 0;i=i.n)if(i.S.i!==i.i||!i.S.h()||i.S.i!==i.i)return!0;return!1}function A(t){for(var i=t.s;i!==void 0;i=i.n){var r=i.S.n;if(r!==void 0&&(i.r=r),i.S.n=i,i.i=-1,i.n===void 0){t.s=i;break}}}function P(t){for(var i=t.s,r=void 0;i!==void 0;){var n=i.p;i.i===-1?(i.S.U(i),n!==void 0&&(n.n=i.n),i.n!==void 0&&(i.n.p=n)):r=i,i.S.n=i.r,i.r!==void 0&&(i.r=void 0),i=n}t.s=r}function h(t){u.call(this,void 0),this.x=t,this.s=void 0,this.g=y-1,this.f=4}(h.prototype=new u).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===y))return!0;if(this.g=y,this.f|=1,this.i>0&&!j(this))return this.f&=-2,!0;var t=o;try{A(this),o=this;var i=this.x();(16&this.f||this.v!==i||this.i===0)&&(this.v=i,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return o=t,P(this),this.f&=-2,!0};h.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var i=this.s;i!==void 0;i=i.n)i.S.S(i)}u.prototype.S.call(this,t)};h.prototype.U=function(t){if(this.t!==void 0&&(u.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var i=this.s;i!==void 0;i=i.n)i.S.U(i)}};h.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(h.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=O(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function T(t){return new h(t)}function G(t){var i=t.u;if(t.u=void 0,typeof i=="function"){v++;var r=o;o=void 0;try{i()}catch(n){throw t.f&=-2,t.f|=8,m(t),n}finally{o=r,b()}}}function m(t){for(var i=t.s;i!==void 0;i=i.n)i.S.U(i);t.x=void 0,t.s=void 0,G(t)}function D(t){if(o!==this)throw new Error("Out-of-order effect");P(this),o=t,this.f&=-2,8&this.f&&m(this),b()}function p(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}p.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var i=this.x();typeof i=="function"&&(this.u=i)}finally{t()}};p.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,G(this),A(this),v++;var t=o;return o=this,D.bind(this,t)};p.prototype.N=function(){2&this.f||(this.f|=2,this.o=d,d=this)};p.prototype.d=function(){this.f|=8,1&this.f||m(this)};function $(t){var i=new p(t);try{i.c()}catch(r){throw i.d(),r}return i.d.bind(i)}var w,g;function c(t,i){E[t]=i.bind(null,E[t]||function(){})}function S(t){g&&g(),g=t&&t.S()}function J(t){var i=this,r=t.data,n=H(r);n.value=r;var f=U(function(){for(var e=i.__v;e=e.__;)if(e.__c){e.__c.__$f|=4;break}return i.__$u.c=function(){var s;!z(f.peek())&&((s=i.base)==null?void 0:s.nodeType)===3?i.base.data=f.peek():(i.__$f|=1,i.setState({}))},T(function(){var s=n.value.value;return s===0?0:s===!0?"":s||""})},[]);return f.value}J.displayName="_st";Object.defineProperties(u.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:J},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});c("__b",function(t,i){if(typeof i.type=="string"){var r,n=i.props;for(var f in n)if(f!=="children"){var e=n[f];e instanceof u&&(r||(i.__np=r={}),r[f]=e,n[f]=e.peek())}}t(i)});c("__r",function(t,i){S();var r,n=i.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(f){var e;return $(function(){e=this}),e.c=function(){n.__$f|=1,n.setState({})},e}())),w=n,S(r),t(i)});c("__e",function(t,i,r,n){S(),w=void 0,t(i,r,n)});c("diffed",function(t,i){S(),w=void 0;var r;if(typeof i.type=="string"&&(r=i.__e)){var n=i.__np,f=i.props;if(n){var e=r.U;if(e)for(var s in e){var a=e[s];a!==void 0&&!(s in n)&&(a.d(),e[s]=void 0)}else r.U=e={};for(var l in n){var _=e[l],k=n[l];_===void 0?(_=F(r,l,k,f),e[l]=_):_.o(k,f)}}}t(i)});function F(t,i,r,n){var f=i in t&&t.ownerSVGElement===void 0,e=C(r);return{o:function(s,a){e.value=s,n=a},d:$(function(){var s=e.value.value;n[i]!==s&&(n[i]=s,f?t[i]=s:s?t.setAttribute(i,s):t.removeAttribute(i))})}}c("unmount",function(t,i){if(typeof i.type=="string"){var r=i.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var f in n){var e=n[f];e&&e.d()}}}}else{var s=i.__c;if(s){var a=s.__$u;a&&(s.__$u=void 0,a.d())}}t(i)});c("__h",function(t,i,r,n){(n<3||n===9)&&(i.__$f|=2),t(i,r,n)});V.prototype.shouldComponentUpdate=function(t,i){var r=this.__$u;if(!(r&&r.s!==void 0||4&this.__$f)||3&this.__$f)return!0;for(var n in i)return!0;for(var f in t)if(f!=="__source"&&t[f]!==this.props[f])return!0;for(var e in this.props)if(!(e in t))return!0;return!1};function H(t){return U(function(){return C(t)},[])}function M(t){var i=N(t);return i.current=t,w.__$f|=4,U(function(){return T(function(){return i.current()})},[])}function Q(t){var i=N(t);i.current=t,q(function(){return $(function(){return i.current()})},[])}export{u as Signal,K as batch,T as computed,$ as effect,C as signal,L as untracked,M as useComputed,H as useSignal,Q as useSignalEffect};
@@ -1,7 +1,7 @@
1
1
  import { FunctionComponent } from 'preact';
2
2
  import { SVGProps } from 'preact/compat';
3
3
 
4
- export type IconType = keyof typeof import('@adobe/elsie/icons');
4
+ export type IconType = keyof typeof import('@adobe-commerce/elsie/icons');
5
5
  export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'size'> {
6
6
  source: FunctionComponent<SVGProps<SVGSVGElement> & {
7
7
  title?: string;
@@ -0,0 +1,16 @@
1
+ export interface Events {
2
+ authenticated: boolean;
3
+ locale: string;
4
+ 'cart/data': Cart | null;
5
+ }
6
+ export interface Cart {
7
+ id: string;
8
+ totalQuantity: number;
9
+ items: Array<{
10
+ uid: string;
11
+ quantity: number;
12
+ sku: string;
13
+ name: string;
14
+ }>;
15
+ }
16
+ //# sourceMappingURL=events-catalog.d.ts.map
@@ -0,0 +1,53 @@
1
+ import { Events } from './events-catalog';
2
+
3
+ export * from './events-catalog';
4
+ /**
5
+ * The `events` class provides static methods for event handling.
6
+ * It allows subscribing to events, emitting events, and enabling or disabling event logging.
7
+ *
8
+ * @class
9
+ * @extends {Events}
10
+ *
11
+ * @property {Function} on - Subscribes to an event.
12
+ * @property {Function} emit - Emits an event.
13
+ * @property {Function} enableLogger - Enables or disables event logging.
14
+ * @property {Function} lastPayload - Returns the last payload of the event.
15
+ */
16
+ export declare class events {
17
+ static _identifier: string;
18
+ static _logger: BroadcastChannel | null;
19
+ static _lastEvent: {
20
+ [key: string]: {
21
+ payload: any;
22
+ };
23
+ };
24
+ /**
25
+ * Returns the last payload of the event.
26
+ * @param event – The event to get the last payload from.
27
+ * @returns – The last payload of the event.
28
+ */
29
+ static lastPayload(event: string): any;
30
+ /**
31
+ * Subscribes to an event.
32
+ * @param event - The event to subscribe to.
33
+ * @param handler - The event handler.
34
+ * @param options - Optional configuration for the event handler.
35
+ */
36
+ static on<K extends keyof Events>(event: K, handler: (payload: Events[K]) => void, options?: {
37
+ eager?: boolean;
38
+ }): {
39
+ off(): void;
40
+ } | undefined;
41
+ /**
42
+ * Emits an event.
43
+ * @param event - The event to emit.
44
+ * @param payload - The event payload.
45
+ */
46
+ static emit<K extends keyof Events>(event: K, payload: Events[K]): void;
47
+ /**
48
+ * Enables or disables event logging.
49
+ * @param enabled - Whether to enable or disable event logging.
50
+ */
51
+ static enableLogger(enabled: boolean): void;
52
+ }
53
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,105 @@
1
+ export type Header = {
2
+ [key: string]: string | null;
3
+ };
4
+ export type FetchOptions = {
5
+ method?: 'GET' | 'POST';
6
+ variables?: {
7
+ [key: string]: any;
8
+ };
9
+ signal?: AbortSignal;
10
+ cache?: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached';
11
+ };
12
+ export type FetchQueryError = Array<{
13
+ message: string;
14
+ extensions: {
15
+ category: string;
16
+ };
17
+ }>;
18
+ declare class FetchGraphQLMesh {
19
+ _endpoint?: string;
20
+ get endpoint(): string | undefined;
21
+ get fetchGraphQlHeaders(): Header | undefined;
22
+ _fetchGraphQlHeaders: Header | undefined;
23
+ /**
24
+ * Sets the GraphQL endpoint.
25
+ * @param endpoint - The GraphQL endpoint.
26
+ */
27
+ setEndpoint(endpoint: string): void;
28
+ /**
29
+ * Sets the GraphQL headers.
30
+ * @param key - The key of the header.
31
+ * @param value - The value of the header.
32
+ */
33
+ setFetchGraphQlHeader(key: string, value: string | null): void;
34
+ /**
35
+ * Removes a specific GraphQL header.
36
+ * @param key - The key of the header.
37
+ */
38
+ removeFetchGraphQlHeader(key: string): void;
39
+ /**
40
+ * Sets the GraphQL headers.
41
+ * @param header - The header object.
42
+ */
43
+ setFetchGraphQlHeaders(header: Header): void;
44
+ /**
45
+ * Fetches GraphQL data.
46
+ * @param query - The GraphQL query.
47
+ * @param options - Optional configuration for the fetch request.
48
+ * @returns
49
+ */
50
+ fetchGraphQl<T = any>(query: string, options?: FetchOptions): Promise<{
51
+ errors?: FetchQueryError;
52
+ data: T;
53
+ }>;
54
+ /**
55
+ * Gets the configuration.
56
+ */
57
+ getConfig(): {
58
+ endpoint: string | undefined;
59
+ fetchGraphQlHeaders: Header | undefined;
60
+ };
61
+ getMethods(): {
62
+ setEndpoint: (endpoint: string) => void;
63
+ setFetchGraphQlHeader: (key: string, value: string | null) => void;
64
+ removeFetchGraphQlHeader: (key: string) => void;
65
+ setFetchGraphQlHeaders: (header: Header) => void;
66
+ fetchGraphQl: <T = any>(query: string, options?: FetchOptions | undefined) => Promise<{
67
+ errors?: FetchQueryError | undefined;
68
+ data: T;
69
+ }>;
70
+ getConfig: () => {
71
+ endpoint: string | undefined;
72
+ fetchGraphQlHeaders: Header | undefined;
73
+ };
74
+ };
75
+ }
76
+ /**
77
+ * `FetchGraphQL` is a class that extends `FetchGraphQLMesh`.
78
+ * It provides methods to get the GraphQL endpoint and headers.
79
+ *
80
+ * @class
81
+ *
82
+ */
83
+ export declare class FetchGraphQL extends FetchGraphQLMesh {
84
+ get endpoint(): string | undefined;
85
+ get fetchGraphQlHeaders(): Header;
86
+ }
87
+ /**
88
+ * Exports several methods from the `mesh` object.
89
+ *
90
+ * @property {Function} setEndpoint - Sets the GraphQL endpoint.
91
+ * @property {Function} setFetchGraphQlHeaders - Sets the GraphQL headers.
92
+ * @property {Function} setFetchGraphQlHeader - Sets a specific GraphQL header.
93
+ * @property {Function} removeFetchGraphQlHeader - Removes a specific GraphQL header.
94
+ * @property {Function} fetchGraphQl - Fetches GraphQL data.
95
+ * @property {Function} getConfig - Gets the configuration.
96
+ */
97
+ export declare const setEndpoint: (endpoint: string) => void, setFetchGraphQlHeaders: (header: Header) => void, setFetchGraphQlHeader: (key: string, value: string | null) => void, removeFetchGraphQlHeader: (key: string) => void, fetchGraphQl: <T = any>(query: string, options?: FetchOptions) => Promise<{
98
+ errors?: FetchQueryError | undefined;
99
+ data: T;
100
+ }>, getConfig: () => {
101
+ endpoint: string | undefined;
102
+ fetchGraphQlHeaders: Header | undefined;
103
+ };
104
+ export {};
105
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ export * from './message.config';
2
+ export * from './typeForms.config';
3
+ export * from './types/recaptchaBadgeSelector.config';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,8 @@
1
+ export declare const recaptchaMessage: {
2
+ failedFetch: string;
3
+ failedSetStorageConfig: string;
4
+ failedGetStorageConfig: string;
5
+ failedExecutionRecaptcha: string;
6
+ failedInitializing: string;
7
+ };
8
+ //# sourceMappingURL=message.config.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const recaptchaBadgeSelector = ".grecaptcha-badge iframe";
2
+ //# sourceMappingURL=recaptchaBadgeSelector.config.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const typeDefaultForm: Record<string, string>;
2
+ //# sourceMappingURL=typeForms.config.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const RECAPTCHA_CONFIGURATION_V3 = "query {\n recaptchaV3Config {\n is_enabled\n website_key\n minimum_score\n badge_position\n language_code\n failure_message\n forms\n theme\n } \n}";
2
+ //# sourceMappingURL=recaptchaConfig.graphql.d.ts.map
@@ -0,0 +1,42 @@
1
+ import { ReCaptchaV3Response, PropsFormTypes, ReCaptchaV3Model } from './types/recaptcha.types';
2
+
3
+ export declare const recaptchaFetchApi: {
4
+ setEndpoint: (endpoint: string) => void;
5
+ setFetchGraphQlHeader: (key: string, value: string | null) => void;
6
+ removeFetchGraphQlHeader: (key: string) => void;
7
+ setFetchGraphQlHeaders: (header: import('@adobe-commerce/fetch-graphql').Header) => void;
8
+ fetchGraphQl: <T = any>(query: string, options?: import('@adobe-commerce/fetch-graphql').FetchOptions | undefined) => Promise<{
9
+ errors?: import('@adobe-commerce/fetch-graphql').FetchQueryError | undefined;
10
+ data: T;
11
+ }>;
12
+ getConfig: () => {
13
+ endpoint: string | undefined;
14
+ fetchGraphQlHeaders: import('@adobe-commerce/fetch-graphql').Header | undefined;
15
+ };
16
+ };
17
+ export declare class RecaptchaModule {
18
+ _enableReCAPTCHA: boolean;
19
+ _recaptchaBackendEndpoint: string;
20
+ _recaptchaScriptUrl: string;
21
+ _configStorageKey: string;
22
+ _logger: boolean;
23
+ _updateBadgePosition(badgeId: string, config: ReCaptchaV3Model): Promise<void | null>;
24
+ _addRecaptchaScript(): Promise<void>;
25
+ _fetchStoreConfig(): Promise<ReCaptchaV3Response | undefined>;
26
+ _loadConfig(): Promise<ReCaptchaV3Model | null>;
27
+ setEndpoint(url: string): void;
28
+ setConfig(configList: PropsFormTypes[]): Promise<void>;
29
+ initReCaptcha(lazyLoadTimeout?: number): Promise<void>;
30
+ verifyReCaptcha(): Promise<string | undefined>;
31
+ enableLogger(logger: boolean): void;
32
+ getMethods(): {
33
+ enableLogger: (logger: boolean) => void;
34
+ setEndpoint: (url: string) => void;
35
+ setConfig: (configList: PropsFormTypes[]) => Promise<void>;
36
+ initReCaptcha: (lazyLoadTimeout?: number) => Promise<void>;
37
+ verifyReCaptcha: () => Promise<string | undefined>;
38
+ };
39
+ }
40
+ declare const initReCaptcha: (lazyLoadTimeout?: number) => Promise<void>, verifyReCaptcha: () => Promise<string | undefined>, setEndpoint: (url: string) => void, setConfig: (configList: PropsFormTypes[]) => Promise<void>, enableLogger: (logger: boolean) => void;
41
+ export { setEndpoint, setConfig, initReCaptcha, verifyReCaptcha, enableLogger };
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const checkRecaptchaBadge: () => Promise<boolean>;
2
+ //# sourceMappingURL=_checkRecaptchaBadge.d.ts.map
@@ -0,0 +1,6 @@
1
+ export declare const convertKeysToCamelCase: (obj: {
2
+ [key: string]: any;
3
+ }) => {
4
+ [key: string]: string | number | boolean;
5
+ };
6
+ //# sourceMappingURL=_convertKeysToCamelCase.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { ReCaptchaV3Model } from '../types/recaptcha.types';
2
+
3
+ export declare const extendConfig: (config: ReCaptchaV3Model, modifyParams: any[]) => ReCaptchaV3Model | undefined;
4
+ //# sourceMappingURL=_extendConfig.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { ReCaptchaV3Model } from '../types/recaptcha.types';
2
+
3
+ declare const getConfigStorage: (storageKey: string, retries?: number, delay?: number) => Promise<ReCaptchaV3Model | null>;
4
+ declare const setConfigStorage: (storageKey: string, config: ReCaptchaV3Model, logger: boolean) => null | undefined;
5
+ export { getConfigStorage, setConfigStorage };
6
+ //# sourceMappingURL=_storageConfig.d.ts.map
@@ -0,0 +1,5 @@
1
+ export * from './_extendConfig';
2
+ export * from './_storageConfig';
3
+ export * from './_checkRecaptchaBadge';
4
+ export * from './_convertKeysToCamelCase';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { ReCaptchaV3Model } from '../types/recaptcha.types';
2
+
3
+ export declare const getRecaptchaToken: (websiteKey: string) => Promise<string>;
4
+ export declare const waitForReCaptcha: () => Promise<unknown>;
5
+ export declare const verifyReCaptchaLoad: (badgeId: string, config: ReCaptchaV3Model, logger: boolean) => Promise<void>;
6
+ //# sourceMappingURL=recaptcha.service.d.ts.map