From e781303f61e7ba2233704739826ee7c54600f0e1 Mon Sep 17 00:00:00 2001 From: Justin Lowery Date: Mon, 3 Apr 2023 11:25:51 -0500 Subject: [PATCH 1/2] refactor(journey-types): removes full step from error object; move types to dedicated file --- .svelte-kit/tsconfig.json | 119 ++++++++++---------------- package.json | 18 ++-- package/CHANGELOG.md | 11 +-- package/index.js | 6 +- rollup.types.config.js | 4 +- src/lib/journey/journey.interfaces.ts | 2 +- src/lib/journey/journey.store.ts | 6 +- src/lib/widget/index.svelte | 5 -- src/lib/widget/types.ts | 46 ++++++++++ 9 files changed, 110 insertions(+), 107 deletions(-) create mode 100644 src/lib/widget/types.ts diff --git a/.svelte-kit/tsconfig.json b/.svelte-kit/tsconfig.json index a1300b55..3168bc4d 100644 --- a/.svelte-kit/tsconfig.json +++ b/.svelte-kit/tsconfig.json @@ -1,76 +1,45 @@ { - "compilerOptions": { - "baseUrl": "..", - "paths": { - "$components": [ - "src/lib/components" - ], - "$components/*": [ - "src/lib/components/*" - ], - "$journey": [ - "src/lib/journey" - ], - "$journey/*": [ - "src/lib/journey/*" - ], - "$lib": [ - "src/lib" - ], - "$lib/*": [ - "src/lib/*" - ], - "$locales": [ - "src/locales" - ], - "$locales/*": [ - "src/locales/*" - ], - "$package": [ - "package" - ], - "$package/*": [ - "package/*" - ], - "$widget": [ - "src/widget" - ], - "$widget/*": [ - "src/widget/*" - ] - }, - "rootDirs": [ - "..", - "./types" - ], - "importsNotUsedAsValues": "error", - "isolatedModules": true, - "preserveValueImports": true, - "lib": [ - "esnext", - "DOM", - "DOM.Iterable" - ], - "moduleResolution": "node", - "module": "esnext", - "target": "esnext" - }, - "include": [ - "ambient.d.ts", - "./types/**/$types.d.ts", - "../vite.config.ts", - "../src/**/*.js", - "../src/**/*.ts", - "../src/**/*.svelte", - "../tests/**/*.js", - "../tests/**/*.ts", - "../tests/**/*.svelte" - ], - "exclude": [ - "../node_modules/**", - "./[!ambient.d.ts]**", - "../src/service-worker.js", - "../src/service-worker.ts", - "../src/service-worker.d.ts" - ] -} \ No newline at end of file + "compilerOptions": { + "baseUrl": "..", + "paths": { + "$components": ["src/lib/components"], + "$components/*": ["src/lib/components/*"], + "$journey": ["src/lib/journey"], + "$journey/*": ["src/lib/journey/*"], + "$lib": ["src/lib"], + "$lib/*": ["src/lib/*"], + "$locales": ["src/locales"], + "$locales/*": ["src/locales/*"], + "$package": ["package"], + "$package/*": ["package/*"], + "$widget": ["src/widget"], + "$widget/*": ["src/widget/*"] + }, + "rootDirs": ["..", "./types"], + "importsNotUsedAsValues": "error", + "isolatedModules": true, + "preserveValueImports": true, + "lib": ["esnext", "DOM", "DOM.Iterable"], + "moduleResolution": "node", + "module": "esnext", + "target": "esnext" + }, + "include": [ + "ambient.d.ts", + "./types/**/$types.d.ts", + "../vite.config.ts", + "../src/**/*.js", + "../src/**/*.ts", + "../src/**/*.svelte", + "../tests/**/*.js", + "../tests/**/*.ts", + "../tests/**/*.svelte" + ], + "exclude": [ + "../node_modules/**", + "./[!ambient.d.ts]**", + "../src/service-worker.js", + "../src/service-worker.ts", + "../src/service-worker.d.ts" + ] +} diff --git a/package.json b/package.json index 31d02488..9e821856 100644 --- a/package.json +++ b/package.json @@ -40,9 +40,9 @@ }, "dependencies": { "@forgerock/javascript-sdk": "^3.4.0", - "uuid": "^9.0.0", - "xss": "^1.0.14", - "zod": "^3.21.4" + "uuid": "9.0.0", + "xss": "1.0.14", + "zod": "3.21.4" }, "devDependencies": { "@babel/core": "^7.21.3", @@ -86,7 +86,7 @@ "autoprefixer": "^10.4.13", "babel-loader": "^9.1.2", "chromatic": "^6.17.0", - "color": "^4.2.3", + "color": "4.2.3", "commitizen": "^4.2.6", "concurrently": "^7.6.0", "cz-conventional-changelog": "^3.3.0", @@ -95,13 +95,13 @@ "eslint-plugin-storybook": "^0.6.11", "eslint-plugin-svelte3": "^4.0.0", "husky": "^8.0.3", - "is-ci": "^3.0.1", + "is-ci": "3.0.1", "jest": "^29.4.2", "jest-playwright-preset": "^3.0.1", "lint-staged": "^13.1.0", "markdown-toc": "^1.2.0", - "mdsvex": "^0.10.6", - "npm-run-all": "^4.1.5", + "mdsvex": "0.10.6", + "npm-run-all": "4.1.5", "playwright": "^1.29.2", "postcss": "^8.4.19", "postcss-cli": "^10.1.0", @@ -118,9 +118,9 @@ "rollup-plugin-postcss": "4.0.2", "rollup-plugin-styles": "^4.0.0", "rollup-plugin-svelte": "^7.1.0", - "semantic-release-slack-bot": "^3.5.3", + "semantic-release-slack-bot": "3.5.3", "storybook": "^7.0.0-rc.3", - "storybook-addon-code-editor": "^0.3.7", + "storybook-addon-code-editor": "0.3.7", "storybook-dark-mode": "2.0.5", "svelte": "^3.55.1", "svelte-check": "^3.0.3", diff --git a/package/CHANGELOG.md b/package/CHANGELOG.md index c4e7b0c0..1ea866c4 100644 --- a/package/CHANGELOG.md +++ b/package/CHANGELOG.md @@ -7,25 +7,22 @@ # [1.0.0-beta.15](https://github.com/forgerock/forgerock-web-login-framework/compare/v1.0.0-beta.14...v1.0.0-beta.15) (2023-03-27) - ### Bug Fixes -* **login-failure:** handle 500 failures within login store ([90fb461](https://github.com/forgerock/forgerock-web-login-framework/commit/90fb461e2598f929e4b418c9794f8b085e433e54)) +- **login-failure:** handle 500 failures within login store ([90fb461](https://github.com/forgerock/forgerock-web-login-framework/commit/90fb461e2598f929e4b418c9794f8b085e433e54)) # [1.0.0-beta.14](https://github.com/forgerock/forgerock-web-login-framework/compare/v1.0.0-beta.13...v1.0.0-beta.14) (2023-03-27) - ### Bug Fixes -* **configuration:** improve handling and reporting of missing configuration ([a611623](https://github.com/forgerock/forgerock-web-login-framework/commit/a611623d7c33b0af18483ccad81a8725e461be65)) +- **configuration:** improve handling and reporting of missing configuration ([a611623](https://github.com/forgerock/forgerock-web-login-framework/commit/a611623d7c33b0af18483ccad81a8725e461be65)) # [1.0.0-beta.13](https://github.com/forgerock/forgerock-web-login-framework/compare/v1.0.0-beta.12...v1.0.0-beta.13) (2023-03-27) - ### Bug Fixes -* **password:** fix password confirmation reset and validation failures ([5b7d039](https://github.com/forgerock/forgerock-web-login-framework/commit/5b7d039ed8feb7eb7053b6818425c9a32b0e667c)) -* **style:** reworking application of headers and footers of widget ([1aa8306](https://github.com/forgerock/forgerock-web-login-framework/commit/1aa8306366127e38145fb6e69298da160349cd0e)) +- **password:** fix password confirmation reset and validation failures ([5b7d039](https://github.com/forgerock/forgerock-web-login-framework/commit/5b7d039ed8feb7eb7053b6818425c9a32b0e667c)) +- **style:** reworking application of headers and footers of widget ([1aa8306](https://github.com/forgerock/forgerock-web-login-framework/commit/1aa8306366127e38145fb6e69298da160349cd0e)) # [1.0.0-beta.12](https://github.com/forgerock/forgerock-web-login-framework/compare/v1.0.0-beta.11...v1.0.0-beta.12) (2023-03-27) diff --git a/package/index.js b/package/index.js index e3ebcb68..8892afb0 100644 --- a/package/index.js +++ b/package/index.js @@ -17731,8 +17731,7 @@ function initialize$4(initOptions) { error: { code: nextStep.getCode(), message: failureMessageStr, - // TODO: Should we remove the callbacks for PII info? - step: prevStep?.payload, + stage: prevStep?.payload?.stage, troubleshoot: null, }, loading: false, @@ -17762,8 +17761,7 @@ function initialize$4(initOptions) { error: { code: nextStep.getCode(), message: failureMessageStr, - // TODO: Should we remove the callbacks for PII info? - step: prevStep?.payload, + stage: prevStep?.payload?.stage, troubleshoot: null, }, loading: false, diff --git a/rollup.types.config.js b/rollup.types.config.js index 3bb59f89..270ba959 100644 --- a/rollup.types.config.js +++ b/rollup.types.config.js @@ -2,11 +2,11 @@ import dts from 'rollup-plugin-dts'; export default [ { - input: 'svelte-package/widget/index.svelte.d.ts', + input: 'svelte-package/widget/types.d.ts', external: ['./main.css'], output: [ { - file: 'package/index.d.ts', + file: 'package/types.d.ts', format: 'es', }, ], diff --git a/src/lib/journey/journey.interfaces.ts b/src/lib/journey/journey.interfaces.ts index e2b9987f..a95ea8b1 100644 --- a/src/lib/journey/journey.interfaces.ts +++ b/src/lib/journey/journey.interfaces.ts @@ -39,7 +39,7 @@ export interface JourneyStoreValue { error: Maybe<{ code: Maybe; message: Maybe; - step: Maybe; + stage: Maybe; troubleshoot: Maybe; }>; loading: boolean; diff --git a/src/lib/journey/journey.store.ts b/src/lib/journey/journey.store.ts index 3b6be54d..50317384 100644 --- a/src/lib/journey/journey.store.ts +++ b/src/lib/journey/journey.store.ts @@ -322,8 +322,7 @@ export function initialize(initOptions?: StepOptions): JourneyStore { error: { code: nextStep.getCode(), message: failureMessageStr, - // TODO: Should we remove the callbacks for PII info? - step: prevStep?.payload, + stage: prevStep?.payload?.stage, troubleshoot: null, }, loading: false, @@ -351,8 +350,7 @@ export function initialize(initOptions?: StepOptions): JourneyStore { error: { code: nextStep.getCode(), message: failureMessageStr, - // TODO: Should we remove the callbacks for PII info? - step: prevStep?.payload, + stage: prevStep?.payload?.stage, troubleshoot: null, }, loading: false, diff --git a/src/lib/widget/index.svelte b/src/lib/widget/index.svelte index 45780045..4950591b 100644 --- a/src/lib/widget/index.svelte +++ b/src/lib/widget/index.svelte @@ -11,11 +11,6 @@ export const component = componentApi; export const request = api.request; export const user = api.user; - - export type ConfigurationApi = ReturnType; - export type JourneyApi = ReturnType; - export type UserInfoApi = ReturnType; - export type UserTokensApi = ReturnType;