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O,IACzIC,qBAAsB,CAAC,eAAe,sBAAsB,6BAA6B,SAAS,YAAY,OAAO,8BAA8B,gBAAgB,SAAS,cAAc,iCAAiC,0BAA0B,aAAa,kBAAkB,sBAAsB,eAAe,oBAAoB,eAAe,0BAA0B,SAAS,iBAAiB,aAAa,gBAC7ZC,KAAK,EACLC,GAAI,YACJC,EAAG,wBACHC,EAAG,YAEHC,IAAK,GAELC,cAAe,4CACfC,GAAI,oCAlC4BC,EAACC,EAAqBC,KAUlD,GADArB,EAAQE,YAAYkB,GAAuBC,GACtCrB,EAAQE,YAAYkB,GAAqBE,QAC1C,MAAM,IAAIxB,MAAM,oBAAsBsB,EAAsB,mCAEhEpB,EAAQE,YAAYkB,GAAqBE,QAAQC,UAAUC,eAAiBJ,EACxEpB,EAAQE,YAAYkB,GAAqBE,QAAQC,UAAU7B,KAC3DM,EAAQE,YAAYF,EAAQE,YAAYkB,GAAqBE,QAAQC,UAAU7B,IAAM0B,IA0BzFD,CAF4B,gFACXf,EAAQ,MAMjCqB,OAAOC,aAAeD,OAAOC,cAAgB,GAC7CD,OAAOC,aAAazB,QAAO0B,EAAAA,EAAA,GACpBF,OAAOC,aAAazB,SAAW,IAC/BD,EAAQC,SAGXwB,OAAOC,aAAaxB,YAAWyB,EAAAA,EAAA,GAC5BF,OAAOC,aAAaxB,aAAe,IACnCF,EAAQE,iCCzEnB0B,EAAOC,QAAU9B,2BCAjB6B,EAAOC,QAAUC","sources":["webpack://Msdyn365.Commerce.Online/./src/modules/herbal-product-specification/actions/get-cms-product-attribute.action.ts?5a49","webpack://Msdyn365.Commerce.Online/./src/themes/herbal-adventureworks/herbal-adventureworks.tsx?0568","webpack://Msdyn365.Commerce.Online/./lib/herbal-adventureworks/module-registration.js?cbb3","webpack://Msdyn365.Commerce.Online/external var \"React\"?0d3b","webpack://Msdyn365.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\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { getSelectedProductIdFromActionInput, getSelectedVariant, SelectedVariantInput } from '@msdyn365-commerce-modules/retail-actions';\r\n/**\r\n * GetCmsProductAttributeContent Input Action\r\n */\r\nexport class GetCmsProductAttributeContentInput implements Msdyn365.IActionInput {\r\n public productId: number;\r\n\r\n public channelId: number;\r\n\r\n public constructor(productId: number | string, channelId: number) {\r\n this.productId = typeof productId === 'string' ? +productId : productId;\r\n this.channelId = channelId;\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 = () => `CMS_Prod_Attr`;\r\n public getCacheObjectType = () => 'CMS_Prod_Attr';\r\n public dataCacheType = (): Msdyn365.CacheType => 'request';\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 IGetCmsProductAttributeContentData {\r\n id: string;\r\n type: string;\r\n title: string;\r\n prod_attr_top: string;\r\n prod_attr_main: 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): Msdyn365.IActionInput => {\r\n const productId = getSelectedProductIdFromActionInput(args);\r\n\r\n if (productId) {\r\n return new GetCmsProductAttributeContentInput(+productId, +args.requestContext.apiSettings.channelId);\r\n }\r\n throw new Error('Unable to create createInput, no productId found on module config or query');\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 action(\r\n input: GetCmsProductAttributeContentInput,\r\n ctx: Msdyn365.IActionContext\r\n): Promise {\r\n const selectedVariantInput = new SelectedVariantInput(input.productId, input.channelId);\r\n try {\r\n const productResult = await getSelectedVariant(selectedVariantInput, ctx);\r\n if (productResult && productResult?.ItemId !== undefined) {\r\n // const frontApiEndpoint = 'http://herbal-cms.localhost:8001';\r\n const frontApiEndpoint = ctx.requestContext.app.config.cmsAPIEndpoint && ctx.requestContext.app.config.cmsAPIEndpoint;\r\n const requestUrl = `${frontApiEndpoint}/api/get-product-attribute/${productResult?.ItemId}/en`;\r\n\r\n const result = await Msdyn365.sendRequest(requestUrl, 'get')\r\n .then(response => {\r\n return response.data;\r\n })\r\n .catch(error => {\r\n ctx.trace('[GetCmsProductAttributeContentInput] Failed to get cms detail.');\r\n throw error;\r\n });\r\n return result;\r\n }\r\n\r\n return undefined;\r\n } catch (error) {\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- cann't assign type to the error variable.\r\n ctx.telemetry.exception(error);\r\n ctx.telemetry.debug('[getCMSProductAttribute]Error executing action');\r\n return undefined;\r\n }\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >action,\r\n // TODO: Give your data action a unique id\r\n id: 'GetCmsProductAttributeContent',\r\n input: 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\n/* eslint-disable no-duplicate-imports */\r\nimport * as React from 'react';\r\n\r\n// TODO: Current build require at least one tsx file\r\nexport default () =>
;\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 (binding.modules['herbal-adventureworks'] = {\n c: () => require('partner/themes/herbal-adventureworks/herbal-adventureworks.tsx'),\n $type: 'themeModule',\n da: [{name:'content', path:'modules/herbal-product-specification/actions/get-cms-product-attribute.action', moduleName: 'buybox',runOn: 0}],\n definitionExtensions: ['active-image','b2b-requests-status','business-organization-list','buybox','cart-icon','cart','checkout-payment-instrument','content-block','header','herbal-cart','herbal-search-result-container','herbal-text-block-video','image-list','navigation-menu','order-template-list','promo-banner','ratings-histogram','reviews-list','search-result-container','search','store-selector','text-block','write-review'],\n iNM: false,\n ns: '__local__',\n n: 'herbal-adventureworks',\n p: '__local__',\n \n pdp: '',\n \n themeSettings: 'herbal-adventureworks.theme.settings.json',\n md: 'src/themes/herbal-adventureworks'\n });\n \n\n {\n const sanitizedActionPath = 'modules/herbal-product-specification/actions/get-cms-product-attribute.action';\n let dataAction = require('partner/modules/herbal-product-specification/actions/get-cms-product-attribute.action');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\n }\n \n\n \n window.__bindings__ = window.__bindings__ || {};\n window.__bindings__.modules = {\n ...window.__bindings__.modules || {},\n ...binding.modules\n };\n \n window.__bindings__.dataActions = {\n ...window.__bindings__.dataActions || {},\n ...binding.dataActions\n };","module.exports = React;","module.exports = ReactDOM;"],"names":["GetCmsProductAttributeContentInput","constructor","productId","channelId","getCacheKey","getCacheObjectType","dataCacheType","this","Msdyn365","action","async","input","ctx","selectedVariantInput","SelectedVariantInput","productResult","getSelectedVariant","undefined","ItemId","requestUrl","requestContext","app","config","cmsAPIEndpoint","then","response","data","catch","error","trace","telemetry","exception","debug","id","args","getSelectedProductIdFromActionInput","apiSettings","Error","React","binding","modules","dataActions","c","require","$type","da","name","path","moduleName","runOn","definitionExtensions","iNM","ns","n","p","pdp","themeSettings","md","registerSanitizedActionPath","sanitizedActionPath","dataAction","default","prototype","RegistrationId","window","__bindings__","_objectSpread","module","exports","ReactDOM"],"sourceRoot":""}