@dropins/storefront-account 1.2.0 → 3.0.0-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.js.map +1 -1
- package/chunks/AddressValidation.js +1 -1
- package/chunks/AddressValidation.js.map +1 -1
- package/chunks/getOrderHistoryList.js.map +1 -1
- package/chunks/getStoreConfig.js.map +1 -1
- package/chunks/removeCustomerAddress.js.map +1 -1
- package/chunks/updateCustomer.js.map +1 -1
- package/containers/AddressValidation.js.map +1 -1
- package/containers/Addresses.js.map +1 -1
- package/containers/CustomerInformation.js +1 -1
- package/containers/CustomerInformation.js.map +1 -1
- package/containers/OrdersList.js.map +1 -1
- package/fragments.js.map +1 -1
- package/package.json +1 -1
- package/render.js.map +1 -1
|
@@ -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,KAAM,SACR,EAGE,GAAGD,CACL,EAEME,EAAU,IAAI,KAAKJ,CAAI,EAE7B,OAAI,MAAMI,EAAQ,QAAQ,CAAC,EAClB,eAGS,IAAI,KAAK,eAAeH,EAAQE,CAAa,EAC9C,OAAOC,CAAO,CACjC,ECzCMC,EAAoB,CACxB,MAAO,EACP,SAAU,KACZ,EAEMC,EAA8BC,GAAc,yBACzC,MAAA,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,CAAC,EAC9B,WAAUC,EAAAR,GAAA,YAAAA,EAAM,QAAN,YAAAQ,EAAa,YAAaV,EACpC,gBAAeW,EAAAT,GAAA,YAAAA,EAAM,QAAN,YAAAS,EAAa,iBAAkBX,EAC9C,YAAWY,EAAAV,GAAA,YAAAA,EAAM,QAAN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S,KACzE,CACF,ECrFa4B,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;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,EAE7DC,GAAsB,MACjCC,EACAC,EACAC,IACsC,CACtC,MAAMC,EAAmBF,EAAiB,SAAS,SAAS,EAIxD,CAAC,EAHD,CACE,WAAY,KAAK,MAAMA,CAAgB,CAAA,EAItC,OAAA,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":"sQA8CO,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,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,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStoreConfig.js","sources":["/@dropins/storefront-account/src/api/initialize/initialize.ts","/@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 { 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","/********************************************************************\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":["initialize","Initializer","config","defaultConfig","transformStoreConfig","response","_b","_a","_d","_c","_f","_e","_h","_g","GET_STORE_CONFIG","getStoreConfig","fetchGraphQl","handleFetchError","handleNetworkError"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getStoreConfig.js","sources":["/@dropins/storefront-account/src/api/initialize/initialize.ts","/@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 { 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","/********************************************************************\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":["initialize","Initializer","config","defaultConfig","transformStoreConfig","response","_b","_a","_d","_c","_f","_e","_h","_g","GET_STORE_CONFIG","getStoreConfig","fetchGraphQl","handleFetchError","handleNetworkError"],"mappings":"iHAkCO,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,OC7BpBI,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"}
|
|
@@ -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":"oHAiBa,M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AgBmD,EAAS,YAAa,CAC3C,oBAAqB,sBACrB,UAAW,YACX,SAAU,WACV,WAAY,YACb,CAAA,CAAA,CACH,CACD,EACE,KAAMb,GAA4C,WACjD,OAAIH,EAAAG,EAAS,SAAT,MAAAH,EAAiB,OAAeb,EAAiBgB,EAAS,MAAM,IAE7DG,GAAAD,EAAAF,GAAA,YAAAA,EAAU,OAAV,YAAAE,EAAgB,wBAAhB,YAAAC,EAAuC,YAAa,EAAA,CAC5D,EACA,MAAMtB,CAAkB,EAnBJ,EAoBzB,ECrCagE,EAAwC;AAAA;AAAA;AAAA;AAAA,ECMxCC,EAAwB,MACnCF,GAEO,MAAMpE,EAAaqE,EAAyB,CACjD,OAAQ,OACR,UAAW,CAAE,GAAID,CAAU,CAAA,CAC5B,EACE,KAAM5C,GAA4C,OACjD,OAAIH,EAAAG,EAAS,SAAT,MAAAH,EAAiB,OAAeb,EAAiBgB,EAAS,MAAM,EAE7DA,EAAS,KAAK,qBAAA,CACtB,EACA,MAAMnB,CAAkB"}
|
|
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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AAgBmD,EAAS,YAAa,CAC3C,oBAAqB,sBACrB,UAAW,YACX,SAAU,WACV,WAAY,YAAA,CACb,CAAA,CACH,CACD,EACE,KAAMb,GAA4C,WACjD,OAAIH,EAAAG,EAAS,SAAT,MAAAH,EAAiB,OAAeb,EAAiBgB,EAAS,MAAM,IAE7DG,GAAAD,EAAAF,GAAA,YAAAA,EAAU,OAAV,YAAAE,EAAgB,wBAAhB,YAAAC,EAAuC,YAAa,EAC7D,CAAC,EACA,MAAMtB,CAAkB,EAnBJ,EAoBzB,ECrCagE,EAAwC;AAAA;AAAA;AAAA;AAAA,ECMxCC,EAAwB,MACnCF,GAEO,MAAMpE,EAAaqE,EAAyB,CACjD,OAAQ,OACR,UAAW,CAAE,GAAID,CAAA,CAAU,CAC5B,EACE,KAAM5C,GAA4C,OACjD,OAAIH,EAAAG,EAAS,SAAT,MAAAH,EAAiB,OAAeb,EAAiBgB,EAAS,MAAM,EAE7DA,EAAS,KAAK,qBACvB,CAAC,EACA,MAAMnB,CAAkB"}
|
|
@@ -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":"oQAuBa,MAAAA,EACXC,GAC2B,yDACrB,MAAAC,GAAgBC,GAAAC,GAAAC,EAAAJ,GAAA,YAAAA,EAAU,OAAV,YAAAI,EAAgB,WA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AD,EAAqC,WAArC,YAAAS,EAA+C,QAAS,EAAA,CAChE,EACA,MAAM6B,CAAkB,ECrBhBS,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMnCC,EAAiB,MAC5BC,GAEO,MAAMb,EAAaW,EAAoB,CAC5C,OAAQ,OACR,UAAW,CACT,MAAOG,EAAgBD,EAAM,YAAa,CACxC,UAAW,YACX,SAAU,WACV,WAAY,aACZ,IAAK,gBACL,oBAAqB,mBACtB,CAAA,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,EAAA,CAC7D,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 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":"oQAuBO,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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B,ECrBhBS,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMnCC,EAAiB,MAC5BC,GAEO,MAAMb,EAAaW,EAAoB,CAC5C,OAAQ,OACR,UAAW,CACT,MAAOG,EAAgBD,EAAM,YAAa,CACxC,UAAW,YACX,SAAU,WACV,WAAY,aACZ,IAAK,gBACL,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressValidation.js","sources":["/@dropins/storefront-account/src/components/AddressValidation/AddressValidation.tsx","/@dropins/storefront-account/src/containers/AddressValidation/AddressValidation.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 '@/account/components/AddressValidation/AddressValidation.css';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { Header, ToggleButton } from '@adobe-commerce/elsie/components';\nimport { CustomerAddressesModel } from '@/account/data/models';\n\nexport interface AddressValidationProps extends HTMLAttributes<HTMLDivElement> {\n busy?: boolean;\n originalAddress: CustomerAddressesModel | null;\n selection: 'suggested' | 'original' | null;\n suggestedAddress: CustomerAddressesModel | null;\n onSelectionChange: (selection: 'suggested' | 'original') => void;\n}\n\nexport function formatAddressLine(\n address: CustomerAddressesModel | null | undefined\n): string[] {\n if (!address) return [];\n const name = `${address.firstName} ${address.lastName}`.trim();\n const street = address.street ?? '';\n const city = address.city ?? '';\n const region = address.region || undefined;\n const post = address.postcode ?? '';\n const country = address.countryCode ?? '';\n\n let cityRegion = '';\n if (city && region) {\n cityRegion = `${city}, ${region?.regionCode ?? ''}`.trim();\n } else if (city) {\n cityRegion = city;\n } else if (region) {\n cityRegion = region?.regionCode ?? '';\n }\n\n let cityRegionPost = cityRegion;\n if (post) {\n cityRegionPost = cityRegion ? `${cityRegion} ${post}` : post;\n }\n\n let line3 = cityRegionPost;\n if (country) {\n line3 = cityRegionPost ? `${cityRegionPost}, ${country}` : country;\n }\n\n return [name, street, line3];\n}\n\nconst AddressBlock: FunctionComponent<{\n title: string;\n address: CustomerAddressesModel | null | undefined;\n selected: boolean;\n busy?: boolean;\n onChange: () => void;\n}> = ({ title, address, selected, busy, onChange }) => {\n const [line1, line2, line3] = formatAddressLine(address);\n const label = (\n <div>\n <div className=\"account-address-validation__option-title\">\n <strong>{title}</strong>\n </div>\n {line1 && <div>{line1}</div>}\n {line2 && <div>{line2}</div>}\n {line3 && <div>{line3}</div>}\n </div>\n );\n return (\n <div className=\"account-address-validation__option\">\n <ToggleButton\n busy={busy}\n className=\"account-address-validation__radio\"\n label={label}\n name=\"address-validation-choice\"\n selected={selected}\n value={title}\n onChange={onChange}\n />\n </div>\n );\n};\n\nexport const AddressValidation: FunctionComponent<AddressValidationProps> = ({\n busy = false,\n className,\n originalAddress,\n onSelectionChange,\n selection,\n suggestedAddress,\n}) => {\n const hasSuggestion = !!suggestedAddress;\n const translations = useText({\n title: 'Account.AddressValidation.title',\n subtitle: 'Account.AddressValidation.subtitle',\n suggestedAddress: 'Account.AddressValidation.suggestedAddress',\n originalAddress: 'Account.AddressValidation.originalAddress',\n });\n\n return (\n <div className={classes(['account-address-validation', className])}>\n <Header\n className=\"account-address-validation__title\"\n divider={false}\n title={translations.title}\n />\n <div className=\"account-address-validation__subtitle\">\n {translations.subtitle}\n </div>\n\n <div\n className={classes([\n 'account-address-validation__options',\n busy && 'account-address-validation__options--busy',\n ])}\n >\n {hasSuggestion && (\n <AddressBlock\n address={suggestedAddress}\n busy={busy}\n selected={selection === 'suggested'}\n title={translations.suggestedAddress}\n onChange={() => onSelectionChange('suggested')}\n />\n )}\n\n <AddressBlock\n address={originalAddress}\n busy={busy}\n selected={selection === 'original'}\n title={translations.originalAddress}\n onChange={() => onSelectionChange('original')}\n />\n </div>\n </div>\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 { Container } from '@adobe-commerce/elsie/lib';\nimport { useCallback, useEffect, useMemo, useState } from 'preact/hooks';\nimport { AddressValidation as AddressValidationComponent } from '@/account/components';\nimport { CustomerAddressesModel } from '@/account/data/models';\n\nexport interface AddressValidationProps {\n selectedAddress?: 'suggested' | 'original' | null;\n suggestedAddress: Partial<CustomerAddressesModel> | null;\n originalAddress: CustomerAddressesModel | null;\n handleSelectedAddress?: (payload: {\n selection: 'suggested' | 'original';\n address: CustomerAddressesModel | null | undefined;\n }) => void;\n}\n\nexport const AddressValidation: Container<AddressValidationProps> = ({\n selectedAddress = null,\n suggestedAddress,\n originalAddress,\n handleSelectedAddress,\n}) => {\n const [selection, setSelection] = useState<'suggested' | 'original' | null>(\n selectedAddress\n );\n const [busy, setBusy] = useState(false);\n\n const mergedSuggestedAddress = useMemo<CustomerAddressesModel | null>(() => {\n if (!suggestedAddress || !originalAddress) return null;\n return { ...originalAddress, ...suggestedAddress };\n }, [originalAddress, suggestedAddress]);\n\n const onSelectionChange = useCallback(\n async (sel: 'suggested' | 'original') => {\n setSelection(sel);\n const chosen =\n sel === 'suggested' ? mergedSuggestedAddress : originalAddress;\n setBusy(true);\n try {\n await handleSelectedAddress?.({ selection: sel, address: chosen });\n } finally {\n setBusy(false);\n }\n },\n [mergedSuggestedAddress, originalAddress, handleSelectedAddress]\n );\n\n useEffect(() => {\n if (!selection) return;\n onSelectionChange(selection);\n }, [selection, onSelectionChange]);\n\n return (\n <AddressValidationComponent\n busy={busy}\n originalAddress={originalAddress}\n selection={selection}\n suggestedAddress={mergedSuggestedAddress}\n onSelectionChange={onSelectionChange}\n />\n );\n};\n"],"names":["formatAddressLine","address","name","street","city","region","post","country","cityRegion","cityRegionPost","line3","AddressBlock","title","selected","busy","onChange","line1","line2","jsx","ToggleButton","AddressValidation","className","originalAddress","onSelectionChange","selection","suggestedAddress","hasSuggestion","translations","useText","jsxs","classes","Header","selectedAddress","handleSelectedAddress","setSelection","useState","setBusy","mergedSuggestedAddress","useMemo","useCallback","sel","chosen","useEffect","AddressValidationComponent"],"mappings":"4jBAiCO,SAASA,EACdC,EACU,CACN,GAAA,CAACA,EAAS,MAAO,CAAC,EAChB,MAAAC,EAAO,GAAGD,EAAQ,SAAS,IAAIA,EAAQ,QAAQ,GAAG,KAAK,EACvDE,EAASF,EAAQ,QAAU,GAC3BG,EAAOH,EAAQ,MAAQ,GACvBI,EAASJ,EAAQ,QAAU,OAC3BK,EAAOL,EAAQ,UAAY,GAC3BM,EAAUN,EAAQ,aAAe,GAEvC,IAAIO,EAAa,GACbJ,GAAQC,EACVG,EAAa,GAAGJ,CAAI,MAAKC,GAAA,YAAAA,EAAQ,aAAc,EAAE,GAAG,KAAK,EAChDD,EACII,EAAAJ,EACJC,IACTG,GAAaH,GAAA,YAAAA,E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Validation.js","sources":["/@dropins/storefront-account/src/components/AddressValidation/AddressValidation.tsx","/@dropins/storefront-account/src/containers/AddressValidation/AddressValidation.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 '@/account/components/AddressValidation/AddressValidation.css';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { Header, ToggleButton } from '@adobe-commerce/elsie/components';\nimport { CustomerAddressesModel } from '@/account/data/models';\n\nexport interface AddressValidationProps extends HTMLAttributes<HTMLDivElement> {\n busy?: boolean;\n originalAddress: CustomerAddressesModel | null;\n selection: 'suggested' | 'original' | null;\n suggestedAddress: CustomerAddressesModel | null;\n onSelectionChange: (selection: 'suggested' | 'original') => void;\n}\n\nexport function formatAddressLine(\n address: CustomerAddressesModel | null | undefined\n): string[] {\n if (!address) return [];\n const name = `${address.firstName} ${address.lastName}`.trim();\n const street = address.street ?? '';\n const city = address.city ?? '';\n const region = address.region || undefined;\n const post = address.postcode ?? '';\n const country = address.countryCode ?? '';\n\n let cityRegion = '';\n if (city && region) {\n cityRegion = `${city}, ${region?.regionCode ?? ''}`.trim();\n } else if (city) {\n cityRegion = city;\n } else if (region) {\n cityRegion = region?.regionCode ?? '';\n }\n\n let cityRegionPost = cityRegion;\n if (post) {\n cityRegionPost = cityRegion ? `${cityRegion} ${post}` : post;\n }\n\n let line3 = cityRegionPost;\n if (country) {\n line3 = cityRegionPost ? `${cityRegionPost}, ${country}` : country;\n }\n\n return [name, street, line3];\n}\n\nconst AddressBlock: FunctionComponent<{\n title: string;\n address: CustomerAddressesModel | null | undefined;\n selected: boolean;\n busy?: boolean;\n onChange: () => void;\n}> = ({ title, address, selected, busy, onChange }) => {\n const [line1, line2, line3] = formatAddressLine(address);\n const label = (\n <div>\n <div className=\"account-address-validation__option-title\">\n <strong>{title}</strong>\n </div>\n {line1 && <div>{line1}</div>}\n {line2 && <div>{line2}</div>}\n {line3 && <div>{line3}</div>}\n </div>\n );\n return (\n <div className=\"account-address-validation__option\">\n <ToggleButton\n busy={busy}\n className=\"account-address-validation__radio\"\n label={label}\n name=\"address-validation-choice\"\n selected={selected}\n value={title}\n onChange={onChange}\n />\n </div>\n );\n};\n\nexport const AddressValidation: FunctionComponent<AddressValidationProps> = ({\n busy = false,\n className,\n originalAddress,\n onSelectionChange,\n selection,\n suggestedAddress,\n}) => {\n const hasSuggestion = !!suggestedAddress;\n const translations = useText({\n title: 'Account.AddressValidation.title',\n subtitle: 'Account.AddressValidation.subtitle',\n suggestedAddress: 'Account.AddressValidation.suggestedAddress',\n originalAddress: 'Account.AddressValidation.originalAddress',\n });\n\n return (\n <div className={classes(['account-address-validation', className])}>\n <Header\n className=\"account-address-validation__title\"\n divider={false}\n title={translations.title}\n />\n <div className=\"account-address-validation__subtitle\">\n {translations.subtitle}\n </div>\n\n <div\n className={classes([\n 'account-address-validation__options',\n busy && 'account-address-validation__options--busy',\n ])}\n >\n {hasSuggestion && (\n <AddressBlock\n address={suggestedAddress}\n busy={busy}\n selected={selection === 'suggested'}\n title={translations.suggestedAddress}\n onChange={() => onSelectionChange('suggested')}\n />\n )}\n\n <AddressBlock\n address={originalAddress}\n busy={busy}\n selected={selection === 'original'}\n title={translations.originalAddress}\n onChange={() => onSelectionChange('original')}\n />\n </div>\n </div>\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 { Container } from '@adobe-commerce/elsie/lib';\nimport { useCallback, useEffect, useMemo, useState } from 'preact/hooks';\nimport { AddressValidation as AddressValidationComponent } from '@/account/components';\nimport { CustomerAddressesModel } from '@/account/data/models';\n\nexport interface AddressValidationProps {\n selectedAddress?: 'suggested' | 'original' | null;\n suggestedAddress: Partial<CustomerAddressesModel> | null;\n originalAddress: CustomerAddressesModel | null;\n handleSelectedAddress?: (payload: {\n selection: 'suggested' | 'original';\n address: CustomerAddressesModel | null | undefined;\n }) => void;\n}\n\nexport const AddressValidation: Container<AddressValidationProps> = ({\n selectedAddress = null,\n suggestedAddress,\n originalAddress,\n handleSelectedAddress,\n}) => {\n const [selection, setSelection] = useState<'suggested' | 'original' | null>(\n selectedAddress\n );\n const [busy, setBusy] = useState(false);\n\n const mergedSuggestedAddress = useMemo<CustomerAddressesModel | null>(() => {\n if (!suggestedAddress || !originalAddress) return null;\n return { ...originalAddress, ...suggestedAddress };\n }, [originalAddress, suggestedAddress]);\n\n const onSelectionChange = useCallback(\n async (sel: 'suggested' | 'original') => {\n setSelection(sel);\n const chosen =\n sel === 'suggested' ? mergedSuggestedAddress : originalAddress;\n setBusy(true);\n try {\n await handleSelectedAddress?.({ selection: sel, address: chosen });\n } finally {\n setBusy(false);\n }\n },\n [mergedSuggestedAddress, originalAddress, handleSelectedAddress]\n );\n\n useEffect(() => {\n if (!selection) return;\n onSelectionChange(selection);\n }, [selection, onSelectionChange]);\n\n return (\n <AddressValidationComponent\n busy={busy}\n originalAddress={originalAddress}\n selection={selection}\n suggestedAddress={mergedSuggestedAddress}\n onSelectionChange={onSelectionChange}\n />\n );\n};\n"],"names":["formatAddressLine","address","name","street","city","region","post","country","cityRegion","cityRegionPost","line3","AddressBlock","title","selected","busy","onChange","line1","line2","jsx","ToggleButton","AddressValidation","className","originalAddress","onSelectionChange","selection","suggestedAddress","hasSuggestion","translations","useText","jsxs","classes","Header","selectedAddress","handleSelectedAddress","setSelection","useState","setBusy","mergedSuggestedAddress","useMemo","useCallback","sel","chosen","useEffect","AddressValidationComponent"],"mappings":"4jBAiCO,SAASA,EACdC,EACU,CACV,GAAI,CAACA,EAAS,MAAO,CAAA,EACrB,MAAMC,EAAO,GAAGD,EAAQ,SAAS,IAAIA,EAAQ,QAAQ,GAAG,KAAA,EAClDE,EAASF,EAAQ,QAAU,GAC3BG,EAAOH,EAAQ,MAAQ,GACvBI,EAASJ,EAAQ,QAAU,OAC3BK,EAAOL,EAAQ,UAAY,GAC3BM,EAAUN,EAAQ,aAAe,GAEvC,IAAIO,EAAa,GACbJ,GAAQC,EACVG,EAAa,GAAGJ,CAAI,MAAKC,GAAA,YAAAA,EAAQ,aAAc,EAAE,GAAG,KAAA,EAC3CD,EACTI,EAAaJ,EACJC,IACTG,GAAaH,GAAA,YAAAA,EAAQ,aAAc,IAGrC,IAAII,EAAiBD,EACjBF,IACFG,EAAiBD,EAAa,GAAGA,CAAU,IAAIF,CAAI,GAAKA,GAG1D,IAAII,EAAQD,EACZ,OAAIF,IACFG,EAAQD,EAAiB,GAAGA,CAAc,KAAKF,CAAO,GAAKA,GAGtD,CAACL,EAAMC,EAAQO,CAAK,CAC7B,CAEA,MAAMC,EAMD,CAAC,CAAE,MAAAC,EAAO,QAAAX,EAAS,SAAAY,EAAU,KAAAC,EAAM,SAAAC,KAAe,CACrD,KAAM,CAACC,EAAOC,EAAOP,CAAK,EAAIV,EAAkBC,CAAO,EAWvD,OACEiB,EAAC,MAAA,CAAI,UAAU,qCACb,SAAAA,EAACC,EAAA,CACC,KAAAL,EACA,UAAU,oCACV,QAdH,MAAA,CACC,SAAA,CAAAI,EAAC,OAAI,UAAU,2CACb,SAAAA,EAAC,SAAA,CAAQ,WAAM,CAA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AMsB,CAAO,EAAID,EAAS,EAAK,EAEhCE,EAAyBC,EAAuC,IAChE,CAACb,GAAoB,CAACH,EAAwB,KAC3C,CAAE,GAAGA,EAAiB,GAAGG,CAAA,EAC/B,CAACH,EAAiBG,CAAgB,CAAC,EAEhCF,EAAoBgB,EACxB,MAAOC,GAAkC,CACvCN,EAAaM,CAAG,EAChB,MAAMC,EACJD,IAAQ,YAAcH,EAAyBf,EACjDc,EAAQ,EAAI,EACZ,GAAI,CACF,MAAMH,GAAA,YAAAA,EAAwB,CAAE,UAAWO,EAAK,QAASC,IAC3D,QAAA,CACEL,EAAQ,EAAK,CACf,CACF,EACA,CAACC,EAAwBf,EAAiBW,CAAqB,CAAA,EAGjE,OAAAS,EAAU,IAAM,CACTlB,GACLD,EAAkBC,CAAS,CAC7B,EAAG,CAACA,EAAWD,CAAiB,CAAC,EAG/BL,EAACyB,EAAA,CACC,KAAA7B,EACA,gBAAAQ,EACA,UAAAE,EACA,iBAAkBa,EAClB,kBAAAd,CAAA,CAAA,CAGN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Addresses.js","sources":["/@dropins/storefront-account/src/containers/Addresses/Addresses.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { AddressesProps } from '@/account/types';\nimport { AddressesWrapper } from '@/account/components';\n\nconst getDefaultFormName = (\n selectShipping: boolean,\n selectBilling: boolean\n): string => {\n if (selectShipping && selectBilling) {\n return 'selectedAddress';\n } else if (selectShipping) {\n return 'selectedShippingAddress';\n } else if (selectBilling) {\n return 'selectedBillingAddress';\n }\n\n return 'default';\n};\n\nexport const Addresses: Container<AddressesProps> = ({\n hideActionFormButtons,\n formName,\n slots,\n title,\n addressFormTitle,\n defaultSelectAddressId,\n showFormLoader,\n forwardFormRef,\n showSaveCheckBox,\n saveCheckBoxValue,\n selectShipping,\n selectBilling,\n selectable,\n className,\n withHeader,\n minifiedView,\n withActionsInMinifiedView,\n withActionsInFullSizeView,\n inputsDefaultValueSet,\n showShippingCheckBox,\n showBillingCheckBox,\n shippingCheckBoxValue,\n billingCheckBoxValue,\n onAddressData,\n routeAddressesPage,\n onSubmit,\n onSuccess,\n onError,\n}) => {\n const minifiedViewKey = minifiedView ? 'minifiedView' : 'fullSizeView';\n const inputName =\n formName ?? getDefaultFormName(selectShipping!, selectBilling!);\n\n return (\n <div\n className={classes(['account-addresses', className])}\n data-testid=\"addressesid\"\n >\n <AddressesWrapper\n inputName={inputName}\n minifiedViewKey={minifiedViewKey}\n hideActionFormButtons={hideActionFormButtons}\n slots={slots}\n title={title}\n addressFormTitle={addressFormTitle}\n defaultSelectAddressId={defaultSelectAddressId}\n showFormLoader={showFormLoader}\n onAddressData={onAddressData}\n forwardFormRef={forwardFormRef}\n selectShipping={selectShipping}\n selectBilling={selectBilling}\n showSaveCheckBox={showSaveCheckBox}\n saveCheckBoxValue={saveCheckBoxValue}\n selectable={selectable}\n className={className}\n withHeader={withHeader}\n minifiedView={minifiedView}\n withActionsInMinifiedView={withActionsInMinifiedView}\n withActionsInFullSizeView={withActionsInFullSizeView}\n inputsDefaultValueSet={inputsDefaultValueSet}\n billingCheckBoxValue={billingCheckBoxValue}\n shippingCheckBoxValue={shippingCheckBoxValue}\n showBillingCheckBox={showBillingCheckBox}\n showShippingCheckBox={showShippingCheckBox}\n routeAddressesPage={routeAddressesPage}\n onSubmit={onSubmit}\n onSuccess={onSuccess}\n onError={onError}\n />\n </div>\n );\n};\n"],"names":["getDefaultFormName","selectShipping","selectBilling","Addresses","hideActionFormButtons","formName","slots","title","addressFormTitle","defaultSelectAddressId","showFormLoader","forwardFormRef","showSaveCheckBox","saveCheckBoxValue","selectable","className","withHeader","minifiedView","withActionsInMinifiedView","withActionsInFullSizeView","inputsDefaultValueSet","showShippingCheckBox","showBillingCheckBox","shippingCheckBoxValue","billingCheckBoxValue","onAddressData","routeAddressesPage","onSubmit","onSuccess","onError","minifiedViewKey","inputName","jsx","classes","AddressesWrapper"],"mappings":"ycAqBA,MAAMA,EAAqB,CACzBC,EACAC,IAEID,GAAkBC,EACb,kBACED,EACF,0BACEC,EACF,yBAGF,UAGIC,EAAuC,CAAC,CACnD,sBAAAC,EACA,SAAAC,EACA,MAAAC,EACA,MAAAC,EACA,iBAAAC,EACA,uBAAAC,EACA,eAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,kBAAAC,EACA,eAAAZ,EACA,cAAAC,EACA,WAAAY,EACA,UAAAC,EACA,WAAAC,EACA,aAAAC,EACA,0BAAAC,EACA,0BAAAC,EACA,sBAAAC,EACA,qBAAAC,EACA,oBAAAC,EACA,sBAAAC,EACA,qBAAAC,EACA,cAAAC,EACA,mBAAAC,EACA,SAAAC,EACA,UAAAC,EACA,QAAAC,CACF,IAAM,
|
|
1
|
+
{"version":3,"file":"Addresses.js","sources":["/@dropins/storefront-account/src/containers/Addresses/Addresses.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { AddressesProps } from '@/account/types';\nimport { AddressesWrapper } from '@/account/components';\n\nconst getDefaultFormName = (\n selectShipping: boolean,\n selectBilling: boolean\n): string => {\n if (selectShipping && selectBilling) {\n return 'selectedAddress';\n } else if (selectShipping) {\n return 'selectedShippingAddress';\n } else if (selectBilling) {\n return 'selectedBillingAddress';\n }\n\n return 'default';\n};\n\nexport const Addresses: Container<AddressesProps> = ({\n hideActionFormButtons,\n formName,\n slots,\n title,\n addressFormTitle,\n defaultSelectAddressId,\n showFormLoader,\n forwardFormRef,\n showSaveCheckBox,\n saveCheckBoxValue,\n selectShipping,\n selectBilling,\n selectable,\n className,\n withHeader,\n minifiedView,\n withActionsInMinifiedView,\n withActionsInFullSizeView,\n inputsDefaultValueSet,\n showShippingCheckBox,\n showBillingCheckBox,\n shippingCheckBoxValue,\n billingCheckBoxValue,\n onAddressData,\n routeAddressesPage,\n onSubmit,\n onSuccess,\n onError,\n}) => {\n const minifiedViewKey = minifiedView ? 'minifiedView' : 'fullSizeView';\n const inputName =\n formName ?? getDefaultFormName(selectShipping!, selectBilling!);\n\n return (\n <div\n className={classes(['account-addresses', className])}\n data-testid=\"addressesid\"\n >\n <AddressesWrapper\n inputName={inputName}\n minifiedViewKey={minifiedViewKey}\n hideActionFormButtons={hideActionFormButtons}\n slots={slots}\n title={title}\n addressFormTitle={addressFormTitle}\n defaultSelectAddressId={defaultSelectAddressId}\n showFormLoader={showFormLoader}\n onAddressData={onAddressData}\n forwardFormRef={forwardFormRef}\n selectShipping={selectShipping}\n selectBilling={selectBilling}\n showSaveCheckBox={showSaveCheckBox}\n saveCheckBoxValue={saveCheckBoxValue}\n selectable={selectable}\n className={className}\n withHeader={withHeader}\n minifiedView={minifiedView}\n withActionsInMinifiedView={withActionsInMinifiedView}\n withActionsInFullSizeView={withActionsInFullSizeView}\n inputsDefaultValueSet={inputsDefaultValueSet}\n billingCheckBoxValue={billingCheckBoxValue}\n shippingCheckBoxValue={shippingCheckBoxValue}\n showBillingCheckBox={showBillingCheckBox}\n showShippingCheckBox={showShippingCheckBox}\n routeAddressesPage={routeAddressesPage}\n onSubmit={onSubmit}\n onSuccess={onSuccess}\n onError={onError}\n />\n </div>\n );\n};\n"],"names":["getDefaultFormName","selectShipping","selectBilling","Addresses","hideActionFormButtons","formName","slots","title","addressFormTitle","defaultSelectAddressId","showFormLoader","forwardFormRef","showSaveCheckBox","saveCheckBoxValue","selectable","className","withHeader","minifiedView","withActionsInMinifiedView","withActionsInFullSizeView","inputsDefaultValueSet","showShippingCheckBox","showBillingCheckBox","shippingCheckBoxValue","billingCheckBoxValue","onAddressData","routeAddressesPage","onSubmit","onSuccess","onError","minifiedViewKey","inputName","jsx","classes","AddressesWrapper"],"mappings":"ycAqBA,MAAMA,EAAqB,CACzBC,EACAC,IAEID,GAAkBC,EACb,kBACED,EACF,0BACEC,EACF,yBAGF,UAGIC,EAAuC,CAAC,CACnD,sBAAAC,EACA,SAAAC,EACA,MAAAC,EACA,MAAAC,EACA,iBAAAC,EACA,uBAAAC,EACA,eAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,kBAAAC,EACA,eAAAZ,EACA,cAAAC,EACA,WAAAY,EACA,UAAAC,EACA,WAAAC,EACA,aAAAC,EACA,0BAAAC,EACA,0BAAAC,EACA,sBAAAC,EACA,qBAAAC,EACA,oBAAAC,EACA,sBAAAC,EACA,qBAAAC,EACA,cAAAC,EACA,mBAAAC,EACA,SAAAC,EACA,UAAAC,EACA,QAAAC,CACF,IAAM,CACJ,MAAMC,EAAkBb,EAAe,eAAiB,eAClDc,EACJ1B,GAAYL,EAAmBC,EAAiBC,CAAc,EAEhE,OACE8B,EAAC,MAAA,CACC,UAAWC,EAAQ,CAAC,oBAAqBlB,CAAS,CAAC,EACnD,cAAY,cAEZ,SAAAiB,EAACE,EAAA,CACC,UAAAH,EACA,gBAAAD,EACA,sBAAA1B,EACA,MAAAE,EACA,MAAAC,EACA,iBAAAC,EACA,uBAAAC,EACA,eAAAC,EACA,cAAAe,EACA,eAAAd,EACA,eAAAV,EACA,cAAAC,EACA,iBAAAU,EACA,kBAAAC,EACA,WAAAC,EACA,UAAAC,EACA,WAAAC,EACA,aAAAC,EACA,0BAAAC,EACA,0BAAAC,EACA,sBAAAC,EACA,qBAAAI,EACA,sBAAAD,EACA,oBAAAD,EACA,qBAAAD,EACA,mBAAAK,EACA,SAAAC,EACA,UAAAC,EACA,QAAAC,CAAA,CAAA,CACF,CAAA,CAGN"}
|