@wix/himalaya-cli 0.1855.0 → 0.1857.0
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/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/auth/src/copy.generated.d.ts +20 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/auth/src/feedback.d.ts +9 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/auth/src/index.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/index.d.ts +21 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/auth.mjs +53 -16
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +94 -29
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{fb500748f6c4768468f2e7f985aa67c38633077c7a98caaa6b500c7b00eea8e9.bin → 7c8b32af7572e93ce52c2bc81b8d0bf5525f6e66531f934dac68d4507a6e3026.bin} +1 -1
- package/dist/browser-plane/sw.js +10 -10
- package/dist/cli.mjs +648 -317
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/himi-json-output.md +2 -2
- package/guides/one-app-section-mappings.md +2 -2
- package/guides/one-app-to-himi-app.md +3 -3
- package/guides/recipe-auth.md +18 -1
- package/guides/sdk-reference.json +4 -4
- package/package.json +2 -2
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-home/index.ts +5 -2
- package/templates/beauty-salon/tier5-src/_shared/himi-media.ts +6 -2
- package/templates/branded-lite/l10n/ar.json +15 -10
- package/templates/branded-lite/l10n/cs.json +15 -10
- package/templates/branded-lite/l10n/da.json +15 -10
- package/templates/branded-lite/l10n/de.json +15 -10
- package/templates/branded-lite/l10n/el.json +15 -10
- package/templates/branded-lite/l10n/es.json +15 -10
- package/templates/branded-lite/l10n/fi.json +15 -10
- package/templates/branded-lite/l10n/fr.json +15 -10
- package/templates/branded-lite/l10n/he.json +12 -8
- package/templates/branded-lite/l10n/hu.json +15 -10
- package/templates/branded-lite/l10n/id.json +15 -10
- package/templates/branded-lite/l10n/it.json +15 -10
- package/templates/branded-lite/l10n/ja.json +15 -10
- package/templates/branded-lite/l10n/ko.json +15 -10
- package/templates/branded-lite/l10n/lt.json +15 -10
- package/templates/branded-lite/l10n/nl.json +15 -10
- package/templates/branded-lite/l10n/no.json +15 -10
- package/templates/branded-lite/l10n/pl.json +15 -10
- package/templates/branded-lite/l10n/pt.json +15 -10
- package/templates/branded-lite/l10n/ru.json +15 -10
- package/templates/branded-lite/l10n/sv.json +15 -10
- package/templates/branded-lite/l10n/th.json +15 -10
- package/templates/branded-lite/l10n/tr.json +15 -10
- package/templates/branded-lite/l10n/uk.json +15 -10
- package/templates/branded-lite/l10n/vi.json +15 -10
- package/templates/branded-lite/l10n/zh.json +15 -10
- package/templates/branded-lite/recipes/performance-tracker.json +464 -75
- package/templates/branded-lite/tier5-src/_shared/himi-media.ts +6 -2
- package/templates/branded-lite/tier5-src/_shared/performance-tracker-goal.ts +57 -0
- package/templates/branded-lite/tier5-src/_shared/performance-tracker-section.ts +124 -49
- package/templates/branded-lite/tier5-src/_shared/performance-tracker-weeks.ts +2 -2
- package/templates/branded-lite/tier5-src/_shared/programs-section.ts +46 -15
- package/templates/community-club/tier5-src/_shared/himi-media.ts +6 -2
- package/templates/events-meetups/tier5-src/_shared/himi-media.ts +6 -2
- package/templates/fitness-gym/tier5-src/_shared/himi-media.ts +6 -2
- package/templates/gym-fitness/tier5-src/_shared/himi-media.ts +6 -2
- package/templates/nonprofit-cause/tier5-src/_shared/himi-media.ts +6 -2
- package/templates/podcast-creator/tier5-src/_shared/himi-media.ts +6 -2
- package/templates/portfolio-creative/tier5-src/_shared/himi-media.ts +6 -2
- package/templates/restaurant/tier5-src/_shared/himi-media.ts +6 -2
- package/templates/retail-store/tier5-src/_shared/himi-media.ts +6 -2
- package/templates/yoga-studio/tier5-src/_shared/himi-media.ts +6 -2
|
@@ -125,5 +125,25 @@ declare const _default: {
|
|
|
125
125
|
readonly "auth.gate.verify.body": "Enter the confirmation code sent to your email to finish signing in.";
|
|
126
126
|
readonly "auth.gate.cancel": "Cancel";
|
|
127
127
|
readonly "auth.gate.codePlaceholder": "Confirmation code";
|
|
128
|
+
readonly "auth.gate.close": "Close";
|
|
129
|
+
readonly "auth.gate.captcha.title": "Verification";
|
|
130
|
+
readonly "auth.gate.signingIn": "Signing in…";
|
|
131
|
+
readonly "auth.gate.account.subtitle": "Sign in with your Wix account to see the sites you belong to.";
|
|
132
|
+
readonly "auth.gate.account.failed": "Sign-in failed. Try again.";
|
|
133
|
+
readonly "auth.gate.account.unavailable": "Signing in isn't available on this website yet.";
|
|
134
|
+
readonly "auth.gate.account.upstreamFailed": "Wix could not confirm your account right now. Try again in a moment.";
|
|
135
|
+
readonly "auth.gate.account.unreachable": "Could not reach the sign-in service. Check your connection and try again.";
|
|
136
|
+
readonly "auth.feedback.notCompleted": "Sign-in did not complete. Please try again.";
|
|
137
|
+
readonly "auth.feedback.registerNotCompleted": "We could not create that account. Try a different email.";
|
|
138
|
+
readonly "auth.flow.registerTitle": "Create an account";
|
|
139
|
+
readonly "auth.flow.subhead": "Memberships belong to a member account.";
|
|
140
|
+
readonly "auth.flow.toRegister": "New here? Create an account";
|
|
141
|
+
readonly "auth.flow.toSignIn": "Already a member? Sign In";
|
|
142
|
+
readonly "auth.flow.signOut": "Sign out";
|
|
143
|
+
readonly "auth.flow.signedInTitle": "You're signed in";
|
|
144
|
+
readonly "auth.flow.signedInNotice": "Signed in.";
|
|
145
|
+
readonly "auth.flow.signedOutNotice": "Signed out.";
|
|
146
|
+
readonly "auth.flow.signOutFailed": "Sign-out did not complete. Try again.";
|
|
147
|
+
readonly "auth.flow.missingFields": "Enter your email and password.";
|
|
128
148
|
};
|
|
129
149
|
export default _default;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
export type AuthFailureCode = "invalid_input" | "invalid_credentials" | "registration_failed" | "email_in_use" | "invalid_code" | "expired_code" | "network" | "rate_limited" | "unavailable" | "cancelled" | "verification_required" | "delivery_failed" | "sms_region_unsupported" | "verification_expired" | "unknown";
|
|
2
2
|
export type AuthOperation = "signIn" | "register" | "reset" | "verify";
|
|
3
|
+
/** The English default for a catalog key (`core/runtime/l10n/auth-gate/en.json`), or "" when none. */
|
|
4
|
+
export declare function authDefault(key: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* The app catalog's answer for `key` through the host's `@himalaya/l10n` bridge, or undefined.
|
|
7
|
+
* Read from the host global rather than imported: `@himalaya/l10n` throws at import on a host
|
|
8
|
+
* without the catalog, and only a bundle that declared the `l10n` grant may call the bridge.
|
|
9
|
+
*/
|
|
10
|
+
export declare function l10nTranslate(key: string): string | undefined;
|
|
11
|
+
/** key -> the translator's answer (an answer equal to the key is "no entry") -> English default. */
|
|
3
12
|
export declare function authMessage(key: string, translate?: (key: string) => string | undefined): string;
|
|
4
13
|
/** Only structured failure identities cross into UI copy. Never echo server/error text. */
|
|
5
14
|
export declare function authFailure(raw: unknown, operation?: AuthOperation, translate?: (key: string) => string | undefined): {
|
|
@@ -6,6 +6,9 @@ export declare const DEFAULT_AUTH_PREFIX = "himi.wix";
|
|
|
6
6
|
export interface AuthOptions {
|
|
7
7
|
/** Override when the host registered a non-default prefix. */
|
|
8
8
|
prefix?: string;
|
|
9
|
+
/** Resolves a catalog key (`auth.feedback.*`) to the app's translation, or undefined/the key
|
|
10
|
+
* when it has none. Defaults to `@himalaya/l10n` when the worker declared the `l10n` grant. */
|
|
11
|
+
translate?: (key: string) => string | undefined;
|
|
9
12
|
}
|
|
10
13
|
/** The outcome of an auth attempt. `ok: false` always carries a showable reason. */
|
|
11
14
|
export type AuthResult = {
|
|
@@ -85,7 +85,18 @@ export interface AuthCopy {
|
|
|
85
85
|
toSignInCta?: string;
|
|
86
86
|
signOutCta?: string;
|
|
87
87
|
signedInTitle?: string;
|
|
88
|
+
/** Notice after a successful sign-in. */
|
|
89
|
+
signedInNotice?: string;
|
|
90
|
+
/** Notice after a sign-out. */
|
|
91
|
+
signedOutNotice?: string;
|
|
92
|
+
/** Notice when a sign-out left the session alive. */
|
|
93
|
+
signOutFailed?: string;
|
|
94
|
+
/** Notice when email or password is empty. */
|
|
95
|
+
missingFields?: string;
|
|
88
96
|
}
|
|
97
|
+
/** `text(key, fallback)`: the app catalog's raw entry, or `fallback` when it has none. An answer
|
|
98
|
+
* equal to the key counts as no entry (`t` answers its own key for a missing row). */
|
|
99
|
+
type AuthTextHook = (key: string, fallback: string) => string;
|
|
89
100
|
export interface AuthScreenOptions {
|
|
90
101
|
/** Where the built worker bundle is served from. */
|
|
91
102
|
bundleUrl: string;
|
|
@@ -96,6 +107,11 @@ export interface AuthScreenOptions {
|
|
|
96
107
|
/** Offer "create an account" alongside sign-in. Default true. */
|
|
97
108
|
register?: boolean;
|
|
98
109
|
copy?: AuthCopy;
|
|
110
|
+
/** Resolve copy from the app's catalog when the screen is built: `text("auth.gate.signIn", fallback)`. */
|
|
111
|
+
text?: AuthTextHook;
|
|
112
|
+
/** Extra capabilities the worker needs, e.g. `["l10n"]` so `createAuthService` can read the app
|
|
113
|
+
* catalog through `@himalaya/l10n` (its default `translate` is silent without that grant). */
|
|
114
|
+
capabilities?: string[];
|
|
99
115
|
/** Buttons shown once signed in, as { label, screenId } — e.g. back to the library. */
|
|
100
116
|
next?: Array<{
|
|
101
117
|
label: string;
|
|
@@ -130,6 +146,11 @@ export interface AuthServiceOptions {
|
|
|
130
146
|
service?: string;
|
|
131
147
|
register?: boolean;
|
|
132
148
|
copy?: AuthCopy;
|
|
149
|
+
/** Resolve copy from the app's catalog at action time: `text("auth.flow.signedInNotice", fallback)`.
|
|
150
|
+
* Defaults to the `@himalaya/l10n` bridge when the worker declared the `l10n` grant. */
|
|
151
|
+
text?: AuthTextHook;
|
|
152
|
+
/** Resolves a failure-reason key (`auth.feedback.*`); defaults to the same catalog. */
|
|
153
|
+
translate?: (key: string) => string | undefined;
|
|
133
154
|
}
|
|
134
155
|
/**
|
|
135
156
|
* The worker behind `authScreen`. An app's whole worker file is:
|
|
@@ -249,7 +249,27 @@ var copy_generated_default = {
|
|
|
249
249
|
"auth.gate.verify.title": "Verify your email",
|
|
250
250
|
"auth.gate.verify.body": "Enter the confirmation code sent to your email to finish signing in.",
|
|
251
251
|
"auth.gate.cancel": "Cancel",
|
|
252
|
-
"auth.gate.codePlaceholder": "Confirmation code"
|
|
252
|
+
"auth.gate.codePlaceholder": "Confirmation code",
|
|
253
|
+
"auth.gate.close": "Close",
|
|
254
|
+
"auth.gate.captcha.title": "Verification",
|
|
255
|
+
"auth.gate.signingIn": "Signing in\u2026",
|
|
256
|
+
"auth.gate.account.subtitle": "Sign in with your Wix account to see the sites you belong to.",
|
|
257
|
+
"auth.gate.account.failed": "Sign-in failed. Try again.",
|
|
258
|
+
"auth.gate.account.unavailable": "Signing in isn't available on this website yet.",
|
|
259
|
+
"auth.gate.account.upstreamFailed": "Wix could not confirm your account right now. Try again in a moment.",
|
|
260
|
+
"auth.gate.account.unreachable": "Could not reach the sign-in service. Check your connection and try again.",
|
|
261
|
+
"auth.feedback.notCompleted": "Sign-in did not complete. Please try again.",
|
|
262
|
+
"auth.feedback.registerNotCompleted": "We could not create that account. Try a different email.",
|
|
263
|
+
"auth.flow.registerTitle": "Create an account",
|
|
264
|
+
"auth.flow.subhead": "Memberships belong to a member account.",
|
|
265
|
+
"auth.flow.toRegister": "New here? Create an account",
|
|
266
|
+
"auth.flow.toSignIn": "Already a member? Sign In",
|
|
267
|
+
"auth.flow.signOut": "Sign out",
|
|
268
|
+
"auth.flow.signedInTitle": "You're signed in",
|
|
269
|
+
"auth.flow.signedInNotice": "Signed in.",
|
|
270
|
+
"auth.flow.signedOutNotice": "Signed out.",
|
|
271
|
+
"auth.flow.signOutFailed": "Sign-out did not complete. Try again.",
|
|
272
|
+
"auth.flow.missingFields": "Enter your email and password."
|
|
253
273
|
};
|
|
254
274
|
|
|
255
275
|
// ../../stdlib/flows/auth/src/feedback.ts
|
|
@@ -296,9 +316,24 @@ var aliases = {
|
|
|
296
316
|
};
|
|
297
317
|
var iamCredentialCodes = /* @__PURE__ */ new Set(["-19999", "-19976"]);
|
|
298
318
|
var iamEmailInUseCode = "-19995";
|
|
319
|
+
function authDefault(key) {
|
|
320
|
+
return copy_generated_default[key] ?? "";
|
|
321
|
+
}
|
|
322
|
+
function l10nTranslate(key) {
|
|
323
|
+
try {
|
|
324
|
+
const caps = globalThis.himalaya?.capabilities;
|
|
325
|
+
if (!Array.isArray(caps) || !caps.includes("l10n")) return void 0;
|
|
326
|
+
const lookup = "__himalaya_l10n" in globalThis ? globalThis.__himalaya_l10n : void 0;
|
|
327
|
+
if (typeof lookup !== "function") return void 0;
|
|
328
|
+
const data = JSON.parse(lookup(key));
|
|
329
|
+
return !data || typeof data !== "object" || data.error || typeof data.message !== "string" || !data.message ? void 0 : data.message;
|
|
330
|
+
} catch {
|
|
331
|
+
return void 0;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
299
334
|
function authMessage(key, translate) {
|
|
300
|
-
const translated = translate
|
|
301
|
-
return translated && translated !== key ? translated :
|
|
335
|
+
const translated = (translate ?? l10nTranslate)(key);
|
|
336
|
+
return translated && translated !== key ? translated : authDefault(key) || authDefault("auth.feedback.unknown");
|
|
302
337
|
}
|
|
303
338
|
function authFailure(raw, operation = "signIn", translate) {
|
|
304
339
|
const value = raw && typeof raw === "object" ? raw : {};
|
|
@@ -334,7 +369,7 @@ function identityErrors(input, operation, requireName = false) {
|
|
|
334
369
|
// ../../stdlib/flows/auth/src/index.ts
|
|
335
370
|
async function dispatch(handlerId, params) {
|
|
336
371
|
const fn = globalThis.himalaya?.dispatch;
|
|
337
|
-
if (!fn) throw new Error("
|
|
372
|
+
if (!fn) throw new Error("auth_dispatch_bridge_missing");
|
|
338
373
|
return await fn(handlerId, params);
|
|
339
374
|
}
|
|
340
375
|
var DEFAULT_AUTH_PREFIX = "himi.wix";
|
|
@@ -363,37 +398,37 @@ async function authState(opts) {
|
|
|
363
398
|
async function signedInEmail(opts) {
|
|
364
399
|
return (await authState(opts)).email;
|
|
365
400
|
}
|
|
366
|
-
async function attempt(action, params,
|
|
401
|
+
async function attempt(action, params, failureKey, opts) {
|
|
367
402
|
let raw;
|
|
368
403
|
try {
|
|
369
404
|
raw = await dispatch(id(opts, action), params);
|
|
370
405
|
} catch (e) {
|
|
371
|
-
return { ok: false, ...authFailure(e, action === "registerDirect" ? "register" : "signIn") };
|
|
406
|
+
return { ok: false, ...authFailure(e, action === "registerDirect" ? "register" : "signIn", opts?.translate) };
|
|
372
407
|
}
|
|
373
|
-
if (!reportedOk(raw) || raw?.error || raw?.payload?.error) return { ok: false, ...authFailure(raw, action === "registerDirect" ? "register" : "signIn") };
|
|
408
|
+
if (!reportedOk(raw) || raw?.error || raw?.payload?.error) return { ok: false, ...authFailure(raw, action === "registerDirect" ? "register" : "signIn", opts?.translate) };
|
|
374
409
|
const state = await authState(opts);
|
|
375
410
|
if (!state.signedIn) {
|
|
376
|
-
return { ok: false, reason:
|
|
411
|
+
return { ok: false, reason: authMessage(failureKey, opts?.translate) };
|
|
377
412
|
}
|
|
378
413
|
return { ok: true, email: state.email };
|
|
379
414
|
}
|
|
380
415
|
function signInDirect(email, password, opts) {
|
|
381
416
|
if (Object.keys(identityErrors({ email: email.trim(), password }, "signIn")).length) {
|
|
382
|
-
return Promise.resolve({ ok: false, code: "invalid_input", reason: authMessage("auth.feedback.invalid_input") });
|
|
417
|
+
return Promise.resolve({ ok: false, code: "invalid_input", reason: authMessage("auth.feedback.invalid_input", opts?.translate) });
|
|
383
418
|
}
|
|
384
419
|
return attempt(
|
|
385
420
|
"signInDirect",
|
|
386
421
|
{ email: email.trim(), password },
|
|
387
|
-
"
|
|
422
|
+
"auth.feedback.notCompleted",
|
|
388
423
|
opts
|
|
389
424
|
);
|
|
390
425
|
}
|
|
391
426
|
function signIn(opts) {
|
|
392
|
-
return attempt("signIn", {}, "
|
|
427
|
+
return attempt("signIn", {}, "auth.feedback.notCompleted", opts);
|
|
393
428
|
}
|
|
394
429
|
function registerMember(email, password, profile, opts) {
|
|
395
430
|
if (Object.keys(identityErrors({ email: email.trim(), password }, "register")).length) {
|
|
396
|
-
return Promise.resolve({ ok: false, code: "invalid_input", reason: authMessage("auth.feedback.invalid_input") });
|
|
431
|
+
return Promise.resolve({ ok: false, code: "invalid_input", reason: authMessage("auth.feedback.invalid_input", opts?.translate) });
|
|
397
432
|
}
|
|
398
433
|
return attempt(
|
|
399
434
|
"registerDirect",
|
|
@@ -403,22 +438,22 @@ function registerMember(email, password, profile, opts) {
|
|
|
403
438
|
...profile?.firstName ? { firstName: profile.firstName } : {},
|
|
404
439
|
...profile?.lastName ? { lastName: profile.lastName } : {}
|
|
405
440
|
},
|
|
406
|
-
"
|
|
441
|
+
"auth.feedback.registerNotCompleted",
|
|
407
442
|
opts
|
|
408
443
|
);
|
|
409
444
|
}
|
|
410
445
|
async function resetPassword(email, opts) {
|
|
411
446
|
const errors = identityErrors({ email }, "reset");
|
|
412
|
-
if (errors.email) return { ok: false, code: "invalid_input", reason: authMessage(errors.email) };
|
|
447
|
+
if (errors.email) return { ok: false, code: "invalid_input", reason: authMessage(errors.email, opts?.translate) };
|
|
413
448
|
email = email.trim();
|
|
414
449
|
try {
|
|
415
450
|
const raw = await dispatch(id(opts, "resetPassword"), { email });
|
|
416
451
|
if (!reportedOk(raw) || raw?.error || raw?.payload?.error) {
|
|
417
|
-
return { ok: false, ...authFailure(raw, "reset") };
|
|
452
|
+
return { ok: false, ...authFailure(raw, "reset", opts?.translate) };
|
|
418
453
|
}
|
|
419
454
|
return { ok: true, email };
|
|
420
455
|
} catch (e) {
|
|
421
|
-
return { ok: false, ...authFailure(e, "reset") };
|
|
456
|
+
return { ok: false, ...authFailure(e, "reset", opts?.translate) };
|
|
422
457
|
}
|
|
423
458
|
}
|
|
424
459
|
async function signOut(opts) {
|
|
@@ -430,10 +465,12 @@ async function signOut(opts) {
|
|
|
430
465
|
}
|
|
431
466
|
export {
|
|
432
467
|
DEFAULT_AUTH_PREFIX,
|
|
468
|
+
authDefault,
|
|
433
469
|
authFailure,
|
|
434
470
|
authMessage,
|
|
435
471
|
authState,
|
|
436
472
|
identityErrors,
|
|
473
|
+
l10nTranslate,
|
|
437
474
|
registerMember,
|
|
438
475
|
resetPassword,
|
|
439
476
|
signIn,
|
|
@@ -2046,7 +2046,27 @@ var copy_generated_default = {
|
|
|
2046
2046
|
"auth.gate.verify.title": "Verify your email",
|
|
2047
2047
|
"auth.gate.verify.body": "Enter the confirmation code sent to your email to finish signing in.",
|
|
2048
2048
|
"auth.gate.cancel": "Cancel",
|
|
2049
|
-
"auth.gate.codePlaceholder": "Confirmation code"
|
|
2049
|
+
"auth.gate.codePlaceholder": "Confirmation code",
|
|
2050
|
+
"auth.gate.close": "Close",
|
|
2051
|
+
"auth.gate.captcha.title": "Verification",
|
|
2052
|
+
"auth.gate.signingIn": "Signing in\u2026",
|
|
2053
|
+
"auth.gate.account.subtitle": "Sign in with your Wix account to see the sites you belong to.",
|
|
2054
|
+
"auth.gate.account.failed": "Sign-in failed. Try again.",
|
|
2055
|
+
"auth.gate.account.unavailable": "Signing in isn't available on this website yet.",
|
|
2056
|
+
"auth.gate.account.upstreamFailed": "Wix could not confirm your account right now. Try again in a moment.",
|
|
2057
|
+
"auth.gate.account.unreachable": "Could not reach the sign-in service. Check your connection and try again.",
|
|
2058
|
+
"auth.feedback.notCompleted": "Sign-in did not complete. Please try again.",
|
|
2059
|
+
"auth.feedback.registerNotCompleted": "We could not create that account. Try a different email.",
|
|
2060
|
+
"auth.flow.registerTitle": "Create an account",
|
|
2061
|
+
"auth.flow.subhead": "Memberships belong to a member account.",
|
|
2062
|
+
"auth.flow.toRegister": "New here? Create an account",
|
|
2063
|
+
"auth.flow.toSignIn": "Already a member? Sign In",
|
|
2064
|
+
"auth.flow.signOut": "Sign out",
|
|
2065
|
+
"auth.flow.signedInTitle": "You're signed in",
|
|
2066
|
+
"auth.flow.signedInNotice": "Signed in.",
|
|
2067
|
+
"auth.flow.signedOutNotice": "Signed out.",
|
|
2068
|
+
"auth.flow.signOutFailed": "Sign-out did not complete. Try again.",
|
|
2069
|
+
"auth.flow.missingFields": "Enter your email and password."
|
|
2050
2070
|
};
|
|
2051
2071
|
|
|
2052
2072
|
// ../../stdlib/flows/auth/src/feedback.ts
|
|
@@ -2093,9 +2113,24 @@ var aliases = {
|
|
|
2093
2113
|
};
|
|
2094
2114
|
var iamCredentialCodes = /* @__PURE__ */ new Set(["-19999", "-19976"]);
|
|
2095
2115
|
var iamEmailInUseCode = "-19995";
|
|
2116
|
+
function authDefault(key) {
|
|
2117
|
+
return copy_generated_default[key] ?? "";
|
|
2118
|
+
}
|
|
2119
|
+
function l10nTranslate(key) {
|
|
2120
|
+
try {
|
|
2121
|
+
const caps = globalThis.himalaya?.capabilities;
|
|
2122
|
+
if (!Array.isArray(caps) || !caps.includes("l10n")) return void 0;
|
|
2123
|
+
const lookup = "__himalaya_l10n" in globalThis ? globalThis.__himalaya_l10n : void 0;
|
|
2124
|
+
if (typeof lookup !== "function") return void 0;
|
|
2125
|
+
const data = JSON.parse(lookup(key));
|
|
2126
|
+
return !data || typeof data !== "object" || data.error || typeof data.message !== "string" || !data.message ? void 0 : data.message;
|
|
2127
|
+
} catch {
|
|
2128
|
+
return void 0;
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2096
2131
|
function authMessage(key, translate) {
|
|
2097
|
-
const translated = translate
|
|
2098
|
-
return translated && translated !== key ? translated :
|
|
2132
|
+
const translated = (translate ?? l10nTranslate)(key);
|
|
2133
|
+
return translated && translated !== key ? translated : authDefault(key) || authDefault("auth.feedback.unknown");
|
|
2099
2134
|
}
|
|
2100
2135
|
function authFailure(raw, operation = "signIn", translate) {
|
|
2101
2136
|
const value = raw && typeof raw === "object" ? raw : {};
|
|
@@ -2131,7 +2166,7 @@ function identityErrors(input, operation, requireName = false) {
|
|
|
2131
2166
|
// ../../stdlib/flows/auth/src/index.ts
|
|
2132
2167
|
async function dispatch2(handlerId, params) {
|
|
2133
2168
|
const fn = globalThis.himalaya?.dispatch;
|
|
2134
|
-
if (!fn) throw new Error("
|
|
2169
|
+
if (!fn) throw new Error("auth_dispatch_bridge_missing");
|
|
2135
2170
|
return await fn(handlerId, params);
|
|
2136
2171
|
}
|
|
2137
2172
|
var DEFAULT_AUTH_PREFIX = "himi.wix";
|
|
@@ -2157,34 +2192,34 @@ async function authState(opts) {
|
|
|
2157
2192
|
return { signedIn: false, email: "" };
|
|
2158
2193
|
}
|
|
2159
2194
|
}
|
|
2160
|
-
async function attempt(action2, params,
|
|
2195
|
+
async function attempt(action2, params, failureKey, opts) {
|
|
2161
2196
|
let raw;
|
|
2162
2197
|
try {
|
|
2163
2198
|
raw = await dispatch2(id(opts, action2), params);
|
|
2164
2199
|
} catch (e) {
|
|
2165
|
-
return { ok: false, ...authFailure(e, action2 === "registerDirect" ? "register" : "signIn") };
|
|
2200
|
+
return { ok: false, ...authFailure(e, action2 === "registerDirect" ? "register" : "signIn", opts?.translate) };
|
|
2166
2201
|
}
|
|
2167
|
-
if (!reportedOk(raw) || raw?.error || raw?.payload?.error) return { ok: false, ...authFailure(raw, action2 === "registerDirect" ? "register" : "signIn") };
|
|
2202
|
+
if (!reportedOk(raw) || raw?.error || raw?.payload?.error) return { ok: false, ...authFailure(raw, action2 === "registerDirect" ? "register" : "signIn", opts?.translate) };
|
|
2168
2203
|
const state = await authState(opts);
|
|
2169
2204
|
if (!state.signedIn) {
|
|
2170
|
-
return { ok: false, reason:
|
|
2205
|
+
return { ok: false, reason: authMessage(failureKey, opts?.translate) };
|
|
2171
2206
|
}
|
|
2172
2207
|
return { ok: true, email: state.email };
|
|
2173
2208
|
}
|
|
2174
2209
|
function signInDirect(email, password, opts) {
|
|
2175
2210
|
if (Object.keys(identityErrors({ email: email.trim(), password }, "signIn")).length) {
|
|
2176
|
-
return Promise.resolve({ ok: false, code: "invalid_input", reason: authMessage("auth.feedback.invalid_input") });
|
|
2211
|
+
return Promise.resolve({ ok: false, code: "invalid_input", reason: authMessage("auth.feedback.invalid_input", opts?.translate) });
|
|
2177
2212
|
}
|
|
2178
2213
|
return attempt(
|
|
2179
2214
|
"signInDirect",
|
|
2180
2215
|
{ email: email.trim(), password },
|
|
2181
|
-
"
|
|
2216
|
+
"auth.feedback.notCompleted",
|
|
2182
2217
|
opts
|
|
2183
2218
|
);
|
|
2184
2219
|
}
|
|
2185
2220
|
function registerMember(email, password, profile, opts) {
|
|
2186
2221
|
if (Object.keys(identityErrors({ email: email.trim(), password }, "register")).length) {
|
|
2187
|
-
return Promise.resolve({ ok: false, code: "invalid_input", reason: authMessage("auth.feedback.invalid_input") });
|
|
2222
|
+
return Promise.resolve({ ok: false, code: "invalid_input", reason: authMessage("auth.feedback.invalid_input", opts?.translate) });
|
|
2188
2223
|
}
|
|
2189
2224
|
return attempt(
|
|
2190
2225
|
"registerDirect",
|
|
@@ -2194,7 +2229,7 @@ function registerMember(email, password, profile, opts) {
|
|
|
2194
2229
|
...profile?.firstName ? { firstName: profile.firstName } : {},
|
|
2195
2230
|
...profile?.lastName ? { lastName: profile.lastName } : {}
|
|
2196
2231
|
},
|
|
2197
|
-
"
|
|
2232
|
+
"auth.feedback.registerNotCompleted",
|
|
2198
2233
|
opts
|
|
2199
2234
|
);
|
|
2200
2235
|
}
|
|
@@ -7073,10 +7108,35 @@ function envelope(screenId, title, root, logic) {
|
|
|
7073
7108
|
payload: { id: "root", body: root.body }
|
|
7074
7109
|
};
|
|
7075
7110
|
}
|
|
7111
|
+
var AUTH_COPY_KEYS = {
|
|
7112
|
+
signInTitle: "auth.gate.signIn",
|
|
7113
|
+
registerTitle: "auth.flow.registerTitle",
|
|
7114
|
+
subhead: "auth.flow.subhead",
|
|
7115
|
+
emailLabel: "auth.gate.field.email",
|
|
7116
|
+
passwordLabel: "auth.gate.field.password",
|
|
7117
|
+
signInCta: "auth.gate.signIn",
|
|
7118
|
+
registerCta: "auth.gate.createAccount",
|
|
7119
|
+
toRegisterCta: "auth.flow.toRegister",
|
|
7120
|
+
toSignInCta: "auth.flow.toSignIn",
|
|
7121
|
+
signOutCta: "auth.flow.signOut",
|
|
7122
|
+
signedInTitle: "auth.flow.signedInTitle",
|
|
7123
|
+
signedInNotice: "auth.flow.signedInNotice",
|
|
7124
|
+
signedOutNotice: "auth.flow.signedOutNotice",
|
|
7125
|
+
signOutFailed: "auth.flow.signOutFailed",
|
|
7126
|
+
missingFields: "auth.flow.missingFields"
|
|
7127
|
+
};
|
|
7128
|
+
function authCopyText(c, text2, field) {
|
|
7129
|
+
const key = AUTH_COPY_KEYS[field];
|
|
7130
|
+
if (c[field] !== void 0) return c[field];
|
|
7131
|
+
const base = authDefault(key);
|
|
7132
|
+
const v = text2 ? text2(key, base) : l10nTranslate(key);
|
|
7133
|
+
return typeof v === "string" && v !== "" && v !== key ? v : base;
|
|
7134
|
+
}
|
|
7076
7135
|
function authScreen(opts) {
|
|
7077
7136
|
const s2 = opts.service ?? "signin";
|
|
7078
7137
|
const screenId = opts.screenId ?? "signin";
|
|
7079
7138
|
const c = opts.copy ?? {};
|
|
7139
|
+
const copyOf = (field2) => authCopyText(c, opts.text, field2);
|
|
7080
7140
|
const withRegister = opts.register !== false;
|
|
7081
7141
|
const field = (key, label, action2, extra = {}) => node4(`${s2}.${key}`, "TextField", {
|
|
7082
7142
|
label,
|
|
@@ -7090,11 +7150,11 @@ function authScreen(opts) {
|
|
|
7090
7150
|
text(`${s2}.subhead`, `$service:${s2}.subhead`),
|
|
7091
7151
|
hideWhen(text(`${s2}.notice`, `$service:${s2}.notice`, "bodyEmphasis"), `$service:${s2}.noNotice`),
|
|
7092
7152
|
hideWhen(
|
|
7093
|
-
field("email",
|
|
7153
|
+
field("email", copyOf("emailLabel"), `tier5.${s2}.setEmail`, { keyboard: "email" }),
|
|
7094
7154
|
`$service:${s2}.signedIn`
|
|
7095
7155
|
),
|
|
7096
7156
|
hideWhen(
|
|
7097
|
-
field("password",
|
|
7157
|
+
field("password", copyOf("passwordLabel"), `tier5.${s2}.setPassword`, { secure: true }),
|
|
7098
7158
|
`$service:${s2}.signedIn`
|
|
7099
7159
|
),
|
|
7100
7160
|
hideWhen(
|
|
@@ -7131,7 +7191,7 @@ function authScreen(opts) {
|
|
|
7131
7191
|
children.push(
|
|
7132
7192
|
hideWhen(
|
|
7133
7193
|
node4(`${s2}.signout`, "Button", {
|
|
7134
|
-
title:
|
|
7194
|
+
title: copyOf("signOutCta"),
|
|
7135
7195
|
style: "secondary",
|
|
7136
7196
|
fullWidth: true,
|
|
7137
7197
|
action: { actionId: `tier5.${s2}.signOut` }
|
|
@@ -7139,22 +7199,27 @@ function authScreen(opts) {
|
|
|
7139
7199
|
`$service:${s2}.notSignedIn`
|
|
7140
7200
|
)
|
|
7141
7201
|
);
|
|
7142
|
-
return envelope(screenId, opts.title ?? "
|
|
7202
|
+
return envelope(screenId, opts.title ?? copyOf("signInTitle"), vstack(`${s2}.root`, children, 14), {
|
|
7143
7203
|
url: opts.bundleUrl,
|
|
7144
|
-
caps: ["wix_api"]
|
|
7204
|
+
caps: [.../* @__PURE__ */ new Set(["wix_api", ...opts.capabilities ?? []])]
|
|
7145
7205
|
});
|
|
7146
7206
|
}
|
|
7147
7207
|
function createAuthService(opts = {}) {
|
|
7148
7208
|
const c = opts.copy ?? {};
|
|
7209
|
+
const copyOf = (field) => authCopyText(c, opts.text, field);
|
|
7210
|
+
const translate = opts.translate ?? (opts.text ? (key) => {
|
|
7211
|
+
const v = opts.text(key, "");
|
|
7212
|
+
return v === "" ? void 0 : v;
|
|
7213
|
+
} : void 0);
|
|
7149
7214
|
const withRegister = opts.register !== false;
|
|
7150
7215
|
const name = opts.service ?? "signin";
|
|
7151
7216
|
const forMode = (s2, mode) => ({
|
|
7152
7217
|
...s2,
|
|
7153
7218
|
mode,
|
|
7154
|
-
headline: mode === "signIn" ?
|
|
7155
|
-
subhead:
|
|
7156
|
-
submitCta: mode === "signIn" ?
|
|
7157
|
-
switchCta: mode === "signIn" ?
|
|
7219
|
+
headline: mode === "signIn" ? copyOf("signInTitle") : copyOf("registerTitle"),
|
|
7220
|
+
subhead: copyOf("subhead"),
|
|
7221
|
+
submitCta: mode === "signIn" ? copyOf("signInCta") : copyOf("registerCta"),
|
|
7222
|
+
switchCta: mode === "signIn" ? copyOf("toRegisterCta") : copyOf("toSignInCta")
|
|
7158
7223
|
});
|
|
7159
7224
|
const BASE = forMode(
|
|
7160
7225
|
{
|
|
@@ -7175,20 +7240,20 @@ function createAuthService(opts = {}) {
|
|
|
7175
7240
|
},
|
|
7176
7241
|
"signIn"
|
|
7177
7242
|
);
|
|
7178
|
-
const failureText = (mode) => mode === "signIn" ? "
|
|
7243
|
+
const failureText = (mode) => authMessage(mode === "signIn" ? "auth.feedback.notCompleted" : "auth.feedback.registerNotCompleted", translate);
|
|
7179
7244
|
const svc = defineService(name, {
|
|
7180
7245
|
state: BASE,
|
|
7181
7246
|
actions: {
|
|
7182
7247
|
/** Reflect an existing session so a returning member is not asked twice. */
|
|
7183
7248
|
load: async (s2) => {
|
|
7184
7249
|
const who = await authState();
|
|
7185
|
-
if (!who.signedIn) return s2;
|
|
7250
|
+
if (!who.signedIn) return forMode(s2, s2.mode);
|
|
7186
7251
|
return {
|
|
7187
7252
|
...s2,
|
|
7188
7253
|
signedIn: true,
|
|
7189
7254
|
notSignedIn: false,
|
|
7190
7255
|
signedInEmail: who.email,
|
|
7191
|
-
headline:
|
|
7256
|
+
headline: copyOf("signedInTitle"),
|
|
7192
7257
|
subhead: who.email
|
|
7193
7258
|
};
|
|
7194
7259
|
},
|
|
@@ -7198,10 +7263,10 @@ function createAuthService(opts = {}) {
|
|
|
7198
7263
|
submit: async (s2) => {
|
|
7199
7264
|
const email = s2.email.trim();
|
|
7200
7265
|
if (!email || !s2.password) {
|
|
7201
|
-
return { ...s2, notice: "
|
|
7266
|
+
return { ...s2, notice: copyOf("missingFields"), noNotice: false };
|
|
7202
7267
|
}
|
|
7203
7268
|
const busy = { ...s2, busy: true, notBusy: false, notice: "", noNotice: true };
|
|
7204
|
-
const r = s2.mode === "signIn" ? await signInDirect(email, s2.password) : await registerMember(email, s2.password);
|
|
7269
|
+
const r = s2.mode === "signIn" ? await signInDirect(email, s2.password, { translate }) : await registerMember(email, s2.password, void 0, { translate });
|
|
7205
7270
|
if (!r.ok) {
|
|
7206
7271
|
return {
|
|
7207
7272
|
...busy,
|
|
@@ -7220,9 +7285,9 @@ function createAuthService(opts = {}) {
|
|
|
7220
7285
|
signedIn: true,
|
|
7221
7286
|
notSignedIn: false,
|
|
7222
7287
|
signedInEmail: r.email,
|
|
7223
|
-
headline:
|
|
7288
|
+
headline: copyOf("signedInTitle"),
|
|
7224
7289
|
subhead: r.email,
|
|
7225
|
-
notice: "
|
|
7290
|
+
notice: copyOf("signedInNotice"),
|
|
7226
7291
|
noNotice: false
|
|
7227
7292
|
};
|
|
7228
7293
|
},
|
|
@@ -7230,7 +7295,7 @@ function createAuthService(opts = {}) {
|
|
|
7230
7295
|
const gone = await signOut();
|
|
7231
7296
|
return {
|
|
7232
7297
|
...forMode({ ...BASE }, "signIn"),
|
|
7233
|
-
notice: gone ? "
|
|
7298
|
+
notice: gone ? copyOf("signedOutNotice") : copyOf("signOutFailed"),
|
|
7234
7299
|
noNotice: false
|
|
7235
7300
|
};
|
|
7236
7301
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"files": [
|
|
3
3
|
{
|
|
4
4
|
"name": "sw.js",
|
|
5
|
-
"bytes":
|
|
5
|
+
"bytes": 2710238
|
|
6
6
|
},
|
|
7
7
|
{
|
|
8
8
|
"name": "host.html",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"bytes": 24320
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"name": "preview-deferred/
|
|
24
|
+
"name": "preview-deferred/7c8b32af7572e93ce52c2bc81b8d0bf5525f6e66531f934dac68d4507a6e3026.bin",
|
|
25
25
|
"bytes": 488215
|
|
26
26
|
},
|
|
27
27
|
{
|
|
@@ -79,10 +79,10 @@
|
|
|
79
79
|
],
|
|
80
80
|
"deferred": [
|
|
81
81
|
{
|
|
82
|
-
"key": "assets/pdf-
|
|
82
|
+
"key": "assets/pdf-DSvwNIUw.js",
|
|
83
83
|
"contentType": "application/javascript; charset=utf-8",
|
|
84
|
-
"sha256": "
|
|
85
|
-
"file": "preview-deferred/
|
|
84
|
+
"sha256": "7c8b32af7572e93ce52c2bc81b8d0bf5525f6e66531f934dac68d4507a6e3026",
|
|
85
|
+
"file": "preview-deferred/7c8b32af7572e93ce52c2bc81b8d0bf5525f6e66531f934dac68d4507a6e3026.bin"
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
"key": "assets/pdf.worker.min-BGnVRhRG.js",
|