@kerne/react 0.1.2 → 0.1.3
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/{chunk-3PROPZWW.cjs → chunk-7U3QBMA7.cjs} +34 -13
- package/dist/{chunk-AIUIBAYB.js → chunk-F6NV76OR.js} +23 -2
- package/dist/{i18n-Qketn1RF.d.cts → i18n-BWTT1DWD.d.cts} +16 -0
- package/dist/{i18n-Qketn1RF.d.ts → i18n-BWTT1DWD.d.ts} +16 -0
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +1 -1
- package/dist/ui/index.cjs +470 -186
- package/dist/ui/index.d.cts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +418 -134
- package/package.json +3 -3
package/dist/ui/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunk7U3QBMA7cjs = require('../chunk-7U3QBMA7.cjs');
|
|
20
20
|
|
|
21
21
|
// src/ui/AuthFlow.tsx
|
|
22
22
|
var _react = require('react');
|
|
@@ -53,6 +53,7 @@ var DARK_TOKENS = `
|
|
|
53
53
|
--kerne-panel: #1b1f26;
|
|
54
54
|
--kerne-surface: #14171c;
|
|
55
55
|
--kerne-surface-raised: #2a2f38;
|
|
56
|
+
--kerne-track: #313743;
|
|
56
57
|
--kerne-primary: #f0f1f3;
|
|
57
58
|
--kerne-primary-fg: #16181d;
|
|
58
59
|
--kerne-primary-hover: #d8dade;
|
|
@@ -81,6 +82,11 @@ var CSS = `
|
|
|
81
82
|
variant, the dropdown floating over host content, a pressed segment. */
|
|
82
83
|
--kerne-surface: #ffffff;
|
|
83
84
|
--kerne-surface-raised: #ffffff;
|
|
85
|
+
/* Unfilled part of a meter, and the ground of a disabled button. Distinct
|
|
86
|
+
from --kerne-panel, which is tuned to sit on the page: on a card the two
|
|
87
|
+
are nearly the same colour, so a meter drawn in panel had invisible empty
|
|
88
|
+
segments and read as having fewer steps than it has. */
|
|
89
|
+
--kerne-track: #e3e5e9;
|
|
84
90
|
--kerne-primary: #16171a;
|
|
85
91
|
--kerne-primary-fg: #ffffff;
|
|
86
92
|
--kerne-primary-hover: #2c2e33;
|
|
@@ -226,6 +232,18 @@ var CSS = `
|
|
|
226
232
|
}
|
|
227
233
|
.kerne-subtitle { margin: 0; font-size: 14px; color: var(--kerne-fg-muted); line-height: 1.5; }
|
|
228
234
|
|
|
235
|
+
/* Moving between steps (sign-in -> sign-up -> forgot password) used to be an
|
|
236
|
+
instant swap: the content and the height both jumped at once, which reads
|
|
237
|
+
as a page reload rather than one flow. */
|
|
238
|
+
@keyframes kerne-step-in {
|
|
239
|
+
from { opacity: 0; transform: translateY(4px); }
|
|
240
|
+
to { opacity: 1; transform: none; }
|
|
241
|
+
}
|
|
242
|
+
.kerne-step { animation: kerne-step-in .18s ease-out; }
|
|
243
|
+
@media (prefers-reduced-motion: reduce) {
|
|
244
|
+
.kerne-step { animation: none; }
|
|
245
|
+
}
|
|
246
|
+
|
|
229
247
|
/* ---------- Stack ---------- */
|
|
230
248
|
.kerne-stack { display: flex; flex-direction: column; gap: 16px; }
|
|
231
249
|
.kerne-form { display: flex; flex-direction: column; gap: 12px; }
|
|
@@ -233,6 +251,9 @@ var CSS = `
|
|
|
233
251
|
.kerne-label { font-size: 14px; font-weight: 500; color: var(--kerne-fg); }
|
|
234
252
|
.kerne-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
|
|
235
253
|
|
|
254
|
+
/* Positioning context for the reveal toggle, which sits inside the input box. */
|
|
255
|
+
.kerne-control { position: relative; display: flex; }
|
|
256
|
+
|
|
236
257
|
.kerne-input {
|
|
237
258
|
font: inherit;
|
|
238
259
|
font-size: 14px;
|
|
@@ -245,6 +266,57 @@ var CSS = `
|
|
|
245
266
|
width: 100%;
|
|
246
267
|
transition: border-color .12s ease, box-shadow .12s ease;
|
|
247
268
|
}
|
|
269
|
+
/* Room for the toggle, so a long password never runs underneath it. */
|
|
270
|
+
.kerne-input[data-kerne-reveal="true"] { padding-right: 42px; }
|
|
271
|
+
|
|
272
|
+
.kerne-reveal {
|
|
273
|
+
position: absolute;
|
|
274
|
+
top: 0; right: 0; bottom: 0;
|
|
275
|
+
width: 40px;
|
|
276
|
+
display: flex; align-items: center; justify-content: center;
|
|
277
|
+
background: none; border: none; padding: 0; cursor: pointer;
|
|
278
|
+
color: var(--kerne-fg-subtle);
|
|
279
|
+
border-radius: var(--kerne-radius);
|
|
280
|
+
transition: color .12s ease;
|
|
281
|
+
}
|
|
282
|
+
.kerne-reveal:hover:not(:disabled) { color: var(--kerne-fg); }
|
|
283
|
+
.kerne-reveal:disabled { cursor: not-allowed; opacity: .5; }
|
|
284
|
+
.kerne-reveal:focus-visible { outline: 2px solid var(--kerne-accent); outline-offset: -2px; }
|
|
285
|
+
|
|
286
|
+
.kerne-field-note { font-size: 12.5px; line-height: 1.4; color: var(--kerne-fg-muted); margin: 0; }
|
|
287
|
+
.kerne-field-error { font-size: 12.5px; line-height: 1.4; color: var(--kerne-danger); margin: 0; }
|
|
288
|
+
/* Caps Lock is a "you are about to get this wrong" signal, not background
|
|
289
|
+
guidance - in muted grey it sat at the same weight as a hint and got read
|
|
290
|
+
as one. */
|
|
291
|
+
.kerne-field-note[data-kerne-warn="true"] { color: var(--kerne-warning); }
|
|
292
|
+
|
|
293
|
+
/* ---------- Password rules ---------- */
|
|
294
|
+
/* Unmet stays at hint weight rather than turning red: nothing is wrong yet,
|
|
295
|
+
the user is still typing. Only the tick earns a color. */
|
|
296
|
+
.kerne-rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
|
|
297
|
+
.kerne-rule {
|
|
298
|
+
display: flex; align-items: center; gap: 6px;
|
|
299
|
+
font-size: 12.5px; line-height: 1.4; color: var(--kerne-fg-muted);
|
|
300
|
+
}
|
|
301
|
+
.kerne-rule[data-met] { color: var(--kerne-success); }
|
|
302
|
+
|
|
303
|
+
/* ---------- Password strength ---------- */
|
|
304
|
+
.kerne-strength { display: flex; flex-direction: column; gap: 5px; }
|
|
305
|
+
.kerne-strength-track { display: flex; gap: 4px; }
|
|
306
|
+
.kerne-strength-step {
|
|
307
|
+
flex: 1; height: 3px; border-radius: 999px;
|
|
308
|
+
background: var(--kerne-track);
|
|
309
|
+
transition: background-color .18s ease;
|
|
310
|
+
}
|
|
311
|
+
.kerne-strength-label { font-size: 12px; color: var(--kerne-fg-muted); }
|
|
312
|
+
.kerne-strength[data-score="0"] .kerne-strength-step[data-on],
|
|
313
|
+
.kerne-strength[data-score="1"] .kerne-strength-step[data-on] { background: var(--kerne-danger); }
|
|
314
|
+
.kerne-strength[data-score="2"] .kerne-strength-step[data-on] { background: var(--kerne-warning); }
|
|
315
|
+
.kerne-strength[data-score="3"] .kerne-strength-step[data-on],
|
|
316
|
+
.kerne-strength[data-score="4"] .kerne-strength-step[data-on] { background: var(--kerne-success); }
|
|
317
|
+
@media (prefers-reduced-motion: reduce) {
|
|
318
|
+
.kerne-strength-step { transition: none; }
|
|
319
|
+
}
|
|
248
320
|
.kerne-input::placeholder { color: var(--kerne-fg-subtle); }
|
|
249
321
|
.kerne-input:hover:not(:disabled):not(:focus) { border-color: var(--kerne-fg-subtle); }
|
|
250
322
|
.kerne-input:focus {
|
|
@@ -279,6 +351,20 @@ var CSS = `
|
|
|
279
351
|
}
|
|
280
352
|
.kerne-button:focus-visible { outline: 2px solid var(--kerne-accent); outline-offset: 2px; }
|
|
281
353
|
.kerne-button:disabled { opacity: .5; cursor: not-allowed; }
|
|
354
|
+
/* A disabled primary drops the brand entirely rather than wearing it at half
|
|
355
|
+
opacity: on a dark theme the light primary faded into an opaque grey slab
|
|
356
|
+
that read as an enabled button, and a brand colour has no business marking
|
|
357
|
+
an action you cannot take. Loading is excluded - it is still the real
|
|
358
|
+
button, just busy. */
|
|
359
|
+
.kerne-button-primary:disabled:not([data-kerne-loading="true"]) {
|
|
360
|
+
opacity: 1;
|
|
361
|
+
background: var(--kerne-track);
|
|
362
|
+
color: var(--kerne-fg-subtle);
|
|
363
|
+
}
|
|
364
|
+
/* A button mid-request is busy, not unavailable - dimming it to the disabled
|
|
365
|
+
opacity reads as "this stopped working". */
|
|
366
|
+
.kerne-button[data-kerne-loading="true"] { opacity: 1; cursor: progress; }
|
|
367
|
+
.kerne-button .kerne-spinner { width: 15px; height: 15px; border-width: 2px; }
|
|
282
368
|
.kerne-button-primary { background: var(--kerne-primary); color: var(--kerne-primary-fg); }
|
|
283
369
|
.kerne-button-primary:hover:not(:disabled) { background: var(--kerne-primary-hover); }
|
|
284
370
|
.kerne-button-outline {
|
|
@@ -417,7 +503,7 @@ var CSS = `
|
|
|
417
503
|
/* Digits line up between rows instead of jittering as counts change. */
|
|
418
504
|
font-variant-numeric: tabular-nums;
|
|
419
505
|
}
|
|
420
|
-
.kerne-meter-track { height: 6px; border-radius: 999px; background: var(--kerne-
|
|
506
|
+
.kerne-meter-track { height: 6px; border-radius: 999px; background: var(--kerne-track); overflow: hidden; }
|
|
421
507
|
.kerne-meter-fill { height: 100%; border-radius: 999px; background: var(--kerne-fg); transition: width .3s ease; }
|
|
422
508
|
.kerne-meter[data-level="warning"] .kerne-meter-fill { background: var(--kerne-warning); }
|
|
423
509
|
.kerne-meter[data-level="critical"] .kerne-meter-fill { background: var(--kerne-danger); }
|
|
@@ -577,6 +663,43 @@ function resolveTheme(appearance) {
|
|
|
577
663
|
return _nullishCoalesce(_optionalChain([appearance, 'optionalAccess', _ => _.theme]), () => ( "light"));
|
|
578
664
|
}
|
|
579
665
|
|
|
666
|
+
// src/ui/password.ts
|
|
667
|
+
var MIN_PASSWORD_LENGTH = 8;
|
|
668
|
+
var BASELINE_POLICY = {
|
|
669
|
+
min_length: MIN_PASSWORD_LENGTH,
|
|
670
|
+
require_uppercase: false,
|
|
671
|
+
require_number: false,
|
|
672
|
+
require_symbol: false
|
|
673
|
+
};
|
|
674
|
+
function resolvePolicy(config) {
|
|
675
|
+
return _nullishCoalesce(_optionalChain([config, 'optionalAccess', _2 => _2.password_policy]), () => ( BASELINE_POLICY));
|
|
676
|
+
}
|
|
677
|
+
function passwordRules(password, policy) {
|
|
678
|
+
const rules = [{ key: "min_length", met: password.length >= policy.min_length }];
|
|
679
|
+
if (policy.require_uppercase) {
|
|
680
|
+
rules.push({ key: "require_uppercase", met: /[A-Z]/.test(password) });
|
|
681
|
+
}
|
|
682
|
+
if (policy.require_number) {
|
|
683
|
+
rules.push({ key: "require_number", met: /\d/.test(password) });
|
|
684
|
+
}
|
|
685
|
+
if (policy.require_symbol) {
|
|
686
|
+
rules.push({ key: "require_symbol", met: /[^A-Za-z0-9]/.test(password) });
|
|
687
|
+
}
|
|
688
|
+
return rules;
|
|
689
|
+
}
|
|
690
|
+
function meetsPolicy(password, policy) {
|
|
691
|
+
return passwordRules(password, policy).every((rule) => rule.met);
|
|
692
|
+
}
|
|
693
|
+
function passwordStrength(password) {
|
|
694
|
+
if (password.length < MIN_PASSWORD_LENGTH) return 0;
|
|
695
|
+
const variety = [/[a-z]/, /[A-Z]/, /\d/, /[^A-Za-z0-9]/].filter((re) => re.test(password)).length;
|
|
696
|
+
let score = 1;
|
|
697
|
+
if (password.length >= 12) score++;
|
|
698
|
+
if (password.length >= 16) score++;
|
|
699
|
+
if (variety >= 3) score++;
|
|
700
|
+
return Math.min(score, 4);
|
|
701
|
+
}
|
|
702
|
+
|
|
580
703
|
// src/ui/primitives.tsx
|
|
581
704
|
var _jsxruntime = require('react/jsx-runtime');
|
|
582
705
|
var InsideShell = _react.createContext.call(void 0, false);
|
|
@@ -602,7 +725,7 @@ function Shell({
|
|
|
602
725
|
{
|
|
603
726
|
className: "kerne-shell",
|
|
604
727
|
"data-kerne-size": size === "wide" ? "wide" : void 0,
|
|
605
|
-
"data-kerne-surface": _optionalChain([appearance, 'optionalAccess',
|
|
728
|
+
"data-kerne-surface": _optionalChain([appearance, 'optionalAccess', _3 => _3.surface]) === "card" ? "card" : void 0,
|
|
606
729
|
children
|
|
607
730
|
}
|
|
608
731
|
)
|
|
@@ -635,6 +758,10 @@ function Masthead({
|
|
|
635
758
|
] })
|
|
636
759
|
] });
|
|
637
760
|
}
|
|
761
|
+
function prefersAutoFocus() {
|
|
762
|
+
if (typeof window === "undefined" || !window.matchMedia) return false;
|
|
763
|
+
return window.matchMedia("(pointer: fine)").matches;
|
|
764
|
+
}
|
|
638
765
|
function Field({
|
|
639
766
|
label,
|
|
640
767
|
type,
|
|
@@ -645,55 +772,185 @@ function Field({
|
|
|
645
772
|
disabled,
|
|
646
773
|
required,
|
|
647
774
|
invalid,
|
|
775
|
+
error,
|
|
648
776
|
action,
|
|
649
777
|
code,
|
|
650
|
-
autoFocus
|
|
778
|
+
autoFocus,
|
|
779
|
+
children
|
|
651
780
|
}) {
|
|
652
781
|
const id = _react.useId.call(void 0, );
|
|
782
|
+
const errorId = `${id}-error`;
|
|
783
|
+
const noteId = `${id}-note`;
|
|
784
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
785
|
+
const isPassword = type === "password";
|
|
786
|
+
const [revealed, setRevealed] = _react.useState.call(void 0, false);
|
|
787
|
+
const [capsLock, setCapsLock] = _react.useState.call(void 0, false);
|
|
788
|
+
const trackCapsLock = (e) => {
|
|
789
|
+
if (!isPassword) return;
|
|
790
|
+
setCapsLock(_nullishCoalesce(_optionalChain([e, 'access', _4 => _4.getModifierState, 'optionalCall', _5 => _5("CapsLock")]), () => ( false)));
|
|
791
|
+
};
|
|
792
|
+
const describedBy = [error ? errorId : null, children ? noteId : null].filter(Boolean).join(" ");
|
|
653
793
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-field", children: [
|
|
654
794
|
action ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-label-row", children: [
|
|
655
795
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { className: "kerne-label", htmlFor: id, children: label }),
|
|
656
796
|
action
|
|
657
797
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { className: "kerne-label", htmlFor: id, children: label }),
|
|
658
|
-
/* @__PURE__ */ _jsxruntime.
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
798
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-control", children: [
|
|
799
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
800
|
+
"input",
|
|
801
|
+
{
|
|
802
|
+
id,
|
|
803
|
+
className: "kerne-input",
|
|
804
|
+
type: isPassword && revealed ? "text" : type,
|
|
805
|
+
value,
|
|
806
|
+
onChange: (e) => onChange(e.target.value),
|
|
807
|
+
onKeyUp: trackCapsLock,
|
|
808
|
+
onBlur: () => setCapsLock(false),
|
|
809
|
+
autoComplete,
|
|
810
|
+
placeholder,
|
|
811
|
+
disabled,
|
|
812
|
+
required,
|
|
813
|
+
"aria-invalid": invalid || !!error || void 0,
|
|
814
|
+
"aria-describedby": describedBy || void 0,
|
|
815
|
+
"data-kerne-code": code ? "true" : void 0,
|
|
816
|
+
"data-kerne-reveal": isPassword ? "true" : void 0,
|
|
817
|
+
autoFocus: autoFocus && prefersAutoFocus()
|
|
818
|
+
}
|
|
819
|
+
),
|
|
820
|
+
isPassword ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
821
|
+
"button",
|
|
822
|
+
{
|
|
823
|
+
type: "button",
|
|
824
|
+
className: "kerne-reveal",
|
|
825
|
+
onClick: () => setRevealed((v) => !v),
|
|
826
|
+
disabled,
|
|
827
|
+
"aria-label": revealed ? l10n.common.hidePassword : l10n.common.showPassword,
|
|
828
|
+
"aria-pressed": revealed,
|
|
829
|
+
tabIndex: -1,
|
|
830
|
+
children: revealed ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EyeOffIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EyeIcon, {})
|
|
831
|
+
}
|
|
832
|
+
) : null
|
|
833
|
+
] }),
|
|
834
|
+
children ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { id: noteId, children }) : null,
|
|
835
|
+
capsLock ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "kerne-field-note", "data-kerne-warn": "true", role: "status", children: l10n.common.capsLockOn }) : null,
|
|
836
|
+
error ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "kerne-field-error", id: errorId, role: "alert", children: error }) : null
|
|
675
837
|
] });
|
|
676
838
|
}
|
|
839
|
+
function EyeIcon() {
|
|
840
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
841
|
+
"svg",
|
|
842
|
+
{
|
|
843
|
+
width: "16",
|
|
844
|
+
height: "16",
|
|
845
|
+
viewBox: "0 0 24 24",
|
|
846
|
+
fill: "none",
|
|
847
|
+
stroke: "currentColor",
|
|
848
|
+
strokeWidth: "2",
|
|
849
|
+
"aria-hidden": "true",
|
|
850
|
+
children: [
|
|
851
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7-10-7-10-7z", strokeLinejoin: "round" }),
|
|
852
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "12", cy: "12", r: "3" })
|
|
853
|
+
]
|
|
854
|
+
}
|
|
855
|
+
);
|
|
856
|
+
}
|
|
857
|
+
function EyeOffIcon() {
|
|
858
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
859
|
+
"svg",
|
|
860
|
+
{
|
|
861
|
+
width: "16",
|
|
862
|
+
height: "16",
|
|
863
|
+
viewBox: "0 0 24 24",
|
|
864
|
+
fill: "none",
|
|
865
|
+
stroke: "currentColor",
|
|
866
|
+
strokeWidth: "2",
|
|
867
|
+
"aria-hidden": "true",
|
|
868
|
+
children: [
|
|
869
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
870
|
+
"path",
|
|
871
|
+
{
|
|
872
|
+
d: "M10.6 6.2A9.9 9.9 0 0 1 12 6c6.4 0 10 7 10 7a15.7 15.7 0 0 1-3 3.7M6.2 7.4A15.6 15.6 0 0 0 2 13s3.6 7 10 7a9.7 9.7 0 0 0 4.3-1",
|
|
873
|
+
strokeLinecap: "round",
|
|
874
|
+
strokeLinejoin: "round"
|
|
875
|
+
}
|
|
876
|
+
),
|
|
877
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "m3 3 18 18", strokeLinecap: "round" })
|
|
878
|
+
]
|
|
879
|
+
}
|
|
880
|
+
);
|
|
881
|
+
}
|
|
677
882
|
function Button({
|
|
678
883
|
children,
|
|
679
884
|
variant = "primary",
|
|
680
885
|
disabled,
|
|
886
|
+
loading,
|
|
681
887
|
type = "submit",
|
|
682
888
|
onClick,
|
|
683
889
|
ariaLabel
|
|
684
890
|
}) {
|
|
685
|
-
return /* @__PURE__ */ _jsxruntime.
|
|
891
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
686
892
|
"button",
|
|
687
893
|
{
|
|
688
894
|
type,
|
|
689
895
|
className: `kerne-button kerne-button-${variant}`,
|
|
690
|
-
disabled,
|
|
896
|
+
disabled: disabled || loading,
|
|
691
897
|
onClick,
|
|
692
898
|
"aria-label": ariaLabel,
|
|
693
|
-
|
|
899
|
+
"aria-busy": loading || void 0,
|
|
900
|
+
"data-kerne-loading": loading ? "true" : void 0,
|
|
901
|
+
children: [
|
|
902
|
+
loading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "kerne-spinner", "aria-hidden": "true" }) : null,
|
|
903
|
+
children
|
|
904
|
+
]
|
|
694
905
|
}
|
|
695
906
|
);
|
|
696
907
|
}
|
|
908
|
+
function PasswordStrength({
|
|
909
|
+
password,
|
|
910
|
+
policy
|
|
911
|
+
}) {
|
|
912
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
913
|
+
const resolved = _nullishCoalesce(policy, () => ( resolvePolicy(null)));
|
|
914
|
+
if (!meetsPolicy(password, resolved)) {
|
|
915
|
+
const labels2 = {
|
|
916
|
+
min_length: _chunk7U3QBMA7cjs.fill.call(void 0, l10n.common.passwordHint, { count: resolved.min_length }),
|
|
917
|
+
require_uppercase: l10n.common.passwordRequireUppercase,
|
|
918
|
+
require_number: l10n.common.passwordRequireNumber,
|
|
919
|
+
require_symbol: l10n.common.passwordRequireSymbol
|
|
920
|
+
};
|
|
921
|
+
const rules = passwordRules(password, resolved);
|
|
922
|
+
if (rules.length === 1) {
|
|
923
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "kerne-field-note", children: labels2[rules[0].key] });
|
|
924
|
+
}
|
|
925
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { className: "kerne-rules", children: rules.map((rule) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { className: "kerne-rule", "data-met": rule.met ? "true" : void 0, children: [
|
|
926
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { "aria-hidden": "true", children: rule.met ? "\u2713" : "\xB7" }),
|
|
927
|
+
labels2[rule.key]
|
|
928
|
+
] }, rule.key)) });
|
|
929
|
+
}
|
|
930
|
+
const score = passwordStrength(password);
|
|
931
|
+
const labels = [
|
|
932
|
+
l10n.common.strengthWeak,
|
|
933
|
+
l10n.common.strengthWeak,
|
|
934
|
+
l10n.common.strengthFair,
|
|
935
|
+
l10n.common.strengthGood,
|
|
936
|
+
l10n.common.strengthStrong
|
|
937
|
+
];
|
|
938
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-strength", "data-score": score, children: [
|
|
939
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "kerne-strength-track", "aria-hidden": "true", children: [1, 2, 3, 4].map((step) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
940
|
+
"span",
|
|
941
|
+
{
|
|
942
|
+
className: "kerne-strength-step",
|
|
943
|
+
"data-on": score >= step ? "true" : void 0
|
|
944
|
+
},
|
|
945
|
+
step
|
|
946
|
+
)) }),
|
|
947
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "kerne-strength-label", children: [
|
|
948
|
+
l10n.common.strengthLabel,
|
|
949
|
+
": ",
|
|
950
|
+
labels[score]
|
|
951
|
+
] })
|
|
952
|
+
] });
|
|
953
|
+
}
|
|
697
954
|
function MethodSwitch({
|
|
698
955
|
onClick,
|
|
699
956
|
children
|
|
@@ -746,7 +1003,7 @@ function Panel({
|
|
|
746
1003
|
"div",
|
|
747
1004
|
{
|
|
748
1005
|
className: `kerne-panel${danger ? " kerne-panel-danger" : ""}${variant === "success" ? " kerne-panel-success" : ""}`,
|
|
749
|
-
...danger ? { role: "alert" } : {},
|
|
1006
|
+
...danger ? { role: "alert" } : { role: "status", "aria-live": "polite" },
|
|
750
1007
|
children: [
|
|
751
1008
|
icon,
|
|
752
1009
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children })
|
|
@@ -852,10 +1109,10 @@ function OAuthButtons({
|
|
|
852
1109
|
disabled,
|
|
853
1110
|
onSelect
|
|
854
1111
|
}) {
|
|
855
|
-
const l10n =
|
|
1112
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
856
1113
|
if (providers.length === 0) return null;
|
|
857
1114
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "kerne-oauth-group", children: providers.map((provider) => {
|
|
858
|
-
const label =
|
|
1115
|
+
const label = _chunk7U3QBMA7cjs.fill.call(void 0, l10n.common.continueWith, {
|
|
859
1116
|
provider: _nullishCoalesce(OAUTH_LABELS[provider], () => ( provider))
|
|
860
1117
|
});
|
|
861
1118
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -864,7 +1121,7 @@ function OAuthButtons({
|
|
|
864
1121
|
type: "button",
|
|
865
1122
|
className: "kerne-button kerne-button-outline",
|
|
866
1123
|
disabled,
|
|
867
|
-
onClick: () => _optionalChain([onSelect, 'optionalCall',
|
|
1124
|
+
onClick: () => _optionalChain([onSelect, 'optionalCall', _6 => _6(provider)]),
|
|
868
1125
|
"aria-label": label,
|
|
869
1126
|
children: [
|
|
870
1127
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, OAuthIcon, { provider }),
|
|
@@ -876,12 +1133,12 @@ function OAuthButtons({
|
|
|
876
1133
|
}) });
|
|
877
1134
|
}
|
|
878
1135
|
function KerneBranding({ show }) {
|
|
879
|
-
const l10n =
|
|
1136
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
880
1137
|
if (!show) return null;
|
|
881
1138
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { className: "kerne-branding", href: "https://kerne.io", target: "_blank", rel: "noopener noreferrer", children: l10n.common.securedByKerne });
|
|
882
1139
|
}
|
|
883
1140
|
function FormSkeleton() {
|
|
884
|
-
const l10n =
|
|
1141
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
885
1142
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-form", "aria-busy": "true", "aria-label": l10n.common.loading, children: [
|
|
886
1143
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "kerne-skeleton" }),
|
|
887
1144
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "kerne-skeleton" })
|
|
@@ -906,11 +1163,11 @@ function LoginForm({
|
|
|
906
1163
|
logo,
|
|
907
1164
|
className
|
|
908
1165
|
}) {
|
|
909
|
-
const client =
|
|
910
|
-
const { login, startPasswordless } =
|
|
911
|
-
const { config, isLoading: configLoading, error: configError } =
|
|
912
|
-
const l10n =
|
|
913
|
-
const showError =
|
|
1166
|
+
const client = _chunk7U3QBMA7cjs.useClient.call(void 0, );
|
|
1167
|
+
const { login, startPasswordless } = _chunk7U3QBMA7cjs.useAuth.call(void 0, );
|
|
1168
|
+
const { config, isLoading: configLoading, error: configError } = _chunk7U3QBMA7cjs.useAuthConfig.call(void 0, );
|
|
1169
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
1170
|
+
const showError = _chunk7U3QBMA7cjs.useErrorResolver.call(void 0, );
|
|
914
1171
|
const [email, setEmail] = _react.useState.call(void 0, "");
|
|
915
1172
|
const [password, setPassword] = _react.useState.call(void 0, "");
|
|
916
1173
|
const [submitting, setSubmitting] = _react.useState.call(void 0, false);
|
|
@@ -918,9 +1175,9 @@ function LoginForm({
|
|
|
918
1175
|
const [linkSentTo, setLinkSentTo] = _react.useState.call(void 0, null);
|
|
919
1176
|
const [passwordMode, setPasswordMode] = _react.useState.call(void 0, false);
|
|
920
1177
|
const shell = (children) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Shell, { appearance, className, children });
|
|
921
|
-
const hasOAuth = (_nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
922
|
-
const hasCredentials = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
923
|
-
const hasMagicLink = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
1178
|
+
const hasOAuth = (_nullishCoalesce(_optionalChain([config, 'optionalAccess', _7 => _7.oauth_providers, 'access', _8 => _8.length]), () => ( 0))) > 0;
|
|
1179
|
+
const hasCredentials = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _9 => _9.enable_credentials]), () => ( false));
|
|
1180
|
+
const hasMagicLink = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _10 => _10.enable_magic_link]), () => ( false));
|
|
924
1181
|
const hasEmailMethod = hasCredentials || hasMagicLink;
|
|
925
1182
|
const usePassword = passwordMode || !hasMagicLink && hasCredentials;
|
|
926
1183
|
const handleSubmit = async (e) => {
|
|
@@ -933,7 +1190,7 @@ function LoginForm({
|
|
|
933
1190
|
if (redirectUrl) {
|
|
934
1191
|
await client.redirectWithSession(redirectUrl);
|
|
935
1192
|
} else {
|
|
936
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
1193
|
+
_optionalChain([onSuccess, 'optionalCall', _11 => _11()]);
|
|
937
1194
|
}
|
|
938
1195
|
} else {
|
|
939
1196
|
await startPasswordless(email, magicLinkCallbackUrl);
|
|
@@ -944,7 +1201,7 @@ function LoginForm({
|
|
|
944
1201
|
setSubmitting(false);
|
|
945
1202
|
}
|
|
946
1203
|
};
|
|
947
|
-
const appName = _optionalChain([config, 'optionalAccess',
|
|
1204
|
+
const appName = _optionalChain([config, 'optionalAccess', _12 => _12.app_name]);
|
|
948
1205
|
const heading = _nullishCoalesce(title, () => ( l10n.signIn.title));
|
|
949
1206
|
if (configLoading) {
|
|
950
1207
|
return shell(
|
|
@@ -974,7 +1231,7 @@ function LoginForm({
|
|
|
974
1231
|
const signUpLine = canSignUp && (signUpUrl || onSignUpClick) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
975
1232
|
l10n.signIn.signUpPrompt,
|
|
976
1233
|
" ",
|
|
977
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextLink, { href: signUpUrl, onClick: onSignUpClick, children: appName ?
|
|
1234
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextLink, { href: signUpUrl, onClick: onSignUpClick, children: appName ? _chunk7U3QBMA7cjs.fill.call(void 0, l10n.signIn.signUpForApp, { app: appName }) : l10n.signIn.signUpLink }),
|
|
978
1235
|
"."
|
|
979
1236
|
] }) : void 0;
|
|
980
1237
|
const submitLabel = submitting ? usePassword ? l10n.signIn.submitting : l10n.signIn.magicSubmitting : usePassword ? l10n.signIn.submit : l10n.signIn.magicSubmit;
|
|
@@ -983,7 +1240,7 @@ function LoginForm({
|
|
|
983
1240
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Masthead, { logo, title: heading, subtitle: _nullishCoalesce(subtitle, () => ( signUpLine)) }),
|
|
984
1241
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-stack", children: [
|
|
985
1242
|
error ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Panel, { variant: "danger", children: error }) : null,
|
|
986
|
-
linkSentTo ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Panel, { children:
|
|
1243
|
+
linkSentTo ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Panel, { children: _chunk7U3QBMA7cjs.fillNode.call(void 0, l10n.signIn.linkSent, { email: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: linkSentTo }) }) }) : hasEmailMethod ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { className: "kerne-form", onSubmit: handleSubmit, children: [
|
|
987
1244
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
988
1245
|
Field,
|
|
989
1246
|
{
|
|
@@ -1012,7 +1269,7 @@ function LoginForm({
|
|
|
1012
1269
|
action: forgotPasswordUrl || onForgotPasswordClick ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextLink, { href: forgotPasswordUrl, onClick: onForgotPasswordClick, children: l10n.signIn.forgotPassword }) : void 0
|
|
1013
1270
|
}
|
|
1014
1271
|
) : null,
|
|
1015
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, {
|
|
1272
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { loading: submitting, disabled: !email || usePassword && !password, children: submitLabel }),
|
|
1016
1273
|
hasCredentials && hasMagicLink ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1017
1274
|
MethodSwitch,
|
|
1018
1275
|
{
|
|
@@ -1059,12 +1316,13 @@ function RegisterForm({
|
|
|
1059
1316
|
logo,
|
|
1060
1317
|
className
|
|
1061
1318
|
}) {
|
|
1062
|
-
const client =
|
|
1063
|
-
const { register, startPasswordless } =
|
|
1064
|
-
const { config, isLoading: configLoading, error: configError } =
|
|
1319
|
+
const client = _chunk7U3QBMA7cjs.useClient.call(void 0, );
|
|
1320
|
+
const { register, startPasswordless } = _chunk7U3QBMA7cjs.useAuth.call(void 0, );
|
|
1321
|
+
const { config, isLoading: configLoading, error: configError } = _chunk7U3QBMA7cjs.useAuthConfig.call(void 0, );
|
|
1322
|
+
const policy = resolvePolicy(config);
|
|
1065
1323
|
const invitationToken = useUrlToken("token", invitationTokenProp) || void 0;
|
|
1066
|
-
const l10n =
|
|
1067
|
-
const showError =
|
|
1324
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
1325
|
+
const showError = _chunk7U3QBMA7cjs.useErrorResolver.call(void 0, );
|
|
1068
1326
|
const [email, setEmail] = _react.useState.call(void 0, "");
|
|
1069
1327
|
const [password, setPassword] = _react.useState.call(void 0, "");
|
|
1070
1328
|
const [name, setName] = _react.useState.call(void 0, "");
|
|
@@ -1074,8 +1332,8 @@ function RegisterForm({
|
|
|
1074
1332
|
const [linkSentTo, setLinkSentTo] = _react.useState.call(void 0, null);
|
|
1075
1333
|
const [passwordMode, setPasswordMode] = _react.useState.call(void 0, false);
|
|
1076
1334
|
const shell = (children) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Shell, { appearance, className, children });
|
|
1077
|
-
const appName = _optionalChain([config, 'optionalAccess',
|
|
1078
|
-
const heading = _nullishCoalesce(title, () => ( (appName ?
|
|
1335
|
+
const appName = _optionalChain([config, 'optionalAccess', _13 => _13.app_name]);
|
|
1336
|
+
const heading = _nullishCoalesce(title, () => ( (appName ? _chunk7U3QBMA7cjs.fill.call(void 0, l10n.signUp.titleWithApp, { app: appName }) : l10n.signUp.title)));
|
|
1079
1337
|
const signInLine = signInUrl || onSignInClick ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1080
1338
|
l10n.signUp.signInPrompt,
|
|
1081
1339
|
" ",
|
|
@@ -1102,7 +1360,7 @@ function RegisterForm({
|
|
|
1102
1360
|
return shell(
|
|
1103
1361
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1104
1362
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Masthead, { logo, title: l10n.signUp.closedTitle, subtitle: signInLine }),
|
|
1105
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Panel, { children:
|
|
1363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Panel, { children: _chunk7U3QBMA7cjs.fill.call(void 0, l10n.signUp.closedBody, { app: _nullishCoalesce(appName, () => ( l10n.common.thisApp)) }) }),
|
|
1106
1364
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: config.show_kerne_branding })
|
|
1107
1365
|
] })
|
|
1108
1366
|
);
|
|
@@ -1129,7 +1387,7 @@ function RegisterForm({
|
|
|
1129
1387
|
if (redirectUrl) {
|
|
1130
1388
|
await client.redirectWithSession(redirectUrl);
|
|
1131
1389
|
} else {
|
|
1132
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
1390
|
+
_optionalChain([onSuccess, 'optionalCall', _14 => _14()]);
|
|
1133
1391
|
}
|
|
1134
1392
|
} else {
|
|
1135
1393
|
await startPasswordless(email, magicLinkCallbackUrl, {
|
|
@@ -1164,7 +1422,7 @@ function RegisterForm({
|
|
|
1164
1422
|
),
|
|
1165
1423
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-stack", children: [
|
|
1166
1424
|
error ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Panel, { variant: "danger", children: error }) : null,
|
|
1167
|
-
linkSentTo ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Panel, { children:
|
|
1425
|
+
linkSentTo ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Panel, { children: _chunk7U3QBMA7cjs.fillNode.call(void 0, l10n.signUp.linkSent, { email: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: linkSentTo }) }) }) : hasEmailMethod ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { className: "kerne-form", onSubmit: handleSubmit, children: [
|
|
1168
1426
|
needsCode ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1169
1427
|
Field,
|
|
1170
1428
|
{
|
|
@@ -1216,13 +1474,15 @@ function RegisterForm({
|
|
|
1216
1474
|
autoComplete: "new-password",
|
|
1217
1475
|
placeholder: l10n.common.passwordPlaceholder,
|
|
1218
1476
|
disabled: submitting,
|
|
1219
|
-
required: true
|
|
1477
|
+
required: true,
|
|
1478
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PasswordStrength, { password, policy })
|
|
1220
1479
|
}
|
|
1221
1480
|
) : null,
|
|
1222
1481
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1223
1482
|
Button,
|
|
1224
1483
|
{
|
|
1225
|
-
|
|
1484
|
+
loading: submitting,
|
|
1485
|
+
disabled: !email || needsCode && !invitationCode || usePassword && !meetsPolicy(password, policy),
|
|
1226
1486
|
children: submitLabel
|
|
1227
1487
|
}
|
|
1228
1488
|
),
|
|
@@ -1267,10 +1527,10 @@ function ForgotPasswordForm({
|
|
|
1267
1527
|
logo,
|
|
1268
1528
|
className
|
|
1269
1529
|
}) {
|
|
1270
|
-
const { requestPasswordReset } =
|
|
1271
|
-
const { config } =
|
|
1272
|
-
const l10n =
|
|
1273
|
-
const showError =
|
|
1530
|
+
const { requestPasswordReset } = _chunk7U3QBMA7cjs.useAuth.call(void 0, );
|
|
1531
|
+
const { config } = _chunk7U3QBMA7cjs.useAuthConfig.call(void 0, );
|
|
1532
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
1533
|
+
const showError = _chunk7U3QBMA7cjs.useErrorResolver.call(void 0, );
|
|
1274
1534
|
const [email, setEmail] = _react.useState.call(void 0, "");
|
|
1275
1535
|
const [submitting, setSubmitting] = _react.useState.call(void 0, false);
|
|
1276
1536
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
@@ -1282,7 +1542,7 @@ function ForgotPasswordForm({
|
|
|
1282
1542
|
try {
|
|
1283
1543
|
await requestPasswordReset(email, callbackUrl);
|
|
1284
1544
|
setSentTo(email);
|
|
1285
|
-
_optionalChain([onSent, 'optionalCall',
|
|
1545
|
+
_optionalChain([onSent, 'optionalCall', _15 => _15(email)]);
|
|
1286
1546
|
} catch (err) {
|
|
1287
1547
|
setError(showError(err));
|
|
1288
1548
|
} finally {
|
|
@@ -1306,7 +1566,7 @@ function ForgotPasswordForm({
|
|
|
1306
1566
|
),
|
|
1307
1567
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-stack", children: [
|
|
1308
1568
|
error ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Panel, { variant: "danger", children: error }) : null,
|
|
1309
|
-
sentTo ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Panel, { children:
|
|
1569
|
+
sentTo ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Panel, { children: _chunk7U3QBMA7cjs.fillNode.call(void 0, l10n.resetPassword.requestSent, { email: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: sentTo }) }) }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { className: "kerne-form", onSubmit: handleSubmit, children: [
|
|
1310
1570
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1311
1571
|
Field,
|
|
1312
1572
|
{
|
|
@@ -1321,11 +1581,11 @@ function ForgotPasswordForm({
|
|
|
1321
1581
|
autoFocus: true
|
|
1322
1582
|
}
|
|
1323
1583
|
),
|
|
1324
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, {
|
|
1584
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { loading: submitting, disabled: !email, children: submitting ? l10n.resetPassword.requestSubmitting : l10n.resetPassword.requestSubmit }),
|
|
1325
1585
|
backLine ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "kerne-footer", children: backLine }) : null
|
|
1326
1586
|
] })
|
|
1327
1587
|
] }),
|
|
1328
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
1588
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _16 => _16.show_kerne_branding]), () => ( false)) })
|
|
1329
1589
|
] });
|
|
1330
1590
|
}
|
|
1331
1591
|
|
|
@@ -1343,11 +1603,12 @@ function ResetPasswordForm({
|
|
|
1343
1603
|
logo,
|
|
1344
1604
|
className
|
|
1345
1605
|
}) {
|
|
1346
|
-
const { confirmPasswordReset } =
|
|
1347
|
-
const { config } =
|
|
1606
|
+
const { confirmPasswordReset } = _chunk7U3QBMA7cjs.useAuth.call(void 0, );
|
|
1607
|
+
const { config } = _chunk7U3QBMA7cjs.useAuthConfig.call(void 0, );
|
|
1608
|
+
const policy = resolvePolicy(config);
|
|
1348
1609
|
const token = useUrlToken("token", tokenProp);
|
|
1349
|
-
const l10n =
|
|
1350
|
-
const showError =
|
|
1610
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
1611
|
+
const showError = _chunk7U3QBMA7cjs.useErrorResolver.call(void 0, );
|
|
1351
1612
|
const [password, setPassword] = _react.useState.call(void 0, "");
|
|
1352
1613
|
const [confirm, setConfirm] = _react.useState.call(void 0, "");
|
|
1353
1614
|
const [submitting, setSubmitting] = _react.useState.call(void 0, false);
|
|
@@ -1373,7 +1634,7 @@ function ResetPasswordForm({
|
|
|
1373
1634
|
try {
|
|
1374
1635
|
await confirmPasswordReset(token, password);
|
|
1375
1636
|
setDone(true);
|
|
1376
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
1637
|
+
_optionalChain([onSuccess, 'optionalCall', _17 => _17()]);
|
|
1377
1638
|
} catch (err) {
|
|
1378
1639
|
setError(showError(err));
|
|
1379
1640
|
} finally {
|
|
@@ -1390,14 +1651,14 @@ function ResetPasswordForm({
|
|
|
1390
1651
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Shell, { appearance, className, children: [
|
|
1391
1652
|
logo ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "kerne-masthead", children: logo }) : null,
|
|
1392
1653
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Status, { tone: "danger", title: l10n.resetPassword.incompleteTitle, action: signInAction, children: l10n.resetPassword.incompleteBody }),
|
|
1393
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
1654
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _18 => _18.show_kerne_branding]), () => ( false)) })
|
|
1394
1655
|
] });
|
|
1395
1656
|
}
|
|
1396
1657
|
if (done) {
|
|
1397
1658
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Shell, { appearance, className, children: [
|
|
1398
1659
|
logo ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "kerne-masthead", children: logo }) : null,
|
|
1399
1660
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Status, { tone: "success", title: l10n.resetPassword.doneTitle, action: signInAction, children: l10n.resetPassword.doneBody }),
|
|
1400
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
1661
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _19 => _19.show_kerne_branding]), () => ( false)) })
|
|
1401
1662
|
] });
|
|
1402
1663
|
}
|
|
1403
1664
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Shell, { appearance, className, children: [
|
|
@@ -1416,7 +1677,8 @@ function ResetPasswordForm({
|
|
|
1416
1677
|
placeholder: l10n.common.passwordPlaceholder,
|
|
1417
1678
|
disabled: submitting,
|
|
1418
1679
|
required: true,
|
|
1419
|
-
autoFocus: true
|
|
1680
|
+
autoFocus: true,
|
|
1681
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PasswordStrength, { password, policy })
|
|
1420
1682
|
}
|
|
1421
1683
|
),
|
|
1422
1684
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1430,15 +1692,21 @@ function ResetPasswordForm({
|
|
|
1430
1692
|
placeholder: l10n.common.passwordPlaceholder,
|
|
1431
1693
|
disabled: submitting,
|
|
1432
1694
|
required: true,
|
|
1433
|
-
|
|
1695
|
+
error: mismatch ? l10n.resetPassword.mismatch : void 0
|
|
1696
|
+
}
|
|
1697
|
+
),
|
|
1698
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1699
|
+
Button,
|
|
1700
|
+
{
|
|
1701
|
+
loading: submitting,
|
|
1702
|
+
disabled: !meetsPolicy(password, policy) || !confirm || mismatch,
|
|
1703
|
+
children: submitting ? l10n.resetPassword.submitting : l10n.resetPassword.submit
|
|
1434
1704
|
}
|
|
1435
1705
|
),
|
|
1436
|
-
mismatch ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "kerne-footer", children: l10n.resetPassword.mismatch }) : null,
|
|
1437
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { disabled: submitting || !password || !confirm || mismatch, children: submitting ? l10n.resetPassword.submitting : l10n.resetPassword.submit }),
|
|
1438
1706
|
signInUrl || onSignInClick ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "kerne-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TextLink, { href: signInUrl, onClick: onSignInClick, children: l10n.common.backToSignIn }) }) : null
|
|
1439
1707
|
] })
|
|
1440
1708
|
] }),
|
|
1441
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
1709
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _20 => _20.show_kerne_branding]), () => ( false)) })
|
|
1442
1710
|
] });
|
|
1443
1711
|
}
|
|
1444
1712
|
|
|
@@ -1455,12 +1723,12 @@ function MagicLinkCallback({
|
|
|
1455
1723
|
logo,
|
|
1456
1724
|
className
|
|
1457
1725
|
}) {
|
|
1458
|
-
const client =
|
|
1459
|
-
const { loginWithMagicLink } =
|
|
1460
|
-
const { config } =
|
|
1726
|
+
const client = _chunk7U3QBMA7cjs.useClient.call(void 0, );
|
|
1727
|
+
const { loginWithMagicLink } = _chunk7U3QBMA7cjs.useAuth.call(void 0, );
|
|
1728
|
+
const { config } = _chunk7U3QBMA7cjs.useAuthConfig.call(void 0, );
|
|
1461
1729
|
const token = useUrlToken("token", tokenProp);
|
|
1462
|
-
const l10n =
|
|
1463
|
-
const showError =
|
|
1730
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
1731
|
+
const showError = _chunk7U3QBMA7cjs.useErrorResolver.call(void 0, );
|
|
1464
1732
|
const [state, setState] = _react.useState.call(void 0, "pending");
|
|
1465
1733
|
const [message, setMessage] = _react.useState.call(void 0, null);
|
|
1466
1734
|
const consumed = _react.useRef.call(void 0, false);
|
|
@@ -1476,7 +1744,7 @@ function MagicLinkCallback({
|
|
|
1476
1744
|
if (redirectUrl) {
|
|
1477
1745
|
await client.redirectWithSession(redirectUrl);
|
|
1478
1746
|
} else {
|
|
1479
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
1747
|
+
_optionalChain([onSuccess, 'optionalCall', _21 => _21()]);
|
|
1480
1748
|
}
|
|
1481
1749
|
}).catch((e) => {
|
|
1482
1750
|
setState("failed");
|
|
@@ -1497,7 +1765,7 @@ function MagicLinkCallback({
|
|
|
1497
1765
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Shell, { appearance, className, children: [
|
|
1498
1766
|
logo ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "kerne-masthead", children: logo }) : null,
|
|
1499
1767
|
state === "pending" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Status, { tone: "loading", title: l10n.magicLink.pendingTitle, children: l10n.magicLink.pendingBody }) : state === "done" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Status, { tone: "success", title: l10n.magicLink.doneTitle, children: l10n.magicLink.doneBody }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Status, { tone: "danger", title: l10n.magicLink.failedTitle, action: retry, children: _nullishCoalesce(message, () => ( l10n.magicLink.missingToken)) }),
|
|
1500
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
1768
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _22 => _22.show_kerne_branding]), () => ( false)) })
|
|
1501
1769
|
] });
|
|
1502
1770
|
}
|
|
1503
1771
|
|
|
@@ -1514,11 +1782,11 @@ function VerifyEmailForm({
|
|
|
1514
1782
|
logo,
|
|
1515
1783
|
className
|
|
1516
1784
|
}) {
|
|
1517
|
-
const { verifyEmailWithCode, verifyEmailWithLink, sendVerificationEmail, refreshToken } =
|
|
1518
|
-
const { config } =
|
|
1785
|
+
const { verifyEmailWithCode, verifyEmailWithLink, sendVerificationEmail, refreshToken } = _chunk7U3QBMA7cjs.useAuth.call(void 0, );
|
|
1786
|
+
const { config } = _chunk7U3QBMA7cjs.useAuthConfig.call(void 0, );
|
|
1519
1787
|
const token = useUrlToken("token", tokenProp);
|
|
1520
|
-
const l10n =
|
|
1521
|
-
const showError =
|
|
1788
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
1789
|
+
const showError = _chunk7U3QBMA7cjs.useErrorResolver.call(void 0, );
|
|
1522
1790
|
const [code, setCode] = _react.useState.call(void 0, "");
|
|
1523
1791
|
const [submitting, setSubmitting] = _react.useState.call(void 0, false);
|
|
1524
1792
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
@@ -1532,7 +1800,7 @@ function VerifyEmailForm({
|
|
|
1532
1800
|
await refreshToken().catch(() => void 0);
|
|
1533
1801
|
}
|
|
1534
1802
|
setVerified(true);
|
|
1535
|
-
_optionalChain([onVerified, 'optionalCall',
|
|
1803
|
+
_optionalChain([onVerified, 'optionalCall', _23 => _23()]);
|
|
1536
1804
|
};
|
|
1537
1805
|
_react.useEffect.call(void 0, () => {
|
|
1538
1806
|
if (token === null || token === "" || consumed.current) return;
|
|
@@ -1572,7 +1840,7 @@ function VerifyEmailForm({
|
|
|
1572
1840
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Shell, { appearance, className, children: [
|
|
1573
1841
|
logo ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "kerne-masthead", children: logo }) : null,
|
|
1574
1842
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Status, { tone: "success", title: l10n.verifyEmail.doneTitle, children: l10n.verifyEmail.doneBody }),
|
|
1575
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
1843
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _24 => _24.show_kerne_branding]), () => ( false)) })
|
|
1576
1844
|
] });
|
|
1577
1845
|
}
|
|
1578
1846
|
if (linkState === "pending") {
|
|
@@ -1594,7 +1862,7 @@ function VerifyEmailForm({
|
|
|
1594
1862
|
}
|
|
1595
1863
|
),
|
|
1596
1864
|
resent ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Panel, { variant: "success", children: l10n.verifyEmail.resent }) : null,
|
|
1597
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
1865
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _25 => _25.show_kerne_branding]), () => ( false)) })
|
|
1598
1866
|
] });
|
|
1599
1867
|
}
|
|
1600
1868
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Shell, { appearance, className, children: [
|
|
@@ -1618,11 +1886,11 @@ function VerifyEmailForm({
|
|
|
1618
1886
|
autoFocus: true
|
|
1619
1887
|
}
|
|
1620
1888
|
),
|
|
1621
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, {
|
|
1889
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { loading: submitting, disabled: !code, children: submitting ? l10n.verifyEmail.submitting : l10n.verifyEmail.submit }),
|
|
1622
1890
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, MethodSwitch, { onClick: handleResend, children: l10n.verifyEmail.resend })
|
|
1623
1891
|
] })
|
|
1624
1892
|
] }),
|
|
1625
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
1893
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _26 => _26.show_kerne_branding]), () => ( false)) })
|
|
1626
1894
|
] });
|
|
1627
1895
|
}
|
|
1628
1896
|
|
|
@@ -1640,12 +1908,13 @@ function ActivateAccountForm({
|
|
|
1640
1908
|
logo,
|
|
1641
1909
|
className
|
|
1642
1910
|
}) {
|
|
1643
|
-
const client =
|
|
1644
|
-
const { getActivationContext, completeActivation } =
|
|
1645
|
-
const { config } =
|
|
1911
|
+
const client = _chunk7U3QBMA7cjs.useClient.call(void 0, );
|
|
1912
|
+
const { getActivationContext, completeActivation } = _chunk7U3QBMA7cjs.useAuth.call(void 0, );
|
|
1913
|
+
const { config } = _chunk7U3QBMA7cjs.useAuthConfig.call(void 0, );
|
|
1914
|
+
const policy = resolvePolicy(config);
|
|
1646
1915
|
const token = useUrlToken("token", tokenProp);
|
|
1647
|
-
const l10n =
|
|
1648
|
-
const showError =
|
|
1916
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
1917
|
+
const showError = _chunk7U3QBMA7cjs.useErrorResolver.call(void 0, );
|
|
1649
1918
|
const [context, setContext] = _react.useState.call(void 0, null);
|
|
1650
1919
|
const [loadError, setLoadError] = _react.useState.call(void 0, null);
|
|
1651
1920
|
const [password, setPassword] = _react.useState.call(void 0, "");
|
|
@@ -1678,11 +1947,11 @@ function ActivateAccountForm({
|
|
|
1678
1947
|
setError(null);
|
|
1679
1948
|
setSubmitting(true);
|
|
1680
1949
|
try {
|
|
1681
|
-
await completeActivation(token, _optionalChain([context, 'optionalAccess',
|
|
1950
|
+
await completeActivation(token, _optionalChain([context, 'optionalAccess', _27 => _27.mode]) === "credentials" ? password : void 0);
|
|
1682
1951
|
if (redirectUrl) {
|
|
1683
1952
|
await client.redirectWithSession(redirectUrl);
|
|
1684
1953
|
} else {
|
|
1685
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
1954
|
+
_optionalChain([onSuccess, 'optionalCall', _28 => _28()]);
|
|
1686
1955
|
}
|
|
1687
1956
|
} catch (err) {
|
|
1688
1957
|
setError(showError(err));
|
|
@@ -1699,7 +1968,7 @@ function ActivateAccountForm({
|
|
|
1699
1968
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Shell, { appearance, className, children: [
|
|
1700
1969
|
logo ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "kerne-masthead", children: logo }) : null,
|
|
1701
1970
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Status, { tone: "danger", title: l10n.activate.failedTitle, action: signInAction, children: _nullishCoalesce(loadError, () => ( l10n.activate.missingToken)) }),
|
|
1702
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
1971
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _29 => _29.show_kerne_branding]), () => ( false)) })
|
|
1703
1972
|
] });
|
|
1704
1973
|
}
|
|
1705
1974
|
if (!context) {
|
|
@@ -1715,7 +1984,7 @@ function ActivateAccountForm({
|
|
|
1715
1984
|
{
|
|
1716
1985
|
logo,
|
|
1717
1986
|
title: heading,
|
|
1718
|
-
subtitle:
|
|
1987
|
+
subtitle: _chunk7U3QBMA7cjs.fillNode.call(void 0,
|
|
1719
1988
|
credentialsMode ? l10n.activate.credentialsSubtitle : l10n.activate.magicSubtitle,
|
|
1720
1989
|
{ email: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: context.email }) }
|
|
1721
1990
|
)
|
|
@@ -1736,7 +2005,8 @@ function ActivateAccountForm({
|
|
|
1736
2005
|
placeholder: l10n.common.passwordPlaceholder,
|
|
1737
2006
|
disabled: submitting,
|
|
1738
2007
|
required: true,
|
|
1739
|
-
autoFocus: true
|
|
2008
|
+
autoFocus: true,
|
|
2009
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PasswordStrength, { password, policy })
|
|
1740
2010
|
}
|
|
1741
2011
|
),
|
|
1742
2012
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1750,15 +2020,21 @@ function ActivateAccountForm({
|
|
|
1750
2020
|
placeholder: l10n.common.passwordPlaceholder,
|
|
1751
2021
|
disabled: submitting,
|
|
1752
2022
|
required: true,
|
|
1753
|
-
|
|
2023
|
+
error: mismatch ? l10n.activate.mismatch : void 0
|
|
1754
2024
|
}
|
|
1755
|
-
)
|
|
1756
|
-
mismatch ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "kerne-footer", children: l10n.activate.mismatch }) : null
|
|
2025
|
+
)
|
|
1757
2026
|
] }) : null,
|
|
1758
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2027
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2028
|
+
Button,
|
|
2029
|
+
{
|
|
2030
|
+
loading: submitting,
|
|
2031
|
+
disabled: credentialsMode && (!meetsPolicy(password, policy) || !confirm || mismatch),
|
|
2032
|
+
children: submitting ? l10n.activate.submitting : l10n.activate.submit
|
|
2033
|
+
}
|
|
2034
|
+
)
|
|
1759
2035
|
] })
|
|
1760
2036
|
] }),
|
|
1761
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
2037
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _30 => _30.show_kerne_branding]), () => ( false)) })
|
|
1762
2038
|
] });
|
|
1763
2039
|
}
|
|
1764
2040
|
|
|
@@ -1780,17 +2056,21 @@ function AuthFlow({
|
|
|
1780
2056
|
logo,
|
|
1781
2057
|
className
|
|
1782
2058
|
}) {
|
|
1783
|
-
const { config } =
|
|
2059
|
+
const { config } = _chunk7U3QBMA7cjs.useAuthConfig.call(void 0, );
|
|
1784
2060
|
const token = useUrlToken("token");
|
|
1785
2061
|
const [internalStep, setInternalStep] = _react.useState.call(void 0, null);
|
|
1786
2062
|
const go = (next) => {
|
|
1787
2063
|
if (controlledStep === void 0) setInternalStep(next);
|
|
1788
|
-
_optionalChain([onStepChange, 'optionalCall',
|
|
2064
|
+
_optionalChain([onStepChange, 'optionalCall', _31 => _31(next)]);
|
|
1789
2065
|
};
|
|
1790
2066
|
const tokenStep = token && (initialStep === void 0 || TOKEN_STEPS.includes(initialStep)) ? _nullishCoalesce(initialStep, () => ( "magic-link")) : null;
|
|
1791
2067
|
const step = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(controlledStep, () => ( internalStep)), () => ( tokenStep)), () => ( initialStep)), () => ( "sign-in"));
|
|
1792
|
-
const canSignUp = allowSignUp && _optionalChain([config, 'optionalAccess',
|
|
1793
|
-
const shared = {
|
|
2068
|
+
const canSignUp = allowSignUp && _optionalChain([config, 'optionalAccess', _32 => _32.registration_mode]) !== "CLOSED";
|
|
2069
|
+
const shared = {
|
|
2070
|
+
appearance,
|
|
2071
|
+
logo,
|
|
2072
|
+
className: `kerne-step${className ? ` ${className}` : ""}`
|
|
2073
|
+
};
|
|
1794
2074
|
switch (step) {
|
|
1795
2075
|
case "sign-up":
|
|
1796
2076
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1863,9 +2143,11 @@ function ChangePasswordForm({
|
|
|
1863
2143
|
appearance,
|
|
1864
2144
|
className
|
|
1865
2145
|
}) {
|
|
1866
|
-
const { updatePassword } =
|
|
1867
|
-
const
|
|
1868
|
-
const
|
|
2146
|
+
const { updatePassword } = _chunk7U3QBMA7cjs.useAuth.call(void 0, );
|
|
2147
|
+
const { config } = _chunk7U3QBMA7cjs.useAuthConfig.call(void 0, );
|
|
2148
|
+
const policy = resolvePolicy(config);
|
|
2149
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
2150
|
+
const showError = _chunk7U3QBMA7cjs.useErrorResolver.call(void 0, );
|
|
1869
2151
|
const heading = title === null ? null : _nullishCoalesce(title, () => ( l10n.security.submit));
|
|
1870
2152
|
const [currentPassword, setCurrentPassword] = _react.useState.call(void 0, "");
|
|
1871
2153
|
const [newPassword, setNewPassword] = _react.useState.call(void 0, "");
|
|
@@ -1887,7 +2169,7 @@ function ChangePasswordForm({
|
|
|
1887
2169
|
setCurrentPassword("");
|
|
1888
2170
|
setNewPassword("");
|
|
1889
2171
|
setConfirm("");
|
|
1890
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
2172
|
+
_optionalChain([onSuccess, 'optionalCall', _33 => _33()]);
|
|
1891
2173
|
} catch (err) {
|
|
1892
2174
|
setError(showError(err));
|
|
1893
2175
|
} finally {
|
|
@@ -1924,7 +2206,8 @@ function ChangePasswordForm({
|
|
|
1924
2206
|
placeholder: l10n.common.passwordPlaceholder,
|
|
1925
2207
|
disabled: submitting,
|
|
1926
2208
|
required: true,
|
|
1927
|
-
|
|
2209
|
+
error: unchanged ? l10n.security.sameAsCurrent : void 0,
|
|
2210
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PasswordStrength, { password: newPassword, policy })
|
|
1928
2211
|
}
|
|
1929
2212
|
),
|
|
1930
2213
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1938,14 +2221,14 @@ function ChangePasswordForm({
|
|
|
1938
2221
|
placeholder: l10n.common.passwordPlaceholder,
|
|
1939
2222
|
disabled: submitting,
|
|
1940
2223
|
required: true,
|
|
1941
|
-
|
|
2224
|
+
error: mismatch ? l10n.security.mismatch : void 0
|
|
1942
2225
|
}
|
|
1943
2226
|
),
|
|
1944
|
-
unchanged ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "kerne-footer", children: l10n.security.sameAsCurrent }) : mismatch ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "kerne-footer", children: l10n.security.mismatch }) : null,
|
|
1945
2227
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1946
2228
|
Button,
|
|
1947
2229
|
{
|
|
1948
|
-
|
|
2230
|
+
loading: submitting,
|
|
2231
|
+
disabled: !currentPassword || !meetsPolicy(newPassword, policy) || !confirm || mismatch || unchanged,
|
|
1949
2232
|
children: submitting ? l10n.security.submitting : l10n.security.submit
|
|
1950
2233
|
}
|
|
1951
2234
|
)
|
|
@@ -1970,10 +2253,10 @@ function WaitlistForm({
|
|
|
1970
2253
|
logo,
|
|
1971
2254
|
className
|
|
1972
2255
|
}) {
|
|
1973
|
-
const { join } =
|
|
1974
|
-
const { config } =
|
|
1975
|
-
const l10n =
|
|
1976
|
-
const showError =
|
|
2256
|
+
const { join } = _chunk7U3QBMA7cjs.useWaitlist.call(void 0, );
|
|
2257
|
+
const { config } = _chunk7U3QBMA7cjs.useAuthConfig.call(void 0, );
|
|
2258
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
2259
|
+
const showError = _chunk7U3QBMA7cjs.useErrorResolver.call(void 0, );
|
|
1977
2260
|
const [email, setEmail] = _react.useState.call(void 0, "");
|
|
1978
2261
|
const [name, setName] = _react.useState.call(void 0, "");
|
|
1979
2262
|
const [submitting, setSubmitting] = _react.useState.call(void 0, false);
|
|
@@ -1990,7 +2273,7 @@ function WaitlistForm({
|
|
|
1990
2273
|
metadata
|
|
1991
2274
|
});
|
|
1992
2275
|
setJoined(true);
|
|
1993
|
-
_optionalChain([onJoined, 'optionalCall',
|
|
2276
|
+
_optionalChain([onJoined, 'optionalCall', _34 => _34(email)]);
|
|
1994
2277
|
} catch (err) {
|
|
1995
2278
|
setError(showError(err));
|
|
1996
2279
|
} finally {
|
|
@@ -2035,11 +2318,11 @@ function WaitlistForm({
|
|
|
2035
2318
|
autoFocus: true
|
|
2036
2319
|
}
|
|
2037
2320
|
),
|
|
2038
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, {
|
|
2321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { loading: submitting, disabled: !email, children: submitting ? l10n.waitlist.submitting : _nullishCoalesce(submitLabel, () => ( l10n.waitlist.submit)) })
|
|
2039
2322
|
] })
|
|
2040
2323
|
] }),
|
|
2041
2324
|
legal ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "kerne-legal", children: legal }) : null,
|
|
2042
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
2325
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _35 => _35.show_kerne_branding]), () => ( false)) })
|
|
2043
2326
|
] });
|
|
2044
2327
|
}
|
|
2045
2328
|
|
|
@@ -2054,11 +2337,11 @@ function SignOutButton({
|
|
|
2054
2337
|
appearance
|
|
2055
2338
|
}) {
|
|
2056
2339
|
ensureStylesInjected();
|
|
2057
|
-
const { logout } =
|
|
2058
|
-
const l10n =
|
|
2340
|
+
const { logout } = _chunk7U3QBMA7cjs.useAuth.call(void 0, );
|
|
2341
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
2059
2342
|
const handle = () => {
|
|
2060
2343
|
logout();
|
|
2061
|
-
_optionalChain([onSignedOut, 'optionalCall',
|
|
2344
|
+
_optionalChain([onSignedOut, 'optionalCall', _36 => _36()]);
|
|
2062
2345
|
if (redirectUrl && typeof window !== "undefined") window.location.href = redirectUrl;
|
|
2063
2346
|
};
|
|
2064
2347
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2089,9 +2372,9 @@ function UserButton({
|
|
|
2089
2372
|
className
|
|
2090
2373
|
}) {
|
|
2091
2374
|
ensureStylesInjected();
|
|
2092
|
-
const { logout, isAuthenticated } =
|
|
2093
|
-
const { user, fullName, initials, email } =
|
|
2094
|
-
const l10n =
|
|
2375
|
+
const { logout, isAuthenticated } = _chunk7U3QBMA7cjs.useAuth.call(void 0, );
|
|
2376
|
+
const { user, fullName, initials, email } = _chunk7U3QBMA7cjs.useUser.call(void 0, );
|
|
2377
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
2095
2378
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
2096
2379
|
const wrapRef = _react.useRef.call(void 0, null);
|
|
2097
2380
|
_react.useEffect.call(void 0, () => {
|
|
@@ -2113,7 +2396,7 @@ function UserButton({
|
|
|
2113
2396
|
const handleSignOut = () => {
|
|
2114
2397
|
setOpen(false);
|
|
2115
2398
|
logout();
|
|
2116
|
-
_optionalChain([onSignedOut, 'optionalCall',
|
|
2399
|
+
_optionalChain([onSignedOut, 'optionalCall', _37 => _37()]);
|
|
2117
2400
|
if (signOutRedirectUrl && typeof window !== "undefined") {
|
|
2118
2401
|
window.location.href = signOutRedirectUrl;
|
|
2119
2402
|
}
|
|
@@ -2134,7 +2417,7 @@ function UserButton({
|
|
|
2134
2417
|
"aria-expanded": open,
|
|
2135
2418
|
"aria-label": l10n.account.menuLabel,
|
|
2136
2419
|
onClick: () => setOpen((v) => !v),
|
|
2137
|
-
children: _optionalChain([user, 'optionalAccess',
|
|
2420
|
+
children: _optionalChain([user, 'optionalAccess', _38 => _38.avatar]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { className: "kerne-avatar", src: user.avatar, alt: "" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "kerne-avatar", children: initials || _optionalChain([email, 'optionalAccess', _39 => _39[0], 'optionalAccess', _40 => _40.toUpperCase, 'call', _41 => _41()]) || "?" })
|
|
2138
2421
|
}
|
|
2139
2422
|
),
|
|
2140
2423
|
open ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-menu", role: "menu", children: [
|
|
@@ -2151,7 +2434,7 @@ function UserButton({
|
|
|
2151
2434
|
className: "kerne-menu-item",
|
|
2152
2435
|
onClick: () => {
|
|
2153
2436
|
setOpen(false);
|
|
2154
|
-
_optionalChain([item, 'access',
|
|
2437
|
+
_optionalChain([item, 'access', _42 => _42.onClick, 'optionalCall', _43 => _43()]);
|
|
2155
2438
|
},
|
|
2156
2439
|
children: item.label
|
|
2157
2440
|
},
|
|
@@ -2182,10 +2465,10 @@ function UserButton({
|
|
|
2182
2465
|
|
|
2183
2466
|
|
|
2184
2467
|
function ProfileSection({ verificationCallbackUrl, onSaved }) {
|
|
2185
|
-
const { updateProfile, sendVerificationEmail, getVerificationStatus } =
|
|
2186
|
-
const { user, fullName, initials, email } =
|
|
2187
|
-
const l10n =
|
|
2188
|
-
const showError =
|
|
2468
|
+
const { updateProfile, sendVerificationEmail, getVerificationStatus } = _chunk7U3QBMA7cjs.useAuth.call(void 0, );
|
|
2469
|
+
const { user, fullName, initials, email } = _chunk7U3QBMA7cjs.useUser.call(void 0, );
|
|
2470
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
2471
|
+
const showError = _chunk7U3QBMA7cjs.useErrorResolver.call(void 0, );
|
|
2189
2472
|
const [firstName, setFirstName] = _react.useState.call(void 0, "");
|
|
2190
2473
|
const [lastName, setLastName] = _react.useState.call(void 0, "");
|
|
2191
2474
|
const [saving, setSaving] = _react.useState.call(void 0, false);
|
|
@@ -2214,7 +2497,7 @@ function ProfileSection({ verificationCallbackUrl, onSaved }) {
|
|
|
2214
2497
|
try {
|
|
2215
2498
|
await updateProfile({ first_name: firstName, last_name: lastName });
|
|
2216
2499
|
setSaved(true);
|
|
2217
|
-
_optionalChain([onSaved, 'optionalCall',
|
|
2500
|
+
_optionalChain([onSaved, 'optionalCall', _44 => _44()]);
|
|
2218
2501
|
} catch (err) {
|
|
2219
2502
|
setError(showError(err));
|
|
2220
2503
|
} finally {
|
|
@@ -2236,7 +2519,7 @@ function ProfileSection({ verificationCallbackUrl, onSaved }) {
|
|
|
2236
2519
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2237
2520
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Subsection, { title: l10n.profile.profileTitle, children: [
|
|
2238
2521
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-identity", children: [
|
|
2239
|
-
_optionalChain([user, 'optionalAccess',
|
|
2522
|
+
_optionalChain([user, 'optionalAccess', _45 => _45.avatar]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { className: "kerne-avatar", src: user.avatar, alt: "" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "kerne-avatar", "aria-hidden": "true", children: initials || _optionalChain([email, 'optionalAccess', _46 => _46[0], 'optionalAccess', _47 => _47.toUpperCase, 'call', _48 => _48()]) || "?" }),
|
|
2240
2523
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-identity-text", children: [
|
|
2241
2524
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "kerne-identity-name", children: fullName || l10n.profile.unnamed }),
|
|
2242
2525
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "kerne-identity-mail", children: email })
|
|
@@ -2269,7 +2552,7 @@ function ProfileSection({ verificationCallbackUrl, onSaved }) {
|
|
|
2269
2552
|
disabled: saving
|
|
2270
2553
|
}
|
|
2271
2554
|
),
|
|
2272
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, {
|
|
2555
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { loading: saving, children: saving ? l10n.profile.saving : l10n.profile.save })
|
|
2273
2556
|
] })
|
|
2274
2557
|
] }),
|
|
2275
2558
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -2283,7 +2566,7 @@ function ProfileSection({ verificationCallbackUrl, onSaved }) {
|
|
|
2283
2566
|
email,
|
|
2284
2567
|
verified === true ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "kerne-badge", "data-tone": "success", children: l10n.profile.verified }) : verified === false ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "kerne-badge", "data-tone": "warning", children: l10n.profile.unverified }) : null
|
|
2285
2568
|
] }) }),
|
|
2286
|
-
verified === false ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { variant: "outline", type: "button", onClick: handleResend,
|
|
2569
|
+
verified === false ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { variant: "outline", type: "button", onClick: handleResend, loading: sending, children: sending ? l10n.common.sending : l10n.profile.verify }) : null
|
|
2287
2570
|
] }),
|
|
2288
2571
|
sent ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Panel, { variant: "success", children: l10n.profile.verificationSent }) : null
|
|
2289
2572
|
]
|
|
@@ -2296,20 +2579,20 @@ function ProfileSection({ verificationCallbackUrl, onSaved }) {
|
|
|
2296
2579
|
|
|
2297
2580
|
|
|
2298
2581
|
function SecuritySection({ showDeleteAccount = true, onDeleted }) {
|
|
2299
|
-
const { requestAccountDeletion } =
|
|
2300
|
-
const { config } =
|
|
2301
|
-
const l10n =
|
|
2302
|
-
const showError =
|
|
2582
|
+
const { requestAccountDeletion } = _chunk7U3QBMA7cjs.useAuth.call(void 0, );
|
|
2583
|
+
const { config } = _chunk7U3QBMA7cjs.useAuthConfig.call(void 0, );
|
|
2584
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
2585
|
+
const showError = _chunk7U3QBMA7cjs.useErrorResolver.call(void 0, );
|
|
2303
2586
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2304
2587
|
const [confirmingDelete, setConfirmingDelete] = _react.useState.call(void 0, false);
|
|
2305
2588
|
const [deleting, setDeleting] = _react.useState.call(void 0, false);
|
|
2306
|
-
const hasPassword = _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
2589
|
+
const hasPassword = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _49 => _49.enable_credentials]), () => ( true));
|
|
2307
2590
|
const handleDelete = async () => {
|
|
2308
2591
|
setError(null);
|
|
2309
2592
|
setDeleting(true);
|
|
2310
2593
|
try {
|
|
2311
2594
|
await requestAccountDeletion();
|
|
2312
|
-
_optionalChain([onDeleted, 'optionalCall',
|
|
2595
|
+
_optionalChain([onDeleted, 'optionalCall', _50 => _50()]);
|
|
2313
2596
|
} catch (err) {
|
|
2314
2597
|
setError(showError(err));
|
|
2315
2598
|
setDeleting(false);
|
|
@@ -2319,7 +2602,7 @@ function SecuritySection({ showDeleteAccount = true, onDeleted }) {
|
|
|
2319
2602
|
error ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Panel, { variant: "danger", children: error }) : null,
|
|
2320
2603
|
hasPassword ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Subsection, { title: l10n.security.passwordTitle, description: l10n.security.passwordDesc, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChangePasswordForm, { title: null }) }) : null,
|
|
2321
2604
|
showDeleteAccount ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Subsection, { title: l10n.security.deleteTitle, description: l10n.security.deleteDesc, children: confirmingDelete ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { display: "flex", gap: 10, flexWrap: "wrap" }, children: [
|
|
2322
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { variant: "danger", type: "button", onClick: handleDelete,
|
|
2605
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { variant: "danger", type: "button", onClick: handleDelete, loading: deleting, children: deleting ? l10n.security.deleting : l10n.security.deleteConfirm }),
|
|
2323
2606
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2324
2607
|
Button,
|
|
2325
2608
|
{
|
|
@@ -2413,13 +2696,13 @@ function UsageMeters({
|
|
|
2413
2696
|
appearance,
|
|
2414
2697
|
className
|
|
2415
2698
|
}) {
|
|
2416
|
-
const { entitlements, isLoading, error } =
|
|
2417
|
-
const { subscription } =
|
|
2418
|
-
const l10n =
|
|
2699
|
+
const { entitlements, isLoading, error } = _chunk7U3QBMA7cjs.useEntitlements.call(void 0, );
|
|
2700
|
+
const { subscription } = _chunk7U3QBMA7cjs.useSubscription.call(void 0, );
|
|
2701
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
2419
2702
|
const heading = title === null ? null : _nullishCoalesce(title, () => ( l10n.usage.title));
|
|
2420
2703
|
const nameFor = (key) => {
|
|
2421
|
-
if (_optionalChain([labels, 'optionalAccess',
|
|
2422
|
-
const fromPlan = _optionalChain([subscription, 'optionalAccess',
|
|
2704
|
+
if (_optionalChain([labels, 'optionalAccess', _51 => _51[key]])) return labels[key];
|
|
2705
|
+
const fromPlan = _optionalChain([subscription, 'optionalAccess', _52 => _52.entitlements, 'access', _53 => _53.find, 'call', _54 => _54((e) => e.feature_key === key), 'optionalAccess', _55 => _55.feature_name]);
|
|
2423
2706
|
return _nullishCoalesce(fromPlan, () => ( humanizeFeatureKey(key)));
|
|
2424
2707
|
};
|
|
2425
2708
|
const shell = (children) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Shell, { appearance, className, children: [
|
|
@@ -2463,7 +2746,7 @@ function UsageMeters({
|
|
|
2463
2746
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-meter", "data-level": level, children: [
|
|
2464
2747
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-meter-head", children: [
|
|
2465
2748
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "kerne-meter-name", children: nameFor(e.feature_key) }),
|
|
2466
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "kerne-meter-value", children: unlimited ?
|
|
2749
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "kerne-meter-value", children: unlimited ? _chunk7U3QBMA7cjs.fill.call(void 0, l10n.usage.used, { count: formatNumber(e.used) }) : `${formatNumber(e.used)} / ${formatNumber(e.limit)}` })
|
|
2467
2750
|
] }),
|
|
2468
2751
|
!unlimited ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2469
2752
|
"div",
|
|
@@ -2477,7 +2760,7 @@ function UsageMeters({
|
|
|
2477
2760
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "kerne-meter-fill", style: { width: `${ratio * 100}%` } })
|
|
2478
2761
|
}
|
|
2479
2762
|
) : null,
|
|
2480
|
-
over && overageAllowed ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "kerne-meter-note", children:
|
|
2763
|
+
over && overageAllowed ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "kerne-meter-note", children: _chunk7U3QBMA7cjs.fill.call(void 0, l10n.usage.overage, {
|
|
2481
2764
|
count: formatNumber(e.used - e.limit)
|
|
2482
2765
|
}) }) : over ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "kerne-meter-note", children: l10n.usage.limitReached }) : null
|
|
2483
2766
|
] }, e.feature_key);
|
|
@@ -2506,10 +2789,10 @@ function SubscriptionCard({
|
|
|
2506
2789
|
appearance,
|
|
2507
2790
|
className
|
|
2508
2791
|
}) {
|
|
2509
|
-
const { subscription, isLoading, error } =
|
|
2510
|
-
const { openPortal } =
|
|
2511
|
-
const l10n =
|
|
2512
|
-
const showError =
|
|
2792
|
+
const { subscription, isLoading, error } = _chunk7U3QBMA7cjs.useSubscription.call(void 0, productSlug);
|
|
2793
|
+
const { openPortal } = _chunk7U3QBMA7cjs.usePortal.call(void 0, );
|
|
2794
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
2795
|
+
const showError = _chunk7U3QBMA7cjs.useErrorResolver.call(void 0, );
|
|
2513
2796
|
const heading = title === null ? null : _nullishCoalesce(title, () => ( l10n.billing.plan));
|
|
2514
2797
|
const statusLabels = {
|
|
2515
2798
|
ACTIVE: l10n.billing.statusActive,
|
|
@@ -2596,7 +2879,7 @@ function SubscriptionCard({
|
|
|
2596
2879
|
] }) : null
|
|
2597
2880
|
] }),
|
|
2598
2881
|
canceled_at ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Panel, { children: l10n.billing.cancelNotice }) : null,
|
|
2599
|
-
!hidePortalButton ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { variant: "outline", type: "button", onClick: handlePortal,
|
|
2882
|
+
!hidePortalButton ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { variant: "outline", type: "button", onClick: handlePortal, loading: opening, children: opening ? l10n.billing.opening : l10n.billing.managePortal }) : null
|
|
2600
2883
|
] })
|
|
2601
2884
|
);
|
|
2602
2885
|
}
|
|
@@ -2623,16 +2906,16 @@ function BillingSection({
|
|
|
2623
2906
|
usageFeatureKeys,
|
|
2624
2907
|
usageLabels
|
|
2625
2908
|
}) {
|
|
2626
|
-
const { subscription } =
|
|
2627
|
-
const { plans, isLoading: plansLoading } =
|
|
2628
|
-
const { openCheckout } =
|
|
2629
|
-
const l10n =
|
|
2630
|
-
const showError =
|
|
2909
|
+
const { subscription } = _chunk7U3QBMA7cjs.useSubscription.call(void 0, productSlug);
|
|
2910
|
+
const { plans, isLoading: plansLoading } = _chunk7U3QBMA7cjs.usePlans.call(void 0, pricingProductIdOrSlug);
|
|
2911
|
+
const { openCheckout } = _chunk7U3QBMA7cjs.useCheckout.call(void 0, );
|
|
2912
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
2913
|
+
const showError = _chunk7U3QBMA7cjs.useErrorResolver.call(void 0, );
|
|
2631
2914
|
const [busy, setBusy] = _react.useState.call(void 0, null);
|
|
2632
2915
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2633
2916
|
const intervals = _react.useMemo.call(void 0, () => intervalsOf(plans), [plans]);
|
|
2634
2917
|
const [interval, setInterval] = _react.useState.call(void 0, null);
|
|
2635
|
-
const activeInterval = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(interval, () => ( _optionalChain([subscription, 'optionalAccess',
|
|
2918
|
+
const activeInterval = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(interval, () => ( _optionalChain([subscription, 'optionalAccess', _56 => _56.plan_price, 'access', _57 => _57.interval]))), () => ( intervals[0])), () => ( null));
|
|
2636
2919
|
const handleSwitch = async (planPriceId) => {
|
|
2637
2920
|
setError(null);
|
|
2638
2921
|
setBusy(planPriceId);
|
|
@@ -2686,7 +2969,7 @@ function BillingSection({
|
|
|
2686
2969
|
) : null,
|
|
2687
2970
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "kerne-plan-list", children: plans.map((plan) => {
|
|
2688
2971
|
const price = _nullishCoalesce(plan.prices.find((p) => p.interval === activeInterval), () => ( plan.prices[0]));
|
|
2689
|
-
const isCurrent = _optionalChain([subscription, 'optionalAccess',
|
|
2972
|
+
const isCurrent = _optionalChain([subscription, 'optionalAccess', _58 => _58.plan, 'access', _59 => _59.slug]) === plan.slug;
|
|
2690
2973
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2691
2974
|
"div",
|
|
2692
2975
|
{
|
|
@@ -2706,6 +2989,7 @@ function BillingSection({
|
|
|
2706
2989
|
variant: "outline",
|
|
2707
2990
|
type: "button",
|
|
2708
2991
|
onClick: () => handleSwitch(price.id),
|
|
2992
|
+
loading: busy === price.id,
|
|
2709
2993
|
disabled: busy !== null,
|
|
2710
2994
|
children: busy === price.id ? l10n.billing.opening : l10n.billing.switchTo
|
|
2711
2995
|
}
|
|
@@ -2743,7 +3027,7 @@ function UserProfile({
|
|
|
2743
3027
|
appearance,
|
|
2744
3028
|
className
|
|
2745
3029
|
}) {
|
|
2746
|
-
const l10n =
|
|
3030
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
2747
3031
|
const builtins = {
|
|
2748
3032
|
profile: {
|
|
2749
3033
|
label: l10n.profile.tabProfile,
|
|
@@ -2770,15 +3054,15 @@ function UserProfile({
|
|
|
2770
3054
|
description: t.description
|
|
2771
3055
|
}))
|
|
2772
3056
|
];
|
|
2773
|
-
const [internalTab, setInternalTab] = _react.useState.call(void 0, _nullishCoalesce(_nullishCoalesce(defaultTab, () => ( _optionalChain([allTabs, 'access',
|
|
3057
|
+
const [internalTab, setInternalTab] = _react.useState.call(void 0, _nullishCoalesce(_nullishCoalesce(defaultTab, () => ( _optionalChain([allTabs, 'access', _60 => _60[0], 'optionalAccess', _61 => _61.id]))), () => ( "profile")));
|
|
2774
3058
|
const current = _nullishCoalesce(controlledTab, () => ( internalTab));
|
|
2775
3059
|
const select = (id) => {
|
|
2776
3060
|
if (controlledTab === void 0) setInternalTab(id);
|
|
2777
|
-
_optionalChain([onTabChange, 'optionalCall',
|
|
3061
|
+
_optionalChain([onTabChange, 'optionalCall', _62 => _62(id)]);
|
|
2778
3062
|
};
|
|
2779
3063
|
const active = _nullishCoalesce(allTabs.find((t) => t.id === current), () => ( allTabs[0]));
|
|
2780
3064
|
const renderPane = () => {
|
|
2781
|
-
switch (_optionalChain([active, 'optionalAccess',
|
|
3065
|
+
switch (_optionalChain([active, 'optionalAccess', _63 => _63.id])) {
|
|
2782
3066
|
case "profile":
|
|
2783
3067
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProfileSection, { verificationCallbackUrl, onSaved });
|
|
2784
3068
|
case "security":
|
|
@@ -2799,7 +3083,7 @@ function UserProfile({
|
|
|
2799
3083
|
}
|
|
2800
3084
|
);
|
|
2801
3085
|
default:
|
|
2802
|
-
return _nullishCoalesce(_optionalChain([extraTabs, 'access',
|
|
3086
|
+
return _nullishCoalesce(_optionalChain([extraTabs, 'access', _64 => _64.find, 'call', _65 => _65((t) => t.id === _optionalChain([active, 'optionalAccess', _66 => _66.id])), 'optionalAccess', _67 => _67.content]), () => ( null));
|
|
2803
3087
|
}
|
|
2804
3088
|
};
|
|
2805
3089
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Shell, { appearance, className, size: "wide", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-profile", children: [
|
|
@@ -2808,7 +3092,7 @@ function UserProfile({
|
|
|
2808
3092
|
{
|
|
2809
3093
|
type: "button",
|
|
2810
3094
|
className: "kerne-nav-item",
|
|
2811
|
-
"aria-current": tab.id === _optionalChain([active, 'optionalAccess',
|
|
3095
|
+
"aria-current": tab.id === _optionalChain([active, 'optionalAccess', _68 => _68.id]) ? "page" : void 0,
|
|
2812
3096
|
onClick: () => select(tab.id),
|
|
2813
3097
|
children: tab.label
|
|
2814
3098
|
},
|
|
@@ -2841,9 +3125,9 @@ function CheckoutResult({
|
|
|
2841
3125
|
logo,
|
|
2842
3126
|
className
|
|
2843
3127
|
}) {
|
|
2844
|
-
const client =
|
|
2845
|
-
const { config } =
|
|
2846
|
-
const l10n =
|
|
3128
|
+
const client = _chunk7U3QBMA7cjs.useClient.call(void 0, );
|
|
3129
|
+
const { config } = _chunk7U3QBMA7cjs.useAuthConfig.call(void 0, );
|
|
3130
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
2847
3131
|
const [state, setState] = _react.useState.call(void 0, "checking");
|
|
2848
3132
|
const confirmed = _react.useRef.call(void 0, false);
|
|
2849
3133
|
_react.useEffect.call(void 0, () => {
|
|
@@ -2857,7 +3141,7 @@ function CheckoutResult({
|
|
|
2857
3141
|
if (sub && !stopped) {
|
|
2858
3142
|
confirmed.current = true;
|
|
2859
3143
|
setState("confirmed");
|
|
2860
|
-
_optionalChain([onConfirmed, 'optionalCall',
|
|
3144
|
+
_optionalChain([onConfirmed, 'optionalCall', _69 => _69(sub)]);
|
|
2861
3145
|
return;
|
|
2862
3146
|
}
|
|
2863
3147
|
} catch (e3) {
|
|
@@ -2881,7 +3165,7 @@ function CheckoutResult({
|
|
|
2881
3165
|
const shell = (children) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Shell, { appearance, className, children: [
|
|
2882
3166
|
logo ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "kerne-masthead", children: logo }) : null,
|
|
2883
3167
|
children,
|
|
2884
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
3168
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, KerneBranding, { show: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _70 => _70.show_kerne_branding]), () => ( false)) })
|
|
2885
3169
|
] });
|
|
2886
3170
|
if (outcome === "cancel") {
|
|
2887
3171
|
return shell(
|
|
@@ -2927,20 +3211,20 @@ function UpgradePrompt({
|
|
|
2927
3211
|
appearance,
|
|
2928
3212
|
className
|
|
2929
3213
|
}) {
|
|
2930
|
-
const { details, allowed, isLoading } =
|
|
2931
|
-
const l10n =
|
|
3214
|
+
const { details, allowed, isLoading } = _chunk7U3QBMA7cjs.useAccess.call(void 0, featureKey, requested);
|
|
3215
|
+
const l10n = _chunk7U3QBMA7cjs.useLocalization.call(void 0, );
|
|
2932
3216
|
if (isLoading) {
|
|
2933
3217
|
if (hideWhileLoading) return null;
|
|
2934
3218
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Shell, { appearance, className, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "kerne-skeleton", style: { height: 80 }, "aria-label": l10n.upgrade.checking }) });
|
|
2935
3219
|
}
|
|
2936
3220
|
if (allowed) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children });
|
|
2937
3221
|
const name = _nullishCoalesce(featureName, () => ( humanizeFeatureKey(featureKey).toLowerCase()));
|
|
2938
|
-
const quotaExhausted = _optionalChain([details, 'optionalAccess',
|
|
2939
|
-
const heading = _nullishCoalesce(title, () => (
|
|
2940
|
-
const body = _nullishCoalesce(description, () => ( (quotaExhausted ?
|
|
3222
|
+
const quotaExhausted = _optionalChain([details, 'optionalAccess', _71 => _71.feature_type]) === "QUOTA" && typeof details.limit === "number" && typeof details.used === "number";
|
|
3223
|
+
const heading = _nullishCoalesce(title, () => ( _chunk7U3QBMA7cjs.fill.call(void 0, quotaExhausted ? l10n.upgrade.quotaTitle : l10n.upgrade.featureTitle, { feature: name })));
|
|
3224
|
+
const body = _nullishCoalesce(description, () => ( (quotaExhausted ? _chunk7U3QBMA7cjs.fill.call(void 0, l10n.upgrade.quotaBody, {
|
|
2941
3225
|
used: formatNumber(details.used),
|
|
2942
3226
|
limit: formatNumber(details.limit)
|
|
2943
|
-
}) :
|
|
3227
|
+
}) : _chunk7U3QBMA7cjs.fill.call(void 0, l10n.upgrade.featureBody, { feature: name }))));
|
|
2944
3228
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Shell, { appearance, className, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-status", children: [
|
|
2945
3229
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "kerne-heading", children: [
|
|
2946
3230
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "kerne-section-title", style: { fontSize: 17 }, children: heading }),
|
|
@@ -2981,4 +3265,4 @@ function UpgradePrompt({
|
|
|
2981
3265
|
|
|
2982
3266
|
|
|
2983
3267
|
|
|
2984
|
-
exports.ActivateAccountForm = ActivateAccountForm; exports.AuthFlow = AuthFlow; exports.BillingSection = BillingSection; exports.ChangePasswordForm = ChangePasswordForm; exports.CheckoutResult = CheckoutResult; exports.ForgotPasswordForm = ForgotPasswordForm; exports.LoginForm = LoginForm; exports.MagicLinkCallback = MagicLinkCallback; exports.ProfileSection = ProfileSection; exports.RegisterForm = RegisterForm; exports.ResetPasswordForm = ResetPasswordForm; exports.SecuritySection = SecuritySection; exports.SignOutButton = SignOutButton; exports.SubscriptionCard = SubscriptionCard; exports.UpgradePrompt = UpgradePrompt; exports.UsageMeters = UsageMeters; exports.UserButton = UserButton; exports.UserProfile = UserProfile; exports.VerifyEmailForm = VerifyEmailForm; exports.WaitlistForm = WaitlistForm; exports.defaultLocalization =
|
|
3268
|
+
exports.ActivateAccountForm = ActivateAccountForm; exports.AuthFlow = AuthFlow; exports.BillingSection = BillingSection; exports.ChangePasswordForm = ChangePasswordForm; exports.CheckoutResult = CheckoutResult; exports.ForgotPasswordForm = ForgotPasswordForm; exports.LoginForm = LoginForm; exports.MagicLinkCallback = MagicLinkCallback; exports.ProfileSection = ProfileSection; exports.RegisterForm = RegisterForm; exports.ResetPasswordForm = ResetPasswordForm; exports.SecuritySection = SecuritySection; exports.SignOutButton = SignOutButton; exports.SubscriptionCard = SubscriptionCard; exports.UpgradePrompt = UpgradePrompt; exports.UsageMeters = UsageMeters; exports.UserButton = UserButton; exports.UserProfile = UserProfile; exports.VerifyEmailForm = VerifyEmailForm; exports.WaitlistForm = WaitlistForm; exports.defaultLocalization = _chunk7U3QBMA7cjs.defaultLocalization; exports.useLocalization = _chunk7U3QBMA7cjs.useLocalization;
|