@ctx-core/auth0-ui 12.2.84 → 12.2.85
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/CHANGELOG.md +8 -0
- package/lib/src/ui/Auth0_c.d.ts +3 -3
- package/lib/ui/Auth0.svelte +15 -15
- package/lib/ui/Auth0_Change_Password_Form.svelte +7 -7
- package/lib/ui/Auth0_Forgot_Password_Form.svelte +8 -8
- package/lib/ui/Auth0_Login_Form.svelte +8 -8
- package/lib/ui/Auth0_Signup_Form.svelte +11 -11
- package/lib/ui/Auth0_c.js +6 -6
- package/lib/ui/Auth0_c.js.map +1 -1
- package/package.json +5 -5
- package/src/ui/Auth0.svelte +15 -15
- package/src/ui/Auth0_Change_Password_Form.svelte +7 -7
- package/src/ui/Auth0_Forgot_Password_Form.svelte +8 -8
- package/src/ui/Auth0_Login_Form.svelte +8 -8
- package/src/ui/Auth0_Signup_Form.svelte +11 -11
- package/src/ui/Auth0_c.ts +6 -6
package/CHANGELOG.md
CHANGED
package/lib/src/ui/Auth0_c.d.ts
CHANGED
|
@@ -8,9 +8,9 @@ export declare class Auth0_c {
|
|
|
8
8
|
readonly login_password_realm_body_: (data: any) => login_data_password_realm_body_I;
|
|
9
9
|
readonly signup_auth0_body_: (data: any) => signup_data_password_realm_body_I;
|
|
10
10
|
readonly signup_password_realm_body_: (data: any) => signup_data_password_realm_body_I;
|
|
11
|
-
readonly auth0_opened_class: import("@ctx-core/auth0").
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
11
|
+
readonly auth0_opened_class: import("@ctx-core/nanostores").ReadableAtom_<import("@ctx-core/auth0").auth0_opened_T>;
|
|
12
|
+
readonly auth0_token_json_: import("@ctx-core/nanostores").WritableAtom_<string | import("@ctx-core/function").nullish>;
|
|
13
|
+
readonly auth0_token_error_: import("@ctx-core/nanostores").WritableAtom_<import("@ctx-core/auth0").auth0_token_error_T>;
|
|
14
14
|
readonly close_auth0: () => void;
|
|
15
15
|
readonly onMount: (root: HTMLElement) => Promise<void>;
|
|
16
16
|
readonly login: (data: login_data_I, schedule_forms_clear?: () => void) => Promise<void>;
|
package/lib/ui/Auth0.svelte
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { setContext } from 'svelte'
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
auth0_forgot_password_opened__, auth0_opened_class__, auth0_login_opened__, auth0_signup_opened__,
|
|
5
|
+
auth0_forgot_password_check_email_opened__, auth0_change_password_opened__
|
|
6
6
|
} from '@ctx-core/auth0'
|
|
7
7
|
import { ctx_ } from '@ctx-core/object'
|
|
8
8
|
import { auth0_ui_ctx_key } from '../auth0_ui_ctx_key.js'
|
|
@@ -15,32 +15,32 @@ import Auth0_Login_Form from './Auth0_Login_Form.svelte'
|
|
|
15
15
|
import Auth0_Signup_Form from './Auth0_Signup_Form.svelte'
|
|
16
16
|
export let ctx = ctx_(), dialog = false
|
|
17
17
|
setContext(auth0_ui_ctx_key, ctx)
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
18
|
+
const auth0_change_password_opened_ = auth0_change_password_opened__(ctx)
|
|
19
|
+
const auth0_opened_class_ = auth0_opened_class__(ctx)
|
|
20
|
+
const auth0_forgot_password_check_email_opened_ = auth0_forgot_password_check_email_opened__(ctx)
|
|
21
|
+
const auth0_forgot_password_opened_ = auth0_forgot_password_opened__(ctx)
|
|
22
|
+
const auth0_login_opened_ = auth0_login_opened__(ctx)
|
|
23
|
+
const auth0_signup_opened_ = auth0_signup_opened__(ctx)
|
|
24
24
|
const _ = new Auth0_c(ctx)
|
|
25
25
|
</script>
|
|
26
26
|
|
|
27
27
|
<div
|
|
28
|
-
class="Auth0 {$
|
|
28
|
+
class="Auth0 {$auth0_opened_class_} {$$props.class || ''}"
|
|
29
29
|
class:dialog
|
|
30
|
-
class:visible={!!$
|
|
30
|
+
class:visible={!!$auth0_opened_class_}
|
|
31
31
|
>
|
|
32
32
|
<Auth0_Dialog_Close></Auth0_Dialog_Close>
|
|
33
|
-
{#if $
|
|
33
|
+
{#if $auth0_login_opened_}
|
|
34
34
|
<Auth0_Login_Form {...$$props}></Auth0_Login_Form>
|
|
35
|
-
{:else if $
|
|
35
|
+
{:else if $auth0_signup_opened_}
|
|
36
36
|
<Auth0_Signup_Form {...$$props}>
|
|
37
37
|
<div slot="tos__signup"></div>
|
|
38
38
|
</Auth0_Signup_Form>
|
|
39
|
-
{:else if $
|
|
39
|
+
{:else if $auth0_forgot_password_opened_}
|
|
40
40
|
<Auth0_Forgot_Password_Form {...$$props}></Auth0_Forgot_Password_Form>
|
|
41
|
-
{:else if $
|
|
41
|
+
{:else if $auth0_forgot_password_check_email_opened_}
|
|
42
42
|
<Auth0_Forgot_Password_Check_Email_Form></Auth0_Forgot_Password_Check_Email_Form>
|
|
43
|
-
{:else if $
|
|
43
|
+
{:else if $auth0_change_password_opened_}
|
|
44
44
|
<Auth0_Change_Password_Form {...$$props}></Auth0_Change_Password_Form>
|
|
45
45
|
{/if}
|
|
46
46
|
<slot></slot>
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { createEventDispatcher } from 'svelte'
|
|
3
|
-
import {
|
|
3
|
+
import { AUTH0_DOMAIN__, auth0_token_error__ } from '@ctx-core/auth0'
|
|
4
4
|
import { getContext_auth0_ui_ctx } from '../getContext_auth0_ui_ctx.js'
|
|
5
5
|
import { Auth0_c } from './Auth0_c.js'
|
|
6
6
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
7
7
|
const ctx = getContext_auth0_ui_ctx()
|
|
8
8
|
const dispatch = createEventDispatcher()
|
|
9
9
|
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const AUTH0_DOMAIN_ = AUTH0_DOMAIN__(ctx)
|
|
11
|
+
const auth0_token_error_ = auth0_token_error__(ctx)
|
|
12
12
|
const _ = new Auth0_c(ctx)
|
|
13
13
|
let root:HTMLDivElement
|
|
14
14
|
let password_input:HTMLInputElement
|
|
15
15
|
let password_confirmation_input
|
|
16
16
|
let password_error:any|undefined //region
|
|
17
|
-
$: password_error = $
|
|
17
|
+
$: password_error = $auth0_token_error_?.password //endregion
|
|
18
18
|
let password_error_confirmation:string|undefined //region
|
|
19
|
-
$: password_error_confirmation = $
|
|
19
|
+
$: password_error_confirmation = $auth0_token_error_?.password_confirmation //endregion
|
|
20
20
|
async function onsubmit_change_password(event:FormDataEvent) {
|
|
21
21
|
dispatch('submit__start')
|
|
22
22
|
try {
|
|
@@ -38,12 +38,12 @@ async function onsubmit_change_password(event:FormDataEvent) {
|
|
|
38
38
|
<Auth0_Dialog_Close></Auth0_Dialog_Close>
|
|
39
39
|
<h1>Change Password</h1>
|
|
40
40
|
<form
|
|
41
|
-
action="https://{$
|
|
41
|
+
action="https://{$AUTH0_DOMAIN_}/dbconnections/change_password"
|
|
42
42
|
accept-charset="UTF-8"
|
|
43
43
|
method="post"
|
|
44
44
|
on:submit|preventDefault={onsubmit_change_password}
|
|
45
45
|
>
|
|
46
|
-
{#if $
|
|
46
|
+
{#if $auth0_token_error_}
|
|
47
47
|
<ul>
|
|
48
48
|
{#if password_error}
|
|
49
49
|
<li class="error {error_class}">
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { AUTH0_DOMAIN__, auth0_token_error__, open_auth0_login, open_auth0_signup } from '@ctx-core/auth0'
|
|
3
3
|
import { getContext_auth0_ui_ctx } from '../getContext_auth0_ui_ctx.js'
|
|
4
4
|
import { Auth0_c } from './Auth0_c.js'
|
|
5
5
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
6
6
|
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
7
7
|
const ctx = getContext_auth0_ui_ctx()
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const AUTH0_DOMAIN_ = AUTH0_DOMAIN__(ctx)
|
|
9
|
+
const auth0_token_error_ = auth0_token_error__(ctx)
|
|
10
10
|
const _ = new Auth0_c(ctx)
|
|
11
|
-
let email_input:HTMLInputElement, error:typeof $
|
|
12
|
-
$: error = $
|
|
11
|
+
let email_input:HTMLInputElement, error:typeof $auth0_token_error_?.error
|
|
12
|
+
$: error = $auth0_token_error_?.error
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
<div class="form forgot_password">
|
|
16
16
|
<Auth0_Dialog_Close></Auth0_Dialog_Close>
|
|
17
17
|
<h1>Forgot Password</h1>
|
|
18
18
|
<form
|
|
19
|
-
action="https://{$
|
|
19
|
+
action="https://{$AUTH0_DOMAIN_}/passwordless/start"
|
|
20
20
|
accept-charset="UTF-8"
|
|
21
21
|
method="post"
|
|
22
22
|
on:submit={event => _.onsubmit_forgot_password(event, { email_input })}
|
|
23
23
|
>
|
|
24
|
-
{#if $
|
|
24
|
+
{#if $auth0_token_error_}
|
|
25
25
|
<ul>
|
|
26
26
|
<li class="error {error_class}">
|
|
27
|
-
{$
|
|
27
|
+
{$auth0_token_error_.error}: {$auth0_token_error_.error_description}
|
|
28
28
|
</li>
|
|
29
29
|
</ul>
|
|
30
30
|
{/if}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
AUTH0_DOMAIN__, auth0_token_error__, auth0_token_error_txt__, open_auth0_forgot_password, open_auth0_signup
|
|
4
4
|
} from '@ctx-core/auth0'
|
|
5
5
|
import type { Ctx } from '@ctx-core/object'
|
|
6
6
|
import { Auth0_c } from './Auth0_c.js'
|
|
7
7
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
8
8
|
export let ctx:Ctx, error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const AUTH0_DOMAIN =
|
|
9
|
+
const auth0_token_error_ = auth0_token_error__(ctx)
|
|
10
|
+
const auth0_token_error_txt_ = auth0_token_error_txt__(ctx)
|
|
11
|
+
const AUTH0_DOMAIN = AUTH0_DOMAIN__(ctx)
|
|
12
12
|
const _ = new Auth0_c(ctx)
|
|
13
13
|
let root:HTMLDivElement
|
|
14
14
|
let username_login_input:HTMLInputElement, password_login_input:HTMLInputElement
|
|
15
15
|
let error_username:string|undefined//region
|
|
16
|
-
$: error_username = $
|
|
16
|
+
$: error_username = $auth0_token_error_?.username //endregion
|
|
17
17
|
let error_password:string|undefined//region
|
|
18
|
-
$: error_password = $
|
|
18
|
+
$: error_password = $auth0_token_error_?.password //endregion
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<div bind:this={root} class="form {$$props.class||''}">
|
|
@@ -31,10 +31,10 @@ $: error_password = $auth0_token_error$?.password //endregion
|
|
|
31
31
|
password_login_input
|
|
32
32
|
}, ()=>_.schedule_forms_clear(root))}
|
|
33
33
|
>
|
|
34
|
-
{#if $
|
|
34
|
+
{#if $auth0_token_error_txt_}
|
|
35
35
|
<ul>
|
|
36
36
|
<li class="error {error_class}">
|
|
37
|
-
{$
|
|
37
|
+
{$auth0_token_error_txt_}
|
|
38
38
|
</li>
|
|
39
39
|
</ul>
|
|
40
40
|
{/if}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
AUTH0_DOMAIN__, auth0_token_error__, open_auth0_forgot_password, open_auth0_login,
|
|
4
4
|
} from '@ctx-core/auth0'
|
|
5
5
|
import { getContext_auth0_ui_ctx } from '../getContext_auth0_ui_ctx.js'
|
|
6
6
|
import { Auth0_c } from './Auth0_c.js'
|
|
7
7
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
8
8
|
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
9
9
|
const ctx = getContext_auth0_ui_ctx()
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const AUTH0_DOMAIN_ = AUTH0_DOMAIN__(ctx)
|
|
11
|
+
const auth0_token_error_ = auth0_token_error__(ctx)
|
|
12
12
|
const _ = new Auth0_c(ctx)
|
|
13
13
|
let root, signup_email_input, signup_password_input, signup_password_confirmation_input
|
|
14
14
|
let error_username:string|undefined //region
|
|
15
|
-
$: error_username = $
|
|
15
|
+
$: error_username = $auth0_token_error_?.username //endregion
|
|
16
16
|
let error_password:string|undefined //region
|
|
17
|
-
$: error_password = $
|
|
17
|
+
$: error_password = $auth0_token_error_?.password //endregion
|
|
18
18
|
let error_password_confirmation:boolean //region
|
|
19
|
-
$: error_password_confirmation = !!$
|
|
19
|
+
$: error_password_confirmation = !!$auth0_token_error_ //endregion
|
|
20
20
|
let error_text:string
|
|
21
21
|
$: {
|
|
22
22
|
let error_text_a = []
|
|
23
|
-
if ($
|
|
24
|
-
for (let key in $
|
|
25
|
-
error_text_a.push($
|
|
23
|
+
if ($auth0_token_error_) {
|
|
24
|
+
for (let key in $auth0_token_error_) {
|
|
25
|
+
error_text_a.push($auth0_token_error_[key])
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
error_text = error_text_a.join('<br>') || ''
|
|
@@ -33,7 +33,7 @@ $: {
|
|
|
33
33
|
<Auth0_Dialog_Close/>
|
|
34
34
|
<h1><slot name="signup_text">Sign Up</slot></h1>
|
|
35
35
|
<form
|
|
36
|
-
action="https://{$
|
|
36
|
+
action="https://{$AUTH0_DOMAIN_}/dbconnections/signup"
|
|
37
37
|
accept-charset="UTF-8"
|
|
38
38
|
method="post"
|
|
39
39
|
on:submit={event =>
|
|
@@ -44,7 +44,7 @@ $: {
|
|
|
44
44
|
}, _.schedule_forms_clear(root))
|
|
45
45
|
}
|
|
46
46
|
>
|
|
47
|
-
{#if $
|
|
47
|
+
{#if $auth0_token_error_}
|
|
48
48
|
<ul>
|
|
49
49
|
<li class="error {error_class}">
|
|
50
50
|
{error_text}
|
package/lib/ui/Auth0_c.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { onDestroy } from 'svelte';
|
|
2
|
-
import { auth0_body_,
|
|
2
|
+
import { auth0_body_, auth0_opened_class__, auth0_token_error__, auth0_token_json__, clear_auth0_token_error, close_auth0, logout_auth0_token_error, open_auth0_forgot_password_check_email, open_auth0_login, password_realm_body_, post_auth0_auth_change_password, post_auth0_dbconnections_signup, post_auth0_oauth_token, post_auth0_passwordless_start, validate_auth0_change_password, validate_auth0_forgot_password, validate_auth0_signup } from '@ctx-core/auth0';
|
|
3
3
|
import { has_dom, dom_a_ } from '@ctx-core/dom';
|
|
4
4
|
import { noop } from '@ctx-core/function';
|
|
5
5
|
export class Auth0_c {
|
|
@@ -9,9 +9,9 @@ export class Auth0_c {
|
|
|
9
9
|
this.login_password_realm_body_ = (data)=>password_realm_body_(this.ctx, this.login_auth0_body_(data));
|
|
10
10
|
this.signup_auth0_body_ = (data)=>auth0_body_(this.ctx, data);
|
|
11
11
|
this.signup_password_realm_body_ = (data)=>password_realm_body_(this.ctx, this.signup_auth0_body_(data));
|
|
12
|
-
this.auth0_opened_class =
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
12
|
+
this.auth0_opened_class = auth0_opened_class__(this.ctx);
|
|
13
|
+
this.auth0_token_json_ = auth0_token_json__(this.ctx);
|
|
14
|
+
this.auth0_token_error_ = auth0_token_error__(this.ctx);
|
|
15
15
|
this.close_auth0 = ()=>close_auth0(this.ctx);
|
|
16
16
|
this.onMount = async (root)=>{
|
|
17
17
|
if (has_dom) {
|
|
@@ -23,12 +23,12 @@ export class Auth0_c {
|
|
|
23
23
|
const [auth0_token, response] = await post_auth0_oauth_token(this.ctx, this.login_password_realm_body_(data));
|
|
24
24
|
if (response.ok) {
|
|
25
25
|
const auth0_token_json = JSON.stringify(auth0_token);
|
|
26
|
-
this.
|
|
26
|
+
this.auth0_token_json_.$ = auth0_token_json;
|
|
27
27
|
schedule_forms_clear();
|
|
28
28
|
this.close_auth0();
|
|
29
29
|
} else {
|
|
30
30
|
const auth_token_error = auth0_token;
|
|
31
|
-
this.
|
|
31
|
+
this.auth0_token_error_.$ = auth_token_error;
|
|
32
32
|
logout_auth0_token_error(this.ctx, auth_token_error);
|
|
33
33
|
}
|
|
34
34
|
};
|
package/lib/ui/Auth0_c.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ui/Auth0_c.ts"],"sourcesContent":["import type { Auth0Error } from 'auth0-js'\nimport { onDestroy } from 'svelte'\nimport type {\n\tauth0_client_id_body_I, auth0_grant_type_body_I, login_data_I, password_realm_body_T, post_auth0_oauth_token_body_I,\n\tpost_auth0_passwordless_start_body_T, post_auth0_passwordless_start_optional_body_T, signup_data_I\n} from '@ctx-core/auth0'\nimport {\n\tauth0_body_, auth0_opened_class$_, auth0_token_error$_, auth0_token_json$_, clear_auth0_token_error,\n\tclose_auth0, logout_auth0_token_error, open_auth0_forgot_password_check_email, open_auth0_login,\n\tpassword_realm_body_, post_auth0_auth_change_password, post_auth0_dbconnections_signup,\n\tpost_auth0_oauth_token, post_auth0_passwordless_start, validate_auth0_change_password,\n\tvalidate_auth0_forgot_password, validate_auth0_signup\n} from '@ctx-core/auth0'\nimport { has_dom, dom_a_ } from '@ctx-core/dom'\nimport { noop } from '@ctx-core/function'\nimport type { Ctx } from '@ctx-core/object'\nexport class Auth0_c {\n\tconstructor(protected ctx:Ctx) {}\n\treadonly login_auth0_body_ = (data:any)=>\n\t\tauth0_body_<login_data_password_realm_body_I>(\n\t\t\tthis.ctx, data\n\t\t)\n\treadonly login_password_realm_body_ = (data:any)=>\n\t\tpassword_realm_body_<login_data_password_realm_body_I>(\n\t\t\tthis.ctx,\n\t\t\tthis.login_auth0_body_(data)\n\t\t)\n\treadonly signup_auth0_body_ = (data:any)=>\n\t\tauth0_body_<signup_data_password_realm_body_I>(this.ctx, data) as signup_data_password_realm_body_I\n\treadonly signup_password_realm_body_ = (data:any)=>\n\t\tpassword_realm_body_<signup_data_password_realm_body_I>(this.ctx, this.signup_auth0_body_(data))\n\treadonly auth0_opened_class = auth0_opened_class$_(this.ctx)\n\treadonly auth0_token_json$ = auth0_token_json$_(this.ctx)\n\treadonly auth0_token_error$ = auth0_token_error$_(this.ctx)\n\treadonly close_auth0 = ()=>close_auth0(this.ctx)\n\treadonly onMount = async (root:HTMLElement)=>{\n\t\tif (has_dom) {\n\t\t\tconst unsubscribe =\n\t\t\t\tthis.auth0_opened_class.subscribe(()=>this.schedule_forms_clear(root))\n\t\t\tonDestroy(unsubscribe)\n\t\t}\n\t}\n\treadonly login = async (data:login_data_I, schedule_forms_clear = ()=>{})=>{\n\t\tconst [auth0_token, response] = await post_auth0_oauth_token(\n\t\t\tthis.ctx, this.login_password_realm_body_(data)\n\t\t)\n\t\tif (response.ok) {\n\t\t\tconst auth0_token_json = JSON.stringify(auth0_token)\n\t\t\tthis.auth0_token_json$.$ = auth0_token_json\n\t\t\tschedule_forms_clear()\n\t\t\tthis.close_auth0()\n\t\t} else {\n\t\t\tconst auth_token_error = auth0_token as Auth0Error\n\t\t\tthis.auth0_token_error$.$ = auth_token_error\n\t\t\tlogout_auth0_token_error(this.ctx, auth_token_error)\n\t\t}\n\t}\n\treadonly signup = async (data:signup_data_I, schedule_forms_clear = ()=>{})=>{\n\t\tconst [auth0_userinfo] = await post_auth0_dbconnections_signup(\n\t\t\tthis.ctx,\n\t\t\tthis.signup_password_realm_body_(data))\n\t\tconst auth0_userinfo_Auth0Error = auth0_userinfo as Auth0Error\n\t\tconst { statusCode } = auth0_userinfo_Auth0Error\n\t\tif (statusCode) {\n\t\t\tconst {\n\t\t\t\tcode,\n\t\t\t\tdescription\n\t\t\t} = auth0_userinfo_Auth0Error\n\t\t\tconst email =\n\t\t\t\tcode === 'user_exists'\n\t\t\t\t? 'This Email is already signed up'\n\t\t\t\t: description || ''\n\t\t\tconst auth0_token_error = { email }\n\t\t\tlogout_auth0_token_error(this.ctx, auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tschedule_forms_clear()\n\t\tawait this.login({\n\t\t\tusername: data.email,\n\t\t\tpassword: data.password,\n\t\t}, schedule_forms_clear)\n\t}\n\treadonly change_password = async (form:{ password:string }, schedule_forms_clear = ()=>{})=>{\n\t\tconst { password } = form\n\t\tlet error\n\t\ttry {\n\t\t\tconst [response_json, response] = await post_auth0_auth_change_password(this.ctx, password)\n\t\t\tif (!response.ok) {\n\t\t\t\tif (response.status == 401) {\n\t\t\t\t\topen_auth0_login(this.ctx)\n\t\t\t\t\tconst auth0_token_error = { username: 'Authentication Error - Log in' }\n\t\t\t\t\tlogout_auth0_token_error(this.ctx, auth0_token_error)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\terror = response_json.error || 'Error changing Password'\n\t\t\t}\n\t\t} catch (e:any) {\n\t\t\tconsole.warn(e)\n\t\t\terror = e.message\n\t\t}\n\t\tif (error) {\n\t\t\tconst auth0_token_error = { password: error }\n\t\t\tlogout_auth0_token_error(this.ctx, auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tschedule_forms_clear()\n\t\tthis.close_auth0()\n\t}\n\treadonly schedule_forms_clear_:(root:HTMLElement)=>void = (root:HTMLElement)=>{\n\t\treturn ()=>this.schedule_forms_clear(root)\n\t}\n\treadonly schedule_forms_clear = (root:HTMLElement)=>{\n\t\tsetTimeout(()=>{\n\t\t\tclear_auth0_token_error(this.ctx)\n\t\t\tclear_inputs(dom_a_('input[type=text]', root))\n\t\t\tclear_inputs(dom_a_('input[type=password]', root))\n\t\t}, 100)\n\t}\n\treadonly onsubmit_signup = async (event:Event, ctx:onsubmit_signup_Ctx, schedule_forms_clear = ()=>{})=>{\n\t\tevent.preventDefault()\n\t\tconst {\n\t\t\temail_input,\n\t\t\tpassword_input,\n\t\t\tpassword_confirmation_input,\n\t\t} = ctx\n\t\tconst email = email_input.value\n\t\tconst password = password_input.value\n\t\tconst password_confirmation = password_confirmation_input.value\n\t\tconst auth0_token_error =\n\t\t\tvalidate_auth0_signup({\n\t\t\t\temail,\n\t\t\t\tpassword,\n\t\t\t\tpassword_confirmation\n\t\t\t})\n\t\tif (auth0_token_error) {\n\t\t\tlogout_auth0_token_error(this.ctx, auth0_token_error)\n\t\t\treturn false\n\t\t}\n\t\tawait this.signup({\n\t\t\temail,\n\t\t\tpassword\n\t\t}, schedule_forms_clear)\n\t\treturn\n\t}\n\treadonly onsubmit_login = async (event:Event, ctx:onsubmit_login_Ctx, schedule_forms_clear = ()=>{})=>{\n\t\tevent.preventDefault()\n\t\tconst { username_login_input, password_login_input } = ctx\n\t\tconst username = username_login_input.value\n\t\tconst password = password_login_input.value\n\t\tawait this.login({ username, password }, schedule_forms_clear)\n\t}\n\treadonly onsubmit_forgot_password = async (event:Event, ctx:onsubmit_forgot_password_Ctx)=>{\n\t\tevent.preventDefault()\n\t\tconst { email_input } = ctx\n\t\tconst email = email_input.value\n\t\tconst data:post_auth0_passwordless_start_optional_body_T = {\n\t\t\tconnection: 'email',\n\t\t\tsend: 'link',\n\t\t\temail\n\t\t}\n\t\tconst auth0_token_error = validate_auth0_forgot_password(data)\n\t\tif (auth0_token_error) {\n\t\t\tlogout_auth0_token_error(this.ctx, auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tawait post_auth0_passwordless_start(\n\t\t\tthis.ctx, this.login_auth0_body_(data) as post_auth0_passwordless_start_body_T\n\t\t)\n\t\topen_auth0_forgot_password_check_email(this.ctx)\n\t}\n\treadonly onsubmit_change_password = async (\n\t\tevent:Event, ctx:onsubmit_change_password_Ctx, schedule_forms_clear = noop\n\t)=>{\n\t\tevent.preventDefault()\n\t\tconst {\n\t\t\tpassword_input,\n\t\t\tpassword_confirmation_input,\n\t\t} = ctx\n\t\tconst password = password_input.value\n\t\tconst password_confirmation = password_confirmation_input.value\n\t\tconst auth0_token_error =\n\t\t\tvalidate_auth0_change_password(\n\t\t\t\t{\n\t\t\t\t\tpassword,\n\t\t\t\t\tpassword_confirmation\n\t\t\t\t})\n\t\tif (auth0_token_error) {\n\t\t\tlogout_auth0_token_error(this.ctx, auth0_token_error)\n\t\t\tthrow auth0_token_error\n\t\t}\n\t\treturn await this.change_password({ password }, schedule_forms_clear)\n\t}\n\treadonly onclose = async (event:MouseEvent)=>{\n\t\tevent.preventDefault()\n\t\tthis.close_auth0()\n\t}\n}\nfunction clear_inputs(inputs:NodeList) {\n\tfor (let i = 0; i < inputs.length; i++) {\n\t\tconst input = inputs[i] as HTMLInputElement\n\t\tinput.value = ''\n\t}\n}\nexport interface signup_data_password_realm_body_I\n\textends signup_data_I,\n\t\tauth0_client_id_body_I,\n\t\tpost_auth0_passwordless_start_body_T,\n\t\tpassword_realm_body_T,\n\t\tauth0_grant_type_body_I,\n\t\tpost_auth0_oauth_token_body_I {}\nexport interface login_data_password_realm_body_I\n\textends login_data_I,\n\t\tauth0_client_id_body_I,\n\t\tpost_auth0_passwordless_start_body_T,\n\t\tpassword_realm_body_T,\n\t\tauth0_grant_type_body_I,\n\t\tpost_auth0_oauth_token_body_I {}\nexport interface onsubmit_change_password_Ctx {\n\tpassword_input:HTMLInputElement\n\tpassword_confirmation_input:HTMLInputElement\n}\nexport interface onsubmit_forgot_password_Ctx {\n\temail_input:HTMLInputElement\n}\nexport interface onsubmit_login_Ctx {\n\tusername_login_input:HTMLInputElement\n\tpassword_login_input:HTMLInputElement\n}\nexport interface onsubmit_signup_Ctx {\n\temail_input:HTMLInputElement\n\tpassword_input:HTMLInputElement\n\tpassword_confirmation_input:HTMLInputElement\n}\n"],"names":["onDestroy","auth0_body_","auth0_opened_class$_","auth0_token_error$_","auth0_token_json$_","clear_auth0_token_error","close_auth0","logout_auth0_token_error","open_auth0_forgot_password_check_email","open_auth0_login","password_realm_body_","post_auth0_auth_change_password","post_auth0_dbconnections_signup","post_auth0_oauth_token","post_auth0_passwordless_start","validate_auth0_change_password","validate_auth0_forgot_password","validate_auth0_signup","has_dom","dom_a_","noop","Auth0_c","constructor","ctx","login_auth0_body_","data","login_password_realm_body_","signup_auth0_body_","signup_password_realm_body_","auth0_opened_class","auth0_token_json$","auth0_token_error$","onMount","root","unsubscribe","subscribe","schedule_forms_clear","login","auth0_token","response","ok","auth0_token_json","JSON","stringify","$","auth_token_error","signup","auth0_userinfo","auth0_userinfo_Auth0Error","statusCode","code","description","email","auth0_token_error","username","password","change_password","form","error","response_json","status","e","console","warn","message","schedule_forms_clear_","setTimeout","clear_inputs","onsubmit_signup","event","preventDefault","email_input","password_input","password_confirmation_input","value","password_confirmation","onsubmit_login","username_login_input","password_login_input","onsubmit_forgot_password","connection","send","onsubmit_change_password","onclose","inputs","i","length","input"],"mappings":"AACA,SAASA,SAAS,QAAQ,QAAQ,CAAA;AAKlC,SACCC,WAAW,EAAEC,oBAAoB,EAAEC,mBAAmB,EAAEC,kBAAkB,EAAEC,uBAAuB,EACnGC,WAAW,EAAEC,wBAAwB,EAAEC,sCAAsC,EAAEC,gBAAgB,EAC/FC,oBAAoB,EAAEC,+BAA+B,EAAEC,+BAA+B,EACtFC,sBAAsB,EAAEC,6BAA6B,EAAEC,8BAA8B,EACrFC,8BAA8B,EAAEC,qBAAqB,QAC/C,iBAAiB,CAAA;AACxB,SAASC,OAAO,EAAEC,MAAM,QAAQ,eAAe,CAAA;AAC/C,SAASC,IAAI,QAAQ,oBAAoB,CAAA;AAEzC,OAAO,MAAMC,OAAO;IACnBC,YAAsBC,IAAO,CAAE;aAATA,GAAO,GAAPA,IAAO;aACpBC,iBAAiB,GAAG,CAACC,IAAQ,GACrCxB,WAAW,CACV,IAAI,CAACsB,GAAG,EAAEE,IAAI,CACd;aACOC,0BAA0B,GAAG,CAACD,IAAQ,GAC9Cf,oBAAoB,CACnB,IAAI,CAACa,GAAG,EACR,IAAI,CAACC,iBAAiB,CAACC,IAAI,CAAC,CAC5B;aACOE,kBAAkB,GAAG,CAACF,IAAQ,GACtCxB,WAAW,CAAoC,IAAI,CAACsB,GAAG,EAAEE,IAAI,CAAC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ts"],"sourcesContent":["import type { Auth0Error } from 'auth0-js'\nimport { onDestroy } from 'svelte'\nimport type {\n\tauth0_client_id_body_I, auth0_grant_type_body_I, login_data_I, password_realm_body_T, post_auth0_oauth_token_body_I,\n\tpost_auth0_passwordless_start_body_T, post_auth0_passwordless_start_optional_body_T, signup_data_I\n} from '@ctx-core/auth0'\nimport {\n\tauth0_body_, auth0_opened_class__, auth0_token_error__, auth0_token_json__, clear_auth0_token_error,\n\tclose_auth0, logout_auth0_token_error, open_auth0_forgot_password_check_email, open_auth0_login,\n\tpassword_realm_body_, post_auth0_auth_change_password, post_auth0_dbconnections_signup,\n\tpost_auth0_oauth_token, post_auth0_passwordless_start, validate_auth0_change_password,\n\tvalidate_auth0_forgot_password, validate_auth0_signup\n} from '@ctx-core/auth0'\nimport { has_dom, dom_a_ } from '@ctx-core/dom'\nimport { noop } from '@ctx-core/function'\nimport type { Ctx } from '@ctx-core/object'\nexport class Auth0_c {\n\tconstructor(protected ctx:Ctx) {}\n\treadonly login_auth0_body_ = (data:any)=>\n\t\tauth0_body_<login_data_password_realm_body_I>(\n\t\t\tthis.ctx, data\n\t\t)\n\treadonly login_password_realm_body_ = (data:any)=>\n\t\tpassword_realm_body_<login_data_password_realm_body_I>(\n\t\t\tthis.ctx,\n\t\t\tthis.login_auth0_body_(data)\n\t\t)\n\treadonly signup_auth0_body_ = (data:any)=>\n\t\tauth0_body_<signup_data_password_realm_body_I>(this.ctx, data) as signup_data_password_realm_body_I\n\treadonly signup_password_realm_body_ = (data:any)=>\n\t\tpassword_realm_body_<signup_data_password_realm_body_I>(this.ctx, this.signup_auth0_body_(data))\n\treadonly auth0_opened_class = auth0_opened_class__(this.ctx)\n\treadonly auth0_token_json_ = auth0_token_json__(this.ctx)\n\treadonly auth0_token_error_ = auth0_token_error__(this.ctx)\n\treadonly close_auth0 = ()=>close_auth0(this.ctx)\n\treadonly onMount = async (root:HTMLElement)=>{\n\t\tif (has_dom) {\n\t\t\tconst unsubscribe =\n\t\t\t\tthis.auth0_opened_class.subscribe(()=>this.schedule_forms_clear(root))\n\t\t\tonDestroy(unsubscribe)\n\t\t}\n\t}\n\treadonly login = async (data:login_data_I, schedule_forms_clear = ()=>{})=>{\n\t\tconst [auth0_token, response] = await post_auth0_oauth_token(\n\t\t\tthis.ctx, this.login_password_realm_body_(data)\n\t\t)\n\t\tif (response.ok) {\n\t\t\tconst auth0_token_json = JSON.stringify(auth0_token)\n\t\t\tthis.auth0_token_json_.$ = auth0_token_json\n\t\t\tschedule_forms_clear()\n\t\t\tthis.close_auth0()\n\t\t} else {\n\t\t\tconst auth_token_error = auth0_token as Auth0Error\n\t\t\tthis.auth0_token_error_.$ = auth_token_error\n\t\t\tlogout_auth0_token_error(this.ctx, auth_token_error)\n\t\t}\n\t}\n\treadonly signup = async (data:signup_data_I, schedule_forms_clear = ()=>{})=>{\n\t\tconst [auth0_userinfo] = await post_auth0_dbconnections_signup(\n\t\t\tthis.ctx,\n\t\t\tthis.signup_password_realm_body_(data))\n\t\tconst auth0_userinfo_Auth0Error = auth0_userinfo as Auth0Error\n\t\tconst { statusCode } = auth0_userinfo_Auth0Error\n\t\tif (statusCode) {\n\t\t\tconst {\n\t\t\t\tcode,\n\t\t\t\tdescription\n\t\t\t} = auth0_userinfo_Auth0Error\n\t\t\tconst email =\n\t\t\t\tcode === 'user_exists'\n\t\t\t\t? 'This Email is already signed up'\n\t\t\t\t: description || ''\n\t\t\tconst auth0_token_error = { email }\n\t\t\tlogout_auth0_token_error(this.ctx, auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tschedule_forms_clear()\n\t\tawait this.login({\n\t\t\tusername: data.email,\n\t\t\tpassword: data.password,\n\t\t}, schedule_forms_clear)\n\t}\n\treadonly change_password = async (form:{ password:string }, schedule_forms_clear = ()=>{})=>{\n\t\tconst { password } = form\n\t\tlet error\n\t\ttry {\n\t\t\tconst [response_json, response] = await post_auth0_auth_change_password(this.ctx, password)\n\t\t\tif (!response.ok) {\n\t\t\t\tif (response.status == 401) {\n\t\t\t\t\topen_auth0_login(this.ctx)\n\t\t\t\t\tconst auth0_token_error = { username: 'Authentication Error - Log in' }\n\t\t\t\t\tlogout_auth0_token_error(this.ctx, auth0_token_error)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\terror = response_json.error || 'Error changing Password'\n\t\t\t}\n\t\t} catch (e:any) {\n\t\t\tconsole.warn(e)\n\t\t\terror = e.message\n\t\t}\n\t\tif (error) {\n\t\t\tconst auth0_token_error = { password: error }\n\t\t\tlogout_auth0_token_error(this.ctx, auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tschedule_forms_clear()\n\t\tthis.close_auth0()\n\t}\n\treadonly schedule_forms_clear_:(root:HTMLElement)=>void = (root:HTMLElement)=>{\n\t\treturn ()=>this.schedule_forms_clear(root)\n\t}\n\treadonly schedule_forms_clear = (root:HTMLElement)=>{\n\t\tsetTimeout(()=>{\n\t\t\tclear_auth0_token_error(this.ctx)\n\t\t\tclear_inputs(dom_a_('input[type=text]', root))\n\t\t\tclear_inputs(dom_a_('input[type=password]', root))\n\t\t}, 100)\n\t}\n\treadonly onsubmit_signup = async (event:Event, ctx:onsubmit_signup_Ctx, schedule_forms_clear = ()=>{})=>{\n\t\tevent.preventDefault()\n\t\tconst {\n\t\t\temail_input,\n\t\t\tpassword_input,\n\t\t\tpassword_confirmation_input,\n\t\t} = ctx\n\t\tconst email = email_input.value\n\t\tconst password = password_input.value\n\t\tconst password_confirmation = password_confirmation_input.value\n\t\tconst auth0_token_error =\n\t\t\tvalidate_auth0_signup({\n\t\t\t\temail,\n\t\t\t\tpassword,\n\t\t\t\tpassword_confirmation\n\t\t\t})\n\t\tif (auth0_token_error) {\n\t\t\tlogout_auth0_token_error(this.ctx, auth0_token_error)\n\t\t\treturn false\n\t\t}\n\t\tawait this.signup({\n\t\t\temail,\n\t\t\tpassword\n\t\t}, schedule_forms_clear)\n\t\treturn\n\t}\n\treadonly onsubmit_login = async (event:Event, ctx:onsubmit_login_Ctx, schedule_forms_clear = ()=>{})=>{\n\t\tevent.preventDefault()\n\t\tconst { username_login_input, password_login_input } = ctx\n\t\tconst username = username_login_input.value\n\t\tconst password = password_login_input.value\n\t\tawait this.login({ username, password }, schedule_forms_clear)\n\t}\n\treadonly onsubmit_forgot_password = async (event:Event, ctx:onsubmit_forgot_password_Ctx)=>{\n\t\tevent.preventDefault()\n\t\tconst { email_input } = ctx\n\t\tconst email = email_input.value\n\t\tconst data:post_auth0_passwordless_start_optional_body_T = {\n\t\t\tconnection: 'email',\n\t\t\tsend: 'link',\n\t\t\temail\n\t\t}\n\t\tconst auth0_token_error = validate_auth0_forgot_password(data)\n\t\tif (auth0_token_error) {\n\t\t\tlogout_auth0_token_error(this.ctx, auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tawait post_auth0_passwordless_start(\n\t\t\tthis.ctx, this.login_auth0_body_(data) as post_auth0_passwordless_start_body_T\n\t\t)\n\t\topen_auth0_forgot_password_check_email(this.ctx)\n\t}\n\treadonly onsubmit_change_password = async (\n\t\tevent:Event, ctx:onsubmit_change_password_Ctx, schedule_forms_clear = noop\n\t)=>{\n\t\tevent.preventDefault()\n\t\tconst {\n\t\t\tpassword_input,\n\t\t\tpassword_confirmation_input,\n\t\t} = ctx\n\t\tconst password = password_input.value\n\t\tconst password_confirmation = password_confirmation_input.value\n\t\tconst auth0_token_error =\n\t\t\tvalidate_auth0_change_password(\n\t\t\t\t{\n\t\t\t\t\tpassword,\n\t\t\t\t\tpassword_confirmation\n\t\t\t\t})\n\t\tif (auth0_token_error) {\n\t\t\tlogout_auth0_token_error(this.ctx, auth0_token_error)\n\t\t\tthrow auth0_token_error\n\t\t}\n\t\treturn await this.change_password({ password }, schedule_forms_clear)\n\t}\n\treadonly onclose = async (event:MouseEvent)=>{\n\t\tevent.preventDefault()\n\t\tthis.close_auth0()\n\t}\n}\nfunction clear_inputs(inputs:NodeList) {\n\tfor (let i = 0; i < inputs.length; i++) {\n\t\tconst input = inputs[i] as HTMLInputElement\n\t\tinput.value = ''\n\t}\n}\nexport interface signup_data_password_realm_body_I\n\textends signup_data_I,\n\t\tauth0_client_id_body_I,\n\t\tpost_auth0_passwordless_start_body_T,\n\t\tpassword_realm_body_T,\n\t\tauth0_grant_type_body_I,\n\t\tpost_auth0_oauth_token_body_I {}\nexport interface login_data_password_realm_body_I\n\textends login_data_I,\n\t\tauth0_client_id_body_I,\n\t\tpost_auth0_passwordless_start_body_T,\n\t\tpassword_realm_body_T,\n\t\tauth0_grant_type_body_I,\n\t\tpost_auth0_oauth_token_body_I {}\nexport interface onsubmit_change_password_Ctx {\n\tpassword_input:HTMLInputElement\n\tpassword_confirmation_input:HTMLInputElement\n}\nexport interface onsubmit_forgot_password_Ctx {\n\temail_input:HTMLInputElement\n}\nexport interface onsubmit_login_Ctx {\n\tusername_login_input:HTMLInputElement\n\tpassword_login_input:HTMLInputElement\n}\nexport interface onsubmit_signup_Ctx {\n\temail_input:HTMLInputElement\n\tpassword_input:HTMLInputElement\n\tpassword_confirmation_input:HTMLInputElement\n}\n"],"names":["onDestroy","auth0_body_","auth0_opened_class__","auth0_token_error__","auth0_token_json__","clear_auth0_token_error","close_auth0","logout_auth0_token_error","open_auth0_forgot_password_check_email","open_auth0_login","password_realm_body_","post_auth0_auth_change_password","post_auth0_dbconnections_signup","post_auth0_oauth_token","post_auth0_passwordless_start","validate_auth0_change_password","validate_auth0_forgot_password","validate_auth0_signup","has_dom","dom_a_","noop","Auth0_c","constructor","ctx","login_auth0_body_","data","login_password_realm_body_","signup_auth0_body_","signup_password_realm_body_","auth0_opened_class","auth0_token_json_","auth0_token_error_","onMount","root","unsubscribe","subscribe","schedule_forms_clear","login","auth0_token","response","ok","auth0_token_json","JSON","stringify","$","auth_token_error","signup","auth0_userinfo","auth0_userinfo_Auth0Error","statusCode","code","description","email","auth0_token_error","username","password","change_password","form","error","response_json","status","e","console","warn","message","schedule_forms_clear_","setTimeout","clear_inputs","onsubmit_signup","event","preventDefault","email_input","password_input","password_confirmation_input","value","password_confirmation","onsubmit_login","username_login_input","password_login_input","onsubmit_forgot_password","connection","send","onsubmit_change_password","onclose","inputs","i","length","input"],"mappings":"AACA,SAASA,SAAS,QAAQ,QAAQ,CAAA;AAKlC,SACCC,WAAW,EAAEC,oBAAoB,EAAEC,mBAAmB,EAAEC,kBAAkB,EAAEC,uBAAuB,EACnGC,WAAW,EAAEC,wBAAwB,EAAEC,sCAAsC,EAAEC,gBAAgB,EAC/FC,oBAAoB,EAAEC,+BAA+B,EAAEC,+BAA+B,EACtFC,sBAAsB,EAAEC,6BAA6B,EAAEC,8BAA8B,EACrFC,8BAA8B,EAAEC,qBAAqB,QAC/C,iBAAiB,CAAA;AACxB,SAASC,OAAO,EAAEC,MAAM,QAAQ,eAAe,CAAA;AAC/C,SAASC,IAAI,QAAQ,oBAAoB,CAAA;AAEzC,OAAO,MAAMC,OAAO;IACnBC,YAAsBC,IAAO,CAAE;aAATA,GAAO,GAAPA,IAAO;aACpBC,iBAAiB,GAAG,CAACC,IAAQ,GACrCxB,WAAW,CACV,IAAI,CAACsB,GAAG,EAAEE,IAAI,CACd;aACOC,0BAA0B,GAAG,CAACD,IAAQ,GAC9Cf,oBAAoB,CACnB,IAAI,CAACa,GAAG,EACR,IAAI,CAACC,iBAAiB,CAACC,IAAI,CAAC,CAC5B;aACOE,kBAAkB,GAAG,CAACF,IAAQ,GACtCxB,WAAW,CAAoC,IAAI,CAACsB,GAAG,EAAEE,IAAI,CAAC,AAAqC;aAC3FG,2BAA2B,GAAG,CAACH,IAAQ,GAC/Cf,oBAAoB,CAAoC,IAAI,CAACa,GAAG,EAAE,IAAI,CAACI,kBAAkB,CAACF,IAAI,CAAC,CAAC;aACxFI,kBAAkB,GAAG3B,oBAAoB,CAAC,IAAI,CAACqB,GAAG,CAAC;aACnDO,iBAAiB,GAAG1B,kBAAkB,CAAC,IAAI,CAACmB,GAAG,CAAC;aAChDQ,kBAAkB,GAAG5B,mBAAmB,CAAC,IAAI,CAACoB,GAAG,CAAC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ACtB,MAAM,EACLE,cAAc,CAAA,EACdC,2BAA2B,CAAA,IAC3B,GAAGlD,GAAG;YACP,MAAMgC,QAAQ,GAAGiB,cAAc,CAACE,KAAK;YACrC,MAAMC,qBAAqB,GAAGF,2BAA2B,CAACC,KAAK;YAC/D,MAAMrB,iBAAiB,GACtBtC,8BAA8B,CAC7B;gBACCwC,QAAQ;gBACRoB,qBAAqB;aACrB,CAAC;YACJ,IAAItB,iBAAiB,EAAE;gBACtB9C,wBAAwB,CAAC,IAAI,CAACgB,GAAG,EAAE8B,iBAAiB,CAAC;gBACrD,MAAMA,iBAAiB,CAAA;aACvB;YACD,OAAO,MAAM,IAAI,CAACG,eAAe,CAAC;gBAAED,QAAQ;aAAE,EAAEnB,oBAAoB,CAAC,CAAA;SACrE;aACQ+C,OAAO,GAAG,OAAOd,KAAgB,GAAG;YAC5CA,KAAK,CAACC,cAAc,EAAE;YACtB,IAAI,CAAChE,WAAW,EAAE;SAClB;KAlLgC;CAmLjC;AACD,SAAS6D,YAAY,CAACiB,MAAe,EAAE;IACtC,IAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,MAAM,CAACE,MAAM,EAAED,CAAC,EAAE,CAAE;QACvC,MAAME,KAAK,GAAGH,MAAM,CAACC,CAAC,CAAC,AAAoB;QAC3CE,KAAK,CAACb,KAAK,GAAG,EAAE;KAChB;CACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ctx-core/auth0-ui",
|
|
3
|
-
"version": "12.2.
|
|
3
|
+
"version": "12.2.85",
|
|
4
4
|
"description": "ctx-core auth0 ui component & express endpoints",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ctx-core",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"./package.json": "./package.json"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@ctx-core/auth0": "^34.
|
|
28
|
-
"@ctx-core/auth0-management": "^9.0.
|
|
29
|
-
"@ctx-core/dialog": "^20.0.
|
|
27
|
+
"@ctx-core/auth0": "^34.3.0",
|
|
28
|
+
"@ctx-core/auth0-management": "^9.0.64",
|
|
29
|
+
"@ctx-core/dialog": "^20.0.28",
|
|
30
30
|
"@ctx-core/dialog-ui-svelte": "^1.0.19",
|
|
31
31
|
"@ctx-core/dom": "^11.1.21",
|
|
32
32
|
"@ctx-core/error": "^11.4.8",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@ctx-core/object": "^22.2.0",
|
|
39
39
|
"@ctx-core/svelte": "^10.1.24",
|
|
40
40
|
"@swc/cli": "^0.1.57",
|
|
41
|
-
"@swc/core": "^1.2.
|
|
41
|
+
"@swc/core": "^1.2.194",
|
|
42
42
|
"auth0-js": "^9.19.0",
|
|
43
43
|
"jsonwebtoken": "^8.5.1",
|
|
44
44
|
"polka": "next"
|
package/src/ui/Auth0.svelte
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { setContext } from 'svelte'
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
auth0_forgot_password_opened__, auth0_opened_class__, auth0_login_opened__, auth0_signup_opened__,
|
|
5
|
+
auth0_forgot_password_check_email_opened__, auth0_change_password_opened__
|
|
6
6
|
} from '@ctx-core/auth0'
|
|
7
7
|
import { ctx_ } from '@ctx-core/object'
|
|
8
8
|
import { auth0_ui_ctx_key } from '../auth0_ui_ctx_key.js'
|
|
@@ -15,32 +15,32 @@ import Auth0_Login_Form from './Auth0_Login_Form.svelte'
|
|
|
15
15
|
import Auth0_Signup_Form from './Auth0_Signup_Form.svelte'
|
|
16
16
|
export let ctx = ctx_(), dialog = false
|
|
17
17
|
setContext(auth0_ui_ctx_key, ctx)
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
18
|
+
const auth0_change_password_opened_ = auth0_change_password_opened__(ctx)
|
|
19
|
+
const auth0_opened_class_ = auth0_opened_class__(ctx)
|
|
20
|
+
const auth0_forgot_password_check_email_opened_ = auth0_forgot_password_check_email_opened__(ctx)
|
|
21
|
+
const auth0_forgot_password_opened_ = auth0_forgot_password_opened__(ctx)
|
|
22
|
+
const auth0_login_opened_ = auth0_login_opened__(ctx)
|
|
23
|
+
const auth0_signup_opened_ = auth0_signup_opened__(ctx)
|
|
24
24
|
const _ = new Auth0_c(ctx)
|
|
25
25
|
</script>
|
|
26
26
|
|
|
27
27
|
<div
|
|
28
|
-
class="Auth0 {$
|
|
28
|
+
class="Auth0 {$auth0_opened_class_} {$$props.class || ''}"
|
|
29
29
|
class:dialog
|
|
30
|
-
class:visible={!!$
|
|
30
|
+
class:visible={!!$auth0_opened_class_}
|
|
31
31
|
>
|
|
32
32
|
<Auth0_Dialog_Close></Auth0_Dialog_Close>
|
|
33
|
-
{#if $
|
|
33
|
+
{#if $auth0_login_opened_}
|
|
34
34
|
<Auth0_Login_Form {...$$props}></Auth0_Login_Form>
|
|
35
|
-
{:else if $
|
|
35
|
+
{:else if $auth0_signup_opened_}
|
|
36
36
|
<Auth0_Signup_Form {...$$props}>
|
|
37
37
|
<div slot="tos__signup"></div>
|
|
38
38
|
</Auth0_Signup_Form>
|
|
39
|
-
{:else if $
|
|
39
|
+
{:else if $auth0_forgot_password_opened_}
|
|
40
40
|
<Auth0_Forgot_Password_Form {...$$props}></Auth0_Forgot_Password_Form>
|
|
41
|
-
{:else if $
|
|
41
|
+
{:else if $auth0_forgot_password_check_email_opened_}
|
|
42
42
|
<Auth0_Forgot_Password_Check_Email_Form></Auth0_Forgot_Password_Check_Email_Form>
|
|
43
|
-
{:else if $
|
|
43
|
+
{:else if $auth0_change_password_opened_}
|
|
44
44
|
<Auth0_Change_Password_Form {...$$props}></Auth0_Change_Password_Form>
|
|
45
45
|
{/if}
|
|
46
46
|
<slot></slot>
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { createEventDispatcher } from 'svelte'
|
|
3
|
-
import {
|
|
3
|
+
import { AUTH0_DOMAIN__, auth0_token_error__ } from '@ctx-core/auth0'
|
|
4
4
|
import { getContext_auth0_ui_ctx } from '../getContext_auth0_ui_ctx.js'
|
|
5
5
|
import { Auth0_c } from './Auth0_c.js'
|
|
6
6
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
7
7
|
const ctx = getContext_auth0_ui_ctx()
|
|
8
8
|
const dispatch = createEventDispatcher()
|
|
9
9
|
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const AUTH0_DOMAIN_ = AUTH0_DOMAIN__(ctx)
|
|
11
|
+
const auth0_token_error_ = auth0_token_error__(ctx)
|
|
12
12
|
const _ = new Auth0_c(ctx)
|
|
13
13
|
let root:HTMLDivElement
|
|
14
14
|
let password_input:HTMLInputElement
|
|
15
15
|
let password_confirmation_input
|
|
16
16
|
let password_error:any|undefined //region
|
|
17
|
-
$: password_error = $
|
|
17
|
+
$: password_error = $auth0_token_error_?.password //endregion
|
|
18
18
|
let password_error_confirmation:string|undefined //region
|
|
19
|
-
$: password_error_confirmation = $
|
|
19
|
+
$: password_error_confirmation = $auth0_token_error_?.password_confirmation //endregion
|
|
20
20
|
async function onsubmit_change_password(event:FormDataEvent) {
|
|
21
21
|
dispatch('submit__start')
|
|
22
22
|
try {
|
|
@@ -38,12 +38,12 @@ async function onsubmit_change_password(event:FormDataEvent) {
|
|
|
38
38
|
<Auth0_Dialog_Close></Auth0_Dialog_Close>
|
|
39
39
|
<h1>Change Password</h1>
|
|
40
40
|
<form
|
|
41
|
-
action="https://{$
|
|
41
|
+
action="https://{$AUTH0_DOMAIN_}/dbconnections/change_password"
|
|
42
42
|
accept-charset="UTF-8"
|
|
43
43
|
method="post"
|
|
44
44
|
on:submit|preventDefault={onsubmit_change_password}
|
|
45
45
|
>
|
|
46
|
-
{#if $
|
|
46
|
+
{#if $auth0_token_error_}
|
|
47
47
|
<ul>
|
|
48
48
|
{#if password_error}
|
|
49
49
|
<li class="error {error_class}">
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { AUTH0_DOMAIN__, auth0_token_error__, open_auth0_login, open_auth0_signup } from '@ctx-core/auth0'
|
|
3
3
|
import { getContext_auth0_ui_ctx } from '../getContext_auth0_ui_ctx.js'
|
|
4
4
|
import { Auth0_c } from './Auth0_c.js'
|
|
5
5
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
6
6
|
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
7
7
|
const ctx = getContext_auth0_ui_ctx()
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const AUTH0_DOMAIN_ = AUTH0_DOMAIN__(ctx)
|
|
9
|
+
const auth0_token_error_ = auth0_token_error__(ctx)
|
|
10
10
|
const _ = new Auth0_c(ctx)
|
|
11
|
-
let email_input:HTMLInputElement, error:typeof $
|
|
12
|
-
$: error = $
|
|
11
|
+
let email_input:HTMLInputElement, error:typeof $auth0_token_error_?.error
|
|
12
|
+
$: error = $auth0_token_error_?.error
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
<div class="form forgot_password">
|
|
16
16
|
<Auth0_Dialog_Close></Auth0_Dialog_Close>
|
|
17
17
|
<h1>Forgot Password</h1>
|
|
18
18
|
<form
|
|
19
|
-
action="https://{$
|
|
19
|
+
action="https://{$AUTH0_DOMAIN_}/passwordless/start"
|
|
20
20
|
accept-charset="UTF-8"
|
|
21
21
|
method="post"
|
|
22
22
|
on:submit={event => _.onsubmit_forgot_password(event, { email_input })}
|
|
23
23
|
>
|
|
24
|
-
{#if $
|
|
24
|
+
{#if $auth0_token_error_}
|
|
25
25
|
<ul>
|
|
26
26
|
<li class="error {error_class}">
|
|
27
|
-
{$
|
|
27
|
+
{$auth0_token_error_.error}: {$auth0_token_error_.error_description}
|
|
28
28
|
</li>
|
|
29
29
|
</ul>
|
|
30
30
|
{/if}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
AUTH0_DOMAIN__, auth0_token_error__, auth0_token_error_txt__, open_auth0_forgot_password, open_auth0_signup
|
|
4
4
|
} from '@ctx-core/auth0'
|
|
5
5
|
import type { Ctx } from '@ctx-core/object'
|
|
6
6
|
import { Auth0_c } from './Auth0_c.js'
|
|
7
7
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
8
8
|
export let ctx:Ctx, error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const AUTH0_DOMAIN =
|
|
9
|
+
const auth0_token_error_ = auth0_token_error__(ctx)
|
|
10
|
+
const auth0_token_error_txt_ = auth0_token_error_txt__(ctx)
|
|
11
|
+
const AUTH0_DOMAIN = AUTH0_DOMAIN__(ctx)
|
|
12
12
|
const _ = new Auth0_c(ctx)
|
|
13
13
|
let root:HTMLDivElement
|
|
14
14
|
let username_login_input:HTMLInputElement, password_login_input:HTMLInputElement
|
|
15
15
|
let error_username:string|undefined//region
|
|
16
|
-
$: error_username = $
|
|
16
|
+
$: error_username = $auth0_token_error_?.username //endregion
|
|
17
17
|
let error_password:string|undefined//region
|
|
18
|
-
$: error_password = $
|
|
18
|
+
$: error_password = $auth0_token_error_?.password //endregion
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<div bind:this={root} class="form {$$props.class||''}">
|
|
@@ -31,10 +31,10 @@ $: error_password = $auth0_token_error$?.password //endregion
|
|
|
31
31
|
password_login_input
|
|
32
32
|
}, ()=>_.schedule_forms_clear(root))}
|
|
33
33
|
>
|
|
34
|
-
{#if $
|
|
34
|
+
{#if $auth0_token_error_txt_}
|
|
35
35
|
<ul>
|
|
36
36
|
<li class="error {error_class}">
|
|
37
|
-
{$
|
|
37
|
+
{$auth0_token_error_txt_}
|
|
38
38
|
</li>
|
|
39
39
|
</ul>
|
|
40
40
|
{/if}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
AUTH0_DOMAIN__, auth0_token_error__, open_auth0_forgot_password, open_auth0_login,
|
|
4
4
|
} from '@ctx-core/auth0'
|
|
5
5
|
import { getContext_auth0_ui_ctx } from '../getContext_auth0_ui_ctx.js'
|
|
6
6
|
import { Auth0_c } from './Auth0_c.js'
|
|
7
7
|
import Auth0_Dialog_Close from './Auth0_Dialog_Close.svelte'
|
|
8
8
|
export let error_class = '', input_class = '', button_class = '', label_class = '.js'
|
|
9
9
|
const ctx = getContext_auth0_ui_ctx()
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const AUTH0_DOMAIN_ = AUTH0_DOMAIN__(ctx)
|
|
11
|
+
const auth0_token_error_ = auth0_token_error__(ctx)
|
|
12
12
|
const _ = new Auth0_c(ctx)
|
|
13
13
|
let root, signup_email_input, signup_password_input, signup_password_confirmation_input
|
|
14
14
|
let error_username:string|undefined //region
|
|
15
|
-
$: error_username = $
|
|
15
|
+
$: error_username = $auth0_token_error_?.username //endregion
|
|
16
16
|
let error_password:string|undefined //region
|
|
17
|
-
$: error_password = $
|
|
17
|
+
$: error_password = $auth0_token_error_?.password //endregion
|
|
18
18
|
let error_password_confirmation:boolean //region
|
|
19
|
-
$: error_password_confirmation = !!$
|
|
19
|
+
$: error_password_confirmation = !!$auth0_token_error_ //endregion
|
|
20
20
|
let error_text:string
|
|
21
21
|
$: {
|
|
22
22
|
let error_text_a = []
|
|
23
|
-
if ($
|
|
24
|
-
for (let key in $
|
|
25
|
-
error_text_a.push($
|
|
23
|
+
if ($auth0_token_error_) {
|
|
24
|
+
for (let key in $auth0_token_error_) {
|
|
25
|
+
error_text_a.push($auth0_token_error_[key])
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
error_text = error_text_a.join('<br>') || ''
|
|
@@ -33,7 +33,7 @@ $: {
|
|
|
33
33
|
<Auth0_Dialog_Close/>
|
|
34
34
|
<h1><slot name="signup_text">Sign Up</slot></h1>
|
|
35
35
|
<form
|
|
36
|
-
action="https://{$
|
|
36
|
+
action="https://{$AUTH0_DOMAIN_}/dbconnections/signup"
|
|
37
37
|
accept-charset="UTF-8"
|
|
38
38
|
method="post"
|
|
39
39
|
on:submit={event =>
|
|
@@ -44,7 +44,7 @@ $: {
|
|
|
44
44
|
}, _.schedule_forms_clear(root))
|
|
45
45
|
}
|
|
46
46
|
>
|
|
47
|
-
{#if $
|
|
47
|
+
{#if $auth0_token_error_}
|
|
48
48
|
<ul>
|
|
49
49
|
<li class="error {error_class}">
|
|
50
50
|
{error_text}
|
package/src/ui/Auth0_c.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
post_auth0_passwordless_start_body_T, post_auth0_passwordless_start_optional_body_T, signup_data_I
|
|
6
6
|
} from '@ctx-core/auth0'
|
|
7
7
|
import {
|
|
8
|
-
auth0_body_,
|
|
8
|
+
auth0_body_, auth0_opened_class__, auth0_token_error__, auth0_token_json__, clear_auth0_token_error,
|
|
9
9
|
close_auth0, logout_auth0_token_error, open_auth0_forgot_password_check_email, open_auth0_login,
|
|
10
10
|
password_realm_body_, post_auth0_auth_change_password, post_auth0_dbconnections_signup,
|
|
11
11
|
post_auth0_oauth_token, post_auth0_passwordless_start, validate_auth0_change_password,
|
|
@@ -29,9 +29,9 @@ export class Auth0_c {
|
|
|
29
29
|
auth0_body_<signup_data_password_realm_body_I>(this.ctx, data) as signup_data_password_realm_body_I
|
|
30
30
|
readonly signup_password_realm_body_ = (data:any)=>
|
|
31
31
|
password_realm_body_<signup_data_password_realm_body_I>(this.ctx, this.signup_auth0_body_(data))
|
|
32
|
-
readonly auth0_opened_class =
|
|
33
|
-
readonly
|
|
34
|
-
readonly
|
|
32
|
+
readonly auth0_opened_class = auth0_opened_class__(this.ctx)
|
|
33
|
+
readonly auth0_token_json_ = auth0_token_json__(this.ctx)
|
|
34
|
+
readonly auth0_token_error_ = auth0_token_error__(this.ctx)
|
|
35
35
|
readonly close_auth0 = ()=>close_auth0(this.ctx)
|
|
36
36
|
readonly onMount = async (root:HTMLElement)=>{
|
|
37
37
|
if (has_dom) {
|
|
@@ -46,12 +46,12 @@ export class Auth0_c {
|
|
|
46
46
|
)
|
|
47
47
|
if (response.ok) {
|
|
48
48
|
const auth0_token_json = JSON.stringify(auth0_token)
|
|
49
|
-
this.
|
|
49
|
+
this.auth0_token_json_.$ = auth0_token_json
|
|
50
50
|
schedule_forms_clear()
|
|
51
51
|
this.close_auth0()
|
|
52
52
|
} else {
|
|
53
53
|
const auth_token_error = auth0_token as Auth0Error
|
|
54
|
-
this.
|
|
54
|
+
this.auth0_token_error_.$ = auth_token_error
|
|
55
55
|
logout_auth0_token_error(this.ctx, auth_token_error)
|
|
56
56
|
}
|
|
57
57
|
}
|