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/build/global.d.ts b/packages/account/build/global.d.ts new file mode 100644 index 000000000000..5ac902685ee5 --- /dev/null +++ b/packages/account/build/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..71ef3c50956a 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.54", "@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..1a92d82ee4aa 100644 --- a/packages/account/tsconfig.json +++ b/packages/account/tsconfig.json @@ -15,8 +15,9 @@ "Sections/*": ["src/Sections/*"], "Stores/*": ["src/Stores/*"], "Styles/*": ["src/Styles/*"], + "Types": ["src/Types"], "@deriv/*": ["../*/src"] } }, - "include": ["src"] + "include": ["src","globals.d.ts"] }