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,EAAiBC,GAIzBQ,OAAOC,aAAeD,OAAOC,cAAgB,GAC7CD,OAAOC,aAAaZ,QAAOjC,EAAAA,EAAA,GACpB4C,OAAOC,aAAaZ,SAAW,IAC/BD,EAAQC,SAGXW,OAAOC,aAAaC,mBAAqB,GACzCF,OAAOC,aAAaC,mBAA8B,UAAC9C,EAAA,GAC5CgC,EAAQE,iCCnEvBa,EAAOC,QAAUC,2BCAjBF,EAAOC,QAAUE","sources":["webpack://united-malt/./src/overrides/get-address-purposes.action.ts?68b5","webpack://united-malt/./src/overrides/get-customer.action.ts?85c6","webpack://united-malt/./src/overrides/get-dimensions-for-selected-variant.action.ts?829c","webpack://united-malt/./lib/__local__/module-registration.js?8a42","webpack://united-malt/external var \"React\"?0d3b","webpack://united-malt/external var \"ReactDOM\"?853b"],"sourcesContent":["/*--------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * See License.txt in the project root for license information.\r\n *--------------------------------------------------------------*/\r\n\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n IAny,\r\n ICommerceApiSettings,\r\n ICreateActionContext,\r\n IGeneric\r\n} from '@msdyn365-commerce/core';\r\nimport {\r\n getAddressPurposesAsync\r\n} from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\r\nimport { AddressPurpose } from '@msdyn365-commerce/retail-proxy';\r\nimport { buildCacheKey, QueryResultSettingsProxy } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\n// @CUSTOM: new import for filtering purpose by config settings\r\nimport { AddressTypesToDisplay } from '../settings/app.settings';\r\n\r\n/**\r\n * Input class for get Address Purposes data action.\r\n */\r\nexport class GetAddressPurposesInput implements IActionInput {\r\n private readonly apiSettings: ICommerceApiSettings;\r\n\r\n constructor(apiSettings: ICommerceApiSettings) {\r\n this.apiSettings = apiSettings;\r\n }\r\n\r\n public getCacheKey = () => buildCacheKey('AddressPurpose', this.apiSettings);\r\n\r\n public getCacheObjectType = () => 'AddressPurpose';\r\n\r\n public dataCacheType = (): CacheType => 'application';\r\n}\r\n\r\n/**\r\n * Creates the input required to make the retail api call.\r\n * @param inputData\r\n */\r\nconst createInput = (inputData: ICreateActionContext>): GetAddressPurposesInput => {\r\n return new GetAddressPurposesInput(inputData.requestContext.apiSettings);\r\n};\r\n\r\nexport async function getAddressPurposesAction(input: GetAddressPurposesInput, ctx: IActionContext): Promise {\r\n\r\n // @CUSTOM: adds filter to address types from global config\r\n // instead of returning next line, customization applied to filter first\r\n const purposes = await getAddressPurposesAsync({ callerContext: ctx, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(ctx) });\r\n const includeList: AddressTypesToDisplay = ctx.requestContext.app.config.addressTypesToDisplay;\r\n\r\n if (includeList.length) {\r\n\r\n const allowedPurposes: AddressPurpose[] = [];\r\n\r\n purposes.forEach(purpose => {\r\n\r\n const allowed = includeList?.find(allowedPurpose => {\r\n return allowedPurpose === purpose.Name;\r\n });\r\n\r\n if (allowed) {\r\n allowedPurposes.push(purpose);\r\n }\r\n\r\n });\r\n\r\n return allowedPurposes;\r\n\r\n }\r\n\r\n // fallback if no filter set in global config\r\n return purposes;\r\n // Customization end\r\n\r\n}\r\n\r\nexport const getAddressPurposesActionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/address/get-address-purposes',\r\n action: >getAddressPurposesAction,\r\n input: createInput\r\n});\r\n\r\nexport default getAddressPurposesActionDataAction;\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n IAny,\r\n ICommerceApiSettings,\r\n ICreateActionContext,\r\n IGeneric\r\n} from '@msdyn365-commerce/core';\r\nimport { Customer, CustomersDataActions } from '@msdyn365-commerce/retail-proxy';\r\n\r\nimport { buildCacheKey } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\n/**\r\n * Input class for get customer data action.\r\n */\r\nexport class GetCustomerInput implements IActionInput {\r\n public customerAccountNumber?: string;\r\n\r\n private readonly apiSettings: ICommerceApiSettings;\r\n\r\n private readonly cacheType?: CacheType;\r\n\r\n public constructor(apiSettings: ICommerceApiSettings, accountNumber?: string, cacheType?: CacheType) {\r\n this.customerAccountNumber = accountNumber;\r\n this.apiSettings = apiSettings;\r\n this.cacheType = cacheType;\r\n }\r\n\r\n /**\r\n * GetCacheKey.\r\n * @returns - Returns string.\r\n */\r\n public getCacheKey = (): string => buildCacheKey(`Customer-${this.customerAccountNumber}`, this.apiSettings);\r\n\r\n /**\r\n * GetCacheObjectType.\r\n * @returns - Cache Object Type string.\r\n */\r\n public getCacheObjectType = (): string => 'Customer';\r\n\r\n /**\r\n * DataCacheType.\r\n * @returns - CacheType string.\r\n */\r\n public dataCacheType = (): CacheType => {\r\n return this.cacheType ? this.cacheType : 'request';\r\n };\r\n}\r\n\r\n/**\r\n * Creates the input required to make the retail api call.\r\n * @param inputData -- The input data passed to the createInput method.\r\n * @returns - ProductAvailabilitiesForSelectedVariant or error.\r\n */\r\nconst createInput = (inputData: ICreateActionContext>): GetCustomerInput => {\r\n const { user, apiSettings } = inputData.requestContext;\r\n if (!user.token || !user.isAuthenticated) {\r\n throw new Error('[getCustomer][createInput]: User is not Authenticated.');\r\n }\r\n\r\n return new GetCustomerInput(apiSettings);\r\n};\r\n\r\n/**\r\n * GetCustomerAction.\r\n * @param input - GetCustomerInput.\r\n * @param ctx - Action Context.\r\n * @returns - Customer information.\r\n */\r\nconst getCustomerAction = async (input: GetCustomerInput, ctx: IActionContext): Promise => {\r\n if (input && ctx.requestContext.user.isAuthenticated) {\r\n // TO-DO- Need to clean up this code once SDK releases new proxy that handles null.\r\n return CustomersDataActions.readAsync({ callerContext: ctx, bypassCache: 'get' }, input.customerAccountNumber || '').then(\r\n response => {\r\n // @CUSTOM: temp patch for address type issue on address select during checkout\r\n // index look of address types causes checkout to fail so setting all address types to\r\n // delivery (2) if neither delivery (2) or invoice (1)\r\n const customer: Customer = Array.isArray(response) ? response[0] : response;\r\n customer?.Addresses?.forEach(address => {\r\n if (address.AddressTypeValue !== 1 && address.AddressTypeValue !== 2) {\r\n address.AddressTypeValue = 2;\r\n }\r\n });\r\n return customer;\r\n // end customization\r\n }\r\n );\r\n }\r\n\r\n ctx.trace('[getCustomer]Invalid input passed to action');\r\n return {};\r\n};\r\n\r\n/**\r\n * The customer data action.\r\n */\r\nexport const getCustomerActionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/get-customer',\r\n action: >getCustomerAction,\r\n input: createInput\r\n});\r\n\r\nexport default getCustomerActionDataAction;\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 { IProductDimensionsWithAvailabilitiesFull, ProductDimensionFull } from '@msdyn365-commerce/commerce-entities';\r\nimport MsDyn365, { // @CUSTOM: Import MsDyn365\r\n CacheType, createObservableDataAction, getCatalogId, IAction, IActionContext, IActionInput,\r\n IAny, ICreateActionContext, IGeneric, IRequestContext\r\n} from '@msdyn365-commerce/core';\r\nimport {\r\n ProductDimension,\r\n ProductDimensionAvailabilitySearchCriteria,\r\n ProductDimensionValue,\r\n ProductDimensionValueInventoryAvailability,\r\n ProductsDataActions\r\n} from '@msdyn365-commerce/retail-proxy';\r\n\r\n//----------------------------------------------------------\r\n// @CUSTOM: Import utilities from the module definition\r\n// instead of from individual files.\r\n//----------------------------------------------------------\r\nimport {\r\n ArrayExtensions,\r\n createInventoryAvailabilitySearchCriteria,\r\n getDimensionValuesFromQuery,\r\n getSelectedProductIdFromActionInput,\r\n QueryResultSettingsProxy,\r\n\r\n // @CUSTOM: New imports\r\n DimensionTypes,\r\n setDimensionValuesToQuery,\r\n convertDimensionTypeToProductDimensionType,\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\n\r\n// Also import hidden variant type\r\nimport { HiddenVariant } from '../settings/app.settings';\r\n//----------------------------------------------------------\r\n\r\n/**\r\n * Defines the dimension value type for get dimensions for selected variant data action.\r\n * Includes old API format for backward compatibility and new API info for availabilities for new logic.\r\n */\r\nexport interface IDimensionValueForSelectedVariant extends ProductDimensionValueInventoryAvailability, ProductDimensionValue {}\r\n\r\n/**\r\n * Defines the returned type for get dimensions for selected variant data action.\r\n * Includes old API format for backward compatibility and new API info for availabilities for new logic.\r\n */\r\nexport interface IDimensionForSelectedVariant extends ProductDimensionFull, IProductDimensionsWithAvailabilitiesFull {}\r\n\r\n/**\r\n * Input class for the getDimensionsForSelectedVariant data action.\r\n */\r\nexport class GetDimensionsForSelectedVariantInput implements IActionInput {\r\n public productId: number;\r\n\r\n public channelId: number;\r\n\r\n public matchingDimensionValues: ProductDimension[];\r\n\r\n public catalogId?: number;\r\n\r\n public constructor(\r\n productId: number,\r\n channelId: number,\r\n matchingDimensionValues?: ProductDimension[],\r\n requestContext?: IRequestContext\r\n ) {\r\n this.productId = productId;\r\n this.channelId = channelId;\r\n this.matchingDimensionValues = matchingDimensionValues || [];\r\n\r\n if (requestContext) {\r\n this.catalogId = getCatalogId(requestContext);\r\n }\r\n }\r\n\r\n /**\r\n * Cache key.\r\n * @returns String.\r\n */\r\n public getCacheKey: () => string = () => `DimensionsForSelectedVariantInput-${this.productId}-${this.channelId}-${this.catalogId ?? 0}`;\r\n\r\n /**\r\n * Cache object type.\r\n * @returns String.\r\n */\r\n public getCacheObjectType: () => string = () => 'DimensionsForSelectedVariantInput';\r\n\r\n /**\r\n * Cache type.\r\n * @returns String.\r\n */\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\n/**\r\n * Create input method for the getDimensionsForSelectedVariant data action.\r\n * @param inputData - The input data passed to the createInput method.\r\n * @returns - The input for the data action.\r\n */\r\nconst createDimensionsForSelectedVariantInput = (inputData: ICreateActionContext>): GetDimensionsForSelectedVariantInput => {\r\n const productId = getSelectedProductIdFromActionInput(inputData);\r\n\r\n if (productId) {\r\n\r\n //----------------------------------------------------------\r\n // @CUSTOM: Inject the target dimension as if it occurred\r\n // in the URL.\r\n // ALSO: if in the browser, update the URL\r\n //----------------------------------------------------------\r\n // Get current dimensions\r\n const curDimensions = getDimensionValuesFromQuery(inputData.requestContext.url.requestUrl);\r\n\r\n // Add the dimension and change the URL\r\n autoSetDimension(curDimensions, inputData.requestContext.app.config.hiddenVariant, inputData.requestContext.url.requestUrl);\r\n\r\n return new GetDimensionsForSelectedVariantInput(\r\n +productId,\r\n +inputData.requestContext.apiSettings.channelId,\r\n curDimensions, // WAS: getDimensionValuesFromQuery(inputData.requestContext.url.requestUrl)\r\n inputData.requestContext\r\n );\r\n //----------------------------------------------------------\r\n}\r\n throw new Error('Unable to create DimensionsForSelectedVariantInput, no productId found on module config or query');\r\n};\r\n\r\n//==========================================================\r\n// @CUSTOM: Set the target dimension and update the URL\r\n//==========================================================\r\nfunction autoSetDimension(dimensions: ProductDimension[], autoVariant: HiddenVariant | undefined, currentUrl: URL) {\r\n\r\n // Verify that global config is fully present. If not, abort.\r\n if (!autoVariant || !autoVariant.name || !autoVariant.defaultValue) {\r\n return;\r\n }\r\n\r\n // Convert the target dimension name to an internal dimension type code\r\n const dimensionType = convertDimensionTypeToProductDimensionType(autoVariant.name.toLowerCase() as DimensionTypes);\r\n\r\n // Search through the list to see if it's already defined\r\n const targetDimension = dimensions.find(entry => entry.DimensionTypeValue === dimensionType);\r\n\r\n // If the dimension is already set, abort\r\n // Note that the dimension could be set to an undesired value, but it's probably best to allow manual overrides\r\n if (targetDimension) {\r\n return;\r\n }\r\n\r\n // Add the target dimension to the list\r\n dimensions.push({\r\n DimensionTypeValue: dimensionType,\r\n DimensionValue: {\r\n RecordId: 0,\r\n Value: autoVariant.defaultValue\r\n }\r\n });\r\n\r\n // If we're in a browser, update the URL\r\n // I'm not sure if this is needed, but seems like a good safety measure for any other code that checks.\r\n if (MsDyn365.isBrowser) {\r\n setDimensionValuesToQuery(currentUrl, dimensions);\r\n }\r\n}\r\n//==========================================================\r\n\r\n/**\r\n * Converts new API type with availabilities to old API type to preserve backward compatibility.\r\n * @param dimensions - Dimensions to convert.\r\n * @returns Dimensions in old API format.\r\n */\r\nconst prepareDimensionsDataResult = (dimensions: IProductDimensionsWithAvailabilitiesFull[]): IDimensionForSelectedVariant[] => {\r\n return dimensions.map(newDimension => {\r\n const oldDimension: IDimensionForSelectedVariant = { ...newDimension };\r\n oldDimension.DimensionValues = ArrayExtensions.validValues(\r\n newDimension.dimensionValuesWithInventory?.map(value => value.DimensionValue)\r\n );\r\n return oldDimension;\r\n });\r\n};\r\n\r\n/**\r\n * Action Method for the getDimensionsForSelectedVariant Data Action.\r\n * @param input - Input for the data action.\r\n * @param context - Action context.\r\n * @returns Product dimensions with availability.\r\n */\r\nexport async function getDimensionsForSelectedVariantAction(\r\n input: GetDimensionsForSelectedVariantInput,\r\n context: IActionContext\r\n): Promise {\r\n const activeProducts = ArrayExtensions.validValues(\r\n await ProductsDataActions.getByIdsAsync(\r\n {\r\n callerContext: context,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\r\n },\r\n input.channelId,\r\n [input.productId],\r\n null,\r\n input.catalogId ?? 0\r\n )\r\n );\r\n\r\n if (!ArrayExtensions.hasElements(activeProducts)) {\r\n return [];\r\n }\r\n\r\n const activeProduct = activeProducts[0];\r\n\r\n if (!ArrayExtensions.hasElements(activeProduct.Dimensions)) {\r\n return [];\r\n }\r\n\r\n const promises = activeProduct.Dimensions.map(dimension => {\r\n const shippingInventoryConfiguration = createInventoryAvailabilitySearchCriteria(context, [], true, undefined, undefined);\r\n\r\n const searchCriteria: ProductDimensionAvailabilitySearchCriteria = {\r\n RequestedDimensionTypeValue: dimension.DimensionTypeValue,\r\n MatchingDimensionValues: input.matchingDimensionValues.filter(item => item.DimensionTypeValue !== dimension.DimensionTypeValue),\r\n DefaultWarehouseOnly: shippingInventoryConfiguration.DefaultWarehouseOnly,\r\n FilterByChannelFulfillmentGroup: shippingInventoryConfiguration.FilterByChannelFulfillmentGroup,\r\n DeliveryModeTypeFilterValue: shippingInventoryConfiguration.DeliveryModeTypeFilterValue,\r\n CatalogId: input.catalogId\r\n };\r\n\r\n const dimensionValuesPromise = ProductsDataActions.getDimensionValuesWithEstimatedAvailabilitiesAsync(\r\n { callerContext: context, queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context) },\r\n activeProduct.MasterProductId ? activeProduct.MasterProductId : activeProduct.RecordId,\r\n searchCriteria\r\n );\r\n const fullDimensionPromise = dimensionValuesPromise.then(dimensionValues => {\r\n const fullDimension: IProductDimensionsWithAvailabilitiesFull = {\r\n ...dimension,\r\n dimensionValuesWithInventory: dimensionValues\r\n };\r\n return fullDimension;\r\n });\r\n\r\n return fullDimensionPromise;\r\n });\r\n\r\n const dimensionValuesResults = await Promise.all(promises);\r\n\r\n return prepareDimensionsDataResult(dimensionValuesResults);\r\n}\r\n\r\n/**\r\n * The GetDimensionsForSelectedVariantDataAction\r\n * Get the currently selected Variant via the getSelectedVariant data action, and the gets the\r\n * available product dimensions for the variant via the getDimensionValues RetailServer API.\r\n */\r\nexport const getDimensionsForSelectedVariantActionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/retail-actions/get-dimensions/for-selected-variant',\r\n action: getDimensionsForSelectedVariantAction as IAction,\r\n input: createDimensionsForSelectedVariantInput\r\n});\r\n\r\nexport default getDimensionsForSelectedVariantActionDataAction;\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 = 'overrides/get-address-purposes.action';\n binding.dataActions[actionPath] = require('partner/overrides/get-address-purposes.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'overrides/get-customer.action';\n binding.dataActions[actionPath] = require('partner/overrides/get-customer.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'overrides/get-dimensions-for-selected-variant.action';\n binding.dataActions[actionPath] = require('partner/overrides/get-dimensions-for-selected-variant.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":["GetAddressPurposesInput","constructor","apiSettings","getCacheKey","buildCacheKey","this","getCacheObjectType","dataCacheType","async","getAddressPurposesAction","input","ctx","purposes","getAddressPurposesAsync","callerContext","queryResultSettings","QueryResultSettingsProxy","getPagingFromInputDataOrDefaultValue","includeList","requestContext","app","config","addressTypesToDisplay","length","allowedPurposes","forEach","purpose","find","allowedPurpose","Name","push","getAddressPurposesActionDataAction","createObservableDataAction","id","action","inputData","GetCustomerInput","accountNumber","cacheType","customerAccountNumber","getCustomerActionDataAction","user","isAuthenticated","CustomersDataActions","bypassCache","then","response","_customer$Addresses","customer","Array","isArray","Addresses","address","AddressTypeValue","trace","token","Error","GetDimensionsForSelectedVariantInput","productId","channelId","matchingDimensionValues","_this$catalogId","catalogId","getCatalogId","getDimensionsForSelectedVariantAction","context","_input$catalogId","activeProducts","ArrayExtensions","validValues","ProductsDataActions","hasElements","activeProduct","Dimensions","promises","map","dimension","shippingInventoryConfiguration","createInventoryAvailabilitySearchCriteria","undefined","searchCriteria","RequestedDimensionTypeValue","DimensionTypeValue","MatchingDimensionValues","filter","item","DefaultWarehouseOnly","FilterByChannelFulfillmentGroup","DeliveryModeTypeFilterValue","CatalogId","MasterProductId","RecordId","dimensionValues","_objectSpread","dimensionValuesWithInventory","dimensionValuesResults","Promise","all","newDimension","_newDimension$dimensi","oldDimension","DimensionValues","value","DimensionValue","getDimensionsForSelectedVariantActionDataAction","getSelectedProductIdFromActionInput","curDimensions","getDimensionValuesFromQuery","url","requestUrl","dimensions","autoVariant","currentUrl","name","defaultValue","dimensionType","convertDimensionTypeToProductDimensionType","toLowerCase","entry","Value","MsDyn365","isBrowser","setDimensionValuesToQuery","autoSetDimension","hiddenVariant","binding","modules","dataActions","registerActionId","actionPath","default","prototype","Object","keys","exportName","Action","require","window","__bindings__","packageDataActions","module","exports","React","ReactDOM"],"sourceRoot":""}