@ezeep/ezeep-js 1.0.316 → 1.0.323
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ezeep.cjs.js +1 -1
- package/dist/cjs/ezp-auth_16.cjs.entry.js +137 -16
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ezp-auth/ezp-auth.js +99 -10
- package/dist/collection/components/ezp-user-menu/ezp-user-menu.css +7 -0
- package/dist/collection/services/auth.js +21 -0
- package/dist/collection/services/print-job.js +14 -2
- package/dist/components/auth.js +1 -1
- package/dist/components/ezp-auth2.js +1 -1
- package/dist/components/ezp-printer-selection2.js +1 -1
- package/dist/components/ezp-user-menu2.js +1 -1
- package/dist/components/utils.js +1 -1
- package/dist/esm/ezeep.js +1 -1
- package/dist/esm/ezp-auth_16.entry.js +137 -16
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/ezeep.js +1 -1
- package/dist/esm-es5/ezp-auth_16.entry.js +2 -2
- package/dist/esm-es5/loader.js +1 -1
- package/dist/ezeep/ezeep.esm.js +1 -1
- package/dist/ezeep/{p-f348cbab.system.entry.js → p-5a755dc7.system.entry.js} +2 -2
- package/dist/ezeep/p-DCznw2Ee.system.js +1 -1
- package/dist/ezeep/p-f567a8c5.entry.js +1 -0
- package/dist/types/components/ezp-auth/ezp-auth.d.ts +34 -0
- package/dist/types/services/auth.d.ts +13 -1
- package/package.json +3 -2
- package/www/build/ezeep.esm.js +1 -1
- package/www/build/p-570b689d.js +1 -0
- package/www/build/{p-f348cbab.system.entry.js → p-5a755dc7.system.entry.js} +2 -2
- package/www/build/p-DCznw2Ee.system.js +1 -1
- package/www/build/p-f567a8c5.entry.js +1 -0
- package/www/data/locales/de.json +2 -2
- package/www/data/locales/en.json +2 -2
- package/www/index.html +1 -1
- package/dist/ezeep/p-98a77798.entry.js +0 -1
- package/www/build/p-4f218598.js +0 -1
- package/www/build/p-98a77798.entry.js +0 -1
package/dist/cjs/ezeep.cjs.js
CHANGED
|
@@ -46,7 +46,7 @@ var patchCloneNodeFix = (HTMLElementPrototype) => {
|
|
|
46
46
|
|
|
47
47
|
patchBrowser().then(async (options) => {
|
|
48
48
|
await appGlobals.globalScripts();
|
|
49
|
-
return index.bootstrapLazy([["ezp-auth_16.cjs",[[257,"ezp-printing",{"clientid":[1],"redirecturi":[1],"filename":[1025],"fileurl":[1],"filetype":[1],"custom":[4],"hidelogin":[4],"hidemenu":[4],"hideheader":[4],"authapihosturl":[1],"printapihosturl":[1],"theme":[1],"fileid":[1],"appearance":[1],"trigger":[1],"language":[1],"code":[1],"filedata":[1],"seamless":[4],"printOpen":[32],"authOpen":[32],"onlyGetSasUri":[32],"noDocumentOpen":[32],"systemAppearance":[32],"files":[32],"open":[64],"logOut":[64],"getSasUri":[64],"getAuthUri":[64],"setAuthRefreshToken":[64],"checkAuth":[64]},[[0,"printCancel","listenPrintCancel"],[0,"printDismiss","listenPrintDismiss"],[0,"printSubmit","listenPrintSubmit"],[0,"authCancel","listenAuthCancel"],[0,"userCancel","listenUserCancel"],[0,"authSuccess","listenAuthSuccess"],[0,"uploadFile","listenUploadFile"],[0,"uploadContinue","listenUploadContinue"],[0,"dialogClose","listenDialogClose"],[0,"dialogAction","listenDialogAction"],[0,"logout","listenLogout"]],{"filedata":[{"watchFileData":0}],"filename":[{"watchFilename":0}],"fileurl":[{"watchFileUrl":0}],"language":[{"watchLanguage":0}]}],[1,"ezp-printer-selection",{"clientID":[1,"client-i-d"],"redirectURI":[1,"redirect-u-r-i"],"filename":[1025],"fileurl":[1],"filetype":[1025],"fileid":[1025],"files":[16],"hidemenu":[4],"hideheader":[4],"seamless":[4],"loading":[32],"printProcessing":[32],"pageRangeInvalid":[32],"uploading":[32],"preparingUpload":[32],"printSuccess":[32],"printFailed":[32],"printTimedOut":[32],"notSupported":[32],"noPrinters":[32],"hubDriverError":[32],"userMenuOpen":[32],"printStopped":[32],"firstVisibleFile":[32],"userName":[32],"printers":[32],"selectedPrinter":[32],"printerConfig":[32],"selectedPrinterConfig":[32],"selectedProperties":[32],"loadingPrinterConfig":[32],"paperid":[32],"currentFileIndex":[32],"totalFiles":[32],"failedFiles":[32],"successfulFiles":[32],"partialSuccess":[32]},[[0,"inputValueChanged","listenInputValueChanged"],[0,"selectSelection","listenSelectSelection"],[0,"stepperChanged","listenStepperChanged"],[0,"userMenuClosure","listenUserMenuClosure"],[0,"logoutEmitter","listenLogout"],[0,"statusCancel","listenStatusCancel"],[0,"statusClose","listenStatusClose"],[0,"statusRetry","listenStatusRetry"]]],[1,"ezp-auth",{"clientID":[1025,"client-i-d"],"redirectURI":[1025,"redirect-u-r-i"],"hidelogin":[4],"trigger":[1],"code":[1],"auth":[32],"authURI":[32],"accessToken":[32],"isPopupBlocked":[32]},[[0,"dialogAction","listenDialogAction"],[0,"dialogClose","listenDialogClose"],[0,"statusCancel","listenStatusCancel"]]],[1,"ezp-upload",{"selectedFiles":[32],"dragging":[32],"firstVisibleFile":[32]},[[0,"dragenter","handleDragEnter"],[0,"dragover","handleDragOver"],[1,"dragleave","handleDragLeave"],[0,"drop","handleDrop"],[9,"drop","resetDrag"],[9,"dragend","resetDrag"],[4,"printCancel","listenPrintCancel"]]],[1,"ezp-dialog",{"heading":[1],"description":[1],"action":[1],"iconName":[1,"icon-name"],"iconSize":[1,"icon-size"],"iconFramed":[4,"icon-framed"],"instance":[1]},[[8,"keydown","handleKeydown"]]],[1,"ezp-user-menu",{"name":[1],"open":[1028]},null,{"open":[{"watchOpen":0}]}],[1,"ezp-select",{"icon":[1],"label":[1],"optionFlow":[1,"option-flow"],"options":[16],"placeholder":[1],"preSelected":[8,"pre-selected"],"toggleFlow":[1,"toggle-flow"],"disabled":[4],"expanded":[32],"selected":[32]},null,{"expanded":[{"watchExpanded":0}],"preSelected":[{"preSelectedChanged":0}]}],[1,"ezp-input",{"label":[1],"value":[1032],"type":[1],"icon":[1],"suffix":[513],"eventType":[1,"event-type"],"placeholder":[1],"focused":[32]}],[1,"ezp-stepper",{"icon":[1],"label":[1],"max":[2],"min":[2],"canDecrease":[32],"canIncrease":[32],"focused":[32],"value":[32]},null,{"value":[{"watchValue":0}]}],[1,"ezp-status",{"description":[1],"subtext":[1],"processing":[4],"instance":[1],"icon":[1],"cancel":[8],"close":[8],"retry":[8]}],[1,"ezp-file-name",{"name":[1],"level":[1],"weight":[1],"placement":[1],"anchor":[1],"expanded":[32],"tooltipOpen":[32]},[[10,"keydown","handleKeyDown"]],{"tooltipOpen":[{"watchTooltipOpen":0}]}],[1,"ezp-backdrop",{"visible":[1028]},[[0,"animationend","listenAnimationEnd"]]],[1,"ezp-icon-button",{"blank":[4],"disabled":[4],"href":[1],"icon":[1],"level":[1],"type":[1]}],[1,"ezp-text-button",{"blank":[4],"disabled":[4],"href":[1],"level":[1],"label":[1],"type":[1],"small":[4]}],[1,"ezp-icon",{"name":[1],"size":[1],"framed":[4]}],[1,"ezp-label",{"ellipsis":[4],"level":[1],"noWrap":[4,"no-wrap"],"text":[1],"weight":[1],"isTruncated":[64]}]]]], options);
|
|
49
|
+
return index.bootstrapLazy([["ezp-auth_16.cjs",[[257,"ezp-printing",{"clientid":[1],"redirecturi":[1],"filename":[1025],"fileurl":[1],"filetype":[1],"custom":[4],"hidelogin":[4],"hidemenu":[4],"hideheader":[4],"authapihosturl":[1],"printapihosturl":[1],"theme":[1],"fileid":[1],"appearance":[1],"trigger":[1],"language":[1],"code":[1],"filedata":[1],"seamless":[4],"printOpen":[32],"authOpen":[32],"onlyGetSasUri":[32],"noDocumentOpen":[32],"systemAppearance":[32],"files":[32],"open":[64],"logOut":[64],"getSasUri":[64],"getAuthUri":[64],"setAuthRefreshToken":[64],"checkAuth":[64]},[[0,"printCancel","listenPrintCancel"],[0,"printDismiss","listenPrintDismiss"],[0,"printSubmit","listenPrintSubmit"],[0,"authCancel","listenAuthCancel"],[0,"userCancel","listenUserCancel"],[0,"authSuccess","listenAuthSuccess"],[0,"uploadFile","listenUploadFile"],[0,"uploadContinue","listenUploadContinue"],[0,"dialogClose","listenDialogClose"],[0,"dialogAction","listenDialogAction"],[0,"logout","listenLogout"]],{"filedata":[{"watchFileData":0}],"filename":[{"watchFilename":0}],"fileurl":[{"watchFileUrl":0}],"language":[{"watchLanguage":0}]}],[1,"ezp-printer-selection",{"clientID":[1,"client-i-d"],"redirectURI":[1,"redirect-u-r-i"],"filename":[1025],"fileurl":[1],"filetype":[1025],"fileid":[1025],"files":[16],"hidemenu":[4],"hideheader":[4],"seamless":[4],"loading":[32],"printProcessing":[32],"pageRangeInvalid":[32],"uploading":[32],"preparingUpload":[32],"printSuccess":[32],"printFailed":[32],"printTimedOut":[32],"notSupported":[32],"noPrinters":[32],"hubDriverError":[32],"userMenuOpen":[32],"printStopped":[32],"firstVisibleFile":[32],"userName":[32],"printers":[32],"selectedPrinter":[32],"printerConfig":[32],"selectedPrinterConfig":[32],"selectedProperties":[32],"loadingPrinterConfig":[32],"paperid":[32],"currentFileIndex":[32],"totalFiles":[32],"failedFiles":[32],"successfulFiles":[32],"partialSuccess":[32]},[[0,"inputValueChanged","listenInputValueChanged"],[0,"selectSelection","listenSelectSelection"],[0,"stepperChanged","listenStepperChanged"],[0,"userMenuClosure","listenUserMenuClosure"],[0,"logoutEmitter","listenLogout"],[0,"statusCancel","listenStatusCancel"],[0,"statusClose","listenStatusClose"],[0,"statusRetry","listenStatusRetry"]]],[1,"ezp-auth",{"clientID":[1025,"client-i-d"],"redirectURI":[1025,"redirect-u-r-i"],"hidelogin":[4],"trigger":[1],"code":[1],"auth":[32],"authURI":[32],"accessToken":[32],"isPopupBlocked":[32],"codeExchangePending":[32]},[[0,"dialogAction","listenDialogAction"],[0,"dialogClose","listenDialogClose"],[0,"statusCancel","listenStatusCancel"]]],[1,"ezp-upload",{"selectedFiles":[32],"dragging":[32],"firstVisibleFile":[32]},[[0,"dragenter","handleDragEnter"],[0,"dragover","handleDragOver"],[1,"dragleave","handleDragLeave"],[0,"drop","handleDrop"],[9,"drop","resetDrag"],[9,"dragend","resetDrag"],[4,"printCancel","listenPrintCancel"]]],[1,"ezp-dialog",{"heading":[1],"description":[1],"action":[1],"iconName":[1,"icon-name"],"iconSize":[1,"icon-size"],"iconFramed":[4,"icon-framed"],"instance":[1]},[[8,"keydown","handleKeydown"]]],[1,"ezp-user-menu",{"name":[1],"open":[1028]},null,{"open":[{"watchOpen":0}]}],[1,"ezp-select",{"icon":[1],"label":[1],"optionFlow":[1,"option-flow"],"options":[16],"placeholder":[1],"preSelected":[8,"pre-selected"],"toggleFlow":[1,"toggle-flow"],"disabled":[4],"expanded":[32],"selected":[32]},null,{"expanded":[{"watchExpanded":0}],"preSelected":[{"preSelectedChanged":0}]}],[1,"ezp-input",{"label":[1],"value":[1032],"type":[1],"icon":[1],"suffix":[513],"eventType":[1,"event-type"],"placeholder":[1],"focused":[32]}],[1,"ezp-stepper",{"icon":[1],"label":[1],"max":[2],"min":[2],"canDecrease":[32],"canIncrease":[32],"focused":[32],"value":[32]},null,{"value":[{"watchValue":0}]}],[1,"ezp-status",{"description":[1],"subtext":[1],"processing":[4],"instance":[1],"icon":[1],"cancel":[8],"close":[8],"retry":[8]}],[1,"ezp-file-name",{"name":[1],"level":[1],"weight":[1],"placement":[1],"anchor":[1],"expanded":[32],"tooltipOpen":[32]},[[10,"keydown","handleKeyDown"]],{"tooltipOpen":[{"watchTooltipOpen":0}]}],[1,"ezp-backdrop",{"visible":[1028]},[[0,"animationend","listenAnimationEnd"]]],[1,"ezp-icon-button",{"blank":[4],"disabled":[4],"href":[1],"icon":[1],"level":[1],"type":[1]}],[1,"ezp-text-button",{"blank":[4],"disabled":[4],"href":[1],"level":[1],"label":[1],"type":[1],"small":[4]}],[1,"ezp-icon",{"name":[1],"size":[1],"framed":[4]}],[1,"ezp-label",{"ellipsis":[4],"level":[1],"noWrap":[4,"no-wrap"],"text":[1],"weight":[1],"isTruncated":[64]}]]]], options);
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
exports.setNonce = index.setNonce;
|
|
@@ -2520,8 +2520,8 @@ const login_dialog$1 = {
|
|
|
2520
2520
|
action: "Anmelden"
|
|
2521
2521
|
};
|
|
2522
2522
|
const popup_blocked_dialog$1 = {
|
|
2523
|
-
heading: "Anmeldefenster wurde
|
|
2524
|
-
description: "
|
|
2523
|
+
heading: "Anmeldefenster wurde nicht geöffnet",
|
|
2524
|
+
description: "Tippe auf Erneut versuchen, um fortzufahren. Falls es weiterhin nicht funktioniert, erlaube Pop-ups für diese Website in den Browser-Einstellungen.",
|
|
2525
2525
|
action: "Erneut versuchen"
|
|
2526
2526
|
};
|
|
2527
2527
|
const no_document_dialog$1 = {
|
|
@@ -2617,8 +2617,8 @@ const login_dialog = {
|
|
|
2617
2617
|
action: "Sign in"
|
|
2618
2618
|
};
|
|
2619
2619
|
const popup_blocked_dialog = {
|
|
2620
|
-
heading: "Sign-in window
|
|
2621
|
-
description: "
|
|
2620
|
+
heading: "Sign-in window didn't open",
|
|
2621
|
+
description: "Tap Try again to continue. If it still doesn't work, allow pop-ups for this site in your browser settings.",
|
|
2622
2622
|
action: "Try again"
|
|
2623
2623
|
};
|
|
2624
2624
|
const no_document_dialog = {
|
|
@@ -3076,6 +3076,16 @@ class EzpAuthorizationService {
|
|
|
3076
3076
|
authStore.state.isAuthorized = true;
|
|
3077
3077
|
storage.setIsAuthorized(true);
|
|
3078
3078
|
}
|
|
3079
|
+
/**
|
|
3080
|
+
* Exchange the authorization code for tokens. Three outcomes, which callers
|
|
3081
|
+
* must be able to tell apart:
|
|
3082
|
+
*
|
|
3083
|
+
* - resolves `true`: tokens were issued and stored;
|
|
3084
|
+
* - resolves `false`: the endpoint refused *the code* (`invalid_grant` —
|
|
3085
|
+
* expired, already used, wrong verifier). Trying again cannot help;
|
|
3086
|
+
* - rejects: nothing is known about the code — the request never completed,
|
|
3087
|
+
* or the endpoint answered with any other error. Trying again may work.
|
|
3088
|
+
*/
|
|
3079
3089
|
getAccessToken() {
|
|
3080
3090
|
return fetch(this.accessTokenURL, {
|
|
3081
3091
|
credentials: 'include',
|
|
@@ -3091,9 +3101,18 @@ class EzpAuthorizationService {
|
|
|
3091
3101
|
})
|
|
3092
3102
|
.then((response) => response.json())
|
|
3093
3103
|
.then((data) => {
|
|
3104
|
+
var _a;
|
|
3094
3105
|
if (data.access_token) {
|
|
3095
3106
|
this.persistTokens(data.access_token, data.refresh_token);
|
|
3107
|
+
// Remember which code produced this session: it is spent now.
|
|
3108
|
+
authStore.state.exchangedCode = authStore.state.code;
|
|
3109
|
+
return true;
|
|
3096
3110
|
}
|
|
3111
|
+
if (data.error === 'invalid_grant')
|
|
3112
|
+
return false;
|
|
3113
|
+
// Only the endpoint's own error code is quoted — never the code,
|
|
3114
|
+
// verifier or anything else from the request.
|
|
3115
|
+
throw new Error(`Token endpoint error: ${(_a = data.error) !== null && _a !== void 0 ? _a : 'unexpected response'}`);
|
|
3097
3116
|
});
|
|
3098
3117
|
}
|
|
3099
3118
|
refreshTokens() {
|
|
@@ -3130,6 +3149,8 @@ class EzpAuthorizationService {
|
|
|
3130
3149
|
}
|
|
3131
3150
|
const authStore = createStore({
|
|
3132
3151
|
code: '',
|
|
3152
|
+
/** The authorization code the current session was obtained with (in memory only). */
|
|
3153
|
+
exchangedCode: '',
|
|
3133
3154
|
codeVerifier: '',
|
|
3134
3155
|
accessToken: '',
|
|
3135
3156
|
refreshToken: '',
|
|
@@ -3164,6 +3185,13 @@ const EzpAuth = class {
|
|
|
3164
3185
|
this.popupBlocked = index.createEvent(this, "popupBlocked", 7);
|
|
3165
3186
|
/** True when the browser blocked the sign-in popup; shows the popup-blocked dialog. */
|
|
3166
3187
|
this.isPopupBlocked = false;
|
|
3188
|
+
/**
|
|
3189
|
+
* True while a host-supplied `code` is still waiting to be exchanged because
|
|
3190
|
+
* the attempt failed for a reason other than the code being refused. Until
|
|
3191
|
+
* it is settled, nothing may proceed on a stored session: the code may be
|
|
3192
|
+
* for a different account than the one stored.
|
|
3193
|
+
*/
|
|
3194
|
+
this.codeExchangePending = false;
|
|
3167
3195
|
this.oauthPopupWindow = null;
|
|
3168
3196
|
this.previousUrl = null;
|
|
3169
3197
|
// Bound once (arrow property) so add/removeEventListener share the same
|
|
@@ -3197,10 +3225,7 @@ const EzpAuth = class {
|
|
|
3197
3225
|
return;
|
|
3198
3226
|
}
|
|
3199
3227
|
authStore.state.code = event.data;
|
|
3200
|
-
this.
|
|
3201
|
-
this.authCancel.emit();
|
|
3202
|
-
this.authSuccess.emit();
|
|
3203
|
-
});
|
|
3228
|
+
this.exchangeCode();
|
|
3204
3229
|
};
|
|
3205
3230
|
}
|
|
3206
3231
|
listenDialogAction(event) {
|
|
@@ -3208,6 +3233,11 @@ const EzpAuth = class {
|
|
|
3208
3233
|
this.handleRetry();
|
|
3209
3234
|
return;
|
|
3210
3235
|
}
|
|
3236
|
+
if (this.codeExchangePending) {
|
|
3237
|
+
// "Sign in" retries the host's code first; see `exchangeHostCode`.
|
|
3238
|
+
this.retryHostCode();
|
|
3239
|
+
return;
|
|
3240
|
+
}
|
|
3211
3241
|
this.openSignInWindow(this.auth.authURI.toString(), 'ezeep Login');
|
|
3212
3242
|
}
|
|
3213
3243
|
listenDialogClose(event) {
|
|
@@ -3220,6 +3250,11 @@ const EzpAuth = class {
|
|
|
3220
3250
|
return;
|
|
3221
3251
|
}
|
|
3222
3252
|
}
|
|
3253
|
+
if (this.codeExchangePending && this.showsSignInStatus()) {
|
|
3254
|
+
// Same rule: this dialog stands in for the sign-in status here.
|
|
3255
|
+
this.listenStatusCancel();
|
|
3256
|
+
return;
|
|
3257
|
+
}
|
|
3223
3258
|
this.authCancel.emit();
|
|
3224
3259
|
}
|
|
3225
3260
|
listenStatusCancel() {
|
|
@@ -3309,19 +3344,93 @@ const EzpAuth = class {
|
|
|
3309
3344
|
this.isPopupBlocked = false;
|
|
3310
3345
|
this.openSignInWindow(this.auth.authURI.toString(), 'ezeep Login');
|
|
3311
3346
|
}
|
|
3347
|
+
/**
|
|
3348
|
+
* Exchange the code in the auth store for tokens and, only if that worked,
|
|
3349
|
+
* move on to the print step. A rejected code or an unreachable token
|
|
3350
|
+
* endpoint leaves the sign-in screen up so the user can try again — moving
|
|
3351
|
+
* on regardless opened the print options without a token, where every call
|
|
3352
|
+
* failed and the user was told they had no printers.
|
|
3353
|
+
*
|
|
3354
|
+
* Resolves to what happened: `signed-in`; `rejected` when the endpoint
|
|
3355
|
+
* refused the code itself; `failed` when the attempt did not get that far
|
|
3356
|
+
* (network or server error), so the code is still unsettled.
|
|
3357
|
+
*/
|
|
3358
|
+
async exchangeCode() {
|
|
3359
|
+
let outcome;
|
|
3360
|
+
try {
|
|
3361
|
+
outcome = (await this.auth.getAccessToken()) === true ? 'signed-in' : 'rejected';
|
|
3362
|
+
}
|
|
3363
|
+
catch (_a) {
|
|
3364
|
+
outcome = 'failed';
|
|
3365
|
+
}
|
|
3366
|
+
if (outcome !== 'signed-in') {
|
|
3367
|
+
// eslint-disable-next-line no-console
|
|
3368
|
+
console.warn(outcome === 'rejected'
|
|
3369
|
+
? '[ezeep] Sign-in failed: the authorization code was rejected.'
|
|
3370
|
+
: '[ezeep] Sign-in failed: the authorization code could not be exchanged.');
|
|
3371
|
+
return outcome;
|
|
3372
|
+
}
|
|
3373
|
+
this.authCancel.emit();
|
|
3374
|
+
this.authSuccess.emit();
|
|
3375
|
+
return outcome;
|
|
3376
|
+
}
|
|
3377
|
+
/**
|
|
3378
|
+
* Exchange the `code` handed in by the host.
|
|
3379
|
+
*
|
|
3380
|
+
* - Signed in: done, the events are out.
|
|
3381
|
+
* - Rejected (`invalid_grant`): the code is dead. A stored session is kept —
|
|
3382
|
+
* after a reload the host still passes the long-spent code that session
|
|
3383
|
+
* came from, and that cannot be told apart from any other dead code.
|
|
3384
|
+
* - Failed (token endpoint unreachable, server error): nothing is known. The
|
|
3385
|
+
* code may be for a different account than a stored session, so carrying
|
|
3386
|
+
* on with that session could let one person print as another. Sign-in
|
|
3387
|
+
* stops on the dialog instead, where "Sign in" tries the code again.
|
|
3388
|
+
*/
|
|
3389
|
+
async exchangeHostCode() {
|
|
3390
|
+
authStore.state.code = this.code;
|
|
3391
|
+
const outcome = await this.exchangeCode();
|
|
3392
|
+
this.codeExchangePending = outcome === 'failed';
|
|
3393
|
+
return outcome;
|
|
3394
|
+
}
|
|
3395
|
+
/** "Sign in" while the host's code is unsettled: try the code again. */
|
|
3396
|
+
async retryHostCode() {
|
|
3397
|
+
const outcome = await this.exchangeHostCode();
|
|
3398
|
+
if (outcome === 'rejected') {
|
|
3399
|
+
// The code is dead after all: carry on as this button normally does —
|
|
3400
|
+
// straight through on a stored session, otherwise open the popup.
|
|
3401
|
+
this.openSignInWindow(this.auth.authURI.toString(), 'ezeep Login');
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3312
3404
|
async componentWillLoad() {
|
|
3313
3405
|
this.auth = new EzpAuthorizationService(this.redirectURI, this.clientID);
|
|
3314
3406
|
if (this.code) {
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3407
|
+
// A host-supplied code is single-use, and this component mounts again on
|
|
3408
|
+
// every open with the same attribute. Skip only the code this page has
|
|
3409
|
+
// already exchanged: sending it again would be rejected.
|
|
3410
|
+
//
|
|
3411
|
+
// Any other code is fresh and is exchanged even when a session is
|
|
3412
|
+
// already stored — it may belong to a different account than the stored
|
|
3413
|
+
// one (someone else signed in through the host on this browser), and
|
|
3414
|
+
// must replace it rather than print as the previous user.
|
|
3415
|
+
if (authStore.state.isAuthorized && this.code === authStore.state.exchangedCode) {
|
|
3416
|
+
this.authCancel.emit();
|
|
3417
|
+
this.authSuccess.emit();
|
|
3418
|
+
return;
|
|
3419
|
+
}
|
|
3420
|
+
// On success the events are out; nothing below applies any more (and the
|
|
3421
|
+
// hidelogin branch would emit them a second time).
|
|
3422
|
+
if ((await this.exchangeHostCode()) === 'signed-in')
|
|
3423
|
+
return;
|
|
3319
3424
|
}
|
|
3320
3425
|
if (authStore.state.isAuthorized === false) {
|
|
3321
3426
|
this.auth.generateCodeVerifier();
|
|
3322
3427
|
await this.auth.generateCodeChallenge(authStore.state.codeVerifier);
|
|
3323
3428
|
this.auth.buildAuthURI();
|
|
3324
3429
|
}
|
|
3430
|
+
// An unsettled host code holds everything here: no automatic pass on a
|
|
3431
|
+
// stored session, no popup. The dialog is shown; "Sign in" retries.
|
|
3432
|
+
if (this.codeExchangePending)
|
|
3433
|
+
return;
|
|
3325
3434
|
if (this.hidelogin && (this.trigger === 'button' || this.trigger === 'file')) {
|
|
3326
3435
|
if (authStore.state.isAuthorized) {
|
|
3327
3436
|
// Already signed in: no sign-in popup is needed, so skip straight to the
|
|
@@ -3338,7 +3447,7 @@ const EzpAuth = class {
|
|
|
3338
3447
|
}
|
|
3339
3448
|
}
|
|
3340
3449
|
render() {
|
|
3341
|
-
return (index.h(index.Host, { key: '
|
|
3450
|
+
return (index.h(index.Host, { key: '91c2e44bba5f080dfe37a0e128ca9e1f769448be' }, this.isPopupBlocked ? (index.h("ezp-dialog", { heading: instance.t('popup_blocked_dialog.heading'), description: instance.t('popup_blocked_dialog.description'), action: instance.t('popup_blocked_dialog.action'), iconName: "exclamation-mark", instance: "popup-blocked", key: "popup-blocked" })) : this.showsSignInStatus() && !this.codeExchangePending ? (index.h("ezp-status", { description: instance.t('login_dialog.action'), processing: true, cancel: true })) : (index.h("ezp-dialog", { heading: instance.t('login_dialog.heading'), description: instance.t('login_dialog.description'), action: instance.t('login_dialog.action'), iconName: "logo", iconSize: "huge", iconFramed: false, instance: "login", key: "login" }))));
|
|
3342
3451
|
}
|
|
3343
3452
|
};
|
|
3344
3453
|
EzpAuth.style = ezpAuthCss();
|
|
@@ -38664,19 +38773,31 @@ async function waitForJobCompletion(getStatus, isQueue, pollIntervalMs = POLL_IN
|
|
|
38664
38773
|
* any failure, so callers can aggregate per-file outcomes.
|
|
38665
38774
|
*/
|
|
38666
38775
|
async function uploadAndPrintFile(ctx, file, hooks = {}) {
|
|
38667
|
-
var _a, _b, _c, _d
|
|
38776
|
+
var _a, _b, _c, _d;
|
|
38668
38777
|
(_a = hooks.onPreparing) === null || _a === void 0 ? void 0 : _a.call(hooks, true);
|
|
38669
38778
|
const response = await ctx.service.prepareFileUpload(ctx.accessToken);
|
|
38670
38779
|
(_b = hooks.onPreparing) === null || _b === void 0 ? void 0 : _b.call(hooks, false);
|
|
38671
38780
|
const fileid = response.fileid;
|
|
38672
38781
|
const sasUri = response.sasUri;
|
|
38673
38782
|
const filetype = fileExtension(file.name);
|
|
38783
|
+
// The upload stage ends as soon as the blob is stored — not when the whole
|
|
38784
|
+
// job does — so the UI moves on from "Uploading…" to "Printing…" while the
|
|
38785
|
+
// job is submitted and polled. `finally` covers a failed upload.
|
|
38786
|
+
let uploading = true;
|
|
38787
|
+
const uploadDone = () => {
|
|
38788
|
+
var _a;
|
|
38789
|
+
if (!uploading)
|
|
38790
|
+
return;
|
|
38791
|
+
uploading = false;
|
|
38792
|
+
(_a = hooks.onUploading) === null || _a === void 0 ? void 0 : _a.call(hooks, false);
|
|
38793
|
+
};
|
|
38674
38794
|
(_c = hooks.onUploading) === null || _c === void 0 ? void 0 : _c.call(hooks, true);
|
|
38675
38795
|
try {
|
|
38676
38796
|
const res = await ctx.service.uploadBlobFiles(sasUri, file);
|
|
38677
38797
|
if (res._response.status !== BLOB_UPLOAD_CREATED) {
|
|
38678
38798
|
throw new Error(`Upload failed for file: ${file.name}`);
|
|
38679
38799
|
}
|
|
38800
|
+
uploadDone();
|
|
38680
38801
|
const data = await ctx.service.printByFileID(ctx.accessToken, fileid, filetype, ctx.printerId, ctx.properties, file.name);
|
|
38681
38802
|
if (data.code === PRINT_REJECTED_CODE) {
|
|
38682
38803
|
throw new Error(`Print failed for file: ${file.name}`);
|
|
@@ -38691,7 +38812,7 @@ async function uploadAndPrintFile(ctx, file, hooks = {}) {
|
|
|
38691
38812
|
await waitForJobCompletion(() => ctx.service.getPrintStatus(), ctx.isQueue, ctx.pollIntervalMs);
|
|
38692
38813
|
}
|
|
38693
38814
|
finally {
|
|
38694
|
-
(
|
|
38815
|
+
uploadDone();
|
|
38695
38816
|
}
|
|
38696
38817
|
}
|
|
38697
38818
|
|
|
@@ -40614,7 +40735,7 @@ const EzpUpload = class {
|
|
|
40614
40735
|
};
|
|
40615
40736
|
EzpUpload.style = ezpUploadCss();
|
|
40616
40737
|
|
|
40617
|
-
const ezpUserMenuCss = () =>
|
|
40738
|
+
const ezpUserMenuCss = () => `@charset "UTF-8";:host{background:var(--ezp-core-surface-tertiary);border-radius:6px;-webkit-box-shadow:var(--ezp-userMenu-boxShadow, 0 0 0 1px var(--ezp-black-10));box-shadow:var(--ezp-userMenu-boxShadow, 0 0 0 1px var(--ezp-black-10));display:block;opacity:var(--ezp-userMenu-opacity, 0);pointer-events:var(--ezp-userMenu-pointerEvents, none);position:absolute;right:0;top:0;-webkit-transform:scale(var(--ezp-userMenu-scale, 0.94, 0.94));transform:scale(var(--ezp-userMenu-scale, 0.94, 0.94));-webkit-transform-origin:right top;transform-origin:right top;-webkit-transition:var(--ezp-userMenu-transition, opacity var(--ezp-duration-3) var(--ezp-easing-out-quart), transform var(--ezp-duration-3) var(--ezp-easing-out-quart), visibility 0s var(--ezp-duration-3));transition:var(--ezp-userMenu-transition, opacity var(--ezp-duration-3) var(--ezp-easing-out-quart), transform var(--ezp-duration-3) var(--ezp-easing-out-quart), visibility 0s var(--ezp-duration-3));visibility:var(--ezp-userMenu-visibility, hidden);z-index:5}:host(.is-open){--ezp-userMenu-opacity:1;--ezp-userMenu-pointerEvents:auto;--ezp-userMenu-scale:1, 1;--ezp-userMenu-transition:opacity var(--ezp-duration-3) var(--ezp-easing-out-quart), transform var(--ezp-duration-3) var(--ezp-easing-out-quart), visibility 0s 0s;--ezp-userMenu-visibility:visible}@media (prefers-color-scheme: dark){:host{--ezp-userMenu-separator-position:inset 0 0 0 var(--hairline-width-positive)}}#header{-ms-flex-align:center;align-items:center;-webkit-box-shadow:var(--ezp-userMenu-header-boxShadowPosition, 0 1px 0 0) var(--ezp-core-outline);box-shadow:var(--ezp-userMenu-header-boxShadowPosition, 0 1px 0 0) var(--ezp-core-outline);-webkit-box-shadow:0;box-shadow:0;display:grid;grid-template:auto/1fr auto;padding:var(--ezp-spacing-4) var(--ezp-spacing-3) var(--ezp-spacing-4) var(--ezp-spacing-4)}#name{color:var(--ezp-core-foreground-primary)}#close{margin:calc(var(--ezp-spacing-3) * -1) 0}#links{-webkit-box-shadow:var(--ezp-userMenu-links-boxShadowPosition, 0 1px 0 0) var(--ezp-core-outline);box-shadow:var(--ezp-userMenu-links-boxShadowPosition, 0 1px 0 0) var(--ezp-core-outline);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding:var(--ezp-spacing-2)}.link{-ms-flex-align:center;align-items:center;background:var(--ezp-userMenu-link-background, transparent);border-radius:3px;color:var(--ezp-core-foreground-primary);cursor:pointer;display:grid;gap:var(--ezp-spacing-3);grid-template:auto/auto 1fr;padding:var(--ezp-spacing-3);text-decoration:none}.link:hover{--ezp-userMenu-link-background:var(--ezp-core-shade-primary)}.link__icon{color:var(--ezp-theme-solid);margin:calc(var(--ezp-spacing-2) * -1) 0}.caption{color:var(--ezp-core-foreground-primary)}#theme{-webkit-box-shadow:var(--ezp-userMenu-theme-boxShadowPosition, 0 1px 0 0) var(--ezp-core-outline);box-shadow:var(--ezp-userMenu-theme-boxShadowPosition, 0 1px 0 0) var(--ezp-core-outline);display:grid;gap:var(--ezp-spacing-3);grid-template:repeat(2, auto)/1fr;padding:var(--ezp-spacing-4) var(--ezp-spacing-4) var(--ezp-spacing-3)}#swatches{display:-ms-flexbox;display:flex;margin:0 calc(var(--ezp-spacing-2) * -1)}.swatch{-ms-flex-align:center;align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ezp-userMenu-swatch-background, transparent);border:0;border-radius:50%;color:var(--ezp-userMenu-swatch-color);cursor:var(--ezp-userMenu-swatch-cursor, pointer);display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;margin:0;opacity:var(--ezp-userMenu-swatch-opacity, 1);outline:none;padding:var(--ezp-spacing-2)}@media (hover: hover){.swatch:not(.selected):hover{--ezp-userMenu-swatch-background:var(--ezp-userMenu-swatch-theme-translucent)}.swatch:not(.selected):active{--ezp-userMenu-swatch-opacity:0.74}}.swatch.selected{--ezp-userMenu-dot-boxShadowSize:10px;--ezp-userMenu-swatch-background:var(--ezp-userMenu-swatch-theme-translucent);--ezp-userMenu-swatch-cursor:normal}.swatch.selected>.dot{-webkit-animation:dot-bounce var(--ezp-duration-2) ease-in-out;animation:dot-bounce var(--ezp-duration-2) ease-in-out}.swatch--blue{--ezp-userMenu-swatch-theme-solid:var(--ezp-accent-blue-solid);--ezp-userMenu-swatch-theme-translucent:var(--ezp-accent-blue-translucent)}.swatch--cyan{--ezp-userMenu-swatch-theme-solid:var(--ezp-accent-cyan-solid);--ezp-userMenu-swatch-theme-translucent:var(--ezp-accent-cyan-translucent)}.swatch--green{--ezp-userMenu-swatch-theme-solid:var(--ezp-accent-green-solid);--ezp-userMenu-swatch-theme-translucent:var(--ezp-accent-green-translucent)}.swatch--teal{--ezp-userMenu-swatch-theme-solid:var(--ezp-accent-teal-solid);--ezp-userMenu-swatch-theme-translucent:var(--ezp-accent-teal-translucent)}.swatch--orange{--ezp-userMenu-swatch-theme-solid:var(--ezp-accent-orange-solid);--ezp-userMenu-swatch-theme-translucent:var(--ezp-accent-orange-translucent)}.swatch--pink{--ezp-userMenu-swatch-theme-solid:var(--ezp-accent-pink-solid);--ezp-userMenu-swatch-theme-translucent:var(--ezp-accent-pink-translucent)}.swatch--red{--ezp-userMenu-swatch-theme-solid:var(--ezp-accent-red-solid);--ezp-userMenu-swatch-theme-translucent:var(--ezp-accent-red-translucent)}.swatch--violet{--ezp-userMenu-swatch-theme-solid:var(--ezp-accent-violet-solid);--ezp-userMenu-swatch-theme-translucent:var(--ezp-accent-violet-translucent)}.dot{background:var(--ezp-userMenu-dot-background, transparent);border-radius:50%;-webkit-box-shadow:inset 0 0 0 var(--ezp-userMenu-dot-boxShadowSize, 4px) var(--ezp-userMenu-swatch-theme-solid);box-shadow:inset 0 0 0 var(--ezp-userMenu-dot-boxShadowSize, 4px) var(--ezp-userMenu-swatch-theme-solid);height:18px;-webkit-transition:-webkit-box-shadow var(--ezp-duration-2);transition:-webkit-box-shadow var(--ezp-duration-2);transition:box-shadow var(--ezp-duration-2);transition:box-shadow var(--ezp-duration-2), -webkit-box-shadow var(--ezp-duration-2);width:18px}#appearance{display:grid;gap:var(--ezp-spacing-3);grid-template:repeat(2, auto)/1fr;padding:var(--ezp-spacing-4) var(--ezp-spacing-4) var(--ezp-spacing-3)}#tabs{display:grid;grid-template:auto/repeat(3, 1fr);margin:0 calc(var(--ezp-spacing-2) * -1)}.tab{--ezp-icon-height:8px;-ms-flex-align:center;align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ezp-userMenu-tab-background, transparent);border:0;border-radius:14px;color:var(--ezp-userMenu-tab-color, var(--ezp-core-foreground-secondary));cursor:var(--ezp-userMenu-tab-cursor, pointer);display:-ms-flexbox;display:flex;gap:var(--ezp-spacing-2);-ms-flex-pack:center;justify-content:center;margin:0;outline:none;padding:var(--ezp-spacing-3) var(--ezp-spacing-3) var(--ezp-spacing-3) var(--ezp-spacing-2)}@media (hover: hover){.tab:not(.selected):hover{--ezp-userMenu-tab-background:var(--ezp-core-shade-primary)}.tab:not(.selected):active{--ezp-userMenu-tab-background:var(--ezp-core-shade-secondary)}}.tab.selected{--ezp-userMenu-tab-background:var(--ezp-theme-translucent);--ezp-userMenu-tab-color:var(--ezp-theme-solid);--ezp-userMenu-tab-cursor:normal}@-webkit-keyframes dot-bounce{0%{-webkit-transform:scale(1, 1);transform:scale(1, 1)}50%{-webkit-transform:scale(0.84, 0.84);transform:scale(0.84, 0.84)}100%{-webkit-transform:scale(1, 1);transform:scale(1, 1)}}@keyframes dot-bounce{0%{-webkit-transform:scale(1, 1);transform:scale(1, 1)}50%{-webkit-transform:scale(0.84, 0.84);transform:scale(0.84, 0.84)}100%{-webkit-transform:scale(1, 1);transform:scale(1, 1)}}`;
|
|
40618
40739
|
|
|
40619
40740
|
const EzpUserMenu = class {
|
|
40620
40741
|
constructor(hostRef) {
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -6,7 +6,7 @@ var appGlobals = require('./app-globals-L_3XPZxT.js');
|
|
|
6
6
|
const defineCustomElements = async (win, options) => {
|
|
7
7
|
if (typeof window === 'undefined') return undefined;
|
|
8
8
|
await appGlobals.globalScripts();
|
|
9
|
-
return index.bootstrapLazy([["ezp-auth_16.cjs",[[257,"ezp-printing",{"clientid":[1],"redirecturi":[1],"filename":[1025],"fileurl":[1],"filetype":[1],"custom":[4],"hidelogin":[4],"hidemenu":[4],"hideheader":[4],"authapihosturl":[1],"printapihosturl":[1],"theme":[1],"fileid":[1],"appearance":[1],"trigger":[1],"language":[1],"code":[1],"filedata":[1],"seamless":[4],"printOpen":[32],"authOpen":[32],"onlyGetSasUri":[32],"noDocumentOpen":[32],"systemAppearance":[32],"files":[32],"open":[64],"logOut":[64],"getSasUri":[64],"getAuthUri":[64],"setAuthRefreshToken":[64],"checkAuth":[64]},[[0,"printCancel","listenPrintCancel"],[0,"printDismiss","listenPrintDismiss"],[0,"printSubmit","listenPrintSubmit"],[0,"authCancel","listenAuthCancel"],[0,"userCancel","listenUserCancel"],[0,"authSuccess","listenAuthSuccess"],[0,"uploadFile","listenUploadFile"],[0,"uploadContinue","listenUploadContinue"],[0,"dialogClose","listenDialogClose"],[0,"dialogAction","listenDialogAction"],[0,"logout","listenLogout"]],{"filedata":[{"watchFileData":0}],"filename":[{"watchFilename":0}],"fileurl":[{"watchFileUrl":0}],"language":[{"watchLanguage":0}]}],[1,"ezp-printer-selection",{"clientID":[1,"client-i-d"],"redirectURI":[1,"redirect-u-r-i"],"filename":[1025],"fileurl":[1],"filetype":[1025],"fileid":[1025],"files":[16],"hidemenu":[4],"hideheader":[4],"seamless":[4],"loading":[32],"printProcessing":[32],"pageRangeInvalid":[32],"uploading":[32],"preparingUpload":[32],"printSuccess":[32],"printFailed":[32],"printTimedOut":[32],"notSupported":[32],"noPrinters":[32],"hubDriverError":[32],"userMenuOpen":[32],"printStopped":[32],"firstVisibleFile":[32],"userName":[32],"printers":[32],"selectedPrinter":[32],"printerConfig":[32],"selectedPrinterConfig":[32],"selectedProperties":[32],"loadingPrinterConfig":[32],"paperid":[32],"currentFileIndex":[32],"totalFiles":[32],"failedFiles":[32],"successfulFiles":[32],"partialSuccess":[32]},[[0,"inputValueChanged","listenInputValueChanged"],[0,"selectSelection","listenSelectSelection"],[0,"stepperChanged","listenStepperChanged"],[0,"userMenuClosure","listenUserMenuClosure"],[0,"logoutEmitter","listenLogout"],[0,"statusCancel","listenStatusCancel"],[0,"statusClose","listenStatusClose"],[0,"statusRetry","listenStatusRetry"]]],[1,"ezp-auth",{"clientID":[1025,"client-i-d"],"redirectURI":[1025,"redirect-u-r-i"],"hidelogin":[4],"trigger":[1],"code":[1],"auth":[32],"authURI":[32],"accessToken":[32],"isPopupBlocked":[32]},[[0,"dialogAction","listenDialogAction"],[0,"dialogClose","listenDialogClose"],[0,"statusCancel","listenStatusCancel"]]],[1,"ezp-upload",{"selectedFiles":[32],"dragging":[32],"firstVisibleFile":[32]},[[0,"dragenter","handleDragEnter"],[0,"dragover","handleDragOver"],[1,"dragleave","handleDragLeave"],[0,"drop","handleDrop"],[9,"drop","resetDrag"],[9,"dragend","resetDrag"],[4,"printCancel","listenPrintCancel"]]],[1,"ezp-dialog",{"heading":[1],"description":[1],"action":[1],"iconName":[1,"icon-name"],"iconSize":[1,"icon-size"],"iconFramed":[4,"icon-framed"],"instance":[1]},[[8,"keydown","handleKeydown"]]],[1,"ezp-user-menu",{"name":[1],"open":[1028]},null,{"open":[{"watchOpen":0}]}],[1,"ezp-select",{"icon":[1],"label":[1],"optionFlow":[1,"option-flow"],"options":[16],"placeholder":[1],"preSelected":[8,"pre-selected"],"toggleFlow":[1,"toggle-flow"],"disabled":[4],"expanded":[32],"selected":[32]},null,{"expanded":[{"watchExpanded":0}],"preSelected":[{"preSelectedChanged":0}]}],[1,"ezp-input",{"label":[1],"value":[1032],"type":[1],"icon":[1],"suffix":[513],"eventType":[1,"event-type"],"placeholder":[1],"focused":[32]}],[1,"ezp-stepper",{"icon":[1],"label":[1],"max":[2],"min":[2],"canDecrease":[32],"canIncrease":[32],"focused":[32],"value":[32]},null,{"value":[{"watchValue":0}]}],[1,"ezp-status",{"description":[1],"subtext":[1],"processing":[4],"instance":[1],"icon":[1],"cancel":[8],"close":[8],"retry":[8]}],[1,"ezp-file-name",{"name":[1],"level":[1],"weight":[1],"placement":[1],"anchor":[1],"expanded":[32],"tooltipOpen":[32]},[[10,"keydown","handleKeyDown"]],{"tooltipOpen":[{"watchTooltipOpen":0}]}],[1,"ezp-backdrop",{"visible":[1028]},[[0,"animationend","listenAnimationEnd"]]],[1,"ezp-icon-button",{"blank":[4],"disabled":[4],"href":[1],"icon":[1],"level":[1],"type":[1]}],[1,"ezp-text-button",{"blank":[4],"disabled":[4],"href":[1],"level":[1],"label":[1],"type":[1],"small":[4]}],[1,"ezp-icon",{"name":[1],"size":[1],"framed":[4]}],[1,"ezp-label",{"ellipsis":[4],"level":[1],"noWrap":[4,"no-wrap"],"text":[1],"weight":[1],"isTruncated":[64]}]]]], options);
|
|
9
|
+
return index.bootstrapLazy([["ezp-auth_16.cjs",[[257,"ezp-printing",{"clientid":[1],"redirecturi":[1],"filename":[1025],"fileurl":[1],"filetype":[1],"custom":[4],"hidelogin":[4],"hidemenu":[4],"hideheader":[4],"authapihosturl":[1],"printapihosturl":[1],"theme":[1],"fileid":[1],"appearance":[1],"trigger":[1],"language":[1],"code":[1],"filedata":[1],"seamless":[4],"printOpen":[32],"authOpen":[32],"onlyGetSasUri":[32],"noDocumentOpen":[32],"systemAppearance":[32],"files":[32],"open":[64],"logOut":[64],"getSasUri":[64],"getAuthUri":[64],"setAuthRefreshToken":[64],"checkAuth":[64]},[[0,"printCancel","listenPrintCancel"],[0,"printDismiss","listenPrintDismiss"],[0,"printSubmit","listenPrintSubmit"],[0,"authCancel","listenAuthCancel"],[0,"userCancel","listenUserCancel"],[0,"authSuccess","listenAuthSuccess"],[0,"uploadFile","listenUploadFile"],[0,"uploadContinue","listenUploadContinue"],[0,"dialogClose","listenDialogClose"],[0,"dialogAction","listenDialogAction"],[0,"logout","listenLogout"]],{"filedata":[{"watchFileData":0}],"filename":[{"watchFilename":0}],"fileurl":[{"watchFileUrl":0}],"language":[{"watchLanguage":0}]}],[1,"ezp-printer-selection",{"clientID":[1,"client-i-d"],"redirectURI":[1,"redirect-u-r-i"],"filename":[1025],"fileurl":[1],"filetype":[1025],"fileid":[1025],"files":[16],"hidemenu":[4],"hideheader":[4],"seamless":[4],"loading":[32],"printProcessing":[32],"pageRangeInvalid":[32],"uploading":[32],"preparingUpload":[32],"printSuccess":[32],"printFailed":[32],"printTimedOut":[32],"notSupported":[32],"noPrinters":[32],"hubDriverError":[32],"userMenuOpen":[32],"printStopped":[32],"firstVisibleFile":[32],"userName":[32],"printers":[32],"selectedPrinter":[32],"printerConfig":[32],"selectedPrinterConfig":[32],"selectedProperties":[32],"loadingPrinterConfig":[32],"paperid":[32],"currentFileIndex":[32],"totalFiles":[32],"failedFiles":[32],"successfulFiles":[32],"partialSuccess":[32]},[[0,"inputValueChanged","listenInputValueChanged"],[0,"selectSelection","listenSelectSelection"],[0,"stepperChanged","listenStepperChanged"],[0,"userMenuClosure","listenUserMenuClosure"],[0,"logoutEmitter","listenLogout"],[0,"statusCancel","listenStatusCancel"],[0,"statusClose","listenStatusClose"],[0,"statusRetry","listenStatusRetry"]]],[1,"ezp-auth",{"clientID":[1025,"client-i-d"],"redirectURI":[1025,"redirect-u-r-i"],"hidelogin":[4],"trigger":[1],"code":[1],"auth":[32],"authURI":[32],"accessToken":[32],"isPopupBlocked":[32],"codeExchangePending":[32]},[[0,"dialogAction","listenDialogAction"],[0,"dialogClose","listenDialogClose"],[0,"statusCancel","listenStatusCancel"]]],[1,"ezp-upload",{"selectedFiles":[32],"dragging":[32],"firstVisibleFile":[32]},[[0,"dragenter","handleDragEnter"],[0,"dragover","handleDragOver"],[1,"dragleave","handleDragLeave"],[0,"drop","handleDrop"],[9,"drop","resetDrag"],[9,"dragend","resetDrag"],[4,"printCancel","listenPrintCancel"]]],[1,"ezp-dialog",{"heading":[1],"description":[1],"action":[1],"iconName":[1,"icon-name"],"iconSize":[1,"icon-size"],"iconFramed":[4,"icon-framed"],"instance":[1]},[[8,"keydown","handleKeydown"]]],[1,"ezp-user-menu",{"name":[1],"open":[1028]},null,{"open":[{"watchOpen":0}]}],[1,"ezp-select",{"icon":[1],"label":[1],"optionFlow":[1,"option-flow"],"options":[16],"placeholder":[1],"preSelected":[8,"pre-selected"],"toggleFlow":[1,"toggle-flow"],"disabled":[4],"expanded":[32],"selected":[32]},null,{"expanded":[{"watchExpanded":0}],"preSelected":[{"preSelectedChanged":0}]}],[1,"ezp-input",{"label":[1],"value":[1032],"type":[1],"icon":[1],"suffix":[513],"eventType":[1,"event-type"],"placeholder":[1],"focused":[32]}],[1,"ezp-stepper",{"icon":[1],"label":[1],"max":[2],"min":[2],"canDecrease":[32],"canIncrease":[32],"focused":[32],"value":[32]},null,{"value":[{"watchValue":0}]}],[1,"ezp-status",{"description":[1],"subtext":[1],"processing":[4],"instance":[1],"icon":[1],"cancel":[8],"close":[8],"retry":[8]}],[1,"ezp-file-name",{"name":[1],"level":[1],"weight":[1],"placement":[1],"anchor":[1],"expanded":[32],"tooltipOpen":[32]},[[10,"keydown","handleKeyDown"]],{"tooltipOpen":[{"watchTooltipOpen":0}]}],[1,"ezp-backdrop",{"visible":[1028]},[[0,"animationend","listenAnimationEnd"]]],[1,"ezp-icon-button",{"blank":[4],"disabled":[4],"href":[1],"icon":[1],"level":[1],"type":[1]}],[1,"ezp-text-button",{"blank":[4],"disabled":[4],"href":[1],"level":[1],"label":[1],"type":[1],"small":[4]}],[1,"ezp-icon",{"name":[1],"size":[1],"framed":[4]}],[1,"ezp-label",{"ellipsis":[4],"level":[1],"noWrap":[4,"no-wrap"],"text":[1],"weight":[1],"isTruncated":[64]}]]]], options);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
exports.setNonce = index.setNonce;
|
|
@@ -7,6 +7,13 @@ export class EzpAuth {
|
|
|
7
7
|
constructor() {
|
|
8
8
|
/** True when the browser blocked the sign-in popup; shows the popup-blocked dialog. */
|
|
9
9
|
this.isPopupBlocked = false;
|
|
10
|
+
/**
|
|
11
|
+
* True while a host-supplied `code` is still waiting to be exchanged because
|
|
12
|
+
* the attempt failed for a reason other than the code being refused. Until
|
|
13
|
+
* it is settled, nothing may proceed on a stored session: the code may be
|
|
14
|
+
* for a different account than the one stored.
|
|
15
|
+
*/
|
|
16
|
+
this.codeExchangePending = false;
|
|
10
17
|
this.oauthPopupWindow = null;
|
|
11
18
|
this.previousUrl = null;
|
|
12
19
|
// Bound once (arrow property) so add/removeEventListener share the same
|
|
@@ -40,10 +47,7 @@ export class EzpAuth {
|
|
|
40
47
|
return;
|
|
41
48
|
}
|
|
42
49
|
authStore.state.code = event.data;
|
|
43
|
-
this.
|
|
44
|
-
this.authCancel.emit();
|
|
45
|
-
this.authSuccess.emit();
|
|
46
|
-
});
|
|
50
|
+
this.exchangeCode();
|
|
47
51
|
};
|
|
48
52
|
}
|
|
49
53
|
listenDialogAction(event) {
|
|
@@ -51,6 +55,11 @@ export class EzpAuth {
|
|
|
51
55
|
this.handleRetry();
|
|
52
56
|
return;
|
|
53
57
|
}
|
|
58
|
+
if (this.codeExchangePending) {
|
|
59
|
+
// "Sign in" retries the host's code first; see `exchangeHostCode`.
|
|
60
|
+
this.retryHostCode();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
54
63
|
this.openSignInWindow(this.auth.authURI.toString(), 'ezeep Login');
|
|
55
64
|
}
|
|
56
65
|
listenDialogClose(event) {
|
|
@@ -63,6 +72,11 @@ export class EzpAuth {
|
|
|
63
72
|
return;
|
|
64
73
|
}
|
|
65
74
|
}
|
|
75
|
+
if (this.codeExchangePending && this.showsSignInStatus()) {
|
|
76
|
+
// Same rule: this dialog stands in for the sign-in status here.
|
|
77
|
+
this.listenStatusCancel();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
66
80
|
this.authCancel.emit();
|
|
67
81
|
}
|
|
68
82
|
listenStatusCancel() {
|
|
@@ -152,19 +166,93 @@ export class EzpAuth {
|
|
|
152
166
|
this.isPopupBlocked = false;
|
|
153
167
|
this.openSignInWindow(this.auth.authURI.toString(), 'ezeep Login');
|
|
154
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Exchange the code in the auth store for tokens and, only if that worked,
|
|
171
|
+
* move on to the print step. A rejected code or an unreachable token
|
|
172
|
+
* endpoint leaves the sign-in screen up so the user can try again — moving
|
|
173
|
+
* on regardless opened the print options without a token, where every call
|
|
174
|
+
* failed and the user was told they had no printers.
|
|
175
|
+
*
|
|
176
|
+
* Resolves to what happened: `signed-in`; `rejected` when the endpoint
|
|
177
|
+
* refused the code itself; `failed` when the attempt did not get that far
|
|
178
|
+
* (network or server error), so the code is still unsettled.
|
|
179
|
+
*/
|
|
180
|
+
async exchangeCode() {
|
|
181
|
+
let outcome;
|
|
182
|
+
try {
|
|
183
|
+
outcome = (await this.auth.getAccessToken()) === true ? 'signed-in' : 'rejected';
|
|
184
|
+
}
|
|
185
|
+
catch (_a) {
|
|
186
|
+
outcome = 'failed';
|
|
187
|
+
}
|
|
188
|
+
if (outcome !== 'signed-in') {
|
|
189
|
+
// eslint-disable-next-line no-console
|
|
190
|
+
console.warn(outcome === 'rejected'
|
|
191
|
+
? '[ezeep] Sign-in failed: the authorization code was rejected.'
|
|
192
|
+
: '[ezeep] Sign-in failed: the authorization code could not be exchanged.');
|
|
193
|
+
return outcome;
|
|
194
|
+
}
|
|
195
|
+
this.authCancel.emit();
|
|
196
|
+
this.authSuccess.emit();
|
|
197
|
+
return outcome;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Exchange the `code` handed in by the host.
|
|
201
|
+
*
|
|
202
|
+
* - Signed in: done, the events are out.
|
|
203
|
+
* - Rejected (`invalid_grant`): the code is dead. A stored session is kept —
|
|
204
|
+
* after a reload the host still passes the long-spent code that session
|
|
205
|
+
* came from, and that cannot be told apart from any other dead code.
|
|
206
|
+
* - Failed (token endpoint unreachable, server error): nothing is known. The
|
|
207
|
+
* code may be for a different account than a stored session, so carrying
|
|
208
|
+
* on with that session could let one person print as another. Sign-in
|
|
209
|
+
* stops on the dialog instead, where "Sign in" tries the code again.
|
|
210
|
+
*/
|
|
211
|
+
async exchangeHostCode() {
|
|
212
|
+
authStore.state.code = this.code;
|
|
213
|
+
const outcome = await this.exchangeCode();
|
|
214
|
+
this.codeExchangePending = outcome === 'failed';
|
|
215
|
+
return outcome;
|
|
216
|
+
}
|
|
217
|
+
/** "Sign in" while the host's code is unsettled: try the code again. */
|
|
218
|
+
async retryHostCode() {
|
|
219
|
+
const outcome = await this.exchangeHostCode();
|
|
220
|
+
if (outcome === 'rejected') {
|
|
221
|
+
// The code is dead after all: carry on as this button normally does —
|
|
222
|
+
// straight through on a stored session, otherwise open the popup.
|
|
223
|
+
this.openSignInWindow(this.auth.authURI.toString(), 'ezeep Login');
|
|
224
|
+
}
|
|
225
|
+
}
|
|
155
226
|
async componentWillLoad() {
|
|
156
227
|
this.auth = new EzpAuthorizationService(this.redirectURI, this.clientID);
|
|
157
228
|
if (this.code) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
229
|
+
// A host-supplied code is single-use, and this component mounts again on
|
|
230
|
+
// every open with the same attribute. Skip only the code this page has
|
|
231
|
+
// already exchanged: sending it again would be rejected.
|
|
232
|
+
//
|
|
233
|
+
// Any other code is fresh and is exchanged even when a session is
|
|
234
|
+
// already stored — it may belong to a different account than the stored
|
|
235
|
+
// one (someone else signed in through the host on this browser), and
|
|
236
|
+
// must replace it rather than print as the previous user.
|
|
237
|
+
if (authStore.state.isAuthorized && this.code === authStore.state.exchangedCode) {
|
|
238
|
+
this.authCancel.emit();
|
|
239
|
+
this.authSuccess.emit();
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
// On success the events are out; nothing below applies any more (and the
|
|
243
|
+
// hidelogin branch would emit them a second time).
|
|
244
|
+
if ((await this.exchangeHostCode()) === 'signed-in')
|
|
245
|
+
return;
|
|
162
246
|
}
|
|
163
247
|
if (authStore.state.isAuthorized === false) {
|
|
164
248
|
this.auth.generateCodeVerifier();
|
|
165
249
|
await this.auth.generateCodeChallenge(authStore.state.codeVerifier);
|
|
166
250
|
this.auth.buildAuthURI();
|
|
167
251
|
}
|
|
252
|
+
// An unsettled host code holds everything here: no automatic pass on a
|
|
253
|
+
// stored session, no popup. The dialog is shown; "Sign in" retries.
|
|
254
|
+
if (this.codeExchangePending)
|
|
255
|
+
return;
|
|
168
256
|
if (this.hidelogin && (this.trigger === 'button' || this.trigger === 'file')) {
|
|
169
257
|
if (authStore.state.isAuthorized) {
|
|
170
258
|
// Already signed in: no sign-in popup is needed, so skip straight to the
|
|
@@ -181,7 +269,7 @@ export class EzpAuth {
|
|
|
181
269
|
}
|
|
182
270
|
}
|
|
183
271
|
render() {
|
|
184
|
-
return (h(Host, { key: '
|
|
272
|
+
return (h(Host, { key: '91c2e44bba5f080dfe37a0e128ca9e1f769448be' }, this.isPopupBlocked ? (h("ezp-dialog", { heading: i18next.t('popup_blocked_dialog.heading'), description: i18next.t('popup_blocked_dialog.description'), action: i18next.t('popup_blocked_dialog.action'), iconName: "exclamation-mark", instance: "popup-blocked", key: "popup-blocked" })) : this.showsSignInStatus() && !this.codeExchangePending ? (h("ezp-status", { description: i18next.t('login_dialog.action'), processing: true, cancel: true })) : (h("ezp-dialog", { heading: i18next.t('login_dialog.heading'), description: i18next.t('login_dialog.description'), action: i18next.t('login_dialog.action'), iconName: "logo", iconSize: "huge", iconFramed: false, instance: "login", key: "login" }))));
|
|
185
273
|
}
|
|
186
274
|
static get is() { return "ezp-auth"; }
|
|
187
275
|
static get encapsulation() { return "shadow"; }
|
|
@@ -299,7 +387,8 @@ export class EzpAuth {
|
|
|
299
387
|
"auth": {},
|
|
300
388
|
"authURI": {},
|
|
301
389
|
"accessToken": {},
|
|
302
|
-
"isPopupBlocked": {}
|
|
390
|
+
"isPopupBlocked": {},
|
|
391
|
+
"codeExchangePending": {}
|
|
303
392
|
};
|
|
304
393
|
}
|
|
305
394
|
static get events() {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
1
2
|
/**
|
|
2
3
|
*
|
|
3
4
|
* Modules
|
|
@@ -34,6 +35,11 @@
|
|
|
34
35
|
box-shadow: var(--ezp-userMenu-boxShadow, 0 0 0 1px var(--ezp-black-10));
|
|
35
36
|
display: block;
|
|
36
37
|
opacity: var(--ezp-userMenu-opacity, 0);
|
|
38
|
+
/* `visibility` only flips to hidden once the fade-out has run — including
|
|
39
|
+
the one that plays when the menu first mounts closed. Until then it lies,
|
|
40
|
+
invisible, over the header and the printer select; without this it
|
|
41
|
+
swallowed clicks meant for them. */
|
|
42
|
+
pointer-events: var(--ezp-userMenu-pointerEvents, none);
|
|
37
43
|
position: absolute;
|
|
38
44
|
right: 0;
|
|
39
45
|
top: 0;
|
|
@@ -45,6 +51,7 @@
|
|
|
45
51
|
}
|
|
46
52
|
:host(.is-open) {
|
|
47
53
|
--ezp-userMenu-opacity: 1;
|
|
54
|
+
--ezp-userMenu-pointerEvents: auto;
|
|
48
55
|
--ezp-userMenu-scale: 1, 1;
|
|
49
56
|
--ezp-userMenu-transition:
|
|
50
57
|
opacity var(--ezp-duration-3) var(--ezp-easing-out-quart),
|
|
@@ -65,6 +65,16 @@ export class EzpAuthorizationService {
|
|
|
65
65
|
authStore.state.isAuthorized = true;
|
|
66
66
|
storage.setIsAuthorized(true);
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Exchange the authorization code for tokens. Three outcomes, which callers
|
|
70
|
+
* must be able to tell apart:
|
|
71
|
+
*
|
|
72
|
+
* - resolves `true`: tokens were issued and stored;
|
|
73
|
+
* - resolves `false`: the endpoint refused *the code* (`invalid_grant` —
|
|
74
|
+
* expired, already used, wrong verifier). Trying again cannot help;
|
|
75
|
+
* - rejects: nothing is known about the code — the request never completed,
|
|
76
|
+
* or the endpoint answered with any other error. Trying again may work.
|
|
77
|
+
*/
|
|
68
78
|
getAccessToken() {
|
|
69
79
|
return fetch(this.accessTokenURL, {
|
|
70
80
|
credentials: 'include',
|
|
@@ -80,9 +90,18 @@ export class EzpAuthorizationService {
|
|
|
80
90
|
})
|
|
81
91
|
.then((response) => response.json())
|
|
82
92
|
.then((data) => {
|
|
93
|
+
var _a;
|
|
83
94
|
if (data.access_token) {
|
|
84
95
|
this.persistTokens(data.access_token, data.refresh_token);
|
|
96
|
+
// Remember which code produced this session: it is spent now.
|
|
97
|
+
authStore.state.exchangedCode = authStore.state.code;
|
|
98
|
+
return true;
|
|
85
99
|
}
|
|
100
|
+
if (data.error === 'invalid_grant')
|
|
101
|
+
return false;
|
|
102
|
+
// Only the endpoint's own error code is quoted — never the code,
|
|
103
|
+
// verifier or anything else from the request.
|
|
104
|
+
throw new Error(`Token endpoint error: ${(_a = data.error) !== null && _a !== void 0 ? _a : 'unexpected response'}`);
|
|
86
105
|
});
|
|
87
106
|
}
|
|
88
107
|
refreshTokens() {
|
|
@@ -119,6 +138,8 @@ export class EzpAuthorizationService {
|
|
|
119
138
|
}
|
|
120
139
|
const authStore = createStore({
|
|
121
140
|
code: '',
|
|
141
|
+
/** The authorization code the current session was obtained with (in memory only). */
|
|
142
|
+
exchangedCode: '',
|
|
122
143
|
codeVerifier: '',
|
|
123
144
|
accessToken: '',
|
|
124
145
|
refreshToken: '',
|