@thunderid/react 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/auth/Callback/OAuthCallback.cjs +10 -4
- package/dist/cjs/components/auth/Callback/OAuthCallback.cjs.map +1 -1
- package/dist/cjs/components/auth/Callback/TokenCallback.cjs +8 -7
- package/dist/cjs/components/auth/Callback/TokenCallback.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs +13 -4
- package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs +52 -9
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs +11 -1
- package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs +18 -14
- package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs +35 -9
- package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs +7 -6
- package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs +16 -13
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs.map +1 -1
- package/dist/cjs/components/primitives/AffixedField/AffixedField.cjs +88 -0
- package/dist/cjs/components/primitives/AffixedField/AffixedField.cjs.map +1 -0
- package/dist/cjs/components/primitives/AffixedField/AffixedField.styles.cjs +130 -0
- package/dist/cjs/components/primitives/AffixedField/AffixedField.styles.cjs.map +1 -0
- package/dist/cjs/contexts/ComponentRenderer/ComponentRendererContext.cjs.map +1 -1
- package/dist/cjs/contexts/I18n/I18nProvider.cjs +2 -3
- package/dist/cjs/contexts/I18n/I18nProvider.cjs.map +1 -1
- package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs +4 -1
- package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs.map +1 -1
- package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs +5 -2
- package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -1
- package/dist/cjs/utils/composeAffixedInputs.cjs +74 -0
- package/dist/cjs/utils/composeAffixedInputs.cjs.map +1 -0
- package/dist/cjs/utils/oauth.cjs +3 -2
- package/dist/cjs/utils/oauth.cjs.map +1 -1
- package/dist/components/auth/Callback/OAuthCallback.d.ts.map +1 -1
- package/dist/components/auth/Callback/OAuthCallback.js +12 -6
- package/dist/components/auth/Callback/OAuthCallback.js.map +1 -1
- package/dist/components/auth/Callback/TokenCallback.d.ts.map +1 -1
- package/dist/components/auth/Callback/TokenCallback.js +8 -7
- package/dist/components/auth/Callback/TokenCallback.js.map +1 -1
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.d.ts.map +1 -1
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js +13 -4
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js.map +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.d.ts +12 -4
- package/dist/components/presentation/auth/AuthOptionFactory.d.ts.map +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.js +52 -9
- package/dist/components/presentation/auth/AuthOptionFactory.js.map +1 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.d.ts.map +1 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js +11 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js.map +1 -1
- package/dist/components/presentation/auth/Recovery/BaseRecovery.d.ts.map +1 -1
- package/dist/components/presentation/auth/Recovery/BaseRecovery.js +19 -15
- package/dist/components/presentation/auth/Recovery/BaseRecovery.js.map +1 -1
- package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignIn/BaseSignIn.js +37 -11
- package/dist/components/presentation/auth/SignIn/BaseSignIn.js.map +1 -1
- package/dist/components/presentation/auth/SignIn/SignIn.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignIn/SignIn.js +7 -6
- package/dist/components/presentation/auth/SignIn/SignIn.js.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.js +16 -13
- package/dist/components/presentation/auth/SignUp/BaseSignUp.js.map +1 -1
- package/dist/components/primitives/AffixedField/AffixedField.d.ts +52 -0
- package/dist/components/primitives/AffixedField/AffixedField.d.ts.map +1 -0
- package/dist/components/primitives/AffixedField/AffixedField.js +83 -0
- package/dist/components/primitives/AffixedField/AffixedField.js.map +1 -0
- package/dist/components/primitives/AffixedField/AffixedField.styles.d.ts +25 -0
- package/dist/components/primitives/AffixedField/AffixedField.styles.d.ts.map +1 -0
- package/dist/components/primitives/AffixedField/AffixedField.styles.js +127 -0
- package/dist/components/primitives/AffixedField/AffixedField.styles.js.map +1 -0
- package/dist/components/primitives/AffixedField/index.d.ts +20 -0
- package/dist/components/primitives/AffixedField/index.d.ts.map +1 -0
- package/dist/components/primitives/Dialog/Dialog.js +3 -3
- package/dist/components/primitives/Dialog/Dialog.js.map +1 -1
- package/dist/contexts/ComponentRenderer/ComponentRendererContext.d.ts +1 -0
- package/dist/contexts/ComponentRenderer/ComponentRendererContext.d.ts.map +1 -1
- package/dist/contexts/ComponentRenderer/ComponentRendererContext.js.map +1 -1
- package/dist/contexts/I18n/I18nProvider.d.ts +6 -0
- package/dist/contexts/I18n/I18nProvider.d.ts.map +1 -1
- package/dist/contexts/I18n/I18nProvider.js +3 -4
- package/dist/contexts/I18n/I18nProvider.js.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDContext.d.ts +5 -0
- package/dist/contexts/ThunderID/ThunderIDContext.d.ts.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDContext.js +3 -1
- package/dist/contexts/ThunderID/ThunderIDContext.js.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDProvider.js +6 -3
- package/dist/contexts/ThunderID/ThunderIDProvider.js.map +1 -1
- package/dist/utils/composeAffixedInputs.d.ts +52 -0
- package/dist/utils/composeAffixedInputs.d.ts.map +1 -0
- package/dist/utils/composeAffixedInputs.js +70 -0
- package/dist/utils/composeAffixedInputs.js.map +1 -0
- package/dist/utils/oauth.d.ts +2 -1
- package/dist/utils/oauth.d.ts.map +1 -1
- package/dist/utils/oauth.js +4 -3
- package/dist/utils/oauth.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Returns the sentinel key used to store the selected prefix `value` for the affixed
|
|
20
|
+
* field addressed by `identifier`. The vendor namespace controls the runtime string
|
|
21
|
+
* so consumers overriding `vendor` do not conflict with the SDK default.
|
|
22
|
+
*/
|
|
23
|
+
export declare const affixPrefixKey: (identifier: string, vendor?: string) => string;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the sentinel key used to store the postfix `value` for the affixed field
|
|
26
|
+
* addressed by `identifier`. See {@link affixPrefixKey}.
|
|
27
|
+
*/
|
|
28
|
+
export declare const affixPostfixKey: (identifier: string, vendor?: string) => string;
|
|
29
|
+
/**
|
|
30
|
+
* Rewrites `formData` (returns a new object) so that any affixed-input identifier
|
|
31
|
+
* tracked by matching sentinel prefix/postfix keys is replaced with its composed
|
|
32
|
+
* form `${prefix}${typed}${postfix}`. Sentinel keys are stripped from the result.
|
|
33
|
+
*
|
|
34
|
+
* Behaviour:
|
|
35
|
+
* - Prefix present, postfix present → `prefix + typed + postfix`.
|
|
36
|
+
* - Only prefix present → `prefix + typed`.
|
|
37
|
+
* - Only postfix present → `typed + postfix`.
|
|
38
|
+
* - Both empty / typed empty → the identifier is left untouched.
|
|
39
|
+
* - No sentinel keys → returns a shallow copy of `formData` unchanged.
|
|
40
|
+
*
|
|
41
|
+
* The input object is not mutated. This is component-type agnostic: any field carrying
|
|
42
|
+
* matching sentinel keys is composed, regardless of whether it originated from a
|
|
43
|
+
* TEXT_INPUT, EMAIL_INPUT, PASSWORD_INPUT, or PHONE_INPUT.
|
|
44
|
+
*
|
|
45
|
+
* @param formData - The current form values map (values indexed by field identifier).
|
|
46
|
+
* @param vendor - The vendor namespace configured on the SDK client, if any. Sentinel
|
|
47
|
+
* keys are resolved through this namespace so composition ignores unrelated keys
|
|
48
|
+
* written by other vendors when multiple SDK instances share a form.
|
|
49
|
+
*/
|
|
50
|
+
declare const composeAffixedInputs: (formData: Record<string, string>, vendor?: string) => Record<string, string>;
|
|
51
|
+
export default composeAffixedInputs;
|
|
52
|
+
//# sourceMappingURL=composeAffixedInputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composeAffixedInputs.d.ts","sourceRoot":"","sources":["../../src/utils/composeAffixedInputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAiBH;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,YAAY,MAAM,EAAE,SAAS,MAAM,KAAG,MAAkD,CAAC;AAExH;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,YAAY,MAAM,EAAE,SAAS,MAAM,KAAG,MAC3B,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,oBAAoB,GAAI,UAAU,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CA6BtG,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { getVendorPrefix } from "@thunderid/browser";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/composeAffixedInputs.ts
|
|
4
|
+
/**
|
|
5
|
+
* Returns the runtime sentinel prefix used to tag "selected prefix" entries in the
|
|
6
|
+
* form-state map. Resolved through the vendor namespace so white-labeled deployments
|
|
7
|
+
* do not collide with each other or with a real field identifier.
|
|
8
|
+
*/
|
|
9
|
+
const prefixSentinel = (vendor) => `__${getVendorPrefix(vendor)}_prefix__`;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the runtime sentinel prefix used to tag "postfix" entries in the form-state
|
|
12
|
+
* map. See {@link prefixSentinel}.
|
|
13
|
+
*/
|
|
14
|
+
const postfixSentinel = (vendor) => `__${getVendorPrefix(vendor)}_postfix__`;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the sentinel key used to store the selected prefix `value` for the affixed
|
|
17
|
+
* field addressed by `identifier`. The vendor namespace controls the runtime string
|
|
18
|
+
* so consumers overriding `vendor` do not conflict with the SDK default.
|
|
19
|
+
*/
|
|
20
|
+
const affixPrefixKey = (identifier, vendor) => `${prefixSentinel(vendor)}${identifier}`;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the sentinel key used to store the postfix `value` for the affixed field
|
|
23
|
+
* addressed by `identifier`. See {@link affixPrefixKey}.
|
|
24
|
+
*/
|
|
25
|
+
const affixPostfixKey = (identifier, vendor) => `${postfixSentinel(vendor)}${identifier}`;
|
|
26
|
+
/**
|
|
27
|
+
* Rewrites `formData` (returns a new object) so that any affixed-input identifier
|
|
28
|
+
* tracked by matching sentinel prefix/postfix keys is replaced with its composed
|
|
29
|
+
* form `${prefix}${typed}${postfix}`. Sentinel keys are stripped from the result.
|
|
30
|
+
*
|
|
31
|
+
* Behaviour:
|
|
32
|
+
* - Prefix present, postfix present → `prefix + typed + postfix`.
|
|
33
|
+
* - Only prefix present → `prefix + typed`.
|
|
34
|
+
* - Only postfix present → `typed + postfix`.
|
|
35
|
+
* - Both empty / typed empty → the identifier is left untouched.
|
|
36
|
+
* - No sentinel keys → returns a shallow copy of `formData` unchanged.
|
|
37
|
+
*
|
|
38
|
+
* The input object is not mutated. This is component-type agnostic: any field carrying
|
|
39
|
+
* matching sentinel keys is composed, regardless of whether it originated from a
|
|
40
|
+
* TEXT_INPUT, EMAIL_INPUT, PASSWORD_INPUT, or PHONE_INPUT.
|
|
41
|
+
*
|
|
42
|
+
* @param formData - The current form values map (values indexed by field identifier).
|
|
43
|
+
* @param vendor - The vendor namespace configured on the SDK client, if any. Sentinel
|
|
44
|
+
* keys are resolved through this namespace so composition ignores unrelated keys
|
|
45
|
+
* written by other vendors when multiple SDK instances share a form.
|
|
46
|
+
*/
|
|
47
|
+
const composeAffixedInputs = (formData, vendor) => {
|
|
48
|
+
const composed = { ...formData };
|
|
49
|
+
const prefixTag = prefixSentinel(vendor);
|
|
50
|
+
const postfixTag = postfixSentinel(vendor);
|
|
51
|
+
for (const key of Object.keys(formData)) {
|
|
52
|
+
if (!key.startsWith(prefixTag) && !key.startsWith(postfixTag)) continue;
|
|
53
|
+
const identifier = key.startsWith(prefixTag) ? key.slice(prefixTag.length) : key.slice(postfixTag.length);
|
|
54
|
+
const typed = composed[identifier] ?? "";
|
|
55
|
+
if (typed === "") {
|
|
56
|
+
delete composed[affixPrefixKey(identifier, vendor)];
|
|
57
|
+
delete composed[affixPostfixKey(identifier, vendor)];
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
composed[identifier] = `${composed[affixPrefixKey(identifier, vendor)] ?? ""}${typed}${composed[affixPostfixKey(identifier, vendor)] ?? ""}`;
|
|
61
|
+
delete composed[affixPrefixKey(identifier, vendor)];
|
|
62
|
+
delete composed[affixPostfixKey(identifier, vendor)];
|
|
63
|
+
}
|
|
64
|
+
return composed;
|
|
65
|
+
};
|
|
66
|
+
var composeAffixedInputs_default = composeAffixedInputs;
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
export { affixPostfixKey, affixPrefixKey, composeAffixedInputs_default as default };
|
|
70
|
+
//# sourceMappingURL=composeAffixedInputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composeAffixedInputs.js","names":["composed: Record<string, string>","prefixTag: string","postfixTag: string","identifier: string","typed: string"],"sources":["../../src/utils/composeAffixedInputs.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {getVendorPrefix} from '@thunderid/browser';\n\n/**\n * Returns the runtime sentinel prefix used to tag \"selected prefix\" entries in the\n * form-state map. Resolved through the vendor namespace so white-labeled deployments\n * do not collide with each other or with a real field identifier.\n */\nconst prefixSentinel = (vendor?: string): string => `__${getVendorPrefix(vendor)}_prefix__`;\n\n/**\n * Returns the runtime sentinel prefix used to tag \"postfix\" entries in the form-state\n * map. See {@link prefixSentinel}.\n */\nconst postfixSentinel = (vendor?: string): string => `__${getVendorPrefix(vendor)}_postfix__`;\n\n/**\n * Returns the sentinel key used to store the selected prefix `value` for the affixed\n * field addressed by `identifier`. The vendor namespace controls the runtime string\n * so consumers overriding `vendor` do not conflict with the SDK default.\n */\nexport const affixPrefixKey = (identifier: string, vendor?: string): string => `${prefixSentinel(vendor)}${identifier}`;\n\n/**\n * Returns the sentinel key used to store the postfix `value` for the affixed field\n * addressed by `identifier`. See {@link affixPrefixKey}.\n */\nexport const affixPostfixKey = (identifier: string, vendor?: string): string =>\n `${postfixSentinel(vendor)}${identifier}`;\n\n/**\n * Rewrites `formData` (returns a new object) so that any affixed-input identifier\n * tracked by matching sentinel prefix/postfix keys is replaced with its composed\n * form `${prefix}${typed}${postfix}`. Sentinel keys are stripped from the result.\n *\n * Behaviour:\n * - Prefix present, postfix present → `prefix + typed + postfix`.\n * - Only prefix present → `prefix + typed`.\n * - Only postfix present → `typed + postfix`.\n * - Both empty / typed empty → the identifier is left untouched.\n * - No sentinel keys → returns a shallow copy of `formData` unchanged.\n *\n * The input object is not mutated. This is component-type agnostic: any field carrying\n * matching sentinel keys is composed, regardless of whether it originated from a\n * TEXT_INPUT, EMAIL_INPUT, PASSWORD_INPUT, or PHONE_INPUT.\n *\n * @param formData - The current form values map (values indexed by field identifier).\n * @param vendor - The vendor namespace configured on the SDK client, if any. Sentinel\n * keys are resolved through this namespace so composition ignores unrelated keys\n * written by other vendors when multiple SDK instances share a form.\n */\nconst composeAffixedInputs = (formData: Record<string, string>, vendor?: string): Record<string, string> => {\n const composed: Record<string, string> = {...formData};\n const prefixTag: string = prefixSentinel(vendor);\n const postfixTag: string = postfixSentinel(vendor);\n\n for (const key of Object.keys(formData)) {\n if (!key.startsWith(prefixTag) && !key.startsWith(postfixTag)) {\n continue;\n }\n\n const identifier: string = key.startsWith(prefixTag) ? key.slice(prefixTag.length) : key.slice(postfixTag.length);\n\n const typed: string = composed[identifier] ?? '';\n if (typed === '') {\n // Preserve emptiness — required-field checks are the caller's responsibility.\n delete composed[affixPrefixKey(identifier, vendor)];\n delete composed[affixPostfixKey(identifier, vendor)];\n continue;\n }\n\n const prefix: string = composed[affixPrefixKey(identifier, vendor)] ?? '';\n const postfix: string = composed[affixPostfixKey(identifier, vendor)] ?? '';\n\n composed[identifier] = `${prefix}${typed}${postfix}`;\n delete composed[affixPrefixKey(identifier, vendor)];\n delete composed[affixPostfixKey(identifier, vendor)];\n }\n\n return composed;\n};\n\nexport default composeAffixedInputs;\n"],"mappings":";;;;;;;;AAyBA,MAAM,kBAAkB,WAA4B,KAAK,gBAAgB,OAAO,CAAC;;;;;AAMjF,MAAM,mBAAmB,WAA4B,KAAK,gBAAgB,OAAO,CAAC;;;;;;AAOlF,MAAa,kBAAkB,YAAoB,WAA4B,GAAG,eAAe,OAAO,GAAG;;;;;AAM3G,MAAa,mBAAmB,YAAoB,WAClD,GAAG,gBAAgB,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;AAuB/B,MAAM,wBAAwB,UAAkC,WAA4C;CAC1G,MAAMA,WAAmC,EAAC,GAAG,UAAS;CACtD,MAAMC,YAAoB,eAAe,OAAO;CAChD,MAAMC,aAAqB,gBAAgB,OAAO;AAElD,MAAK,MAAM,OAAO,OAAO,KAAK,SAAS,EAAE;AACvC,MAAI,CAAC,IAAI,WAAW,UAAU,IAAI,CAAC,IAAI,WAAW,WAAW,CAC3D;EAGF,MAAMC,aAAqB,IAAI,WAAW,UAAU,GAAG,IAAI,MAAM,UAAU,OAAO,GAAG,IAAI,MAAM,WAAW,OAAO;EAEjH,MAAMC,QAAgB,SAAS,eAAe;AAC9C,MAAI,UAAU,IAAI;AAEhB,UAAO,SAAS,eAAe,YAAY,OAAO;AAClD,UAAO,SAAS,gBAAgB,YAAY,OAAO;AACnD;;AAMF,WAAS,cAAc,GAHA,SAAS,eAAe,YAAY,OAAO,KAAK,KAGpC,QAFX,SAAS,gBAAgB,YAAY,OAAO,KAAK;AAGzE,SAAO,SAAS,eAAe,YAAY,OAAO;AAClD,SAAO,SAAS,gBAAgB,YAAY,OAAO;;AAGrD,QAAO;;AAGT,mCAAe"}
|
package/dist/utils/oauth.d.ts
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* Generates random state, stores return path in sessionStorage, and redirects to OAuth provider.
|
|
21
21
|
*
|
|
22
22
|
* @param redirectURL - OAuth authorization URL from the server
|
|
23
|
+
* @param vendor - Vendor/brand namespace used to prefix the sessionStorage key. Defaults to `'thunderid'`.
|
|
23
24
|
*/
|
|
24
|
-
export declare function initiateOAuthRedirect(redirectURL: string): void;
|
|
25
|
+
export declare function initiateOAuthRedirect(redirectURL: string, vendor?: string): void;
|
|
25
26
|
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/utils/oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/utils/oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAsBhF"}
|
package/dist/utils/oauth.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { navigate } from "@thunderid/browser";
|
|
1
|
+
import { getVendorPrefix, navigate } from "@thunderid/browser";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/oauth.ts
|
|
4
4
|
/**
|
|
@@ -6,13 +6,14 @@ import { navigate } from "@thunderid/browser";
|
|
|
6
6
|
* Generates random state, stores return path in sessionStorage, and redirects to OAuth provider.
|
|
7
7
|
*
|
|
8
8
|
* @param redirectURL - OAuth authorization URL from the server
|
|
9
|
+
* @param vendor - Vendor/brand namespace used to prefix the sessionStorage key. Defaults to `'thunderid'`.
|
|
9
10
|
*/
|
|
10
|
-
function initiateOAuthRedirect(redirectURL) {
|
|
11
|
+
function initiateOAuthRedirect(redirectURL, vendor) {
|
|
11
12
|
const basePath = document.querySelector("base")?.getAttribute("href") || "";
|
|
12
13
|
let returnPath = window.location.pathname;
|
|
13
14
|
if (basePath && returnPath.startsWith(basePath)) returnPath = returnPath.slice(basePath.length) || "/";
|
|
14
15
|
const state = crypto.randomUUID();
|
|
15
|
-
sessionStorage.setItem(
|
|
16
|
+
sessionStorage.setItem(`${getVendorPrefix(vendor)}_oauth_${state}`, JSON.stringify({
|
|
16
17
|
path: returnPath,
|
|
17
18
|
timestamp: Date.now()
|
|
18
19
|
}));
|
package/dist/utils/oauth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.js","names":["basePath: string","returnPath: string","state: string","redirectUrlObj: URL"],"sources":["../../src/utils/oauth.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {navigate} from '@thunderid/browser';\n\n/**\n * Initiates OAuth redirect with CSRF protection.\n * Generates random state, stores return path in sessionStorage, and redirects to OAuth provider.\n *\n * @param redirectURL - OAuth authorization URL from the server\n */\nexport function initiateOAuthRedirect(redirectURL: string): void {\n const basePath: string = document.querySelector('base')?.getAttribute('href') || '';\n let returnPath: string = window.location.pathname;\n\n if (basePath && returnPath.startsWith(basePath)) {\n returnPath = returnPath.slice(basePath.length) || '/';\n }\n\n const state: string = crypto.randomUUID();\n\n sessionStorage.setItem(\n
|
|
1
|
+
{"version":3,"file":"oauth.js","names":["basePath: string","returnPath: string","state: string","redirectUrlObj: URL"],"sources":["../../src/utils/oauth.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {navigate, getVendorPrefix} from '@thunderid/browser';\n\n/**\n * Initiates OAuth redirect with CSRF protection.\n * Generates random state, stores return path in sessionStorage, and redirects to OAuth provider.\n *\n * @param redirectURL - OAuth authorization URL from the server\n * @param vendor - Vendor/brand namespace used to prefix the sessionStorage key. Defaults to `'thunderid'`.\n */\nexport function initiateOAuthRedirect(redirectURL: string, vendor?: string): void {\n const basePath: string = document.querySelector('base')?.getAttribute('href') || '';\n let returnPath: string = window.location.pathname;\n\n if (basePath && returnPath.startsWith(basePath)) {\n returnPath = returnPath.slice(basePath.length) || '/';\n }\n\n const state: string = crypto.randomUUID();\n\n sessionStorage.setItem(\n `${getVendorPrefix(vendor)}_oauth_${state}`,\n JSON.stringify({\n path: returnPath,\n timestamp: Date.now(),\n }),\n );\n\n const redirectUrlObj: URL = new URL(redirectURL);\n redirectUrlObj.searchParams.set('state', state);\n\n navigate(redirectUrlObj.toString());\n}\n"],"mappings":";;;;;;;;;;AA2BA,SAAgB,sBAAsB,aAAqB,QAAuB;CAChF,MAAMA,WAAmB,SAAS,cAAc,OAAO,EAAE,aAAa,OAAO,IAAI;CACjF,IAAIC,aAAqB,OAAO,SAAS;AAEzC,KAAI,YAAY,WAAW,WAAW,SAAS,CAC7C,cAAa,WAAW,MAAM,SAAS,OAAO,IAAI;CAGpD,MAAMC,QAAgB,OAAO,YAAY;AAEzC,gBAAe,QACb,GAAG,gBAAgB,OAAO,CAAC,SAAS,SACpC,KAAK,UAAU;EACb,MAAM;EACN,WAAW,KAAK,KAAK;EACtB,CAAC,CACH;CAED,MAAMC,iBAAsB,IAAI,IAAI,YAAY;AAChD,gBAAe,aAAa,IAAI,SAAS,MAAM;AAE/C,UAAS,eAAe,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thunderid/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "React SDK for ThunderID",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"thunderid",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@floating-ui/react": "0.27.12",
|
|
62
62
|
"dompurify": "3.4.11",
|
|
63
63
|
"tslib": "2.8.1",
|
|
64
|
-
"@thunderid/browser": "^0.
|
|
64
|
+
"@thunderid/browser": "^0.6.0"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|