@dropins/storefront-account 3.2.0 → 3.2.1

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.
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
- import{t as H,f as j,a as Y}from"./removeCustomerAddress.js";import{c as J}from"./initialize.js";import"@dropins/tools/event-bus.js";import{merge as K}from"@dropins/tools/lib.js";import{CUSTOMER_ORDER_FRAGMENT as Q,ADDRESS_FRAGMENT as B,ORDER_SUMMARY_FRAGMENT as V}from"../fragments.js";const W=(a,t="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(t,d).format(u)},X=(a,t="en-US",c={})=>{const d={...{hour:"2-digit",minute:"2-digit"},...c},u=new Date(a);return isNaN(u.getTime())?"Invalid Time":new Intl.DateTimeFormat(t,d).format(u)},_={value:0,currency:"USD"},Z=a=>{var t,c,s,d,u,g,f,l,n,T;return{subtotal:((t=a==null?void 0:a.total)==null?void 0:t.subtotal)??_,grandTotal:((c=a==null?void 0:a.total)==null?void 0:c.grand_total)??_,grandTotalExclTax:((s=a==null?void 0:a.total)==null?void 0:s.grand_total_excl_tax)??_,totalGiftcard:((d=a==null?void 0:a.total)==null?void 0:d.total_giftcard)??_,subtotalExclTax:((u=a==null?void 0:a.total)==null?void 0:u.subtotal_excl_tax)??_,subtotalInclTax:((g=a==null?void 0:a.total)==null?void 0:g.subtotal_incl_tax)??_,taxes:((f=a==null?void 0:a.total)==null?void 0:f.taxes)??[],totalTax:((l=a==null?void 0:a.total)==null?void 0:l.total_tax)??_,totalShipping:((n=a==null?void 0:a.total)==null?void 0:n.total_shipping)??_,discounts:((T=a==null?void 0:a.total)==null?void 0:T.discounts)??[]}},m=a=>{var d,u,g,f,l,n,T,S,i,E,O,p,h,D,y,M,A,I,b,x,N,G,C,F,$,U,k,v,R,q;if(!((u=(d=a.data)==null?void 0:d.customer)!=null&&u.orders))return null;const t=((f=(g=a==null?void 0:a.data)==null?void 0:g.customer)==null?void 0:f.returns)??[],s={items:(((T=(n=(l=a==null?void 0:a.data)==null?void 0:l.customer)==null?void 0:n.orders)==null?void 0:T.items)??[]).map(r=>{var w;return{items:r==null?void 0:r.items.map(o=>{var L,z,P;return{status:(o==null?void 0:o.status)??"",productName:(o==null?void 0:o.product_name)??"",id:o==null?void 0:o.id,quantityOrdered:(o==null?void 0:o.quantity_ordered)??0,quantityShipped:(o==null?void 0:o.quantity_shipped)??0,quantityInvoiced:(o==null?void 0:o.quantity_invoiced)??0,sku:(o==null?void 0:o.product_sku)??"",urlKey:(o==null?void 0:o.product_url_key)??"",topLevelSku:((L=o==null?void 0:o.product)==null?void 0:L.sku)??"",product:{smallImage:{url:((P=(z=o==null?void 0:o.product)==null?void 0:z.small_image)==null?void 0:P.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:(w=t==null?void 0:t.items)==null?void 0:w.filter(o=>o.order.id===r.id),orderDate:W(r.order_date),orderTime:X(r.order_date),shippingAddress:H(r.shipping_address),billingAddress:H(r.billing_address),total:Z(r)}}),pageInfo:{pageSize:((O=(E=(i=(S=a==null?void 0:a.data)==null?void 0:S.customer)==null?void 0:i.orders)==null?void 0:E.page_info)==null?void 0:O.page_size)??10,totalPages:((y=(D=(h=(p=a==null?void 0:a.data)==null?void 0:p.customer)==null?void 0:h.orders)==null?void 0:D.page_info)==null?void 0:y.total_pages)??1,currentPage:((b=(I=(A=(M=a==null?void 0:a.data)==null?void 0:M.customer)==null?void 0:A.orders)==null?void 0:I.page_info)==null?void 0:b.current_page)??1},totalCount:((G=(N=(x=a==null?void 0:a.data)==null?void 0:x.customer)==null?void 0:N.orders)==null?void 0:G.total_count)??0,dateOfFirstOrder:(($=(F=(C=a==null?void 0:a.data)==null?void 0:C.customer)==null?void 0:F.orders)==null?void 0:$.date_of_first_order)??""};return K(s,(q=(R=(v=(k=(U=J)==null?void 0:U.getConfig())==null?void 0:k.models)==null?void 0:v.OrderHistoryModel)==null?void 0:R.transformer)==null?void 0:q.call(R,a.data))},e=`
3
+ import{t as H,f as j,a as Y}from"./removeCustomerAddress.js";import{c as J}from"./initialize.js";import"@dropins/tools/event-bus.js";import{merge as K}from"@dropins/tools/lib.js";import{CUSTOMER_ORDER_FRAGMENT as Q,ADDRESS_FRAGMENT as Z,ORDER_SUMMARY_FRAGMENT as B}from"../fragments.js";const V=(a,t="en-US",c={})=>{const s={day:"2-digit",month:"2-digit",year:"numeric"},d=/^\d{4}-\d{2}-\d{2}$/.test(a.trim()),u={...s,...d?{timeZone:"UTC"}:{},...c},_=new Date(a);return isNaN(_.getTime())?"Invalid Date":new Intl.DateTimeFormat(t,u).format(_)},W=(a,t="en-US",c={})=>{const d={...{hour:"2-digit",minute:"2-digit"},...c},u=new Date(a);return isNaN(u.getTime())?"Invalid Time":new Intl.DateTimeFormat(t,d).format(u)},g={value:0,currency:"USD"},X=a=>{var t,c,s,d,u,_,f,l,n,T;return{subtotal:((t=a==null?void 0:a.total)==null?void 0:t.subtotal)??g,grandTotal:((c=a==null?void 0:a.total)==null?void 0:c.grand_total)??g,grandTotalExclTax:((s=a==null?void 0:a.total)==null?void 0:s.grand_total_excl_tax)??g,totalGiftcard:((d=a==null?void 0:a.total)==null?void 0:d.total_giftcard)??g,subtotalExclTax:((u=a==null?void 0:a.total)==null?void 0:u.subtotal_excl_tax)??g,subtotalInclTax:((_=a==null?void 0:a.total)==null?void 0:_.subtotal_incl_tax)??g,taxes:((f=a==null?void 0:a.total)==null?void 0:f.taxes)??[],totalTax:((l=a==null?void 0:a.total)==null?void 0:l.total_tax)??g,totalShipping:((n=a==null?void 0:a.total)==null?void 0:n.total_shipping)??g,discounts:((T=a==null?void 0:a.total)==null?void 0:T.discounts)??[]}},m=a=>{var d,u,_,f,l,n,T,R,S,E,O,p,h,D,y,M,A,I,b,x,N,C,G,$,F,U,k,v,i,q;if(!((u=(d=a.data)==null?void 0:d.customer)!=null&&u.orders))return null;const t=((f=(_=a==null?void 0:a.data)==null?void 0:_.customer)==null?void 0:f.returns)??[],s={items:(((T=(n=(l=a==null?void 0:a.data)==null?void 0:l.customer)==null?void 0:n.orders)==null?void 0:T.items)??[]).map(r=>{var w;return{items:r==null?void 0:r.items.map(o=>{var L,z,P;return{status:(o==null?void 0:o.status)??"",productName:(o==null?void 0:o.product_name)??"",id:o==null?void 0:o.id,quantityOrdered:(o==null?void 0:o.quantity_ordered)??0,quantityShipped:(o==null?void 0:o.quantity_shipped)??0,quantityInvoiced:(o==null?void 0:o.quantity_invoiced)??0,sku:(o==null?void 0:o.product_sku)??"",urlKey:(o==null?void 0:o.product_url_key)??"",topLevelSku:((L=o==null?void 0:o.product)==null?void 0:L.sku)??"",product:{smallImage:{url:((P=(z=o==null?void 0:o.product)==null?void 0:z.small_image)==null?void 0:P.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:(w=t==null?void 0:t.items)==null?void 0:w.filter(o=>o.order.id===r.id),orderDate:V(r.order_date),orderTime:W(r.order_date),shippingAddress:H(r.shipping_address),billingAddress:H(r.billing_address),total:X(r)}}),pageInfo:{pageSize:((O=(E=(S=(R=a==null?void 0:a.data)==null?void 0:R.customer)==null?void 0:S.orders)==null?void 0:E.page_info)==null?void 0:O.page_size)??10,totalPages:((y=(D=(h=(p=a==null?void 0:a.data)==null?void 0:p.customer)==null?void 0:h.orders)==null?void 0:D.page_info)==null?void 0:y.total_pages)??1,currentPage:((b=(I=(A=(M=a==null?void 0:a.data)==null?void 0:M.customer)==null?void 0:A.orders)==null?void 0:I.page_info)==null?void 0:b.current_page)??1},totalCount:((C=(N=(x=a==null?void 0:a.data)==null?void 0:x.customer)==null?void 0:N.orders)==null?void 0:C.total_count)??0,dateOfFirstOrder:((F=($=(G=a==null?void 0:a.data)==null?void 0:G.customer)==null?void 0:$.orders)==null?void 0:F.date_of_first_order)??""};return K(s,(q=(i=(v=(k=(U=J)==null?void 0:U.getConfig())==null?void 0:k.models)==null?void 0:v.OrderHistoryModel)==null?void 0:i.transformer)==null?void 0:q.call(i,a.data))},e=`
4
4
  query GET_CUSTOMER_ORDERS_LIST(
5
5
  $currentPage: Int
6
6
  $pageSize: Int
@@ -46,7 +46,7 @@ import{t as H,f as j,a as Y}from"./removeCustomerAddress.js";import{c as J}from"
46
46
  }
47
47
  }
48
48
  ${Q}
49
+ ${Z}
49
50
  ${B}
50
- ${V}
51
51
  `,aa={sort_direction:"DESC",sort_field:"CREATED_AT"},ca=async(a,t,c)=>{const s=t.includes("viewAll")?{}:{order_date:JSON.parse(t)};return await j(e,{method:"GET",cache:"no-cache",variables:{pageSize:a,currentPage:c,filter:s,sort:aa}}).then(d=>m(d)).catch(Y)};export{ca as g};
52
52
  //# sourceMappingURL=getOrderHistoryList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getOrderHistoryList.js","sources":["/@dropins/storefront-account/src/lib/formatDateToLocale.ts","/@dropins/storefront-account/src/lib/formatTimeToLocale.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 2026 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/**\n * Formats a time string according to a specified locale and options.\n * Returns \"Invalid Time\" 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 time string, or \"Invalid Time\" if the input is invalid.\n *\n * @example\n * // Default formatting (en-US locale)\n * console.log(formatTimeToLocale('2023-08-29 12:34'));\n * // Output: \"12:34 AM\"\n */\nexport const formatTimeToLocale = (\n date: string,\n locale: string = 'en-US',\n options: Intl.DateTimeFormatOptions = {}\n): string => {\n const defaultOptions: Intl.DateTimeFormatOptions = {\n hour: '2-digit',\n minute: '2-digit',\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 Time';\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 { formatTimeToLocale } from '@/account/lib/formatTimeToLocale';\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?.product_sku ?? '',\n urlKey: element?.product_url_key ?? '',\n topLevelSku: element?.product?.sku ?? '',\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 orderTime: formatTimeToLocale(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 CUSTOMER_ORDER_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 ...CUSTOMER_ORDER_FRAGMENT\n shipping_address {\n ...ADDRESS_FRAGMENT\n }\n billing_address {\n ...ADDRESS_FRAGMENT\n }\n total {\n ...ORDER_SUMMARY_FRAGMENT\n }\n }\n }\n }\n }\n ${CUSTOMER_ORDER_FRAGMENT}\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","formatTimeToLocale","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","CUSTOMER_ORDER_FRAGMENT","ADDRESS_FRAGMENT","ORDER_SUMMARY_FRAGMENT","SORT_DIRECTION","getOrderHistoryList","pageSize","selectOrdersDate","currentPage","filterOrderDate","fetchGraphQl","handleNetworkError"],"mappings":"+RA8CO,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,ECtCaC,EAAqB,CAChCL,EACAC,EAAiB,QACjBC,EAAsC,CAAA,IAC3B,CAKX,MAAMC,EAA4C,CAChD,GALiD,CACjD,KAAM,UACN,OAAQ,SAAA,EAIR,GAAGD,CAAA,EAGCE,EAAU,IAAI,KAAKJ,CAAI,EAE7B,OAAI,MAAMI,EAAQ,QAAA,CAAS,EAClB,eAGS,IAAI,KAAK,eAAeH,EAAQE,CAAa,EAC9C,OAAOC,CAAO,CACjC,ECxBME,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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,MAAMuC,CAAkB,CAC7B"}
1
+ {"version":3,"file":"getOrderHistoryList.js","sources":["/@dropins/storefront-account/src/lib/formatDateToLocale.ts","/@dropins/storefront-account/src/lib/formatTimeToLocale.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 // ISO date-only strings parse as UTC midnight; formatting in the host timezone\n // shifts the calendar day west of UTC. Use UTC for display so the date matches\n // the string in every environment (callers can override via `options.timeZone`).\n const isDateOnly = /^\\d{4}-\\d{2}-\\d{2}$/.test(date.trim());\n\n const formatOptions: Intl.DateTimeFormatOptions = {\n ...defaultOptions,\n ...(isDateOnly ? { timeZone: 'UTC' } : {}),\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 2026 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/**\n * Formats a time string according to a specified locale and options.\n * Returns \"Invalid Time\" 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 time string, or \"Invalid Time\" if the input is invalid.\n *\n * @example\n * // Default formatting (en-US locale)\n * console.log(formatTimeToLocale('2023-08-29 12:34'));\n * // Output: \"12:34 AM\"\n */\nexport const formatTimeToLocale = (\n date: string,\n locale: string = 'en-US',\n options: Intl.DateTimeFormatOptions = {}\n): string => {\n const defaultOptions: Intl.DateTimeFormatOptions = {\n hour: '2-digit',\n minute: '2-digit',\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 Time';\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 { formatTimeToLocale } from '@/account/lib/formatTimeToLocale';\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?.product_sku ?? '',\n urlKey: element?.product_url_key ?? '',\n topLevelSku: element?.product?.sku ?? '',\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 orderTime: formatTimeToLocale(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 CUSTOMER_ORDER_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 ...CUSTOMER_ORDER_FRAGMENT\n shipping_address {\n ...ADDRESS_FRAGMENT\n }\n billing_address {\n ...ADDRESS_FRAGMENT\n }\n total {\n ...ORDER_SUMMARY_FRAGMENT\n }\n }\n }\n }\n }\n ${CUSTOMER_ORDER_FRAGMENT}\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","defaultOptions","isDateOnly","formatOptions","dateObj","formatTimeToLocale","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","CUSTOMER_ORDER_FRAGMENT","ADDRESS_FRAGMENT","ORDER_SUMMARY_FRAGMENT","SORT_DIRECTION","getOrderHistoryList","pageSize","selectOrdersDate","currentPage","filterOrderDate","fetchGraphQl","handleNetworkError"],"mappings":"+RA8CO,MAAMA,EAAqB,CAChCC,EACAC,EAAiB,QACjBC,EAAsC,CAAA,IAC3B,CACX,MAAMC,EAA6C,CACjD,IAAK,UACL,MAAO,UACP,KAAM,SAAA,EAKFC,EAAa,sBAAsB,KAAKJ,EAAK,MAAM,EAEnDK,EAA4C,CAChD,GAAGF,EACH,GAAIC,EAAa,CAAE,SAAU,KAAA,EAAU,CAAA,EACvC,GAAGF,CAAA,EAGCI,EAAU,IAAI,KAAKN,CAAI,EAE7B,OAAI,MAAMM,EAAQ,QAAA,CAAS,EAClB,eAGS,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EAAyC;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IA6ClDC,CAAuB;AAAA,IACvBC,CAAgB;AAAA,IAChBC,CAAsB;AAAA,EC9CpBC,GAAiB,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,EAAaV,EAA0B,CAClD,OAAQ,MACR,MAAO,WACP,UAAW,CACT,SAAAM,EACA,YAAAE,EACA,OAAQC,EACR,KAAML,EAAA,CACR,CACD,EACE,KAAMhC,GACED,EAA0BC,CAAQ,CAC1C,EACA,MAAMuC,CAAkB,CAC7B"}
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2026 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"./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=`
3
+ import{l as F,f as e,h as C,a as _,m as k}from"./removeCustomerAddress.js";import{BASIC_CUSTOMER_INFO_FRAGMENT as B}from"../fragments.js";import{c as L}from"./initialize.js";import"@dropins/tools/event-bus.js";import{merge as V}from"@dropins/tools/lib.js";const H=t=>{var r,i,u,d,h,f,E,S,T,w,g,O,P,A,M,U,b,R,N,$,n,v,G,y,l,D;const m=(u=(i=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:i.custom_attributes)==null?void 0:u.filter(c=>c).reduce((c,o)=>{var x;const I=F(o.code);return(x=o.selected_options)!=null&&x.length?c[I]=o.selected_options[0].value??"":c[I]=o.value??"",c},{}),a={email:((h=(d=t==null?void 0:t.data)==null?void 0:d.customer)==null?void 0:h.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:((g=(w=t==null?void 0:t.data)==null?void 0:w.customer)==null?void 0:g.middlename)||"",gender:((P=(O=t==null?void 0:t.data)==null?void 0:O.customer)==null?void 0:P.gender)||"1",dateOfBirth:((M=(A=t==null?void 0:t.data)==null?void 0:A.customer)==null?void 0:M.date_of_birth)||"",prefix:((b=(U=t==null?void 0:t.data)==null?void 0:U.customer)==null?void 0:b.prefix)||"",suffix:((N=(R=t==null?void 0:t.data)==null?void 0:R.customer)==null?void 0:N.suffix)||"",createdAt:((n=($=t==null?void 0:t.data)==null?void 0:$.customer)==null?void 0:n.created_at)||"",...m};return V(a,(D=(l=(y=(G=(v=L)==null?void 0:v.getConfig())==null?void 0:G.models)==null?void 0:y.CustomerDataModelShort)==null?void 0:l.transformer)==null?void 0:D.call(l,t.data))},W=`
4
4
  query GET_CUSTOMER {
5
5
  customer {
6
6
  ...BASIC_CUSTOMER_INFO_FRAGMENT
@@ -9,12 +9,18 @@ import{l as n,f as C,h as o,a as h,m as x}from"./removeCustomerAddress.js";impor
9
9
  code
10
10
  value
11
11
  }
12
+ ... on AttributeSelectedOptions {
13
+ code
14
+ selected_options {
15
+ value
16
+ }
17
+ }
12
18
  code
13
19
  }
14
20
  }
15
21
  }
16
- ${F}
17
- `,X=async()=>await C(k,{method:"GET",cache:"no-cache"}).then(t=>{var m;return(m=t.errors)!=null&&m.length?o(t.errors):L(t)}).catch(h),H=`
22
+ ${B}
23
+ `,Z=async()=>await e(W,{method:"GET",cache:"no-cache"}).then(t=>{var m;return(m=t.errors)!=null&&m.length?C(t.errors):H(t)}).catch(_),q=`
18
24
  mutation CHANGE_CUSTOMER_PASSWORD(
19
25
  $currentPassword: String!
20
26
  $newPassword: String!
@@ -26,7 +32,7 @@ import{l as n,f as C,h as o,a as h,m as x}from"./removeCustomerAddress.js";impor
26
32
  email
27
33
  }
28
34
  }
29
- `,Y=async({currentPassword:t,newPassword:m})=>await C(H,{method:"POST",variables:{currentPassword:t,newPassword:m}}).then(a=>{var r,u,i;return(r=a.errors)!=null&&r.length?o(a.errors):((i=(u=a==null?void 0:a.data)==null?void 0:u.changeCustomerPassword)==null?void 0:i.email)||""}).catch(h),W=`
35
+ `,s=async({currentPassword:t,newPassword:m})=>await e(q,{method:"POST",variables:{currentPassword:t,newPassword:m}}).then(a=>{var r,i,u;return(r=a.errors)!=null&&r.length?C(a.errors):((u=(i=a==null?void 0:a.data)==null?void 0:i.changeCustomerPassword)==null?void 0:u.email)||""}).catch(_),K=`
30
36
  mutation UPDATE_CUSTOMER_EMAIL($email: String!, $password: String!) {
31
37
  updateCustomerEmail(email: $email, password: $password) {
32
38
  customer {
@@ -34,7 +40,7 @@ import{l as n,f as C,h as o,a as h,m as x}from"./removeCustomerAddress.js";impor
34
40
  }
35
41
  }
36
42
  }
37
- `,Z=async({email:t,password:m})=>await C(W,{method:"POST",variables:{email:t,password:m}}).then(a=>{var r,u,i,d;return(r=a.errors)!=null&&r.length?o(a.errors):((d=(i=(u=a==null?void 0:a.data)==null?void 0:u.updateCustomerEmail)==null?void 0:i.customer)==null?void 0:d.email)||""}).catch(h),q=`
43
+ `,p=async({email:t,password:m})=>await e(K,{method:"POST",variables:{email:t,password:m}}).then(a=>{var r,i,u,d;return(r=a.errors)!=null&&r.length?C(a.errors):((d=(u=(i=a==null?void 0:a.data)==null?void 0:i.updateCustomerEmail)==null?void 0:u.customer)==null?void 0:d.email)||""}).catch(_),Q=`
38
44
  mutation UPDATE_CUSTOMER_V2($input: CustomerUpdateInput!) {
39
45
  updateCustomerV2(input: $input) {
40
46
  customer {
@@ -42,5 +48,5 @@ import{l as n,f as C,h as o,a as h,m as x}from"./removeCustomerAddress.js";impor
42
48
  }
43
49
  }
44
50
  }
45
- `,s=async t=>await C(q,{method:"POST",variables:{input:x(t,"snakeCase",{firstName:"firstname",lastName:"lastname",middleName:"middlename",dob:"date_of_birth",custom_attributesV2:"custom_attributes"})}}).then(m=>{var a,r,u,i;return(a=m.errors)!=null&&a.length?o(m.errors):((i=(u=(r=m==null?void 0:m.data)==null?void 0:r.updateCustomerV2)==null?void 0:u.customer)==null?void 0:i.email)||""}).catch(h);export{Z as a,s as b,X as g,Y as u};
51
+ `,tt=async t=>await e(Q,{method:"POST",variables:{input:k(t,"snakeCase",{firstName:"firstname",lastName:"lastname",middleName:"middlename",dob:"date_of_birth",custom_attributesV2:"custom_attributes"})}}).then(m=>{var a,r,i,u;return(a=m.errors)!=null&&a.length?C(m.errors):((u=(i=(r=m==null?void 0:m.data)==null?void 0:r.updateCustomerV2)==null?void 0:i.customer)==null?void 0:u.email)||""}).catch(_);export{p as a,tt as b,Z as g,s as u};
46
52
  //# sourceMappingURL=updateCustomer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateCustomer.js","sources":["/@dropins/storefront-account/src/data/transforms/transform-customer.ts","/@dropins/storefront-account/src/api/getCustomer/graphql/getCustomer.graphql.ts","/@dropins/storefront-account/src/api/getCustomer/getCustomer.ts","/@dropins/storefront-account/src/api/updateCustomerPassword/graphql/updateCustomerPassword.graphql.ts","/@dropins/storefront-account/src/api/updateCustomerPassword/updateCustomerPassword.ts","/@dropins/storefront-account/src/api/updateCustomerEmail/graphql/updateCustomerEmail.graphql.ts","/@dropins/storefront-account/src/api/updateCustomerEmail/updateCustomerEmail.ts","/@dropins/storefront-account/src/api/updateCustomer/graphql/updateCustomer.graphql.ts","/@dropins/storefront-account/src/api/updateCustomer/updateCustomer.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 { getCustomerShortResponse } from '@/account/types';\nimport { CustomerDataModelShort } from '../models/customer';\nimport { convertToCamelCase } from '@/account/lib/convertCase';\nimport { config } from '@/account/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\n\nexport const transformCustomer = (\n response: getCustomerShortResponse\n): CustomerDataModelShort => {\n const attributeList = response?.data?.customer?.custom_attributes\n ?.filter((el) => el)\n .reduce(\n (\n accumulator: Record<string, string | number | boolean>,\n currentValue\n ) => {\n accumulator[convertToCamelCase(currentValue.code as string)] =\n currentValue.value ?? '';\n return accumulator;\n },\n {} as Record<string, string | number | boolean>\n );\n\n const model = {\n email: response?.data?.customer?.email || '',\n firstName: response?.data?.customer?.firstname || '',\n lastName: response?.data?.customer?.lastname || '',\n middleName: response?.data?.customer?.middlename || '',\n gender: response?.data?.customer?.gender || '1',\n dateOfBirth: response?.data?.customer?.date_of_birth || '',\n prefix: response?.data?.customer?.prefix || '',\n suffix: response?.data?.customer?.suffix || '',\n createdAt: response?.data?.customer?.created_at || '',\n ...attributeList,\n };\n\n return merge(\n model, // default transformer\n config\n ?.getConfig()\n ?.models?.CustomerDataModelShort?.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 { BASIC_CUSTOMER_INFO_FRAGMENT } from '@/account/api/graphql/CustomerFragment.graphql';\n\nexport const GET_CUSTOMER = /* GraphQL */ `\n query GET_CUSTOMER {\n customer {\n ...BASIC_CUSTOMER_INFO_FRAGMENT\n custom_attributes {\n ... on AttributeValue {\n code\n value\n }\n code\n }\n }\n }\n ${BASIC_CUSTOMER_INFO_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 { handleNetworkError } from '@/account/lib/network-error';\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { GET_CUSTOMER } from './graphql/getCustomer.graphql';\nimport { transformCustomer } from '@/account/data/transforms';\nimport { CustomerDataModelShort } from '@/account/data/models/customer';\nimport { getCustomerShortResponse } from '@/account/types';\n\nexport const getCustomer = async (): Promise<CustomerDataModelShort> => {\n return await fetchGraphQl(GET_CUSTOMER, {\n method: 'GET',\n cache: 'no-cache',\n })\n .then((response: getCustomerShortResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformCustomer(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 CHANGE_CUSTOMER_PASSWORD = /* GraphQL */ `\n mutation CHANGE_CUSTOMER_PASSWORD(\n $currentPassword: String!\n $newPassword: String!\n ) {\n changeCustomerPassword(\n currentPassword: $currentPassword\n newPassword: $newPassword\n ) {\n email\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 { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport {\n ChangeCustomerPasswordProps,\n ChangeCustomerPasswordResponse,\n} from '@/account/types';\nimport { CHANGE_CUSTOMER_PASSWORD } from './graphql/updateCustomerPassword.graphql';\n\nexport const updateCustomerPassword = async ({\n currentPassword,\n newPassword,\n}: ChangeCustomerPasswordProps): Promise<string> => {\n return await fetchGraphQl(CHANGE_CUSTOMER_PASSWORD, {\n method: 'POST',\n variables: { currentPassword, newPassword },\n })\n .then((response: ChangeCustomerPasswordResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response?.data?.changeCustomerPassword?.email || '';\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_EMAIL = /* GraphQL */ `\n mutation UPDATE_CUSTOMER_EMAIL($email: String!, $password: String!) {\n updateCustomerEmail(email: $email, password: $password) {\n customer {\n email\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 '../fetch-graphql';\nimport { UPDATE_CUSTOMER_EMAIL } from './graphql/updateCustomerEmail.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\n\nexport const updateCustomerEmail = async ({\n email,\n password,\n}: {\n email: string;\n password: string;\n}): Promise<string> => {\n return await fetchGraphQl(UPDATE_CUSTOMER_EMAIL, {\n method: 'POST',\n variables: { email, password },\n })\n .then((response) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response?.data?.updateCustomerEmail?.customer?.email || '';\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_V2 = /* GraphQL */ `\n mutation UPDATE_CUSTOMER_V2($input: CustomerUpdateInput!) {\n updateCustomerV2(input: $input) {\n customer {\n email\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 '../fetch-graphql';\nimport { UPDATE_CUSTOMER_V2 } from './graphql/updateCustomer.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { convertKeysCase } from '@/account/lib/convertCase';\n\nexport const updateCustomer = async (\n form: Record<string, string>\n): Promise<string> => {\n return await fetchGraphQl(UPDATE_CUSTOMER_V2, {\n method: 'POST',\n variables: {\n input: convertKeysCase(form, 'snakeCase', {\n firstName: 'firstname',\n lastName: 'lastname',\n middleName: 'middlename',\n dob: 'date_of_birth',\n custom_attributesV2: 'custom_attributes',\n }),\n },\n })\n .then((response) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response?.data?.updateCustomerV2?.customer?.email || '';\n })\n .catch(handleNetworkError);\n};\n"],"names":["transformCustomer","response","attributeList","_c","_b","_a","el","accumulator","currentValue","convertToCamelCase","model","_e","_d","_g","_f","_i","_h","_k","_j","_m","_l","_o","_n","_q","_p","_s","_r","_u","_t","merge","_z","_y","_x","_w","_v","config","GET_CUSTOMER","BASIC_CUSTOMER_INFO_FRAGMENT","getCustomer","fetchGraphQl","handleFetchError","handleNetworkError","CHANGE_CUSTOMER_PASSWORD","updateCustomerPassword","currentPassword","newPassword","UPDATE_CUSTOMER_EMAIL","updateCustomerEmail","email","password","UPDATE_CUSTOMER_V2","updateCustomer","form","convertKeysCase"],"mappings":"gQAuBO,MAAMA,EACXC,GAC2B,yDAC3B,MAAMC,GAAgBC,GAAAC,GAAAC,EAAAJ,GAAA,YAAAA,EAAU,OAAV,YAAAI,EAAgB,WAAhB,YAAAD,EAA0B,oBAA1B,YAAAD,EAClB,OAAQG,GAAOA,GAChB,OACC,CACEC,EACAC,KAEAD,EAAYE,EAAmBD,EAAa,IAAc,CAAC,EACzDA,EAAa,OAAS,GACjBD,GAET,CAAA,GAGEG,EAAQ,CACZ,QAAOC,GAAAC,EAAAX,GAAA,YAAAA,EAAU,OAAV,YAAAW,EAAgB,WAAhB,YAAAD,EAA0B,QAAS,GAC1C,YAAWE,GAAAC,EAAAb,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BACL,oBAAqB,mBAAA,CACtB,CAAA,CACH,CACD,EACE,KAAMnD,GAAa,aAClB,OAAII,EAAAJ,EAAS,SAAT,MAAAI,EAAiB,OAAemC,EAAiBvC,EAAS,MAAM,IAE7DW,GAAAT,GAAAC,EAAAH,GAAA,YAAAA,EAAU,OAAV,YAAAG,EAAgB,mBAAhB,YAAAD,EAAkC,WAAlC,YAAAS,EAA4C,QAAS,EAC9D,CAAC,EACA,MAAM6B,CAAkB"}
1
+ {"version":3,"file":"updateCustomer.js","sources":["/@dropins/storefront-account/src/data/transforms/transform-customer.ts","/@dropins/storefront-account/src/api/getCustomer/graphql/getCustomer.graphql.ts","/@dropins/storefront-account/src/api/getCustomer/getCustomer.ts","/@dropins/storefront-account/src/api/updateCustomerPassword/graphql/updateCustomerPassword.graphql.ts","/@dropins/storefront-account/src/api/updateCustomerPassword/updateCustomerPassword.ts","/@dropins/storefront-account/src/api/updateCustomerEmail/graphql/updateCustomerEmail.graphql.ts","/@dropins/storefront-account/src/api/updateCustomerEmail/updateCustomerEmail.ts","/@dropins/storefront-account/src/api/updateCustomer/graphql/updateCustomer.graphql.ts","/@dropins/storefront-account/src/api/updateCustomer/updateCustomer.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 { getCustomerShortResponse } from '@/account/types';\nimport { CustomerDataModelShort } from '../models/customer';\nimport { convertToCamelCase } from '@/account/lib/convertCase';\nimport { config } from '@/account/api';\nimport { merge } from '@adobe-commerce/elsie/lib';\n\nexport const transformCustomer = (\n response: getCustomerShortResponse\n): CustomerDataModelShort => {\n const attributeList = response?.data?.customer?.custom_attributes\n ?.filter((el) => el)\n .reduce(\n (\n accumulator: Record<string, string | number | boolean>,\n currentValue\n ) => {\n const key = convertToCamelCase(currentValue.code as string);\n\n if (currentValue.selected_options?.length) {\n // Select/dropdown attribute — grab the first selected option's value\n accumulator[key] = currentValue.selected_options[0].value ?? '';\n } else {\n // Regular attribute\n accumulator[key] = currentValue.value ?? '';\n }\n\n return accumulator;\n },\n {} as Record<string, string | number | boolean>\n );\n\n const model = {\n email: response?.data?.customer?.email || '',\n firstName: response?.data?.customer?.firstname || '',\n lastName: response?.data?.customer?.lastname || '',\n middleName: response?.data?.customer?.middlename || '',\n gender: response?.data?.customer?.gender || '1',\n dateOfBirth: response?.data?.customer?.date_of_birth || '',\n prefix: response?.data?.customer?.prefix || '',\n suffix: response?.data?.customer?.suffix || '',\n createdAt: response?.data?.customer?.created_at || '',\n ...attributeList,\n };\n\n return merge(\n model, // default transformer\n config\n ?.getConfig()\n ?.models?.CustomerDataModelShort?.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 { BASIC_CUSTOMER_INFO_FRAGMENT } from '@/account/api/graphql/CustomerFragment.graphql';\n\nexport const GET_CUSTOMER = /* GraphQL */ `\n query GET_CUSTOMER {\n customer {\n ...BASIC_CUSTOMER_INFO_FRAGMENT\n custom_attributes {\n ... on AttributeValue {\n code\n value\n }\n ... on AttributeSelectedOptions {\n code\n selected_options {\n value\n }\n }\n code\n }\n }\n }\n ${BASIC_CUSTOMER_INFO_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 { handleNetworkError } from '@/account/lib/network-error';\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { GET_CUSTOMER } from './graphql/getCustomer.graphql';\nimport { transformCustomer } from '@/account/data/transforms';\nimport { CustomerDataModelShort } from '@/account/data/models/customer';\nimport { getCustomerShortResponse } from '@/account/types';\n\nexport const getCustomer = async (): Promise<CustomerDataModelShort> => {\n return await fetchGraphQl(GET_CUSTOMER, {\n method: 'GET',\n cache: 'no-cache',\n })\n .then((response: getCustomerShortResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformCustomer(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 CHANGE_CUSTOMER_PASSWORD = /* GraphQL */ `\n mutation CHANGE_CUSTOMER_PASSWORD(\n $currentPassword: String!\n $newPassword: String!\n ) {\n changeCustomerPassword(\n currentPassword: $currentPassword\n newPassword: $newPassword\n ) {\n email\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 { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport {\n ChangeCustomerPasswordProps,\n ChangeCustomerPasswordResponse,\n} from '@/account/types';\nimport { CHANGE_CUSTOMER_PASSWORD } from './graphql/updateCustomerPassword.graphql';\n\nexport const updateCustomerPassword = async ({\n currentPassword,\n newPassword,\n}: ChangeCustomerPasswordProps): Promise<string> => {\n return await fetchGraphQl(CHANGE_CUSTOMER_PASSWORD, {\n method: 'POST',\n variables: { currentPassword, newPassword },\n })\n .then((response: ChangeCustomerPasswordResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response?.data?.changeCustomerPassword?.email || '';\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_EMAIL = /* GraphQL */ `\n mutation UPDATE_CUSTOMER_EMAIL($email: String!, $password: String!) {\n updateCustomerEmail(email: $email, password: $password) {\n customer {\n email\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 '../fetch-graphql';\nimport { UPDATE_CUSTOMER_EMAIL } from './graphql/updateCustomerEmail.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\n\nexport const updateCustomerEmail = async ({\n email,\n password,\n}: {\n email: string;\n password: string;\n}): Promise<string> => {\n return await fetchGraphQl(UPDATE_CUSTOMER_EMAIL, {\n method: 'POST',\n variables: { email, password },\n })\n .then((response) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response?.data?.updateCustomerEmail?.customer?.email || '';\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_V2 = /* GraphQL */ `\n mutation UPDATE_CUSTOMER_V2($input: CustomerUpdateInput!) {\n updateCustomerV2(input: $input) {\n customer {\n email\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 '../fetch-graphql';\nimport { UPDATE_CUSTOMER_V2 } from './graphql/updateCustomer.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { convertKeysCase } from '@/account/lib/convertCase';\n\nexport const updateCustomer = async (\n form: Record<string, string>\n): Promise<string> => {\n return await fetchGraphQl(UPDATE_CUSTOMER_V2, {\n method: 'POST',\n variables: {\n input: convertKeysCase(form, 'snakeCase', {\n firstName: 'firstname',\n lastName: 'lastname',\n middleName: 'middlename',\n dob: 'date_of_birth',\n custom_attributesV2: 'custom_attributes',\n }),\n },\n })\n .then((response) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response?.data?.updateCustomerV2?.customer?.email || '';\n })\n .catch(handleNetworkError);\n};\n"],"names":["transformCustomer","response","attributeList","_c","_b","_a","el","accumulator","currentValue","key","convertToCamelCase","model","_e","_d","_g","_f","_i","_h","_k","_j","_m","_l","_o","_n","_q","_p","_s","_r","_u","_t","merge","_z","_y","_x","_w","_v","config","GET_CUSTOMER","BASIC_CUSTOMER_INFO_FRAGMENT","getCustomer","fetchGraphQl","handleFetchError","handleNetworkError","CHANGE_CUSTOMER_PASSWORD","updateCustomerPassword","currentPassword","newPassword","UPDATE_CUSTOMER_EMAIL","updateCustomerEmail","email","password","UPDATE_CUSTOMER_V2","updateCustomer","form","convertKeysCase"],"mappings":"gQAuBO,MAAMA,EACXC,GAC2B,yDAC3B,MAAMC,GAAgBC,GAAAC,GAAAC,EAAAJ,GAAA,YAAAA,EAAU,OAAV,YAAAI,EAAgB,WAAhB,YAAAD,EAA0B,oBAA1B,YAAAD,EAClB,OAAQG,GAAOA,GAChB,OACC,CACEC,EACAC,IACG,OACH,MAAMC,EAAMC,EAAmBF,EAAa,IAAc,EAE1D,OAAIH,EAAAG,EAAa,mBAAb,MAAAH,EAA+B,OAEjCE,EAAYE,CAAG,EAAID,EAAa,iBAA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