@dropins/storefront-auth 2.2.0-beta1 → 3.0.0-beta1

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/chunks/Button2.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as s,jsxs as f}from"@dropins/tools/preact-jsx-runtime.js";import{useState as g,useCallback as l}from"@dropins/tools/preact-hooks.js";import*as t from"@dropins/tools/preact-compat.js";import{classes as d}from"@dropins/tools/lib.js";import{Button as w}from"@dropins/tools/components.js";import"./Button.js";const M=e=>{if(!e)return null;const r=new FormData(e);if(r&&typeof r.entries=="function"){const n=r.entries();if(n&&typeof n[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(n)))||{}}return{}},S=e=>typeof e=="function",E=e=>t.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("g",{clipPath:"url(#clip0_841_1324)"},t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_841_1324"},t.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),v=e=>t.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),L=e=>t.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),k={success:s(v,{}),warning:s(E,{}),error:s(L,{})},b=()=>{const[e,r]=g({}),n=l(o=>{if(!o||!o.type){r({});return}const c=k[o.type];r({...o,icon:c})},[]);return{inLineAlertProps:e,handleSetInLineAlertProps:n}},y=({type:e,buttonText:r,variant:n,className:o="",enableLoader:c=!1,onClick:a,style:i,icon:u,...h})=>{const m=l(p=>{a==null||a(p)},[a]);return f(w,{icon:u,style:i,type:e,variant:n,className:d(["auth-button",o,c?"enableLoader":""]),onClick:m,...h,children:[s("span",{className:"auth-button__text",children:r}),c?s("div",{className:"auth-button__wrapper",children:s("span",{className:"auth-button__loader"})}):null]})};export{y as B,S as c,M as g,b as u};
3
+ import{jsx as s,jsxs as f}from"@dropins/tools/preact-jsx-runtime.js";import{useState as g,useCallback as i}from"@dropins/tools/preact-hooks.js";import*as t from"@dropins/tools/preact-compat.js";import{classes as d}from"@dropins/tools/lib.js";import{Button as w}from"@dropins/tools/components.js";import"./Button.js";const M=e=>{if(!e)return null;const r=new FormData(e);if(r&&typeof r.entries=="function"){const n=r.entries();if(n&&typeof n[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(n)))||{}}return{}},S=e=>typeof e=="function",E=e=>t.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),k=e=>t.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("g",{clipPath:"url(#clip0_841_1324)"},t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_841_1324"},t.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)",strokeWidth:1})))),v=e=>t.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),L={success:s(E,{}),warning:s(k,{}),error:s(v,{})},W=()=>{const[e,r]=g({}),n=i(o=>{if(!o||!o.type){r({});return}const c=L[o.type];r({...o,icon:c})},[]);return{inLineAlertProps:e,handleSetInLineAlertProps:n}},b=({type:e,buttonText:r,variant:n,className:o="",enableLoader:c=!1,onClick:a,style:l,icon:u,...h})=>{const m=i(p=>{a==null||a(p)},[a]);return f(w,{icon:u,style:l,type:e,variant:n,className:d(["auth-button",o,c?"enableLoader":""]),onClick:m,...h,children:[s("span",{className:"auth-button__text",children:r}),c?s("div",{className:"auth-button__wrapper",children:s("span",{className:"auth-button__loader"})}):null]})};export{b as B,S as c,M as g,W as u};
4
4
  //# sourceMappingURL=Button2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button2.js","sources":["/@dropins/storefront-auth/src/lib/getFormValues.ts","/@dropins/storefront-auth/src/lib/checkIsFunction.ts","../../node_modules/@adobe-commerce/elsie/src/icons/Warning.svg","../../node_modules/@adobe-commerce/elsie/src/icons/CheckWithCircle.svg","../../node_modules/@adobe-commerce/elsie/src/icons/WarningWithCircle.svg","/@dropins/storefront-auth/src/hooks/useInLineAlert.tsx","/@dropins/storefront-auth/src/components/Button/Button.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const getFormValues = (form: any) => {\n if (!form) return null;\n\n const formData = new FormData(form);\n\n if (formData && typeof formData.entries === 'function') {\n const entries = formData.entries();\n if (entries && typeof entries[Symbol.iterator] === 'function') {\n return JSON.parse(JSON.stringify(Object.fromEntries(entries))) || {};\n }\n }\n return {};\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const checkIsFunction = (value: any): value is Function => {\n return typeof value === 'function';\n};\n","import * as React from \"react\";\nconst SvgWarning = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Warning_Base\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_841_1324)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_841_1324\" }, /* @__PURE__ */ React.createElement(\"rect\", { width: 24, height: 21, fill: \"white\", transform: \"translate(0 1.5)\" }))));\nexport default SvgWarning;\n","import * as React from \"react\";\nconst SvgCheckWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M6.75 12.762L10.2385 15.75L17.25 9\", stroke: \"currentColor\" }));\nexport default SvgCheckWithCircle;\n","import * as React from \"react\";\nconst SvgWarningWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z\", stroke: \"currentColor\" }));\nexport default SvgWarningWithCircle;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useState, useCallback } from 'preact/hooks';\nimport { InLineAlertInterface } from '../types';\nimport {\n CheckWithCircle as Success,\n Warning,\n WarningWithCircle as Error,\n} from '@adobe-commerce/elsie/icons';\n\nconst iconsList = {\n success: <Success />,\n warning: <Warning />,\n error: <Error />,\n};\n\nexport const useInLineAlert = () => {\n const [inLineAlertProps, setInLineAlertProps] =\n useState<InLineAlertInterface>({});\n\n const handleSetInLineAlertProps = useCallback(\n (notification: InLineAlertInterface | undefined) => {\n if (!notification || !notification.type) {\n setInLineAlertProps({});\n return;\n }\n\n const icon = iconsList[notification.type];\n\n setInLineAlertProps({\n ...notification,\n icon,\n });\n },\n []\n );\n\n return { inLineAlertProps, handleSetInLineAlertProps };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { useCallback } from 'preact/hooks';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Button as ElsieButton } from '@adobe-commerce/elsie/components';\nimport '@/auth/components/Button/Button.css';\n\nexport interface ButtonProps {\n type: 'submit' | 'button';\n variant?: 'primary' | 'secondary' | 'tertiary';\n className?: string;\n buttonText: string;\n enableLoader?: boolean;\n onClick?: (event: MouseEvent) => void;\n style?: Record<string, string | number>;\n icon?: VNode<HTMLAttributes<SVGSVGElement>>;\n disabled?: boolean;\n}\n\nexport const Button: FunctionComponent<ButtonProps> = ({\n type,\n buttonText,\n variant,\n className = '',\n enableLoader = false,\n onClick,\n style,\n icon,\n ...props\n}) => {\n const handleOnclick = useCallback(\n (event: MouseEvent) => {\n onClick?.(event);\n },\n [onClick]\n );\n\n const isLoader = enableLoader ? 'enableLoader' : '';\n\n return (\n <ElsieButton\n icon={icon}\n style={style}\n type={type}\n variant={variant}\n className={classes(['auth-button', className, isLoader])}\n onClick={handleOnclick}\n {...props}\n >\n <span className=\"auth-button__text\">{buttonText}</span>\n {enableLoader ? (\n <div className=\"auth-button__wrapper\">\n <span className=\"auth-button__loader\" />\n </div>\n ) : null}\n </ElsieButton>\n );\n};\n"],"names":["getFormValues","form","formData","entries","checkIsFunction","value","SvgWarning","props","React","SvgCheckWithCircle","SvgWarningWithCircle","iconsList","Success","Warning","Error","useInLineAlert","inLineAlertProps","setInLineAlertProps","useState","handleSetInLineAlertProps","useCallback","notification","icon","Button","type","buttonText","variant","className","enableLoader","onClick","style","handleOnclick","event","jsxs","ElsieButton","classes","jsx"],"mappings":"4TAiBO,MAAMA,EAAiBC,GAAc,CAC1C,GAAI,CAACA,EAAM,OAAO,KAElB,MAAMC,EAAW,IAAI,SAASD,CAAI,EAElC,GAAIC,GAAY,OAAOA,EAAS,SAAY,WAAY,CACtD,MAAMC,EAAUD,EAAS,QAAA,EACzB,GAAIC,GAAW,OAAOA,EAAQ,OAAO,QAAQ,GAAM,WACjD,OAAO,KAAK,MAAM,KAAK,UAAU,OAAO,YAAYA,CAAO,CAAC,CAAC,GAAK,CAAA,CAEtE,CACA,MAAO,CAAA,CACT,ECZaC,EAAmBC,GACvB,OAAOA,GAAU,WCjBpBC,EAAcC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,oBAAqB,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAK,EAAoBC,EAAM,cAAc,IAAK,CAAE,SAAU,wBAA0CA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,6DAA8D,OAAQ,eAAgB,cAAe,QAAS,eAAgB,OAAO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,IAAI,EAExCJ,EAAoB,CAClB,GAAGI,EACH,KAAAC,CAAA,CACD,CACH,EACA,CAAA,CAAC,EAGH,MAAO,CAAE,iBAAAN,EAAkB,0BAAAG,CAAA,CAC7B,ECjBaI,EAAyC,CAAC,CACrD,KAAAC,EACA,WAAAC,EACA,QAAAC,EACA,UAAAC,EAAY,GACZ,aAAAC,EAAe,GACf,QAAAC,EACA,MAAAC,EACA,KAAAR,EACA,GAAGf,CACL,IAAM,CACJ,MAAMwB,EAAgBX,EACnBY,GAAsB,CACrBH,GAAA,MAAAA,EAAUG,EACZ,EACA,CAACH,CAAO,CAAA,EAKV,OACEI,EAACC,EAAA,CACC,KAAAZ,EACA,MAAAQ,EACA,KAAAN,EACA,QAAAE,EACA,UAAWS,EAAQ,CAAC,cAAeR,EARtBC,EAAe,eAAiB,EAQS,CAAC,EACvD,QAASG,EACR,GAAGxB,EAEJ,SAAA,CAAA6B,EAAC,OAAA,CAAK,UAAU,oBAAqB,SAAAX,EAAW,EAC/CG,EACCQ,EAAC,MAAA,CAAI,UAAU,uBACb,WAAC,OAAA,CAAK,UAAU,qBAAA,CAAsB,CAAA,CACxC,EACE,IAAA,CAAA,CAAA,CAGV","x_google_ignoreList":[2,3,4]}
1
+ {"version":3,"file":"Button2.js","sources":["/@dropins/storefront-auth/src/lib/getFormValues.ts","/@dropins/storefront-auth/src/lib/checkIsFunction.ts","../../node_modules/@adobe-commerce/elsie/src/icons/CheckWithCircle.svg","../../node_modules/@adobe-commerce/elsie/src/icons/Warning.svg","../../node_modules/@adobe-commerce/elsie/src/icons/WarningWithCircle.svg","/@dropins/storefront-auth/src/hooks/useInLineAlert.tsx","/@dropins/storefront-auth/src/components/Button/Button.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const getFormValues = (form: any) => {\n if (!form) return null;\n\n const formData = new FormData(form);\n\n if (formData && typeof formData.entries === 'function') {\n const entries = formData.entries();\n if (entries && typeof entries[Symbol.iterator] === 'function') {\n return JSON.parse(JSON.stringify(Object.fromEntries(entries))) || {};\n }\n }\n return {};\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const checkIsFunction = (value: any): value is Function => {\n return typeof value === 'function';\n};\n","import * as React from \"react\";\nconst SvgCheckWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M6.75 12.762L10.2385 15.75L17.25 9\", stroke: \"currentColor\" }));\nexport default SvgCheckWithCircle;\n","import * as React from \"react\";\nconst SvgWarning = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Warning_Base\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_841_1324)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"round\", strokeLinejoin: \"round\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_841_1324\" }, /* @__PURE__ */ React.createElement(\"rect\", { width: 24, height: 21, fill: \"white\", transform: \"translate(0 1.5)\", strokeWidth: 1 }))));\nexport default SvgWarning;\n","import * as React from \"react\";\nconst SvgWarningWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z\", stroke: \"currentColor\" }));\nexport default SvgWarningWithCircle;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useState, useCallback } from 'preact/hooks';\nimport { InLineAlertInterface } from '../types';\nimport {\n CheckWithCircle as Success,\n Warning,\n WarningWithCircle as Error,\n} from '@adobe-commerce/elsie/icons';\n\nconst iconsList = {\n success: <Success />,\n warning: <Warning />,\n error: <Error />,\n};\n\nexport const useInLineAlert = () => {\n const [inLineAlertProps, setInLineAlertProps] =\n useState<InLineAlertInterface>({});\n\n const handleSetInLineAlertProps = useCallback(\n (notification: InLineAlertInterface | undefined) => {\n if (!notification || !notification.type) {\n setInLineAlertProps({});\n return;\n }\n\n const icon = iconsList[notification.type];\n\n setInLineAlertProps({\n ...notification,\n icon,\n });\n },\n []\n );\n\n return { inLineAlertProps, handleSetInLineAlertProps };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { useCallback } from 'preact/hooks';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Button as ElsieButton } from '@adobe-commerce/elsie/components';\nimport '@/auth/components/Button/Button.css';\n\nexport interface ButtonProps {\n type: 'submit' | 'button';\n variant?: 'primary' | 'secondary' | 'tertiary';\n className?: string;\n buttonText: string;\n enableLoader?: boolean;\n onClick?: (event: MouseEvent) => void;\n style?: Record<string, string | number>;\n icon?: VNode<HTMLAttributes<SVGSVGElement>>;\n disabled?: boolean;\n}\n\nexport const Button: FunctionComponent<ButtonProps> = ({\n type,\n buttonText,\n variant,\n className = '',\n enableLoader = false,\n onClick,\n style,\n icon,\n ...props\n}) => {\n const handleOnclick = useCallback(\n (event: MouseEvent) => {\n onClick?.(event);\n },\n [onClick]\n );\n\n const isLoader = enableLoader ? 'enableLoader' : '';\n\n return (\n <ElsieButton\n icon={icon}\n style={style}\n type={type}\n variant={variant}\n className={classes(['auth-button', className, isLoader])}\n onClick={handleOnclick}\n {...props}\n >\n <span className=\"auth-button__text\">{buttonText}</span>\n {enableLoader ? (\n <div className=\"auth-button__wrapper\">\n <span className=\"auth-button__loader\" />\n </div>\n ) : null}\n </ElsieButton>\n );\n};\n"],"names":["getFormValues","form","formData","entries","checkIsFunction","value","SvgCheckWithCircle","props","React","SvgWarning","SvgWarningWithCircle","iconsList","Success","Warning","Error","useInLineAlert","inLineAlertProps","setInLineAlertProps","useState","handleSetInLineAlertProps","useCallback","notification","icon","Button","type","buttonText","variant","className","enableLoader","onClick","style","handleOnclick","event","jsxs","ElsieButton","classes","jsx"],"mappings":"4TAiBO,MAAMA,EAAiBC,GAAc,CAC1C,GAAI,CAACA,EAAM,OAAO,KAElB,MAAMC,EAAW,IAAI,SAASD,CAAI,EAElC,GAAIC,GAAY,OAAOA,EAAS,SAAY,WAAY,CACtD,MAAMC,EAAUD,EAAS,QAAA,EACzB,GAAIC,GAAW,OAAOA,EAAQ,OAAO,QAAQ,GAAM,WACjD,OAAO,KAAK,MAAM,KAAK,UAAU,OAAO,YAAYA,CAAO,CAAC,CAAC,GAAK,CAAA,CAEtE,CACA,MAAO,CAAA,CACT,ECZaC,EAAmBC,GACvB,OAAOA,GAAU,WCjBpBC,EAAsBC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,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AM,CAChB,EAEaC,EAAiB,IAAM,CAClC,KAAM,CAACC,EAAkBC,CAAmB,EAC1CC,EAA+B,CAAA,CAAE,EAE7BC,EAA4BC,EAC/BC,GAAmD,CAClD,GAAI,CAACA,GAAgB,CAACA,EAAa,KAAM,CACvCJ,EAAoB,CAAA,CAAE,EACtB,MACF,CAEA,MAAMK,EAAOX,EAAUU,EAAa,IAAI,EAExCJ,EAAoB,CAClB,GAAGI,EACH,KAAAC,CAAA,CACD,CACH,EACA,CAAA,CAAC,EAGH,MAAO,CAAE,iBAAAN,EAAkB,0BAAAG,CAAA,CAC7B,ECjBaI,EAAyC,CAAC,CACrD,KAAAC,EACA,WAAAC,EACA,QAAAC,EACA,UAAAC,EAAY,GACZ,aAAAC,EAAe,GACf,QAAAC,EACA,MAAAC,EACA,KAAAR,EACA,GAAGf,CACL,IAAM,CACJ,MAAMwB,EAAgBX,EACnBY,GAAsB,CACrBH,GAAA,MAAAA,EAAUG,EACZ,EACA,CAACH,CAAO,CAAA,EAKV,OACEI,EAACC,EAAA,CACC,KAAAZ,EACA,MAAAQ,EACA,KAAAN,EACA,QAAAE,EACA,UAAWS,EAAQ,CAAC,cAAeR,EARtBC,EAAe,eAAiB,EAQS,CAAC,EACvD,QAASG,EACR,GAAGxB,EAEJ,SAAA,CAAA6B,EAAC,OAAA,CAAK,UAAU,oBAAqB,SAAAX,EAAW,EAC/CG,EACCQ,EAAC,MAAA,CAAI,UAAU,uBACb,WAAC,OAAA,CAAK,UAAU,qBAAA,CAAsB,CAAA,CACxC,EACE,IAAA,CAAA,CAAA,CAGV","x_google_ignoreList":[2,3,4]}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as l,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import{classes as h}from"@dropins/tools/lib.js";import{v as _,F}from"./Button.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as P}from"./requestPasswordResetEmail.js";import{g as v,c as p,u as x,B as g}from"./Button2.js";import{useState as N,useCallback as y}from"@dropins/tools/preact-hooks.js";import{useText as b}from"@dropins/tools/i18n.js";import{Header as E,InLineAlert as L}from"@dropins/tools/components.js";import{s as T,D}from"./simplifyTransformAttributesForm.js";import*as R from"@dropins/tools/preact-compat.js";const A=t=>R.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},R.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),j=({routeSignIn:t,onErrorCallback:o,onSuccessCallback:m,setActiveComponent:n,handleSetInLineAlertProps:s})=>{const u=b({successPasswordResetEmailNotification:"Auth.Notification.successPasswordResetEmailNotification"}),[i,e]=N(!1),f=y(async c=>{c.preventDefault();const r=v(c.target);if(!_(r==null?void 0:r.email))return;e(!0);const w=await P(r.email);if(e(!1),!w.success){o==null||o(w),s==null||s({type:"error",text:w.message});return}if(m){await m();return}s==null||s({type:"success",text:u.successPasswordResetEmailNotification.replace("{email}",r.email)})},[s,o,m,u.successPasswordResetEmailNotification]),d=y(()=>{if(p(n)){n("signInForm");return}p(t)&&(window.location.href=t())},[n,t]);return{isLoading:i,submitResetPassword:f,redirectToSignInPage:d}},J=({formSize:t="default",routeSignIn:o,setActiveComponent:m,onErrorCallback:n,onSuccessCallback:s,...u})=>{const i=b({title:"Auth.ResetPasswordForm.title",buttonPrimary:"Auth.ResetPasswordForm.buttonPrimary",buttonSecondary:"Auth.ResetPasswordForm.buttonSecondary",formAriaLabel:"Auth.ResetPasswordForm.formAriaLabel"}),{inLineAlertProps:e,handleSetInLineAlertProps:f}=x(),{isLoading:d,submitResetPassword:c,redirectToSignInPage:r}=j({routeSignIn:o,setActiveComponent:m,onErrorCallback:n,onSuccessCallback:s,handleSetInLineAlertProps:f});return l("div",{...u,className:h(["auth-reset-password-form",`auth-reset-password-form--${t}`]),"data-testid":"resetPasswordForm",children:[a(E,{title:i.title,divider:!1,className:"auth-reset-password-form__title"}),e.text?a(L,{className:"auth-reset-password-form__notification",type:e.type,variant:"secondary",heading:e.text,icon:e.icon}):null,a(F,{"aria-labelledby":i.formAriaLabel,name:"resetPassword_form",className:"auth-reset-password-form__form",onSubmit:c,loading:d,fieldsConfig:T(D),children:l("div",{className:"auth-reset-password-form__buttons",children:[a(g,{className:"auth-reset-password-form__buttons--signin",type:"button",variant:"tertiary",style:{padding:"0"},icon:a(A,{style:{transform:"rotate(90deg)"}}),buttonText:i.buttonSecondary,enableLoader:!1,onClick:r}),a(g,{type:"submit",buttonText:i.buttonPrimary,variant:"primary",enableLoader:d})]})}),a("div",{id:"requestPasswordResetEmail"})]})};export{J as R};
3
+ import{jsxs as l,jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{classes as h}from"@dropins/tools/lib.js";import{v as _,F}from"./Button.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{r as P}from"./requestPasswordResetEmail.js";import{g as v,c as p,u as x,B as g}from"./Button2.js";import{useState as N,useCallback as y}from"@dropins/tools/preact-hooks.js";import{useText as b}from"@dropins/tools/i18n.js";import{Header as E,InLineAlert as L}from"@dropins/tools/components.js";import{s as T,D}from"./simplifyTransformAttributesForm.js";import*as R from"@dropins/tools/preact-compat.js";const A=s=>R.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},R.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1,strokeLinecap:"square",strokeLinejoin:"round"})),j=({routeSignIn:s,onErrorCallback:a,onSuccessCallback:m,setActiveComponent:n,handleSetInLineAlertProps:t})=>{const c=b({successPasswordResetEmailNotification:"Auth.Notification.successPasswordResetEmailNotification"}),[i,e]=N(!1),f=y(async d=>{d.preventDefault();const r=v(d.target);if(!_(r==null?void 0:r.email))return;e(!0);const w=await P(r.email);if(e(!1),!w.success){a==null||a(w),t==null||t({type:"error",text:w.message});return}if(m){await m();return}t==null||t({type:"success",text:c.successPasswordResetEmailNotification.replace("{email}",r.email)})},[t,a,m,c.successPasswordResetEmailNotification]),u=y(()=>{if(p(n)){n("signInForm");return}p(s)&&(window.location.href=s())},[n,s]);return{isLoading:i,submitResetPassword:f,redirectToSignInPage:u}},J=({formSize:s="default",routeSignIn:a,setActiveComponent:m,onErrorCallback:n,onSuccessCallback:t,...c})=>{const i=b({title:"Auth.ResetPasswordForm.title",buttonPrimary:"Auth.ResetPasswordForm.buttonPrimary",buttonSecondary:"Auth.ResetPasswordForm.buttonSecondary",formAriaLabel:"Auth.ResetPasswordForm.formAriaLabel"}),{inLineAlertProps:e,handleSetInLineAlertProps:f}=x(),{isLoading:u,submitResetPassword:d,redirectToSignInPage:r}=j({routeSignIn:a,setActiveComponent:m,onErrorCallback:n,onSuccessCallback:t,handleSetInLineAlertProps:f});return l("div",{...c,className:h(["auth-reset-password-form",`auth-reset-password-form--${s}`]),"data-testid":"resetPasswordForm",children:[o(E,{title:i.title,divider:!1,className:"auth-reset-password-form__title"}),e.text?o(L,{className:"auth-reset-password-form__notification",type:e.type,variant:"secondary",heading:e.text,icon:e.icon}):null,o(F,{"aria-labelledby":i.formAriaLabel,name:"resetPassword_form",className:"auth-reset-password-form__form",onSubmit:d,loading:u,fieldsConfig:T(D),children:l("div",{className:"auth-reset-password-form__buttons",children:[o(g,{className:"auth-reset-password-form__buttons--signin",type:"button",variant:"tertiary",style:{padding:"0"},icon:o(A,{style:{transform:"rotate(90deg)"}}),buttonText:i.buttonSecondary,enableLoader:!1,onClick:r}),o(g,{type:"submit",buttonText:i.buttonPrimary,variant:"primary",enableLoader:u})]})}),o("div",{id:"requestPasswordResetEmail"})]})};export{J as R};
4
4
  //# sourceMappingURL=ResetPasswordForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResetPasswordForm.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/ChevronDown.svg","/@dropins/storefront-auth/src/hooks/components/useResetPasswordForm.tsx","/@dropins/storefront-auth/src/components/ResetPasswordForm/ResetPasswordForm.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgChevronDown = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701\", stroke: \"currentColor\", strokeWidth: 1.5, strokeLinecap: \"square\", strokeLinejoin: \"round\" }));\nexport default SvgChevronDown;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { requestPasswordResetEmail } from '@/auth/api';\nimport { checkIsFunction } from '@/auth/lib/checkIsFunction';\nimport { getFormValues } from '@/auth/lib/getFormValues';\nimport { UseResetPasswordFormProps } from '@/auth/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { useCallback, useState } from 'preact/hooks';\nimport { validateEmail } from '@/auth/lib/validationFields';\n\nexport const useResetPasswordForm = ({\n routeSignIn,\n onErrorCallback,\n onSuccessCallback,\n setActiveComponent,\n handleSetInLineAlertProps,\n}: UseResetPasswordFormProps) => {\n const translations = useText({\n successPasswordResetEmailNotification:\n 'Auth.Notification.successPasswordResetEmailNotification',\n });\n const [isLoading, setIsLoading] = useState(false);\n\n const submitResetPassword = useCallback(\n async (event: any): Promise<void> => {\n event.preventDefault();\n\n const formValues = getFormValues(event.target);\n\n if (!validateEmail(formValues?.email)) {\n return;\n }\n\n setIsLoading(true);\n\n const response = await requestPasswordResetEmail(formValues.email);\n\n setIsLoading(false);\n\n if (!response.success) {\n onErrorCallback?.(response);\n handleSetInLineAlertProps?.({\n type: 'error',\n text: response.message,\n });\n return;\n }\n\n if (onSuccessCallback) {\n await onSuccessCallback();\n return;\n }\n\n handleSetInLineAlertProps?.({\n type: 'success',\n text: translations.successPasswordResetEmailNotification.replace(\n '{email}',\n formValues.email\n ),\n });\n },\n [\n handleSetInLineAlertProps,\n onErrorCallback,\n onSuccessCallback,\n translations.successPasswordResetEmailNotification,\n ]\n );\n\n const redirectToSignInPage = useCallback(() => {\n if (checkIsFunction(setActiveComponent)) {\n setActiveComponent('signInForm');\n return;\n }\n\n if (checkIsFunction(routeSignIn)) {\n window.location.href = routeSignIn();\n }\n }, [setActiveComponent, routeSignIn]);\n\n return {\n isLoading,\n submitResetPassword,\n redirectToSignInPage,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport '@/auth/components/ResetPasswordForm/ResetPasswordForm.css';\nimport { useResetPasswordForm } from '@/auth/hooks/components/useResetPasswordForm';\nimport { ResetPasswordFormProps } from '@/auth/types';\nimport { ChevronDown as ChevronLeft } from '@adobe-commerce/elsie/icons';\nimport { Form, Button } from '@/auth/components';\nimport { useInLineAlert } from '@/auth/hooks/useInLineAlert';\nimport { Header, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { simplifyTransformAttributesForm } from '@/auth/lib/simplifyTransformAttributesForm';\nimport { DEFAULT__RESET_PASSWORD_EMAIL_FIELD } from '@/auth/configs/defaultCreateUserConfigs';\n\nexport const ResetPasswordForm: FunctionComponent<\n ResetPasswordFormProps & HTMLAttributes<HTMLDivElement>\n> = ({\n formSize = 'default',\n routeSignIn,\n setActiveComponent,\n onErrorCallback,\n onSuccessCallback,\n ...props\n}) => {\n const translations = useText({\n title: 'Auth.ResetPasswordForm.title',\n buttonPrimary: 'Auth.ResetPasswordForm.buttonPrimary',\n buttonSecondary: 'Auth.ResetPasswordForm.buttonSecondary',\n formAriaLabel: 'Auth.ResetPasswordForm.formAriaLabel',\n });\n\n const { inLineAlertProps, handleSetInLineAlertProps } = useInLineAlert();\n\n const { isLoading, submitResetPassword, redirectToSignInPage } =\n useResetPasswordForm({\n routeSignIn,\n setActiveComponent,\n onErrorCallback,\n onSuccessCallback,\n handleSetInLineAlertProps,\n });\n\n return (\n <div\n {...props}\n className={classes([\n 'auth-reset-password-form',\n `auth-reset-password-form--${formSize}`,\n ])}\n data-testid=\"resetPasswordForm\"\n >\n <Header\n title={translations.title}\n divider={false}\n className=\"auth-reset-password-form__title\"\n />\n {inLineAlertProps.text ? (\n <InLineAlert\n className=\"auth-reset-password-form__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n />\n ) : null}\n <Form\n aria-labelledby={translations.formAriaLabel}\n name=\"resetPassword_form\"\n className=\"auth-reset-password-form__form\"\n onSubmit={submitResetPassword}\n loading={isLoading}\n fieldsConfig={simplifyTransformAttributesForm(\n DEFAULT__RESET_PASSWORD_EMAIL_FIELD\n )}\n >\n <div className=\"auth-reset-password-form__buttons\">\n <Button\n className=\"auth-reset-password-form__buttons--signin\"\n type=\"button\"\n variant=\"tertiary\"\n style={{ padding: '0' }}\n icon={<ChevronLeft style={{ transform: 'rotate(90deg)' }} />}\n buttonText={translations.buttonSecondary}\n enableLoader={false}\n onClick={redirectToSignInPage}\n />\n <Button\n type=\"submit\"\n buttonText={translations.buttonPrimary}\n variant=\"primary\"\n enableLoader={isLoading}\n />\n </div>\n </Form>\n <div id=\"requestPasswordResetEmail\" />\n </div>\n );\n};\n"],"names":["SvgChevronDown","props","React","useResetPasswordForm","routeSignIn","onErrorCallback","onSuccessCallback","setActiveComponent","handleSetInLineAlertProps","translations","useText","isLoading","setIsLoading","useState","submitResetPassword","useCallback","event","formValues","getFormValues","validateEmail","response","requestPasswordResetEmail","redirectToSignInPage","checkIsFunction","ResetPasswordForm","formSize","inLineAlertProps","useInLineAlert","jsxs","classes","jsx","Header","InLineAlert","Form","simplifyTransformAttributesForm","DEFAULT__RESET_PASSWORD_EMAIL_FIELD","Button","ChevronLeft"],"mappings":"wnBACA,MAAMA,EAAkBC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAK,EAAoBC,EAAM,cAAc,OAAQ,CAAE,EAAG,kDAAmD,OAAQ,eAAgB,YAAa,IAAK,cAAe,SAAU,eAAgB,OAAO,CAAE,CAAC,ECwB/WC,EAAuB,CAAC,CACnC,YAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,mBAAAC,EACA,0BAAAC,CACF,IAAiC,CAC/B,MAAMC,EAAeC,EAAQ,CAC3B,sCACE,yDAAA,CACH,EACK,CAACC,EAAWC,CAAY,EAAIC,EAAS,EAAK,EAE1CC,EAAsBC,EAC1B,MAAOC,GAA8B,CACnCA,EAAM,eAAA,EAEN,MAAMC,EAAaC,EAAcF,EAAM,MAAM,EAE7C,GAAI,CAACG,EAAcF,GAAA,YAAAA,EAAY,KAAK,EAClC,OAGFL,EAAa,EAAI,EAEjB,MAAMQ,EAAW,MAAMC,EAA0BJ,EAAW,KAAK,EAIjE,GAFAL,EAAa,EAAK,EAEd,CAACQ,EAAS,QAAS,CACrBf,GAA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N,EAAiB,KACvB,QAAQ,YACR,QAASA,EAAiB,KAC1B,KAAMA,EAAiB,IAAA,CAAA,EAEvB,KACJI,EAACG,EAAA,CACC,kBAAiBxB,EAAa,cAC9B,KAAK,qBACL,UAAU,iCACV,SAAUK,EACV,QAASH,EACT,aAAcuB,EACZC,CAAA,EAGF,SAAAP,EAAC,MAAA,CAAI,UAAU,oCACb,SAAA,CAAAE,EAACM,EAAA,CACC,UAAU,4CACV,KAAK,SACL,QAAQ,WACR,MAAO,CAAE,QAAS,GAAA,EAClB,KAAMN,EAACO,EAAA,CAAY,MAAO,CAAE,UAAW,iBAAmB,EAC1D,WAAY5B,EAAa,gBACzB,aAAc,GACd,QAASa,CAAA,CAAA,EAEXQ,EAACM,EAAA,CACC,KAAK,SACL,WAAY3B,EAAa,cACzB,QAAQ,UACR,aAAcE,CAAA,CAAA,CAChB,CAAA,CACF,CAAA,CAAA,EAEFmB,EAAC,MAAA,CAAI,GAAG,2BAAA,CAA4B,CAAA,CAAA,CAAA,CAG1C","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"ResetPasswordForm.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/ChevronDown.svg","/@dropins/storefront-auth/src/hooks/components/useResetPasswordForm.tsx","/@dropins/storefront-auth/src/components/ResetPasswordForm/ResetPasswordForm.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgChevronDown = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701\", stroke: \"currentColor\", strokeWidth: 1, strokeLinecap: \"square\", strokeLinejoin: \"round\" }));\nexport default SvgChevronDown;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { requestPasswordResetEmail } from '@/auth/api';\nimport { checkIsFunction } from '@/auth/lib/checkIsFunction';\nimport { getFormValues } from '@/auth/lib/getFormValues';\nimport { UseResetPasswordFormProps } from '@/auth/types';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { useCallback, useState } from 'preact/hooks';\nimport { validateEmail } from '@/auth/lib/validationFields';\n\nexport const useResetPasswordForm = ({\n routeSignIn,\n onErrorCallback,\n onSuccessCallback,\n setActiveComponent,\n handleSetInLineAlertProps,\n}: UseResetPasswordFormProps) => {\n const translations = useText({\n successPasswordResetEmailNotification:\n 'Auth.Notification.successPasswordResetEmailNotification',\n });\n const [isLoading, setIsLoading] = useState(false);\n\n const submitResetPassword = useCallback(\n async (event: any): Promise<void> => {\n event.preventDefault();\n\n const formValues = getFormValues(event.target);\n\n if (!validateEmail(formValues?.email)) {\n return;\n }\n\n setIsLoading(true);\n\n const response = await requestPasswordResetEmail(formValues.email);\n\n setIsLoading(false);\n\n if (!response.success) {\n onErrorCallback?.(response);\n handleSetInLineAlertProps?.({\n type: 'error',\n text: response.message,\n });\n return;\n }\n\n if (onSuccessCallback) {\n await onSuccessCallback();\n return;\n }\n\n handleSetInLineAlertProps?.({\n type: 'success',\n text: translations.successPasswordResetEmailNotification.replace(\n '{email}',\n formValues.email\n ),\n });\n },\n [\n handleSetInLineAlertProps,\n onErrorCallback,\n onSuccessCallback,\n translations.successPasswordResetEmailNotification,\n ]\n );\n\n const redirectToSignInPage = useCallback(() => {\n if (checkIsFunction(setActiveComponent)) {\n setActiveComponent('signInForm');\n return;\n }\n\n if (checkIsFunction(routeSignIn)) {\n window.location.href = routeSignIn();\n }\n }, [setActiveComponent, routeSignIn]);\n\n return {\n isLoading,\n submitResetPassword,\n redirectToSignInPage,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport '@/auth/components/ResetPasswordForm/ResetPasswordForm.css';\nimport { useResetPasswordForm } from '@/auth/hooks/components/useResetPasswordForm';\nimport { ResetPasswordFormProps } from '@/auth/types';\nimport { ChevronDown as ChevronLeft } from '@adobe-commerce/elsie/icons';\nimport { Form, Button } from '@/auth/components';\nimport { useInLineAlert } from '@/auth/hooks/useInLineAlert';\nimport { Header, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { simplifyTransformAttributesForm } from '@/auth/lib/simplifyTransformAttributesForm';\nimport { DEFAULT__RESET_PASSWORD_EMAIL_FIELD } from '@/auth/configs/defaultCreateUserConfigs';\n\nexport const ResetPasswordForm: FunctionComponent<\n ResetPasswordFormProps & HTMLAttributes<HTMLDivElement>\n> = ({\n formSize = 'default',\n routeSignIn,\n setActiveComponent,\n onErrorCallback,\n onSuccessCallback,\n ...props\n}) => {\n const translations = useText({\n title: 'Auth.ResetPasswordForm.title',\n buttonPrimary: 'Auth.ResetPasswordForm.buttonPrimary',\n buttonSecondary: 'Auth.ResetPasswordForm.buttonSecondary',\n formAriaLabel: 'Auth.ResetPasswordForm.formAriaLabel',\n });\n\n const { inLineAlertProps, handleSetInLineAlertProps } = useInLineAlert();\n\n const { isLoading, submitResetPassword, redirectToSignInPage } =\n useResetPasswordForm({\n routeSignIn,\n setActiveComponent,\n onErrorCallback,\n onSuccessCallback,\n handleSetInLineAlertProps,\n });\n\n return (\n <div\n {...props}\n className={classes([\n 'auth-reset-password-form',\n `auth-reset-password-form--${formSize}`,\n ])}\n data-testid=\"resetPasswordForm\"\n >\n <Header\n title={translations.title}\n divider={false}\n className=\"auth-reset-password-form__title\"\n />\n {inLineAlertProps.text ? (\n <InLineAlert\n className=\"auth-reset-password-form__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n />\n ) : null}\n <Form\n aria-labelledby={translations.formAriaLabel}\n name=\"resetPassword_form\"\n className=\"auth-reset-password-form__form\"\n onSubmit={submitResetPassword}\n loading={isLoading}\n fieldsConfig={simplifyTransformAttributesForm(\n DEFAULT__RESET_PASSWORD_EMAIL_FIELD\n )}\n >\n <div className=\"auth-reset-password-form__buttons\">\n <Button\n className=\"auth-reset-password-form__buttons--signin\"\n type=\"button\"\n variant=\"tertiary\"\n style={{ padding: '0' }}\n icon={<ChevronLeft style={{ transform: 'rotate(90deg)' }} />}\n buttonText={translations.buttonSecondary}\n enableLoader={false}\n onClick={redirectToSignInPage}\n />\n <Button\n type=\"submit\"\n buttonText={translations.buttonPrimary}\n variant=\"primary\"\n enableLoader={isLoading}\n />\n </div>\n </Form>\n <div id=\"requestPasswordResetEmail\" />\n </div>\n );\n};\n"],"names":["SvgChevronDown","props","React","useResetPasswordForm","routeSignIn","onErrorCallback","onSuccessCallback","setActiveComponent","handleSetInLineAlertProps","translations","useText","isLoading","setIsLoading","useState","submitResetPassword","useCallback","event","formValues","getFormValues","validateEmail","response","requestPasswordResetEmail","redirectToSignInPage","checkIsFunction","ResetPasswordForm","formSize","inLineAlertProps","useInLineAlert","jsxs","classes","jsx","Header","InLineAlert","Form","simplifyTransformAttributesForm","DEFAULT__RESET_PASSWORD_EMAIL_FIELD","Button","ChevronLeft"],"mappings":"wnBACA,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,cACzB,QAAQ,UACR,aAAcE,CAAA,CAAA,CAChB,CAAA,CACF,CAAA,CAAA,EAEFmB,EAAC,MAAA,CAAI,GAAG,2BAAA,CAA4B,CAAA,CAAA,CAAA,CAG1C","x_google_ignoreList":[0]}
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{Initializer as S,Config as A}from"@dropins/tools/lib.js";import{events as i}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f as p,h as y,a as T,r as k}from"./network-error.js";const C={auth_dropin_user_token:"auth_dropin_user_token",auth_dropin_firstname:"auth_dropin_firstname"},f=3600,O=e=>{const t=document.cookie.split(";");let r;return t.forEach(o=>{const[n,a]=o.trim().split("=");n===e&&(r=decodeURIComponent(a))}),r},R=e=>{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},V=async()=>{try{const e=sessionStorage.getItem("storeConfig");let r=(e?JSON.parse(e):{}).customerAccessTokenLifetime;if(!r){const o=await x();sessionStorage.setItem("storeConfig",JSON.stringify(o)),r=(o==null?void 0:o.customerAccessTokenLifetime)||f}return`Max-Age=${r}`}catch(e){return console.error("getCookiesLifetime() Error:",e),`Max-Age=${f}`}},l=new A(void 0),E=new S({init:async e=>{const r={...{authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"},customerPermissionRoles:!1},...e};E.config.setConfig(r);const o=O(C.auth_dropin_user_token),[n]=await Promise.all([U(r.authHeaderConfig.header,r.authHeaderConfig.tokenPrefix),r.customerPermissionRoles&&o?P():Promise.resolve()]);l.setConfig(n)},listeners:()=>[i.on("authenticated",e=>{const t=l.getConfig();if(t!==void 0&&e!==t){l.setConfig(e);const{customerPermissionRoles:r}=E.config.getConfig();r&&P()}})]}),j=E.config,w=e=>{var t,r,o,n,a,s,u,h,m,d;return{autocompleteOnStorefront:((r=(t=e==null?void 0:e.data)==null?void 0:t.storeConfig)==null?void 0:r.autocomplete_on_storefront)||!1,minLength:((n=(o=e==null?void 0:e.data)==null?void 0:o.storeConfig)==null?void 0:n.minimum_password_length)||3,requiredCharacterClasses:+((s=(a=e==null?void 0:e.data)==null?void 0:a.storeConfig)==null?void 0:s.required_character_classes_number)||0,createAccountConfirmation:((h=(u=e==null?void 0:e.data)==null?void 0:u.storeConfig)==null?void 0:h.create_account_confirmation)||!1,customerAccessTokenLifetime:((d=(m=e==null?void 0:e.data)==null?void 0:m.storeConfig)==null?void 0:d.customer_access_token_lifetime)*f||f}},I=e=>{const t=e.map(r=>r.message).join(" ");throw Error(t)},v=async e=>{if(!e||e.trim()==="")return"";try{const t=atob(e),r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);const o=await crypto.subtle.digest("SHA-1",r);return Array.from(new Uint8Array(o)).map(s=>s.toString(16).padStart(2,"0")).join("")}catch(t){return console.error(`Failed to convert base64 to SHA1: ${t instanceof Error?t.message:"Unknown error"}`),""}},M="b6589fc6ab0dc82cf12099d1c2d40ab994e8410c",g=async e=>{const t=e?await v(e):M;i.emit("auth/group-uid",t)},b=`
3
+ import{Initializer as S,Config as A}from"@dropins/tools/lib.js";import{events as i}from"@dropins/tools/event-bus.js";import"@dropins/tools/recaptcha.js";import{f as p,h as T,a as y,r as k}from"./network-error.js";const C={auth_dropin_user_token:"auth_dropin_user_token",auth_dropin_firstname:"auth_dropin_firstname"},V=["localhost","127.0.0.1","::1"],f=3600,P=e=>{const t=document.cookie.split(";");let r;return t.forEach(o=>{const[n,s]=o.trim().split("=");n===e&&(r=decodeURIComponent(s))}),r},R=e=>{document.cookie=`${e}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`},j=async()=>{try{const e=sessionStorage.getItem("storeConfig");let r=(e?JSON.parse(e):{}).customerAccessTokenLifetime;if(!r){const o=await b();sessionStorage.setItem("storeConfig",JSON.stringify(o)),r=(o==null?void 0:o.customerAccessTokenLifetime)||f}return`Max-Age=${r}`}catch(e){return console.error("getCookiesLifetime() Error:",e),`Max-Age=${f}`}},l=new A(void 0),E=new S({init:async e=>{const r={...{authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"},customerPermissionRoles:!1},...e};E.config.setConfig(r);const o=P(C.auth_dropin_user_token),[n]=await Promise.all([U(r.authHeaderConfig.header,r.authHeaderConfig.tokenPrefix),r.customerPermissionRoles&&o?O():Promise.resolve()]);l.setConfig(n)},listeners:()=>[i.on("authenticated",e=>{const t=l.getConfig();if(t!==void 0&&e!==t){l.setConfig(e);const{customerPermissionRoles:r}=E.config.getConfig();r&&O()}})]}),W=E.config,w=e=>{var t,r,o,n,s,a,u,h,m,d;return{autocompleteOnStorefront:((r=(t=e==null?void 0:e.data)==null?void 0:t.storeConfig)==null?void 0:r.autocomplete_on_storefront)||!1,minLength:((n=(o=e==null?void 0:e.data)==null?void 0:o.storeConfig)==null?void 0:n.minimum_password_length)||3,requiredCharacterClasses:+((a=(s=e==null?void 0:e.data)==null?void 0:s.storeConfig)==null?void 0:a.required_character_classes_number)||0,createAccountConfirmation:((h=(u=e==null?void 0:e.data)==null?void 0:u.storeConfig)==null?void 0:h.create_account_confirmation)||!1,customerAccessTokenLifetime:((d=(m=e==null?void 0:e.data)==null?void 0:m.storeConfig)==null?void 0:d.customer_access_token_lifetime)*f||f}},I=e=>{const t=e.map(r=>r.message).join(" ");throw Error(t)},v=async e=>{if(!e||e.trim()==="")return"";try{const t=atob(e),r=new Uint8Array(t.length);for(let a=0;a<t.length;a++)r[a]=t.charCodeAt(a);const o=await crypto.subtle.digest("SHA-1",r);return Array.from(new Uint8Array(o)).map(a=>a.toString(16).padStart(2,"0")).join("")}catch(t){return console.error(`Failed to convert base64 to SHA1: ${t instanceof Error?t.message:"Unknown error"}`),""}},M="b6589fc6ab0dc82cf12099d1c2d40ab994e8410c",g=async e=>{const t=e?await v(e):M;i.emit("auth/group-uid",t)},L=`
4
4
  query GET_STORE_CONFIG {
5
5
  storeConfig {
6
6
  autocomplete_on_storefront
@@ -14,7 +14,7 @@ import{Initializer as S,Config as A}from"@dropins/tools/lib.js";import{events as
14
14
  customer_access_token_lifetime
15
15
  }
16
16
  }
17
- `,x=async()=>await p(b,{method:"GET",cache:"force-cache"}).then(e=>{var t;return(t=e.errors)!=null&&t.length?I(e.errors):w(e)}).catch(y),L=`
17
+ `,b=async()=>await p(L,{method:"GET",cache:"force-cache"}).then(e=>{var t;return(t=e.errors)!=null&&t.length?I(e.errors):w(e)}).catch(T),x=`
18
18
  query VALIDATE_TOKEN {
19
19
  customer {
20
20
  group {
@@ -22,7 +22,7 @@ import{Initializer as S,Config as A}from"@dropins/tools/lib.js";import{events as
22
22
  }
23
23
  }
24
24
  }
25
- `,U=async(e="Authorization",t="Bearer")=>{const r=O(C.auth_dropin_user_token);return r?(T(e,`${t} ${r}`),p(L).then(async o=>{var a,s,u,h;return!((a=o.errors)!=null&&a.find(m=>{var d;return((d=m.extensions)==null?void 0:d.category)==="graphql-authentication"}))?(await g((h=(u=(s=o.data)==null?void 0:s.customer)==null?void 0:u.group)==null?void 0:h.uid),i.emit("authenticated",!0),!0):(R(C.auth_dropin_user_token),k(e),await g(),i.emit("authenticated",!1),!1)})):(await g(),i.emit("authenticated",!1),!1)},G=`
25
+ `,U=async(e="Authorization",t="Bearer")=>{const r=P(C.auth_dropin_user_token);return r?(y(e,`${t} ${r}`),p(x).then(async o=>{var s,a,u,h;return!((s=o.errors)!=null&&s.find(m=>{var d;return((d=m.extensions)==null?void 0:d.category)==="graphql-authentication"}))?(await g((h=(u=(a=o.data)==null?void 0:a.customer)==null?void 0:u.group)==null?void 0:h.uid),i.emit("authenticated",!0),!0):(R(C.auth_dropin_user_token),k(e),await g(),i.emit("authenticated",!1),!1)})):(await g(),i.emit("authenticated",!1),!1)},G=`
26
26
  query GET_CUSTOMER_ROLE_PERMISSIONS {
27
27
  customer {
28
28
  purchase_orders_enabled
@@ -56,5 +56,5 @@ import{Initializer as S,Config as A}from"@dropins/tools/lib.js";import{events as
56
56
  }
57
57
  }
58
58
  }
59
- `;let _=null,c=null;const N=e=>{const t={},r=o=>{o.forEach(n=>{var a;t[n.id]=!0,(a=n.children)!=null&&a.length&&r(n.children)})};return r(e),t},H=["Magento_PurchaseOrder::all","Magento_PurchaseOrder::view_purchase_orders","Magento_PurchaseOrder::view_purchase_orders_for_subordinates","Magento_PurchaseOrder::view_purchase_orders_for_company","Magento_PurchaseOrder::autoapprove_purchase_order","Magento_PurchaseOrderRule::super_approve_purchase_order","Magento_PurchaseOrderRule::view_approval_rules","Magento_PurchaseOrderRule::manage_approval_rules"],F=e=>(e==null?void 0:e.id)==="MA=="&&Array.isArray(e.permissions)&&e.permissions.length===0,q=e=>{var t;return(t=e==null?void 0:e.permissions)!=null&&t.length?N(e.permissions):{}},$=(e,t)=>{if(t===!0)return e;const r={...e};return H.forEach(o=>{r[o]=!1}),r},D=(e,t)=>{const r=F(e),o=q(e),n=$(o,t);return{...{all:!0,...r&&{admin:!0}},...n}},z=async()=>{var e,t,r,o;try{const n=await p(G,{method:"GET"}),a=D((t=(e=n.data)==null?void 0:e.customer)==null?void 0:t.role,(o=(r=n.data)==null?void 0:r.customer)==null?void 0:o.purchase_orders_enabled);return _=a,c=null,a}catch(n){throw c=null,n}},P=()=>_?(i.emit("auth/permissions",_),Promise.resolve(_)):(c||(c=z().then(e=>(i.emit("auth/permissions",e),e))),c),W=()=>{_=null,c=null};export{C,W as _,P as a,V as b,j as c,R as d,g as e,x as g,I as h,E as i,U as v};
59
+ `;let _=null,c=null;const H=e=>{const t={},r=o=>{o.forEach(n=>{var s;t[n.id]=!0,(s=n.children)!=null&&s.length&&r(n.children)})};return r(e),t},N=["Magento_PurchaseOrder::all","Magento_PurchaseOrder::view_purchase_orders","Magento_PurchaseOrder::view_purchase_orders_for_subordinates","Magento_PurchaseOrder::view_purchase_orders_for_company","Magento_PurchaseOrder::autoapprove_purchase_order","Magento_PurchaseOrderRule::super_approve_purchase_order","Magento_PurchaseOrderRule::view_approval_rules","Magento_PurchaseOrderRule::manage_approval_rules"],F=e=>(e==null?void 0:e.id)==="MA=="&&Array.isArray(e.permissions)&&e.permissions.length===0,q=e=>{var t;return(t=e==null?void 0:e.permissions)!=null&&t.length?H(e.permissions):{}},$=(e,t)=>{if(t===!0)return e;const r={...e};return N.forEach(o=>{r[o]=!1}),r},D=(e,t)=>{const r=F(e),o=q(e),n=$(o,t);return{...{all:!0,...r&&{admin:!0}},...n}},z=async()=>{var e,t,r,o;try{const n=await p(G,{method:"GET"}),s=D((t=(e=n.data)==null?void 0:e.customer)==null?void 0:t.role,(o=(r=n.data)==null?void 0:r.customer)==null?void 0:o.purchase_orders_enabled);return _=s,c=null,s}catch(n){throw c=null,n}},O=()=>_?(i.emit("auth/permissions",_),Promise.resolve(_)):(c||(c=z().then(e=>(i.emit("auth/permissions",e),e))),c),X=()=>{_=null,c=null};export{C,V as L,X as _,O as a,j as b,W as c,R as d,g as e,b as g,I as h,E as i,U as v};
60
60
  //# sourceMappingURL=getCustomerRolePermissions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCustomerRolePermissions.js","sources":["/@dropins/storefront-auth/src/configs/cookieConfigs.ts","/@dropins/storefront-auth/src/lib/cookieUtils.ts","/@dropins/storefront-auth/src/api/initialize/initialize.ts","/@dropins/storefront-auth/src/data/transforms/transform-store-config.ts","/@dropins/storefront-auth/src/lib/fetch-error.ts","/@dropins/storefront-auth/src/lib/base64ToSha1.ts","/@dropins/storefront-auth/src/lib/emitAuthGroupId.ts","/@dropins/storefront-auth/src/api/getStoreConfig/graphql/getStoreConfig.graphql.ts","/@dropins/storefront-auth/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-auth/src/api/verifyToken/graphql/verifyToken.graphql.ts","/@dropins/storefront-auth/src/api/verifyToken/verifyToken.ts","/@dropins/storefront-auth/src/api/getCustomerRolePermissions/graphql/getCustomerRolePermissions.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerRolePermissions/getCustomerRolePermissions.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nconst COOKIE_NAMES = {\n auth_dropin_user_token: 'auth_dropin_user_token',\n auth_dropin_firstname: 'auth_dropin_firstname',\n};\n\nconst COOKIE_LIFETIME = 3600;\n\nexport { COOKIE_NAMES, COOKIE_LIFETIME };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/* eslint-disable no-useless-escape */\nimport { getStoreConfig } from '@/auth/api';\nimport { COOKIE_LIFETIME } from '@/auth/configs/cookieConfigs';\n\nexport const getCookie = (cookieName: string) => {\n const cookies = document.cookie.split(';');\n let foundValue;\n\n cookies.forEach((cookie) => {\n const [name, value] = cookie.trim().split('=');\n if (name === cookieName) {\n foundValue = decodeURIComponent(value);\n }\n });\n\n return foundValue;\n};\n\nexport const deleteCookie = (cookieName: string) => {\n document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;\n};\n\nexport const getCookiesLifetime = async () => {\n try {\n const storeConfigString = sessionStorage.getItem('storeConfig');\n const cachedStoreConfig = storeConfigString\n ? JSON.parse(storeConfigString)\n : {};\n\n let accessTokenLifeTime = cachedStoreConfig.customerAccessTokenLifetime;\n\n if (!accessTokenLifeTime) {\n const storeConfig = await getStoreConfig();\n\n sessionStorage.setItem('storeConfig', JSON.stringify(storeConfig));\n\n accessTokenLifeTime =\n storeConfig?.customerAccessTokenLifetime || COOKIE_LIFETIME;\n }\n\n return `Max-Age=${accessTokenLifeTime}`;\n } catch (error) {\n console.error('getCookiesLifetime() Error:', error);\n return `Max-Age=${COOKIE_LIFETIME}`;\n }\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Initializer, Model, Config } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { getCookie } from '@/auth/lib/cookieUtils';\nimport { CustomerModel } from '@/auth/data/models';\nimport { verifyToken, getCustomerRolePermissions } from '@/auth/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport { COOKIE_NAMES } from '@/auth/configs/cookieConfigs';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n authHeaderConfig: {\n header: string;\n tokenPrefix: string;\n };\n customerPermissionRoles?: boolean;\n models?: {\n CustomerModel?: Model<CustomerModel>;\n };\n};\n\nconst _authenticated = new Config<boolean | undefined>(undefined);\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {\n authHeaderConfig: {\n header: 'Authorization',\n tokenPrefix: 'Bearer',\n },\n customerPermissionRoles: false,\n };\n\n const mergedConfig = { ...defaultConfig, ...config };\n\n initialize.config.setConfig(mergedConfig);\n\n const token = getCookie(COOKIE_NAMES.auth_dropin_user_token);\n\n const [authenticated] = await Promise.all([\n verifyToken(\n mergedConfig.authHeaderConfig.header,\n mergedConfig.authHeaderConfig.tokenPrefix\n ),\n mergedConfig.customerPermissionRoles && token\n ? getCustomerRolePermissions()\n : Promise.resolve(),\n ]);\n\n _authenticated.setConfig(authenticated);\n },\n\n listeners: () => [\n events.on('authenticated', (next) => {\n const prev = _authenticated.getConfig();\n\n if (prev !== undefined && next !== prev) {\n _authenticated.setConfig(next);\n const { customerPermissionRoles } = initialize.config.getConfig();\n if (customerPermissionRoles) {\n getCustomerRolePermissions();\n }\n }\n }),\n ],\n});\n\nexport const config = initialize.config;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getStoreConfigResponse } from '@/auth/types';\nimport { COOKIE_LIFETIME } from '@/auth/configs/cookieConfigs';\nimport { StoreConfigModel } from '../models';\n\nexport const transformStoreConfig = (\n response: getStoreConfigResponse\n): StoreConfigModel => {\n return {\n autocompleteOnStorefront:\n response?.data?.storeConfig?.autocomplete_on_storefront || false,\n // Need information about min length in response undefined\n minLength: response?.data?.storeConfig?.minimum_password_length || 3,\n requiredCharacterClasses:\n +response?.data?.storeConfig?.required_character_classes_number || 0,\n createAccountConfirmation:\n response?.data?.storeConfig?.create_account_confirmation || false,\n customerAccessTokenLifetime:\n response?.data?.storeConfig?.customer_access_token_lifetime *\n COOKIE_LIFETIME || COOKIE_LIFETIME,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/**\n * Converts a base64 encoded string to a SHA1 hash string\n * @param base64String - The base64 encoded string to convert\n * @returns A promise that resolves to the SHA1 hash as a hexadecimal string, or empty string if input is undefined/null/empty or if conversion fails\n */\nexport const base64ToSha1 = async (\n base64String?: string | null\n): Promise<string> => {\n // Handle edge cases: undefined, null, or empty string\n if (!base64String || base64String.trim() === '') {\n return '';\n }\n\n try {\n // Decode base64 string to binary data\n const binaryString = atob(base64String);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n\n // Compute SHA1 hash using Web Crypto API\n const hashBuffer = await crypto.subtle.digest('SHA-1', bytes);\n\n // Convert hash to hexadecimal string\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const hashHex = hashArray\n .map((byte) => byte.toString(16).padStart(2, '0'))\n .join('');\n\n return hashHex;\n } catch (error) {\n console.error(\n `Failed to convert base64 to SHA1: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n return '';\n }\n};\n\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\nimport { base64ToSha1 } from './base64ToSha1';\n\n/**\n * Default customer group ID for non-logged-in (NLI) customers.\n * This value is emitted via the 'auth/group-uid' event when:\n * - A customer is not authenticated\n * - Token validation fails\n * - Customer logs out\n */\nexport const DEFAULT_NLI_CUSTOMER_GROUP_ID = 'b6589fc6ab0dc82cf12099d1c2d40ab994e8410c';\n\n/**\n * Emits the auth/group-uid event with the provided group UID.\n * If a value is provided, it will be converted from base64 to SHA1 hash.\n * If no value is provided, the default NLI customer group ID will be emitted.\n * \n * @param groupUid - The base64 encoded group UID, or undefined/null for default\n */\nexport const emitAuthGroupIdEvent = async (\n groupUid?: string | null\n): Promise<void> => {\n const groupIdHash = groupUid \n ? await base64ToSha1(groupUid) \n : DEFAULT_NLI_CUSTOMER_GROUP_ID;\n \n events.emit('auth/group-uid', groupIdHash);\n};\n\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_STORE_CONFIG = /* GraphQL */ `\n query GET_STORE_CONFIG {\n storeConfig {\n autocomplete_on_storefront\n minimum_password_length\n required_character_classes_number\n store_code\n store_name\n store_group_code\n locale\n create_account_confirmation\n customer_access_token_lifetime\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getStoreConfigResponse } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_STORE_CONFIG } from './graphql/getStoreConfig.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { transformStoreConfig } from '@/auth/data/transforms';\nimport { StoreConfigModel } from '@/auth/data/models';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\n\nexport const getStoreConfig = async (): Promise<StoreConfigModel> => {\n return await fetchGraphQl(GET_STORE_CONFIG, {\n method: 'GET',\n cache: 'force-cache',\n })\n .then((response: getStoreConfigResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformStoreConfig(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const VALIDATE_CUSTOMER_TOKEN = /* GraphQL */ `\n query VALIDATE_TOKEN {\n customer {\n group {\n uid\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n fetchGraphQl,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeader,\n} from '../fetch-graphql';\nimport { deleteCookie, getCookie } from '@/auth/lib/cookieUtils';\nimport { COOKIE_NAMES } from '@/auth/configs/cookieConfigs';\nimport { VALIDATE_CUSTOMER_TOKEN } from './graphql/verifyToken.graphql';\nimport { emitAuthGroupIdEvent } from '@/auth/lib/emitAuthGroupId';\n\nexport const verifyToken = async (\n authType = 'Authorization',\n type = 'Bearer'\n) => {\n const token = getCookie(COOKIE_NAMES.auth_dropin_user_token);\n\n if (!token) {\n await emitAuthGroupIdEvent();\n events.emit('authenticated', false);\n return false;\n }\n\n setFetchGraphQlHeader(authType, `${type} ${token}`);\n\n return fetchGraphQl(VALIDATE_CUSTOMER_TOKEN).then(async (res) => {\n const unauthenticated = !!res.errors?.find(\n (error) => error.extensions?.category === 'graphql-authentication'\n );\n\n if (!unauthenticated) {\n await emitAuthGroupIdEvent(res.data?.customer?.group?.uid);\n events.emit('authenticated', true);\n return true;\n };\n\n deleteCookie(COOKIE_NAMES.auth_dropin_user_token);\n removeFetchGraphQlHeader(authType);\n await emitAuthGroupIdEvent();\n events.emit('authenticated', false);\n return false;\n });\n};\n","export const GET_CUSTOMER_ROLE_PERMISSIONS = `\n query GET_CUSTOMER_ROLE_PERMISSIONS {\n customer {\n purchase_orders_enabled\n role {\n id\n name\n permissions {\n id\n text\n children {\n id\n text\n children {\n id\n text\n children {\n id\n text\n children {\n id\n text\n children {\n id\n text\n }\n }\n }\n }\n }\n }\n }\n }\n }\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\nimport { fetchGraphQl } from '@/auth/api/fetch-graphql';\nimport { PermissionsModel } from '@/auth/data/models';\nimport { GET_CUSTOMER_ROLE_PERMISSIONS } from './graphql/getCustomerRolePermissions.graphql';\n\n// TypeScript interfaces\ninterface Permission {\n id: string;\n text: string;\n children?: Permission[];\n}\n\ninterface Role {\n id: string;\n name: string;\n permissions?: Permission[];\n}\n\ninterface GetCustomerRolePermissionsResponse {\n data?: {\n customer?: {\n purchase_orders_enabled?: boolean;\n role?: Role;\n };\n };\n errors?: {\n message: string;\n }[];\n}\n\n// Module-level cache\nlet permissionsCache: PermissionsModel | null = null;\nlet fetchPromise: Promise<PermissionsModel> | null = null;\n\n/**\n * Recursively flattens permission tree into a flat object\n */\nconst flattenPermissionTree = (\n permissions: Permission[]\n): Record<string, boolean> => {\n const flattened: Record<string, boolean> = {};\n\n const processPermissions = (perms: Permission[]): void => {\n perms.forEach((permission) => {\n flattened[permission.id] = true;\n if (permission.children?.length) {\n processPermissions(permission.children);\n }\n });\n };\n\n processPermissions(permissions);\n return flattened;\n};\n\n/**\n * Purchase Order related permissions that should be set to false\n * when purchase orders are disabled\n */\nconst PURCHASE_ORDER_PERMISSIONS = [\n 'Magento_PurchaseOrder::all',\n 'Magento_PurchaseOrder::view_purchase_orders',\n 'Magento_PurchaseOrder::view_purchase_orders_for_subordinates',\n 'Magento_PurchaseOrder::view_purchase_orders_for_company',\n 'Magento_PurchaseOrder::autoapprove_purchase_order',\n 'Magento_PurchaseOrderRule::super_approve_purchase_order',\n 'Magento_PurchaseOrderRule::view_approval_rules',\n 'Magento_PurchaseOrderRule::manage_approval_rules',\n];\n\n/**\n * Determines if user has admin privileges\n * Admin is only when user has role ID 'MA==' AND has an empty permissions array\n */\nconst isAdminUser = (role?: Role): boolean => {\n return (\n role?.id === 'MA==' &&\n Array.isArray(role.permissions) &&\n role.permissions.length === 0\n );\n};\n\n/**\n * Gets all available permissions from the GraphQL response\n * Returns an empty object if no permissions (e.g., admin users have empty array)\n */\nconst getAllPermissions = (role?: Role): Record<string, boolean> => {\n if (role?.permissions?.length) {\n return flattenPermissionTree(role.permissions);\n }\n return {};\n};\n\n/**\n * Handles purchase order permissions based on PO enabled status\n * When PO is disabled, explicitly sets all PO permissions to false\n * This ensures consumers can distinguish between \"no data\" and \"explicitly disabled\"\n */\nconst overridePurchaseOrderPermissions = (\n permissions: Record<string, boolean>,\n purchaseOrdersEnabled?: boolean\n): Record<string, boolean> => {\n // If PO is enabled, return permissions as-is from backend\n if (purchaseOrdersEnabled === true) {\n return permissions;\n }\n\n // When PO is disabled, explicitly set all PO permissions to false\n const result = { ...permissions };\n PURCHASE_ORDER_PERMISSIONS.forEach((permission) => {\n result[permission] = false;\n });\n\n return result;\n};\n\n/**\n * Processes role data into flattened permissions\n */\nconst processUserPermissions = (\n role?: Role,\n purchaseOrdersEnabled?: boolean\n): PermissionsModel => {\n const isAdmin = isAdminUser(role);\n\n // Get all permissions (for both admin and non-admin users)\n const allPermissions = getAllPermissions(role);\n\n // Override PO permissions to false if PO is disabled\n const processedPermissions = overridePurchaseOrderPermissions(\n allPermissions,\n purchaseOrdersEnabled\n );\n\n const basePermissions: PermissionsModel = {\n all: true,\n ...(isAdmin && { admin: true }),\n };\n\n return { ...basePermissions, ...processedPermissions };\n};\n\n/**\n * Fetches user role permissions from GraphQL API\n */\nconst fetchUserRolePermissions = async (): Promise<PermissionsModel> => {\n try {\n const response = (await fetchGraphQl(GET_CUSTOMER_ROLE_PERMISSIONS, {\n method: 'GET',\n })) as GetCustomerRolePermissionsResponse;\n\n const permissions = processUserPermissions(\n response.data?.customer?.role,\n response.data?.customer?.purchase_orders_enabled\n );\n\n // Update cache\n permissionsCache = permissions;\n fetchPromise = null;\n\n return permissions;\n } catch (error) {\n fetchPromise = null;\n throw error;\n }\n};\n\n/**\n * Gets user role permissions with caching\n */\nexport const getCustomerRolePermissions = (): Promise<PermissionsModel> => {\n // Return cached data as resolved promise if available\n if (permissionsCache) {\n events.emit('auth/permissions', permissionsCache);\n return Promise.resolve(permissionsCache);\n }\n\n // No cache available - create and return fetch promise if not already fetching\n if (!fetchPromise) {\n fetchPromise = fetchUserRolePermissions().then((permissions) => {\n events.emit('auth/permissions', permissions);\n return permissions;\n });\n }\n\n return fetchPromise;\n};\n\n/**\n * Resets the permissions cache\n * @internal\n */\nexport const _resetCache = (): void => {\n permissionsCache = null;\n fetchPromise = null;\n};\n"],"names":["COOKIE_NAMES","COOKIE_LIFETIME","getCookie","cookieName","cookies","foundValue","cookie","name","value","deleteCookie","getCookiesLifetime","storeConfigString","accessTokenLifeTime","storeConfig","getStoreConfig","error","_authenticated","Config","initialize","Initializer","config","mergedConfig","token","authenticated","verifyToken","getCustomerRolePermissions","events","next","prev","customerPermissionRoles","transformStoreConfig","response","_b","_a","_d","_c","_f","_e","_h","_g","_j","_i","handleFetchError","errors","errorMessage","e","base64ToSha1","base64String","binaryString","bytes","i","hashBuffer","byte","DEFAULT_NLI_CUSTOMER_GROUP_ID","emitAuthGroupIdEvent","groupUid","groupIdHash","GET_STORE_CONFIG","fetchGraphQl","handleNetworkError","VALIDATE_CUSTOMER_TOKEN","authType","type","setFetchGraphQlHeader","res","removeFetchGraphQlHeader","GET_CUSTOMER_ROLE_PERMISSIONS","permissionsCache","fetchPromise","flattenPermissionTree","permissions","flattened","processPermissions","perms","permission","PURCHASE_ORDER_PERMISSIONS","isAdminUser","role","getAllPermissions","overridePurchaseOrderPermissions","purchaseOrdersEnabled","result","processUserPermissions","isAdmin","allPermissions","processedPermissions","fetchUserRolePermissions","_resetCache"],"mappings":"qNAiBA,MAAMA,EAAe,CACnB,uBAAwB,yBACxB,sBAAuB,uBACzB,EAEMC,EAAkB,KCDXC,EAAaC,GAAuB,CAC/C,MAAMC,EAAU,SAAS,OAAO,MAAM,GAAG,EACzC,IAAIC,EAEJ,OAAAD,EAAQ,QAASE,GAAW,CAC1B,KAAM,CAACC,EAAMC,CAAK,EAAIF,EAAO,KAAA,EAAO,MAAM,GAAG,EACzCC,IAASJ,IACXE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AuBN,EAC3BK,EACAJ,CAAA,EAQF,MAAO,CAAE,GALiC,CACxC,IAAK,GACL,GAAIG,GAAW,CAAE,MAAO,EAAA,CAAK,EAGF,GAAGE,CAAA,CAClC,EAKMC,EAA2B,SAAuC,aACtE,GAAI,CACF,MAAMvD,EAAY,MAAM2B,EAAaQ,EAA+B,CAClE,OAAQ,KAAA,CACT,EAEKI,EAAcY,GAClBlD,GAAAC,EAAAF,EAAS,OAAT,YAAAE,EAAe,WAAf,YAAAD,EAAyB,MACzBE,GAAAC,EAAAJ,EAAS,OAAT,YAAAI,EAAe,WAAf,YAAAD,EAAyB,uBAAA,EAI3B,OAAAiC,EAAmBG,EACnBF,EAAe,KAERE,CACT,OAASvD,EAAO,CACd,MAAAqD,EAAe,KACTrD,CACR,CACF,EAKaU,EAA6B,IAEpC0C,GACFzC,EAAO,KAAK,mBAAoByC,CAAgB,EACzC,QAAQ,QAAQA,CAAgB,IAIpCC,IACHA,EAAekB,EAAA,EAA2B,KAAMhB,IAC9C5C,EAAO,KAAK,mBAAoB4C,CAAW,EACpCA,EACR,GAGIF,GAOImB,EAAc,IAAY,CACrCpB,EAAmB,KACnBC,EAAe,IACjB"}
1
+ {"version":3,"file":"getCustomerRolePermissions.js","sources":["/@dropins/storefront-auth/src/configs/cookieConfigs.ts","/@dropins/storefront-auth/src/lib/cookieUtils.ts","/@dropins/storefront-auth/src/api/initialize/initialize.ts","/@dropins/storefront-auth/src/data/transforms/transform-store-config.ts","/@dropins/storefront-auth/src/lib/fetch-error.ts","/@dropins/storefront-auth/src/lib/base64ToSha1.ts","/@dropins/storefront-auth/src/lib/emitAuthGroupId.ts","/@dropins/storefront-auth/src/api/getStoreConfig/graphql/getStoreConfig.graphql.ts","/@dropins/storefront-auth/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-auth/src/api/verifyToken/graphql/verifyToken.graphql.ts","/@dropins/storefront-auth/src/api/verifyToken/verifyToken.ts","/@dropins/storefront-auth/src/api/getCustomerRolePermissions/graphql/getCustomerRolePermissions.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerRolePermissions/getCustomerRolePermissions.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nconst COOKIE_NAMES = {\n auth_dropin_user_token: 'auth_dropin_user_token',\n auth_dropin_firstname: 'auth_dropin_firstname',\n};\n\nconst LOCALHOST = [\n 'localhost',\n '127.0.0.1',\n '::1'\n];\n\nconst COOKIE_LIFETIME = 3600;\n\nexport { COOKIE_NAMES, COOKIE_LIFETIME, LOCALHOST };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/* eslint-disable no-useless-escape */\nimport { getStoreConfig } from '@/auth/api';\nimport { COOKIE_LIFETIME } from '@/auth/configs/cookieConfigs';\n\nexport const getCookie = (cookieName: string) => {\n const cookies = document.cookie.split(';');\n let foundValue;\n\n cookies.forEach((cookie) => {\n const [name, value] = cookie.trim().split('=');\n if (name === cookieName) {\n foundValue = decodeURIComponent(value);\n }\n });\n\n return foundValue;\n};\n\nexport const deleteCookie = (cookieName: string) => {\n document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;\n};\n\nexport const getCookiesLifetime = async () => {\n try {\n const storeConfigString = sessionStorage.getItem('storeConfig');\n const cachedStoreConfig = storeConfigString\n ? JSON.parse(storeConfigString)\n : {};\n\n let accessTokenLifeTime = cachedStoreConfig.customerAccessTokenLifetime;\n\n if (!accessTokenLifeTime) {\n const storeConfig = await getStoreConfig();\n\n sessionStorage.setItem('storeConfig', JSON.stringify(storeConfig));\n\n accessTokenLifeTime =\n storeConfig?.customerAccessTokenLifetime || COOKIE_LIFETIME;\n }\n\n return `Max-Age=${accessTokenLifeTime}`;\n } catch (error) {\n console.error('getCookiesLifetime() Error:', error);\n return `Max-Age=${COOKIE_LIFETIME}`;\n }\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Initializer, Model, Config } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { getCookie } from '@/auth/lib/cookieUtils';\nimport { CustomerModel } from '@/auth/data/models';\nimport { verifyToken, getCustomerRolePermissions } from '@/auth/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport { COOKIE_NAMES } from '@/auth/configs/cookieConfigs';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n authHeaderConfig: {\n header: string;\n tokenPrefix: string;\n };\n customerPermissionRoles?: boolean;\n models?: {\n CustomerModel?: Model<CustomerModel>;\n };\n};\n\nconst _authenticated = new Config<boolean | undefined>(undefined);\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {\n authHeaderConfig: {\n header: 'Authorization',\n tokenPrefix: 'Bearer',\n },\n customerPermissionRoles: false,\n };\n\n const mergedConfig = { ...defaultConfig, ...config };\n\n initialize.config.setConfig(mergedConfig);\n\n const token = getCookie(COOKIE_NAMES.auth_dropin_user_token);\n\n const [authenticated] = await Promise.all([\n verifyToken(\n mergedConfig.authHeaderConfig.header,\n mergedConfig.authHeaderConfig.tokenPrefix\n ),\n mergedConfig.customerPermissionRoles && token\n ? getCustomerRolePermissions()\n : Promise.resolve(),\n ]);\n\n _authenticated.setConfig(authenticated);\n },\n\n listeners: () => [\n events.on('authenticated', (next) => {\n const prev = _authenticated.getConfig();\n\n if (prev !== undefined && next !== prev) {\n _authenticated.setConfig(next);\n const { customerPermissionRoles } = initialize.config.getConfig();\n if (customerPermissionRoles) {\n getCustomerRolePermissions();\n }\n }\n }),\n ],\n});\n\nexport const config = initialize.config;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getStoreConfigResponse } from '@/auth/types';\nimport { COOKIE_LIFETIME } from '@/auth/configs/cookieConfigs';\nimport { StoreConfigModel } from '../models';\n\nexport const transformStoreConfig = (\n response: getStoreConfigResponse\n): StoreConfigModel => {\n return {\n autocompleteOnStorefront:\n response?.data?.storeConfig?.autocomplete_on_storefront || false,\n // Need information about min length in response undefined\n minLength: response?.data?.storeConfig?.minimum_password_length || 3,\n requiredCharacterClasses:\n +response?.data?.storeConfig?.required_character_classes_number || 0,\n createAccountConfirmation:\n response?.data?.storeConfig?.create_account_confirmation || false,\n customerAccessTokenLifetime:\n response?.data?.storeConfig?.customer_access_token_lifetime *\n COOKIE_LIFETIME || COOKIE_LIFETIME,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/**\n * Converts a base64 encoded string to a SHA1 hash string\n * @param base64String - The base64 encoded string to convert\n * @returns A promise that resolves to the SHA1 hash as a hexadecimal string, or empty string if input is undefined/null/empty or if conversion fails\n */\nexport const base64ToSha1 = async (\n base64String?: string | null\n): Promise<string> => {\n // Handle edge cases: undefined, null, or empty string\n if (!base64String || base64String.trim() === '') {\n return '';\n }\n\n try {\n // Decode base64 string to binary data\n const binaryString = atob(base64String);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n\n // Compute SHA1 hash using Web Crypto API\n const hashBuffer = await crypto.subtle.digest('SHA-1', bytes);\n\n // Convert hash to hexadecimal string\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n const hashHex = hashArray\n .map((byte) => byte.toString(16).padStart(2, '0'))\n .join('');\n\n return hashHex;\n } catch (error) {\n console.error(\n `Failed to convert base64 to SHA1: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n return '';\n }\n};\n\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\nimport { base64ToSha1 } from './base64ToSha1';\n\n/**\n * Default customer group ID for non-logged-in (NLI) customers.\n * This value is emitted via the 'auth/group-uid' event when:\n * - A customer is not authenticated\n * - Token validation fails\n * - Customer logs out\n */\nexport const DEFAULT_NLI_CUSTOMER_GROUP_ID = 'b6589fc6ab0dc82cf12099d1c2d40ab994e8410c';\n\n/**\n * Emits the auth/group-uid event with the provided group UID.\n * If a value is provided, it will be converted from base64 to SHA1 hash.\n * If no value is provided, the default NLI customer group ID will be emitted.\n * \n * @param groupUid - The base64 encoded group UID, or undefined/null for default\n */\nexport const emitAuthGroupIdEvent = async (\n groupUid?: string | null\n): Promise<void> => {\n const groupIdHash = groupUid \n ? await base64ToSha1(groupUid) \n : DEFAULT_NLI_CUSTOMER_GROUP_ID;\n \n events.emit('auth/group-uid', groupIdHash);\n};\n\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_STORE_CONFIG = /* GraphQL */ `\n query GET_STORE_CONFIG {\n storeConfig {\n autocomplete_on_storefront\n minimum_password_length\n required_character_classes_number\n store_code\n store_name\n store_group_code\n locale\n create_account_confirmation\n customer_access_token_lifetime\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getStoreConfigResponse } from '@/auth/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_STORE_CONFIG } from './graphql/getStoreConfig.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { transformStoreConfig } from '@/auth/data/transforms';\nimport { StoreConfigModel } from '@/auth/data/models';\nimport { handleFetchError } from '@/auth/lib/fetch-error';\n\nexport const getStoreConfig = async (): Promise<StoreConfigModel> => {\n return await fetchGraphQl(GET_STORE_CONFIG, {\n method: 'GET',\n cache: 'force-cache',\n })\n .then((response: getStoreConfigResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformStoreConfig(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const VALIDATE_CUSTOMER_TOKEN = /* GraphQL */ `\n query VALIDATE_TOKEN {\n customer {\n group {\n uid\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n fetchGraphQl,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeader,\n} from '../fetch-graphql';\nimport { deleteCookie, getCookie } from '@/auth/lib/cookieUtils';\nimport { COOKIE_NAMES } from '@/auth/configs/cookieConfigs';\nimport { VALIDATE_CUSTOMER_TOKEN } from './graphql/verifyToken.graphql';\nimport { emitAuthGroupIdEvent } from '@/auth/lib/emitAuthGroupId';\n\nexport const verifyToken = async (\n authType = 'Authorization',\n type = 'Bearer'\n) => {\n const token = getCookie(COOKIE_NAMES.auth_dropin_user_token);\n\n if (!token) {\n await emitAuthGroupIdEvent();\n events.emit('authenticated', false);\n return false;\n }\n\n setFetchGraphQlHeader(authType, `${type} ${token}`);\n\n return fetchGraphQl(VALIDATE_CUSTOMER_TOKEN).then(async (res) => {\n const unauthenticated = !!res.errors?.find(\n (error) => error.extensions?.category === 'graphql-authentication'\n );\n\n if (!unauthenticated) {\n await emitAuthGroupIdEvent(res.data?.customer?.group?.uid);\n events.emit('authenticated', true);\n return true;\n };\n\n deleteCookie(COOKIE_NAMES.auth_dropin_user_token);\n removeFetchGraphQlHeader(authType);\n await emitAuthGroupIdEvent();\n events.emit('authenticated', false);\n return false;\n });\n};\n","export const GET_CUSTOMER_ROLE_PERMISSIONS = `\n query GET_CUSTOMER_ROLE_PERMISSIONS {\n customer {\n purchase_orders_enabled\n role {\n id\n name\n permissions {\n id\n text\n children {\n id\n text\n children {\n id\n text\n children {\n id\n text\n children {\n id\n text\n children {\n id\n text\n }\n }\n }\n }\n }\n }\n }\n }\n }\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\nimport { fetchGraphQl } from '@/auth/api/fetch-graphql';\nimport { PermissionsModel } from '@/auth/data/models';\nimport { GET_CUSTOMER_ROLE_PERMISSIONS } from './graphql/getCustomerRolePermissions.graphql';\n\n// TypeScript interfaces\ninterface Permission {\n id: string;\n text: string;\n children?: Permission[];\n}\n\ninterface Role {\n id: string;\n name: string;\n permissions?: Permission[];\n}\n\ninterface GetCustomerRolePermissionsResponse {\n data?: {\n customer?: {\n purchase_orders_enabled?: boolean;\n role?: Role;\n };\n };\n errors?: {\n message: string;\n }[];\n}\n\n// Module-level cache\nlet permissionsCache: PermissionsModel | null = null;\nlet fetchPromise: Promise<PermissionsModel> | null = null;\n\n/**\n * Recursively flattens permission tree into a flat object\n */\nconst flattenPermissionTree = (\n permissions: Permission[]\n): Record<string, boolean> => {\n const flattened: Record<string, boolean> = {};\n\n const processPermissions = (perms: Permission[]): void => {\n perms.forEach((permission) => {\n flattened[permission.id] = true;\n if (permission.children?.length) {\n processPermissions(permission.children);\n }\n });\n };\n\n processPermissions(permissions);\n return flattened;\n};\n\n/**\n * Purchase Order related permissions that should be set to false\n * when purchase orders are disabled\n */\nconst PURCHASE_ORDER_PERMISSIONS = [\n 'Magento_PurchaseOrder::all',\n 'Magento_PurchaseOrder::view_purchase_orders',\n 'Magento_PurchaseOrder::view_purchase_orders_for_subordinates',\n 'Magento_PurchaseOrder::view_purchase_orders_for_company',\n 'Magento_PurchaseOrder::autoapprove_purchase_order',\n 'Magento_PurchaseOrderRule::super_approve_purchase_order',\n 'Magento_PurchaseOrderRule::view_approval_rules',\n 'Magento_PurchaseOrderRule::manage_approval_rules',\n];\n\n/**\n * Determines if user has admin privileges\n * Admin is only when user has role ID 'MA==' AND has an empty permissions array\n */\nconst isAdminUser = (role?: Role): boolean => {\n return (\n role?.id === 'MA==' &&\n Array.isArray(role.permissions) &&\n role.permissions.length === 0\n );\n};\n\n/**\n * Gets all available permissions from the GraphQL response\n * Returns an empty object if no permissions (e.g., admin users have empty array)\n */\nconst getAllPermissions = (role?: Role): Record<string, boolean> => {\n if (role?.permissions?.length) {\n return flattenPermissionTree(role.permissions);\n }\n return {};\n};\n\n/**\n * Handles purchase order permissions based on PO enabled status\n * When PO is disabled, explicitly sets all PO permissions to false\n * This ensures consumers can distinguish between \"no data\" and \"explicitly disabled\"\n */\nconst overridePurchaseOrderPermissions = (\n permissions: Record<string, boolean>,\n purchaseOrdersEnabled?: boolean\n): Record<string, boolean> => {\n // If PO is enabled, return permissions as-is from backend\n if (purchaseOrdersEnabled === true) {\n return permissions;\n }\n\n // When PO is disabled, explicitly set all PO permissions to false\n const result = { ...permissions };\n PURCHASE_ORDER_PERMISSIONS.forEach((permission) => {\n result[permission] = false;\n });\n\n return result;\n};\n\n/**\n * Processes role data into flattened permissions\n */\nconst processUserPermissions = (\n role?: Role,\n purchaseOrdersEnabled?: boolean\n): PermissionsModel => {\n const isAdmin = isAdminUser(role);\n\n // Get all permissions (for both admin and non-admin users)\n const allPermissions = getAllPermissions(role);\n\n // Override PO permissions to false if PO is disabled\n const processedPermissions = overridePurchaseOrderPermissions(\n allPermissions,\n purchaseOrdersEnabled\n );\n\n const basePermissions: PermissionsModel = {\n all: true,\n ...(isAdmin && { admin: true }),\n };\n\n return { ...basePermissions, ...processedPermissions };\n};\n\n/**\n * Fetches user role permissions from GraphQL API\n */\nconst fetchUserRolePermissions = async (): Promise<PermissionsModel> => {\n try {\n const response = (await fetchGraphQl(GET_CUSTOMER_ROLE_PERMISSIONS, {\n method: 'GET',\n })) as GetCustomerRolePermissionsResponse;\n\n const permissions = processUserPermissions(\n response.data?.customer?.role,\n response.data?.customer?.purchase_orders_enabled\n );\n\n // Update cache\n permissionsCache = permissions;\n fetchPromise = null;\n\n return permissions;\n } catch (error) {\n fetchPromise = null;\n throw error;\n }\n};\n\n/**\n * Gets user role permissions with caching\n */\nexport const getCustomerRolePermissions = (): Promise<PermissionsModel> => {\n // Return cached data as resolved promise if available\n if (permissionsCache) {\n events.emit('auth/permissions', permissionsCache);\n return Promise.resolve(permissionsCache);\n }\n\n // No cache available - create and return fetch promise if not already fetching\n if (!fetchPromise) {\n fetchPromise = fetchUserRolePermissions().then((permissions) => {\n events.emit('auth/permissions', permissions);\n return permissions;\n });\n }\n\n return fetchPromise;\n};\n\n/**\n * Resets the permissions cache\n * @internal\n */\nexport const _resetCache = (): void => {\n permissionsCache = null;\n fetchPromise = null;\n};\n"],"names":["COOKIE_NAMES","LOCALHOST","COOKIE_LIFETIME","getCookie","cookieName","cookies","foundValue","cookie","name","value","deleteCookie","getCookiesLifetime","storeConfigString","accessTokenLifeTime","storeConfig","getStoreConfig","error","_authenticated","Config","initialize","Initializer","config","mergedConfig","token","authenticated","verifyToken","getCustomerRolePermissions","events","next","prev","customerPermissionRoles","transformStoreConfig","response","_b","_a","_d","_c","_f","_e","_h","_g","_j","_i","handleFetchError","errors","errorMessage","e","base64ToSha1","base64String","binaryString","bytes","i","hashBuffer","byte","DEFAULT_NLI_CUSTOMER_GROUP_ID","emitAuthGroupIdEvent","groupUid","groupIdHash","GET_STORE_CONFIG","fetchGraphQl","handleNetworkError","VALIDATE_CUSTOMER_TOKEN","authType","type","setFetchGraphQlHeader","res","removeFetchGraphQlHeader","GET_CUSTOMER_ROLE_PERMISSIONS","permissionsCache","fetchPromise","flattenPermissionTree","permissions","flattened","processPermissions","perms","permission","PURCHASE_ORDER_PERMISSIONS","isAdminUser","role","getAllPermissions","overridePurchaseOrderPermissions","purchaseOrdersEnabled","result","processUserPermissions","isAdmin","allPermissions","processedPermissions","fetchUserRolePermissions","_resetCache"],"mappings":"qNAiBA,MAAMA,EAAe,CACnB,uBAAwB,yBACxB,sBAAuB,uBACzB,EAEMC,EAAY,CAChB,YACA,YACA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W,EAAS,CAAE,GAAGX,CAAA,EACpB,OAAAK,EAA2B,QAASD,GAAe,CACjDO,EAAOP,CAAU,EAAI,EACvB,CAAC,EAEMO,CACT,EAKMC,EAAyB,CAC7BL,EACAG,IACqB,CACrB,MAAMG,EAAUP,EAAYC,CAAI,EAG1BO,EAAiBN,EAAkBD,CAAI,EAGvCQ,EAAuBN,EAC3BK,EACAJ,CAAA,EAQF,MAAO,CAAE,GALiC,CACxC,IAAK,GACL,GAAIG,GAAW,CAAE,MAAO,EAAA,CAAK,EAGF,GAAGE,CAAA,CAClC,EAKMC,EAA2B,SAAuC,aACtE,GAAI,CACF,MAAMvD,EAAY,MAAM2B,EAAaQ,EAA+B,CAClE,OAAQ,KAAA,CACT,EAEKI,EAAcY,GAClBlD,GAAAC,EAAAF,EAAS,OAAT,YAAAE,EAAe,WAAf,YAAAD,EAAyB,MACzBE,GAAAC,EAAAJ,EAAS,OAAT,YAAAI,EAAe,WAAf,YAAAD,EAAyB,uBAAA,EAI3B,OAAAiC,EAAmBG,EACnBF,EAAe,KAERE,CACT,OAASvD,EAAO,CACd,MAAAqD,EAAe,KACTrD,CACR,CACF,EAKaU,EAA6B,IAEpC0C,GACFzC,EAAO,KAAK,mBAAoByC,CAAgB,EACzC,QAAQ,QAAQA,CAAgB,IAIpCC,IACHA,EAAekB,EAAA,EAA2B,KAAMhB,IAC9C5C,EAAO,KAAK,mBAAoB4C,CAAW,EACpCA,EACR,GAGIF,GAOImB,EAAc,IAAY,CACrCpB,EAAmB,KACnBC,EAAe,IACjB"}
@@ -1,17 +1,17 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{a as R,f as h,h as $}from"./network-error.js";import"@dropins/tools/recaptcha.js";import{events as w}from"@dropins/tools/event-bus.js";import{merge as k}from"@dropins/tools/lib.js";import{c as G,b as U,C as O,e as v}from"./getCustomerRolePermissions.js";import{CUSTOMER_INFORMATION_FRAGMENT as C}from"../fragments.js";import{p as x,E as y}from"./acdl.js";import{s as F}from"./setReCaptchaToken.js";const D=t=>{var f,e,o,a,u,m,r,T,g,d,E,M,c,N;const i={email:((e=(f=t==null?void 0:t.data)==null?void 0:f.customer)==null?void 0:e.email)??"",firstName:((a=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:a.firstname)??"",lastName:((m=(u=t==null?void 0:t.data)==null?void 0:u.customer)==null?void 0:m.lastname)??"",groupUid:((g=(T=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:T.group)==null?void 0:g.uid)??""};return k(i,(N=(c=(M=(E=(d=G)==null?void 0:d.getConfig())==null?void 0:E.models)==null?void 0:M.CustomerModel)==null?void 0:c.transformer)==null?void 0:N.call(c,t.data))},S=`
3
+ import{a as R,f as $,h as w}from"./network-error.js";import"@dropins/tools/recaptcha.js";import{events as k}from"@dropins/tools/event-bus.js";import{merge as U}from"@dropins/tools/lib.js";import{c as G,b as C,C as h,e as v,L as F}from"./getCustomerRolePermissions.js";import{CUSTOMER_INFORMATION_FRAGMENT as x}from"../fragments.js";import{p as y,E as S}from"./acdl.js";import{s as D}from"./setReCaptchaToken.js";const H=t=>{var T,e,o,a,c,m,r,f,g,d,s,E,u,M;const i={email:((e=(T=t==null?void 0:t.data)==null?void 0:T.customer)==null?void 0:e.email)??"",firstName:((a=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:a.firstname)??"",lastName:((m=(c=t==null?void 0:t.data)==null?void 0:c.customer)==null?void 0:m.lastname)??"",groupUid:((g=(f=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:f.group)==null?void 0:g.uid)??""};return U(i,(M=(u=(E=(s=(d=G)==null?void 0:d.getConfig())==null?void 0:s.models)==null?void 0:E.CustomerModel)==null?void 0:u.transformer)==null?void 0:M.call(u,t.data))},K=`
4
4
  query GET_CUSTOMER_DATA {
5
5
  customer {
6
6
  ...CUSTOMER_INFORMATION_FRAGMENT
7
7
  }
8
8
  }
9
- ${C}
10
- `,K=async t=>{if(t){const{authHeaderConfig:i}=G.getConfig();R(i.header,i.tokenPrefix?`${i.tokenPrefix} ${t}`:t)}return await h(S,{method:"GET",cache:"force-cache"}).then(i=>D(i)).catch($)},H=`
9
+ ${x}
10
+ `,A=async t=>{if(t){const{authHeaderConfig:i}=G.getConfig();R(i.header,i.tokenPrefix?`${i.tokenPrefix} ${t}`:t)}return await $(K,{method:"GET",cache:"force-cache"}).then(i=>H(i)).catch(w)},Q=`
11
11
  mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {
12
12
  generateCustomerToken(email: $email, password: $password) {
13
13
  token
14
14
  }
15
15
  }
16
- `,W=async({email:t,password:i,translations:f,onErrorCallback:e,handleSetInLineAlertProps:o})=>{var d,E,M,c,N;await F();const a=await h(H,{method:"POST",variables:{email:t,password:i}}).catch($);if(!((E=(d=a==null?void 0:a.data)==null?void 0:d.generateCustomerToken)!=null&&E.token)){const _=f.customerTokenErrorMessage,s=a!=null&&a.errors?a.errors[0].message:_;return e==null||e(s),o==null||o({type:"error",text:s}),{errorMessage:s,userName:"",userEmail:""}}const u=(c=(M=a==null?void 0:a.data)==null?void 0:M.generateCustomerToken)==null?void 0:c.token,m=await K(u),r=m==null?void 0:m.firstName,T=m==null?void 0:m.email;if(!r||!T){const _=f.customerTokenErrorMessage;return e==null||e(_),o==null||o({type:"error",text:_}),{errorMessage:_,userName:"",userEmail:""}}const g=await U();return document.cookie=`${O.auth_dropin_firstname}=${r}; path=/; ${g}; Secure;`,document.cookie=`${O.auth_dropin_user_token}=${u}; path=/; ${g}; Secure;`,await v(u?m==null?void 0:m.groupUid:void 0),w.emit("authenticated",!!u),x((N=y)==null?void 0:N.SIGN_IN,{...m}),{errorMessage:"",userName:r,userEmail:T}};export{W as a,K as g};
16
+ `,Y=async({email:t,password:i,translations:T,onErrorCallback:e,handleSetInLineAlertProps:o})=>{var s,E,u,M,_;await D();const a=await $(Q,{method:"POST",variables:{email:t,password:i}}).catch(w);if(!((E=(s=a==null?void 0:a.data)==null?void 0:s.generateCustomerToken)!=null&&E.token)){const N=T.customerTokenErrorMessage,O=a!=null&&a.errors?a.errors[0].message:N;return e==null||e(O),o==null||o({type:"error",text:O}),{errorMessage:O,userName:"",userEmail:""}}const c=(M=(u=a==null?void 0:a.data)==null?void 0:u.generateCustomerToken)==null?void 0:M.token,m=await A(c),r=m==null?void 0:m.firstName,f=m==null?void 0:m.email;if(!r||!f){const N=T.customerTokenErrorMessage;return e==null||e(N),o==null||o({type:"error",text:N}),{errorMessage:N,userName:"",userEmail:""}}const g=await C(),d=F.includes(window.location.hostname)?"":"Secure";return document.cookie=`${h.auth_dropin_firstname}=${r}; path=/; ${g}; ${d};`,document.cookie=`${h.auth_dropin_user_token}=${c}; path=/; ${g}; ${d};`,await v(c?m==null?void 0:m.groupUid:void 0),k.emit("authenticated",!!c),y((_=S)==null?void 0:_.SIGN_IN,{...m}),{errorMessage:"",userName:r,userEmail:f}};export{Y as a,A as g};
17
17
  //# sourceMappingURL=getCustomerToken.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCustomerToken.js","sources":["/@dropins/storefront-auth/src/data/transforms/transform-customer-data.ts","/@dropins/storefront-auth/src/api/getCustomerData/graphql/getCustomerData.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerData/getCustomerData.ts","/@dropins/storefront-auth/src/api/getCustomerToken/graphql/getCustomerToken.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerToken/getCustomerToken.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getCustomerDataResponse } from '@/auth/types';\nimport { CustomerModel } from '../models';\nimport { config } from '@/auth/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\n\nexport const transformCustomerData = (\n response: getCustomerDataResponse\n): CustomerModel => {\n const model = {\n email: response?.data?.customer?.email ?? '',\n firstName: response?.data?.customer?.firstname ?? '',\n lastName: response?.data?.customer?.lastname ?? '',\n groupUid: response?.data?.customer?.group?.uid ?? '',\n };\n\n // Extend the model merging custom transformer, if provided\n return merge(\n model, // default transformer\n config?.getConfig()?.models?.CustomerModel?.transformer?.(response.data) // custom transformer\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const GET_CUSTOMER_DATA = /* GraphQL */ `\n query GET_CUSTOMER_DATA {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl, setFetchGraphQlHeader, config } from '@/auth/api';\nimport { GET_CUSTOMER_DATA } from './graphql/getCustomerData.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { CustomerModel } from '@/auth/data/models';\nimport { transformCustomerData } from '@/auth/data/transforms';\n\nexport const getCustomerData = async (\n user_token: string\n): Promise<CustomerModel> => {\n if (user_token) {\n const { authHeaderConfig } = config.getConfig();\n\n setFetchGraphQlHeader(\n authHeaderConfig.header,\n authHeaderConfig.tokenPrefix\n ? `${authHeaderConfig.tokenPrefix} ${user_token}`\n : user_token\n );\n }\n\n return await fetchGraphQl(GET_CUSTOMER_DATA, {\n method: 'GET',\n cache: 'force-cache',\n })\n .then((response) => {\n return transformCustomerData(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_CUSTOMER_TOKEN = /* GraphQL */ `\n mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {\n generateCustomerToken(email: $email, password: $password) {\n token\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_CUSTOMER_TOKEN } from './graphql/getCustomerToken.graphql';\nimport { getCustomerData } from '../getCustomerData';\nimport { InLineAlertInterface } from '@/auth/types';\nimport { events } from '@adobe-commerce/event-bus';\nimport { COOKIE_NAMES } from '@/auth/configs/cookieConfigs';\nimport { getCookiesLifetime } from '@/auth/lib/cookieUtils';\nimport { publishEvents, EventsList } from '@/auth/lib/acdl';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\nimport { emitAuthGroupIdEvent } from '@/auth/lib/emitAuthGroupId';\n\ninterface getCustomerTokenProps {\n email: string;\n password: string;\n handleSetInLineAlertProps: (value?: InLineAlertInterface) => void;\n translations: Record<string, string>;\n onErrorCallback?: (value?: unknown) => void;\n}\n\nexport const getCustomerToken = async ({\n email,\n password,\n translations,\n onErrorCallback,\n handleSetInLineAlertProps,\n}: getCustomerTokenProps): Promise<{\n errorMessage: string;\n userName: string;\n userEmail: string;\n}> => {\n await setReCaptchaToken();\n\n const response = await fetchGraphQl(GET_CUSTOMER_TOKEN, {\n method: 'POST',\n variables: { email, password },\n }).catch(handleNetworkError);\n\n if (!response?.data?.generateCustomerToken?.token) {\n // Fallback error message\n const defaultErrorMessage = translations.customerTokenErrorMessage;\n const errorMessage = response?.errors\n ? response.errors[0].message\n : defaultErrorMessage;\n\n onErrorCallback?.(errorMessage);\n handleSetInLineAlertProps?.({ type: 'error', text: errorMessage });\n\n return { errorMessage, userName: '', userEmail: '' };\n }\n\n const userToken = response?.data?.generateCustomerToken?.token;\n\n const responseCustomer = await getCustomerData(userToken);\n const userName = responseCustomer?.firstName;\n const userEmail = responseCustomer?.email;\n\n if (!userName || !userEmail) {\n const errorMessage = translations.customerTokenErrorMessage;\n\n onErrorCallback?.(errorMessage);\n handleSetInLineAlertProps?.({ type: 'error', text: errorMessage });\n\n return { errorMessage, userName: '', userEmail: '' };\n }\n\n const cookiesLifetime = await getCookiesLifetime();\n\n document.cookie = `${COOKIE_NAMES.auth_dropin_firstname}=${userName}; path=/; ${cookiesLifetime}; Secure;`;\n document.cookie = `${COOKIE_NAMES.auth_dropin_user_token}=${userToken}; path=/; ${cookiesLifetime}; Secure;`;\n\n await emitAuthGroupIdEvent(userToken ? responseCustomer?.groupUid : undefined);\n events.emit('authenticated', !!userToken);\n\n publishEvents(EventsList?.SIGN_IN, { ...responseCustomer });\n\n return { errorMessage: '', userName, userEmail };\n};\n"],"names":["transformCustomerData","response","model","_b","_a","_d","_c","_f","_e","_i","_h","_g","merge","_n","_m","_l","_k","_j","config","GET_CUSTOMER_DATA","CUSTOMER_INFORMATION_FRAGMENT","getCustomerData","user_token","authHeaderConfig","setFetchGraphQlHeader","fetchGraphQl","handleNetworkError","GET_CUSTOMER_TOKEN","getCustomerToken","email","password","translations","onErrorCallback","handleSetInLineAlertProps","setReCaptchaToken","defaultErrorMessage","errorMessage","userToken","responseCustomer","userName","userEmail","cookiesLifetime","getCookiesLifetime","COOKIE_NAMES","emitAuthGroupIdEvent","events","publishEvents","EventsList"],"mappings":"qZAsBO,MAAMA,EACXC,GACkB,iCAClB,MAAMC,EAAQ,CACZ,QAAOC,GAAAC,EAAAH,GAAA,YAAAA,EAAU,OAAV,YAAAG,EAAgB,WAAhB,YAAAD,EAA0B,QAAS,GAC1C,YAAWE,GAAAC,EAAAL,GAAA,YAAAA,EAAU,OAAV,YAAAK,EAAgB,WAAhB,YAAAD,EAA0B,YAAa,GAClD,WAAUE,GAAAC,EAAAP,GAAA,YAAAA,EAAU,OAAV,YAAAO,EAAgB,WAAhB,YAAAD,EAA0B,WAAY,GAChD,WAAUE,GAAAC,GAAAC,EAAAV,GAAA,YAAAA,EAAU,OAAV,YAAAU,EAAgB,WAAhB,YAAAD,EAA0B,QAA1B,YAAAD,EAAiC,MAAO,EAAA,EAIpD,OAAOG,EACLV,GACAW,GAAAC,GAAAC,GAAAC,GAAAC,EAAAC,IAAA,YAAAD,EAAQ,cAAR,YAAAD,EAAqB,SAArB,YAAAD,EAA6B,gBAA7B,YAAAD,EAA4C,cAA5C,YAAAD,EAAA,KAAAC,EAA0Db,EAAS,KAAI,CAE3E,EClBakB,EAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAM3CC,CAA6B;AAAA,EC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AAW,CAC3B,MAAMJ,EAAeL,EAAa,0BAElC,OAAAC,GAAA,MAAAA,EAAkBI,GAClBH,GAAA,MAAAA,EAA4B,CAAE,KAAM,QAAS,KAAMG,IAE5C,CAAE,aAAAA,EAAc,SAAU,GAAI,UAAW,EAAA,CAClD,CAEA,MAAMK,EAAkB,MAAMC,EAAA,EAE9B,gBAAS,OAAS,GAAGC,EAAa,qBAAqB,IAAIJ,CAAQ,aAAaE,CAAe,YAC/F,SAAS,OAAS,GAAGE,EAAa,sBAAsB,IAAIN,CAAS,aAAaI,CAAe,YAEjG,MAAMG,EAAqBP,EAAYC,GAAA,YAAAA,EAAkB,SAAW,MAAS,EAC7EO,EAAO,KAAK,gBAAiB,CAAC,CAACR,CAAS,EAExCS,GAActC,EAAAuC,IAAA,YAAAvC,EAAY,QAAS,CAAE,GAAG8B,EAAkB,EAEnD,CAAE,aAAc,GAAI,SAAAC,EAAU,UAAAC,CAAA,CACvC"}
1
+ {"version":3,"file":"getCustomerToken.js","sources":["/@dropins/storefront-auth/src/data/transforms/transform-customer-data.ts","/@dropins/storefront-auth/src/api/getCustomerData/graphql/getCustomerData.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerData/getCustomerData.ts","/@dropins/storefront-auth/src/api/getCustomerToken/graphql/getCustomerToken.graphql.ts","/@dropins/storefront-auth/src/api/getCustomerToken/getCustomerToken.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getCustomerDataResponse } from '@/auth/types';\nimport { CustomerModel } from '../models';\nimport { config } from '@/auth/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\n\nexport const transformCustomerData = (\n response: getCustomerDataResponse\n): CustomerModel => {\n const model = {\n email: response?.data?.customer?.email ?? '',\n firstName: response?.data?.customer?.firstname ?? '',\n lastName: response?.data?.customer?.lastname ?? '',\n groupUid: response?.data?.customer?.group?.uid ?? '',\n };\n\n // Extend the model merging custom transformer, if provided\n return merge(\n model, // default transformer\n config?.getConfig()?.models?.CustomerModel?.transformer?.(response.data) // custom transformer\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMER_INFORMATION_FRAGMENT } from '@/auth/api/fragments';\n\nexport const GET_CUSTOMER_DATA = /* GraphQL */ `\n query GET_CUSTOMER_DATA {\n customer {\n ...CUSTOMER_INFORMATION_FRAGMENT\n }\n }\n ${CUSTOMER_INFORMATION_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl, setFetchGraphQlHeader, config } from '@/auth/api';\nimport { GET_CUSTOMER_DATA } from './graphql/getCustomerData.graphql';\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { CustomerModel } from '@/auth/data/models';\nimport { transformCustomerData } from '@/auth/data/transforms';\n\nexport const getCustomerData = async (\n user_token: string\n): Promise<CustomerModel> => {\n if (user_token) {\n const { authHeaderConfig } = config.getConfig();\n\n setFetchGraphQlHeader(\n authHeaderConfig.header,\n authHeaderConfig.tokenPrefix\n ? `${authHeaderConfig.tokenPrefix} ${user_token}`\n : user_token\n );\n }\n\n return await fetchGraphQl(GET_CUSTOMER_DATA, {\n method: 'GET',\n cache: 'force-cache',\n })\n .then((response) => {\n return transformCustomerData(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_CUSTOMER_TOKEN = /* GraphQL */ `\n mutation GET_CUSTOMER_TOKEN($email: String!, $password: String!) {\n generateCustomerToken(email: $email, password: $password) {\n token\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/auth/lib/network-error';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_CUSTOMER_TOKEN } from './graphql/getCustomerToken.graphql';\nimport { getCustomerData } from '../getCustomerData';\nimport { InLineAlertInterface } from '@/auth/types';\nimport { events } from '@adobe-commerce/event-bus';\nimport { COOKIE_NAMES, LOCALHOST } from '@/auth/configs/cookieConfigs';\nimport { getCookiesLifetime } from '@/auth/lib/cookieUtils';\nimport { publishEvents, EventsList } from '@/auth/lib/acdl';\nimport { setReCaptchaToken } from '@/auth/lib/setReCaptchaToken';\nimport { emitAuthGroupIdEvent } from '@/auth/lib/emitAuthGroupId';\n\ninterface getCustomerTokenProps {\n email: string;\n password: string;\n handleSetInLineAlertProps: (value?: InLineAlertInterface) => void;\n translations: Record<string, string>;\n onErrorCallback?: (value?: unknown) => void;\n}\n\nexport const getCustomerToken = async ({\n email,\n password,\n translations,\n onErrorCallback,\n handleSetInLineAlertProps,\n}: getCustomerTokenProps): Promise<{\n errorMessage: string;\n userName: string;\n userEmail: string;\n}> => {\n await setReCaptchaToken();\n\n const response = await fetchGraphQl(GET_CUSTOMER_TOKEN, {\n method: 'POST',\n variables: { email, password },\n }).catch(handleNetworkError);\n\n if (!response?.data?.generateCustomerToken?.token) {\n // Fallback error message\n const defaultErrorMessage = translations.customerTokenErrorMessage;\n const errorMessage = response?.errors\n ? response.errors[0].message\n : defaultErrorMessage;\n\n onErrorCallback?.(errorMessage);\n handleSetInLineAlertProps?.({ type: 'error', text: errorMessage });\n\n return { errorMessage, userName: '', userEmail: '' };\n }\n\n const userToken = response?.data?.generateCustomerToken?.token;\n\n const responseCustomer = await getCustomerData(userToken);\n const userName = responseCustomer?.firstName;\n const userEmail = responseCustomer?.email;\n\n if (!userName || !userEmail) {\n const errorMessage = translations.customerTokenErrorMessage;\n\n onErrorCallback?.(errorMessage);\n handleSetInLineAlertProps?.({ type: 'error', text: errorMessage });\n\n return { errorMessage, userName: '', userEmail: '' };\n }\n\n const cookiesLifetime = await getCookiesLifetime();\n\n // Do not set 'Secure' flag on auth cookies when running on localhost (fix for Safari browser)\n const cookieSecureFlag: string | null = LOCALHOST.includes(window.location.hostname) ? '' : 'Secure';\n\n document.cookie = `${COOKIE_NAMES.auth_dropin_firstname}=${userName}; path=/; ${cookiesLifetime}; ${cookieSecureFlag};`;\n document.cookie = `${COOKIE_NAMES.auth_dropin_user_token}=${userToken}; path=/; ${cookiesLifetime}; ${cookieSecureFlag};`;\n\n await emitAuthGroupIdEvent(userToken ? responseCustomer?.groupUid : undefined);\n events.emit('authenticated', !!userToken);\n\n publishEvents(EventsList?.SIGN_IN, { ...responseCustomer });\n\n return { errorMessage: '', userName, userEmail };\n};\n"],"names":["transformCustomerData","response","model","_b","_a","_d","_c","_f","_e","_i","_h","_g","merge","_n","_m","_l","_k","_j","config","GET_CUSTOMER_DATA","CUSTOMER_INFORMATION_FRAGMENT","getCustomerData","user_token","authHeaderConfig","setFetchGraphQlHeader","fetchGraphQl","handleNetworkError","GET_CUSTOMER_TOKEN","getCustomerToken","email","password","translations","onErrorCallback","handleSetInLineAlertProps","setReCaptchaToken","defaultErrorMessage","errorMessage","userToken","responseCustomer","userName","userEmail","cookiesLifetime","getCookiesLifetime","cookieSecureFlag","LOCALHOST","COOKIE_NAMES","emitAuthGroupIdEvent","events","publishEvents","EventsList"],"mappings":"4ZAsBO,MAAMA,EACXC,GACkB,iCAClB,MAAMC,EAAQ,CACZ,QAAOC,GAAAC,EAAAH,GAAA,YAAAA,EAAU,OAAV,YAAAG,EAAgB,WAAhB,YAAAD,EAA0B,QAAS,GAC1C,YAAWE,GAAAC,EAAAL,GAAA,YAAAA,EAAU,OAAV,YAAAK,EAAgB,WAAhB,YAAAD,EAA0B,YAAa,GAClD,WAAUE,GAAAC,EAAAP,GAAA,YAAAA,EAAU,OAAV,YAAAO,EAAgB,WAAhB,YAAAD,EAA0B,WAAY,GAChD,WAAUE,GAAAC,GAAAC,EAAAV,GAAA,YAAAA,EAAU,OAAV,YAAAU,EAAgB,WAAhB,YAAAD,EAA0B,QAA1B,YAAAD,EAAiC,MAAO,EAAA,EAIpD,OAAOG,EACLV,GACAW,GAAAC,GAAAC,GAAAC,GAAAC,EAAAC,IAAA,YAAAD,EAAQ,cAAR,YAAAD,EAAqB,SAArB,YAAAD,EAA6B,gBAA7B,YAAAD,EAA4C,cAA5C,Y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B,EAAgBgB,CAAS,EAClDE,EAAWD,GAAA,YAAAA,EAAkB,UAC7BE,EAAYF,GAAA,YAAAA,EAAkB,MAEpC,GAAI,CAACC,GAAY,CAACC,EAAW,CAC3B,MAAMJ,EAAeL,EAAa,0BAElC,OAAAC,GAAA,MAAAA,EAAkBI,GAClBH,GAAA,MAAAA,EAA4B,CAAE,KAAM,QAAS,KAAMG,IAE5C,CAAE,aAAAA,EAAc,SAAU,GAAI,UAAW,EAAA,CAClD,CAEA,MAAMK,EAAkB,MAAMC,EAAA,EAGxBC,EAAkCC,EAAU,SAAS,OAAO,SAAS,QAAQ,EAAI,GAAK,SAE5F,gBAAS,OAAS,GAAGC,EAAa,qBAAqB,IAAIN,CAAQ,aAAaE,CAAe,KAAKE,CAAgB,IACpH,SAAS,OAAS,GAAGE,EAAa,sBAAsB,IAAIR,CAAS,aAAaI,CAAe,KAAKE,CAAgB,IAEtH,MAAMG,EAAqBT,EAAYC,GAAA,YAAAA,EAAkB,SAAW,MAAS,EAC7ES,EAAO,KAAK,gBAAiB,CAAC,CAACV,CAAS,EAExCW,GAAcxC,EAAAyC,IAAA,YAAAzC,EAAY,QAAS,CAAE,GAAG8B,EAAkB,EAEnD,CAAE,aAAc,GAAI,SAAAC,EAAU,UAAAC,CAAA,CACvC"}
@@ -18,6 +18,7 @@ declare const COOKIE_NAMES: {
18
18
  auth_dropin_user_token: string;
19
19
  auth_dropin_firstname: string;
20
20
  };
21
+ declare const LOCALHOST: string[];
21
22
  declare const COOKIE_LIFETIME = 3600;
22
- export { COOKIE_NAMES, COOKIE_LIFETIME };
23
+ export { COOKIE_NAMES, COOKIE_LIFETIME, LOCALHOST };
23
24
  //# sourceMappingURL=cookieConfigs.d.ts.map
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-auth", "version": "2.2.0-beta1", "@dropins/tools": "~1.5.0", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/storefront-auth", "version": "3.0.0-beta1", "@dropins/tools": "~1.6.0-beta3", "license": "SEE LICENSE IN LICENSE.md"}