diff --git a/.changeset/forty-rabbits-leave.md b/.changeset/forty-rabbits-leave.md new file mode 100644 index 000000000..329a3693a --- /dev/null +++ b/.changeset/forty-rabbits-leave.md @@ -0,0 +1,6 @@ +--- +'@asgardeo/javascript': minor +'@asgardeo/react': minor +--- + +Add Emoji support for Image + Fix issues in component generation diff --git a/packages/__legacy__/core/.editorconfig b/packages/__legacy__/core/.editorconfig deleted file mode 100644 index 54a161112..000000000 --- a/packages/__legacy__/core/.editorconfig +++ /dev/null @@ -1 +0,0 @@ -../../.editorconfig diff --git a/packages/__legacy__/core/.eslintignore b/packages/__legacy__/core/.eslintignore deleted file mode 100644 index 99b0b518a..000000000 --- a/packages/__legacy__/core/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -/dist -/build -/node_modules -/coverage diff --git a/packages/__legacy__/core/.eslintrc.cjs b/packages/__legacy__/core/.eslintrc.cjs deleted file mode 100644 index ae06f6220..000000000 --- a/packages/__legacy__/core/.eslintrc.cjs +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -const path = require('path'); - -module.exports = { - extends: ['plugin:@wso2/typescript', 'plugin:@wso2/strict', 'plugin:@wso2/internal', 'plugin:@wso2/prettier'], - parserOptions: { - project: [path.resolve(__dirname, 'tsconfig.eslint.json')], - }, - plugins: ['@wso2'], - rules: { - // In `getBrandingCSS` we are using non dot notation to access the object properties. - // TODO: Refactor the code to use dot notation. - '@typescript-eslint/dot-notation': 'off', - '@typescript-eslint/no-empty-function': [ - 'error', - { - allow: ['constructors'], - }, - ], - // We are throwing custom exceptions in the codebase. - // Hence, turning this off to avoid linting errors. (https://eslint.org/docs/latest/rules/no-throw-literal#known-limitations) - '@typescript-eslint/no-throw-literal': 'off', - // We need to use private constructors in some classes. - // Hence, turning this off to avoid linting errors. - // TODO: Ideally suppression should be done inline for these cases. But it seems to not work ATM. - '@typescript-eslint/no-useless-constructor': 'off', - }, -}; diff --git a/packages/__legacy__/core/.gitignore b/packages/__legacy__/core/.gitignore deleted file mode 100644 index f20a8a8c1..000000000 --- a/packages/__legacy__/core/.gitignore +++ /dev/null @@ -1,134 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -.pnpm-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# Snowpack dependency directory (https://snowpack.dev/) -web_modules/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional stylelint cache -.stylelintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variable files -.env -.env.development.local -.env.test.local -.env.production.local -.env.local - -# parcel-bundler cache (https://parceljs.org/) -.cache -.parcel-cache - -# Next.js build output -.next -out - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and not Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# vuepress v2.x temp and cache directory -.temp -.cache - -# Docusaurus cache and generated files -.docusaurus - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port - -# Stores VSCode versions used for testing VSCode extensions -.vscode-test - -# yarn v2 -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.pnp.* - -# misc -.DS_Store -*.pem diff --git a/packages/__legacy__/core/.prettierignore b/packages/__legacy__/core/.prettierignore deleted file mode 100644 index c925c21d5..000000000 --- a/packages/__legacy__/core/.prettierignore +++ /dev/null @@ -1,2 +0,0 @@ -/dist -/node_modules diff --git a/packages/__legacy__/core/CHANGELOG.md b/packages/__legacy__/core/CHANGELOG.md deleted file mode 100644 index 445767589..000000000 --- a/packages/__legacy__/core/CHANGELOG.md +++ /dev/null @@ -1,49 +0,0 @@ -# @asgardeo/js - -## 0.1.3 - -### Patch Changes - -- [#47](https://github.com/asgardeo/javascript/pull/47) - [`3d3af92`](https://github.com/asgardeo/javascript/commit/3d3af92338dec2d4b8aff09f9ba9da7d68781108) Thanks - [@dasuni-30](https://github.com/dasuni-30)! - Add support to esm in core package - -## 0.1.2 - -### Patch Changes - -- [#34](https://github.com/asgardeo/javascript/pull/34) - [`4344408`](https://github.com/asgardeo/javascript/commit/43444087466db1c12fdb97e283192d5e2ccc00f1) Thanks - [@DonOmalVindula](https://github.com/DonOmalVindula)! - Improvements to Identifier first authenticator in the React - SDK - -## 0.1.1 - -### Patch Changes - -- [#20](https://github.com/asgardeo/javascript/pull/20) - [`8eef064`](https://github.com/asgardeo/javascript/commit/8eef0641c01de02aa7c4a6d75f059136fcfdb489) Thanks - [@movinsilva](https://github.com/movinsilva)! - Add readme files and update build scripts - -## 0.1.0 - -### Minor Changes - -- [#17](https://github.com/asgardeo/javascript/pull/17) - [`0be3e48`](https://github.com/asgardeo/javascript/commit/0be3e48a2896e10eea2f4c74ccc24eb1ddab09bd) Thanks - [@movinsilva](https://github.com/movinsilva)! - Initial release of @asgardeo/js and @asgardeo/react - - - Drop in components - - - SignIn - - SignOut - - SignedIn - - SignedOut - - - Custom hooks - - - useAuthentication - - useOn - - - api function calls in js - - branding and i18n support diff --git a/packages/__legacy__/core/LICENSE b/packages/__legacy__/core/LICENSE deleted file mode 100644 index 261eeb9e9..000000000 --- a/packages/__legacy__/core/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/__legacy__/core/README.md b/packages/__legacy__/core/README.md deleted file mode 100644 index 230d09b8c..000000000 --- a/packages/__legacy__/core/README.md +++ /dev/null @@ -1,39 +0,0 @@ -

-

@asgardeo/js

-

-

Handles framework agnostic content

-
- npm (scoped) - npm - License -
- -## Installation - -```bash -# With npm -npm install @asgardeo/js - -# With pnpm -pnpm add @asgardeo/js - -# With yarn -yarn add @asgardeo/js -``` - -## Usage - -To use functions from `@asgardeo/js`, simply import the function and use it in your code: - -```jsx -import { authenticate } from '@asgardeo/js'; - -function implementAuthn() { - const response = await authenticate(); -} -``` - -## License - -Licenses this source under the Apache License, Version 2.0 [LICENSE](./LICENSE), You may not use this file except in -compliance with the License. diff --git a/packages/__legacy__/core/package.json b/packages/__legacy__/core/package.json deleted file mode 100644 index ce977cc5a..000000000 --- a/packages/__legacy__/core/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "private": true, - "name": "@asgardeo/js-legacy", - "version": "0.1.3", - "description": "Framework agnostic JS for Asgardeo or Identity Server", - "main": "dist/esm/index.js", - "module": "dist/esm/index.js", - "umd": "dist/umd/index.js", - "types": "dist/index.d.ts", - "author": "WSO2", - "license": "Apache-2.0", - "files": [ - "dist", - "LICENSE", - "README.md" - ], - "homepage": "https://github.com/asgardeo/javascript/tree/main/packages/core#readme", - "bugs": { - "url": "https://github.com/asgardeo/javascript/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/asgardeo/javascript", - "directory": "packages/core" - }, - "keywords": [ - "asgardeo", - "identity", - "ui", - "core" - ], - "scripts": { - "build": "rollup -c", - "lint": "eslint .", - "lint:fix": "eslint . --fix" - }, - "devDependencies": { - "@rollup/plugin-commonjs": "25.0.7", - "@rollup/plugin-dynamic-import-vars": "2.1.2", - "@rollup/plugin-node-resolve": "15.2.3", - "@rollup/plugin-typescript": "11.1.6", - "@types/lodash.isempty": "4.4.9", - "@types/lodash.merge": "4.6.9", - "@types/node": "20.12.7", - "@wso2/eslint-plugin": "catalog:", - "@wso2/prettier-config": "catalog:", - "eslint": "8.57.0", - "prettier": "3.2.5", - "rollup": "4.17.2", - "rollup-plugin-dts": "6.1.0", - "tslib": "2.6.2", - "typescript": "5.1.6" - }, - "publishConfig": { - "access": "restricted" - }, - "dependencies": { - "@asgardeo/auth-js": "5.0.1", - "csstype": "3.1.3", - "lodash.isempty": "4.4.0", - "lodash.merge": "4.6.2" - } -} diff --git a/packages/__legacy__/core/prettier.config.cjs b/packages/__legacy__/core/prettier.config.cjs deleted file mode 100644 index c07f730d2..000000000 --- a/packages/__legacy__/core/prettier.config.cjs +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -module.exports = require('@wso2/prettier-config'); diff --git a/packages/__legacy__/core/rollup.config.cjs b/packages/__legacy__/core/rollup.config.cjs deleted file mode 100644 index 24553b896..000000000 --- a/packages/__legacy__/core/rollup.config.cjs +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -const commonjs = require('@rollup/plugin-commonjs'); -const dynamicImportVars = require('@rollup/plugin-dynamic-import-vars'); -const nodeResolve = require('@rollup/plugin-node-resolve'); -const typescript = require('@rollup/plugin-typescript'); -const dts = require('rollup-plugin-dts'); - -const pkg = require('./package.json'); - -module.exports = [ - { - cache: false, - input: 'src/index.ts', - output: [ - { - file: pkg.main, - format: 'cjs', - inlineDynamicImports: true, - sourcemap: true, - }, - { - file: pkg.umd, - format: 'umd', - inlineDynamicImports: true, - name: 'core', - sourcemap: true, - }, - { - file: pkg.module, - format: 'esm', - inlineDynamicImports: true, - sourcemap: true, - }, - ], - plugins: [nodeResolve(), commonjs(), dynamicImportVars(), typescript({tsconfig: './tsconfig.lib.json'})], - }, - { - cache: false, - input: 'dist/esm/types/index.d.ts', - output: [{file: 'dist/index.d.ts', format: 'esm'}], - plugins: [dts.default()], - }, -]; diff --git a/packages/__legacy__/core/src/api/authenticate.ts b/packages/__legacy__/core/src/api/authenticate.ts deleted file mode 100644 index 1fc25e6b8..000000000 --- a/packages/__legacy__/core/src/api/authenticate.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {AuthClient} from '../auth-client'; -import AsgardeoUIException from '../exception'; -import {AuthenticateProps} from '../models/auth-api-request'; -import {AuthApiResponse} from '../models/auth-api-response'; - -/** - * Send an authentication request to the authentication API. - * - * @param {AuthenticateProps} props - The authentication request body. - * @returns {Promise} A promise that resolves with the authentication API response. - */ -const authenticate = async (props: AuthenticateProps): Promise => { - let authnRequest: Request; - let response: Response; - - try { - const formBody: string = JSON.stringify(props); - - const headers: Headers = new Headers(); - headers.append('Content-Type', 'application/json'); - - const requestOptions: RequestInit = { - body: formBody, - headers, - method: 'POST', - }; - - /* Getting baseURL from authClient's data layer */ - const {baseUrl} = await AuthClient.getInstance().getStorageManager().getConfigData(); - - authnRequest = new Request(`${baseUrl}/oauth2/authn`, requestOptions); - } catch (error) { - throw new AsgardeoUIException('JS_UI_CORE-AUTHN-A-NF', 'Authentication request building failed', error.stack); - } - - try { - response = await fetch(authnRequest); - } catch (error) { - throw new AsgardeoUIException('JS_UI_CORE-AUTHN-A-NE', `Authentication API call Failed: ${error}`, error.stack); - } - - if (response.ok) { - return (await response.json()) as AuthApiResponse; - } - - throw new AsgardeoUIException( - 'JS_UI_CORE-AUTHN-A-HE', - 'Failed to receive a successful response from the authentication endpoint', - ); -}; - -export default authenticate; diff --git a/packages/__legacy__/core/src/api/authorize.ts b/packages/__legacy__/core/src/api/authorize.ts deleted file mode 100644 index 777a21135..000000000 --- a/packages/__legacy__/core/src/api/authorize.ts +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {AuthClient} from '../auth-client'; -import AsgardeoUIException from '../exception'; -import {AuthApiResponse} from '../models/auth-api-response'; -import {UIAuthClient} from '../models/auth-config'; - -/** - * This function is used to authorize the user. - * @returns {Promise} A promise that resolves with the authorization response. - */ -const authorize = async (): Promise => { - let response: Response; - let requestOptions: RequestInit; - let authzURL: string; - - try { - const authInstace: UIAuthClient = AuthClient.getInstance(); - // FIXME: We should be able to get the URL itself. - // const params: Map = await authInstace.getAuthorizationURLParams(); - const params: Map = new Map(); - - const formBody: URLSearchParams = new URLSearchParams(); - - Array.from(params.entries()).forEach(([key, value]: [string, string]) => { - formBody.append(key, value); - }); - - /* Save the state temporarily in the data layer, this needs to be passed when token is requested */ - await authInstace.getStorageManager().setTemporaryDataParameter('state', params.get('state')); - - const headers: Headers = new Headers(); - headers.append('Accept', 'application/json'); - headers.append('Content-Type', 'application/x-www-form-urlencoded'); - - requestOptions = { - body: formBody.toString(), - headers, - method: 'POST', - }; - - authzURL = (await authInstace.getOpenIDProviderEndpoints()).authorizationEndpoint; - } catch (error) { - throw new AsgardeoUIException('JS_UI_CORE-AUTHZ-A-NF', 'Authorization request building failed', error.stack); - } - - try { - response = await fetch(authzURL, requestOptions); - } catch (error) { - throw new AsgardeoUIException('JS_UI_CORE-AUTHZ-A-NE', 'Authorization API call failed', error.stack); - } - - if (response.ok) { - return (await response.json()) as AuthApiResponse; - } - - throw new AsgardeoUIException( - 'JS_UI_CORE-AUTHZ-A-HE', - 'Failed to receive a successful response from the authorization server', - ); -}; - -export default authorize; diff --git a/packages/__legacy__/core/src/api/get-branding-preference-text.ts b/packages/__legacy__/core/src/api/get-branding-preference-text.ts deleted file mode 100644 index 87bd3fb26..000000000 --- a/packages/__legacy__/core/src/api/get-branding-preference-text.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {AuthClient} from '../auth-client'; -import AsgardeoUIException from '../exception'; -import {BrandingPreferenceTextAPIResponse, GetBrandingPreferenceTextProps} from '../models/branding-text-api-response'; - -/** - * Fetch the branding preference text from the server. - * - * @param locale - The locale of the branding text. - * @param name - The name of the branding text. - * @param screen - The screen of the branding text. - * @param type - The type of the branding text. - * @returns A Promise that resolves to the response from the server. - * @throws {AsgardeoUIException} If the API call fails or when the response is not successful. - */ -const getBrandingPreferenceText = async ( - props: GetBrandingPreferenceTextProps, -): Promise => { - const {locale, name, screen, type} = props; - - const headers: Headers = new Headers(); - headers.append('Accept', 'application/json'); - headers.append('Content-Type', 'application/json'); - - const requestOptions: RequestInit = { - headers, - method: 'GET', - }; - - const params: URLSearchParams = new URLSearchParams(); - params.append('locale', locale); - params.append('name', name); - params.append('screen', screen); - params.append('type', type); - - const {baseUrl} = await AuthClient.getInstance().getStorageManager().getConfigData(); - const textUrl: string = `${baseUrl}/api/server/v1/branding-preference/text/resolve`; - const urlWithParams: string = `${textUrl}?${params.toString()}`; - let response: Response; - - try { - response = await fetch(new Request(urlWithParams, requestOptions)); - } catch (error) { - throw new AsgardeoUIException('JS_UI_CORE-BT-GBPT-NE', 'Branding Text API call failed', error.stack); - } - - if (response.ok) { - return (await response.json()) as BrandingPreferenceTextAPIResponse; - } - - throw new AsgardeoUIException( - 'JS_UI_CORE-BT-GBPT-HE', - 'Failed to receive a successful response from the branding text endpoint', - ); -}; - -export default getBrandingPreferenceText; diff --git a/packages/__legacy__/core/src/api/get-branding-preference.ts b/packages/__legacy__/core/src/api/get-branding-preference.ts deleted file mode 100644 index 64c63f082..000000000 --- a/packages/__legacy__/core/src/api/get-branding-preference.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {AuthClient} from '../auth-client'; -import AsgardeoUIException from '../exception'; -import {BrandingPreferenceAPIResponse, BrandingPreferenceTypes} from '../models/branding-api-response'; - -/** - * Fetch branding preferences from the server. - * - * @returns {Promise} A promise that resolves with the branding preferences. - * @throws {AsgardeoUIException} If an error occurs while fetching the branding preferences or when the response is unsuccessful. - */ -const getBrandingPreference = async (): Promise => { - const { - baseUrl, - type = BrandingPreferenceTypes.Org, - name = 'WSO2', - } = await AuthClient.getInstance().getStorageManager().getConfigData(); - const brandingUrl: string = `${baseUrl}/api/server/v1/branding-preference?type=${type}&name=${name}`; - let response: Response; - - try { - response = await fetch(brandingUrl); - } catch (error) { - throw new AsgardeoUIException('JS_UI_CORE-BR-GBP-NE', 'Error while fetching branding data.', error.stack); - } - - if (response.ok) { - return (await response.json()) as Promise; - } - - throw new AsgardeoUIException( - 'JS_UI_CORE-BR-GBP-HE', - 'Failed to receive a successful response from the branding API.', - ); -}; - -export default getBrandingPreference; diff --git a/packages/__legacy__/core/src/api/get-profile-information.ts b/packages/__legacy__/core/src/api/get-profile-information.ts deleted file mode 100644 index 7b5faed0e..000000000 --- a/packages/__legacy__/core/src/api/get-profile-information.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {AuthClient} from '../auth-client'; -import AsgardeoUIException from '../exception'; -import {MeAPIResponse} from '../models/me-api-response'; - -/** - * Fetch the profile information of the authenticated user. - * - * This function uses the `AuthClient` instance to get the base URL and access token, - * and then makes a GET request to the `/scim2/Me` endpoint to fetch the user's profile information. - * - * @returns {Promise} A promise that resolves to an object containing the user's profile information. - * @throws {AsgardeoUIException} Throws an exception if there's an error getting the base URL and access token, or if the fetch request fails. - */ -const getProfileInformation = async (): Promise => { - let baseUrl: string; - let accessToken: string; - let response: Response; - - try { - baseUrl = (await AuthClient.getInstance().getStorageManager().getConfigData()).baseUrl; - accessToken = await AuthClient.getInstance().getAccessToken(); - } catch (error) { - throw new AsgardeoUIException( - 'JS_UI_CORE-ME-GPI-NF', - 'Failed in getting the base URL and access token.', - error.stack, - ); - } - - if (!accessToken) { - throw new AsgardeoUIException('JS_UI_CORE-ME-GPI-IV', 'Access token is null.'); - } - - const headers: Headers = new Headers(); - headers.append('Authorization', `Bearer ${accessToken}`); - headers.append('Content-Type', 'application/json'); - - const requestOptions: RequestInit = { - headers, - method: 'GET', - }; - - try { - response = await fetch(new Request(`${baseUrl}/scim2/Me`, requestOptions)); - } catch (error) { - throw new AsgardeoUIException('JS_UI_CORE-ME-GPI-NE', 'Me API call failed.', error.stack); - } - - if (response.ok) { - return (await response.json()) as MeAPIResponse; - } - - throw new AsgardeoUIException('JS_UI_CORE-ME-GPI-HE', 'Failed to receive a successful response from the Me API.'); -}; - -export default getProfileInformation; diff --git a/packages/__legacy__/core/src/api/public-api.ts b/packages/__legacy__/core/src/api/public-api.ts deleted file mode 100644 index 0eef3ae97..000000000 --- a/packages/__legacy__/core/src/api/public-api.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export {default as authorize} from './authorize'; -export {default as authenticate} from './authenticate'; -export {default as getBrandingPreference} from './get-branding-preference'; -export {default as getProfileInformation} from './get-profile-information'; -export {default as getBrandingPreferenceText} from './get-branding-preference-text'; -export {default as signOut} from './sign-out'; diff --git a/packages/__legacy__/core/src/api/sign-out.ts b/packages/__legacy__/core/src/api/sign-out.ts deleted file mode 100644 index 90f54c57a..000000000 --- a/packages/__legacy__/core/src/api/sign-out.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {AuthClient} from '../auth-client'; -import AsgardeoUIException from '../exception'; -import {UIAuthClient} from '../models/auth-config'; - -/** - * Sign out the user. - * - * This function sends a signout request to the server. - * - * @returns {Promise} A promise that resolves when the sign out process is complete. - * - * @example - * signOut() - * .then(() => { - * console.log('Signed out!'); - * }) - * .catch((error) => { - * console.error('Failed to sign out:', error); - * }); - */ -const signOut = async (): Promise => { - let response: Response; - let signOutUrl: string; - - const headers: Headers = new Headers(); - headers.append('Accept', 'application/json'); - headers.append('Content-Type', 'application/x-www-form-urlencoded'); - - const formBody: URLSearchParams = new URLSearchParams(); - - const authClient: UIAuthClient = AuthClient.getInstance(); - - try { - formBody.append('id_token_hint', await authClient.getIdToken()); - formBody.append('client_id', (await authClient.getStorageManager().getConfigData()).clientId); - formBody.append('response_mode', 'direct'); - } catch (error) { - throw new AsgardeoUIException('JS_UI_CORE-SIGNOUT-SO-IV', 'Failed to build the body of the signout request.'); - } - - const requestOptions: RequestInit = { - body: formBody.toString(), - headers, - method: 'POST', - }; - - try { - const {endSessionEndpoint} = await authClient.getOpenIDProviderEndpoints(); - signOutUrl = endSessionEndpoint; - } catch (error) { - throw new AsgardeoUIException('JS_UI_CORE-SIGNOUT-SO-NF', 'Failed to retrieve the sign out endpoint.'); - } - - try { - response = await fetch(signOutUrl, requestOptions); - } catch (error) { - throw new AsgardeoUIException('JS_UI_CORE-SIGNOUT-SO-NE', 'Failed to send a request to the sign out endpoint.'); - } - - if (!response.ok) { - throw new AsgardeoUIException( - 'JS_UI_CORE-SIGNOUT-SO-HE', - 'Failed to receive a successful response from the sign out endpoint.', - ); - } -}; - -export default signOut; diff --git a/packages/__legacy__/core/src/auth-client.ts b/packages/__legacy__/core/src/auth-client.ts deleted file mode 100644 index 255ae4b7f..000000000 --- a/packages/__legacy__/core/src/auth-client.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {AsgardeoAuthClient, Store, Crypto} from '@asgardeo/auth-js'; -import {UIAuthClient, UIAuthConfig} from './models/auth-config'; -import {BrandingPreferenceTypes} from './models/branding-api-response'; - -/** - * The `AuthClient` class is a singleton class that provides an instance of the `UIAuthClient`. - */ -export class AuthClient { - private static instance: UIAuthClient; - - /** - * Private constructor to prevent direct object creation. - * This is necessary because this is a singleton class. - * @private - */ - private constructor() {} - - /** - * Returns the singleton instance of `UIAuthClient`. If the instance does not exist, it is created. - * - * @param {UIAuthConfig} authClientConfig - The configuration for the `UIAuthClient`. - * @param {Store} store - The store for the `UIAuthClient`. - * @param {Crypto} cryptoUtils - The crypto utilities for the `UIAuthClient`. - * @returns {UIAuthClient} The singleton instance of `UIAuthClient`. - */ - static getInstance(authClientConfig?: UIAuthConfig, store?: Store, cryptoUtils?: Crypto): UIAuthClient { - if (!AuthClient.instance) { - const DEFAULT_NAME: string = 'carbon.super'; - - const extendedAuthClientConfig: UIAuthConfig = { - ...authClientConfig, - enableConsoleBranding: authClientConfig?.enableConsoleBranding ?? true, - enableConsoleTextBranding: authClientConfig?.enableConsoleTextBranding ?? true, - name: authClientConfig?.name ?? DEFAULT_NAME, - responseMode: 'direct', - type: authClientConfig?.type ?? BrandingPreferenceTypes.Org, - }; - - AuthClient.instance = new AsgardeoAuthClient(); - AuthClient.instance.initialize(extendedAuthClientConfig, store, cryptoUtils); - } - - return AuthClient.instance; - } -} - -/* Interfaces, classes and enums required from the auth-js package */ -export {Crypto, JWKInterface, Store, AsgardeoAuthClient, TokenResponse} from '@asgardeo/auth-js'; diff --git a/packages/__legacy__/core/src/branding/default-branding/dark-theme.ts b/packages/__legacy__/core/src/branding/default-branding/dark-theme.ts deleted file mode 100644 index 3a0a3d15e..000000000 --- a/packages/__legacy__/core/src/branding/default-branding/dark-theme.ts +++ /dev/null @@ -1,237 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {ThemeConfig} from '../../models/branding-api-response'; - -const DARK_THEME: ThemeConfig = { - buttons: { - externalConnection: { - base: { - background: { - backgroundColor: '#FFFFFF', - }, - border: { - borderRadius: '4px', - }, - font: { - color: '#000000de', - }, - }, - }, - primary: { - base: { - border: { - borderRadius: '4px', - }, - font: { - color: '#ffffffe6', - }, - }, - }, - secondary: { - base: { - border: { - borderRadius: '4px', - }, - font: { - color: '#000000de', - }, - }, - }, - }, - colors: { - alerts: { - error: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#ffd8d8', - }, - info: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#eff7fd', - }, - neutral: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#f8f8f9', - }, - warning: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#fff6e7', - }, - }, - background: { - body: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#fbfbfb', - }, - surface: { - contrastText: '', - dark: '#F6F4F2', - inverted: '#212a32', - light: '#f9fafb', - main: '#ffffff', - }, - }, - illustrations: { - accent1: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#3865B5', - }, - accent2: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#19BECE', - }, - accent3: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#FFFFFF', - }, - primary: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#FF7300', - }, - secondary: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#E0E1E2', - }, - }, - outlined: { - default: '#dadce0', - }, - primary: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#FF7300', - }, - secondary: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#E0E1E2', - }, - text: { - primary: '#000000de', - secondary: '#00000066', - }, - }, - footer: { - border: { - borderColor: '', - }, - font: { - color: '', - }, - }, - images: { - favicon: { - imgURL: undefined, - }, - logo: { - altText: undefined, - imgURL: undefined, - }, - myAccountLogo: { - altText: undefined, - imgURL: undefined, - title: 'Account', - }, - }, - inputs: { - base: { - background: { - backgroundColor: '#FFFFFF', - }, - border: { - borderColor: '', - borderRadius: '4px', - }, - font: { - color: '', - }, - labels: { - font: { - color: '', - }, - }, - }, - }, - loginBox: { - background: { - backgroundColor: '', - }, - border: { - borderColor: '', - borderRadius: '12px', - borderWidth: '1px', - }, - font: { - color: '', - }, - }, - loginPage: { - background: { - backgroundColor: '', - }, - font: { - color: '', - }, - }, - typography: { - font: { - fontFamily: 'Gilmer', - }, - heading: { - font: { - color: '', - }, - }, - }, -}; - -export default DARK_THEME; diff --git a/packages/__legacy__/core/src/branding/default-branding/default-branding.ts b/packages/__legacy__/core/src/branding/default-branding/default-branding.ts deleted file mode 100644 index ad658d0ed..000000000 --- a/packages/__legacy__/core/src/branding/default-branding/default-branding.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import DARK_THEME from './dark-theme'; -import LIGHT_THEME from './light-theme'; -import { - BrandingPreferenceAPIResponse, - PredefinedThemes, - PredefinedLayouts, - BrandingPreferenceTypes, -} from '../../models/branding-api-response'; - -const DEFAULT_BRANDING: BrandingPreferenceAPIResponse = { - locale: 'en-US', - name: '', - preference: { - configs: { - isBrandingEnabled: false, - }, - layout: { - activeLayout: PredefinedLayouts.Centered, - }, - organizationDetails: { - displayName: '', - supportEmail: '', - }, - theme: { - DARK: DARK_THEME, - LIGHT: LIGHT_THEME, - activeTheme: PredefinedThemes.Light, - }, - urls: { - cookiePolicyURL: '', - privacyPolicyURL: '', - termsOfUseURL: '', - }, - }, - type: BrandingPreferenceTypes.Org, -}; - -export default DEFAULT_BRANDING; diff --git a/packages/__legacy__/core/src/branding/default-branding/light-theme.ts b/packages/__legacy__/core/src/branding/default-branding/light-theme.ts deleted file mode 100644 index 745c6d1eb..000000000 --- a/packages/__legacy__/core/src/branding/default-branding/light-theme.ts +++ /dev/null @@ -1,237 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {ThemeConfig} from '../../models/branding-api-response'; - -const LIGHT_THEME: ThemeConfig = { - buttons: { - externalConnection: { - base: { - background: { - backgroundColor: '#FFFFFF', - }, - border: { - borderRadius: '4px', - }, - font: { - color: '#000000de', - }, - }, - }, - primary: { - base: { - border: { - borderRadius: '4px', - }, - font: { - color: '#ffffffe6', - }, - }, - }, - secondary: { - base: { - border: { - borderRadius: '4px', - }, - font: { - color: '#000000de', - }, - }, - }, - }, - colors: { - alerts: { - error: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#ffd8d8', - }, - info: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#eff7fd', - }, - neutral: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#f8f8f9', - }, - warning: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#fff6e7', - }, - }, - background: { - body: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#fbfbfb', - }, - surface: { - contrastText: '', - dark: '#F6F4F2', - inverted: '#212a32', - light: '#f9fafb', - main: '#ffffff', - }, - }, - illustrations: { - accent1: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#3865B5', - }, - accent2: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#19BECE', - }, - accent3: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#FFFFFF', - }, - primary: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#FF7300', - }, - secondary: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#E0E1E2', - }, - }, - outlined: { - default: '#dadce0', - }, - primary: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#FF7300', - }, - secondary: { - contrastText: '', - dark: '', - inverted: '', - light: '', - main: '#E0E1E2', - }, - text: { - primary: '#000000de', - secondary: '#00000066', - }, - }, - footer: { - border: { - borderColor: '', - }, - font: { - color: '', - }, - }, - images: { - favicon: { - imgURL: undefined, - }, - logo: { - altText: undefined, - imgURL: undefined, - }, - myAccountLogo: { - altText: undefined, - imgURL: undefined, - title: 'Account', - }, - }, - inputs: { - base: { - background: { - backgroundColor: '#FFFFFF', - }, - border: { - borderColor: '', - borderRadius: '4px', - }, - font: { - color: '', - }, - labels: { - font: { - color: '', - }, - }, - }, - }, - loginBox: { - background: { - backgroundColor: '', - }, - border: { - borderColor: '', - borderRadius: '12px', - borderWidth: '1px', - }, - font: { - color: '', - }, - }, - loginPage: { - background: { - backgroundColor: '', - }, - font: { - color: '', - }, - }, - typography: { - font: { - fontFamily: 'Gilmer', - }, - heading: { - font: { - color: '', - }, - }, - }, -}; - -export default LIGHT_THEME; diff --git a/packages/__legacy__/core/src/branding/get-branding-css.ts b/packages/__legacy__/core/src/branding/get-branding-css.ts deleted file mode 100644 index b0d64e254..000000000 --- a/packages/__legacy__/core/src/branding/get-branding-css.ts +++ /dev/null @@ -1,128 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import isEmpty from 'lodash.isempty'; -import getBranding from './get-branding'; -import {ThemeConfig} from '../models/branding-api-response'; -import GetBrandingProps from '../models/get-branding-props'; - -/** - * Generate a CSS string based on branding properties. - * - * This function retrieves the branding preferences based on the provided props, - * then generates a CSS string based on the active theme within those preferences. - * If no active theme is found, an empty string is returned. - * - * @param {GetBrandingProps} props - The properties used to retrieve the branding preferences. - * @returns {Promise} A promise that resolves to a CSS string. If no theme is found, - * the promise resolves to an empty string. - * - * @example - * getBrandingCSS(props).then(css => { - * // do something with the css string - * }); - */ -const getBrandingCSS = async (props: GetBrandingProps): Promise => { - const {theme} = (await getBranding(props)).preference; - - if (!theme) { - return ''; - } - const activeTheme: ThemeConfig = theme[theme.activeTheme]; - - const footerFontColor: string = !isEmpty(activeTheme.footer.font.color) ? activeTheme.footer.font.color : 'inherit'; - const headingFontColor: string = !isEmpty(activeTheme.typography.heading.font.color) - ? activeTheme.typography.heading.font.color - : 'inherit'; - const loginBoxFontColor: string = !isEmpty(activeTheme.loginBox.font.color) - ? activeTheme.loginBox.font.color - : 'inherit'; - const inputBaseFontColor: string = !isEmpty(activeTheme.inputs.base.font.color) - ? activeTheme.inputs.base.font.color - : 'inherit'; - const inputBaseLabelFontColor: string = !isEmpty(activeTheme.inputs.base.labels.font.color) - ? activeTheme.inputs.base.labels.font.color - : 'inherit'; - - return ` - ${activeTheme.typography.font.importURL ? `@import url(${activeTheme.typography.font.importURL});` : ''} - - :root { - --asg-colors-primary-main: ${activeTheme.colors.primary.main}; - --asg-colors-secondary-main: ${activeTheme.colors.secondary.main}; - --asg-colors-background-body-main: ${activeTheme.colors.background?.body?.main}; - --asg-colors-background-surface-main: ${activeTheme.colors.background?.surface?.main}; - --asg-colors-background-surface-light: ${activeTheme.colors.background?.surface?.light}; - --asg-colors-background-surface-dark: ${activeTheme.colors.background?.surface?.dark}; - --asg-colors-background-surface-inverted: ${activeTheme.colors.background?.surface?.inverted}; - --asg-colors-outlined-default: ${activeTheme.colors.outlined?.default}; - --asg-colors-text-primary: ${activeTheme.colors.text?.primary}; - --asg-colors-text-secondary: ${activeTheme.colors.text?.secondary}; - --asg-colors-alerts-error-main: ${activeTheme.colors.alerts?.error?.main}; - --asg-colors-alerts-neutral-main: ${activeTheme.colors.alerts?.neutral?.main}; - --asg-colors-alerts-info-main: ${activeTheme.colors.alerts?.info?.main}; - --asg-colors-alerts-warning-main: ${activeTheme.colors.alerts?.warning?.main}; - --asg-colors-illustrations-primary-main: ${activeTheme.colors.illustrations?.primary?.main}; - --asg-colors-illustrations-secondary-main: ${activeTheme.colors.illustrations?.secondary?.main}; - --asg-colors-illustrations-accent1-main: ${activeTheme.colors.illustrations?.accent1?.main}; - --asg-colors-illustrations-accent2-main: ${activeTheme.colors.illustrations?.accent2?.main}; - --asg-colors-illustrations-accent3-main: ${activeTheme.colors.illustrations?.accent3?.main}; - - /* Components */ - --asg-footer-text-color: ${footerFontColor}; - --asg-footer-border-color: ${activeTheme.footer?.border?.borderColor || 'var(--asg-colors-outlined-default)'}; - --asg-primary-font-family: ${activeTheme.typography.font.fontFamily}; - --asg-heading-text-color: ${headingFontColor}; - --asg-primary-button-base-text-color: ${activeTheme.buttons.primary.base.font.color}; - --asg-primary-button-base-border-radius: ${activeTheme.buttons.primary.base.border.borderRadius}; - --asg-secondary-button-base-text-color: ${activeTheme.buttons.secondary.base.font.color}; - --asg-secondary-button-base-border-radius: ${activeTheme.buttons.secondary.base.border.borderRadius}; - --asg-external-login-button-base-background-color: ${ - activeTheme.buttons.externalConnection.base.background.backgroundColor - }; - --asg-external-login-button-base-text-color: ${activeTheme.buttons.externalConnection.base.font.color}; - --asg-external-login-button-base-border-radius: ${activeTheme.buttons.externalConnection.base.border.borderRadius}; - --asg-login-box-background-color: ${ - activeTheme.loginBox?.background?.backgroundColor || 'var(--asg-colors-background-surface-main)' - }; - --asg-login-box-border-color: ${activeTheme.loginBox?.border?.borderColor || 'var(--asg-colors-outlined-default)'}; - --asg-login-box-border-width: ${activeTheme.loginBox.border.borderWidth}; - --asg-login-box-border-style: solid; - --asg-login-box-border-radius: ${activeTheme.loginBox.border.borderRadius}; - --asg-login-box-text-color: ${loginBoxFontColor}; - --asg-login-page-background-color: ${ - activeTheme.loginPage?.background?.backgroundColor || 'var(--asg-colors-background-body-main)' - }; - --asg-login-page-font-color: ${activeTheme.loginPage?.font?.color || 'var(--asg-colors-text-primary)'}; - --asg-input-field-base-text-color: ${inputBaseFontColor || 'var(--asg-colors-text-primary)'}; - --asg-input-field-base-background-color: ${activeTheme.inputs.base.background.backgroundColor}; - --asg-input-field-base-label-text-color: ${inputBaseLabelFontColor}; - --asg-input-field-base-border-color: ${ - activeTheme.inputs.base.border.borderColor || 'var(--asg-colors-outlined-default)' - }; - --asg-input-field-base-border-radius: ${activeTheme.inputs.base.border.borderRadius}; - --language-selector-background-color: var(--asg-login-page-background-color) !important; - --language-selector-text-color: var(--asg-footer-text-color) !important; - --language-selector-border-color: var(--asg-colors-primary-main) !important; - - /* Oxygen UI variables */ - --oxygen-palette-text-primary: ${activeTheme.colors.text?.primary}; -} `; -}; - -export default getBrandingCSS; diff --git a/packages/__legacy__/core/src/branding/get-branding.ts b/packages/__legacy__/core/src/branding/get-branding.ts deleted file mode 100644 index 0320b520f..000000000 --- a/packages/__legacy__/core/src/branding/get-branding.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import merge from 'lodash.merge'; -import DEFAULT_BRANDING from './default-branding/default-branding'; -import getBrandingPreference from '../api/get-branding-preference'; -import {AuthClient} from '../auth-client'; -import {Branding} from '../models/branding'; -import {BrandingPreferenceAPIResponse} from '../models/branding-api-response'; -import GetBrandingProps from '../models/get-branding-props'; - -/** - * Fetch and merge branding properties. - * - * @param {GetBrandingProps} props - Branding properties. - * @returns {Promise} A promise that resolves with the merged branding properties. - */ -const getBranding = async (props: GetBrandingProps): Promise => { - const {branding, merged} = props; - let mergedBranding: Branding; - - /** - * If the `merged` prop is not provided, fetch the branding from the console and merge it with the default branding. - * If the `merged` prop is provided, merge it with the branding props. - */ - if (!merged) { - let brandingFromConsole: BrandingPreferenceAPIResponse; - - try { - const {enableConsoleBranding} = await AuthClient.getInstance().getStorageManager().getConfigData(); - - if (enableConsoleBranding) { - brandingFromConsole = await getBrandingPreference(); - } - } catch { - /** - * If the branding from the console cannot be fetched, proceed with the default branding. - */ - } - - if (brandingFromConsole?.preference?.configs?.isBrandingEnabled) { - mergedBranding = merge(DEFAULT_BRANDING, brandingFromConsole ?? {}, branding ?? {}); - } else { - mergedBranding = merge(DEFAULT_BRANDING, branding ?? {}); - } - } else { - mergedBranding = merge(merged, branding ?? {}); - } - - return mergedBranding; -}; - -export default getBranding; diff --git a/packages/__legacy__/core/src/branding/public.ts b/packages/__legacy__/core/src/branding/public.ts deleted file mode 100644 index 280677f56..000000000 --- a/packages/__legacy__/core/src/branding/public.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export {default as getBranding} from './get-branding'; -export {default as getBrandingCSS} from './get-branding-css'; diff --git a/packages/__legacy__/core/src/exception.ts b/packages/__legacy__/core/src/exception.ts deleted file mode 100644 index d8695d561..000000000 --- a/packages/__legacy__/core/src/exception.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * `AsgardeoUIException` is a custom error class that extends the built-in `Error` class. - * - * @extends {Error} - */ -export default class AsgardeoUIException extends Error { - /** - * The name of the error, which is set to the name of the constructor. - * @override - */ - public override name: string; - - /** - * The stack trace of the error. - * @override - */ - public override stack: string; - - /** - * The code of the error. - */ - public code: string; - - /** - * Constructs a new `AsgardeoUIException`. - * - * @param {string} code - The error code. - * @param {string} message - The error message. - * @param {string} [stack] - The error stack trace. - */ - constructor(code: string, message: string, stack?: string) { - super(message); - this.code = code; - this.name = this.constructor.name; - this.stack = stack; - } -} diff --git a/packages/__legacy__/core/src/i18n/get-localization.ts b/packages/__legacy__/core/src/i18n/get-localization.ts deleted file mode 100644 index b0f453d94..000000000 --- a/packages/__legacy__/core/src/i18n/get-localization.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {AuthClientConfig} from '@asgardeo/auth-js'; -import merge from 'lodash.merge'; -import {TextObject} from './screens/model'; -import getBrandingPreferenceText from '../api/get-branding-preference-text'; -import {AuthClient} from '../auth-client'; -import {UIAuthConfig} from '../models/auth-config'; -import {BrandingPreferenceTextAPIResponse} from '../models/branding-text-api-response'; -import GetLocalizationProps from '../models/get-localization-props'; - -/** - * Fetch and merge branding properties. - * - * @param {BrandingProps} props - Branding properties. - * @returns {Promise} A promise that resolves with the merged branding properties. - */ -const getLocalization = async (props: GetLocalizationProps): Promise => { - const {componentTextOverrides, locale, providerTextOverrides, screen} = props; - - const module: TextObject = await import(`./screens/${screen}/${locale}.ts`); - - let textFromConsoleBranding: BrandingPreferenceTextAPIResponse; - - const configData: AuthClientConfig = await AuthClient.getInstance().getStorageManager().getConfigData(); - - try { - if (configData.enableConsoleTextBranding) { - textFromConsoleBranding = await getBrandingPreferenceText({ - locale, - name: configData.name, - screen, - type: configData.type, - }); - } - } catch (error) { - /** - * If the branding from the console cannot be fetched, proceed with the default branding. - */ - } - - /** - * Merge text objects according to the priority - */ - const mergedText: TextObject = await merge( - /** - * PRIORITY 04: Default stored branding text - */ - module[screen] ?? {}, - /** - * PRIORITY 03: Text from console branding - */ - textFromConsoleBranding?.preference?.text ?? {}, - /** - * PRIORITY 02: Text from provider customization - */ - providerTextOverrides?.[locale]?.[screen] ?? {}, - /** - * PRIORITY 01: Text from component customization - */ - componentTextOverrides?.[locale]?.[screen] ?? {}, - ); - - return mergedText; -}; - -export default getLocalization; diff --git a/packages/__legacy__/core/src/i18n/public.ts b/packages/__legacy__/core/src/i18n/public.ts deleted file mode 100644 index a8c9cec76..000000000 --- a/packages/__legacy__/core/src/i18n/public.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export * from './screens/model'; -export * from './screens/keys'; -export {default as getLocalization} from './get-localization'; diff --git a/packages/__legacy__/core/src/i18n/screens/common/en-US.ts b/packages/__legacy__/core/src/i18n/screens/common/en-US.ts deleted file mode 100644 index 5c66e5c79..000000000 --- a/packages/__legacy__/core/src/i18n/screens/common/en-US.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Common} from './model'; - -export const common: Common = { - 'common.title': 'Sign In', - copyright: '© {{currentYear}} WSO2 LLC.', - error: 'Something went wrong. Please try again.', - 'multiple.options.prefix': 'Sign in with', - or: 'OR', - 'prefix.register': "Don't have an account?", - 'privacy.policy': 'Privacy Policy', - register: 'Register', - 'site.title': 'WSO2 Identity Server', - 'terms.of.service': 'Terms of Service', -}; diff --git a/packages/__legacy__/core/src/i18n/screens/common/fr-FR.ts b/packages/__legacy__/core/src/i18n/screens/common/fr-FR.ts deleted file mode 100644 index bb21e7ff2..000000000 --- a/packages/__legacy__/core/src/i18n/screens/common/fr-FR.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Common} from './model'; - -export const common: Common = { - 'common.title': "S'identifier", - copyright: '© {{currentYear}} WSO2 LLC.', - error: "Quelque chose s'est mal passé. Veuillez réessayer.", - 'multiple.options.prefix': 'Se connecter avec', - or: 'OU', - 'prefix.register': "Vous n'avez pas de compte?", - 'privacy.policy': 'Politique de confidentialité', - register: "S'inscrire", - 'site.title': 'Identity Server WSO2', - 'terms.of.service': 'Conditions de service', -}; diff --git a/packages/__legacy__/core/src/i18n/screens/common/model.ts b/packages/__legacy__/core/src/i18n/screens/common/model.ts deleted file mode 100644 index 2b5d58618..000000000 --- a/packages/__legacy__/core/src/i18n/screens/common/model.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Interface for the common text. - */ -export interface Common { - 'common.title': string; - copyright: string; - error: string; - 'multiple.options.prefix': string; - or: string; - 'prefix.register': string; - 'privacy.policy': string; - register: string; - 'site.title': string; - 'terms.of.service': string; -} diff --git a/packages/__legacy__/core/src/i18n/screens/emailOtp/en-US.ts b/packages/__legacy__/core/src/i18n/screens/emailOtp/en-US.ts deleted file mode 100644 index 7bffbfd87..000000000 --- a/packages/__legacy__/core/src/i18n/screens/emailOtp/en-US.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {EmailOTP} from './model'; - -export const emailOtp: EmailOTP = { - continue: 'Continue', - 'email.heading': 'Sign In', - 'email.otp.heading': 'OTP Verification', - 'enter.verification.code.got.by.device': 'Enter the code sent to your email ID.', - 'resend.code': 'Resend code', - 'username.label': 'Username', - 'username.placeholder': 'Enter your username', -}; diff --git a/packages/__legacy__/core/src/i18n/screens/emailOtp/model.ts b/packages/__legacy__/core/src/i18n/screens/emailOtp/model.ts deleted file mode 100644 index 6e3beb9e1..000000000 --- a/packages/__legacy__/core/src/i18n/screens/emailOtp/model.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Interface for the TOTP text. - */ -export interface EmailOTP { - continue: string; - 'email.heading': string; - 'email.otp.heading': string; - 'enter.verification.code.got.by.device': string; - 'resend.code': string; - 'username.label': string; - 'username.placeholder': string; -} diff --git a/packages/__legacy__/core/src/i18n/screens/identifierFirst/en-US.ts b/packages/__legacy__/core/src/i18n/screens/identifierFirst/en-US.ts deleted file mode 100644 index f783f78f0..000000000 --- a/packages/__legacy__/core/src/i18n/screens/identifierFirst/en-US.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {IdentifierFirst} from './model'; - -export const identifierFirst: IdentifierFirst = { - continue: 'Continue', - 'enter.your.username': 'Enter your username', - 'login.button': 'Sign In', - 'login.heading': 'Sign In', - 'remember.me': 'Remember me on this computer', - retry: 'Login failed! Please check your username and password and try again.', - username: 'Username', -}; diff --git a/packages/__legacy__/core/src/i18n/screens/identifierFirst/fr-FR.ts b/packages/__legacy__/core/src/i18n/screens/identifierFirst/fr-FR.ts deleted file mode 100644 index 05a834d9a..000000000 --- a/packages/__legacy__/core/src/i18n/screens/identifierFirst/fr-FR.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {IdentifierFirst} from './model'; - -export const identifierFirst: IdentifierFirst = { - continue: 'Continuer', - 'enter.your.username': "Entrez votre nom d'utilisateur", - 'login.button': 'Se connecter', - 'login.heading': 'Se connecter', - 'remember.me': 'Se souvenir de moi sur cet ordinateur', - retry: "Échec de la connexion! Veuillez vérifier votre nom d'utilisateur et votre mot de passe et réessayer.", - username: "Nom d'utilisateur", -}; diff --git a/packages/__legacy__/core/src/i18n/screens/identifierFirst/model.ts b/packages/__legacy__/core/src/i18n/screens/identifierFirst/model.ts deleted file mode 100644 index 739eb60c6..000000000 --- a/packages/__legacy__/core/src/i18n/screens/identifierFirst/model.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Interface for the IdentifierFirst text. - */ -export interface IdentifierFirst { - continue: string; - 'enter.your.username': string; - 'login.button': string; - 'login.heading': string; - 'remember.me': string; - retry: string; - username: string; -} diff --git a/packages/__legacy__/core/src/i18n/screens/keys.ts b/packages/__legacy__/core/src/i18n/screens/keys.ts deleted file mode 100644 index 2d074abd4..000000000 --- a/packages/__legacy__/core/src/i18n/screens/keys.ts +++ /dev/null @@ -1,270 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Interface for the i18n keys. - */ -interface Keys { - common: { - common: { - title: string; - }; - copyright: string; - error: string; - multiple: { - options: { - prefix: string; - }; - }; - or: string; - prefix: { - register: string; - }; - privacy: { - policy: string; - }; - register: string; - site: { - title: string; - }; - terms: { - of: { - service: string; - }; - }; - }; - emailOtp: { - continue: string; - email: { - heading: string; - otp: { - heading: string; - }; - }; - enter: { - verification: { - code: { - got: { - by: { - device: string; - }; - }; - }; - }; - }; - resend: { - code: string; - }; - username: { - label: string; - placeholder: string; - }; - }; - identifierFirst: { - button: string; - continue: string; - enter: { - your: { - username: string; - }; - }; - login: { - heading: string; - }; - remember: { - me: string; - }; - retry: string; - username: string; - }; - login: { - button: string; - enter: { - your: { - password: string; - username: string; - }; - }; - login: { - heading: string; - }; - password: string; - remember: { - me: string; - }; - retry: string; - username: string; - }; - smsOtp: { - continue: string; - resend: { - code: string; - }; - - sms: { - otp: { - heading: string; - subheading: string; - }; - }; - }; - totp: { - continue: string; - enroll: { - message1: string; - message2: string; - }; - enter: { - verification: { - code: { - got: { - by: { - device: string; - }; - }; - }; - }; - }; - heading: string; - }; -} - -export const keys: Keys = { - common: { - common: { - title: 'common.common.title', - }, - copyright: 'common.copyright', - error: 'common.error', - multiple: { - options: { - prefix: 'common.multiple.options.prefix', - }, - }, - or: 'common.or', - prefix: { - register: 'common.prefix.register', - }, - privacy: { - policy: 'common.privacy.policy', - }, - register: 'common.register', - site: { - title: 'common.site.title', - }, - terms: { - of: { - service: 'common.terms.of.service', - }, - }, - }, - emailOtp: { - continue: 'emailOtp.continue', - email: { - heading: 'emailOtp.email.heading', - otp: { - heading: 'emailOtp.email.otp.heading', - }, - }, - enter: { - verification: { - code: { - got: { - by: { - device: 'emailOtp.enter.verification.code.got.by.device', - }, - }, - }, - }, - }, - resend: { - code: 'emailOtp.resend.code', - }, - username: { - label: 'emailOtp.username.label', - placeholder: 'emailOtp.username.placeholder', - }, - }, - identifierFirst: { - button: 'identifierFirst.button', - continue: 'identifierFirst.continue', - enter: { - your: { - username: 'identifierFirst.enter.your.username', - }, - }, - login: { - heading: 'identifierFirst.login.heading', - }, - remember: { - me: 'identifierFirst.remember.me', - }, - retry: 'identifierFirst.retry', - username: 'identifierFirst.username', - }, - login: { - button: 'login.login.button', - enter: { - your: { - password: 'login.enter.your.password', - username: 'login.enter.your.username', - }, - }, - login: { - heading: 'login.login.heading', - }, - password: 'login.password', - remember: { - me: 'login.remember.me', - }, - retry: 'login.retry', - username: 'login.username', - }, - smsOtp: { - continue: 'smsOtp.continue', - resend: { - code: 'smsOtp.resend.code', - }, - - sms: { - otp: { - heading: 'smsOtp.sms.otp.heading', - subheading: 'smsOtp.sms.otp.subheading', - }, - }, - }, - totp: { - continue: 'totp.continue', - enroll: { - message1: 'totp.totp.enroll.message1', - message2: 'totp.totp.enroll.message2', - }, - enter: { - verification: { - code: { - got: { - by: { - device: 'totp.enter.verification.code.got.by.device', - }, - }, - }, - }, - }, - heading: 'totp.totp.heading', - }, -}; diff --git a/packages/__legacy__/core/src/i18n/screens/login/en-US.ts b/packages/__legacy__/core/src/i18n/screens/login/en-US.ts deleted file mode 100644 index dff3ce0df..000000000 --- a/packages/__legacy__/core/src/i18n/screens/login/en-US.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Login} from './model'; - -export const login: Login = { - 'enter.your.password': 'Enter your password', - 'enter.your.username': 'Enter your username', - 'login.button': 'Sign In', - 'login.heading': 'Sign In', - password: 'Password', - 'remember.me': 'Remember me on this computer', - retry: 'Login failed! Please check your username and password and try again.', - username: 'Username', -}; diff --git a/packages/__legacy__/core/src/i18n/screens/login/fr-FR.ts b/packages/__legacy__/core/src/i18n/screens/login/fr-FR.ts deleted file mode 100644 index 571b8c153..000000000 --- a/packages/__legacy__/core/src/i18n/screens/login/fr-FR.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Login} from './model'; - -export const login: Login = { - 'enter.your.password': 'Entrez votre mot de passe', - 'enter.your.username': "Entrez votre nom d'utilisateur", - 'login.button': 'Se connecter', - 'login.heading': 'Se connecter', - password: 'Mot de passe', - 'remember.me': 'Se souvenir de moi sur cet ordinateur', - retry: "Échec de la connexion! Veuillez vérifier votre nom d'utilisateur et votre mot de passe et réessayer.", - username: "Nom d'utilisateur", -}; diff --git a/packages/__legacy__/core/src/i18n/screens/login/model.ts b/packages/__legacy__/core/src/i18n/screens/login/model.ts deleted file mode 100644 index e9e51dc79..000000000 --- a/packages/__legacy__/core/src/i18n/screens/login/model.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Interface for the login text. - */ -export interface Login { - 'enter.your.password': string; - 'enter.your.username': string; - 'login.button': string; - 'login.heading': string; - password: string; - 'remember.me': string; - retry: string; - username: string; -} diff --git a/packages/__legacy__/core/src/i18n/screens/model.ts b/packages/__legacy__/core/src/i18n/screens/model.ts deleted file mode 100644 index f9c28a879..000000000 --- a/packages/__legacy__/core/src/i18n/screens/model.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Common} from './common/model'; -import {IdentifierFirst} from './identifierFirst/model'; -import {Login} from './login/model'; -import {TOTP} from './totp/model'; - -/** - * Interface for the text preference. - */ -export interface TextPreference { - common: Common; - identifierFirst: IdentifierFirst; - login: Login; - totp: TOTP; -} - -/** - * Interface for the return type of the getLocalization function. - */ -export type TextObject = Login | TOTP | Common | IdentifierFirst; diff --git a/packages/__legacy__/core/src/i18n/screens/smsOtp/en-US.ts b/packages/__legacy__/core/src/i18n/screens/smsOtp/en-US.ts deleted file mode 100644 index 39078995e..000000000 --- a/packages/__legacy__/core/src/i18n/screens/smsOtp/en-US.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {SmsOTP} from './model'; - -export const smsOtp: SmsOTP = { - continue: 'Continue', - 'resend.code': 'Resend code', - 'sms.otp.heading': 'OTP Verification', - 'sms.otp.subheading': 'Enter the code sent to your mobile device.', -}; diff --git a/packages/__legacy__/core/src/i18n/screens/smsOtp/model.ts b/packages/__legacy__/core/src/i18n/screens/smsOtp/model.ts deleted file mode 100644 index b44b46468..000000000 --- a/packages/__legacy__/core/src/i18n/screens/smsOtp/model.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Interface for the TOTP text. - */ -export interface SmsOTP { - continue: string; - 'resend.code': string; - 'sms.otp.heading': string; - 'sms.otp.subheading': string; -} diff --git a/packages/__legacy__/core/src/i18n/screens/totp/en-US.ts b/packages/__legacy__/core/src/i18n/screens/totp/en-US.ts deleted file mode 100644 index fbe906e64..000000000 --- a/packages/__legacy__/core/src/i18n/screens/totp/en-US.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {TOTP} from './model'; - -export const totp: TOTP = { - continue: 'Continue', - 'enter.verification.code.got.by.device': 'Enter the verification code generated by your authenticator app.', - 'totp.enroll.message1': "Haven't setup your TOTP authenticator yet?", - 'totp.enroll.message2': 'Contact Support', - 'totp.heading': 'Verify Your Identity', -}; diff --git a/packages/__legacy__/core/src/i18n/screens/totp/fr-FR.ts b/packages/__legacy__/core/src/i18n/screens/totp/fr-FR.ts deleted file mode 100644 index 4576b4bd3..000000000 --- a/packages/__legacy__/core/src/i18n/screens/totp/fr-FR.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {TOTP} from './model'; - -export const totp: TOTP = { - continue: 'Continuer', - 'enter.verification.code.got.by.device': - "Entrez le code de vérification généré par votre application d'authentification.", - 'totp.enroll.message1': "Vous n'avez pas encore configuré votre application d'authentification TOTP?", - 'totp.enroll.message2': 'Contacter le support', - 'totp.heading': 'Vérifiez votre identité', -}; diff --git a/packages/__legacy__/core/src/i18n/screens/totp/model.ts b/packages/__legacy__/core/src/i18n/screens/totp/model.ts deleted file mode 100644 index 2c76b42a7..000000000 --- a/packages/__legacy__/core/src/i18n/screens/totp/model.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Interface for the TOTP text. - */ -export interface TOTP { - continue: string; - 'enter.verification.code.got.by.device': string; - 'totp.enroll.message1': string; - 'totp.enroll.message2': string; - 'totp.heading': string; -} diff --git a/packages/__legacy__/core/src/index.ts b/packages/__legacy__/core/src/index.ts deleted file mode 100644 index 9f27cbb7f..000000000 --- a/packages/__legacy__/core/src/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export * from './api/public-api'; -export * from './branding/public'; -export * from './i18n/public'; -export * from './auth-client'; -export * from './models/public-models'; -export {default as AsgardeoUIException} from './exception'; diff --git a/packages/__legacy__/core/src/models/auth-api-request.ts b/packages/__legacy__/core/src/models/auth-api-request.ts deleted file mode 100644 index 59ce7dead..000000000 --- a/packages/__legacy__/core/src/models/auth-api-request.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Interface for the Authn API request body. - */ -export interface AuthenticateProps { - /** - * The authentication flow id. - */ - flowId: string; - /** - * Contains selected authenticator's required details. - */ - selectedAuthenticator: SelectedAuthenticator; -} - -/** - * Interface for the selected authenticator. - */ -export interface SelectedAuthenticator { - /** - * The authentication authenticator id. - */ - authenticatorId: string; - /** - *Required parameters for the selected authenticator. - */ - params?: Record; -} diff --git a/packages/__legacy__/core/src/models/auth-api-response.ts b/packages/__legacy__/core/src/models/auth-api-response.ts deleted file mode 100644 index 81bd6a6ed..000000000 --- a/packages/__legacy__/core/src/models/auth-api-response.ts +++ /dev/null @@ -1,256 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Interface for the Authn and Authz API response. - */ -export interface AuthApiResponse { - /** - *If user is successfully authenticated, contains the authentication data. - */ - authData?: AuthData; - /** - *A unique identifier for the authentication flow. - */ - flowId: string; - /** - * The status of the authentication flow. - */ - flowStatus: FlowStatus; - /** - * The type of the authentication flow. - */ - flowType: string; - /** - * Contains the urls related to the authentication flow. - */ - links: Link[]; - /** - * Contains the authenticator data related to the next step. - */ - nextStep: AuthStep; -} - -/** - * Interface for the authentication data after flow status become SUCCESS_COMPLETED. - */ -export interface AuthData { - /** - * Code of the authentication flow - */ - code: string; - /** - * Session state of the authentication flow - */ - session_state: string; -} - -/** - * Enum for the flow status. - */ -export enum FlowStatus { - /** - * The authentication flow is failed. - */ - FailIncomplete = 'FAIL_INCOMPLETE', - /** - * The authentication flow is incomplete. - */ - Incomplete = 'INCOMPLETE', - /** - * The authentication flow is success. - */ - SuccessCompleted = 'SUCCESS_COMPLETED', -} - -/** - * Interface for the link. - */ -export interface Link { - /** - * The relative url of the link. - */ - href: string; - /** - * The supported http methods of the link. - */ - method: LinkMethod; - /** - * The identifier of the link. - */ - name: string; -} - -/** - * Enum for the link method. - */ -export enum LinkMethod { - Get = 'GET', - Post = 'POST', -} - -/** - * Interface for the authentication step. - */ -export interface AuthStep { - /** - * Contains the data related to the available authentication steps. - */ - authenticators: Authenticator[]; - /** - * The type of the next step in the authentication flow. - */ - stepType: StepType; -} - -/** - * Enum for the step type. - */ -export enum StepType { - /** - * The next step is for authenticating the user through a configured authenticator. - */ - AuthenticatorPrompt = 'AUTHENTICATOR_PROMPT', - /** - * The next step is for authenticator selection. - */ - MultiOptionsPrompt = 'MULTI_OPTIONS_PROMPT', -} - -/** - * Interface for the authenticator. - */ -export interface Authenticator { - /** - * The authenticator name. - */ - authenticator: string; - /** - * The authenticator identifier. - */ - authenticatorId: string; - /** - * The identity provider identifier. - */ - idp: string; - /** - * The metadata related to the authenticator. - */ - metadata: Metadata; - /** - * Contains the required parameters that should be sent to the server for - * processing the current step of the authentication request. - */ - requiredParams: string[]; -} - -/** - * Interface for the metadata. - */ -export interface Metadata { - /** - * Contains any additional data related to the authenticator which would be - * needed for the application to perform authentication. - */ - additionalData?: AdditionalData; - /** - * The i18n key for the authenticator. - */ - i18nKey: string; - /** - * If the promptType is USER_PROMPT, contains the data related to input parameters of the authenticator. - * */ - params?: Params; - /** - * The type of the prompt. - */ - promptType: PromptType; -} - -/** - * Enum for the prompt type. - */ -export enum PromptType { - /** - * The prompt is for the system to perform an internal action which - * will result in obtaining the required parameters. - */ - InternalPrompt = 'INTERNAL_PROMPT', - /** - * The prompt is for the user to be redirected to a different url which - * will result in obtaining the required parameters. - */ - RedirectionPromt = 'REDIRECTION_PROMPT', - /** - * The prompt is for the user to input the required parameters for the authenticator. - */ - UserPrompt = 'USER_PROMPT', -} - -/** - * Interface for the params. - */ -export interface Params { - /** - * Indicates whether the parameter is confidential or not. - */ - confidential: boolean; - /** - * Display name when prompting for the user. - */ - displayName: string; - /** - * The i18n key for the parameter. - */ - i18nKey: string; - /** - * Indicates the recommended display order of the parameter. - */ - order: number; - /* - * The parameter identifier. - */ - param: string; - /** - * Indicates the data type of the parameter. - */ - type: ParamsType; -} - -/** - * Enum for the params type. - */ -export enum ParamsType { - Boolean = 'BOOLEAN', - Integer = 'INTEGER', - String = 'STRING', -} - -/** - * Interface for the additional data. - */ -export interface AdditionalData { - /** - * Redirect URL for the redirection prompt. - */ - redirectUrl: string; - /** - * The state of the authentication flow. - */ - state: string; -} diff --git a/packages/__legacy__/core/src/models/auth-config.ts b/packages/__legacy__/core/src/models/auth-config.ts deleted file mode 100644 index a86565dfd..000000000 --- a/packages/__legacy__/core/src/models/auth-config.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {AsgardeoAuthClient, AuthClientConfig} from '@asgardeo/auth-js'; -import {BrandingPreferenceTypes} from './branding-api-response'; - -/** - * Interface for the configuration extension from the AuthClientConfig of '@asgardeo/auth-js'. - */ -interface AuthClientConfigExtension { - /** - * If enabled, the branding from the console will be used. Default value is true. - */ - enableConsoleBranding?: boolean; - /** - * If enabled, the text branding from the console will be used for the text. Default value is true. - */ - enableConsoleTextBranding?: boolean; - /* Language code of the locale. */ - locale?: string; - /** - * Tenant/Application name to filter the retrieval of customizations. - */ - name?: string; - /** - * Type to filter the retrieval of customizations. - */ - type?: BrandingPreferenceTypes; -} - -/** - * Type for the UI Auth configuration. - */ -export type UIAuthConfig = AuthClientConfig; - -/** - * Type for the UI Auth client. - */ -export type UIAuthClient = AsgardeoAuthClient; diff --git a/packages/__legacy__/core/src/models/branding-api-response.ts b/packages/__legacy__/core/src/models/branding-api-response.ts deleted file mode 100644 index 7e0dfbab5..000000000 --- a/packages/__legacy__/core/src/models/branding-api-response.ts +++ /dev/null @@ -1,593 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { - BackgroundStyleAttributes, - BorderStyleAttributes, - ButtonStyleAttributes, - ColorStyleAttributes, - ElementState, - FontStyleAttributes, -} from './element-styles'; - -/** - * Interface for the Branding Preference API response. - */ -export interface BrandingPreferenceAPIResponse { - /** - * Resource locale. - */ - locale: string; - /** - * Requested resource name. - */ - name: string; - /** - * Preference object. - */ - preference: BrandingPreference; - /** - * Preference type. - */ - type: BrandingPreferenceTypes; -} - -/** - * Interface Branding preference object. - */ -export interface BrandingPreference { - /** - * Configurations. - */ - configs: BrandingPreferenceConfig; - /** - * images such as Logo, Favicon, etc. - * @deprecated Use the images object in `theme.[].images`. - */ - images?: BrandingPreferenceImages; - /** - * Layout. - */ - layout: BrandingPreferenceLayout; - /** - * Organization's basic details. - */ - organizationDetails: BrandingPreferenceOrganizationDetails; - /** - * Stylesheets for login pages etc.. - */ - stylesheets?: BrandingPreferenceStylesheets; - /** - * Theme. - */ - theme: BrandingPreferenceTheme; - /** - * Links for policies, etc. - */ - urls: BrandingPreferenceURL; -} - -/** - * Interface Branding preference organization details. - */ -export interface BrandingPreferenceOrganizationDetails { - /** - * Copyright for the footer. - * @deprecated Moved to the `/branding-preference/text` API. - */ - copyrightText?: string; - /** - * Display name to be shown for Org members. - */ - displayName: string; - /** - * Site title appearing on the browser tab. - * @deprecated Moved to the `/branding-preference/text` API. - */ - siteTitle?: string; - /** - * Support email to be shown for Org members. - */ - supportEmail: string; -} - -/** - * Interface Branding preference images. - */ -export interface BrandingPreferenceImages { - /** - * Organization Favicon. - */ - favicon: Omit; - /** - * Organization Logo. - */ - logo: BrandingPreferenceImage; - /** - * Organization My Account Logo. - */ - myAccountLogo: BrandingPreferenceImage; -} - -/** - * Interface Branding preference image. - */ -export interface BrandingPreferenceImage { - /** - * Image Alt. - */ - altText: string | undefined; - /** - * Image URL. - */ - imgURL: string | undefined; - /** - * Title. - */ - title?: string; -} - -/** - * Interface Branding preference URLs. - */ -export interface BrandingPreferenceURL { - /** - * Link for Cookie Policy. - */ - cookiePolicyURL: string; - /** - * Link for Privacy Policy. - */ - privacyPolicyURL: string; - /** - * Link for Terms of Service. - */ - termsOfUseURL: string; -} - -/** - * Interface Branding preference stylesheets. - */ -export interface BrandingPreferenceStylesheets { - /** - * Login portal stylesheet. - */ - accountApp: PredefinedThemes; -} - -export type BrandingPreferenceTheme = StrictBrandingPreferenceTheme & DynamicBrandingPreferenceTheme; - -/** - * Interface Branding preference theme. - */ -export type DynamicBrandingPreferenceTheme = { - [key in PredefinedThemesKeys]: ThemeConfig; -}; - -/** - * Theme Configurations Interface. - */ -export interface ThemeConfig { - /** - * Button Preferences. - */ - buttons: BrandingPreferenceButtons; - /** - * Color Palette. - */ - colors: BrandingPreferenceColors; - /** - * Footer Preferences. - */ - footer: BrandingPreferenceFooter; - /** - * images such as Logo, Favicon, etc. - */ - images: BrandingPreferenceImages; - /** - * Input Fields Preferences. - */ - inputs: ElementState; - /** - * Login Box Preferences. - */ - loginBox: BrandingPreferenceLoginBox; - /** - * Login Page Preferences. - */ - loginPage?: BrandingPreferencePage; - /** - * Page Preferences. - * @deprecated Renamed to `loginPage` to keep it specific for login page. - */ - page?: BrandingPreferencePage; - /** - * Typography Preferences. - */ - typography: BrandingPreferenceTypography; -} - -/** - * Strict Interface Branding preference theme. - */ -export interface StrictBrandingPreferenceTheme { - /** - * The active theme. - */ - activeTheme: PredefinedThemes; -} - -/** - * Represents a color palette with different shades and contrast text. - */ -export interface PaletteColor { - /** - * The contrast text color for the color. - */ - contrastText?: string; - - /** - * The dark shade of the color. - */ - dark?: string; - - /** - * The inverted color for the color. - */ - inverted?: string; - - /** - * The light shade of the color. - */ - light?: string; - - /** - * The main shade of the color. - */ - main: string; -} - -/** - * Interface defining the color palette for a branding preference theme. - */ -export interface BrandingPreferenceColors { - /** - * The alerts color palette of the theme. - */ - alerts: { - /** - * The error alerts color palette of the theme. - */ - error: PaletteColor; - /** - * The info alerts color palette of the theme. - */ - info: PaletteColor; - /** - * The neutral alerts color palette of the theme. - */ - neutral: PaletteColor; - /** - * The warning alerts color palette of the theme. - */ - warning: PaletteColor; - }; - /** - * The background color palette of the theme. - */ - background: { - /** - * The body background color palette of the theme. - */ - body: PaletteColor; - /** - * The surface background color palette of the theme. - */ - surface: PaletteColor; - }; - /** - * The illustrations color palette of the theme. - */ - illustrations: { - /** - * The accent 1 illustrations color palette of the theme. - */ - accent1: PaletteColor; - /** - * The accent 2 illustrations color palette of the theme. - */ - accent2: PaletteColor; - /** - * The accent 3 illustrations color palette of the theme. - */ - accent3: PaletteColor; - /** - * The primary illustrations color palette of the theme. - */ - primary: PaletteColor; - /** - * The secondary illustrations color palette of the theme. - */ - secondary: PaletteColor; - }; - /** - * The outlined color palette of the theme. - */ - outlined: { - /** - * The default outlined color palette of the theme. - */ - default: string; - }; - /** - * The primary color palette of the theme. - */ - primary: PaletteColor; - /** - * The secondary color palette of the theme. - */ - secondary: PaletteColor; - /** - * The text color palette of the theme. - */ - text: { - /** - * The primary text color palette of the theme. - */ - primary: string; - /** - * The secondary text color palette of the theme. - */ - secondary: string; - }; -} - -/** - * Interface Branding preference footer preferences. - */ -export interface BrandingPreferenceFooter { - /** - * Page Body Font. - */ - border: Pick; - /** - * Page Body Font. - */ - font: FontStyleAttributes; -} - -/** - * Interface Branding preference page preferences. - */ -export interface BrandingPreferencePage { - /** - * Page Background. - */ - background: BackgroundStyleAttributes; - /** - * Page Body Font. - */ - font: FontStyleAttributes; -} - -/** - * Interface for the Branding Preference Typography. - */ -export interface BrandingPreferenceTypography { - /** - * Page Font. - */ - font: BrandingPreferenceTypographyFont; - /** - * Page Heading Typography. - */ - heading: { - /** - * Page Heading Font Preferences. - */ - font: ColorStyleAttributes; - }; -} - -/** - * Interface for the Font Typography Font. - */ -export interface BrandingPreferenceTypographyFont { - /** - * Font Family. - */ - fontFamily: string; - /** - * URL to import if loaded from a CDN. - */ - importURL?: string; -} - -/** - * Interface for the Login Box Preferences. - */ -export interface BrandingPreferenceButtons { - /** - * Social, External IDP Connection Button Preference. - */ - externalConnection: ElementState; - /** - * Primary Button Preferences. - */ - primary: ElementState>; - /** - * Secondary Button Preferences. - */ - secondary: ElementState>; -} - -/** - * Interface for the Login Box Preferences. - */ -export interface BrandingPreferenceInput { - /** - * Input field background. - */ - background: BackgroundStyleAttributes; - /** - * Secondary Button Preferences. - */ - border: Pick; - /** - * Input Field Font Preferences. - */ - font: FontStyleAttributes; - /** - * Input Labels Preferences. - */ - labels: { - /** - * Input Labels Font Preferences. - */ - font: FontStyleAttributes; - }; -} - -export interface BrandingPreferenceLoginBox { - /** - * Login Box Background. - */ - background: BackgroundStyleAttributes; - /** - * Login Box Border. - */ - border: BorderStyleAttributes; - /** - * Login Box Font. - */ - font: FontStyleAttributes; -} - -/** - * Interface Branding preference layout. - */ -export type BrandingPreferenceLayout = StrictBrandingPreferenceLayout & Partial; - -/** - * Strict Interface Branding preference layout. - */ -export interface StrictBrandingPreferenceLayout { - /** - * The active layout. - */ - activeLayout: PredefinedLayouts; -} - -/** - * Interface dynamic branding preference layout. - */ -export type DynamicBrandingPreferenceLayout = BrandingPreferenceSideImageLayout & BrandingPreferenceSideAlignedLayout; - -/** - * Left Image and Right Image layouts preference interface. - */ -export interface BrandingPreferenceSideImageLayout { - sideImg: BrandingPreferenceImage; -} - -/** - * Left Aligned and Right Aligned layouts preference interface. - */ -export interface BrandingPreferenceSideAlignedLayout { - productTagLine: string; -} - -/** - * Interface Branding preference configurations. - */ -export interface BrandingPreferenceConfig { - /** - * Should the changes be published? - */ - isBrandingEnabled: boolean; - /** - * Should remove default branding. - * @deprecated Renamed to `removeDefaultBranding` to keep it common. - */ - removeAsgardeoBranding?: boolean; - /** - * Should remove default branding. - */ - removeDefaultBranding?: boolean; -} - -/** - * Enum for Branding Preference Types. - */ -export enum BrandingPreferenceTypes { - /** - * Branding Preference for the App. - */ - App = 'APP', - /** - * Custom Branding Preference. - */ - Custom = 'CUSTOM', - /** - * Branding Preference for the Organization. - */ - Org = 'ORG', -} - -/** - * Enum for the font config strategies. - */ -export enum FontConfigurationStrategies { - BrowserDefault = 'BROWSER_DEFAULT', - Cdn = 'CDN', -} - -/** - * Enum for preview screen types. - */ -export enum PreviewScreenType { - EmailTemplate = 'email-template', - Login = 'login', - MyAccount = 'myaccount', -} - -/** - * Enum for set of predefined layouts. - */ -export enum PredefinedLayouts { - Centered = 'centered', - Custom = 'custom', - LeftAligned = 'left-aligned', - LeftImage = 'left-image', - RightAligned = 'right-aligned', - RightImage = 'right-image', -} - -/** - * Enum for set of predefined themes. - */ -export enum PredefinedThemes { - Dark = 'DARK', - Light = 'LIGHT', -} - -/** - * Mirror the enum as a string literal type - * to be used as a key in the theme object. - */ -export type PredefinedThemesKeys = 'LIGHT' | 'DARK'; diff --git a/packages/__legacy__/core/src/models/branding-text-api-response.ts b/packages/__legacy__/core/src/models/branding-text-api-response.ts deleted file mode 100644 index 30bb6bf05..000000000 --- a/packages/__legacy__/core/src/models/branding-text-api-response.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {BrandingPreferenceTypes} from './branding-api-response'; -import {ScreenType} from './screen-type'; - -/** - * Interface for the props of the `getBrandingPreferenceText` function. - */ -export interface GetBrandingPreferenceTextProps { - /** - * Locale to filter the retrieval of customizations. - */ - locale: string; - /** - * Tenant/Application name to filter the retrieval of customizations. - */ - name: string; - /** - * Screen to filter the retrieval of customizations. - */ - screen: ScreenType; - /** - * Type to filter the retrieval of customizations. - */ - type: BrandingPreferenceTypes; -} - -/** - * Branding preference text response interface. - */ -export interface BrandingPreferenceTextAPIResponse extends GetBrandingPreferenceTextProps { - /** - * Branding text preference. - */ - preference: BrandingTextPreference; -} - -/** - * Branding text preference interface. - */ -export interface BrandingTextPreference { - text: { - [keys: string]: string; - }; -} diff --git a/packages/__legacy__/core/src/models/branding.ts b/packages/__legacy__/core/src/models/branding.ts deleted file mode 100644 index c4f31ffd0..000000000 --- a/packages/__legacy__/core/src/models/branding.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {BrandingPreference, BrandingPreferenceTypes} from './branding-api-response'; -import {RecursivePartial} from './common'; -import {TextPreference} from '../i18n/screens/model'; - -/** - * Interface for the text in the customization object. - */ -export type BrandingPreferenceText = Record>; - -export type BrandingPreferenceTextProps = RecursivePartial; - -interface BrandingPreferenceWithText extends BrandingPreference { - text?: BrandingPreferenceText; -} - -/** - * Interface for the branding object. - */ -export interface Branding { - locale: string; - /** - * Requested resource name. - */ - name: string; - /** - * Preference object. - */ - preference: BrandingPreferenceWithText; - /** - * Preference type. - */ - type: BrandingPreferenceTypes; -} - -/** - * Type for the branding props. - */ -export type BrandingProps = RecursivePartial; diff --git a/packages/__legacy__/core/src/models/common.ts b/packages/__legacy__/core/src/models/common.ts deleted file mode 100644 index df92041c1..000000000 --- a/packages/__legacy__/core/src/models/common.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Makes all properties optional in T including nested properties - */ -export type RecursivePartial = { - [P in keyof T]?: T[P] extends (infer U)[] - ? RecursivePartial[] - : T[P] extends object - ? RecursivePartial - : T[P]; -}; diff --git a/packages/__legacy__/core/src/models/element-styles.ts b/packages/__legacy__/core/src/models/element-styles.ts deleted file mode 100644 index 3c86e8ae2..000000000 --- a/packages/__legacy__/core/src/models/element-styles.ts +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import type * as CSS from 'csstype'; - -/** - * Interface for the Primary Button Style Attributes.. - */ -export interface ButtonStyleAttributes { - /** - * Button Background. - */ - background: BackgroundStyleAttributes; - /** - * Button Border. - */ - border: Pick; - /** - * Button Text. - */ - font: FontStyleAttributes; -} - -/** - * Color styles interface. - * @remarks Extend with contrast, alpha. whenever necessary. - */ -export type ColorStyleAttributes = Pick; - -/** - * Font styles interface. - * @remarks Extend with font size, weight. whenever necessary. - */ -export type FontStyleAttributes = ColorStyleAttributes; - -/** - * Border styles interface. - * @remarks Extend with borderStyle, etc. whenever necessary. - */ -export type BorderStyleAttributes = Pick & - Pick & - Pick; - -/** - * Background styles interface. - * @remarks Extend with backgroundImage, backgroundSize, etc. whenever necessary. - */ -export type BackgroundStyleAttributes = Pick; - -/** - * Generic interface for element states. - * @remarks Extend with hover, active & other possible element states. - */ -export interface ElementState { - base: T; -} diff --git a/packages/__legacy__/core/src/models/get-branding-props.ts b/packages/__legacy__/core/src/models/get-branding-props.ts deleted file mode 100644 index 0ebe3b2ab..000000000 --- a/packages/__legacy__/core/src/models/get-branding-props.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Branding, BrandingProps} from './branding'; - -/** - * Interface for the getBranding function props. - */ -interface GetBrandingProps { - /** - * Customization prop passed to the component/provider. - */ - branding?: BrandingProps; - /** - * Merged customization object. - */ - merged?: Branding; -} - -export default GetBrandingProps; diff --git a/packages/__legacy__/core/src/models/get-localization-props.ts b/packages/__legacy__/core/src/models/get-localization-props.ts deleted file mode 100644 index 7eee4d56a..000000000 --- a/packages/__legacy__/core/src/models/get-localization-props.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {BrandingPreferenceTextProps} from './branding'; -import {ScreenType} from './screen-type'; - -/** - * Interface for getLocalization function props. - */ -interface GetLocalizationProps { - /** - * Customiztion prop passed to the component - */ - componentTextOverrides?: BrandingPreferenceTextProps; - /** - * Locale to filter the retrieval of localization. - */ - locale: string; - /** - * Customization prop passed to the provider - */ - providerTextOverrides?: BrandingPreferenceTextProps; - /** - * Screen to filter the retrieval of localization. - */ - screen: ScreenType; -} - -export default GetLocalizationProps; diff --git a/packages/__legacy__/core/src/models/me-api-response.ts b/packages/__legacy__/core/src/models/me-api-response.ts deleted file mode 100644 index 8b9fe3e7a..000000000 --- a/packages/__legacy__/core/src/models/me-api-response.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * The interface for the response from the "me" API endpoint. - */ -export interface MeAPIResponse { - /** - * The user's email addresses. - */ - emails: string[]; - /** - * The user's id. - */ - id: string; - /** - * The user's names. - */ - name: Name; - /** - * When signed in using a social login, the photos field will be populated instead of profile URL. - */ - photos?: Photos[]; - /** - * The user's profile URL. - */ - profileUrl: string; - /** - * The user's username. - */ - userName: string; -} - -/** - * The interface for the name field in the "me" API response. - */ -export interface Name { - familyName?: string; - givenName?: string; -} - -/** - * The interface for the photos field in the "me" API response. - */ -export interface Photos { - type: string; - value: string; -} diff --git a/packages/__legacy__/core/src/models/public-models.ts b/packages/__legacy__/core/src/models/public-models.ts deleted file mode 100644 index 0e6b3dfa2..000000000 --- a/packages/__legacy__/core/src/models/public-models.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export * from './auth-api-request'; -export * from './auth-api-response'; -export * from './auth-config'; -export * from './branding-api-response'; -export * from './branding'; -export * from './me-api-response'; -export * from './screen-type'; diff --git a/packages/__legacy__/core/src/models/screen-type.ts b/packages/__legacy__/core/src/models/screen-type.ts deleted file mode 100644 index 078ee0622..000000000 --- a/packages/__legacy__/core/src/models/screen-type.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Enum to store screen types. - */ -export enum ScreenType { - Common = 'common', - EmailOTP = 'emailOtp', - Login = 'login', - SMSOTP = 'smsOtp', - TOTP = 'totp', -} diff --git a/packages/__legacy__/core/tsconfig.eslint.json b/packages/__legacy__/core/tsconfig.eslint.json deleted file mode 100644 index 2211bcaaf..000000000 --- a/packages/__legacy__/core/tsconfig.eslint.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": [ - "**/.*.js", - "**/.*.cjs", - "**/.*.ts", - "**/*.js", - "**/*.cjs", - "**/*.ts", - ] - } diff --git a/packages/__legacy__/core/tsconfig.json b/packages/__legacy__/core/tsconfig.json deleted file mode 100644 index 62ff812ca..000000000 --- a/packages/__legacy__/core/tsconfig.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "compileOnSave": false, - "compilerOptions": { - "declaration": false, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "importHelpers": true, - "target": "es2015", - "module": "esnext", - "lib": ["es2017", "dom"], - "skipLibCheck": true, - "skipDefaultLibCheck": true, - "jsx": "react-jsx", - "allowJs": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "strict": false, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "resolveJsonModule": true, - "types": ["node", "jest"], - }, - "exclude": ["node_modules", "tmp"], - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.lib.json" - } - ] -} diff --git a/packages/__legacy__/core/tsconfig.lib.json b/packages/__legacy__/core/tsconfig.lib.json deleted file mode 100644 index 003eb30c3..000000000 --- a/packages/__legacy__/core/tsconfig.lib.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "declaration": true, - "outDir": "dist", - "declarationDir": "types", - "types": ["node"], - "emitDeclarationOnly": true - }, - "files": [], - "exclude": [ - "test-configs", - "jest.config.ts", - "**/*.spec.ts", - "**/*.test.ts", - "**/*.spec.tsx", - "**/*.test.tsx", - "**/*.spec.js", - "**/*.test.js", - "**/*.spec.jsx", - "**/*.test.jsx", - "dist" - ], - "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx", "rollup.config.cjs"] - } diff --git a/packages/__legacy__/react/.editorconfig b/packages/__legacy__/react/.editorconfig deleted file mode 100644 index 54a161112..000000000 --- a/packages/__legacy__/react/.editorconfig +++ /dev/null @@ -1 +0,0 @@ -../../.editorconfig diff --git a/packages/__legacy__/react/.eslintignore b/packages/__legacy__/react/.eslintignore deleted file mode 100644 index c925c21d5..000000000 --- a/packages/__legacy__/react/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -/dist -/node_modules diff --git a/packages/__legacy__/react/.eslintrc.cjs b/packages/__legacy__/react/.eslintrc.cjs deleted file mode 100644 index d8644f33e..000000000 --- a/packages/__legacy__/react/.eslintrc.cjs +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -const path = require('path'); - -module.exports = { - extends: [ - 'plugin:@wso2/typescript', - 'plugin:@wso2/react', - 'plugin:@wso2/strict', - 'plugin:@wso2/internal', - 'plugin:@wso2/prettier', - 'plugin:@wso2/jest', - 'plugin:react/jsx-runtime', - ], - parserOptions: { - project: [path.resolve(__dirname, 'tsconfig.lib.json'), path.resolve(__dirname, 'tsconfig.eslint.json')], - }, - plugins: ['@wso2'], - rules: { - // In `SignIn.tsx` we are using non dot notation to access the object properties. - // TODO: Refactor the code to use dot notation. - '@typescript-eslint/dot-notation': 'off', - // We are throwing custom exceptions in the codebase. - // Hence, turning this off to avoid linting errors. (https://eslint.org/docs/latest/rules/no-throw-literal#known-limitations) - '@typescript-eslint/no-throw-literal': 'off', - // TODO: Fix this and enable. - // Occurred while linting /packages/react/src/utils/crypto-utils.ts:33 - // Rule: "@typescript-eslint/no-useless-constructor" - '@typescript-eslint/no-useless-constructor': 'off', - 'class-methods-use-this': 'off', - }, -}; diff --git a/packages/__legacy__/react/.gitignore b/packages/__legacy__/react/.gitignore deleted file mode 100644 index f20a8a8c1..000000000 --- a/packages/__legacy__/react/.gitignore +++ /dev/null @@ -1,134 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -.pnpm-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# Snowpack dependency directory (https://snowpack.dev/) -web_modules/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional stylelint cache -.stylelintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variable files -.env -.env.development.local -.env.test.local -.env.production.local -.env.local - -# parcel-bundler cache (https://parceljs.org/) -.cache -.parcel-cache - -# Next.js build output -.next -out - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and not Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# vuepress v2.x temp and cache directory -.temp -.cache - -# Docusaurus cache and generated files -.docusaurus - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port - -# Stores VSCode versions used for testing VSCode extensions -.vscode-test - -# yarn v2 -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.pnp.* - -# misc -.DS_Store -*.pem diff --git a/packages/__legacy__/react/.prettierignore b/packages/__legacy__/react/.prettierignore deleted file mode 100644 index c925c21d5..000000000 --- a/packages/__legacy__/react/.prettierignore +++ /dev/null @@ -1,2 +0,0 @@ -/dist -/node_modules diff --git a/packages/__legacy__/react/CHANGELOG.md b/packages/__legacy__/react/CHANGELOG.md deleted file mode 100644 index 1d6fd181d..000000000 --- a/packages/__legacy__/react/CHANGELOG.md +++ /dev/null @@ -1,95 +0,0 @@ -# @asgardeo/react - -## 0.2.4 - -### Patch Changes - -- [#44](https://github.com/asgardeo/javascript/pull/44) - [`355234c`](https://github.com/asgardeo/javascript/commit/355234c5da7f873675f0dde8ac34fe18946c85c5) Thanks - [@dasuni-30](https://github.com/dasuni-30)! - Update package.json to support ESM modules - -- [#48](https://github.com/asgardeo/javascript/pull/48) - [`f0bbb30`](https://github.com/asgardeo/javascript/commit/f0bbb300f5ca7e27bab3ce90cb1bae9dc550aa98) Thanks - [@dasuni-30](https://github.com/dasuni-30)! - Fix EsLint issues in the PR build failure - -- Updated dependencies - [[`3d3af92`](https://github.com/asgardeo/javascript/commit/3d3af92338dec2d4b8aff09f9ba9da7d68781108)]: - - @asgardeo/js@0.1.3 - -## 0.2.3 - -### Patch Changes - -- [#38](https://github.com/asgardeo/javascript/pull/38) - [`9d577ed`](https://github.com/asgardeo/javascript/commit/9d577ed83b3ba138b884d2a2aa0f51f4dc2d7d79) Thanks - [@DonOmalVindula](https://github.com/DonOmalVindula)! - Fix loading state issues in the React SDK - -## 0.2.2 - -### Patch Changes - -- [#36](https://github.com/asgardeo/javascript/pull/36) - [`39b7402`](https://github.com/asgardeo/javascript/commit/39b74025195a74fde8d7a723855c3b3d7100bb9f) Thanks - [@DonOmalVindula](https://github.com/DonOmalVindula)! - Expose global loading state from the react SDK - -## 0.2.1 - -### Patch Changes - -- [#34](https://github.com/asgardeo/javascript/pull/34) - [`4344408`](https://github.com/asgardeo/javascript/commit/43444087466db1c12fdb97e283192d5e2ccc00f1) Thanks - [@DonOmalVindula](https://github.com/DonOmalVindula)! - Improvements to Identifier first authenticator in the React - SDK - -- Updated dependencies - [[`4344408`](https://github.com/asgardeo/javascript/commit/43444087466db1c12fdb97e283192d5e2ccc00f1)]: - - @asgardeo/js@0.1.2 - -## 0.2.0 - -### Minor Changes - -- [#31](https://github.com/asgardeo/javascript/pull/31) - [`084d8e9`](https://github.com/asgardeo/javascript/commit/084d8e9cc66a1b36033f82bf7659b9c3a1ac3627) Thanks - [@DonOmalVindula](https://github.com/DonOmalVindula)! - Implement support for identifier first authenticator - -## 0.1.1 - -### Patch Changes - -- [#20](https://github.com/asgardeo/javascript/pull/20) - [`8eef064`](https://github.com/asgardeo/javascript/commit/8eef0641c01de02aa7c4a6d75f059136fcfdb489) Thanks - [@movinsilva](https://github.com/movinsilva)! - Add readme files and update build scripts - -- Updated dependencies - [[`8eef064`](https://github.com/asgardeo/javascript/commit/8eef0641c01de02aa7c4a6d75f059136fcfdb489)]: - - @asgardeo/js@0.1.1 - -## 0.1.0 - -### Minor Changes - -- [#17](https://github.com/asgardeo/javascript/pull/17) - [`0be3e48`](https://github.com/asgardeo/javascript/commit/0be3e48a2896e10eea2f4c74ccc24eb1ddab09bd) Thanks - [@movinsilva](https://github.com/movinsilva)! - Initial release of @asgardeo/js and @asgardeo/react - - - Drop in components - - - SignIn - - SignOut - - SignedIn - - SignedOut - - - Custom hooks - - - useAuthentication - - useOn - - - api function calls in js - - branding and i18n support - -### Patch Changes - -- Updated dependencies - [[`0be3e48`](https://github.com/asgardeo/javascript/commit/0be3e48a2896e10eea2f4c74ccc24eb1ddab09bd)]: - - @asgardeo/js@0.1.0 diff --git a/packages/__legacy__/react/LICENSE b/packages/__legacy__/react/LICENSE deleted file mode 100644 index 261eeb9e9..000000000 --- a/packages/__legacy__/react/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/__legacy__/react/README.md b/packages/__legacy__/react/README.md deleted file mode 100644 index 30b225361..000000000 --- a/packages/__legacy__/react/README.md +++ /dev/null @@ -1,27 +0,0 @@ -

-

@asgardeo/react

-

-

React Wrapper to build customizable login UIs for Asgardeo or Identity Server

-
- npm (scoped) - npm - License -
- -## Installation - -```bash -# With npm -npm install @asgardeo/react - -# With pnpm -pnpm add @asgardeo/react - -# With yarn -yarn add @asgardeo/react -``` - -## License - -Licenses this source under the Apache License, Version 2.0 [LICENSE](./LICENSE), You may not use this file except in -compliance with the License. diff --git a/packages/__legacy__/react/declarations.d.ts b/packages/__legacy__/react/declarations.d.ts deleted file mode 100644 index 875a50f8d..000000000 --- a/packages/__legacy__/react/declarations.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -declare module '*.svg' { - const content: string; - export default content; -} diff --git a/packages/__legacy__/react/package.json b/packages/__legacy__/react/package.json deleted file mode 100644 index bfdc63b90..000000000 --- a/packages/__legacy__/react/package.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "private": true, - "name": "@asgardeo/react-legacy", - "version": "0.2.4", - "description": "React Wrapper to build customizable login UIs for Asgardeo or Identity Server", - "main": "dist/esm/index.js", - "module": "dist/esm/index.js", - "types": "dist/index.d.ts", - "type": "module", - "author": "WSO2", - "license": "Apache-2.0", - "files": [ - "dist", - "LICENSE", - "README.md" - ], - "homepage": "https://github.com/asgardeo/javascript/tree/main/packages/react#readme", - "bugs": { - "url": "https://github.com/asgardeo/javascript/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/asgardeo/javascript", - "directory": "packages/react" - }, - "keywords": [ - "asgardeo", - "identity", - "ui", - "react", - "login", - "customize" - ], - "scripts": { - "build": "rollup -c", - "lint": "eslint .", - "lint:fix": "eslint . --fix" - }, - "publishConfig": { - "access": "restricted" - }, - "devDependencies": { - "@rollup/plugin-commonjs": "25.0.7", - "@rollup/plugin-image": "3.0.3", - "@rollup/plugin-node-resolve": "15.2.3", - "@rollup/plugin-typescript": "11.1.6", - "@types/node": "20.12.7", - "@types/randombytes": "2.0.3", - "@types/react": "18.2.79", - "@types/react-dom": "18.2.25", - "@wso2/eslint-plugin": "catalog:", - "@wso2/prettier-config": "catalog:", - "@wso2/stylelint-config": "catalog:", - "eslint": "8.57.0", - "prettier": "3.2.5", - "react": "18.2.0", - "react-dom": "18.2.0", - "rollup": "4.17.2", - "rollup-plugin-dts": "6.1.0", - "rollup-plugin-polyfill-node": "0.13.0", - "rollup-plugin-styles": "4.0.0", - "sass": "1.75.0", - "stylelint": "15.1.0", - "tslib": "2.6.2", - "typescript": "5.1.6" - }, - "dependencies": { - "@asgardeo/js": "0.1.3", - "@oxygen-ui/react": "1.11.0", - "base64url": "3.0.1", - "buffer": "6.0.3", - "clsx": "2.1.1", - "fast-sha256": "1.3.0", - "jose": "5.3.0", - "randombytes": "2.1.0" - }, - "peerDependencies": { - "react": ">=18.3.1", - "react-dom": ">=18.3.1" - } -} diff --git a/packages/__legacy__/react/prettier.config.cjs b/packages/__legacy__/react/prettier.config.cjs deleted file mode 100644 index c07f730d2..000000000 --- a/packages/__legacy__/react/prettier.config.cjs +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -module.exports = require('@wso2/prettier-config'); diff --git a/packages/__legacy__/react/rollup.config.cjs b/packages/__legacy__/react/rollup.config.cjs deleted file mode 100644 index 5f03aaa1c..000000000 --- a/packages/__legacy__/react/rollup.config.cjs +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -const commonjs = require('@rollup/plugin-commonjs'); -const image = require('@rollup/plugin-image'); -const nodeResolve = require('@rollup/plugin-node-resolve'); -const typescript = require('@rollup/plugin-typescript'); -const dts = require('rollup-plugin-dts'); -const nodePolyfills = require('rollup-plugin-polyfill-node'); -const styles = require('rollup-plugin-styles'); - -const pkg = require('./package.json'); - -module.exports = [ - { - cache: false, - external: ['react', 'react-dom'], - input: 'src/index.ts', - onwarn(warning, warn) { - // Suppress this error message... there are hundreds of them - if (warning.code === 'MODULE_LEVEL_DIRECTIVE') return; - // Use default for everything else - warn(warning); - }, - output: [ - { - file: pkg.main, - format: 'cjs', - sourcemap: true, - }, - { - file: pkg.module, - format: 'esm', - sourcemap: true, - }, - ], - plugins: [ - nodePolyfills(), - nodeResolve({ - browser: true, - preferBuiltins: true, - }), - commonjs(), - typescript({tsconfig: './tsconfig.lib.json'}), - styles({ - mode: 'inject', - }), - image(), - ], - }, - { - cache: false, - external: [/\.(sass|scss|css)$/] /* ignore style files */, - input: 'dist/esm/types/index.d.ts', - output: [{file: 'dist/index.d.ts', format: 'esm'}], - plugins: [dts.default()], - }, -]; diff --git a/packages/__legacy__/react/src/assets/building-icon.svg b/packages/__legacy__/react/src/assets/building-icon.svg deleted file mode 100644 index fc8ff94a5..000000000 --- a/packages/__legacy__/react/src/assets/building-icon.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - diff --git a/packages/__legacy__/react/src/assets/email-solid.svg b/packages/__legacy__/react/src/assets/email-solid.svg deleted file mode 100644 index 248a0e9fb..000000000 --- a/packages/__legacy__/react/src/assets/email-solid.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - diff --git a/packages/__legacy__/react/src/assets/sms-icon.svg b/packages/__legacy__/react/src/assets/sms-icon.svg deleted file mode 100644 index 7cbf9f8f2..000000000 --- a/packages/__legacy__/react/src/assets/sms-icon.svg +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/packages/__legacy__/react/src/assets/social-logins/facebook.svg b/packages/__legacy__/react/src/assets/social-logins/facebook.svg deleted file mode 100644 index b217c0138..000000000 --- a/packages/__legacy__/react/src/assets/social-logins/facebook.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - diff --git a/packages/__legacy__/react/src/assets/social-logins/github.svg b/packages/__legacy__/react/src/assets/social-logins/github.svg deleted file mode 100644 index e1b198710..000000000 --- a/packages/__legacy__/react/src/assets/social-logins/github.svg +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/packages/__legacy__/react/src/assets/social-logins/google.svg b/packages/__legacy__/react/src/assets/social-logins/google.svg deleted file mode 100644 index 6375b41b2..000000000 --- a/packages/__legacy__/react/src/assets/social-logins/google.svg +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - diff --git a/packages/__legacy__/react/src/assets/social-logins/microsoft.svg b/packages/__legacy__/react/src/assets/social-logins/microsoft.svg deleted file mode 100644 index 431b21e9a..000000000 --- a/packages/__legacy__/react/src/assets/social-logins/microsoft.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - - - diff --git a/packages/__legacy__/react/src/assets/totp.svg b/packages/__legacy__/react/src/assets/totp.svg deleted file mode 100644 index dea82ba8b..000000000 --- a/packages/__legacy__/react/src/assets/totp.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - diff --git a/packages/__legacy__/react/src/components/SignIn/SignIn.tsx b/packages/__legacy__/react/src/components/SignIn/SignIn.tsx deleted file mode 100644 index 9500ccaf0..000000000 --- a/packages/__legacy__/react/src/components/SignIn/SignIn.tsx +++ /dev/null @@ -1,408 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { - AsgardeoUIException, - AuthApiResponse, - AuthClient, - Authenticator, - Branding, - FlowStatus, - Metadata, - PromptType, - ScreenType, - UIAuthClient, - authenticate, - authorize, - getBranding, - keys, -} from '@asgardeo/js'; -import {CircularProgress, ThemeProvider} from '@oxygen-ui/react'; -import {FC, ReactElement, useContext, useEffect, useState} from 'react'; -import BasicAuth from './fragments/BasicAuth'; -import EmailOtp from './fragments/EmailOtp'; -import IdentifierFirst from './fragments/IdentifierFirst'; -import LoginOptionsBox from './fragments/LoginOptionsBox'; -import SmsOtp from './fragments/SmsOtp'; -import Totp from './fragments/Totp'; -import AsgardeoContext from '../../contexts/asgardeo-context'; -import BrandingPreferenceContext from '../../contexts/branding-preference-context'; -import useAuthentication from '../../hooks/use-authentication'; -import {useConfig} from '../../hooks/use-config'; -import useTranslations from '../../hooks/use-translations'; -import AuthContext from '../../models/auth-context'; -import {AlertType, SignInProps} from '../../models/sign-in'; -import {SignIn as UISignIn} from '../../oxygen-ui-react-auth-components'; -import generateThemeSignIn from '../../theme/generate-theme-sign-in'; -import SPACryptoUtils from '../../utils/crypto-utils'; -import './sign-in.scss'; - -/** - * This component provides the sign-in functionality. - * - * @param {SignInProps} props - Props injected to the component. - * @param {BrandingProps} props.brandingProps - Branding related props. - * @param {boolean} props.showSignUp - Show sign-up. - * - * @returns {ReactElement} - React element. - */ -const SignIn: FC = (props: SignInProps): ReactElement => { - const { - basicAuthChildren, - brandingProps, - emailOtpChildren, - identifierFirstChildren, - showFooter = true, - showLogo = true, - showSignUp, - smsOtpChildren, - totpChildren, - } = props; - - const [alert, setAlert] = useState(); - const [showSelfSignUp, setShowSelfSignUp] = useState(showSignUp); - const [componentBranding, setComponentBranding] = useState(); - - const {isSignedIn} = useAuthentication(); - const {config} = useConfig(); - - const authContext: AuthContext | undefined = useContext(AsgardeoContext); - const {setAuthResponse, setIsComponentLoading} = authContext; - const brandingPreference: Branding = useContext(BrandingPreferenceContext); - - const {isLoading, t} = useTranslations({ - componentLocaleOverride: brandingProps?.locale, - componentTextOverrides: brandingProps?.preference?.text, - screen: ScreenType.Common, - }); - - useEffect(() => { - getBranding({branding: brandingProps, merged: brandingPreference}).then((response: Branding) => { - setComponentBranding(response); - }); - }, [brandingPreference, brandingProps]); - - useEffect(() => { - /** - * Calling authorize function and initiating the api based authentication flow - */ - authorize() - .then((response: AuthApiResponse) => { - setAuthResponse(response); - }) - .catch((error: Error) => { - setAlert({alertType: {error: true}, key: keys.common.error}); - throw new AsgardeoUIException('REACT_UI-SIGN_IN-SI-SE01', 'Authorization failed', error.stack); - }) - .finally(() => { - setIsComponentLoading(false); - }); - }, [setAuthResponse, setIsComponentLoading]); - - /** - * Handles the generalized authentication process. - * @param {string} authenticatorId - Authenticator ID. - * @param {object} [authParams] - Authentication parameters. - */ - const handleAuthenticate = async (authenticatorId: string, authParams?: {[key: string]: string}): Promise => { - setAlert(undefined); - - if (authContext?.authResponse === undefined) { - throw new AsgardeoUIException('REACT_UI-SIGN_IN-HA-IV02', 'Auth response is undefined.'); - } - - authContext?.setIsAuthLoading(true); - - const resp: AuthApiResponse = await authenticate({ - flowId: authContext?.authResponse.flowId, - selectedAuthenticator: { - authenticatorId, - params: authParams, - }, - }).catch((authnError: Error) => { - setAlert({alertType: {error: true}, key: keys.common.error}); - authContext?.setIsAuthLoading(false); - throw new AsgardeoUIException('REACT_UI-SIGN_IN-HA-SE03', 'Authentication failed.', authnError.stack); - }); - - if (!authParams) { - const metaData: Metadata = resp.nextStep?.authenticators[0]?.metadata; - if (metaData.promptType === PromptType.RedirectionPromt) { - /** - * Open a popup window to handle redirection prompts - */ - window.open( - metaData.additionalData?.redirectUrl, - resp.nextStep.authenticators[0].authenticator, - 'width=500,height=600', - ); - - /** - * Add an event listener to the window to capture the message from the popup - */ - window.addEventListener('message', function messageEventHandler(event: MessageEvent) { - /** - * Check the origin of the message to ensure it's from the popup window - */ - if (event.origin !== config.afterSignInUrl) return; - - const {code, state} = event.data; - - if (code && state) { - handleAuthenticate(resp?.nextStep?.authenticators[0]?.authenticatorId, {code, state}); - } - - /** - * Remove the event listener - */ - window.removeEventListener('message', messageEventHandler); - }); - } else if (metaData.promptType === PromptType.UserPrompt) { - authContext?.setAuthResponse(resp); - } - } else if (resp.flowStatus === FlowStatus.SuccessCompleted && resp.authData) { - /** - * when the authentication is successful, generate the token - */ - authContext?.setAuthResponse(resp); - - const authInstance: UIAuthClient = AuthClient.getInstance(); - const state: string = (await authInstance.getStorageManager().getTemporaryDataParameter('state')).toString(); - - await authInstance.requestAccessToken(resp.authData.code, resp.authData.session_state, state); - - authContext?.setAuthentication(); - } else if (resp.flowStatus === FlowStatus.FailIncomplete) { - authContext?.setAuthResponse({ - ...resp, - nextStep: authContext?.authResponse.nextStep, - }); - - setAlert({alertType: {error: true}, key: keys.common.error}); - } else { - authContext?.setAuthResponse(resp); - setShowSelfSignUp(false); - } - - authContext?.setIsAuthLoading(false); - }; - - const renderLoginOptions = (authenticators: Authenticator[]): ReactElement[] => { - const LoginOptions: ReactElement[] = []; - - authenticators.forEach((authenticator: Authenticator) => { - const displayName: string = authenticator.idp === 'LOCAL' ? authenticator.authenticator : authenticator.idp; - LoginOptions.push( - => handleAuthenticate(authenticator.authenticatorId)} - key={authenticator.authenticatorId} - />, - ); - }); - - return LoginOptions; - }; - - const renderSignIn = (): ReactElement => { - const authenticators: Authenticator[] = authContext?.authResponse?.nextStep?.authenticators; - - if (authenticators) { - const usernamePasswordAuthenticator: Authenticator = authenticators.find( - (authenticator: Authenticator) => authenticator.authenticator === 'Username & Password', - ); - - if (usernamePasswordAuthenticator) { - return ( - auth.authenticatorId !== usernamePasswordAuthenticator.authenticatorId, - ), - )} - > - {basicAuthChildren} - - ); - } - - const identifierFirstAuthenticator: Authenticator = authenticators.find( - (authenticator: Authenticator) => authenticator.authenticator === 'Identifier First', - ); - - if (identifierFirstAuthenticator) { - return ( - auth.authenticatorId !== identifierFirstAuthenticator.authenticatorId, - ), - )} - > - {identifierFirstChildren} - - ); - } - - if (authenticators.length === 1) { - if (authenticators[0].authenticator === 'TOTP') { - return ( - - {totpChildren} - - ); - } - if ( - // TODO: change after api based auth gets fixed - new SPACryptoUtils() - .base64URLDecode(authContext?.authResponse.nextStep.authenticators[0].authenticatorId) - .split(':')[0] === 'email-otp-authenticator' - ) { - return ( - - {emailOtpChildren} - - ); - } - - if ( - // TODO: change after api based auth gets fixed - new SPACryptoUtils() - .base64URLDecode(authContext?.authResponse.nextStep.authenticators[0].authenticatorId) - .split(':')[0] === 'sms-otp-authenticator' - ) { - return ( - - {smsOtpChildren} - - ); - } - } - - /** - * If there are multiple authenticators without Username and password, render the multiple options screen - */ - if (authenticators.length > 1) { - return ( - - - {t(keys.common.common.title)} - - {!usernamePasswordAuthenticator && alert && ( - - {t(alert.key)} - - )} - {renderLoginOptions(authenticators)} - - ); - } - } - return null; - }; - - /** - * Renders the circular progress component while the component or text is loading. - */ - if (authContext?.isComponentLoading || isLoading || authContext?.isBrandingLoading) { - return ( -
- -
- ); - } - - const imgUrl: string = brandingPreference?.preference?.theme?.LIGHT?.images?.logo?.imgURL; - let copyrightText: string = t(keys.common.copyright); - const DEFAULT_LOCALE: string = 'en-US'; - - if (showFooter && copyrightText.includes('{{currentYear}}')) { - copyrightText = copyrightText.replace('{{currentYear}}', new Date().getFullYear().toString()); - } - - return ( - - - {showLogo && !(isLoading || authContext?.isComponentLoading) && ( - - )} - {authContext?.authResponse?.flowStatus !== FlowStatus.SuccessCompleted && !isSignedIn && ( - <> - {renderSignIn()} - - {showFooter && !(isLoading || authContext?.isComponentLoading) && ( - - {t(keys.common.privacy.policy)} - - ), - }, - { - children: ( - - {t(keys.common.terms.of.service)} - - ), - }, - {children: {componentBranding?.locale ?? DEFAULT_LOCALE}}, - ]} - /> - )} - - )} - {(authContext?.authResponse?.flowStatus === FlowStatus.SuccessCompleted || isSignedIn) && ( -
Successfully Authenticated
- )} -
-
- ); -}; - -export default SignIn; diff --git a/packages/__legacy__/react/src/components/SignIn/fragments/BasicAuth.tsx b/packages/__legacy__/react/src/components/SignIn/fragments/BasicAuth.tsx deleted file mode 100644 index bc1baadf3..000000000 --- a/packages/__legacy__/react/src/components/SignIn/fragments/BasicAuth.tsx +++ /dev/null @@ -1,146 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {ScreenType, keys} from '@asgardeo/js'; -import {CircularProgress, Grid, Skeleton} from '@oxygen-ui/react'; -import {PropsWithChildren, ReactElement, useContext, useState} from 'react'; -import AsgardeoContext from '../../../contexts/asgardeo-context'; -import useTranslations from '../../../hooks/use-translations'; -import BasicAuthProps from '../../../models/basic-auth-props'; -import {SignIn as UISignIn} from '../../../oxygen-ui-react-auth-components'; -import './basic-auth.scss'; - -/** - * This component renders the basic authentication form. - * - * @param {BasicAuthProps} props - Props injected to the basic authentication component. - * @param {BrandingProps} props.brandingProps - Branding props. - * @param {Function} props.handleAuthenticate - Callback to handle authentication. - * @param {Authenticator} props.authenticator - Authenticator. - * @param {AlertType} props.alert - Alert type. - * @param {ReactElement[]} props.renderLoginOptions - Login options. - * @param {boolean} props.showSelfSignUp - Show self sign up. - * - * @return {ReactElement} - */ -const BasicAuth = ({ - handleAuthenticate, - authenticator, - children, - alert, - brandingProps, - showSelfSignUp, - renderLoginOptions, -}: PropsWithChildren): ReactElement => { - const [password, setPassword] = useState(''); - - const {isAuthLoading, username, setUsername} = useContext(AsgardeoContext); - - const {t, isLoading} = useTranslations({ - componentLocaleOverride: brandingProps?.locale, - componentTextOverrides: brandingProps?.preference?.text, - screen: ScreenType.Login, - }); - - if (isLoading) { - return ( - - - - - - - - - ); - } - - return ( - - - {t(keys.login.login.heading)} - - - {alert && ( - - {t(alert.key)} - - )} - - ): void => setUsername(e.target.value)} - /> - - ): void => setPassword(e.target.value)} - /> - - {children} - - { - handleAuthenticate(authenticator.authenticatorId, { - password, - username, - }); - }} - > - {t(keys.login.button)} - - - {isAuthLoading && ( -
- -
- )} - - {showSelfSignUp && ( - - {t(keys.common.prefix.register)} - - {t(keys.common.register)} - - - )} - - {renderLoginOptions.length !== 0 && {t(keys.common.or)} } - - {renderLoginOptions} -
- ); -}; - -export default BasicAuth; diff --git a/packages/__legacy__/react/src/components/SignIn/fragments/EmailOtp.tsx b/packages/__legacy__/react/src/components/SignIn/fragments/EmailOtp.tsx deleted file mode 100644 index 113961143..000000000 --- a/packages/__legacy__/react/src/components/SignIn/fragments/EmailOtp.tsx +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {ScreenType, keys} from '@asgardeo/js'; -import {CircularProgress, Skeleton} from '@oxygen-ui/react'; -import {PropsWithChildren, ReactElement, useContext, useState} from 'react'; -import AsgardeoContext from '../../../contexts/asgardeo-context'; -import useTranslations from '../../../hooks/use-translations'; -import EmailOtpProps from '../../../models/email-otp-props'; -import {SignIn as UISignIn} from '../../../oxygen-ui-react-auth-components'; -import './email-otp.scss'; - -/** - * Email OTP component. - * - * @param {EmailOtpProps} props - Props injected to the component. - * @param {BrandingProps} props.brandingProps - Branding props. - * @param {Authenticator} props.authenticator - Authenticator. - * @param {Function} props.handleAuthenticate - Callback to handle authentication. - * @param {AlertType} props.alert - Alert type. - * @return {ReactElement} - */ -const EmailOtp = ({ - alert, - brandingProps, - authenticator, - children, - handleAuthenticate, -}: PropsWithChildren): ReactElement => { - const [inputValue, setInputValue] = useState(); - const [isContinueLoading, setIsContinueLoading] = useState(false); - const [isResendLoading, setIsResendLoading] = useState(false); - - const {isAuthLoading} = useContext(AsgardeoContext); - - const param: string = authenticator?.metadata?.params[0]?.param; - /** - * Temporary i18n mapping. - * TODO: Remove once the i18n keys are implemented correctly in the API response. - */ - const i18nMapping: {[key: string]: {heading: string; inputLabel: string; placeholder?: string}} = { - OTPCode: {heading: keys.emailOtp.email.heading, inputLabel: keys.emailOtp.enter.verification.code.got.by.device}, - username: { - heading: keys.emailOtp.email.otp.heading, - inputLabel: keys.emailOtp.username.label, - placeholder: keys.emailOtp.username.placeholder, - }, - }; - - const {isLoading, t} = useTranslations({ - componentLocaleOverride: brandingProps?.locale, - componentTextOverrides: brandingProps?.preference?.text, - screen: ScreenType.EmailOTP, - }); - - if (isLoading) { - return ( - - - - - - - ); - } - - return ( - - {t(i18nMapping[param].heading)} - - {alert && {alert.key}} - - ): void => setInputValue(e.target.value)} - /> - - {children} - - { - handleAuthenticate(authenticator.authenticatorId, {[authenticator.requiredParams[0]]: inputValue}); - setInputValue(''); - setIsResendLoading(false); - setIsContinueLoading(true); - }} - > - {t(keys.emailOtp.continue)} - {isAuthLoading && isContinueLoading && } - - - {param === 'OTPCode' && ( - { - handleAuthenticate(authenticator.authenticatorId); - setInputValue(''); - setIsContinueLoading(false); - setIsResendLoading(true); - }} - > - {t(keys.emailOtp.resend.code)} - {isAuthLoading && isResendLoading && } - - )} - - ); -}; - -export default EmailOtp; diff --git a/packages/__legacy__/react/src/components/SignIn/fragments/IdentifierFirst.tsx b/packages/__legacy__/react/src/components/SignIn/fragments/IdentifierFirst.tsx deleted file mode 100644 index edf7388f9..000000000 --- a/packages/__legacy__/react/src/components/SignIn/fragments/IdentifierFirst.tsx +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {ScreenType, keys} from '@asgardeo/js'; -import {CircularProgress, Grid, Skeleton} from '@oxygen-ui/react'; -import {PropsWithChildren, ReactElement, useContext} from 'react'; -import AsgardeoContext from '../../../contexts/asgardeo-context'; -import useTranslations from '../../../hooks/use-translations'; -import BasicAuthProps from '../../../models/basic-auth-props'; -import {SignIn as UISignIn} from '../../../oxygen-ui-react-auth-components'; -import './basic-auth.scss'; - -/** - * This component renders the IdentifierFirst authentication form. - * - * @param {IdentifierFirstProps} props - Props injected to the IdentifierFirst authentication component. - * @param {BrandingProps} props.brandingProps - Branding props. - * @param {Function} props.handleAuthenticate - Callback to handle authentication. - * @param {Authenticator} props.authenticator - Authenticator. - * @param {AlertType} props.alert - Alert type. - * @param {ReactElement[]} props.renderLoginOptions - Login options. - * @param {boolean} props.showSelfSignUp - Show self sign up. - * - * @return {ReactElement} - */ -const IdentifierFirst = ({ - handleAuthenticate, - authenticator, - alert, - brandingProps, - children, - showSelfSignUp, - renderLoginOptions, -}: PropsWithChildren): ReactElement => { - const {isAuthLoading, username, setUsername} = useContext(AsgardeoContext); - - const {t, isLoading} = useTranslations({ - componentLocaleOverride: brandingProps?.locale, - componentTextOverrides: brandingProps?.preference?.text, - screen: ScreenType.Login, - }); - - if (isLoading) { - return ( - - - - - - - - - ); - } - - return ( - - - {t(keys.login.login.heading)} - - - {alert && ( - - {t(alert.key)} - - )} - - ): void => setUsername(e.target.value)} - /> - - {children} - - { - handleAuthenticate(authenticator.authenticatorId, { - username, - }); - }} - > - {t(keys.login.button)} - - - {isAuthLoading && ( -
- -
- )} - - {showSelfSignUp && ( - - {t(keys.common.prefix.register)} - - {t(keys.common.register)} - - - )} - - {renderLoginOptions.length !== 0 && {t(keys.common.or)} } - - {renderLoginOptions} -
- ); -}; - -export default IdentifierFirst; diff --git a/packages/__legacy__/react/src/components/SignIn/fragments/LoginOptionsBox.tsx b/packages/__legacy__/react/src/components/SignIn/fragments/LoginOptionsBox.tsx deleted file mode 100644 index a6b5a844b..000000000 --- a/packages/__legacy__/react/src/components/SignIn/fragments/LoginOptionsBox.tsx +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {ReactElement} from 'react'; -import buildingIcon from '../../../assets/building-icon.svg'; -import emailSolid from '../../../assets/email-solid.svg'; -import smsIcon from '../../../assets/sms-icon.svg'; -import facebook from '../../../assets/social-logins/facebook.svg'; -import github from '../../../assets/social-logins/github.svg'; -import google from '../../../assets/social-logins/google.svg'; -import microsoft from '../../../assets/social-logins/microsoft.svg'; -import totp from '../../../assets/totp.svg'; -import LoginOptionsBoxProps from '../../../models/login-options-box-props'; -import {SignIn as UISignIn} from '../../../oxygen-ui-react-auth-components'; - -const images: {[key: string]: string} = { - 'Email OTP': emailSolid, - Github: github, - Google: google, - Microsoft: microsoft, - 'SMS OTP': smsIcon, - TOTP: totp, - facebook, -}; - -/** - * This component renders the login options box. - * - * @param {LoginOptionsBoxProps} props - Props injected to the component. - * @param {string} props.socialName - Name of the social login. - * @param {string} props.displayName - Display name of the social login. - * @param {Function} props.handleOnClick - On click handler. - * @return {ReactElement} - */ -const LoginOptionsBox = ({ - isAuthLoading, - socialName, - displayName, - handleOnClick, -}: LoginOptionsBoxProps): ReactElement => ( - } - onClick={handleOnClick} - disabled={isAuthLoading} - > - {displayName} - -); - -export default LoginOptionsBox; diff --git a/packages/__legacy__/react/src/components/SignIn/fragments/SmsOtp.tsx b/packages/__legacy__/react/src/components/SignIn/fragments/SmsOtp.tsx deleted file mode 100644 index 6f3c5fe8d..000000000 --- a/packages/__legacy__/react/src/components/SignIn/fragments/SmsOtp.tsx +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {ScreenType, keys} from '@asgardeo/js'; -import {CircularProgress} from '@oxygen-ui/react'; -import {PropsWithChildren, ReactElement, useState} from 'react'; -import useTranslations from '../../../hooks/use-translations'; -import EmailOtpProps from '../../../models/email-otp-props'; -import {SignIn as UISignIn} from '../../../oxygen-ui-react-auth-components'; - -const SmsOtp = ({ - alert, - brandingProps, - authenticator, - children, - handleAuthenticate, -}: PropsWithChildren): ReactElement => { - const [otp, setOtp] = useState(); - - const {isLoading, t} = useTranslations({ - componentLocaleOverride: brandingProps?.locale, - componentTextOverrides: brandingProps?.preference?.text, - screen: ScreenType.SMSOTP, - }); - - if (isLoading) { - return ( -
- -
- ); - } - - return ( - - {t(keys.smsOtp.sms.otp.heading)} - - {t(keys.smsOtp.sms.otp.subheading)} - - {alert && {alert.key}} - - - - {children} - - { - handleAuthenticate(authenticator.authenticatorId, {OTPCode: otp}); - setOtp(''); - }} - > - {t(keys.smsOtp.continue)} - - - handleAuthenticate(authenticator.authenticatorId)} - color="secondary" - variant="contained" - > - {t(keys.smsOtp.resend.code)} - - - ); -}; - -export default SmsOtp; diff --git a/packages/__legacy__/react/src/components/SignIn/fragments/Totp.tsx b/packages/__legacy__/react/src/components/SignIn/fragments/Totp.tsx deleted file mode 100644 index 9a17c3b63..000000000 --- a/packages/__legacy__/react/src/components/SignIn/fragments/Totp.tsx +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {ScreenType, keys} from '@asgardeo/js'; -import {CircularProgress, Grid, Skeleton} from '@oxygen-ui/react'; -import {useState, ReactElement, useContext, PropsWithChildren} from 'react'; -import AsgardeoContext from '../../../contexts/asgardeo-context'; -import useTranslations from '../../../hooks/use-translations'; -import TotpProps from '../../../models/totp-props'; -import {SignIn as UISignIn} from '../../../oxygen-ui-react-auth-components'; -import './totp.scss'; - -/** - * This component renders the TOTP authentication screen. - * - * @param {TotpProps} props - Props injected to the component. - * @param {AlertType} props.alert - Alert type. - * @param {string} props.authenticator - Authenticator. - * @param {BrandingProps} props.brandingProps - Branding props. - * @param {Function} props.handleAuthenticate - Callback to handle authentication. - * - * @return {ReactElement} - */ -const Totp = ({ - brandingProps, - authenticator, - children, - handleAuthenticate, - alert, -}: PropsWithChildren): ReactElement => { - const [totp, setTotp] = useState(); - - const {isAuthLoading} = useContext(AsgardeoContext); - - const {isLoading, t} = useTranslations({ - componentLocaleOverride: brandingProps?.locale, - componentTextOverrides: brandingProps?.preference?.text, - screen: ScreenType.TOTP, - }); - - if (isLoading) { - return ( - - - - - - - - - - - - - - - ); - } - return ( - - {t(keys.totp.heading)} - - {alert && ( - - {t(alert.key)} - - )} - - {t(keys.totp.enter.verification.code.got.by.device)} - - - - {children} - - { - handleAuthenticate(authenticator.authenticatorId, {token: totp}); - setTotp(''); - }} - > - {t(keys.totp.continue)} - - - {isAuthLoading && ( -
- -
- )} - - - {t(keys.totp.enroll.message1)} -
- {t(keys.totp.enroll.message2)} -
-
- ); -}; - -export default Totp; diff --git a/packages/__legacy__/react/src/components/SignIn/fragments/basic-auth.scss b/packages/__legacy__/react/src/components/SignIn/fragments/basic-auth.scss deleted file mode 100644 index 50a8fac34..000000000 --- a/packages/__legacy__/react/src/components/SignIn/fragments/basic-auth.scss +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -.asgardeo-basic-auth-skeleton { - display: flex; - flex-flow: column nowrap; - padding: 32px; - row-gap: 8px; - - .skeleton-title { - margin: 0 auto; - } - - .skeleton-text-field-label { - margin-top: 12px; - } - - .skeleton-submit-button { - margin: 20px auto 0; - border-radius: 20px; - } -} - -.Paper-basicAuth { - opacity: 0.5; - animation: fade-in 0.9s ease-in-out forwards; - - .asgardeo-basic-auth-alert { - margin-top: 12px; - } -} - -.asgardeo-register-link { - margin-left: 3px; -} - -@keyframes fade-in { - to { - opacity: 1; - } -} diff --git a/packages/__legacy__/react/src/components/SignIn/fragments/email-otp.scss b/packages/__legacy__/react/src/components/SignIn/fragments/email-otp.scss deleted file mode 100644 index 67a168882..000000000 --- a/packages/__legacy__/react/src/components/SignIn/fragments/email-otp.scss +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -.asgardeo-email-otp-skeleton { - display: flex; - flex-flow: column nowrap; - padding: 32px; - row-gap: 8px; - - .skeleton-title { - margin: 0 auto; - } - - .skeleton-text-field-label { - margin-top: 12px; - } - - .skeleton-submit-button { - margin: 20px auto 0; - border-radius: 20px; - } -} - -.asgardeo-email-otp-paper { - opacity: 0.5; - animation: fade-in 0.9s ease-in-out forwards; -} - -@keyframes fade-in { - to { - opacity: 1; - } -} diff --git a/packages/__legacy__/react/src/components/SignIn/fragments/totp.scss b/packages/__legacy__/react/src/components/SignIn/fragments/totp.scss deleted file mode 100644 index db7e0bf0a..000000000 --- a/packages/__legacy__/react/src/components/SignIn/fragments/totp.scss +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -.asgardeo-totp-skeleton { - display: flex; - flex-flow: column nowrap; - padding: 32px; - row-gap: 8px; - min-width: 330px; - - .skeleton-title { - margin: 0 auto; - } - - .skeleton-pin-box { - margin: 0 4px; - } - - .skeleton-submit-button { - margin: 20px auto 0; - border-radius: 20px; - } -} - -.asgardeo-totp-alert { - margin: 20px 0; -} diff --git a/packages/__legacy__/react/src/components/SignIn/sign-in.scss b/packages/__legacy__/react/src/components/SignIn/sign-in.scss deleted file mode 100644 index 40f68abb1..000000000 --- a/packages/__legacy__/react/src/components/SignIn/sign-in.scss +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -$--min-height: 75vh; - -.Box-asgardeoSignIn { - min-width: 350px; - min-height: $--min-height; - - .email-otp-resend-button { - margin-top: 0; - } - - .multiple-otions-title { - margin: 16px 0 34px; - } - - .asgardeo-multiple-options-paper { - padding-bottom: 64px; - - .asgardeo-sign-in-alert { - margin-bottom: 24px; - } - } -} - -.Box-circularProgressHolder { - display: flex; - justify-content: center; - align-items: center; - min-height: $--min-height; - - .circular-progress { - color: rgb(214 211 211) !important; - } -} - -.asgardeo-sign-in-footer, -.asgardeo-sign-in-logo { - opacity: 0.5; - animation: fade-in 0.7s ease-in-out forwards; -} - -@keyframes fade-in { - to { - opacity: 1; - } -} - -.circular-progress-holder-authn { - display: flex; - justify-content: center; - align-items: center; - flex-grow: 1; - - .sign-in-button-progress { - color: var(--oxygen-palette-primary-main); - margin: 0 auto !important; - max-height: 25px; - max-width: 25px; - margin-left: 12px; - } -} diff --git a/packages/__legacy__/react/src/components/SignInButton/SignInButton.tsx b/packages/__legacy__/react/src/components/SignInButton/SignInButton.tsx deleted file mode 100644 index bc52077af..000000000 --- a/packages/__legacy__/react/src/components/SignInButton/SignInButton.tsx +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Box, Button, CircularProgress} from '@oxygen-ui/react'; -import React, {ReactElement, useContext, useState} from 'react'; -import './sign-in-button.scss'; -import AsgardeoContext from '../../contexts/asgardeo-context'; -import AuthContext from '../../models/auth-context'; -import {SignInButtonProps} from '../../models/sign-in'; -import SignIn from '../SignIn/SignIn'; - -/** - * SignInButton component. This button will render a modal with the SignIn component when clicked. - * - * @param {Object} props - Component props. - * @param {ReactElement} props.customComponent - Optional custom component to be rendered. - * @returns {ReactElement} Rendered SignInButton component. - */ -const SignInButton = (props: SignInButtonProps): ReactElement => { - const {customComponent, showFooter = false, showLogo = false, showSignUp = false} = props; - - const [modalVisible, setModalVisible] = useState(false); - - const authContext: AuthContext | undefined = useContext(AsgardeoContext); - - const openModal = (): void => { - setModalVisible(true); - }; - - const closeModal = (): void => { - setModalVisible(false); - }; - - if (authContext.isBrandingLoading) { - return ( - - ); - } - - return ( -
- {customComponent ? ( - React.cloneElement(customComponent, { - onClick: openModal, - }) - ) : ( - - )} - - {modalVisible && ( - - - - )} - - {modalVisible && } -
- ); -}; - -export default SignInButton; diff --git a/packages/__legacy__/react/src/components/SignInButton/sign-in-button.scss b/packages/__legacy__/react/src/components/SignInButton/sign-in-button.scss deleted file mode 100644 index 7a59663c6..000000000 --- a/packages/__legacy__/react/src/components/SignInButton/sign-in-button.scss +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -.asgardeo { - .asgardeo-sign-in-button { - color: var(--oxygen-palette-text-primary); - } - - .OxygenSignInImage { - height: 45px; - } - - .popup-box { - position: fixed; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - z-index: 1000; - min-height: 65%; - min-width: 35%; - max-height: 100%; - display: flex; - justify-content: center; - align-items: center; - overflow: auto; - padding-top: 40px; - - /* Hide scrollbar for Chrome, Safari and Opera */ - ::-webkit-scrollbar { - display: none; - } - - /* Hide scrollbar for IE, Edge and Firefox */ - -ms-overflow-style: none; /* IE and Edge */ - scrollbar-width: none; /* Firefox */ - } - - .popup-box-overlay { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: rgb(0 0 0 / 76.8%); - z-index: 100; - } -} diff --git a/packages/__legacy__/react/src/components/SignOutButton/SignOutButton.tsx b/packages/__legacy__/react/src/components/SignOutButton/SignOutButton.tsx deleted file mode 100644 index bd5292092..000000000 --- a/packages/__legacy__/react/src/components/SignOutButton/SignOutButton.tsx +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Button} from '@oxygen-ui/react'; -import {ReactElement} from 'react'; -import useAuthentication from '../../hooks/use-authentication'; - -/** - * SignOutButton component. - * - * This component renders a sign out button. When clicked, it triggers the sign out process. - * - * @returns {ReactElement} Rendered SignOutButton component. - */ -const SignOutButton = (): ReactElement => { - const {signOut} = useAuthentication(); - - return ( -
- -
- ); -}; - -export default SignOutButton; diff --git a/packages/__legacy__/react/src/components/SignedIn/SignedIn.tsx b/packages/__legacy__/react/src/components/SignedIn/SignedIn.tsx deleted file mode 100644 index 58dabe2a8..000000000 --- a/packages/__legacy__/react/src/components/SignedIn/SignedIn.tsx +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {FC, PropsWithChildren} from 'react'; -import useAuthentication from '../../hooks/use-authentication'; -import SignedProps from '../../models/signed-props'; - -/** - * This component renders its children if the user is signed out. - * - * @param {PropsWithChildren} props - Props injected to the component. - * @param {ReactElement} props.fallback - Fallback element to render. - * - * @return {JSX.Element} - */ -const SignedIn: FC> = (props: PropsWithChildren) => { - const {fallback = null, children} = props; - const {isSignedIn} = useAuthentication(); - - return isSignedIn ? children : fallback; -}; - -export default SignedIn; diff --git a/packages/__legacy__/react/src/components/SignedOut/SignedOut.tsx b/packages/__legacy__/react/src/components/SignedOut/SignedOut.tsx deleted file mode 100644 index 1e5825a4b..000000000 --- a/packages/__legacy__/react/src/components/SignedOut/SignedOut.tsx +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {FC, PropsWithChildren} from 'react'; -import useAuthentication from '../../hooks/use-authentication'; -import SignedProps from '../../models/signed-props'; - -/** - * This component renders its children if the user is signed out. - * - * @param {PropsWithChildren} props - Props injected to the component. - * @param {ReactElement} props.fallback - Fallback element to render. - * - * @return {JSX.Element} - */ -const SignedOut: FC> = (props: PropsWithChildren) => { - const {fallback = null, children} = props; - const {isSignedIn} = useAuthentication(); - - return !isSignedIn ? children : fallback; -}; - -export default SignedOut; diff --git a/packages/__legacy__/react/src/components/public-components.ts b/packages/__legacy__/react/src/components/public-components.ts deleted file mode 100644 index 5e518d199..000000000 --- a/packages/__legacy__/react/src/components/public-components.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export {default as SignIn} from './SignIn/SignIn'; -export {default as SignedIn} from './SignedIn/SignedIn'; -export {default as SignedOut} from './SignedOut/SignedOut'; -export {default as SignInButton} from './SignInButton/SignInButton'; -export {default as SignOutButton} from './SignOutButton/SignOutButton'; diff --git a/packages/__legacy__/react/src/contexts/asgardeo-context.ts b/packages/__legacy__/react/src/contexts/asgardeo-context.ts deleted file mode 100644 index d04644ef7..000000000 --- a/packages/__legacy__/react/src/contexts/asgardeo-context.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Context, createContext} from 'react'; -import AuthContext from '../models/auth-context'; - -const AsgardeoContext: Context = createContext(undefined); - -export default AsgardeoContext; diff --git a/packages/__legacy__/react/src/contexts/branding-preference-context.ts b/packages/__legacy__/react/src/contexts/branding-preference-context.ts deleted file mode 100644 index 1e4e96e9f..000000000 --- a/packages/__legacy__/react/src/contexts/branding-preference-context.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Branding} from '@asgardeo/js'; -import {Context, createContext} from 'react'; - -const BrandingPreferenceContext: Context = createContext(undefined); - -export default BrandingPreferenceContext; diff --git a/packages/__legacy__/react/src/contexts/i18n-context.ts b/packages/__legacy__/react/src/contexts/i18n-context.ts deleted file mode 100644 index e826ae174..000000000 --- a/packages/__legacy__/react/src/contexts/i18n-context.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Context, createContext} from 'react'; -import {I18n} from '../models/i18n'; - -const I18nContext: Context = createContext(undefined); - -export default I18nContext; diff --git a/packages/__legacy__/react/src/hooks/use-authentication.ts b/packages/__legacy__/react/src/hooks/use-authentication.ts deleted file mode 100644 index 08e753957..000000000 --- a/packages/__legacy__/react/src/hooks/use-authentication.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {signOut as signOutApiCall} from '@asgardeo/js'; -import {useContext} from 'react'; -import AsgardeoContext from '../contexts/asgardeo-context'; -import AuthContext from '../models/auth-context'; -import UseAuthentication from '../models/use-authentication'; - -/** - * `useAuthentication` is a custom hook that provides access to the authentication context. - * It returns an object containing the current user, the authentication status, the access token, and a sign out function. - * - * @returns {UseAuthentication} An object containing the current user (`user`), the authentication status (`isSignedIn`), - * the access token (`accessToken`), and a sign out function (`signOut`). - */ -const useAuthentication = (): UseAuthentication => { - const contextValue: AuthContext = useContext(AsgardeoContext); - - const {accessToken, authResponse, isSignedIn, isGlobalLoading, setUsername, user, username} = contextValue; - - const signOut: () => void = () => { - signOutApiCall().then(() => { - sessionStorage.clear(); - if (contextValue.onSignOutRef.current) { - contextValue.onSignOutRef.current(); - } - }); - }; - - return { - accessToken, - authResponse, - isSignedIn, - isGlobalLoading, - setUsername, - signOut, - user, - username, - }; -}; - -export default useAuthentication; diff --git a/packages/__legacy__/react/src/hooks/use-config.ts b/packages/__legacy__/react/src/hooks/use-config.ts deleted file mode 100644 index 1611d6a6d..000000000 --- a/packages/__legacy__/react/src/hooks/use-config.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {UIAuthConfig} from '@asgardeo/js'; -import {useContext} from 'react'; -import AsgardeoContext from '../contexts/asgardeo-context'; -import UseConfig from '../models/use-config'; - -/** - * Custom hook to access the authentication configuration from the AsgardeoProviderContext. - * @returns An object containing the authentication configuration. - */ -export const useConfig = (): UseConfig => { - const {config} = useContext(AsgardeoContext) as { - config: UIAuthConfig; - }; - - return {config}; -}; diff --git a/packages/__legacy__/react/src/hooks/use-on.ts b/packages/__legacy__/react/src/hooks/use-on.ts deleted file mode 100644 index 9e259bba8..000000000 --- a/packages/__legacy__/react/src/hooks/use-on.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {AsgardeoUIException} from '@asgardeo/js'; -import {useContext, useEffect} from 'react'; -import AsgardeoContext from '../contexts/asgardeo-context'; -import AuthContext from '../models/auth-context'; -import {Hooks, UseOnProps} from '../models/use-on'; - -const useOn = (props: UseOnProps): void => { - const {callback, event} = props; - - const contextValue: AuthContext = useContext(AsgardeoContext); - - useEffect(() => { - switch (event) { - case Hooks.SignIn: - contextValue.setOnSignIn(callback); - break; - case Hooks.SignOut: - contextValue.setOnSignOut(callback); - break; - default: - throw new AsgardeoUIException('REACT-USE_ON-UO-IV-01', 'Invalid event type provided.'); - } - }, [callback, contextValue, event]); -}; - -export default useOn; diff --git a/packages/__legacy__/react/src/hooks/use-translations.ts b/packages/__legacy__/react/src/hooks/use-translations.ts deleted file mode 100644 index 21f0ccda1..000000000 --- a/packages/__legacy__/react/src/hooks/use-translations.ts +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {useContext, useEffect, useState} from 'react'; -import AsgardeoContext from '../contexts/asgardeo-context'; -import I18nContext from '../contexts/i18n-context'; -import {I18n, SetTranslationsProps} from '../models/i18n'; -import UseTranslations from '../models/use-translations'; - -/** - * `useTranslations` is a custom hook that fetches translations. - * It takes an object of type `SetTranslationsProps` as an argument, which includes the screen type, - * and optional locale and text overrides. - * - * @param {SetTranslationsProps} props - The properties used to fetch the translations. - * @param {ScreenType} props.screen - The screen type for which to fetch translations. - * @param {string} [props.componentLocaleOverride] - Optional locale override. - * @param {BrandingPreferenceTextProps} [props.componentTextOverrides] - Optional text overrides. - * - * @returns {UseTranslations} An object containing the translations (`t`) and a loading state (`isLoading`). - */ -const useTranslations = (props: SetTranslationsProps): UseTranslations => { - const {componentLocaleOverride, componentTextOverrides, screen} = props; - - const [isLoading, setIsLoading] = useState(true); - - const {setIsTextLoading} = useContext(AsgardeoContext); - - const contextValue: I18n = useContext(I18nContext); - const {text, setTranslations} = contextValue; - - useEffect(() => { - setTranslations({componentLocaleOverride, componentTextOverrides, screen}).then((response: boolean) => { - setIsLoading(!response); - setIsTextLoading(!response); - }); - }, [componentLocaleOverride, componentTextOverrides, screen, setIsTextLoading, setTranslations]); - - useEffect(() => { - setIsTextLoading(isLoading); - }, [isLoading, setIsTextLoading]); - - /** - * `t` is a function that retrieves a specific translation from the fetched translations. - * It takes a key as an argument, which is a string that represents a path to the desired translation. - * - * @param {string} key - The key of the translation to retrieve. This is a string that represents - * a path in the translations object, with parts separated by '.'. - * - * @returns {string} The requested translation. - */ - const t = (key: string): string => { - const keySegments: string[] = key.split('.'); - - const screenKey: string = keySegments[0]; - const rightPart: string = keySegments.slice(1).join('.'); - - return text[screenKey][rightPart]; - }; - - return {isLoading, t}; -}; - -export default useTranslations; diff --git a/packages/__legacy__/react/src/index.ts b/packages/__legacy__/react/src/index.ts deleted file mode 100644 index 98f497c95..000000000 --- a/packages/__legacy__/react/src/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export * from './components/public-components'; -export * from './models/public-models'; -export {default as AsgardeoProvider} from './providers/AsgardeoProvider'; -export {default as useAuthentication} from './hooks/use-authentication'; -export {default as useOn} from './hooks/use-on'; diff --git a/packages/__legacy__/react/src/models/asgardeo-provider-props.ts b/packages/__legacy__/react/src/models/asgardeo-provider-props.ts deleted file mode 100644 index 38f0174c7..000000000 --- a/packages/__legacy__/react/src/models/asgardeo-provider-props.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {BrandingProps, Store, UIAuthConfig} from '@asgardeo/js'; - -interface AsgardeoProviderProps { - branding?: BrandingProps; - config: UIAuthConfig; - store?: Store; -} - -export default AsgardeoProviderProps; diff --git a/packages/__legacy__/react/src/models/auth-context.ts b/packages/__legacy__/react/src/models/auth-context.ts deleted file mode 100644 index 4a1e1f932..000000000 --- a/packages/__legacy__/react/src/models/auth-context.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {UIAuthConfig, MeAPIResponse, AuthApiResponse} from '@asgardeo/js'; - -interface AuthContext { - accessToken: string; - authResponse: AuthApiResponse; - config: UIAuthConfig; - isAuthLoading: boolean; - isSignedIn: boolean | undefined; - isBrandingLoading: boolean; - isComponentLoading: boolean; - isGlobalLoading: boolean; - isTextLoading: boolean; - onSignOutRef: React.MutableRefObject; - setAuthResponse: (response: AuthApiResponse) => void; - setAuthentication: () => void; - setIsAuthLoading: (value: boolean) => void; - setIsBrandingLoading: (value: boolean) => void; - setIsComponentLoading: (value: boolean) => void; - setIsTextLoading: (value: boolean) => void; - setOnSignIn: (response?: any) => void | Promise; - setOnSignOut: (response?: any) => void | Promise; - setUsername: (username: string) => void; - user: MeAPIResponse; - username: string; -} - -export default AuthContext; diff --git a/packages/__legacy__/react/src/models/basic-auth-props.ts b/packages/__legacy__/react/src/models/basic-auth-props.ts deleted file mode 100644 index 28f79c8e0..000000000 --- a/packages/__legacy__/react/src/models/basic-auth-props.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Authenticator, BrandingProps} from '@asgardeo/js'; -import {ReactElement} from 'react'; -import {AlertType} from './sign-in'; - -interface BasicAuthProps { - alert?: AlertType; - authenticator: Authenticator; - brandingProps?: BrandingProps; - handleAuthenticate: Function; - renderLoginOptions?: ReactElement[]; - showSelfSignUp: boolean; -} - -export default BasicAuthProps; diff --git a/packages/__legacy__/react/src/models/branding-preference-provider-props.ts b/packages/__legacy__/react/src/models/branding-preference-provider-props.ts deleted file mode 100644 index 621dc38b4..000000000 --- a/packages/__legacy__/react/src/models/branding-preference-provider-props.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {BrandingProps} from '@asgardeo/js'; - -interface BrandingPreferenceProviderProps { - branding?: BrandingProps; -} - -export default BrandingPreferenceProviderProps; diff --git a/packages/__legacy__/react/src/models/email-otp-props.ts b/packages/__legacy__/react/src/models/email-otp-props.ts deleted file mode 100644 index 87a269a7a..000000000 --- a/packages/__legacy__/react/src/models/email-otp-props.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Authenticator, BrandingProps} from '@asgardeo/js'; -import {AlertType} from './sign-in'; - -interface EmailOtpProps { - alert?: AlertType; - authenticator?: Authenticator; - brandingProps?: BrandingProps; - handleAuthenticate: Function; -} - -export default EmailOtpProps; diff --git a/packages/__legacy__/react/src/models/i18n.ts b/packages/__legacy__/react/src/models/i18n.ts deleted file mode 100644 index 4a9c27089..000000000 --- a/packages/__legacy__/react/src/models/i18n.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {BrandingPreferenceTextProps, ScreenType, TextObject} from '@asgardeo/js'; - -export type I18nLocalization = - | { - [key in ScreenType]: TextObject; - } - | {}; - -export interface SetTranslationsProps { - componentLocaleOverride?: string; - componentTextOverrides?: BrandingPreferenceTextProps; - screen?: ScreenType; -} -export interface I18n { - setTranslations: (props: SetTranslationsProps) => Promise; - text: I18nLocalization; -} - -export interface I18nProviderProps { - providerLocaleOverride?: string; - providerTextOverrides?: BrandingPreferenceTextProps; -} diff --git a/packages/__legacy__/react/src/models/jwt-verify-options.ts b/packages/__legacy__/react/src/models/jwt-verify-options.ts deleted file mode 100644 index bb1bc2078..000000000 --- a/packages/__legacy__/react/src/models/jwt-verify-options.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -interface JwtVerifyOptions { - algorithms: string[]; - audience: string; - clockTolerance: number; - issuer: string; - subject: string; -} - -export default JwtVerifyOptions; diff --git a/packages/__legacy__/react/src/models/login-options-box-props.ts b/packages/__legacy__/react/src/models/login-options-box-props.ts deleted file mode 100644 index ff6e4e3a2..000000000 --- a/packages/__legacy__/react/src/models/login-options-box-props.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -interface LoginOptionsBoxProps { - displayName: string; - handleOnClick: () => void; - isAuthLoading: boolean; - socialName: string; -} - -export default LoginOptionsBoxProps; diff --git a/packages/__legacy__/react/src/models/public-models.ts b/packages/__legacy__/react/src/models/public-models.ts deleted file mode 100644 index 31797683a..000000000 --- a/packages/__legacy__/react/src/models/public-models.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export type {UIAuthConfig} from '@asgardeo/js'; -export {Hooks} from './use-on'; diff --git a/packages/__legacy__/react/src/models/sign-in.ts b/packages/__legacy__/react/src/models/sign-in.ts deleted file mode 100644 index fecde462e..000000000 --- a/packages/__legacy__/react/src/models/sign-in.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {BrandingProps} from '@asgardeo/js'; -import {ReactElement} from 'react'; - -export interface SignInProps { - basicAuthChildren?: ReactElement; - brandingProps?: BrandingProps; - emailOtpChildren?: ReactElement; - identifierFirstChildren?: ReactElement; - showFooter?: boolean; - showLogo?: boolean; - showSignUp?: boolean; - smsOtpChildren?: ReactElement; - totpChildren?: ReactElement; -} - -export type AlertType = { - alertType: - | {error?: boolean; info?: never; warning?: never} - | {error?: never; info?: boolean; warning?: never} - | {error?: never; infor?: never; warning?: boolean}; - key: string; -}; - -export interface SignInButtonProps extends SignInProps { - customComponent?: ReactElement; -} diff --git a/packages/__legacy__/react/src/models/signed-props.ts b/packages/__legacy__/react/src/models/signed-props.ts deleted file mode 100644 index acc02059a..000000000 --- a/packages/__legacy__/react/src/models/signed-props.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {ReactElement} from 'react'; - -interface SignedProps { - fallback?: ReactElement; -} - -export default SignedProps; diff --git a/packages/__legacy__/react/src/models/totp-props.ts b/packages/__legacy__/react/src/models/totp-props.ts deleted file mode 100644 index 1a819de84..000000000 --- a/packages/__legacy__/react/src/models/totp-props.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Authenticator, BrandingProps} from '@asgardeo/js'; -import {AlertType} from './sign-in'; - -interface TotpProps { - alert?: AlertType; - authenticator: Authenticator; - brandingProps?: BrandingProps; - handleAuthenticate: Function; -} - -export default TotpProps; diff --git a/packages/__legacy__/react/src/models/use-authentication.ts b/packages/__legacy__/react/src/models/use-authentication.ts deleted file mode 100644 index d48692d88..000000000 --- a/packages/__legacy__/react/src/models/use-authentication.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {AuthApiResponse, MeAPIResponse} from '@asgardeo/js'; - -interface UseAuthentication { - accessToken: string; - authResponse: AuthApiResponse; - isSignedIn: Promise | boolean; - isGlobalLoading: boolean; - setUsername: (username: string) => void; - signOut: () => void; - user: MeAPIResponse; - username: string; -} - -export default UseAuthentication; diff --git a/packages/__legacy__/react/src/models/use-config.ts b/packages/__legacy__/react/src/models/use-config.ts deleted file mode 100644 index 116aa189a..000000000 --- a/packages/__legacy__/react/src/models/use-config.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {UIAuthConfig} from '@asgardeo/js'; - -interface UseConfig { - config: UIAuthConfig; -} - -export default UseConfig; diff --git a/packages/__legacy__/react/src/models/use-on.ts b/packages/__legacy__/react/src/models/use-on.ts deleted file mode 100644 index aee2af97b..000000000 --- a/packages/__legacy__/react/src/models/use-on.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export enum Hooks { - SignIn, - SignOut, -} - -export interface UseOnProps { - /** - * The callback to be executed when the event is triggered. - */ - callback: (response?: any) => void | Promise; - /** - * The event to listen to. - */ - event: Hooks; -} diff --git a/packages/__legacy__/react/src/models/use-translations.ts b/packages/__legacy__/react/src/models/use-translations.ts deleted file mode 100644 index ed53fe5b7..000000000 --- a/packages/__legacy__/react/src/models/use-translations.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -interface UseTranslations { - isLoading: boolean; - t: (key: string) => string; -} - -export default UseTranslations; diff --git a/packages/__legacy__/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx b/packages/__legacy__/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx deleted file mode 100644 index 0eef4fb4d..000000000 --- a/packages/__legacy__/react/src/oxygen-ui-react-auth-components/SignIn/SignIn.tsx +++ /dev/null @@ -1,224 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Box, BoxProps} from '@oxygen-ui/react'; -import clsx from 'clsx'; -import { - ElementType, - ForwardRefExoticComponent, - MutableRefObject, - ReactElement, - forwardRef, - isValidElement, -} from 'react'; -import {WithWrapperProps} from '../models/component'; -import SignInAlert from '../SignInAlert/SignInAlert'; -import SignInButton, {SignInButtonProps} from '../SignInButton/SignInButton'; -import SignInDivider from '../SignInDivider/SignInDivider'; -import SignInFooter from '../SignInFooter/SignInFooter'; -import SignInImage from '../SignInImage/SignInImage'; -import SignInLink, {SignInLinkProps} from '../SignInLink/SignInLink'; -import SignInPaper from '../SignInPaper/SignInPaper'; -import SignInPinInput from '../SignInPinInput/SignInPinInput'; -import SignInTextField, {SignInTextFieldProps} from '../SignInTextField/SignInTextField'; -import SignInTypography, {SignInTypographyProps} from '../SignInTypography/SignInTypography'; -import './sign-in.scss'; - -type Footer = - | ReactElement - | { - copyrights?: { - link?: string; - text: string; - }; - locale?: { - text: string; - }; - privacyPolicy?: { - link?: string; - text: string; - }; - termsOfUse?: { - link?: string; - text: string; - }; - }; - -export type SignInProps = { - component?: C; - footer?: Footer; - links?: SignInLinkProps[]; - loginOptions?: SignInButtonProps[]; - logo?: string; - submitButton?: {text: string} & SignInButtonProps; - subtitle?: {text: string} & SignInTypographyProps; - textFields?: SignInTextFieldProps[]; - title?: {text: string} & SignInTypographyProps; -} & Omit; - -type SignInCompoundProps = { - Alert: typeof SignInAlert; - Button: typeof SignInButton; - Divider: typeof SignInDivider; - Footer: typeof SignInFooter; - Image: typeof SignInImage; - Link: typeof SignInLink; - Paper: typeof SignInPaper; - PinInput: typeof SignInPinInput; - TextField: typeof SignInTextField; - Typography: typeof SignInTypography; -}; - -const COMPONENT_NAME: string = 'SignIn'; - -const SignIn: ForwardRefExoticComponent & WithWrapperProps & SignInCompoundProps = forwardRef( - (props: SignInProps, ref: MutableRefObject): ReactElement => { - const { - children, - className, - title, - subtitle, - textFields = [ - { - label: 'username', - name: 'text', - placeholder: 'Enter your username', - }, - { - label: 'Password', - name: 'password', - placeholder: 'Enter your password', - type: 'password', - }, - ], - links, - loginOptions, - logo, - submitButton, - footer, - ...rest - } = props; - - const classes: string = clsx(`Oxygen${COMPONENT_NAME}`, className); - - /** - * Destructure the title and subtitle props to extract the title and subtitle as both cannot be passed. - */ - const { - children: titleChildren, - text: titleText, - title: titleTitle, - subtitle: titleSubtitle, - ...restTitleProps - } = title ?? {}; - - const { - children: subtitleChildren, - text: subtitleText, - title: subtitleTitle, - subtitle: subtitleSubtitle, - ...restSubtitleProps - } = subtitle ?? {}; - - const {children: submitButtonChildren, text: submitButtonText, ...restSubmitButtonTextProps} = submitButton ?? {}; - - /** - * If SignIn component contains any children render only the outer box. - * Otherwise render the default SignIn component. - */ - if (children) { - return ( - - {children} - - ); - } - - return ( - - {logo && } - - - - {titleChildren ?? titleText ?? 'Sign In'} - - - {subtitle && ( - - {subtitleChildren ?? subtitleText} - - )} - - {textFields.map((textFieldProps: SignInTextFieldProps, index: number) => ( - - ))} - - - {submitButtonChildren ?? submitButtonText ?? 'Sign In'} - - - {links && - links.map((linkProps: SignInLinkProps, index: number) => ( -
- -
-
- ))} - - {loginOptions && ( - <> - OR - {loginOptions.map((loginOptionProps: SignInButtonProps, index: number) => ( - - ))} - - )} -
- - {footer && isValidElement(footer) ? ( - footer - ) : ( - {footer?.copyrights?.text}}} - items={[ - {children: {footer?.termsOfUse?.text}}, - {children: {footer?.privacyPolicy?.text}}, - {children: {footer?.locale?.text}}, - ]} - /> - )} -
- ); - }, -) as ForwardRefExoticComponent & WithWrapperProps & SignInCompoundProps; - -SignIn.displayName = COMPONENT_NAME; -SignIn.muiName = COMPONENT_NAME; - -SignIn.Typography = SignInTypography; -SignIn.Paper = SignInPaper; -SignIn.Alert = SignInAlert; -SignIn.Divider = SignInDivider; -SignIn.Link = SignInLink; -SignIn.Button = SignInButton; -SignIn.TextField = SignInTextField; -SignIn.PinInput = SignInPinInput; -SignIn.Image = SignInImage; -SignIn.Footer = SignInFooter; - -export default SignIn; diff --git a/packages/__legacy__/react/src/oxygen-ui-react-auth-components/SignIn/sign-in.scss b/packages/__legacy__/react/src/oxygen-ui-react-auth-components/SignIn/sign-in.scss deleted file mode 100644 index 609fac01b..000000000 --- a/packages/__legacy__/react/src/oxygen-ui-react-auth-components/SignIn/sign-in.scss +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -.OxygenSignIn { - display: flex; - flex-flow: column nowrap; - align-content: center; - justify-content: center; - align-items: center; - text-align: left; - padding: 20px; - max-width: fit-content; -} diff --git a/packages/__legacy__/react/src/oxygen-ui-react-auth-components/SignInAlert/SignInAlert.tsx b/packages/__legacy__/react/src/oxygen-ui-react-auth-components/SignInAlert/SignInAlert.tsx deleted file mode 100644 index 0cef75cd4..000000000 --- a/packages/__legacy__/react/src/oxygen-ui-react-auth-components/SignInAlert/SignInAlert.tsx +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Alert} from '@oxygen-ui/react'; -import clsx from 'clsx'; -import {ElementType, ForwardRefExoticComponent, MutableRefObject, ReactElement, forwardRef} from 'react'; -import {WithWrapperProps} from '../models/component'; -import './sign-in-alert.scss'; - -// TODO: AlertProps is not available in oxygen-ui/react -export type SignInAlertProps = { - component?: C; -} & ( - | {error?: boolean; info?: never; warning?: never} - | {error?: never; info?: boolean; warning?: never} - | {error?: never; info?: never; warning?: boolean} -); - -const COMPONENT_NAME: string = 'SignInAlert'; - -enum Color { - Error = 'error', - Info = 'info', - Warning = 'warning', -} - -const SignInAlert: ForwardRefExoticComponent & WithWrapperProps = forwardRef( - (props: SignInAlertProps, ref: MutableRefObject): ReactElement => { - const {className, error, info, warning, color, icon, ...rest} = props; - - const classes: string = clsx(`Oxygen${COMPONENT_NAME}`, className); - - let extendedColor: string = color; - if (!color) { - if (error) { - extendedColor = Color.Error; - } else if (warning) { - extendedColor = Color.Warning; - } else { - extendedColor = Color.Info; - } - } - - const extendedIcon: Node | boolean = icon || false; - - return ; - }, -) as ForwardRefExoticComponent & WithWrapperProps; - -SignInAlert.displayName = COMPONENT_NAME; -SignInAlert.muiName = COMPONENT_NAME; - -export default SignInAlert; diff --git a/packages/__legacy__/react/src/oxygen-ui-react-auth-components/SignInAlert/sign-in-alert.scss b/packages/__legacy__/react/src/oxygen-ui-react-auth-components/SignInAlert/sign-in-alert.scss deleted file mode 100644 index 10154369f..000000000 --- a/packages/__legacy__/react/src/oxygen-ui-react-auth-components/SignInAlert/sign-in-alert.scss +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -.OxygenSignInAlert { - border-radius: 12px; -} diff --git a/packages/__legacy__/react/src/oxygen-ui-react-auth-components/SignInButton/SignInButton.tsx b/packages/__legacy__/react/src/oxygen-ui-react-auth-components/SignInButton/SignInButton.tsx deleted file mode 100644 index 51a8fb983..000000000 --- a/packages/__legacy__/react/src/oxygen-ui-react-auth-components/SignInButton/SignInButton.tsx +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import {Button, ButtonProps} from '@oxygen-ui/react'; -import clsx from 'clsx'; -import {ElementType, ForwardRefExoticComponent, MutableRefObject, ReactElement, forwardRef} from 'react'; -import {WithWrapperProps} from '../models/component'; -import './sign-in-button.scss'; - -export type SignInButtonProps = { - component?: C; - social?: boolean; -} & Omit; - -const COMPONENT_NAME: string = 'SignInButton'; - -const SignInButton: ForwardRefExoticComponent & WithWrapperProps = forwardRef( - (props: SignInButtonProps, ref: MutableRefObject): ReactElement => { - const {className, variant, social, ...rest} = props; - - let classes: string = clsx(`Oxygen${COMPONENT_NAME}`, className); - if (social) { - classes = clsx(classes, `Oxygen${COMPONENT_NAME}-social`); - } - - return