@tap-payments/auth-jsconnect 1.0.91-test → 1.0.95-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 (134) hide show
  1. package/README.md +58 -52
  2. package/build/@types/app.d.ts +11 -2
  3. package/build/@types/app.js +9 -0
  4. package/build/@types/form.d.ts +2 -0
  5. package/build/api/auth.d.ts +22 -3
  6. package/build/api/axios.d.ts +2 -0
  7. package/build/api/axios.js +64 -0
  8. package/build/api/country.d.ts +1 -2
  9. package/build/api/country.js +7 -8
  10. package/build/api/firebase.d.ts +1 -1
  11. package/build/api/firebase.js +5 -2
  12. package/build/api/index.d.ts +7 -8
  13. package/build/api/ip.d.ts +1 -1
  14. package/build/api/ip.js +5 -2
  15. package/build/api/lead.d.ts +2 -0
  16. package/build/api/operator.d.ts +1 -1
  17. package/build/api/operator.js +60 -4
  18. package/build/app/rootReducer.d.ts +0 -1
  19. package/build/app/rootReducer.js +1 -3
  20. package/build/app/settings.d.ts +9 -12
  21. package/build/app/settings.js +87 -111
  22. package/build/app/store.d.ts +0 -2
  23. package/build/components/AnimationFlow/AnimationFlow.d.ts +2 -1
  24. package/build/components/AnimationFlow/AnimationFlow.js +2 -2
  25. package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
  26. package/build/components/AnimationFlow/BottomSheet.js +16 -4
  27. package/build/components/AnimationFlow/Loader.js +1 -1
  28. package/build/constants/app.d.ts +6 -1
  29. package/build/constants/app.js +16 -12
  30. package/build/features/app/bank/bankStore.d.ts +5 -1
  31. package/build/features/app/bank/bankStore.js +41 -4
  32. package/build/features/app/business/businessStore.d.ts +5 -7
  33. package/build/features/app/business/businessStore.js +44 -46
  34. package/build/features/app/connect/connectStore.d.ts +2 -7
  35. package/build/features/app/connect/connectStore.js +23 -55
  36. package/build/features/app/individual/individualStore.d.ts +6 -7
  37. package/build/features/app/individual/individualStore.js +55 -50
  38. package/build/features/app/password/passwordStore.d.ts +34 -2
  39. package/build/features/app/password/passwordStore.js +218 -8
  40. package/build/features/app/tax/taxStore.d.ts +5 -1
  41. package/build/features/app/tax/taxStore.js +43 -6
  42. package/build/features/bank/Bank.js +8 -7
  43. package/build/features/bank/screens/BankDetails/BankDetails.js +2 -1
  44. package/build/features/bank/screens/BankDetails/ConfirmPolicy.d.ts +3 -0
  45. package/build/features/bank/screens/BankDetails/ConfirmPolicy.js +67 -0
  46. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
  47. package/build/features/bank/screens/BankDetails/validation.js +2 -1
  48. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -4
  49. package/build/features/bank/screens/Verify/OTPInput.d.ts +3 -1
  50. package/build/features/bank/screens/Verify/OTPInput.js +6 -1
  51. package/build/features/bank/screens/Verify/Verify.js +3 -2
  52. package/build/features/business/Business.js +9 -11
  53. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -5
  54. package/build/features/business/screens/Verify/OTPInput.d.ts +3 -1
  55. package/build/features/business/screens/Verify/OTPInput.js +6 -1
  56. package/build/features/business/screens/Verify/Verify.js +3 -2
  57. package/build/features/connect/Connect.js +7 -9
  58. package/build/features/connect/screens/Merchant/BrandName.js +3 -2
  59. package/build/features/connect/screens/Mobile/Mobile.js +1 -1
  60. package/build/features/featuresScreens.d.ts +0 -1
  61. package/build/features/featuresScreens.js +5 -7
  62. package/build/features/individual/Individual.js +9 -11
  63. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +4 -2
  64. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -4
  65. package/build/features/individual/screens/Verify/OTPInput.d.ts +3 -1
  66. package/build/features/individual/screens/Verify/OTPInput.js +6 -1
  67. package/build/features/individual/screens/Verify/Verify.js +3 -2
  68. package/build/features/password/Password.js +16 -9
  69. package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -2
  70. package/build/features/password/screens/OTP/OTP.d.ts +8 -0
  71. package/build/features/password/screens/OTP/OTP.js +78 -0
  72. package/build/features/password/screens/OTP/OTPInput.d.ts +5 -0
  73. package/build/features/password/screens/OTP/OTPInput.js +46 -0
  74. package/build/features/password/screens/OTP/index.d.ts +3 -0
  75. package/build/features/password/screens/OTP/index.js +2 -0
  76. package/build/features/password/screens/OTP/validation.d.ts +8 -0
  77. package/build/features/password/screens/OTP/validation.js +4 -0
  78. package/build/features/password/screens/Success/Success.js +8 -2
  79. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -5
  80. package/build/features/password/screens/Verify/OTPInput.d.ts +3 -1
  81. package/build/features/password/screens/Verify/OTPInput.js +6 -1
  82. package/build/features/password/screens/Verify/Verify.js +3 -2
  83. package/build/features/shared/Background/Background.js +3 -2
  84. package/build/features/shared/Background/LogoBackground.d.ts +1 -4
  85. package/build/features/shared/Background/LogoBackground.js +4 -32
  86. package/build/features/shared/Button/AbsherButton.js +3 -8
  87. package/build/features/shared/Button/EmailProvidersButtons.js +2 -1
  88. package/build/features/shared/Button/FlowsButtons.d.ts +10 -1
  89. package/build/features/shared/Button/FlowsButtons.js +100 -7
  90. package/build/features/shared/Button/MobileButton.js +3 -8
  91. package/build/features/shared/Button/SuccessButton.js +17 -13
  92. package/build/features/shared/Footer/Footer.js +2 -3
  93. package/build/features/shared/OTP/OTP.d.ts +2 -1
  94. package/build/features/shared/OTP/OTP.js +10 -2
  95. package/build/features/tax/Tax.js +7 -6
  96. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -4
  97. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.d.ts +3 -0
  98. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.js +66 -0
  99. package/build/features/tax/screens/TaxDetails/TaxDetails.js +5 -2
  100. package/build/features/tax/screens/TaxDetails/VATId.js +13 -2
  101. package/build/features/tax/screens/TaxDetails/validation.d.ts +3 -0
  102. package/build/features/tax/screens/TaxDetails/validation.js +2 -1
  103. package/build/features/tax/screens/Verify/OTPInput.d.ts +3 -1
  104. package/build/features/tax/screens/Verify/OTPInput.js +6 -1
  105. package/build/features/tax/screens/Verify/Verify.js +3 -2
  106. package/build/hooks/index.d.ts +1 -0
  107. package/build/hooks/index.js +1 -0
  108. package/build/hooks/useAppConfig.d.ts +1 -4
  109. package/build/hooks/useAppConfig.js +13 -110
  110. package/build/hooks/useAppDispatch.d.ts +0 -1
  111. package/build/hooks/useAppTheme.js +3 -2
  112. package/build/hooks/useErrorListener.d.ts +1 -1
  113. package/build/hooks/useErrorListener.js +4 -6
  114. package/build/hooks/useStepStartedListener.d.ts +1 -0
  115. package/build/hooks/useStepStartedListener.js +10 -0
  116. package/build/index.d.ts +2 -3
  117. package/build/index.js +2 -5
  118. package/build/theme/theme.d.ts +1 -1
  119. package/build/theme/theme.js +1 -2
  120. package/build/utils/array.d.ts +3 -0
  121. package/build/utils/array.js +10 -0
  122. package/build/utils/string.d.ts +2 -0
  123. package/build/utils/string.js +23 -0
  124. package/package.json +127 -127
  125. package/build/features/Landing/Landing.d.ts +0 -7
  126. package/build/features/Landing/Landing.js +0 -55
  127. package/build/features/Landing/index.d.ts +0 -1
  128. package/build/features/Landing/index.js +0 -1
  129. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.d.ts +0 -5
  130. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.js +0 -41
  131. package/build/features/Landing/screens/VerifyAndRedirect/index.d.ts +0 -2
  132. package/build/features/Landing/screens/VerifyAndRedirect/index.js +0 -2
  133. package/build/features/app/landing/landingStore.d.ts +0 -22
  134. package/build/features/app/landing/landingStore.js +0 -103
@@ -1,6 +1,7 @@
1
1
  import { useEffect, useState } from 'react';
2
2
  import { LanguageMode, DirectionMode } from '../@types';
3
3
  import { settingsSelector } from '../app/settings';
4
+ import { isMobile } from 'react-device-detect';
4
5
  import { useAppSelector } from './useAppSelector';
5
6
  import { appTheme } from '../theme';
6
7
  export var useAppTheme = function () {
@@ -8,7 +9,7 @@ export var useAppTheme = function () {
8
9
  var data = useAppSelector(settingsSelector).data;
9
10
  useEffect(function () {
10
11
  var dir = data.language === LanguageMode.AR ? DirectionMode.RTL : DirectionMode.LTR;
11
- setTheme(appTheme(data.skin, dir));
12
- }, [data.skin, data.language]);
12
+ setTheme(appTheme(data.skin, isMobile, dir));
13
+ }, [data.skin, data.language, isMobile]);
13
14
  return { theme: theme };
14
15
  };
@@ -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
  };
@@ -1,2 +1,2 @@
1
1
  import { DirectionMode, ThemeMode } from '../@types';
2
- export declare const appTheme: (mode: ThemeMode, dir: DirectionMode) => import("@mui/material/styles").Theme;
2
+ export declare const appTheme: (mode: ThemeMode, isMobile: boolean, dir: DirectionMode) => import("@mui/material/styles").Theme;
@@ -3,8 +3,7 @@ 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';
7
- export var appTheme = function (mode, dir) {
6
+ export var appTheme = function (mode, isMobile, dir) {
8
7
  return createTheme({
9
8
  palette: mode === 'dark' ? darkPalette : lightPalette,
10
9
  direction: dir,
@@ -1,3 +1,4 @@
1
+ import { CountryCode } from '../@types';
1
2
  export declare const isArray: (value: any) => value is any[];
2
3
  export declare const joinArray: (items: Array<any>, joiner?: string) => string;
3
4
  export declare const replaceStringArrayItems: (items: Array<string>, include: string, withThis: string) => string[];
@@ -8,3 +9,5 @@ export declare const isInclude: (items: Array<string | number>, item: any) => bo
8
9
  export declare const findItem: (items: Array<string | number>, key: any) => string | number | undefined;
9
10
  export declare const isExist: (items: Array<any>, id: string) => any;
10
11
  export declare const allAreTruthy: (items: Array<any>, condition: boolean | string, key: string, exclude?: string) => boolean;
12
+ export declare const sortCountries: (countries: Array<CountryCode>) => CountryCode[];
13
+ export declare const findCountryByIso2: (countries: Array<CountryCode>, iso2: string) => CountryCode | undefined;
@@ -53,3 +53,13 @@ export var allAreTruthy = function (items, condition, key, exclude) {
53
53
  return item[key] === condition;
54
54
  });
55
55
  };
56
+ export var sortCountries = function (countries) {
57
+ return (countries || []).sort(function (cOne, cTwo) {
58
+ return cOne.name.english.localeCompare(cTwo.name.english);
59
+ });
60
+ };
61
+ export var findCountryByIso2 = function (countries, iso2) {
62
+ if (!iso2)
63
+ throw new Error('iso2 is required');
64
+ return countries.find(function (country) { return country.iso2.toLowerCase() === iso2.toLowerCase(); });
65
+ };
@@ -11,6 +11,7 @@ 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
13
  export declare const getFlowUrl: (path: string, lang: string) => string;
14
+ export declare const getResetFlowUrl: (path: string, lang: string, operationType: string, leadId: string) => string;
14
15
  export declare const capitalizeTheFirstLetterOfEachWord: (words: string) => string;
15
16
  export declare const getRequestHeaders: (deviceInfo: DeviceInfo) => {
16
17
  al: string;
@@ -37,3 +38,4 @@ export declare const getRequestHeaders: (deviceInfo: DeviceInfo) => {
37
38
  };
38
39
  export declare const removeRequestHeaders: () => void;
39
40
  export declare const getBaseUrl: () => string;
41
+ 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';
@@ -61,6 +62,10 @@ export var getFlowUrl = function (path, lang) {
61
62
  var origin = window.location.origin;
62
63
  return origin + path + "?lang=".concat(lang, "&token=");
63
64
  };
65
+ export var getResetFlowUrl = function (path, lang, operationType, leadId) {
66
+ var origin = window.location.origin;
67
+ return origin + path + "?lang=".concat(lang, "&operation_type=").concat(operationType, "&lead_id=").concat(leadId, "&token=");
68
+ };
64
69
  export var capitalizeTheFirstLetterOfEachWord = function (words) {
65
70
  var separateWord = words.toLowerCase().split(' ');
66
71
  for (var i = 0; i < separateWord.length; i++) {
@@ -134,3 +139,21 @@ export var getBaseUrl = function () {
134
139
  }
135
140
  return ENDPOINT_PATHS.PRODUCTION_BASE_URL;
136
141
  };
142
+ export var getScreenNameBasedOnFlow = function (flow) {
143
+ if (flow === FlowsTypes.BANK) {
144
+ return 'BANK_BANK_DETAILS_STEP';
145
+ }
146
+ if (flow === FlowsTypes.BUSINESS) {
147
+ return 'BUSINESS_BUSINESS_TYPE_STEP';
148
+ }
149
+ if (flow === FlowsTypes.INDIVIDUAL) {
150
+ return 'INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP';
151
+ }
152
+ if (flow === FlowsTypes.CONNECT) {
153
+ return 'CONNECT_NID_STEP';
154
+ }
155
+ if (flow === FlowsTypes.TAX) {
156
+ return 'TAX_TAX_DETAILS_STEP';
157
+ }
158
+ return '';
159
+ };
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.95-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;