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zD,OAAOgE,aAAehE,OAAOgE,cAAgB,GAC7ChE,OAAOgE,aAAaV,QAAOnL,EAAAA,EAAA,GACpB6H,OAAOgE,aAAaV,SAAW,IAC/BD,EAAQC,SAGXtD,OAAOgE,aAAaC,mBAAqB,GACzCjE,OAAOgE,aAAaC,mBAA8B,UAAC9L,EAAA,GAC5CkL,EAAQE,iCCjGvBW,EAAOC,QAAUC,2BCAjBF,EAAOC,QAAUE","sources":["webpack://Msdyn365.Commerce.Online/./src/actions/get-all-articles.action.ts?5930","webpack://Msdyn365.Commerce.Online/./src/actions/get-all-item-references.action.ts?e8ae","webpack://Msdyn365.Commerce.Online/./src/actions/get-article.action.ts?36ab","webpack://Msdyn365.Commerce.Online/./src/actions/get-ftp-documents.action.ts?9fac","webpack://Msdyn365.Commerce.Online/./src/actions/get-item-references-by-model.action.ts?51f6","webpack://Msdyn365.Commerce.Online/./src/actions/get-roof-table.action.ts?6b0d","webpack://Msdyn365.Commerce.Online/./src/actions/lobas-url-utils.ts?fbe6","webpack://Msdyn365.Commerce.Online/./src/modules/lobas-article-page-summary/lobas-article-page-summary.action.ts?1251","webpack://Msdyn365.Commerce.Online/./src/modules/lobas-product-page-summary/lobas-product-page-summary.action.ts?7bfe","webpack://Msdyn365.Commerce.Online/./lib/__local__/module-registration.js?8a42","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","/*!\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 { createObservableDataAction, IAction, ICreateActionContext } from '@msdyn365-commerce/core';\r\nimport { retailAction } from '@msdyn365-commerce/retail-proxy';\r\nimport { IRoof } from './DataServiceEntities.g';\r\nimport { createGetAllRoofItemReferencesInput } from './DataActionExtension.g';\r\n\r\nexport default createObservableDataAction({\r\n action: >retailAction,\r\n input: (context: ICreateActionContext) => {\r\n return createGetAllRoofItemReferencesInput({ Paging: { Top: 1000 } });\r\n }\r\n});\r\n\r\n/**\r\n * GetRoofTable Input Action\r\n */\r\n/*export class GetRoofTableInput implements IActionInput {\r\n // TODO: Construct the input needed to run the action\r\n constructor() {}\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 = () => 'IGetRoofTable';\r\n public dataCacheType = (): 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 IGetRoofTableData {\r\n text: 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\n/*export const createInput = (args: ICreateActionContext): IActionInput => {\r\n return new GetRoofTableInput();\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\n/*export async function getRoofTableAction(input: GetRoofTableInput, ctx: 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 response = await Msdyn365.sendRequest('/get/example/id/1', 'get');\r\n return (getRoofTableAsync({ callerContext: ctx }));\r\n}\r\n\r\n/**\r\n * Get roof table data action\r\n */\r\n/*export const getRoofTableActionDataAction = createObservableDataAction({\r\n id: 'get-roof-table',\r\n action: >getRoofTableAction,\r\n input: createInput\r\n});\r\n\r\nexport default getRoofTableActionDataAction;*/\r\n","/* eslint-disable no-debugger */\r\nimport { createObservableDataAction, IAction, ICreateActionContext } from '@msdyn365-commerce/core';\r\nimport { retailAction } from '@msdyn365-commerce/retail-proxy';\r\nimport { IArticle } from './DataServiceEntities.g';\r\nimport { createGetArticleByURLInput } from './DataActionExtension.g';\r\n\r\nexport default createObservableDataAction({\r\n action: >retailAction,\r\n input: (context: ICreateActionContext) => {\r\n let articleName = context.requestContext.url.requestUrl.pathname.split('/').at(-1);\r\n if (articleName === undefined) {\r\n articleName = '';\r\n }\r\n\r\n return createGetArticleByURLInput(articleName);\r\n }\r\n});\r\n","/* eslint-disable @typescript-eslint/no-require-imports */\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 Msdyn365 from '@msdyn365-commerce/core';\r\nimport { ILobasDocumentListConfig } from '../modules/lobas-document-list/lobas-document-list.props.autogenerated';\r\n\r\n/**\r\n * GetAllFtpDocuments Input Action\r\n */\r\nexport class GetFtpDocumentsInput implements Msdyn365.IActionInput {\r\n // TODO: Construct the input needed to run the action\r\n public config: ILobasDocumentListConfig;\r\n\r\n constructor(config: ILobasDocumentListConfig) {\r\n this.config = config;\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 = () =>\r\n `IGetFtpDocumentsData_${this.config.ftpServerPath}_${\r\n this.config.documentSearchKeywords ? this.config.documentSearchKeywords.join('_') : ''\r\n }`;\r\n public getCacheObjectType = () => 'IGetFtpDocumentsData';\r\n public dataCacheType = (): Msdyn365.CacheType => 'request';\r\n}\r\n\r\nexport declare enum FileType {\r\n Unknown = 0,\r\n File = 1,\r\n Directory = 2,\r\n SymbolicLink = 3\r\n}\r\nexport interface UnixPermissions {\r\n readonly user: number;\r\n readonly group: number;\r\n readonly world: number;\r\n}\r\n// TODO: Create a data model here or import one to capture the response of the action\r\nexport interface IGetFtpDocumentsData {\r\n name: string;\r\n type: FileType;\r\n size: number;\r\n rawModifiedAt: string;\r\n modifiedAt?: Date;\r\n permissions?: UnixPermissions;\r\n hardLinkCount?: number;\r\n link?: string;\r\n group?: string;\r\n user?: string;\r\n uniqueID?: 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 GetFtpDocumentsInput(args.config as ILobasDocumentListConfig);\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(input: GetFtpDocumentsInput, ctx: Msdyn365.IActionContext): Promise {\r\n const ftp = require('basic-ftp');\r\n let fileList: IGetFtpDocumentsData[] = [];\r\n\r\n const ftpConfig = {\r\n host: input.config.ftpServerHost,\r\n port: input.config.ftpServerPort,\r\n user: input.config.ftpServerUser,\r\n password: input.config.ftpServerPassword,\r\n secure: false\r\n };\r\n\r\n const client = new ftp.Client();\r\n\r\n try {\r\n await client.access(ftpConfig);\r\n //console.log(input.config.ftpServerPath);\r\n fileList = await client.list(`${input.config.ftpServerRootPath}${input.config.ftpServerPath}`);\r\n //console.log(fileList[0]);\r\n } catch (err) {\r\n //console.log(err);\r\n } finally {\r\n client.close();\r\n }\r\n\r\n return fileList;\r\n}\r\n\r\nexport default Msdyn365.createObservableDataAction({\r\n action: >action,\r\n id: 'GetFtpDocuments',\r\n input: createInput\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 { createObservableDataAction, IAction, ICreateActionContext } from '@msdyn365-commerce/core';\r\nimport { retailAction } from '@msdyn365-commerce/retail-proxy';\r\nimport { IRoof } from './DataServiceEntities.g';\r\nimport { createGetRoofItemReferencesByModelInput } from './DataActionExtension.g';\r\n\r\nexport default createObservableDataAction({\r\n action: >retailAction,\r\n input: (context: ICreateActionContext, modelId: any) => {\r\n return createGetRoofItemReferencesByModelInput({ Paging: { Top: 0 } }, modelId);\r\n }\r\n});\r\n\r\n/**\r\n * GetRoofTable Input Action\r\n */\r\n/*export class GetRoofTableInput implements IActionInput {\r\n // TODO: Construct the input needed to run the action\r\n constructor() {}\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 = () => 'IGetRoofTable';\r\n public dataCacheType = (): 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 IGetRoofTableData {\r\n text: 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\n/*export const createInput = (args: ICreateActionContext): IActionInput => {\r\n return new GetRoofTableInput();\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\n/*export async function getRoofTableAction(input: GetRoofTableInput, ctx: 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 response = await Msdyn365.sendRequest('/get/example/id/1', 'get');\r\n return (getRoofTableAsync({ callerContext: ctx }));\r\n}\r\n\r\n/**\r\n * Get roof table data action\r\n */\r\n/*export const getRoofTableActionDataAction = createObservableDataAction({\r\n id: 'get-roof-table',\r\n action: >getRoofTableAction,\r\n input: createInput\r\n});\r\n\r\nexport default getRoofTableActionDataAction;*/\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 { createObservableDataAction, IAction, ICreateActionContext } from '@msdyn365-commerce/core';\r\nimport { retailAction } from '@msdyn365-commerce/retail-proxy';\r\nimport { IRoof } from './DataServiceEntities.g';\r\nimport { createGetRoofTableInput } from './DataActionExtension.g';\r\n\r\nexport default createObservableDataAction({\r\n action: >retailAction,\r\n input: (context: ICreateActionContext) => {\r\n return createGetRoofTableInput({ Paging: { Top: 0 } });\r\n }\r\n});\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. 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 {\r\n CacheType,\r\n createObservableDataAction,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n ICommerceApiSettings,\r\n ICreateActionContext,\r\n IRequestContext\r\n} from '@msdyn365-commerce/core';\r\nimport { buildCacheKey, generateImageUrl, QueryResultSettingsProxy } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nimport { IPageSummaryData } from '@msdyn365-commerce-modules/page-summary';\r\nimport { ILobasArticlePageSummaryConfig } from './lobas-article-page-summary.props.autogenerated';\r\nimport { IArticle } from '../../actions/DataServiceEntities.g';\r\nimport { getArticleByURLAsync } from '../../actions/DataActionExtension.g';\r\n\r\n/**\r\n * Product Page Summary Input.\r\n */\r\nexport class ArticlePageSummaryInput implements IActionInput {\r\n public apiSettings: ICommerceApiSettings;\r\n\r\n public config: ILobasArticlePageSummaryConfig;\r\n\r\n public articleId: string;\r\n\r\n public constructor(\r\n config: ILobasArticlePageSummaryConfig,\r\n apiSettings: ICommerceApiSettings,\r\n articleId: string,\r\n requestContext?: IRequestContext\r\n ) {\r\n this.config = config || {};\r\n this.apiSettings = apiSettings;\r\n this.articleId = articleId;\r\n }\r\n\r\n public getCacheObjectType = (): string => 'ArticlePageSummary';\r\n\r\n public getCacheKey = (): string => `${buildCacheKey('ArticlePageSummary', this.apiSettings)}-${this.config.title}-${this.articleId}`;\r\n\r\n public dataCacheType = (): CacheType => 'application';\r\n}\r\n\r\nexport interface IArticlePageSummary extends IPageSummaryData {\r\n articleId?: string;\r\n}\r\n\r\nconst createInput = (args: ICreateActionContext) => {\r\n const urlParts = args.requestContext.url.requestUrl.href.split('/');\r\n const articleId = urlParts[urlParts.length - 1];\r\n\r\n if (articleId) {\r\n return new ArticlePageSummaryInput(\r\n args.config,\r\n args.requestContext.apiSettings,\r\n articleId,\r\n args.requestContext\r\n );\r\n }\r\n throw new Error('Unable to create ArticlePageSummaryAction input, no articleId found in url');\r\n};\r\n\r\nconst action = async (input: ArticlePageSummaryInput, context: IActionContext): Promise => {\r\n const { config, articleId, apiSettings } = input;\r\n let article: IArticle | undefined;\r\n try {\r\n article = await getArticleByURLAsync(\r\n {\r\n callerContext: context,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\r\n },\r\n articleId\r\n );\r\n } catch {\r\n // Do nothing, if there's an error we fall back to values defined from config\r\n }\r\n if (article) {\r\n const regex = /(<([^>]+)>)/gi;\r\n\r\n return {\r\n title: article.Title,\r\n description: article.Summary?.replace(regex, ''),\r\n sharingImageUrl: generateImageUrl(article.ThumbnailImage, apiSettings),\r\n canonicalUrl: context.requestContext.url.requestUrl.href,\r\n faviconUrl: config && config.faviconUrl,\r\n articleId: article.URL\r\n };\r\n\r\n // If the action fails fallback to values defined from config\r\n } else if (config) {\r\n return {\r\n title: config.title,\r\n description: config.description,\r\n sharingImageUrl: config.sharingImage && config.sharingImage.src,\r\n faviconUrl: config && config.faviconUrl\r\n };\r\n }\r\n return {};\r\n};\r\n\r\nexport default createObservableDataAction({\r\n id: 'lobas-article-page-summary',\r\n action: >action,\r\n input: createInput\r\n});\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\n/* eslint-disable no-duplicate-imports */\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n getCatalogId,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n ICommerceApiSettings,\r\n ICreateActionContext,\r\n IRequestContext\r\n} from '@msdyn365-commerce/core';\r\nimport { SimpleProduct } from '@msdyn365-commerce/retail-proxy';\r\nimport { getAttributeValuesAsync, getByIdsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/ProductsDataActions.g';\r\nimport {\r\n ArrayExtensions,\r\n buildCacheKey,\r\n generateImageUrl,\r\n getProductUrlSync,\r\n getSelectedProductIdFromActionInput,\r\n QueryResultSettingsProxy\r\n} from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nimport { IPageSummaryData } from '@msdyn365-commerce-modules/page-summary';\r\nimport { ILobasProductPageSummaryConfig } from './lobas-product-page-summary.props.autogenerated';\r\n\r\n/**\r\n * Product Page Summary Input.\r\n */\r\nexport class ProductPageSummaryInput implements IActionInput {\r\n public apiSettings: ICommerceApiSettings;\r\n\r\n public config: ILobasProductPageSummaryConfig;\r\n\r\n public productId: number;\r\n\r\n public catalogId?: number;\r\n\r\n public constructor(\r\n config: ILobasProductPageSummaryConfig,\r\n apiSettings: ICommerceApiSettings,\r\n productId: number,\r\n requestContext?: IRequestContext\r\n ) {\r\n this.config = config || {};\r\n this.apiSettings = apiSettings;\r\n this.productId = productId;\r\n\r\n if (requestContext) {\r\n this.catalogId = getCatalogId(requestContext);\r\n }\r\n }\r\n\r\n public getCacheObjectType = (): string => 'ProductPageSummary';\r\n\r\n public getCacheKey = (): string =>\r\n `${buildCacheKey('ProductPageSummary', this.apiSettings)}-${this.config.title}-${this.productId}-${this.catalogId ?? 0}`;\r\n\r\n public dataCacheType = (): CacheType => 'application';\r\n}\r\n\r\nexport interface IProductPageSummary extends IPageSummaryData {\r\n price?: number;\r\n productId?: number;\r\n productBrand?: string;\r\n}\r\n\r\nconst createInput = (args: ICreateActionContext) => {\r\n const productId = getSelectedProductIdFromActionInput(args);\r\n\r\n if (productId) {\r\n return new ProductPageSummaryInput(\r\n args.config,\r\n args.requestContext.apiSettings,\r\n +productId,\r\n args.requestContext\r\n );\r\n }\r\n throw new Error('Unable to create ProductPageSummaryAction input, no productId found on module config or query');\r\n};\r\n\r\n// Checks product attributes for the presence of brand attribute to extract the brand name for product metadata\r\nconst getProductBrand = async (\r\n context: IActionContext,\r\n recordId: number,\r\n channelId: number,\r\n catalogId: number\r\n): Promise => {\r\n const productAttributes = await getAttributeValuesAsync(\r\n {\r\n callerContext: context,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\r\n },\r\n recordId,\r\n channelId,\r\n catalogId\r\n );\r\n for (const productAttribute of productAttributes) {\r\n if (productAttribute.Name === 'Brand') {\r\n return productAttribute.TextValue;\r\n }\r\n }\r\n return;\r\n};\r\n\r\nconst action = async (input: ProductPageSummaryInput, context: IActionContext): Promise => {\r\n const { config, productId, apiSettings } = input;\r\n let simpleProductsData: SimpleProduct[] | undefined;\r\n try {\r\n simpleProductsData = ArrayExtensions.validValues(\r\n await getByIdsAsync(\r\n {\r\n callerContext: context,\r\n queryResultSettings: QueryResultSettingsProxy.getPagingFromInputDataOrDefaultValue(context)\r\n },\r\n apiSettings.channelId,\r\n [productId],\r\n null,\r\n input.catalogId ?? 0\r\n )\r\n );\r\n } catch {\r\n // Do nothing, if there's an error we fall back to values defined from config\r\n }\r\n debugger;\r\n if (ArrayExtensions.hasElements(simpleProductsData)) {\r\n const simpleProductData = simpleProductsData[0];\r\n let productUrl: string | undefined;\r\n try {\r\n productUrl = getProductUrlSync(simpleProductData, context);\r\n const canonicalDomain = context.requestContext.canonicalDomain;\r\n if (productUrl && canonicalDomain) {\r\n productUrl = `https://${canonicalDomain}${productUrl}`.toLocaleLowerCase();\r\n } else {\r\n productUrl = undefined;\r\n }\r\n } catch {\r\n productUrl = undefined;\r\n }\r\n let productBrand: string | undefined;\r\n try {\r\n productBrand = await getProductBrand(context, productId, apiSettings.channelId, input.catalogId ?? 0);\r\n } catch {\r\n productBrand = undefined;\r\n }\r\n return {\r\n title: simpleProductData.Name,\r\n description: simpleProductData.Description,\r\n sharingImageUrl: generateImageUrl(simpleProductData.PrimaryImageUrl, apiSettings),\r\n canonicalUrl: productUrl,\r\n faviconUrl: config && config.faviconUrl,\r\n productId: simpleProductData.RecordId,\r\n price: simpleProductData.AdjustedPrice,\r\n productBrand\r\n };\r\n\r\n // If the action fails fallback to values defined from config\r\n } else if (config) {\r\n return {\r\n title: config.title,\r\n description: config.description,\r\n sharingImageUrl: config.sharingImage && config.sharingImage.src,\r\n faviconUrl: config && config.faviconUrl\r\n };\r\n }\r\n return {};\r\n};\r\n\r\nexport default createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/page-summary/product-page-summary',\r\n action: >action,\r\n input: createInput\r\n});\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/get-all-articles.action';\n binding.dataActions[actionPath] = require('partner/actions/get-all-articles.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'actions/get-all-item-references.action';\n binding.dataActions[actionPath] = require('partner/actions/get-all-item-references.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'actions/get-article.action';\n binding.dataActions[actionPath] = require('partner/actions/get-article.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'actions/get-ftp-documents.action';\n binding.dataActions[actionPath] = require('partner/actions/get-ftp-documents.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'actions/get-item-references-by-model.action';\n binding.dataActions[actionPath] = require('partner/actions/get-item-references-by-model.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'actions/get-roof-table.action';\n binding.dataActions[actionPath] = require('partner/actions/get-roof-table.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'modules/lobas-article-page-summary/lobas-article-page-summary.action';\n binding.dataActions[actionPath] = require('partner/modules/lobas-article-page-summary/lobas-article-page-summary.action');\n registerActionId(actionPath);\n }\n\n { \n const actionPath = 'modules/lobas-product-page-summary/lobas-product-page-summary.action';\n binding.dataActions[actionPath] = require('partner/modules/lobas-product-page-summary/lobas-product-page-summary.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":["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","retailAction","createGetAllRoofItemReferencesInput","articleName","undefined","createGetArticleByURLInput","GetFtpDocumentsInput","ftpServerPath","documentSearchKeywords","join","Msdyn365","ctx","ftp","require","fileList","ftpConfig","host","ftpServerHost","port","ftpServerPort","user","ftpServerUser","password","ftpServerPassword","secure","client","Client","access","list","ftpServerRootPath","err","close","modelId","createGetRoofItemReferencesByModelInput","createGetRoofTableInput","compressedRefinerKeys","compressedRefinerArray","parseQueryParam","compressedRefiner","parsedRefiner","forEach","refinerKey","index","_unused","Boolean","buildListPageUrl","fullUrl","sortingColumns","skipCount","searchParams","delete","set","stringify","compressedRefiners","push","compressRefiners","href","toString","getCurrentUrl","MsDyn365","window","location","ArticlePageSummaryInput","articleId","buildCacheKey","title","getArticleByURLAsync","_article$Summary","regex","Title","description","Summary","sharingImageUrl","generateImageUrl","ThumbnailImage","canonicalUrl","faviconUrl","sharingImage","src","urlParts","Error","ProductPageSummaryInput","productId","_this$catalogId","catalogId","getCatalogId","simpleProductsData","_input$catalogId","ArrayExtensions","getByIdsAsync","channelId","simpleProductData","productUrl","productBrand","getProductUrlSync","canonicalDomain","toLocaleLowerCase","_unused2","_input$catalogId2","recordId","productAttributes","getAttributeValuesAsync","productAttribute","Name","TextValue","getProductBrand","_unused3","Description","PrimaryImageUrl","RecordId","price","AdjustedPrice","getSelectedProductIdFromActionInput","binding","modules","dataActions","registerActionId","actionPath","default","prototype","Object","keys","exportName","Action","__bindings__","packageDataActions","module","exports","React","ReactDOM"],"sourceRoot":""}