From 51dc96a447d053a0840351c01e8528cabfc9581e Mon Sep 17 00:00:00 2001 From: Brion Date: Sun, 28 Sep 2025 12:49:49 +0530 Subject: [PATCH 01/16] chore: add entry for experimental samples directory --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 9b89913dd..6e06d3ee7 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,7 @@ Thumbs.db .env* .cursor/rules/nx-rules.mdc .github/instructions/nx.instructions.md + +# Experimental Samples +# NOTE to Developers: Please use this samples folder for experimental code only and do not commit. +samples/__experimental__/ From e92295969af0daa358f092be718e4dd505da42d6 Mon Sep 17 00:00:00 2001 From: Brion Date: Mon, 29 Sep 2025 00:07:47 +0530 Subject: [PATCH 02/16] feat(i18n): add initial internationalization package with translations and configuration files --- packages/i18n/.editorconfig | 1 + packages/i18n/.eslintignore | 4 + packages/i18n/.eslintrc.cjs | 38 +++++ packages/i18n/.gitignore | 130 ++++++++++++++++++ packages/i18n/.prettierignore | 4 + packages/i18n/esbuild.config.mjs | 44 ++++++ packages/i18n/package.json | 60 ++++++++ packages/i18n/prettier.config.cjs | 19 +++ packages/i18n/src/index.ts | 26 ++++ .../{javascript => i18n}/src/models/i18n.ts | 0 .../i18n => i18n/src/translations}/en-US.ts | 0 .../i18n => i18n/src/translations}/index.ts | 0 .../src/utils/getI18nBundles.ts | 2 +- packages/i18n/tsconfig.eslint.json | 11 ++ packages/i18n/tsconfig.json | 34 +++++ packages/i18n/tsconfig.lib.json | 20 +++ packages/i18n/tsconfig.spec.json | 17 +++ packages/i18n/vitest.config.ts | 25 ++++ packages/javascript/package.json | 1 + packages/javascript/src/index.ts | 3 - packages/javascript/src/models/config.ts | 2 +- packages/react/package.json | 1 + .../react/src/contexts/I18n/I18nContext.ts | 10 +- .../react/src/contexts/I18n/I18nProvider.tsx | 4 +- packages/react/src/hooks/useTranslation.ts | 3 +- pnpm-lock.yaml | 54 +++++++- 26 files changed, 493 insertions(+), 20 deletions(-) create mode 100644 packages/i18n/.editorconfig create mode 100644 packages/i18n/.eslintignore create mode 100644 packages/i18n/.eslintrc.cjs create mode 100644 packages/i18n/.gitignore create mode 100644 packages/i18n/.prettierignore create mode 100644 packages/i18n/esbuild.config.mjs create mode 100644 packages/i18n/package.json create mode 100644 packages/i18n/prettier.config.cjs create mode 100644 packages/i18n/src/index.ts rename packages/{javascript => i18n}/src/models/i18n.ts (100%) rename packages/{javascript/src/i18n => i18n/src/translations}/en-US.ts (100%) rename packages/{javascript/src/i18n => i18n/src/translations}/index.ts (100%) rename packages/{javascript => i18n}/src/utils/getI18nBundles.ts (96%) create mode 100644 packages/i18n/tsconfig.eslint.json create mode 100644 packages/i18n/tsconfig.json create mode 100644 packages/i18n/tsconfig.lib.json create mode 100644 packages/i18n/tsconfig.spec.json create mode 100644 packages/i18n/vitest.config.ts diff --git a/packages/i18n/.editorconfig b/packages/i18n/.editorconfig new file mode 100644 index 000000000..1b3ce07de --- /dev/null +++ b/packages/i18n/.editorconfig @@ -0,0 +1 @@ +../../.editorconfig \ No newline at end of file diff --git a/packages/i18n/.eslintignore b/packages/i18n/.eslintignore new file mode 100644 index 000000000..177586b6b --- /dev/null +++ b/packages/i18n/.eslintignore @@ -0,0 +1,4 @@ +/dist +/build +/node_modules +/coverage \ No newline at end of file diff --git a/packages/i18n/.eslintrc.cjs b/packages/i18n/.eslintrc.cjs new file mode 100644 index 000000000..2676ca816 --- /dev/null +++ b/packages/i18n/.eslintrc.cjs @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2025, 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 = { + env: { + es6: true, + node: true, + }, + extends: [ + 'plugin:@wso2/typescript', + 'plugin:@wso2/strict', + 'plugin:@wso2/internal', + 'plugin:@wso2/jest', + 'plugin:@wso2/prettier', + ], + parserOptions: { + ecmaVersion: 2018, + project: [path.resolve(__dirname, 'tsconfig.eslint.json')], + }, + plugins: ['@wso2'], +}; diff --git a/packages/i18n/.gitignore b/packages/i18n/.gitignore new file mode 100644 index 000000000..c6bba5913 --- /dev/null +++ b/packages/i18n/.gitignore @@ -0,0 +1,130 @@ +# 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.* diff --git a/packages/i18n/.prettierignore b/packages/i18n/.prettierignore new file mode 100644 index 000000000..99b0b518a --- /dev/null +++ b/packages/i18n/.prettierignore @@ -0,0 +1,4 @@ +/dist +/build +/node_modules +/coverage diff --git a/packages/i18n/esbuild.config.mjs b/packages/i18n/esbuild.config.mjs new file mode 100644 index 000000000..75bd11607 --- /dev/null +++ b/packages/i18n/esbuild.config.mjs @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2025, 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 {readFileSync} from 'fs'; +import * as esbuild from 'esbuild'; + +const pkg = JSON.parse(readFileSync('./package.json', 'utf8')); + +const commonOptions = { + bundle: true, + entryPoints: ['src/index.ts'], + external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})], + platform: 'node', + target: ['es2020'], +}; + +await esbuild.build({ + ...commonOptions, + format: 'esm', + outfile: 'dist/index.js', + sourcemap: true, +}); + +await esbuild.build({ + ...commonOptions, + format: 'cjs', + outfile: 'dist/cjs/index.js', + sourcemap: true, +}); diff --git a/packages/i18n/package.json b/packages/i18n/package.json new file mode 100644 index 000000000..f5e7806f0 --- /dev/null +++ b/packages/i18n/package.json @@ -0,0 +1,60 @@ +{ + "name": "@asgardeo/i18n", + "version": "0.0.0", + "description": "Internationalization (i18n) package for Asgardeo JavaScript SDKs.", + "keywords": [ + "asgardeo", + "i18n", + "internationalization", + "localization" + ], + "homepage": "https://github.com/asgardeo/javascript/tree/main/packages/i18n#readme", + "bugs": { + "url": "https://github.com/asgardeo/javascript/issues" + }, + "author": "WSO2", + "license": "Apache-2.0", + "type": "module", + "main": "dist/cjs/index.js", + "module": "dist/index.js", + "exports": { + "import": "./dist/index.js", + "require": "./dist/cjs/index.js" + }, + "files": [ + "dist", + "README.md", + "LICENSE" + ], + "types": "dist/index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/asgardeo/javascript", + "directory": "packages/i18n" + }, + "scripts": { + "build": "pnpm clean && node esbuild.config.mjs && tsc -p tsconfig.lib.json --emitDeclarationOnly --outDir dist", + "clean": "rimraf dist", + "fix:lint": "eslint . --ext .js,.jsx,.ts,.tsx,.cjs,.mjs", + "lint": "eslint . --ext .js,.jsx,.ts,.tsx,.cjs,.mjs", + "test": "vitest", + "typecheck": "tsc -p tsconfig.lib.json" + }, + "devDependencies": { + "@types/node": "^22.15.30", + "@wso2/eslint-plugin": "catalog:", + "@wso2/prettier-config": "catalog:", + "esbuild": "^0.25.9", + "eslint": "8.57.0", + "prettier": "^2.6.2", + "rimraf": "^6.0.1", + "typescript": "~5.7.2", + "vitest": "^3.1.3" + }, + "dependencies": { + "tslib": "^2.8.1" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/i18n/prettier.config.cjs b/packages/i18n/prettier.config.cjs new file mode 100644 index 000000000..929b9b15f --- /dev/null +++ b/packages/i18n/prettier.config.cjs @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2025, 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/i18n/src/index.ts b/packages/i18n/src/index.ts new file mode 100644 index 000000000..b6ab947a5 --- /dev/null +++ b/packages/i18n/src/index.ts @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2025, 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. + */ + +// Models +export type {I18nBundle, I18nTranslations, I18nMetadata, I18nTextDirection} from './models/i18n'; + +// Translations +export * from './translations'; + +// Utils +export {default as getI18nBundles} from './utils/getI18nBundles'; diff --git a/packages/javascript/src/models/i18n.ts b/packages/i18n/src/models/i18n.ts similarity index 100% rename from packages/javascript/src/models/i18n.ts rename to packages/i18n/src/models/i18n.ts diff --git a/packages/javascript/src/i18n/en-US.ts b/packages/i18n/src/translations/en-US.ts similarity index 100% rename from packages/javascript/src/i18n/en-US.ts rename to packages/i18n/src/translations/en-US.ts diff --git a/packages/javascript/src/i18n/index.ts b/packages/i18n/src/translations/index.ts similarity index 100% rename from packages/javascript/src/i18n/index.ts rename to packages/i18n/src/translations/index.ts diff --git a/packages/javascript/src/utils/getI18nBundles.ts b/packages/i18n/src/utils/getI18nBundles.ts similarity index 96% rename from packages/javascript/src/utils/getI18nBundles.ts rename to packages/i18n/src/utils/getI18nBundles.ts index 009c92bff..d20119806 100644 --- a/packages/javascript/src/utils/getI18nBundles.ts +++ b/packages/i18n/src/utils/getI18nBundles.ts @@ -17,7 +17,7 @@ */ import {I18nBundle, I18nTranslations} from '../models/i18n'; -import * as i18n from '../i18n'; +import * as i18n from '../translations'; /** * Get internationalization bundles for the specified locale. diff --git a/packages/i18n/tsconfig.eslint.json b/packages/i18n/tsconfig.eslint.json new file mode 100644 index 000000000..23fadc266 --- /dev/null +++ b/packages/i18n/tsconfig.eslint.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "include": [ + "**/.*.js", + "**/.*.cjs", + "**/.*.ts", + "**/*.js", + "**/*.cjs", + "**/*.ts", + ] +} diff --git a/packages/i18n/tsconfig.json b/packages/i18n/tsconfig.json new file mode 100644 index 000000000..56fc2075c --- /dev/null +++ b/packages/i18n/tsconfig.json @@ -0,0 +1,34 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "declaration": false, + "emitDecoratorMetadata": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "importHelpers": true, + "lib": ["ESNext", "DOM"], + "module": "ESNext", + "moduleResolution": "node", + "skipLibCheck": true, + "skipDefaultLibCheck": true, + "sourceMap": true, + "target": "ESNext", + "forceConsistentCasingInFileNames": true, + "strict": false, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "exclude": ["node_modules", "tmp", "dist"], + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/packages/i18n/tsconfig.lib.json b/packages/i18n/tsconfig.lib.json new file mode 100644 index 000000000..b2c9c1aef --- /dev/null +++ b/packages/i18n/tsconfig.lib.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true, + "outDir": "dist", + "declarationDir": "dist", + "types": ["node"] + }, + "exclude": [ + "**/*.spec.ts", + "**/*.test.ts", + "**/*.spec.tsx", + "**/*.test.tsx", + "**/*.spec.js", + "**/*.test.js", + "**/*.spec.jsx", + "**/*.test.jsx" + ], + "include": ["src/**/*.js", "src/**/*.ts", "types/**/*.d.ts"] +} diff --git a/packages/i18n/tsconfig.spec.json b/packages/i18n/tsconfig.spec.json new file mode 100644 index 000000000..3f9daf174 --- /dev/null +++ b/packages/i18n/tsconfig.spec.json @@ -0,0 +1,17 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "dist", + "module": "commonjs", + "types": ["vitest/globals"] + }, + "include": [ + "test-configs", + "vitest.config.ts", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.js", + "**/*.spec.js", + "**/*.d.ts" + ] +} diff --git a/packages/i18n/vitest.config.ts b/packages/i18n/vitest.config.ts new file mode 100644 index 000000000..dbdd537b3 --- /dev/null +++ b/packages/i18n/vitest.config.ts @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2025, 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 {defineConfig} from 'vitest/config'; + +export default defineConfig({ + test: { + globals: true, + }, +}); diff --git a/packages/javascript/package.json b/packages/javascript/package.json index df172bd87..7b666ba86 100644 --- a/packages/javascript/package.json +++ b/packages/javascript/package.json @@ -53,6 +53,7 @@ "vitest": "^3.1.3" }, "dependencies": { + "@asgardeo/i18n": "workspace:^", "tslib": "^2.8.1" }, "publishConfig": { diff --git a/packages/javascript/src/index.ts b/packages/javascript/src/index.ts index 0672d647e..bbed3bc6b 100644 --- a/packages/javascript/src/index.ts +++ b/packages/javascript/src/index.ts @@ -1,4 +1,3 @@ -import { Platform } from './models/platforms'; /** * Copyright (c) 2020, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. * @@ -124,7 +123,6 @@ export { export {Schema, SchemaAttribute, WellKnownSchemaIds, FlattenedSchema} from './models/scim2-schema'; export {RecursivePartial} from './models/utility-types'; export {FieldType} from './models/field'; -export {I18nBundle, I18nTranslations, I18nMetadata} from './models/i18n'; export {default as AsgardeoJavaScriptClient} from './AsgardeoJavaScriptClient'; @@ -144,7 +142,6 @@ export {default as generateUserProfile} from './utils/generateUserProfile'; export {default as getLatestStateParam} from './utils/getLatestStateParam'; export {default as generateFlattenedUserProfile} from './utils/generateFlattenedUserProfile'; export {default as getRedirectBasedSignUpUrl} from './utils/getRedirectBasedSignUpUrl'; -export {default as getI18nBundles} from './utils/getI18nBundles'; export {default as identifyPlatform} from './utils/identifyPlatform'; export {default as isEmpty} from './utils/isEmpty'; export {default as set} from './utils/set'; diff --git a/packages/javascript/src/models/config.ts b/packages/javascript/src/models/config.ts index 06ec2cea0..57f3c0842 100644 --- a/packages/javascript/src/models/config.ts +++ b/packages/javascript/src/models/config.ts @@ -16,7 +16,7 @@ * under the License. */ -import {I18nBundle} from './i18n'; +import {I18nBundle} from '@asgardeo/i18n'; import {RecursivePartial} from './utility-types'; import {ThemeConfig, ThemeMode} from '../theme/types'; diff --git a/packages/react/package.json b/packages/react/package.json index 400356759..bd6f911e7 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -62,6 +62,7 @@ "react": ">=16.8.0" }, "dependencies": { + "@asgardeo/i18n": "workspace:^", "@asgardeo/browser": "workspace:^", "@emotion/css": "^11.13.5", "@floating-ui/react": "^0.27.12", diff --git a/packages/react/src/contexts/I18n/I18nContext.ts b/packages/react/src/contexts/I18n/I18nContext.ts index af8229a4e..d72484e17 100644 --- a/packages/react/src/contexts/I18n/I18nContext.ts +++ b/packages/react/src/contexts/I18n/I18nContext.ts @@ -17,29 +17,29 @@ */ import {createContext} from 'react'; -import {I18nBundle} from '@asgardeo/browser'; +import {I18nBundle} from '@asgardeo/i18n'; export interface I18nContextValue { /** * The current language code (e.g., 'en-US', 'fr-FR') */ currentLanguage: string; - + /** * The fallback language code */ fallbackLanguage: string; - + /** * All available i18n bundles (default + user provided) */ bundles: Record; - + /** * Function to change the current language */ setLanguage: (language: string) => void; - + /** * Function to get a translation by key with optional parameters */ diff --git a/packages/react/src/contexts/I18n/I18nProvider.tsx b/packages/react/src/contexts/I18n/I18nProvider.tsx index c249a861b..bc08239f9 100644 --- a/packages/react/src/contexts/I18n/I18nProvider.tsx +++ b/packages/react/src/contexts/I18n/I18nProvider.tsx @@ -17,8 +17,8 @@ */ import {FC, PropsWithChildren, ReactElement, useCallback, useEffect, useMemo, useState} from 'react'; -import {I18nBundle, I18nPreferences, deepMerge} from '@asgardeo/browser'; -import {getI18nBundles} from '@asgardeo/browser'; +import {I18nBundle, getI18nBundles} from '@asgardeo/i18n'; +import {deepMerge, I18nPreferences} from '@asgardeo/browser'; import I18nContext, {I18nContextValue} from './I18nContext'; const I18N_LANGUAGE_STORAGE_KEY = 'asgardeo-i18n-language'; diff --git a/packages/react/src/hooks/useTranslation.ts b/packages/react/src/hooks/useTranslation.ts index 981dbe2f8..f265c14f1 100644 --- a/packages/react/src/hooks/useTranslation.ts +++ b/packages/react/src/hooks/useTranslation.ts @@ -17,7 +17,8 @@ */ import {useContext, useMemo} from 'react'; -import {deepMerge, I18nBundle, I18nPreferences} from '@asgardeo/browser'; +import {I18nBundle} from '@asgardeo/i18n'; +import {deepMerge, I18nPreferences} from '@asgardeo/browser'; import I18nContext, {I18nContextValue} from '../contexts/I18n/I18nContext'; export interface UseTranslation { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8f1ef80d3..e4cb00895 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -170,8 +170,45 @@ importers: specifier: ^3.1.3 version: 3.1.3(@types/node@22.15.30)(@vitest/browser@3.1.3)(jiti@2.6.0)(jsdom@26.1.0)(lightningcss@1.30.1)(sass-embedded@1.92.1)(sass@1.92.1)(terser@5.39.2)(yaml@2.8.0) + packages/i18n: + dependencies: + tslib: + specifier: ^2.8.1 + version: 2.8.1 + devDependencies: + '@types/node': + specifier: ^22.15.30 + version: 22.15.30 + '@wso2/eslint-plugin': + specifier: 'catalog:' + version: https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?a1fc6eb570653c999828aea9f5027cba06af4391(eslint@8.57.0)(typescript@5.7.3) + '@wso2/prettier-config': + specifier: 'catalog:' + version: https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?a1fc6eb570653c999828aea9f5027cba06af4391(prettier@2.8.8)(typescript@5.7.3) + esbuild: + specifier: ^0.25.9 + version: 0.25.10 + eslint: + specifier: 8.57.0 + version: 8.57.0 + prettier: + specifier: ^2.6.2 + version: 2.8.8 + rimraf: + specifier: ^6.0.1 + version: 6.0.1 + typescript: + specifier: ~5.7.2 + version: 5.7.3 + vitest: + specifier: ^3.1.3 + version: 3.1.3(@types/node@22.15.30)(@vitest/browser@3.1.3)(jiti@2.6.0)(jsdom@26.1.0)(lightningcss@1.30.1)(sass-embedded@1.92.1)(sass@1.92.1)(terser@5.39.2)(yaml@2.8.0) + packages/javascript: dependencies: + '@asgardeo/i18n': + specifier: workspace:^ + version: link:../i18n tslib: specifier: ^2.8.1 version: 2.8.1 @@ -322,6 +359,9 @@ importers: '@asgardeo/browser': specifier: workspace:^ version: link:../browser + '@asgardeo/i18n': + specifier: workspace:^ + version: link:../i18n '@emotion/css': specifier: ^11.13.5 version: 11.13.5 @@ -8380,7 +8420,7 @@ snapshots: '@typescript-eslint/visitor-keys@8.33.1': dependencies: '@typescript-eslint/types': 8.33.1 - eslint-visitor-keys: 4.2.0 + eslint-visitor-keys: 4.2.1 '@ungap/structured-clone@1.3.0': {} @@ -10094,7 +10134,7 @@ snapshots: eslint@8.57.0: dependencies: - '@eslint-community/eslint-utils': 4.7.0(eslint@8.57.0) + '@eslint-community/eslint-utils': 4.8.0(eslint@8.57.0) '@eslint-community/regexpp': 4.12.1 '@eslint/eslintrc': 2.1.4 '@eslint/js': 8.57.0 @@ -10191,8 +10231,8 @@ snapshots: espree@9.6.1: dependencies: - acorn: 8.14.1 - acorn-jsx: 5.3.2(acorn@8.14.1) + acorn: 8.15.0 + acorn-jsx: 5.3.2(acorn@8.15.0) eslint-visitor-keys: 3.4.3 esprima@4.0.1: {} @@ -13074,7 +13114,7 @@ snapshots: vite@6.3.5(@types/node@20.17.50)(jiti@2.6.0)(lightningcss@1.30.1)(sass-embedded@1.92.1)(sass@1.89.0)(terser@5.39.2)(yaml@2.8.0): dependencies: - esbuild: 0.25.9 + esbuild: 0.25.10 fdir: 6.4.4(picomatch@4.0.2) picomatch: 4.0.2 postcss: 8.5.6 @@ -13092,7 +13132,7 @@ snapshots: vite@6.3.5(@types/node@22.15.30)(jiti@2.6.0)(lightningcss@1.30.1)(sass-embedded@1.92.1)(sass@1.92.1)(terser@5.39.2)(yaml@2.8.0): dependencies: - esbuild: 0.25.9 + esbuild: 0.25.10 fdir: 6.4.4(picomatch@4.0.2) picomatch: 4.0.2 postcss: 8.5.6 @@ -13110,7 +13150,7 @@ snapshots: vite@6.3.5(@types/node@24.0.3)(jiti@2.6.0)(lightningcss@1.30.1)(sass-embedded@1.92.1)(sass@1.92.1)(terser@5.39.2)(yaml@2.8.0): dependencies: - esbuild: 0.25.9 + esbuild: 0.25.10 fdir: 6.4.4(picomatch@4.0.2) picomatch: 4.0.2 postcss: 8.5.6 From 51d2bd0b26f48401678d5d06478140e1626b4d06 Mon Sep 17 00:00:00 2001 From: Brion Date: Mon, 29 Sep 2025 00:13:58 +0530 Subject: [PATCH 03/16] chore: update issue templates to include '@asgardeo/i18n' and improve version description --- .github/ISSUE_TEMPLATE/bug.yml | 6 ++++-- .github/ISSUE_TEMPLATE/improvement.yml | 4 +++- .github/ISSUE_TEMPLATE/new_feature.yml | 4 +++- .github/issue_template.md | 18 ------------------ .github/pull_request_template.md | 11 ++++------- 5 files changed, 14 insertions(+), 29 deletions(-) delete mode 100644 .github/issue_template.md diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 5603f21b3..3948ce6d9 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -18,7 +18,7 @@ body: - type: dropdown id: area attributes: - label: Please select the package issue is related to + label: Please select the area the issue is related to options: - '@asgardeo/browser' - '@asgardeo/express' @@ -29,7 +29,9 @@ body: - '@asgardeo/react' - '@asgardeo/react-router' - '@asgardeo/vue' + - '@asgardeo/i18n' - 'samples' + - 'other' default: 1 multiple: true validations: @@ -38,7 +40,7 @@ body: id: version attributes: label: Version - description: Enter package version or commit hash. + description: Enter package version or commit hash. (Use `N/A` if not applicable) validations: required: true - type: textarea diff --git a/.github/ISSUE_TEMPLATE/improvement.yml b/.github/ISSUE_TEMPLATE/improvement.yml index 2c8fa101f..301b56d4f 100644 --- a/.github/ISSUE_TEMPLATE/improvement.yml +++ b/.github/ISSUE_TEMPLATE/improvement.yml @@ -30,7 +30,9 @@ body: - '@asgardeo/react' - '@asgardeo/react-router' - '@asgardeo/vue' + - '@asgardeo/i18n' - 'samples' + - 'other' default: 1 multiple: true validations: @@ -39,7 +41,7 @@ body: id: version attributes: label: Version - description: Enter package version or commit hash. + description: Enter package version or commit hash. (Use `N/A` if not applicable) validations: required: true - type: checkboxes diff --git a/.github/ISSUE_TEMPLATE/new_feature.yml b/.github/ISSUE_TEMPLATE/new_feature.yml index bdef20147..4b74bc261 100644 --- a/.github/ISSUE_TEMPLATE/new_feature.yml +++ b/.github/ISSUE_TEMPLATE/new_feature.yml @@ -37,7 +37,9 @@ body: - '@asgardeo/react' - '@asgardeo/react-router' - '@asgardeo/vue' + - '@asgardeo/i18n' - 'samples' + - 'other' default: 1 multiple: true validations: @@ -46,7 +48,7 @@ body: id: version attributes: label: Version - description: Enter package version or commit hash. + description: Enter package version or commit hash. (Use `N/A` if not applicable) validations: required: true - type: checkboxes diff --git a/.github/issue_template.md b/.github/issue_template.md deleted file mode 100644 index 757e13efe..000000000 --- a/.github/issue_template.md +++ /dev/null @@ -1,18 +0,0 @@ -**Description:** - - -**Suggested Labels:** - - -**Suggested Assignees:** - - -**Affected Product Version:** - -**OS, DB, other environment details and versions:** - -**Steps to reproduce:** - - -**Related Issues:** - \ No newline at end of file diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7d7404b73..8c083c589 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -2,20 +2,17 @@ ### Related Issues -- +- N/A ### Related PRs -- +- N/A ### Checklist -- [ ] e2e cypress tests locally verified. +- [ ] Followed the [CONTRIBUTING](https://github.com/asgardeo/javascript/blob/main/CONTRIBUTING.md) guidelines. - [ ] Manual test round performed and verified. -- [ ] UX/UI review done on the final implementation. - [ ] Documentation provided. (Add links if there are any) - [ ] Unit tests provided. (Add links if there are any) -- [ ] Integration tests provided. (Add links if there are any) ### Security checks - [ ] Followed secure coding standards in http://wso2.com/technical-reports/wso2-secure-engineering-guidelines? -- [ ] Ran FindSecurityBugs plugin and verified report? -- [ ] Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? \ No newline at end of file +- [ ] Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? From 8e318fa06e317d2faa538d8df7075625ba3e8ace Mon Sep 17 00:00:00 2001 From: Brion Date: Mon, 29 Sep 2025 00:31:02 +0530 Subject: [PATCH 04/16] docs: update contributing guide to reflect Asgardeo JavaScript SDKs --- CONTRIBUTING.md | 208 ++++++++++++++---------------------------------- 1 file changed, 59 insertions(+), 149 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4e3845960..8c7ce329e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,9 @@ -# Contributing to Asgardeo Web UI SDKs +# Contributing to Asgardeo JavaScript SDKs -This guide walks you through setting up the development environment and other important information for contributing to Asgardeo Web UI SDKs. +This guide walks you through setting up the development environment and other important information for contributing to Asgardeo JavaScript SDKs. ## Table of Contents + - [Prerequisite Software](#prerequisite-software) - [Development Tools](#development-tools) - [NX Console](#nx-console) @@ -26,44 +27,18 @@ This guide walks you through setting up the development environment and other im To build and write code, make sure you have the following set of tools on your local environment: -* [Git](https://git-scm.com/downloads) - Open source distributed version control system. For install instructions, refer [this](https://www.atlassian.com/git/tutorials/install-git). -* [Node.js](https://nodejs.org/en/download/) - JavaScript runtime. (`v18 or higher`) -* [pnpm](https://pnpm.io/) - Alternate npm client for faster package installs. (`v9 or higher`) +- [Git](https://git-scm.com/downloads) - Open source distributed version control system. For install instructions, refer [this](https://www.atlassian.com/git/tutorials/install-git). +- [Node.js](https://nodejs.org/en/download/) - JavaScript runtime. (`v18 or higher`) +- [pnpm](https://pnpm.io/) - Alternate npm client for faster package installs. (`v9 or higher`) ## Development Tools -### NX Console - -Editor plugin which wraps NX commands so you don't have to memorize. - -- [Install for VS Code](https://marketplace.visualstudio.com/items?itemName=nrwl.angular-console) -- [Install for VS Web Storm](https://plugins.jetbrains.com/plugin/15000-nx-webstorm) - -### React Developer Tools - -Browser extension to debug React code. - -- [Download for Chrome](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en) -- [Download for Firefox](https://addons.mozilla.org/en-US/firefox/addon/react-devtools/) - -### ESLint Plugin - -Static code analysis tool for identifying problematic patterns found in JavaScript/Typescript code. - -- [Install for VS Code](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) -- [Install for VS Web Storm](https://www.jetbrains.com/help/webstorm/eslint.html) - -### Code Spell Checker - -A basic spell checker that works well with code and documents. - -- [Install for VS Code](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) - -### JSON Sort Order - -Sorts JSON objects in alphabetical order. - -- [Install for VS Code](https://marketplace.visualstudio.com/items?itemName=msyesyan.json-sorter) +| Extension | Description | VS Code Marketplace | +|-----------|-------------|---------------------| +| NX Console | Editor plugin which wraps NX commands so you don't have to memorize. | [Install](https://marketplace.visualstudio.com/items?itemName=nrwl.angular-console) | +| ESLint | Static code analysis tool for identifying problematic patterns found in JavaScript/Typescript code. | [Install](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) | +| Code Spell Checker | A basic spell checker that works well with code and documents. | [Install](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) | +| JSON Sort Order | Sorts JSON objects in alphabetical order. | [Install](https://marketplace.visualstudio.com/items?itemName=msyesyan.json-sorter) | ## Setting up the Source Code @@ -98,151 +73,86 @@ pnpm build ## Contributing to the Documentation -We use [Vitepress](https://vitepress.dev/) to generate the documentation site. The documentation site is located in the `docs` directory. -To contribute to the documentation, you can follow the steps below to start the Vitepress server locally. +The documentation for Asgardeo JavaScript SDKs is maintained in the Asgardeo / WSO2 Identity Server Official Docs site. -1. Navigate to the `docs` directory. +- [Asgardeo Docs](https://wso2.com/asgardeo/docs) +- [WSO2 Identity Server Docs](https://is.docs.wso2.com/en/latest/) -```bash -cd docs -``` - -2. Start the Vitepress server. - -```bash -pnpm docs:dev -``` +To contribute to the documentation, please send a pull request to the [Asgardeo Docs repository](https://github.com/wso2/docs-is). ## Commit Message Guidelines -*This specification is inspired by and supersedes the [AngularJS commit message format][commit-message-format].* - -We have very precise rules over how our Git commit messages must be formatted. -This format leads to **easier to read commit history**. - -Each commit message consists of a **header**, a **body**, and a **footer**. - -``` -
- - - -