@dropins/storefront-account 4.0.0-beta.1 → 4.0.0-beta.3
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/CHANGELOG.md +12 -0
- package/api.js +22 -140
- package/api.js.map +1 -1
- package/containers/AddressForm.js +1 -1
- package/containers/AddressForm.js.map +1 -1
- package/containers/AddressValidation.js +1 -1
- package/containers/AddressValidation.js.map +1 -1
- package/containers/Addresses.js +1 -1
- package/containers/Addresses.js.map +1 -1
- package/containers/CustomerInformation.js +1 -1
- package/containers/CustomerInformation.js.map +1 -1
- package/containers/OrdersList.js +1 -1
- package/containers/OrdersList.js.map +1 -1
- package/containers/PaymentMethods.js +1 -1
- package/containers/PaymentMethods.js.map +1 -1
- package/containers/SellerAssistedBuyingActivity.js +1 -1
- package/containers/SellerAssistedBuyingActivity.js.map +1 -1
- package/containers/SellerAssistedBuyingSettings.js +1 -1
- package/containers/SellerAssistedBuyingSettings.js.map +1 -1
- package/fragments.js +119 -1
- package/fragments.js.map +1 -1
- package/package.json +1 -1
- package/render.js +1 -1
- package/render.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{useState as f,useMemo as b,useCallback as x,useEffect as C}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/lib.js";import{i as V}from"./AddressForm.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/i18n.js";import"../api.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/preact.js";const
|
|
3
|
+
import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{useState as f,useMemo as b,useCallback as x,useEffect as C}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/lib.js";import{i as V}from"./AddressForm.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/i18n.js";import"../api.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"@dropins/tools/preact.js";const F=({selectedAddress:c=null,suggestedAddress:i,originalAddress:t,handleSelectedAddress:o})=>{const[m,a]=f(c),[s,p]=f(!1),r=b(()=>!i||!t?null:{...t,...i},[t,i]),u=x(async n=>{a(n);const y=n==="suggested"?r:t;p(!0);try{await(o==null?void 0:o({selection:n,address:y}))}finally{p(!1)}},[r,t,o]);return C(()=>{m&&u(m)},[m,u]),e(V,{busy:s,originalAddress:t,selection:m,suggestedAddress:r,onSelectionChange:u})};export{F as AddressValidation,F as default};
|
|
4
4
|
//# sourceMappingURL=AddressValidation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressValidation.js","sources":["/@dropins/storefront-account/src/containers/AddressValidation/AddressValidation.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\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { useCallback, useEffect, useMemo, useState } from 'preact/hooks';\nimport { AddressValidation as AddressValidationComponent } from '@/account/components';\nimport { CustomerAddressesModel } from '@/account/data/models';\n\nexport interface AddressValidationProps {\n selectedAddress?: 'suggested' | 'original' | null;\n suggestedAddress: Partial<CustomerAddressesModel> | null;\n originalAddress: CustomerAddressesModel | null;\n handleSelectedAddress?: (payload: {\n selection: 'suggested' | 'original';\n address: CustomerAddressesModel | null | undefined;\n }) => void;\n}\n\nexport const AddressValidation: Container<AddressValidationProps> = ({\n selectedAddress = null,\n suggestedAddress,\n originalAddress,\n handleSelectedAddress,\n}) => {\n const [selection, setSelection] = useState<'suggested' | 'original' | null>(\n selectedAddress\n );\n const [busy, setBusy] = useState(false);\n\n const mergedSuggestedAddress = useMemo<CustomerAddressesModel | null>(() => {\n if (!suggestedAddress || !originalAddress) return null;\n return { ...originalAddress, ...suggestedAddress };\n }, [originalAddress, suggestedAddress]);\n\n const onSelectionChange = useCallback(\n async (sel: 'suggested' | 'original') => {\n setSelection(sel);\n const chosen =\n sel === 'suggested' ? mergedSuggestedAddress : originalAddress;\n setBusy(true);\n try {\n await handleSelectedAddress?.({ selection: sel, address: chosen });\n } finally {\n setBusy(false);\n }\n },\n [mergedSuggestedAddress, originalAddress, handleSelectedAddress]\n );\n\n useEffect(() => {\n if (!selection) return;\n onSelectionChange(selection);\n }, [selection, onSelectionChange]);\n\n return (\n <AddressValidationComponent\n busy={busy}\n originalAddress={originalAddress}\n selection={selection}\n suggestedAddress={mergedSuggestedAddress}\n onSelectionChange={onSelectionChange}\n />\n );\n};\n"],"names":["AddressValidation","selectedAddress","suggestedAddress","originalAddress","handleSelectedAddress","selection","setSelection","useState","busy","setBusy","mergedSuggestedAddress","useMemo","onSelectionChange","useCallback","sel","chosen","useEffect","jsx","AddressValidationComponent"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddressValidation.js","sources":["/@dropins/storefront-account/src/containers/AddressValidation/AddressValidation.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\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { useCallback, useEffect, useMemo, useState } from 'preact/hooks';\nimport { AddressValidation as AddressValidationComponent } from '@/account/components';\nimport { CustomerAddressesModel } from '@/account/data/models';\n\nexport interface AddressValidationProps {\n selectedAddress?: 'suggested' | 'original' | null;\n suggestedAddress: Partial<CustomerAddressesModel> | null;\n originalAddress: CustomerAddressesModel | null;\n handleSelectedAddress?: (payload: {\n selection: 'suggested' | 'original';\n address: CustomerAddressesModel | null | undefined;\n }) => void;\n}\n\nexport const AddressValidation: Container<AddressValidationProps> = ({\n selectedAddress = null,\n suggestedAddress,\n originalAddress,\n handleSelectedAddress,\n}) => {\n const [selection, setSelection] = useState<'suggested' | 'original' | null>(\n selectedAddress\n );\n const [busy, setBusy] = useState(false);\n\n const mergedSuggestedAddress = useMemo<CustomerAddressesModel | null>(() => {\n if (!suggestedAddress || !originalAddress) return null;\n return { ...originalAddress, ...suggestedAddress };\n }, [originalAddress, suggestedAddress]);\n\n const onSelectionChange = useCallback(\n async (sel: 'suggested' | 'original') => {\n setSelection(sel);\n const chosen =\n sel === 'suggested' ? mergedSuggestedAddress : originalAddress;\n setBusy(true);\n try {\n await handleSelectedAddress?.({ selection: sel, address: chosen });\n } finally {\n setBusy(false);\n }\n },\n [mergedSuggestedAddress, originalAddress, handleSelectedAddress]\n );\n\n useEffect(() => {\n if (!selection) return;\n onSelectionChange(selection);\n }, [selection, onSelectionChange]);\n\n return (\n <AddressValidationComponent\n busy={busy}\n originalAddress={originalAddress}\n selection={selection}\n suggestedAddress={mergedSuggestedAddress}\n onSelectionChange={onSelectionChange}\n />\n );\n};\n"],"names":["AddressValidation","selectedAddress","suggestedAddress","originalAddress","handleSelectedAddress","selection","setSelection","useState","busy","setBusy","mergedSuggestedAddress","useMemo","onSelectionChange","useCallback","sel","chosen","useEffect","jsx","AddressValidationComponent"],"mappings":"weAgCO,MAAMA,EAAuD,CAAC,CACnE,gBAAAC,EAAkB,KAClB,iBAAAC,EACA,gBAAAC,EACA,sBAAAC,CACF,IAAM,CACJ,KAAM,CAACC,EAAWC,CAAY,EAAIC,EAChCN,CAAA,EAEI,CAACO,EAAMC,CAAO,EAAIF,EAAS,EAAK,EAEhCG,EAAyBC,EAAuC,IAChE,CAACT,GAAoB,CAACC,EAAwB,KAC3C,CAAE,GAAGA,EAAiB,GAAGD,CAAA,EAC/B,CAACC,EAAiBD,CAAgB,CAAC,EAEhCU,EAAoBC,EACxB,MAAOC,GAAkC,CACvCR,EAAaQ,CAAG,EAChB,MAAMC,EACJD,IAAQ,YAAcJ,EAAyBP,EACjDM,EAAQ,EAAI,EACZ,GAAI,CACF,MAAML,GAAA,YAAAA,EAAwB,CAAE,UAAWU,EAAK,QAASC,IAC3D,QAAA,CACEN,EAAQ,EAAK,CACf,CACF,EACA,CAACC,EAAwBP,EAAiBC,CAAqB,CAAA,EAGjE,OAAAY,EAAU,IAAM,CACTX,GACLO,EAAkBP,CAAS,CAC7B,EAAG,CAACA,EAAWO,CAAiB,CAAC,EAG/BK,EAACC,EAAA,CACC,KAAAV,EACA,gBAAAL,EACA,UAAAE,EACA,iBAAkBK,EAClB,kBAAAE,CAAA,CAAA,CAGN"}
|
package/containers/Addresses.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{classes as C}from"@dropins/tools/lib.js";import{A as E}from"./AddressForm.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/i18n.js";import"../api.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/preact.js";const G=(e,r)=>e&&r?"selectedAddress":e?"selectedShippingAddress":r?"selectedBillingAddress":"default",
|
|
3
|
+
import{jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{classes as C}from"@dropins/tools/lib.js";import{A as E}from"./AddressForm.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/i18n.js";import"../api.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"@dropins/tools/preact.js";const G=(e,r)=>e&&r?"selectedAddress":e?"selectedShippingAddress":r?"selectedBillingAddress":"default",X=({hideActionFormButtons:e,fieldIdPrefix:r,formName:m,slots:a,title:p,addressFormTitle:f,defaultSelectAddressId:n,showFormLoader:u,forwardFormRef:c,showSaveCheckBox:l,saveCheckBoxValue:A,selectShipping:s,selectBilling:t,selectable:w,className:d,withHeader:x,minifiedView:i,withActionsInMinifiedView:N,withActionsInFullSizeView:V,inputsDefaultValueSet:j,showShippingCheckBox:v,showBillingCheckBox:y,shippingCheckBoxValue:z,billingCheckBoxValue:D,onAddressData:F,routeAddressesPage:K,onSubmit:W,onSuccess:b,onError:h})=>{const k=i?"minifiedView":"fullSizeView",q=m??G(s,t);return o("div",{className:C(["account-addresses",d]),"data-testid":"addressesid",children:o(E,{inputName:q,minifiedViewKey:k,hideActionFormButtons:e,fieldIdPrefix:r,slots:a,title:p,addressFormTitle:f,defaultSelectAddressId:n,showFormLoader:u,onAddressData:F,forwardFormRef:c,selectShipping:s,selectBilling:t,showSaveCheckBox:l,saveCheckBoxValue:A,selectable:w,className:d,withHeader:x,minifiedView:i,withActionsInMinifiedView:N,withActionsInFullSizeView:V,inputsDefaultValueSet:j,billingCheckBoxValue:D,shippingCheckBoxValue:z,showBillingCheckBox:y,showShippingCheckBox:v,routeAddressesPage:K,onSubmit:W,onSuccess:b,onError:h})})};export{X as Addresses,X as default};
|
|
4
4
|
//# sourceMappingURL=Addresses.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Addresses.js","sources":["/@dropins/storefront-account/src/containers/Addresses/Addresses.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\nimport { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { AddressesProps } from '@/account/types';\nimport { AddressesWrapper } from '@/account/components';\n\nconst getDefaultFormName = (\n selectShipping: boolean,\n selectBilling: boolean\n): string => {\n if (selectShipping && selectBilling) {\n return 'selectedAddress';\n } else if (selectShipping) {\n return 'selectedShippingAddress';\n } else if (selectBilling) {\n return 'selectedBillingAddress';\n }\n\n return 'default';\n};\n\nexport const Addresses: Container<AddressesProps> = ({\n hideActionFormButtons,\n fieldIdPrefix,\n formName,\n slots,\n title,\n addressFormTitle,\n defaultSelectAddressId,\n showFormLoader,\n forwardFormRef,\n showSaveCheckBox,\n saveCheckBoxValue,\n selectShipping,\n selectBilling,\n selectable,\n className,\n withHeader,\n minifiedView,\n withActionsInMinifiedView,\n withActionsInFullSizeView,\n inputsDefaultValueSet,\n showShippingCheckBox,\n showBillingCheckBox,\n shippingCheckBoxValue,\n billingCheckBoxValue,\n onAddressData,\n routeAddressesPage,\n onSubmit,\n onSuccess,\n onError,\n}) => {\n const minifiedViewKey = minifiedView ? 'minifiedView' : 'fullSizeView';\n const inputName =\n formName ?? getDefaultFormName(selectShipping!, selectBilling!);\n\n return (\n <div\n className={classes(['account-addresses', className])}\n data-testid=\"addressesid\"\n >\n <AddressesWrapper\n inputName={inputName}\n minifiedViewKey={minifiedViewKey}\n hideActionFormButtons={hideActionFormButtons}\n fieldIdPrefix={fieldIdPrefix}\n slots={slots}\n title={title}\n addressFormTitle={addressFormTitle}\n defaultSelectAddressId={defaultSelectAddressId}\n showFormLoader={showFormLoader}\n onAddressData={onAddressData}\n forwardFormRef={forwardFormRef}\n selectShipping={selectShipping}\n selectBilling={selectBilling}\n showSaveCheckBox={showSaveCheckBox}\n saveCheckBoxValue={saveCheckBoxValue}\n selectable={selectable}\n className={className}\n withHeader={withHeader}\n minifiedView={minifiedView}\n withActionsInMinifiedView={withActionsInMinifiedView}\n withActionsInFullSizeView={withActionsInFullSizeView}\n inputsDefaultValueSet={inputsDefaultValueSet}\n billingCheckBoxValue={billingCheckBoxValue}\n shippingCheckBoxValue={shippingCheckBoxValue}\n showBillingCheckBox={showBillingCheckBox}\n showShippingCheckBox={showShippingCheckBox}\n routeAddressesPage={routeAddressesPage}\n onSubmit={onSubmit}\n onSuccess={onSuccess}\n onError={onError}\n />\n </div>\n );\n};\n"],"names":["getDefaultFormName","selectShipping","selectBilling","Addresses","hideActionFormButtons","fieldIdPrefix","formName","slots","title","addressFormTitle","defaultSelectAddressId","showFormLoader","forwardFormRef","showSaveCheckBox","saveCheckBoxValue","selectable","className","withHeader","minifiedView","withActionsInMinifiedView","withActionsInFullSizeView","inputsDefaultValueSet","showShippingCheckBox","showBillingCheckBox","shippingCheckBoxValue","billingCheckBoxValue","onAddressData","routeAddressesPage","onSubmit","onSuccess","onError","minifiedViewKey","inputName","jsx","classes","AddressesWrapper"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Addresses.js","sources":["/@dropins/storefront-account/src/containers/Addresses/Addresses.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\nimport { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { AddressesProps } from '@/account/types';\nimport { AddressesWrapper } from '@/account/components';\n\nconst getDefaultFormName = (\n selectShipping: boolean,\n selectBilling: boolean\n): string => {\n if (selectShipping && selectBilling) {\n return 'selectedAddress';\n } else if (selectShipping) {\n return 'selectedShippingAddress';\n } else if (selectBilling) {\n return 'selectedBillingAddress';\n }\n\n return 'default';\n};\n\nexport const Addresses: Container<AddressesProps> = ({\n hideActionFormButtons,\n fieldIdPrefix,\n formName,\n slots,\n title,\n addressFormTitle,\n defaultSelectAddressId,\n showFormLoader,\n forwardFormRef,\n showSaveCheckBox,\n saveCheckBoxValue,\n selectShipping,\n selectBilling,\n selectable,\n className,\n withHeader,\n minifiedView,\n withActionsInMinifiedView,\n withActionsInFullSizeView,\n inputsDefaultValueSet,\n showShippingCheckBox,\n showBillingCheckBox,\n shippingCheckBoxValue,\n billingCheckBoxValue,\n onAddressData,\n routeAddressesPage,\n onSubmit,\n onSuccess,\n onError,\n}) => {\n const minifiedViewKey = minifiedView ? 'minifiedView' : 'fullSizeView';\n const inputName =\n formName ?? getDefaultFormName(selectShipping!, selectBilling!);\n\n return (\n <div\n className={classes(['account-addresses', className])}\n data-testid=\"addressesid\"\n >\n <AddressesWrapper\n inputName={inputName}\n minifiedViewKey={minifiedViewKey}\n hideActionFormButtons={hideActionFormButtons}\n fieldIdPrefix={fieldIdPrefix}\n slots={slots}\n title={title}\n addressFormTitle={addressFormTitle}\n defaultSelectAddressId={defaultSelectAddressId}\n showFormLoader={showFormLoader}\n onAddressData={onAddressData}\n forwardFormRef={forwardFormRef}\n selectShipping={selectShipping}\n selectBilling={selectBilling}\n showSaveCheckBox={showSaveCheckBox}\n saveCheckBoxValue={saveCheckBoxValue}\n selectable={selectable}\n className={className}\n withHeader={withHeader}\n minifiedView={minifiedView}\n withActionsInMinifiedView={withActionsInMinifiedView}\n withActionsInFullSizeView={withActionsInFullSizeView}\n inputsDefaultValueSet={inputsDefaultValueSet}\n billingCheckBoxValue={billingCheckBoxValue}\n shippingCheckBoxValue={shippingCheckBoxValue}\n showBillingCheckBox={showBillingCheckBox}\n showShippingCheckBox={showShippingCheckBox}\n routeAddressesPage={routeAddressesPage}\n onSubmit={onSubmit}\n onSuccess={onSuccess}\n onError={onError}\n />\n </div>\n );\n};\n"],"names":["getDefaultFormName","selectShipping","selectBilling","Addresses","hideActionFormButtons","fieldIdPrefix","formName","slots","title","addressFormTitle","defaultSelectAddressId","showFormLoader","forwardFormRef","showSaveCheckBox","saveCheckBoxValue","selectable","className","withHeader","minifiedView","withActionsInMinifiedView","withActionsInFullSizeView","inputsDefaultValueSet","showShippingCheckBox","showBillingCheckBox","shippingCheckBoxValue","billingCheckBoxValue","onAddressData","routeAddressesPage","onSubmit","onSuccess","onError","minifiedViewKey","inputName","jsx","classes","AddressesWrapper"],"mappings":"0bAqBA,MAAMA,EAAqB,CACzBC,EACAC,IAEID,GAAkBC,EACb,kBACED,EACF,0BACEC,EACF,yBAGF,UAGIC,EAAuC,CAAC,CACnD,sBAAAC,EACA,cAAAC,EACA,SAAAC,EACA,MAAAC,EACA,MAAAC,EACA,iBAAAC,EACA,uBAAAC,EACA,eAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,kBAAAC,EACA,eAAAb,EACA,cAAAC,EACA,WAAAa,EACA,UAAAC,EACA,WAAAC,EACA,aAAAC,EACA,0BAAAC,EACA,0BAAAC,EACA,sBAAAC,EACA,qBAAAC,EACA,oBAAAC,EACA,sBAAAC,EACA,qBAAAC,EACA,cAAAC,EACA,mBAAAC,EACA,SAAAC,EACA,UAAAC,EACA,QAAAC,CACF,IAAM,CACJ,MAAMC,EAAkBb,EAAe,eAAiB,eAClDc,EACJ1B,GAAYN,EAAmBC,EAAiBC,CAAc,EAEhE,OACE+B,EAAC,MAAA,CACC,UAAWC,EAAQ,CAAC,oBAAqBlB,CAAS,CAAC,EACnD,cAAY,cAEZ,SAAAiB,EAACE,EAAA,CACC,UAAAH,EACA,gBAAAD,EACA,sBAAA3B,EACA,cAAAC,EACA,MAAAE,EACA,MAAAC,EACA,iBAAAC,EACA,uBAAAC,EACA,eAAAC,EACA,cAAAe,EACA,eAAAd,EACA,eAAAX,EACA,cAAAC,EACA,iBAAAW,EACA,kBAAAC,EACA,WAAAC,EACA,UAAAC,EACA,WAAAC,EACA,aAAAC,EACA,0BAAAC,EACA,0BAAAC,EACA,sBAAAC,EACA,qBAAAI,EACA,sBAAAD,EACA,oBAAAD,EACA,qBAAAD,EACA,mBAAAK,EACA,SAAAC,EACA,UAAAC,EACA,QAAAC,CAAA,CAAA,CACF,CAAA,CAGN"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as l,jsxs as re}from"@dropins/tools/preact-jsx-runtime.js";import{classes as se}from"@dropins/tools/lib.js";import{d as ae,g as ie,n as D,b as ue,c as de,e as ce,C as le,f as me,h as fe,E as he}from"./AddressForm.js";import"@dropins/tools/preact-compat.js";import{Header as Ce}from"@dropins/tools/components.js";import{useState as i,useCallback as d,useEffect as _,useMemo as j}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{t as ge,getCustomer as pe,getAttributesForm as we,updateCustomer as J,updateCustomerEmail as Ee}from"../api.js";import{useText as X}from"@dropins/tools/i18n.js";import"@dropins/tools/preact.js";import"@dropins/tools/fetch-graphql.js";const be=t=>{if(!(t!=null&&t.dateOfBirth))return t;const{dateOfBirth:n,...s}=t;return{...s,dob:n}},Ae="accountContext";var E=(t=>(t.EDIT_ACCOUNT_EVENT="edit-account",t))(E||{});const Pe={EDIT_ACCOUNT_EVENT:"edit-account"};function q(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function Te(t,n){const s=q();s.push({[t]:null}),s.push({[t]:n})}function Ie(t,n){q().push(a=>{const c=a.getState?a.getState():{};a.push({event:t,eventInfo:{...c,...n}})})}function ye(t){const n=ge(t);Te(Ae,n),Ie(Pe.EDIT_ACCOUNT_EVENT)}const K=(t,n)=>{const s=sessionStorage.getItem("accountStoreConfig"),c={...s?JSON.parse(s):{},...n};switch(t){case"edit-account":ye(c);break;default:return null}},Ve=({handleSetInLineAlert:t})=>{const n=X({accountSuccess:"Account.minifiedView.CustomerInformation.editCustomerInformation.accountSuccess",accountError:"Account.minifiedView.CustomerInformation.editCustomerInformation.accountError",genderMale:"Account.minifiedView.CustomerInformation.genderMale",genderFemale:"Account.minifiedView.CustomerInformation.genderFemale"}),[s,a]=i(!0),[c,b]=i(!1),[S,T]=i(!1),[U,I]=i(!1),[L,m]=i(!1),[v,V]=i(!1),[A,N]=i([]),[o,x]=i(null),[P,M]=i([]),[f,H]=i({}),[k,B]=i(""),[G,Q]=i(""),R=d(e=>{const{value:r}=e==null?void 0:e.target;r.length&&m(!1),r.length||m(!0)},[]),h=d(e=>{B(e)},[]),Y=d(e=>{H(e)},[]),Z=d(()=>{T(!0),I(!1),t(),h("")},[t,h]),$=d(e=>{e==null||e(),T(!1)},[]),ee=d(()=>{I(!0),T(!1),t(),h("")},[t,h]),te=d(e=>{e==null||e(),I(!1)},[]),C=d((e,r)=>{e==="success"?t({type:"success",text:r??n.accountSuccess}):e==="error"?t({type:"error",text:r??n.accountError}):t(),b(!1)},[t,n]),O=d(()=>{pe().then(e=>{var u;const r=(u=e==null?void 0:e.createdAt)==null?void 0:u.split(" ")[0],g=be({...e,gender:e.gender===1?n.genderMale:n.genderFemale});x(g),Q(r)})},[n.genderFemale,n.genderMale]);_(()=>{O()},[]),_(()=>{we("customer_account_edit").then(e=>{M(e);const r=e.map(({name:g,customUpperCode:u,orderNumber:p,label:F})=>({name:u,orderNumber:p,label:ae.includes(g)?null:F}));N(r)})},[]),_(()=>{f.email&&f.email!==(o==null?void 0:o.email)?V(!0):f.email&&f.email===(o==null?void 0:o.email)&&V(!1)},[o==null?void 0:o.email,f]);const y=j(()=>!A||!o?[]:A.filter(({name:r})=>r!==void 0&&o[r]).map(r=>({name:r.name,orderNumber:r.orderNumber,value:o[r.name],label:r.label})),[o,A]);_(()=>{y!=null&&y.length&&a(!1)},[y]);const oe=j(()=>P==null?void 0:P.map(e=>({...e,defaultValue:e!=null&&e.customUpperCode&&o?o[e.customUpperCode]??"":""})).map(e=>e.customUpperCode==="gender"?{...e,defaultValue:e.defaultValue==="Male"?1:2}:e),[P,o]),ne=d(async(e,r)=>{const g=ie(e.target),{email:u,password:p,...F}=g,z=u!==(o==null?void 0:o.email)&&p.length===0;if(!r){z&&m(!0);return}if(m(!1),b(!0),u===(o==null?void 0:o.email)){h(""),J(D(F,"account")).then(w=>{w&&(O(),C("success"),K(E==null?void 0:E.EDIT_ACCOUNT_EVENT,{...g}))}).catch(w=>{C("error",w.message)});return}if(z){m(!0),b(!1);return}u!=null&&u.length&&(p!=null&&p.length)&&Ee({email:u,password:p}).then(w=>{w&&J(D(F,"account")).then(W=>{W&&(O(),C("success"),K(E==null?void 0:E.EDIT_ACCOUNT_EVENT,{...g}))}).catch(W=>{C("error",W.message)})}).catch(w=>{C("error",w.message)})},[o,h,O,C]);return{createdAt:G,errorPasswordEmpty:L,passwordValue:k,showPasswordOnEmailChange:v,orderedCustomerData:y,loading:s,normalizeFieldsConfig:oe,submitLoading:c,showEditForm:U,showChangePassword:S,handleShowChangePassword:Z,handleHideChangePassword:$,handleShowEditForm:ee,handleHideEditForm:te,handleUpdateCustomerInformation:ne,handleInputChange:Y,handleSetPassword:h,handleOnBlurPassword:R,renderAlertMessage:C}},Ne={success:l(ce,{}),warning:l(de,{}),error:l(ue,{})},Oe=()=>{const[t,n]=i({}),s=d(a=>{if(!(a!=null&&a.type)){n({});return}const c=Ne[a.type];n({...a,icon:c})},[]);return{inLineAlertProps:t,handleSetInLineAlert:s}},
|
|
3
|
+
import{jsx as l,jsxs as re}from"@dropins/tools/preact-jsx-runtime.js";import{classes as se}from"@dropins/tools/lib.js";import{d as ae,g as ie,n as D,b as ue,c as de,e as ce,C as le,f as me,h as fe,E as he}from"./AddressForm.js";import"@dropins/tools/preact-compat.js";import{Header as Ce}from"@dropins/tools/components.js";import{useState as i,useCallback as d,useEffect as _,useMemo as j}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{t as ge,getCustomer as pe,getAttributesForm as we,updateCustomer as J,updateCustomerEmail as Ee}from"../api.js";import{useText as X}from"@dropins/tools/i18n.js";import"@dropins/tools/preact.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";const be=t=>{if(!(t!=null&&t.dateOfBirth))return t;const{dateOfBirth:n,...s}=t;return{...s,dob:n}},Ae="accountContext";var E=(t=>(t.EDIT_ACCOUNT_EVENT="edit-account",t))(E||{});const Pe={EDIT_ACCOUNT_EVENT:"edit-account"};function q(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function Te(t,n){const s=q();s.push({[t]:null}),s.push({[t]:n})}function Ie(t,n){q().push(a=>{const c=a.getState?a.getState():{};a.push({event:t,eventInfo:{...c,...n}})})}function ye(t){const n=ge(t);Te(Ae,n),Ie(Pe.EDIT_ACCOUNT_EVENT)}const K=(t,n)=>{const s=sessionStorage.getItem("accountStoreConfig"),c={...s?JSON.parse(s):{},...n};switch(t){case"edit-account":ye(c);break;default:return null}},Ve=({handleSetInLineAlert:t})=>{const n=X({accountSuccess:"Account.minifiedView.CustomerInformation.editCustomerInformation.accountSuccess",accountError:"Account.minifiedView.CustomerInformation.editCustomerInformation.accountError",genderMale:"Account.minifiedView.CustomerInformation.genderMale",genderFemale:"Account.minifiedView.CustomerInformation.genderFemale"}),[s,a]=i(!0),[c,b]=i(!1),[S,T]=i(!1),[U,I]=i(!1),[L,m]=i(!1),[v,V]=i(!1),[A,N]=i([]),[o,x]=i(null),[P,M]=i([]),[f,H]=i({}),[k,B]=i(""),[G,Q]=i(""),R=d(e=>{const{value:r}=e==null?void 0:e.target;r.length&&m(!1),r.length||m(!0)},[]),h=d(e=>{B(e)},[]),Y=d(e=>{H(e)},[]),Z=d(()=>{T(!0),I(!1),t(),h("")},[t,h]),$=d(e=>{e==null||e(),T(!1)},[]),ee=d(()=>{I(!0),T(!1),t(),h("")},[t,h]),te=d(e=>{e==null||e(),I(!1)},[]),C=d((e,r)=>{e==="success"?t({type:"success",text:r??n.accountSuccess}):e==="error"?t({type:"error",text:r??n.accountError}):t(),b(!1)},[t,n]),O=d(()=>{pe().then(e=>{var u;const r=(u=e==null?void 0:e.createdAt)==null?void 0:u.split(" ")[0],g=be({...e,gender:e.gender===1?n.genderMale:n.genderFemale});x(g),Q(r)})},[n.genderFemale,n.genderMale]);_(()=>{O()},[]),_(()=>{we("customer_account_edit").then(e=>{M(e);const r=e.map(({name:g,customUpperCode:u,orderNumber:p,label:F})=>({name:u,orderNumber:p,label:ae.includes(g)?null:F}));N(r)})},[]),_(()=>{f.email&&f.email!==(o==null?void 0:o.email)?V(!0):f.email&&f.email===(o==null?void 0:o.email)&&V(!1)},[o==null?void 0:o.email,f]);const y=j(()=>!A||!o?[]:A.filter(({name:r})=>r!==void 0&&o[r]).map(r=>({name:r.name,orderNumber:r.orderNumber,value:o[r.name],label:r.label})),[o,A]);_(()=>{y!=null&&y.length&&a(!1)},[y]);const oe=j(()=>P==null?void 0:P.map(e=>({...e,defaultValue:e!=null&&e.customUpperCode&&o?o[e.customUpperCode]??"":""})).map(e=>e.customUpperCode==="gender"?{...e,defaultValue:e.defaultValue==="Male"?1:2}:e),[P,o]),ne=d(async(e,r)=>{const g=ie(e.target),{email:u,password:p,...F}=g,z=u!==(o==null?void 0:o.email)&&p.length===0;if(!r){z&&m(!0);return}if(m(!1),b(!0),u===(o==null?void 0:o.email)){h(""),J(D(F,"account")).then(w=>{w&&(O(),C("success"),K(E==null?void 0:E.EDIT_ACCOUNT_EVENT,{...g}))}).catch(w=>{C("error",w.message)});return}if(z){m(!0),b(!1);return}u!=null&&u.length&&(p!=null&&p.length)&&Ee({email:u,password:p}).then(w=>{w&&J(D(F,"account")).then(W=>{W&&(O(),C("success"),K(E==null?void 0:E.EDIT_ACCOUNT_EVENT,{...g}))}).catch(W=>{C("error",W.message)})}).catch(w=>{C("error",w.message)})},[o,h,O,C]);return{createdAt:G,errorPasswordEmpty:L,passwordValue:k,showPasswordOnEmailChange:v,orderedCustomerData:y,loading:s,normalizeFieldsConfig:oe,submitLoading:c,showEditForm:U,showChangePassword:S,handleShowChangePassword:Z,handleHideChangePassword:$,handleShowEditForm:ee,handleHideEditForm:te,handleUpdateCustomerInformation:ne,handleInputChange:Y,handleSetPassword:h,handleOnBlurPassword:R,renderAlertMessage:C}},Ne={success:l(ce,{}),warning:l(de,{}),error:l(ue,{})},Oe=()=>{const[t,n]=i({}),s=d(a=>{if(!(a!=null&&a.type)){n({});return}const c=Ne[a.type];n({...a,icon:c})},[]);return{inLineAlertProps:t,handleSetInLineAlert:s}},ze=({className:t,withHeader:n=!0,slots:s})=>{const a=X({containerTitle:"Account.minifiedView.CustomerInformation.containerTitle"}),{inLineAlertProps:c,handleSetInLineAlert:b}=Oe(),{createdAt:S,errorPasswordEmpty:T,passwordValue:U,showPasswordOnEmailChange:I,orderedCustomerData:L,loading:m,normalizeFieldsConfig:v,submitLoading:V,showEditForm:A,showChangePassword:N,handleShowChangePassword:o,handleHideChangePassword:x,handleShowEditForm:P,handleHideEditForm:M,handleUpdateCustomerInformation:f,handleInputChange:H,handleSetPassword:k,handleOnBlurPassword:B}=Ve({handleSetInLineAlert:b});return m?l("div",{"data-testid":"customerInformationLoader",children:l(le,{withCard:!0})}):re("div",{className:se(["account-customer-information",t]),children:[n?l(Ce,{title:a.containerTitle,divider:!1,className:"customer-information__title"}):null,l(me,{createdAt:S,slots:s,orderedCustomerData:L,showEditForm:A,showChangePassword:N,handleShowChangePassword:o,handleShowEditForm:P}),N?l(fe,{inLineAlertProps:c,handleSetInLineAlert:b,handleHideChangePassword:x}):null,A?l(he,{inLineAlertProps:c,submitLoading:V,formFieldsList:v,errorPasswordEmpty:T,passwordValue:U,showPasswordOnEmailChange:I,handleSetPassword:k,handleOnBlurPassword:B,handleUpdateCustomerInformation:f,handleHideEditForm:M,handleInputChange:H}):null]})};export{ze as CustomerInformation,ze as default};
|
|
4
4
|
//# sourceMappingURL=CustomerInformation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomerInformation.js","sources":["/@dropins/storefront-account/src/lib/transformDobCustomer.ts","/@dropins/storefront-account/src/lib/acdl.ts","/@dropins/storefront-account/src/hooks/containers/useCustomerInformation.tsx","/@dropins/storefront-account/src/hooks/useInLineAlert.tsx","/@dropins/storefront-account/src/containers/CustomerInformation/CustomerInformation.tsx"],"sourcesContent":["import { CustomerDataModelShort } from '@/account/data/models/customer';\n\nexport const transformDobCustomer = (\n customerData: CustomerDataModelShort\n): CustomerDataModelShort | (CustomerDataModelShort & { dob: string }) => {\n if (!customerData?.dateOfBirth) return customerData;\n\n const { dateOfBirth, ...rest } = customerData;\n\n return { ...rest, dob: dateOfBirth } as CustomerDataModelShort & {\n dob: string;\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 { transformAccount } from '../data/transforms';\n\nconst ACCOUNT_CONTEXT = 'accountContext';\n\nenum EventsList {\n EDIT_ACCOUNT_EVENT = 'edit-account',\n}\n\nconst events = {\n // Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/editAccountAEP.ts\n EDIT_ACCOUNT_EVENT: EventsList.EDIT_ACCOUNT_EVENT,\n};\n\nexport function getAdobeDataLayer() {\n // @ts-ignore\n window.adobeDataLayer = window.adobeDataLayer || [];\n // @ts-ignore\n return window.adobeDataLayer;\n}\n\n/**\n * Sets a context in the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/Base.ts#L6\n */\nfunction setContext(name: string, data: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n // Clear existing context\n adobeDataLayer.push({\n [name]: null,\n });\n\n // Set new context\n adobeDataLayer.push({\n [name]: data,\n });\n}\n\n/**\n * Pushes an event to the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/1973d0ce28471ef190fa06dad6359ffa0ab51db6/packages/storefront-events-sdk/src/Base.ts#L34\n */\nfunction pushEvent(event: string, additionalContext?: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n adobeDataLayer.push((acdl: any) => {\n const state = acdl.getState ? acdl.getState() : {};\n\n acdl.push({\n event,\n eventInfo: {\n ...state,\n ...additionalContext,\n },\n });\n });\n}\n\n/**\n * References:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/editAccountAEP.ts\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/utils/aep/account.ts\n */\nfunction editAccountEvent(eventData: any) {\n const accountData = transformAccount(eventData);\n\n setContext(ACCOUNT_CONTEXT, accountData);\n\n pushEvent(events.EDIT_ACCOUNT_EVENT);\n}\n\nconst publishEvents = (eventType: string, eventParams: any) => {\n const storeConfigRaw = sessionStorage.getItem('accountStoreConfig');\n const storeConfig = storeConfigRaw ? JSON.parse(storeConfigRaw) : {};\n const eventData = { ...storeConfig, ...eventParams };\n\n switch (eventType) {\n case EventsList.EDIT_ACCOUNT_EVENT:\n editAccountEvent(eventData);\n break;\n\n default:\n return null;\n }\n};\n\nexport { EventsList, publishEvents, pushEvent };\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 { useCallback, useEffect, useMemo, useState } from 'preact/hooks';\nimport {\n getAttributesForm,\n getCustomer,\n updateCustomerEmail,\n updateCustomer,\n} from '@/account/api';\nimport {\n KeysSortOrderProps,\n UseCustomerInformationProps,\n} from '@/account/types';\nimport { defaultAccountAttributePreset } from '@/account/configs/defaultAttributePreset.config';\nimport { CustomerDataModelShort } from '@/account/data/models/customer';\nimport { AttributesFormModel } from '@/account/data/models';\nimport { getFormValues } from '@/account/lib/getFormValues';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { normalizeAttributes } from '@/account/lib/normalizeAttributes';\nimport { transformDobCustomer } from '@/account/lib/transformDobCustomer';\nimport { EventsList, publishEvents } from '@/account/lib/acdl';\n\nexport const useCustomerInformation = ({\n handleSetInLineAlert,\n}: UseCustomerInformationProps) => {\n const translations = useText({\n accountSuccess:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.accountSuccess',\n accountError:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.accountError',\n genderMale: 'Account.minifiedView.CustomerInformation.genderMale',\n genderFemale: 'Account.minifiedView.CustomerInformation.genderFemale',\n });\n const [loading, setLoading] = useState<boolean>(true);\n const [submitLoading, setSubmitLoading] = useState<boolean>(false);\n const [showChangePassword, setShowChangePassword] = useState<boolean>(false);\n const [showEditForm, setShowEditForm] = useState<boolean>(false);\n const [errorPasswordEmpty, setErrorPasswordEmpty] = useState(false);\n const [showPasswordOnEmailChange, setShowPasswordOnEmailChange] =\n useState(false);\n const [keysSortOrder, setKeysSortOrder] = useState<KeysSortOrderProps[] | []>(\n []\n );\n const [customerData, setCustomerData] =\n useState<CustomerDataModelShort | null>(null);\n const [formFieldsList, setFormFieldsList] = useState<\n AttributesFormModel[] | []\n >([]);\n const [inputChange, setInputChange] = useState<\n Record<string, string | number | boolean>\n >({});\n const [passwordValue, setPasswordValue] = useState('');\n const [createdAt, setCreatedAt] = useState('');\n\n const handleOnBlurPassword = useCallback((event: Event) => {\n const { value } = event?.target as HTMLInputElement;\n\n if (value.length) setErrorPasswordEmpty(false);\n if (!value.length) setErrorPasswordEmpty(true);\n }, []);\n\n const handleSetPassword = useCallback((value: string) => {\n setPasswordValue(value);\n }, []);\n\n const handleInputChange = useCallback(\n (value: Record<string, string | number | boolean>) => {\n setInputChange(value);\n },\n []\n );\n\n const handleShowChangePassword = useCallback(() => {\n setShowChangePassword(true);\n setShowEditForm(false);\n handleSetInLineAlert();\n handleSetPassword('');\n }, [handleSetInLineAlert, handleSetPassword]);\n\n const handleHideChangePassword = useCallback((clearStates?: () => void) => {\n clearStates?.();\n setShowChangePassword(false);\n }, []);\n\n const handleShowEditForm = useCallback(() => {\n setShowEditForm(true);\n setShowChangePassword(false);\n handleSetInLineAlert();\n handleSetPassword('');\n }, [handleSetInLineAlert, handleSetPassword]);\n\n const handleHideEditForm = useCallback((clearStates?: () => void) => {\n clearStates?.();\n setShowEditForm(false);\n }, []);\n\n const renderAlertMessage = useCallback(\n (type: 'success' | 'error', message?: string) => {\n if (type === 'success') {\n handleSetInLineAlert({\n type: 'success',\n text: message ?? translations.accountSuccess,\n });\n } else if (type === 'error') {\n handleSetInLineAlert({\n type: 'error',\n text: message ?? translations.accountError,\n });\n } else {\n handleSetInLineAlert();\n }\n\n setSubmitLoading(false);\n },\n [handleSetInLineAlert, translations]\n );\n\n const fetchCustomer = useCallback(() => {\n getCustomer().then((customer: CustomerDataModelShort) => {\n const createAccountDate = customer?.createdAt?.split(' ')[0];\n const modifyCustomerData = transformDobCustomer({\n ...customer,\n gender:\n customer.gender === 1\n ? translations.genderMale\n : translations.genderFemale,\n });\n\n setCustomerData(modifyCustomerData);\n setCreatedAt(createAccountDate);\n });\n }, [translations.genderFemale, translations.genderMale]);\n\n useEffect(() => {\n fetchCustomer();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n getAttributesForm('customer_account_edit').then(\n (attributesFormResponse) => {\n setFormFieldsList(attributesFormResponse);\n\n const result: KeysSortOrderProps[] = attributesFormResponse.map(\n ({ name, customUpperCode, orderNumber, label }) => ({\n name: customUpperCode,\n orderNumber,\n label: !defaultAccountAttributePreset.includes(name as string)\n ? label\n : null,\n })\n );\n\n setKeysSortOrder(result);\n }\n );\n }, []);\n\n useEffect(() => {\n if (inputChange['email'] && inputChange['email'] !== customerData?.email) {\n setShowPasswordOnEmailChange(true);\n } else if (\n inputChange['email'] &&\n inputChange['email'] === customerData?.email\n ) {\n setShowPasswordOnEmailChange(false);\n }\n }, [customerData?.email, inputChange]);\n\n const orderedCustomerData = useMemo(() => {\n if (!keysSortOrder || !customerData) return [];\n\n const result = keysSortOrder\n .filter(\n ({ name }) =>\n name !== undefined && (customerData as Record<string, any>)[name]\n )\n .map((item) => {\n return {\n name: item.name,\n orderNumber: item.orderNumber,\n value: (customerData as Record<string, any>)[item.name],\n label: item.label,\n };\n });\n\n return result;\n }, [customerData, keysSortOrder]);\n\n useEffect(() => {\n orderedCustomerData?.length && setLoading(false);\n }, [orderedCustomerData]);\n\n const normalizeFieldsConfig = useMemo(() => {\n return formFieldsList\n ?.map((el) => ({\n ...el,\n defaultValue:\n el?.customUpperCode && customerData\n ? (customerData as Record<string, any>)[el.customUpperCode] ?? ''\n : '',\n }))\n .map((item) => {\n if (item.customUpperCode === 'gender') {\n return {\n ...item,\n defaultValue: item.defaultValue === 'Male' ? 1 : 2,\n };\n }\n\n return item;\n });\n }, [formFieldsList, customerData]);\n\n const handleUpdateCustomerInformation = useCallback(\n async (event: Event, valid: boolean) => {\n const formValues = getFormValues(event.target as HTMLFormElement);\n\n const { email, password, ...props } = formValues;\n\n const passwordEmpty =\n email !== customerData?.email! && password.length === 0;\n\n if (!valid) {\n if (passwordEmpty) {\n setErrorPasswordEmpty(true);\n }\n return;\n }\n\n setErrorPasswordEmpty(false);\n setSubmitLoading(true);\n\n if (email === customerData?.email!) {\n handleSetPassword('');\n\n updateCustomer(normalizeAttributes(props, 'account'))\n .then((response) => {\n if (!response) return;\n\n fetchCustomer();\n\n renderAlertMessage('success');\n publishEvents(EventsList?.EDIT_ACCOUNT_EVENT, {\n ...formValues,\n });\n })\n .catch((error) => {\n renderAlertMessage('error', error.message);\n });\n\n return;\n }\n\n if (passwordEmpty) {\n setErrorPasswordEmpty(true);\n setSubmitLoading(false);\n return;\n }\n\n if (email?.length && password?.length) {\n updateCustomerEmail({ email, password })\n .then((customerEmail) => {\n if (!customerEmail) return;\n\n updateCustomer(normalizeAttributes(props, 'account'))\n .then((responseCustomer) => {\n if (!responseCustomer) return;\n\n fetchCustomer();\n\n renderAlertMessage('success');\n\n publishEvents(EventsList?.EDIT_ACCOUNT_EVENT, {\n ...formValues,\n });\n })\n .catch((error) => {\n renderAlertMessage('error', error.message);\n });\n })\n .catch((error) => {\n renderAlertMessage('error', error.message);\n });\n }\n },\n [customerData, handleSetPassword, fetchCustomer, renderAlertMessage]\n );\n\n return {\n createdAt,\n errorPasswordEmpty,\n passwordValue,\n showPasswordOnEmailChange,\n orderedCustomerData,\n loading,\n normalizeFieldsConfig,\n submitLoading,\n showEditForm,\n showChangePassword,\n handleShowChangePassword,\n handleHideChangePassword,\n handleShowEditForm,\n handleHideEditForm,\n handleUpdateCustomerInformation,\n handleInputChange,\n handleSetPassword,\n handleOnBlurPassword,\n renderAlertMessage,\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 { useState, useCallback } from 'preact/hooks';\nimport { InLineAlertProps } 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] = useState<InLineAlertProps>(\n {}\n );\n\n const handleSetInLineAlert = useCallback(\n (notification: InLineAlertProps | undefined) => {\n if (!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, handleSetInLineAlert };\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 {\n CardLoader,\n ChangePassword,\n CustomerInformationCard,\n EditCustomerInformation,\n} from '@/account/components';\nimport { useCustomerInformation } from '@/account/hooks/containers/useCustomerInformation';\nimport { useInLineAlert } from '@/account/hooks/useInLineAlert';\nimport { CustomerInformationProps } from '@/account/types';\nimport { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { Header } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport const CustomerInformation: Container<CustomerInformationProps> = ({\n className,\n withHeader = true,\n slots,\n}) => {\n const translations = useText({\n containerTitle: 'Account.minifiedView.CustomerInformation.containerTitle',\n });\n const { inLineAlertProps, handleSetInLineAlert } = useInLineAlert();\n const {\n createdAt,\n errorPasswordEmpty,\n passwordValue,\n showPasswordOnEmailChange,\n orderedCustomerData,\n loading,\n normalizeFieldsConfig,\n submitLoading,\n showEditForm,\n showChangePassword,\n handleShowChangePassword,\n handleHideChangePassword,\n handleShowEditForm,\n handleHideEditForm,\n handleUpdateCustomerInformation,\n handleInputChange,\n handleSetPassword,\n handleOnBlurPassword,\n } = useCustomerInformation({ handleSetInLineAlert });\n\n if (loading)\n return (\n <div data-testid=\"customerInformationLoader\">\n <CardLoader withCard />\n </div>\n );\n\n return (\n <div className={classes(['account-customer-information', className])}>\n {withHeader ? (\n <Header\n title={translations.containerTitle}\n divider={false}\n className={'customer-information__title'}\n />\n ) : null}\n <CustomerInformationCard\n createdAt={createdAt}\n slots={slots}\n orderedCustomerData={orderedCustomerData}\n showEditForm={showEditForm}\n showChangePassword={showChangePassword}\n handleShowChangePassword={handleShowChangePassword}\n handleShowEditForm={handleShowEditForm}\n />\n {showChangePassword ? (\n <ChangePassword\n inLineAlertProps={inLineAlertProps}\n handleSetInLineAlert={handleSetInLineAlert}\n handleHideChangePassword={handleHideChangePassword}\n />\n ) : null}\n {showEditForm ? (\n <EditCustomerInformation\n inLineAlertProps={inLineAlertProps}\n submitLoading={submitLoading}\n formFieldsList={normalizeFieldsConfig}\n errorPasswordEmpty={errorPasswordEmpty}\n passwordValue={passwordValue}\n showPasswordOnEmailChange={showPasswordOnEmailChange}\n handleSetPassword={handleSetPassword}\n handleOnBlurPassword={handleOnBlurPassword}\n handleUpdateCustomerInformation={handleUpdateCustomerInformation}\n handleHideEditForm={handleHideEditForm}\n handleInputChange={handleInputChange}\n />\n ) : null}\n </div>\n );\n};\n"],"names":["transformDobCustomer","customerData","dateOfBirth","rest","ACCOUNT_CONTEXT","EventsList","events","getAdobeDataLayer","setContext","name","data","adobeDataLayer","pushEvent","event","additionalContext","acdl","state","editAccountEvent","eventData","accountData","transformAccount","publishEvents","eventType","eventParams","storeConfigRaw","useCustomerInformation","handleSetInLineAlert","translations","useText","loading","setLoading","useState","submitLoading","setSubmitLoading","showChangePassword","setShowChangePassword","showEditForm","setShowEditForm","errorPasswordEmpty","setErrorPasswordEmpty","showPasswordOnEmailChange","setShowPasswordOnEmailChange","keysSortOrder","setKeysSortOrder","setCustomerData","formFieldsList","setFormFieldsList","inputChange","setInputChange","passwordValue","setPasswordValue","createdAt","setCreatedAt","handleOnBlurPassword","useCallback","value","handleSetPassword","handleInputChange","handleShowChangePassword","handleHideChangePassword","clearStates","handleShowEditForm","handleHideEditForm","renderAlertMessage","type","message","fetchCustomer","getCustomer","customer","createAccountDate","_a","modifyCustomerData","useEffect","getAttributesForm","attributesFormResponse","result","customUpperCode","orderNumber","label","defaultAccountAttributePreset","orderedCustomerData","useMemo","item","normalizeFieldsConfig","el","handleUpdateCustomerInformation","valid","formValues","getFormValues","email","password","props","passwordEmpty","updateCustomer","normalizeAttributes","response","error","updateCustomerEmail","customerEmail","responseCustomer","iconsList","Success","Warning","Error","useInLineAlert","inLineAlertProps","setInLineAlertProps","notification","icon","CustomerInformation","className","withHeader","slots","jsx","CardLoader","jsxs","classes","Header","CustomerInformationCard","ChangePassword","EditCustomerInformation"],"mappings":"+rBAEO,MAAMA,GACXC,GACwE,CACxE,GAAI,EAACA,GAAA,MAAAA,EAAc,aAAa,OAAOA,EAEvC,KAAM,CAAE,YAAAC,EAAa,GAAGC,CAAA,EAASF,EAEjC,MAAO,CAAE,GAAGE,EAAM,IAAKD,CAAA,CAGzB,ECOME,GAAkB,iBAExB,IAAKC,GAAAA,IACHA,EAAA,mBAAqB,eADlBA,IAAAA,GAAA,CAAA,CAAA,EAIL,MAAMC,GAAS,CAEb,mBAAoB,cACtB,EAEO,SAASC,GAAoB,CAElC,cAAO,eAAiB,OAAO,gBAAkB,CAAA,EAE1C,OAAO,cAChB,CAMA,SAASC,GAAWC,EAAcC,EAAW,CAC3C,MAAMC,EAAiBJ,EAAA,EAGvBI,EAAe,KAAK,CAClB,CAACF,CAAI,EAAG,IAAA,CACT,EAGDE,EAAe,KAAK,CAClB,CAACF,CAAI,EAAGC,CAAA,CACT,CACH,CAMA,SAASE,GAAUC,EAAeC,EAAyB,CAClCP,EAAA,EAER,KAAMQ,GAAc,CACjC,MAAMC,EAAQD,EAAK,SAAWA,EAAK,SAAA,EAAa,CAAA,EAEhDA,EAAK,KAAK,CACR,MAAAF,EACA,UAAW,CACT,GAAGG,EACH,GA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7C,CACJ,UAAArD,EACA,mBAAAb,EACA,cAAAW,EACA,0BAAAT,EACA,oBAAAwC,EACA,QAAAnD,EACA,sBAAAsD,EACA,cAAAnD,EACA,aAAAI,EACA,mBAAAF,EACA,yBAAAwB,EACA,yBAAAC,EACA,mBAAAE,EACA,mBAAAC,EACA,gCAAAuB,EACA,kBAAA5B,EACA,kBAAAD,EACA,qBAAAH,CAAA,EACE5B,GAAuB,CAAE,qBAAAC,EAAsB,EAEnD,OAAIG,EAEAoF,EAAC,OAAI,cAAY,4BACf,WAACC,GAAA,CAAW,SAAQ,GAAC,CAAA,CACvB,EAIFC,GAAC,OAAI,UAAWC,GAAQ,CAAC,+BAAgCN,CAAS,CAAC,EAChE,SAAA,CAAAC,EACCE,EAACI,GAAA,CACC,MAAO1F,EAAa,eACpB,QAAS,GACT,UAAW,6BAAA,CAAA,EAEX,KACJsF,EAACK,GAAA,CACC,UAAAnE,EACA,MAAA6D,EACA,oBAAAhC,EACA,aAAA5C,EACA,mBAAAF,EACA,yBAAAwB,EACA,mBAAAG,CAAA,CAAA,EAED3B,EACC+E,EAACM,GAAA,CACC,iBAAAd,EACA,qBAAA/E,EACA,yBAAAiC,CAAA,CAAA,EAEA,KACHvB,EACC6E,EAACO,GAAA,CACC,iBAAAf,EACA,cAAAzE,EACA,eAAgBmD,EAChB,mBAAA7C,EACA,cAAAW,EACA,0BAAAT,EACA,kBAAAgB,EACA,qBAAAH,EACA,gCAAAgC,EACA,mBAAAvB,EACA,kBAAAL,CAAA,CAAA,EAEA,IAAA,EACN,CAEJ"}
|
|
1
|
+
{"version":3,"file":"CustomerInformation.js","sources":["/@dropins/storefront-account/src/lib/transformDobCustomer.ts","/@dropins/storefront-account/src/lib/acdl.ts","/@dropins/storefront-account/src/hooks/containers/useCustomerInformation.tsx","/@dropins/storefront-account/src/hooks/useInLineAlert.tsx","/@dropins/storefront-account/src/containers/CustomerInformation/CustomerInformation.tsx"],"sourcesContent":["import { CustomerDataModelShort } from '@/account/data/models/customer';\n\nexport const transformDobCustomer = (\n customerData: CustomerDataModelShort\n): CustomerDataModelShort | (CustomerDataModelShort & { dob: string }) => {\n if (!customerData?.dateOfBirth) return customerData;\n\n const { dateOfBirth, ...rest } = customerData;\n\n return { ...rest, dob: dateOfBirth } as CustomerDataModelShort & {\n dob: string;\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 { transformAccount } from '../data/transforms';\n\nconst ACCOUNT_CONTEXT = 'accountContext';\n\nenum EventsList {\n EDIT_ACCOUNT_EVENT = 'edit-account',\n}\n\nconst events = {\n // Reference - https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/editAccountAEP.ts\n EDIT_ACCOUNT_EVENT: EventsList.EDIT_ACCOUNT_EVENT,\n};\n\nexport function getAdobeDataLayer() {\n // @ts-ignore\n window.adobeDataLayer = window.adobeDataLayer || [];\n // @ts-ignore\n return window.adobeDataLayer;\n}\n\n/**\n * Sets a context in the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/Base.ts#L6\n */\nfunction setContext(name: string, data: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n // Clear existing context\n adobeDataLayer.push({\n [name]: null,\n });\n\n // Set new context\n adobeDataLayer.push({\n [name]: data,\n });\n}\n\n/**\n * Pushes an event to the Adobe Client Data Layer (ACDL)\n * Logic based on: https://github.com/adobe/commerce-events/blob/1973d0ce28471ef190fa06dad6359ffa0ab51db6/packages/storefront-events-sdk/src/Base.ts#L34\n */\nfunction pushEvent(event: string, additionalContext?: any) {\n const adobeDataLayer = getAdobeDataLayer();\n\n adobeDataLayer.push((acdl: any) => {\n const state = acdl.getState ? acdl.getState() : {};\n\n acdl.push({\n event,\n eventInfo: {\n ...state,\n ...additionalContext,\n },\n });\n });\n}\n\n/**\n * References:\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/handlers/account/editAccountAEP.ts\n * https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-collector/src/utils/aep/account.ts\n */\nfunction editAccountEvent(eventData: any) {\n const accountData = transformAccount(eventData);\n\n setContext(ACCOUNT_CONTEXT, accountData);\n\n pushEvent(events.EDIT_ACCOUNT_EVENT);\n}\n\nconst publishEvents = (eventType: string, eventParams: any) => {\n const storeConfigRaw = sessionStorage.getItem('accountStoreConfig');\n const storeConfig = storeConfigRaw ? JSON.parse(storeConfigRaw) : {};\n const eventData = { ...storeConfig, ...eventParams };\n\n switch (eventType) {\n case EventsList.EDIT_ACCOUNT_EVENT:\n editAccountEvent(eventData);\n break;\n\n default:\n return null;\n }\n};\n\nexport { EventsList, publishEvents, pushEvent };\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 { useCallback, useEffect, useMemo, useState } from 'preact/hooks';\nimport {\n getAttributesForm,\n getCustomer,\n updateCustomerEmail,\n updateCustomer,\n} from '@/account/api';\nimport {\n KeysSortOrderProps,\n UseCustomerInformationProps,\n} from '@/account/types';\nimport { defaultAccountAttributePreset } from '@/account/configs/defaultAttributePreset.config';\nimport { CustomerDataModelShort } from '@/account/data/models/customer';\nimport { AttributesFormModel } from '@/account/data/models';\nimport { getFormValues } from '@/account/lib/getFormValues';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { normalizeAttributes } from '@/account/lib/normalizeAttributes';\nimport { transformDobCustomer } from '@/account/lib/transformDobCustomer';\nimport { EventsList, publishEvents } from '@/account/lib/acdl';\n\nexport const useCustomerInformation = ({\n handleSetInLineAlert,\n}: UseCustomerInformationProps) => {\n const translations = useText({\n accountSuccess:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.accountSuccess',\n accountError:\n 'Account.minifiedView.CustomerInformation.editCustomerInformation.accountError',\n genderMale: 'Account.minifiedView.CustomerInformation.genderMale',\n genderFemale: 'Account.minifiedView.CustomerInformation.genderFemale',\n });\n const [loading, setLoading] = useState<boolean>(true);\n const [submitLoading, setSubmitLoading] = useState<boolean>(false);\n const [showChangePassword, setShowChangePassword] = useState<boolean>(false);\n const [showEditForm, setShowEditForm] = useState<boolean>(false);\n const [errorPasswordEmpty, setErrorPasswordEmpty] = useState(false);\n const [showPasswordOnEmailChange, setShowPasswordOnEmailChange] =\n useState(false);\n const [keysSortOrder, setKeysSortOrder] = useState<KeysSortOrderProps[] | []>(\n []\n );\n const [customerData, setCustomerData] =\n useState<CustomerDataModelShort | null>(null);\n const [formFieldsList, setFormFieldsList] = useState<\n AttributesFormModel[] | []\n >([]);\n const [inputChange, setInputChange] = useState<\n Record<string, string | number | boolean>\n >({});\n const [passwordValue, setPasswordValue] = useState('');\n const [createdAt, setCreatedAt] = useState('');\n\n const handleOnBlurPassword = useCallback((event: Event) => {\n const { value } = event?.target as HTMLInputElement;\n\n if (value.length) setErrorPasswordEmpty(false);\n if (!value.length) setErrorPasswordEmpty(true);\n }, []);\n\n const handleSetPassword = useCallback((value: string) => {\n setPasswordValue(value);\n }, []);\n\n const handleInputChange = useCallback(\n (value: Record<string, string | number | boolean>) => {\n setInputChange(value);\n },\n []\n );\n\n const handleShowChangePassword = useCallback(() => {\n setShowChangePassword(true);\n setShowEditForm(false);\n handleSetInLineAlert();\n handleSetPassword('');\n }, [handleSetInLineAlert, handleSetPassword]);\n\n const handleHideChangePassword = useCallback((clearStates?: () => void) => {\n clearStates?.();\n setShowChangePassword(false);\n }, []);\n\n const handleShowEditForm = useCallback(() => {\n setShowEditForm(true);\n setShowChangePassword(false);\n handleSetInLineAlert();\n handleSetPassword('');\n }, [handleSetInLineAlert, handleSetPassword]);\n\n const handleHideEditForm = useCallback((clearStates?: () => void) => {\n clearStates?.();\n setShowEditForm(false);\n }, []);\n\n const renderAlertMessage = useCallback(\n (type: 'success' | 'error', message?: string) => {\n if (type === 'success') {\n handleSetInLineAlert({\n type: 'success',\n text: message ?? translations.accountSuccess,\n });\n } else if (type === 'error') {\n handleSetInLineAlert({\n type: 'error',\n text: message ?? translations.accountError,\n });\n } else {\n handleSetInLineAlert();\n }\n\n setSubmitLoading(false);\n },\n [handleSetInLineAlert, translations]\n );\n\n const fetchCustomer = useCallback(() => {\n getCustomer().then((customer: CustomerDataModelShort) => {\n const createAccountDate = customer?.createdAt?.split(' ')[0];\n const modifyCustomerData = transformDobCustomer({\n ...customer,\n gender:\n customer.gender === 1\n ? translations.genderMale\n : translations.genderFemale,\n });\n\n setCustomerData(modifyCustomerData);\n setCreatedAt(createAccountDate);\n });\n }, [translations.genderFemale, translations.genderMale]);\n\n useEffect(() => {\n fetchCustomer();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n getAttributesForm('customer_account_edit').then(\n (attributesFormResponse) => {\n setFormFieldsList(attributesFormResponse);\n\n const result: KeysSortOrderProps[] = attributesFormResponse.map(\n ({ name, customUpperCode, orderNumber, label }) => ({\n name: customUpperCode,\n orderNumber,\n label: !defaultAccountAttributePreset.includes(name as string)\n ? label\n : null,\n })\n );\n\n setKeysSortOrder(result);\n }\n );\n }, []);\n\n useEffect(() => {\n if (inputChange['email'] && inputChange['email'] !== customerData?.email) {\n setShowPasswordOnEmailChange(true);\n } else if (\n inputChange['email'] &&\n inputChange['email'] === customerData?.email\n ) {\n setShowPasswordOnEmailChange(false);\n }\n }, [customerData?.email, inputChange]);\n\n const orderedCustomerData = useMemo(() => {\n if (!keysSortOrder || !customerData) return [];\n\n const result = keysSortOrder\n .filter(\n ({ name }) =>\n name !== undefined && (customerData as Record<string, any>)[name]\n )\n .map((item) => {\n return {\n name: item.name,\n orderNumber: item.orderNumber,\n value: (customerData as Record<string, any>)[item.name],\n label: item.label,\n };\n });\n\n return result;\n }, [customerData, keysSortOrder]);\n\n useEffect(() => {\n orderedCustomerData?.length && setLoading(false);\n }, [orderedCustomerData]);\n\n const normalizeFieldsConfig = useMemo(() => {\n return formFieldsList\n ?.map((el) => ({\n ...el,\n defaultValue:\n el?.customUpperCode && customerData\n ? (customerData as Record<string, any>)[el.customUpperCode] ?? ''\n : '',\n }))\n .map((item) => {\n if (item.customUpperCode === 'gender') {\n return {\n ...item,\n defaultValue: item.defaultValue === 'Male' ? 1 : 2,\n };\n }\n\n return item;\n });\n }, [formFieldsList, customerData]);\n\n const handleUpdateCustomerInformation = useCallback(\n async (event: Event, valid: boolean) => {\n const formValues = getFormValues(event.target as HTMLFormElement);\n\n const { email, password, ...props } = formValues;\n\n const passwordEmpty =\n email !== customerData?.email! && password.length === 0;\n\n if (!valid) {\n if (passwordEmpty) {\n setErrorPasswordEmpty(true);\n }\n return;\n }\n\n setErrorPasswordEmpty(false);\n setSubmitLoading(true);\n\n if (email === customerData?.email!) {\n handleSetPassword('');\n\n updateCustomer(normalizeAttributes(props, 'account'))\n .then((response) => {\n if (!response) return;\n\n fetchCustomer();\n\n renderAlertMessage('success');\n publishEvents(EventsList?.EDIT_ACCOUNT_EVENT, {\n ...formValues,\n });\n })\n .catch((error) => {\n renderAlertMessage('error', error.message);\n });\n\n return;\n }\n\n if (passwordEmpty) {\n setErrorPasswordEmpty(true);\n setSubmitLoading(false);\n return;\n }\n\n if (email?.length && password?.length) {\n updateCustomerEmail({ email, password })\n .then((customerEmail) => {\n if (!customerEmail) return;\n\n updateCustomer(normalizeAttributes(props, 'account'))\n .then((responseCustomer) => {\n if (!responseCustomer) return;\n\n fetchCustomer();\n\n renderAlertMessage('success');\n\n publishEvents(EventsList?.EDIT_ACCOUNT_EVENT, {\n ...formValues,\n });\n })\n .catch((error) => {\n renderAlertMessage('error', error.message);\n });\n })\n .catch((error) => {\n renderAlertMessage('error', error.message);\n });\n }\n },\n [customerData, handleSetPassword, fetchCustomer, renderAlertMessage]\n );\n\n return {\n createdAt,\n errorPasswordEmpty,\n passwordValue,\n showPasswordOnEmailChange,\n orderedCustomerData,\n loading,\n normalizeFieldsConfig,\n submitLoading,\n showEditForm,\n showChangePassword,\n handleShowChangePassword,\n handleHideChangePassword,\n handleShowEditForm,\n handleHideEditForm,\n handleUpdateCustomerInformation,\n handleInputChange,\n handleSetPassword,\n handleOnBlurPassword,\n renderAlertMessage,\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 { useState, useCallback } from 'preact/hooks';\nimport { InLineAlertProps } 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] = useState<InLineAlertProps>(\n {}\n );\n\n const handleSetInLineAlert = useCallback(\n (notification: InLineAlertProps | undefined) => {\n if (!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, handleSetInLineAlert };\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 {\n CardLoader,\n ChangePassword,\n CustomerInformationCard,\n EditCustomerInformation,\n} from '@/account/components';\nimport { useCustomerInformation } from '@/account/hooks/containers/useCustomerInformation';\nimport { useInLineAlert } from '@/account/hooks/useInLineAlert';\nimport { CustomerInformationProps } from '@/account/types';\nimport { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { Header } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport const CustomerInformation: Container<CustomerInformationProps> = ({\n className,\n withHeader = true,\n slots,\n}) => {\n const translations = useText({\n containerTitle: 'Account.minifiedView.CustomerInformation.containerTitle',\n });\n const { inLineAlertProps, handleSetInLineAlert } = useInLineAlert();\n const {\n createdAt,\n errorPasswordEmpty,\n passwordValue,\n showPasswordOnEmailChange,\n orderedCustomerData,\n loading,\n normalizeFieldsConfig,\n submitLoading,\n showEditForm,\n showChangePassword,\n handleShowChangePassword,\n handleHideChangePassword,\n handleShowEditForm,\n handleHideEditForm,\n handleUpdateCustomerInformation,\n handleInputChange,\n handleSetPassword,\n handleOnBlurPassword,\n } = useCustomerInformation({ handleSetInLineAlert });\n\n if (loading)\n return (\n <div data-testid=\"customerInformationLoader\">\n <CardLoader withCard />\n </div>\n );\n\n return (\n <div className={classes(['account-customer-information', className])}>\n {withHeader ? (\n <Header\n title={translations.containerTitle}\n divider={false}\n className={'customer-information__title'}\n />\n ) : null}\n <CustomerInformationCard\n createdAt={createdAt}\n slots={slots}\n orderedCustomerData={orderedCustomerData}\n showEditForm={showEditForm}\n showChangePassword={showChangePassword}\n handleShowChangePassword={handleShowChangePassword}\n handleShowEditForm={handleShowEditForm}\n />\n {showChangePassword ? (\n <ChangePassword\n inLineAlertProps={inLineAlertProps}\n handleSetInLineAlert={handleSetInLineAlert}\n handleHideChangePassword={handleHideChangePassword}\n />\n ) : null}\n {showEditForm ? (\n <EditCustomerInformation\n inLineAlertProps={inLineAlertProps}\n submitLoading={submitLoading}\n formFieldsList={normalizeFieldsConfig}\n errorPasswordEmpty={errorPasswordEmpty}\n passwordValue={passwordValue}\n showPasswordOnEmailChange={showPasswordOnEmailChange}\n handleSetPassword={handleSetPassword}\n handleOnBlurPassword={handleOnBlurPassword}\n handleUpdateCustomerInformation={handleUpdateCustomerInformation}\n handleHideEditForm={handleHideEditForm}\n handleInputChange={handleInputChange}\n />\n ) : null}\n </div>\n );\n};\n"],"names":["transformDobCustomer","customerData","dateOfBirth","rest","ACCOUNT_CONTEXT","EventsList","events","getAdobeDataLayer","setContext","name","data","adobeDataLayer","pushEvent","event","additionalContext","acdl","state","editAccountEvent","eventData","accountData","transformAccount","publishEvents","eventType","eventParams","storeConfigRaw","useCustomerInformation","handleSetInLineAlert","translations","useText","loading","setLoading","useState","submitLoading","setSubmitLoading","showChangePassword","setShowChangePassword","showEditForm","setShowEditForm","errorPasswordEmpty","setErrorPasswordEmpty","showPasswordOnEmailChange","setShowPasswordOnEmailChange","keysSortOrder","setKeysSortOrder","setCustomerData","formFieldsList","setFormFieldsList","inputChange","setInputChange","passwordValue","setPasswordValue","createdAt","setCreatedAt","handleOnBlurPassword","useCallback","value","handleSetPassword","handleInputChange","handleShowChangePassword","handleHideChangePassword","clearStates","handleShowEditForm","handleHideEditForm","renderAlertMessage","type","message","fetchCustomer","getCustomer","customer","createAccountDate","_a","modifyCustomerData","useEffect","getAttributesForm","attributesFormResponse","result","customUpperCode","orderNumber","label","defaultAccountAttributePreset","orderedCustomerData","useMemo","item","normalizeFieldsConfig","el","handleUpdateCustomerInformation","valid","formValues","getFormValues","email","password","props","passwordEmpty","updateCustomer","normalizeAttributes","response","error","updateCustomerEmail","customerEmail","responseCustomer","iconsList","Success","Warning","Error","useInLineAlert","inLineAlertProps","setInLineAlertProps","notification","icon","CustomerInformation","className","withHeader","slots","jsx","CardLoader","jsxs","classes","Header","CustomerInformationCard","ChangePassword","EditCustomerInformation"],"mappings":"utBAEO,MAAMA,GACXC,GACwE,CACxE,GAAI,EAACA,GAAA,MAAAA,EAAc,aAAa,OAAOA,EAEvC,KAAM,CAAE,YAAAC,EAAa,GAAGC,CAAA,EAASF,EAEjC,MAAO,CAAE,GAAGE,EAAM,IAAKD,CAAA,CAGzB,ECOME,GAAkB,iBAExB,IAAKC,GAAAA,IACHA,EAAA,mBAAqB,eADlBA,IAAAA,GAAA,CAAA,CAAA,EAIL,MAAMC,GAAS,CAEb,mBAAoB,cACtB,EAEO,SAASC,GAAoB,CAElC,cAAO,eAAiB,OAAO,gBAAkB,CAAA,EAE1C,OAAO,cAChB,CAMA,SAASC,GAAWC,EAAcC,EAAW,CAC3C,MAAMC,EAAiBJ,EAAA,EAGvBI,EAAe,KAAK,CAClB,CAACF,CAAI,EAAG,IAAA,CACT,EAGDE,EAAe,KAAK,CAClB,CAACF,CAAI,EAAGC,CAAA,CACT,CACH,CAMA,SAASE,GAAUC,EAAeC,EAAyB,CAClCP,EAAA,EAER,KAAMQ,GAAc,CACjC,MAAMC,EAAQD,EAAK,SAAWA,EAAK,SAAA,EAAa,CAAA,EAEhDA,EAAK,KAAK,CACR,MAAAF,EACA,UAAW,CACT,GAAGG,EACH,GAAGF,CAAA,CACL,CACD,CACH,CAAC,CACH,CAOA,SAASG,GAAiBC,EAAgB,CACxC,MAAMC,EAAcC,GAAiBF,CAAS,EAE9CV,GAAWJ,GAAiBe,CAAW,EAEvCP,GAAUN,GAAO,kBAAkB,CACrC,CAEA,MAAMe,EAAgB,CAACC,EAAmBC,IAAqB,CAC7D,MAAMC,EAAiB,eAAe,QAAQ,oBAAoB,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EACE5B,GAAuB,CAAE,qBAAAC,EAAsB,EAEnD,OAAIG,EAEAoF,EAAC,OAAI,cAAY,4BACf,WAACC,GAAA,CAAW,SAAQ,GAAC,CAAA,CACvB,EAIFC,GAAC,OAAI,UAAWC,GAAQ,CAAC,+BAAgCN,CAAS,CAAC,EAChE,SAAA,CAAAC,EACCE,EAACI,GAAA,CACC,MAAO1F,EAAa,eACpB,QAAS,GACT,UAAW,6BAAA,CAAA,EAEX,KACJsF,EAACK,GAAA,CACC,UAAAnE,EACA,MAAA6D,EACA,oBAAAhC,EACA,aAAA5C,EACA,mBAAAF,EACA,yBAAAwB,EACA,mBAAAG,CAAA,CAAA,EAED3B,EACC+E,EAACM,GAAA,CACC,iBAAAd,EACA,qBAAA/E,EACA,yBAAAiC,CAAA,CAAA,EAEA,KACHvB,EACC6E,EAACO,GAAA,CACC,iBAAAf,EACA,cAAAzE,EACA,eAAgBmD,EAChB,mBAAA7C,EACA,cAAAW,EACA,0BAAAT,EACA,kBAAAgB,EACA,qBAAAH,EACA,gCAAAgC,EACA,mBAAAvB,EACA,kBAAAL,CAAA,CAAA,EAEA,IAAA,EACN,CAEJ"}
|
package/containers/OrdersList.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{classes as u}from"@dropins/tools/lib.js";import{O as L}from"./AddressForm.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"../api.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/preact.js";const
|
|
3
|
+
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{classes as u}from"@dropins/tools/lib.js";import{O as L}from"./AddressForm.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"../api.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"@dropins/tools/preact.js";const y=({className:r,withHeader:o,minifiedView:i,withThumbnails:s,withFilter:m,ordersInMinifiedView:p,pageSize:e,routeOrdersList:d,routeOrderDetails:a,routeReturnDetails:c,routeTracking:f,routeOrderProduct:l,slots:n})=>t("div",{className:u(["account-orders-list",r]),"data-testid":"ordersListId",children:t(L,{className:r,withHeader:o,minifiedView:i,withThumbnails:s,withFilter:m,ordersInMinifiedView:p,pageSize:e,routeOrdersList:d,routeOrderDetails:a,routeReturnDetails:c,routeTracking:f,routeOrderProduct:l,slots:n})});export{y as OrdersList,y as default};
|
|
4
4
|
//# sourceMappingURL=OrdersList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrdersList.js","sources":["/@dropins/storefront-account/src/containers/OrdersList/OrdersList.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\nimport { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { OrdersListProps } from '@/account/types';\nimport { OrdersListWrapper } from '@/account/components/OrdersListWrapper';\n\nexport const OrdersList: Container<OrdersListProps> = ({\n className,\n withHeader,\n minifiedView,\n withThumbnails,\n withFilter,\n ordersInMinifiedView,\n pageSize,\n routeOrdersList,\n routeOrderDetails,\n routeReturnDetails,\n routeTracking,\n routeOrderProduct,\n slots,\n}) => {\n return (\n <div\n className={classes(['account-orders-list', className])}\n data-testid=\"ordersListId\"\n >\n <OrdersListWrapper\n className={className}\n withHeader={withHeader}\n minifiedView={minifiedView}\n withThumbnails={withThumbnails}\n withFilter={withFilter}\n ordersInMinifiedView={ordersInMinifiedView}\n pageSize={pageSize}\n routeOrdersList={routeOrdersList}\n routeOrderDetails={routeOrderDetails}\n routeReturnDetails={routeReturnDetails}\n routeTracking={routeTracking}\n routeOrderProduct={routeOrderProduct}\n slots={slots}\n />\n </div>\n );\n};\n"],"names":["OrdersList","className","withHeader","minifiedView","withThumbnails","withFilter","ordersInMinifiedView","pageSize","routeOrdersList","routeOrderDetails","routeReturnDetails","routeTracking","routeOrderProduct","slots","jsx","classes","OrdersListWrapper"],"mappings":"
|
|
1
|
+
{"version":3,"file":"OrdersList.js","sources":["/@dropins/storefront-account/src/containers/OrdersList/OrdersList.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\nimport { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { OrdersListProps } from '@/account/types';\nimport { OrdersListWrapper } from '@/account/components/OrdersListWrapper';\n\nexport const OrdersList: Container<OrdersListProps> = ({\n className,\n withHeader,\n minifiedView,\n withThumbnails,\n withFilter,\n ordersInMinifiedView,\n pageSize,\n routeOrdersList,\n routeOrderDetails,\n routeReturnDetails,\n routeTracking,\n routeOrderProduct,\n slots,\n}) => {\n return (\n <div\n className={classes(['account-orders-list', className])}\n data-testid=\"ordersListId\"\n >\n <OrdersListWrapper\n className={className}\n withHeader={withHeader}\n minifiedView={minifiedView}\n withThumbnails={withThumbnails}\n withFilter={withFilter}\n ordersInMinifiedView={ordersInMinifiedView}\n pageSize={pageSize}\n routeOrdersList={routeOrdersList}\n routeOrderDetails={routeOrderDetails}\n routeReturnDetails={routeReturnDetails}\n routeTracking={routeTracking}\n routeOrderProduct={routeOrderProduct}\n slots={slots}\n />\n </div>\n );\n};\n"],"names":["OrdersList","className","withHeader","minifiedView","withThumbnails","withFilter","ordersInMinifiedView","pageSize","routeOrdersList","routeOrderDetails","routeReturnDetails","routeTracking","routeOrderProduct","slots","jsx","classes","OrdersListWrapper"],"mappings":"0bAqBO,MAAMA,EAAyC,CAAC,CACrD,UAAAC,EACA,WAAAC,EACA,aAAAC,EACA,eAAAC,EACA,WAAAC,EACA,qBAAAC,EACA,SAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,mBAAAC,EACA,cAAAC,EACA,kBAAAC,EACA,MAAAC,CACF,IAEIC,EAAC,MAAA,CACC,UAAWC,EAAQ,CAAC,sBAAuBd,CAAS,CAAC,EACrD,cAAY,eAEZ,SAAAa,EAACE,EAAA,CACC,UAAAf,EACA,WAAAC,EACA,aAAAC,EACA,eAAAC,EACA,WAAAC,EACA,qBAAAC,EACA,SAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,mBAAAC,EACA,cAAAC,EACA,kBAAAC,EACA,MAAAC,CAAA,CAAA,CACF,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{classes as m}from"@dropins/tools/lib.js";import{P as
|
|
3
|
+
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{classes as m}from"@dropins/tools/lib.js";import{P as p}from"./AddressForm.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"../api.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"@dropins/tools/preact.js";const M=({className:o,...r})=>t("div",{className:m(["account-payment-methods-root",o]),"data-testid":"paymentMethodsRoot",children:t(p,{...r})});export{M as PaymentMethods,M as default};
|
|
4
4
|
//# sourceMappingURL=PaymentMethods.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentMethods.js","sources":["/@dropins/storefront-account/src/containers/PaymentMethods/PaymentMethods.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2026 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 { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { PaymentMethodsProps } from '@/account/types';\nimport { PaymentMethodsWrapper } from '@/account/components/PaymentMethodsWrapper';\n\nexport const PaymentMethods: Container<PaymentMethodsProps> = ({\n className,\n ...rest\n}) => {\n return (\n <div\n className={classes(['account-payment-methods-root', className])}\n data-testid=\"paymentMethodsRoot\"\n >\n <PaymentMethodsWrapper {...rest} />\n </div>\n );\n};\n"],"names":["PaymentMethods","className","rest","jsx","classes","PaymentMethodsWrapper"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PaymentMethods.js","sources":["/@dropins/storefront-account/src/containers/PaymentMethods/PaymentMethods.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2026 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 { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { PaymentMethodsProps } from '@/account/types';\nimport { PaymentMethodsWrapper } from '@/account/components/PaymentMethodsWrapper';\n\nexport const PaymentMethods: Container<PaymentMethodsProps> = ({\n className,\n ...rest\n}) => {\n return (\n <div\n className={classes(['account-payment-methods-root', className])}\n data-testid=\"paymentMethodsRoot\"\n >\n <PaymentMethodsWrapper {...rest} />\n </div>\n );\n};\n"],"names":["PaymentMethods","className","rest","jsx","classes","PaymentMethodsWrapper"],"mappings":"0bAqBO,MAAMA,EAAiD,CAAC,CAC7D,UAAAC,EACA,GAAGC,CACL,IAEIC,EAAC,MAAA,CACC,UAAWC,EAAQ,CAAC,+BAAgCH,CAAS,CAAC,EAC9D,cAAY,qBAEZ,SAAAE,EAACE,EAAA,CAAuB,GAAGH,CAAA,CAAM,CAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as y}from"@dropins/tools/preact-jsx-runtime.js";import{classes as m}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{getAdminAssistanceActions as v}from"../api.js";import{useState as r,useEffect as A,useCallback as _}from"@dropins/tools/preact-hooks.js";import{u as f,a as B}from"./AddressForm.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import{useText as C}from"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/preact.js";const T=(c={})=>{const{pageSize:s=10}=c,[d,e]=r(!0),[u,l]=r(null),[p,o]=r(null),[
|
|
3
|
+
import{jsx as y}from"@dropins/tools/preact-jsx-runtime.js";import{classes as m}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{getAdminAssistanceActions as v}from"../api.js";import{useState as r,useEffect as A,useCallback as _}from"@dropins/tools/preact-hooks.js";import{u as f,a as B}from"./AddressForm.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import{useText as C}from"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"@dropins/tools/preact.js";const T=(c={})=>{const{pageSize:s=10}=c,[d,e]=r(!0),[u,l]=r(null),[p,o]=r(null),[i,n]=r(1);A(()=>{n(1)},[s]),A(()=>{e(!0),o(null),v(s,i).then(t=>{l(t)}).catch(t=>{console.error("Failed to fetch admin assistance actions:",t),o(t instanceof Error?t.message:String(t))}).finally(()=>{e(!1)})},[i,s]);const a=_(t=>{n(t)},[]);return{loading:d,adminAssistanceActions:u,error:p,currentPage:i,handlePageChange:a}},q=({className:c,pageSize:s=10,withWrapper:d=!0})=>{const e=C({actionHeader:"Account.sellerAssistedBuyingActivity.tableHeaders.action",dateHeader:"Account.sellerAssistedBuyingActivity.tableHeaders.date",detailsHeader:"Account.sellerAssistedBuyingActivity.tableHeaders.details",emptyStateMessage:"Account.sellerAssistedBuyingActivity.emptyStateMessage",errorMessage:"Account.sellerAssistedBuyingActivity.errorMessage",featureDisabledMessage:"Account.sellerAssistedBuyingActivity.featureDisabledMessage",placeOrder:"Account.sellerAssistedBuyingActivity.actionTypes.place_order",addToCart:"Account.sellerAssistedBuyingActivity.actionTypes.add_to_cart",removeFromCart:"Account.sellerAssistedBuyingActivity.actionTypes.remove_from_cart",removeCartItem:"Account.sellerAssistedBuyingActivity.actionTypes.remove_cart_item",updateQty:"Account.sellerAssistedBuyingActivity.actionTypes.update_qty",applyCoupon:"Account.sellerAssistedBuyingActivity.actionTypes.apply_coupon",removeCoupon:"Account.sellerAssistedBuyingActivity.actionTypes.remove_coupon",updateAddress:"Account.sellerAssistedBuyingActivity.actionTypes.update_address",updatePayment:"Account.sellerAssistedBuyingActivity.actionTypes.update_payment",updateShipping:"Account.sellerAssistedBuyingActivity.actionTypes.update_shipping",addProductNote:"Account.sellerAssistedBuyingActivity.actionTypes.add_product_note",updateCustomerInfo:"Account.sellerAssistedBuyingActivity.actionTypes.update_customer_info",save:"Account.sellerAssistedBuyingActivity.actionTypes.save"}),{loading:u,adminAssistanceActions:l,error:p,currentPage:o,handlePageChange:i}=T({pageSize:s}),{loading:n,remoteShoppingAssistanceConfigs:a}=f(),t={action:e.actionHeader,date:e.dateHeader,details:e.detailsHeader},g={place_order:e.placeOrder,add_to_cart:e.addToCart,remove_from_cart:e.removeFromCart,remove_cart_item:e.removeCartItem,update_qty:e.updateQty,apply_coupon:e.applyCoupon,remove_coupon:e.removeCoupon,update_address:e.updateAddress,update_payment:e.updatePayment,update_shipping:e.updateShipping,add_product_note:e.addProductNote,update_customer_info:e.updateCustomerInfo,save:e.save};return y("div",{className:m(["account-seller-assisted-buying-activity",c]),"data-testid":"sellerAssistedBuyingActivityId",children:y(B,{loading:n||u,adminAssistanceActions:l,tableHeaders:t,actionTypesMap:g,emptyStateMessage:e.emptyStateMessage,featureDisabledMessage:e.featureDisabledMessage,isRemoteShoppingAssistanceAvailable:(a==null?void 0:a.shoppingAssistanceEnabled)??!1,errorMessage:p?e.errorMessage:void 0,currentPage:o,onPageChange:i,withWrapper:d})})};export{q as SellerAssistedBuyingActivity,q as default};
|
|
4
4
|
//# sourceMappingURL=SellerAssistedBuyingActivity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SellerAssistedBuyingActivity.js","sources":["/@dropins/storefront-account/src/hooks/containers/useSellerAssistedBuyingActivity.tsx","/@dropins/storefront-account/src/containers/SellerAssistedBuyingActivity/SellerAssistedBuyingActivity.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2026 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 { getAdminAssistanceActions } from '@/account/api';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport {\n UseSellerAssistedBuyingActivityReturn,\n UseSellerAssistedBuyingActivityProps,\n AdminAssistanceActions,\n} from '@/account/types';\n\nexport const useSellerAssistedBuyingActivity = (\n props: UseSellerAssistedBuyingActivityProps = {}\n): UseSellerAssistedBuyingActivityReturn => {\n const { pageSize = 10 } = props;\n const [loading, setLoading] = useState<boolean>(true);\n const [adminAssistanceActions, setAdminAssistanceActions] =\n useState<AdminAssistanceActions | null>(null);\n const [error, setError] = useState<string | null>(null);\n const [currentPage, setCurrentPage] = useState<number>(1);\n\n // Reset to page 1 when pageSize changes to avoid out-of-range page requests\n useEffect(() => {\n setCurrentPage(1);\n }, [pageSize]);\n\n useEffect(() => {\n setLoading(true);\n setError(null);\n\n getAdminAssistanceActions(pageSize, currentPage)\n .then((adminAssistanceActions) => {\n setAdminAssistanceActions(adminAssistanceActions);\n })\n .catch((err) => {\n console.error('Failed to fetch admin assistance actions:', err);\n setError(err instanceof Error ? err.message : String(err));\n })\n .finally(() => {\n setLoading(false);\n });\n }, [currentPage, pageSize]);\n\n const handlePageChange = useCallback((page: number) => {\n setCurrentPage(page);\n }, []);\n\n return {\n loading,\n adminAssistanceActions,\n error,\n currentPage,\n handlePageChange,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2026 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 { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { useSellerAssistedBuyingActivity } from '@/account/hooks/containers/useSellerAssistedBuyingActivity';\nimport { useGetStoreConfigs } from '@/account/hooks/containers/useGetStoreConfigs';\nimport { SellerAssistedBuyingActivityProps } from '@/account/types';\nimport { SellerAssistedBuyingActivityTable } from '@/account/components';\n\nexport const SellerAssistedBuyingActivity: Container<\n SellerAssistedBuyingActivityProps\n> = ({ className, pageSize = 10, withWrapper = true }) => {\n const translations = useText({\n actionHeader: 'Account.sellerAssistedBuyingActivity.tableHeaders.action',\n dateHeader: 'Account.sellerAssistedBuyingActivity.tableHeaders.date',\n detailsHeader: 'Account.sellerAssistedBuyingActivity.tableHeaders.details',\n emptyStateMessage: 'Account.sellerAssistedBuyingActivity.emptyStateMessage',\n errorMessage: 'Account.sellerAssistedBuyingActivity.errorMessage',\n featureDisabledMessage:\n 'Account.sellerAssistedBuyingActivity.featureDisabledMessage',\n // Action types translations\n placeOrder: 'Account.sellerAssistedBuyingActivity.actionTypes.place_order',\n addToCart: 'Account.sellerAssistedBuyingActivity.actionTypes.add_to_cart',\n removeFromCart:\n 'Account.sellerAssistedBuyingActivity.actionTypes.remove_from_cart',\n removeCartItem:\n 'Account.sellerAssistedBuyingActivity.actionTypes.remove_cart_item',\n updateQty: 'Account.sellerAssistedBuyingActivity.actionTypes.update_qty',\n applyCoupon:\n 'Account.sellerAssistedBuyingActivity.actionTypes.apply_coupon',\n removeCoupon:\n 'Account.sellerAssistedBuyingActivity.actionTypes.remove_coupon',\n updateAddress:\n 'Account.sellerAssistedBuyingActivity.actionTypes.update_address',\n updatePayment:\n 'Account.sellerAssistedBuyingActivity.actionTypes.update_payment',\n updateShipping:\n 'Account.sellerAssistedBuyingActivity.actionTypes.update_shipping',\n addProductNote:\n 'Account.sellerAssistedBuyingActivity.actionTypes.add_product_note',\n updateCustomerInfo:\n 'Account.sellerAssistedBuyingActivity.actionTypes.update_customer_info',\n save: 'Account.sellerAssistedBuyingActivity.actionTypes.save',\n });\n\n const {\n loading,\n adminAssistanceActions,\n error,\n currentPage,\n handlePageChange,\n } = useSellerAssistedBuyingActivity({ pageSize });\n const {\n loading: storeConfigLoading,\n remoteShoppingAssistanceConfigs,\n } = useGetStoreConfigs();\n\n const tableHeaders = {\n action: translations.actionHeader,\n date: translations.dateHeader,\n details: translations.detailsHeader,\n };\n\n const actionTypesMap: Record<string, string> = {\n place_order: translations.placeOrder,\n add_to_cart: translations.addToCart,\n remove_from_cart: translations.removeFromCart,\n remove_cart_item: translations.removeCartItem,\n update_qty: translations.updateQty,\n apply_coupon: translations.applyCoupon,\n remove_coupon: translations.removeCoupon,\n update_address: translations.updateAddress,\n update_payment: translations.updatePayment,\n update_shipping: translations.updateShipping,\n add_product_note: translations.addProductNote,\n update_customer_info: translations.updateCustomerInfo,\n save: translations.save,\n };\n\n return (\n <div\n className={classes([\n 'account-seller-assisted-buying-activity',\n className,\n ])}\n data-testid=\"sellerAssistedBuyingActivityId\"\n >\n <SellerAssistedBuyingActivityTable\n loading={storeConfigLoading || loading}\n adminAssistanceActions={adminAssistanceActions}\n tableHeaders={tableHeaders}\n actionTypesMap={actionTypesMap}\n emptyStateMessage={translations.emptyStateMessage}\n featureDisabledMessage={translations.featureDisabledMessage}\n isRemoteShoppingAssistanceAvailable={\n remoteShoppingAssistanceConfigs?.shoppingAssistanceEnabled ?? false\n }\n errorMessage={error ? translations.errorMessage : undefined}\n currentPage={currentPage}\n onPageChange={handlePageChange}\n withWrapper={withWrapper}\n />\n </div>\n );\n};\n"],"names":["useSellerAssistedBuyingActivity","props","pageSize","loading","setLoading","useState","adminAssistanceActions","setAdminAssistanceActions","error","setError","currentPage","setCurrentPage","useEffect","getAdminAssistanceActions","err","handlePageChange","useCallback","page","SellerAssistedBuyingActivity","className","withWrapper","translations","useText","storeConfigLoading","remoteShoppingAssistanceConfigs","useGetStoreConfigs","tableHeaders","actionTypesMap","jsx","classes","SellerAssistedBuyingActivityTable"],"mappings":"khBAyBO,MAAMA,EAAkC,CAC7CC,EAA8C,KACJ,CAC1C,KAAM,CAAE,SAAAC,EAAW,EAAA,EAAOD,EACpB,CAACE,EAASC,CAAU,EAAIC,EAAkB,EAAI,EAC9C,CAACC,EAAwBC,CAAyB,EACtDF,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QL,EAAa,aACrB,KAAMA,EAAa,WACnB,QAASA,EAAa,aAAA,EAGlBM,EAAyC,CAC7C,YAAaN,EAAa,WAC1B,YAAaA,EAAa,UAC1B,iBAAkBA,EAAa,eAC/B,iBAAkBA,EAAa,eAC/B,WAAYA,EAAa,UACzB,aAAcA,EAAa,YAC3B,cAAeA,EAAa,aAC5B,eAAgBA,EAAa,cAC7B,eAAgBA,EAAa,cAC7B,gBAAiBA,EAAa,eAC9B,iBAAkBA,EAAa,eAC/B,qBAAsBA,EAAa,mBACnC,KAAMA,EAAa,IAAA,EAGrB,OACEO,EAAC,MAAA,CACC,UAAWC,EAAQ,CACjB,0CACAV,CAAA,CACD,EACD,cAAY,iCAEZ,SAAAS,EAACE,EAAA,CACC,QAASP,GAAsBpB,EAC/B,uBAAAG,EACA,aAAAoB,EACA,eAAAC,EACA,kBAAmBN,EAAa,kBAChC,uBAAwBA,EAAa,uBACrC,qCACEG,GAAA,YAAAA,EAAiC,4BAA6B,GAEhE,aAAchB,EAAQa,EAAa,aAAe,OAClD,YAAAX,EACA,aAAcK,EACd,YAAAK,CAAA,CAAA,CACF,CAAA,CAGN"}
|
|
1
|
+
{"version":3,"file":"SellerAssistedBuyingActivity.js","sources":["/@dropins/storefront-account/src/hooks/containers/useSellerAssistedBuyingActivity.tsx","/@dropins/storefront-account/src/containers/SellerAssistedBuyingActivity/SellerAssistedBuyingActivity.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2026 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 { getAdminAssistanceActions } from '@/account/api';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport {\n UseSellerAssistedBuyingActivityReturn,\n UseSellerAssistedBuyingActivityProps,\n AdminAssistanceActions,\n} from '@/account/types';\n\nexport const useSellerAssistedBuyingActivity = (\n props: UseSellerAssistedBuyingActivityProps = {}\n): UseSellerAssistedBuyingActivityReturn => {\n const { pageSize = 10 } = props;\n const [loading, setLoading] = useState<boolean>(true);\n const [adminAssistanceActions, setAdminAssistanceActions] =\n useState<AdminAssistanceActions | null>(null);\n const [error, setError] = useState<string | null>(null);\n const [currentPage, setCurrentPage] = useState<number>(1);\n\n // Reset to page 1 when pageSize changes to avoid out-of-range page requests\n useEffect(() => {\n setCurrentPage(1);\n }, [pageSize]);\n\n useEffect(() => {\n setLoading(true);\n setError(null);\n\n getAdminAssistanceActions(pageSize, currentPage)\n .then((adminAssistanceActions) => {\n setAdminAssistanceActions(adminAssistanceActions);\n })\n .catch((err) => {\n console.error('Failed to fetch admin assistance actions:', err);\n setError(err instanceof Error ? err.message : String(err));\n })\n .finally(() => {\n setLoading(false);\n });\n }, [currentPage, pageSize]);\n\n const handlePageChange = useCallback((page: number) => {\n setCurrentPage(page);\n }, []);\n\n return {\n loading,\n adminAssistanceActions,\n error,\n currentPage,\n handlePageChange,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2026 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 { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { useSellerAssistedBuyingActivity } from '@/account/hooks/containers/useSellerAssistedBuyingActivity';\nimport { useGetStoreConfigs } from '@/account/hooks/containers/useGetStoreConfigs';\nimport { SellerAssistedBuyingActivityProps } from '@/account/types';\nimport { SellerAssistedBuyingActivityTable } from '@/account/components';\n\nexport const SellerAssistedBuyingActivity: Container<\n SellerAssistedBuyingActivityProps\n> = ({ className, pageSize = 10, withWrapper = true }) => {\n const translations = useText({\n actionHeader: 'Account.sellerAssistedBuyingActivity.tableHeaders.action',\n dateHeader: 'Account.sellerAssistedBuyingActivity.tableHeaders.date',\n detailsHeader: 'Account.sellerAssistedBuyingActivity.tableHeaders.details',\n emptyStateMessage: 'Account.sellerAssistedBuyingActivity.emptyStateMessage',\n errorMessage: 'Account.sellerAssistedBuyingActivity.errorMessage',\n featureDisabledMessage:\n 'Account.sellerAssistedBuyingActivity.featureDisabledMessage',\n // Action types translations\n placeOrder: 'Account.sellerAssistedBuyingActivity.actionTypes.place_order',\n addToCart: 'Account.sellerAssistedBuyingActivity.actionTypes.add_to_cart',\n removeFromCart:\n 'Account.sellerAssistedBuyingActivity.actionTypes.remove_from_cart',\n removeCartItem:\n 'Account.sellerAssistedBuyingActivity.actionTypes.remove_cart_item',\n updateQty: 'Account.sellerAssistedBuyingActivity.actionTypes.update_qty',\n applyCoupon:\n 'Account.sellerAssistedBuyingActivity.actionTypes.apply_coupon',\n removeCoupon:\n 'Account.sellerAssistedBuyingActivity.actionTypes.remove_coupon',\n updateAddress:\n 'Account.sellerAssistedBuyingActivity.actionTypes.update_address',\n updatePayment:\n 'Account.sellerAssistedBuyingActivity.actionTypes.update_payment',\n updateShipping:\n 'Account.sellerAssistedBuyingActivity.actionTypes.update_shipping',\n addProductNote:\n 'Account.sellerAssistedBuyingActivity.actionTypes.add_product_note',\n updateCustomerInfo:\n 'Account.sellerAssistedBuyingActivity.actionTypes.update_customer_info',\n save: 'Account.sellerAssistedBuyingActivity.actionTypes.save',\n });\n\n const {\n loading,\n adminAssistanceActions,\n error,\n currentPage,\n handlePageChange,\n } = useSellerAssistedBuyingActivity({ pageSize });\n const {\n loading: storeConfigLoading,\n remoteShoppingAssistanceConfigs,\n } = useGetStoreConfigs();\n\n const tableHeaders = {\n action: translations.actionHeader,\n date: translations.dateHeader,\n details: translations.detailsHeader,\n };\n\n const actionTypesMap: Record<string, string> = {\n place_order: translations.placeOrder,\n add_to_cart: translations.addToCart,\n remove_from_cart: translations.removeFromCart,\n remove_cart_item: translations.removeCartItem,\n update_qty: translations.updateQty,\n apply_coupon: translations.applyCoupon,\n remove_coupon: translations.removeCoupon,\n update_address: translations.updateAddress,\n update_payment: translations.updatePayment,\n update_shipping: translations.updateShipping,\n add_product_note: translations.addProductNote,\n update_customer_info: translations.updateCustomerInfo,\n save: translations.save,\n };\n\n return (\n <div\n className={classes([\n 'account-seller-assisted-buying-activity',\n className,\n ])}\n data-testid=\"sellerAssistedBuyingActivityId\"\n >\n <SellerAssistedBuyingActivityTable\n loading={storeConfigLoading || loading}\n adminAssistanceActions={adminAssistanceActions}\n tableHeaders={tableHeaders}\n actionTypesMap={actionTypesMap}\n emptyStateMessage={translations.emptyStateMessage}\n featureDisabledMessage={translations.featureDisabledMessage}\n isRemoteShoppingAssistanceAvailable={\n remoteShoppingAssistanceConfigs?.shoppingAssistanceEnabled ?? false\n }\n errorMessage={error ? translations.errorMessage : undefined}\n currentPage={currentPage}\n onPageChange={handlePageChange}\n withWrapper={withWrapper}\n />\n </div>\n );\n};\n"],"names":["useSellerAssistedBuyingActivity","props","pageSize","loading","setLoading","useState","adminAssistanceActions","setAdminAssistanceActions","error","setError","currentPage","setCurrentPage","useEffect","getAdminAssistanceActions","err","handlePageChange","useCallback","page","SellerAssistedBuyingActivity","className","withWrapper","translations","useText","storeConfigLoading","remoteShoppingAssistanceConfigs","useGetStoreConfigs","tableHeaders","actionTypesMap","jsx","classes","SellerAssistedBuyingActivityTable"],"mappings":"0iBAyBO,MAAMA,EAAkC,CAC7CC,EAA8C,KACJ,CAC1C,KAAM,CAAE,SAAAC,EAAW,EAAA,EAAOD,EACpB,CAACE,EAASC,CAAU,EAAIC,EAAkB,EAAI,EAC9C,CAACC,EAAwBC,CAAyB,EACt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OAAQL,EAAa,aACrB,KAAMA,EAAa,WACnB,QAASA,EAAa,aAAA,EAGlBM,EAAyC,CAC7C,YAAaN,EAAa,WAC1B,YAAaA,EAAa,UAC1B,iBAAkBA,EAAa,eAC/B,iBAAkBA,EAAa,eAC/B,WAAYA,EAAa,UACzB,aAAcA,EAAa,YAC3B,cAAeA,EAAa,aAC5B,eAAgBA,EAAa,cAC7B,eAAgBA,EAAa,cAC7B,gBAAiBA,EAAa,eAC9B,iBAAkBA,EAAa,eAC/B,qBAAsBA,EAAa,mBACnC,KAAMA,EAAa,IAAA,EAGrB,OACEO,EAAC,MAAA,CACC,UAAWC,EAAQ,CACjB,0CACAV,CAAA,CACD,EACD,cAAY,iCAEZ,SAAAS,EAACE,EAAA,CACC,QAASP,GAAsBpB,EAC/B,uBAAAG,EACA,aAAAoB,EACA,eAAAC,EACA,kBAAmBN,EAAa,kBAChC,uBAAwBA,EAAa,uBACrC,qCACEG,GAAA,YAAAA,EAAiC,4BAA6B,GAEhE,aAAchB,EAAQa,EAAa,aAAe,OAClD,YAAAX,EACA,aAAcK,EACd,YAAAK,CAAA,CAAA,CACF,CAAA,CAGN"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as f}from"@dropins/tools/preact-jsx-runtime.js";import{debounce as R,classes as L}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{updateCustomer as B,getCustomer as D}from"../api.js";import{useState as r,useRef as A,useEffect as p,useCallback as x}from"@dropins/tools/preact-hooks.js";import{u as M,S as T}from"./AddressForm.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import{useText as w}from"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/preact.js";const E=t=>{const[a,i]=r(!0),[s,u]=r(!1),[c,n]=r(!1),[d,l]=r(!1),[g,b]=r(!1),h=A(!1),o=A(R(e=>{B({allowRemoteShoppingAssistance:e}).catch(m=>{console.error("Failed to update remote shopping assistance:",m),n(!e),l(!1)})},500)).current;p(()=>()=>{var e;(e=o.cancel)==null||e.call(o)},[o]),p(()=>{const e=(t==null?void 0:t.shoppingAssistanceEnabled)??!1;u(e)},[t]),p(()=>{if(!t){i(!1),b(!1);return}i(!0),D().then(e=>{const m=e.allowRemoteShoppingAssistance??!1;h.current||(n(m),l(!1)),b(!0)}).catch(e=>{console.error("Failed to load remote shopping assistance:",e)}).finally(()=>{i(!1)})},[t]);const S=x(e=>{h.current=!0,b(!0),n(e),l(!1),o(e)},[o]),k=x(()=>{l(!0)},[]),y=(!a||h.current)&&g&&s&&!c&&!d;return{loading:a,isRemoteShoppingAssistanceAvailable:s,isRemoteShoppingAssistanceEnabled:c,showAlert:y,handleCheckboxChange:S,handleDismissAlert:k}},
|
|
3
|
+
import{jsx as f}from"@dropins/tools/preact-jsx-runtime.js";import{debounce as R,classes as L}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{updateCustomer as B,getCustomer as D}from"../api.js";import{useState as r,useRef as A,useEffect as p,useCallback as x}from"@dropins/tools/preact-hooks.js";import{u as M,S as T}from"./AddressForm.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/components.js";import{useText as w}from"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"@dropins/tools/preact.js";const E=t=>{const[a,i]=r(!0),[s,u]=r(!1),[c,n]=r(!1),[d,l]=r(!1),[g,b]=r(!1),h=A(!1),o=A(R(e=>{B({allowRemoteShoppingAssistance:e}).catch(m=>{console.error("Failed to update remote shopping assistance:",m),n(!e),l(!1)})},500)).current;p(()=>()=>{var e;(e=o.cancel)==null||e.call(o)},[o]),p(()=>{const e=(t==null?void 0:t.shoppingAssistanceEnabled)??!1;u(e)},[t]),p(()=>{if(!t){i(!1),b(!1);return}i(!0),D().then(e=>{const m=e.allowRemoteShoppingAssistance??!1;h.current||(n(m),l(!1)),b(!0)}).catch(e=>{console.error("Failed to load remote shopping assistance:",e)}).finally(()=>{i(!1)})},[t]);const S=x(e=>{h.current=!0,b(!0),n(e),l(!1),o(e)},[o]),k=x(()=>{l(!0)},[]),y=(!a||h.current)&&g&&s&&!c&&!d;return{loading:a,isRemoteShoppingAssistanceAvailable:s,isRemoteShoppingAssistanceEnabled:c,showAlert:y,handleCheckboxChange:S,handleDismissAlert:k}},K=({className:t})=>{const a=w({checkboxLabel:"Account.sellerAssistedBuyingSettings.checkboxLabel",checkboxTooltip:"Account.sellerAssistedBuyingSettings.checkboxTooltip",alertMessage:"Account.sellerAssistedBuyingSettings.alertMessage",featureDisabledMessage:"Account.sellerAssistedBuyingSettings.featureDisabledMessage"}),{loading:i,remoteShoppingAssistanceConfigs:s}=M(),{loading:u,isRemoteShoppingAssistanceAvailable:c,isRemoteShoppingAssistanceEnabled:n,showAlert:d,handleCheckboxChange:l,handleDismissAlert:g}=E(s);return f("div",{className:L(["account-seller-assisted-buying-settings",t]),"data-testid":"sellerAssistedBuyingSettingsId",children:f(T,{loading:i||u,isRemoteShoppingAssistanceEnabled:n,showAlert:d,checkboxLabel:(s==null?void 0:s.shoppingAssistanceCheckboxTitle)||a.checkboxLabel,checkboxTooltip:(s==null?void 0:s.shoppingAssistanceCheckboxTooltip)??a.checkboxTooltip,alertMessage:a.alertMessage,featureDisabledMessage:a.featureDisabledMessage,handleCheckboxChange:l,handleDismissAlert:g,isRemoteShoppingAssistanceAvailable:c})})};export{K as SellerAssistedBuyingSettings,K as default};
|
|
4
4
|
//# sourceMappingURL=SellerAssistedBuyingSettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SellerAssistedBuyingSettings.js","sources":["/@dropins/storefront-account/src/hooks/containers/useSellerAssistedBuyingSettings.tsx","/@dropins/storefront-account/src/containers/SellerAssistedBuyingSettings/SellerAssistedBuyingSettings.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2026 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 { updateCustomer, getCustomer } from '@/account/api';\nimport { useCallback, useEffect, useState, useRef } from 'preact/hooks';\nimport { debounce } from '@adobe-commerce/elsie/lib';\nimport { UseSellerAssistedBuyingSettingsReturn } from '@/account/types';\n\ninterface RemoteShoppingAssistanceConfigs {\n shoppingAssistanceEnabled: boolean;\n shoppingAssistanceCheckboxTitle: string;\n shoppingAssistanceCheckboxTooltip: string;\n}\n\nexport const useSellerAssistedBuyingSettings = (\n remoteShoppingAssistanceConfigs: RemoteShoppingAssistanceConfigs | null\n): UseSellerAssistedBuyingSettingsReturn => {\n const [loading, setLoading] = useState<boolean>(true);\n const [\n isRemoteShoppingAssistanceAvailable,\n setIsRemoteShoppingAssistanceAvailable,\n ] = useState<boolean>(false);\n const [\n isRemoteShoppingAssistanceEnabled,\n setIsRemoteShoppingAssistanceEnabled,\n ] = useState<boolean>(false);\n const [isAlertDismissed, setIsAlertDismissed] = useState<boolean>(false);\n const [hasLoadedCustomerPreference, setHasLoadedCustomerPreference] =\n useState<boolean>(false);\n const hasUserInteracted = useRef(false);\n\n const debouncedUpdateCustomer = useRef(\n debounce((checked: boolean) => {\n updateCustomer({\n allowRemoteShoppingAssistance: checked,\n }).catch((error) => {\n console.error('Failed to update remote shopping assistance:', error);\n setIsRemoteShoppingAssistanceEnabled(!checked);\n setIsAlertDismissed(false);\n });\n }, 500)\n ).current;\n\n useEffect(() => {\n return () => {\n debouncedUpdateCustomer.cancel?.();\n };\n }, [debouncedUpdateCustomer]);\n\n useEffect(() => {\n const enabledLoginAsCustomer =\n remoteShoppingAssistanceConfigs?.shoppingAssistanceEnabled ?? false;\n\n setIsRemoteShoppingAssistanceAvailable(enabledLoginAsCustomer);\n }, [remoteShoppingAssistanceConfigs]);\n\n useEffect(() => {\n if (!remoteShoppingAssistanceConfigs) {\n setLoading(false);\n setHasLoadedCustomerPreference(false);\n return;\n }\n\n setLoading(true);\n\n getCustomer()\n .then((customer) => {\n const allowRemoteShoppingAssistance =\n customer.allowRemoteShoppingAssistance ?? false;\n\n if (!hasUserInteracted.current) {\n setIsRemoteShoppingAssistanceEnabled(allowRemoteShoppingAssistance);\n setIsAlertDismissed(false);\n }\n setHasLoadedCustomerPreference(true);\n })\n .catch((error) => {\n console.error('Failed to load remote shopping assistance:', error);\n })\n .finally(() => {\n setLoading(false);\n });\n }, [remoteShoppingAssistanceConfigs]);\n\n const handleCheckboxChange = useCallback(\n (checked: boolean) => {\n hasUserInteracted.current = true;\n setHasLoadedCustomerPreference(true);\n setIsRemoteShoppingAssistanceEnabled(checked);\n setIsAlertDismissed(false);\n debouncedUpdateCustomer(checked);\n },\n [debouncedUpdateCustomer]\n );\n\n const handleDismissAlert = useCallback(() => {\n setIsAlertDismissed(true);\n }, []);\n\n const showAlert =\n (!loading || hasUserInteracted.current) &&\n hasLoadedCustomerPreference &&\n isRemoteShoppingAssistanceAvailable &&\n !isRemoteShoppingAssistanceEnabled &&\n !isAlertDismissed;\n\n return {\n loading,\n isRemoteShoppingAssistanceAvailable,\n isRemoteShoppingAssistanceEnabled,\n showAlert,\n handleCheckboxChange,\n handleDismissAlert,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2026 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 { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { useSellerAssistedBuyingSettings } from '@/account/hooks/containers/useSellerAssistedBuyingSettings';\nimport { useGetStoreConfigs } from '@/account/hooks/containers/useGetStoreConfigs';\nimport { SellerAssistedBuyingSettingsProps } from '@/account/types';\nimport { SellerAssistedBuyingSettingsControl } from '@/account/components';\n\nexport const SellerAssistedBuyingSettings: Container<\n SellerAssistedBuyingSettingsProps\n> = ({ className }) => {\n const translations = useText({\n checkboxLabel: 'Account.sellerAssistedBuyingSettings.checkboxLabel',\n checkboxTooltip: 'Account.sellerAssistedBuyingSettings.checkboxTooltip',\n alertMessage: 'Account.sellerAssistedBuyingSettings.alertMessage',\n featureDisabledMessage:\n 'Account.sellerAssistedBuyingSettings.featureDisabledMessage',\n });\n\n const {\n loading: storeConfigLoading,\n remoteShoppingAssistanceConfigs,\n } = useGetStoreConfigs();\n\n const {\n loading,\n isRemoteShoppingAssistanceAvailable,\n isRemoteShoppingAssistanceEnabled,\n showAlert,\n handleCheckboxChange,\n handleDismissAlert,\n } = useSellerAssistedBuyingSettings(remoteShoppingAssistanceConfigs);\n\n return (\n <div\n className={classes([\n 'account-seller-assisted-buying-settings',\n className,\n ])}\n data-testid=\"sellerAssistedBuyingSettingsId\"\n >\n <SellerAssistedBuyingSettingsControl\n loading={storeConfigLoading || loading}\n isRemoteShoppingAssistanceEnabled={isRemoteShoppingAssistanceEnabled}\n showAlert={showAlert}\n checkboxLabel={\n remoteShoppingAssistanceConfigs?.shoppingAssistanceCheckboxTitle ||\n translations.checkboxLabel\n }\n checkboxTooltip={\n remoteShoppingAssistanceConfigs?.shoppingAssistanceCheckboxTooltip ??\n translations.checkboxTooltip\n }\n alertMessage={translations.alertMessage}\n featureDisabledMessage={translations.featureDisabledMessage}\n handleCheckboxChange={handleCheckboxChange}\n handleDismissAlert={handleDismissAlert}\n isRemoteShoppingAssistanceAvailable={\n isRemoteShoppingAssistanceAvailable\n }\n />\n </div>\n );\n};\n"],"names":["useSellerAssistedBuyingSettings","remoteShoppingAssistanceConfigs","loading","setLoading","useState","isRemoteShoppingAssistanceAvailable","setIsRemoteShoppingAssistanceAvailable","isRemoteShoppingAssistanceEnabled","setIsRemoteShoppingAssistanceEnabled","isAlertDismissed","setIsAlertDismissed","hasLoadedCustomerPreference","setHasLoadedCustomerPreference","hasUserInteracted","useRef","debouncedUpdateCustomer","debounce","checked","updateCustomer","error","useEffect","_a","enabledLoginAsCustomer","getCustomer","customer","allowRemoteShoppingAssistance","handleCheckboxChange","useCallback","handleDismissAlert","showAlert","SellerAssistedBuyingSettings","className","translations","useText","storeConfigLoading","useGetStoreConfigs","jsx","classes","SellerAssistedBuyingSettingsControl"],"mappings":"kjBA4BO,MAAMA,EACXC,GAC0C,CAC1C,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAkB,EAAI,EAC9C,CACJC,EACAC,CAAA,EACEF,EAAkB,EAAK,EACrB,CACJG,EACAC,CAAA,EACEJ,EAAkB,EAAK,EACrB,CAACK,EAAkBC,CAAmB,EAAIN,EAAkB,EAAK,EACjE,CAACO,EAA6BC,CAA8B,EAChER,EAAkB,EAAK,EACnBS,EAAoBC,EAAO,EAAK,EAEhCC,EAA0BD,EAC9BE,EAAUC,GAAqB,CAC7BC,EAAe,CACb,8BAA+BD,CAAA,CAChC,EAAE,MAAOE,GAAU,CAClB,QAAQ,MAAM,+CAAgDA,CAAK,EACnEX,EAAqC,CAACS,CAAO,EAC7CP,EAAoB,EAAK,CAC3B,CAAC,CACH,EAAG,GAAG,CAAA,EACN,QAEFU,EAAU,IACD,IAAM,QACXC,EAAAN,EAAwB,SAAxB,MAAAM,EAAA,KAAAN,EACF,EACC,CAACA,CAAuB,CAAC,EAE5BK,EAAU,IAAM,CACd,MAAME,GACJrB,GAAA,YAAAA,EAAiC,4BAA6B,GAEhEK,EAAuCgB,CAAsB,CAC/D,EAAG,CAACrB,CAA+B,CAAC,EAEpCmB,EAAU,IAAM,CACd,GAAI,CAACnB,EAAiC,CACpCE,EAA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CAAAK,EACA,UAAAsB,EACA,eACE5B,GAAA,YAAAA,EAAiC,kCACjC+B,EAAa,cAEf,iBACE/B,GAAA,YAAAA,EAAiC,oCACjC+B,EAAa,gBAEf,aAAcA,EAAa,aAC3B,uBAAwBA,EAAa,uBACrC,qBAAAN,EACA,mBAAAE,EACA,oCAAAvB,CAAA,CAAA,CAGF,CAAA,CAGN"}
|
|
1
|
+
{"version":3,"file":"SellerAssistedBuyingSettings.js","sources":["/@dropins/storefront-account/src/hooks/containers/useSellerAssistedBuyingSettings.tsx","/@dropins/storefront-account/src/containers/SellerAssistedBuyingSettings/SellerAssistedBuyingSettings.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2026 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 { updateCustomer, getCustomer } from '@/account/api';\nimport { useCallback, useEffect, useState, useRef } from 'preact/hooks';\nimport { debounce } from '@adobe-commerce/elsie/lib';\nimport { UseSellerAssistedBuyingSettingsReturn } from '@/account/types';\n\ninterface RemoteShoppingAssistanceConfigs {\n shoppingAssistanceEnabled: boolean;\n shoppingAssistanceCheckboxTitle: string;\n shoppingAssistanceCheckboxTooltip: string;\n}\n\nexport const useSellerAssistedBuyingSettings = (\n remoteShoppingAssistanceConfigs: RemoteShoppingAssistanceConfigs | null\n): UseSellerAssistedBuyingSettingsReturn => {\n const [loading, setLoading] = useState<boolean>(true);\n const [\n isRemoteShoppingAssistanceAvailable,\n setIsRemoteShoppingAssistanceAvailable,\n ] = useState<boolean>(false);\n const [\n isRemoteShoppingAssistanceEnabled,\n setIsRemoteShoppingAssistanceEnabled,\n ] = useState<boolean>(false);\n const [isAlertDismissed, setIsAlertDismissed] = useState<boolean>(false);\n const [hasLoadedCustomerPreference, setHasLoadedCustomerPreference] =\n useState<boolean>(false);\n const hasUserInteracted = useRef(false);\n\n const debouncedUpdateCustomer = useRef(\n debounce((checked: boolean) => {\n updateCustomer({\n allowRemoteShoppingAssistance: checked,\n }).catch((error) => {\n console.error('Failed to update remote shopping assistance:', error);\n setIsRemoteShoppingAssistanceEnabled(!checked);\n setIsAlertDismissed(false);\n });\n }, 500)\n ).current;\n\n useEffect(() => {\n return () => {\n debouncedUpdateCustomer.cancel?.();\n };\n }, [debouncedUpdateCustomer]);\n\n useEffect(() => {\n const enabledLoginAsCustomer =\n remoteShoppingAssistanceConfigs?.shoppingAssistanceEnabled ?? false;\n\n setIsRemoteShoppingAssistanceAvailable(enabledLoginAsCustomer);\n }, [remoteShoppingAssistanceConfigs]);\n\n useEffect(() => {\n if (!remoteShoppingAssistanceConfigs) {\n setLoading(false);\n setHasLoadedCustomerPreference(false);\n return;\n }\n\n setLoading(true);\n\n getCustomer()\n .then((customer) => {\n const allowRemoteShoppingAssistance =\n customer.allowRemoteShoppingAssistance ?? false;\n\n if (!hasUserInteracted.current) {\n setIsRemoteShoppingAssistanceEnabled(allowRemoteShoppingAssistance);\n setIsAlertDismissed(false);\n }\n setHasLoadedCustomerPreference(true);\n })\n .catch((error) => {\n console.error('Failed to load remote shopping assistance:', error);\n })\n .finally(() => {\n setLoading(false);\n });\n }, [remoteShoppingAssistanceConfigs]);\n\n const handleCheckboxChange = useCallback(\n (checked: boolean) => {\n hasUserInteracted.current = true;\n setHasLoadedCustomerPreference(true);\n setIsRemoteShoppingAssistanceEnabled(checked);\n setIsAlertDismissed(false);\n debouncedUpdateCustomer(checked);\n },\n [debouncedUpdateCustomer]\n );\n\n const handleDismissAlert = useCallback(() => {\n setIsAlertDismissed(true);\n }, []);\n\n const showAlert =\n (!loading || hasUserInteracted.current) &&\n hasLoadedCustomerPreference &&\n isRemoteShoppingAssistanceAvailable &&\n !isRemoteShoppingAssistanceEnabled &&\n !isAlertDismissed;\n\n return {\n loading,\n isRemoteShoppingAssistanceAvailable,\n isRemoteShoppingAssistanceEnabled,\n showAlert,\n handleCheckboxChange,\n handleDismissAlert,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2026 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 { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { useSellerAssistedBuyingSettings } from '@/account/hooks/containers/useSellerAssistedBuyingSettings';\nimport { useGetStoreConfigs } from '@/account/hooks/containers/useGetStoreConfigs';\nimport { SellerAssistedBuyingSettingsProps } from '@/account/types';\nimport { SellerAssistedBuyingSettingsControl } from '@/account/components';\n\nexport const SellerAssistedBuyingSettings: Container<\n SellerAssistedBuyingSettingsProps\n> = ({ className }) => {\n const translations = useText({\n checkboxLabel: 'Account.sellerAssistedBuyingSettings.checkboxLabel',\n checkboxTooltip: 'Account.sellerAssistedBuyingSettings.checkboxTooltip',\n alertMessage: 'Account.sellerAssistedBuyingSettings.alertMessage',\n featureDisabledMessage:\n 'Account.sellerAssistedBuyingSettings.featureDisabledMessage',\n });\n\n const {\n loading: storeConfigLoading,\n remoteShoppingAssistanceConfigs,\n } = useGetStoreConfigs();\n\n const {\n loading,\n isRemoteShoppingAssistanceAvailable,\n isRemoteShoppingAssistanceEnabled,\n showAlert,\n handleCheckboxChange,\n handleDismissAlert,\n } = useSellerAssistedBuyingSettings(remoteShoppingAssistanceConfigs);\n\n return (\n <div\n className={classes([\n 'account-seller-assisted-buying-settings',\n className,\n ])}\n data-testid=\"sellerAssistedBuyingSettingsId\"\n >\n <SellerAssistedBuyingSettingsControl\n loading={storeConfigLoading || loading}\n isRemoteShoppingAssistanceEnabled={isRemoteShoppingAssistanceEnabled}\n showAlert={showAlert}\n checkboxLabel={\n remoteShoppingAssistanceConfigs?.shoppingAssistanceCheckboxTitle ||\n translations.checkboxLabel\n }\n checkboxTooltip={\n remoteShoppingAssistanceConfigs?.shoppingAssistanceCheckboxTooltip ??\n translations.checkboxTooltip\n }\n alertMessage={translations.alertMessage}\n featureDisabledMessage={translations.featureDisabledMessage}\n handleCheckboxChange={handleCheckboxChange}\n handleDismissAlert={handleDismissAlert}\n isRemoteShoppingAssistanceAvailable={\n isRemoteShoppingAssistanceAvailable\n }\n />\n </div>\n );\n};\n"],"names":["useSellerAssistedBuyingSettings","remoteShoppingAssistanceConfigs","loading","setLoading","useState","isRemoteShoppingAssistanceAvailable","setIsRemoteShoppingAssistanceAvailable","isRemoteShoppingAssistanceEnabled","setIsRemoteShoppingAssistanceEnabled","isAlertDismissed","setIsAlertDismissed","hasLoadedCustomerPreference","setHasLoadedCustomerPreference","hasUserInteracted","useRef","debouncedUpdateCustomer","debounce","checked","updateCustomer","error","useEffect","_a","enabledLoginAsCustomer","getCustomer","customer","allowRemoteShoppingAssistance","handleCheckboxChange","useCallback","handleDismissAlert","showAlert","SellerAssistedBuyingSettings","className","translations","useText","storeConfigLoading","useGetStoreConfigs","jsx","classes","SellerAssistedBuyingSettingsControl"],"mappings":"0kBA4BO,MAAMA,EACXC,GAC0C,CAC1C,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAkB,EAAI,EAC9C,CACJC,EACAC,CAAA,EACEF,EAAkB,EAAK,EACrB,CACJG,EACAC,CAAA,EACEJ,EAAkB,EAAK,EACrB,CAACK,EAAkBC,CAAmB,EAAIN,EAAkB,EAAK,EACjE,CAACO,EAA6BC,CAA8B,EAChER,EAAkB,EAAK,EACnBS,EAAoBC,EAAO,EAAK,EAEhCC,EAA0BD,EAC9BE,EAAUC,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ACA,qBAAAH,EACA,mBAAAE,CAAA,CAEJ,ECxGaE,EAET,CAAC,CAAE,UAAAC,KAAgB,CACrB,MAAMC,EAAeC,EAAQ,CAC3B,cAAe,qDACf,gBAAiB,uDACjB,aAAc,oDACd,uBACE,6DAAA,CACH,EAEK,CACJ,QAASC,EACT,gCAAAjC,CAAA,EACEkC,EAAA,EAEE,CACJ,QAAAjC,EACA,oCAAAG,EACA,kCAAAE,EACA,UAAAsB,EACA,qBAAAH,EACA,mBAAAE,CAAA,EACE5B,EAAgCC,CAA+B,EAEnE,OACEmC,EAAC,MAAA,CACC,UAAWC,EAAQ,CACjB,0CACAN,CAAA,CACD,EACD,cAAY,iCAEZ,SAAAK,EAACE,EAAA,CACC,QAASJ,GAAsBhC,EAC/B,kCAAAK,EACA,UAAAsB,EACA,eACE5B,GAAA,YAAAA,EAAiC,kCACjC+B,EAAa,cAEf,iBACE/B,GAAA,YAAAA,EAAiC,oCACjC+B,EAAa,gBAEf,aAAcA,EAAa,aAC3B,uBAAwBA,EAAa,uBACrC,qBAAAN,EACA,mBAAAE,EACA,oCAAAvB,CAAA,CAAA,CAGF,CAAA,CAGN"}
|
package/fragments.js
CHANGED
|
@@ -1,4 +1,122 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
|
|
3
|
+
const e=`
|
|
4
|
+
fragment BASIC_CUSTOMER_INFO_FRAGMENT on Customer {
|
|
5
|
+
date_of_birth
|
|
6
|
+
email
|
|
7
|
+
firstname
|
|
8
|
+
gender
|
|
9
|
+
lastname
|
|
10
|
+
middlename
|
|
11
|
+
prefix
|
|
12
|
+
suffix
|
|
13
|
+
created_at
|
|
14
|
+
allow_remote_shopping_assistance
|
|
15
|
+
}
|
|
16
|
+
`,t=`
|
|
17
|
+
fragment ADDRESS_FRAGMENT on OrderAddress {
|
|
18
|
+
city
|
|
19
|
+
company
|
|
20
|
+
country_code
|
|
21
|
+
fax
|
|
22
|
+
firstname
|
|
23
|
+
lastname
|
|
24
|
+
middlename
|
|
25
|
+
postcode
|
|
26
|
+
prefix
|
|
27
|
+
region
|
|
28
|
+
region_id
|
|
29
|
+
street
|
|
30
|
+
suffix
|
|
31
|
+
telephone
|
|
32
|
+
vat_id
|
|
33
|
+
}
|
|
34
|
+
`,r=`
|
|
35
|
+
fragment ORDER_SUMMARY_FRAGMENT on OrderTotal {
|
|
36
|
+
grand_total {
|
|
37
|
+
value
|
|
38
|
+
currency
|
|
39
|
+
}
|
|
40
|
+
grand_total_excl_tax {
|
|
41
|
+
value
|
|
42
|
+
currency
|
|
43
|
+
}
|
|
44
|
+
total_giftcard {
|
|
45
|
+
currency
|
|
46
|
+
value
|
|
47
|
+
}
|
|
48
|
+
subtotal_excl_tax {
|
|
49
|
+
currency
|
|
50
|
+
value
|
|
51
|
+
}
|
|
52
|
+
subtotal_incl_tax {
|
|
53
|
+
currency
|
|
54
|
+
value
|
|
55
|
+
}
|
|
56
|
+
taxes {
|
|
57
|
+
amount {
|
|
58
|
+
currency
|
|
59
|
+
value
|
|
60
|
+
}
|
|
61
|
+
rate
|
|
62
|
+
title
|
|
63
|
+
}
|
|
64
|
+
total_tax {
|
|
65
|
+
currency
|
|
66
|
+
value
|
|
67
|
+
}
|
|
68
|
+
total_shipping {
|
|
69
|
+
currency
|
|
70
|
+
value
|
|
71
|
+
}
|
|
72
|
+
discounts {
|
|
73
|
+
amount {
|
|
74
|
+
currency
|
|
75
|
+
value
|
|
76
|
+
}
|
|
77
|
+
label
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
`,a=`
|
|
81
|
+
fragment CUSTOMER_ORDER_FRAGMENT on CustomerOrder {
|
|
82
|
+
admin_assisted_order
|
|
83
|
+
token
|
|
84
|
+
email
|
|
85
|
+
shipping_method
|
|
86
|
+
payment_methods {
|
|
87
|
+
name
|
|
88
|
+
type
|
|
89
|
+
}
|
|
90
|
+
shipments {
|
|
91
|
+
id
|
|
92
|
+
number
|
|
93
|
+
tracking {
|
|
94
|
+
title
|
|
95
|
+
number
|
|
96
|
+
carrier
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
number
|
|
100
|
+
id
|
|
101
|
+
order_date
|
|
102
|
+
carrier
|
|
103
|
+
status
|
|
104
|
+
items {
|
|
105
|
+
status
|
|
106
|
+
product_name
|
|
107
|
+
id
|
|
108
|
+
quantity_ordered
|
|
109
|
+
quantity_shipped
|
|
110
|
+
quantity_invoiced
|
|
111
|
+
product_sku
|
|
112
|
+
product_url_key
|
|
113
|
+
product {
|
|
114
|
+
sku
|
|
115
|
+
small_image {
|
|
116
|
+
url
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
`;export{t as ADDRESS_FRAGMENT,e as BASIC_CUSTOMER_INFO_FRAGMENT,a as CUSTOMER_ORDER_FRAGMENT,r as ORDER_SUMMARY_FRAGMENT};
|
|
4
122
|
//# sourceMappingURL=fragments.js.map
|