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G,KACjDT,EAAe3N,OAAS,IACxB4N,GAAwB,IAAID,EAAeS,MAAM,EAAG,SAKpEX,EAAcG,MACX,CAGCH,EAFa,aACJ5J,KAAKxC,GACAA,EAEAA,EAAM+M,MAAM,GAAI,QAGnC,GAAa,YAAT/L,QAAgCE,IAAVlB,EAAqB,CAG9CoM,EAFiB,oBACJ5J,KAAKxC,GACJA,EAEAA,EAAM+M,MAAM,GAAI,GAGtC,OACI/F,EAAAA,cAAA,QAAAP,OAAAqB,OAAA,CACI9G,KAAMA,EACN5F,GAAI+L,EACJF,UAAW,GAAGA,YAAoBA,YAAoB9C,IACtDA,KAAMA,EACNoD,UAAW4E,EACXnM,MAAgB,UAATgB,GAA6B,YAATA,EAAqBoL,EAAcpM,EAC9DiN,YAC+B,QAA3BrE,EACiC,QAA3BA,EACa,YAAT5H,EACI,QACS,UAATA,EACA,kBACA,GACK,YAATA,EACA,OACS,UAATA,EACA,iBACA,GACK,YAATA,EACA,QACS,UAATA,EACA,iBACA,GAEV0D,UAAoB,YAAT1D,EAAqB,GAAKqL,GAChChF,GAAwB,GACzBO,EAAU,CACdH,SAAUA","sources":["webpack://Msdyn365.Commerce.Online/./src/actions/get-address-purposes.ts?3461","webpack://Msdyn365.Commerce.Online/./src/actions/get-state-provinces.ts?a6ba","webpack://Msdyn365.Commerce.Online/./src/common/address-common.ts?e30a","webpack://Msdyn365.Commerce.Online/./src/common/address-format.data.ts?f2e7","webpack://Msdyn365.Commerce.Online/./src/common/address-format.ts?b845","webpack://Msdyn365.Commerce.Online/./src/common/address-meta-data.ts?c0c5","webpack://Msdyn365.Commerce.Online/./src/common/address-module.data.ts?1c51","webpack://Msdyn365.Commerce.Online/./src/common/components/address-alert.tsx?e0a2","webpack://Msdyn365.Commerce.Online/./src/common/components/address-checkbox.tsx?a2d4","webpack://Msdyn365.Commerce.Online/./src/common/components/address-dropdown.tsx?34b0","webpack://Msdyn365.Commerce.Online/./src/common/components/address-label.tsx?1e7b","webpack://Msdyn365.Commerce.Online/./src/common/components/address-add.tsx?876e","webpack://Msdyn365.Commerce.Online/./src/common/components/address-button.tsx?ce28","webpack://Msdyn365.Commerce.Online/./src/common/components/address-error-message.tsx?73f9","webpack://Msdyn365.Commerce.Online/./src/common/components/address-error-title.tsx?b6f8","webpack://Msdyn365.Commerce.Online/./src/common/components/address-input.tsx?2742"],"sourcesContent":["/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n IAny,\r\n ICommerceApiSettings,\r\n ICreateActionContext,\r\n IGeneric\r\n} from '@msdyn365-commerce/core';\r\nimport { getAddressPurposesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\r\nimport { AddressPurpose } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport { buildCacheKey, QueryResultSettingsProxy } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\n/**\r\n * Input class for get Address Purposes data action.\r\n */\r\nexport class GetAddressPurposesInput implements IActionInput {\r\n private readonly apiSettings: ICommerceApiSettings;\r\n\r\n constructor(apiSettings: ICommerceApiSettings) {\r\n this.apiSettings = apiSettings;\r\n }\r\n\r\n public getCacheKey = () => buildCacheKey('AddressPurpose', this.apiSettings);\r\n\r\n public getCacheObjectType = () => 'AddressPurpose';\r\n\r\n public dataCacheType = (): CacheType => 'application';\r\n}\r\n\r\n/**\r\n * Creates the input required to make the retail api call.\r\n * @param inputData\r\n */\r\nconst createInput = (inputData: ICreateActionContext>): GetAddressPurposesInput => {\r\n return new GetAddressPurposesInput(inputData.requestContext.apiSettings);\r\n};\r\n\r\nexport async function getAddressPurposesAction(input: GetAddressPurposesInput, ctx: IActionContext): Promise {\r\n return getAddressPurposesAsync({\r\n callerContext: ctx,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\r\n });\r\n}\r\n\r\nexport const getAddressPurposesActionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/address/get-address-purposes',\r\n action: >getAddressPurposesAction,\r\n input: createInput\r\n});\r\n\r\nexport default getAddressPurposesActionDataAction;\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n ICommerceApiSettings\r\n} from '@msdyn365-commerce/core';\r\nimport { getStateProvincesAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\r\nimport { StateProvinceInfo } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport { buildCacheKey, QueryResultSettingsProxy } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\n/**\r\n * Input class for get state provinces data action.\r\n */\r\nexport class GetStateProvincesInput implements IActionInput {\r\n public countryRegionId: string;\r\n\r\n private readonly apiSettings: ICommerceApiSettings;\r\n\r\n constructor(countryRegionId: string, apiSettings: ICommerceApiSettings) {\r\n this.countryRegionId = countryRegionId;\r\n this.apiSettings = apiSettings;\r\n }\r\n\r\n public getCacheKey = () => buildCacheKey(`StateProvinceInfo-${this.countryRegionId}`, this.apiSettings);\r\n\r\n public getCacheObjectType = () => 'StateProvinceInfo';\r\n\r\n public dataCacheType = (): CacheType => 'request';\r\n}\r\n\r\nexport async function getStateProvinceAction(input: GetStateProvincesInput, ctx: IActionContext): Promise {\r\n return getStateProvincesAsync(\r\n {\r\n callerContext: ctx,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx)\r\n },\r\n input.countryRegionId\r\n );\r\n}\r\n\r\nexport const getStateProvinceActionDataAction = createObservableDataAction({\r\n action: >getStateProvinceAction\r\n});\r\n\r\nexport default getStateProvinceActionDataAction;\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport { IActionInput, ICoreContext, IObservableAction, ITelemetry } from '@msdyn365-commerce/core';\r\nimport {\r\n Address,\r\n AddressPurpose,\r\n CountryRegionInfo,\r\n StateProvinceInfo\r\n} from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport {\r\n addAddress,\r\n AddressManagementInput,\r\n ArrayExtensions,\r\n updateAddress,\r\n updatePrimaryAddress\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nimport { getAddressPurposesAction, GetAddressPurposesInput } from '../actions/get-address-purposes';\r\nimport { getStateProvinceAction, GetStateProvincesInput } from '../actions/get-state-provinces';\r\n// import { IAddressResource, IAddressResponse } from './address-module.data';\r\nimport { IAddressResource, IAddressResponse } from '../common/address-module.data';\r\n\r\n/**\r\n *\r\n * Address common.\r\n */\r\nexport class AddressCommon {\r\n private readonly context: ICoreContext;\r\n\r\n private readonly resources: IAddressResource;\r\n\r\n private readonly telemetry: ITelemetry;\r\n\r\n constructor(context: ICoreContext, resources: IAddressResource, telemetry: ITelemetry) {\r\n this.context = context;\r\n this.resources = resources;\r\n this.telemetry = telemetry;\r\n }\r\n\r\n public getDefaultCountryRegionId = (countryRegionId: string, countryRegions: CountryRegionInfo[], market?: string): string => {\r\n const marketISOCode = market || 'US';\r\n const currentCountryRegion = countryRegions.find(countryRegion => (countryRegion.ISOCode || '') === marketISOCode);\r\n return (currentCountryRegion && currentCountryRegion.CountryRegionId) || countryRegionId;\r\n };\r\n\r\n public parseRetailException = (resources: IAddressResource): IAddressResponse => {\r\n return {\r\n errorTitle: resources.addressErrorMessageTitle,\r\n errorMessage: resources.addressGenericErrorMessage\r\n };\r\n };\r\n\r\n public isAuthenticatedFlow = (): boolean => {\r\n return this.context.request.user.isAuthenticated;\r\n };\r\n\r\n public getStateProvinces = async (countryRegionId: string): Promise => {\r\n let response: StateProvinceInfo[] = [];\r\n if (this.context && this.context.actionContext) {\r\n try {\r\n const input = new GetStateProvincesInput(countryRegionId, this.context.request.apiSettings);\r\n response = await getStateProvinceAction(input, this.context.actionContext);\r\n } catch (error) {\r\n if (this.telemetry) {\r\n this.telemetry.error(`Error encountered ${error}`);\r\n this.telemetry.debug('Unable to get state provinces');\r\n }\r\n }\r\n }\r\n return Promise.resolve(response);\r\n };\r\n\r\n // For any address, check for common requried field else treat it as invalid\\empty address.\r\n public isEmpty = (address: Address): boolean => {\r\n if (address && address.ThreeLetterISORegionName && (address.State || address.City)) {\r\n return false;\r\n }\r\n\r\n return true;\r\n };\r\n\r\n public addCustomerAddress = async (address: Address): Promise => {\r\n await this.updateLogisticsLocationRoleRecordId(address);\r\n return this.submitCustomerAddress(addAddress, address);\r\n };\r\n\r\n public updateCustomerAddress = async (address: Address): Promise => {\r\n await this.updateLogisticsLocationRoleRecordId(address);\r\n return this.submitCustomerAddress(updateAddress, address);\r\n };\r\n\r\n public updateCustomerPrimaryAddress = async (address: Address): Promise => {\r\n return this.submitCustomerAddress(updatePrimaryAddress, address);\r\n };\r\n\r\n private readonly submitCustomerAddress = async (\r\n addressAction: IObservableAction,\r\n address: Address\r\n ): Promise => {\r\n address.AddressTypeValue = address.AddressTypeValue || 7; // 7 sets it to HOME by default\r\n\r\n const input = new AddressManagementInput(address);\r\n return this.execAddressAction(addressAction, input, address);\r\n };\r\n\r\n private readonly execAddressAction = async (\r\n addressAction: IObservableAction,\r\n input: IActionInput | IActionInput[],\r\n address: Address\r\n ): Promise => {\r\n let response: IAddressResponse = {};\r\n\r\n if (this.context && this.context.actionContext) {\r\n try {\r\n const addresses = await addressAction(input, this.context.actionContext);\r\n if (addresses.length > 0) {\r\n response.address = address.RecordId ? address : addresses[addresses.length - 1];\r\n } else {\r\n response.address = address;\r\n }\r\n response.customerAddresses = addresses;\r\n } catch (error) {\r\n if (this.telemetry) {\r\n this.telemetry.error(`Error encountered ${error}`);\r\n this.telemetry.debug('Unable to exec address action');\r\n }\r\n response = this.parseRetailException(this.resources);\r\n }\r\n }\r\n return Promise.resolve(response);\r\n };\r\n\r\n /**\r\n * Function to get the address purposes and update the LogisticsLocationRoleRecordId to update the address type.\r\n * @param address - Address object.\r\n * @returns Returns void.\r\n */\r\n private readonly updateLogisticsLocationRoleRecordId = async (address: Address): Promise => {\r\n let addressPurposes: AddressPurpose[] = [];\r\n try {\r\n const input: GetAddressPurposesInput = new GetAddressPurposesInput(this.context.request.apiSettings);\r\n addressPurposes = await getAddressPurposesAction(input, this.context.actionContext);\r\n } catch (error) {\r\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions -- Supparsing the any type for error.\r\n this.telemetry.error(`Error encountered ${error}`);\r\n this.telemetry.debug('Unable to get address purposes');\r\n }\r\n if (ArrayExtensions.hasElements(addressPurposes)) {\r\n const addressPurpose: AddressPurpose | undefined = addressPurposes.find(\r\n purpose => purpose.AddressType === address.AddressTypeValue\r\n );\r\n if (addressPurpose) {\r\n address.LogisticsLocationRoleRecordId = addressPurpose.RecordId;\r\n }\r\n }\r\n };\r\n}\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nexport enum AddressItemDisplayType {\r\n Input = 'Input',\r\n Dropdown = 'Dropdown',\r\n Checkbox = 'Checkbox',\r\n Number = 'number' // VSI Customization for phone number\r\n}\r\n\r\nexport enum AddressValidationRuleType {\r\n Required = 'Required',\r\n Format = 'Format'\r\n}\r\n\r\nexport enum AddressItemType {\r\n Name = 1001,\r\n Phone = 1002,\r\n IsPrimary = 1003,\r\n AddressTypeValue = 1004,\r\n ZipCode = 1,\r\n City = 2,\r\n County = 3,\r\n State = 4,\r\n ThreeLetterISORegionName = 5,\r\n Street = 6,\r\n DistrictName = 7,\r\n StreetNumber = 8,\r\n BuildingCompliment = 9,\r\n Postbox = 10,\r\n House_RU = 21,\r\n Flat_RU = 22,\r\n CountryOKSMCode_RU = 23\r\n}\r\n\r\nexport interface IAddressItem {\r\n name: string;\r\n type: AddressItemType;\r\n label: string;\r\n maxLength: number;\r\n displayType: AddressItemDisplayType;\r\n validationRules?: IAddressValidationRule[];\r\n isNewLine: boolean;\r\n}\r\n\r\nexport interface IAddressValidationRule {\r\n type: AddressValidationRuleType;\r\n regEx: string;\r\n message: string;\r\n}\r\n\r\nexport interface IAddressDropdownsData {\r\n [index: string]: { key?: string | number; value?: string }[];\r\n}\r\n\r\n// tslint:disable-next-line: no-empty-interface\r\nexport interface IAddressFormatData {}\r\n","/* eslint-disable security/detect-non-literal-regexp */\r\n/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport {\r\n Address,\r\n AddressPurpose,\r\n CountryRegionInfo,\r\n StateProvinceInfo\r\n} from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport { get, set } from 'mobx';\r\n\r\nimport { AddressItemType, IAddressDropdownsData, IAddressItem, IAddressValidationRule } from '../common/address-format.data';\r\nimport { AddressMetaData } from '../common/address-meta-data';\r\n/**\r\n *\r\n * Retail Service Address format parser.\r\n */\r\nexport class AddressFormat {\r\n private readonly countryRegionsInfo?: CountryRegionInfo[];\r\n\r\n private readonly addressPurposes?: AddressPurpose[];\r\n\r\n private readonly addressMetaData: AddressMetaData;\r\n\r\n constructor(countryRegionsInfo: CountryRegionInfo[], addressMetaData: AddressMetaData, addressPurposes: AddressPurpose[]) {\r\n this.countryRegionsInfo = countryRegionsInfo;\r\n this.addressMetaData = addressMetaData;\r\n this.addressPurposes = addressPurposes;\r\n }\r\n\r\n public getAddressFormat(countryRegionId: string): IAddressItem[] {\r\n const countryRegionInfo = this._getCountryRegionInfo(countryRegionId);\r\n if (countryRegionInfo) {\r\n return this._getAddressDisplayFormat(countryRegionInfo);\r\n }\r\n return [];\r\n }\r\n\r\n public getCountryFormat(): { key?: string; value?: string }[] {\r\n return (this.countryRegionsInfo || []).map(countryRegion => {\r\n return {\r\n key: countryRegion.CountryRegionId,\r\n value: countryRegion.ShortName\r\n };\r\n });\r\n }\r\n\r\n public getStateFormat(stateProvinceInfo?: StateProvinceInfo[]): { key?: string; value?: string }[] {\r\n return (stateProvinceInfo || []).map(state => {\r\n return {\r\n key: state.StateId,\r\n value: state.StateName\r\n };\r\n });\r\n }\r\n\r\n public getAddressTypeFormat(): { key?: number; value?: string }[] {\r\n return (this.addressPurposes || []).map(addressPurpose => {\r\n return {\r\n key: addressPurpose.AddressType,\r\n value: addressPurpose.Name\r\n };\r\n });\r\n }\r\n\r\n public getPrefilledAddressDropdownData = (\r\n stateDefaultSelectionText: string,\r\n stateProvinceInfo?: StateProvinceInfo[]\r\n ): IAddressDropdownsData => {\r\n const defaultStateText = {\r\n key: '',\r\n value: stateDefaultSelectionText\r\n };\r\n const dropdownData: IAddressDropdownsData = {};\r\n\r\n dropdownData[AddressItemType[AddressItemType.ThreeLetterISORegionName]] = this.getCountryFormat();\r\n dropdownData[AddressItemType[AddressItemType.State]] = this.getStateFormat(stateProvinceInfo);\r\n dropdownData[AddressItemType[AddressItemType.State]].unshift(defaultStateText);\r\n dropdownData[AddressItemType[AddressItemType.AddressTypeValue]] = this.getAddressTypeFormat();\r\n\r\n return dropdownData;\r\n };\r\n\r\n public getTwoLetterISORegionName = (countryRegionId: string): string | undefined => {\r\n const countryRegionInfo = this._getCountryRegionInfo(countryRegionId);\r\n\r\n return countryRegionInfo!.ISOCode;\r\n };\r\n\r\n public validateAddressFormat = (\r\n address: Address,\r\n validationError: Address,\r\n countryRegionId: string,\r\n propertyName?: string\r\n ): boolean => {\r\n let isValid: boolean = true;\r\n let validationtor;\r\n const addressFormat = this.getAddressFormat(address.ThreeLetterISORegionName || countryRegionId);\r\n\r\n addressFormat.forEach(addressFormatItem => {\r\n if (!propertyName || (propertyName && addressFormatItem.name === propertyName)) {\r\n validationtor = this._inputValidation(addressFormatItem, validationError, address);\r\n if (validationtor !== undefined) {\r\n isValid = validationtor;\r\n }\r\n }\r\n });\r\n\r\n return isValid;\r\n };\r\n\r\n public getTranformedAddress = (result: Microsoft.Maps.ISuggestionResult, stateProvinceInfo?: StateProvinceInfo[]): Address => {\r\n const address: Address = {};\r\n\r\n // Zip Code\r\n if (result.address.postalCode !== undefined) {\r\n address.ZipCode = result.address.postalCode;\r\n } else {\r\n address.ZipCode = '';\r\n }\r\n\r\n // State\r\n if (stateProvinceInfo) {\r\n const selectedState = stateProvinceInfo.find(state => state.StateName === result.address.adminDistrict);\r\n if (!selectedState) {\r\n address.State = '';\r\n address.StateName = result.address.adminDistrict;\r\n } else {\r\n address.State = selectedState.StateId;\r\n address.StateName = selectedState.StateName;\r\n }\r\n }\r\n\r\n // Street\r\n if (result.address.addressLine !== undefined) {\r\n address.Street = result.address.addressLine;\r\n } else {\r\n address.Street = ' ';\r\n }\r\n\r\n // City\r\n if (result.address.locality !== undefined) {\r\n address.City = result.address.locality;\r\n } else {\r\n address.City = '';\r\n }\r\n\r\n // District\r\n if (result.address.district !== undefined) {\r\n address.DistrictName = result.address.district;\r\n address.CountyName = result.address.district;\r\n } else {\r\n address.DistrictName = '';\r\n }\r\n\r\n // Formatted Address\r\n address.FullAddress = result.address.formattedAddress;\r\n\r\n return address;\r\n };\r\n\r\n private _inputValidation(addressFormatItem: IAddressItem, validationError: Address, address: Address): boolean | undefined {\r\n set(validationError, { [addressFormatItem.name]: null });\r\n for (const validationRule of addressFormatItem.validationRules || []) {\r\n if (!this._validateRegEx(address, addressFormatItem.name, validationRule)) {\r\n set(validationError, { [addressFormatItem.name]: validationRule.message });\r\n return false;\r\n }\r\n }\r\n return undefined;\r\n }\r\n\r\n private readonly _validateRegEx = (address: Address, propertyName: string, validationRule: IAddressValidationRule): boolean => {\r\n if (validationRule.regEx && validationRule.regEx.length > 0) {\r\n const regex = new RegExp(validationRule.regEx);\r\n return regex.test((get(address, propertyName) as string) || '');\r\n }\r\n return true;\r\n };\r\n\r\n private _getCountryRegionInfo(countryRegionId: string): CountryRegionInfo | undefined {\r\n return (this.countryRegionsInfo || []).find(countryRegion => {\r\n return (countryRegion.CountryRegionId || '').toLowerCase() === countryRegionId.toLowerCase();\r\n });\r\n }\r\n\r\n private _getAddressDisplayFormat(countryRegionInfo: CountryRegionInfo): IAddressItem[] {\r\n const addressDisplayItem: IAddressItem[] = [];\r\n\r\n if (countryRegionInfo && countryRegionInfo.AddressFormatLines) {\r\n const AddressTypeItem = this._extendAddressDisplayFormat(AddressItemType.AddressTypeValue, true);\r\n if (AddressTypeItem) {\r\n addressDisplayItem.push(AddressTypeItem);\r\n }\r\n\r\n const nameDisplayItem = this._extendAddressDisplayFormat(AddressItemType.Name, true);\r\n if (nameDisplayItem) {\r\n addressDisplayItem.push(nameDisplayItem);\r\n }\r\n\r\n countryRegionInfo.AddressFormatLines.forEach(formatLine => {\r\n if (formatLine.AddressComponentNameValue) {\r\n const addressItem = this.addressMetaData.getItemFormat(formatLine.AddressComponentNameValue);\r\n if (addressItem) {\r\n addressItem.isNewLine = formatLine.NewLine || false;\r\n addressDisplayItem.push(addressItem);\r\n }\r\n }\r\n });\r\n\r\n const phoneDisplayItem = this._extendAddressDisplayFormat(AddressItemType.Phone, false);\r\n if (phoneDisplayItem) {\r\n addressDisplayItem.push(phoneDisplayItem);\r\n }\r\n\r\n const isPrimaryDisplayItem = this._extendAddressDisplayFormat(AddressItemType.IsPrimary, false);\r\n if (isPrimaryDisplayItem) {\r\n addressDisplayItem.push(isPrimaryDisplayItem);\r\n }\r\n }\r\n\r\n return addressDisplayItem;\r\n }\r\n\r\n private _extendAddressDisplayFormat(type: AddressItemType, isNewLine: boolean): IAddressItem | undefined {\r\n const addressItem = this.addressMetaData.getItemFormat(type);\r\n if (addressItem) {\r\n addressItem.isNewLine = isNewLine;\r\n }\r\n return addressItem;\r\n }\r\n}\r\n","/* eslint-disable security/detect-object-injection */\r\n/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\n// import { PhoneRegex } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { PhoneRegex } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nimport {\r\n AddressItemDisplayType,\r\n AddressItemType,\r\n AddressValidationRuleType,\r\n IAddressItem,\r\n IAddressValidationRule\r\n} from '../common/address-format.data';\r\nimport { IAddressResource } from '../common/address-module.data';\r\n\r\n/**\r\n * Address meta data.\r\n */\r\nexport class AddressMetaData {\r\n private readonly metaData: IAddressItem[] = [];\r\n\r\n private readonly resources: IAddressResource;\r\n\r\n private readonly requiredFieldRegEx: string = '\\\\S';\r\n\r\n private readonly resourcesPrefix: string = 'address';\r\n\r\n private readonly maxLength: number = 64;\r\n\r\n private readonly requiredFields: AddressItemType[];\r\n\r\n private readonly excludedTypes: AddressItemType[];\r\n\r\n constructor(resources: IAddressResource, excluded?: AddressItemType[], required?: AddressItemType[]) {\r\n this.resources = resources || {};\r\n this.excludedTypes = excluded || [];\r\n this.requiredFields =\r\n required !== undefined\r\n ? required\r\n : [\r\n AddressItemType.Name,\r\n AddressItemType.ZipCode,\r\n AddressItemType.City,\r\n AddressItemType.State,\r\n AddressItemType.ThreeLetterISORegionName,\r\n AddressItemType.Street,\r\n AddressItemType.Phone\r\n ];\r\n this._init();\r\n }\r\n\r\n public getItemFormat(id: number): IAddressItem | undefined {\r\n return this.metaData.find(item => {\r\n return item.type === id;\r\n });\r\n }\r\n\r\n private _init(): void {\r\n this._addItem(AddressItemType.Name, AddressItemDisplayType.Input);\r\n this._addItem(AddressItemType.Phone, AddressItemDisplayType.Input, PhoneRegex.defaultRegex); // VSI Customization for phone number and change error message from resources. Account management address, Buisness Account address, checkout shipping address.\r\n this._addItem(AddressItemType.ZipCode, AddressItemDisplayType.Input);\r\n this._addItem(AddressItemType.City, AddressItemDisplayType.Input);\r\n this._addItem(AddressItemType.County, AddressItemDisplayType.Input);\r\n this._addItem(AddressItemType.State, AddressItemDisplayType.Dropdown);\r\n this._addItem(AddressItemType.ThreeLetterISORegionName, AddressItemDisplayType.Dropdown);\r\n this._addItem(AddressItemType.Street, AddressItemDisplayType.Input);\r\n this._addItem(AddressItemType.DistrictName, AddressItemDisplayType.Input);\r\n this._addItem(AddressItemType.StreetNumber, AddressItemDisplayType.Input);\r\n this._addItem(AddressItemType.BuildingCompliment, AddressItemDisplayType.Input);\r\n this._addItem(AddressItemType.Postbox, AddressItemDisplayType.Input);\r\n this._addItem(AddressItemType.House_RU, AddressItemDisplayType.Input);\r\n this._addItem(AddressItemType.Flat_RU, AddressItemDisplayType.Input);\r\n this._addItem(AddressItemType.CountryOKSMCode_RU, AddressItemDisplayType.Input);\r\n this._addItem(AddressItemType.AddressTypeValue, AddressItemDisplayType.Dropdown);\r\n this._addItem(AddressItemType.IsPrimary, AddressItemDisplayType.Checkbox);\r\n }\r\n\r\n private _addItem(type: AddressItemType, displayType: AddressItemDisplayType, format?: string): void {\r\n if (this.excludedTypes.includes(type)) {\r\n return;\r\n }\r\n const nameKey = AddressItemType[type].replace('_', '');\r\n\r\n // Find out if currentItem is required field\r\n const validationRules = this._validationRules(type, nameKey, format);\r\n const isRequired = validationRules.some(rule => rule.type === AddressValidationRuleType.Required);\r\n\r\n // If no optional string is provided in resource file, use the original label text\r\n const optionalString =\r\n this.resources[`${this.resourcesPrefix}${nameKey}LabelOptional`] || this.resources[`${this.resourcesPrefix}${nameKey}Label`];\r\n const item: IAddressItem = {\r\n type,\r\n displayType,\r\n name: AddressItemType[type],\r\n label: isRequired ? this.resources[`${this.resourcesPrefix}${nameKey}Label`] : optionalString,\r\n maxLength: type === 1002 ? 11 : this.maxLength,\r\n validationRules,\r\n isNewLine: true\r\n };\r\n this.metaData.push(item);\r\n }\r\n\r\n private _validationRules(type: AddressItemType, name: string, format?: string): IAddressValidationRule[] {\r\n const validationRules: IAddressValidationRule[] = [];\r\n\r\n for (const ruleType of Object.keys(AddressValidationRuleType)) {\r\n const key = `${this.resourcesPrefix}${name}${ruleType}`;\r\n const message: string = this.resources[`${key}ErrorMessage`];\r\n switch (ruleType) {\r\n case AddressValidationRuleType.Required: {\r\n if (this.requiredFields.find((itemType: AddressItemType) => itemType === type)) {\r\n validationRules.push(this._validationRule(ruleType, this.requiredFieldRegEx, message));\r\n }\r\n break;\r\n }\r\n case AddressValidationRuleType.Format: {\r\n validationRules.push(this._validationRule(ruleType, format!, message));\r\n break;\r\n }\r\n default:\r\n }\r\n }\r\n return validationRules;\r\n }\r\n\r\n private _validationRule(type: AddressValidationRuleType, regEx: string, message: string): IAddressValidationRule {\r\n return {\r\n type,\r\n regEx,\r\n message\r\n };\r\n }\r\n}\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport { Address } from '@msdyn365-commerce/retail-proxy';\r\nimport { Heading } from '@msdyn365-commerce-modules/data-types';\r\n\r\nexport enum AddressOperation {\r\n Add = 'Add',\r\n Show = 'Show',\r\n Update = 'Update',\r\n List = 'List'\r\n}\r\n\r\nexport enum AddressType {\r\n Shipping = 'Shipping',\r\n Billing = 'Billing',\r\n Invoice = 'Invoice',\r\n Company = 'Company'\r\n}\r\n\r\nexport interface IDropdownDisplayData {\r\n [index: string]: { key?: string; value?: string }[];\r\n}\r\n\r\nexport interface IAddressResponse {\r\n errorTitle?: string;\r\n errorMessage?: string;\r\n customerAddresses?: Address[];\r\n address?: Address;\r\n}\r\n\r\nexport interface IAddressConfig {\r\n heading?: Heading;\r\n primaryAddressSectionHeading?: Heading;\r\n otherAddressSectionHeading?: Heading;\r\n addAddressHeading?: Heading;\r\n editAddressHeading?: Heading;\r\n}\r\n\r\nexport interface IAddressResource {\r\n addressChangeCheckboxAriaLabel: string;\r\n addressAddButtonText: string;\r\n addressAddButtonAriaLabel: string;\r\n addressPrimaryButtonText: string;\r\n addressPrimaryButtonAriaLabel: string;\r\n addressEditButtonText: string;\r\n addressEditButtonAriaLabel: string;\r\n addressRemoveButtonText: string;\r\n addressRemoveButtonAriaLabel: string;\r\n addressSaveButtonText: string;\r\n addressSaveButtonAriaLabel: string;\r\n addressCancelButtonText: string;\r\n addressCancelButtonAriaLabel: string;\r\n addressStateDefaultSelectionText: string;\r\n addressNameLabel: string;\r\n addressNameLabelOptional?: string;\r\n addressNameRequiredErrorMessage: string;\r\n addressPhoneLabel: string;\r\n addressPhoneLabelOptional?: string;\r\n addressPhoneRequiredErrorMessage: string;\r\n addressZipCodeLabel: string;\r\n addressZipCodeLabelOptional?: string;\r\n addressZipCodeRequiredErrorMessage: string;\r\n addressCityLabel: string;\r\n addressCityLabelOptional?: string;\r\n addressCityRequiredErrorMessage: string;\r\n addressCountyLabel: string;\r\n addressCountyLabelOptional?: string;\r\n addressCountyRequiredErrorMessage: string;\r\n addressStateLabel: string;\r\n addressStateLabelOptional?: string;\r\n addressStateRequiredErrorMessage: string;\r\n addressThreeLetterISORegionNameLabel: string;\r\n addressThreeLetterISORegionNameLabelOptional?: string;\r\n addressThreeLetterISORegionNameRequiredErrorMessage: string;\r\n addressStreetRequiredErrorMessage: string;\r\n addressDistrictLabel: string;\r\n addressDistrictLabelOptional?: string;\r\n addressDistrictNameLabel: string;\r\n addressDistrictNameLabelOptional?: string;\r\n addressDistrictRequiredErrorMessage: string;\r\n addressStreetNumberLabel: string;\r\n addressStreetNumberLabelOptional?: string;\r\n addressStreetNumberRequiredErrorMessage: string;\r\n addressBuildingComplimentLabel: string;\r\n addressBuildingComplimentLabelOptional?: string;\r\n addressBuildingComplimentRequiredErrorMessage: string;\r\n addressPostboxLabel: string;\r\n addressPostboxLabelOptional?: string;\r\n addressPostboxRequiredErrorMessage: string;\r\n addressHouseRULabel: string;\r\n addressHouseRULabelOptional?: string;\r\n addressHouseRURequiredErrorMessage: string;\r\n addressFlatRULabel: string;\r\n addressFlatRULabelOptional?: string;\r\n addressFlatRURequiredErrorMessage: string;\r\n addressCountryOKSMCodeRULabel: string;\r\n addressCountryOKSMCodeRURequiredErrorMessage: string;\r\n addressErrorMessageTitle: string;\r\n addressGenericErrorMessage: string;\r\n addressEmptyListAddressMessage: string;\r\n removeAddressNotification?: string;\r\n}\r\n\r\n// tslint:disable-next-line: no-empty-interface\r\nexport interface IAddressModuleData {}\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport * as React from 'react';\r\n\r\nexport interface IAdressAlert {\r\n message?: string;\r\n}\r\n\r\n/**\r\n * Address alert.\r\n * @param props - Configuration of the functional component.\r\n * @returns React functional component.\r\n */\r\nexport const AddressAlertFunctionComponent: React.FC = (props: IAdressAlert) => {\r\n const message = props.message;\r\n return (\r\n \r\n {message && <>{message}}\r\n \r\n );\r\n};\r\n\r\nexport default AddressAlertFunctionComponent;\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport { getPayloadObject, getTelemetryAttributes, ITelemetryContent } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\n\r\nexport interface IAdressCheckbox {\r\n id?: string;\r\n name?: string;\r\n className: string;\r\n type: string;\r\n isChecked: boolean;\r\n autoFocus?: boolean;\r\n additionalAddributes?: object;\r\n telemetryContent?: ITelemetryContent;\r\n onChange(event: React.ChangeEvent): void;\r\n}\r\n\r\n/**\r\n * Address checkbox.\r\n * @param props - Configuration of the functional component.\r\n * @returns React functional component.\r\n */\r\nexport const AddressCheckboxFunctionComponent: React.FC = (props: IAdressCheckbox) => {\r\n const {\r\n id: itemId,\r\n name,\r\n className,\r\n type,\r\n isChecked,\r\n additionalAddributes,\r\n telemetryContent,\r\n autoFocus: shouldBeAutoFocused,\r\n onChange\r\n } = props;\r\n\r\n const payLoad = getPayloadObject('click', telemetryContent!, name!);\r\n const attributes = getTelemetryAttributes(telemetryContent!, payLoad);\r\n return (\r\n \r\n );\r\n};\r\n\r\nexport default AddressCheckboxFunctionComponent;\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport * as React from 'react';\r\n\r\nexport interface IAdressDropdown {\r\n id: string;\r\n name: string;\r\n className: string;\r\n value: string | number;\r\n additionalAddributes?: object;\r\n displayData: { key?: string | number; value?: string }[];\r\n onChange(event: React.ChangeEvent): void;\r\n}\r\n\r\nconst getDropdownItem = (key?: string | number, value?: string, selectedValue?: string | number): React.ReactNode => {\r\n let isSelected: boolean;\r\n if (typeof key === 'number') {\r\n isSelected = key === selectedValue;\r\n } else {\r\n isSelected = typeof selectedValue === 'string' && (key || '').toLowerCase() === (selectedValue || '').toLowerCase();\r\n }\r\n\r\n return (\r\n \r\n );\r\n};\r\n\r\n/**\r\n * Address dropdown.\r\n * @param props - Configuration of the functional component.\r\n * @returns React functional component.\r\n */\r\nexport const AddressDropdownFunctionComponent: React.FC = (props: IAdressDropdown) => {\r\n const { id: itemId, name, className, value, additionalAddributes, displayData, onChange } = props;\r\n\r\n return (\r\n \r\n {displayData && displayData.map(item => getDropdownItem(item.key, item.value, value))}\r\n \r\n );\r\n};\r\n\r\nexport default AddressDropdownFunctionComponent;\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport * as React from 'react';\r\n\r\nexport interface IAdressLabel {\r\n id: string;\r\n text: string;\r\n}\r\n\r\n/**\r\n * Address label.\r\n * @param props - Configuration of the functional component.\r\n * @returns React functional component.\r\n */\r\nexport const AddressLabelFunctionComponent: React.FC = (props: IAdressLabel) => {\r\n const { id: itemId, text } = props;\r\n\r\n return (\r\n \r\n );\r\n};\r\n\r\nexport default AddressLabelFunctionComponent;\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport { Address } from '@msdyn365-commerce/retail-proxy/dist/Entities/CommerceTypes.g';\r\nimport { Heading as HeadingData } from '@msdyn365-commerce-modules/data-types';\r\nimport { Heading, INodeProps, ITelemetryContent } from '@msdyn365-commerce-modules/utilities';\r\nimport classname from 'classnames';\r\nimport { get } from 'mobx';\r\nimport * as React from 'react';\r\n\r\nimport {\r\n AddressItemDisplayType,\r\n AddressItemType,\r\n AddressValidationRuleType,\r\n IAddressDropdownsData,\r\n IAddressItem,\r\n IAddressValidationRule\r\n} from '../address-format.data';\r\nimport { AddressType, IAddressResource, IAddressResponse } from '../address-module.data';\r\nimport AddressAlertComponent from './address-alert';\r\nimport AddressButtonComponent from './address-button';\r\nimport AdressCheckboxComponent from './address-checkbox';\r\nimport AdressDropdownComponent from './address-dropdown';\r\nimport AddressErrorMessageComponent from './address-error-message';\r\nimport AddressErrorTitleComponent from './address-error-title';\r\nimport AddressInputComponent from './address-input';\r\nimport AddressLabelComponent from './address-label';\r\n\r\nexport interface IAddressAddInputProps {\r\n isUpdating?: boolean;\r\n hasError?: boolean;\r\n hasExternalSubmitGroup?: boolean;\r\n addressType: AddressType;\r\n addressFormat: IAddressItem[];\r\n defaultCountryRegionId: string;\r\n defaultAddressType: number;\r\n selectedAddress?: Address;\r\n dropdownDisplayData: IAddressDropdownsData;\r\n resources: IAddressResource;\r\n addressActionResponse?: IAddressResponse;\r\n addAddressHeading?: HeadingData;\r\n editAddressHeading?: HeadingData;\r\n validationError?: object;\r\n telemetryContent?: ITelemetryContent;\r\n shouldAutoFocus?: boolean;\r\n onInputChange(event: React.ChangeEvent): void;\r\n onDropdownChange(event: React.ChangeEvent): void;\r\n onSave?(): void;\r\n onCancel?(): void;\r\n usSiteFlag: boolean;\r\n mexicoSiteFlag: boolean;\r\n}\r\n\r\nexport interface IAddressError {\r\n AddressError: INodeProps;\r\n title: React.ReactNode;\r\n message: React.ReactNode;\r\n}\r\n\r\nexport interface IAddressAddItem {\r\n key: string;\r\n AddressItem: INodeProps;\r\n label: React.ReactNode;\r\n alert: React.ReactNode;\r\n input: React.ReactNode;\r\n customAlert: React.ReactNode;\r\n customLabel?: React.ReactNode;\r\n}\r\n\r\nexport interface IAddressAddUpdateProps {\r\n AddressForm: INodeProps;\r\n heading: React.ReactNode;\r\n items: IAddressAddItem[];\r\n hasError: boolean;\r\n error: IAddressError;\r\n isShowSaveButton: boolean;\r\n saveButton: React.ReactNode;\r\n isShowCancelButton: boolean;\r\n cancelButton: React.ReactNode;\r\n usSiteFlag?: boolean;\r\n mexicoSiteFlag?: boolean;\r\n}\r\n\r\nconst getRequriedAttribute = (validationRules?: IAddressValidationRule[]): object => {\r\n const requriedRule = (validationRules || []).find(validationRule => {\r\n return validationRule.type === AddressValidationRuleType.Required;\r\n });\r\n\r\n return requriedRule ? { 'aria-required': true } : {};\r\n};\r\n\r\nconst getAddessItems = (selectedAddress: Address, props: IAddressAddInputProps): IAddressAddItem[] => {\r\n const {\r\n addressFormat,\r\n addressType,\r\n dropdownDisplayData,\r\n defaultCountryRegionId,\r\n defaultAddressType,\r\n validationError = {},\r\n onInputChange,\r\n onDropdownChange,\r\n shouldAutoFocus,\r\n usSiteFlag,\r\n mexicoSiteFlag\r\n } = props;\r\n return addressFormat.map((addressFormatItem, index) => {\r\n const elementId = `${addressType.toLowerCase()}_address${addressFormatItem.name.toLowerCase()}`;\r\n const errorMessage = get(validationError, addressFormatItem.name);\r\n const className = classname(\r\n 'msc-address-form__item',\r\n addressFormatItem.name === 'Phone' && usSiteFlag && 'us-phone-format',\r\n `msc-address-form__item-${addressFormatItem.name.toLowerCase()}`,\r\n {\r\n 'msc-address-form__item-newline': addressFormatItem.isNewLine,\r\n 'address-form__item-invalid': errorMessage\r\n }\r\n );\r\n let input;\r\n if (addressFormatItem.displayType === AddressItemDisplayType.Input) {\r\n input = (\r\n \r\n );\r\n }\r\n // VSI Customization for type number\r\n else if (addressFormatItem.displayType === AddressItemDisplayType.Number) {\r\n input = (\r\n \r\n );\r\n } else if (addressFormatItem.displayType === AddressItemDisplayType.Checkbox) {\r\n input = (\r\n \r\n );\r\n } else {\r\n const displayData = dropdownDisplayData[addressFormatItem.name];\r\n let selectedValue = selectedAddress[addressFormatItem.name];\r\n\r\n if (addressFormatItem.type === AddressItemType.ThreeLetterISORegionName) {\r\n selectedValue = selectedValue || defaultCountryRegionId;\r\n }\r\n\r\n if (addressFormatItem.type === AddressItemType.AddressTypeValue) {\r\n selectedValue = selectedValue || defaultAddressType;\r\n }\r\n\r\n input = (\r\n \r\n );\r\n }\r\n const zipcodeError = errorMessage?.replace('Post code', 'Zip Code');\r\n const postcodeError = errorMessage?.replace('Post code', 'Postal Code');\r\n return {\r\n key: addressFormatItem.name,\r\n AddressItem: { className, id: `${elementId}_container` },\r\n label: ,\r\n customLabel:\r\n addressFormatItem.name.toLowerCase() === 'zipcode' ? (\r\n \r\n ) : null,\r\n alert: (\r\n \r\n ),\r\n input,\r\n customAlert:\r\n addressFormatItem.name === 'ZipCode' && selectedAddress[addressFormatItem.name]?.length === 10 ? (\r\n \r\n ) : (\r\n returnAddressAlertComponent(addressFormatItem.name, selectedAddress[addressFormatItem.name], usSiteFlag, mexicoSiteFlag)\r\n )\r\n };\r\n });\r\n};\r\n\r\nconst returnAddressAlertComponent = (AddressName: string, value: string, usSiteFlag?: boolean, mexicoSiteFlag?: boolean) => {\r\n if (usSiteFlag) {\r\n if (AddressName === 'Phone' && (value?.length <= 12 || value?.length === 14)) {\r\n return (\r\n \r\n );\r\n } else {\r\n return null;\r\n }\r\n } else if (mexicoSiteFlag) {\r\n if (AddressName === 'Phone' && (value?.length <= 12 || value?.length === 15)) {\r\n return (\r\n \r\n );\r\n } else {\r\n return null;\r\n }\r\n } else {\r\n if (AddressName === 'Phone' && value?.length === 14) {\r\n return (\r\n \r\n );\r\n } else {\r\n return null;\r\n }\r\n }\r\n};\r\n\r\nexport const AddressAddUpdate = (props: IAddressAddInputProps): IAddressAddUpdateProps => {\r\n const {\r\n editAddressHeading,\r\n addAddressHeading,\r\n selectedAddress = {},\r\n resources,\r\n hasError,\r\n onCancel,\r\n onSave,\r\n hasExternalSubmitGroup,\r\n isUpdating,\r\n addressActionResponse,\r\n telemetryContent\r\n } = props;\r\n const heading = selectedAddress.RecordId ? editAddressHeading : addAddressHeading;\r\n return {\r\n AddressForm: { className: 'msc-address-form' },\r\n heading: heading && ,\r\n items: getAddessItems(selectedAddress, props),\r\n isShowSaveButton: !hasExternalSubmitGroup,\r\n saveButton: onSave && (\r\n \r\n ),\r\n isShowCancelButton: !hasExternalSubmitGroup,\r\n cancelButton: onCancel && (\r\n \r\n ),\r\n hasError: hasError || false,\r\n error: {\r\n AddressError: { className: 'msc-address-form__error' },\r\n title: addressActionResponse && addressActionResponse.errorTitle && ,\r\n message: addressActionResponse && addressActionResponse.errorMessage && (\r\n \r\n )\r\n }\r\n };\r\n};\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport { getPayloadObject, getTelemetryAttributes, ITelemetryContent } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\n\r\nexport interface IAddressButton {\r\n className: string;\r\n text: string;\r\n ariaLabel: string;\r\n disabled?: boolean;\r\n telemetryContent?: ITelemetryContent;\r\n role?: string;\r\n onClick(event: React.MouseEvent): void;\r\n}\r\n\r\n/**\r\n * Address button.\r\n * @param props - Configuration of the functional component.\r\n * @returns React functional component.\r\n */\r\nexport const AddressButtonFunctionComponent: React.FC = (props: IAddressButton) => {\r\n const { className, text, ariaLabel, disabled: isDisabled, telemetryContent, onClick, role } = props;\r\n const payLoad = getPayloadObject('click', telemetryContent!, text);\r\n const attributes = getTelemetryAttributes(telemetryContent!, payLoad);\r\n return (\r\n \r\n );\r\n};\r\n\r\nexport default AddressButtonFunctionComponent;\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport * as React from 'react';\r\n\r\nexport interface IAdressErrorMessage {\r\n message: string;\r\n}\r\n\r\n/**\r\n * Address error message.\r\n * @param props - Configuration of the functional component.\r\n * @returns React functional component.\r\n */\r\nexport const AddressErrorMessageFunctionComponent: React.FC = (props: IAdressErrorMessage) => {\r\n const { message } = props;\r\n\r\n return

{message}

;\r\n};\r\n\r\nexport default AddressErrorMessageFunctionComponent;\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport * as React from 'react';\r\n\r\nexport interface IAdressErrorTitle {\r\n title: string;\r\n}\r\n\r\n/**\r\n * Address error title.\r\n * @param props - Configuration of the functional component.\r\n * @returns React functional component.\r\n */\r\nexport const AddressErrorTitleFunctionComponent: React.FC = (props: IAdressErrorTitle) => {\r\n const { title } = props;\r\n\r\n return

{title}

;\r\n};\r\n\r\nexport default AddressErrorTitleFunctionComponent;\r\n","/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport { getPayloadObject, getTelemetryAttributes, ITelemetryContent } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\n\r\nexport interface IAdressInput {\r\n id?: string;\r\n name?: string;\r\n className: string;\r\n type: string;\r\n value: string;\r\n maxLength?: number;\r\n autoFocus?: boolean;\r\n additionalAddributes?: object;\r\n telemetryContent?: ITelemetryContent;\r\n onChange(event: React.ChangeEvent): void;\r\n defaultCountryRegionId?: string;\r\n usSiteFlag?: boolean;\r\n mexicoSiteFlag?: boolean;\r\n}\r\n\r\n/**\r\n * Address input.\r\n * @param props - Configuration of the functional component.\r\n * @returns React functional component.\r\n */\r\nexport const AddressInputFunctionComponent: React.FC = (props: IAdressInput) => {\r\n const {\r\n id: itemId,\r\n name,\r\n className,\r\n type,\r\n value,\r\n maxLength,\r\n additionalAddributes,\r\n autoFocus: shouldUseAutoFocus,\r\n telemetryContent,\r\n onChange,\r\n defaultCountryRegionId\r\n } = props;\r\n const usSiteFlag = props.usSiteFlag ? props.usSiteFlag : undefined;\r\n const mexicoSiteFlag = props.mexicoSiteFlag ? props.mexicoSiteFlag : undefined;\r\n const payLoad = getPayloadObject('click', telemetryContent!, name!);\r\n const attributes = getTelemetryAttributes(telemetryContent!, payLoad);\r\n //VSI customization for business-sign-up\r\n let numberValue = '';\r\n const customMaxLength = usSiteFlag && name === 'Phone' ? 14 : maxLength;\r\n if (name === 'Phone' && value !== undefined) {\r\n if (usSiteFlag) {\r\n const rawPhoneNumber = value.replace(/\\D/g, ''); // Remove non-numeric characters\r\n let formattedPhoneNumber = '';\r\n if (rawPhoneNumber.length >= 11) {\r\n formattedPhoneNumber = rawPhoneNumber.substring(1);\r\n formattedPhoneNumber = formattedPhoneNumber?.split(' ').join('');\r\n // Apply formatting\r\n const areaCode = formattedPhoneNumber?.slice(0, 3);\r\n const firstPart = formattedPhoneNumber?.slice(3, 6);\r\n const secondPart = formattedPhoneNumber?.slice(6);\r\n formattedPhoneNumber = `(${areaCode}) ${firstPart}-${secondPart}`;\r\n } else if (mexicoSiteFlag) {\r\n formattedPhoneNumber = (value || '').replace(new RegExp('[<>]', 'gi'), '');\r\n const tempValue = formattedPhoneNumber.split(' ').join('');\r\n formattedPhoneNumber = tempValue.replace(/(\\d{2})(\\d{2})(\\d{4})(\\d{4})/, '$1 $2 $3 $4');\r\n } else {\r\n if (rawPhoneNumber.length >= 1) {\r\n formattedPhoneNumber = `(${rawPhoneNumber.slice(0, 3)}`;\r\n if (rawPhoneNumber.length > 3) {\r\n formattedPhoneNumber += `) ${rawPhoneNumber.slice(3, 6)}`;\r\n if (rawPhoneNumber.length > 6) {\r\n formattedPhoneNumber += `-${rawPhoneNumber.slice(6, 10)}`;\r\n }\r\n }\r\n }\r\n }\r\n numberValue = formattedPhoneNumber;\r\n } else {\r\n const phoneReg = /^[0-9\\s]*$/;\r\n if (phoneReg.test(value)) {\r\n numberValue = value;\r\n } else {\r\n numberValue = value.slice(0, -1);\r\n }\r\n }\r\n } else if (name === 'ZipCode' && value !== undefined) {\r\n const zipCodeRegex = /^[a-zA-Z0-9_.-]*$/;\r\n if (zipCodeRegex.test(value)) {\r\n numberValue = value;\r\n } else {\r\n numberValue = value.slice(0, -1);\r\n }\r\n }\r\n return (\r\n \r\n );\r\n};\r\n\r\nexport default AddressInputFunctionComponent;\r\n"],"names":["GetAddressPurposesInput","constructor","apiSettings","getCacheKey","buildCacheKey","this","getCacheObjectType","dataCacheType","async","getAddressPurposesAction","input","ctx","getAddressPurposesAsync","callerContext","queryResultSettings","QueryResultSettingsProxy","getPagingFromInputDataOrDefaultValue","createObservableDataAction","id","action","inputData","requestContext","GetStateProvincesInput","countryRegionId","getStateProvinceAction","getStateProvincesAsync","AddressCommon","context","resources","telemetry","getDefaultCountryRegionId","countryRegions","market","marketISOCode","currentCountryRegion","find","countryRegion","ISOCode","CountryRegionId","parseRetailException","errorTitle","addressErrorMessageTitle","errorMessage","addressGenericErrorMessage","isAuthenticatedFlow","request","user","isAuthenticated","getStateProvinces","response","actionContext","error","debug","Promise","resolve","isEmpty","address","ThreeLetterISORegionName","State","City","addCustomerAddress","updateLogisticsLocationRoleRecordId","submitCustomerAddress","addAddress","updateCustomerAddress","updateAddress","updateCustomerPrimaryAddress","updatePrimaryAddress","addressAction","AddressTypeValue","AddressManagementInput","execAddressAction","addresses","length","RecordId","customerAddresses","addressPurposes","ArrayExtensions","hasElements","addressPurpose","purpose","AddressType","LogisticsLocationRoleRecordId","AddressItemDisplayType","AddressValidationRuleType","AddressItemType","AddressFormat","countryRegionsInfo","addressMetaData","getPrefilledAddressDropdownData","stateDefaultSelectionText","stateProvinceInfo","defaultStateText","key","value","dropdownData","getCountryFormat","getStateFormat","unshift","getAddressTypeFormat","getTwoLetterISORegionName","_getCountryRegionInfo","validateAddressFormat","validationError","propertyName","validationtor","isValid","getAddressFormat","forEach","addressFormatItem","name","_inputValidation","undefined","getTranformedAddress","result","postalCode","ZipCode","selectedState","state","StateName","adminDistrict","StateId","addressLine","Street","locality","district","DistrictName","CountyName","FullAddress","formattedAddress","_validateRegEx","validationRule","regEx","RegExp","test","get","countryRegionInfo","_getAddressDisplayFormat","map","ShortName","Name","set","validationRules","message","toLowerCase","addressDisplayItem","AddressFormatLines","AddressTypeItem","_extendAddressDisplayFormat","push","nameDisplayItem","formatLine","AddressComponentNameValue","addressItem","getItemFormat","isNewLine","NewLine","phoneDisplayItem","Phone","isPrimaryDisplayItem","IsPrimary","type","AddressMetaData","excluded","required","metaData","requiredFieldRegEx","resourcesPrefix","maxLength","excludedTypes","requiredFields","_init","item","_addItem","Input","PhoneRegex","defaultRegex","County","Dropdown","StreetNumber","BuildingCompliment","Postbox","House_RU","Flat_RU","CountryOKSMCode_RU","Checkbox","displayType","format","includes","nameKey","replace","_validationRules","isRequired","some","rule","Required","optionalString","label","ruleType","Object","keys","itemType","_validationRule","Format","AddressOperation","props","React","className","role","itemId","isChecked","additionalAddributes","telemetryContent","autoFocus","shouldBeAutoFocused","onChange","payLoad","getPayloadObject","attributes","getTelemetryAttributes","assign","checked","displayData","getDropdownItem","selectedValue","isSelected","text","htmlFor","getRequriedAttribute","getAddessItems","selectedAddress","addressFormat","addressType","dropdownDisplayData","defaultCountryRegionId","defaultAddressType","onInputChange","onDropdownChange","shouldAutoFocus","usSiteFlag","mexicoSiteFlag","index","_selectedAddress$addr","elementId","classname","AddressInputComponent","Number","AdressCheckboxComponent","AdressDropdownComponent","zipcodeError","postcodeError","AddressItem","AddressLabelComponent","customLabel","alert","AddressAlertComponent","customAlert","returnAddressAlertComponent","AddressName","AddressAddUpdate","editAddressHeading","addAddressHeading","hasError","onCancel","onSave","hasExternalSubmitGroup","isUpdating","addressActionResponse","heading","AddressForm","Heading","items","isShowSaveButton","saveButton","AddressButtonComponent","addressSaveButtonText","ariaLabel","addressSaveButtonAriaLabel","disabled","onClick","isShowCancelButton","cancelButton","addressCancelButtonText","addressCancelButtonAriaLabel","AddressError","title","AddressErrorTitleComponent","AddressErrorMessageComponent","isDisabled","shouldUseAutoFocus","numberValue","customMaxLength","rawPhoneNumber","formattedPhoneNumber","_formattedPhoneNumber","_formattedPhoneNumber2","_formattedPhoneNumber3","_formattedPhoneNumber4","substring","split","join","slice","tempValue","placeholder"],"sourceRoot":""}