{"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\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.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);\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\tconst connectedStore = await PhotoStoreConnector.connectToAsync(store, this.storageService);\r\n\t\t\tif (!connectedStore || !connectedStore.isConnected)\r\n\t\t\t\treturn;\r\n\r\n\t\t\tthis.selectPhotoSourcePopup.reloadStore(connectedStore);\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\r\n\t\t\tif (connectedStore.storeType === StoreType.GooglePhotos && connectedStore.useExternalPhotoPicker) {\r\n\t\t\t\tawait this.openImportFromGoogleAsync(connectedStore);\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(connectedStore);\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\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// open the picker\r\n\t\t\tconst popupWindow = this.externalPicker.openPicker();\r\n\t\t\tif (popupWindow == 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\r\n\t\t\tif (userHasSelectedPhotos) {\r\n\t\t\t\tconst selectPhotosAndCloseConnection = async (externalPicker: eXpress.core.mediastore.ExternalPhotoPicker): Promise => {\r\n\t\t\t\t\tconst photos = await externalPicker.getSelectedPhotos();\r\n\t\t\t\t\tawait this.closeConnectionAsync();\r\n\t\t\t\t\treturn photos;\r\n\t\t\t\t};\r\n\r\n\t\t\t\tconst photos = await core.showLoadingDialogPromiseAsync(selectPhotosAndCloseConnection(this.externalPicker));\r\n\t\t\t\tthis.selectPhotoSourcePopup.close(null); //Close the store selection-popup when the user has made his selection\r\n\r\n\t\t\t\tthis.processSelectedPhotosAsync && await this.processSelectedPhotosAsync({ selection: photos, storeType: StoreType.GooglePhotos } as IPhotoImport);\r\n\t\t\t}\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\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\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\r\n\t\t\t\t\t\treturn this.uploadService.createUploadSessionAsync(context.pointOfSaleId, GetCookie(\"accid\"), folder.id, \"prints\", runtime);\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(): JQueryPromise {\r\n\t\t\treturn this.uploadService.getUploadFolderForProductCategoryAsync(GetCookie(\"accid\"), this.productCategory);\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","store","storeType","StoreType","selectPhotoSourcePopup","close","PhotoStoreConnector","connectToAsync","connectedStore","isConnected","reloadStore","currentStoreType","closeConnectionAsync","GooglePhotos","useExternalPhotoPicker","openImportFromGoogleAsync","openImportFrom","externalPicker","deleteExternalPhotoPicker","undefined","showPopupBlockedBanner","bannerEl","document","querySelector","innerHTML","replace","name","classList","remove","mediastore","ExternalPhotoPicker","showLoadingDialogPromiseAsync","createExternalPhotoPicker","_b","openPicker","startPickerPolling","selectPhotosAndCloseConnection","getSelectedPhotos","photos","processSelectedPhotosAsync","selection","renderedDialogsEl","getElementsByClassName","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","removeEventListener","getUploadedPhotosAsync","folderId","fileIds","getPhotosAsync","GetCookie","productCategory","uploadService","prototype","openAsync","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","Upload","getUploadFolderForProductCategoryAsync"],"mappings":"IAAUA,8sDAAV,SAAUA,SAAQ,IAAAC,KAajBC,SAbiBD,KAAAD,QAAIC,OAAJD,aAiSjB,CAAA,GApRAE,SAAA,WAeC,SAAAA,SAAYC,MAAZ,IAMCC,MAAAC,KApBgBA,KAAgBC,iBAAW,uBAkCpCD,KAAAE,kCAAoC,WAAA,OAAAC,UAAAJ,WAAA,OAAA,GAAA,2FAC5B,MAAM,CA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