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GAGLC,GAAI,6CAlC4BC,EAACC,EAAqBC,KAUlD,GADAlB,EAAQE,YAAYe,GAAuBC,GACtClB,EAAQE,YAAYe,GAAqBE,QAC1C,MAAM,IAAIC,MAAM,oBAAsBH,EAAsB,mCAEhEjB,EAAQE,YAAYe,GAAqBE,QAAQE,UAAUC,eAAiBL,EACxEjB,EAAQE,YAAYe,GAAqBE,QAAQE,UAAUvI,KAC3DkH,EAAQE,YAAYF,EAAQE,YAAYe,GAAqBE,QAAQE,UAAUvI,IAAMmI,IA0BzFD,CAF4B,kCACXZ,EAAQ,MAMjC5D,OAAO+E,aAAe/E,OAAO+E,cAAgB,GAC7C/E,OAAO+E,aAAatB,QAAOrJ,EAAAA,EAAA,GACpB4F,OAAO+E,aAAatB,SAAW,IAC/BD,EAAQC,SAGXzD,OAAO+E,aAAarB,YAAWtJ,EAAAA,EAAA,GAC5B4F,OAAO+E,aAAarB,aAAe,IACnCF,EAAQE,iCCzEnBsB,EAAOC,QAAU9E,2BCAjB6E,EAAOC,QAAUC","sources":["webpack://Msdyn365.Commerce.Online/./src/actions/get-all-articles.action.ts?5930","webpack://Msdyn365.Commerce.Online/./src/actions/lobas-url-utils.ts?fbe6","webpack://Msdyn365.Commerce.Online/./src/modules/lobas-article-collection-mini/lobas-article-collection-mini.tsx?ec52","webpack://Msdyn365.Commerce.Online/./src/modules/lobas-article-collection/components/articleCollectionCard.tsx?517d","webpack://Msdyn365.Commerce.Online/./lib/lobas-article-collection-mini/module-registration.js?b602","webpack://Msdyn365.Commerce.Online/external var \"React\"?0d3b","webpack://Msdyn365.Commerce.Online/external var \"ReactDOM\"?853b"],"sourcesContent":["/* eslint-disable no-debugger */\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\n// import { createObservableDataAction, IAction, ICreateActionContext } from '@msdyn365-commerce/core';\r\n// import { IArticle } from './DataServiceEntities.g';\r\n\r\nimport {\r\n createObservableDataAction,\r\n IAction,\r\n ICommerceApiSettings,\r\n ICreateActionContext,\r\n IActionInput,\r\n IActionContext\r\n} from '@msdyn365-commerce/core';\r\nimport { IQueryResultSettings, convertToString, SortColumn, CacheType, AsyncResult } from '@msdyn365-commerce/retail-proxy';\r\nimport { IArticle } from './DataServiceEntities.g';\r\nimport { getAllArticlesAsync } from './DataActionExtension.g';\r\nimport { ILobasTableRefinerValue } from '../modules/components/lobas-table';\r\nimport { generateCacheKey, QueryResultSettingsProxy } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { toJS } from 'mobx';\r\n\r\nimport { hydrateRefinersFromUrl } from './lobas-url-utils';\r\n\r\nexport class BaseCollectionInput implements IActionInput {\r\n public refiners: ILobasTableRefinerValue[];\r\n\r\n public queryResultSettings: IQueryResultSettings;\r\n\r\n public apiSettings: ICommerceApiSettings;\r\n\r\n public locale?: string;\r\n\r\n public articlePageURL?: string;\r\n\r\n public constructor(\r\n apiSettings: ICommerceApiSettings,\r\n queryResultSettings: IQueryResultSettings,\r\n refiners: ILobasTableRefinerValue[],\r\n locale?: string,\r\n articlePageURL?: string\r\n ) {\r\n this.apiSettings = apiSettings;\r\n this.queryResultSettings = queryResultSettings;\r\n this.refiners = refiners;\r\n this.locale = locale;\r\n this.articlePageURL = articlePageURL;\r\n }\r\n\r\n public getCacheKey = () => {\r\n const queryResultSettings = {\r\n ...this.queryResultSettings.Paging,\r\n ...toJS(this.queryResultSettings.Sorting)\r\n };\r\n\r\n const cacheKey = generateCacheKey(\r\n this.apiSettings,\r\n {\r\n key: 'Refiners',\r\n value: this.refiners.map(\r\n refiner =>\r\n `RefinerRecordId:${refiner.RefinerRecordId}-LeftValueBoundString:${refiner.LeftValueBoundString ||\r\n ''}-RightValueBoundString:${refiner.RightValueBoundString || ''}`\r\n )\r\n },\r\n { key: 'QueryResultSettings', value: convertToString(queryResultSettings) },\r\n { key: 'Locale', value: this.locale }\r\n );\r\n return cacheKey;\r\n };\r\n\r\n public getCacheObjectType = () => 'CollectionActionResult';\r\n\r\n public dataCacheType = (): CacheType => 'request';\r\n}\r\n\r\nexport class GetFullArticlesByCollectionInput extends BaseCollectionInput implements IActionInput {\r\n /**\r\n * The cache object type.\r\n * @returns The cache object type.\r\n */\r\n public getCacheObjectType = (): string => 'FullArticlesResult';\r\n\r\n /**\r\n * The data cache type.\r\n * @returns The data cache type.\r\n */\r\n public dataCacheType = (): CacheType => {\r\n if (\r\n (this.refiners && this.refiners.length > 0) ||\r\n (this.queryResultSettings &&\r\n this.queryResultSettings.Sorting &&\r\n this.queryResultSettings.Sorting.Columns &&\r\n this.queryResultSettings.Sorting.Columns.length > 0)\r\n ) {\r\n return 'request';\r\n }\r\n return 'application';\r\n };\r\n}\r\n\r\nexport type CollectionClassConstructor = new (\r\n apiSettings: ICommerceApiSettings,\r\n queryResultSettings: IQueryResultSettings,\r\n refiners: ILobasTableRefinerValue[],\r\n locale?: string\r\n) => BaseCollectionInput;\r\n\r\nexport interface IFullArticleResultsWithCount {\r\n articles: IArticle[];\r\n count: number;\r\n}\r\n\r\n/**\r\n * TODO: Use this function to create the input required to make the action call.\r\n * @param args\r\n * @param inputClassConstuctor\r\n */\r\nexport const createBaseCollectionInput = (\r\n args: ICreateActionContext,\r\n inputClassConstuctor: CollectionClassConstructor\r\n): BaseCollectionInput => {\r\n const queryResultSettings = QueryResultSettingsProxy.fromInputData(args).QueryResultSettings;\r\n const queryRefiners = hydrateRefinersFromUrl(args.requestContext);\r\n\r\n if (args.requestContext.query && args.requestContext.query.sorting) {\r\n queryResultSettings.Sorting = { Columns: JSON.parse(decodeURIComponent(args.requestContext.query.sorting)) };\r\n }\r\n\r\n return new inputClassConstuctor(args.requestContext.apiSettings, queryResultSettings, queryRefiners, args.requestContext.locale);\r\n};\r\n\r\n/**\r\n * CreateInput function which creates and actionInput used to fetch products for a list page.\r\n * @param args - The API arguments.\r\n * @returns IActionInput - The action input.\r\n */\r\nconst createInput = (args: ICreateActionContext<{ itemsPerPage: number; articlePageURL: string }>): IActionInput => {\r\n const input = createBaseCollectionInput(args, GetFullArticlesByCollectionInput);\r\n\r\n // Set Top\r\n if (input.queryResultSettings.Paging) {\r\n input.queryResultSettings.Paging.Top = args.config?.itemsPerPage || 1;\r\n }\r\n\r\n // Set Skip\r\n if (input.queryResultSettings.Paging && args.requestContext.query && args.requestContext.query.skip) {\r\n input.queryResultSettings.Paging.Skip = +args.requestContext.query.skip;\r\n }\r\n\r\n input.queryResultSettings.Sorting = { Columns: [{ IsDescending: true, ColumnName: 'DateReleased' }] };\r\n\r\n input.queryResultSettings.count = true;\r\n\r\n input.articlePageURL = args.config && args.config.articlePageURL;\r\n\r\n return input;\r\n};\r\n\r\n/**\r\n * Action function to fetch products for a list page.\r\n * @param input - The input.\r\n * @param context - The context.\r\n * @returns IFullArticleResultsWithCount - The full product search result with count.\r\n */\r\nasync function action(input: GetFullArticlesByCollectionInput, context: IActionContext): Promise {\r\n const defaultNumber: number = 0;\r\n\r\n const promise: AsyncResult = getAllArticlesAsync({\r\n callerContext: context,\r\n queryResultSettings: input.queryResultSettings\r\n });\r\n\r\n let articleResults = await promise;\r\n\r\n const pageName = context.requestContext.url.requestUrl.pathname.split('/').at(1);\r\n\r\n if (pageName === input.articlePageURL?.replace('/', '')) {\r\n const articleURL = context.requestContext.url.requestUrl.pathname.split('/').at(-1);\r\n articleResults = articleResults.filter(article => article.URL !== articleURL);\r\n }\r\n\r\n return { articles: articleResults, count: promise.metadata.count ?? defaultNumber };\r\n}\r\n\r\nexport const getArticlesDataAction = createObservableDataAction({\r\n id: 'lobas-article-collection/get-full-articles-by-collection',\r\n action: action as IAction,\r\n input: createInput\r\n});\r\n\r\nexport default getArticlesDataAction;\r\n","/* eslint-disable no-debugger */\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 MsDyn365, { IRequestContext, getUrlSync, IActionContext } from '@msdyn365-commerce/core';\r\nimport { SortColumn } from '@msdyn365-commerce/retail-proxy';\r\nimport { ILobasTableRefinerValue } from '../modules/components/lobas-table';\r\n\r\n/**\r\n * Refiner Compression:\r\n * Refiners contains a non-trivial amount of data that is required to successfully make\r\n * a refiner-based API call. To allow for deep-linking of refiners in the URL, refiner data\r\n * must be compressed so that URL max length is not exceeded. Refiners will be compressed into\r\n * the following array style index-based format:\r\n * [DataTypeValue, LeftValueBoundString, RefinerRecordId, RefinerSourceValue, RightValueBoundString, UnitText].\r\n */\r\nconst compressedRefinerKeys = [\r\n 'DataTypeValue',\r\n 'LeftValueBoundString',\r\n 'RefinerRecordId',\r\n 'RefinerSourceValue',\r\n 'RightValueBoundString',\r\n 'UnitText'\r\n];\r\n\r\n/**\r\n * Hydrates compressed refiner data from URL.\r\n * @param fullUrl The full URL of the page.\r\n * @param requestContext\r\n */\r\nexport const hydrateRefinersFromUrl = (requestContext: IRequestContext): ILobasTableRefinerValue[] => {\r\n const compressedRefinerArray = parseQueryParam<(string | number)[][]>('refiners', requestContext);\r\n if (!compressedRefinerArray || compressedRefinerArray.length === 0) {\r\n return [];\r\n }\r\n\r\n return compressedRefinerArray\r\n .map(compressedRefiner => {\r\n try {\r\n const parsedRefiner: ILobasTableRefinerValue = {};\r\n compressedRefinerKeys.forEach((refinerKey, index) => {\r\n parsedRefiner[refinerKey] = compressedRefiner[index];\r\n });\r\n return parsedRefiner;\r\n } catch {\r\n return undefined;\r\n }\r\n })\r\n .filter(Boolean);\r\n};\r\n\r\n/**\r\n * Compressed a list of refiners for use in URLs.\r\n * @param refiners The uncompressed refiners.\r\n */\r\nexport const compressRefiners = (refiners: ILobasTableRefinerValue[]) => {\r\n const compressedRefiners: (string | number)[][] = [];\r\n\r\n refiners.forEach(refiner => {\r\n const compressedRefiner: (string | number)[] = [];\r\n compressedRefinerKeys.forEach(refinerKey => {\r\n compressedRefiner.push(refiner[refinerKey]);\r\n });\r\n compressedRefiners.push(compressedRefiner);\r\n });\r\n\r\n return compressedRefiners;\r\n};\r\n\r\n/**\r\n * Method which creates a URL contiaining serialized active refiners.\r\n * @param fullUrl The Current URL of the page.\r\n * @param refiners The refiners which should be added to the URL.\r\n * @param sortingColumns\r\n * @param skipCount\r\n */\r\nexport const buildListPageUrl = (fullUrl: URL, refiners?: ILobasTableRefinerValue[], sortingColumns?: SortColumn[], skipCount?: number) => {\r\n // Refiner Change flow\r\n if (refiners !== undefined) {\r\n if (refiners.length === 0) {\r\n fullUrl.searchParams.delete('refiners');\r\n } else {\r\n fullUrl.searchParams.set('refiners', JSON.stringify(compressRefiners(refiners)));\r\n }\r\n\r\n // Adding or removing a refiner means we want to always load page 1\r\n fullUrl.searchParams.delete('skip');\r\n return fullUrl.href;\r\n }\r\n debugger;\r\n if (sortingColumns !== undefined) {\r\n if (sortingColumns.length === 0) {\r\n fullUrl.searchParams.delete('sorting');\r\n } else {\r\n fullUrl.searchParams.set('sorting', JSON.stringify(sortingColumns));\r\n }\r\n\r\n // Changing the sort means always load page 1\r\n fullUrl.searchParams.delete('skip');\r\n return fullUrl.href;\r\n }\r\n\r\n if (skipCount) {\r\n fullUrl.searchParams.set('skip', skipCount.toString());\r\n }\r\n\r\n return fullUrl.href;\r\n};\r\n\r\n/**\r\n * Parses a query param from the query object of the request context.\r\n * @param key The query parameter key.\r\n * @param requestContext The request context.\r\n */\r\nexport const parseQueryParam = (key: string, requestContext: IRequestContext): T | null => {\r\n if (requestContext.query && requestContext.query[key]) {\r\n return JSON.parse(decodeURIComponent(requestContext.query[key]));\r\n }\r\n return null;\r\n};\r\n\r\n/**\r\n * Gets the current URL of the page from the request context.\r\n * @param requestContext The request context.\r\n */\r\nexport const getCurrentUrl = (requestContext: IRequestContext): URL => {\r\n if (MsDyn365.isBrowser) {\r\n return new URL(window.location.href);\r\n }\r\n\r\n // NOTE: Typing on requestURL is incorrect\r\n if (requestContext.url.requestUrl.href) {\r\n return new URL(requestContext.url.requestUrl.href);\r\n }\r\n return new URL((requestContext.url.requestUrl));\r\n};\r\n\r\nexport function getArticlePageUrlSync(name: string, recordId: number, ctx: IActionContext): string {\r\n return getUrlSync('article', ctx, {\r\n article: { Title: name || '', Id: recordId }\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\nimport { IArticle } from '../../actions/DataServiceEntities.g';\r\nimport ArticleCollectionCard from '../lobas-article-collection/components/articleCollectionCard';\r\nimport { ILobasArticleCollectionMiniData } from './lobas-article-collection-mini.data';\r\nimport {\r\n ILobasArticleCollectionMiniProps,\r\n ILobasArticleCollectionMiniResources\r\n} from './lobas-article-collection-mini.props.autogenerated';\r\nimport classNames from 'classnames';\r\nexport interface ILobasArticleCollectionMiniViewProps extends ILobasArticleCollectionMiniProps {\r\n article: IArticle;\r\n resources: ILobasArticleCollectionMiniResources;\r\n locale: string;\r\n}\r\n\r\n/**\r\n *\r\n * LobasArticleCollection component\r\n * @extends {React.PureComponent>}\r\n */\r\nclass LobasArticleCollection extends React.PureComponent> {\r\n public constructor(props: ILobasArticleCollectionMiniProps) {\r\n super(props);\r\n this.state = { articles: [] };\r\n }\r\n\r\n public componentDidMount() {\r\n console.log(this.props.data.articles);\r\n void this.props.data.articles.then(res => {\r\n this.setState({ articles: res.articles });\r\n });\r\n }\r\n\r\n public render(): JSX.Element | null {\r\n const itemsPerPage = this.props.config.itemsPerPage || 1;\r\n\r\n if (this.props.data.articles.status === 'FAILED') {\r\n return
{this.props.resources.noArticlesLabel}
;\r\n } else {\r\n var articles = this.state['articles'];\r\n\r\n var filteredArticles = articles.filter((a: IArticle) => {\r\n if (a.FilterKeywords && this.props.config.filterByTags) {\r\n const keywords = a.FilterKeywords.split(',').map(k => k.trim());\r\n return this.props.config.filterByTags.every(k => keywords.includes(k));\r\n } else {\r\n if (this.props.config.filterByTags) {\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n }\r\n });\r\n\r\n var slicedArticles = filteredArticles.slice(0, itemsPerPage);\r\n\r\n return (\r\n
\r\n {slicedArticles.map((a: IArticle) => {\r\n const articleCollectionViewProps = {\r\n article: a,\r\n resources: this.props.resources,\r\n locale: this.props.context.request.locale\r\n } as ILobasArticleCollectionMiniViewProps;\r\n return (\r\n // eslint-disable-next-line react/jsx-key, react/jsx-no-target-blank\r\n \r\n \r\n \r\n );\r\n })}\r\n
\r\n );\r\n }\r\n }\r\n}\r\n\r\nexport default LobasArticleCollection;\r\n","import React, { Component } from 'react';\r\nimport { getRichTextHtml } from '@msdyn365-commerce/core';\r\nimport { ILobasArticleCollectionViewProps } from '../lobas-article-collection';\r\nimport { ILobasArticleCollectionMiniViewProps } from '../../lobas-article-collection-mini/lobas-article-collection-mini';\r\n\r\nclass ArticleCollectionCard extends Component {\r\n private fixDateFormat(date: Date | undefined): String {\r\n if (!date) {\r\n return '';\r\n }\r\n\r\n const length = 10;\r\n return new Date(date).toLocaleDateString(this.props.locale).substring(0, length);\r\n }\r\n\r\n public render() {\r\n return (\r\n
\r\n \r\n

{this.props.article.Title}

\r\n
{`${this.props.resources.articlePublishedDate} ${this.fixDateFormat(\r\n this.props.article.DateReleased\r\n )}`}
\r\n

\r\n
\r\n {this.props.article.Keywords?.split(',').map(kw => (\r\n // eslint-disable-next-line react/jsx-key\r\n

{kw}

\r\n ))}\r\n
\r\n
{this.props.resources.readMoreLabel}
\r\n
\r\n );\r\n }\r\n}\r\n\r\nexport default ArticleCollectionCard;\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['lobas-article-collection-mini'] = {\n c: () => require('partner/modules/lobas-article-collection-mini/lobas-article-collection-mini.tsx'),\n $type: 'contentModule',\n da: [{name:'articles', path:'actions/get-all-articles.action', runOn: 0}],\n \n iNM: false,\n ns: '__local__',\n n: 'lobas-article-collection-mini',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/lobas-article-collection-mini'\n });\n \n\n {\n const sanitizedActionPath = 'actions/get-all-articles.action';\n let dataAction = require('partner/actions/get-all-articles.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":["BaseCollectionInput","constructor","apiSettings","queryResultSettings","refiners","locale","articlePageURL","getCacheKey","_objectSpread","this","Paging","toJS","Sorting","generateCacheKey","key","value","map","refiner","RefinerRecordId","LeftValueBoundString","RightValueBoundString","convertToString","getCacheObjectType","dataCacheType","GetFullArticlesByCollectionInput","length","Columns","createBaseCollectionInput","args","inputClassConstuctor","QueryResultSettingsProxy","QueryResultSettings","queryRefiners","hydrateRefinersFromUrl","requestContext","query","sorting","JSON","parse","decodeURIComponent","getArticlesDataAction","createObservableDataAction","id","action","async","input","context","_input$articlePageURL","_promise$metadata$cou","promise","getAllArticlesAsync","callerContext","articleResults","url","requestUrl","pathname","split","at","replace","articleURL","filter","article","URL","articles","count","metadata","_args$config","Top","config","itemsPerPage","skip","Skip","IsDescending","ColumnName","compressedRefinerKeys","compressedRefinerArray","parseQueryParam","compressedRefiner","parsedRefiner","forEach","refinerKey","index","_unused","Boolean","buildListPageUrl","fullUrl","sortingColumns","skipCount","undefined","searchParams","delete","set","stringify","compressedRefiners","push","compressRefiners","href","toString","getCurrentUrl","MsDyn365","window","location","LobasArticleCollection","React","props","super","state","componentDidMount","console","log","data","then","res","setState","render","status","resources","noArticlesLabel","slicedArticles","a","FilterKeywords","filterByTags","keywords","k","trim","every","includes","slice","className","classNames","articleCollectionViewProps","request","origin","target","openArticlesInNewTab","ArticleCollectionCard","Object","assign","Component","fixDateFormat","date","Date","toLocaleDateString","substring","_this$props$article$K","src","ThumbnailImage","Title","articlePublishedDate","DateReleased","dangerouslySetInnerHTML","getRichTextHtml","Summary","Keywords","kw","readMoreLabel","binding","modules","dataActions","c","require","$type","da","name","path","runOn","iNM","ns","n","p","pdp","md","registerSanitizedActionPath","sanitizedActionPath","dataAction","default","Error","prototype","RegistrationId","__bindings__","module","exports","ReactDOM"],"sourceRoot":""}