@tap-payments/auth-jsconnect 1.0.90-test → 2.0.0

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 (220) hide show
  1. package/README.md +60 -54
  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/account.js +1 -1
  6. package/build/api/auth.js +1 -1
  7. package/build/api/availabilityServices.js +1 -1
  8. package/build/api/axios.js +2 -2
  9. package/build/api/country.js +1 -1
  10. package/build/api/data.js +1 -1
  11. package/build/api/entity.js +1 -1
  12. package/build/api/firebase.js +1 -1
  13. package/build/api/individual.js +1 -1
  14. package/build/api/ip.js +1 -1
  15. package/build/api/lead.js +1 -1
  16. package/build/api/operator.js +1 -1
  17. package/build/app/rootReducer.d.ts +6 -7
  18. package/build/app/rootReducer.js +7 -9
  19. package/build/app/settings.d.ts +3 -3
  20. package/build/app/settings.js +5 -5
  21. package/build/app/store.d.ts +0 -2
  22. package/build/components/AnimationFlow/BottomSheet.js +1 -1
  23. package/build/components/AnimationFlow/Dialog.js +2 -2
  24. package/build/components/DatePicker/DatePicker.js +3 -3
  25. package/build/components/DatePicker/customStyle.css +86 -0
  26. package/build/components/Footer/Footer.d.ts +0 -2
  27. package/build/components/Footer/Footer.js +3 -4
  28. package/build/components/Input/Input.js +2 -2
  29. package/build/components/OTPTimer/OTPTimer.js +1 -1
  30. package/build/components/Providers/ThemeProvider.d.ts +1 -1
  31. package/build/components/SimpleList/SimpleList.js +1 -1
  32. package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +1 -1
  33. package/build/components/SocialMediaGroup/SocialMediaGroup.js +2 -2
  34. package/build/constants/app.d.ts +1 -2
  35. package/build/constants/app.js +1 -9
  36. package/build/features/app/bank/bankStore.d.ts +6 -2
  37. package/build/features/app/bank/bankStore.js +42 -5
  38. package/build/features/app/business/businessStore.d.ts +8 -4
  39. package/build/features/app/business/businessStore.js +41 -6
  40. package/build/features/app/connect/connectStore.d.ts +3 -2
  41. package/build/features/app/connect/connectStore.js +20 -18
  42. package/build/features/app/individual/individualStore.d.ts +6 -2
  43. package/build/features/app/individual/individualStore.js +41 -5
  44. package/build/features/app/password/passwordStore.d.ts +6 -2
  45. package/build/features/app/password/passwordStore.js +41 -5
  46. package/build/features/app/tax/taxStore.d.ts +6 -2
  47. package/build/features/app/tax/taxStore.js +43 -6
  48. package/build/features/bank/Bank.d.ts +1 -1
  49. package/build/features/bank/Bank.js +13 -12
  50. package/build/features/bank/screens/BankDetails/BankDetails.js +10 -9
  51. package/build/features/bank/screens/BankDetails/BankName.js +8 -8
  52. package/build/features/bank/screens/BankDetails/Beneficiary.js +7 -7
  53. package/build/features/bank/screens/BankDetails/ConfirmPolicy.d.ts +3 -0
  54. package/build/features/bank/screens/BankDetails/ConfirmPolicy.js +67 -0
  55. package/build/features/bank/screens/BankDetails/IBAN.js +8 -8
  56. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
  57. package/build/features/bank/screens/BankDetails/validation.js +3 -2
  58. package/build/features/bank/screens/Success/Success.js +3 -3
  59. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -10
  60. package/build/features/bank/screens/Verify/OTPInput.d.ts +3 -1
  61. package/build/features/bank/screens/Verify/OTPInput.js +8 -3
  62. package/build/features/bank/screens/Verify/Verify.js +12 -11
  63. package/build/features/business/Business.d.ts +1 -1
  64. package/build/features/business/Business.js +13 -12
  65. package/build/features/business/screens/Activities/Activities.js +7 -7
  66. package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
  67. package/build/features/business/screens/Activities/ActivitiesList.js +9 -9
  68. package/build/features/business/screens/Activities/OperationStartDate.js +2 -2
  69. package/build/features/business/screens/Activities/SalesChannels.d.ts +1 -1
  70. package/build/features/business/screens/Activities/SalesChannels.js +7 -7
  71. package/build/features/business/screens/BusinessType/BusinessType.js +8 -8
  72. package/build/features/business/screens/BusinessType/LicenseList.js +10 -10
  73. package/build/features/business/screens/BusinessType/LicenseNumber.js +8 -8
  74. package/build/features/business/screens/BusinessType/SelectType.js +6 -6
  75. package/build/features/business/screens/BusinessType/validation.js +2 -2
  76. package/build/features/business/screens/Customers/CustomerLocations.d.ts +1 -1
  77. package/build/features/business/screens/Customers/CustomerLocations.js +8 -8
  78. package/build/features/business/screens/Customers/Customers.js +8 -8
  79. package/build/features/business/screens/Customers/ExpectedCustomers.js +6 -6
  80. package/build/features/business/screens/Customers/ExpectedSalesRange.js +7 -7
  81. package/build/features/business/screens/Customers/RefundPolicy.d.ts +2 -2
  82. package/build/features/business/screens/Customers/RefundPolicy.js +7 -7
  83. package/build/features/business/screens/Customers/TransactionPolicy.js +5 -5
  84. package/build/features/business/screens/IDBOD/DOB.js +5 -5
  85. package/build/features/business/screens/IDBOD/ID.js +6 -6
  86. package/build/features/business/screens/IDBOD/IDBOD.js +6 -6
  87. package/build/features/business/screens/OTP/OTP.js +9 -9
  88. package/build/features/business/screens/OTP/OTPInput.js +4 -4
  89. package/build/features/business/screens/Success/Success.js +3 -3
  90. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -9
  91. package/build/features/business/screens/Verify/OTPInput.d.ts +3 -1
  92. package/build/features/business/screens/Verify/OTPInput.js +8 -3
  93. package/build/features/business/screens/Verify/Verify.js +12 -11
  94. package/build/features/connect/Connect.d.ts +1 -1
  95. package/build/features/connect/Connect.js +13 -11
  96. package/build/features/connect/screens/Individual/Email.js +7 -7
  97. package/build/features/connect/screens/Individual/Individual.js +9 -9
  98. package/build/features/connect/screens/Individual/MobileNumber.d.ts +1 -1
  99. package/build/features/connect/screens/Individual/MobileNumber.js +11 -11
  100. package/build/features/connect/screens/Individual/Name.js +6 -6
  101. package/build/features/connect/screens/Individual/validation.js +1 -1
  102. package/build/features/connect/screens/Merchant/BrandList.d.ts +1 -1
  103. package/build/features/connect/screens/Merchant/BrandList.js +8 -8
  104. package/build/features/connect/screens/Merchant/BrandName.js +10 -10
  105. package/build/features/connect/screens/Merchant/Merchant.js +7 -7
  106. package/build/features/connect/screens/Merchant/SocialMedia.js +9 -9
  107. package/build/features/connect/screens/Merchant/TAC.js +7 -7
  108. package/build/features/connect/screens/Merchant/validation.js +1 -1
  109. package/build/features/connect/screens/Mobile/Mobile.js +10 -10
  110. package/build/features/connect/screens/Mobile/MobileNumber.d.ts +1 -1
  111. package/build/features/connect/screens/Mobile/MobileNumber.js +12 -12
  112. package/build/features/connect/screens/Mobile/Title.js +2 -2
  113. package/build/features/connect/screens/NID/DOB.js +5 -5
  114. package/build/features/connect/screens/NID/IDNumber.js +8 -8
  115. package/build/features/connect/screens/NID/NID.js +9 -9
  116. package/build/features/connect/screens/OTP/OTP.js +9 -9
  117. package/build/features/connect/screens/OTP/OTPInput.js +4 -4
  118. package/build/features/connect/screens/ThankYou/ThankYou.js +3 -3
  119. package/build/features/featuresScreens.d.ts +1 -2
  120. package/build/features/featuresScreens.js +30 -37
  121. package/build/features/individual/Individual.d.ts +1 -1
  122. package/build/features/individual/Individual.js +13 -12
  123. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +8 -8
  124. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerLocation.d.ts +1 -1
  125. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerLocation.js +8 -8
  126. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerName.js +6 -6
  127. package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +6 -6
  128. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.d.ts +1 -1
  129. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +9 -9
  130. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +6 -6
  131. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.d.ts +1 -1
  132. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +8 -8
  133. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +1 -1
  134. package/build/features/individual/screens/ShowIndividualInfo/ShowOwnerInfo.js +6 -6
  135. package/build/features/individual/screens/ShowIndividualInfo/info.js +1 -1
  136. package/build/features/individual/screens/Success/Success.js +3 -3
  137. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -10
  138. package/build/features/individual/screens/Verify/OTPInput.d.ts +3 -1
  139. package/build/features/individual/screens/Verify/OTPInput.js +8 -3
  140. package/build/features/individual/screens/Verify/Verify.js +12 -11
  141. package/build/features/password/Password.d.ts +1 -1
  142. package/build/features/password/Password.js +13 -12
  143. package/build/features/password/screens/CreatePassword/ConditionText.js +1 -1
  144. package/build/features/password/screens/CreatePassword/ConfirmPassword.js +3 -3
  145. package/build/features/password/screens/CreatePassword/CreatePassword.js +7 -7
  146. package/build/features/password/screens/CreatePassword/Password.js +6 -6
  147. package/build/features/password/screens/Success/Success.js +3 -3
  148. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -10
  149. package/build/features/password/screens/Verify/OTPInput.d.ts +3 -1
  150. package/build/features/password/screens/Verify/OTPInput.js +8 -3
  151. package/build/features/password/screens/Verify/Verify.js +12 -11
  152. package/build/features/shared/AcceptancePayouts/AcceptancePayouts.js +4 -4
  153. package/build/features/shared/Background/LogoBackground.js +4 -7
  154. package/build/features/shared/Button/AbsherButton.d.ts +2 -3
  155. package/build/features/shared/Button/AbsherButton.js +7 -12
  156. package/build/features/shared/Button/Button.d.ts +1 -1
  157. package/build/features/shared/Button/Button.js +7 -7
  158. package/build/features/shared/Button/EmailProvidersButtons.d.ts +1 -1
  159. package/build/features/shared/Button/EmailProvidersButtons.js +4 -3
  160. package/build/features/shared/Button/FlowsButtons.d.ts +5 -2
  161. package/build/features/shared/Button/FlowsButtons.js +14 -9
  162. package/build/features/shared/Button/MobileButton.d.ts +2 -3
  163. package/build/features/shared/Button/MobileButton.js +7 -12
  164. package/build/features/shared/Button/SuccessButton.js +1 -1
  165. package/build/features/shared/Footer/Footer.js +5 -5
  166. package/build/features/shared/Input/Input.d.ts +1 -1
  167. package/build/features/shared/Input/Input.js +2 -2
  168. package/build/features/shared/OTP/OTP.d.ts +3 -2
  169. package/build/features/shared/OTP/OTP.js +13 -5
  170. package/build/features/shared/Search/Search.js +1 -1
  171. package/build/features/shared/SearchIcon/SearchIcon.js +2 -2
  172. package/build/features/shared/SuccessScreen/SuccessScreen.js +5 -5
  173. package/build/features/tax/Tax.d.ts +1 -1
  174. package/build/features/tax/Tax.js +13 -12
  175. package/build/features/tax/screens/Success/Success.js +3 -3
  176. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -10
  177. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.d.ts +3 -0
  178. package/build/features/tax/screens/TaxDetails/ConfirmPolicy.js +66 -0
  179. package/build/features/tax/screens/TaxDetails/TaxDetails.js +11 -8
  180. package/build/features/tax/screens/TaxDetails/VATId.js +18 -7
  181. package/build/features/tax/screens/TaxDetails/validation.d.ts +3 -0
  182. package/build/features/tax/screens/TaxDetails/validation.js +2 -1
  183. package/build/features/tax/screens/Verify/OTPInput.d.ts +3 -1
  184. package/build/features/tax/screens/Verify/OTPInput.js +8 -3
  185. package/build/features/tax/screens/Verify/Verify.js +12 -11
  186. package/build/hooks/index.d.ts +1 -0
  187. package/build/hooks/index.js +1 -0
  188. package/build/hooks/useAppConfig.d.ts +1 -1
  189. package/build/hooks/useAppConfig.js +4 -4
  190. package/build/hooks/useAppDispatch.d.ts +0 -1
  191. package/build/hooks/useAppSelector.d.ts +1 -1
  192. package/build/hooks/useAppTheme.d.ts +1 -1
  193. package/build/hooks/useAppTheme.js +3 -3
  194. package/build/hooks/useErrorListener.d.ts +1 -1
  195. package/build/hooks/useErrorListener.js +5 -7
  196. package/build/hooks/useLanguage.js +1 -1
  197. package/build/hooks/useRedirectionListener.js +1 -1
  198. package/build/hooks/useStepStartedListener.d.ts +1 -0
  199. package/build/hooks/useStepStartedListener.js +10 -0
  200. package/build/i18n.js +1 -1
  201. package/build/index.css +135 -0
  202. package/build/index.d.ts +8 -9
  203. package/build/index.js +8 -11
  204. package/build/theme/theme.d.ts +1 -1
  205. package/build/utils/locale.d.ts +1 -1
  206. package/build/utils/locale.js +1 -1
  207. package/build/utils/rsa.js +1 -1
  208. package/build/utils/string.d.ts +2 -1
  209. package/build/utils/string.js +22 -3
  210. package/package.json +1 -1
  211. package/build/features/Landing/Landing.d.ts +0 -7
  212. package/build/features/Landing/Landing.js +0 -55
  213. package/build/features/Landing/index.d.ts +0 -1
  214. package/build/features/Landing/index.js +0 -1
  215. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.d.ts +0 -5
  216. package/build/features/Landing/screens/VerifyAndRedirect/VerifyAndRedirect.js +0 -41
  217. package/build/features/Landing/screens/VerifyAndRedirect/index.d.ts +0 -2
  218. package/build/features/Landing/screens/VerifyAndRedirect/index.js +0 -2
  219. package/build/features/app/landing/landingStore.d.ts +0 -22
  220. package/build/features/app/landing/landingStore.js +0 -103
@@ -1,16 +1,14 @@
1
1
  import { useEffect } from 'react';
2
- import { settingsSelector } from '@app/settings';
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)
@@ -1,5 +1,5 @@
1
1
  import { useTranslation } from 'react-i18next';
2
- import { LanguageMode } from '@types';
2
+ import { LanguageMode } from '../@types';
3
3
  export function useLanguage() {
4
4
  var i18n = useTranslation().i18n;
5
5
  var isAr = i18n.language === LanguageMode.AR;
@@ -1,4 +1,4 @@
1
- import { decodeObjectBase64, getParameterByName } from '@utils';
1
+ import { decodeObjectBase64, getParameterByName } from '../utils';
2
2
  export var useRedirectionData = function (dataKey) {
3
3
  if (dataKey === void 0) { dataKey = 'data'; }
4
4
  var dataToken = getParameterByName(dataKey);
@@ -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/i18n.js CHANGED
@@ -2,7 +2,7 @@ import i18n from 'i18next';
2
2
  import { initReactI18next } from 'react-i18next';
3
3
  import Backend from 'i18next-http-backend';
4
4
  import LanguageDetector from 'i18next-browser-languagedetector';
5
- import { LOCAL_STORAGE_KEYS } from '@constants';
5
+ import { LOCAL_STORAGE_KEYS } from './constants';
6
6
  import translationEN from './assets/locales/en.json';
7
7
  import translationAR from './assets/locales/ar.json';
8
8
  var resources = {
@@ -0,0 +1,135 @@
1
+ @import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap');
2
+ @import url('https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap');
3
+ @import url('https://fonts.googleapis.com/icon?family=Material+Icons');
4
+ @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap');
5
+ @import url('https://fonts.googleapis.com/css?family=Tajawal&display=swap');
6
+
7
+ /* http://meyerweb.com/eric/tools/css/reset/
8
+ v2.0 | 20110126
9
+ License: none (public domain)
10
+ */
11
+
12
+ html,
13
+ body,
14
+ div,
15
+ span,
16
+ applet,
17
+ object,
18
+ iframe,
19
+ h1,
20
+ h2,
21
+ h3,
22
+ h4,
23
+ h5,
24
+ h6,
25
+ p,
26
+ blockquote,
27
+ pre,
28
+ a,
29
+ abbr,
30
+ acronym,
31
+ address,
32
+ big,
33
+ cite,
34
+ code,
35
+ del,
36
+ dfn,
37
+ em,
38
+ img,
39
+ ins,
40
+ kbd,
41
+ q,
42
+ s,
43
+ samp,
44
+ small,
45
+ strike,
46
+ strong,
47
+ sub,
48
+ sup,
49
+ tt,
50
+ var,
51
+ b,
52
+ u,
53
+ i,
54
+ center,
55
+ dl,
56
+ dt,
57
+ dd,
58
+ ol,
59
+ ul,
60
+ li,
61
+ fieldset,
62
+ form,
63
+ label,
64
+ legend,
65
+ table,
66
+ caption,
67
+ tbody,
68
+ tfoot,
69
+ thead,
70
+ tr,
71
+ th,
72
+ td,
73
+ article,
74
+ aside,
75
+ canvas,
76
+ details,
77
+ embed,
78
+ figure,
79
+ figcaption,
80
+ footer,
81
+ header,
82
+ hgroup,
83
+ menu,
84
+ nav,
85
+ output,
86
+ ruby,
87
+ section,
88
+ summary,
89
+ time,
90
+ mark,
91
+ audio,
92
+ video {
93
+ margin: 0;
94
+ padding: 0;
95
+ border: 0;
96
+ font-size: 100%;
97
+ font: inherit;
98
+ vertical-align: baseline;
99
+ }
100
+ /* HTML5 display-role reset for older browsers */
101
+ article,
102
+ aside,
103
+ details,
104
+ figcaption,
105
+ figure,
106
+ footer,
107
+ header,
108
+ hgroup,
109
+ menu,
110
+ nav,
111
+ section {
112
+ display: block;
113
+ }
114
+ body {
115
+ line-height: 1;
116
+ }
117
+ ol,
118
+ ul {
119
+ list-style: none;
120
+ }
121
+ blockquote,
122
+ q {
123
+ quotes: none;
124
+ }
125
+ blockquote:before,
126
+ blockquote:after,
127
+ q:before,
128
+ q:after {
129
+ content: '';
130
+ content: none;
131
+ }
132
+ table {
133
+ border-collapse: collapse;
134
+ border-spacing: 0;
135
+ }
package/build/index.d.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  import './index.css';
2
2
  import './i18n';
3
- import { ConnectLib, renderConnectLib, ConnectLibProps, unmountConnectLib } from '@features/connect';
4
- import { BusinessLib, renderBusinessLib, BusinessLibProps, unmountBusinessLib } from '@features/business';
5
- import { PasswordLib, renderPasswordLib, PasswordLibProps, unmountPasswordLib } from '@features/password';
6
- import { IndividualLib, renderIndividualLib, IndividualLibProps, unmountIndividualLib } from '@features/individual';
7
- import { BankLib, renderBankLib, BankLibProps, unmountBankLib } from '@features/bank';
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 };
3
+ import { ConnectLib, renderConnectLib, ConnectLibProps, unmountConnectLib } from './features/connect';
4
+ import { BusinessLib, renderBusinessLib, BusinessLibProps, unmountBusinessLib } from './features/business';
5
+ import { PasswordLib, renderPasswordLib, PasswordLibProps, unmountPasswordLib } from './features/password';
6
+ import { IndividualLib, renderIndividualLib, IndividualLibProps, unmountIndividualLib } from './features/individual';
7
+ import { BankLib, renderBankLib, BankLibProps, unmountBankLib } from './features/bank';
8
+ import { TaxLib, renderTaxLib, TaxLibProps, unmountTaxLib } from './features/tax';
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
@@ -1,13 +1,12 @@
1
1
  import './index.css';
2
2
  import './i18n';
3
- import { ConnectLib, renderConnectLib, unmountConnectLib } from '@features/connect';
4
- import { BusinessLib, renderBusinessLib, unmountBusinessLib } from '@features/business';
5
- import { PasswordLib, renderPasswordLib, unmountPasswordLib } from '@features/password';
6
- import { IndividualLib, renderIndividualLib, unmountIndividualLib } from '@features/individual';
7
- import { BankLib, renderBankLib, unmountBankLib } from '@features/bank';
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 };
3
+ import { ConnectLib, renderConnectLib, unmountConnectLib } from './features/connect';
4
+ import { BusinessLib, renderBusinessLib, unmountBusinessLib } from './features/business';
5
+ import { PasswordLib, renderPasswordLib, unmountPasswordLib } from './features/password';
6
+ import { IndividualLib, renderIndividualLib, unmountIndividualLib } from './features/individual';
7
+ import { BankLib, renderBankLib, unmountBankLib } from './features/bank';
8
+ import { TaxLib, renderTaxLib, unmountTaxLib } from './features/tax';
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
- import { DirectionMode, ThemeMode } from '@types';
1
+ import { DirectionMode, ThemeMode } from '../@types';
2
2
  export declare const appTheme: (mode: ThemeMode, dir: DirectionMode) => import("@mui/material/styles").Theme;
@@ -1,2 +1,2 @@
1
- import { LocalProps } from '@types';
1
+ import { LocalProps } from '../@types';
2
2
  export declare const updateLocale: (locale: LocalProps, country: string) => void;
@@ -1,5 +1,5 @@
1
1
  import { initReactI18next } from 'react-i18next';
2
- import i18n from '@src/i18n';
2
+ import i18n from '../i18n';
3
3
  export var updateLocale = function (locale, country) {
4
4
  var data = locale[country.toUpperCase()] || locale['default'];
5
5
  if (i18n.isInitialized) {
@@ -1,5 +1,5 @@
1
1
  import { JSEncrypt } from 'jsencrypt';
2
- import { RSA_FRONTEND_MW_PUBLIC_KEY } from '@constants';
2
+ import { RSA_FRONTEND_MW_PUBLIC_KEY } from '../constants';
3
3
  var rsa = new JSEncrypt();
4
4
  rsa.setPublicKey(RSA_FRONTEND_MW_PUBLIC_KEY);
5
5
  export var encryptObject = function (data) {
@@ -1,4 +1,4 @@
1
- import { DeviceInfo } from '@types';
1
+ import { DeviceInfo } from '../@types';
2
2
  export declare const maskPhone: (str?: string) => string;
3
3
  export declare const maskID: (str: string) => string;
4
4
  export declare const showLastFour: (str: string) => string;
@@ -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,6 +1,7 @@
1
- import { encryptString } from '@utils';
2
- import { removeAxiosGlobalHeaders } from '@api';
3
- import { ENDPOINT_PATHS } from '@constants';
1
+ import { FlowsTypes } from '../@types';
2
+ import { encryptString } from '.';
3
+ import { removeAxiosGlobalHeaders } from '../api';
4
+ import { ENDPOINT_PATHS } from '../constants';
4
5
  export var maskPhone = function (str) {
5
6
  if (str === void 0) { str = ''; }
6
7
  var lastTwo = str.substring(str.length - 2, str.length);
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.90-test",
3
+ "version": "2.0.0",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- import { LibConfig } from '@src/@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 '@features/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 '@features/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 '@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; };