@dropins/storefront-account 3.1.0-beta1 → 3.1.0
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/createCustomerAddress/createCustomerAddress.d.ts +2 -1
- package/api/createCustomerAddress/graphql/createCustomerAddress.graphql.d.ts +1 -1
- package/chunks/removeCustomerAddress.js +7 -6
- package/chunks/removeCustomerAddress.js.map +1 -1
- package/package.json +1 -1
- package/types/api/createCustomerAddress.types.d.ts +5 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { CreateCustomerAddressResult } from '../../types';
|
|
1
2
|
import { CustomerAddressesModel } from '../../data/models';
|
|
2
3
|
|
|
3
|
-
export declare const createCustomerAddress: (address: CustomerAddressesModel) => Promise<
|
|
4
|
+
export declare const createCustomerAddress: (address: CustomerAddressesModel) => Promise<CreateCustomerAddressResult>;
|
|
4
5
|
//# sourceMappingURL=createCustomerAddress.d.ts.map
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export declare const CREATE_CUSTOMER_ADDRESS = "\n mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n firstname\n }\n }\n";
|
|
17
|
+
export declare const CREATE_CUSTOMER_ADDRESS = "\n mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n firstname\n uid\n }\n }\n";
|
|
18
18
|
//# sourceMappingURL=createCustomerAddress.graphql.d.ts.map
|
|
@@ -46,13 +46,14 @@ import{events as E}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}fr
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
`,
|
|
49
|
+
`,f=t=>{throw t instanceof DOMException&&t.name==="AbortError"||E.emit("error",{source:"auth",type:"network",error:t}),t},_=t=>{const r=t.map(n=>n.message).join(" ");throw Error(r)},b=t=>t.replace(/_([a-z])/g,(r,n)=>n.toUpperCase()),T=t=>t.replace(/([A-Z])/g,r=>`_${r.toLowerCase()}`),g=(t,r,n)=>{const o=["string","boolean","number"],u=r==="camelCase"?b:T;return Array.isArray(t)?t.map(i=>o.includes(typeof i)||i===null?i:typeof i=="object"?g(i,r,n):i):t!==null&&typeof t=="object"?Object.entries(t).reduce((i,[c,a])=>{const e=n&&n[c]?n[c]:u(c);return i[e]=o.includes(typeof a)||a===null?a:g(a,r,n),i},{}):t},y=t=>{let r=[];for(const n of t)if(!(n.frontend_input!=="MULTILINE"||n.multiline_count<2))for(let o=2;o<=n.multiline_count;o++){const u={...n,is_required:!1,name:`${n.code}_multiline_${o}`,code:`${n.code}_multiline_${o}`,id:`${n.code}_multiline_${o}`};r.push(u)}return r},R=t=>{switch(t){case"middlename":return"middleName";case"firstname":return"firstName";case"lastname":return"lastName";default:return b(t)}},v=t=>{var r;return t!=null&&t.options?(r=t==null?void 0:t.options)==null?void 0:r.map(n=>({isDefault:(n==null?void 0:n.is_default)??!1,text:(n==null?void 0:n.label)??"",value:(n==null?void 0:n.value)??""})):[]},N=t=>{var i,c,a;const r=((c=(i=t==null?void 0:t.data)==null?void 0:i.attributesForm)==null?void 0:c.items)||[];if(!r.length)return[];const n=(a=r.filter(e=>{var l;return!((l=e.frontend_input)!=null&&l.includes("HIDDEN"))}))==null?void 0:a.map(({code:e,...l})=>{const h=e!=="country_id"?e:"country_code";return{...l,name:h,id:h,code:h}}),o=y(n);return n.concat(o).map(e=>({code:e==null?void 0:e.code,name:e==null?void 0:e.name,id:e==null?void 0:e.id,label:(e==null?void 0:e.label)??"",entityType:e==null?void 0:e.entity_type,className:(e==null?void 0:e.frontend_class)??"",defaultValue:(e==null?void 0:e.default_value)??"",fieldType:e==null?void 0:e.frontend_input,multilineCount:(e==null?void 0:e.multiline_count)??0,orderNumber:Number(e==null?void 0:e.sort_order)||0,isHidden:!1,isUnique:(e==null?void 0:e.is_unique)??!1,required:(e==null?void 0:e.is_required)??!1,validateRules:(e==null?void 0:e.validate_rules)??[],options:v(e),customUpperCode:R(e==null?void 0:e.code)})).sort((e,l)=>Number(e.orderNumber)-Number(l.orderNumber))},O=t=>{const r={};for(const n in t){const o=t[n];!Array.isArray(o)||o.length===0||(n==="custom_attributesV2"?o.forEach(u=>{typeof u=="object"&&"value"in u&&(r[u==null?void 0:u.code]=u==null?void 0:u.value)}):o.length>1?o.forEach((u,i)=>{i===0?r[n]=u:r[`${n}_multiline_${i+1}`]=u}):r[n]=o[0])}return r},I=t=>({prefix:(t==null?void 0:t.prefix)??"",suffix:(t==null?void 0:t.suffix)??"",firstname:(t==null?void 0:t.firstname)??"",lastname:(t==null?void 0:t.lastname)??"",middlename:(t==null?void 0:t.middlename)??""}),U=t=>({id:(t==null?void 0:t.id)??"",vat_id:(t==null?void 0:t.vat_id)??"",postcode:(t==null?void 0:t.postcode)??"",country_code:(t==null?void 0:t.country_code)??"",uid:(t==null?void 0:t.uid)??""}),M=t=>({company:(t==null?void 0:t.company)??"",telephone:(t==null?void 0:t.telephone)??"",fax:(t==null?void 0:t.fax)??""}),$=t=>{var n,o,u;return g({...I(t),...U(t),...M(t),city:(t==null?void 0:t.city)??"",region:{region:((n=t==null?void 0:t.region)==null?void 0:n.region)??"",region_code:((o=t==null?void 0:t.region)==null?void 0:o.region_code)??"",region_id:((u=t==null?void 0:t.region)==null?void 0:u.region_id)??""},default_shipping:(t==null?void 0:t.default_shipping)||!1,default_billing:(t==null?void 0:t.default_billing)||!1,...O(t)},"camelCase",{})},w=t=>{var o,u;const r=((u=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:u.addresses)||[];return r.length?r.map($).sort((i,c)=>(Number(c.defaultBilling)||Number(c.defaultShipping))-(Number(i.defaultBilling)||Number(i.defaultShipping))):[]},q=t=>{var c,a;if(!((a=(c=t==null?void 0:t.data)==null?void 0:c.countries)!=null&&a.length))return{availableCountries:[],countriesWithRequiredRegion:[],optionalZipCountries:[]};const{countries:r,storeConfig:n}=t.data,o=n==null?void 0:n.countries_with_required_region.split(","),u=n==null?void 0:n.optional_zip_countries.split(",");return{availableCountries:r.filter(({two_letter_abbreviation:e,full_name_locale:l})=>!!(e&&l)).map(e=>{const{two_letter_abbreviation:l,full_name_locale:h,available_regions:m}=e,p=Array.isArray(m)&&m.length>0;return{value:l,text:h,availableRegions:p?m:void 0}}).sort((e,l)=>e.text.localeCompare(l.text)),countriesWithRequiredRegion:o,optionalZipCountries:u}},K=async t=>{const r=`_account_attributesForm_${t}`,n=sessionStorage.getItem(r);return n?JSON.parse(n):await s(t!=="shortRequest"?S:A,{method:"GET",cache:"force-cache",variables:{formCode:t}}).then(o=>{var i;if((i=o.errors)!=null&&i.length)return _(o.errors);const u=N(o);return sessionStorage.setItem(r,JSON.stringify(u)),u}).catch(f)},x=`
|
|
50
50
|
mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {
|
|
51
51
|
createCustomerAddress(input: $input) {
|
|
52
52
|
firstname
|
|
53
|
+
uid
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
|
-
`,z=async t=>await s(x,{method:"POST",variables:{input:g(t,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(r=>{var
|
|
56
|
+
`,z=async t=>await s(x,{method:"POST",variables:{input:g(t,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(r=>{var o,u;if((o=r.errors)!=null&&o.length)return _(r.errors);const n=(u=r==null?void 0:r.data)==null?void 0:u.createCustomerAddress;return{firstname:(n==null?void 0:n.firstname)??"",uid:(n==null?void 0:n.uid)??""}}).catch(f),F=`
|
|
56
57
|
query GET_CUSTOMER_ADDRESS {
|
|
57
58
|
customer {
|
|
58
59
|
addresses {
|
|
@@ -87,7 +88,7 @@ import{events as E}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}fr
|
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
`,Z=async()=>await s(F,{method:"GET",cache:"no-cache"}).then(t=>{var r;return(r=t.errors)!=null&&r.length?
|
|
91
|
+
`,Z=async()=>await s(F,{method:"GET",cache:"no-cache"}).then(t=>{var r;return(r=t.errors)!=null&&r.length?_(t.errors):w(t)}).catch(f),G=`
|
|
91
92
|
query GET_COUNTRIES_QUERY {
|
|
92
93
|
countries {
|
|
93
94
|
two_letter_abbreviation
|
|
@@ -103,15 +104,15 @@ import{events as E}from"@dropins/tools/event-bus.js";import{FetchGraphQL as C}fr
|
|
|
103
104
|
optional_zip_countries
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
|
-
`,W=async()=>{const t="_account_countries",r=sessionStorage.getItem(t);return r?JSON.parse(r):await s(G,{method:"GET",cache:"no-cache"}).then(n=>{var u;if((u=n.errors)!=null&&u.length)return
|
|
107
|
+
`,W=async()=>{const t="_account_countries",r=sessionStorage.getItem(t);return r?JSON.parse(r):await s(G,{method:"GET",cache:"no-cache"}).then(n=>{var u;if((u=n.errors)!=null&&u.length)return _(n.errors);const o=q(n);return sessionStorage.setItem(t,JSON.stringify(o)),o}).catch(f)},V=`
|
|
107
108
|
mutation UPDATE_CUSTOMER_ADDRESS($id: Int!, $input: CustomerAddressInput) {
|
|
108
109
|
updateCustomerAddress(id: $id, input: $input) {
|
|
109
110
|
firstname
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
|
-
`,Y=async t=>{const{addressId:r,...n}=t;return r?await s(V,{method:"POST",variables:{id:Number(r),input:g(n,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(o=>{var u,i,c;return(u=o.errors)!=null&&u.length?
|
|
113
|
+
`,Y=async t=>{const{addressId:r,...n}=t;return r?await s(V,{method:"POST",variables:{id:Number(r),input:g(n,"snakeCase",{custom_attributesV2:"custom_attributesV2",firstName:"firstname",lastName:"lastname",middleName:"middlename"})}}).then(o=>{var u,i,c;return(u=o.errors)!=null&&u.length?_(o.errors):((c=(i=o==null?void 0:o.data)==null?void 0:i.updateCustomerAddress)==null?void 0:c.firstname)||""}).catch(f):""},B=`
|
|
113
114
|
mutation REMOVE_CUSTOMER_ADDRESS($id: Int!) {
|
|
114
115
|
deleteCustomerAddress(id: $id)
|
|
115
116
|
}
|
|
116
|
-
`,X=async t=>await s(B,{method:"POST",variables:{id:t}}).then(r=>{var n;return(n=r.errors)!=null&&n.length?
|
|
117
|
+
`,X=async t=>await s(B,{method:"POST",variables:{id:t}}).then(r=>{var n;return(n=r.errors)!=null&&n.length?_(r.errors):r.data.deleteCustomerAddress}).catch(f);export{f as a,k as b,P as c,K as d,z as e,s as f,J as g,_ as h,Z as i,W as j,X as k,b as l,g as m,T as n,L as r,j as s,$ as t,Y as u};
|
|
117
118
|
//# sourceMappingURL=removeCustomerAddress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removeCustomerAddress.js","sources":["/@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/lib/convertCase.ts","/@dropins/storefront-account/src/data/transforms/transform-attributes-form.ts","/@dropins/storefront-account/src/data/transforms/transform-customer-address.ts","/@dropins/storefront-account/src/data/transforms/transform-countries.ts","/@dropins/storefront-account/src/api/getAttributesForm/getAttributesForm.ts","/@dropins/storefront-account/src/api/createCustomerAddress/graphql/createCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/createCustomerAddress/createCustomerAddress.ts","/@dropins/storefront-account/src/api/getCustomerAddress/graphql/getCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/getCustomerAddress/getCustomerAddress.ts","/@dropins/storefront-account/src/api/getCountries/graphql/getCountries.graphql.ts","/@dropins/storefront-account/src/api/getCountries/getCountries.ts","/@dropins/storefront-account/src/api/updateCustomerAddress/graphql/updateCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/updateCustomerAddress/updateCustomerAddress.ts","/@dropins/storefront-account/src/api/removeCustomerAddress/graphql/removeCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/removeCustomerAddress/removeCustomerAddress.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_ATTRIBUTES_FORM = /* GraphQL */ `\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\n }\n }\n`;\n\nexport const GET_ATTRIBUTES_FORM_SHORT = /* GraphQL */ `\n query GET_ATTRIBUTES_FORM_SHORT {\n attributesForm(formCode: \"customer_register_address\") {\n items {\n frontend_input\n label\n code\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n }\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\n\n/**\n * A function which can be attached to fetchGraphQL to handle thrown errors in\n * a generic way.\n */\nexport const handleNetworkError = (error: Error) => {\n const isAbortError =\n error instanceof DOMException && error.name === 'AbortError';\n\n if (!isAbortError) {\n // @ts-ignore\n events.emit('error', {\n source: 'auth',\n type: 'network',\n error,\n });\n }\n throw error;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const convertToCamelCase = (key: string): string => {\n return key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());\n};\n\nexport const convertToSnakeCase = (key: string): string => {\n return key.replace(/([A-Z])/g, (letter) => `_${letter.toLowerCase()}`);\n};\n\nexport const convertKeysCase = (\n data: any,\n type: 'snakeCase' | 'camelCase',\n dictionary?: Record<string, string>\n): any => {\n const typeList = ['string', 'boolean', 'number'];\n const callback =\n type === 'camelCase' ? convertToCamelCase : convertToSnakeCase;\n\n if (Array.isArray(data)) {\n return data.map((element) => {\n if (typeList.includes(typeof element) || element === null) return element;\n\n if (typeof element === 'object') {\n return convertKeysCase(element, type, dictionary);\n }\n return element;\n });\n }\n\n if (data !== null && typeof data === 'object') {\n return Object.entries(data).reduce((acc, [key, value]) => {\n const newKey =\n dictionary && dictionary[key] ? dictionary[key] : callback(key);\n acc[newKey] =\n typeList.includes(typeof value) || value === null\n ? value\n : convertKeysCase(value, type, dictionary);\n return acc;\n }, {} as Record<string, unknown>);\n }\n\n return data;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n GetAttributesFormResponse,\n ResponseAttributesFormItemsProps,\n} from '@/account/types';\nimport { AttributesFormModel, FieldEnumList } from '../models';\nimport { convertToCamelCase } from '@/account/lib/convertCase';\n\nexport const cloneArrayIfExists = (\n fields: ResponseAttributesFormItemsProps[]\n) => {\n let multilineItems: any = [];\n\n for (const element of fields) {\n if (element.frontend_input !== 'MULTILINE' || element.multiline_count < 2) {\n continue;\n }\n\n for (let i = 2; i <= element.multiline_count; i++) {\n const newItem = {\n ...element,\n is_required: false,\n name: `${element.code}_multiline_${i}`,\n code: `${element.code}_multiline_${i}`,\n id: `${element.code}_multiline_${i}`,\n };\n\n multilineItems.push(newItem);\n }\n }\n\n return multilineItems;\n};\n\nconst transformCustomUpperCode = (code: string) => {\n switch (code) {\n case 'middlename':\n return 'middleName';\n case 'firstname':\n return 'firstName';\n case 'lastname':\n return 'lastName';\n default:\n return convertToCamelCase(code);\n }\n};\n\nconst transformOptions = (item: any) => {\n if (!item?.options) return [];\n\n return item?.options?.map((el: any) => {\n return {\n isDefault: el?.is_default ?? false,\n text: el?.label ?? '',\n value: el?.value ?? '',\n };\n });\n};\n\nexport const transformAttributesForm = (\n response: GetAttributesFormResponse\n): AttributesFormModel[] => {\n const items = response?.data?.attributesForm?.items || [];\n\n if (!items.length) return [];\n\n const fields = items\n .filter((el) => !el.frontend_input?.includes('HIDDEN'))\n ?.map(({ code, ...other }) => {\n const isDefaultCode = code !== 'country_id' ? code : 'country_code';\n\n return {\n ...other,\n name: isDefaultCode,\n id: isDefaultCode,\n code: isDefaultCode,\n };\n });\n\n const multilineItems = cloneArrayIfExists(fields as any);\n\n const attributesConfig = fields\n .concat(multilineItems)\n .map((item) => {\n return {\n code: item?.code,\n name: item?.name,\n id: item?.id,\n label: item?.label ?? '',\n entityType: item?.entity_type,\n className: item?.frontend_class ?? '',\n defaultValue: item?.default_value ?? '',\n fieldType: item?.frontend_input as FieldEnumList,\n multilineCount: item?.multiline_count ?? 0,\n orderNumber: Number(item?.sort_order) || 0,\n isHidden: false,\n isUnique: item?.is_unique ?? false,\n required: item?.is_required ?? false,\n validateRules: item?.validate_rules ?? [],\n options: transformOptions(item),\n customUpperCode: transformCustomUpperCode(item?.code),\n };\n })\n .sort((a, b) => Number(a.orderNumber) - Number(b.orderNumber));\n\n return attributesConfig;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CustomerAddressesModel } from '../models';\nimport { AddressResponse, UserAddressesProps } from '@/account/types';\nimport { convertKeysCase } from '@/account/lib/convertCase';\n\nconst expandArraysInObject = (inputObject: UserAddressesProps) => {\n const flattenedAttributes: Record<string, unknown> = {};\n\n for (const key in inputObject) {\n const element = inputObject[key as keyof UserAddressesProps];\n\n if (!Array.isArray(element) || element.length === 0) continue;\n\n if (key === 'custom_attributesV2') {\n element.forEach((item) => {\n if (typeof item === 'object' && 'value' in item) {\n flattenedAttributes[item?.code] = item?.value;\n }\n });\n } else if (element.length > 1) {\n element.forEach((value: unknown, index: number) => {\n index === 0\n ? (flattenedAttributes[key] = value)\n : (flattenedAttributes[`${key}_multiline_${index + 1}`] = value);\n });\n } else {\n flattenedAttributes[key] = element[0] as Record<string, string>;\n }\n }\n\n return flattenedAttributes;\n};\nconst transformFullName = (address: UserAddressesProps) => {\n return {\n prefix: address?.prefix ?? '',\n suffix: address?.suffix ?? '',\n firstname: address?.firstname ?? '',\n lastname: address?.lastname ?? '',\n middlename: address?.middlename ?? '',\n };\n};\n\nconst transformIds = (address: UserAddressesProps) => {\n return {\n id: address?.id ?? '',\n vat_id: address?.vat_id ?? '',\n postcode: address?.postcode ?? '',\n country_code: address?.country_code ?? '',\n uid: address?.uid ?? '',\n };\n};\n\nconst transformContacts = (address: UserAddressesProps) => {\n return {\n company: address?.company ?? '',\n telephone: address?.telephone ?? '',\n fax: address?.fax ?? '',\n };\n};\n\n// Function to transform a single address\nexport const transformSingleAddress = (\n addressData: UserAddressesProps\n): CustomerAddressesModel => {\n const result = convertKeysCase(\n {\n ...transformFullName(addressData),\n ...transformIds(addressData),\n ...transformContacts(addressData),\n city: addressData?.city ?? '',\n region: {\n region: addressData?.region?.region ?? '',\n region_code: addressData?.region?.region_code ?? '',\n region_id: addressData?.region?.region_id ?? '',\n },\n default_shipping: addressData?.default_shipping || false,\n default_billing: addressData?.default_billing || false,\n ...expandArraysInObject(addressData),\n },\n 'camelCase',\n {}\n );\n\n return result;\n};\n\n// Function to transform multiple addresses from a response\nexport const transformMultipleAddresses = (\n response: AddressResponse\n): CustomerAddressesModel[] | [] => {\n const addresses: UserAddressesProps[] =\n response?.data?.customer?.addresses || [];\n\n if (!addresses.length) return [];\n\n const result = addresses\n .map(transformSingleAddress)\n .sort(\n (a, b) =>\n (Number(b.defaultBilling) || Number(b.defaultShipping)) -\n (Number(a.defaultBilling) || Number(a.defaultShipping))\n );\n\n return result;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CountriesFormResponse } from '@/account/types';\nimport { Country } from '../models';\n\nexport const transformCountries = (\n response: CountriesFormResponse\n): {\n availableCountries: Country[] | [];\n countriesWithRequiredRegion: string[];\n optionalZipCountries: string[];\n} => {\n if (!response?.data?.countries?.length) {\n return {\n availableCountries: [],\n countriesWithRequiredRegion: [],\n optionalZipCountries: [],\n };\n }\n\n const { countries, storeConfig } = response.data;\n\n const countriesWithRequiredRegion =\n storeConfig?.countries_with_required_region.split(',');\n const optionalZipCountries = storeConfig?.optional_zip_countries.split(',');\n\n const availableCountries = countries\n .filter(({ two_letter_abbreviation, full_name_locale }) =>\n Boolean(two_letter_abbreviation && full_name_locale)\n )\n .map((country) => {\n const { two_letter_abbreviation, full_name_locale, available_regions } = country;\n\n const hasRegions = Array.isArray(available_regions) && available_regions.length > 0;\n return {\n value: two_letter_abbreviation,\n text: full_name_locale,\n availableRegions: hasRegions ? available_regions : undefined,\n };\n })\n .sort((a, b) => a.text.localeCompare(b.text));\n\n return {\n availableCountries,\n countriesWithRequiredRegion,\n optionalZipCountries,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '../fetch-graphql';\nimport {\n GET_ATTRIBUTES_FORM,\n GET_ATTRIBUTES_FORM_SHORT,\n} from './graphql/getAttributesForm.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { transformAttributesForm } from '@/account/data/transforms';\nimport { AttributesFormModel } from '@/account/data/models';\nimport { GetAttributesFormResponse } from '@/account/types';\n\nexport const getAttributesForm = async (\n formCode: string\n): Promise<AttributesFormModel[]> => {\n const sessionStorageKey = `_account_attributesForm_${formCode}`;\n\n const sessionStorageCache = sessionStorage.getItem(sessionStorageKey);\n\n if (sessionStorageCache) {\n return JSON.parse(sessionStorageCache);\n }\n\n return await fetchGraphQl(\n formCode !== 'shortRequest'\n ? GET_ATTRIBUTES_FORM\n : GET_ATTRIBUTES_FORM_SHORT,\n {\n method: 'GET',\n cache: 'force-cache',\n variables: { formCode },\n }\n )\n .then((response: GetAttributesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n const transformedData = transformAttributesForm(response);\n\n sessionStorage.setItem(\n sessionStorageKey,\n JSON.stringify(transformedData)\n );\n\n return transformedData;\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CREATE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n firstname\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CreateCustomerAddressResponse } from '@/account/types';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { CREATE_CUSTOMER_ADDRESS } from './graphql/createCustomerAddress.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { convertKeysCase } from '@/account/lib/convertCase';\nimport { CustomerAddressesModel } from '@/account/data/models';\n\nexport const createCustomerAddress = async (\n address: CustomerAddressesModel\n): Promise<string> => {\n return await fetchGraphQl(CREATE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: {\n input: convertKeysCase(address, 'snakeCase', {\n custom_attributesV2: 'custom_attributesV2',\n firstName: 'firstname',\n lastName: 'lastname',\n middleName: 'middlename',\n }),\n },\n })\n .then((response: CreateCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response?.data?.createCustomerAddress?.firstname || '';\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_CUSTOMER_ADDRESS = /* GraphQL */ `\n query GET_CUSTOMER_ADDRESS {\n customer {\n addresses {\n firstname\n lastname\n middlename\n fax\n prefix\n suffix\n city\n company\n country_code\n region {\n region\n region_code\n region_id\n }\n custom_attributesV2 {\n ... on AttributeValue {\n code\n value\n }\n }\n telephone\n id\n vat_id\n postcode\n street\n default_shipping\n default_billing\n uid\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { GET_CUSTOMER_ADDRESS } from './graphql/getCustomerAddress.graphql';\nimport { transformMultipleAddresses } from '@/account/data/transforms';\nimport { CustomerAddressesModel } from '@/account/data/models/customer-address';\nimport { AddressResponse } from '@/account/types';\nimport { handleFetchError } from '@/account/lib/fetch-error';\n\nexport const getCustomerAddress = async (): Promise<\n CustomerAddressesModel[]\n> => {\n return await fetchGraphQl(GET_CUSTOMER_ADDRESS, {\n method: 'GET',\n cache: 'no-cache',\n })\n .then((response: AddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformMultipleAddresses(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_COUNTRIES_QUERY = /* GraphQL */ `\n query GET_COUNTRIES_QUERY {\n countries {\n two_letter_abbreviation\n full_name_locale\n available_regions {\n id\n code\n name\n }\n }\n storeConfig {\n countries_with_required_region\n optional_zip_countries\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_COUNTRIES_QUERY } from './graphql/getCountries.graphql';\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { transformCountries } from '@/account/data/transforms';\nimport { CountriesFormResponse } from '@/account/types';\nimport { Country } from '@/account/data/models';\n\nexport const getCountries = async (): Promise<{\n availableCountries: Country[] | [];\n countriesWithRequiredRegion: string[];\n optionalZipCountries: string[];\n}> => {\n const sessionStorageKey = '_account_countries';\n\n const sessionStorageCache = sessionStorage.getItem(sessionStorageKey);\n\n if (sessionStorageCache) {\n return JSON.parse(sessionStorageCache);\n }\n\n return await fetchGraphQl(GET_COUNTRIES_QUERY, {\n method: 'GET',\n cache: 'no-cache',\n })\n .then((response: CountriesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n const transformedData = transformCountries(response);\n\n sessionStorage.setItem(\n sessionStorageKey,\n JSON.stringify(transformedData)\n );\n\n return transformedData;\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const UPDATE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation UPDATE_CUSTOMER_ADDRESS($id: Int!, $input: CustomerAddressInput) {\n updateCustomerAddress(id: $id, input: $input) {\n firstname\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { UPDATE_CUSTOMER_ADDRESS } from './graphql/updateCustomerAddress.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { UpdateCustomerAddressResponse } from '@/account/types';\nimport { CustomerAddressesModel } from '@/account/data/models';\nimport { convertKeysCase } from '@/account/lib/convertCase';\n\ntype ExtendedAddressFormProps = CustomerAddressesModel & {\n addressId: number;\n};\n\nexport const updateCustomerAddress = async (\n forms: ExtendedAddressFormProps\n): Promise<string> => {\n const { addressId, ...address } = forms;\n\n if (!addressId) return '';\n\n return await fetchGraphQl(UPDATE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: {\n id: Number(addressId),\n input: convertKeysCase(address, 'snakeCase', {\n custom_attributesV2: 'custom_attributesV2',\n firstName: 'firstname',\n lastName: 'lastname',\n middleName: 'middlename',\n }),\n },\n })\n .then((response: UpdateCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response?.data?.updateCustomerAddress?.firstname || '';\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REMOVE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation REMOVE_CUSTOMER_ADDRESS($id: Int!) {\n deleteCustomerAddress(id: $id)\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { REMOVE_CUSTOMER_ADDRESS } from './graphql/removeCustomerAddress.graphql';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { RemoveCustomerAddressResponse } from '@/account/types';\n\nexport const removeCustomerAddress = async (\n addressId: number\n): Promise<boolean> => {\n return await fetchGraphQl(REMOVE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: { id: addressId },\n })\n .then((response: RemoveCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response.data.deleteCustomerAddress;\n })\n .catch(handleNetworkError);\n};\n"],"names":["setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","GET_ATTRIBUTES_FORM","GET_ATTRIBUTES_FORM_SHORT","handleNetworkError","error","events","handleFetchError","errors","errorMessage","e","convertToCamelCase","key","_","letter","convertToSnakeCase","convertKeysCase","data","type","dictionary","typeList","callback","element","acc","value","newKey","cloneArrayIfExists","fields","multilineItems","i","newItem","transformCustomUpperCode","code","transformOptions","item","_a","el","transformAttributesForm","response","items","_b","_c","other","isDefaultCode","a","b","expandArraysInObject","inputObject","flattenedAttributes","index","transformFullName","address","transformIds","transformContacts","transformSingleAddress","addressData","transformMultipleAddresses","addresses","transformCountries","countries","storeConfig","countriesWithRequiredRegion","optionalZipCountries","two_letter_abbreviation","full_name_locale","country","available_regions","hasRegions","getAttributesForm","formCode","sessionStorageKey","sessionStorageCache","transformedData","CREATE_CUSTOMER_ADDRESS","createCustomerAddress","GET_CUSTOMER_ADDRESS","getCustomerAddress","GET_COUNTRIES_QUERY","getCountries","UPDATE_CUSTOMER_ADDRESS","updateCustomerAddress","forms","addressId","REMOVE_CUSTOMER_ADDRESS","removeCustomerAddress"],"mappings":"oHAmBO,KAAM,CACX,YAAAA,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,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YACX,SAAU,WACV,WAAY,YAAA,CACb,CAAA,CACH,CACD,EACE,KAAMb,GAA4C,WACjD,OAAIH,EAAAG,EAAS,SAAT,MAAAH,EAAiB,OAAe5B,EAAiB+B,EAAS,MAAM,IAE7DG,GAAAD,EAAAF,GAAA,YAAAA,EAAU,OAAV,YAAAE,EAAgB,wBAAhB,YAAAC,EAAuC,YAAa,EAC7D,CAAC,EACA,MAAMrC,CAAkB,EAnBJ,EAoBzB,ECrCa+E,EAAwC;AAAA;AAAA;AAAA;AAAA,ECMxCC,EAAwB,MACnCF,GAEO,MAAMnF,EAAaoF,EAAyB,CACjD,OAAQ,OACR,UAAW,CAAE,GAAID,CAAA,CAAU,CAC5B,EACE,KAAM5C,GAA4C,OACjD,OAAIH,EAAAG,EAAS,SAAT,MAAAH,EAAiB,OAAe5B,EAAiB+B,EAAS,MAAM,EAE7DA,EAAS,KAAK,qBACvB,CAAC,EACA,MAAMlC,CAAkB"}
|
|
1
|
+
{"version":3,"file":"removeCustomerAddress.js","sources":["/@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/lib/convertCase.ts","/@dropins/storefront-account/src/data/transforms/transform-attributes-form.ts","/@dropins/storefront-account/src/data/transforms/transform-customer-address.ts","/@dropins/storefront-account/src/data/transforms/transform-countries.ts","/@dropins/storefront-account/src/api/getAttributesForm/getAttributesForm.ts","/@dropins/storefront-account/src/api/createCustomerAddress/graphql/createCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/createCustomerAddress/createCustomerAddress.ts","/@dropins/storefront-account/src/api/getCustomerAddress/graphql/getCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/getCustomerAddress/getCustomerAddress.ts","/@dropins/storefront-account/src/api/getCountries/graphql/getCountries.graphql.ts","/@dropins/storefront-account/src/api/getCountries/getCountries.ts","/@dropins/storefront-account/src/api/updateCustomerAddress/graphql/updateCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/updateCustomerAddress/updateCustomerAddress.ts","/@dropins/storefront-account/src/api/removeCustomerAddress/graphql/removeCustomerAddress.graphql.ts","/@dropins/storefront-account/src/api/removeCustomerAddress/removeCustomerAddress.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_ATTRIBUTES_FORM = /* GraphQL */ `\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\n }\n }\n`;\n\nexport const GET_ATTRIBUTES_FORM_SHORT = /* GraphQL */ `\n query GET_ATTRIBUTES_FORM_SHORT {\n attributesForm(formCode: \"customer_register_address\") {\n items {\n frontend_input\n label\n code\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n }\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\n\n/**\n * A function which can be attached to fetchGraphQL to handle thrown errors in\n * a generic way.\n */\nexport const handleNetworkError = (error: Error) => {\n const isAbortError =\n error instanceof DOMException && error.name === 'AbortError';\n\n if (!isAbortError) {\n // @ts-ignore\n events.emit('error', {\n source: 'auth',\n type: 'network',\n error,\n });\n }\n throw error;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const convertToCamelCase = (key: string): string => {\n return key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());\n};\n\nexport const convertToSnakeCase = (key: string): string => {\n return key.replace(/([A-Z])/g, (letter) => `_${letter.toLowerCase()}`);\n};\n\nexport const convertKeysCase = (\n data: any,\n type: 'snakeCase' | 'camelCase',\n dictionary?: Record<string, string>\n): any => {\n const typeList = ['string', 'boolean', 'number'];\n const callback =\n type === 'camelCase' ? convertToCamelCase : convertToSnakeCase;\n\n if (Array.isArray(data)) {\n return data.map((element) => {\n if (typeList.includes(typeof element) || element === null) return element;\n\n if (typeof element === 'object') {\n return convertKeysCase(element, type, dictionary);\n }\n return element;\n });\n }\n\n if (data !== null && typeof data === 'object') {\n return Object.entries(data).reduce((acc, [key, value]) => {\n const newKey =\n dictionary && dictionary[key] ? dictionary[key] : callback(key);\n acc[newKey] =\n typeList.includes(typeof value) || value === null\n ? value\n : convertKeysCase(value, type, dictionary);\n return acc;\n }, {} as Record<string, unknown>);\n }\n\n return data;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n GetAttributesFormResponse,\n ResponseAttributesFormItemsProps,\n} from '@/account/types';\nimport { AttributesFormModel, FieldEnumList } from '../models';\nimport { convertToCamelCase } from '@/account/lib/convertCase';\n\nexport const cloneArrayIfExists = (\n fields: ResponseAttributesFormItemsProps[]\n) => {\n let multilineItems: any = [];\n\n for (const element of fields) {\n if (element.frontend_input !== 'MULTILINE' || element.multiline_count < 2) {\n continue;\n }\n\n for (let i = 2; i <= element.multiline_count; i++) {\n const newItem = {\n ...element,\n is_required: false,\n name: `${element.code}_multiline_${i}`,\n code: `${element.code}_multiline_${i}`,\n id: `${element.code}_multiline_${i}`,\n };\n\n multilineItems.push(newItem);\n }\n }\n\n return multilineItems;\n};\n\nconst transformCustomUpperCode = (code: string) => {\n switch (code) {\n case 'middlename':\n return 'middleName';\n case 'firstname':\n return 'firstName';\n case 'lastname':\n return 'lastName';\n default:\n return convertToCamelCase(code);\n }\n};\n\nconst transformOptions = (item: any) => {\n if (!item?.options) return [];\n\n return item?.options?.map((el: any) => {\n return {\n isDefault: el?.is_default ?? false,\n text: el?.label ?? '',\n value: el?.value ?? '',\n };\n });\n};\n\nexport const transformAttributesForm = (\n response: GetAttributesFormResponse\n): AttributesFormModel[] => {\n const items = response?.data?.attributesForm?.items || [];\n\n if (!items.length) return [];\n\n const fields = items\n .filter((el) => !el.frontend_input?.includes('HIDDEN'))\n ?.map(({ code, ...other }) => {\n const isDefaultCode = code !== 'country_id' ? code : 'country_code';\n\n return {\n ...other,\n name: isDefaultCode,\n id: isDefaultCode,\n code: isDefaultCode,\n };\n });\n\n const multilineItems = cloneArrayIfExists(fields as any);\n\n const attributesConfig = fields\n .concat(multilineItems)\n .map((item) => {\n return {\n code: item?.code,\n name: item?.name,\n id: item?.id,\n label: item?.label ?? '',\n entityType: item?.entity_type,\n className: item?.frontend_class ?? '',\n defaultValue: item?.default_value ?? '',\n fieldType: item?.frontend_input as FieldEnumList,\n multilineCount: item?.multiline_count ?? 0,\n orderNumber: Number(item?.sort_order) || 0,\n isHidden: false,\n isUnique: item?.is_unique ?? false,\n required: item?.is_required ?? false,\n validateRules: item?.validate_rules ?? [],\n options: transformOptions(item),\n customUpperCode: transformCustomUpperCode(item?.code),\n };\n })\n .sort((a, b) => Number(a.orderNumber) - Number(b.orderNumber));\n\n return attributesConfig;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CustomerAddressesModel } from '../models';\nimport { AddressResponse, UserAddressesProps } from '@/account/types';\nimport { convertKeysCase } from '@/account/lib/convertCase';\n\nconst expandArraysInObject = (inputObject: UserAddressesProps) => {\n const flattenedAttributes: Record<string, unknown> = {};\n\n for (const key in inputObject) {\n const element = inputObject[key as keyof UserAddressesProps];\n\n if (!Array.isArray(element) || element.length === 0) continue;\n\n if (key === 'custom_attributesV2') {\n element.forEach((item) => {\n if (typeof item === 'object' && 'value' in item) {\n flattenedAttributes[item?.code] = item?.value;\n }\n });\n } else if (element.length > 1) {\n element.forEach((value: unknown, index: number) => {\n index === 0\n ? (flattenedAttributes[key] = value)\n : (flattenedAttributes[`${key}_multiline_${index + 1}`] = value);\n });\n } else {\n flattenedAttributes[key] = element[0] as Record<string, string>;\n }\n }\n\n return flattenedAttributes;\n};\nconst transformFullName = (address: UserAddressesProps) => {\n return {\n prefix: address?.prefix ?? '',\n suffix: address?.suffix ?? '',\n firstname: address?.firstname ?? '',\n lastname: address?.lastname ?? '',\n middlename: address?.middlename ?? '',\n };\n};\n\nconst transformIds = (address: UserAddressesProps) => {\n return {\n id: address?.id ?? '',\n vat_id: address?.vat_id ?? '',\n postcode: address?.postcode ?? '',\n country_code: address?.country_code ?? '',\n uid: address?.uid ?? '',\n };\n};\n\nconst transformContacts = (address: UserAddressesProps) => {\n return {\n company: address?.company ?? '',\n telephone: address?.telephone ?? '',\n fax: address?.fax ?? '',\n };\n};\n\n// Function to transform a single address\nexport const transformSingleAddress = (\n addressData: UserAddressesProps\n): CustomerAddressesModel => {\n const result = convertKeysCase(\n {\n ...transformFullName(addressData),\n ...transformIds(addressData),\n ...transformContacts(addressData),\n city: addressData?.city ?? '',\n region: {\n region: addressData?.region?.region ?? '',\n region_code: addressData?.region?.region_code ?? '',\n region_id: addressData?.region?.region_id ?? '',\n },\n default_shipping: addressData?.default_shipping || false,\n default_billing: addressData?.default_billing || false,\n ...expandArraysInObject(addressData),\n },\n 'camelCase',\n {}\n );\n\n return result;\n};\n\n// Function to transform multiple addresses from a response\nexport const transformMultipleAddresses = (\n response: AddressResponse\n): CustomerAddressesModel[] | [] => {\n const addresses: UserAddressesProps[] =\n response?.data?.customer?.addresses || [];\n\n if (!addresses.length) return [];\n\n const result = addresses\n .map(transformSingleAddress)\n .sort(\n (a, b) =>\n (Number(b.defaultBilling) || Number(b.defaultShipping)) -\n (Number(a.defaultBilling) || Number(a.defaultShipping))\n );\n\n return result;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CountriesFormResponse } from '@/account/types';\nimport { Country } from '../models';\n\nexport const transformCountries = (\n response: CountriesFormResponse\n): {\n availableCountries: Country[] | [];\n countriesWithRequiredRegion: string[];\n optionalZipCountries: string[];\n} => {\n if (!response?.data?.countries?.length) {\n return {\n availableCountries: [],\n countriesWithRequiredRegion: [],\n optionalZipCountries: [],\n };\n }\n\n const { countries, storeConfig } = response.data;\n\n const countriesWithRequiredRegion =\n storeConfig?.countries_with_required_region.split(',');\n const optionalZipCountries = storeConfig?.optional_zip_countries.split(',');\n\n const availableCountries = countries\n .filter(({ two_letter_abbreviation, full_name_locale }) =>\n Boolean(two_letter_abbreviation && full_name_locale)\n )\n .map((country) => {\n const { two_letter_abbreviation, full_name_locale, available_regions } = country;\n\n const hasRegions = Array.isArray(available_regions) && available_regions.length > 0;\n return {\n value: two_letter_abbreviation,\n text: full_name_locale,\n availableRegions: hasRegions ? available_regions : undefined,\n };\n })\n .sort((a, b) => a.text.localeCompare(b.text));\n\n return {\n availableCountries,\n countriesWithRequiredRegion,\n optionalZipCountries,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '../fetch-graphql';\nimport {\n GET_ATTRIBUTES_FORM,\n GET_ATTRIBUTES_FORM_SHORT,\n} from './graphql/getAttributesForm.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { transformAttributesForm } from '@/account/data/transforms';\nimport { AttributesFormModel } from '@/account/data/models';\nimport { GetAttributesFormResponse } from '@/account/types';\n\nexport const getAttributesForm = async (\n formCode: string\n): Promise<AttributesFormModel[]> => {\n const sessionStorageKey = `_account_attributesForm_${formCode}`;\n\n const sessionStorageCache = sessionStorage.getItem(sessionStorageKey);\n\n if (sessionStorageCache) {\n return JSON.parse(sessionStorageCache);\n }\n\n return await fetchGraphQl(\n formCode !== 'shortRequest'\n ? GET_ATTRIBUTES_FORM\n : GET_ATTRIBUTES_FORM_SHORT,\n {\n method: 'GET',\n cache: 'force-cache',\n variables: { formCode },\n }\n )\n .then((response: GetAttributesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n const transformedData = transformAttributesForm(response);\n\n sessionStorage.setItem(\n sessionStorageKey,\n JSON.stringify(transformedData)\n );\n\n return transformedData;\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CREATE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation CREATE_CUSTOMER_ADDRESS($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n firstname\n uid\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 {\n CreateCustomerAddressResponse,\n CreateCustomerAddressResult,\n} 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<CreateCustomerAddressResult> => {\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 const created = response?.data?.createCustomerAddress;\n return {\n firstname: created?.firstname ?? '',\n uid: created?.uid ?? '',\n };\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_CUSTOMER_ADDRESS = /* GraphQL */ `\n query GET_CUSTOMER_ADDRESS {\n customer {\n addresses {\n firstname\n lastname\n middlename\n fax\n prefix\n suffix\n city\n company\n country_code\n region {\n region\n region_code\n region_id\n }\n custom_attributesV2 {\n ... on AttributeValue {\n code\n value\n }\n }\n telephone\n id\n vat_id\n postcode\n street\n default_shipping\n default_billing\n uid\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { GET_CUSTOMER_ADDRESS } from './graphql/getCustomerAddress.graphql';\nimport { transformMultipleAddresses } from '@/account/data/transforms';\nimport { CustomerAddressesModel } from '@/account/data/models/customer-address';\nimport { AddressResponse } from '@/account/types';\nimport { handleFetchError } from '@/account/lib/fetch-error';\n\nexport const getCustomerAddress = async (): Promise<\n CustomerAddressesModel[]\n> => {\n return await fetchGraphQl(GET_CUSTOMER_ADDRESS, {\n method: 'GET',\n cache: 'no-cache',\n })\n .then((response: AddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return transformMultipleAddresses(response);\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_COUNTRIES_QUERY = /* GraphQL */ `\n query GET_COUNTRIES_QUERY {\n countries {\n two_letter_abbreviation\n full_name_locale\n available_regions {\n id\n code\n name\n }\n }\n storeConfig {\n countries_with_required_region\n optional_zip_countries\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_COUNTRIES_QUERY } from './graphql/getCountries.graphql';\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { transformCountries } from '@/account/data/transforms';\nimport { CountriesFormResponse } from '@/account/types';\nimport { Country } from '@/account/data/models';\n\nexport const getCountries = async (): Promise<{\n availableCountries: Country[] | [];\n countriesWithRequiredRegion: string[];\n optionalZipCountries: string[];\n}> => {\n const sessionStorageKey = '_account_countries';\n\n const sessionStorageCache = sessionStorage.getItem(sessionStorageKey);\n\n if (sessionStorageCache) {\n return JSON.parse(sessionStorageCache);\n }\n\n return await fetchGraphQl(GET_COUNTRIES_QUERY, {\n method: 'GET',\n cache: 'no-cache',\n })\n .then((response: CountriesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n const transformedData = transformCountries(response);\n\n sessionStorage.setItem(\n sessionStorageKey,\n JSON.stringify(transformedData)\n );\n\n return transformedData;\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const UPDATE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation UPDATE_CUSTOMER_ADDRESS($id: Int!, $input: CustomerAddressInput) {\n updateCustomerAddress(id: $id, input: $input) {\n firstname\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { UPDATE_CUSTOMER_ADDRESS } from './graphql/updateCustomerAddress.graphql';\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { UpdateCustomerAddressResponse } from '@/account/types';\nimport { CustomerAddressesModel } from '@/account/data/models';\nimport { convertKeysCase } from '@/account/lib/convertCase';\n\ntype ExtendedAddressFormProps = CustomerAddressesModel & {\n addressId: number;\n};\n\nexport const updateCustomerAddress = async (\n forms: ExtendedAddressFormProps\n): Promise<string> => {\n const { addressId, ...address } = forms;\n\n if (!addressId) return '';\n\n return await fetchGraphQl(UPDATE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: {\n id: Number(addressId),\n input: convertKeysCase(address, 'snakeCase', {\n custom_attributesV2: 'custom_attributesV2',\n firstName: 'firstname',\n lastName: 'lastname',\n middleName: 'middlename',\n }),\n },\n })\n .then((response: UpdateCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response?.data?.updateCustomerAddress?.firstname || '';\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REMOVE_CUSTOMER_ADDRESS = /* GraphQL */ `\n mutation REMOVE_CUSTOMER_ADDRESS($id: Int!) {\n deleteCustomerAddress(id: $id)\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { handleNetworkError } from '@/account/lib/network-error';\nimport { fetchGraphQl } from '@/account/api/fetch-graphql';\nimport { REMOVE_CUSTOMER_ADDRESS } from './graphql/removeCustomerAddress.graphql';\nimport { handleFetchError } from '@/account/lib/fetch-error';\nimport { RemoveCustomerAddressResponse } from '@/account/types';\n\nexport const removeCustomerAddress = async (\n addressId: number\n): Promise<boolean> => {\n return await fetchGraphQl(REMOVE_CUSTOMER_ADDRESS, {\n method: 'POST',\n variables: { id: addressId },\n })\n .then((response: RemoveCustomerAddressResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n return response.data.deleteCustomerAddress;\n })\n .catch(handleNetworkError);\n};\n"],"names":["setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","GET_ATTRIBUTES_FORM","GET_ATTRIBUTES_FORM_SHORT","handleNetworkError","error","events","handleFetchError","errors","errorMessage","e","convertToCamelCase","key","_","letter","convertToSnakeCase","convertKeysCase","data","type","dictionary","typeList","callback","element","acc","value","newKey","cloneArrayIfExists","fields","multilineItems","i","newItem","transformCustomUpperCode","code","transformOptions","item","_a","el","transformAttributesForm","response","items","_b","_c","other","isDefaultCode","a","b","expandArraysInObject","inputObject","flattenedAttributes","index","transformFullName","address","transformIds","transformContacts","transformSingleAddress","addressData","transformMultipleAddresses","addresses","transformCountries","countries","storeConfig","countriesWithRequiredRegion","optionalZipCountries","two_letter_abbreviation","full_name_locale","country","available_regions","hasRegions","getAttributesForm","formCode","sessionStorageKey","sessionStorageCache","transformedData","CREATE_CUSTOMER_ADDRESS","createCustomerAddress","created","GET_CUSTOMER_ADDRESS","getCustomerAddress","GET_COUNTRIES_QUERY","getCountries","UPDATE_CUSTOMER_ADDRESS","updateCustomerAddress","forms","addressId","REMOVE_CUSTOMER_ADDRESS","removeCustomerAddress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EAAY+B,EAElC,OAAKC,EAEE,MAAMpF,EAAaiF,EAAyB,CACjD,OAAQ,OACR,UAAW,CACT,GAAI,OAAOG,CAAS,EACpB,MAAOnE,EAAgBmC,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,OAAe5B,EAAiB+B,EAAS,MAAM,IAE7DG,GAAAD,EAAAF,GAAA,YAAAA,EAAU,OAAV,YAAAE,EAAgB,wBAAhB,YAAAC,EAAuC,YAAa,EAC7D,CAAC,EACA,MAAMrC,CAAkB,EAnBJ,EAoBzB,ECrCagF,EAAwC;AAAA;AAAA;AAAA;AAAA,ECMxCC,EAAwB,MACnCF,GAEO,MAAMpF,EAAaqF,EAAyB,CACjD,OAAQ,OACR,UAAW,CAAE,GAAID,CAAA,CAAU,CAC5B,EACE,KAAM7C,GAA4C,OACjD,OAAIH,EAAAG,EAAS,SAAT,MAAAH,EAAiB,OAAe5B,EAAiB+B,EAAS,MAAM,EAE7DA,EAAS,KAAK,qBACvB,CAAC,EACA,MAAMlC,CAAkB"}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@dropins/storefront-account", "version": "3.1.0
|
|
1
|
+
{"name": "@dropins/storefront-account", "version": "3.1.0", "@dropins/tools": "~1.7.0", "license": "SEE LICENSE IN LICENSE.md"}
|
|
@@ -18,12 +18,17 @@ export interface CreateCustomerAddressResponse {
|
|
|
18
18
|
data: {
|
|
19
19
|
createCustomerAddress: {
|
|
20
20
|
firstname: string;
|
|
21
|
+
uid: string;
|
|
21
22
|
};
|
|
22
23
|
};
|
|
23
24
|
errors?: {
|
|
24
25
|
message: string;
|
|
25
26
|
}[];
|
|
26
27
|
}
|
|
28
|
+
export interface CreateCustomerAddressResult {
|
|
29
|
+
firstname: string;
|
|
30
|
+
uid: string;
|
|
31
|
+
}
|
|
27
32
|
interface Region {
|
|
28
33
|
region_id: number;
|
|
29
34
|
region: string;
|