From d9974cbd6606f5f4d528d1ed165f473ce1930329 Mon Sep 17 00:00:00 2001 From: Likhith Kolayari <98398322+likhith-deriv@users.noreply.github.com> Date: Tue, 27 Sep 2022 12:24:09 +0400 Subject: [PATCH] feat: added configuration for account package migration (#6419) Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com> --- packages/account/.eslintrc.js | 5 ++++- packages/account/build/constants.js | 1 + packages/account/global.d.ts | 1 + packages/account/package.json | 1 + packages/account/src/Types/common-prop.type.ts | 11 +++++++++++ packages/account/src/Types/context.type.ts | 18 ++++++++++++++++++ packages/account/src/Types/index.ts | 2 ++ packages/account/tsconfig.json | 10 ++++------ 8 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 packages/account/global.d.ts create mode 100644 packages/account/src/Types/common-prop.type.ts create mode 100644 packages/account/src/Types/context.type.ts create mode 100644 packages/account/src/Types/index.ts diff --git a/packages/account/.eslintrc.js b/packages/account/.eslintrc.js index b5fe2450213a..8842b63e58a1 100644 --- a/packages/account/.eslintrc.js +++ b/packages/account/.eslintrc.js @@ -7,4 +7,7 @@ module.exports = { webpack: { config: webpackConfig({}) }, }, }, -}; \ No newline at end of file + rules: { + 'import/no-extraneous-dependencies': ['off', { devDependencies: ['**/*.spec.*'] }], + }, +}; diff --git a/packages/account/build/constants.js b/packages/account/build/constants.js index 807b4047aa10..77d6e833d2bb 100644 --- a/packages/account/build/constants.js +++ b/packages/account/build/constants.js @@ -31,6 +31,7 @@ const ALIASES = { Services: path.resolve(__dirname, '../src/Services'), Stores: path.resolve(__dirname, '../src/Stores'), Styles: path.resolve(__dirname, '../src/Styles'), + Types: path.resolve(__dirname, '../src/Types'), }; const rules = (is_test_env = false, is_mocha_only = false) => [ diff --git a/packages/account/global.d.ts b/packages/account/global.d.ts new file mode 100644 index 000000000000..5ac902685ee5 --- /dev/null +++ b/packages/account/global.d.ts @@ -0,0 +1 @@ +declare module '@binary-com/binary-document-uploader'; diff --git a/packages/account/package.json b/packages/account/package.json index b27fb7d140ce..30950f6052cf 100644 --- a/packages/account/package.json +++ b/packages/account/package.json @@ -28,6 +28,7 @@ }, "dependencies": { "@binary-com/binary-document-uploader": "^2.4.7", + "@deriv/api-types": "1.0.48", "@deriv/components": "^1.0.0", "@deriv/shared": "^1.0.0", "@deriv/translations": "^1.0.0", diff --git a/packages/account/src/Types/common-prop.type.ts b/packages/account/src/Types/common-prop.type.ts new file mode 100644 index 000000000000..3c4592d190d0 --- /dev/null +++ b/packages/account/src/Types/common-prop.type.ts @@ -0,0 +1,11 @@ +export type TFormValidation = { + warnings: { [key: string]: string }; + errors: { [key: string]: string }; +}; + +export type TToken = { + display_name: string; + last_used: string; + scopes: string[]; + token: string; +}; diff --git a/packages/account/src/Types/context.type.ts b/packages/account/src/Types/context.type.ts new file mode 100644 index 000000000000..8edbccc6eca8 --- /dev/null +++ b/packages/account/src/Types/context.type.ts @@ -0,0 +1,18 @@ +import { TToken } from './common-prop.type'; + +export type TPlatformContext = { + is_appstore: boolean; + displayName: string; +}; + +export type TApiContext = { + api_tokens: NonNullable | undefined; + deleteToken: (token: string) => Promise; + footer_ref: Element | DocumentFragment | undefined; + overlay_ref: + | ((...args: unknown[]) => unknown) + | import('prop-types').InferProps<{ + current: import('prop-types').Requireable; + }>; + toggleOverlay: () => void; +}; diff --git a/packages/account/src/Types/index.ts b/packages/account/src/Types/index.ts new file mode 100644 index 000000000000..07ac06fc0417 --- /dev/null +++ b/packages/account/src/Types/index.ts @@ -0,0 +1,2 @@ +export * from './common-prop.type'; +export * from './context.type'; diff --git a/packages/account/tsconfig.json b/packages/account/tsconfig.json index 182c1c0c7d40..954f183f6f61 100644 --- a/packages/account/tsconfig.json +++ b/packages/account/tsconfig.json @@ -8,15 +8,13 @@ "Containers/*": ["src/Containers/*"], "Constants/*": ["src/Constants/*"], "Configs/*": ["src/Configs/*"], - "Duplicated/*": ["src/Duplicated/*"], "Helpers/*": ["src/Helpers/*"], - "Layout/*": ["src/Layout/*"], "Modules/*": ["src/Modules/*"], "Sections/*": ["src/Sections/*"], "Stores/*": ["src/Stores/*"], - "Styles/*": ["src/Styles/*"], - "@deriv/*": ["../*/src"] + "Types": ["src/Types"], + "@deriv/*": ["../*/src"], } }, - "include": ["src"] -} + "include": ["src","globals.d.ts"] +} \ No newline at end of file