@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.
- package/.elsie.js +1 -1
- package/bin/builders/generate/component/templates/Component.js +1 -1
- package/bin/builders/generate/component/templates/unit-test.js +1 -1
- package/bin/builders/generate/container/templates/Component.js +1 -1
- package/bin/builders/generate/container/templates/unit-test.js +1 -1
- package/config/eslint.js +8 -8
- package/config/jest.js +3 -3
- package/config/storybook/components/FileTree/index.js +1 -1
- package/config/storybook/components/Flex/index.js +1 -1
- package/config/storybook/components/OptionsTable/index.js +1 -1
- package/config/storybook/components/Panel/index.ts +1 -1
- package/config/storybook/components/Screenshot/index.js +1 -1
- package/config/storybook/components/Steps/index.js +1 -1
- package/config/storybook/components/StoryWrapper/index.js +1 -1
- package/config/storybook/components/Summary/index.js +1 -1
- package/config/storybook/components/Variants/index.js +1 -1
- package/config/vite.mjs +12 -12
- package/dist/recaptcha.js +2 -2
- package/dist/signals.js +1 -1
- package/dist/types/elsie/src/components/Icon/Icon.d.ts +1 -1
- package/dist/types/event-bus/src/events-catalog.d.ts +16 -0
- package/dist/types/event-bus/src/index.d.ts +53 -0
- package/dist/types/fetch-graphql/src/index.d.ts +105 -0
- package/dist/types/recaptcha/src/configs/index.d.ts +4 -0
- package/dist/types/recaptcha/src/configs/message.config.d.ts +8 -0
- package/dist/types/recaptcha/src/configs/recaptchaBadgeSelector.config.d.ts +2 -0
- package/dist/types/recaptcha/src/configs/typeForms.config.d.ts +2 -0
- package/dist/types/recaptcha/src/graphql/recaptchaConfig.graphql.d.ts +2 -0
- package/dist/types/recaptcha/src/index.d.ts +42 -0
- package/dist/types/recaptcha/src/lib/_checkRecaptchaBadge.d.ts +2 -0
- package/dist/types/recaptcha/src/lib/_convertKeysToCamelCase.d.ts +6 -0
- package/dist/types/recaptcha/src/lib/_extendConfig.d.ts +4 -0
- package/dist/types/recaptcha/src/lib/_storageConfig.d.ts +6 -0
- package/dist/types/recaptcha/src/lib/index.d.ts +5 -0
- package/dist/types/recaptcha/src/services/recaptcha.service.d.ts +6 -0
- package/package.json +2 -3
- package/src/components/Accordion/Accordion.stories.tsx +3 -3
- package/src/components/Accordion/Accordion.tsx +5 -5
- package/src/components/Accordion/index.ts +2 -2
- package/src/components/ActionButton/ActionButton.stories.tsx +4 -4
- package/src/components/ActionButton/ActionButton.tsx +2 -2
- package/src/components/ActionButton/index.ts +1 -1
- package/src/components/ActionButtonGroup/ActionButtonGroup.stories.tsx +3 -3
- package/src/components/ActionButtonGroup/ActionButtonGroup.tsx +3 -3
- package/src/components/ActionButtonGroup/index.ts +1 -1
- package/src/components/AlertBanner/AlertBanner.stories.tsx +2 -2
- package/src/components/AlertBanner/AlertBanner.tsx +5 -5
- package/src/components/AlertBanner/index.ts +2 -2
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +5 -5
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +2 -2
- package/src/components/Breadcrumbs/index.ts +2 -2
- package/src/components/Button/Button.mdx +2 -2
- package/src/components/Button/Button.stories.tsx +4 -4
- package/src/components/Button/Button.tsx +2 -2
- package/src/components/Button/index.ts +2 -2
- package/src/components/Card/Card.stories.tsx +2 -2
- package/src/components/Card/Card.tsx +2 -2
- package/src/components/Card/index.ts +1 -1
- package/src/components/CartItem/CartItem.stories.tsx +2 -2
- package/src/components/CartItem/CartItem.tsx +5 -5
- package/src/components/CartItem/CartItemSkeleton.tsx +1 -1
- package/src/components/CartItem/index.ts +3 -3
- package/src/components/CartList/CartList.stories.tsx +1 -1
- package/src/components/CartList/CartList.tsx +2 -2
- package/src/components/CartList/index.ts +2 -2
- package/src/components/Checkbox/Checkbox.stories.tsx +2 -2
- package/src/components/Checkbox/Checkbox.tsx +4 -4
- package/src/components/Checkbox/index.ts +1 -1
- package/src/components/ColorSwatch/ColorSwatch.stories.tsx +2 -2
- package/src/components/ColorSwatch/ColorSwatch.tsx +3 -3
- package/src/components/ColorSwatch/index.ts +2 -2
- package/src/components/ContentGrid/ContentGrid.stories.tsx +1 -1
- package/src/components/ContentGrid/ContentGrid.tsx +2 -2
- package/src/components/ContentGrid/index.ts +2 -2
- package/src/components/Divider/Divider.stories.tsx +1 -1
- package/src/components/Divider/Divider.tsx +2 -2
- package/src/components/Divider/index.ts +2 -2
- package/src/components/Field/Field.stories.tsx +9 -9
- package/src/components/Field/Field.tsx +2 -2
- package/src/components/Field/index.ts +1 -1
- package/src/components/Header/Header.stories.tsx +2 -2
- package/src/components/Header/Header.tsx +3 -3
- package/src/components/Header/index.ts +2 -2
- package/src/components/Icon/Icon.stories.helpers.jsx +1 -1
- package/src/components/Icon/Icon.stories.tsx +4 -4
- package/src/components/Icon/Icon.tsx +45 -45
- package/src/components/Icon/index.ts +1 -1
- package/src/components/IllustratedMessage/IllustratedMessage.stories.tsx +4 -4
- package/src/components/IllustratedMessage/IllustratedMessage.tsx +3 -3
- package/src/components/IllustratedMessage/index.ts +2 -2
- package/src/components/Image/Image.stories.tsx +2 -2
- package/src/components/Image/Image.tsx +2 -2
- package/src/components/Image/index.ts +1 -1
- package/src/components/ImageSwatch/ImageSwatch.stories.tsx +2 -2
- package/src/components/ImageSwatch/ImageSwatch.tsx +4 -4
- package/src/components/ImageSwatch/index.ts +2 -2
- package/src/components/InLineAlert/InLineAlert.stories.tsx +4 -4
- package/src/components/InLineAlert/InLineAlert.tsx +5 -5
- package/src/components/InLineAlert/index.ts +2 -2
- package/src/components/Incrementer/Incrementer.stories.tsx +1 -1
- package/src/components/Incrementer/Incrementer.tsx +5 -5
- package/src/components/Incrementer/index.ts +1 -1
- package/src/components/Input/Input.stories.tsx +4 -4
- package/src/components/Input/Input.tsx +4 -4
- package/src/components/Input/index.ts +2 -2
- package/src/components/InputDate/InputDate.stories.tsx +1 -1
- package/src/components/InputDate/InputDate.tsx +5 -5
- package/src/components/InputDate/index.ts +2 -2
- package/src/components/InputPassword/InputPassword.stories.tsx +1 -1
- package/src/components/InputPassword/InputPassword.tsx +5 -5
- package/src/components/InputPassword/PasswordStatusIndicator/PasswordStatusIndicator.tsx +4 -4
- package/src/components/InputPassword/PasswordStatusIndicator/index.ts +2 -2
- package/src/components/InputPassword/index.ts +2 -2
- package/src/components/Modal/Modal.tsx +4 -4
- package/src/components/Modal/index.ts +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +2 -2
- package/src/components/Pagination/Pagination.tsx +5 -5
- package/src/components/Pagination/index.ts +2 -2
- package/src/components/Picker/Picker.stories.tsx +2 -2
- package/src/components/Picker/Picker.tsx +4 -4
- package/src/components/Picker/index.ts +1 -1
- package/src/components/Price/Price.stories.tsx +2 -2
- package/src/components/Price/Price.tsx +2 -2
- package/src/components/Price/index.ts +1 -1
- package/src/components/PriceRange/PriceRange.stories.tsx +2 -2
- package/src/components/PriceRange/PriceRange.tsx +4 -4
- package/src/components/PriceRange/index.ts +2 -2
- package/src/components/ProgressSpinner/ProgressSpinner.stories.tsx +3 -3
- package/src/components/ProgressSpinner/ProgressSpinner.tsx +3 -3
- package/src/components/ProgressSpinner/index.ts +2 -2
- package/src/components/RadioButton/RadioButton.stories.tsx +2 -2
- package/src/components/RadioButton/RadioButton.tsx +2 -2
- package/src/components/RadioButton/index.ts +2 -2
- package/src/components/Skeleton/Skeleton.stories.tsx +1 -1
- package/src/components/Skeleton/Skeleton.tsx +2 -2
- package/src/components/Skeleton/index.ts +1 -1
- package/src/components/Tag/Tag.stories.tsx +1 -1
- package/src/components/Tag/Tag.tsx +2 -2
- package/src/components/Tag/index.ts +2 -2
- package/src/components/TextArea/TextArea.stories.tsx +1 -1
- package/src/components/TextArea/TextArea.tsx +2 -2
- package/src/components/TextArea/index.ts +2 -2
- package/src/components/TextSwatch/TextSwatch.stories.tsx +2 -2
- package/src/components/TextSwatch/TextSwatch.tsx +3 -3
- package/src/components/TextSwatch/index.ts +2 -2
- package/src/components/ToggleButton/ToggleButton.stories.tsx +3 -3
- package/src/components/ToggleButton/ToggleButton.tsx +3 -3
- package/src/components/ToggleButton/index.ts +2 -2
- package/src/components/UIProvider/UIProvider.tsx +4 -4
- package/src/components/UIProvider/index.ts +1 -1
- package/src/components/index.ts +40 -40
- package/src/docs/API/event-bus.mdx +1 -1
- package/src/docs/API/graphql.mdx +3 -3
- package/src/docs/API/initializer.mdx +2 -2
- package/src/docs/API/render.mdx +2 -2
- package/src/docs/Design/colors.mdx +1 -1
- package/src/docs/Design/grid.mdx +2 -2
- package/src/docs/Design/overview.mdx +6 -6
- package/src/docs/Design/shapes.mdx +3 -3
- package/src/docs/Design/spacing.mdx +1 -1
- package/src/docs/Design/typography.mdx +1 -1
- package/src/docs/Utilities/classList.mdx +2 -2
- package/src/docs/Utilities/debounce.mdx +1 -1
- package/src/docs/Utilities/getFormErrors.mdx +1 -1
- package/src/docs/Utilities/getFormValues.mdx +1 -1
- package/src/docs/components/overview.mdx +3 -3
- package/src/docs/quick-start.mdx +3 -3
- package/src/docs/slots.mdx +1 -1
- package/src/docs/welcome.mdx +4 -4
- package/src/i18n/index.ts +2 -2
- package/src/lib/index.ts +15 -15
- package/src/lib/initializer.ts +1 -1
- package/src/lib/render.tsx +2 -2
- package/src/lib/resolve-image.ts +1 -1
- package/src/lib/slot.tsx +2 -2
- package/src/lib/tests.tsx +1 -1
package/.elsie.js
CHANGED
|
@@ -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
|
|
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
|
-
}`,
|
|
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
|
|
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,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,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,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
|