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A,EAAMC,8oBCXnB,MAAMiD,EAAU,CAAEC,QAAS,GAAIC,YAAa,IAwCvCF,EAAQC,QAAQ,uBAAyB,CACtCE,EAAGA,IAAM/E,EAAQ,MACjBgF,MAAO,gBACPC,GAAI,CAAC,CAAC3C,KAAK,YAAc4C,KAAK,mCAAoCC,MAAO,IAEzEC,KAAK,EACLC,GAAI,YACJC,EAAG,sBACHC,EAAG,YAEHC,IAAK,GAGLC,GAAI,mCAlC4BC,EAACC,EAAqBC,KAUlD,GADAhB,EAAQE,YAAYa,GAAuBC,GACtChB,EAAQE,YAAYa,GAAqBE,QAC1C,MAAM,IAAIC,MAAM,oBAAsBH,EAAsB,mCAEhEf,EAAQE,YAAYa,GAAqBE,QAAQE,UAAUC,eAAiBL,EACxEf,EAAQE,YAAYa,GAAqBE,QAAQE,UAAU5E,KAC3DyD,EAAQE,YAAYF,EAAQE,YAAYa,GAAqBE,QAAQE,UAAU5E,IAAMwE,IA0BzFD,CAF4B,mCACX1F,EAAQ,MAMjCiG,OAAOC,aAAeD,OAAOC,cAAgB,GAC7CD,OAAOC,aAAarB,QAAOpD,EAAAA,EAAA,GACpBwE,OAAOC,aAAarB,SAAW,IAC/BD,EAAQC,SAGXoB,OAAOC,aAAapB,YAAWrD,EAAAA,EAAA,GAC5BwE,OAAOC,aAAapB,aAAe,IACnCF,EAAQE,aAEY,MAAMqB,EAAiB,GAC9BA,EAAe,uEAAyE,CAChGpB,EAAGA,IAAM/E,EAAQ,MACjBoG,GAAI,2CAEpBH,OAAOC,aAAeD,OAAOC,cAAgB,GAC7CD,OAAOC,aAAaC,eAAc1E,EAAAA,EAAA,GACPwE,OAAOC,aAAaC,gBAAkB,IACtCA,uBCnF3BE,EAAOC,QAAUhF,2BCAjB+E,EAAOC,QAAUC","sources":["webpack://Msdyn365.Commerce.Online/./src/actions/get-ftp-documents.action.ts?9fac","webpack://Msdyn365.Commerce.Online/./src/modules/lobas-document-list/lobas-document-list.tsx?2c75","webpack://Msdyn365.Commerce.Online/./src/modules/lobas-document-list/lobas-document-list.view.tsx?4454","webpack://Msdyn365.Commerce.Online/./lib/lobas-document-list/module-registration.js?28de","webpack://Msdyn365.Commerce.Online/external var \"React\"?0d3b","webpack://Msdyn365.Commerce.Online/external var \"ReactDOM\"?853b"],"sourcesContent":["/* 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\nimport * as React from 'react';\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\nimport { ILobasDocumentListData } from './lobas-document-list.data';\r\nimport { ILobasDocumentListProps } from './lobas-document-list.props.autogenerated';\r\nimport { ILobasLinkProps } from '../components/lobas-table';\r\nimport {\r\n getPayloadObject,\r\n getTelemetryAttributes,\r\n ITelemetryContent,\r\n onTelemetryClick,\r\n getTelemetryObject\r\n} from '@msdyn365-commerce-modules/utilities';\r\nimport { IGetFtpDocumentsData } from '../../actions/get-ftp-documents.action';\r\nimport { ArrayExtensions } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nexport interface ILobasDocumentListViewProps extends ILobasDocumentListProps {\r\n lobasDocumentListContainer?: React.ReactNode;\r\n className?: string;\r\n}\r\n\r\n/**\r\n *\r\n * LobasDocumentList component\r\n * @extends {React.PureComponent>}\r\n */\r\nclass LobasDocumentList extends React.PureComponent> {\r\n public render(): JSX.Element | null {\r\n const viewProps = {\r\n ...this.props,\r\n lobasDocumentListContainer: this._createLinkContainer(this.props.data.documents.result),\r\n className: this.props.config.className\r\n } as ILobasDocumentListViewProps;\r\n\r\n return this.props.renderView(viewProps);\r\n }\r\n\r\n private _createLinkContainer(documents: IGetFtpDocumentsData[] | undefined): JSX.Element | null {\r\n const links =\r\n documents &&\r\n documents\r\n .filter(\r\n document =>\r\n document.name !== '.' &&\r\n document.name !== '..' &&\r\n ((ArrayExtensions.hasElements(this.props.config.documentSearchKeywords) &&\r\n this.props.config.documentSearchKeywords?.filter(keyword => document.name.startsWith(keyword)).length > 0) ||\r\n !ArrayExtensions.hasElements(this.props.config.documentSearchKeywords))\r\n )\r\n .map((document, index) => {\r\n const link = this._createLink(document);\r\n return link;\r\n });\r\n\r\n return
{links}
;\r\n }\r\n\r\n private _createLink(content: IGetFtpDocumentsData): JSX.Element | null {\r\n const baseUrl = `https://lob.as/${this.props.config.ftpServerPath}`;\r\n\r\n const link: ILobasLinkProps = {\r\n linkUrl: `${baseUrl}/${content.name}`,\r\n linkText: content.name,\r\n linkType: '',\r\n disabled: false\r\n };\r\n\r\n // Construct telemetry attribute to render\r\n const payLoad = getPayloadObject('click', getTelemetryContent(this.props), '', '');\r\n const linkText = link.linkText ? link.linkText : '';\r\n payLoad.contentAction.etext = linkText;\r\n const attributes = getTelemetryAttributes(getTelemetryContent(this.props), payLoad);\r\n const btnClass = 'lobas-link-btn__primary';\r\n\r\n const editableLink: Msdyn365.ILinksData = {\r\n ariaLabel: '',\r\n className: btnClass,\r\n linkText: link.linkText,\r\n linkUrl: link.linkUrl,\r\n openInNewTab: true,\r\n role: 'link',\r\n additionalProperties: attributes,\r\n onClick: onTelemetryClick(getTelemetryContent(this.props), payLoad, linkText)\r\n };\r\n\r\n return (\r\n
\r\n \r\n
\r\n );\r\n }\r\n}\r\n\r\nexport function getTelemetryContent(props: ILobasDocumentListProps): ITelemetryContent {\r\n return getTelemetryObject(props.context.request.telemetryPageName!, props.friendlyName, props.telemetry);\r\n}\r\n\r\nexport default LobasDocumentList;\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 { ILobasDocumentListViewProps } from './lobas-document-list';\r\n\r\nexport default (props: ILobasDocumentListViewProps) => {\r\n return (\r\n
\r\n {props.lobasDocumentListContainer}\r\n
\r\n );\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 (binding.modules['lobas-document-list'] = {\n c: () => require('partner/modules/lobas-document-list/lobas-document-list.tsx'),\n $type: 'contentModule',\n da: [{name:'documents', path:'actions/get-ftp-documents.action', runOn: 0}],\n \n iNM: false,\n ns: '__local__',\n n: 'lobas-document-list',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/lobas-document-list'\n });\n \n\n {\n const sanitizedActionPath = 'actions/get-ftp-documents.action';\n let dataAction = require('partner/actions/get-ftp-documents.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 };\n export const viewDictionary = {};\n viewDictionary['__local__|__local__|modules|lobas-document-list|lobas-document-list'] = {\n c: () => require('partner/modules/lobas-document-list/lobas-document-list.view.tsx'),\n cn: '__local__-__local__-lobas-document-list'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\n };","module.exports = React;","module.exports = ReactDOM;"],"names":["GetFtpDocumentsInput","constructor","config","getCacheKey","this","ftpServerPath","documentSearchKeywords","join","getCacheObjectType","dataCacheType","Msdyn365","action","async","input","ctx","ftp","require","fileList","ftpConfig","host","ftpServerHost","port","ftpServerPort","user","ftpServerUser","password","ftpServerPassword","secure","client","Client","access","list","ftpServerRootPath","err","close","id","args","LobasDocumentList","React","render","viewProps","_objectSpread","props","lobasDocumentListContainer","_createLinkContainer","data","documents","result","className","renderView","links","filter","document","_this$props$config$do","name","ArrayExtensions","keyword","startsWith","length","map","index","_createLink","content","link","linkUrl","linkText","linkType","disabled","payLoad","getPayloadObject","getTelemetryContent","contentAction","etext","attributes","getTelemetryAttributes","editableLink","ariaLabel","openInNewTab","role","additionalProperties","onClick","onTelemetryClick","key","getTelemetryObject","context","request","telemetryPageName","friendlyName","telemetry","Object","assign","renderModuleAttributes","binding","modules","dataActions","c","$type","da","path","runOn","iNM","ns","n","p","pdp","md","registerSanitizedActionPath","sanitizedActionPath","dataAction","default","Error","prototype","RegistrationId","window","__bindings__","viewDictionary","cn","module","exports","ReactDOM"],"sourceRoot":""}