@tap-payments/auth-jsconnect 2.5.5 → 2.5.6

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 (92) hide show
  1. package/build/@types/app.d.ts +5 -1
  2. package/build/@types/redux.d.ts +1 -0
  3. package/build/api/data.d.ts +4 -17
  4. package/build/api/data.js +5 -45
  5. package/build/api/entity.d.ts +3 -2
  6. package/build/api/entity.js +12 -4
  7. package/build/api/index.d.ts +5 -21
  8. package/build/components/Providers/ThemeProvider.js +1 -1
  9. package/build/constants/api.d.ts +2 -7
  10. package/build/constants/api.js +5 -15
  11. package/build/constants/app.js +7 -1
  12. package/build/features/app/auth/authStore.js +24 -21
  13. package/build/features/app/bank/bankStore.d.ts +13 -19
  14. package/build/features/app/bank/bankStore.js +183 -165
  15. package/build/features/app/board/boardStore.js +16 -10
  16. package/build/features/app/brand/brandStore.d.ts +17 -31
  17. package/build/features/app/brand/brandStore.js +250 -261
  18. package/build/features/app/business/businessStore.js +16 -16
  19. package/build/features/app/connect/connectStore.js +7 -7
  20. package/build/features/app/connectExpress/connectExpressStore.d.ts +5 -1
  21. package/build/features/app/connectExpress/connectExpressStore.js +64 -27
  22. package/build/features/app/entity/entityStore.d.ts +20 -34
  23. package/build/features/app/entity/entityStore.js +204 -249
  24. package/build/features/app/individual/individualStore.d.ts +17 -36
  25. package/build/features/app/individual/individualStore.js +228 -270
  26. package/build/features/app/password/passwordStore.d.ts +21 -25
  27. package/build/features/app/password/passwordStore.js +203 -220
  28. package/build/features/app/tax/taxStore.d.ts +13 -7
  29. package/build/features/app/tax/taxStore.js +168 -147
  30. package/build/features/auth/Auth.d.ts +0 -2
  31. package/build/features/auth/Auth.js +7 -7
  32. package/build/features/auth/screens/AuthSwitch/AuthSwitch.js +1 -1
  33. package/build/features/bank/Bank.js +5 -3
  34. package/build/features/bank/screens/BankDetails/BankDetails.js +17 -4
  35. package/build/features/board/Board.d.ts +2 -0
  36. package/build/features/board/Board.js +13 -7
  37. package/build/features/board/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  38. package/build/features/board/screens/PrepareDataLoading/PrepareDataLoading.js +10 -0
  39. package/build/features/board/screens/PrepareDataLoading/index.d.ts +2 -0
  40. package/build/features/board/screens/PrepareDataLoading/index.js +2 -0
  41. package/build/features/board/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -2
  42. package/build/features/brand/Brand.js +5 -3
  43. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +2 -2
  44. package/build/features/brand/screens/BrandActivities/BrandActivities.js +48 -11
  45. package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +3 -3
  46. package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +2 -2
  47. package/build/features/brand/screens/BrandInfo/BrandInfo.js +22 -4
  48. package/build/features/brand/screens/BrandSegmentInfo/BrandSegmentInfo.js +22 -6
  49. package/build/features/business/Business.js +5 -3
  50. package/build/features/business/screens/Activities/Activities.js +9 -1
  51. package/build/features/business/screens/Activities/ActivitiesList.d.ts +2 -2
  52. package/build/features/business/screens/Activities/OperationStartDate.d.ts +1 -1
  53. package/build/features/business/screens/BrandDetails/SalesChannel.d.ts +1 -1
  54. package/build/features/business/screens/Customers/CustomerLocations.d.ts +3 -3
  55. package/build/features/business/screens/Customers/Customers.js +9 -1
  56. package/build/features/business/screens/Customers/RefundPolicy.d.ts +2 -2
  57. package/build/features/connect/Connect.js +5 -4
  58. package/build/features/connect/screens/BusinessCountry/BusinessCountry.js +7 -1
  59. package/build/features/connectExpress/ConnectExpress.js +5 -4
  60. package/build/features/entity/Entity.js +5 -3
  61. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +2 -2
  62. package/build/features/entity/screens/EntityCapital/EntityCapital.js +33 -9
  63. package/build/features/entity/screens/EntityName/EntityName.js +31 -14
  64. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +2 -2
  65. package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +1 -1
  66. package/build/features/entity/screens/EntityName/IssuingDate.d.ts +1 -1
  67. package/build/features/featuresScreens.js +5 -0
  68. package/build/features/individual/Individual.js +5 -3
  69. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.d.ts +1 -1
  70. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +43 -10
  71. package/build/features/individual/screens/IndividualList/IndividualList.d.ts +2 -2
  72. package/build/features/individual/screens/IndividualList/IndividualList.js +7 -0
  73. package/build/features/individual/screens/IndividualList/UserList.js +3 -3
  74. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.d.ts +1 -1
  75. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +73 -18
  76. package/build/features/password/Password.js +6 -4
  77. package/build/features/shared/Address/CountryList.d.ts +2 -2
  78. package/build/features/shared/Address/InputSelect.d.ts +2 -2
  79. package/build/features/shared/Button/FlowsButtons.js +10 -2
  80. package/build/features/shared/Input/Input.d.ts +1 -1
  81. package/build/features/signIn/SignIn.js +15 -5
  82. package/build/features/tax/Tax.js +5 -3
  83. package/build/features/tax/screens/TaxDetails/TaxDetails.js +7 -2
  84. package/build/hooks/index.d.ts +1 -0
  85. package/build/hooks/index.js +1 -0
  86. package/build/hooks/useAppConfig.js +1 -1
  87. package/build/hooks/useAppTheme.js +4 -3
  88. package/build/hooks/useFormDirtyCheck.d.ts +10 -0
  89. package/build/hooks/useFormDirtyCheck.js +66 -0
  90. package/build/theme/theme.d.ts +1 -1
  91. package/build/theme/theme.js +2 -2
  92. package/package.json +1 -1
@@ -0,0 +1,66 @@
1
+ import React from 'react';
2
+ import _ from 'lodash';
3
+ export var useFormDirtyCheck = function (method, backendData, customAttrs) {
4
+ var _a = React.useState(false), isDirty = _a[0], setIsDirty = _a[1];
5
+ var data = method.watch();
6
+ var isValidData = function (formValue, backendValue) {
7
+ if (_.isUndefined(formValue))
8
+ return false;
9
+ if (_.isArray(formValue) && formValue.length === 0)
10
+ return false;
11
+ if (_.isObject(formValue) && _.isEmpty(formValue))
12
+ return false;
13
+ if (formValue === '' && !backendValue)
14
+ return false;
15
+ return true;
16
+ };
17
+ var isArray = function (data, backendData) {
18
+ return backendData && data && _.isArray(backendData) && _.isArray(data);
19
+ };
20
+ var isObject = function (data, backendData) {
21
+ return backendData && data && _.isObject(data) && _.isObject(backendData);
22
+ };
23
+ var mapArrayOfObjectWithKeys = function (items, keys) {
24
+ return _.map(items, function (item) { return _.pick(item, keys); });
25
+ };
26
+ var mapObjectWithKeys = function (item, keys) {
27
+ return _.pick(item, keys);
28
+ };
29
+ var deepComparison = function (data, backendData, customAttrs) {
30
+ var _loop_1 = function (key) {
31
+ var formValue = data === null || data === void 0 ? void 0 : data[key];
32
+ var backEndValue = backendData === null || backendData === void 0 ? void 0 : backendData[key];
33
+ if (!isValidData(formValue, backEndValue))
34
+ return "continue";
35
+ var customAttr = customAttrs === null || customAttrs === void 0 ? void 0 : customAttrs.find(function (el) { return el.name === key; });
36
+ if (customAttr) {
37
+ var keys = customAttr.keys;
38
+ if (isArray(formValue, backEndValue)) {
39
+ formValue = mapArrayOfObjectWithKeys(formValue, keys);
40
+ backEndValue = mapArrayOfObjectWithKeys(backEndValue, keys);
41
+ if (formValue.length !== backEndValue.length)
42
+ return { value: true };
43
+ if (_.differenceWith(formValue, backEndValue, _.isEqual).length > 0)
44
+ return { value: true };
45
+ }
46
+ if (isObject(formValue, backEndValue)) {
47
+ formValue = mapObjectWithKeys(formValue, keys);
48
+ backEndValue = mapObjectWithKeys(backEndValue, keys);
49
+ }
50
+ }
51
+ if (!_.isEqual(formValue, backEndValue))
52
+ return { value: true };
53
+ };
54
+ for (var key in backendData) {
55
+ var state_1 = _loop_1(key);
56
+ if (typeof state_1 === "object")
57
+ return state_1.value;
58
+ }
59
+ return false;
60
+ };
61
+ React.useEffect(function () {
62
+ var isDirty = deepComparison(data, backendData, customAttrs);
63
+ setIsDirty(isDirty);
64
+ }, [data, backendData]);
65
+ return { isDirty: isDirty };
66
+ };
@@ -1,2 +1,2 @@
1
1
  import { DirectionMode, ThemeMode } from '../@types';
2
- export declare const appTheme: (mode: ThemeMode, isMobile: boolean, dir: DirectionMode) => import("@mui/material/styles").Theme;
2
+ export declare const appTheme: (mode: ThemeMode, dir: DirectionMode, isSmallScreen: boolean) => import("@mui/material/styles").Theme;
@@ -3,7 +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
- export var appTheme = function (mode, isMobile, dir) {
6
+ export var appTheme = function (mode, dir, isSmallScreen) {
7
7
  return createTheme({
8
8
  palette: mode === 'dark' ? darkPalette : lightPalette,
9
9
  direction: dir,
@@ -11,7 +11,7 @@ export var appTheme = function (mode, isMobile, dir) {
11
11
  breakpoints: {
12
12
  values: {
13
13
  xs: 0,
14
- sm: isMobile ? 1536 : 600,
14
+ sm: isSmallScreen ? 1536 : 600,
15
15
  md: 900,
16
16
  lg: 1200,
17
17
  xl: 1536
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.5.5",
3
+ "version": "2.5.6",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",