@ctx-core/auth0-ui 12.2.3 → 12.2.7

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 CHANGED
@@ -1,5 +1,43 @@
1
1
  # @ctx-core/auth0-ui
2
2
 
3
+ ## 12.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - update dependencies
8
+ - Updated dependencies
9
+ - @ctx-core/auth0-management@8.0.3
10
+
11
+ ## 12.2.6
12
+
13
+ ### Patch Changes
14
+
15
+ - auth0-js: ^9.18.1 -> ^9.19.0
16
+ - Updated dependencies
17
+ - @ctx-core/auth0@29.0.2
18
+
19
+ ## 12.2.5
20
+
21
+ ### Patch Changes
22
+
23
+ - update dependencies
24
+ - Updated dependencies
25
+ - @ctx-core/auth0-management@8.0.1
26
+
27
+ ## 12.2.4
28
+
29
+ ### Patch Changes
30
+
31
+ - use fetch instead of safe_fetch
32
+ - Updated dependencies
33
+ - Updated dependencies
34
+ - Updated dependencies
35
+ - Updated dependencies
36
+ - Updated dependencies
37
+ - @ctx-core/auth0@29.0.0
38
+ - @ctx-core/auth0-management@8.0.0
39
+ - @ctx-core/fetch-undici@1.1.0
40
+
3
41
  ## 12.2.3
4
42
 
5
43
  ### Patch Changes
@@ -10,7 +10,7 @@ export declare class Auth0_c {
10
10
  readonly signup_password_realm_body_: password_realm_body__T<signup_data_password_realm_body_I>;
11
11
  readonly auth0_opened_class: import("@ctx-core/auth0").auth0_opened_class$_T;
12
12
  readonly auth0_token_json$: import("@ctx-core/auth0").auth0_token_json$_T;
13
- readonly auth0_token_error: import("@ctx-core/auth0").auth0_token_error$_T;
13
+ readonly auth0_token_error$: import("@ctx-core/auth0").auth0_token_error$_T;
14
14
  readonly clear_auth0_token_error: import("@ctx-core/auth0").clear_auth0_token_error_T;
15
15
  readonly close_auth0: import("@ctx-core/auth0").close_auth0_T;
16
16
  readonly logout_auth0_token_error: logout_auth0_token_error_T;
package/lib/ui/Auth0_c.js CHANGED
@@ -11,7 +11,7 @@ export class Auth0_c {
11
11
  this.signup_password_realm_body_ = password_realm_body__b(this.ctx, 'signup_password_realm_body_fn', this.signup_auth0_body_);
12
12
  this.auth0_opened_class = auth0_opened_class$_b(this.ctx);
13
13
  this.auth0_token_json$ = auth0_token_json$_b(this.ctx);
14
- this.auth0_token_error = auth0_token_error$_b(this.ctx);
14
+ this.auth0_token_error$ = auth0_token_error$_b(this.ctx);
15
15
  this.clear_auth0_token_error = clear_auth0_token_error_b(this.ctx);
16
16
  this.close_auth0 = close_auth0_b(this.ctx);
17
17
  this.logout_auth0_token_error = logout_auth0_token_error_b(this.ctx);
@@ -29,25 +29,25 @@ export class Auth0_c {
29
29
  }
30
30
  };
31
31
  this.login = async (data, schedule_forms_clear = ()=>{})=>{
32
- const response = await this.post_auth0_oauth_token(this.login_password_realm_body_(data));
32
+ const [auth0_token, response] = await this.post_auth0_oauth_token(this.login_password_realm_body_(data));
33
33
  if (response.ok) {
34
- const auth0_token_json = await response.text();
34
+ const auth0_token_json = JSON.stringify(auth0_token);
35
35
  this.auth0_token_json$.$ = auth0_token_json;
36
36
  schedule_forms_clear();
37
37
  this.close_auth0();
38
38
  } else {
39
- const $auth_token_error = await response.json();
40
- this.auth0_token_error.$ = $auth_token_error;
41
- this.logout_auth0_token_error($auth_token_error);
39
+ const auth_token_error = auth0_token;
40
+ this.auth0_token_error$.$ = auth_token_error;
41
+ this.logout_auth0_token_error(auth_token_error);
42
42
  }
43
43
  };
44
44
  this.signup = async (data, schedule_forms_clear = ()=>{})=>{
45
- const response = await this.post_auth0_dbconnections_signup(this.signup_password_realm_body_(data));
46
- const auth0_userinfo = await response.json();
47
- const { statusCode } = auth0_userinfo;
45
+ const [auth0_userinfo] = await this.post_auth0_dbconnections_signup(this.signup_password_realm_body_(data));
46
+ const auth0_userinfo_Auth0Error = auth0_userinfo;
47
+ const { statusCode } = auth0_userinfo_Auth0Error;
48
48
  if (statusCode) {
49
- const { code , description } = auth0_userinfo;
50
- const email = code === 'user_exists' ? 'This Email is already signed up' : description;
49
+ const { code , description } = auth0_userinfo_Auth0Error;
50
+ const email = code === 'user_exists' ? 'This Email is already signed up' : description || '';
51
51
  const auth0_token_error = {
52
52
  email
53
53
  };
@@ -64,8 +64,7 @@ export class Auth0_c {
64
64
  const { password } = form;
65
65
  let error;
66
66
  try {
67
- const response = await this.post_auth0_auth_change_password(password);
68
- const response_json = await response.json();
67
+ const [response_json, response] = await this.post_auth0_auth_change_password(password);
69
68
  if (!response.ok) {
70
69
  if (response.status == 401) {
71
70
  this.open_auth0_login();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ui/Auth0_c.ts"],"sourcesContent":["import { onDestroy } from 'svelte'\nimport type {\n\tauth0_body__T, auth0_client_id_body_I, auth0_grant_type_body_I, login_data_I, logout_auth0_token_error_T,\n\topen_auth0_forgot_password_check_email_T, open_auth0_login_T, password_realm_body__T, password_realm_body_T,\n\tpost_auth0_auth_change_password_T, post_auth0_dbconnections_signup_T, post_auth0_oauth_token_body_I,\n\tpost_auth0_oauth_token_T, post_auth0_passwordless_start_body_T, post_auth0_passwordless_start_optional_body_T,\n\tpost_auth0_passwordless_start_T, signup_data_I\n} from '@ctx-core/auth0'\nimport {\n\tauth0_body__b, auth0_opened_class$_b, auth0_token_error$_b, auth0_token_json$_b, clear_auth0_token_error_b,\n\tclose_auth0_b, logout_auth0_token_error_b, open_auth0_forgot_password_check_email_b, open_auth0_login_b,\n\tpassword_realm_body__b, post_auth0_auth_change_password_b, post_auth0_dbconnections_signup_b,\n\tpost_auth0_oauth_token_b, post_auth0_passwordless_start_b, 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_ =\n\t\tauth0_body__b<login_data_password_realm_body_I>(\n\t\t\tthis.ctx, 'login_auth0_body_') as auth0_body__T<login_data_password_realm_body_I>\n\treadonly login_password_realm_body_ = password_realm_body__b<login_data_password_realm_body_I>(\n\t\tthis.ctx,\n\t\t'login_password_realm_body_',\n\t\tthis.login_auth0_body_\n\t)\n\treadonly signup_auth0_body_ =\n\t\tauth0_body__b<signup_data_password_realm_body_I>(\n\t\t\tthis.ctx, 'signup_auth0_body_') as auth0_body__T<signup_data_password_realm_body_I>\n\treadonly signup_password_realm_body_:password_realm_body__T<signup_data_password_realm_body_I> =\n\t\tpassword_realm_body__b<signup_data_password_realm_body_I>(\n\t\t\tthis.ctx, 'signup_password_realm_body_fn', this.signup_auth0_body_\n\t\t)\n\treadonly auth0_opened_class = auth0_opened_class$_b(this.ctx)\n\treadonly auth0_token_json$ = auth0_token_json$_b(this.ctx)\n\treadonly auth0_token_error = auth0_token_error$_b(this.ctx)\n\treadonly clear_auth0_token_error = clear_auth0_token_error_b(this.ctx)\n\treadonly close_auth0 = close_auth0_b(this.ctx)\n\treadonly logout_auth0_token_error:logout_auth0_token_error_T = logout_auth0_token_error_b(this.ctx)\n\treadonly open_auth0_login:open_auth0_login_T = open_auth0_login_b(this.ctx)\n\treadonly open_auth0_forgot_password_check_email:open_auth0_forgot_password_check_email_T = open_auth0_forgot_password_check_email_b(this.ctx)\n\treadonly post_auth0_dbconnections_signup:post_auth0_dbconnections_signup_T = post_auth0_dbconnections_signup_b(this.ctx)\n\treadonly post_auth0_oauth_token:post_auth0_oauth_token_T = post_auth0_oauth_token_b(this.ctx)\n\treadonly post_auth0_auth_change_password:post_auth0_auth_change_password_T = post_auth0_auth_change_password_b(this.ctx)\n\treadonly post_auth0_passwordless_start:post_auth0_passwordless_start_T = post_auth0_passwordless_start_b(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 response = await this.post_auth0_oauth_token(\n\t\t\tthis.login_password_realm_body_(data)\n\t\t)\n\t\tif (response.ok) {\n\t\t\tconst auth0_token_json = await response.text()\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 = await response.json()\n\t\t\tthis.auth0_token_error.$ = $auth_token_error\n\t\t\tthis.logout_auth0_token_error($auth_token_error)\n\t\t}\n\t}\n\treadonly signup = async (data:signup_data_I, schedule_forms_clear = ()=>{})=>{\n\t\tconst response = await this.post_auth0_dbconnections_signup(this.signup_password_realm_body_(data))\n\t\tconst auth0_userinfo = await response.json()\n\t\tconst { statusCode } = auth0_userinfo\n\t\tif (statusCode) {\n\t\t\tconst {\n\t\t\t\tcode,\n\t\t\t\tdescription\n\t\t\t} = auth0_userinfo\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\tthis.logout_auth0_token_error(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 = await this.post_auth0_auth_change_password(password)\n\t\t\tconst response_json = await response.json()\n\t\t\tif (!response.ok) {\n\t\t\t\tif (response.status == 401) {\n\t\t\t\t\tthis.open_auth0_login()\n\t\t\t\t\tconst auth0_token_error = { username: 'Authentication Error - Log in' }\n\t\t\t\t\tthis.logout_auth0_token_error(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\tthis.logout_auth0_token_error(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\tthis.clear_auth0_token_error()\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\tthis.logout_auth0_token_error(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\tthis.logout_auth0_token_error(auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tawait this.post_auth0_passwordless_start(\n\t\t\tthis.login_auth0_body_(data) as post_auth0_passwordless_start_body_T\n\t\t)\n\t\tthis.open_auth0_forgot_password_check_email()\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\tthis.logout_auth0_token_error(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__b","auth0_opened_class$_b","auth0_token_error$_b","auth0_token_json$_b","clear_auth0_token_error_b","close_auth0_b","logout_auth0_token_error_b","open_auth0_forgot_password_check_email_b","open_auth0_login_b","password_realm_body__b","post_auth0_auth_change_password_b","post_auth0_dbconnections_signup_b","post_auth0_oauth_token_b","post_auth0_passwordless_start_b","validate_auth0_change_password","validate_auth0_forgot_password","validate_auth0_signup","has_dom","dom_a_","noop","Auth0_c","ctx","login_auth0_body_","login_password_realm_body_","signup_auth0_body_","signup_password_realm_body_","auth0_opened_class","auth0_token_json$","auth0_token_error","clear_auth0_token_error","close_auth0","logout_auth0_token_error","open_auth0_login","open_auth0_forgot_password_check_email","post_auth0_dbconnections_signup","post_auth0_oauth_token","post_auth0_auth_change_password","post_auth0_passwordless_start","onMount","root","unsubscribe","subscribe","schedule_forms_clear","login","data","response","ok","auth0_token_json","text","$","$auth_token_error","json","signup","auth0_userinfo","statusCode","code","description","email","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"],"mapp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CAAC;gBAACD,QAAQ;YAAC,CAAC,EAAEjB,oBAAoB;QACrE,CAAC;QAxLK,IA6LN,CAJS6C,OAAO,UAAUd,KAAgB,GAAG,CAAC;YAC7CA,KAAK,CAACC,cAAc;YACpB,IAAI,CAAC5C,WAAW;QACjB,CAAC;IA3L+B,CAAC;;SA6LzByC,YAAY,CAACiB,MAAe,EAAE,CAAC;IACvC,GAAG,CAAE,GAAG,CAACC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,MAAM,CAACE,MAAM,EAAED,CAAC,GAAI,CAAC;QACxC,KAAK,CAACE,KAAK,GAAGH,MAAM,CAACC,CAAC;QACtBE,KAAK,CAACb,KAAK,GAAG,CAAE;IACjB,CAAC;AACF,CAAC"}
1
+ {"version":3,"sources":["../../src/ui/Auth0_c.ts"],"sourcesContent":["import type { Auth0Error } from 'auth0-js'\nimport { onDestroy } from 'svelte'\nimport type {\n\tauth0_body__T, auth0_client_id_body_I, auth0_grant_type_body_I, login_data_I, logout_auth0_token_error_T,\n\topen_auth0_forgot_password_check_email_T, open_auth0_login_T, password_realm_body__T, password_realm_body_T,\n\tpost_auth0_auth_change_password_T, post_auth0_dbconnections_signup_T, post_auth0_oauth_token_body_I,\n\tpost_auth0_oauth_token_T, post_auth0_passwordless_start_body_T, post_auth0_passwordless_start_optional_body_T,\n\tpost_auth0_passwordless_start_T, signup_data_I\n} from '@ctx-core/auth0'\nimport {\n\tauth0_body__b, auth0_opened_class$_b, auth0_token_error$_b, auth0_token_json$_b, clear_auth0_token_error_b,\n\tclose_auth0_b, logout_auth0_token_error_b, open_auth0_forgot_password_check_email_b, open_auth0_login_b,\n\tpassword_realm_body__b, post_auth0_auth_change_password_b, post_auth0_dbconnections_signup_b,\n\tpost_auth0_oauth_token_b, post_auth0_passwordless_start_b, 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_ =\n\t\tauth0_body__b<login_data_password_realm_body_I>(\n\t\t\tthis.ctx, 'login_auth0_body_') as auth0_body__T<login_data_password_realm_body_I>\n\treadonly login_password_realm_body_ = password_realm_body__b<login_data_password_realm_body_I>(\n\t\tthis.ctx,\n\t\t'login_password_realm_body_',\n\t\tthis.login_auth0_body_\n\t)\n\treadonly signup_auth0_body_ =\n\t\tauth0_body__b<signup_data_password_realm_body_I>(\n\t\t\tthis.ctx, 'signup_auth0_body_') as auth0_body__T<signup_data_password_realm_body_I>\n\treadonly signup_password_realm_body_:password_realm_body__T<signup_data_password_realm_body_I> =\n\t\tpassword_realm_body__b<signup_data_password_realm_body_I>(\n\t\t\tthis.ctx, 'signup_password_realm_body_fn', this.signup_auth0_body_\n\t\t)\n\treadonly auth0_opened_class = auth0_opened_class$_b(this.ctx)\n\treadonly auth0_token_json$ = auth0_token_json$_b(this.ctx)\n\treadonly auth0_token_error$ = auth0_token_error$_b(this.ctx)\n\treadonly clear_auth0_token_error = clear_auth0_token_error_b(this.ctx)\n\treadonly close_auth0 = close_auth0_b(this.ctx)\n\treadonly logout_auth0_token_error:logout_auth0_token_error_T = logout_auth0_token_error_b(this.ctx)\n\treadonly open_auth0_login:open_auth0_login_T = open_auth0_login_b(this.ctx)\n\treadonly open_auth0_forgot_password_check_email:open_auth0_forgot_password_check_email_T = open_auth0_forgot_password_check_email_b(this.ctx)\n\treadonly post_auth0_dbconnections_signup:post_auth0_dbconnections_signup_T = post_auth0_dbconnections_signup_b(this.ctx)\n\treadonly post_auth0_oauth_token:post_auth0_oauth_token_T = post_auth0_oauth_token_b(this.ctx)\n\treadonly post_auth0_auth_change_password:post_auth0_auth_change_password_T = post_auth0_auth_change_password_b(this.ctx)\n\treadonly post_auth0_passwordless_start:post_auth0_passwordless_start_T = post_auth0_passwordless_start_b(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 this.post_auth0_oauth_token(\n\t\t\tthis.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\tthis.logout_auth0_token_error(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 this.post_auth0_dbconnections_signup(this.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\tthis.logout_auth0_token_error(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 this.post_auth0_auth_change_password(password)\n\t\t\tif (!response.ok) {\n\t\t\t\tif (response.status == 401) {\n\t\t\t\t\tthis.open_auth0_login()\n\t\t\t\t\tconst auth0_token_error = { username: 'Authentication Error - Log in' }\n\t\t\t\t\tthis.logout_auth0_token_error(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\tthis.logout_auth0_token_error(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\tthis.clear_auth0_token_error()\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\tthis.logout_auth0_token_error(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\tthis.logout_auth0_token_error(auth0_token_error)\n\t\t\treturn\n\t\t}\n\t\tawait this.post_auth0_passwordless_start(\n\t\t\tthis.login_auth0_body_(data) as post_auth0_passwordless_start_body_T\n\t\t)\n\t\tthis.open_auth0_forgot_password_check_email()\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\tthis.logout_auth0_token_error(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__b","auth0_opened_class$_b","auth0_token_error$_b","auth0_token_json$_b","clear_auth0_token_error_b","close_auth0_b","logout_auth0_token_error_b","open_auth0_forgot_password_check_email_b","open_auth0_login_b","password_realm_body__b","post_auth0_auth_change_password_b","post_auth0_dbconnections_signup_b","post_auth0_oauth_token_b","post_auth0_passwordless_start_b","validate_auth0_change_password","validate_auth0_forgot_password","validate_auth0_signup","has_dom","dom_a_","noop","Auth0_c","ctx","login_auth0_body_","login_password_realm_body_","signup_auth0_body_","signup_password_realm_body_","auth0_opened_class","auth0_token_json$","auth0_token_error$","clear_auth0_token_error","close_auth0","logout_auth0_token_error","open_auth0_login","open_auth0_forgot_password_check_email","post_auth0_dbconnections_signup","post_auth0_oauth_token","post_auth0_auth_change_password","post_auth0_passwordless_start","onMount","root","unsubscribe","subscribe","schedule_forms_clear","login","data","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,MAAM,GAAGA,SAAS,QAAQ,CAAQ;AAQlC,MAAM,GACLC,aAAa,EAAEC,qBAAqB,EAAEC,oBAAoB,EAAEC,mBAAmB,EAAEC,yBAAyB,EAC1GC,aAAa,EAAEC,0BAA0B,EAAEC,wCAAwC,EAAEC,kBAAkB,EACvGC,sBAAsB,EAAEC,iCAAiC,EAAEC,iCAAiC,EAC5FC,wBAAwB,EAAEC,+BAA+B,EAAEC,8BAA8B,EACzFC,8BAA8B,EAAEC,qBAAqB,QAC/C,CAAiB;AACxB,MAAM,GAAGC,OAAO,EAAEC,MAAM,QAAQ,CAAe;AAC/C,MAAM,GAAGC,IAAI,QAAQ,CAAoB;AAEzC,MAAM,OAAOC,OAAO;gBACGC,IAAO,CAAE,CAAC;aAAVA,GAAO,GAAPA,IAAO;QADvB,IA4LN,CA1LSC,iBAAiB,GACzBtB,aAAa,CACZ,IAAI,CAACqB,GAAG,EAAE,CAAmB;QAJzB,IA4LN,CAvLSE,0BAA0B,GAAGd,sBAAsB,CAC3D,IAAI,CAACY,GAAG,EACR,CAA4B,6BAC5B,IAAI,CAACC,iBAAiB;QARjB,IA4LN,CAlLSE,kBAAkB,GAC1BxB,aAAa,CACZ,IAAI,CAACqB,GAAG,EAAE,CAAoB;QAZ1B,IA4LN,CA/KSI,2BAA2B,GACnChB,sBAAsB,CACrB,IAAI,CAACY,GAAG,EAAE,CAA+B,gCAAE,IAAI,CAACG,kBAAkB;QAf9D,IA4LN,CA3KSE,kBAAkB,GAAGzB,qBAAqB,CAAC,IAAI,CAACoB,GAAG;QAjBtD,IA4LN,CA1KSM,iBAAiB,GAAGxB,m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,EAAE,EAAEtB,iBAAiB,EAAE,CAAC;gBACvB,IAAI,CAAC7B,wBAAwB,CAAC6B,iBAAiB;gBAC/C,KAAK,CAACA,iBAAiB;YACxB,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,IAAI,CAACG,eAAe,CAAC,CAAC;gBAACD,QAAQ;YAAC,CAAC,EAAEpB,oBAAoB;QACrE,CAAC;QAvLK,IA4LN,CAJSgD,OAAO,UAAUd,KAAgB,GAAG,CAAC;YAC7CA,KAAK,CAACC,cAAc;YACpB,IAAI,CAAC/C,WAAW;QACjB,CAAC;IA1L+B,CAAC;;SA4LzB4C,YAAY,CAACiB,MAAe,EAAE,CAAC;IACvC,GAAG,CAAE,GAAG,CAACC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,MAAM,CAACE,MAAM,EAAED,CAAC,GAAI,CAAC;QACxC,KAAK,CAACE,KAAK,GAAGH,MAAM,CAACC,CAAC;QACtBE,KAAK,CAACb,KAAK,GAAG,CAAE;IACjB,CAAC;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctx-core/auth0-ui",
3
- "version": "12.2.3",
3
+ "version": "12.2.7",
4
4
  "description": "ctx-core auth0 ui component & express endpoints",
5
5
  "keywords": [
6
6
  "ctx-core",
@@ -26,13 +26,13 @@
26
26
  "./package.json": "./package.json"
27
27
  },
28
28
  "dependencies": {
29
- "@ctx-core/auth0": "^28.1.2",
30
- "@ctx-core/auth0-management": "^7.1.5",
29
+ "@ctx-core/auth0": "^29.1.0",
30
+ "@ctx-core/auth0-management": "^8.0.3",
31
31
  "@ctx-core/dialog": "^18.0.16",
32
32
  "@ctx-core/dialog-ui-svelte": "^1.0.14",
33
33
  "@ctx-core/dom": "^11.1.5",
34
- "@ctx-core/error": "^11.1.23",
35
- "@ctx-core/fetch-undici": "^1.0.3",
34
+ "@ctx-core/error": "^11.3.0",
35
+ "@ctx-core/fetch-undici": "^1.1.0",
36
36
  "@ctx-core/function": "^20.4.0",
37
37
  "@ctx-core/http": "^9.0.22",
38
38
  "@ctx-core/jwt": "^10.0.50",
@@ -41,17 +41,18 @@
41
41
  "@ctx-core/svelte": "^10.1.7",
42
42
  "@swc/cli": "^0.1.55",
43
43
  "@swc/core": "^1.2.133",
44
- "auth0-js": "^9.18.1",
44
+ "auth0-js": "^9.19.0",
45
45
  "jsonwebtoken": "^8.5.1",
46
46
  "polka": "next"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@sveltejs/adapter-auto": "next",
50
50
  "@sveltejs/kit": "next",
51
+ "@types/auth0-js": "^9.14.5",
51
52
  "@types/jsonwebtoken": "^8.5.8",
52
53
  "@types/trouter": "^3.1.1",
53
54
  "rimraf": "^3.0.2",
54
- "svelte": "^3.46.2",
55
+ "svelte": "^3.46.3",
55
56
  "svelte-check": "^2.3.0",
56
57
  "svelte-preprocess": "^4.10.2",
57
58
  "svelte2tsx": "^0.4.14",
package/src/ui/Auth0_c.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Auth0Error } from 'auth0-js'
1
2
  import { onDestroy } from 'svelte'
2
3
  import type {
3
4
  auth0_body__T, auth0_client_id_body_I, auth0_grant_type_body_I, login_data_I, logout_auth0_token_error_T,
@@ -35,7 +36,7 @@ export class Auth0_c {
35
36
  )
36
37
  readonly auth0_opened_class = auth0_opened_class$_b(this.ctx)
37
38
  readonly auth0_token_json$ = auth0_token_json$_b(this.ctx)
38
- readonly auth0_token_error = auth0_token_error$_b(this.ctx)
39
+ readonly auth0_token_error$ = auth0_token_error$_b(this.ctx)
39
40
  readonly clear_auth0_token_error = clear_auth0_token_error_b(this.ctx)
40
41
  readonly close_auth0 = close_auth0_b(this.ctx)
41
42
  readonly logout_auth0_token_error:logout_auth0_token_error_T = logout_auth0_token_error_b(this.ctx)
@@ -53,33 +54,33 @@ export class Auth0_c {
53
54
  }
54
55
  }
55
56
  readonly login = async (data:login_data_I, schedule_forms_clear = ()=>{})=>{
56
- const response = await this.post_auth0_oauth_token(
57
+ const [auth0_token, response] = await this.post_auth0_oauth_token(
57
58
  this.login_password_realm_body_(data)
58
59
  )
59
60
  if (response.ok) {
60
- const auth0_token_json = await response.text()
61
+ const auth0_token_json = JSON.stringify(auth0_token)
61
62
  this.auth0_token_json$.$ = auth0_token_json
62
63
  schedule_forms_clear()
63
64
  this.close_auth0()
64
65
  } else {
65
- const $auth_token_error = await response.json()
66
- this.auth0_token_error.$ = $auth_token_error
67
- this.logout_auth0_token_error($auth_token_error)
66
+ const auth_token_error = auth0_token as Auth0Error
67
+ this.auth0_token_error$.$ = auth_token_error
68
+ this.logout_auth0_token_error(auth_token_error)
68
69
  }
69
70
  }
70
71
  readonly signup = async (data:signup_data_I, schedule_forms_clear = ()=>{})=>{
71
- const response = await this.post_auth0_dbconnections_signup(this.signup_password_realm_body_(data))
72
- const auth0_userinfo = await response.json()
73
- const { statusCode } = auth0_userinfo
72
+ const [auth0_userinfo] = await this.post_auth0_dbconnections_signup(this.signup_password_realm_body_(data))
73
+ const auth0_userinfo_Auth0Error = auth0_userinfo as Auth0Error
74
+ const { statusCode } = auth0_userinfo_Auth0Error
74
75
  if (statusCode) {
75
76
  const {
76
77
  code,
77
78
  description
78
- } = auth0_userinfo
79
+ } = auth0_userinfo_Auth0Error
79
80
  const email =
80
81
  code === 'user_exists'
81
82
  ? 'This Email is already signed up'
82
- : description
83
+ : description || ''
83
84
  const auth0_token_error = { email }
84
85
  this.logout_auth0_token_error(auth0_token_error)
85
86
  return
@@ -94,8 +95,7 @@ export class Auth0_c {
94
95
  const { password } = form
95
96
  let error
96
97
  try {
97
- const response = await this.post_auth0_auth_change_password(password)
98
- const response_json = await response.json()
98
+ const [response_json, response] = await this.post_auth0_auth_change_password(password)
99
99
  if (!response.ok) {
100
100
  if (response.status == 401) {
101
101
  this.open_auth0_login()