@keycloakify/svelte 0.1.12 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -193,7 +193,7 @@
193
193
  href="#"
194
194
  id="try-another-way"
195
195
  onclick={() => {
196
- document.forms['kc-select-try-another-way-form' as never].submit();
196
+ document.forms['kc-select-try-another-way-form' as never].requestSubmit();
197
197
  return false;
198
198
  }}
199
199
  >
@@ -5,6 +5,9 @@ export type KcContextLike = {
5
5
  ssoLoginInOtherTabsUrl: string;
6
6
  };
7
7
  scripts?: string[];
8
+ authenticationSession?: {
9
+ authSessionIdHash: string;
10
+ };
8
11
  };
9
12
  export declare function useInitialize(params: {
10
13
  kcContext: KcContextLike;
@@ -35,11 +35,14 @@ export function useInitialize(params) {
35
35
  }))),
36
36
  {
37
37
  type: 'module',
38
- textContent: `
39
- import { checkCookiesAndSetTimer } from "${url.resourcesPath}/js/authChecker.js";
40
-
41
- checkCookiesAndSetTimer("${url.ssoLoginInOtherTabsUrl}");
42
- `,
38
+ textContent: [
39
+ `import { startSessionPolling, checkAuthSession } from "${url.resourcesPath}/js/authChecker.js";`,
40
+ ``,
41
+ `startSessionPolling("${kcContext.url.ssoLoginInOtherTabsUrl}");`,
42
+ kcContext.authenticationSession === undefined
43
+ ? ''
44
+ : `checkAuthSession("${kcContext.authenticationSession.authSessionIdHash}");`,
45
+ ].join('\n'),
43
46
  },
44
47
  ],
45
48
  });
@@ -110,7 +110,7 @@
110
110
  )}
111
111
  data-sitekey={recaptchaSiteKey}
112
112
  data-callback={() => {
113
- (document.getElementById('kc-register-form') as HTMLFormElement).submit();
113
+ (document.getElementById('kc-register-form') as HTMLFormElement).requestSubmit();
114
114
  }}
115
115
  data-action={recaptchaAction}
116
116
  type="submit"
@@ -28,7 +28,7 @@
28
28
  return;
29
29
  }
30
30
 
31
- htmlFormElement.submit();
31
+ htmlFormElement.requestSubmit();
32
32
  });
33
33
  </script>
34
34
 
@@ -57,7 +57,7 @@
57
57
  // @ts-expect-error: Trusted Keycloak's code
58
58
  document.getElementById('executionValue').value = '${execution}';
59
59
  // @ts-expect-error: Trusted Keycloak's code
60
- document.getElementById('kc-error-credential-form').submit();
60
+ document.getElementById('kc-error-credential-form').requestSubmit();
61
61
  }}
62
62
  type="button"
63
63
  class={kcClsx('kcButtonClass', 'kcButtonPrimaryClass', 'kcButtonBlockClass', 'kcButtonLargeClass')}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keycloakify/svelte",
3
- "version": "0.1.12",
3
+ "version": "0.2.0",
4
4
  "description": "Svelte Components for Keycloakify",
5
5
  "keywords": [
6
6
  "keycloak",
@@ -432,7 +432,7 @@
432
432
  "release": "sh scripts/release.sh"
433
433
  },
434
434
  "peerDependencies": {
435
- "keycloakify": "^11.7.0",
435
+ "keycloakify": "^11.9.0",
436
436
  "svelte": "^5.0.0"
437
437
  },
438
438
  "devDependencies": {
@@ -452,7 +452,7 @@
452
452
  "eslint-plugin-svelte": "^3.10.1",
453
453
  "eslint-plugin-unused-imports": "^4.1.4",
454
454
  "globals": "^16.3.0",
455
- "keycloakify": "^11.8.50",
455
+ "keycloakify": "^11.9.0",
456
456
  "npm-check-updates": "^18.0.1",
457
457
  "prettier": "^3.6.2",
458
458
  "prettier-plugin-svelte": "^3.4.0",
@@ -193,7 +193,7 @@
193
193
  href="#"
194
194
  id="try-another-way"
195
195
  onclick={() => {
196
- document.forms['kc-select-try-another-way-form' as never].submit();
196
+ document.forms['kc-select-try-another-way-form' as never].requestSubmit();
197
197
  return false;
198
198
  }}
199
199
  >
@@ -11,6 +11,9 @@ export type KcContextLike = {
11
11
  ssoLoginInOtherTabsUrl: string;
12
12
  };
13
13
  scripts?: string[];
14
+ authenticationSession?: {
15
+ authSessionIdHash: string;
16
+ };
14
17
  };
15
18
 
16
19
  assert<keyof KcContextLike extends keyof KcContext ? true : false>();
@@ -50,11 +53,14 @@ export function useInitialize(params: { kcContext: KcContextLike; doUseDefaultCs
50
53
  }))),
51
54
  {
52
55
  type: 'module',
53
- textContent: `
54
- import { checkCookiesAndSetTimer } from "${url.resourcesPath}/js/authChecker.js";
55
-
56
- checkCookiesAndSetTimer("${url.ssoLoginInOtherTabsUrl}");
57
- `,
56
+ textContent: [
57
+ `import { startSessionPolling, checkAuthSession } from "${url.resourcesPath}/js/authChecker.js";`,
58
+ ``,
59
+ `startSessionPolling("${kcContext.url.ssoLoginInOtherTabsUrl}");`,
60
+ kcContext.authenticationSession === undefined
61
+ ? ''
62
+ : `checkAuthSession("${kcContext.authenticationSession.authSessionIdHash}");`,
63
+ ].join('\n'),
58
64
  },
59
65
  ],
60
66
  });
@@ -110,7 +110,7 @@
110
110
  )}
111
111
  data-sitekey={recaptchaSiteKey}
112
112
  data-callback={() => {
113
- (document.getElementById('kc-register-form') as HTMLFormElement).submit();
113
+ (document.getElementById('kc-register-form') as HTMLFormElement).requestSubmit();
114
114
  }}
115
115
  data-action={recaptchaAction}
116
116
  type="submit"
@@ -28,7 +28,7 @@
28
28
  return;
29
29
  }
30
30
 
31
- htmlFormElement.submit();
31
+ htmlFormElement.requestSubmit();
32
32
  });
33
33
  </script>
34
34
 
@@ -57,7 +57,7 @@
57
57
  // @ts-expect-error: Trusted Keycloak's code
58
58
  document.getElementById('executionValue').value = '${execution}';
59
59
  // @ts-expect-error: Trusted Keycloak's code
60
- document.getElementById('kc-error-credential-form').submit();
60
+ document.getElementById('kc-error-credential-form').requestSubmit();
61
61
  }}
62
62
  type="button"
63
63
  class={kcClsx('kcButtonClass', 'kcButtonPrimaryClass', 'kcButtonBlockClass', 'kcButtonLargeClass')}