{"version":3,"file":"importer.min.js","sources":["importer.ts"],"sourcesContent":["namespace eXpress.core {\r\n\texport interface IPhotoImport {\r\n\t\tselection: IPhoto[] | null;\r\n\t\tstoreType: StoreType;\r\n\t}\r\n\r\n\texport interface IImporterDependencies {\r\n\t\treadonly contentManager: core.ContentManager;\r\n\t\treadonly storageService: services.StorageService;\r\n\t\treadonly uploadService: services.UploadService;\r\n\t\treadonly productCategory: string;\r\n\t\treadonly processSelectedPhotosAsync: (data: IPhotoImport | null) => Promise;\r\n\t}\r\n\texport class Importer {\r\n\t\tprivate readonly IMPORTFROM_CLASS: string = 'technical-importfrom';\r\n\t\tprivate readonly contentManager: core.ContentManager;\r\n\t\tprivate readonly storageService: services.StorageService;\r\n\t\tprivate readonly uploadService: services.UploadService;\r\n\t\tprivate readonly productCategory: string;\r\n\r\n\t\tprivate currentStoreType: StoreType;\r\n\t\tprivate externalPicker: eXpress.core.mediastore.ExternalPhotoPicker | undefined;\r\n\t\tprivate pickerWindow: Window | null;\r\n\r\n\t\tprivate photoStoreConnector: PhotoStoreConnector;\r\n\t\tprivate selectPhotoSourcePopup: SelectPhotoSourcePopup;\r\n\t\tprivate uploadProgressPopup: ProgressPopup;\r\n\t\tprivate uploader: Upload;\r\n\t\tpublic processSelectedPhotosAsync: (data: IPhotoImport | null) => Promise;\r\n\r\n\t\tconstructor(deps: IImporterDependencies) {\r\n\t\t\tthis.productCategory = deps.productCategory;\r\n\t\t\tthis.contentManager = deps.contentManager;\r\n\t\t\tthis.storageService = deps.storageService;\r\n\t\t\tthis.uploadService = deps.uploadService;\r\n\t\t\tthis.processSelectedPhotosAsync = deps.processSelectedPhotosAsync;\r\n\t\t}\r\n\r\n\t\tpublic async openAsync(): Promise {\r\n\t\t\tthis.photoStoreConnector = new PhotoStoreConnector({\r\n\t\t\t\tconnectedToStoreAsync: this.connectedToStoreAsync,\r\n\t\t\t\tstorageService: this.storageService,\r\n\t\t\t} as IPhotoStoreConnectorDependencies);\r\n\r\n\r\n\t\t\tthis.createUploader();\r\n\t\t\t// delete popup if it already exists\r\n\t\t\tif (this.selectPhotoSourcePopup) {\r\n\t\t\t\tthis.selectPhotoSourcePopup.delete();\r\n\t\t\t}\r\n\t\t\tthis.selectPhotoSourcePopup = await core.showLoadingDialogPromiseAsync(this.createSelectPhotoSourcePopupAsync());\r\n\r\n\t\t\tawait this.selectPhotoSourcePopup.openAsync();\r\n\t\t}\r\n\r\n\t\t// functions\r\n\t\tprivate createSelectPhotoSourcePopupAsync = async (): Promise => {\r\n\t\t\tconst stores = await this.storageService.getPhotoStoresAsync(context.pointOfSaleId, context.languageCode, false, false, true);\r\n\t\t\tconst $popup = await SelectPhotoSourcePopup.createDialogAsync(this.contentManager, stores);\r\n\r\n\t\t\treturn new SelectPhotoSourcePopup($popup, stores, this.contentManager, context, this.uploader, this.connectToStorePartnerAsync, this.popupCloseEvent);\r\n\t\t};\r\n\r\n\t\tpublic connectToStorePartnerAsync = async (store: IPhotoStore | null): Promise => {\r\n\t\t\tif (!store)\r\n\t\t\t\treturn;\r\n\r\n\t\t\t// eXpress => close the popup so we can display the login-popup\r\n\t\t\tif (store.storeType == StoreType.eXpress)\r\n\t\t\t\tthis.selectPhotoSourcePopup.close(null);\r\n\r\n\t\t\tawait this.photoStoreConnector.connectToAsync(store);\r\n\t\t};\r\n\r\n\t\tprivate connectedToStoreAsync = async (store: IPhotoStore | null): Promise => {\r\n\t\t\tif (!store || !store.isConnected)\r\n\t\t\t\treturn;\r\n\r\n\t\t\tthis.selectPhotoSourcePopup.reloadStore(store);\r\n\r\n\t\t\tif (this.currentStoreType && this.currentStoreType != store.storeType)\r\n\t\t\t\tawait this.closeConnectionAsync();\r\n\r\n\t\t\tthis.currentStoreType = store.storeType;\r\n\t\t\tif (store.storeType === StoreType.GooglePhotos && store.useExternalPhotoPicker) {\r\n\t\t\t\tawait this.openImportFromGoogleAsync(store);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tthis.selectPhotoSourcePopup.close(null);\r\n\t\t\tthis.openImportFrom(store);\r\n\t\t};\r\n\r\n\t\tprivate popupCloseEvent = () => {\r\n\t\t\t//Close the connection to the partner\r\n\t\t\tthis.closeConnectionAsync();\r\n\t\t};\r\n\r\n\t\tpublic closeConnectionAsync = async () => {\r\n\t\t\tif (this.externalPicker) {\r\n\t\t\t\tawait this.externalPicker.deleteExternalPhotoPicker();\r\n\t\t\t\tthis.externalPicker = undefined;\r\n\t\t\t}\r\n\r\n\t\t\tthis.pickerWindow && this.pickerWindow.close();\r\n\t\t\tthis.pickerWindow = null;\r\n\t\t};\r\n\r\n\t\tprivate showPopupBlockedBanner = (store: IPhotoStore) => {\r\n\t\t\tconst bannerEl = document.querySelector('.technical-mediapartner-connected-popupblocked');\r\n\t\t\tif (!bannerEl)\r\n\t\t\t\treturn;\r\n\r\n\t\t\tbannerEl.innerHTML = bannerEl.innerHTML.replace('{0}', store.name);\r\n\t\t\tbannerEl.classList.remove(\"u-hide\");\r\n\t\t};\r\n\r\n\t\tprivate openImportFromGoogleAsync = async (store: IPhotoStore) => {\r\n\t\t\t// reuse existing picker\r\n\t\t\tif (!this.externalPicker)\r\n\t\t\t\tthis.externalPicker = new eXpress.core.mediastore.ExternalPhotoPicker(this.storageService);\r\n\r\n\t\t\tawait core.showLoadingDialogPromiseAsync(this.externalPicker.createExternalPhotoPicker());\r\n\r\n\t\t\t// a window is already open? Try to close it\r\n\t\t\tif (this.pickerWindow)\r\n\t\t\t\tthis.pickerWindow.close();\r\n\r\n\t\t\t// open the picker\r\n\t\t\tthis.pickerWindow = this.externalPicker.openPicker();\r\n\t\t\tif (this.pickerWindow == null) {\r\n\t\t\t\t// We couldn't open the popup => show the banner\r\n\t\t\t\t// The customer could open the popup via the browser, so we can't stop here\r\n\t\t\t\t// and have to start polling the session\r\n\t\t\t\tthis.showPopupBlockedBanner(store);\r\n\t\t\t}\r\n\r\n\t\t\t// wait for feedback\r\n\t\t\tconst userHasSelectedPhotos = await this.externalPicker.startPickerPolling();\r\n\t\t\tif (!userHasSelectedPhotos)\r\n\t\t\t\treturn;\r\n\r\n\t\t\tconst selectPhotosAndCloseConnection = async (externalPicker: eXpress.core.mediastore.ExternalPhotoPicker): Promise => {\r\n\t\t\t\tconst photos = await externalPicker.getSelectedPhotos();\r\n\t\t\t\tawait this.closeConnectionAsync();\r\n\t\t\t\treturn photos;\r\n\t\t\t};\r\n\r\n\t\t\tconst photos = await core.showLoadingDialogPromiseAsync(selectPhotosAndCloseConnection(this.externalPicker));\r\n\t\t\tthis.selectPhotoSourcePopup.close(null); //Close the store selection-popup when the user has made his selection\r\n\r\n\t\t\tthis.processSelectedPhotosAsync && await this.processSelectedPhotosAsync({ selection: photos, storeType: StoreType.GooglePhotos } as IPhotoImport);\r\n\t\t};\r\n\r\n\t\tpublic openImportFrom = (store: core.IPhotoStore) => {\r\n\t\t\tconst renderedDialogsEl = document.getElementsByClassName('renderedDialogs');\r\n\t\t\tconst htmlEl = html.querySelector(document, 'html', true);\r\n\t\t\tconst bodyEl = html.querySelector(document, 'body', true);\r\n\r\n\t\t\thtml.addClass(htmlEl, 'has-open-dialog u-no-scroll');\r\n\t\t\thtml.addClass(bodyEl, 'u-no-scroll');\r\n\r\n\t\t\tif (!renderedDialogsEl || renderedDialogsEl.length == 0)\r\n\t\t\t\treturn;\r\n\r\n\t\t\tconst renderedDialogEl = renderedDialogsEl[0];\r\n\r\n\t\t\t// create iframe\r\n\t\t\tconst frameEl = document.createElement(\"iframe\");\r\n\t\t\tframeEl.style.height = \"100%;\";\r\n\t\t\tframeEl.style.overflow = 'hidden';\r\n\t\t\tframeEl.style.width = '100%';\r\n\t\t\tframeEl.style.height = '100vh';\r\n\t\t\tframeEl.src = store.importPhotosUrl;\r\n\r\n\t\t\t// create content-div\r\n\t\t\tconst corePopupContent = document.createElement(\"div\");\r\n\t\t\tcorePopupContent.classList.add('m-popup__content');\r\n\t\t\tcorePopupContent.style.maxWidth = 'initial';\r\n\t\t\tcorePopupContent.style.display = 'flex';\r\n\t\t\tcorePopupContent.style.maxHeight = '100vh';\r\n\t\t\tcorePopupContent.append(frameEl);\r\n\r\n\t\t\t// create container-div\r\n\t\t\tconst corePopup = document.createElement(\"div\");\r\n\t\t\tcorePopup.classList.add('m-popup');\r\n\t\t\tcorePopup.classList.add(this.IMPORTFROM_CLASS);\r\n\t\t\tcorePopup.style.display = 'flex';\r\n\t\t\tcorePopup.append(corePopupContent);\r\n\r\n\t\t\t// add listeners\r\n\t\t\twindow.addEventListener(\"message\", this.messageEvent);\r\n\t\t\tdocument.addEventListener(\"importPhotosFinished\", this.importPhotosFinishedEvent);\r\n\r\n\t\t\trenderedDialogEl.append(corePopup);\r\n\t\t};\r\n\r\n\t\tprivate importPhotosFinishedEvent = async (e) => {\r\n\t\t\tconst data = e.detail as IPhotoImport | null;\r\n\t\t\tthis.processSelectedPhotosAsync && await this.processSelectedPhotosAsync(data);\r\n\t\t\tawait this.closeImportFromAsync(data?.storeType);\r\n\t\t};\r\n\r\n\t\tprivate messageEvent = async (event) => {\r\n\t\t\tif (!event.data)\r\n\t\t\t\treturn;\r\n\r\n\t\t\tif (event.data.command === \"CloseImportPhotosPopUp\")\r\n\t\t\t\tawait this.closeImportFromAsync();\r\n\t\t};\r\n\r\n\t\tpublic closeImportFromAsync = async (storeType?: StoreType) => {\r\n\t\t\t// remove popup\r\n\t\t\tdocument.querySelectorAll('.' + this.IMPORTFROM_CLASS).forEach(importFromEl => importFromEl.remove());\r\n\r\n\t\t\tconst htmlEl = html.querySelector(document, 'html', true);\r\n\t\t\tconst bodyEl = html.querySelector(document, 'body', true);\r\n\r\n\t\t\thtml.removeClass(htmlEl, 'has-open-dialog u-no-scroll');\r\n\t\t\thtml.removeClass(bodyEl, 'u-no-scroll');\r\n\r\n\t\t\t// remove listeners\r\n\t\t\twindow.removeEventListener(\"message\", this.messageEvent);\r\n\t\t\tdocument.removeEventListener(\"importPhotosFinished\", this.importPhotosFinishedEvent);\r\n\r\n\t\t\t// close connection\r\n\t\t\tawait this.closeConnectionAsync();\r\n\t\t};\r\n\r\n\r\n\t\t// upload stuff\r\n\r\n\t\tprivate createUploader(): void {\r\n\t\t\tif (this.uploader) {\r\n\t\t\t\tthis.uploader.refresh();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconst uploadButtonId = 'uploadFromDeviceBtn';\r\n\t\t\tconst uploadSettings: eXpress.core.UploadSettings = {\r\n\t\t\t\tuploadButtonId: uploadButtonId,\r\n\t\t\t\tafterInit: () => {\r\n\t\t\t\t\tconst uploadBtn = document.getElementById(uploadButtonId);\r\n\t\t\t\t\tuploadBtn && uploadBtn.addEventListener('click', async (e) => {\r\n\t\t\t\t\t\t// close any open connection\r\n\t\t\t\t\t\tawait this.closeConnectionAsync();\r\n\t\t\t\t\t});\r\n\t\t\t\t},\r\n\t\t\t\tbeforeUploadStart: (totalFiles) => {\r\n\t\t\t\t\tthis.selectPhotoSourcePopup.makeInvisible();\r\n\r\n\t\t\t\t\tcore.showLoadingDialogAsync(ProgressPopup.createDialogAsync())\r\n\t\t\t\t\t\t.then($popup => {\r\n\t\t\t\t\t\t\tthis.uploadProgressPopup = new ProgressPopup($popup);\r\n\t\t\t\t\t\t\tthis.uploadProgressPopup.setProgressDialogContentAsync(this.contentManager, \"Label.UploadProgressDialog.Counter\", totalFiles)\r\n\t\t\t\t\t\t\t\t.then(progressPopup => {\r\n\t\t\t\t\t\t\t\t\t// only show progress if upload did not finish yet!\r\n\t\t\t\t\t\t\t\t\tif (this.uploader.isUploading()) {\r\n\t\t\t\t\t\t\t\t\t\tthis.uploadProgressPopup.openAsync();\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t});\r\n\t\t\t\t},\r\n\t\t\t\tfileUploaded: (uploadedFiles) => {\r\n\t\t\t\t\t// update upload progress\r\n\t\t\t\t\tif (this.uploadProgressPopup)\r\n\t\t\t\t\t\tthis.uploadProgressPopup.updateProgress(uploadedFiles);\r\n\t\t\t\t},\r\n\t\t\t\timportFinished: (folderId: string, importedFileIds: string[], numberOfFailedUploads: number, failedFileNames: string[]) => {\r\n\t\t\t\t\tthis.selectPhotoSourcePopup.close(null); // plupload fails if the element is removed, so only remove it after all files are uploaded\r\n\r\n\t\t\t\t\tif (this.uploadProgressPopup)\r\n\t\t\t\t\t\tthis.uploadProgressPopup.close(true);\r\n\r\n\t\t\t\t\tthis.uploader.refresh();\r\n\t\t\t\t\tif (numberOfFailedUploads > 0) {\r\n\t\t\t\t\t\tcore.showLoadingDialogAsync(this.uploader.getUploadErrorPopupAsync(this.contentManager, numberOfFailedUploads, failedFileNames))\r\n\t\t\t\t\t\t\t.then($popup => new ContentPopup($popup, true).openAsync())\r\n\t\t\t\t\t\t\t.then(() => this.getUploadedPhotosAsync(folderId, importedFileIds))\r\n\t\t\t\t\t\t\t.then(async (photos: AnyPhoto[] | undefined) => {\r\n\t\t\t\t\t\t\t\tconst photoImport = {\r\n\t\t\t\t\t\t\t\t\tselection: photos,\r\n\t\t\t\t\t\t\t\t\tstoreType: StoreType.eXpress,\r\n\t\t\t\t\t\t\t\t} as IPhotoImport;\r\n\t\t\t\t\t\t\t\tthis.processSelectedPhotosAsync && await this.processSelectedPhotosAsync(photoImport);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tthis.getUploadedPhotosAsync(folderId, importedFileIds)\r\n\t\t\t\t\t\t\t.then(async (photos: AnyPhoto[] | undefined) => {\r\n\t\t\t\t\t\t\t\tconst photoImport = {\r\n\t\t\t\t\t\t\t\t\tselection: photos,\r\n\t\t\t\t\t\t\t\t\tstoreType: StoreType.eXpress,\r\n\t\t\t\t\t\t\t\t} as IPhotoImport;\r\n\t\t\t\t\t\t\t\tthis.processSelectedPhotosAsync && await this.processSelectedPhotosAsync(photoImport);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\tcreateUploadSessionAsync: (runtime) => {\r\n\t\t\t\t\treturn this.getUploadFolderAsync().then(folder => {\r\n\t\t\t\t\t\tif (!folder.id) throw new Error(\"Upload folder needs to have an id.\");\r\n\r\n\t\t\t\t\t\tthis.uploader.setFolderId(folder.id);\r\n\t\t\t\t\t\treturn this.uploadService.setToken().then(_ => {\r\n\t\t\t\t\t\t\treturn this.uploadService.createUploadSessionAsync(context.pointOfSaleId, GetCookie(\"accid\"), folder.id!, \"prints\", runtime);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t\tthis.uploader = new Upload(uploadSettings, context, this.uploadService, \"prints\");\r\n\t\t}\r\n\r\n\t\tprivate getUploadedPhotosAsync = async (folderId: string, fileIds: string[]): Promise => {\r\n\t\t\tif (!fileIds || !fileIds.length)\r\n\t\t\t\treturn undefined;\r\n\r\n\t\t\treturn await this.storageService.getPhotosAsync(context.pointOfSaleId, GetCookie(\"accid\"), folderId, fileIds);\r\n\t\t};\r\n\r\n\t\tprivate getUploadFolderAsync(): Promise {\r\n\t\t\treturn this.uploadService.setToken().then(_ => {\r\n\t\t\t\treturn this.uploadService.getUploadFolderForProductCategoryAsync(GetCookie(\"accid\"), this.productCategory);\r\n\t\t\t});\r\n\r\n\t\t}\r\n\t}\r\n}\r\n"],"names":["eXpress","core","Importer","deps","_this","this","IMPORTFROM_CLASS","createSelectPhotoSourcePopupAsync","__awaiter","storageService","getPhotoStoresAsync","context","pointOfSaleId","languageCode","stores","_a","sent","SelectPhotoSourcePopup","createDialogAsync","contentManager","$popup","uploader","connectToStorePartnerAsync","popupCloseEvent","store","storeType","StoreType","selectPhotoSourcePopup","close","photoStoreConnector","connectToAsync","connectedToStoreAsync","isConnected","reloadStore","currentStoreType","closeConnectionAsync","GooglePhotos","useExternalPhotoPicker","openImportFromGoogleAsync","openImportFrom","externalPicker","deleteExternalPhotoPicker","undefined","pickerWindow","showPopupBlockedBanner","bannerEl","document","querySelector","innerHTML","replace","name","classList","remove","mediastore","ExternalPhotoPicker","showLoadingDialogPromiseAsync","createExternalPhotoPicker","_b","openPicker","startPickerPolling","selectPhotosAndCloseConnection","getSelectedPhotos","photos","processSelectedPhotosAsync","selection","renderedDialogsEl","getElementsByClassName","htmlEl","html","bodyEl","addClass","length","renderedDialogEl","frameEl","createElement","style","height","overflow","width","src","importPhotosUrl","corePopupContent","add","maxWidth","display","maxHeight","append","corePopup","window","addEventListener","messageEvent","importPhotosFinishedEvent","e","data","detail","closeImportFromAsync","event","command","querySelectorAll","forEach","importFromEl","removeClass","removeEventListener","getUploadedPhotosAsync","folderId","fileIds","getPhotosAsync","GetCookie","productCategory","uploadService","prototype","openAsync","PhotoStoreConnector","createUploader","delete","refresh","uploadSettings","uploadButtonId","afterInit","uploadBtn","getElementById","beforeUploadStart","totalFiles","makeInvisible","showLoadingDialogAsync","ProgressPopup","then","uploadProgressPopup","setProgressDialogContentAsync","progressPopup","isUploading","fileUploaded","uploadedFiles","updateProgress","importFinished","importedFileIds","numberOfFailedUploads","failedFileNames","getUploadErrorPopupAsync","ContentPopup","photoImport","createUploadSessionAsync","runtime","getUploadFolderAsync","folder","id","Error","setFolderId","setToken","_","Upload","getUploadFolderForProductCategoryAsync"],"mappings":"IAAUA,8sDAAV,SAAUA,SAAQ,IAAAC,KAajBC,SAbiBD,KAAAD,QAAIC,OAAJD,aAuUjB,CAAA,GA1TAE,SAAA,WAiBC,SAAAA,SAAYC,MAAZ,IAMCC,MAAAC,KAtBgBA,KAAgBC,iBAAW,uBA0CpCD,KAAAE,kCAAoC,WAAA,OAAAC,UAAAJ,WAAA,OAAA,GAAA,2FAC5B,MAAM,CAAA,EAAAC,KAAKI,eAAeC,oBAAoBT,KAAAU,QAAQC,cAAeX,KAAAU,QAAQE,cAAc,GAAO,GAAO,WACzG,OADTC,OAASC,GAA8GC,OACxG,CAAA,EAAAf,KAAAgB,uBAAuBC,kBAAkBb,KAAKc,eAAgBL,gBAEnF,OAFMM,OAASL,GA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