@tap-payments/auth-jsconnect 1.0.91-test → 1.0.93-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +58 -52
  2. package/build/@types/app.d.ts +9 -0
  3. package/build/@types/app.js +9 -0
  4. package/build/@types/form.d.ts +2 -0
  5. package/build/app/rootReducer.d.ts +0 -1
  6. package/build/app/rootReducer.js +1 -3
  7. package/build/app/store.d.ts +0 -2
  8. package/build/components/AnimationFlow/BottomSheet.js +1 -1
  9. package/build/constants/app.d.ts +0 -1
  10. package/build/constants/app.js +0 -8
  11. package/build/features/app/bank/bankStore.d.ts +5 -1
  12. package/build/features/app/bank/bankStore.js +38 -1
  13. package/build/features/app/business/businessStore.d.ts +5 -1
  14. package/build/features/app/business/businessStore.js +36 -1
  15. package/build/features/app/connect/connectStore.d.ts +2 -1
  16. package/build/features/app/connect/connectStore.js +14 -5
  17. package/build/features/app/individual/individualStore.d.ts +5 -1
  18. package/build/features/app/individual/individualStore.js +36 -0
  19. package/build/features/app/password/passwordStore.d.ts +5 -1
  20. package/build/features/app/password/passwordStore.js +37 -1
  21. package/build/features/app/tax/taxStore.d.ts +5 -1
  22. package/build/features/app/tax/taxStore.js +39 -2
  23. package/build/features/bank/Bank.js +4 -3
  24. package/build/features/bank/screens/BankDetails/BankDetails.js +2 -1
  25. package/build/features/bank/screens/BankDetails/ConfirmPolicy.d.ts +3 -0
  26. package/build/features/bank/screens/BankDetails/ConfirmPolicy.js +67 -0
  27. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
  28. package/build/features/bank/screens/BankDetails/validation.js +2 -1
  29. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  30. package/build/features/bank/screens/Verify/OTPInput.d.ts +3 -1
  31. package/build/features/bank/screens/Verify/OTPInput.js +6 -1
  32. package/build/features/bank/screens/Verify/Verify.js +3 -2
  33. package/build/features/business/Business.js +4 -3
  34. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -1
  35. package/build/features/business/screens/Verify/OTPInput.d.ts +3 -1
  36. package/build/features/business/screens/Verify/OTPInput.js +6 -1
  37. package/build/features/business/screens/Verify/Verify.js +3 -2
  38. package/build/features/connect/Connect.js +5 -3
  39. package/build/features/featuresScreens.d.ts +0 -1
  40. package/build/features/featuresScreens.js +0 -7
  41. package/build/features/individual/Individual.js +4 -3
  42. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  43. package/build/features/individual/screens/Verify/OTPInput.d.ts +3 -1
  44. package/build/features/individual/screens/Verify/OTPInput.js +6 -1
  45. package/build/features/individual/screens/Verify/Verify.js +3 -2
  46. package/build/features/password/Password.js +4 -3
  47. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  48. package/build/features/password/screens/Verify/OTPInput.d.ts +3 -1
  49. package/build/features/password/screens/Verify/OTPInput.js +6 -1
  50. package/build/features/password/screens/Verify/Verify.js +3 -2
  51. package/build/features/shared/Button/AbsherButton.js +3 -8
  52. package/build/features/shared/Button/EmailProvidersButtons.js +2 -1
  53. package/build/features/shared/Button/FlowsButtons.d.ts +4 -1
  54. package/build/features/shared/Button/FlowsButtons.js +10 -5
  55. package/build/features/shared/Button/MobileButton.js +3 -8
  56. package/build/features/shared/OTP/OTP.d.ts +2 -1
  57. package/build/features/shared/OTP/OTP.js +10 -2
  58. package/build/features/tax/Tax.js +4 -3
  59. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  60. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.d.ts +3 -0
  61. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.js +66 -0
  62. package/build/features/tax/screens/TaxDetails/TaxDetails.js +5 -2
  63. package/build/features/tax/screens/TaxDetails/VATId.js +13 -2
  64. package/build/features/tax/screens/TaxDetails/validation.d.ts +3 -0
  65. package/build/features/tax/screens/TaxDetails/validation.js +2 -1
  66. package/build/features/tax/screens/Verify/OTPInput.d.ts +3 -1
  67. package/build/features/tax/screens/Verify/OTPInput.js +6 -1
  68. package/build/features/tax/screens/Verify/Verify.js +3 -2
  69. package/build/hooks/index.d.ts +1 -0
  70. package/build/hooks/index.js +1 -0
  71. package/build/hooks/useAppDispatch.d.ts +0 -1
  72. package/build/hooks/useErrorListener.d.ts +1 -1
  73. package/build/hooks/useErrorListener.js +4 -6
  74. package/build/hooks/useStepStartedListener.d.ts +1 -0
  75. package/build/hooks/useStepStartedListener.js +10 -0
  76. package/build/index.d.ts +2 -3
  77. package/build/index.js +2 -5
  78. package/build/utils/string.d.ts +1 -0
  79. package/build/utils/string.js +19 -0
  80. package/package.json +127 -127
  81. package/build/features/Landing/Landing.d.ts +0 -7
  82. package/build/features/Landing/Landing.js +0 -55
  83. package/build/features/Landing/index.d.ts +0 -1
  84. package/build/features/Landing/index.js +0 -1
  85. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.d.ts +0 -5
  86. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.js +0 -41
  87. package/build/features/Landing/screens/VerifyAndRedirect/index.d.ts +0 -2
  88. package/build/features/Landing/screens/VerifyAndRedirect/index.js +0 -2
  89. package/build/features/app/landing/landingStore.d.ts +0 -22
  90. package/build/features/app/landing/landingStore.js +0 -103
@@ -1,16 +1,14 @@
1
1
  import { useEffect } from 'react';
2
2
  import { settingsSelector } from '../app/settings';
3
3
  import { useAppSelector } from './useAppSelector';
4
- import { connectSelector } from '../features/app/connect/connectStore';
5
- export var useErrorListener = function () {
4
+ export var useErrorListener = function (error) {
6
5
  var settings = useAppSelector(settingsSelector);
7
- var connect = useAppSelector(connectSelector);
8
6
  useEffect(function () {
9
7
  var _a, _b;
10
- if (connect.error || settings.error) {
11
- (_b = (_a = settings.data.appConfig) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, settings.error || connect.error);
8
+ if (error) {
9
+ (_b = (_a = settings.data.appConfig) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
12
10
  }
13
- }, [connect.error, settings.error]);
11
+ }, [error]);
14
12
  useEffect(function () {
15
13
  var _a, _b;
16
14
  if (!settings.error)
@@ -0,0 +1 @@
1
+ export declare const useStepStartedListener: () => void;
@@ -0,0 +1,10 @@
1
+ import { useEffect } from 'react';
2
+ import { settingsSelector } from '../app/settings';
3
+ import { useAppSelector } from './useAppSelector';
4
+ export var useStepStartedListener = function () {
5
+ var settings = useAppSelector(settingsSelector);
6
+ useEffect(function () {
7
+ var _a, _b;
8
+ (_b = (_a = settings.data.appConfig).onStepStarted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name);
9
+ }, [settings.data.activeScreen]);
10
+ };
package/build/index.d.ts CHANGED
@@ -6,6 +6,5 @@ import { PasswordLib, renderPasswordLib, PasswordLibProps, unmountPasswordLib }
6
6
  import { IndividualLib, renderIndividualLib, IndividualLibProps, unmountIndividualLib } from './features/individual';
7
7
  import { BankLib, renderBankLib, BankLibProps, unmountBankLib } from './features/bank';
8
8
  import { TaxLib, renderTaxLib, TaxLibProps, unmountTaxLib } from './features/tax';
9
- import { LandingLib, LandingProps, renderLandingLib, unmountLandingLib } from './features/Landing';
10
- export type { ConnectLibProps, BusinessLibProps, PasswordLibProps, IndividualLibProps, BankLibProps, TaxLibProps, LandingProps };
11
- export { ConnectLib, renderConnectLib, unmountConnectLib, BusinessLib, renderBusinessLib, unmountBusinessLib, PasswordLib, renderPasswordLib, unmountPasswordLib, IndividualLib, renderIndividualLib, unmountIndividualLib, BankLib, renderBankLib, unmountBankLib, TaxLib, renderTaxLib, unmountTaxLib, LandingLib, renderLandingLib, unmountLandingLib };
9
+ export type { ConnectLibProps, BusinessLibProps, PasswordLibProps, IndividualLibProps, BankLibProps, TaxLibProps };
10
+ export { ConnectLib, renderConnectLib, unmountConnectLib, BusinessLib, renderBusinessLib, unmountBusinessLib, PasswordLib, renderPasswordLib, unmountPasswordLib, IndividualLib, renderIndividualLib, unmountIndividualLib, BankLib, renderBankLib, unmountBankLib, TaxLib, renderTaxLib, unmountTaxLib };
package/build/index.js CHANGED
@@ -6,8 +6,7 @@ import { PasswordLib, renderPasswordLib, unmountPasswordLib } from './features/p
6
6
  import { IndividualLib, renderIndividualLib, unmountIndividualLib } from './features/individual';
7
7
  import { BankLib, renderBankLib, unmountBankLib } from './features/bank';
8
8
  import { TaxLib, renderTaxLib, unmountTaxLib } from './features/tax';
9
- import { LandingLib, renderLandingLib, unmountLandingLib } from './features/Landing';
10
- export { ConnectLib, renderConnectLib, unmountConnectLib, BusinessLib, renderBusinessLib, unmountBusinessLib, PasswordLib, renderPasswordLib, unmountPasswordLib, IndividualLib, renderIndividualLib, unmountIndividualLib, BankLib, renderBankLib, unmountBankLib, TaxLib, renderTaxLib, unmountTaxLib, LandingLib, renderLandingLib, unmountLandingLib };
9
+ export { ConnectLib, renderConnectLib, unmountConnectLib, BusinessLib, renderBusinessLib, unmountBusinessLib, PasswordLib, renderPasswordLib, unmountPasswordLib, IndividualLib, renderIndividualLib, unmountIndividualLib, BankLib, renderBankLib, unmountBankLib, TaxLib, renderTaxLib, unmountTaxLib };
11
10
  window['TapAuth'] = {
12
11
  renderConnectLib: renderConnectLib,
13
12
  unmountConnectLib: unmountConnectLib,
@@ -20,7 +19,5 @@ window['TapAuth'] = {
20
19
  renderBankLib: renderBankLib,
21
20
  unmountBankLib: unmountBankLib,
22
21
  renderTaxLib: renderTaxLib,
23
- unmountTaxLib: unmountTaxLib,
24
- renderLandingLib: renderLandingLib,
25
- unmountLandingLib: unmountLandingLib
22
+ unmountTaxLib: unmountTaxLib
26
23
  };
@@ -37,3 +37,4 @@ export declare const getRequestHeaders: (deviceInfo: DeviceInfo) => {
37
37
  };
38
38
  export declare const removeRequestHeaders: () => void;
39
39
  export declare const getBaseUrl: () => string;
40
+ export declare const getScreenNameBasedOnFlow: (flow: string) => "CONNECT_NID_STEP" | "" | "BUSINESS_BUSINESS_TYPE_STEP" | "INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP" | "BANK_BANK_DETAILS_STEP" | "TAX_TAX_DETAILS_STEP";
@@ -1,3 +1,4 @@
1
+ import { FlowsTypes } from '../@types';
1
2
  import { encryptString } from '.';
2
3
  import { removeAxiosGlobalHeaders } from '../api';
3
4
  import { ENDPOINT_PATHS } from '../constants';
@@ -134,3 +135,21 @@ export var getBaseUrl = function () {
134
135
  }
135
136
  return ENDPOINT_PATHS.PRODUCTION_BASE_URL;
136
137
  };
138
+ export var getScreenNameBasedOnFlow = function (flow) {
139
+ if (flow === FlowsTypes.BANK) {
140
+ return 'BANK_BANK_DETAILS_STEP';
141
+ }
142
+ if (flow === FlowsTypes.BUSINESS) {
143
+ return 'BUSINESS_BUSINESS_TYPE_STEP';
144
+ }
145
+ if (flow === FlowsTypes.INDIVIDUAL) {
146
+ return 'INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP';
147
+ }
148
+ if (flow === FlowsTypes.CONNECT) {
149
+ return 'CONNECT_NID_STEP';
150
+ }
151
+ if (flow === FlowsTypes.TAX) {
152
+ return 'TAX_TAX_DETAILS_STEP';
153
+ }
154
+ return '';
155
+ };
package/package.json CHANGED
@@ -1,127 +1,127 @@
1
- {
2
- "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.91-test",
4
- "description": "connect library, auth",
5
- "private": false,
6
- "main": "build/index.js",
7
- "module": "build/index.js",
8
- "types": "build/index.d.ts",
9
- "files": [
10
- "build",
11
- "README.md"
12
- ],
13
- "scripts": {
14
- "husky:setup": "npx husky install",
15
- "prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\" *.json *.js",
16
- "prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\" *.json *.js",
17
- "lint": "eslint src --color --ext .js,.jsx,.ts,.tsx,.json",
18
- "lint:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
19
- "start": "cross-env NODE_ENV=development webpack serve",
20
- "build": "rm -rf build && cross-env NODE_ENV=production webpack",
21
- "copy:files": "copyfiles -u 1 src/**/*.css build/",
22
- "tsc:alias": "tsc-alias -p tsconfig.json",
23
- "ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
24
- "push": "npm publish --access public"
25
- },
26
- "keywords": [],
27
- "author": {
28
- "name": "Ahmed Elsharkawy",
29
- "email": "a.elsharkawy@tap.company"
30
- },
31
- "license": "ISC",
32
- "devDependencies": {
33
- "@babel/core": "^7.18.6",
34
- "@babel/preset-env": "^7.18.6",
35
- "@babel/preset-react": "^7.18.6",
36
- "@babel/preset-typescript": "^7.18.6",
37
- "@types/lodash-es": "^4.17.6",
38
- "@types/moment-hijri": "^2.1.0",
39
- "@types/react": "^18.0.15",
40
- "@types/react-calendar": "~3.5.1",
41
- "@types/react-dom": "^18.0.6",
42
- "@typescript-eslint/eslint-plugin": "^5.30.5",
43
- "@typescript-eslint/parser": "^5.30.5",
44
- "babel-loader": "^8.2.5",
45
- "copyfiles": "^2.4.1",
46
- "cross-env": "^7.0.3",
47
- "css-loader": "^6.7.1",
48
- "css-minimizer-webpack-plugin": "^4.0.0",
49
- "eslint": "^8.19.0",
50
- "eslint-config-airbnb": "^19.0.4",
51
- "eslint-config-prettier": "^8.5.0",
52
- "eslint-plugin-import": "^2.26.0",
53
- "eslint-plugin-jsx-a11y": "^6.6.0",
54
- "eslint-plugin-node": "^11.1.0",
55
- "eslint-plugin-prettier": "^4.2.1",
56
- "eslint-plugin-react": "^7.30.1",
57
- "eslint-plugin-react-hooks": "^4.6.0",
58
- "file-loader": "^6.2.0",
59
- "fork-ts-checker-webpack-plugin": "^7.2.12",
60
- "html-loader": "^3.1.2",
61
- "html-webpack-plugin": "^5.5.0",
62
- "husky": "^8.0.1",
63
- "lint-staged": "^13.0.3",
64
- "mini-css-extract-plugin": "^2.6.1",
65
- "prettier": "^2.7.1",
66
- "sass": "^1.53.0",
67
- "sass-loader": "^13.0.2",
68
- "style-loader": "^3.3.1",
69
- "terser-webpack-plugin": "^5.3.3",
70
- "tsc-alias": "^1.6.11",
71
- "typescript": "^4.7.4",
72
- "webpack": "^5.73.0",
73
- "webpack-cli": "^4.10.0",
74
- "webpack-dev-server": "^4.9.3",
75
- "webpack-merge": "^5.8.0"
76
- },
77
- "dependencies": {
78
- "@emotion/react": "^11.9.3",
79
- "@emotion/styled": "^11.9.3",
80
- "@fingerprintjs/fingerprintjs": "~3.3.4",
81
- "@hookform/resolvers": "^2.9.6",
82
- "@mui/icons-material": "^5.8.4",
83
- "@mui/material": "^5.8.7",
84
- "@reduxjs/toolkit": "^1.8.3",
85
- "axios": "^0.27.2",
86
- "device-detector-js": "^3.0.3",
87
- "i18next": "^21.8.14",
88
- "i18next-browser-languagedetector": "^6.1.4",
89
- "i18next-http-backend": "^1.4.1",
90
- "jsencrypt": "^3.2.1",
91
- "lodash-es": "^4.17.21",
92
- "moment-hijri": "~2.1.2",
93
- "react": "^18.2.0",
94
- "react-calendar": "~3.7.0",
95
- "react-device-detect": "^2.2.2",
96
- "react-dom": "^18.2.0",
97
- "react-hook-form": "^7.33.1",
98
- "react-i18next": "^11.18.1",
99
- "react-otp-input": "^2.4.0",
100
- "react-redux": "^8.0.2",
101
- "react-spring-bottom-sheet": "^3.4.1",
102
- "yup": "^0.32.11"
103
- },
104
- "peerDependencies": {
105
- "react": "^18.2.0",
106
- "react-dom": "^18.2.0"
107
- },
108
- "lint-staged": {
109
- "src/**/*.{ts,tsx,json,js,jsx}": [
110
- "yarn run prettier:fix",
111
- "yarn run lint",
112
- "git add ."
113
- ]
114
- },
115
- "browserslist": {
116
- "production": [
117
- ">0.2%",
118
- "not dead",
119
- "not op_mini all"
120
- ],
121
- "development": [
122
- "last 1 chrome version",
123
- "last 1 firefox version",
124
- "last 1 safari version"
125
- ]
126
- }
127
- }
1
+ {
2
+ "name": "@tap-payments/auth-jsconnect",
3
+ "version": "1.0.93-test",
4
+ "description": "connect library, auth",
5
+ "private": false,
6
+ "main": "build/index.js",
7
+ "module": "build/index.js",
8
+ "types": "build/index.d.ts",
9
+ "files": [
10
+ "build",
11
+ "README.md"
12
+ ],
13
+ "scripts": {
14
+ "husky:setup": "npx husky install",
15
+ "prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\" *.json *.js",
16
+ "prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\" *.json *.js",
17
+ "lint": "eslint src --color --ext .js,.jsx,.ts,.tsx,.json",
18
+ "lint:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
19
+ "start": "cross-env NODE_ENV=development webpack serve",
20
+ "build": "rm -rf build && cross-env NODE_ENV=production webpack",
21
+ "copy:files": "copyfiles -u 1 src/**/*.css build/",
22
+ "tsc:alias": "tsc-alias -p tsconfig.json",
23
+ "ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
24
+ "push": "npm publish --access public"
25
+ },
26
+ "keywords": [],
27
+ "author": {
28
+ "name": "Ahmed Elsharkawy",
29
+ "email": "a.elsharkawy@tap.company"
30
+ },
31
+ "license": "ISC",
32
+ "devDependencies": {
33
+ "@babel/core": "^7.18.6",
34
+ "@babel/preset-env": "^7.18.6",
35
+ "@babel/preset-react": "^7.18.6",
36
+ "@babel/preset-typescript": "^7.18.6",
37
+ "@types/lodash-es": "^4.17.6",
38
+ "@types/moment-hijri": "^2.1.0",
39
+ "@types/react": "^18.0.15",
40
+ "@types/react-calendar": "~3.5.1",
41
+ "@types/react-dom": "^18.0.6",
42
+ "@typescript-eslint/eslint-plugin": "^5.30.5",
43
+ "@typescript-eslint/parser": "^5.30.5",
44
+ "babel-loader": "^8.2.5",
45
+ "copyfiles": "^2.4.1",
46
+ "cross-env": "^7.0.3",
47
+ "css-loader": "^6.7.1",
48
+ "css-minimizer-webpack-plugin": "^4.0.0",
49
+ "eslint": "^8.19.0",
50
+ "eslint-config-airbnb": "^19.0.4",
51
+ "eslint-config-prettier": "^8.5.0",
52
+ "eslint-plugin-import": "^2.26.0",
53
+ "eslint-plugin-jsx-a11y": "^6.6.0",
54
+ "eslint-plugin-node": "^11.1.0",
55
+ "eslint-plugin-prettier": "^4.2.1",
56
+ "eslint-plugin-react": "^7.30.1",
57
+ "eslint-plugin-react-hooks": "^4.6.0",
58
+ "file-loader": "^6.2.0",
59
+ "fork-ts-checker-webpack-plugin": "^7.2.12",
60
+ "html-loader": "^3.1.2",
61
+ "html-webpack-plugin": "^5.5.0",
62
+ "husky": "^8.0.1",
63
+ "lint-staged": "^13.0.3",
64
+ "mini-css-extract-plugin": "^2.6.1",
65
+ "prettier": "^2.7.1",
66
+ "sass": "^1.53.0",
67
+ "sass-loader": "^13.0.2",
68
+ "style-loader": "^3.3.1",
69
+ "terser-webpack-plugin": "^5.3.3",
70
+ "tsc-alias": "^1.6.11",
71
+ "typescript": "^4.7.4",
72
+ "webpack": "^5.73.0",
73
+ "webpack-cli": "^4.10.0",
74
+ "webpack-dev-server": "^4.9.3",
75
+ "webpack-merge": "^5.8.0"
76
+ },
77
+ "dependencies": {
78
+ "@emotion/react": "^11.9.3",
79
+ "@emotion/styled": "^11.9.3",
80
+ "@fingerprintjs/fingerprintjs": "~3.3.4",
81
+ "@hookform/resolvers": "^2.9.6",
82
+ "@mui/icons-material": "^5.8.4",
83
+ "@mui/material": "^5.8.7",
84
+ "@reduxjs/toolkit": "^1.8.3",
85
+ "axios": "^0.27.2",
86
+ "device-detector-js": "^3.0.3",
87
+ "i18next": "^21.8.14",
88
+ "i18next-browser-languagedetector": "^6.1.4",
89
+ "i18next-http-backend": "^1.4.1",
90
+ "jsencrypt": "^3.2.1",
91
+ "lodash-es": "^4.17.21",
92
+ "moment-hijri": "~2.1.2",
93
+ "react": "^18.2.0",
94
+ "react-calendar": "~3.7.0",
95
+ "react-device-detect": "^2.2.2",
96
+ "react-dom": "^18.2.0",
97
+ "react-hook-form": "^7.33.1",
98
+ "react-i18next": "^11.18.1",
99
+ "react-otp-input": "^2.4.0",
100
+ "react-redux": "^8.0.2",
101
+ "react-spring-bottom-sheet": "^3.4.1",
102
+ "yup": "^0.32.11"
103
+ },
104
+ "peerDependencies": {
105
+ "react": "^18.2.0",
106
+ "react-dom": "^18.2.0"
107
+ },
108
+ "lint-staged": {
109
+ "src/**/*.{ts,tsx,json,js,jsx}": [
110
+ "yarn run prettier:fix",
111
+ "yarn run lint",
112
+ "git add ."
113
+ ]
114
+ },
115
+ "browserslist": {
116
+ "production": [
117
+ ">0.2%",
118
+ "not dead",
119
+ "not op_mini all"
120
+ ],
121
+ "development": [
122
+ "last 1 chrome version",
123
+ "last 1 firefox version",
124
+ "last 1 safari version"
125
+ ]
126
+ }
127
+ }
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- import { LibConfig } from '../../@types';
3
- export interface LandingProps extends LibConfig {
4
- }
5
- export declare function LandingLib(props: LandingProps): JSX.Element;
6
- export declare function renderLandingLib(config: LandingProps, elementId: string): void;
7
- export declare function unmountLandingLib(elementId: string): void;
@@ -1,55 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import React, { memo, useEffect } from 'react';
14
- import { useAppTheme, useAppDispatch, useAppSelector, useErrorListener, useAppConfig } from '../../hooks';
15
- import { settingsSelector } from '../../app/settings';
16
- import { store } from '../../app/store';
17
- import { ReduxProvider, ThemeProvider } from '../../components/Providers';
18
- import Collapse from '../../components/Collapse';
19
- import { getParameterByName, reactElement } from '../../utils';
20
- import { LANDING_SCREENS_NAVIGATION } from '../../constants';
21
- import { landingFeatureScreens } from '../featuresScreens';
22
- import { verifyAuthToken } from '../app/landing/landingStore';
23
- var Landing = memo(function (props) {
24
- var open = React.useState(true)[0];
25
- var theme = useAppTheme().theme;
26
- var dispatch = useAppDispatch();
27
- var data = useAppSelector(settingsSelector).data;
28
- var loading = useAppConfig(__assign({ navigation: LANDING_SCREENS_NAVIGATION }, props)).loading;
29
- useErrorListener();
30
- var activeScreen = data.activeScreen;
31
- var verifyToken = function () {
32
- var token = getParameterByName('token');
33
- if (!token)
34
- throw new Error('Auth token is not found!');
35
- dispatch(verifyAuthToken(token));
36
- };
37
- useEffect(function () {
38
- if (!loading)
39
- verifyToken();
40
- }, [loading]);
41
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: landingFeatureScreens.map(function (_a, index) {
42
- var Element = _a.element, name = _a.name;
43
- var isActive = activeScreen.name === name;
44
- return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
45
- }) })));
46
- });
47
- export function LandingLib(props) {
48
- return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Landing, __assign({}, props)) })));
49
- }
50
- export function renderLandingLib(config, elementId) {
51
- reactElement(elementId).render(_jsx(LandingLib, __assign({}, config)));
52
- }
53
- export function unmountLandingLib(elementId) {
54
- reactElement(elementId).unmount();
55
- }
@@ -1 +0,0 @@
1
- export * from './Landing';
@@ -1 +0,0 @@
1
- export * from './Landing';
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- export interface VerifyAndRedirectProps {
3
- }
4
- declare const _default: React.MemoExoticComponent<({}: VerifyAndRedirectProps) => JSX.Element>;
5
- export default _default;
@@ -1,41 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import * as React from 'react';
3
- import Box from '@mui/material/Box/Box';
4
- import { styled } from '@mui/material/styles';
5
- import { settingsSelector } from '../../../../app/settings';
6
- import { landingSelector } from '../../../app/landing/landingStore';
7
- import { useAppSelector } from '../../../../hooks';
8
- import Loader from '../../../../components/AnimationFlow/Loader';
9
- import Error from '../../../../components/AnimationFlow/Error';
10
- import { getParameterByName } from '../../../../utils';
11
- var ScreenContainerStyled = styled(Box)(function (_a) {
12
- var theme = _a.theme;
13
- return ({
14
- display: 'flex',
15
- justifyContent: 'center',
16
- alignItems: 'center',
17
- width: '100vw',
18
- height: '100vh'
19
- });
20
- });
21
- var VerifyAndRedirect = function (_a) {
22
- var _b = useAppSelector(settingsSelector), sLoading = _b.loading, sError = _b.error;
23
- var _c = useAppSelector(landingSelector), data = _c.data, error = _c.error, loading = _c.loading;
24
- var isLoading = sLoading || loading;
25
- var errorMessage = sError || error;
26
- var token = getParameterByName('token');
27
- var getFlowName = function (stepName) {
28
- return stepName.split('_')[0];
29
- };
30
- React.useEffect(function () {
31
- var step_name = (data.verify.responseBody || {}).step_name;
32
- if (step_name) {
33
- var flowName_1 = getFlowName(step_name);
34
- setTimeout(function () {
35
- window.location.href = "".concat(window.location.origin, "/").concat(flowName_1, "?token=").concat(token);
36
- }, 300);
37
- }
38
- }, [data.verify.responseBody]);
39
- return (_jsxs(ScreenContainerStyled, { children: [isLoading && _jsx(Loader, {}), errorMessage && _jsx(Error, { error: errorMessage })] }));
40
- };
41
- export default React.memo(VerifyAndRedirect);
@@ -1,2 +0,0 @@
1
- import VerifyAndRedirect from './VerifyAndRedirect';
2
- export default VerifyAndRedirect;
@@ -1,2 +0,0 @@
1
- import VerifyAndRedirect from './VerifyAndRedirect';
2
- export default VerifyAndRedirect;
@@ -1,22 +0,0 @@
1
- import { RootState } from '../../../app/store';
2
- import { ResponseData, SharedState } from '../../../@types';
3
- export declare const verifyAuthToken: import("@reduxjs/toolkit").AsyncThunk<{
4
- data: any;
5
- token: string;
6
- }, string, {}>;
7
- declare type VerifyData = {
8
- token: string;
9
- };
10
- export interface LandingData {
11
- verify: ResponseData & VerifyData;
12
- }
13
- export interface LandingState extends SharedState<LandingData> {
14
- }
15
- export declare const landingSlice: import("@reduxjs/toolkit").Slice<LandingState, {
16
- clearError: (state: LandingState) => void;
17
- stopLoader: (state: LandingState) => void;
18
- }, "landing/store">;
19
- export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
20
- declare const _default: import("redux").Reducer<LandingState, import("redux").AnyAction>;
21
- export default _default;
22
- export declare const landingSelector: (state: RootState) => LandingState;
@@ -1,103 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (_) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- var _a;
38
- import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
39
- import API from '../../../api';
40
- export var verifyAuthToken = createAsyncThunk('verifyAuthToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
41
- var payload, data;
42
- return __generator(this, function (_a) {
43
- switch (_a.label) {
44
- case 0:
45
- payload = {
46
- service_name: 'tap_email',
47
- verify_token: token
48
- };
49
- return [4, API.leadService.verifyLeadToken(payload)];
50
- case 1:
51
- data = (_a.sent()).data;
52
- return [2, { data: data, token: token }];
53
- }
54
- });
55
- }); });
56
- var initialState = {
57
- error: null,
58
- loading: false,
59
- data: {
60
- verify: {
61
- token: ''
62
- }
63
- }
64
- };
65
- export var landingSlice = createSlice({
66
- name: 'landing/store',
67
- initialState: initialState,
68
- reducers: {
69
- clearError: function (state) {
70
- state.error = null;
71
- },
72
- stopLoader: function (state) {
73
- state.loading = false;
74
- }
75
- },
76
- extraReducers: function (builder) {
77
- builder
78
- .addCase(verifyAuthToken.fulfilled, function (state, action) {
79
- var _a;
80
- state.loading = false;
81
- state.error = null;
82
- var _b = action.payload, data = _b.data, token = _b.token;
83
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
84
- if (description) {
85
- state.error = description;
86
- return;
87
- }
88
- state.data.verify.responseBody = data;
89
- state.data.verify.token = token;
90
- })
91
- .addCase(verifyAuthToken.rejected, function (state, action) {
92
- state.error = action.error.message;
93
- state.loading = false;
94
- })
95
- .addCase(verifyAuthToken.pending, function (state) {
96
- state.loading = true;
97
- state.error = null;
98
- });
99
- }
100
- });
101
- export var clearError = (_a = landingSlice.actions, _a.clearError), stopLoader = _a.stopLoader;
102
- export default landingSlice.reducer;
103
- export var landingSelector = function (state) { return state.landing; };