@dropins/storefront-account 3.0.0-beta2 → 3.0.0-beta3
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/api.js +2 -2
- package/api.js.map +1 -1
- package/chunks/getOrderHistoryList.js +1 -1
- package/chunks/getOrderHistoryList.js.map +1 -1
- package/chunks/getStoreConfig.js +2 -2
- package/chunks/getStoreConfig.js.map +1 -1
- package/chunks/initialize.js +4 -0
- package/chunks/initialize.js.map +1 -0
- package/chunks/removeCustomerAddress.js +4 -4
- package/chunks/removeCustomerAddress.js.map +1 -1
- package/chunks/updateCustomer.js +1 -1
- package/chunks/updateCustomer.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/package.json +1 -1
- package/render.js +1 -1
- package/render.js.map +1 -1
package/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{c as b,
|
|
3
|
+
import{c as b,i as v}from"./chunks/initialize.js";import{f as d,h as m,a as u}from"./chunks/removeCustomerAddress.js";import{e as _,d as A,g as F,j as N,i as O,k as R,r as $,s as H,b as I,c as Q,u as w}from"./chunks/removeCustomerAddress.js";import{g as k,b as J,a as j,u as q}from"./chunks/updateCustomer.js";import{g as B}from"./chunks/getOrderHistoryList.js";import{g as K}from"./chunks/getStoreConfig.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/fetch-graphql.js";import"./fragments.js";const g=t=>{var r,s;const a=(s=(r=t==null?void 0:t.data)==null?void 0:r.country)==null?void 0:s.available_regions;return a?a.filter(e=>{if(!e)return!1;const{id:i,code:n,name:c}=e;return!!(i&&n&&c)}).map(e=>{const{id:i}=e;return{id:i,text:e.name,value:`${e.code},${e.id}`}}):[]},f=`
|
|
4
4
|
query GET_REGIONS($countryCode: String!) {
|
|
5
5
|
country(id: $countryCode) {
|
|
6
6
|
id
|
|
@@ -11,5 +11,5 @@ import{c as b,g as v,i as _}from"./chunks/getStoreConfig.js";import{f as d,h as
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
`,E=async t=>{const a=`_account_regions_${t}`,o=sessionStorage.getItem(a);return o?JSON.parse(o):await d(
|
|
14
|
+
`,E=async t=>{const a=`_account_regions_${t}`,o=sessionStorage.getItem(a);return o?JSON.parse(o):await d(f,{method:"GET",cache:"no-cache",variables:{countryCode:t}}).then(r=>{var e;if((e=r.errors)!=null&&e.length)return m(r.errors);const s=g(r);return sessionStorage.setItem(a,JSON.stringify(s)),s}).catch(u)};export{b as config,_ as createCustomerAddress,d as fetchGraphQl,A as getAttributesForm,F as getConfig,N as getCountries,k as getCustomer,O as getCustomerAddress,B as getOrderHistoryList,E as getRegions,K as getStoreConfig,v as initialize,R as removeCustomerAddress,$ as removeFetchGraphQlHeader,H as setEndpoint,I as setFetchGraphQlHeader,Q as setFetchGraphQlHeaders,J as updateCustomer,w as updateCustomerAddress,j as updateCustomerEmail,q as updateCustomerPassword};
|
|
15
15
|
//# sourceMappingURL=api.js.map
|
package/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":["/@dropins/storefront-account/src/data/transforms/transform-regions.ts","/@dropins/storefront-account/src/api/getRegions/graphql/getRegions.graphql.ts","/@dropins/storefront-account/src/api/getRegions/getRegions.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { RegionsFormResponse } from '@/account/types';\nimport { Region, RegionTransform } from '../models';\n\nexport const transformRegions = (\n response: RegionsFormResponse\n): RegionTransform[] | [] => {\n const availableRegions = response?.data?.country?.available_regions;\n if (!availableRegions) return [];\n\n const regions = availableRegions\n .filter((item) => {\n if (!item) return false;\n\n const { id, code, name } = item;\n return Boolean(id && code && name);\n })\n .map((region) => {\n const { id } = region as Region;\n\n return { id, text: region.name, value: `${region.code},${region.id}` };\n });\n\n return regions;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_REGIONS = /* GraphQL */ `\n query GET_REGIONS($countryCode: String!) {\n country(id: $countryCode) {\n id\n available_regions {\n id\n code\n name\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { GET_REGIONS } from './graphql/getRegions.graphql';\nimport { transformRegions } from '@/account/data/transforms';\nimport { RegionsFormResponse } from '@/account/types';\nimport { RegionTransform } from '@/account/data/models';\n\nexport const getRegions = async (\n countryCode: string\n): Promise<RegionTransform[] | []> => {\n const sessionStorageKey = `_account_regions_${countryCode}`;\n\n const sessionStorageCache = sessionStorage.getItem(sessionStorageKey);\n\n if (sessionStorageCache) {\n return JSON.parse(sessionStorageCache);\n }\n\n return await fetchGraphQl(GET_REGIONS, {\n method: 'GET',\n cache: 'no-cache',\n variables: { countryCode },\n })\n .then((response: RegionsFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n const transformedData = transformRegions(response);\n\n sessionStorage.setItem(\n sessionStorageKey,\n JSON.stringify(transformedData)\n );\n\n return transformedData;\n })\n .catch(handleNetworkError);\n};\n"],"names":["transformRegions","response","availableRegions","_b","_a","item","id","code","name","region","GET_REGIONS","getRegions","countryCode","sessionStorageKey","sessionStorageCache","fetchGraphQl","handleFetchError","transformedData","handleNetworkError"],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.js","sources":["/@dropins/storefront-account/src/data/transforms/transform-regions.ts","/@dropins/storefront-account/src/api/getRegions/graphql/getRegions.graphql.ts","/@dropins/storefront-account/src/api/getRegions/getRegions.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { RegionsFormResponse } from '@/account/types';\nimport { Region, RegionTransform } from '../models';\n\nexport const transformRegions = (\n response: RegionsFormResponse\n): RegionTransform[] | [] => {\n const availableRegions = response?.data?.country?.available_regions;\n if (!availableRegions) return [];\n\n const regions = availableRegions\n .filter((item) => {\n if (!item) return false;\n\n const { id, code, name } = item;\n return Boolean(id && code && name);\n })\n .map((region) => {\n const { id } = region as Region;\n\n return { id, text: region.name, value: `${region.code},${region.id}` };\n });\n\n return regions;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_REGIONS = /* GraphQL */ `\n query GET_REGIONS($countryCode: String!) {\n country(id: $countryCode) {\n id\n available_regions {\n id\n code\n name\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { GET_REGIONS } from './graphql/getRegions.graphql';\nimport { transformRegions } from '@/account/data/transforms';\nimport { RegionsFormResponse } from '@/account/types';\nimport { RegionTransform } from '@/account/data/models';\n\nexport const getRegions = async (\n countryCode: string\n): Promise<RegionTransform[] | []> => {\n const sessionStorageKey = `_account_regions_${countryCode}`;\n\n const sessionStorageCache = sessionStorage.getItem(sessionStorageKey);\n\n if (sessionStorageCache) {\n return JSON.parse(sessionStorageCache);\n }\n\n return await fetchGraphQl(GET_REGIONS, {\n method: 'GET',\n cache: 'no-cache',\n variables: { countryCode },\n })\n .then((response: RegionsFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n const transformedData = transformRegions(response);\n\n sessionStorage.setItem(\n sessionStorageKey,\n JSON.stringify(transformedData)\n );\n\n return transformedData;\n })\n .catch(handleNetworkError);\n};\n"],"names":["transformRegions","response","availableRegions","_b","_a","item","id","code","name","region","GET_REGIONS","getRegions","countryCode","sessionStorageKey","sessionStorageCache","fetchGraphQl","handleFetchError","transformedData","handleNetworkError"],"mappings":"0hBAoBO,MAAMA,EACXC,GAC2B,SAC3B,MAAMC,GAAmBC,GAAAC,EAAAH,GAAA,YAAAA,EAAU,OAAV,YAAAG,EAAgB,UAAhB,YAAAD,EAAyB,kBAClD,OAAKD,EAEWA,EACb,OAAQG,GAAS,CAChB,GAAI,CAACA,EAAM,MAAO,GAElB,KAAM,CAAE,GAAAC,EAAI,KAAAC,EAAM,KAAAC,CAAA,EAASH,EAC3B,MAAO,GAAQC,GAAMC,GAAQC,EAC/B,CAAC,EACA,IAAKC,GAAW,CACf,KAAM,CAAE,GAAAH,GAAOG,EAEf,MAAO,CAAE,GAAAH,EAAI,KAAMG,EAAO,KAAM,MAAO,GAAGA,EAAO,IAAI,IAAIA,EAAO,EAAE,EAAA,CACpE,CAAC,EAb2B,CAAA,CAgBhC,ECvBaC,EAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECQ5BC,EAAa,MACxBC,GACoC,CACpC,MAAMC,EAAoB,oBAAoBD,CAAW,GAEnDE,EAAsB,eAAe,QAAQD,CAAiB,EAEpE,OAAIC,EACK,KAAK,MAAMA,CAAmB,EAGhC,MAAMC,EAAaL,EAAa,CACrC,OAAQ,MACR,MAAO,WACP,UAAW,CAAE,YAAAE,CAAA,CAAY,CAC1B,EACE,KAAMX,GAAkC,OACvC,IAAIG,EAAAH,EAAS,SAAT,MAAAG,EAAiB,OAAQ,OAAOY,EAAiBf,EAAS,MAAM,EAEpE,MAAMgB,EAAkBjB,EAAiBC,CAAQ,EAEjD,sBAAe,QACbY,EACA,KAAK,UAAUI,CAAe,CAAA,EAGzBA,CACT,CAAC,EACA,MAAMC,CAAkB,CAC7B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{t as L,f as H,a as Y}from"./removeCustomerAddress.js";import{c as j}from"./
|
|
3
|
+
import{t as L,f as H,a as Y}from"./removeCustomerAddress.js";import{c as j}from"./initialize.js";import"@dropins/tools/event-bus.js";import{merge as J}from"@dropins/tools/lib.js";import{ADDRESS_FRAGMENT as K,ORDER_SUMMARY_FRAGMENT as Q}from"../fragments.js";const B=(a,o="en-US",c={})=>{const d={...{day:"2-digit",month:"2-digit",year:"numeric"},...c},u=new Date(a);return isNaN(u.getTime())?"Invalid Date":new Intl.DateTimeFormat(o,d).format(u)},s={value:0,currency:"USD"},V=a=>{var o,c,_,d,u,g,l,f,n,i;return{subtotal:((o=a==null?void 0:a.total)==null?void 0:o.subtotal)??s,grandTotal:((c=a==null?void 0:a.total)==null?void 0:c.grand_total)??s,grandTotalExclTax:((_=a==null?void 0:a.total)==null?void 0:_.grand_total_excl_tax)??s,totalGiftcard:((d=a==null?void 0:a.total)==null?void 0:d.total_giftcard)??s,subtotalExclTax:((u=a==null?void 0:a.total)==null?void 0:u.subtotal_excl_tax)??s,subtotalInclTax:((g=a==null?void 0:a.total)==null?void 0:g.subtotal_incl_tax)??s,taxes:((l=a==null?void 0:a.total)==null?void 0:l.taxes)??[],totalTax:((f=a==null?void 0:a.total)==null?void 0:f.total_tax)??s,totalShipping:((n=a==null?void 0:a.total)==null?void 0:n.total_shipping)??s,discounts:((i=a==null?void 0:a.total)==null?void 0:i.discounts)??[]}},W=a=>{var d,u,g,l,f,n,i,h,S,y,T,E,R,O,D,b,A,x,M,I,N,k,q,G,$,C,F,v,p,z;if(!((u=(d=a.data)==null?void 0:d.customer)!=null&&u.orders))return null;const o=((l=(g=a==null?void 0:a.data)==null?void 0:g.customer)==null?void 0:l.returns)??[],_={items:(((i=(n=(f=a==null?void 0:a.data)==null?void 0:f.customer)==null?void 0:n.orders)==null?void 0:i.items)??[]).map(r=>{var P;return{items:r==null?void 0:r.items.map(t=>{var U,w;return{status:(t==null?void 0:t.status)??"",productName:(t==null?void 0:t.product_name)??"",id:t==null?void 0:t.id,quantityOrdered:(t==null?void 0:t.quantity_ordered)??0,quantityShipped:(t==null?void 0:t.quantity_shipped)??0,quantityInvoiced:(t==null?void 0:t.quantity_invoiced)??0,sku:(t==null?void 0:t.sku)??"",urlKey:(t==null?void 0:t.url_key)??"",product:{smallImage:{url:((w=(U=t==null?void 0:t.product)==null?void 0:U.small_image)==null?void 0:w.url)??""}}}}),token:r==null?void 0:r.token,email:r==null?void 0:r.email,shippingMethod:r==null?void 0:r.shipping_method,paymentMethods:(r==null?void 0:r.payment_methods)??[],shipments:(r==null?void 0:r.shipments)??[],id:r==null?void 0:r.id,carrier:r==null?void 0:r.carrier,status:r==null?void 0:r.status,number:r==null?void 0:r.number,returns:(P=o==null?void 0:o.items)==null?void 0:P.filter(t=>t.order.id===r.id),orderDate:B(r.order_date),shippingAddress:L(r.shipping_address),billingAddress:L(r.billing_address),total:V(r)}}),pageInfo:{pageSize:((T=(y=(S=(h=a==null?void 0:a.data)==null?void 0:h.customer)==null?void 0:S.orders)==null?void 0:y.page_info)==null?void 0:T.page_size)??10,totalPages:((D=(O=(R=(E=a==null?void 0:a.data)==null?void 0:E.customer)==null?void 0:R.orders)==null?void 0:O.page_info)==null?void 0:D.total_pages)??1,currentPage:((M=(x=(A=(b=a==null?void 0:a.data)==null?void 0:b.customer)==null?void 0:A.orders)==null?void 0:x.page_info)==null?void 0:M.current_page)??1},totalCount:((k=(N=(I=a==null?void 0:a.data)==null?void 0:I.customer)==null?void 0:N.orders)==null?void 0:k.total_count)??0,dateOfFirstOrder:(($=(G=(q=a==null?void 0:a.data)==null?void 0:q.customer)==null?void 0:G.orders)==null?void 0:$.date_of_first_order)??""};return J(_,(z=(p=(v=(F=(C=j)==null?void 0:C.getConfig())==null?void 0:F.models)==null?void 0:v.OrderHistoryModel)==null?void 0:p.transformer)==null?void 0:z.call(p,a.data))},X=`
|
|
4
4
|
query GET_CUSTOMER_ORDERS_LIST(
|
|
5
5
|
$currentPage: Int
|
|
6
6
|
$pageSize: Int
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOrderHistoryList.js","sources":["/@dropins/storefront-account/src/lib/formatDateToLocale.ts","/@dropins/storefront-account/src/data/transforms/transform-order-history-list.ts","/@dropins/storefront-account/src/api/getOrderHistoryList/graphql/getOrderHistoryList.graphql.ts","/@dropins/storefront-account/src/api/getOrderHistoryList/getOrderHistoryList.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/**\n * Formats a date string according to a specified locale and options.\n * Returns \"Invalid Date\" if the input date string is invalid.\n *\n * @param {string} date - The date string to be formatted.\n * @param {string} [locale='en-US'] - The locale to use for formatting. Defaults to 'en-US'.\n * @param {Intl.DateTimeFormatOptions} [options={}] - Optional formatting options to customize the output.\n * @returns {string} The formatted date string, or \"Invalid Date\" if the input is invalid.\n *\n * @example\n * // Default formatting (en-US locale, MM/DD/YYYY)\n * console.log(formatDateToLocale('2023-08-29'));\n * // Output: \"08/29/2023\"\n *\n * @example\n * // Formatting with a specified locale (e.g., en-GB for DD/MM/YYYY)\n * console.log(formatDateToLocale('2023-08-29', 'en-GB'));\n * // Output: \"29/08/2023\"\n *\n * @example\n * // Formatting with a specified locale and custom options (e.g., de-DE with long month format)\n * console.log(formatDateToLocale('2023-08-29', 'de-DE', { month: 'long', year: 'numeric' }));\n * // Output: \"29. August 2023\"\n *\n * @example\n * // Handling an invalid date string\n * console.log(formatDateToLocale('invalid-date'));\n * // Output: \"Invalid Date\"\n */\nexport const formatDateToLocale = (\n date: string,\n locale: string = 'en-US',\n options: Intl.DateTimeFormatOptions = {}\n): string => {\n const defaultOptions: Intl.DateTimeFormatOptions = {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric',\n };\n const formatOptions: Intl.DateTimeFormatOptions = {\n ...defaultOptions,\n ...options,\n };\n\n const dateObj = new Date(date);\n\n if (isNaN(dateObj.getTime())) {\n return 'Invalid Date';\n }\n\n const formatter = new Intl.DateTimeFormat(locale, formatOptions);\n return formatter.format(dateObj);\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 OrderHistoryListResponse, OrderItemProps,\n OrderProps,\n ReturnProps,\n} from '@/account/types';\nimport { OrderHistoryModel } from '@/account/data/models';\nimport { transformSingleAddress } from '@/account/data/transforms/transform-customer-address';\nimport { formatDateToLocale } from '@/account/lib/formatDateToLocale';\nimport { config } from '@/account/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\n\nconst initialMoneyProps = {\n value: 0,\n currency: 'USD',\n};\n\nconst transformOrderHistoryTotal = (item: any) => {\n return {\n subtotal: item?.total?.subtotal ?? initialMoneyProps,\n grandTotal: item?.total?.grand_total ?? initialMoneyProps,\n grandTotalExclTax: item?.total?.grand_total_excl_tax ?? initialMoneyProps,\n totalGiftcard: item?.total?.total_giftcard ?? initialMoneyProps,\n subtotalExclTax: item?.total?.subtotal_excl_tax ?? initialMoneyProps,\n subtotalInclTax: item?.total?.subtotal_incl_tax ?? initialMoneyProps,\n taxes: item?.total?.taxes ?? [],\n totalTax: item?.total?.total_tax ?? initialMoneyProps,\n totalShipping: item?.total?.total_shipping ?? initialMoneyProps,\n discounts: item?.total?.discounts ?? [],\n };\n};\n\nexport const transformOrderHistoryList = (\n response: OrderHistoryListResponse\n): OrderHistoryModel | null => {\n if (!response.data?.customer?.orders) return null;\n\n const returns = response?.data?.customer?.returns ?? [];\n const items = response?.data?.customer?.orders?.items ?? [];\n\n const model = {\n items: items.map((item: OrderProps) => {\n return {\n items: item?.items.map((element: OrderItemProps) => ({\n status: element?.status ?? '',\n productName: element?.product_name ?? '',\n id: element?.id,\n quantityOrdered: element?.quantity_ordered ?? 0,\n quantityShipped: element?.quantity_shipped ?? 0,\n quantityInvoiced: element?.quantity_invoiced ?? 0,\n sku: element?.sku ?? '',\n urlKey: element?.url_key ?? '',\n product: {\n smallImage: {\n url: element?.product?.small_image?.url ?? '',\n },\n },\n })),\n token: item?.token,\n email: item?.email,\n shippingMethod: item?.shipping_method,\n paymentMethods: item?.payment_methods ?? [],\n shipments: item?.shipments ?? [],\n id: item?.id,\n carrier: item?.carrier,\n status: item?.status,\n number: item?.number,\n returns: returns?.items?.filter(\n (returnItem: ReturnProps) => returnItem.order.id === item.id\n ),\n orderDate: formatDateToLocale(item.order_date),\n shippingAddress: transformSingleAddress(item.shipping_address),\n billingAddress: transformSingleAddress(item.billing_address),\n total: transformOrderHistoryTotal(item),\n };\n }),\n pageInfo: {\n pageSize: response?.data?.customer?.orders?.page_info?.page_size ?? 10,\n totalPages: response?.data?.customer?.orders?.page_info?.total_pages ?? 1,\n currentPage:\n response?.data?.customer?.orders?.page_info?.current_page ?? 1,\n },\n totalCount: response?.data?.customer?.orders?.total_count ?? 0,\n dateOfFirstOrder:\n response?.data?.customer?.orders?.date_of_first_order ?? '',\n };\n\n return merge(\n model, // default transformer\n config?.getConfig()?.models?.OrderHistoryModel?.transformer?.(response.data) // custom transformer\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n ADDRESS_FRAGMENT,\n ORDER_SUMMARY_FRAGMENT,\n} from '@/account/api/fragments';\n\nexport const GET_CUSTOMER_ORDERS_LIST = /* GraphQL */ `\n query GET_CUSTOMER_ORDERS_LIST(\n $currentPage: Int\n $pageSize: Int\n $filter: CustomerOrdersFilterInput\n $sort: CustomerOrderSortInput\n ) {\n customer {\n returns {\n items {\n uid\n number\n order {\n id\n }\n }\n }\n orders(\n currentPage: $currentPage\n pageSize: $pageSize\n filter: $filter\n sort: $sort\n ) {\n page_info {\n page_size\n total_pages\n current_page\n }\n date_of_first_order\n total_count\n items {\n token\n email\n shipping_method\n payment_methods {\n name\n type\n }\n shipping_address {\n ...ADDRESS_FRAGMENT\n }\n billing_address {\n ...ADDRESS_FRAGMENT\n }\n shipments {\n id\n number\n tracking {\n title\n number\n carrier\n }\n }\n number\n id\n order_date\n carrier\n status\n items {\n status\n product_name\n id\n quantity_ordered\n quantity_shipped\n quantity_invoiced\n product {\n sku\n url_key\n small_image {\n url\n }\n }\n }\n total {\n ...ORDER_SUMMARY_FRAGMENT\n }\n }\n }\n }\n }\n ${ADDRESS_FRAGMENT}\n ${ORDER_SUMMARY_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/account/api';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { GET_CUSTOMER_ORDERS_LIST } from './graphql/getOrderHistoryList.graphql';\nimport { OrderHistoryListResponse } from '@/account/types';\nimport { transformOrderHistoryList } from '@/account/data/transforms';\nimport { OrderHistoryModel } from '@/account/data/models';\n\nconst SORT_DIRECTION = { sort_direction: 'DESC', sort_field: 'CREATED_AT' };\n\nexport const getOrderHistoryList = async (\n pageSize: number,\n selectOrdersDate: string,\n currentPage: number\n): Promise<OrderHistoryModel | null> => {\n const filterOrderDate = !selectOrdersDate.includes('viewAll')\n ? {\n order_date: JSON.parse(selectOrdersDate),\n }\n : {};\n\n return await fetchGraphQl(GET_CUSTOMER_ORDERS_LIST, {\n method: 'GET',\n cache: 'no-cache',\n variables: {\n pageSize,\n currentPage,\n filter: filterOrderDate,\n sort: SORT_DIRECTION,\n },\n })\n .then((response: OrderHistoryListResponse) => {\n return transformOrderHistoryList(response);\n })\n .catch(handleNetworkError);\n};\n"],"names":["formatDateToLocale","date","locale","options","formatOptions","dateObj","initialMoneyProps","transformOrderHistoryTotal","item","_a","_b","_c","_d","_e","_f","_g","_h","_i","_j","transformOrderHistoryList","response","returns","model","element","returnItem","transformSingleAddress","_k","_o","_n","_m","_l","_s","_r","_q","_p","_v","_u","_t","_y","_x","_w","merge","_D","_C","_B","_A","_z","config","GET_CUSTOMER_ORDERS_LIST","ADDRESS_FRAGMENT","ORDER_SUMMARY_FRAGMENT","SORT_DIRECTION","getOrderHistoryList","pageSize","selectOrdersDate","currentPage","filterOrderDate","fetchGraphQl","handleNetworkError"],"mappings":"sQA8CO,MAAMA,EAAqB,CAChCC,EACAC,EAAiB,QACjBC,EAAsC,CAAA,IAC3B,CAMX,MAAMC,EAA4C,CAChD,GANiD,CACjD,IAAK,UACL,MAAO,UACP,KA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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAgFlDC,CAAgB;AAAA,IAChBC,CAAsB;AAAA,EC/EpBC,EAAiB,CAAE,eAAgB,OAAQ,WAAY,YAAA,EAEhDC,GAAsB,MACjCC,EACAC,EACAC,IACsC,CACtC,MAAMC,EAAmBF,EAAiB,SAAS,SAAS,EAIxD,CAAA,EAHA,CACE,WAAY,KAAK,MAAMA,CAAgB,CAAA,EAI7C,OAAO,MAAMG,EAAaT,EAA0B,CAClD,OAAQ,MACR,MAAO,WACP,UAAW,CACT,SAAAK,EACA,YAAAE,EACA,OAAQC,EACR,KAAML,CAAA,CACR,CACD,EACE,KAAM/B,GACED,EAA0BC,CAAQ,CAC1C,EACA,MAAMsC,CAAkB,CAC7B"}
|
|
1
|
+
{"version":3,"file":"getOrderHistoryList.js","sources":["/@dropins/storefront-account/src/lib/formatDateToLocale.ts","/@dropins/storefront-account/src/data/transforms/transform-order-history-list.ts","/@dropins/storefront-account/src/api/getOrderHistoryList/graphql/getOrderHistoryList.graphql.ts","/@dropins/storefront-account/src/api/getOrderHistoryList/getOrderHistoryList.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/**\n * Formats a date string according to a specified locale and options.\n * Returns \"Invalid Date\" if the input date string is invalid.\n *\n * @param {string} date - The date string to be formatted.\n * @param {string} [locale='en-US'] - The locale to use for formatting. Defaults to 'en-US'.\n * @param {Intl.DateTimeFormatOptions} [options={}] - Optional formatting options to customize the output.\n * @returns {string} The formatted date string, or \"Invalid Date\" if the input is invalid.\n *\n * @example\n * // Default formatting (en-US locale, MM/DD/YYYY)\n * console.log(formatDateToLocale('2023-08-29'));\n * // Output: \"08/29/2023\"\n *\n * @example\n * // Formatting with a specified locale (e.g., en-GB for DD/MM/YYYY)\n * console.log(formatDateToLocale('2023-08-29', 'en-GB'));\n * // Output: \"29/08/2023\"\n *\n * @example\n * // Formatting with a specified locale and custom options (e.g., de-DE with long month format)\n * console.log(formatDateToLocale('2023-08-29', 'de-DE', { month: 'long', year: 'numeric' }));\n * // Output: \"29. August 2023\"\n *\n * @example\n * // Handling an invalid date string\n * console.log(formatDateToLocale('invalid-date'));\n * // Output: \"Invalid Date\"\n */\nexport const formatDateToLocale = (\n date: string,\n locale: string = 'en-US',\n options: Intl.DateTimeFormatOptions = {}\n): string => {\n const defaultOptions: Intl.DateTimeFormatOptions = {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric',\n };\n const formatOptions: Intl.DateTimeFormatOptions = {\n ...defaultOptions,\n ...options,\n };\n\n const dateObj = new Date(date);\n\n if (isNaN(dateObj.getTime())) {\n return 'Invalid Date';\n }\n\n const formatter = new Intl.DateTimeFormat(locale, formatOptions);\n return formatter.format(dateObj);\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 OrderHistoryListResponse, OrderItemProps,\n OrderProps,\n ReturnProps,\n} from '@/account/types';\nimport { OrderHistoryModel } from '@/account/data/models';\nimport { transformSingleAddress } from '@/account/data/transforms/transform-customer-address';\nimport { formatDateToLocale } from '@/account/lib/formatDateToLocale';\nimport { config } from '@/account/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\n\nconst initialMoneyProps = {\n value: 0,\n currency: 'USD',\n};\n\nconst transformOrderHistoryTotal = (item: any) => {\n return {\n subtotal: item?.total?.subtotal ?? initialMoneyProps,\n grandTotal: item?.total?.grand_total ?? initialMoneyProps,\n grandTotalExclTax: item?.total?.grand_total_excl_tax ?? initialMoneyProps,\n totalGiftcard: item?.total?.total_giftcard ?? initialMoneyProps,\n subtotalExclTax: item?.total?.subtotal_excl_tax ?? initialMoneyProps,\n subtotalInclTax: item?.total?.subtotal_incl_tax ?? initialMoneyProps,\n taxes: item?.total?.taxes ?? [],\n totalTax: item?.total?.total_tax ?? initialMoneyProps,\n totalShipping: item?.total?.total_shipping ?? initialMoneyProps,\n discounts: item?.total?.discounts ?? [],\n };\n};\n\nexport const transformOrderHistoryList = (\n response: OrderHistoryListResponse\n): OrderHistoryModel | null => {\n if (!response.data?.customer?.orders) return null;\n\n const returns = response?.data?.customer?.returns ?? [];\n const items = response?.data?.customer?.orders?.items ?? [];\n\n const model = {\n items: items.map((item: OrderProps) => {\n return {\n items: item?.items.map((element: OrderItemProps) => ({\n status: element?.status ?? '',\n productName: element?.product_name ?? '',\n id: element?.id,\n quantityOrdered: element?.quantity_ordered ?? 0,\n quantityShipped: element?.quantity_shipped ?? 0,\n quantityInvoiced: element?.quantity_invoiced ?? 0,\n sku: element?.sku ?? '',\n urlKey: element?.url_key ?? '',\n product: {\n smallImage: {\n url: element?.product?.small_image?.url ?? '',\n },\n },\n })),\n token: item?.token,\n email: item?.email,\n shippingMethod: item?.shipping_method,\n paymentMethods: item?.payment_methods ?? [],\n shipments: item?.shipments ?? [],\n id: item?.id,\n carrier: item?.carrier,\n status: item?.status,\n number: item?.number,\n returns: returns?.items?.filter(\n (returnItem: ReturnProps) => returnItem.order.id === item.id\n ),\n orderDate: formatDateToLocale(item.order_date),\n shippingAddress: transformSingleAddress(item.shipping_address),\n billingAddress: transformSingleAddress(item.billing_address),\n total: transformOrderHistoryTotal(item),\n };\n }),\n pageInfo: {\n pageSize: response?.data?.customer?.orders?.page_info?.page_size ?? 10,\n totalPages: response?.data?.customer?.orders?.page_info?.total_pages ?? 1,\n currentPage:\n response?.data?.customer?.orders?.page_info?.current_page ?? 1,\n },\n totalCount: response?.data?.customer?.orders?.total_count ?? 0,\n dateOfFirstOrder:\n response?.data?.customer?.orders?.date_of_first_order ?? '',\n };\n\n return merge(\n model, // default transformer\n config?.getConfig()?.models?.OrderHistoryModel?.transformer?.(response.data) // custom transformer\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n ADDRESS_FRAGMENT,\n ORDER_SUMMARY_FRAGMENT,\n} from '@/account/api/fragments';\n\nexport const GET_CUSTOMER_ORDERS_LIST = /* GraphQL */ `\n query GET_CUSTOMER_ORDERS_LIST(\n $currentPage: Int\n $pageSize: Int\n $filter: CustomerOrdersFilterInput\n $sort: CustomerOrderSortInput\n ) {\n customer {\n returns {\n items {\n uid\n number\n order {\n id\n }\n }\n }\n orders(\n currentPage: $currentPage\n pageSize: $pageSize\n filter: $filter\n sort: $sort\n ) {\n page_info {\n page_size\n total_pages\n current_page\n }\n date_of_first_order\n total_count\n items {\n token\n email\n shipping_method\n payment_methods {\n name\n type\n }\n shipping_address {\n ...ADDRESS_FRAGMENT\n }\n billing_address {\n ...ADDRESS_FRAGMENT\n }\n shipments {\n id\n number\n tracking {\n title\n number\n carrier\n }\n }\n number\n id\n order_date\n carrier\n status\n items {\n status\n product_name\n id\n quantity_ordered\n quantity_shipped\n quantity_invoiced\n product {\n sku\n url_key\n small_image {\n url\n }\n }\n }\n total {\n ...ORDER_SUMMARY_FRAGMENT\n }\n }\n }\n }\n }\n ${ADDRESS_FRAGMENT}\n ${ORDER_SUMMARY_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/account/api';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { GET_CUSTOMER_ORDERS_LIST } from './graphql/getOrderHistoryList.graphql';\nimport { OrderHistoryListResponse } from '@/account/types';\nimport { transformOrderHistoryList } from '@/account/data/transforms';\nimport { OrderHistoryModel } from '@/account/data/models';\n\nconst SORT_DIRECTION = { sort_direction: 'DESC', sort_field: 'CREATED_AT' };\n\nexport const getOrderHistoryList = async (\n pageSize: number,\n selectOrdersDate: string,\n currentPage: number\n): Promise<OrderHistoryModel | null> => {\n const filterOrderDate = !selectOrdersDate.includes('viewAll')\n ? {\n order_date: JSON.parse(selectOrdersDate),\n }\n : {};\n\n return await fetchGraphQl(GET_CUSTOMER_ORDERS_LIST, {\n method: 'GET',\n cache: 'no-cache',\n variables: {\n pageSize,\n currentPage,\n filter: filterOrderDate,\n sort: SORT_DIRECTION,\n },\n })\n .then((response: OrderHistoryListResponse) => {\n return transformOrderHistoryList(response);\n })\n .catch(handleNetworkError);\n};\n"],"names":["formatDateToLocale","date","locale","options","formatOptions","dateObj","initialMoneyProps","transformOrderHistoryTotal","item","_a","_b","_c","_d","_e","_f","_g","_h","_i","_j","transformOrderHistoryList","response","returns","model","element","returnItem","transformSingleAddress","_k","_o","_n","_m","_l","_s","_r","_q","_p","_v","_u","_t","_y","_x","_w","merge","_D","_C","_B","_A","_z","config","GET_CUSTOMER_ORDERS_LIST","ADDRESS_FRAGMENT","ORDER_SUMMARY_FRAGMENT","SORT_DIRECTION","getOrderHistoryList","pageSize","selectOrdersDate","currentPage","filterOrderDate","fetchGraphQl","handleNetworkError"],"mappings":"kQA8CO,MAAMA,EAAqB,CAChCC,EACAC,EAAiB,QACjBC,EAAsC,CAAA,IAC3B,CAMX,MAAMC,EAA4C,CAChD,GANiD,CACjD,IAAK,UACL,MAAO,UACP,KAAM,SAAA,EAIN,GAAGD,CAAA,EAGCE,EAAU,IAAI,KAAKJ,CAAI,EAE7B,OAAI,MAAMI,EAAQ,QAAA,CAAS,EAClB,eAGS,IAAI,KAAK,eAAeH,EAAQE,CAAa,EAC9C,OAAOC,CAAO,CACjC,ECzCMC,EAAoB,CACxB,MAAO,EACP,SAAU,KACZ,EAEMC,EAA8BC,GAAc,yBAChD,MAAO,CACL,WAAUC,EAAAD,GAAA,YAAAA,EAAM,QAAN,YAAAC,EAAa,WAAYH,EACnC,aAAYI,EAAAF,GAAA,YAAAA,EAAM,QAAN,YAAAE,EAAa,cAAeJ,EACxC,oBAAmBK,EAAAH,GAAA,YAAAA,EAAM,QAAN,YAAAG,EAAa,uBAAwBL,EACxD,gBAAeM,EAAAJ,GAAA,YAAAA,EAAM,QAAN,YAAAI,EAAa,iBAAkBN,EAC9C,kBAAiBO,EAAAL,GAAA,YAAAA,EAAM,QAAN,YAAAK,EAAa,oBAAqBP,EACnD,kBAAiBQ,EAAAN,GAAA,YAAAA,EAAM,QAAN,YAAAM,EAAa,oBAAqBR,EACnD,QAAOS,EAAAP,GAAA,YAAAA,EAAM,QAAN,YAAAO,EAAa,QAAS,CAAA,EAC7B,WAAUC,EAAAR,GAAA,YAAAA,EAA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|
+
import{f as e,h as m,a as u}from"./removeCustomerAddress.js";const f=t=>{var a,r,c,_,i,o,d,h;return{baseMediaUrl:(r=(a=t==null?void 0:t.data)==null?void 0:a.storeConfig)==null?void 0:r.base_media_url,minLength:+((_=(c=t==null?void 0:t.data)==null?void 0:c.storeConfig)==null?void 0:_.minimum_password_length)||3,requiredCharacterClasses:+((o=(i=t==null?void 0:t.data)==null?void 0:i.storeConfig)==null?void 0:o.required_character_classes_number)||0,storeCode:((h=(d=t==null?void 0:t.data)==null?void 0:d.storeConfig)==null?void 0:h.store_code)??""}},g=`
|
|
4
4
|
query GET_STORE_CONFIG {
|
|
5
5
|
storeConfig {
|
|
6
6
|
base_media_url
|
|
@@ -10,5 +10,5 @@ import{Initializer as d}from"@dropins/tools/lib.js";import{f as h,h as g,a as m}
|
|
|
10
10
|
store_code
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
`,
|
|
13
|
+
`,C=async()=>await e(g,{method:"GET",cache:"force-cache"}).then(t=>{var a;return(a=t.errors)!=null&&a.length?m(t.errors):f(t)}).catch(u);export{C as g};
|
|
14
14
|
//# sourceMappingURL=getStoreConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStoreConfig.js","sources":["/@dropins/storefront-account/src/
|
|
1
|
+
{"version":3,"file":"getStoreConfig.js","sources":["/@dropins/storefront-account/src/data/transforms/transform-store-config.ts","/@dropins/storefront-account/src/api/getStoreConfig/graphql/getStoreConfig.graphql.ts","/@dropins/storefront-account/src/api/getStoreConfig/getStoreConfig.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GetStoreConfigResponse } from '@/account/types';\nimport { StoreConfigModel } from '../models';\n\nexport const transformStoreConfig = (\n response: GetStoreConfigResponse\n): StoreConfigModel => {\n return {\n baseMediaUrl: response?.data?.storeConfig?.base_media_url,\n minLength: +response?.data?.storeConfig?.minimum_password_length || 3,\n requiredCharacterClasses:\n +response?.data?.storeConfig?.required_character_classes_number || 0,\n storeCode: response?.data?.storeConfig?.store_code ?? '',\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_STORE_CONFIG = /* GraphQL */ `\n query GET_STORE_CONFIG {\n storeConfig {\n base_media_url\n autocomplete_on_storefront\n minimum_password_length\n required_character_classes_number\n store_code\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { GET_STORE_CONFIG } from './graphql/getStoreConfig.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { GetStoreConfigResponse } from '@/account/types';\nimport { transformStoreConfig } from '@/account/data/transforms';\nimport { StoreConfigModel } from '@/account/data/models';\n\nexport const getStoreConfig = async (): Promise<StoreConfigModel> => {\n return await fetchGraphQl(GET_STORE_CONFIG, {\n method: 'GET',\n cache: 'force-cache',\n })\n .then((response: GetStoreConfigResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformStoreConfig(response);\n })\n .catch(handleNetworkError);\n};\n"],"names":["transformStoreConfig","response","_b","_a","_d","_c","_f","_e","_h","_g","GET_STORE_CONFIG","getStoreConfig","fetchGraphQl","handleFetchError","handleNetworkError"],"mappings":"6DAoBO,MAAMA,EACXC,GACqB,qBACrB,MAAO,CACL,cAAcC,GAAAC,EAAAF,GAAA,YAAAA,EAAU,OAAV,YAAAE,EAAgB,cAAhB,YAAAD,EAA6B,eAC3C,UAAW,GAACE,GAAAC,EAAAJ,GAAA,YAAAA,EAAU,OAAV,YAAAI,EAAgB,cAAhB,YAAAD,EAA6B,0BAA2B,EACpE,yBACE,GAACE,GAAAC,EAAAN,GAAA,YAAAA,EAAU,OAAV,YAAAM,EAAgB,cAAhB,YAAAD,EAA6B,oCAAqC,EACrE,YAAWE,GAAAC,EAAAR,GAAA,YAAAA,EAAU,OAAV,YAAAQ,EAAgB,cAAhB,YAAAD,EAA6B,aAAc,EAAA,CAE1D,ECbaE,EAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECQjCC,EAAiB,SACrB,MAAMC,EAAaF,EAAkB,CAC1C,OAAQ,MACR,MAAO,aAAA,CACR,EACE,KAAMT,GAAqC,OAC1C,OAAIE,EAAAF,EAAS,SAAT,MAAAE,EAAiB,OAAeU,EAAiBZ,EAAS,MAAM,EAE7DD,EAAqBC,CAAQ,CACtC,CAAC,EACA,MAAMa,CAAkB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{Initializer as o}from"@dropins/tools/lib.js";const i=new o({init:async n=>{const e={authHeaderConfig:{header:"Authorization",tokenPrefix:"Bearer"}};i.config.setConfig({...e,...n})},listeners:()=>[]}),a=i.config;export{a as c,i};
|
|
4
|
+
//# sourceMappingURL=initialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialize.js","sources":["/@dropins/storefront-account/src/api/initialize/initialize.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Initializer, Model } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { OrderHistoryModel } from '@/account/data/models';\nimport { CustomerDataModelShort } from '@/account/data/models/customer';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n authHeaderConfig?: {\n header?: string;\n tokenPrefix?: string;\n };\n models?: {\n OrderHistoryModel?: Model<OrderHistoryModel>;\n CustomerDataModelShort?: Model<CustomerDataModelShort>;\n };\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {\n authHeaderConfig: {\n header: 'Authorization',\n tokenPrefix: 'Bearer',\n },\n };\n\n initialize.config.setConfig({ ...defaultConfig, ...config });\n },\n\n listeners: () => [],\n});\n\nexport const config = initialize.config;\n"],"names":["initialize","Initializer","config","defaultConfig"],"mappings":"oDAkCO,MAAMA,EAAa,IAAIC,EAAyB,CACrD,KAAM,MAAOC,GAAW,CACtB,MAAMC,EAAgB,CACpB,iBAAkB,CAChB,OAAQ,gBACR,YAAa,QAAA,CACf,EAGFH,EAAW,OAAO,UAAU,CAAE,GAAGG,EAAe,GAAGD,EAAQ,CAC7D,EAEA,UAAW,IAAM,CAAA,CACnB,CAAC,EAEYA,EAASF,EAAW"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{events as E}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}from"@dropins/tools/fetch-graphql.js";const
|
|
3
|
+
import{events as E}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}from"@dropins/tools/fetch-graphql.js";const{setEndpoint:j,setFetchGraphQlHeader:k,removeFetchGraphQlHeader:L,setFetchGraphQlHeaders:P,fetchGraphQl:s,getConfig:J}=new C().getMethods(),S=`
|
|
4
4
|
query GET_ATTRIBUTES_FORM($formCode: String!) {
|
|
5
5
|
attributesForm(formCode: $formCode) {
|
|
6
6
|
items {
|
|
@@ -32,7 +32,7 @@ import{events as E}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}fr
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
`,
|
|
35
|
+
`,A=`
|
|
36
36
|
query GET_ATTRIBUTES_FORM_SHORT {
|
|
37
37
|
attributesForm(formCode: "customer_register_address") {
|
|
38
38
|
items {
|
|
@@ -46,7 +46,7 @@ import{events as E}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}fr
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
`,_=t=>{throw t instanceof DOMException&&t.name==="AbortError"||E.emit("error",{source:"auth",type:"network",error:t}),t},f=t=>{const r=t.map(n=>n.message).join(" ");throw Error(r)},y=t=>{let r=[];for(const n of t)if(!(n.frontend_input!=="MULTILINE"||n.multiline_count<2))for(let o=2;o<=n.multiline_count;o++){const u={...n,is_required:!1,name:`${n.code}_multiline_${o}`,code:`${n.code}_multiline_${o}`,id:`${n.code}_multiline_${o}`};r.push(u)}return r},R=t=>{switch(t){case"middlename":return"middleName";case"firstname":return"firstName";case"lastname":return"lastName";default:return b(t)}},v=t=>{var r;return t!=null&&t.options?(r=t==null?void 0:t.options)==null?void 0:r.map(n=>({isDefault:(n==null?void 0:n.is_default)??!1,text:(n==null?void 0:n.label)??"",value:(n==null?void 0:n.value)??""})):[]},N=t=>{var i,c,a;const r=((c=(i=t==null?void 0:t.data)==null?void 0:i.attributesForm)==null?void 0:c.items)||[];if(!r.length)return[];const n=(a=r.filter(e=>{var l;return!((l=e.frontend_input)!=null&&l.includes("HIDDEN"))}))==null?void 0:a.map(({code:e,...l})=>{const h=e!=="country_id"?e:"country_code";return{...l,name:h,id:h,code:h}}),o=y(n);return n.concat(o).map(e=>({code:e==null?void 0:e.code,name:e==null?void 0:e.name,id:e==null?void 0:e.id,label:(e==null?void 0:e.label)??"",entityType:e==null?void 0:e.entity_type,className:(e==null?void 0:e.frontend_class)??"",defaultValue:(e==null?void 0:e.default_value)??"",fieldType:e==null?void 0:e.frontend_input,multilineCount:(e==null?void 0:e.multiline_count)??0,orderNumber:Number(e==null?void 0:e.sort_order)||0,isHidden:!1,isUnique:(e==null?void 0:e.is_unique)??!1,required:(e==null?void 0:e.is_required)??!1,validateRules:(e==null?void 0:e.validate_rules)??[],options:v(e),customUpperCode:R(e==null?void 0:e.code)})).sort((e,l)=>Number(e.orderNumber)-Number(l.orderNumber))},O=t=>{const r={};for(const n in t){const o=t[n];!Array.isArray(o)||o.length===0||(n==="custom_attributesV2"?o.forEach(u=>{typeof u=="object"&&"value"in u&&(r[u==null?void 0:u.code]=u==null?void 0:u.value)}):o.length>1?o.forEach((u,i)=>{i===0?r[n]=u:r[`${n}_multiline_${i+1}`]=u}):r[n]=o[0])}return r},I=t=>({prefix:(t==null?void 0:t.prefix)??"",suffix:(t==null?void 0:t.suffix)??"",firstname:(t==null?void 0:t.firstname)??"",lastname:(t==null?void 0:t.lastname)??"",middlename:(t==null?void 0:t.middlename)??""}),U=t=>({id:(t==null?void 0:t.id)??"",vat_id:(t==null?void 0:t.vat_id)??"",postcode:(t==null?void 0:t.postcode)??"",country_code:(t==null?void 0:t.country_code)??"",uid:(t==null?void 0:t.uid)??""}),M=t=>({company:(t==null?void 0:t.company)??"",telephone:(t==null?void 0:t.telephone)??"",fax:(t==null?void 0:t.fax)??""}),$=t=>{var n,o,u;return g({...I(t),...U(t),...M(t),city:(t==null?void 0:t.city)??"",region:{region:((n=t==null?void 0:t.region)==null?void 0:n.region)??"",region_code:((o=t==null?void 0:t.region)==null?void 0:o.region_code)??"",region_id:((u=t==null?void 0:t.region)==null?void 0:u.region_id)??""},default_shipping:(t==null?void 0:t.default_shipping)||!1,default_billing:(t==null?void 0:t.default_billing)||!1,...O(t)},"camelCase",{})},w=t=>{var o,u;const r=((u=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:u.addresses)||[];return r.length?r.map($).sort((i,c)=>(Number(c.defaultBilling)||Number(c.defaultShipping))-(Number(i.defaultBilling)||Number(i.defaultShipping))):[]},q=t=>{var c,a;if(!((a=(c=t==null?void 0:t.data)==null?void 0:c.countries)!=null&&a.length))return{availableCountries:[],countriesWithRequiredRegion:[],optionalZipCountries:[]};const{countries:r,storeConfig:n}=t.data,o=n==null?void 0:n.countries_with_required_region.split(","),u=n==null?void 0:n.optional_zip_countries.split(",");return{availableCountries:r.filter(({two_letter_abbreviation:e,full_name_locale:l})=>!!(e&&l)).map(e=>{const{two_letter_abbreviation:l,full_name_locale:h,available_regions:m}=e,p=Array.isArray(m)&&m.length>0;return{value:l,text:h,availableRegions:p?m:void 0}}).sort((e,l)=>e.text.localeCompare(l.text)),countriesWithRequiredRegion:o,optionalZipCountries:u}},K=async t=>{const r=`_account_attributesForm_${t}`,n=sessionStorage.getItem(r);return n?JSON.parse(n):await s(t!=="shortRequest"?A
|
|
49
|
+
`,_=t=>{throw t instanceof DOMException&&t.name==="AbortError"||E.emit("error",{source:"auth",type:"network",error:t}),t},f=t=>{const r=t.map(n=>n.message).join(" ");throw Error(r)},b=t=>t.replace(/_([a-z])/g,(r,n)=>n.toUpperCase()),T=t=>t.replace(/([A-Z])/g,r=>`_${r.toLowerCase()}`),g=(t,r,n)=>{const o=["string","boolean","number"],u=r==="camelCase"?b:T;return Array.isArray(t)?t.map(i=>o.includes(typeof i)||i===null?i:typeof i=="object"?g(i,r,n):i):t!==null&&typeof t=="object"?Object.entries(t).reduce((i,[c,a])=>{const e=n&&n[c]?n[c]:u(c);return i[e]=o.includes(typeof a)||a===null?a:g(a,r,n),i},{}):t},y=t=>{let r=[];for(const n of t)if(!(n.frontend_input!=="MULTILINE"||n.multiline_count<2))for(let o=2;o<=n.multiline_count;o++){const u={...n,is_required:!1,name:`${n.code}_multiline_${o}`,code:`${n.code}_multiline_${o}`,id:`${n.code}_multiline_${o}`};r.push(u)}return r},R=t=>{switch(t){case"middlename":return"middleName";case"firstname":return"firstName";case"lastname":return"lastName";default:return b(t)}},v=t=>{var r;return t!=null&&t.options?(r=t==null?void 0:t.options)==null?void 0:r.map(n=>({isDefault:(n==null?void 0:n.is_default)??!1,text:(n==null?void 0:n.label)??"",value:(n==null?void 0:n.value)??""})):[]},N=t=>{var i,c,a;const r=((c=(i=t==null?void 0:t.data)==null?void 0:i.attributesForm)==null?void 0:c.items)||[];if(!r.length)return[];const n=(a=r.filter(e=>{var l;return!((l=e.frontend_input)!=null&&l.includes("HIDDEN"))}))==null?void 0:a.map(({code:e,...l})=>{const h=e!=="country_id"?e:"country_code";return{...l,name:h,id:h,code:h}}),o=y(n);return n.concat(o).map(e=>({code:e==null?void 0:e.code,name:e==null?void 0:e.name,id:e==null?void 0:e.id,label:(e==null?void 0:e.label)??"",entityType:e==null?void 0:e.entity_type,className:(e==null?void 0:e.frontend_class)??"",defaultValue:(e==null?void 0:e.default_value)??"",fieldType:e==null?void 0:e.frontend_input,multilineCount:(e==null?void 0:e.multiline_count)??0,orderNumber:Number(e==null?void 0:e.sort_order)||0,isHidden:!1,isUnique:(e==null?void 0:e.is_unique)??!1,required:(e==null?void 0:e.is_required)??!1,validateRules:(e==null?void 0:e.validate_rules)??[],options:v(e),customUpperCode:R(e==null?void 0:e.code)})).sort((e,l)=>Number(e.orderNumber)-Number(l.orderNumber))},O=t=>{const r={};for(const n in t){const o=t[n];!Array.isArray(o)||o.length===0||(n==="custom_attributesV2"?o.forEach(u=>{typeof u=="object"&&"value"in u&&(r[u==null?void 0:u.code]=u==null?void 0:u.value)}):o.length>1?o.forEach((u,i)=>{i===0?r[n]=u:r[`${n}_multiline_${i+1}`]=u}):r[n]=o[0])}return r},I=t=>({prefix:(t==null?void 0:t.prefix)??"",suffix:(t==null?void 0:t.suffix)??"",firstname:(t==null?void 0:t.firstname)??"",lastname:(t==null?void 0:t.lastname)??"",middlename:(t==null?void 0:t.middlename)??""}),U=t=>({id:(t==null?void 0:t.id)??"",vat_id:(t==null?void 0:t.vat_id)??"",postcode:(t==null?void 0:t.postcode)??"",country_code:(t==null?void 0:t.country_code)??"",uid:(t==null?void 0:t.uid)??""}),M=t=>({company:(t==null?void 0:t.company)??"",telephone:(t==null?void 0:t.telephone)??"",fax:(t==null?void 0:t.fax)??""}),$=t=>{var n,o,u;return g({...I(t),...U(t),...M(t),city:(t==null?void 0:t.city)??"",region:{region:((n=t==null?void 0:t.region)==null?void 0:n.region)??"",region_code:((o=t==null?void 0:t.region)==null?void 0:o.region_code)??"",region_id:((u=t==null?void 0:t.region)==null?void 0:u.region_id)??""},default_shipping:(t==null?void 0:t.default_shipping)||!1,default_billing:(t==null?void 0:t.default_billing)||!1,...O(t)},"camelCase",{})},w=t=>{var o,u;const r=((u=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:u.addresses)||[];return r.length?r.map($).sort((i,c)=>(Number(c.defaultBilling)||Number(c.defaultShipping))-(Number(i.defaultBilling)||Number(i.defaultShipping))):[]},q=t=>{var c,a;if(!((a=(c=t==null?void 0:t.data)==null?void 0:c.countries)!=null&&a.length))return{availableCountries:[],countriesWithRequiredRegion:[],optionalZipCountries:[]};const{countries:r,storeConfig:n}=t.data,o=n==null?void 0:n.countries_with_required_region.split(","),u=n==null?void 0:n.optional_zip_countries.split(",");return{availableCountries:r.filter(({two_letter_abbreviation:e,full_name_locale:l})=>!!(e&&l)).map(e=>{const{two_letter_abbreviation:l,full_name_locale:h,available_regions:m}=e,p=Array.isArray(m)&&m.length>0;return{value:l,text:h,availableRegions:p?m:void 0}}).sort((e,l)=>e.text.localeCompare(l.text)),countriesWithRequiredRegion:o,optionalZipCountries:u}},K=async t=>{const r=`_account_attributesForm_${t}`,n=sessionStorage.getItem(r);return n?JSON.parse(n):await s(t!=="shortRequest"?S:A,{method:"GET",cache:"force-cache",variables:{formCode:t}}).then(o=>{var i;if((i=o.errors)!=null&&i.length)return f(o.errors);const u=N(o);return sessionStorage.setItem(r,JSON.stringify(u)),u}).catch(_)},x=`
|
|
50
50
|
mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {
|
|
51
51
|
createCustomerAddress(input: $input) {
|
|
52
52
|
firstname
|
|
@@ -113,5 +113,5 @@ import{events as E}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}fr
|
|
|
113
113
|
mutation REMOVE_CUSTOMER_ADDRESS($id: Int!) {
|
|
114
114
|
deleteCustomerAddress(id: $id)
|
|
115
115
|
}
|
|
116
|
-
`,X=async t=>await s(B,{method:"POST",variables:{id:t}}).then(r=>{var n;return(n=r.errors)!=null&&n.length?f(r.errors):r.data.deleteCustomerAddress}).catch(_);export{_ as a,k as b,P as c,K as d,z as e,s as f,J as g,f as h,Z as i,W as j,X as k,b as l,g as m,
|
|
116
|
+
`,X=async t=>await s(B,{method:"POST",variables:{id:t}}).then(r=>{var n;return(n=r.errors)!=null&&n.length?f(r.errors):r.data.deleteCustomerAddress}).catch(_);export{_ as a,k as b,P as c,K as d,z as e,s as f,J as g,f as h,Z as i,W as j,X as k,b as l,g as m,T as n,L as r,j as s,$ as t,Y as u};
|
|
117
117
|
//# sourceMappingURL=removeCustomerAddress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removeCustomerAddress.js","sources":["/@dropins/storefront-account/src/lib/convertCase.ts","/@dropins/storefront-account/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-account/src/api/getAttributesForm/graphql/getAttributesForm.graphql.ts","/@dropins/storefront-account/src/lib/network-error.ts","/@dropins/storefront-account/src/lib/fetch-error.ts","/@dropins/storefront-account/src/data/transforms/transform-attributes-form.ts","/@dropins/storefront-account/src/data/transforms/transform-customer-address.ts","/@dropins/storefront-account/src/data/transforms/transform-countries.ts","/@dropins/storefront-account/src/api/getAttributesForm/getAttributesForm.ts","/@dropins/storefront-account/src/api/createCustomerAddress/graphql/createCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/createCustomerAddress/createCustomerAddress.ts","/@dropins/storefront-account/src/api/getCustomerAddress/graphql/getCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/getCustomerAddress/getCustomerAddress.ts","/@dropins/storefront-account/src/api/getCountries/graphql/getCountries.graphql.ts","/@dropins/storefront-account/src/api/getCountries/getCountries.ts","/@dropins/storefront-account/src/api/updateCustomerAddress/graphql/updateCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/updateCustomerAddress/updateCustomerAddress.ts","/@dropins/storefront-account/src/api/removeCustomerAddress/graphql/removeCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/removeCustomerAddress/removeCustomerAddress.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const convertToCamelCase = (key: string): string => {\n return key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());\n};\n\nexport const convertToSnakeCase = (key: string): string => {\n return key.replace(/([A-Z])/g, (letter) => `_${letter.toLowerCase()}`);\n};\n\nexport const convertKeysCase = (\n data: any,\n type: 'snakeCase' | 'camelCase',\n dictionary?: Record<string, string>\n): any => {\n const typeList = ['string', 'boolean', 'number'];\n const callback =\n type === 'camelCase' ? convertToCamelCase : convertToSnakeCase;\n\n if (Array.isArray(data)) {\n return data.map((element) => {\n if (typeList.includes(typeof element) || element === null) return element;\n\n if (typeof element === 'object') {\n return convertKeysCase(element, type, dictionary);\n }\n return element;\n });\n }\n\n if (data !== null && typeof data === 'object') {\n return Object.entries(data).reduce((acc, [key, value]) => {\n const newKey =\n dictionary && dictionary[key] ? dictionary[key] : callback(key);\n acc[newKey] =\n typeList.includes(typeof value) || value === null\n ? value\n : convertKeysCase(value, type, dictionary);\n return acc;\n }, {} as Record<string, unknown>);\n }\n\n return data;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_ATTRIBUTES_FORM = /* GraphQL */ `\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\n }\n }\n`;\n\nexport const GET_ATTRIBUTES_FORM_SHORT = /* GraphQL */ `\n query GET_ATTRIBUTES_FORM_SHORT {\n attributesForm(formCode: \"customer_register_address\") {\n items {\n frontend_input\n label\n code\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n }\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\n\n/**\n * A function which can be attached to fetchGraphQL to handle thrown errors in\n * a generic way.\n */\nexport const handleNetworkError = (error: Error) => {\n const isAbortError =\n error instanceof DOMException && error.name === 'AbortError';\n\n if (!isAbortError) {\n // @ts-ignore\n events.emit('error', {\n source: 'auth',\n type: 'network',\n error,\n });\n }\n throw error;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n GetAttributesFormResponse,\n ResponseAttributesFormItemsProps,\n} from '@/account/types';\nimport { AttributesFormModel, FieldEnumList } from '../models';\nimport { convertToCamelCase } from '@/account/lib/convertCase';\n\nexport const cloneArrayIfExists = (\n fields: ResponseAttributesFormItemsProps[]\n) => {\n let multilineItems: any = [];\n\n for (const element of fields) {\n if (element.frontend_input !== 'MULTILINE' || element.multiline_count < 2) {\n continue;\n }\n\n for (let i = 2; i <= element.multiline_count; i++) {\n const newItem = {\n ...element,\n is_required: false,\n name: `${element.code}_multiline_${i}`,\n code: `${element.code}_multiline_${i}`,\n id: `${element.code}_multiline_${i}`,\n };\n\n multilineItems.push(newItem);\n }\n }\n\n return multilineItems;\n};\n\nconst transformCustomUpperCode = (code: string) => {\n switch (code) {\n case 'middlename':\n return 'middleName';\n case 'firstname':\n return 'firstName';\n case 'lastname':\n return 'lastName';\n default:\n return convertToCamelCase(code);\n }\n};\n\nconst transformOptions = (item: any) => {\n if (!item?.options) return [];\n\n return item?.options?.map((el: any) => {\n return {\n isDefault: el?.is_default ?? false,\n text: el?.label ?? '',\n value: el?.value ?? '',\n };\n });\n};\n\nexport const transformAttributesForm = (\n response: GetAttributesFormResponse\n): AttributesFormModel[] => {\n const items = response?.data?.attributesForm?.items || [];\n\n if (!items.length) return [];\n\n const fields = items\n .filter((el) => !el.frontend_input?.includes('HIDDEN'))\n ?.map(({ code, ...other }) => {\n const isDefaultCode = code !== 'country_id' ? code : 'country_code';\n\n return {\n ...other,\n name: isDefaultCode,\n id: isDefaultCode,\n code: isDefaultCode,\n };\n });\n\n const multilineItems = cloneArrayIfExists(fields as any);\n\n const attributesConfig = fields\n .concat(multilineItems)\n .map((item) => {\n return {\n code: item?.code,\n name: item?.name,\n id: item?.id,\n label: item?.label ?? '',\n entityType: item?.entity_type,\n className: item?.frontend_class ?? '',\n defaultValue: item?.default_value ?? '',\n fieldType: item?.frontend_input as FieldEnumList,\n multilineCount: item?.multiline_count ?? 0,\n orderNumber: Number(item?.sort_order) || 0,\n isHidden: false,\n isUnique: item?.is_unique ?? false,\n required: item?.is_required ?? false,\n validateRules: item?.validate_rules ?? [],\n options: transformOptions(item),\n customUpperCode: transformCustomUpperCode(item?.code),\n };\n })\n .sort((a, b) => Number(a.orderNumber) - Number(b.orderNumber));\n\n return attributesConfig;\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 { CustomerAddressesModel } from '../models';\nimport { AddressResponse, UserAddressesProps } from '@/account/types';\nimport { convertKeysCase } from '@/account/lib/convertCase';\n\nconst expandArraysInObject = (inputObject: UserAddressesProps) => {\n const flattenedAttributes: Record<string, unknown> = {};\n\n for (const key in inputObject) {\n const element = inputObject[key as keyof UserAddressesProps];\n\n if (!Array.isArray(element) || element.length === 0) continue;\n\n if (key === 'custom_attributesV2') {\n element.forEach((item) => {\n if (typeof item === 'object' && 'value' in item) {\n flattenedAttributes[item?.code] = item?.value;\n }\n });\n } else if (element.length > 1) {\n element.forEach((value: unknown, index: number) => {\n index === 0\n ? (flattenedAttributes[key] = value)\n : (flattenedAttributes[`${key}_multiline_${index + 1}`] = value);\n });\n } else {\n flattenedAttributes[key] = element[0] as Record<string, string>;\n }\n }\n\n return flattenedAttributes;\n};\nconst transformFullName = (address: UserAddressesProps) => {\n return {\n prefix: address?.prefix ?? '',\n suffix: address?.suffix ?? '',\n firstname: address?.firstname ?? '',\n lastname: address?.lastname ?? '',\n middlename: address?.middlename ?? '',\n };\n};\n\nconst transformIds = (address: UserAddressesProps) => {\n return {\n id: address?.id ?? '',\n vat_id: address?.vat_id ?? '',\n postcode: address?.postcode ?? '',\n country_code: address?.country_code ?? '',\n uid: address?.uid ?? '',\n };\n};\n\nconst transformContacts = (address: UserAddressesProps) => {\n return {\n company: address?.company ?? '',\n telephone: address?.telephone ?? '',\n fax: address?.fax ?? '',\n };\n};\n\n// Function to transform a single address\nexport const transformSingleAddress = (\n addressData: UserAddressesProps\n): CustomerAddressesModel => {\n const result = convertKeysCase(\n {\n ...transformFullName(addressData),\n ...transformIds(addressData),\n ...transformContacts(addressData),\n city: addressData?.city ?? '',\n region: {\n region: addressData?.region?.region ?? '',\n region_code: addressData?.region?.region_code ?? '',\n region_id: addressData?.region?.region_id ?? '',\n },\n default_shipping: addressData?.default_shipping || false,\n default_billing: addressData?.default_billing || false,\n ...expandArraysInObject(addressData),\n },\n 'camelCase',\n {}\n );\n\n return result;\n};\n\n// Function to transform multiple addresses from a response\nexport const transformMultipleAddresses = (\n response: AddressResponse\n): CustomerAddressesModel[] | [] => {\n const addresses: UserAddressesProps[] =\n response?.data?.customer?.addresses || [];\n\n if (!addresses.length) return [];\n\n const result = addresses\n .map(transformSingleAddress)\n .sort(\n (a, b) =>\n (Number(b.defaultBilling) || Number(b.defaultShipping)) -\n (Number(a.defaultBilling) || Number(a.defaultShipping))\n );\n\n return result;\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 { CountriesFormResponse } from '@/account/types';\nimport { Country } from '../models';\n\nexport const transformCountries = (\n response: CountriesFormResponse\n): {\n availableCountries: Country[] | [];\n countriesWithRequiredRegion: string[];\n optionalZipCountries: string[];\n} => {\n if (!response?.data?.countries?.length) {\n return {\n availableCountries: [],\n countriesWithRequiredRegion: [],\n optionalZipCountries: [],\n };\n }\n\n const { countries, storeConfig } = response.data;\n\n const countriesWithRequiredRegion =\n storeConfig?.countries_with_required_region.split(',');\n const optionalZipCountries = storeConfig?.optional_zip_countries.split(',');\n\n const availableCountries = countries\n .filter(({ two_letter_abbreviation, full_name_locale }) =>\n Boolean(two_letter_abbreviation && full_name_locale)\n )\n .map((country) => {\n const { two_letter_abbreviation, full_name_locale, available_regions } = country;\n\n const hasRegions = Array.isArray(available_regions) && available_regions.length > 0;\n return {\n value: two_letter_abbreviation,\n text: full_name_locale,\n availableRegions: hasRegions ? available_regions : undefined,\n };\n })\n .sort((a, b) => a.text.localeCompare(b.text));\n\n return {\n availableCountries,\n countriesWithRequiredRegion,\n optionalZipCountries,\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 { fetchGraphQl } from '../fetch-graphql';\nimport {\n GET_ATTRIBUTES_FORM,\n GET_ATTRIBUTES_FORM_SHORT,\n} from './graphql/getAttributesForm.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { transformAttributesForm } from '@/account/data/transforms';\nimport { AttributesFormModel } from '@/account/data/models';\nimport { GetAttributesFormResponse } from '@/account/types';\n\nexport const getAttributesForm = async (\n formCode: string\n): Promise<AttributesFormModel[]> => {\n const sessionStorageKey = `_account_attributesForm_${formCode}`;\n\n const sessionStorageCache = sessionStorage.getItem(sessionStorageKey);\n\n if (sessionStorageCache) {\n return JSON.parse(sessionStorageCache);\n }\n\n return await fetchGraphQl(\n formCode !== 'shortRequest'\n ? GET_ATTRIBUTES_FORM\n : GET_ATTRIBUTES_FORM_SHORT,\n {\n method: 'GET',\n cache: 'force-cache',\n variables: { formCode },\n }\n )\n .then((response: GetAttributesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n const transformedData = transformAttributesForm(response);\n\n sessionStorage.setItem(\n sessionStorageKey,\n JSON.stringify(transformedData)\n );\n\n return transformedData;\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CREATE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n firstname\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CreateCustomerAddressResponse } from '@/account/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER_ADDRESS } from './graphql/createCustomerAddress.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { convertKeysCase } from '@/account/lib/convertCase';\nimport { CustomerAddressesModel } from '@/account/data/models';\n\nexport const createCustomerAddress = async (\n address: CustomerAddressesModel\n): Promise<string> => {\n return await fetchGraphQl(CREATE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: {\n input: convertKeysCase(address, 'snakeCase', {\n custom_attributesV2: 'custom_attributesV2',\n firstName: 'firstname',\n lastName: 'lastname',\n middleName: 'middlename',\n }),\n },\n })\n .then((response: CreateCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response?.data?.createCustomerAddress?.firstname || '';\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_CUSTOMER_ADDRESS = /* GraphQL */ `\n query GET_CUSTOMER_ADDRESS {\n customer {\n addresses {\n firstname\n lastname\n middlename\n fax\n prefix\n suffix\n city\n company\n country_code\n region {\n region\n region_code\n region_id\n }\n custom_attributesV2 {\n ... on AttributeValue {\n code\n value\n }\n }\n telephone\n id\n vat_id\n postcode\n street\n default_shipping\n default_billing\n uid\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { GET_CUSTOMER_ADDRESS } from './graphql/getCustomerAddress.graphql';\nimport { transformMultipleAddresses } from '@/account/data/transforms';\nimport { CustomerAddressesModel } from '@/account/data/models/customer-address';\nimport { AddressResponse } from '@/account/types';\nimport { handleFetchError } from '@/account/lib/fetch-error';\n\nexport const getCustomerAddress = async (): Promise<\n CustomerAddressesModel[]\n> => {\n return await fetchGraphQl(GET_CUSTOMER_ADDRESS, {\n method: 'GET',\n cache: 'no-cache',\n })\n .then((response: AddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformMultipleAddresses(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_COUNTRIES_QUERY = /* GraphQL */ `\n query GET_COUNTRIES_QUERY {\n countries {\n two_letter_abbreviation\n full_name_locale\n available_regions {\n id\n code\n name\n }\n }\n storeConfig {\n countries_with_required_region\n optional_zip_countries\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_COUNTRIES_QUERY } from './graphql/getCountries.graphql';\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { transformCountries } from '@/account/data/transforms';\nimport { CountriesFormResponse } from '@/account/types';\nimport { Country } from '@/account/data/models';\n\nexport const getCountries = async (): Promise<{\n availableCountries: Country[] | [];\n countriesWithRequiredRegion: string[];\n optionalZipCountries: string[];\n}> => {\n const sessionStorageKey = '_account_countries';\n\n const sessionStorageCache = sessionStorage.getItem(sessionStorageKey);\n\n if (sessionStorageCache) {\n return JSON.parse(sessionStorageCache);\n }\n\n return await fetchGraphQl(GET_COUNTRIES_QUERY, {\n method: 'GET',\n cache: 'no-cache',\n })\n .then((response: CountriesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n const transformedData = transformCountries(response);\n\n sessionStorage.setItem(\n sessionStorageKey,\n JSON.stringify(transformedData)\n );\n\n return transformedData;\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const UPDATE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation UPDATE_CUSTOMER_ADDRESS($id: Int!, $input: CustomerAddressInput) {\n updateCustomerAddress(id: $id, input: $input) {\n firstname\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { UPDATE_CUSTOMER_ADDRESS } from './graphql/updateCustomerAddress.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { UpdateCustomerAddressResponse } from '@/account/types';\nimport { CustomerAddressesModel } from '@/account/data/models';\nimport { convertKeysCase } from '@/account/lib/convertCase';\n\ntype ExtendedAddressFormProps = CustomerAddressesModel & {\n addressId: number;\n};\n\nexport const updateCustomerAddress = async (\n forms: ExtendedAddressFormProps\n): Promise<string> => {\n const { addressId, ...address } = forms;\n\n if (!addressId) return '';\n\n return await fetchGraphQl(UPDATE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: {\n id: Number(addressId),\n input: convertKeysCase(address, 'snakeCase', {\n custom_attributesV2: 'custom_attributesV2',\n firstName: 'firstname',\n lastName: 'lastname',\n middleName: 'middlename',\n }),\n },\n })\n .then((response: UpdateCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response?.data?.updateCustomerAddress?.firstname || '';\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REMOVE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation REMOVE_CUSTOMER_ADDRESS($id: Int!) {\n deleteCustomerAddress(id: $id)\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { REMOVE_CUSTOMER_ADDRESS } from './graphql/removeCustomerAddress.graphql';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { RemoveCustomerAddressResponse } from '@/account/types';\n\nexport const removeCustomerAddress = async (\n addressId: number\n): Promise<boolean> => {\n return await fetchGraphQl(REMOVE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: { id: addressId },\n })\n .then((response: RemoveCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response.data.deleteCustomerAddress;\n })\n .catch(handleNetworkError);\n};\n"],"names":["convertToCamelCase","key","_","letter","convertToSnakeCase","convertKeysCase","data","type","dictionary","typeList","callback","element","acc","value","newKey","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","GET_ATTRIBUTES_FORM","GET_ATTRIBUTES_FORM_SHORT","handleNetworkError","error","events","handleFetchError","errors","errorMessage","e","cloneArrayIfExists","fields","multilineItems","i","newItem","transformCustomUpperCode","code","transformOptions","item","_a","el","transformAttributesForm","response","items","_b","_c","other","isDefaultCode","a","b","expandArraysInObject","inputObject","flattenedAttributes","index","transformFullName","address","transformIds","transformContacts","transformSingleAddress","addressData","transformMultipleAddresses","addresses","transformCountries","countries","storeConfig","countriesWithRequiredRegion","optionalZipCountries","two_letter_abbreviation","full_name_locale","country","available_regions","hasRegions","getAttributesForm","formCode","sessionStorageKey","sessionStorageCache","transformedData","CREATE_CUSTOMER_ADDRESS","createCustomerAddress","GET_CUSTOMER_ADDRESS","getCustomerAddress","GET_COUNTRIES_QUERY","getCountries","UPDATE_CUSTOMER_ADDRESS","updateCustomerAddress","forms","addressId","REMOVE_CUSTOMER_ADDRESS","removeCustomerAddress"],"mappings":"oHAiBO,MAAMA,EAAsBC,GAC1BA,EAAI,QAAQ,YAAa,CAACC,EAAGC,IAAWA,EAAO,aAAa,EAGxDC,EAAsBH,GAC1BA,EAAI,QAAQ,WAAaE,GAAW,IAAIA,EAAO,YAAA,CAAa,EAAE,EAG1DE,EAAkB,CAC7BC,EACAC,EACAC,IACQ,CACR,MAAMC,EAAW,CAAC,SAAU,UAAW,QAAQ,EACzCC,EACJH,IAAS,YAAcP,EAAqBI,EAE9C,OAAI,MAAM,QAAQE,CAAI,EACbA,EAAK,IAAKK,GACXF,EAAS,SAAS,OAAOE,CAAO,GAAKA,IAAY,KAAaA,EAE9D,OAAOA,GAAY,SACdN,EAAgBM,EAASJ,EAAMC,CAAU,EAE3CG,CACR,EAGCL,IAAS,MAAQ,OAAOA,GAAS,SAC5B,OAAO,QAAQA,CAAI,EAAE,OAAO,CAACM,EAAK,CAACX,EAAKY,CAAK,IAAM,CACxD,MAAMC,EACJN,GAAcA,EAAWP,CAAG,EAAIO,EAAWP,CAAG,EAAIS,EAAST,CAAG,EAChE,OAAAW,EAAIE,CAAM,EACRL,EAAS,SAAS,OAAOI,CAAK,GAAKA,IAAU,KACzCA,E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/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-account/src/api/getAttributesForm/graphql/getAttributesForm.graphql.ts","/@dropins/storefront-account/src/lib/network-error.ts","/@dropins/storefront-account/src/lib/fetch-error.ts","/@dropins/storefront-account/src/lib/convertCase.ts","/@dropins/storefront-account/src/data/transforms/transform-attributes-form.ts","/@dropins/storefront-account/src/data/transforms/transform-customer-address.ts","/@dropins/storefront-account/src/data/transforms/transform-countries.ts","/@dropins/storefront-account/src/api/getAttributesForm/getAttributesForm.ts","/@dropins/storefront-account/src/api/createCustomerAddress/graphql/createCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/createCustomerAddress/createCustomerAddress.ts","/@dropins/storefront-account/src/api/getCustomerAddress/graphql/getCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/getCustomerAddress/getCustomerAddress.ts","/@dropins/storefront-account/src/api/getCountries/graphql/getCountries.graphql.ts","/@dropins/storefront-account/src/api/getCountries/getCountries.ts","/@dropins/storefront-account/src/api/updateCustomerAddress/graphql/updateCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/updateCustomerAddress/updateCustomerAddress.ts","/@dropins/storefront-account/src/api/removeCustomerAddress/graphql/removeCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/removeCustomerAddress/removeCustomerAddress.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_ATTRIBUTES_FORM = /* GraphQL */ `\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\n }\n }\n`;\n\nexport const GET_ATTRIBUTES_FORM_SHORT = /* GraphQL */ `\n query GET_ATTRIBUTES_FORM_SHORT {\n attributesForm(formCode: \"customer_register_address\") {\n items {\n frontend_input\n label\n code\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n }\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\n\n/**\n * A function which can be attached to fetchGraphQL to handle thrown errors in\n * a generic way.\n */\nexport const handleNetworkError = (error: Error) => {\n const isAbortError =\n error instanceof DOMException && error.name === 'AbortError';\n\n if (!isAbortError) {\n // @ts-ignore\n events.emit('error', {\n source: 'auth',\n type: 'network',\n error,\n });\n }\n throw error;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const convertToCamelCase = (key: string): string => {\n return key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());\n};\n\nexport const convertToSnakeCase = (key: string): string => {\n return key.replace(/([A-Z])/g, (letter) => `_${letter.toLowerCase()}`);\n};\n\nexport const convertKeysCase = (\n data: any,\n type: 'snakeCase' | 'camelCase',\n dictionary?: Record<string, string>\n): any => {\n const typeList = ['string', 'boolean', 'number'];\n const callback =\n type === 'camelCase' ? convertToCamelCase : convertToSnakeCase;\n\n if (Array.isArray(data)) {\n return data.map((element) => {\n if (typeList.includes(typeof element) || element === null) return element;\n\n if (typeof element === 'object') {\n return convertKeysCase(element, type, dictionary);\n }\n return element;\n });\n }\n\n if (data !== null && typeof data === 'object') {\n return Object.entries(data).reduce((acc, [key, value]) => {\n const newKey =\n dictionary && dictionary[key] ? dictionary[key] : callback(key);\n acc[newKey] =\n typeList.includes(typeof value) || value === null\n ? value\n : convertKeysCase(value, type, dictionary);\n return acc;\n }, {} as Record<string, unknown>);\n }\n\n return data;\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 GetAttributesFormResponse,\n ResponseAttributesFormItemsProps,\n} from '@/account/types';\nimport { AttributesFormModel, FieldEnumList } from '../models';\nimport { convertToCamelCase } from '@/account/lib/convertCase';\n\nexport const cloneArrayIfExists = (\n fields: ResponseAttributesFormItemsProps[]\n) => {\n let multilineItems: any = [];\n\n for (const element of fields) {\n if (element.frontend_input !== 'MULTILINE' || element.multiline_count < 2) {\n continue;\n }\n\n for (let i = 2; i <= element.multiline_count; i++) {\n const newItem = {\n ...element,\n is_required: false,\n name: `${element.code}_multiline_${i}`,\n code: `${element.code}_multiline_${i}`,\n id: `${element.code}_multiline_${i}`,\n };\n\n multilineItems.push(newItem);\n }\n }\n\n return multilineItems;\n};\n\nconst transformCustomUpperCode = (code: string) => {\n switch (code) {\n case 'middlename':\n return 'middleName';\n case 'firstname':\n return 'firstName';\n case 'lastname':\n return 'lastName';\n default:\n return convertToCamelCase(code);\n }\n};\n\nconst transformOptions = (item: any) => {\n if (!item?.options) return [];\n\n return item?.options?.map((el: any) => {\n return {\n isDefault: el?.is_default ?? false,\n text: el?.label ?? '',\n value: el?.value ?? '',\n };\n });\n};\n\nexport const transformAttributesForm = (\n response: GetAttributesFormResponse\n): AttributesFormModel[] => {\n const items = response?.data?.attributesForm?.items || [];\n\n if (!items.length) return [];\n\n const fields = items\n .filter((el) => !el.frontend_input?.includes('HIDDEN'))\n ?.map(({ code, ...other }) => {\n const isDefaultCode = code !== 'country_id' ? code : 'country_code';\n\n return {\n ...other,\n name: isDefaultCode,\n id: isDefaultCode,\n code: isDefaultCode,\n };\n });\n\n const multilineItems = cloneArrayIfExists(fields as any);\n\n const attributesConfig = fields\n .concat(multilineItems)\n .map((item) => {\n return {\n code: item?.code,\n name: item?.name,\n id: item?.id,\n label: item?.label ?? '',\n entityType: item?.entity_type,\n className: item?.frontend_class ?? '',\n defaultValue: item?.default_value ?? '',\n fieldType: item?.frontend_input as FieldEnumList,\n multilineCount: item?.multiline_count ?? 0,\n orderNumber: Number(item?.sort_order) || 0,\n isHidden: false,\n isUnique: item?.is_unique ?? false,\n required: item?.is_required ?? false,\n validateRules: item?.validate_rules ?? [],\n options: transformOptions(item),\n customUpperCode: transformCustomUpperCode(item?.code),\n };\n })\n .sort((a, b) => Number(a.orderNumber) - Number(b.orderNumber));\n\n return attributesConfig;\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 { CustomerAddressesModel } from '../models';\nimport { AddressResponse, UserAddressesProps } from '@/account/types';\nimport { convertKeysCase } from '@/account/lib/convertCase';\n\nconst expandArraysInObject = (inputObject: UserAddressesProps) => {\n const flattenedAttributes: Record<string, unknown> = {};\n\n for (const key in inputObject) {\n const element = inputObject[key as keyof UserAddressesProps];\n\n if (!Array.isArray(element) || element.length === 0) continue;\n\n if (key === 'custom_attributesV2') {\n element.forEach((item) => {\n if (typeof item === 'object' && 'value' in item) {\n flattenedAttributes[item?.code] = item?.value;\n }\n });\n } else if (element.length > 1) {\n element.forEach((value: unknown, index: number) => {\n index === 0\n ? (flattenedAttributes[key] = value)\n : (flattenedAttributes[`${key}_multiline_${index + 1}`] = value);\n });\n } else {\n flattenedAttributes[key] = element[0] as Record<string, string>;\n }\n }\n\n return flattenedAttributes;\n};\nconst transformFullName = (address: UserAddressesProps) => {\n return {\n prefix: address?.prefix ?? '',\n suffix: address?.suffix ?? '',\n firstname: address?.firstname ?? '',\n lastname: address?.lastname ?? '',\n middlename: address?.middlename ?? '',\n };\n};\n\nconst transformIds = (address: UserAddressesProps) => {\n return {\n id: address?.id ?? '',\n vat_id: address?.vat_id ?? '',\n postcode: address?.postcode ?? '',\n country_code: address?.country_code ?? '',\n uid: address?.uid ?? '',\n };\n};\n\nconst transformContacts = (address: UserAddressesProps) => {\n return {\n company: address?.company ?? '',\n telephone: address?.telephone ?? '',\n fax: address?.fax ?? '',\n };\n};\n\n// Function to transform a single address\nexport const transformSingleAddress = (\n addressData: UserAddressesProps\n): CustomerAddressesModel => {\n const result = convertKeysCase(\n {\n ...transformFullName(addressData),\n ...transformIds(addressData),\n ...transformContacts(addressData),\n city: addressData?.city ?? '',\n region: {\n region: addressData?.region?.region ?? '',\n region_code: addressData?.region?.region_code ?? '',\n region_id: addressData?.region?.region_id ?? '',\n },\n default_shipping: addressData?.default_shipping || false,\n default_billing: addressData?.default_billing || false,\n ...expandArraysInObject(addressData),\n },\n 'camelCase',\n {}\n );\n\n return result;\n};\n\n// Function to transform multiple addresses from a response\nexport const transformMultipleAddresses = (\n response: AddressResponse\n): CustomerAddressesModel[] | [] => {\n const addresses: UserAddressesProps[] =\n response?.data?.customer?.addresses || [];\n\n if (!addresses.length) return [];\n\n const result = addresses\n .map(transformSingleAddress)\n .sort(\n (a, b) =>\n (Number(b.defaultBilling) || Number(b.defaultShipping)) -\n (Number(a.defaultBilling) || Number(a.defaultShipping))\n );\n\n return result;\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 { CountriesFormResponse } from '@/account/types';\nimport { Country } from '../models';\n\nexport const transformCountries = (\n response: CountriesFormResponse\n): {\n availableCountries: Country[] | [];\n countriesWithRequiredRegion: string[];\n optionalZipCountries: string[];\n} => {\n if (!response?.data?.countries?.length) {\n return {\n availableCountries: [],\n countriesWithRequiredRegion: [],\n optionalZipCountries: [],\n };\n }\n\n const { countries, storeConfig } = response.data;\n\n const countriesWithRequiredRegion =\n storeConfig?.countries_with_required_region.split(',');\n const optionalZipCountries = storeConfig?.optional_zip_countries.split(',');\n\n const availableCountries = countries\n .filter(({ two_letter_abbreviation, full_name_locale }) =>\n Boolean(two_letter_abbreviation && full_name_locale)\n )\n .map((country) => {\n const { two_letter_abbreviation, full_name_locale, available_regions } = country;\n\n const hasRegions = Array.isArray(available_regions) && available_regions.length > 0;\n return {\n value: two_letter_abbreviation,\n text: full_name_locale,\n availableRegions: hasRegions ? available_regions : undefined,\n };\n })\n .sort((a, b) => a.text.localeCompare(b.text));\n\n return {\n availableCountries,\n countriesWithRequiredRegion,\n optionalZipCountries,\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 { fetchGraphQl } from '../fetch-graphql';\nimport {\n GET_ATTRIBUTES_FORM,\n GET_ATTRIBUTES_FORM_SHORT,\n} from './graphql/getAttributesForm.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { transformAttributesForm } from '@/account/data/transforms';\nimport { AttributesFormModel } from '@/account/data/models';\nimport { GetAttributesFormResponse } from '@/account/types';\n\nexport const getAttributesForm = async (\n formCode: string\n): Promise<AttributesFormModel[]> => {\n const sessionStorageKey = `_account_attributesForm_${formCode}`;\n\n const sessionStorageCache = sessionStorage.getItem(sessionStorageKey);\n\n if (sessionStorageCache) {\n return JSON.parse(sessionStorageCache);\n }\n\n return await fetchGraphQl(\n formCode !== 'shortRequest'\n ? GET_ATTRIBUTES_FORM\n : GET_ATTRIBUTES_FORM_SHORT,\n {\n method: 'GET',\n cache: 'force-cache',\n variables: { formCode },\n }\n )\n .then((response: GetAttributesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n const transformedData = transformAttributesForm(response);\n\n sessionStorage.setItem(\n sessionStorageKey,\n JSON.stringify(transformedData)\n );\n\n return transformedData;\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CREATE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n firstname\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CreateCustomerAddressResponse } from '@/account/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER_ADDRESS } from './graphql/createCustomerAddress.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { convertKeysCase } from '@/account/lib/convertCase';\nimport { CustomerAddressesModel } from '@/account/data/models';\n\nexport const createCustomerAddress = async (\n address: CustomerAddressesModel\n): Promise<string> => {\n return await fetchGraphQl(CREATE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: {\n input: convertKeysCase(address, 'snakeCase', {\n custom_attributesV2: 'custom_attributesV2',\n firstName: 'firstname',\n lastName: 'lastname',\n middleName: 'middlename',\n }),\n },\n })\n .then((response: CreateCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response?.data?.createCustomerAddress?.firstname || '';\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_CUSTOMER_ADDRESS = /* GraphQL */ `\n query GET_CUSTOMER_ADDRESS {\n customer {\n addresses {\n firstname\n lastname\n middlename\n fax\n prefix\n suffix\n city\n company\n country_code\n region {\n region\n region_code\n region_id\n }\n custom_attributesV2 {\n ... on AttributeValue {\n code\n value\n }\n }\n telephone\n id\n vat_id\n postcode\n street\n default_shipping\n default_billing\n uid\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { GET_CUSTOMER_ADDRESS } from './graphql/getCustomerAddress.graphql';\nimport { transformMultipleAddresses } from '@/account/data/transforms';\nimport { CustomerAddressesModel } from '@/account/data/models/customer-address';\nimport { AddressResponse } from '@/account/types';\nimport { handleFetchError } from '@/account/lib/fetch-error';\n\nexport const getCustomerAddress = async (): Promise<\n CustomerAddressesModel[]\n> => {\n return await fetchGraphQl(GET_CUSTOMER_ADDRESS, {\n method: 'GET',\n cache: 'no-cache',\n })\n .then((response: AddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformMultipleAddresses(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_COUNTRIES_QUERY = /* GraphQL */ `\n query GET_COUNTRIES_QUERY {\n countries {\n two_letter_abbreviation\n full_name_locale\n available_regions {\n id\n code\n name\n }\n }\n storeConfig {\n countries_with_required_region\n optional_zip_countries\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_COUNTRIES_QUERY } from './graphql/getCountries.graphql';\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { transformCountries } from '@/account/data/transforms';\nimport { CountriesFormResponse } from '@/account/types';\nimport { Country } from '@/account/data/models';\n\nexport const getCountries = async (): Promise<{\n availableCountries: Country[] | [];\n countriesWithRequiredRegion: string[];\n optionalZipCountries: string[];\n}> => {\n const sessionStorageKey = '_account_countries';\n\n const sessionStorageCache = sessionStorage.getItem(sessionStorageKey);\n\n if (sessionStorageCache) {\n return JSON.parse(sessionStorageCache);\n }\n\n return await fetchGraphQl(GET_COUNTRIES_QUERY, {\n method: 'GET',\n cache: 'no-cache',\n })\n .then((response: CountriesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n const transformedData = transformCountries(response);\n\n sessionStorage.setItem(\n sessionStorageKey,\n JSON.stringify(transformedData)\n );\n\n return transformedData;\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const UPDATE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation UPDATE_CUSTOMER_ADDRESS($id: Int!, $input: CustomerAddressInput) {\n updateCustomerAddress(id: $id, input: $input) {\n firstname\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { UPDATE_CUSTOMER_ADDRESS } from './graphql/updateCustomerAddress.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { UpdateCustomerAddressResponse } from '@/account/types';\nimport { CustomerAddressesModel } from '@/account/data/models';\nimport { convertKeysCase } from '@/account/lib/convertCase';\n\ntype ExtendedAddressFormProps = CustomerAddressesModel & {\n addressId: number;\n};\n\nexport const updateCustomerAddress = async (\n forms: ExtendedAddressFormProps\n): Promise<string> => {\n const { addressId, ...address } = forms;\n\n if (!addressId) return '';\n\n return await fetchGraphQl(UPDATE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: {\n id: Number(addressId),\n input: convertKeysCase(address, 'snakeCase', {\n custom_attributesV2: 'custom_attributesV2',\n firstName: 'firstname',\n lastName: 'lastname',\n middleName: 'middlename',\n }),\n },\n })\n .then((response: UpdateCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response?.data?.updateCustomerAddress?.firstname || '';\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REMOVE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation REMOVE_CUSTOMER_ADDRESS($id: Int!) {\n deleteCustomerAddress(id: $id)\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { REMOVE_CUSTOMER_ADDRESS } from './graphql/removeCustomerAddress.graphql';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { RemoveCustomerAddressResponse } from '@/account/types';\n\nexport const removeCustomerAddress = async (\n addressId: number\n): Promise<boolean> => {\n return await fetchGraphQl(REMOVE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: { id: addressId },\n })\n .then((response: RemoveCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response.data.deleteCustomerAddress;\n })\n .catch(handleNetworkError);\n};\n"],"names":["setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","GET_ATTRIBUTES_FORM","GET_ATTRIBUTES_FORM_SHORT","handleNetworkError","error","events","handleFetchError","errors","errorMessage","e","convertToCamelCase","key","_","letter","convertToSnakeCase","convertKeysCase","data","type","dictionary","typeList","callback","element","acc","value","newKey","cloneArrayIfExists","fields","multilineItems","i","newItem","transformCustomUpperCode","code","transformOptions","item","_a","el","transformAttributesForm","response","items","_b","_c","other","isDefaultCode","a","b","expandArraysInObject","inputObject","flattenedAttributes","index","transformFullName","address","transformIds","transformContacts","transformSingleAddress","addressData","transformMultipleAddresses","addresses","transformCountries","countries","storeConfig","countriesWithRequiredRegion","optionalZipCountries","two_letter_abbreviation","full_name_locale","country","available_regions","hasRegions","getAttributesForm","formCode","sessionStorageKey","sessionStorageCache","transformedData","CREATE_CUSTOMER_ADDRESS","createCustomerAddress","GET_CUSTOMER_ADDRESS","getCustomerAddress","GET_COUNTRIES_QUERY","getCountries","UPDATE_CUSTOMER_ADDRESS","updateCustomerAddress","forms","addressId","REMOVE_CUSTOMER_ADDRESS","removeCustomerAddress"],"mappings":"oHAmBO,KAAM,CACX,YAAAA,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA,ECTVC,EAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkCpCC,EAA0C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EC5B1CC,EAAsBC,GAAiB,CAIlD,MAFEA,aAAiB,cAAgBA,EAAM,OAAS,cAIhDC,EAAO,KAAK,QAAS,CACnB,OAAQ,OACR,KAAM,UACN,MAAAD,CAAA,CACD,EAEGA,CACR,EClBaE,EAAoBC,GAAuC,CACtE,MAAMC,EAAeD,EAAO,IAAKE,GAAWA,EAAE,OAAO,EAAE,KAAK,GAAG,EAE/D,MAAM,MAAMD,CAAY,CAC1B,ECLaE,EAAs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right 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{l as n,f as C,h as o,a as h,m as x}from"./removeCustomerAddress.js";import{BASIC_CUSTOMER_INFO_FRAGMENT as F}from"../fragments.js";import{c as V}from"./
|
|
3
|
+
import{l as n,f as C,h as o,a as h,m as x}from"./removeCustomerAddress.js";import{BASIC_CUSTOMER_INFO_FRAGMENT as F}from"../fragments.js";import{c as V}from"./initialize.js";import"@dropins/tools/event-bus.js";import{merge as B}from"@dropins/tools/lib.js";const L=t=>{var r,u,i,d,_,f,E,S,T,w,e,g,O,P,A,M,U,R,b,N,$,G,v,D,c,I;const m=(i=(u=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:u.custom_attributes)==null?void 0:i.filter(l=>l).reduce((l,y)=>(l[n(y.code)]=y.value??"",l),{}),a={email:((_=(d=t==null?void 0:t.data)==null?void 0:d.customer)==null?void 0:_.email)||"",firstName:((E=(f=t==null?void 0:t.data)==null?void 0:f.customer)==null?void 0:E.firstname)||"",lastName:((T=(S=t==null?void 0:t.data)==null?void 0:S.customer)==null?void 0:T.lastname)||"",middleName:((e=(w=t==null?void 0:t.data)==null?void 0:w.customer)==null?void 0:e.middlename)||"",gender:((O=(g=t==null?void 0:t.data)==null?void 0:g.customer)==null?void 0:O.gender)||"1",dateOfBirth:((A=(P=t==null?void 0:t.data)==null?void 0:P.customer)==null?void 0:A.date_of_birth)||"",prefix:((U=(M=t==null?void 0:t.data)==null?void 0:M.customer)==null?void 0:U.prefix)||"",suffix:((b=(R=t==null?void 0:t.data)==null?void 0:R.customer)==null?void 0:b.suffix)||"",createdAt:(($=(N=t==null?void 0:t.data)==null?void 0:N.customer)==null?void 0:$.created_at)||"",...m};return B(a,(I=(c=(D=(v=(G=V)==null?void 0:G.getConfig())==null?void 0:v.models)==null?void 0:D.CustomerDataModelShort)==null?void 0:c.transformer)==null?void 0:I.call(c,t.data))},k=`
|
|
4
4
|
query GET_CUSTOMER {
|
|
5
5
|
customer {
|
|
6
6
|
...BASIC_CUSTOMER_INFO_FRAGMENT
|