@dropins/tools 1.0.0-alpha1 → 1.0.0-alpha2

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/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/tools", "version": "1.0.0-alpha1", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/tools", "version": "1.0.0-alpha2", "license": "SEE LICENSE IN LICENSE.md"}
package/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};
@@ -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