@asgardeo/react 0.12.0 → 0.13.2

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.
Files changed (39) hide show
  1. package/dist/api/createOrganization.d.ts +5 -1
  2. package/dist/api/getAllOrganizations.d.ts +5 -1
  3. package/dist/api/getMeOrganizations.d.ts +5 -1
  4. package/dist/api/getOrganization.d.ts +5 -1
  5. package/dist/api/getSchemas.d.ts +5 -1
  6. package/dist/api/getScim2Me.d.ts +5 -1
  7. package/dist/api/updateMeProfile.d.ts +5 -1
  8. package/dist/api/updateOrganization.d.ts +5 -1
  9. package/dist/cjs/index.js +2603 -2087
  10. package/dist/cjs/index.js.map +4 -4
  11. package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +5 -1
  12. package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +5 -1
  13. package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +5 -1
  14. package/dist/components/presentation/UserDropdown/UserDropdown.d.ts +3 -0
  15. package/dist/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.d.ts +5 -0
  16. package/dist/components/presentation/auth/AuthOptionFactory.d.ts +14 -1
  17. package/dist/components/presentation/auth/InviteUser/v2/BaseInviteUser.d.ts +5 -0
  18. package/dist/components/presentation/auth/SignIn/v2/BaseSignIn.d.ts +5 -1
  19. package/dist/components/presentation/auth/SignIn/v2/SignIn.d.ts +5 -1
  20. package/dist/{utils/v2/resolveTranslation.d.ts → components/primitives/Icons/ArrowLeftRight.d.ts} +11 -9
  21. package/dist/components/primitives/Icons/flowIconRegistry.d.ts +28 -0
  22. package/dist/components/primitives/Icons/index.d.ts +1 -0
  23. package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +23 -1
  24. package/dist/contexts/FlowMeta/FlowMetaContext.d.ts +39 -0
  25. package/dist/contexts/FlowMeta/FlowMetaProvider.d.ts +50 -0
  26. package/dist/contexts/FlowMeta/useFlowMeta.d.ts +20 -0
  27. package/dist/contexts/I18n/I18nContext.d.ts +5 -0
  28. package/dist/contexts/Theme/ThemeProvider.d.ts +36 -39
  29. package/dist/contexts/Theme/v1/ThemeProvider.d.ts +88 -0
  30. package/dist/contexts/Theme/v2/ThemeProvider.d.ts +57 -0
  31. package/dist/index.js +2056 -1540
  32. package/dist/index.js.map +4 -4
  33. package/dist/utils/applyThemeToDOM.d.ts +24 -0
  34. package/dist/utils/normalizeThemeConfig.d.ts +30 -0
  35. package/dist/utils/v2/buildThemeConfigFromFlowMeta.d.ts +33 -0
  36. package/dist/utils/v2/flowTransformer.d.ts +3 -3
  37. package/dist/utils/v2/resolveTranslationsInArray.d.ts +4 -2
  38. package/dist/utils/v2/resolveTranslationsInObject.d.ts +5 -3
  39. package/package.json +6 -5
@@ -0,0 +1,24 @@
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
+ import { Theme } from '@asgardeo/browser';
19
+ /**
20
+ * Writes all CSS custom properties from a resolved `Theme` onto the document root.
21
+ * Called inside a `useEffect` whenever the active theme changes.
22
+ */
23
+ declare const applyThemeToDOM: (theme: Theme) => void;
24
+ export default applyThemeToDOM;
@@ -0,0 +1,30 @@
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
+ import { RecursivePartial, ThemeConfig } from '@asgardeo/browser';
19
+ /**
20
+ * Normalizes a `RecursivePartial<ThemeConfig>` so that color fields which are
21
+ * supplied as plain CSS color strings are coerced into `{ main: string }`
22
+ * objects before being handed to `createTheme`.
23
+ *
24
+ * Only the color groups that `toCssVariables` in `createTheme` actually reads
25
+ * individual sub-keys from are normalized here (`primary`, `secondary`,
26
+ * `error`, `success`, `warning`, `info`). `border` is left alone because it
27
+ * IS a plain string in `ThemeConfig`.
28
+ */
29
+ declare const normalizeThemeConfig: (config: RecursivePartial<ThemeConfig> | undefined) => RecursivePartial<ThemeConfig> | undefined;
30
+ export default normalizeThemeConfig;
@@ -0,0 +1,33 @@
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
+ import { FlowMetaTheme, RecursivePartial, ThemeConfig } from '@asgardeo/browser';
19
+ /**
20
+ * Converts a v2 `FlowMetaTheme` into a `RecursivePartial<ThemeConfig>` that
21
+ * `createTheme` can consume.
22
+ *
23
+ * Only fields explicitly present in the FlowMeta response are included so that
24
+ * `createTheme` can deep-merge them onto its base (light/dark) defaults without
25
+ * accidentally dropping sibling keys that were not returned by the server.
26
+ *
27
+ * For example, when FlowMeta returns only `background.default` and
28
+ * `background.paper`, only `body.main` and `surface` are set — the base
29
+ * theme's `background.disabled` and `background.dark` are **not** overridden
30
+ * and therefore keep their default CSS variable values.
31
+ */
32
+ declare const buildThemeConfigFromFlowMeta: (flowMetaTheme: FlowMetaTheme, colorScheme: "light" | "dark") => RecursivePartial<ThemeConfig>;
33
+ export default buildThemeConfigFromFlowMeta;
@@ -40,7 +40,7 @@
40
40
  * This transformer is used by both SignIn and SignUp v2 components to ensure
41
41
  * consistent response handling across all embedded flows.
42
42
  */
43
- import { EmbeddedFlowComponentV2 as EmbeddedFlowComponent } from '@asgardeo/browser';
43
+ import { EmbeddedFlowComponentV2 as EmbeddedFlowComponent, FlowMetadataResponse } from '@asgardeo/browser';
44
44
  import { UseTranslation } from '../../hooks/useTranslation';
45
45
  /**
46
46
  * Generic flow error response interface that covers common error structure
@@ -81,7 +81,7 @@ export interface FlowTransformOptions {
81
81
  * @param resolveTranslations - Whether to resolve translation strings or keep them as i18n keys (default: true)
82
82
  * @returns Array of flow components with resolved or unresolved translations
83
83
  */
84
- export declare const transformComponents: (response: any, t: UseTranslation["t"], resolveTranslations?: boolean) => EmbeddedFlowComponent[];
84
+ export declare const transformComponents: (response: any, t: UseTranslation["t"], resolveTranslations?: boolean, meta?: FlowMetadataResponse | null) => EmbeddedFlowComponent[];
85
85
  /**
86
86
  * Extract error message from flow error response.
87
87
  * Supports any flow error response that follows the standard structure.
@@ -113,7 +113,7 @@ export declare const checkForErrorResponse: (response: any, t: UseTranslation["t
113
113
  * @returns Normalized flow response with flowId and transformed components
114
114
  * @throws {any} The original response if it's an error and throwOnError is true
115
115
  */
116
- export declare const normalizeFlowResponse: (response: any, t: UseTranslation["t"], options?: FlowTransformOptions) => {
116
+ export declare const normalizeFlowResponse: (response: any, t: UseTranslation["t"], options?: FlowTransformOptions, meta?: FlowMetadataResponse | null) => {
117
117
  components: EmbeddedFlowComponent[];
118
118
  flowId: string;
119
119
  };
@@ -15,13 +15,15 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
+ import { FlowMetadataResponse } from '@asgardeo/browser';
18
19
  import { UseTranslation } from '../../hooks/useTranslation';
19
20
  /**
20
- * Recursively resolves translation strings in an array of objects.
21
+ * Recursively resolves translation and meta template strings in an array of objects.
21
22
  * @param items - Array of objects to process
22
23
  * @param t - The translation function from useTranslation
23
24
  * @param properties - Array of property names to resolve (optional)
25
+ * @param meta - Optional flow metadata for resolving meta() expressions
24
26
  * @returns A new array with resolved translations
25
27
  */
26
- declare const resolveTranslationsInArray: <T extends Record<string, any>>(items: T[], t: UseTranslation["t"], properties?: string[]) => T[];
28
+ declare const resolveTranslationsInArray: <T extends Record<string, any>>(items: T[], t: UseTranslation["t"], properties?: string[], meta?: FlowMetadataResponse | null) => T[];
27
29
  export default resolveTranslationsInArray;
@@ -15,13 +15,15 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
+ import { FlowMetadataResponse } from '@asgardeo/browser';
18
19
  import { UseTranslation } from '../../hooks/useTranslation';
19
20
  /**
20
- * Resolves translation strings in an object's properties.
21
+ * Resolves all {{ t() }} and {{ meta() }} template expressions in an object's string properties.
21
22
  * @param obj - The object to process
22
23
  * @param t - The translation function from useTranslation
23
24
  * @param properties - Array of property names to resolve (optional, defaults to common properties)
24
- * @returns A new object with resolved translations
25
+ * @param meta - Optional flow metadata for resolving meta() expressions
26
+ * @returns A new object with resolved template strings
25
27
  */
26
- export declare const resolveTranslationsInObject: <T extends Record<string, any>>(obj: T, t: UseTranslation["t"], properties?: string[]) => T;
28
+ export declare const resolveTranslationsInObject: <T extends Record<string, any>>(obj: T, t: UseTranslation["t"], properties?: string[], meta?: FlowMetadataResponse | null) => T;
27
29
  export default resolveTranslationsInObject;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asgardeo/react",
3
- "version": "0.12.0",
3
+ "version": "0.13.2",
4
4
  "description": "React implementation of Asgardeo JavaScript SDK.",
5
5
  "keywords": [
6
6
  "asgardeo",
@@ -36,8 +36,8 @@
36
36
  "@testing-library/react": "16.3.0",
37
37
  "@types/node": "22.15.3",
38
38
  "@types/react": "19.1.5",
39
- "@wso2/eslint-plugin": "git+https://github.com/brionmario/wso2-ui-configs.git#a1fc6eb570653c999828aea9f5027cba06af4391&path:packages/eslint-plugin",
40
- "@wso2/prettier-config": "git+https://github.com/brionmario/wso2-ui-configs.git#a1fc6eb570653c999828aea9f5027cba06af4391&path:packages/prettier-config",
39
+ "@wso2/eslint-plugin": "git+https://github.com/brionmario/wso2-ui-configs.git#d3041825a4f8f235c8f9fa36b55cf29d54e791c8&path:packages/eslint-plugin",
40
+ "@wso2/prettier-config": "git+https://github.com/brionmario/wso2-ui-configs.git#d3041825a4f8f235c8f9fa36b55cf29d54e791c8&path:packages/prettier-config",
41
41
  "esbuild-plugin-preserve-directives": "0.0.11",
42
42
  "eslint": "8.57.0",
43
43
  "jsdom": "26.1.0",
@@ -55,11 +55,12 @@
55
55
  "@emotion/css": "11.13.5",
56
56
  "@floating-ui/react": "0.27.12",
57
57
  "@types/react-dom": "19.1.5",
58
+ "dompurify": "3.3.1",
58
59
  "esbuild": "0.25.9",
59
60
  "react-dom": "19.1.4",
60
61
  "tslib": "2.8.1",
61
- "@asgardeo/i18n": "0.4.2",
62
- "@asgardeo/browser": "0.2.10"
62
+ "@asgardeo/browser": "0.4.1",
63
+ "@asgardeo/i18n": "0.4.2"
63
64
  },
64
65
  "publishConfig": {
65
66
  "access": "public"