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ce.Online/./src/actions/get-custom-address.action.ts?9be4","webpack://Bayer.Commerce.Online/./lib/__local__/module-registration.js?8a42","webpack://Bayer.Commerce.Online/external var \"React\"?0d3b","webpack://Bayer.Commerce.Online/external var \"ReactDOM\"?853b"],"sourcesContent":["/*!\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 * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { IHTTPError, IHTTPResponse, sendCommerceRequest, IHTTPRequestOptions, ICommerceApiSettings } from '@msdyn365-commerce/core';\r\n\r\n/**\r\n * AddCustomCheckoutAdditionalInfo Input Action\r\n */\r\nexport class AddCustomCheckoutAdditionalInfoInput implements IAddCustomCheckoutAdditionalInfoData {\r\n // TODO: Construct the input needed to run the action\r\n public readonly apiSettings: ICommerceApiSettings;\r\n public transactionId?: string;\r\n public channelId?: string;\r\n public dataAreaId?: string;\r\n public poNumber?: string;\r\n public shippingDetailsForWarehouse?: string;\r\n public shippingDetailsForTransportation?: string;\r\n public messageToCustomerService?: string;\r\n public userAccountNumber?: string;\r\n constructor(\r\n apiSettings: ICommerceApiSettings,\r\n transactionId?: string,\r\n channelId?: string,\r\n dataAreaId?: string,\r\n poNumber?: string,\r\n shippingDetailsForWarehouse?: string,\r\n shippingDetailsForTransportation?: string,\r\n messageToCustomerService?: string,\r\n userAccountNumber?: string\r\n ) {\r\n this.apiSettings = apiSettings;\r\n this.transactionId = transactionId;\r\n this.channelId = channelId;\r\n this.dataAreaId = dataAreaId;\r\n this.poNumber = poNumber;\r\n this.shippingDetailsForWarehouse = shippingDetailsForWarehouse;\r\n this.shippingDetailsForTransportation = shippingDetailsForTransportation;\r\n this.messageToCustomerService = messageToCustomerService;\r\n this.userAccountNumber = userAccountNumber;\r\n }\r\n\r\n // TODO: Determine if the results of this get action should cache the results and if so provide\r\n // a cache object type and an appropriate cache key\r\n public getCacheKey = () => `DEFAULT`;\r\n public getCacheObjectType = () => 'Get Custom Checkout Additional Info';\r\n public dataCacheType = (): Msdyn365.CacheType => 'none';\r\n}\r\n\r\n// TODO: Create a data model here or import one to capture the response of the action\r\nexport interface IAddCustomCheckoutAdditionalInfoData extends Msdyn365.IActionInput {\r\n transactionId?: string;\r\n channelId?: string;\r\n dataAreaId?: string;\r\n poNumber?: string;\r\n shippingDetailsForWarehouse?: string;\r\n shippingDetailsForTransportation?: string;\r\n messageToCustomerService?: string;\r\n}\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call\r\n */\r\nconst createInput = (args: Msdyn365.ICreateActionContext): IAddCustomCheckoutAdditionalInfoData => {\r\n const { requestContext } = args;\r\n if (!requestContext.user.isAuthenticated) {\r\n throw new Error('Unable to create address input. User is not authenticated.');\r\n }\r\n\r\n return new AddCustomCheckoutAdditionalInfoInput(args.requestContext.apiSettings);\r\n};\r\n\r\n/**\r\n * TODO: Use this function to call your action and process the results as needed\r\n */\r\nasync function addCustomAdditionalInfo(input: AddCustomCheckoutAdditionalInfoInput, ctx: Msdyn365.IActionContext): Promise {\r\n // const apiSettings = Msdyn365.msdyn365Commerce.apiSettings;\r\n\r\n // TODO: Uncomment the below line to get the value from a service\r\n const { apiSettings } = ctx.requestContext;\r\n\r\n const requestOptions: IHTTPRequestOptions = {\r\n headers: {\r\n oun: apiSettings.oun,\r\n 'Content-Type': 'application/json'\r\n }\r\n };\r\n\r\n if (requestOptions.headers && ctx.requestContext.user.token) {\r\n requestOptions.headers.Authorization = `id_token ${ctx.requestContext.user.token}`;\r\n }\r\n\r\n const requestUrl = `${apiSettings.baseUrl}commerce/SendMoreOrderDetails`;\r\n\r\n const requestBody = {\r\n TransactionID: input.transactionId,\r\n ChannelId: input.channelId || '',\r\n DataAreaId: input.dataAreaId || '',\r\n PONumber: input.poNumber || '',\r\n WareHouseShippingDetails: input.shippingDetailsForWarehouse || '',\r\n TransportationShippingDetails: input.shippingDetailsForTransportation || '',\r\n MessageToCustomerService: input.messageToCustomerService || ''\r\n };\r\n\r\n return sendCommerceRequest(requestUrl, 'post', requestBody, requestOptions)\r\n .then((response: IHTTPResponse) => {\r\n if (response.status >= 200 && response.status < 300 && response.data) {\r\n return response.data;\r\n }\r\n ctx.trace('[addCustomCheckoutAdditionalInfoAction] Invalid response recieved from RetailServer');\r\n return false;\r\n })\r\n .catch((error: IHTTPError) => {\r\n console.log('\\n\\n\\n\\n\\n\\n error', error, '\\n\\n\\n\\n\\n\\n end');\r\n ctx.trace(error.message);\r\n ctx.trace(error.stack || '');\r\n ctx.trace(`Unable to Fetch Custom Details.`);\r\n ctx.telemetry.exception(error);\r\n return {};\r\n });\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >addCustomAdditionalInfo,\r\n // TODO: Give your data action a unique id\r\n id: 'AddCustomCheckoutAdditionalInfo',\r\n input: <(args: Msdyn365.ICreateActionContext) => Msdyn365.IActionInput>createInput\r\n // TODO: Uncomment the below line if this is a meant to be a batched data action\r\n // isBatched: true\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 {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n ICommerceApiSettings,\r\n ICreateActionContext\r\n} from '@msdyn365-commerce/core';\r\nimport { Address } from '@msdyn365-commerce/retail-proxy';\r\nimport { GetCustomerInput, getCustomer } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\n/**\r\n * Input class for the getAddress data action.\r\n */\r\nexport class AddressInput implements IActionInput {\r\n public userAccountNumber?: string;\r\n public isUpdateObj?: boolean;\r\n public filteredAddressObj?: Address[];\r\n\r\n public readonly apiSettings: ICommerceApiSettings;\r\n\r\n constructor(apiSettings: ICommerceApiSettings, userAccountNumber?: string, isUpdateObj?: boolean, filteredAddressObj?: Address[]) {\r\n this.userAccountNumber = userAccountNumber;\r\n this.isUpdateObj = isUpdateObj || false;\r\n this.filteredAddressObj = filteredAddressObj || [];\r\n this.apiSettings = apiSettings;\r\n }\r\n\r\n public getCacheKey = () => `DEFAULT`;\r\n\r\n public getCacheObjectType = () => 'Get Custom Address';\r\n\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\n/**\r\n * CreateInput method for the getAddress method.\r\n * @param inputData The input data passed to the createInput method.\r\n */\r\nexport const createGetAddressInput = (inputData: ICreateActionContext): IActionInput => {\r\n const { requestContext } = inputData;\r\n if (!requestContext.user.isAuthenticated) {\r\n throw new Error('Unable to create address input. User is not authenticated.');\r\n }\r\n\r\n return new AddressInput(inputData.requestContext.apiSettings);\r\n};\r\n\r\n/**\r\n * The action method for the getAddress data action.\r\n * @param input The action input.\r\n * @param ctx The action context.\r\n */\r\nexport async function getAddressAction(input: AddressInput, ctx: IActionContext): Promise {\r\n if (input.isUpdateObj && input.filteredAddressObj && input.filteredAddressObj.length) {\r\n return input.filteredAddressObj || [];\r\n }\r\n\r\n const customerInput = new GetCustomerInput(ctx.requestContext.apiSettings, input.userAccountNumber);\r\n\r\n const customer = await getCustomer(customerInput, ctx);\r\n\r\n if (!customer) {\r\n throw new Error('Not able to get customer');\r\n }\r\n\r\n const addressArr: any = customer.Addresses;\r\n\r\n let hasArrHaveAttentionToVal = false;\r\n\r\n addressArr.forEach((item: Address) => {\r\n if (item.AttentionTo && item.AttentionTo === ctx.requestContext.channel?.ChannelNaturalId) {\r\n hasArrHaveAttentionToVal = true;\r\n return;\r\n }\r\n });\r\n\r\n const filterObj = hasArrHaveAttentionToVal\r\n ? addressArr.filter((item: Address) => item.AttentionTo === ctx.requestContext.channel?.ChannelNaturalId)\r\n : addressArr;\r\n\r\n return filterObj || [];\r\n}\r\n\r\n/**\r\n * The getAddress data action\r\n * Gets a customers information via the read RetailServer API\r\n * Returns address information associated with the retrieved customer.\r\n */\r\nexport const getAddressActionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/get-address',\r\n action: >getAddressAction,\r\n input: <(args: ICreateActionContext) => IActionInput>createGetAddressInput\r\n});\r\n\r\nexport default getAddressActionDataAction;\r\n","const binding = { modules: {}, dataActions: {} };\n\n const registerActionId = (actionPath) => {\n if (binding.dataActions[actionPath] &&\n binding.dataActions[actionPath].default &&\n binding.dataActions[actionPath].default.prototype &&\n binding.dataActions[actionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[actionPath].default.prototype.id] = binding.dataActions[actionPath];\n } else {\n Object.keys(binding.dataActions[actionPath] || {}).forEach(exportName => {\n if (binding.dataActions[actionPath][exportName] &&\n binding.dataActions[actionPath][exportName].prototype &&\n binding.dataActions[actionPath][exportName].prototype.Action) {\n binding.dataActions[binding.dataActions[actionPath][exportName].prototype.id] = binding.dataActions[actionPath][exportName];\n }\n })\n }\n };\n\n const registerSanitizedActionPath = (sanitizedActionPath, dataAction) => {\n if (process.env.NODE_ENV === 'development') {\n if (!dataAction.default) {\n throw new Error('Data action path does not have a default export');\n }\n if (!(dataAction.default.prototype.id && binding.dataActions[dataAction.default.prototype.id]) || !binding.dataActions[sanitizedActionPath]) {\n binding.dataActions[sanitizedActionPath] = dataAction;\n }\n } else {\n binding.dataActions[sanitizedActionPath] = dataAction;\n if (!binding.dataActions[sanitizedActionPath].default) {\n throw new Error('Data action path ' + sanitizedActionPath + ' does not have a default export');\n }\n binding.dataActions[sanitizedActionPath].default.prototype.RegistrationId = sanitizedActionPath;\n if (binding.dataActions[sanitizedActionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[sanitizedActionPath].default.prototype.id] = sanitizedActionPath;\n }\n }\n };\n \n\n { \n const actionPath = 'actions/add-custom-additional-info.action';\n binding.dataActions[actionPath] = require('partner/actions/add-custom-additional-info.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'actions/get-custom-address.action';\n binding.dataActions[actionPath] = require('partner/actions/get-custom-address.action');\n registerActionId(actionPath);\n }\n\n \n window.__bindings__ = window.__bindings__ || {};\n window.__bindings__.modules = {\n ...window.__bindings__.modules || {},\n ...binding.modules\n };\n \n window.__bindings__.packageDataActions = {};\n window.__bindings__.packageDataActions['__local__'] = {\n ...binding.dataActions\n };","module.exports = React;","module.exports = ReactDOM;"],"names":["AddCustomCheckoutAdditionalInfoInput","constructor","apiSettings","transactionId","channelId","dataAreaId","poNumber","shippingDetailsForWarehouse","shippingDetailsForTransportation","messageToCustomerService","userAccountNumber","getCacheKey","getCacheObjectType","dataCacheType","this","Msdyn365","action","async","input","ctx","requestContext","requestOptions","headers","oun","user","token","Authorization","requestUrl","baseUrl","requestBody","TransactionID","ChannelId","DataAreaId","PONumber","WareHouseShippingDetails","TransportationShippingDetails","MessageToCustomerService","sendCommerceRequest","then","response","status","data","trace","catch","error","console","log","message","stack","telemetry","exception","id","args","isAuthenticated","Error","AddressInput","isUpdateObj","filteredAddressObj","createGetAddressInput","inputData","getAddressAction","length","customerInput","GetCustomerInput","customer","getCustomer","addressArr","Addresses","hasArrHaveAttentionToVal","forEach","item","_ctx$requestContext$c","AttentionTo","channel","ChannelNaturalId","filter","_ctx$requestContext$c2","getAddressActionDataAction","createObservableDataAction","binding","modules","dataActions","registerActionId","actionPath","default","prototype","Object","keys","exportName","Action","require","window","__bindings__","_objectSpread","packageDataActions","module","exports","React","ReactDOM"],"sourceRoot":""}