| number {\n return this._customerAccountAmount;\n }\n\n @action\n public updateTokenizedPaymentCard(newTokenizedPaymentCard: TokenizedPaymentCard): void {\n this._tokenizedPaymentCard = newTokenizedPaymentCard;\n }\n\n @action\n public updateTenderLine(newTenderLine: TenderLine | undefined): void {\n this._tenderLine = newTenderLine;\n }\n\n @action\n public updateShippingAddress(newShippingAddress: Address): void {\n this._shippingAddress = newShippingAddress;\n }\n\n @action\n public updateBillingAddress(newBillingAddress: Address): void {\n this._billingAddress = newBillingAddress;\n }\n\n @action\n public updateCardPrefix(newCardPrefix: string): void {\n this._cardPrefix = newCardPrefix;\n }\n\n @action\n public removeGiftCard(giftCardNumber: string): void {\n this._giftCards = this._giftCards.filter(giftCard => giftCard.Id !== giftCardNumber);\n }\n\n @action\n public removeGiftCardExtend(giftCardNumber: string): void {\n this._giftCardExtends = this._giftCardExtends.filter(giftCard => giftCard.Id !== giftCardNumber);\n }\n\n @action\n public addGiftCard(giftCard: GiftCard): void {\n this._giftCards = [giftCard, ...this._giftCards];\n }\n\n @action\n public addGiftCardExtend(giftCard: IGiftCardExtend): void {\n this._giftCardExtends = [giftCard, ...this._giftCards];\n }\n\n @action\n public updateLoyaltyCardNumber(newLoyaltyCardNumber: string): void {\n this._loyaltyCardNumber = newLoyaltyCardNumber;\n }\n\n @action\n public updateLoyaltyAmount(newAmount: number): void {\n this._loyaltyAmount = newAmount;\n }\n\n @action\n public updateGuestCheckoutEmail(\n newGuestCheckoutEmail: string,\n customerReference: string,\n customerRequisition: string,\n note: Note\n ): void {\n this._guestCheckoutEmail = newGuestCheckoutEmail;\n this._customerReference = customerReference;\n this._customerRequisition = customerRequisition;\n this._note = note;\n }\n\n @action\n public updateTermsAndConditionsAcceptance(newIsTermsAndConditionAccepted: boolean): void {\n this._isTermsAndConditionAccepted = newIsTermsAndConditionAccepted;\n }\n\n @action\n public updateCustomerAccountAmount(newAmount: number): void {\n this._customerAccountAmount = newAmount;\n }\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { IModule } from '@msdyn365-commerce/core';\nimport { ArrayExtensions } from '@msdyn365-commerce-modules/retail-actions';\nimport isMatch from 'lodash/isMatch';\nimport { observer } from 'mobx-react';\nimport * as React from 'react';\n\nimport { getModuleStates, updateModuleStates } from './module-state';\nimport { IModuleState, IModuleStateManager, IModuleStateProps, IModuleStates } from './module-state.data';\n\nexport interface IProps extends IModule, IModuleStateProps {\n enableControl?: boolean;\n}\n\nconst sectionContainerModuleId = 'section-container';\nconst paymentInstrumentModuleId = 'payment-instrument';\n\nconst withModuleState = (WrappedComponent: React.ComponentType
): React.ComponentType
=> {\n /**\n *\n * ModuleState component.\n * @extends {React.Component
}\n */\n @observer\n class ModuleState extends React.Component
{\n constructor(props: P) {\n super(props);\n this.initializeState();\n }\n\n public shouldComponentUpdate(nextProps: IModuleStateProps): boolean {\n if (this.props === nextProps) {\n return false;\n }\n return true;\n }\n\n public render(): JSX.Element | null {\n const { id } = this.props;\n return ;\n }\n\n private readonly initializeState = (): void => {\n const { id, typeName, context } = this.props;\n const states = getModuleStates(context.actionContext);\n if (!states) {\n this.props.telemetry.error('withModuleState initializeState() - states not found');\n return;\n }\n\n if (states[id]) {\n // State has been initialized\n return;\n }\n\n updateModuleStates(\n {\n ...states,\n [id]: {\n id,\n typeName,\n hasInitialized: false,\n hasError: false,\n isRequired: true,\n isCancellable: true,\n isSubmitContainer: false,\n status: undefined,\n childIds: []\n }\n },\n context.actionContext\n );\n };\n\n /**\n * GetModuleStateManager\n * Get module state manager by id.\n * @param id\n */\n private readonly getModuleStateManager = (id: string): IModuleStateManager => {\n const moduleState = this.get()[id];\n return {\n ...moduleState!,\n hasInitialized: this.validate(id, { hasInitialized: true }, true), // All has initialized is initialized\n hasError: this.validate(id, { hasError: true }), // Partial has error is error\n isReady: this.validate(id, { status: 'ready' }, true, true), // All ready is ready (exclued disabled and skipped)\n isUpdating: this.validate(id, { status: 'updating' }), // Partial updating is updating\n isPending: this.validate(id, { status: 'pending' }), // Partial pending is pending\n isSkipped: this.validate(id, { status: 'skipped' }, true, true), // All skipped is skipped (exclued disabled)\n isDisabled: this.validate(id, { status: 'disabled' }, true), // All disabled is disabled\n isCancelAllowed: this.validate(id, { isCancellable: true }, true, true), // Partial not allowed is not allowed\n shouldSubmitContainer: this.validate(id, { isSubmitContainer: true }), // Partial submit is submit.\n hasExternalSubmitGroup: this.hasExternalSubmitGroup(),\n hasModuleState: this.hasModuleState(id),\n setIsRequired: (value: boolean): void => {\n this.update(id, { isRequired: value });\n },\n setIsCancellable: (value: boolean): void => {\n this.update(id, { isCancellable: value });\n },\n setIsSubmitContainer: (value: boolean): void => {\n this.update(id, { isSubmitContainer: value });\n },\n setHasError: (value: boolean): void => {\n this.update(id, { hasError: value });\n },\n onReady: (): void => {\n this.update(id, { status: 'ready' });\n },\n onUpdating: (): void => {\n this.update(id, { status: 'updating' });\n },\n onPending: (): void => {\n this.update(id, { status: 'pending' });\n },\n onSkip: (): void => {\n this.update(id, { status: 'skipped' });\n },\n onDisable: (): void => {\n this.update(id, { status: 'disabled' });\n },\n getModule: (moduleId: string): IModuleStateManager => this.getModuleStateManager(moduleId),\n getModuleByTypeName: (typeName: string): IModuleStateManager => this.getModuleStateManagerByTypeName(typeName),\n init: (options?: Partial): void => {\n if (moduleState?.hasInitialized) {\n // State has been initialized\n return;\n }\n this.update(id, {\n hasInitialized: true,\n ...options\n });\n }\n };\n };\n\n /**\n * GetModuleStateManagerByTypeName\n * Get module state manager by type name.\n * @param typeName\n */\n private readonly getModuleStateManagerByTypeName = (typeName: string): IModuleStateManager => {\n const moduleStates = getModuleStates(this.props.context.actionContext);\n const moduleState = Object.values(moduleStates).find(_moduleState => _moduleState?.typeName === typeName);\n return this.getModuleStateManager((moduleState && moduleState.id) || '');\n };\n\n /**\n * Get\n * Get all module states.\n */\n private readonly get = (): IModuleStates => {\n return getModuleStates(this.props.context.actionContext);\n };\n\n /**\n * Update\n * Update module state.\n * @param id\n * @param value\n */\n private readonly update = (id: string, value: Partial): void => {\n // Console.log('withModuleState - update', id, value);\n const modules = this.get();\n if (!modules[id]) {\n this.props.telemetry.error(`withModuleState update() - Module state with id ${id} is not found.`);\n return;\n }\n modules[id] = {\n ...modules[id]!,\n ...value\n };\n };\n\n private readonly _validateLeaf = (id: string, source: Partial): boolean => {\n const modules = this.get();\n const module = modules[id];\n if (!module) {\n return false;\n }\n return isMatch(module, source);\n };\n\n private readonly _validateContainer = (\n id: string,\n source: Partial,\n allMatched?: boolean,\n skipSkippableItem?: boolean\n ): boolean => {\n const modules = this.get();\n const module = modules[id];\n if (!module) {\n // Module doesn't has module state\n return !!allMatched;\n }\n\n if (skipSkippableItem && (module.status === 'disabled' || module.status === 'skipped')) {\n // Skip disabled or skipped modules\n return !!allMatched;\n }\n\n // It is leaf module\n if (!module.childIds || module.childIds.length === 0) {\n return this._validateLeaf(id, source);\n }\n\n let childIds = module.childIds;\n\n if (this.props.context.app.config.shouldEnableSinglePaymentAuthorizationCheckout) {\n // For new checkout flow, we bypass the isReady check for payment section container to enable the place order button.\n childIds = childIds.filter(childId => !this._isPaymentSectionContainer(childId));\n }\n\n // It is container module\n const method = allMatched ? 'every' : 'some';\n return childIds[method](childId => this._validateContainer(childId, source, allMatched, skipSkippableItem));\n };\n\n /**\n * Check if it is a section container with payment module.\n * @param moduleId -- The id of the module.\n * @returns If it is a section container with payment module.\n */\n private readonly _isPaymentSectionContainer = (moduleId: string): boolean => {\n if (!moduleId.includes(sectionContainerModuleId)) {\n return false;\n }\n\n const modules = this.get();\n const module = modules[moduleId];\n\n if (module && ArrayExtensions.hasElements(module.childIds.filter(childId => childId.includes(paymentInstrumentModuleId)))) {\n return true;\n }\n\n return false;\n };\n\n /**\n * Validate\n * Validate current module and all its child module match the provided condition.\n * @param id\n * @param source\n * @param allMatched\n * @param skipSkippableItem\n */\n private readonly validate = (\n id: string,\n source: Partial,\n allMatched?: boolean,\n skipSkippableItem?: boolean\n ): boolean => {\n const modules = this.get();\n const module = modules[id];\n if (!module) {\n return false;\n }\n\n // It is leaf module\n if (!module.childIds || module.childIds.length === 0) {\n return this._validateLeaf(id, source);\n }\n\n // It is container module\n return this._validateContainer(id, source, allMatched, skipSkippableItem);\n };\n\n /**\n * HasExternalSubmitGroup\n * Module will use external submit group.\n */\n private readonly hasExternalSubmitGroup = (): boolean => {\n return !!this.props.enableControl;\n };\n\n /**\n * HasModuleState\n * Module is using module state manager.\n * @param id\n */\n private readonly hasModuleState = (id: string): boolean => {\n const modules = this.get();\n const module = modules[id];\n return !!module;\n };\n }\n\n return ModuleState;\n};\n\nexport default withModuleState;\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { CacheType, IActionContext, IActionInput } from '@msdyn365-commerce/core';\n\nimport { IModuleStates } from './module-state.data';\n\n/**\n * GetModulesInput.\n */\nexport class ModuleStatesCacheKey implements IActionInput {\n public getCacheKey = () => 'ModuleState';\n\n public getCacheObjectType = () => 'ModuleState';\n\n public dataCacheType = (): CacheType => 'none';\n}\n\nexport function getModuleStates(ctx: IActionContext): IModuleStates {\n const cacheKey = new ModuleStatesCacheKey();\n\n let moduleStates = ctx.get(cacheKey.getCacheObjectType(), cacheKey.getCacheKey());\n if (moduleStates) {\n return moduleStates;\n }\n ctx.update(cacheKey, {});\n moduleStates = ctx.get(cacheKey.getCacheObjectType(), cacheKey.getCacheKey());\n return moduleStates;\n}\n\nexport function updateModuleStates(value: IModuleStates, ctx: IActionContext): void {\n const cacheKey = new ModuleStatesCacheKey();\n ctx.update(cacheKey, value);\n}\n","/*--------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * See License.txt in the project root for license information.\n *--------------------------------------------------------------*/\n\n/**\n * EnabledPaymentsForOBO enum.\n */\n export enum EnabledPaymentsForOBO {\n OnCustomerAccount = 1,\n ExpressPayment = 0,\n Loyalty = 0,\n GiftCard = 0,\n PaymentInstrument = 0,\n ApplePay = 0\n}\n","import { Cart, CartLine, IContext, LineDeliverySpecification } from '@msdyn365-commerce/retail-proxy';\r\nimport {\r\n updateAsync,\r\n updateCartLinesAsync,\r\n updateLineDeliverySpecificationsAsync\r\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/CartsDataActions.g';\r\nimport { IActionContext } from '@msdyn365-commerce/core';\r\n\r\nexport const updateLineDeliverySpecifications = async (\r\n context: IContext,\r\n cartId: string,\r\n lineDeliverySpecifications: LineDeliverySpecification[]\r\n): Promise => {\r\n return updateLineDeliverySpecificationsAsync(context, cartId, lineDeliverySpecifications).catch(err => {\r\n console.log(err);\r\n return err;\r\n });\r\n};\r\n\r\nexport const getCartLinesforSubscription = (cartLine: CartLine[]): CartLine[] => {\r\n return cartLine?.filter(line => isSubscriptionLine(line)) || [];\r\n};\r\n\r\nexport const getCartLinesforDelivery = (cartLine: CartLine[]): CartLine[] => {\r\n return cartLine?.filter(line => isDeliveryLine(line)) ?? [];\r\n};\r\n\r\nexport const getCartLinesforPickup = (cartLine: CartLine[]): CartLine[] => {\r\n return cartLine?.filter(line => isPickupLine(line)) ?? [];\r\n};\r\n\r\nexport const updateCartLines = (context: IContext, id: string, cartLines: CartLine[] | null | undefined) => {\r\n return updateCartLinesAsync(context, id, cartLines);\r\n};\r\n\r\nexport const updateCartLineAttributeValues = async (\r\n lineId: string,\r\n attributeKey: string,\r\n attributeValue: string,\r\n actionContext: IActionContext,\r\n cart: Cart\r\n) => {\r\n const cartLines = cart.CartLines;\r\n\r\n cartLines?.map((cartLine, index) => {\r\n if (cartLine.LineId === lineId) {\r\n const newAttribute = {\r\n '@odata.type': '#Microsoft.Dynamics.Commerce.Runtime.DataModel.AttributeTextValue',\r\n ExtensionProperties: [],\r\n Name: attributeKey,\r\n TextValue: attributeValue,\r\n TextValueTranslations: []\r\n };\r\n\r\n if (cartLine.AttributeValues) {\r\n const attrIndex = cartLine.AttributeValues.findIndex(attr => attr.Name === attributeKey);\r\n\r\n if (attrIndex > -1) {\r\n // eslint-disable-next-line security/detect-object-injection\r\n cartLine.AttributeValues[attrIndex] = newAttribute;\r\n } else {\r\n cartLine.AttributeValues.push(newAttribute);\r\n }\r\n } else {\r\n cartLine.AttributeValues = [];\r\n cartLine.AttributeValues.push(newAttribute);\r\n }\r\n }\r\n });\r\n\r\n const newCart = await updateCartLinesAsync({ callerContext: actionContext }, cart.Id, cartLines);\r\n await updateAsync({ callerContext: actionContext }, newCart);\r\n};\r\n\r\nconst isSubscriptionLine = (line: CartLine): boolean => {\r\n const isSubscription = line?.ExtensionProperties?.find(x => x.Key === 'isSubscription')?.Value?.BooleanValue || false;\r\n\r\n //commeted out because all subscriptions need subscription addresses regardless of serv country or not\r\n // const isManualSubscription = line?.ExtensionProperties?.find(x => x.Key === 'isManualSubscription')?.Value?.BooleanValue || false;\r\n\r\n // return isSubscription && !isManualSubscription;\r\n return isSubscription;\r\n};\r\n\r\nconst isDeliveryLine = (line: CartLine): boolean => {\r\n return !isPickupLine(line) && (line.FulfillmentStoreId === undefined || line.FulfillmentStoreId === '') && !isSubscriptionLine(line);\r\n};\r\n\r\nconst isPickupLine = (line: CartLine): boolean => {\r\n return line.DeliveryMode === 'PICKUP' || line.DeliveryMode === 'CURBSIDE';\r\n};\r\n","export const stateCheckListKo = [\r\n { value: '강원', label: '강원도' },\r\n { value: '경기', label: '경기도' },\r\n { value: '경남', label: '경남' },\r\n { value: '경북', label: '경북' },\r\n { value: '광주', label: '광주시' },\r\n { value: '대구', label: '대구시' },\r\n { value: '대전', label: '대전시' },\r\n { value: '부산', label: '부산시' },\r\n { value: '서울', label: '서울시' },\r\n { value: '세종', label: '세종시' },\r\n { value: '울산', label: '울산시' },\r\n { value: '인천', label: '인천시' },\r\n { value: '전남', label: '전남' },\r\n { value: '전북', label: '전북' },\r\n { value: '제주', label: '제주시' },\r\n { value: '충남', label: '충남' },\r\n { value: '충북', label: '충북' }\r\n];\r\n\r\nexport const stateCheckList = [\r\n { value: 'Seoul', label: 'Seoul' },\r\n { value: 'Busan', label: 'Busan' },\r\n { value: 'Daegu', label: 'Daegu' },\r\n { value: 'Incheon', label: 'Incheon' },\r\n { value: 'Gwangju', label: 'Gwangju' },\r\n { value: 'Daejeon', label: 'Daejeon' },\r\n { value: 'Ulsan', label: 'Ulsan' },\r\n { value: 'Gyeonggi', label: 'Gyeonggi' },\r\n { value: 'Gangwon', label: 'Gangwon' },\r\n { value: 'ChungBuk', label: 'North Chungcheong' },\r\n { value: 'ChungNam', label: 'South Chungcheong' },\r\n { value: 'JunBuk', label: 'North Jeolla' },\r\n { value: 'JunNam', label: 'South Jeolla' },\r\n { value: 'GyeongBuk', label: 'North Gyeongsang' },\r\n { value: 'GyeongNam', label: 'South Gyeongsang' },\r\n { value: 'Jeju', label: 'Jeju' },\r\n { value: 'Sejong', label: 'Sejong' }\r\n];\r\n\r\nexport const cityCheck = [\r\n 'CT',\r\n 'DN',\r\n 'HN',\r\n 'HP',\r\n 'SG',\r\n 'HCM',\r\n 'KR-11',\r\n 'KR-26',\r\n 'KR-27',\r\n 'KR-28',\r\n 'KR-29',\r\n 'KR-30',\r\n 'KR-31',\r\n 'KR-41',\r\n 'KR-42',\r\n 'KR-43',\r\n 'KR-49',\r\n '11',\r\n '26',\r\n '27',\r\n '28',\r\n '29',\r\n '30',\r\n '31',\r\n '41',\r\n '42',\r\n '43',\r\n '49',\r\n 'Seoul',\r\n 'Busan',\r\n 'Daegu',\r\n 'Incheon',\r\n 'Gwangju',\r\n 'Daejeon',\r\n 'Ulsan',\r\n 'Gyeonggi',\r\n 'Gangwon',\r\n 'North Chungcheong',\r\n 'Sejong',\r\n 'Jeju',\r\n '서울',\r\n '부산',\r\n '대구',\r\n '인천',\r\n '광주',\r\n '대전',\r\n '울산',\r\n '경기',\r\n '강원',\r\n '충정북도',\r\n '제주',\r\n '세종'\r\n];\r\n\r\nexport const stateCheckListMixed = [\r\n { value: '강원', label: '강원도' },\r\n { value: '경기', label: '경기도' },\r\n { value: '경남', label: '경남' },\r\n { value: '경북', label: '경북' },\r\n { value: '광주', label: '광주시' },\r\n { value: '대구', label: '대구시' },\r\n { value: '대전', label: '대전시' },\r\n { value: '부산', label: '부산시' },\r\n { value: '서울', label: '서울시' },\r\n { value: '세종', label: '세종시' },\r\n { value: '울산', label: '울산시' },\r\n { value: '인천', label: '인천시' },\r\n { value: '전남', label: '전남' },\r\n { value: '전북', label: '전북' },\r\n { value: '제주', label: '제주시' },\r\n { value: '충남', label: '충남' },\r\n { value: '충북', label: '충북' },\r\n { value: 'Seoul', label: 'Seoul' },\r\n { value: 'Busan', label: 'Busan' },\r\n { value: 'Daegu', label: 'Daegu' },\r\n { value: 'Incheon', label: 'Incheon' },\r\n { value: 'Gwangju', label: 'Gwangju' },\r\n { value: 'Daejeon', label: 'Daejeon' },\r\n { value: 'Ulsan', label: 'Ulsan' },\r\n { value: 'Gyeonggi', label: 'Gyeonggi' },\r\n { value: 'Gangwon', label: 'Gangwon' },\r\n { value: 'ChungBuk', label: 'North Chungcheong' },\r\n { value: 'ChungNam', label: 'South Chungcheong' },\r\n { value: 'JunBuk', label: 'North Jeolla' },\r\n { value: 'JunNam', label: 'South Jeolla' },\r\n { value: 'GyeongBuk', label: 'North Gyeongsang' },\r\n { value: 'GyeongNam', label: 'South Gyeongsang' },\r\n { value: 'Jeju', label: 'Jeju' },\r\n { value: 'Sejong', label: 'Sejong' }\r\n];\r\n\r\nexport const ArgState = [\r\n { key: 'CT', value: 'Catamarca' },\r\n { key: 'CC', value: 'Chaco' },\r\n { key: 'CH', value: 'Chubut' },\r\n { key: 'C', value: 'Ciudad Autónoma de Buenos Aires' },\r\n { key: 'CB', value: 'Córdoba' },\r\n { key: 'CN', value: 'Corrientes' },\r\n { key: 'ER', value: 'Entre Ríos' },\r\n { key: 'FM', value: 'Formosa' },\r\n { key: 'JY', value: 'Jujuy' },\r\n { key: 'LP', value: 'La Pampa' },\r\n { key: 'LR', value: 'La Rioja' },\r\n { key: 'MZ', value: 'Mendoza' },\r\n { key: 'MN', value: 'Misiones' },\r\n { key: 'NQ', value: 'Neuquén' },\r\n { key: 'BA', value: 'Provincia de Buenos Aires' },\r\n { key: 'RN', value: 'Río Negro' },\r\n { key: 'SA', value: 'Salta' },\r\n { key: 'SJ', value: 'San Juan' },\r\n { key: 'SL', value: 'San Luis' },\r\n { key: 'SC', value: 'Santa Cruz' },\r\n { key: 'SF', value: 'Santa Fe' },\r\n { key: 'SE', value: 'Santiago del Estero' },\r\n { key: 'TF', value: 'Tierra del Fuego' },\r\n { key: 'TM', value: 'Tucumán' }\r\n];\r\n","export const districtListCHL = [\r\n { value: 'COYHAIQUE', label: 'COYHAIQUE' },\r\n { value: 'LAGO VERDE', label: 'LAGO VERDE' },\r\n { value: 'AYSEN', label: 'AYSEN' },\r\n { value: 'CISNES', label: 'CISNES' },\r\n { value: 'GUAITECAS', label: 'GUAITECAS' },\r\n { value: 'COCHRANE', label: 'COCHRANE' },\r\n { value: 'O HIGGINS', label: 'O HIGGINS' },\r\n { value: 'TORTEL', label: 'TORTEL' },\r\n { value: 'CHILE CHICO', label: 'CHILE CHICO' },\r\n { value: 'RIO IBANEZ', label: 'RIO IBANEZ' },\r\n { value: 'ANTOFAGASTA', label: 'ANTOFAGASTA' },\r\n { value: 'MEJILLONES', label: 'MEJILLONES' },\r\n { value: 'SIERRA GORDA', label: 'SIERRA GORDA' },\r\n { value: 'TALTAL', label: 'TALTAL' },\r\n { value: 'CALAMA', label: 'CALAMA' },\r\n { value: 'OLLAGUE', label: 'OLLAGUE' },\r\n { value: 'SAN PEDRO DE ATACAMA', label: 'SAN PEDRO DE ATACAMA' },\r\n { value: 'TOCOPILLA', label: 'TOCOPILLA' },\r\n { value: 'MARIA ELENA', label: 'MARIA ELENA' },\r\n { value: 'ARICA', label: 'ARICA' },\r\n { value: 'CAMARONES', label: 'CAMARONES' },\r\n { value: 'PUTRE', label: 'PUTRE' },\r\n { value: 'GENERAL LAGOS', label: 'GENERAL LAGOS' },\r\n { value: 'TEMUCO', label: 'TEMUCO' },\r\n { value: 'CARAHUE', label: 'CARAHUE' },\r\n { value: 'CHOLCHOL', label: 'CHOLCHOL' },\r\n { value: 'CUARARREHUE', label: 'CUARARREHUE' },\r\n { value: 'FREIRE', label: 'FREIRE' },\r\n { value: 'GALVARINO', label: 'GALVARINO' },\r\n { value: 'GORBEA', label: 'GORBEA' },\r\n { value: 'LAUTARO', label: 'LAUTARO' },\r\n { value: 'LONCOCHE', label: 'LONCOCHE' },\r\n { value: 'MELIPEUCO', label: 'MELIPEUCO' },\r\n { value: 'NUEVA IMPERIAL', label: 'NUEVA IMPERIAL' },\r\n { value: 'PADRE LAS CASAS', label: 'PADRE LAS CASAS' },\r\n { value: 'PERQUENCO', label: 'PERQUENCO' },\r\n { value: 'PITRUFQUEN', label: 'PITRUFQUEN' },\r\n { value: 'PUCON', label: 'PUCON' },\r\n { value: 'SAAVEDRA', label: 'SAAVEDRA' },\r\n { value: 'TEODORO SCHMIDT', label: 'TEODORO SCHMIDT' },\r\n { value: 'VILLARRICA', label: 'VILLARRICA' },\r\n { value: 'VILCUN', label: 'VILCUN' },\r\n { value: 'TOLTEN', label: 'TOLTEN' },\r\n { value: 'CUNCO', label: 'CUNCO' },\r\n { value: 'ANGOL', label: 'ANGOL' },\r\n { value: 'COLLIPULLI', label: 'COLLIPULLI' },\r\n { value: 'CURACAUTIN', label: 'CURACAUTIN' },\r\n { value: 'ERCILLA', label: 'ERCILLA' },\r\n { value: 'LONQUIMAY', label: 'LONQUIMAY' },\r\n { value: 'LOS SAUCES', label: 'LOS SAUCES' },\r\n { value: 'LUMACO', label: 'LUMACO' },\r\n { value: 'PUREN', label: 'PUREN' },\r\n { value: 'RENAICO', label: 'RENAICO' },\r\n { value: 'TRAIGUEN', label: 'TRAIGUEN' },\r\n { value: 'VICTORIA', label: 'VICTORIA' },\r\n { value: 'COPIAPO', label: 'COPIAPO' },\r\n { value: 'CALDERA', label: 'CALDERA' },\r\n { value: 'TIERRA AMARILLA', label: 'TIERRA AMARILLA' },\r\n { value: 'CHANARAL', label: 'CHANARAL' },\r\n { value: 'DIEGO DE ALMAGRO', label: 'DIEGO DE ALMAGRO' },\r\n { value: 'VALLENAR', label: 'VALLENAR' },\r\n { value: 'ALTO DEL CARMEN', label: 'ALTO DEL CARMEN' },\r\n { value: 'FREIRINA', label: 'FREIRINA' },\r\n { value: 'HUASCO', label: 'HUASCO' },\r\n { value: 'TOME', label: 'TOME' },\r\n { value: 'TALCAHUANO', label: 'TALCAHUANO' },\r\n { value: 'SANTA JUANA', label: 'SANTA JUANA' },\r\n { value: 'SAN PEDRO DE LA PAZ', label: 'SAN PEDRO DE LA PAZ' },\r\n { value: 'PENCO', label: 'PENCO' },\r\n { value: 'LOTA', label: 'LOTA' },\r\n { value: 'HUALQUI', label: 'HUALQUI' },\r\n { value: 'HUALPEN', label: 'HUALPEN' },\r\n { value: 'FLORIDA', label: 'FLORIDA' },\r\n { value: 'CORONEL', label: 'CORONEL' },\r\n { value: 'CONCEPCION', label: 'CONCEPCION' },\r\n { value: 'CHIGUAYANTE', label: 'CHIGUAYANTE' },\r\n { value: 'TIRUA', label: 'TIRUA' },\r\n { value: 'LOS ALAMOS', label: 'LOS ALAMOS' },\r\n { value: 'LEBU', label: 'LEBU' },\r\n { value: 'CURANILAHUE', label: 'CURANILAHUE' },\r\n { value: 'CONTULMO', label: 'CONTULMO' },\r\n { value: 'CANETE', label: 'CANETE' },\r\n { value: 'ARAUCO', label: 'ARAUCO' },\r\n { value: 'YUMBEL', label: 'YUMBEL' },\r\n { value: 'TUCAPEL', label: 'TUCAPEL' },\r\n { value: 'SANTA BARBARA', label: 'SANTA BARBARA' },\r\n { value: 'SAN ROSENDO', label: 'SAN ROSENDO' },\r\n { value: 'QUILLECO', label: 'QUILLECO' },\r\n { value: 'QUILACO', label: 'QUILACO' },\r\n { value: 'NEGRETE', label: 'NEGRETE' },\r\n { value: 'NACIMIENTO', label: 'NACIMIENTO' },\r\n { value: 'MAULCHEN', label: 'MAULCHEN' },\r\n { value: 'LOS ANGELES', label: 'LOS ANGELES' },\r\n { value: 'LAJA', label: 'LAJA' },\r\n { value: 'CABRERO', label: 'CABRERO' },\r\n { value: 'ANTUCO', label: 'ANTUCO' },\r\n { value: 'ALTO BIOBIO', label: 'ALTO BIOBIO' },\r\n { value: 'CHILLAN', label: 'CHILLAN' },\r\n { value: 'BULNES', label: 'BULNES' },\r\n { value: 'COBQUECURA', label: 'COBQUECURA' },\r\n { value: 'COELEMU', label: 'COELEMU' },\r\n { value: 'COIHUECO', label: 'COIHUECO' },\r\n { value: 'CHILLAN VIEJO', label: 'CHILLAN VIEJO' },\r\n { value: 'EL CARMEN', label: 'EL CARMEN' },\r\n { value: 'NINHUE', label: 'NINHUE' },\r\n { value: 'NIQUEN', label: 'NIQUEN' },\r\n { value: 'PEMUCO', label: 'PEMUCO' },\r\n { value: 'PINTO', label: 'PINTO' },\r\n { value: 'PORTEZUELO', label: 'PORTEZUELO' },\r\n { value: 'QUILLON', label: 'QUILLON' },\r\n { value: 'QUIRIHUE', label: 'QUIRIHUE' },\r\n { value: 'RANQUIL', label: 'RANQUIL' },\r\n { value: 'SAN CARLOS', label: 'SAN CARLOS' },\r\n { value: 'SAN FABIAN DE ALICO', label: 'SAN FABIAN DE ALICO' },\r\n { value: 'SAN IGNACIO', label: 'SAN IGNACIO' },\r\n { value: 'SAN NICOLAS', label: 'SAN NICOLAS' },\r\n { value: 'TREHUACO', label: 'TREHUACO' },\r\n { value: 'YUNGAY', label: 'YUNGAY' },\r\n { value: 'LA SERENA', label: 'LA SERENA' },\r\n { value: 'COQUIMBO', label: 'COQUIMBO' },\r\n { value: 'ANDACOLLO', label: 'ANDACOLLO' },\r\n { value: 'LA HIGUERA', label: 'LA HIGUERA' },\r\n { value: 'PAIHUANO', label: 'PAIHUANO' },\r\n { value: 'VICUNA', label: 'VICUNA' },\r\n { value: 'ILLAPEL', label: 'ILLAPEL' },\r\n { value: 'CANELA', label: 'CANELA' },\r\n { value: 'LOS VILOS', label: 'LOS VILOS' },\r\n { value: 'SALAMANCA', label: 'SALAMANCA' },\r\n { value: 'OVALLE', label: 'OVALLE' },\r\n { value: 'COMBARBALA', label: 'COMBARBALA' },\r\n { value: 'MONTE PATRIA', label: 'MONTE PATRIA' },\r\n { value: 'PUNITAQUI', label: 'PUNITAQUI' },\r\n { value: 'RIO HURTADO', label: 'RIO HURTADO' },\r\n { value: 'RANCAGUA', label: 'RANCAGUA' },\r\n { value: 'CODEGUA', label: 'CODEGUA' },\r\n { value: 'COINCO', label: 'COINCO' },\r\n { value: 'COLTAUCO', label: 'COLTAUCO' },\r\n { value: 'CONIHUE', label: 'CONIHUE' },\r\n { value: 'GRANEROS', label: 'GRANEROS' },\r\n { value: 'LAS CABRAS', label: 'LAS CABRAS' },\r\n { value: 'MACHALI', label: 'MACHALI' },\r\n { value: 'MALLOA', label: 'MALLOA' },\r\n { value: 'MOSTAZAL', label: 'MOSTAZAL' },\r\n { value: 'OLIVAR', label: 'OLIVAR' },\r\n { value: 'PEUMO', label: 'PEUMO' },\r\n { value: 'PICHIDEGUA', label: 'PICHIDEGUA' },\r\n { value: 'QUINTA DE TILCOCO', label: 'QUINTA DE TILCOCO' },\r\n { value: 'RENGO', label: 'RENGO' },\r\n { value: 'REQUINOA', label: 'REQUINOA' },\r\n { value: 'SAN VICENTE', label: 'SAN VICENTE' },\r\n { value: 'PICHILEMU', label: 'PICHILEMU' },\r\n { value: 'LA ESTRELLA', label: 'LA ESTRELLA' },\r\n { value: 'LITUECHE', label: 'LITUECHE' },\r\n { value: 'MARCHIHUE', label: 'MARCHIHUE' },\r\n { value: 'NAVIDAD', label: 'NAVIDAD' },\r\n { value: 'PAREDONES', label: 'PAREDONES' },\r\n { value: 'SAN FERNANDO', label: 'SAN FERNANDO' },\r\n { value: 'CHEPICA', label: 'CHEPICA' },\r\n { value: 'CHIMBARONGO', label: 'CHIMBARONGO' },\r\n { value: 'LOLOL', label: 'LOLOL' },\r\n { value: 'NANCAGUA', label: 'NANCAGUA' },\r\n { value: 'PALMILLA', label: 'PALMILLA' },\r\n { value: 'PERALILLO', label: 'PERALILLO' },\r\n { value: 'PLACILLA', label: 'PLACILLA' },\r\n { value: 'PUMANQUE', label: 'PUMANQUE' },\r\n { value: 'SANTA CRUZ', label: 'SANTA CRUZ' },\r\n { value: 'PUERTO MONTT', label: 'PUERTO MONTT' },\r\n { value: 'CALBUCO', label: 'CALBUCO' },\r\n { value: 'COCHAMO', label: 'COCHAMO' },\r\n { value: 'FRESIA', label: 'FRESIA' },\r\n { value: 'FRUTILLAR', label: 'FRUTILLAR' },\r\n { value: 'LOS MUERMOS', label: 'LOS MUERMOS' },\r\n { value: 'LLANQUIHUE', label: 'LLANQUIHUE' },\r\n { value: 'MAULLIN', label: 'MAULLIN' },\r\n { value: 'PUERTO VARAS', label: 'PUERTO VARAS' },\r\n { value: 'CASTRO', label: 'CASTRO' },\r\n { value: 'ANCUD', label: 'ANCUD' },\r\n { value: 'CHONCHI', label: 'CHONCHI' },\r\n { value: 'CURACO DE VELEZ', label: 'CURACO DE VELEZ' },\r\n { value: 'DALCAHUE', label: 'DALCAHUE' },\r\n { value: 'PUQUELDON', label: 'PUQUELDON' },\r\n { value: 'QUEILEN', label: 'QUEILEN' },\r\n { value: 'QUELLON', label: 'QUELLON' },\r\n { value: 'QUEMCHI', label: 'QUEMCHI' },\r\n { value: 'QUINCHAO', label: 'QUINCHAO' },\r\n { value: 'OSORNO', label: 'OSORNO' },\r\n { value: 'PUERTO OCTAY', label: 'PUERTO OCTAY' },\r\n { value: 'PURRANQUE', label: 'PURRANQUE' },\r\n { value: 'PUYEHUE', label: 'PUYEHUE' },\r\n { value: 'RIO NEGRO', label: 'RIO NEGRO' },\r\n { value: 'SAN JUAN DE LA COSTA', label: 'SAN JUAN DE LA COSTA' },\r\n { value: 'SAN PABLO', label: 'SAN PABLO' },\r\n { value: 'CHAITEN', label: 'CHAITEN' },\r\n { value: 'FUTALEUFU', label: 'FUTALEUFU' },\r\n { value: 'HUALAIHUE', label: 'HUALAIHUE' },\r\n { value: 'PALENA', label: 'PALENA' },\r\n { value: 'VALDIVIA', label: 'VALDIVIA' },\r\n { value: 'CORRAL', label: 'CORRAL' },\r\n { value: 'LANCO', label: 'LANCO' },\r\n { value: 'LOS LAGOS', label: 'LOS LAGOS' },\r\n { value: 'MAFIL', label: 'MAFIL' },\r\n { value: 'SAN JOSE DE MARIQUINA', label: 'SAN JOSE DE MARIQUINA' },\r\n { value: 'PAILLACO', label: 'PAILLACO' },\r\n { value: 'PANGUIPULLI', label: 'PANGUIPULLI' },\r\n { value: 'LA UNION', label: 'LA UNION' },\r\n { value: 'FUTRONO', label: 'FUTRONO' },\r\n { value: 'LAGO RANCO', label: 'LAGO RANCO' },\r\n { value: 'RIO BUENO', label: 'RIO BUENO' },\r\n { value: 'PUNTA ARENAS', label: 'PUNTA ARENAS' },\r\n { value: 'LAGUNA BLANCA', label: 'LAGUNA BLANCA' },\r\n { value: 'RIO VERDE', label: 'RIO VERDE' },\r\n { value: 'SAN GREGORIO', label: 'SAN GREGORIO' },\r\n { value: 'CABO DE HORNOS', label: 'CABO DE HORNOS' },\r\n { value: 'ANTARTICA', label: 'ANTARTICA' },\r\n { value: 'PORVENIR', label: 'PORVENIR' },\r\n { value: 'PRIMAVERA', label: 'PRIMAVERA' },\r\n { value: 'TIMAUKEL', label: 'TIMAUKEL' },\r\n { value: 'PUERTO NATALES', label: 'PUERTO NATALES' },\r\n { value: 'TORRES DEL PAINE', label: 'TORRES DEL PAINE' },\r\n { value: 'TALCAHUANO', label: 'TALCAHUANO' },\r\n { value: 'CONSTITUCION', label: 'CONSTITUCION' },\r\n { value: 'CUREPTO', label: 'CUREPTO' },\r\n { value: 'EMPEDRADO', label: 'EMPEDRADO' },\r\n { value: 'MAULE', label: 'MAULE' },\r\n { value: 'PELARCO', label: 'PELARCO' },\r\n { value: 'PENCAHUE', label: 'PENCAHUE' },\r\n { value: 'RIO CLARO', label: 'RIO CLARO' },\r\n { value: 'SAN CLEMENTE', label: 'SAN CLEMENTE' },\r\n { value: 'SAN RAFAEL', label: 'SAN RAFAEL' },\r\n { value: 'CAUQUENES', label: 'CAUQUENES' },\r\n { value: 'CHANCO', label: 'CHANCO' },\r\n { value: 'PELLUHUE', label: 'PELLUHUE' },\r\n { value: 'CURICO', label: 'CURICO' },\r\n { value: 'HUALANE', label: 'HUALANE' },\r\n { value: 'LICANTEN', label: 'LICANTEN' },\r\n { value: 'MOLINA', label: 'MOLINA' },\r\n { value: 'RAUCO', label: 'RAUCO' },\r\n { value: 'ROMERAL', label: 'ROMERAL' },\r\n { value: 'SAGRADA FAMILIA', label: 'SAGRADA FAMILIA' },\r\n { value: 'TENO', label: 'TENO' },\r\n { value: 'VICHUQUEN', label: 'VICHUQUEN' },\r\n { value: 'LINARES', label: 'LINARES' },\r\n { value: 'COLBUN', label: 'COLBUN' },\r\n { value: 'LONGAVI', label: 'LONGAVI' },\r\n { value: 'PARRAL', label: 'PARRAL' },\r\n { value: 'RETIRO', label: 'RETIRO' },\r\n { value: 'SAN JAVIER', label: 'SAN JAVIER' },\r\n { value: 'VILLA ALEGRE', label: 'VILLA ALEGRE' },\r\n { value: 'YERBAS BUENAS', label: 'YERBAS BUENAS' },\r\n { value: 'SANTIAGO', label: 'SANTIAGO' },\r\n { value: 'CERRILLOS', label: 'CERRILLOS' },\r\n { value: 'CERRO NAVIA', label: 'CERRO NAVIA' },\r\n { value: 'CONCHALI', label: 'CONCHALI' },\r\n { value: 'EL BOSQUE', label: 'EL BOSQUE' },\r\n { value: 'ESTACION CENTRAL', label: 'ESTACION CENTRAL' },\r\n { value: 'HUECHURABA', label: 'HUECHURABA' },\r\n { value: 'INDEPENDENCIA', label: 'INDEPENDENCIA' },\r\n { value: 'LA CISTERNA', label: 'LA CISTERNA' },\r\n { value: 'LA FLORIDA', label: 'LA FLORIDA' },\r\n { value: 'LA GRANJA', label: 'LA GRANJA' },\r\n { value: 'LA PENTANA', label: 'LA PENTANA' },\r\n { value: 'LA REINA', label: 'LA REINA' },\r\n { value: 'LAS CONDES', label: 'LAS CONDES' },\r\n { value: 'LO BARNECHEA', label: 'LO BARNECHEA' },\r\n { value: 'LO ESPEJO', label: 'LO ESPEJO' },\r\n { value: 'LO PRADO', label: 'LO PRADO' },\r\n { value: 'MACUL', label: 'MACUL' },\r\n { value: 'MAIPU', label: 'MAIPU' },\r\n { value: 'PUENTE ALTO', label: 'PUENTE ALTO' },\r\n { value: 'PIRQUE', label: 'PIRQUE' },\r\n { value: 'SAN JOSE DE MAIPO', label: 'SAN JOSE DE MAIPO' },\r\n { value: 'COLINA', label: 'COLINA' },\r\n { value: 'LAMPA', label: 'LAMPA' },\r\n { value: 'TILTIL', label: 'TILTIL' },\r\n { value: 'SAN BERNARDO', label: 'SAN BERNARDO' },\r\n { value: 'BUIN', label: 'BUIN' },\r\n { value: 'CALERA DE TANGO', label: 'CALERA DE TANGO' },\r\n { value: 'PAINE', label: 'PAINE' },\r\n { value: 'MELIPILLA', label: 'MELIPILLA' },\r\n { value: 'ALHUE', label: 'ALHUE' },\r\n { value: 'CURACAVI', label: 'CURACAVI' },\r\n { value: 'MARIA PINTO', label: 'MARIA PINTO' },\r\n { value: 'SAN PEDRO', label: 'SAN PEDRO' },\r\n { value: 'TALAGANTE', label: 'TALAGANTE' },\r\n { value: 'EL MONTE', label: 'EL MONTE' },\r\n { value: 'ISLA DE MAIPO', label: 'ISLA DE MAIPO' },\r\n { value: 'PADRE HURTADO', label: 'PADRE HURTADO' },\r\n { value: 'PENAFLOR', label: 'PENAFLOR' },\r\n { value: 'IQUIQUE', label: 'IQUIQUE' },\r\n { value: 'ALTO HOSPICIO', label: 'ALTO HOSPICIO' },\r\n { value: 'POZO ALMONTE', label: 'POZO ALMONTE' },\r\n { value: 'CAMINA', label: 'CAMINA' },\r\n { value: 'COLCHANE', label: 'COLCHANE' },\r\n { value: 'HUARA', label: 'HUARA' },\r\n { value: 'PICA', label: 'PICA' },\r\n { value: 'VALPARAISO', label: 'VALPARAISO' },\r\n { value: 'CASABLANCA', label: 'CASABLANCA' },\r\n { value: 'CON CON', label: 'CON CON' },\r\n { value: 'ISLA JUAN FERNANDEZ', label: 'ISLA JUAN FERNANDEZ' },\r\n { value: 'PUCHUNCAVI', label: 'PUCHUNCAVI' },\r\n { value: 'QUINTERO', label: 'QUINTERO' },\r\n { value: 'VINA DEL MAR', label: 'VINA DEL MAR' },\r\n { value: 'ISLA DE PASCUA', label: 'ISLA DE PASCUA' },\r\n { value: 'LOS ANDES', label: 'LOS ANDES' },\r\n { value: 'CALLE LARGA', label: 'CALLE LARGA' },\r\n { value: 'RINCONADA', label: 'RINCONADA' },\r\n { value: 'SAN ESTEB', label: 'SAN ESTEB' }\r\n];\r\n\r\nexport const cityCheckListChl = [\r\n { value: 'COIHAIQUE', label: 'COIHAIQUE' },\r\n { value: 'AISEN', label: 'AISEN' },\r\n { value: 'CAPITAN PRAT', label: 'CAPITAN PRAT' },\r\n { value: 'GENERAL CARRERA', label: 'GENERAL CARRERA' },\r\n { value: 'ANTOFGASA', label: 'ANTOFGASA' },\r\n { value: 'EL LOA', label: 'EL LOA' },\r\n { value: 'TOCOPILLA', label: 'TOCOPILLA' },\r\n { value: 'ARICA', label: 'ARICA' },\r\n { value: 'PARINACOTA', label: 'PARINACOTA' },\r\n { value: 'CAUTIN', label: 'CAUTIN' },\r\n { value: 'MALLECO', label: 'MALLECO' },\r\n { value: 'COPIAPO', label: 'COPIAPO' },\r\n { value: 'CHANARAL', label: 'CHANARAL' },\r\n { value: 'HUASCO', label: 'HUASCO' },\r\n { value: 'CONCEPCION', label: 'CONCEPCION' },\r\n { value: 'ARAUCO', label: 'ARAUCO' },\r\n { value: 'BIOBIO', label: 'BIOBIO' },\r\n { value: 'NUBLE', label: 'NUBLE' },\r\n { value: 'ELQUI', label: 'ELQUI' },\r\n { value: 'CHOAPA', label: 'CHOAPA' },\r\n { value: 'LIMARI', label: 'LIMARI' },\r\n { value: 'CACHAPOAL', label: 'CACHAPOAL' },\r\n { value: 'CARDENAL CARO', label: 'CARDENAL CARO' },\r\n { value: 'COLCHAGUA', label: 'COLCHAGUA' },\r\n { value: 'LLANQUIHUE', label: 'LLANQUIHUE' },\r\n { value: 'CHILOE', label: 'CHILOE' },\r\n { value: 'OSORNO', label: 'OSORNO' },\r\n { value: 'PALENA', label: 'PALENA' },\r\n { value: 'VALDIVIA', label: 'VALDIVIA' },\r\n { value: 'RANCO', label: 'RANCO' },\r\n { value: 'MAGALLANES', label: 'MAGALLANES' },\r\n { value: 'ANTARTICA CHILENA', label: 'ANTARTICA CHILENA' },\r\n { value: 'TIERRA DEL FUEGO', label: 'TIERRA DEL FUEGO' },\r\n { value: 'ULTIMA ESPERANZA', label: 'ULTIMA ESPERANZA' },\r\n { value: 'TALCA', label: 'TALCA' },\r\n { value: 'CAUQUENES', label: 'CAUQUENES' },\r\n { value: 'CURICO', label: 'CURICO' },\r\n { value: 'LINARES', label: 'LINARES' },\r\n { value: 'SANTIAGO', label: 'SANTIAGO' },\r\n { value: 'CORDILLERA', label: 'CORDILLERA' },\r\n { value: 'CHACABUCO', label: 'CHACABUCO' },\r\n { value: 'MAIPO', label: 'MAIPO' },\r\n { value: 'MELIPLLA', label: 'MELIPLLA' },\r\n { value: 'TALAGANTE', label: 'TALAGANTE' },\r\n { value: 'IQUIQUE', label: 'IQUIQUE' },\r\n { value: 'TAMARUGAL', label: 'TAMARUGAL' },\r\n { value: 'VALPARAISO', label: 'VALPARAISO' },\r\n { value: 'ISLA DE PASCUA', label: 'ISLA DE PASCUA' },\r\n { value: 'LOS ANDES', label: 'LOS ANDES' },\r\n { value: 'PETORCA', label: 'PETORCA' },\r\n { value: 'QUILLOTA', label: 'QUILLOTA' },\r\n { value: 'SAN ANTONIO', label: 'SAN ANTONIO' },\r\n { value: 'SAN FELIPE', label: 'SAN FELIPE' },\r\n { value: 'MARGA MARGA', label: 'MARGA MARGA' }\r\n];\r\n\r\nexport const stateCheckListChl = [\r\n { value: 'AI', label: 'Aisén del General Carlos Ibañez del Campo' },\r\n { value: 'AN', label: 'Antofagasta' },\r\n { value: 'AP', label: 'Arica y Parinacota' },\r\n { value: 'AR', label: 'Araucanía' },\r\n { value: 'AT', label: 'Atacama' },\r\n { value: 'BI', label: 'Bío-Bío' },\r\n { value: 'CO', label: 'Coquimbo' },\r\n { value: 'LI', label: `Libertador General Bernardo O'Higgins` },\r\n { value: 'LL', label: 'Los Lagos' },\r\n { value: 'LR', label: 'Los Ríos' },\r\n { value: 'MA', label: 'Magallanes' },\r\n { value: 'ML', label: 'Maule' },\r\n { value: 'RM', label: 'Región Metropolitana de Santiago' },\r\n { value: 'TA', label: 'Tarapacá' },\r\n { value: 'VS', label: 'Valparaíso' }\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}\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 disabled?: 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 * 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 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 { 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 );\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 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}\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 } = 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 AddressInputFunctionComponent;\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, 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: any;\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?: any;\r\n onSaveCustom?: any;\r\n onCustomSave?: any;\r\n onSaveSmarty?: any;\r\n onCancel?(): void;\r\n loading?: any;\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: any;\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 resources?: any;\r\n defaultCountryRegionId?: any;\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 resources\r\n } = props;\r\n const twoStreetsAddressFormat: IAddressItem[] = [];\r\n\r\n // addressFormat.map((addressFormatItem, index) => {\r\n // if (addressFormatItem.name === 'Street') {\r\n // let validationRules1: IAddressValidationRule[] = [];\r\n // let validationRules2: IAddressValidationRule[] = [];\r\n // if (addressFormatItem.validationRules) {\r\n // validationRules1 = [...addressFormatItem.validationRules];\r\n // validationRules2 = [...addressFormatItem.validationRules];\r\n\r\n // validationRules1[0].message = 'Street 1 is required';\r\n // validationRules2.shift();\r\n // }\r\n\r\n // const street1 = {\r\n // ...addressFormatItem,\r\n // name: 'Street',\r\n // label: 'Street 1 *',\r\n // maxLength: 30,\r\n // validationRules: validationRules1\r\n // };\r\n // const street2 = { ...addressFormatItem, name: 'Street_2', label: 'Street 2', maxLength: 30, validationRules: validationRules2 };\r\n // twoStreetsAddressFormat.push(street1);\r\n // twoStreetsAddressFormat.push(street2);\r\n // } else {\r\n // twoStreetsAddressFormat.push(addressFormatItem);\r\n // }\r\n // });\r\n addressFormat.map((addressFormatItem, index) => {\r\n if (addressFormatItem.name === 'State' && defaultCountryRegionId === 'KOR') {\r\n addressFormatItem.label = resources.addressMunicipalityLabel;\r\n }\r\n if (addressFormatItem.name === 'City' && defaultCountryRegionId === 'AUS') {\r\n addressFormatItem.label = resources.addressSuburbLabel;\r\n }\r\n\r\n if (addressFormatItem.name === 'ThreeLetterISORegionName') {\r\n addressFormatItem.disabled = true;\r\n }\r\n if (addressFormatItem.name === 'Street') {\r\n let validationRules1: IAddressValidationRule[] = [];\r\n let validationRules2: IAddressValidationRule[] = [];\r\n if (addressFormatItem.validationRules) {\r\n validationRules1 = [...addressFormatItem.validationRules];\r\n validationRules2 = [...addressFormatItem.validationRules];\r\n\r\n validationRules1[0].message = 'Street 1 is required';\r\n validationRules2.shift();\r\n }\r\n\r\n const street1 = {\r\n ...addressFormatItem,\r\n name: 'Street',\r\n label: resources.addressStreetLabel1,\r\n maxLength: 30,\r\n validationRules: validationRules1\r\n };\r\n const street2 = {\r\n ...addressFormatItem,\r\n name: 'Street_2',\r\n label: resources.addressStreetLabel2,\r\n maxLength: 30,\r\n validationRules: validationRules2\r\n };\r\n twoStreetsAddressFormat.push(street1);\r\n twoStreetsAddressFormat.push(street2);\r\n } else {\r\n twoStreetsAddressFormat.push(addressFormatItem);\r\n }\r\n });\r\n\r\n return twoStreetsAddressFormat.map((addressFormatItem, index) => {\r\n const elementId = `${addressType.toLowerCase()}_address${addressFormatItem.name.toLowerCase()}`;\r\n let errorMessage = get(validationError, addressFormatItem.name);\r\n if (addressFormatItem.name === 'State' && defaultCountryRegionId === 'KOR' && errorMessage) {\r\n const splitErrorMessage = errorMessage.split(' ');\r\n splitErrorMessage[0] = resources.addressMunicipalityLabel.replace('*', '');\r\n const joinedMessage = splitErrorMessage.join(' ');\r\n errorMessage = joinedMessage;\r\n } else if (addressFormatItem.name === 'City' && defaultCountryRegionId === 'AUS' && errorMessage) {\r\n const splitErrorMessage = errorMessage.split(' ');\r\n splitErrorMessage[0] = resources.addressSuburbLabel.replace('*', '');\r\n const joinedMessage = splitErrorMessage.join(' ');\r\n errorMessage = joinedMessage;\r\n }\r\n const className = classname('msc-address-form__item', `msc-address-form__item-${addressFormatItem.name.toLowerCase()}`, {\r\n 'msc-address-form__item-newline': addressFormatItem.isNewLine,\r\n 'address-form__item-invalid': errorMessage\r\n });\r\n let input;\r\n\r\n if (addressFormatItem.displayType === AddressItemDisplayType.Input) {\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 // @ts-ignore\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 let filteredData: any;\r\n\r\n if (displayData) {\r\n filteredData = displayData.filter((data: any) => {\r\n return data.key !== null && data.key !== 'NULL';\r\n });\r\n }\r\n\r\n input = (\r\n \r\n );\r\n }\r\n\r\n if (addressFormatItem.name === 'State') {\r\n if (input && input.props && input.props.displayData && input.props.displayData.length > 1) {\r\n const filteredData = input.props.displayData.filter((item: any) => {\r\n return item.key !== '' && item.key !== 'NULL';\r\n });\r\n input.props.displayData = filteredData;\r\n }\r\n }\r\n\r\n return {\r\n key: addressFormatItem.name,\r\n AddressItem: { className, id: `${elementId}_container` },\r\n label: ,\r\n alert: ,\r\n input\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 defaultCountryRegionId,\r\n onCustomSave,\r\n onSaveSmarty\r\n } = props;\r\n const heading = selectedAddress.RecordId ? editAddressHeading : addAddressHeading;\r\n\r\n return {\r\n AddressForm: { className: 'msc-address-form' },\r\n defaultCountryRegionId: defaultCountryRegionId,\r\n heading: heading && ,\r\n items: getAddessItems(selectedAddress, props),\r\n isShowSaveButton: !hasExternalSubmitGroup,\r\n saveButton:\r\n onSave &&\r\n (defaultCountryRegionId === 'BRA' ||\r\n defaultCountryRegionId === 'GHA' ||\r\n defaultCountryRegionId === 'CIV' ||\r\n defaultCountryRegionId === 'NGA' ||\r\n defaultCountryRegionId === 'PER' ||\r\n defaultCountryRegionId === 'CHL' ||\r\n defaultCountryRegionId === 'URY') ? (\r\n \r\n ) : defaultCountryRegionId === 'USA' || defaultCountryRegionId === 'CAN' ? (\r\n \r\n ) : (\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 \r\n ),\r\n message: addressActionResponse && addressActionResponse.errorMessage && (\r\n \r\n )\r\n }\r\n };\r\n};\r\n","import * as React from 'react';\r\n\r\nimport { getUnitAddressesAsync } from '../../../../actions/DataActionExtension.g';\r\nimport Select from 'react-select';\r\nimport { Waiting } from '@msdyn365-commerce-modules/utilities';\r\n\r\nexport const AfricaCheckout: React.FC = ({\r\n resources,\r\n customSetAddress,\r\n context,\r\n setIsVisible,\r\n setIsDisabled,\r\n filteredItems,\r\n setUnitName,\r\n setStakeNameAddress,\r\n defaultCountryRegionId,\r\n currentAddress\r\n}) => {\r\n const [name, setName] = React.useState('');\r\n const [stakeName, setStakeName] = React.useState('');\r\n const [address, setAddress] = React.useState([]);\r\n const [unit, setUnit] = React.useState();\r\n const [isLoading, setIsLoading] = React.useState(false);\r\n const [isDone, setIsDone] = React.useState(false);\r\n const [showCity, setShowCity] = React.useState(false);\r\n const [showState, setShowState] = React.useState(false);\r\n const [options, setOptions] = React.useState([]);\r\n const [wards, setWards] = React.useState([]);\r\n const [stakes, setStakes] = React.useState([]);\r\n const [currentOptionWard, setCurrentOptionWard] = React.useState();\r\n const [currentOptionStake, setCurrentOptionStake] = React.useState();\r\n\r\n React.useEffect(() => {\r\n if (currentAddress && currentAddress.Name && currentAddress.Name !== '') {\r\n setName(currentAddress.Name);\r\n }\r\n\r\n if (currentAddress && currentAddress.Street && currentAddress.Street !== '') {\r\n const streetSplit = currentAddress.Street.split('\\n');\r\n const address = {\r\n Name: currentAddress.Name,\r\n Street: streetSplit[2] || '',\r\n City: currentAddress.City || '',\r\n StreetNumber: currentAddress.StreetNumber || '',\r\n State: currentAddress.State || '',\r\n ThreeLetterISORegionName: currentAddress.ThreeLetterISORegionName || defaultCountryRegionId || '',\r\n ZipCode: currentAddress.Zipcode || ''\r\n };\r\n setCurrentOptionWard({ label: streetSplit[0], value: streetSplit[0] });\r\n setUnitName(streetSplit[0]);\r\n setCurrentOptionStake({ label: streetSplit[1], value: streetSplit[1] });\r\n setStakeName(streetSplit[1]);\r\n setStakeNameAddress(streetSplit[1]);\r\n setUnit(address);\r\n }\r\n }, []);\r\n\r\n const getUnitAddress = async () => {\r\n const ctx = { callerContext: context.actionContext };\r\n setIsLoading(true);\r\n setIsDisabled(true);\r\n\r\n const unitAddress = await getUnitAddressesAsync(ctx, false, '', '')\r\n .then((res: any) => {\r\n setIsLoading(false);\r\n // setShowUnitSearch(false);\r\n const options = res.map((unit: any) => {\r\n return { label: unit.UnitName, value: unit.UnitName };\r\n });\r\n const stakeOptions = options.filter((option: any) => {\r\n return option.label.includes('Stake') || option.label.includes('stake');\r\n });\r\n const wardOptions = options.filter((option: any) => {\r\n return option.label.toLowerCase().includes('ward') || option.label.toLowerCase().includes('branch');\r\n });\r\n setWards(wardOptions);\r\n setStakes(stakeOptions);\r\n setOptions(options);\r\n\r\n if (res && res[0] !== undefined && res[1] === undefined) {\r\n if (options && options.length === 1) {\r\n setCurrentOptionWard(options[0]);\r\n }\r\n const address = {\r\n Name: name,\r\n Street: res[0].Street || '',\r\n City: res[0].City || '',\r\n StreetNumber: res[0].StreetNumber || '',\r\n State: res[0].State || '',\r\n ThreeLetterISORegionName: res[0].CountryRegionId || defaultCountryRegionId || '',\r\n ZipCode: res[0].Zipcode || ''\r\n };\r\n setUnitName(res[0].UnitName);\r\n customSetAddress(address);\r\n setAddress(res);\r\n setUnit(address);\r\n } else if (res && res[0] !== undefined) {\r\n // setCurrentOptionWard(null);\r\n setAddress(res);\r\n // setUnit({});\r\n } else if (res && res[0] === undefined) {\r\n setIsVisible(false);\r\n }\r\n })\r\n .catch((err: any) => {\r\n setIsLoading(false);\r\n return console.log(err);\r\n });\r\n setIsDone(true);\r\n\r\n return unitAddress;\r\n };\r\n\r\n React.useEffect(() => {\r\n void getUnitAddress();\r\n if (filteredItems) {\r\n const hasCity = filteredItems.some((obj: any) => obj.hasOwnProperty('key') && obj.key === 'City');\r\n const hasState = filteredItems.some((obj: any) => obj.hasOwnProperty('key') && obj.key === 'State');\r\n setShowCity(hasCity);\r\n setShowState(hasState);\r\n }\r\n }, []);\r\n\r\n if (isLoading) {\r\n return (\r\n \r\n \r\n
\r\n );\r\n } else if (options && isDone) {\r\n if (options) {\r\n options.sort((a: any, b: any) => {\r\n const labelA = a.label.toUpperCase();\r\n const labelB = b.label.toUpperCase();\r\n\r\n if (labelA < labelB) {\r\n return -1;\r\n }\r\n if (labelA > labelB) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n }\r\n if (wards) {\r\n wards.sort((a: any, b: any) => {\r\n const labelA = a.label.toUpperCase();\r\n const labelB = b.label.toUpperCase();\r\n\r\n if (labelA < labelB) {\r\n return -1;\r\n }\r\n if (labelA > labelB) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n }\r\n if (stakes) {\r\n stakes.sort((a: any, b: any) => {\r\n const labelA = a.label.toUpperCase();\r\n const labelB = b.label.toUpperCase();\r\n\r\n if (labelA < labelB) {\r\n return -1;\r\n }\r\n if (labelA > labelB) {\r\n return 1;\r\n }\r\n return 0;\r\n });\r\n }\r\n setIsVisible(true);\r\n const onChangeWard = (e: any) => {\r\n const selectedAddress = address.filter((unit: any) => {\r\n return unit.UnitName === e.value;\r\n });\r\n const newAddress: any = {};\r\n if (selectedAddress && selectedAddress[0]) {\r\n if (name && name !== '' && stakeName !== '') {\r\n setIsDisabled(false);\r\n } else {\r\n setIsDisabled(true);\r\n }\r\n setUnitName(selectedAddress[0].UnitName);\r\n setUnit(selectedAddress[0]);\r\n newAddress.Name = name ? name : '';\r\n newAddress.Street = selectedAddress[0] ? (selectedAddress[0].Street ? selectedAddress[0].Street : '') : '';\r\n newAddress.City = selectedAddress[0] ? (selectedAddress[0].City ? selectedAddress[0].City : '') : '';\r\n newAddress.StreetNumber = selectedAddress[0]\r\n ? selectedAddress[0].StreetNumber\r\n ? selectedAddress[0].StreetNumber\r\n : ''\r\n : '';\r\n newAddress.State = selectedAddress[0] ? (selectedAddress[0].State ? selectedAddress[0].State : '') : '';\r\n newAddress.ThreeLetterISORegionName = selectedAddress[0]\r\n ? selectedAddress[0].ThreeLetterISORegionName\r\n ? selectedAddress[0].ThreeLetterISORegionName\r\n : selectedAddress[0].CountryRegionId\r\n ? selectedAddress[0].CountryRegionId\r\n : ''\r\n : '';\r\n newAddress.ZipCode = selectedAddress[0] ? (selectedAddress[0].Zipcode ? selectedAddress[0].Zipcode : '') : '';\r\n }\r\n customSetAddress(newAddress);\r\n };\r\n const onChangeStake = (e: any) => {\r\n if (e && e.value !== '' && unit && unit.Street && name !== '') {\r\n setIsDisabled(false);\r\n } else {\r\n setIsDisabled(true);\r\n }\r\n const newAddress: any = {};\r\n setStakeName(e.value);\r\n setStakeNameAddress(e.value);\r\n newAddress.Name = name;\r\n newAddress.Street = unit ? (unit.Street ? unit.Street : '') : '';\r\n newAddress.City = unit ? (unit.City ? unit.City : '') : '';\r\n newAddress.StreetNumber = unit ? (unit.StreetNumber ? unit.StreetNumber : '') : '';\r\n newAddress.State = unit ? (unit.State ? unit.State : '') : '';\r\n newAddress.ThreeLetterISORegionName = unit\r\n ? unit.ThreeLetterISORegionName\r\n ? unit.ThreeLetterISORegionName\r\n : unit.CountryRegionId\r\n ? unit.CountryRegionId\r\n : ''\r\n : '';\r\n newAddress.ZipCode = unit ? (unit.Zipcode ? unit.Zipcode : '') : '';\r\n\r\n customSetAddress(newAddress);\r\n setUnit(newAddress);\r\n };\r\n\r\n // const setUnitSearch = async () => {\r\n // // setShowUnitSearch(true);\r\n // await getUnitAddress(false);\r\n // setIsVisible(false);\r\n // };\r\n\r\n const nameChange = (value: string) => {\r\n if (value !== '' && unit && unit.Street && stakeName !== '') {\r\n setIsDisabled(false);\r\n } else {\r\n setIsDisabled(true);\r\n }\r\n const newAddress: any = {\r\n Name: value\r\n };\r\n setName(value);\r\n // setShowDefault(true);\r\n newAddress.Street = unit ? (unit.Street ? unit.Street : '') : '';\r\n newAddress.City = unit ? (unit.City ? unit.City : '') : '';\r\n newAddress.StreetNumber = unit ? (unit.StreetNumber ? unit.StreetNumber : '') : '';\r\n newAddress.State = unit ? (unit.State ? unit.State : '') : '';\r\n newAddress.ThreeLetterISORegionName = unit\r\n ? unit.ThreeLetterISORegionName\r\n ? unit.ThreeLetterISORegionName\r\n : unit.CountryRegionId\r\n ? unit.CountryRegionId\r\n : ''\r\n : '';\r\n newAddress.ZipCode = unit ? (unit.Zipcode ? unit.Zipcode : '') : '';\r\n\r\n customSetAddress(newAddress);\r\n setUnit(newAddress);\r\n };\r\n return (\r\n \r\n );\r\n } else {\r\n return null;\r\n }\r\n};\r\n","import * as React from 'react';\r\nimport axios from 'axios';\r\n\r\nexport const BrazilCheckout: React.FC = ({ resources, customSetAddress, setIsDisabled, currentAddress }) => {\r\n const [zipcode, setZipcode] = React.useState('');\r\n const [name, setName] = React.useState('');\r\n const [street, setStreet] = React.useState('');\r\n const [streetTwo, setStreetTwo] = React.useState('');\r\n const [neighborhood, setNeighborhood] = React.useState('');\r\n const [city, setCity] = React.useState('');\r\n const [houseNum, setHouseNum] = React.useState('');\r\n const [state, setState] = React.useState('');\r\n const [address, setAddress] = React.useState([]);\r\n const [disabled, setDisabled] = React.useState(false);\r\n const findAddress = async () => {\r\n await axios({\r\n method: 'get',\r\n // url: `https://viacep.com.br/ws/01137-010/json`\r\n url: `https://viacep.com.br/ws/${zipcode}/json`\r\n }).then(response => {\r\n const address = {\r\n Name: name,\r\n Street: response.data.logradouro,\r\n City: response.data.localidade,\r\n DistrictName: response.data.bairro,\r\n State: response.data.uf,\r\n StreetNumber: houseNum,\r\n ZipCode: zipcode\r\n };\r\n if (response.data.logradouro) {\r\n customSetAddress(address);\r\n setAddress(address);\r\n setStreet(response.data.logradouro || '');\r\n setDisabled(true);\r\n }\r\n });\r\n };\r\n\r\n React.useEffect(() => {\r\n if (zipcode.length >= 8) {\r\n void findAddress();\r\n } else if (zipcode.length === 0) {\r\n setAddress(null);\r\n setDisabled(false);\r\n setStreet('');\r\n }\r\n }, [zipcode]);\r\n\r\n React.useEffect(() => {\r\n if (\r\n address &&\r\n address.City &&\r\n address.Name &&\r\n address.State &&\r\n address.ZipCode &&\r\n address.Street &&\r\n address.DistrictName &&\r\n address.StreetNumber\r\n ) {\r\n setIsDisabled(false);\r\n } else {\r\n setIsDisabled(true);\r\n }\r\n }, [address]);\r\n React.useEffect(() => {\r\n const address: any = {\r\n // Name: name,\r\n // Street: response.data.logradouro,\r\n // City: response.data.localidade,\r\n // DistrictName: response.data.bairro,\r\n // State: response.data.uf,\r\n // StreetNumber: houseNum,\r\n // ZipCode: zipcode\r\n };\r\n if (currentAddress && currentAddress.Name && currentAddress.Name !== '') {\r\n setName(currentAddress.Name);\r\n address.Name = currentAddress.Name;\r\n }\r\n if (currentAddress && currentAddress.City && currentAddress.City !== '') {\r\n setCity(currentAddress.City);\r\n address.City = currentAddress.City;\r\n }\r\n if (currentAddress && currentAddress.State && currentAddress.State !== '') {\r\n setState(currentAddress.State);\r\n address.State = currentAddress.State;\r\n }\r\n if (currentAddress && currentAddress.ZipCode && currentAddress.ZipCode !== '') {\r\n setZipcode(currentAddress.ZipCode);\r\n address.ZipCode = currentAddress.ZipCode;\r\n }\r\n if (currentAddress && currentAddress.Street && currentAddress.Street !== '') {\r\n const streetSplit = currentAddress.Street.split('\\n');\r\n address.Street = currentAddress.Street;\r\n\r\n if (streetSplit && streetSplit[0]) {\r\n setStreet(streetSplit[0]);\r\n }\r\n if (streetSplit && streetSplit[1]) {\r\n setStreetTwo(streetSplit[1]);\r\n }\r\n }\r\n if (currentAddress && currentAddress.DistrictName && currentAddress.DistrictName !== '') {\r\n setNeighborhood(currentAddress.DistrictName);\r\n address.DistrictName = currentAddress.DistrictName;\r\n }\r\n if (currentAddress && currentAddress.StreetNumber && currentAddress.StreetNumber !== '') {\r\n setHouseNum(currentAddress.StreetNumber);\r\n address.StreetNumber = currentAddress.StreetNumber;\r\n }\r\n customSetAddress(address);\r\n // if (currentAddress && currentAddress.Name && currentAddress.Name !== '') {\r\n // setName(currentAddress.Name);\r\n // }\r\n }, []);\r\n\r\n const nameChange = (value: string) => {\r\n const newAddress: any = {\r\n Name: value\r\n };\r\n setName(value);\r\n newAddress.Street = address && address.Street ? address.Street : streetTwo ? `${address.Street || street}\\n${streetTwo}` : street;\r\n newAddress.City = address && address.City ? address.City : city;\r\n newAddress.DistrictName = address && address.DistrictName ? address.DistrictName : neighborhood;\r\n newAddress.ZipCode = address && address.ZipCode ? address.ZipCode : zipcode;\r\n newAddress.StreetNumber = address && address.StreetNumber ? address.StreetNumber : houseNum;\r\n newAddress.State = address && address.State ? address.State : state;\r\n\r\n customSetAddress(newAddress);\r\n setAddress(newAddress);\r\n };\r\n\r\n const houseNumChange = (value: string) => {\r\n const newAddress: any = {\r\n StreetNumber: value\r\n };\r\n setHouseNum(value);\r\n newAddress.Name = name;\r\n newAddress.Street = address && address.Street ? address.Street : streetTwo ? `${address.Street || street}\\n${streetTwo}` : street;\r\n newAddress.City = address && address.City ? address.City : city;\r\n newAddress.DistrictName = address && address.DistrictName ? address.DistrictName : neighborhood;\r\n newAddress.ZipCode = address && address.ZipCode ? address.ZipCode : zipcode;\r\n newAddress.State = address && address.State ? address.State : state;\r\n\r\n customSetAddress(newAddress);\r\n setAddress(newAddress);\r\n };\r\n\r\n const cityChange = (value: string) => {\r\n const newAddress: any = {\r\n City: value\r\n };\r\n setCity(value);\r\n newAddress.Name = name;\r\n newAddress.Street = address && address.Street ? address.Street : streetTwo ? `${address.Street || street}\\n${streetTwo}` : street;\r\n newAddress.DistrictName = address && address.DistrictName ? address.DistrictName : neighborhood;\r\n newAddress.ZipCode = address && address.ZipCode ? address.ZipCode : zipcode;\r\n newAddress.StreetNumber = address && address.StreetNumber ? address.StreetNumber : houseNum;\r\n newAddress.State = address && address.State ? address.State : state;\r\n\r\n customSetAddress(newAddress);\r\n setAddress(newAddress);\r\n };\r\n\r\n const neighborChange = (value: string) => {\r\n const newAddress: any = {\r\n District: value\r\n };\r\n setNeighborhood(value);\r\n newAddress.Name = name;\r\n newAddress.Street = address && address.Street ? address.Street : streetTwo ? `${address.Street || street}\\n${streetTwo}` : street;\r\n newAddress.City = address && address.City ? address.City : city;\r\n newAddress.ZipCode = address && address.ZipCode ? address.ZipCode : zipcode;\r\n newAddress.StreetNumber = address && address.StreetNumber ? address.StreetNumber : houseNum;\r\n newAddress.State = address && address.State ? address.State : state;\r\n\r\n customSetAddress(newAddress);\r\n setAddress(newAddress);\r\n };\r\n\r\n const streetChange = (value: string) => {\r\n const newAddress: any = {\r\n Street: streetTwo ? `${value}\\n${streetTwo}` : value\r\n };\r\n setStreet(value);\r\n newAddress.Name = name;\r\n newAddress.City = address && address.City ? address.City : city;\r\n newAddress.DistrictName = address && address.DistrictName ? address.DistrictName : neighborhood;\r\n newAddress.ZipCode = address && address.ZipCode ? address.ZipCode : zipcode;\r\n newAddress.StreetNumber = address && address.StreetNumber ? address.StreetNumber : houseNum;\r\n newAddress.State = address && address.State ? address.State : state;\r\n\r\n customSetAddress(newAddress);\r\n setAddress(newAddress);\r\n };\r\n\r\n const streetTwoChange = (value: string) => {\r\n const streetOne = address.Street ? address.Street.split('\\n') : street ? street.split('\\n') : '';\r\n const newAddress: any = {\r\n Street: `${streetOne && streetOne[0] ? streetOne[0] : ''}\\n${value}`\r\n };\r\n setStreetTwo(value);\r\n newAddress.Name = name;\r\n newAddress.City = address && address.City ? address.City : city;\r\n newAddress.DistrictName = address && address.DistrictName ? address.DistrictName : neighborhood;\r\n newAddress.ZipCode = address && address.ZipCode ? address.ZipCode : zipcode;\r\n newAddress.StreetNumber = address && address.StreetNumber ? address.StreetNumber : houseNum;\r\n newAddress.State = address && address.State ? address.State : state;\r\n\r\n customSetAddress(newAddress);\r\n setAddress(newAddress);\r\n };\r\n\r\n const stateChange = (value: string) => {\r\n const newAddress: any = {\r\n State: value\r\n };\r\n setState(value);\r\n newAddress.Name = name;\r\n newAddress.City = address && address.City ? address.City : city;\r\n newAddress.Street = address && address.Street ? address.Street : streetTwo ? `${address.Street || street}\\n${streetTwo}` : street;\r\n newAddress.DistrictName = address && address.DistrictName ? address.DistrictName : neighborhood;\r\n newAddress.ZipCode = address && address.ZipCode ? address.ZipCode : zipcode;\r\n newAddress.StreetNumber = address && address.StreetNumber ? address.StreetNumber : houseNum;\r\n\r\n customSetAddress(newAddress);\r\n setAddress(newAddress);\r\n };\r\n\r\n return (\r\n \r\n \r\n nameChange(e.target.value)}\r\n />\r\n \r\n setZipcode(e.target.value)}\r\n />\r\n \r\n houseNumChange(e.target.value)}\r\n />\r\n \r\n streetChange(e.target.value)}\r\n disabled={disabled}\r\n />\r\n \r\n streetTwoChange(e.target.value)}\r\n // disabled={address ? true : false}\r\n />\r\n \r\n neighborChange(e.target.value)}\r\n disabled={disabled}\r\n />\r\n \r\n stateChange(e.target.value)}\r\n disabled={disabled}\r\n />\r\n \r\n cityChange(e.target.value)}\r\n disabled={disabled}\r\n />\r\n
\r\n );\r\n};\r\n","import * as React from 'react';\r\nimport { getCitiesAsync, getCountiesAsync, getZipcodesAsync } from '../../../../actions/DataActionExtension.g';\r\n// @ts-ignore\r\nimport { Secondary } from '@churchofjesuschrist/eden-buttons';\r\n// @ts-ignore\r\nimport { Error } from '@churchofjesuschrist/eden-alert';\r\nimport { Address } from '@msdyn365-commerce/retail-proxy';\r\n\r\nexport const PeruCheckout: React.FC = ({\r\n resources,\r\n customSetAddress,\r\n context,\r\n setIsVisible,\r\n setIsDisabled,\r\n filteredItems,\r\n defaultCountryRegionId,\r\n currentAddress\r\n}) => {\r\n const [name, setName] = React.useState('');\r\n const [streetNum, setStreetNum] = React.useState('');\r\n const [street, setStreet] = React.useState('');\r\n const [counties, setCounties] = React.useState();\r\n const [cities, setCities] = React.useState();\r\n const [stateId, setStateId] = React.useState('');\r\n // const [state, setState] = React.useState('');\r\n const [city, setCity] = React.useState('');\r\n const [county, setCounty] = React.useState('');\r\n const [address, setAddress] = React.useState([]);\r\n const [citySelected, setCitySelected] = React.useState(false);\r\n const [zipcode, setZipcode] = React.useState('');\r\n // const [, setZipcode] = React.useState('');\r\n\r\n React.useEffect(() => {\r\n if (name !== '' && street !== '' && citySelected && streetNum !== '' && zipcode !== '') {\r\n setIsDisabled(false);\r\n } else {\r\n setIsDisabled(true);\r\n }\r\n }, [address, citySelected]);\r\n const getData = async (state: string, county: string) => {\r\n const ctx = { callerContext: context.actionContext };\r\n\r\n const countiesList = await getCountiesAsync(ctx, 'PER', state);\r\n\r\n const citiesList = await getCitiesAsync(ctx, 'PER', state, county);\r\n\r\n setCounties(countiesList);\r\n setCities(citiesList);\r\n };\r\n\r\n React.useEffect(() => {\r\n if (currentAddress && currentAddress.Name && currentAddress.Name !== '') {\r\n setName(currentAddress.Name);\r\n }\r\n if (currentAddress && currentAddress.City && currentAddress.City !== '') {\r\n setCity(currentAddress.City);\r\n }\r\n if (currentAddress && currentAddress.State && currentAddress.State !== '') {\r\n setStateId(currentAddress.State);\r\n }\r\n if (currentAddress && currentAddress.ZipCode && currentAddress.ZipCode !== '') {\r\n setZipcode(currentAddress.ZipCode);\r\n }\r\n if (currentAddress && currentAddress.Street && currentAddress.Street !== '') {\r\n const streetSplit = currentAddress.Street.split('\\n');\r\n if (streetSplit && streetSplit[0]) {\r\n setStreet(streetSplit[0]);\r\n }\r\n if (streetSplit && streetSplit[1]) {\r\n setStreetNum(streetSplit[1]);\r\n }\r\n if (streetSplit && streetSplit[2]) {\r\n setCounty(streetSplit[2]);\r\n }\r\n }\r\n // if (currentAddress && currentAddress.DistrictName && currentAddress.DistrictName !== '') {\r\n // setNeighborhood(currentAddress.DistrictName);\r\n // }\r\n if (currentAddress && currentAddress.StreetNumber && currentAddress.StreetNumber !== '') {\r\n setStreetNum(currentAddress.StreetNumber);\r\n }\r\n\r\n if (currentAddress && currentAddress.Street && currentAddress.State) {\r\n const streetSplit = currentAddress.Street.split('\\n');\r\n if (streetSplit && streetSplit[2]) {\r\n void getData(currentAddress.State, streetSplit[2]);\r\n }\r\n }\r\n // if (currentAddress && currentAddress.Name && currentAddress.Name !== '') {\r\n // setName(currentAddress.Name);\r\n // }\r\n }, []);\r\n\r\n let countiesList;\r\n const findCounties = async (state: any) => {\r\n const ctx = { callerContext: context.actionContext };\r\n // countiesList = await getCountiesAsync(ctx, 'PER', state);\r\n countiesList = await getCountiesAsync(ctx, 'PER', state);\r\n const selectedState = filteredItems.filter((county: any) => {\r\n return county.key === state;\r\n });\r\n\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: `${street}\\n${streetNum}\\n${county}`,\r\n StreetNumber: streetNum,\r\n City: city,\r\n State: selectedState[0].key,\r\n ZipCode: zipcode\r\n };\r\n setCitySelected(false);\r\n\r\n customSetAddress(customAddress);\r\n setCounties(countiesList);\r\n setCities([]);\r\n setStateId(state);\r\n setAddress(customAddress);\r\n\r\n return countiesList;\r\n };\r\n let citiesList: any;\r\n const findCities = async (county: any) => {\r\n const ctx = { callerContext: context.actionContext };\r\n citiesList = await getCitiesAsync(ctx, 'PER', stateId, county);\r\n\r\n setCounty(county);\r\n setCities(citiesList);\r\n\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: `${street}\\n${streetNum}\\n${county}`,\r\n StreetNumber: streetNum,\r\n City: city,\r\n State: stateId,\r\n ZipCode: zipcode\r\n };\r\n setCitySelected(false);\r\n customSetAddress(customAddress);\r\n setCity('');\r\n setAddress(customAddress);\r\n\r\n return citiesList;\r\n };\r\n let zipcodeAsync: any;\r\n const selectCity = async (city: any) => {\r\n const ctx = { callerContext: context.actionContext };\r\n\r\n zipcodeAsync = await getZipcodesAsync(ctx, 'PER', stateId, county, city).catch((err: any) => {\r\n console.log(err);\r\n });\r\n if (zipcodeAsync && zipcodeAsync[0]) {\r\n setZipcode(zipcodeAsync[0].ZipPostalCode);\r\n }\r\n\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: `${street}\\n${streetNum}\\n${county}`,\r\n StreetNumber: streetNum,\r\n City: city,\r\n State: stateId,\r\n ZipCode: zipcodeAsync && zipcodeAsync[0] ? zipcodeAsync[0].ZipPostalCode : ''\r\n };\r\n\r\n customSetAddress(customAddress);\r\n if (city && city !== '') {\r\n setCitySelected(true);\r\n } else {\r\n setCitySelected(false);\r\n }\r\n setAddress(customAddress);\r\n setCity(city);\r\n };\r\n\r\n const customSetName = (name: any) => {\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: `${street}\\n${streetNum}\\n${county}`,\r\n StreetNumber: streetNum,\r\n City: city,\r\n State: stateId,\r\n ZipCode: zipcode\r\n };\r\n\r\n customSetAddress(customAddress);\r\n setAddress(customAddress);\r\n setName(name);\r\n };\r\n const customSetStreetNum = (streetNum: any) => {\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: `${street}\\n${streetNum}\\n${county}`,\r\n StreetNumber: streetNum,\r\n City: city,\r\n State: stateId,\r\n ZipCode: zipcode\r\n };\r\n\r\n customSetAddress(customAddress);\r\n setAddress(customAddress);\r\n setStreetNum(streetNum);\r\n };\r\n const customSetStreet = (street: any) => {\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: `${street}\\n${streetNum}\\n${county}`,\r\n StreetNumber: streetNum,\r\n City: city,\r\n State: stateId,\r\n ZipCode: zipcode\r\n };\r\n customSetAddress(customAddress);\r\n setAddress(customAddress);\r\n setStreet(street);\r\n };\r\n return (\r\n \r\n \r\n customSetName(e.target.value)}\r\n />\r\n \r\n customSetStreetNum(e.target.value)}\r\n />\r\n \r\n customSetStreet(e.target.value)}\r\n />\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n );\r\n};\r\n","import * as React from 'react';\r\nimport { getCitiesAsync, getDistrictsAsync } from '../../../../actions/DataActionExtension.g';\r\n// @ts-ignore\r\nimport { Secondary } from '@churchofjesuschrist/eden-buttons';\r\n// @ts-ignore\r\nimport { Error } from '@churchofjesuschrist/eden-alert';\r\nimport { Address } from '@msdyn365-commerce/retail-proxy';\r\nimport { cityCheckListChl, districtListCHL } from '../countryFilterLists.tsx/Chile';\r\n\r\nexport const ChileCheckout: React.FC = ({\r\n resources,\r\n customSetAddress,\r\n context,\r\n setIsVisible,\r\n setIsDisabled,\r\n filteredItems,\r\n defaultCountryRegionId,\r\n currentAddress\r\n}) => {\r\n const [name, setName] = React.useState('');\r\n const [street, setStreet] = React.useState('');\r\n const [districts, setDistricts] = React.useState();\r\n const [cities, setCities] = React.useState();\r\n const [state, setState] = React.useState('');\r\n const [city, setCity] = React.useState('');\r\n const [district, setDistrict] = React.useState('');\r\n const [address, setAddress] = React.useState([]);\r\n const [citySelected, setCitySelected] = React.useState(false);\r\n const [districtSelected, setDistrictSelected] = React.useState(false);\r\n\r\n const getData = async (state: string, county: string) => {\r\n const ctx = { callerContext: context.actionContext };\r\n const citiesList = await getCitiesAsync(ctx, 'CHL', state, '');\r\n\r\n const districtList = await getDistrictsAsync(ctx, 'CHL', state, '', city);\r\n\r\n setCities(citiesList);\r\n setDistricts(districtList);\r\n };\r\n\r\n React.useEffect(() => {\r\n if (currentAddress && currentAddress.Name && currentAddress.Name !== '') {\r\n setName(currentAddress.Name);\r\n }\r\n if (currentAddress && currentAddress.City && currentAddress.City !== '') {\r\n setCity(currentAddress.City);\r\n }\r\n if (currentAddress && currentAddress.State && currentAddress.State !== '') {\r\n setState(currentAddress.State);\r\n }\r\n if (currentAddress && currentAddress.DistrictName && currentAddress.DistrictName !== '') {\r\n setDistrict(currentAddress.DistrictName);\r\n }\r\n if (currentAddress && currentAddress.Street && currentAddress.Street !== '') {\r\n const streetSplit = currentAddress.Street.split('\\n');\r\n if (streetSplit && streetSplit[0]) {\r\n setStreet(streetSplit[0]);\r\n }\r\n }\r\n\r\n if (currentAddress && currentAddress.City && currentAddress.State) {\r\n void getData(currentAddress.State, currentAddress.City);\r\n }\r\n }, []);\r\n\r\n React.useEffect(() => {\r\n if (name !== '' && street !== '' && citySelected && districts.length === 0) {\r\n setIsDisabled(false);\r\n } else if (name !== '' && street !== '' && citySelected && districts && districtSelected) {\r\n setIsDisabled(false);\r\n } else {\r\n setIsDisabled(true);\r\n }\r\n }, [address, citySelected, districts]);\r\n\r\n let citiesList: any;\r\n const findCities = async (state: any) => {\r\n const ctx = { callerContext: context.actionContext };\r\n citiesList = await getCitiesAsync(ctx, 'CHL', state, '');\r\n let filteredCities: any;\r\n if (citiesList) {\r\n filteredCities = citiesList.filter((option: any) => {\r\n return cityCheckListChl.some(item => item.value === option.Name && item.label === option.Description);\r\n });\r\n }\r\n\r\n setCities(filteredCities ? filteredCities : citiesList);\r\n // setCities(citiesList);\r\n\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: `${street}`,\r\n State: state,\r\n City: city,\r\n DistrictName: district\r\n };\r\n setDistricts([]);\r\n setDistrict('');\r\n setCity('');\r\n setState(state);\r\n setCitySelected(false);\r\n setDistrictSelected(false);\r\n customSetAddress(customAddress);\r\n setAddress(customAddress);\r\n\r\n return citiesList;\r\n };\r\n let districtList: any;\r\n const selectCity = async (city: any) => {\r\n const ctx = { callerContext: context.actionContext };\r\n\r\n districtList = await getDistrictsAsync(ctx, 'CHL', state, '', city);\r\n\r\n let filteredDistricts: any;\r\n if (districtList) {\r\n filteredDistricts = districtList.filter((option: any) => {\r\n return districtListCHL.some(item => item.value === option.Name && item.label === option.Description);\r\n });\r\n }\r\n\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: `${street}`,\r\n State: state,\r\n City: city,\r\n DistrictName: districtList.length === 0 ? '' : district\r\n };\r\n const isSelected = district ? true : false;\r\n\r\n setDistricts(filteredDistricts ? filteredDistricts : districtList);\r\n // setDistricts(districtList);\r\n\r\n customSetAddress(customAddress);\r\n setCitySelected(true);\r\n setDistrictSelected(isSelected);\r\n setAddress(customAddress);\r\n setCity(city);\r\n setDistrict('');\r\n };\r\n\r\n const selectDistrict = async (district: any) => {\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: `${street}`,\r\n State: state,\r\n City: city,\r\n DistrictName: district\r\n };\r\n\r\n customSetAddress(customAddress);\r\n setDistrictSelected(true);\r\n setAddress(customAddress);\r\n setDistrict(district);\r\n };\r\n\r\n const customSetName = (name: any) => {\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: `${street}`,\r\n State: state,\r\n City: city,\r\n DistrictName: district\r\n };\r\n\r\n customSetAddress(customAddress);\r\n setAddress(customAddress);\r\n setName(name);\r\n };\r\n const customSetStreet = (street: any) => {\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: `${street}`,\r\n State: state,\r\n City: city,\r\n DistrictName: district\r\n };\r\n customSetAddress(customAddress);\r\n setAddress(customAddress);\r\n setStreet(street);\r\n };\r\n return (\r\n \r\n \r\n customSetName(e.target.value)}\r\n />\r\n \r\n customSetStreet(e.target.value)}\r\n />\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n );\r\n};\r\n","import * as React from 'react';\r\n// @ts-ignore\r\nimport { Secondary } from '@churchofjesuschrist/eden-buttons';\r\n// @ts-ignore\r\nimport { Error } from '@churchofjesuschrist/eden-alert';\r\nimport { Address } from '@msdyn365-commerce/retail-proxy';\r\n\r\nexport const UruguayCheckout: React.FC = ({\r\n resources,\r\n customSetAddress,\r\n setIsDisabled,\r\n filteredItems,\r\n defaultCountryRegionId,\r\n currentAddress,\r\n addressItems\r\n}) => {\r\n const [name, setName] = React.useState('');\r\n const [betweenStreet, setBetweenStreet] = React.useState('');\r\n const [street, setStreet] = React.useState('');\r\n const [postalCode, setPostalCode] = React.useState('');\r\n const [stateId, setStateId] = React.useState('');\r\n const [address, setAddress] = React.useState([]);\r\n const [zipcode, setZipcode] = React.useState('');\r\n const [countryRegionName, SetCountryRegionName] = React.useState('');\r\n\r\n React.useEffect(() => {\r\n if (name !== '' && street !== '' && stateId !== '') {\r\n setIsDisabled(false);\r\n } else {\r\n setIsDisabled(true);\r\n }\r\n }, [address]);\r\n\r\n React.useEffect(() => {\r\n let countryList;\r\n let countryValue;\r\n if (addressItems) {\r\n countryList = addressItems.filter((item: any) => {\r\n return item.key === 'ThreeLetterISORegionName';\r\n });\r\n }\r\n\r\n if (\r\n countryList &&\r\n countryList[0] &&\r\n countryList[0].input &&\r\n countryList[0].input.props &&\r\n countryList[0].input.props.displayData &&\r\n defaultCountryRegionId\r\n ) {\r\n countryValue = countryList[0].input.props.displayData.filter((country: any) => {\r\n return country.key === defaultCountryRegionId;\r\n });\r\n }\r\n\r\n if (countryValue && countryValue[0]) {\r\n SetCountryRegionName(countryValue[0].value);\r\n }\r\n }, []);\r\n\r\n React.useEffect(() => {\r\n if (currentAddress && currentAddress.Name && currentAddress.Name !== '') {\r\n setName(currentAddress.Name);\r\n }\r\n if (currentAddress && currentAddress.State && currentAddress.State !== '') {\r\n setStateId(currentAddress.State);\r\n }\r\n if (currentAddress && currentAddress.ZipCode && currentAddress.ZipCode !== '') {\r\n setZipcode(currentAddress.ZipCode);\r\n setPostalCode(currentAddress.ZipCode);\r\n }\r\n if (currentAddress && currentAddress.Street && currentAddress.Street !== '') {\r\n const streetSplit = currentAddress.Street.split('\\n');\r\n if (streetSplit && streetSplit[0]) {\r\n setStreet(streetSplit[0]);\r\n }\r\n if (streetSplit && streetSplit[1]) {\r\n setBetweenStreet(streetSplit[1]);\r\n } else if (currentAddress.Street_2 && currentAddress.Street_2 !== '') {\r\n setBetweenStreet(currentAddress.Street_2);\r\n }\r\n }\r\n if (currentAddress) {\r\n setAddress(currentAddress);\r\n }\r\n }, []);\r\n\r\n const selectState = async (state: any) => {\r\n const selectedState = filteredItems.filter((county: any) => {\r\n return county.key === state;\r\n });\r\n\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: betweenStreet && betweenStreet !== '' ? `${street}\\n${betweenStreet}` : `${street}`,\r\n State: selectedState[0].key,\r\n ZipCode: zipcode\r\n };\r\n customSetAddress(customAddress);\r\n setStateId(state);\r\n setAddress(customAddress);\r\n };\r\n\r\n const customSetName = (name: any) => {\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: betweenStreet && betweenStreet !== '' ? `${street}\\n${betweenStreet}` : `${street}`,\r\n State: stateId,\r\n ZipCode: postalCode\r\n };\r\n\r\n customSetAddress(customAddress);\r\n setAddress(customAddress);\r\n setName(name);\r\n };\r\n const customSetPostalCode = (zipcode: any) => {\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: betweenStreet && betweenStreet !== '' ? `${street}\\n${betweenStreet}` : `${street}`,\r\n State: stateId,\r\n ZipCode: zipcode\r\n };\r\n\r\n customSetAddress(customAddress);\r\n setAddress(customAddress);\r\n setPostalCode(zipcode);\r\n };\r\n const customSetBetweenStreet = (betweenStreet: any) => {\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: betweenStreet && betweenStreet !== '' ? `${street}\\n${betweenStreet}` : `${street}`,\r\n State: stateId,\r\n ZipCode: postalCode\r\n };\r\n\r\n customSetAddress(customAddress);\r\n setAddress(customAddress);\r\n setBetweenStreet(betweenStreet);\r\n };\r\n const customSetStreet = (street: any) => {\r\n const customAddress: Address = {\r\n Name: name,\r\n Street: betweenStreet && betweenStreet !== '' ? `${street}\\n${betweenStreet}` : `${street}`,\r\n State: stateId,\r\n ZipCode: postalCode\r\n };\r\n customSetAddress(customAddress);\r\n setAddress(customAddress);\r\n setStreet(street);\r\n };\r\n return (\r\n \r\n \r\n customSetName(e.target.value)}\r\n />\r\n \r\n customSetStreet(e.target.value)}\r\n />\r\n \r\n customSetBetweenStreet(e.target.value)}\r\n />\r\n \r\n \r\n \r\n customSetPostalCode(e.target.value)}\r\n />\r\n \r\n \r\n
\r\n );\r\n};\r\n","import React, { useState } from 'react';\r\nimport {\r\n Address,\r\n AddressPurpose,\r\n Cart,\r\n AsyncResult,\r\n ChannelDeliveryOptionConfiguration,\r\n FeatureState,\r\n OrgUnitLocation,\r\n StateProvinceInfo,\r\n CountryRegionInfo\r\n} from '@msdyn365-commerce/retail-proxy';\r\nimport { IAddressAddItem } from '../../modules/lds-checkout-shipping-address-4/components/address/address-add';\r\n// import { AddressFormat } from '../../modules/lds-delivery/components/address-format';\r\n// import { AddressFormat } from '@msdyn365-commerce-modules/address';\r\n// import {\r\n// IAddressDropdownsData,\r\n// IAddressItem,\r\n// IAddressValidationRule,\r\n// AddressItemDisplayType,\r\n// AddressItemType,\r\n// AddressValidationRuleType\r\n// } from '../../modules/lds-delivery/components/address-format.data';\r\nimport {\r\n IAddressDropdownsData,\r\n IAddressItem,\r\n IAddressValidationRule,\r\n AddressItemDisplayType,\r\n AddressItemType,\r\n AddressValidationRuleType,\r\n AddressMetaData,\r\n AddressCommon,\r\n AddressFormat,\r\n AddressType\r\n} from '@msdyn365-commerce-modules/address';\r\n// import { AddressMetaData } from '../../modules/lds-delivery/components/address-meta.data';\r\n// import { AddressMetaData } from '@msdyn365-commerce-modules/address';\r\n// import { AddressCommon } from '@msdyn365-commerce-modules/address';\r\n// import { ILdsDeliveryResources } from '../../modules/lds-delivery/lds-delivery.props.autogenerated';\r\nimport { ICoreContext } from '@msdyn365-commerce/core-internal';\r\nimport { ITelemetry } from '@msdyn365-commerce/core';\r\nimport classname from 'classnames';\r\n// import { AddressType } from '../../modules/lds-delivery/components/address-module.data';\r\n// import { AddressType } from '@msdyn365-commerce-modules/address';\r\n// import { ICartLineWithProduct } from '../../modules/lds-delivery/lds-delivery';\r\nimport { ICartLineWithProduct } from '@msdyn365-commerce-modules/address/src/modules/checkout-shipping-address/components/checkout-shipping-cartlines-images';\r\nimport { updateLineDeliverySpecifications } from './cart-line-utilities';\r\n\r\nimport { validateSuggestAddressAsync } from '../../actions/DataActionExtension.g';\r\nimport { ICartState } from '@msdyn365-commerce/global-state';\r\nimport { format } from '@msdyn365-commerce-modules/utilities';\r\n\r\nimport { stateCheckList, stateCheckListKo } from './state-address-utilities';\r\n\r\n// import {\r\n// AsyncResult,\r\n// ChannelDeliveryOptionConfiguration,\r\n// FeatureState,\r\n// OrgUnitLocation,\r\n// StateProvinceInfo,\r\n// CountryRegionInfo\r\n// } from '@msdyn365-commerce/retail-proxy';\r\nimport { IStoreSelectorStateManager } from '@msdyn365-commerce-modules/bopis-utilities';\r\nexport interface ILdsDeliveryData {\r\n orgUnitLocations: AsyncResult;\r\n channelDeliveryOptionConfig: AsyncResult;\r\n featureState: AsyncResult;\r\n storeSelectorStateManager: AsyncResult;\r\n cart: AsyncResult;\r\n countryStates: AsyncResult;\r\n countryRegions: AsyncResult;\r\n}\r\n\r\ninterface Option {\r\n value: string;\r\n label: string;\r\n key: string;\r\n}\r\n\r\nexport const getAddressItems = (\r\n inputAddress: Address,\r\n dropdownDisplayData: IAddressDropdownsData,\r\n setInputAddress: (address: Address) => void,\r\n addressPurposes: AddressPurpose[],\r\n // resources: ILdsDeliveryResources,\r\n resources: any,\r\n context: ICoreContext,\r\n telemetry: ITelemetry,\r\n cart: any,\r\n setCountryStates?: any,\r\n countryRegions?: any,\r\n setRequiredInputs?: any,\r\n requiredInputs?: any,\r\n setError?: any\r\n): IAddressAddItem[] => {\r\n const addressType = AddressType.Shipping;\r\n const _getAddressFormatExcludeList = (): AddressItemType[] => {\r\n const addressFormatExcludeList: AddressItemType[] = [];\r\n\r\n addressFormatExcludeList.push(AddressItemType.AddressTypeValue);\r\n\r\n addressFormatExcludeList.push(AddressItemType.IsPrimary);\r\n\r\n return addressFormatExcludeList;\r\n };\r\n\r\n const 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 const addressFormat = new AddressFormat(\r\n countryRegions || [],\r\n new AddressMetaData({ ...resources }, _getAddressFormatExcludeList()),\r\n addressPurposes || []\r\n );\r\n const countryExtension = cart.result.cart.ExtensionProperties.filter((property: any) => {\r\n return property.Key === 'Country';\r\n });\r\n const userCountry = countryExtension[0].Value.StringValue;\r\n\r\n const addressCommon = new AddressCommon(context, resources, telemetry);\r\n const market = context.request.channel?.ChannelCountryRegionISOCode;\r\n const countryRegionId = addressCommon.getDefaultCountryRegionId(userCountry || market, countryRegions || [], userCountry || market);\r\n const addressItem = addressFormat.getAddressFormat(\r\n inputAddress.ThreeLetterISORegionName ? inputAddress.ThreeLetterISORegionName : countryRegionId\r\n );\r\n\r\n const onSetAddress = (name: string, value: string | boolean) => {\r\n setInputAddress({ ...inputAddress, [name]: value });\r\n };\r\n\r\n const onInputChange = (event: React.ChangeEvent): void => {\r\n if (event.target.type === 'checkbox') {\r\n onSetAddress(event.target.name, event.target.checked);\r\n } else {\r\n const value = (event.target.value || '').replace(new RegExp('[<>]', 'gi'), '');\r\n onSetAddress(event.target.name, value);\r\n }\r\n };\r\n\r\n const onDropdownChange = (inputValue: any): void => {\r\n const values = inputValue.target.value.split(',');\r\n const key = values[1] || 'key';\r\n const value = values[0] || 'value';\r\n if (key === 'ThreeLetterISORegionName') {\r\n setCountryStates(value);\r\n }\r\n setInputAddress({ ...inputAddress, [key]: value });\r\n };\r\n\r\n const twoStreetsAddressFormat: IAddressItem[] = [];\r\n\r\n addressItem.map((addressFormatItem, index) => {\r\n if (addressFormatItem.name === 'State' && countryRegionId === 'KOR') {\r\n addressFormatItem.label = resources.addressMunicipalityLabel;\r\n }\r\n if (addressFormatItem.name === 'City' && countryRegionId === 'AUS') {\r\n addressFormatItem.label = resources.addressSuburbLabel;\r\n }\r\n if (addressFormatItem.name === 'Street') {\r\n let validationRules1: IAddressValidationRule[] = [];\r\n let validationRules2: IAddressValidationRule[] = [];\r\n if (addressFormatItem.validationRules) {\r\n validationRules1 = [...addressFormatItem.validationRules];\r\n validationRules2 = [...addressFormatItem.validationRules];\r\n\r\n validationRules1[0].message = 'Street 1 is required';\r\n validationRules2.shift();\r\n }\r\n\r\n const street1 = {\r\n ...addressFormatItem,\r\n name: 'Street',\r\n label: resources.addressStreetLabel1,\r\n maxLength: 30,\r\n validationRules: validationRules1\r\n };\r\n const street2 = {\r\n ...addressFormatItem,\r\n name: 'Street_2',\r\n label: resources.addressStreetLabel2,\r\n maxLength: 30,\r\n validationRules: validationRules2\r\n };\r\n twoStreetsAddressFormat.push(street1);\r\n twoStreetsAddressFormat.push(street2);\r\n } else {\r\n twoStreetsAddressFormat.push(addressFormatItem);\r\n }\r\n });\r\n\r\n const requiredFormInputs = twoStreetsAddressFormat.filter(x => {\r\n return x.validationRules && x.validationRules[0].type === 'Required' && x.name !== 'ThreeLetterISORegionName';\r\n });\r\n\r\n if (requiredInputs === undefined && setRequiredInputs) {\r\n setRequiredInputs(requiredFormInputs);\r\n }\r\n\r\n return twoStreetsAddressFormat.map((addressFormatItem, index) => {\r\n const elementId = `${addressType.toLowerCase()}_address${addressFormatItem.name.toLowerCase()}`;\r\n const errorMessage = '';\r\n const className = classname('msc-address-form__item', `msc-address-form__item-${addressFormatItem.name.toLowerCase()}`, {\r\n 'msc-address-form__item-newline': addressFormatItem.isNewLine,\r\n 'address-form__item-invalid': errorMessage\r\n });\r\n const addressItemStyle: React.CSSProperties = {\r\n margin: '16px 18px'\r\n };\r\n\r\n let input;\r\n\r\n const textInputStyle: React.CSSProperties = {\r\n width: '100%',\r\n border: '1px solid #878A8C',\r\n boxSizing: 'border-box',\r\n borderRadius: '2px',\r\n margin: '8px 0px',\r\n lineHeight: '22px',\r\n padding: '8px',\r\n fontSize: '16px',\r\n fontFamily: `\"Ensign:Sans\",Arial,\"noto sans\" ,sans-serif`,\r\n fontStyle: 'normal'\r\n };\r\n const textInputStyleInvalid: React.CSSProperties = {\r\n width: '100%',\r\n border: '1px solid red',\r\n boxSizing: 'border-box',\r\n borderRadius: '2px',\r\n margin: '8px 0px',\r\n lineHeight: '22px',\r\n padding: '8px',\r\n fontSize: '16px',\r\n fontFamily: `\"Ensign:Sans\",Arial,\"noto sans\" ,sans-serif`,\r\n fontStyle: 'normal'\r\n };\r\n\r\n const labelStyle: React.CSSProperties = {\r\n fontFamily: `\"Ensign:Sans\",Arial,\"noto sans\" ,sans-serif`,\r\n fontStyle: 'normal',\r\n fontSize: '14px',\r\n lineHeight: '19px',\r\n marginLeft: '8px'\r\n };\r\n const [invalidError, setInavlidError] = useState('');\r\n // const [firstBlur, setFirstBlur] = useState(true);\r\n\r\n const inputRequired = getRequriedAttribute(addressFormatItem.validationRules);\r\n const inputRequiredValues = Object.values(inputRequired);\r\n const isInputRequired = inputRequiredValues[0] === true ? true : false;\r\n const inputChanged = (e: any) => {\r\n const phoneCheck = /^[\\+]?[(]?[0-9]{0,3}[)]?[-\\s\\.]?[0-9]{3}[-\\s\\.]?[0-9]{4,6}$/im;\r\n const nameCheck = /[`~!@#$%^&*()_|+\\-=?;:'\",.<>\\{\\}\\[\\]\\\\\\/]/gi;\r\n const emojiNameCheck = /(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\u0023-\\u0039]\\ufe0f?\\u20e3|\\u3299|\\u3297|\\u303d|\\u3030|\\u24c2|\\ud83c[\\udd70-\\udd71]|\\ud83c[\\udd7e-\\udd7f]|\\ud83c\\udd8e|\\ud83c[\\udd91-\\udd9a]|\\ud83c[\\udde6-\\uddff]|\\ud83c[\\ude01-\\ude02]|\\ud83c\\ude1a|\\ud83c\\ude2f|\\ud83c[\\ude32-\\ude3a]|\\ud83c[\\ude50-\\ude51]|\\u203c|\\u2049|[\\u25aa-\\u25ab]|\\u25b6|\\u25c0|[\\u25fb-\\u25fe]|\\u00a9|\\u00ae|\\u2122|\\u2139|\\ud83c\\udc04|[\\u2600-\\u26FF]|\\u2b05|\\u2b06|\\u2b07|\\u2b1b|\\u2b1c|\\u2b50|\\u2b55|\\u231a|\\u231b|\\u2328|\\u23cf|[\\u23e9-\\u23f3]|[\\u23f8-\\u23fa]|\\ud83c\\udccf|\\u2934|\\u2935|[\\u2190-\\u21ff])/g;\r\n\r\n if (!e.target.value && isInputRequired) {\r\n const label = addressFormatItem.label.split('*');\r\n const inputText =\r\n addressFormatItem.type === 1 && resources.addressZipCodeRequiredErrorMessage\r\n ? resources.addressZipCodeRequiredErrorMessage\r\n : label[0];\r\n const errorText = format(resources.addressDefaultRequiredErrorMessage, inputText);\r\n setInavlidError(errorText);\r\n setError(true);\r\n } else if (addressFormatItem.type === 1002 && e.target.value) {\r\n if (!phoneCheck.test(e.target.value)) {\r\n setError(true);\r\n setInavlidError(resources.addressPhoneFormatErrorMessage ? resources.addressPhoneFormatErrorMessage : '');\r\n } else {\r\n // setError(false);\r\n setInavlidError('');\r\n }\r\n } else if (addressFormatItem.type === 1001 && e.target.value) {\r\n if (nameCheck.test(e.target.value) || emojiNameCheck.test(e.target.value)) {\r\n const errorText = format(resources.addressDefaultInvalidErrorMessage, addressFormatItem.name);\r\n setError(true);\r\n setInavlidError(errorText);\r\n } else {\r\n // setError(false);\r\n setInavlidError('');\r\n }\r\n } else {\r\n setInavlidError('');\r\n }\r\n };\r\n\r\n const dropdownValueCheck = (inputValue: any): void => {\r\n const values = inputValue.target.value.split(',');\r\n const key = values[1] || 'key';\r\n const value = values[0] || 'value';\r\n const dropdownValue = { ...inputAddress, [key]: value };\r\n if (!dropdownValue.State) {\r\n setInavlidError(`${addressFormatItem.name} is required`);\r\n } else {\r\n setInavlidError('');\r\n }\r\n };\r\n\r\n if (addressFormatItem.displayType === AddressItemDisplayType.Input) {\r\n input = (\r\n <>\r\n \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 // const prefilledAddressDropdownData = addressFormat.getPrefilledAddressDropdownData(\r\n // resources.addressStateDefaultSelectionText,\r\n // newStates || []\r\n // );\r\n\r\n const options: Option[] = displayData\r\n .filter(x => x.key !== '')\r\n .map(data => {\r\n return {\r\n key: addressFormatItem.name,\r\n value: (data.key as string) || '',\r\n label: (data.value as string) || ''\r\n };\r\n });\r\n const selectedValue = {\r\n key: addressFormatItem.name,\r\n // @ts-ignore\r\n label: inputAddress[addressFormatItem.name],\r\n // @ts-ignore\r\n value: inputAddress[addressFormatItem.name]\r\n };\r\n\r\n let disableDropdown = false;\r\n if (addressFormatItem.type === AddressItemType.ThreeLetterISORegionName) {\r\n selectedValue.key = addressFormatItem.name;\r\n selectedValue.label = displayData.find(x => x.key === countryRegionId)?.value; // selectedValue.value || countryRegionId;\r\n selectedValue.value = countryRegionId;\r\n\r\n if (inputAddress.ThreeLetterISORegionName !== countryRegionId) {\r\n setInputAddress({ ...inputAddress, [selectedValue.key]: selectedValue.value });\r\n }\r\n\r\n disableDropdown = true;\r\n }\r\n\r\n if (addressFormatItem.type === AddressItemType.AddressTypeValue) {\r\n selectedValue.key = addressFormatItem.name;\r\n selectedValue.label = selectedValue.value || 6;\r\n selectedValue.value = selectedValue.value || 6;\r\n }\r\n let filteredOptions;\r\n\r\n if (countryRegionId && countryRegionId === 'KOR' && addressFormatItem.name === 'State' && context.request.locale !== 'en-US') {\r\n filteredOptions = options.filter(option => {\r\n return stateCheckListKo.some(item => item.label === option.label && item.value === option.value);\r\n });\r\n } else if (\r\n countryRegionId &&\r\n countryRegionId === 'KOR' &&\r\n addressFormatItem.name === 'State' &&\r\n context.request.locale === 'en-US'\r\n ) {\r\n filteredOptions = options.filter(option => {\r\n return stateCheckList.some(item => item.label === option.label && item.value === option.value);\r\n });\r\n }\r\n\r\n input = (\r\n <>\r\n \r\n >\r\n );\r\n }\r\n\r\n return {\r\n key: addressFormatItem.name,\r\n AddressItem: { className, id: `${elementId}_container`, style: addressItemStyle },\r\n label: {addressFormatItem.label}
,\r\n alert: {invalidError},\r\n input\r\n };\r\n });\r\n};\r\n\r\nexport const getSmartyStreetAddress = async (context: ICoreContext, inputAddress: any) => {\r\n const ctx = { callerContext: context.actionContext };\r\n\r\n inputAddress.AddressTypeValue = 2;\r\n // Call SmartyStreets here.\r\n const smartyStreetValidation = await validateSuggestAddressAsync(\r\n ctx,\r\n inputAddress.Street || '',\r\n inputAddress.City || '',\r\n inputAddress.State || '',\r\n inputAddress.ZipCode || '',\r\n inputAddress.ThreeLetterISORegionName || '',\r\n inputAddress.DistrictName || '',\r\n inputAddress.Street_2 || ''\r\n ).catch((err: any) => {\r\n console.log(err);\r\n });\r\n\r\n return smartyStreetValidation;\r\n};\r\n\r\nexport const submitAddress = async (\r\n context: ICoreContext,\r\n // resources: ILdsDeliveryResources,\r\n resources: any,\r\n telemetry: ITelemetry,\r\n inputAddress: Address,\r\n customerAddresses: Address[],\r\n cartId: string,\r\n deliveryGroup: ICartLineWithProduct[],\r\n addAddressToAccount: boolean,\r\n countryRegionId: string,\r\n config: any,\r\n cart?: ICartState\r\n): Promise => {\r\n const ctx = { callerContext: context.actionContext };\r\n\r\n inputAddress.AddressTypeValue = 2;\r\n inputAddress.ThreeLetterISORegionName ? null : (inputAddress.ThreeLetterISORegionName = countryRegionId);\r\n\r\n const addressCommon = new AddressCommon(context, resources, telemetry);\r\n if (addressCommon.isAuthenticatedFlow() && !customerAddresses.includes(inputAddress) && addAddressToAccount) {\r\n await addressCommon.addCustomerAddress(inputAddress || {});\r\n }\r\n const lineDeliverySpecifications = deliveryGroup.map(item => {\r\n // const isSubscription = item.cartLine.ExtensionProperties?.find(x => x.Key === 'isSubscription')?.Value?.BooleanValue || false;\r\n if (countryRegionId === 'USA' || countryRegionId === 'CAN') {\r\n inputAddress.TaxGroup = 'Vertex';\r\n } else if (inputAddress.TaxGroup === 'Vertex' && countryRegionId !== 'USA' && countryRegionId !== 'CAN') {\r\n delete inputAddress.TaxGroup;\r\n }\r\n\r\n return {\r\n LineId: item.cartLine.LineId,\r\n DeliverySpecification: {\r\n DeliveryAddress: inputAddress,\r\n DeliveryModeId: config.deliveryMode,\r\n DeliveryPreferenceTypeValue: 1\r\n }\r\n };\r\n });\r\n\r\n return updateLineDeliverySpecifications(ctx, cartId, lineDeliverySpecifications);\r\n};\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE 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 {\r\n AddressItemType,\r\n IAddressDropdownsData,\r\n IAddressItem,\r\n IAddressValidationRule,\r\n AddressMetaData\r\n} from '@msdyn365-commerce-modules/address';\r\n// import { AddressMetaData } from '@msdyn365-commerce-modules/address';\r\n\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.LongName\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.Description\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 // eslint-disable-next-line security/detect-non-literal-regexp\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"],"names":["AccountManagementAddress","React","constructor","props","super","countryRegionId","countryRegions","addressPurposes","defaultAddressType","asyncCustAddressCreationFeatureName","editAsyncCustomerFeatureName","asyncCustomerAddressCreationFeatureIsEnabled","isEditAsyncCustomerFeatureEnabled","_onSuggestionSelected","async","this","_clearAddressFields","address","addressFormat","getTranformedAddress","result","stateProvinceInfo","set","addUpdateAddress","Street","ZipCode","CountyName","City","State","DistrictName","FullAddress","setTimeout","getAddressFormat","ThreeLetterISORegionName","forEach","format","_this$autoSuggest","undefined","name","autoSuggest","excludedAddressFields","includes","_clearValidation","validationError","_dataInitialize","data","reaction","_data$countryRegions$","_data$addressPurposes","_data$address$result","customerAddresses","_renderAddOrUpdateAddress","AddressAddUpdate","isUpdating","resources","addressType","AddressType","Shipping","defaultCountryRegionId","selectedAddress","addressActionResponse","dropdownDisplayData","getPrefilledAddressDropdownData","addressStateDefaultSelectionText","telemetryContent","onInputChange","_onAddressAddUpdateInputChange","onDropdownChange","_onAddressAddUpdateDropdownChange","onSave","_onAddressAddUpdateSubmit","onCancel","_resetView","_renderListAddress","_this$props$data$cust","_this$props$context$a","config","heading","text","headingTag","tag","AddressList","addresses","primaryAddressSectionHeading","otherAddressSectionHeading","contextRequest","context","request","handleLineItemHeadingChange","event","target","value","onEditAddress","_goToEditAddress","onRemoveAddress","_onRemoveAddress","onAddAddress","_goToAddAddress","onUpdatePrimaryAddress","_onSubmitUpdatePrimaryAddress","isAsyncCustomerAddressCreationFeatureEnabled","isAsyncCustomer","customerInformation","IsAsyncCustomer","canRenderAsyncCustomerDataAsUnmodifiable","app","_attachMapAutoSuggest","storeSelectorStateManager","_this$autoSuggest2","isMapApiLoaded","attachAutoSuggest","onAddressAddUpdate","formattedValue","toString","trim","validateAddressFormat","type","checked","replace","RegExp","AddressItemType","AddressTypeValue","_onCountryChange","_onAddressUpdate","response","onSuccess","then","hasError","addressCommon","isAuthenticatedFlow","currentOperation","AddressOperation","Update","updateCustomerAddress","addCustomerAddress","Promise","resolve","_onAddOrUpdateSuccess","_this$autoSuggest3","twoLetterISORegionName","getTwoLetterISORegionName","TwoLetterISORegionName","changeAutoSuggestionCountryCode","_getAddressFormatExcludeList","addressFormatExcludeList","showAddressType","push","IsPrimary","_getStateProvinces","Add","getStateProvinces","some","state","StateId","_updateCurrentOperation","operation","updateCustomerPrimaryAddress","_onUpdatePrimaryAddressSuccess","_objectSpread","Deactivate","removeAddressData","_renderScreenReaderRemoveText","notification","formatNotification","removeAddressNotification","Name","className","_setDefaultCountryRegionId","List","telemetry","AddressCommon","AddressFormat","AddressMetaData","getTelemetryObject","telemetryPageName","friendlyName","actionContext","requestContext","channel","autoSuggestionEnabled","autoSuggestOptions","BingMapsApiKey","error","BingMapsEnabled","options","AutoSuggest","ChannelCountryRegionISOCode","DefaultLanguageId","_this$props$data$stor","loadMapApi","_this$autoSuggest4","_loadMapAPI","_this$props$data$stor2","_this$props$data$stor3","_this$autoSuggest5","disposeAutoSuggest","shouldComponentUpdate","nextProps","nextState","render","_data$featureState","_data$featureState2","_this$props$context$a2","renderView","featureState","find","feature","IsEnabled","infoMessageBar","Msdyn365","accountProcessingPendingInfoMessageCanAddAddress","accountProcessingPendingInfoMessage","viewState","isShowAddresList","isShowAddOrUpdateAddress","AccountAddressManagement","moduleProps","classnames","showAddressList","showAddOrUpdateAddress","screenReaderNotification","market","getDefaultCountryRegionId","__decorate","observable","action","observer","BusinessAccountAddress","shouldAutoFocus","excludedList","_resetAddressFields","map","addressFormatItem","displayType","AddressItemDisplayType","Input","Checkbox","countryStates","_data$countryStates$r","Company","_updateAddress","_updateCountryRegionId","updateForm","isRequired","cleanValue","_isEmpty","_isInputRequired","addressItemValue","ObjectExtensions","isNullOrUndefined","validationRules","length","validationRule","AddressValidationRuleType","Required","componentDidMount","resetAddress","_request$channel","AddressShow","_ref","AddressDetail","items","Node","Object","assign","item","description","_ref2","isShowList","Item","key","showItems","isShowPrimaryButton","primaryButton","editButton","removeButton","Error","isShowError","title","message","AddressLists","_ref3","ListAddress","isShowEmptyListMessage","emptyListMessage","addButton","primaryAddressList","otherAddressList","_ref4","AddressForm","isShowSaveButton","saveButton","isShowCancelButton","cancelButton","AddressItem","label","alert","input","AddressError","Module","formatAddress","onSaveCustom","_onAddressAddUpdateSubmitCustom","sessionStorage","setItem","JSON","stringify","countryRegion","unitName","stakeName","loading","Email","user","emailAddress","newOrUpdatedAddress","StreetNumber","Street_2","_isNewAddressCustom","skipSmarty","UserAddress","keys","userStreet2","getItem","_getSmartyAddress","customAddress","isdeliverable","city","street2","street","country","plusfour","zipcode","TaxGroup","RecordId","District","parse","setState","showSmarty","smartyStreets","getSmartyStreetAddress","catch","err","console","log","smartyAddress","smartyFailed","isFinalSubmit","streetSplit","split","existingAddress","_address$Name","_address$Street","_address$StreetNumber","_address$City","_address$State","_address$ZipCode","_address$Phone","_address$ThreeLetterI","_address$AddressTypeV","_address$DistrictName","_address$StreetNumber2","Phone","customerAddress","finalSubmit","saveAddress","saveAddressCustom","countryExtension","cart","ExtensionProperties","filter","property","Key","Value","StringValue","CheckoutPickupCartLines","moduleClassName","cartLines","itemTitle","isMobileCheck","isMobile","variant","VariantType","Browser","gridSettings","xs","w","sm","md","lg","xl","isMobileView","ArrayExtensions","hasElements","cartLine","isShowQty","quantity","lineId","Image","imageProps","role","productQuantityInfo","altText","id","defaultImageSettings","viewports","q","h","lazyload","quality","CheckoutShippingAddress","_data$featureState$re2","addressListSelectedAddress","multiplePickupStoreSwitchName","retailMultiplePickUpOptionEnabled","checkoutErrorRef","_initPickupGroup","pickupCartLines","_getCartLinesforDelivery","_this$props$data$chec","products","_getProductsByCartLines","checkout","checkoutCart","ChannelId","line","product","x","ProductId","shippingGroups","_data$featureState$re","_this$props$data$chec2","_this$props$data$chec3","CartLines","_isDelivery","_isNotPickupMode","DeliveryMode","FulfillmentStoreId","deliveryMode","_this$props$context$r","_featureState$result","pickupDeliveryModeCode","PickupDeliveryModeCode","channelDeliveryOptionConfig","_channelDeliveryOptio","pickupDeliveryMode","PickupDeliveryModeCodes","pickupMode","channelId","productInputs","ProductInput","apiSettings","CatalogId","getSimpleProducts","onSaveHandler","onCancelHandler","hasExternalSubmitGroup","moduleState","onSubmit","onCustomSave","onSaveSmarty","onCancelButtonHandler","_renderSelectAddress","onAddAddressHandler","filteredAddresses","addressesForList","toLowerCase","AddressSelect","onAddressOptionChange","_onAddressOptionChange","_onSelectAddress","addressRecordId","currentTarget","filteredStateList","locale","stateCheckList","stateCheckListKo","cityCheck","_updateModuleState","_clearError","_isNewAddress","newAddress","twoLetterIsoRegionName","_getDefaultAddress","_getAddressFromCartExpressPaymentDetails","expressPaymentDetailsFromCartPage","tokenizedPaymentCard","isExpressAddressAppliedInCartPage","addressFromCartExpress","getExpressAddress","getAddressFromTokenizedPaymentCard","Country","threeLetterIsoRegionName","getThreeLetterIsoRegionName","NameOnCard","Address1","Address2","Zip","expressAddress","_country$ISOCode","ISOCode","CountryRegionId","_initModuleState","init","status","_canShip","onEdit","checkoutState","defaultAddress","shippingCartLines","ShippingAddress","isExpressCheckoutApplied","shippingAddressFromExpressCheckout","isEmpty","Show","_setShippingAddress","updateHasShippingAddress","newHasShippingAddress","information","shippingAddress","_checkout$result$chec","_checkout$result$chec2","emailDeliveryModeCode","EmailDeliveryModeCode","hasInvoiceLine","_channelDeliveryOptio2","newShippingAddress","updateShippingAddress","onReady","onPending","onUpdating","_address$Name2","_address$Street2","_address$StreetNumber3","_address$City2","_address$State2","_address$ZipCode2","_address$Phone2","_address$ThreeLetterI2","_address$AddressTypeV2","_setErrorMessage","errorMessage","setHasError","addressListValidated","_this$props$data$chec6","_this$props$data$chec4","_this$props$data$chec5","_address","shouldEnableCheckoutErrorDisplayMessaging","_this$props$data$chec7","checkoutError","errorLocation","ErrorLocation","_this$props$data$chec8","checkoutErrorFocus","CheckoutModule","focusOnCheckoutError","_featureState$result2","headingImages","itemsText","singleItemText","errorMessageTitle","imageSettings","cartlines","_line$cartLine$LineId","_line$product","_line$product$Primary","_line$product2","_line$product3","_line$cartLine$Quanti","LineId","src","PrimaryImageUrl","fallBackSrc","getFallbackImageUrl","ItemId","loadFailureBehavior","Quantity","itemText","lineImageProps","cartLineImages","isRetailMultiplePickUpOptionEnabled","isShowAddress","showAddress","_renderShowAddress","ErrorComponent","showAddressSelectHandler","showAddOrUpdateAddressHandler","showAddressSelect","_this$props$data$cart","_this$props$data$cart2","properties","_this$props$data$chec9","computed","withModuleState","stateName","setStateName","filteredList","setFilteredList","filteredItems","findState","findCountry","countryId","ctx","callerContext","translation","stateNameTranslationAsync","DisplayName","getStateTranslation","stateCheckListMixed","isDuplicate","setIsVisible","style","display","flexDirection","justifyContent","width","height","paddingLeft","paddingRight","color","cursor","onClick","onClickFunctionEdit","Edit","size","onClickFunction","Delete","borderTop","paddingTop","addNewAddressText","userAddress","userAddressCustom","inputAddress","setInputAddress","isVisible","isDisabled","setIsDisabled","customDisabled","setCustomDisabled","setUnitName","stakeNameAddress","setStakeNameAddress","disabled","setDisabled","hideCity","setHideCity","updatedStateList","setUpdatedStateList","stateListTranslation","translatedStateList","countryStateTranslationAsync","updateNames","array2","stateList","item1","match","item2","LongName","option","displayData","cityCheckKOR","shouldHideCity","additionalAddributes","customKoreaStateOnChange","functionToExecute","districtIndex","findIndex","street2Index","removedDistrict","splice","customSetAddress","canSubmit","Waiting","marginBottom","smartyStreetAddressHeader","Secondary","smartyStreetsAddressButton","userShippingAddressHeader","userAddressButton","BrazilCheckout","currentAddress","Ghost","AfricaCheckout","PeruCheckout","UruguayCheckout","stateCheckListChl","ChileCheckout","border","boxSizing","borderRadius","fontSize","lineHeight","fontWeight","selected","onChange","e","ArgState","pop","popValue","join","addressDepartmentLabel","addressDepartmentRequiredErrorMessage","addressStateProvinceLabel","addressStateProvinceRequiredErrorMessage","addressColoniaLabel","addressColoniaRequiredErrorMessage","isListVisible","setIsListVisible","setIsDuplicate","children","Info","marginTop","final","translationCache","Map","cacheKey","current","has","get","recordId","setRecordId","validResults","setValidResults","isItemSelected","SelectAddress","results","obj","array","validateAddressFormatAsync","addressCountry","StateValid","CityValid","StreetNumberValid","CountryRegionValid","AddressValid","filterAsyncResults","SelectItem","customOnChange","Number","functionOnClick","onSaveFunction","addressItems","ref","CheckoutStateInput","_this","getCacheKey","buildCacheKey","getCacheObjectType","dataCacheType","createObservableDataAction","CheckoutState","inputData","_giftCards","_giftCardExtends","_loyaltyAmount","_guestCheckoutEmail","_customerReference","_customerRequisition","_note","_isTermsAndConditionAccepted","_customerAccountAmount","defineProperty","prototype","_tokenizedPaymentCard","_tenderLine","_billingAddress","_shippingAddress","_cardPrefix","_loyaltyCardNumber","updateTokenizedPaymentCard","newTokenizedPaymentCard","updateTenderLine","newTenderLine","updateBillingAddress","newBillingAddress","updateCardPrefix","newCardPrefix","removeGiftCard","giftCardNumber","giftCard","Id","removeGiftCardExtend","addGiftCard","__spreadArrays","addGiftCardExtend","updateLoyaltyCardNumber","newLoyaltyCardNumber","updateLoyaltyAmount","newAmount","updateGuestCheckoutEmail","newGuestCheckoutEmail","customerReference","customerRequisition","note","updateTermsAndConditionsAcceptance","newIsTermsAndConditionAccepted","updateCustomerAccountAmount","WrappedComponent","_super","ModuleState","call","initializeState","_b","typeName","states","getModuleStates","updateModuleStates","__assign","_a","hasInitialized","isCancellable","isSubmitContainer","childIds","getModuleStateManager","validate","isReady","isPending","isSkipped","isCancelAllowed","shouldSubmitContainer","hasModuleState","setIsRequired","update","setIsCancellable","setIsSubmitContainer","onSkip","onDisable","getModule","moduleId","getModuleByTypeName","getModuleStateManagerByTypeName","moduleStates","values","_moduleState","modules","_validateLeaf","source","module","isMatch","_validateContainer","allMatched","skipSkippableItem","shouldEnableSinglePaymentAuthorizationCheckout","childId","_isPaymentSectionContainer","enableControl","__extends","ModuleStatesCacheKey","EnabledPaymentsForOBO","updateLineDeliverySpecifications","cartId","lineDeliverySpecifications","updateLineDeliverySpecificationsAsync","updateCartLineAttributeValues","attributeKey","attributeValue","index","newAttribute","TextValue","TextValueTranslations","AttributeValues","attrIndex","attr","newCart","updateCartLinesAsync","updateAsync","districtListCHL","cityCheckListChl","ariaLabel","payLoad","getPayloadObject","attributes","getTelemetryAttributes","itemId","isChecked","autoFocus","shouldBeAutoFocused","getDropdownItem","selectedValue","isSelected","maxLength","shouldUseAutoFocus","htmlFor","getRequriedAttribute","getAddessItems","twoStreetsAddressFormat","addressMunicipalityLabel","addressSuburbLabel","validationRules1","validationRules2","shift","street1","addressStreetLabel1","addressStreetLabel2","elementId","splitErrorMessage","classname","isNewLine","AddressInputComponent","AdressCheckboxComponent","filteredData","AdressDropdownComponent","AddressLabelComponent","AddressAlertComponent","editAddressHeading","addAddressHeading","Heading","AddressButtonComponent","addressSaveButtonText","addressSaveButtonAriaLabel","addressCancelButtonText","addressCancelButtonAriaLabel","errorTitle","AddressErrorTitleComponent","AddressErrorMessageComponent","setName","setStakeName","setAddress","unit","setUnit","isLoading","setIsLoading","isDone","setIsDone","showCity","setShowCity","showState","setShowState","setOptions","wards","setWards","stakes","setStakes","currentOptionWard","setCurrentOptionWard","currentOptionStake","setCurrentOptionStake","Zipcode","unitAddress","getUnitAddressesAsync","res","UnitName","stakeOptions","wardOptions","getUnitAddress","hasCity","hasOwnProperty","hasState","sort","a","b","labelA","toUpperCase","labelB","onChangeWard","onChangeStake","nameChange","fontFamily","fontStyle","marginLeft","addressNameLabel","margin","padding","africaUnitLabel","Select","placeholder","defaultValue","africaStakeLabel","addressStreetLabel","addressCityLabel","addressStateLabel","addressThreeLetterISORegionNameLabel","setZipcode","setStreet","streetTwo","setStreetTwo","neighborhood","setNeighborhood","setCity","houseNum","setHouseNum","axios","method","url","logradouro","localidade","bairro","uf","findAddress","addressZipCodeLabel","minLength","addressHouseRULabel","houseNumChange","streetChange","addressMoreInformationLabel","streetOne","streetTwoChange","addressDistrictLabel","neighborChange","stateChange","cityChange","streetNum","setStreetNum","counties","setCounties","cities","setCities","stateId","setStateId","county","setCounty","citySelected","setCitySelected","countiesList","getCountiesAsync","citiesList","getCitiesAsync","getData","zipcodeAsync","customSetName","addressSectorLabel","customSetStreetNum","customSetStreet","addressRegionNameLabel","selectedState","findCounties","addressMunicipalityNameLabel","findCities","CountyId","getZipcodesAsync","ZipPostalCode","selectCity","cityItem","districts","setDistricts","district","setDistrict","districtSelected","setDistrictSelected","districtList","getDistrictsAsync","filteredCities","Description","stateItem","filteredDistricts","addressDistrictNameLabel","selectDistrict","districtItem","betweenStreet","setBetweenStreet","postalCode","setPostalCode","countryRegionName","SetCountryRegionName","countryList","countryValue","addressBetweenStreetsLabel","customSetBetweenStreet","selectState","addressPostalCodeLabel","customSetPostalCode","validateSuggestAddressAsync","countryRegionsInfo","addressMetaData","stateDefaultSelectionText","defaultStateText","dropdownData","getCountryFormat","getStateFormat","unshift","getAddressTypeFormat","_getCountryRegionInfo","propertyName","validationtor","isValid","_inputValidation","StateName","adminDistrict","addressLine","locality","formattedAddress","_validateRegEx","regEx","test","countryRegionInfo","_getAddressDisplayFormat","addressPurpose","addressDisplayItem","AddressFormatLines","AddressTypeItem","_extendAddressDisplayFormat","nameDisplayItem","formatLine","AddressComponentNameValue","addressItem","getItemFormat","NewLine","phoneDisplayItem","isPrimaryDisplayItem"],"sourceRoot":""}