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AiB,CAAC,EAC/BA,EAAe,+EAAiF,CACxGpB,EAAGA,IAAMC,EAAQ,MACjBoB,GAAI,+CAEpB/F,OAAO6F,aAAe7F,OAAO6F,cAAgB,CAAC,EAC9C7F,OAAO6F,aAAaC,eAAc5C,EAAAA,EAAA,GACPlD,OAAO6F,aAAaC,gBAAkB,CAAC,GACvCA,UCnF3BE,EAAOC,QAAUrG,cCAjBoG,EAAOC,QAAUC","sources":["webpack://Msdyn365.Commerce.Online/./src/actions/ecomm-current-event.ts?31c1","webpack://Msdyn365.Commerce.Online/./src/actions/get-categories.ts?0ce6","webpack://Msdyn365.Commerce.Online/./src/modules/ecomm-event-description/ecomm-event-description.tsx?a991","webpack://Msdyn365.Commerce.Online/./src/modules/ecomm-event-description/ecomm-event-description.view.tsx?7ca9","webpack://Msdyn365.Commerce.Online/./lib/ecomm-event-description/module-registration.js?1bb3","webpack://Msdyn365.Commerce.Online/external var \"React\"?0d3b","webpack://Msdyn365.Commerce.Online/external var \"ReactDOM\"?853b"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License. See License.txt in the project root for license information.\r\n *--------------------------------------------------------------------------------------------*/\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\n/**\r\n * GetActivecategorymenustate Input Action\r\n */\r\nexport class GetCurrentEventInput implements Msdyn365.IActionInput {\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 = () => `CurrentEvent`;\r\n public getCacheObjectType = () => 'CurrentEvent';\r\n public dataCacheType = (): Msdyn365.CacheType => 'application';\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 IGetCurrentEventStateData {\r\n eventJson: 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 return new GetCurrentEventInput();\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 getCurrentEventStateAction(input: GetCurrentEventInput, ctx: Msdyn365.IActionContext): Promise {\r\n // TODO: Uncomment the below line to get the value from a service.\r\n // const response = await Msdyn365.sendRequest('/get/example/id/1', 'get');\r\n return { eventJson: '' };\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >getCurrentEventStateAction,\r\n // TODO: Give your data action a unique id.\r\n id: 'GetCurrentEventStateActionState',\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});","import { createObservableDataAction, IAction, ICreateActionContext } from '@msdyn365-commerce/core';\r\nimport { Category, retailAction } from '@msdyn365-commerce/retail-proxy';\r\nimport { createGetCategoriesInput } from '@msdyn365-commerce/retail-proxy/dist/DataActions/CategoriesDataActions.g';\r\n\r\n/**\r\n * Get Org Unit Configuration Data Action\r\n */\r\nexport default createObservableDataAction({\r\n action: >retailAction,\r\n input: (context: ICreateActionContext) => {\r\n return createGetCategoriesInput({ Paging: { Top: 0 } }, context.requestContext.apiSettings.channelId);\r\n }\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 * as React from 'react';\r\n\r\nimport { generateImageUrl } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nimport { getUpcomingEventsByIdAsync } from '../../actions/DataActionExtension.g';\r\nimport { GetCurrentEventInput } from '../../actions/ecomm-current-event';\r\n\r\nimport { IEcommEventDescriptionData } from './ecomm-event-description.data';\r\nimport { IEcommEventDescriptionProps } from './ecomm-event-description.props.autogenerated';\r\n\r\nexport interface IEcommEventDescriptionViewProps extends IEcommEventDescriptionProps {\r\n type: string;\r\n name: string;\r\n imageUrl: string;\r\n description: string;\r\n}\r\n\r\n/**\r\n *\r\n * EcommEventDescription component\r\n * @extends {React.PureComponent>}\r\n */\r\nclass EcommEventDescription extends React.PureComponent> {\r\n public state = { event: '' };\r\n\r\n public componentDidMount() {\r\n if (typeof window !== 'undefined') {\r\n const { config, context, data: { categories } } = this.props;\r\n \r\n const parameters = window.location.search;\r\n const urlParams = new URLSearchParams(parameters);\r\n const eventId = urlParams.get('id');\r\n\r\n const language = context.request.locale.split('-')[0];\r\n const org = config.organisation ? this.props.config.organisation! : 'BT';\r\n\r\n let startDate = new Date();\r\n startDate.setHours(0, 0, 0, 0);\r\n \r\n let endDate = new Date();\r\n endDate.setHours(0, 0, 0, 0);\r\n endDate.setMonth(endDate.getMonth() + config.dateRange);\r\n\r\n // Get event from api.\r\n getUpcomingEventsByIdAsync({ callerContext: context.actionContext }, config.isUat, language, org, startDate.toISOString(), endDate.toISOString(), eventId ? eventId : '').then(result => {\r\n if (result.length > 0 && this.state.event === '') {\r\n const eventJson = JSON.parse(result[0]);\r\n\r\n if (eventJson['EcommerceId']) {\r\n var categoryIndex = categories.result!.findIndex(category => category.RecordId.toString() === eventJson['EcommerceId'])\r\n \r\n if (categoryIndex >= 0) {\r\n var imgUrl = generateImageUrl(categories.result![`${categoryIndex}`].Images![0].Uri, this.props.context.request.apiSettings);\r\n eventJson['Img'] = imgUrl;\r\n }\r\n\r\n context.actionContext.update(new GetCurrentEventInput(), { eventJson: result[result.length - 1] });\r\n }\r\n\r\n this.setState({ event: JSON.stringify(eventJson) });\r\n }\r\n });\r\n }\r\n }\r\n\r\n public render(): JSX.Element | null {\r\n if (!this.state.event) {\r\n return null;\r\n }\r\n\r\n const item = JSON.parse(this.state.event);\r\n\r\n const IEcommEventDescriptionViewProps = {\r\n ...this.props,\r\n type: item.Type,\r\n name: item.Name,\r\n imageUrl: item.Img,\r\n description: item.Description\r\n };\r\n \r\n return this.props.renderView(IEcommEventDescriptionViewProps);\r\n }\r\n}\r\n\r\nexport default EcommEventDescription;","/*!\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 React from 'react';\r\n\r\nimport { IEcommEventDescriptionViewProps } from './ecomm-event-description';\r\n\r\n/**\r\n *\r\n * EcommEventDescriptionView component\r\n * @extends {React.PureComponent}\r\n */\r\n export class EcommEventDescriptionView extends React.PureComponent {\r\n public render(): JSX.Element | null {\r\n return (\r\n
\r\n
\r\n
\r\n
\r\n
\r\n

{this.props.type}

\r\n

{this.props.name}

\r\n

{this.props.description}

\r\n {this._renderButtons()}\r\n
\r\n
\r\n );\r\n }\r\n\r\n private _renderButtons(): JSX.Element | null {\r\n const { config } = this.props;\r\n\r\n let first = null;\r\n\r\n if (config.firstAnchorTargetID) {\r\n first = {config.firstButtonText};\r\n }\r\n\r\n let second = null;\r\n\r\n if (config.secondAnchorTargetID) {\r\n second = {config.secondButtonText};\r\n }\r\n\r\n return (\r\n
\r\n {first}\r\n {second}\r\n
\r\n );\r\n }\r\n }\r\n\r\nexport default EcommEventDescriptionView;","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['ecomm-event-description'] = {\n c: () => require('partner/modules/ecomm-event-description/ecomm-event-description.tsx'),\n $type: 'contentModule',\n da: [{name:'categories', path:'actions/get-categories', runOn: 0}],\n \n iNM: false,\n ns: '__local__',\n n: 'ecomm-event-description',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/ecomm-event-description'\n });\n \n\n {\n const sanitizedActionPath = 'actions/get-categories';\n let dataAction = require('partner/actions/get-categories');\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 };\n export const viewDictionary = {};\n viewDictionary['__local__|__local__|modules|ecomm-event-description|ecomm-event-description'] = {\n c: () => require('partner/modules/ecomm-event-description/ecomm-event-description.view.tsx'),\n cn: '__local__-__local__-ecomm-event-description'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\n };","module.exports = React;","module.exports = ReactDOM;"],"names":["GetCurrentEventInput","constructor","getCacheKey","getCacheObjectType","dataCacheType","Msdyn365","action","async","input","ctx","eventJson","id","args","createObservableDataAction","retailAction","context","createGetCategoriesInput","Paging","Top","requestContext","apiSettings","channelId","EcommEventDescription","React","state","event","componentDidMount","window","config","data","categories","this","props","parameters","location","search","eventId","URLSearchParams","get","language","request","locale","split","org","organisation","startDate","Date","setHours","endDate","setMonth","getMonth","dateRange","getUpcomingEventsByIdAsync","callerContext","actionContext","isUat","toISOString","then","result","length","JSON","parse","categoryIndex","findIndex","category","RecordId","toString","imgUrl","generateImageUrl","Images","Uri","update","setState","stringify","render","item","IEcommEventDescriptionViewProps","_objectSpread","type","Type","name","Name","imageUrl","Img","description","Description","renderView","EcommEventDescriptionView","className","src","_renderButtons","first","firstAnchorTargetID","href","firstButtonText","second","secondAnchorTargetID","secondButtonText","binding","modules","dataActions","c","require","$type","da","path","runOn","iNM","ns","n","p","pdp","md","registerSanitizedActionPath","sanitizedActionPath","dataAction","default","Error","prototype","RegistrationId","__bindings__","viewDictionary","cn","module","exports","ReactDOM"],"sourceRoot":""}