@tap-payments/auth-jsconnect 1.0.89 → 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 (117) hide show
  1. package/README.md +86 -135
  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/api/availabilityServices.d.ts +2 -0
  6. package/build/api/axios.js +1 -2
  7. package/build/api/index.d.ts +2 -2
  8. package/build/api/index.js +2 -2
  9. package/build/app/rootReducer.d.ts +0 -1
  10. package/build/app/rootReducer.js +1 -3
  11. package/build/app/store.d.ts +0 -2
  12. package/build/components/AnimationFlow/BottomSheet.js +1 -1
  13. package/build/components/Button/Button.d.ts +6 -1
  14. package/build/components/Button/Button.js +61 -23
  15. package/build/components/Footer/Footer.d.ts +0 -2
  16. package/build/components/Footer/Footer.js +0 -1
  17. package/build/constants/api.d.ts +3 -1
  18. package/build/constants/api.js +6 -2
  19. package/build/constants/app.d.ts +0 -1
  20. package/build/constants/app.js +0 -8
  21. package/build/features/app/bank/bankStore.d.ts +5 -1
  22. package/build/features/app/bank/bankStore.js +38 -1
  23. package/build/features/app/business/businessStore.d.ts +5 -1
  24. package/build/features/app/business/businessStore.js +40 -5
  25. package/build/features/app/connect/connectStore.d.ts +2 -1
  26. package/build/features/app/connect/connectStore.js +19 -8
  27. package/build/features/app/individual/individualStore.d.ts +5 -1
  28. package/build/features/app/individual/individualStore.js +36 -0
  29. package/build/features/app/password/passwordStore.d.ts +5 -1
  30. package/build/features/app/password/passwordStore.js +37 -1
  31. package/build/features/app/tax/taxStore.d.ts +5 -1
  32. package/build/features/app/tax/taxStore.js +39 -2
  33. package/build/features/bank/Bank.js +9 -4
  34. package/build/features/bank/screens/BankDetails/BankDetails.js +6 -1
  35. package/build/features/bank/screens/BankDetails/ConfirmPolicy.d.ts +3 -0
  36. package/build/features/bank/screens/BankDetails/ConfirmPolicy.js +67 -0
  37. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
  38. package/build/features/bank/screens/BankDetails/validation.js +2 -1
  39. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  40. package/build/features/bank/screens/Verify/OTPInput.d.ts +3 -1
  41. package/build/features/bank/screens/Verify/OTPInput.js +6 -1
  42. package/build/features/bank/screens/Verify/Verify.js +3 -2
  43. package/build/features/business/Business.js +9 -4
  44. package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
  45. package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
  46. package/build/features/business/screens/Customers/RefundPolicy.d.ts +1 -1
  47. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -1
  48. package/build/features/business/screens/Verify/OTPInput.d.ts +3 -1
  49. package/build/features/business/screens/Verify/OTPInput.js +6 -1
  50. package/build/features/business/screens/Verify/Verify.js +3 -2
  51. package/build/features/connect/Connect.js +5 -3
  52. package/build/features/connect/screens/Mobile/Mobile.js +1 -1
  53. package/build/features/connect/screens/NID/NID.js +1 -1
  54. package/build/features/featuresScreens.d.ts +0 -1
  55. package/build/features/featuresScreens.js +0 -7
  56. package/build/features/individual/Individual.js +9 -4
  57. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +3 -3
  58. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  59. package/build/features/individual/screens/Verify/OTPInput.d.ts +3 -1
  60. package/build/features/individual/screens/Verify/OTPInput.js +6 -1
  61. package/build/features/individual/screens/Verify/Verify.js +3 -2
  62. package/build/features/password/Password.js +9 -4
  63. package/build/features/password/screens/CreatePassword/CreatePassword.js +5 -1
  64. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  65. package/build/features/password/screens/Verify/OTPInput.d.ts +3 -1
  66. package/build/features/password/screens/Verify/OTPInput.js +6 -1
  67. package/build/features/password/screens/Verify/Verify.js +3 -2
  68. package/build/features/shared/AcceptancePayouts/AcceptancePayouts.js +1 -1
  69. package/build/features/shared/Background/Background.js +3 -3
  70. package/build/features/shared/Background/LogoBackground.js +1 -4
  71. package/build/features/shared/Button/AbsherButton.d.ts +1 -2
  72. package/build/features/shared/Button/AbsherButton.js +5 -32
  73. package/build/features/shared/Button/EmailProvidersButtons.js +13 -48
  74. package/build/features/shared/Button/FlowsButtons.d.ts +4 -1
  75. package/build/features/shared/Button/FlowsButtons.js +51 -46
  76. package/build/features/shared/Button/MobileButton.d.ts +1 -2
  77. package/build/features/shared/Button/MobileButton.js +3 -29
  78. package/build/features/shared/Button/SuccessButton.js +18 -16
  79. package/build/features/shared/Footer/Footer.js +1 -1
  80. package/build/features/shared/OTP/OTP.d.ts +2 -1
  81. package/build/features/shared/OTP/OTP.js +10 -2
  82. package/build/features/tax/Tax.js +9 -4
  83. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  84. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.d.ts +3 -0
  85. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.js +66 -0
  86. package/build/features/tax/screens/TaxDetails/TaxDetails.js +9 -2
  87. package/build/features/tax/screens/TaxDetails/VATId.js +13 -2
  88. package/build/features/tax/screens/TaxDetails/validation.d.ts +3 -0
  89. package/build/features/tax/screens/TaxDetails/validation.js +2 -1
  90. package/build/features/tax/screens/Verify/OTPInput.d.ts +3 -1
  91. package/build/features/tax/screens/Verify/OTPInput.js +6 -1
  92. package/build/features/tax/screens/Verify/Verify.js +3 -2
  93. package/build/hooks/index.d.ts +1 -0
  94. package/build/hooks/index.js +1 -0
  95. package/build/hooks/useAppConfig.js +11 -1
  96. package/build/hooks/useAppDispatch.d.ts +0 -1
  97. package/build/hooks/useErrorListener.d.ts +1 -1
  98. package/build/hooks/useErrorListener.js +4 -6
  99. package/build/hooks/useStepStartedListener.d.ts +1 -0
  100. package/build/hooks/useStepStartedListener.js +10 -0
  101. package/build/index.d.ts +2 -3
  102. package/build/index.js +2 -5
  103. package/build/theme/theme.js +10 -0
  104. package/build/utils/locale.js +2 -2
  105. package/build/utils/string.d.ts +3 -1
  106. package/build/utils/string.js +35 -2
  107. package/package.json +127 -126
  108. package/build/features/Landing/Landing.d.ts +0 -7
  109. package/build/features/Landing/Landing.js +0 -55
  110. package/build/features/Landing/index.d.ts +0 -1
  111. package/build/features/Landing/index.js +0 -1
  112. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.d.ts +0 -5
  113. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.js +0 -41
  114. package/build/features/Landing/screens/VerifyAndRedirect/index.d.ts +0 -2
  115. package/build/features/Landing/screens/VerifyAndRedirect/index.js +0 -2
  116. package/build/features/app/landing/landingStore.d.ts +0 -22
  117. package/build/features/app/landing/landingStore.js +0 -103
@@ -6,5 +6,4 @@ export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
6
6
  tax: import("../features/app/tax/taxStore").TaxState;
7
7
  individual: import("../features/app/individual/individualStore").IndividualState;
8
8
  password: import("../features/app/password/passwordStore").PasswordState;
9
- landing: import("../features/app/landing/landingStore").LandingState;
10
9
  }, undefined, import("redux").AnyAction> & import("redux").Dispatch<import("redux").AnyAction>;
@@ -1 +1 @@
1
- export declare const useErrorListener: () => void;
1
+ export declare const useErrorListener: (error?: string | null) => void;
@@ -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
  };
@@ -3,11 +3,21 @@ import { typography } from './typography';
3
3
  import { darkPalette, lightPalette } from './palette';
4
4
  import { components } from './components';
5
5
  import { shadows } from './shadows';
6
+ import { isMobile } from 'react-device-detect';
6
7
  export var appTheme = function (mode, dir) {
7
8
  return createTheme({
8
9
  palette: mode === 'dark' ? darkPalette : lightPalette,
9
10
  direction: dir,
10
11
  typography: typography,
12
+ breakpoints: {
13
+ values: {
14
+ xs: 0,
15
+ sm: isMobile ? 1536 : 600,
16
+ md: 900,
17
+ lg: 1200,
18
+ xl: 1536
19
+ }
20
+ },
11
21
  components: components,
12
22
  shape: {
13
23
  borderRadius: 5
@@ -1,7 +1,7 @@
1
1
  import { initReactI18next } from 'react-i18next';
2
2
  import i18n from '../i18n';
3
3
  export var updateLocale = function (locale, country) {
4
- var data = locale[country] || locale['default'];
4
+ var data = locale[country.toUpperCase()] || locale['default'];
5
5
  if (i18n.isInitialized) {
6
6
  i18n.removeResourceBundle('*', 'translation');
7
7
  i18n.addResourceBundle('en', 'translation', data.en.translation);
@@ -9,7 +9,7 @@ export var updateLocale = function (locale, country) {
9
9
  }
10
10
  else {
11
11
  i18n.use(initReactI18next).init({
12
- resources: locale,
12
+ resources: data,
13
13
  fallbackLng: 'en',
14
14
  initImmediate: false,
15
15
  preload: ['ar', 'en'],
@@ -10,7 +10,7 @@ export declare const getIndividualName: (name: string) => {
10
10
  export declare const convertNumbers2English: (str: string) => string;
11
11
  export declare const getParameterByName: (name: string) => string | null;
12
12
  export declare const getClientEmailUrl: () => string;
13
- export declare const getFlowUrl: (path: string) => string;
13
+ export declare const getFlowUrl: (path: string, lang: string) => string;
14
14
  export declare const capitalizeTheFirstLetterOfEachWord: (words: string) => string;
15
15
  export declare const getRequestHeaders: (deviceInfo: DeviceInfo) => {
16
16
  al: string;
@@ -36,3 +36,5 @@ export declare const getRequestHeaders: (deviceInfo: DeviceInfo) => {
36
36
  l: string;
37
37
  };
38
38
  export declare const removeRequestHeaders: () => void;
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,5 +1,7 @@
1
+ import { FlowsTypes } from '../@types';
1
2
  import { encryptString } from '.';
2
3
  import { removeAxiosGlobalHeaders } from '../api';
4
+ import { ENDPOINT_PATHS } from '../constants';
3
5
  export var maskPhone = function (str) {
4
6
  if (str === void 0) { str = ''; }
5
7
  var lastTwo = str.substring(str.length - 2, str.length);
@@ -56,9 +58,9 @@ export var getClientEmailUrl = function () {
56
58
  var origin = window.location.origin;
57
59
  return origin + '/?token=';
58
60
  };
59
- export var getFlowUrl = function (path) {
61
+ export var getFlowUrl = function (path, lang) {
60
62
  var origin = window.location.origin;
61
- return origin + path + '?token=';
63
+ return origin + path + "?lang=".concat(lang, "&token=");
62
64
  };
63
65
  export var capitalizeTheFirstLetterOfEachWord = function (words) {
64
66
  var separateWord = words.toLowerCase().split(' ');
@@ -120,3 +122,34 @@ export var removeRequestHeaders = function () {
120
122
  'authorization'
121
123
  ]);
122
124
  };
125
+ export var getBaseUrl = function () {
126
+ var origin = window.location.origin;
127
+ if (origin.includes('localhost')) {
128
+ return ENDPOINT_PATHS.DEV_BASE_URL;
129
+ }
130
+ if (origin.includes('dev')) {
131
+ return ENDPOINT_PATHS.DEV_BASE_URL;
132
+ }
133
+ if (origin.includes('sandbox')) {
134
+ return ENDPOINT_PATHS.SANDBOX_BASE_URL;
135
+ }
136
+ return ENDPOINT_PATHS.PRODUCTION_BASE_URL;
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,126 +1,127 @@
1
- {
2
- "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.89",
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": "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": "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-dom": "^18.2.0",
96
- "react-hook-form": "^7.33.1",
97
- "react-i18next": "^11.18.1",
98
- "react-otp-input": "^2.4.0",
99
- "react-redux": "^8.0.2",
100
- "react-spring-bottom-sheet": "^3.4.1",
101
- "yup": "^0.32.11"
102
- },
103
- "peerDependencies": {
104
- "react": "^18.2.0",
105
- "react-dom": "^18.2.0"
106
- },
107
- "lint-staged": {
108
- "src/**/*.{ts,tsx,json,js,jsx}": [
109
- "yarn run prettier:fix",
110
- "yarn run lint",
111
- "git add ."
112
- ]
113
- },
114
- "browserslist": {
115
- "production": [
116
- ">0.2%",
117
- "not dead",
118
- "not op_mini all"
119
- ],
120
- "development": [
121
- "last 1 chrome version",
122
- "last 1 firefox version",
123
- "last 1 safari version"
124
- ]
125
- }
126
- }
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;