@developer_tribe/react-native-comnyx 0.3.2 → 0.3.3

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 (179) hide show
  1. package/lib/commonjs/App.js +8 -3
  2. package/lib/commonjs/App.js.map +1 -1
  3. package/lib/commonjs/assets/arrow-right.png +0 -0
  4. package/lib/commonjs/assets/headphones-01.png +0 -0
  5. package/lib/commonjs/assets/iconamoon_clock-fill.png +0 -0
  6. package/lib/commonjs/assets/info-circle.png +0 -0
  7. package/lib/commonjs/assets/message-notification-square.png +0 -0
  8. package/lib/commonjs/assets/x-close.png +0 -0
  9. package/lib/commonjs/components/ChatList.js +355 -50
  10. package/lib/commonjs/components/ChatList.js.map +1 -1
  11. package/lib/commonjs/components/CustomAlert.js +132 -0
  12. package/lib/commonjs/components/CustomAlert.js.map +1 -0
  13. package/lib/commonjs/components/CustomerForm.js +252 -198
  14. package/lib/commonjs/components/CustomerForm.js.map +1 -1
  15. package/lib/commonjs/components/EmptyList.js +36 -11
  16. package/lib/commonjs/components/EmptyList.js.map +1 -1
  17. package/lib/commonjs/components/InitFailed.js +8 -5
  18. package/lib/commonjs/components/InitFailed.js.map +1 -1
  19. package/lib/commonjs/components/MessageInput.js +49 -16
  20. package/lib/commonjs/components/MessageInput.js.map +1 -1
  21. package/lib/commonjs/components/MessageItem.js +133 -42
  22. package/lib/commonjs/components/MessageItem.js.map +1 -1
  23. package/lib/commonjs/components/ScaledSheet.js +67 -0
  24. package/lib/commonjs/components/ScaledSheet.js.map +1 -0
  25. package/lib/commonjs/components/SizeMatter.js +27 -0
  26. package/lib/commonjs/components/SizeMatter.js.map +1 -0
  27. package/lib/commonjs/index.js +7 -0
  28. package/lib/commonjs/index.js.map +1 -1
  29. package/lib/commonjs/store.js +15 -9
  30. package/lib/commonjs/store.js.map +1 -1
  31. package/lib/commonjs/types/Theme.js +20 -2
  32. package/lib/commonjs/types/Theme.js.map +1 -1
  33. package/lib/commonjs/utils/deepMap.js +38 -0
  34. package/lib/commonjs/utils/deepMap.js.map +1 -0
  35. package/lib/commonjs/utils/formatDate.js +16 -0
  36. package/lib/commonjs/utils/formatDate.js.map +1 -0
  37. package/lib/commonjs/utils/scalingUtils.js +33 -0
  38. package/lib/commonjs/utils/scalingUtils.js.map +1 -0
  39. package/lib/commonjs/viewabilityConfig.js +11 -0
  40. package/lib/commonjs/viewabilityConfig.js.map +1 -0
  41. package/lib/module/App.js +8 -3
  42. package/lib/module/App.js.map +1 -1
  43. package/lib/module/assets/arrow-right.png +0 -0
  44. package/lib/module/assets/headphones-01.png +0 -0
  45. package/lib/module/assets/iconamoon_clock-fill.png +0 -0
  46. package/lib/module/assets/info-circle.png +0 -0
  47. package/lib/module/assets/message-notification-square.png +0 -0
  48. package/lib/module/assets/x-close.png +0 -0
  49. package/lib/module/components/ChatList.js +357 -54
  50. package/lib/module/components/ChatList.js.map +1 -1
  51. package/lib/module/components/CustomAlert.js +127 -0
  52. package/lib/module/components/CustomAlert.js.map +1 -0
  53. package/lib/module/components/CustomerForm.js +253 -200
  54. package/lib/module/components/CustomerForm.js.map +1 -1
  55. package/lib/module/components/EmptyList.js +38 -13
  56. package/lib/module/components/EmptyList.js.map +1 -1
  57. package/lib/module/components/InitFailed.js +9 -6
  58. package/lib/module/components/InitFailed.js.map +1 -1
  59. package/lib/module/components/MessageInput.js +50 -17
  60. package/lib/module/components/MessageInput.js.map +1 -1
  61. package/lib/module/components/MessageItem.js +134 -44
  62. package/lib/module/components/MessageItem.js.map +1 -1
  63. package/lib/module/components/ScaledSheet.js +62 -0
  64. package/lib/module/components/ScaledSheet.js.map +1 -0
  65. package/lib/module/components/SizeMatter.js +23 -0
  66. package/lib/module/components/SizeMatter.js.map +1 -0
  67. package/lib/module/index.js +1 -0
  68. package/lib/module/index.js.map +1 -1
  69. package/lib/module/store.js +15 -9
  70. package/lib/module/store.js.map +1 -1
  71. package/lib/module/types/Theme.js +20 -2
  72. package/lib/module/types/Theme.js.map +1 -1
  73. package/lib/module/utils/deepMap.js +34 -0
  74. package/lib/module/utils/deepMap.js.map +1 -0
  75. package/lib/module/utils/formatDate.js +11 -0
  76. package/lib/module/utils/formatDate.js.map +1 -0
  77. package/lib/module/utils/scalingUtils.js +25 -0
  78. package/lib/module/utils/scalingUtils.js.map +1 -0
  79. package/lib/module/viewabilityConfig.js +7 -0
  80. package/lib/module/viewabilityConfig.js.map +1 -0
  81. package/lib/typescript/commonjs/src/App.d.ts +2 -1
  82. package/lib/typescript/commonjs/src/App.d.ts.map +1 -1
  83. package/lib/typescript/commonjs/src/components/ChatList.d.ts +3 -1
  84. package/lib/typescript/commonjs/src/components/ChatList.d.ts.map +1 -1
  85. package/lib/typescript/commonjs/src/components/CustomAlert.d.ts +15 -0
  86. package/lib/typescript/commonjs/src/components/CustomAlert.d.ts.map +1 -0
  87. package/lib/typescript/commonjs/src/components/CustomerForm.d.ts +3 -1
  88. package/lib/typescript/commonjs/src/components/CustomerForm.d.ts.map +1 -1
  89. package/lib/typescript/commonjs/src/components/EmptyList.d.ts.map +1 -1
  90. package/lib/typescript/commonjs/src/components/InitFailed.d.ts.map +1 -1
  91. package/lib/typescript/commonjs/src/components/MessageInput.d.ts +1 -0
  92. package/lib/typescript/commonjs/src/components/MessageInput.d.ts.map +1 -1
  93. package/lib/typescript/commonjs/src/components/MessageItem.d.ts +2 -1
  94. package/lib/typescript/commonjs/src/components/MessageItem.d.ts.map +1 -1
  95. package/lib/typescript/commonjs/src/components/ScaledSheet.d.ts +2 -0
  96. package/lib/typescript/commonjs/src/components/ScaledSheet.d.ts.map +1 -0
  97. package/lib/typescript/commonjs/src/components/SizeMatter.d.ts +7 -0
  98. package/lib/typescript/commonjs/src/components/SizeMatter.d.ts.map +1 -0
  99. package/lib/typescript/commonjs/src/index.d.ts +1 -0
  100. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  101. package/lib/typescript/commonjs/src/store.d.ts +6 -0
  102. package/lib/typescript/commonjs/src/store.d.ts.map +1 -1
  103. package/lib/typescript/commonjs/src/types/Conversation.d.ts +2 -0
  104. package/lib/typescript/commonjs/src/types/Conversation.d.ts.map +1 -1
  105. package/lib/typescript/commonjs/src/types/Theme.d.ts +9 -0
  106. package/lib/typescript/commonjs/src/types/Theme.d.ts.map +1 -1
  107. package/lib/typescript/commonjs/src/utils/deepMap.d.ts +7 -0
  108. package/lib/typescript/commonjs/src/utils/deepMap.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/src/utils/formatDate.d.ts +2 -0
  110. package/lib/typescript/commonjs/src/utils/formatDate.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/src/utils/scalingUtils.d.ts +10 -0
  112. package/lib/typescript/commonjs/src/utils/scalingUtils.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/src/viewabilityConfig.d.ts +5 -0
  114. package/lib/typescript/commonjs/src/viewabilityConfig.d.ts.map +1 -0
  115. package/lib/typescript/module/src/App.d.ts +2 -1
  116. package/lib/typescript/module/src/App.d.ts.map +1 -1
  117. package/lib/typescript/module/src/components/ChatList.d.ts +3 -1
  118. package/lib/typescript/module/src/components/ChatList.d.ts.map +1 -1
  119. package/lib/typescript/module/src/components/CustomAlert.d.ts +15 -0
  120. package/lib/typescript/module/src/components/CustomAlert.d.ts.map +1 -0
  121. package/lib/typescript/module/src/components/CustomerForm.d.ts +3 -1
  122. package/lib/typescript/module/src/components/CustomerForm.d.ts.map +1 -1
  123. package/lib/typescript/module/src/components/EmptyList.d.ts.map +1 -1
  124. package/lib/typescript/module/src/components/InitFailed.d.ts.map +1 -1
  125. package/lib/typescript/module/src/components/MessageInput.d.ts +1 -0
  126. package/lib/typescript/module/src/components/MessageInput.d.ts.map +1 -1
  127. package/lib/typescript/module/src/components/MessageItem.d.ts +2 -1
  128. package/lib/typescript/module/src/components/MessageItem.d.ts.map +1 -1
  129. package/lib/typescript/module/src/components/ScaledSheet.d.ts +2 -0
  130. package/lib/typescript/module/src/components/ScaledSheet.d.ts.map +1 -0
  131. package/lib/typescript/module/src/components/SizeMatter.d.ts +7 -0
  132. package/lib/typescript/module/src/components/SizeMatter.d.ts.map +1 -0
  133. package/lib/typescript/module/src/index.d.ts +1 -0
  134. package/lib/typescript/module/src/index.d.ts.map +1 -1
  135. package/lib/typescript/module/src/store.d.ts +6 -0
  136. package/lib/typescript/module/src/store.d.ts.map +1 -1
  137. package/lib/typescript/module/src/types/Conversation.d.ts +2 -0
  138. package/lib/typescript/module/src/types/Conversation.d.ts.map +1 -1
  139. package/lib/typescript/module/src/types/Theme.d.ts +9 -0
  140. package/lib/typescript/module/src/types/Theme.d.ts.map +1 -1
  141. package/lib/typescript/module/src/utils/deepMap.d.ts +7 -0
  142. package/lib/typescript/module/src/utils/deepMap.d.ts.map +1 -0
  143. package/lib/typescript/module/src/utils/formatDate.d.ts +2 -0
  144. package/lib/typescript/module/src/utils/formatDate.d.ts.map +1 -0
  145. package/lib/typescript/module/src/utils/scalingUtils.d.ts +10 -0
  146. package/lib/typescript/module/src/utils/scalingUtils.d.ts.map +1 -0
  147. package/lib/typescript/module/src/viewabilityConfig.d.ts +5 -0
  148. package/lib/typescript/module/src/viewabilityConfig.d.ts.map +1 -0
  149. package/package.json +1 -1
  150. package/src/App.tsx +4 -2
  151. package/src/assets/arrow-right.png +0 -0
  152. package/src/assets/headphones-01.png +0 -0
  153. package/src/assets/iconamoon_clock-fill.png +0 -0
  154. package/src/assets/info-circle.png +0 -0
  155. package/src/assets/message-notification-square.png +0 -0
  156. package/src/assets/x-close.png +0 -0
  157. package/src/components/ChatList.tsx +413 -60
  158. package/src/components/CustomAlert.tsx +132 -0
  159. package/src/components/CustomerForm.tsx +272 -224
  160. package/src/components/EmptyList.tsx +31 -7
  161. package/src/components/InitFailed.tsx +9 -6
  162. package/src/components/MessageInput.tsx +86 -49
  163. package/src/components/MessageItem.tsx +181 -58
  164. package/src/components/ScaledSheet.ts +93 -0
  165. package/src/components/SizeMatter.tsx +22 -0
  166. package/src/index.tsx +1 -0
  167. package/src/store.ts +13 -3
  168. package/src/types/Conversation.ts +2 -0
  169. package/src/types/Theme.ts +27 -0
  170. package/src/utils/deepMap.ts +47 -0
  171. package/src/utils/formatDate.ts +8 -0
  172. package/src/utils/scalingUtils.ts +27 -0
  173. package/src/viewabilityConfig.ts +4 -0
  174. package/lib/commonjs/assets/double-check.png +0 -0
  175. package/lib/commonjs/assets/send.png +0 -0
  176. package/lib/module/assets/double-check.png +0 -0
  177. package/lib/module/assets/send.png +0 -0
  178. package/src/assets/double-check.png +0 -0
  179. package/src/assets/send.png +0 -0
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _useThemeColors = require("../hooks/useThemeColors.js");
10
+ var _AppText = require("./AppText.js");
11
+ var _ScaledSheet = require("./ScaledSheet.js");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ const infoIcon = require('../assets/info-circle.png');
15
+ function CustomPopup({
16
+ isVisible,
17
+ onClose,
18
+ title,
19
+ description,
20
+ onCancelButton,
21
+ onResendButton,
22
+ buttonText
23
+ }) {
24
+ const themeColors = (0, _useThemeColors.useThemeColors)();
25
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
26
+ visible: isVisible,
27
+ transparent: true,
28
+ onRequestClose: onClose,
29
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
30
+ style: styles.overlay,
31
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
32
+ style: [styles.popup, {
33
+ backgroundColor: themeColors.background
34
+ }],
35
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
36
+ source: infoIcon,
37
+ height: 64,
38
+ width: 64
39
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
40
+ style: styles.title,
41
+ children: title
42
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
43
+ style: [styles.description, {
44
+ color: themeColors.navy
45
+ }],
46
+ children: description
47
+ }), onResendButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
48
+ style: [styles.buttonUp, {
49
+ backgroundColor: themeColors.dark_background
50
+ }],
51
+ onPress: onResendButton,
52
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
53
+ localization: 'customer.form.resend',
54
+ style: [styles.buttonText, {
55
+ color: themeColors.light_text
56
+ }]
57
+ })
58
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
59
+ style: [styles.buttonDown, {
60
+ borderColor: themeColors.dark_background
61
+ }],
62
+ onPress: onCancelButton,
63
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
64
+ localization: buttonText,
65
+ style: [styles.buttonText, {
66
+ color: themeColors.text
67
+ }]
68
+ })
69
+ })]
70
+ })
71
+ })
72
+ });
73
+ }
74
+ const styles = _ScaledSheet.ScaledSheet.create({
75
+ overlay: {
76
+ flex: 1,
77
+ justifyContent: 'center',
78
+ alignItems: 'center',
79
+ backgroundColor: 'rgba(0, 0, 0, 0.60)'
80
+ },
81
+ popup: {
82
+ width: '80%',
83
+ borderRadius: '20@s',
84
+ overflow: 'hidden',
85
+ alignItems: 'center',
86
+ paddingVertical: '20@vs'
87
+ },
88
+ title: {
89
+ marginVertical: '16@vs',
90
+ fontWeight: 700,
91
+ fontSize: '16@vs'
92
+ },
93
+ description: {
94
+ marginBottom: '16@vs',
95
+ alignItems: 'center',
96
+ textAlign: 'center',
97
+ width: '85%',
98
+ fontWeight: 500,
99
+ fontSize: '16@vs'
100
+ },
101
+ buttonText: {
102
+ color: 'white',
103
+ fontSize: '16@vs',
104
+ fontWeight: '600'
105
+ },
106
+ buttonContainer: {
107
+ flexDirection: 'column',
108
+ width: '90%',
109
+ justifyContent: 'center',
110
+ alignItems: 'center'
111
+ },
112
+ buttonUp: {
113
+ borderRadius: '12@s',
114
+ width: '256@s',
115
+ height: '56@vs',
116
+ marginBottom: '16@vs',
117
+ alignItems: 'center',
118
+ justifyContent: 'center'
119
+ },
120
+ buttonDown: {
121
+ backgroundColor: 'transparent',
122
+ borderRadius: '12@s',
123
+ width: '256@s',
124
+ height: '56@vs',
125
+ alignItems: 'center',
126
+ justifyContent: 'center',
127
+ marginBottom: '12@vs',
128
+ borderWidth: 1
129
+ }
130
+ });
131
+ var _default = exports.default = /*#__PURE__*/_react.default.memo(CustomPopup);
132
+ //# sourceMappingURL=CustomAlert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_useThemeColors","_AppText","_ScaledSheet","_jsxRuntime","e","__esModule","default","infoIcon","CustomPopup","isVisible","onClose","title","description","onCancelButton","onResendButton","buttonText","themeColors","useThemeColors","jsx","Modal","visible","transparent","onRequestClose","children","View","style","styles","overlay","jsxs","popup","backgroundColor","background","Image","source","height","width","AppText","color","navy","TouchableOpacity","buttonUp","dark_background","onPress","localization","light_text","buttonDown","borderColor","text","ScaledSheet","create","flex","justifyContent","alignItems","borderRadius","overflow","paddingVertical","marginVertical","fontWeight","fontSize","marginBottom","textAlign","buttonContainer","flexDirection","borderWidth","_default","exports","React","memo"],"sourceRoot":"../../../src","sources":["components/CustomAlert.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA,IAAAI,YAAA,GAAAJ,OAAA;AAA4C,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,E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C,UAAU,EAAE,GAAG;IACfC,QAAQ,EAAE;EACZ,CAAC;EACD9C,WAAW,EAAE;IACX+C,YAAY,EAAE,OAAO;IACrBP,UAAU,EAAE,QAAQ;IACpBQ,SAAS,EAAE,QAAQ;IACnBzB,KAAK,EAAE,KAAK;IACZsB,UAAU,EAAE,GAAG;IACfC,QAAQ,EAAE;EACZ,CAAC;EACD3C,UAAU,EAAE;IACVsB,KAAK,EAAE,OAAO;IACdqB,QAAQ,EAAE,OAAO;IACjBD,UAAU,EAAE;EACd,CAAC;EACDI,eAAe,EAAE;IACfC,aAAa,EAAE,QAAQ;IACvB3B,KAAK,EAAE,KAAK;IACZgB,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE;EACd,CAAC;EACDZ,QAAQ,EAAE;IACRa,YAAY,EAAE,MAAM;IACpBlB,KAAK,EAAE,OAAO;IACdD,MAAM,EAAE,OAAO;IACfyB,YAAY,EAAE,OAAO;IACrBP,UAAU,EAAE,QAAQ;IACpBD,cAAc,EAAE;EAClB,CAAC;EACDN,UAAU,EAAE;IACVf,eAAe,EAAE,aAAa;IAC9BuB,YAAY,EAAE,MAAM;IACpBlB,KAAK,EAAE,OAAO;IACdD,MAAM,EAAE,OAAO;IACfkB,UAAU,EAAE,QAAQ;IACpBD,cAAc,EAAE,QAAQ;IACxBQ,YAAY,EAAE,OAAO;IACrBI,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA3D,OAAA,gBAEY4D,cAAK,CAACC,IAAI,CAAC3D,WAAW,CAAC","ignoreList":[]}
@@ -11,10 +11,16 @@ var _index = require("../api/index.js");
11
11
  var _AppText = require("./AppText.js");
12
12
  var _useLocalize = require("../hooks/useLocalize.js");
13
13
  var _useThemeColors = require("../hooks/useThemeColors.js");
14
+ var _CustomAlert = _interopRequireDefault(require("./CustomAlert.js"));
14
15
  var _react = require("react");
15
- var _countries = require("../constants/countries.js");
16
+ var _ScaledSheet = require("./ScaledSheet.js");
16
17
  var _jsxRuntime = require("react/jsx-runtime");
17
- function CustomerForm() {
18
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
+ const closeIcon = require('../assets/x-close.png');
20
+ const infoIcon = require('../assets/info-circle.png');
21
+ function CustomerForm({
22
+ onBack
23
+ }) {
18
24
  const {
19
25
  control,
20
26
  handleSubmit,
@@ -24,13 +30,17 @@ function CustomerForm() {
24
30
  } = (0, _reactHookForm.useForm)();
25
31
  const themeColors = (0, _useThemeColors.useThemeColors)();
26
32
  const localize = (0, _useLocalize.useLocalize)();
27
- const [isCountryModalVisible, setIsCountryModalVisible] = (0, _react.useState)(false);
28
33
  const inputStyle = {
29
34
  ...styles.input,
30
35
  color: themeColors.text,
31
- borderColor: themeColors.border,
36
+ borderColor: themeColors.gainsboro,
32
37
  backgroundColor: themeColors.background
33
38
  };
39
+ const [popupVisible, setPopupVisible] = (0, _react.useState)(false);
40
+ const [popupContent, setPopupContent] = (0, _react.useState)({
41
+ title: '',
42
+ description: 'null'
43
+ });
34
44
  const onSubmit = async data => {
35
45
  try {
36
46
  const customer = await (0, _index.createCustomer)({
@@ -49,232 +59,245 @@ function CustomerForm() {
49
59
  console.error('Error creating customer:', error);
50
60
  }
51
61
  };
62
+ const showErrorPopup = (title, description) => {
63
+ setPopupVisible(true);
64
+ setPopupContent({
65
+ title: title ?? 'customer.form.failed.name',
66
+ description: description ?? 'customer.form.failed.name.desc'
67
+ });
68
+ };
69
+
70
+ // eslint-disable-next-line react/no-unstable-nested-components
71
+ const InfoButton = ({
72
+ title,
73
+ description
74
+ }) => {
75
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
76
+ onPress: () => showErrorPopup(title, description),
77
+ activeOpacity: 1,
78
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
79
+ source: infoIcon,
80
+ style: styles.infoIcon
81
+ })
82
+ });
83
+ };
52
84
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
53
85
  style: [styles.container, {
54
86
  backgroundColor: themeColors.background
55
87
  }],
56
88
  onPress: _reactNative.Keyboard.dismiss,
57
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
58
- style: styles.headerContainer,
59
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
60
- localization: "customer.form.title",
61
- style: [styles.headerText, {
62
- color: themeColors.text
63
- }]
64
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
65
- localization: "customer.form.instructions",
66
- style: [styles.headerText, {
67
- color: themeColors.text
68
- }]
69
- })]
70
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
71
- control: control,
72
- rules: {
73
- maxLength: {
74
- value: 30,
75
- message: localize('customer.form.validation.name.maxLength')
76
- }
77
- },
78
- render: ({
79
- field: {
80
- onChange,
81
- value
82
- }
83
- }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
84
- style: inputStyle,
85
- placeholder: localize('customer.form.placeholder.name'),
86
- placeholderTextColor: "#6C757D",
87
- value: value,
88
- onChangeText: onChange
89
- }),
90
- name: "name"
91
- }), errors.name && /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
92
- localization: errors.name.message ? undefined : 'customer.form.error',
93
- style: [styles.error, {
94
- color: themeColors.error
95
- }],
96
- children: errors.name.message
97
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
98
- control: control,
99
- rules: {
100
- maxLength: {
101
- value: 2,
102
- message: localize('customer.form.validation.country.maxLength')
103
- }
104
- },
105
- render: ({
106
- field: {
107
- onChange,
108
- value
109
- }
110
- }) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
111
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
112
- style: [styles.input, {
113
- borderColor: themeColors.border,
114
- backgroundColor: themeColors.background,
115
- justifyContent: 'center'
89
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
90
+ contentContainerStyle: styles.scrollContainer,
91
+ keyboardShouldPersistTaps: "handled",
92
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
93
+ style: [styles.container, {
94
+ backgroundColor: themeColors.background
95
+ }],
96
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
97
+ style: [styles.iconContainer, {
98
+ backgroundColor: themeColors.dark_background
116
99
  }],
117
- onPress: () => setIsCountryModalVisible(true),
118
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
119
- style: {
120
- color: value ? themeColors.text : '#6C757D'
121
- },
122
- children: value ? _countries.countries.find(c => c.code === value)?.name : localize('customer.form.placeholder.country')
100
+ onPress: onBack,
101
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
102
+ source: closeIcon,
103
+ style: [styles.closeIcon, {
104
+ tintColor: themeColors.light_text
105
+ }]
123
106
  })
124
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
125
- visible: isCountryModalVisible,
126
- transparent: true,
127
- animationType: "slide",
128
- onRequestClose: () => setIsCountryModalVisible(false),
129
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
130
- style: [styles.modalContainer, {
131
- backgroundColor: 'rgba(0, 0, 0, 0.5)'
107
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
108
+ style: [styles.headerContainer, {
109
+ backgroundColor: themeColors.dark_background
110
+ }],
111
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
112
+ localization: "customer.form.title",
113
+ style: [styles.headerText, {
114
+ color: themeColors.gainsboro
115
+ }]
116
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
117
+ localization: "customer.form.instructions",
118
+ style: [styles.headerText, {
119
+ color: themeColors.light_text
120
+ }]
121
+ })]
122
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
123
+ style: styles.titleContainer,
124
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
125
+ style: [styles.title, {
126
+ color: themeColors.slate
127
+ }],
128
+ children: localize('customer.form.title')
129
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
130
+ control: control,
131
+ rules: {
132
+ maxLength: {
133
+ value: 30,
134
+ message: localize('customer.form.validation.name.maxLength')
135
+ }
136
+ },
137
+ render: ({
138
+ field: {
139
+ onChange,
140
+ value
141
+ }
142
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
143
+ style: [styles.inputContainer, {
144
+ borderBottomColor: themeColors.gainsboro
145
+ }],
146
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
147
+ style: inputStyle,
148
+ placeholder: localize('customer.form.placeholder.name'),
149
+ placeholderTextColor: themeColors.gainsboro,
150
+ value: value,
151
+ onChangeText: onChange
152
+ }), errors.name && /*#__PURE__*/(0, _jsxRuntime.jsx)(InfoButton, {
153
+ title: 'customer.form.failed.name',
154
+ description: 'customer.form.failed.name.desc'
155
+ })]
156
+ }),
157
+ name: "name"
158
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
159
+ style: [styles.title, {
160
+ color: themeColors.slate
132
161
  }],
133
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
134
- style: [styles.modalContent, {
135
- backgroundColor: themeColors.background
162
+ children: "Email"
163
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
164
+ control: control,
165
+ rules: {
166
+ pattern: {
167
+ value: /^\S+@\S+$/i,
168
+ message: localize('customer.form.validation.email.pattern')
169
+ }
170
+ },
171
+ render: ({
172
+ field: {
173
+ onChange,
174
+ value
175
+ }
176
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
177
+ style: [styles.inputContainer, {
178
+ borderBottomColor: themeColors.gainsboro
179
+ }],
180
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
181
+ style: inputStyle,
182
+ placeholder: localize('customer.form.placeholder.email'),
183
+ placeholderTextColor: themeColors.gainsboro,
184
+ value: value,
185
+ onChangeText: onChange,
186
+ keyboardType: "email-address"
187
+ }), errors.email && /*#__PURE__*/(0, _jsxRuntime.jsx)(InfoButton, {
188
+ title: 'customer.form.failed.email',
189
+ description: 'customer.form.failed.email.desc'
190
+ })]
191
+ }),
192
+ name: "email"
193
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
194
+ style: [styles.title, {
195
+ color: themeColors.slate
196
+ }],
197
+ children: "Phone"
198
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
199
+ control: control,
200
+ rules: {
201
+ validate: value => {
202
+ if (!value) return true;
203
+ return typeof value === 'string' || localize('customer.form.validation.phone.invalid');
204
+ }
205
+ },
206
+ render: ({
207
+ field: {
208
+ onChange,
209
+ value
210
+ }
211
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
212
+ style: [styles.inputContainer, {
213
+ borderBottomColor: themeColors.gainsboro
136
214
  }],
137
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.FlatList, {
138
- data: _countries.countries,
139
- keyExtractor: item => item.code,
140
- initialScrollIndex: _countries.countries.findIndex(c => c.code === value),
141
- renderItem: ({
142
- item
143
- }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
144
- style: [styles.countryItem, {
145
- backgroundColor: value === item.code ? themeColors.primary : themeColors.background,
146
- borderBottomColor: themeColors.border
147
- }],
148
- onPress: () => {
149
- onChange(item.code);
150
- setIsCountryModalVisible(false);
151
- },
152
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
153
- style: {
154
- color: value === item.code ? themeColors.background : themeColors.text,
155
- fontSize: 16
156
- },
157
- children: item.name
158
- })
159
- })
160
- })
161
- })
215
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
216
+ style: inputStyle,
217
+ placeholder: localize('customer.form.placeholder.phone'),
218
+ placeholderTextColor: themeColors.gainsboro,
219
+ value: value,
220
+ onChangeText: onChange,
221
+ keyboardType: "phone-pad"
222
+ }), errors.phone && /*#__PURE__*/(0, _jsxRuntime.jsx)(InfoButton, {
223
+ title: 'customer.form.failed.phone',
224
+ description: 'customer.form.failed.phone.desc'
225
+ })]
226
+ }),
227
+ name: "phone"
228
+ })]
229
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
230
+ style: [styles.button, {
231
+ backgroundColor: themeColors.dark_background
232
+ }],
233
+ onPress: handleSubmit(onSubmit),
234
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
235
+ localization: "customer.form.submit",
236
+ style: [styles.buttonText, {
237
+ color: themeColors.light_text
238
+ }]
162
239
  })
163
240
  })]
164
- }),
165
- name: "country"
166
- }), errors.country && /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
167
- localization: errors.country.message ? undefined : 'customer.form.error',
168
- style: [styles.error, {
169
- color: themeColors.error
170
- }],
171
- children: errors.country.message
172
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
173
- control: control,
174
- rules: {
175
- pattern: {
176
- value: /^\S+@\S+$/i,
177
- message: localize('customer.form.validation.email.pattern')
178
- }
179
- },
180
- render: ({
181
- field: {
182
- onChange,
183
- value
184
- }
185
- }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
186
- style: inputStyle,
187
- placeholder: localize('customer.form.placeholder.email'),
188
- placeholderTextColor: "#6C757D",
189
- value: value,
190
- onChangeText: onChange,
191
- keyboardType: "email-address"
192
- }),
193
- name: "email"
194
- }), errors.email && /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
195
- localization: errors.email.message ? undefined : 'customer.form.error',
196
- style: [styles.error, {
197
- color: themeColors.error
198
- }],
199
- children: errors.email.message
200
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
201
- control: control,
202
- rules: {
203
- validate: value => {
204
- if (!value) return true;
205
- return typeof value === 'string' || localize('customer.form.validation.phone.invalid');
206
- }
207
- },
208
- render: ({
209
- field: {
210
- onChange,
211
- value
212
- }
213
- }) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
214
- style: inputStyle,
215
- placeholder: localize('customer.form.placeholder.phone'),
216
- placeholderTextColor: "#6C757D",
217
- value: value,
218
- onChangeText: onChange,
219
- keyboardType: "phone-pad"
220
- }),
221
- name: "phone"
222
- }), errors.phone && /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
223
- localization: errors.phone.message ? undefined : 'customer.form.error',
224
- style: [styles.error, {
225
- color: themeColors.error
226
- }],
227
- children: errors.phone.message
228
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
229
- style: [styles.button, {
230
- backgroundColor: themeColors.primary
231
- }],
232
- onPress: handleSubmit(onSubmit),
233
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppText.AppText, {
234
- localization: "customer.form.submit",
235
- style: styles.buttonText
236
241
  })
242
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomAlert.default, {
243
+ isVisible: popupVisible,
244
+ onClose: () => setPopupVisible(false),
245
+ title: popupContent.title,
246
+ description: popupContent.description,
247
+ onCancelButton: () => {
248
+ setPopupVisible(false);
249
+ setPopupContent({
250
+ title: '',
251
+ description: ''
252
+ });
253
+ },
254
+ onResendButton: () => {
255
+ setPopupVisible(false);
256
+ }
237
257
  })]
238
258
  });
239
259
  }
240
- const styles = _reactNative.StyleSheet.create({
260
+ const styles = _ScaledSheet.ScaledSheet.create({
241
261
  container: {
242
- padding: 24,
262
+ paddingBottom: '24@vs',
243
263
  flex: 1,
244
- justifyContent: 'center'
264
+ justifyContent: 'space-between'
245
265
  },
246
266
  headerContainer: {
247
- marginBottom: 24
267
+ paddingHorizontal: '24@s',
268
+ marginBottom: '24@vs',
269
+ paddingBottom: '32@vs'
248
270
  },
249
271
  headerText: {
250
- fontSize: 15,
272
+ fontSize: '30@vs',
251
273
  fontWeight: '600',
252
- textAlign: 'center'
274
+ textAlign: 'left'
253
275
  },
254
276
  input: {
255
- height: 56,
256
- borderWidth: 1,
257
- borderRadius: 12,
258
- paddingHorizontal: 16,
259
- fontSize: 16,
277
+ borderRadius: '12@s',
278
+ paddingHorizontal: '12@s',
279
+ fontSize: '16@vs',
260
280
  backgroundColor: 'white',
261
- marginBottom: 16
281
+ paddingVertical: '8@vs',
282
+ width: '95%'
262
283
  },
263
284
  button: {
264
- padding: 16,
265
- borderRadius: 12,
285
+ paddingHorizontal: '16@s',
286
+ paddingVertical: '16@vs',
287
+ borderRadius: '12@s',
266
288
  alignItems: 'center',
267
- marginTop: 24
289
+ marginTop: '24@vs',
290
+ marginHorizontal: '20@s'
268
291
  },
269
292
  buttonText: {
270
293
  color: 'white',
271
- fontSize: 16,
294
+ fontSize: '16@vs',
272
295
  fontWeight: '600'
273
296
  },
274
297
  error: {
275
- fontSize: 14,
276
- marginLeft: 16,
277
- top: -16
298
+ fontSize: '14@vs',
299
+ marginLeft: '16@s',
300
+ top: '-16@vs'
278
301
  },
279
302
  modalContainer: {
280
303
  flex: 1,
@@ -284,12 +307,43 @@ const styles = _reactNative.StyleSheet.create({
284
307
  modalContent: {
285
308
  width: '90%',
286
309
  height: '70%',
287
- borderRadius: 12,
310
+ borderRadius: '12@s',
288
311
  overflow: 'hidden'
289
312
  },
290
313
  countryItem: {
291
- padding: 16,
314
+ paddingHorizontal: '16@s',
315
+ paddingVertical: '16@vs',
292
316
  borderBottomWidth: 1
317
+ },
318
+ title: {
319
+ fontSize: '16@vs'
320
+ },
321
+ iconContainer: {
322
+ paddingHorizontal: '20@s',
323
+ paddingVertical: '10@vs'
324
+ },
325
+ inputContainer: {
326
+ flexDirection: 'row',
327
+ alignItems: 'center',
328
+ borderWidth: 1,
329
+ marginBottom: '8@vs'
330
+ },
331
+ closeIcon: {
332
+ width: '24@s',
333
+ height: '24@vs'
334
+ },
335
+ scrollContainer: {
336
+ flexGrow: 1,
337
+ justifyContent: 'space-between'
338
+ },
339
+ infoIcon: {
340
+ width: '24@s',
341
+ height: '24@vs',
342
+ tintColor: 'red'
343
+ },
344
+ titleContainer: {
345
+ marginHorizontal: '20@s',
346
+ flex: 1
293
347
  }
294
348
  });
295
349
  //# sourceMappingURL=CustomerForm.js.map