@antscorp/antsomi-ui 2.0.107 → 2.0.109

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 (299) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +78 -78
  3. package/es/__mocks__/1000_city.json +802 -802
  4. package/es/__mocks__/sql-query.json +56 -56
  5. package/es/assets/css/main.scss +6 -6
  6. package/es/assets/images/feedback.svg +3 -3
  7. package/es/assets/svg/mobile-frame.svg +3 -3
  8. package/es/assets/svg/warning-icon.svg +5 -5
  9. package/es/components/atoms/Alert/Alert.js +28 -28
  10. package/es/components/atoms/ContentEditable/styled.js +16 -16
  11. package/es/components/atoms/DividerPure/styled.js +35 -35
  12. package/es/components/atoms/Icon/index.js +19 -19
  13. package/es/components/atoms/Iframe/Iframe.js +18 -18
  14. package/es/components/atoms/Input/styled.js +104 -104
  15. package/es/components/atoms/InputDynamic/styled.js +284 -284
  16. package/es/components/atoms/MobileBrandingBar/styled.js +21 -21
  17. package/es/components/atoms/MobileFrame/styled.js +30 -30
  18. package/es/components/atoms/MobileFrameV2/styled.js +42 -42
  19. package/es/components/atoms/MobileFrameV3/styled.js +31 -31
  20. package/es/components/atoms/NotificationStatus/styled.js +10 -10
  21. package/es/components/atoms/PreviewTabs/styled.js +69 -69
  22. package/es/components/atoms/Radio/index.js +16 -16
  23. package/es/components/atoms/ReactIframe/ReactIframe.js +5 -5
  24. package/es/components/atoms/ReactIframe/styled.js +9 -9
  25. package/es/components/atoms/RequiredLabel/styled.js +3 -3
  26. package/es/components/atoms/ScrollBox/index.js +5 -5
  27. package/es/components/atoms/Scrollbars/styled.js +21 -21
  28. package/es/components/atoms/SlideBar/styled.js +194 -194
  29. package/es/components/atoms/Slider/styled.js +31 -31
  30. package/es/components/atoms/Space/Space.js +4 -4
  31. package/es/components/atoms/Spin/styled.js +11 -11
  32. package/es/components/atoms/Steps/styled.js +244 -244
  33. package/es/components/atoms/Switch/styled.js +56 -56
  34. package/es/components/atoms/Tag/Tag.js +10 -10
  35. package/es/components/atoms/Text/styled.js +34 -34
  36. package/es/components/icons/DomainManagementIcon.js +1 -1
  37. package/es/components/icons/LoadingIcon.js +33 -33
  38. package/es/components/icons/document/styled.js +43 -43
  39. package/es/components/index.scss +1 -1
  40. package/es/components/molecules/AccessDenied/styled.js +28 -28
  41. package/es/components/molecules/AccountSelection/styled.js +110 -110
  42. package/es/components/molecules/AddDynamicContent/styled.js +23 -23
  43. package/es/components/molecules/AlignSetting/styled.js +4 -4
  44. package/es/components/molecules/ApplyPopupContent/styled.js +32 -32
  45. package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/styled.js +8 -8
  46. package/es/components/molecules/CalendarSelection/components/CustomPicker/styled.js +79 -79
  47. package/es/components/molecules/CalendarSelection/components/Footer/styled.js +4 -4
  48. package/es/components/molecules/CalendarSelection/components/RangePicker/styled.js +21 -21
  49. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/Option.js +26 -26
  50. package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/styled.js +30 -30
  51. package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/styled.js +26 -26
  52. package/es/components/molecules/CalendarSelection/styled.js +8 -8
  53. package/es/components/molecules/CaptureScreen/components/CommentBox/styled.js +119 -119
  54. package/es/components/molecules/CaptureScreen/components/Cursor/styled.js +67 -67
  55. package/es/components/molecules/CaptureScreen/styled.js +240 -240
  56. package/es/components/molecules/ChartTab/components/styled.js +24 -24
  57. package/es/components/molecules/ChartTab/styled.js +20 -20
  58. package/es/components/molecules/ChatBox/AntsomiAI.js +8 -8
  59. package/es/components/molecules/ChatBox/ChatBoxInsight/QuestionItem.js +9 -9
  60. package/es/components/molecules/ChatBox/ChatBoxInsight/styled.js +365 -365
  61. package/es/components/molecules/ChatBox/styled.js +324 -324
  62. package/es/components/molecules/CodeStructure/styled.js +5 -5
  63. package/es/components/molecules/ColorPicker/ChromePicker/styled.js +10 -10
  64. package/es/components/molecules/ColorPicker/CustomPicker/styled.js +89 -89
  65. package/es/components/molecules/ColorPicker/SketchPicker/styled.js +5 -5
  66. package/es/components/molecules/ColorPicker/styled.js +7 -7
  67. package/es/components/molecules/ColorSetting/styled.js +39 -39
  68. package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.js +110 -110
  69. package/es/components/molecules/DatePickerV2/styled.js +6 -6
  70. package/es/components/molecules/DisplayFormat/styled.js +12 -12
  71. package/es/components/molecules/DrawerDetail/components/ToggleDrawerSizeButton.js +24 -24
  72. package/es/components/molecules/DrawerDetail/styled.js +109 -109
  73. package/es/components/molecules/Dropdown/style.scss +11 -11
  74. package/es/components/molecules/Dropdown/styled.js +28 -28
  75. package/es/components/molecules/EdgeSetting/styled.js +10 -10
  76. package/es/components/molecules/EditableName/styled.js +70 -70
  77. package/es/components/molecules/EditingList/styled.js +29 -29
  78. package/es/components/molecules/EditingListV2/components/List/List.d.ts +1 -1
  79. package/es/components/molecules/EditingListV2/components/List/List.js +16 -7
  80. package/es/components/molecules/EditorTab/styled.js +156 -156
  81. package/es/components/molecules/EmojiCollections/styled.js +22 -22
  82. package/es/components/molecules/EmojiPopover/styled.js +4 -4
  83. package/es/components/molecules/EmptyData/styled.js +53 -53
  84. package/es/components/molecules/FontSizeInput/index.scss +15 -15
  85. package/es/components/molecules/GradientSetting/styled.js +57 -57
  86. package/es/components/molecules/HeaderV2/styled.js +70 -70
  87. package/es/components/molecules/IconSelection/styled.js +69 -69
  88. package/es/components/molecules/ImageEditor/components/ModalShortcut.js +21 -21
  89. package/es/components/molecules/ImageEditor/styled.js +5 -5
  90. package/es/components/molecules/ImagePreview/styled.js +3 -3
  91. package/es/components/molecules/InputNumberWithUnit/styled.js +14 -14
  92. package/es/components/molecules/InputSearch/styled.js +41 -41
  93. package/es/components/molecules/ItemNotFound/styled.js +26 -26
  94. package/es/components/molecules/MatchAnySelect/components/ExtendValuePopup.js +8 -8
  95. package/es/components/molecules/MatchAnySelect/styled.js +247 -247
  96. package/es/components/molecules/Modal/styled.js +63 -63
  97. package/es/components/molecules/ModalSelect/styled.js +152 -152
  98. package/es/components/molecules/ModalV2/styled.js +27 -27
  99. package/es/components/molecules/PopupDraggable/styled.js +57 -57
  100. package/es/components/molecules/PreviewModal/styled.js +26 -26
  101. package/es/components/molecules/ProcessLoading/styled.js +2 -2
  102. package/es/components/molecules/QuillEditor/CustomToolbar.js +3165 -3165
  103. package/es/components/molecules/QuillEditor/EditorToolbar.js +7 -7
  104. package/es/components/molecules/QuillEditor/styled.js +25 -25
  105. package/es/components/molecules/RadioGroup/styled.js +9 -9
  106. package/es/components/molecules/RequestAccess/styled.js +38 -38
  107. package/es/components/molecules/ResizeGrid/components/Cell/styled.js +77 -77
  108. package/es/components/molecules/ResizeGrid/styled.js +50 -50
  109. package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/styled.js +118 -118
  110. package/es/components/molecules/RichMenu/RichMenuBlock/styled.js +13 -13
  111. package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/styled.js +40 -40
  112. package/es/components/molecules/RichMenu/RichMenuChatBar/styled.js +27 -27
  113. package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.js +2 -2
  114. package/es/components/molecules/RichMenu/RichMenuMobileView/styled.js +38 -38
  115. package/es/components/molecules/SearchPopover/components/PopoverSelect/styled.js +36 -36
  116. package/es/components/molecules/SearchPopover/components/PopoverSelect/styles.scss +7 -7
  117. package/es/components/molecules/SearchPopover/styled.js +32 -32
  118. package/es/components/molecules/Select/styled.js +32 -32
  119. package/es/components/molecules/SelectAccount/styled.js +147 -147
  120. package/es/components/molecules/SelectEventAttribute/styled.js +8 -8
  121. package/es/components/molecules/SelectMulti/styled.js +62 -62
  122. package/es/components/molecules/SelectV2/styled.js +124 -124
  123. package/es/components/molecules/SettingWrapper/styled.js +12 -12
  124. package/es/components/molecules/ShareAccess/components/GeneralAccess/styled.js +56 -56
  125. package/es/components/molecules/ShareAccess/components/LayoutContent/styled.js +5 -5
  126. package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/styled.js +15 -15
  127. package/es/components/molecules/ShareAccess/components/PeopleAccess/styled.js +63 -63
  128. package/es/components/molecules/ShareAccess/components/SearchUser/styled.js +31 -31
  129. package/es/components/molecules/SliderWithInputNumber/styled.js +2 -2
  130. package/es/components/molecules/Tabs/Tabs.js +11 -11
  131. package/es/components/molecules/TagifyInput/TagifyInput.js +65 -54
  132. package/es/components/molecules/TagifyInput/constants.d.ts +7 -3
  133. package/es/components/molecules/TagifyInput/constants.js +7 -2
  134. package/es/components/molecules/TagifyInput/patternHandlers.js +34 -1
  135. package/es/components/molecules/TagifyInput/styled.js +37 -37
  136. package/es/components/molecules/TagifyInput/types.d.ts +13 -3
  137. package/es/components/molecules/TagifyInput/utils.d.ts +1 -0
  138. package/es/components/molecules/TagifyInput/utils.js +15 -14
  139. package/es/components/molecules/TagifyInput/utils.style.js +218 -218
  140. package/es/components/molecules/TemplateSaveAs/components/Category/Category.js +5 -5
  141. package/es/components/molecules/TemplateSaveAs/components/ImageSlider/styled.js +276 -276
  142. package/es/components/molecules/TemplateSaveAs/styled.js +134 -134
  143. package/es/components/molecules/ThumbnailCard/styled.js +92 -92
  144. package/es/components/molecules/Tree/styled.js +38 -38
  145. package/es/components/molecules/UnsubscribePreferences/constants.d.ts +27 -0
  146. package/es/components/molecules/UnsubscribePreferences/constants.js +28 -0
  147. package/es/components/molecules/UnsubscribePreferences/index.d.ts +17 -0
  148. package/es/components/molecules/UnsubscribePreferences/index.js +203 -0
  149. package/es/components/molecules/UnsubscribePreferences/styled.d.ts +2 -0
  150. package/es/components/molecules/UnsubscribePreferences/styled.js +11 -0
  151. package/es/components/molecules/UnsubscribePreferences/utils.d.ts +15 -0
  152. package/es/components/molecules/UnsubscribePreferences/utils.js +56 -0
  153. package/es/components/molecules/UnsubscribePreview/components/PreferencesPage/index.d.ts +12 -0
  154. package/es/components/molecules/UnsubscribePreview/components/PreferencesPage/index.js +159 -0
  155. package/es/components/molecules/UnsubscribePreview/components/ResultPage/index.d.ts +13 -0
  156. package/es/components/molecules/UnsubscribePreview/components/ResultPage/index.js +28 -0
  157. package/es/components/molecules/UnsubscribePreview/components/TestAlert/index.d.ts +9 -0
  158. package/es/components/molecules/UnsubscribePreview/components/TestAlert/index.js +18 -0
  159. package/es/components/molecules/UnsubscribePreview/components/UnsubscribedPage/index.d.ts +13 -0
  160. package/es/components/molecules/UnsubscribePreview/components/UnsubscribedPage/index.js +85 -0
  161. package/es/components/molecules/UnsubscribePreview/components/index.d.ts +3 -0
  162. package/es/components/molecules/UnsubscribePreview/components/index.js +3 -0
  163. package/es/components/molecules/UnsubscribePreview/components/styled.d.ts +13 -0
  164. package/es/components/molecules/UnsubscribePreview/components/styled.js +65 -0
  165. package/es/components/molecules/UnsubscribePreview/index.d.ts +10 -0
  166. package/es/components/molecules/UnsubscribePreview/index.js +66 -0
  167. package/es/components/molecules/UnsubscribePreview/styled.d.ts +9 -0
  168. package/es/components/molecules/UnsubscribePreview/styled.js +51 -0
  169. package/es/components/molecules/UnsubscribePreview/type.d.ts +5 -0
  170. package/es/components/molecules/UnsubscribePreview/type.js +1 -0
  171. package/es/components/molecules/UnsubscribePreview/utils.d.ts +9 -0
  172. package/es/components/molecules/UnsubscribePreview/utils.js +27 -0
  173. package/es/components/molecules/UploadImage/index.d.ts +4 -0
  174. package/es/components/molecules/UploadImage/index.js +2 -2
  175. package/es/components/molecules/UploadImage/styled.js +114 -114
  176. package/es/components/molecules/VirtualizedMenu/styled.js +82 -82
  177. package/es/components/molecules/index.d.ts +4 -0
  178. package/es/components/molecules/index.js +2 -0
  179. package/es/components/organism/AccountProfile/components/AccountSetting/components/EditableInput/styles.js +98 -98
  180. package/es/components/organism/AccountProfile/components/AccountSetting/components/LanguageSelector/styles.js +18 -18
  181. package/es/components/organism/AccountProfile/components/AccountSetting/styled.js +543 -543
  182. package/es/components/organism/AccountProfile/components/AccountSetting/styles.scss +39 -39
  183. package/es/components/organism/AccountSharing/styled.js +336 -336
  184. package/es/components/organism/ActivityTimeline/__mocks__/event_tracking.json +1290 -1290
  185. package/es/components/organism/ActivityTimeline/__mocks__/timeline.json +3059 -3059
  186. package/es/components/organism/ActivityTimeline/components/ActionHistory/styled.js +28 -28
  187. package/es/components/organism/ActivityTimeline/components/CardMember/styled.js +60 -60
  188. package/es/components/organism/ActivityTimeline/components/ItemGroupEvent/styled.js +4 -4
  189. package/es/components/organism/ActivityTimeline/components/List/styled.js +77 -77
  190. package/es/components/organism/ActivityTimeline/components/ListItem/styled.js +37 -37
  191. package/es/components/organism/ActivityTimeline/components/ProductCard/styled.js +92 -92
  192. package/es/components/organism/ActivityTimeline/components/Redeem/styled.js +7 -7
  193. package/es/components/organism/ActivityTimeline/components/Slide/styled.js +20 -20
  194. package/es/components/organism/ActivityTimeline/components/TimeLineTitle/styled.js +7 -7
  195. package/es/components/organism/ActivityTimeline/components/TimelineSection/styled.js +69 -69
  196. package/es/components/organism/ActivityTimeline/styled.js +39 -39
  197. package/es/components/organism/AlgorithmsSetting/styled.js +35 -35
  198. package/es/components/organism/BasicLogin/components/ChooseMethod/styled.js +19 -19
  199. package/es/components/organism/BasicLogin/components/LoginWithEmail/styled.js +3 -3
  200. package/es/components/organism/BasicLogin/components/LoginWithGG/styled.js +3 -3
  201. package/es/components/organism/BasicLogin/components/SignIn/styled.js +8 -8
  202. package/es/components/organism/BasicLogin/components/WidgetLayout/styled.js +18 -18
  203. package/es/components/organism/BasicLogin/styled.js +107 -107
  204. package/es/components/organism/ContentSources/styled.js +50 -50
  205. package/es/components/organism/DataTable/components/AddButton/index.js +8 -8
  206. package/es/components/organism/DataTable/components/ModifyColumn/styled.js +18 -18
  207. package/es/components/organism/DataTable/components/Pagination/styled.js +26 -26
  208. package/es/components/organism/DataTable/components/Table/styled.js +135 -135
  209. package/es/components/organism/DataTable/components/Toolbar/SearchPopover.js +17 -17
  210. package/es/components/organism/DataTable/components/Toolbar/styled.js +70 -70
  211. package/es/components/organism/DataTable/styled/index.js +84 -84
  212. package/es/components/organism/Filter/components/FilterCondition/styled.js +34 -34
  213. package/es/components/organism/Filter/styled.js +109 -109
  214. package/es/components/organism/FilterSetting/components/common/InputArray/styled.js +5 -5
  215. package/es/components/organism/FilterSetting/components/common/InputOrSelect/index.js +63 -63
  216. package/es/components/organism/FilterSetting/components/common/InputSelectMulti/ColumnSuggestion/index.js +31 -31
  217. package/es/components/organism/FilterSetting/components/common/InputSelectMulti/Tree/index.js +22 -22
  218. package/es/components/organism/FilterSetting/components/common/InputSelectMulti/index.js +55 -55
  219. package/es/components/organism/FilterSetting/styled.js +19 -19
  220. package/es/components/organism/Help/styled.js +267 -267
  221. package/es/components/organism/LeftMenu/components/HomeMenu/styled.js +39 -39
  222. package/es/components/organism/LeftMenu/components/common/ChildMenu/components/MenuItemImage/styled.js +16 -16
  223. package/es/components/organism/LeftMenu/components/common/ChildMenu/styled.js +156 -156
  224. package/es/components/organism/LeftMenu/styled.js +214 -214
  225. package/es/components/organism/Login/components/ChooseMethod/styled.js +19 -19
  226. package/es/components/organism/Login/components/ForgotPassword/styled.js +8 -8
  227. package/es/components/organism/Login/components/LoginSelectPortal/Item/styled.js +31 -31
  228. package/es/components/organism/Login/components/LoginSelectPortal/styled.js +3 -3
  229. package/es/components/organism/Login/components/LoginWithEmail/styled.js +3 -3
  230. package/es/components/organism/Login/components/LoginWithGG/styled.js +3 -3
  231. package/es/components/organism/Login/components/SetupGGAuthenticator/styled.js +7 -7
  232. package/es/components/organism/Login/components/SignIn/styled.js +8 -8
  233. package/es/components/organism/Login/components/VerifyAccount/styled.js +13 -13
  234. package/es/components/organism/Login/components/WidgetLayout/styled.js +18 -18
  235. package/es/components/organism/Login/styled.js +115 -115
  236. package/es/components/organism/Menu/styled.js +6 -6
  237. package/es/components/organism/ModifyColumnModal/styled.js +132 -132
  238. package/es/components/organism/Notification/styled.js +155 -155
  239. package/es/components/organism/PreviewCollections/Messages/SkeletonMessage/styled.js +14 -14
  240. package/es/components/organism/PreviewCollections/WhatsappMessage/CarouselMessage/styled.js +63 -63
  241. package/es/components/organism/PreviewCollections/WhatsappMessage/FooterMessage/index.js +3 -1
  242. package/es/components/organism/PreviewCollections/constants.js +50 -50
  243. package/es/components/organism/PreviewCollections/styled.js +16 -16
  244. package/es/components/organism/PreviewTemplateModal/components/Banner/styled.js +78 -78
  245. package/es/components/organism/PreviewTemplateModal/components/Information/styled.js +52 -52
  246. package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/styled.js +18 -18
  247. package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/styled.js +77 -77
  248. package/es/components/organism/PreviewTemplateModal/styled.js +21 -21
  249. package/es/components/organism/SQLGeneration/components/styled.js +354 -354
  250. package/es/components/organism/SQLGeneration/index.scss +1 -1
  251. package/es/components/organism/SQLGeneration/integrations/AceEditor/index.scss +4 -4
  252. package/es/components/organism/Table/CrossTabTable/components/CustomCell/styled.js +11 -11
  253. package/es/components/organism/Table/CrossTabTable/styled.js +11 -11
  254. package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/styled.js +17 -17
  255. package/es/components/organism/Table/ExplorePivotTable/styled.js +11 -11
  256. package/es/components/organism/TicketEditor/styled.js +850 -850
  257. package/es/components/organism/TicketEditorV2/styled.js +839 -839
  258. package/es/components/organism/index.scss +1 -1
  259. package/es/components/template/Layout/Layout.js +10 -10
  260. package/es/components/template/Layout/components/RecommendationWorkspace/components/MenuMapping/components/OldLeftMenu/styled.js +73 -73
  261. package/es/components/template/Layout/components/RecommendationWorkspace/components/MenuMapping/styled.js +39 -39
  262. package/es/components/template/Layout/components/RecommendationWorkspace/components/RecommendationImage/styled.js +61 -61
  263. package/es/components/template/Layout/components/RecommendationWorkspace/styled.js +16 -16
  264. package/es/components/template/Layout/styled.js +84 -84
  265. package/es/components/template/TemplateListing/components/BlankTemplate/styled.js +21 -21
  266. package/es/components/template/TemplateListing/components/CategoryListing/styled.js +123 -123
  267. package/es/components/template/TemplateListing/components/Empty/styled.js +20 -20
  268. package/es/components/template/TemplateListing/stories/demo/styled.js +4 -4
  269. package/es/components/template/TemplateListing/styled/index.js +40 -40
  270. package/es/constants/index.d.ts +1 -0
  271. package/es/constants/index.js +1 -0
  272. package/es/constants/queries.d.ts +5 -0
  273. package/es/constants/queries.js +6 -0
  274. package/es/constants/unsubscribe.d.ts +56 -0
  275. package/es/constants/unsubscribe.js +77 -0
  276. package/es/providers/ConfigProvider/GlobalStyle.js +1249 -1249
  277. package/es/queries/Unsubscribe/index.d.ts +5 -0
  278. package/es/queries/Unsubscribe/index.js +5 -0
  279. package/es/queries/Unsubscribe/useGetUnsubscribeList.d.ts +8 -0
  280. package/es/queries/Unsubscribe/useGetUnsubscribeList.js +18 -0
  281. package/es/queries/Unsubscribe/useGetUnsubscribeListByIdentifier.d.ts +8 -0
  282. package/es/queries/Unsubscribe/useGetUnsubscribeListByIdentifier.js +11 -0
  283. package/es/queries/Unsubscribe/useGetUnsubscribeListPermission.d.ts +8 -0
  284. package/es/queries/Unsubscribe/useGetUnsubscribeListPermission.js +17 -0
  285. package/es/queries/Unsubscribe/useGetUnsubscribePreferences.d.ts +23 -0
  286. package/es/queries/Unsubscribe/useGetUnsubscribePreferences.js +26 -0
  287. package/es/services/MediaTemplateDesign/UploadFile/index.js +4 -4
  288. package/es/services/Unsubscribe/index.d.ts +41 -0
  289. package/es/services/Unsubscribe/index.js +78 -0
  290. package/es/styled/common.js +51 -51
  291. package/es/tests/styled.js +4 -4
  292. package/es/types/index.d.ts +1 -0
  293. package/es/types/index.js +1 -0
  294. package/es/types/unsubscribe.d.ts +25 -0
  295. package/es/types/unsubscribe.js +1 -0
  296. package/es/utils/common.d.ts +1 -0
  297. package/es/utils/common.js +3 -0
  298. package/es/utils/variables.js +7 -7
  299. package/package.json +266 -266
@@ -0,0 +1,203 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ // Libraries
3
+ import { useMemo } from 'react';
4
+ import { translate, translations } from '@antscorp/antsomi-locales';
5
+ // Queries
6
+ import { useGetUnsubscribeListPermission } from '@antscorp/antsomi-ui/es/queries/Unsubscribe';
7
+ // Constants
8
+ import { CUSTOM_SEGMENT, LANDING_PAGE_TYPE, UNSUBSCRIBE_LIST_MESSAGE_ERRORS } from './constants';
9
+ import { GLOBAL_UNSUBSCRIBED_LIST, GLOBAL_UNSUBSCRIBED_WHATSAPP, } from '@antscorp/antsomi-ui/es/constants';
10
+ // Utils
11
+ import { buildOptionPreferencesList, buildOptionUnsubscribedList, checkUnsubscribeList, unsubscribeListNotExist, } from './utils';
12
+ import { compareStrings, handleError } from '@antscorp/antsomi-ui/es/utils';
13
+ // Components
14
+ import { EditingListV2, Input, RadioGroup, SelectV2, SettingWrapper, Space, Spin, Switch, UploadImage, } from '../../index';
15
+ import { TextStyled } from './styled';
16
+ const PATH = 'antsomi-ui/src/components/molecules/UnsubscribePreferences/index.tsx';
17
+ export const UnsubscribePreferences = (props) => {
18
+ const { type, apiConfig, unsubscribePreferences, hideLandingPageType, fieldPath = 'settings.unsubscribePreferences', required = ['unsubscribeListId', 'title', 'description'], onChange, } = props;
19
+ const { segmentId, logo, title, description, customLink, haveResubscribeButton, unsubscribeListId, } = unsubscribePreferences || {};
20
+ const preferenceListIds = useMemo(() => Array.isArray(unsubscribePreferences.preferenceListIds)
21
+ ? [...unsubscribePreferences.preferenceListIds]
22
+ : unsubscribePreferences.preferenceListIds
23
+ ? [`${unsubscribePreferences.preferenceListIds}`]
24
+ : [], [unsubscribePreferences.preferenceListIds]);
25
+ const landingPageType = unsubscribePreferences?.landingPageType ||
26
+ (segmentId === CUSTOM_SEGMENT.value
27
+ ? LANDING_PAGE_TYPE.SPECIFIC_LINK.value
28
+ : LANDING_PAGE_TYPE.CUSTOM_PAGE.value);
29
+ const isGlobalUnsubscribedList = [GLOBAL_UNSUBSCRIBED_LIST, GLOBAL_UNSUBSCRIBED_WHATSAPP].some(({ list_id }) => compareStrings(list_id, unsubscribeListId) === 0);
30
+ const { data: unsubscribeDataPermission, isFetching: isLoadingUnsubscribeListPermission } = useGetUnsubscribeListPermission({
31
+ args: {
32
+ data: {
33
+ type,
34
+ portalId: apiConfig.portalId || 0,
35
+ },
36
+ },
37
+ options: {
38
+ enabled: !!apiConfig.portalId,
39
+ },
40
+ }, apiConfig);
41
+ // Memoized
42
+ const unsubscribeList = useMemo(() => {
43
+ if (isLoadingUnsubscribeListPermission)
44
+ return [];
45
+ return unsubscribeDataPermission?.entries[0] || [];
46
+ }, [unsubscribeDataPermission, isLoadingUnsubscribeListPermission]);
47
+ const memoizedUnsubscribedLists = useMemo(() => buildOptionUnsubscribedList(unsubscribeList || [], unsubscribeListId?.toString() || [])?.map(({ list_id, list_name }) => ({
48
+ value: list_id,
49
+ label: list_name,
50
+ })), [unsubscribeList, unsubscribeListId]);
51
+ const memoizedPreferencesLists = useMemo(() => {
52
+ const list = buildOptionPreferencesList(unsubscribeList || [], unsubscribeListId?.toString() || []);
53
+ return ([
54
+ ...(preferenceListIds?.map(key => {
55
+ const select = list?.find(opt => `${opt.key}` === `${key}`);
56
+ if (!select) {
57
+ return {
58
+ value: key,
59
+ label: `[ID - ${key}]`,
60
+ key,
61
+ errorMessage: UNSUBSCRIBE_LIST_MESSAGE_ERRORS.UNAUTHORIZED,
62
+ };
63
+ }
64
+ return null;
65
+ }) || []),
66
+ ...(list || []),
67
+ ]?.filter((item) => Boolean(item)) || []);
68
+ }, [unsubscribeList, unsubscribeListId, preferenceListIds]);
69
+ const { errorMessage: unsubscribeListErrorMessage } = checkUnsubscribeList({
70
+ listUnsubscribe: unsubscribeList || [],
71
+ unsubscribeId: `${unsubscribeListId}`,
72
+ });
73
+ const handleChange = (key, value) => {
74
+ try {
75
+ switch (key) {
76
+ case 'unsubscribeListId': {
77
+ const newPreferenceListIds = buildOptionPreferencesList(unsubscribeList || [], value || [])
78
+ ?.filter(each => !each.errorMessage)
79
+ .map(item => item.value);
80
+ onChange({
81
+ ...unsubscribePreferences,
82
+ unsubscribeListId: value,
83
+ preferenceListIds: newPreferenceListIds,
84
+ }, [
85
+ {
86
+ fieldPath: `${fieldPath}.unsubscribeListId`,
87
+ data: value,
88
+ },
89
+ {
90
+ fieldPath: `${fieldPath}.preferenceListIds`,
91
+ data: newPreferenceListIds,
92
+ },
93
+ ]);
94
+ break;
95
+ }
96
+ case 'landingPageType': {
97
+ onChange({
98
+ ...unsubscribePreferences,
99
+ landingPageType: value,
100
+ }, [
101
+ {
102
+ fieldPath: `${fieldPath}.landingPageType`,
103
+ data: value,
104
+ },
105
+ ]);
106
+ break;
107
+ }
108
+ case 'customLink': {
109
+ onChange({
110
+ ...unsubscribePreferences,
111
+ customLink: value,
112
+ }, [
113
+ {
114
+ fieldPath: `${fieldPath}.customLink`,
115
+ data: value,
116
+ },
117
+ ]);
118
+ break;
119
+ }
120
+ case 'logo': {
121
+ onChange({
122
+ ...unsubscribePreferences,
123
+ logo: value,
124
+ }, [
125
+ {
126
+ fieldPath: `${fieldPath}.logo`,
127
+ data: value,
128
+ },
129
+ ]);
130
+ break;
131
+ }
132
+ case 'title': {
133
+ onChange({
134
+ ...unsubscribePreferences,
135
+ title: value,
136
+ }, [
137
+ {
138
+ fieldPath: `${fieldPath}.title`,
139
+ data: value,
140
+ },
141
+ ]);
142
+ break;
143
+ }
144
+ case 'description': {
145
+ onChange({
146
+ ...unsubscribePreferences,
147
+ description: value,
148
+ }, [
149
+ {
150
+ fieldPath: `${fieldPath}.description`,
151
+ data: value,
152
+ },
153
+ ]);
154
+ break;
155
+ }
156
+ case 'haveResubscribeButton': {
157
+ onChange({
158
+ ...unsubscribePreferences,
159
+ haveResubscribeButton: value,
160
+ }, [
161
+ {
162
+ fieldPath: `${fieldPath}.haveResubscribeButton`,
163
+ data: value,
164
+ },
165
+ ]);
166
+ break;
167
+ }
168
+ case 'preferenceListIds': {
169
+ onChange({
170
+ ...unsubscribePreferences,
171
+ preferenceListIds: value,
172
+ }, [
173
+ {
174
+ fieldPath: `${fieldPath}.preferenceListIds`,
175
+ data: value,
176
+ },
177
+ ]);
178
+ break;
179
+ }
180
+ default:
181
+ break;
182
+ }
183
+ }
184
+ catch (error) {
185
+ handleError(error, {
186
+ path: PATH,
187
+ name: 'handleChange',
188
+ args: { key, value },
189
+ });
190
+ }
191
+ };
192
+ return (_jsxs(Space, { className: "unsubscribe-preferences", size: 20, direction: "vertical", children: [_jsx(SelectV2, { showSearch: true, label: _jsx(TextStyled, { color: "#666666", required: required.includes('unsubscribeListId'), children: translate(translations._TITLE_UNSUBSCRIBED_LIST, 'Unsubscribed list') }), placeholder: translate('', 'Select Unsubscribed List'), loading: isLoadingUnsubscribeListPermission, options: memoizedUnsubscribedLists, value: unsubscribeListNotExist(unsubscribeList, unsubscribeListId?.toString()), errorMsg: unsubscribeListErrorMessage, status: !isLoadingUnsubscribeListPermission && unsubscribeListErrorMessage !== '' ? 'error' : '', onChange: value => {
193
+ handleChange('unsubscribeListId', value);
194
+ } }), !hideLandingPageType && (_jsx(SettingWrapper, { label: translate(translations._TITLE_UNSUBSCRIBE_LANDING_PAGE, 'Landing page'), children: _jsx(RadioGroup, { value: landingPageType, options: Object.values(LANDING_PAGE_TYPE), onChange: e => {
195
+ handleChange('landingPageType', e.target.value);
196
+ } }) })), landingPageType === LANDING_PAGE_TYPE.SPECIFIC_LINK.value ? (_jsxs(Space, { size: 5, direction: "vertical", children: [_jsx(TextStyled, { color: "#666666", required: required.includes('customLink'), children: translate(translations._TITLE_UNSUBSCRIBE_PAGE_URL, 'Page URL') }), _jsx(Input, { value: customLink, placeholder: translate('_', 'Enter text here...'), onAfterChange: value => handleChange('customLink', value) })] })) : (_jsxs(_Fragment, { children: [_jsx(UploadImage, { domainMedia: `${apiConfig.url}`, slug: "", paramConfigs: apiConfig, title: translate('_', 'Logo'), disableRemove: true, isInputMode: false, selectedImage: {
197
+ url: logo,
198
+ }, onChangeImage: image => {
199
+ handleChange('logo', image.url);
200
+ }, onRemoveImage: () => {
201
+ handleChange('logo', '');
202
+ }, required: required.includes('logo') }), _jsxs(Space, { size: 5, direction: "vertical", children: [_jsx(TextStyled, { color: "#666666", required: required.includes('title'), children: translate(translations._TITLE_TICKET_TITLE, 'Title') }), _jsx(Input, { value: title, placeholder: translate('_', 'Enter text here...'), maxLength: 70, onAfterChange: value => handleChange('title', value) })] }), _jsxs(Space, { size: 5, direction: "vertical", children: [_jsx(TextStyled, { color: "#666666", required: required.includes('description'), children: translate(translations._TITL_DESCRIPTION, 'Description') }), _jsx(Input, { value: description, placeholder: translate('_', 'Enter text here...'), maxLength: 255, onAfterChange: value => handleChange('description', value) })] }), isGlobalUnsubscribedList ? (_jsxs(Space, { size: 5, direction: "horizontal", style: { display: 'flex', justifyContent: 'space-between' }, children: [_jsx(TextStyled, { color: "#666666", required: required.includes('haveResubscribeButton'), children: translate(`${translations._TITLE_DISPLAY_RESUBSCRIBE_BUTTON}?`, 'Display Resubscribe button?') }), _jsx(Switch, { checked: haveResubscribeButton || false, onChange: checked => handleChange('haveResubscribeButton', checked) })] })) : (_jsxs(Space, { size: 5, direction: "vertical", children: [_jsx(TextStyled, { color: "#666666", required: required.includes('preferenceListIds'), children: translate(translations._TITLE_PREFERENCES, 'Preferences') }), isLoadingUnsubscribeListPermission ? (_jsx(Spin, { spinning: true, className: "ants-flex ants-justify-center", size: "small" })) : (_jsx(EditingListV2, { className: "ants-mt-2", addButtonLabel: translate(translations._ACT_ADD_UNSUBSCRIBED_LIST, 'Add unsubscribed list'), options: memoizedPreferencesLists, selected: preferenceListIds, onChange: value => handleChange('preferenceListIds', value) }))] }))] }))] }));
203
+ };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const TextStyled: import("styled-components").StyledComponent<import("react").FC<import("../../atoms/Text").TextProps>, any, {}, never>;
@@ -0,0 +1,11 @@
1
+ import styled, { css } from 'styled-components';
2
+ import { Text } from '../../index';
3
+ export const TextStyled = styled(Text) `
4
+ ${({ required }) => required &&
5
+ css `
6
+ &::after {
7
+ content: ' *';
8
+ color: #ef3340;
9
+ }
10
+ `}
11
+ `;
@@ -0,0 +1,15 @@
1
+ import { TUnsubscribeList } from '@antscorp/antsomi-ui/es/types';
2
+ export declare const buildOptionUnsubscribedList: (list: TUnsubscribeList[], selected: any) => TUnsubscribeList[];
3
+ export declare const unsubscribeListNotExist: (options: any, value: any) => any;
4
+ export declare const checkUnsubscribeList: ({ listUnsubscribe, unsubscribeId, }: {
5
+ listUnsubscribe?: any[];
6
+ unsubscribeId?: string;
7
+ }) => {
8
+ errorMessage: string;
9
+ };
10
+ export declare const buildOptionPreferencesList: (list: TUnsubscribeList[], selected: any) => {
11
+ value: string;
12
+ label: string;
13
+ key: string;
14
+ errorMessage: any;
15
+ }[];
@@ -0,0 +1,56 @@
1
+ import { compareStrings } from '@antscorp/antsomi-ui/es/utils';
2
+ import { UNSUBSCRIBE_LIST_MESSAGE_ERRORS, UNSUBSCRIBE_LIST_STATUS } from './constants';
3
+ import { GLOBAL_UNSUBSCRIBED_LIST, GLOBAL_UNSUBSCRIBED_WHATSAPP, } from '@antscorp/antsomi-ui/es/constants';
4
+ export const buildOptionUnsubscribedList = (list, selected) => {
5
+ const arrSelected = Array.isArray(selected) ? selected : [selected];
6
+ const result = list?.filter(each => compareStrings(each.status, UNSUBSCRIBE_LIST_STATUS.ACTIVE) === 0 ||
7
+ arrSelected.includes(each.list_id)) || [];
8
+ return result;
9
+ };
10
+ export const unsubscribeListNotExist = (options, value) => {
11
+ // eslint-disable-next-line no-extra-boolean-cast
12
+ if (!!value) {
13
+ const selected = options?.find(item => compareStrings(item.list_id, value) === 0);
14
+ if (!selected) {
15
+ return `[ID - ${value}]`;
16
+ }
17
+ }
18
+ return value;
19
+ };
20
+ export const checkUnsubscribeList = ({ listUnsubscribe, unsubscribeId, }) => {
21
+ let errorMessage = '';
22
+ const listSelected = listUnsubscribe?.find(({ list_id }) => list_id === unsubscribeId);
23
+ if (listSelected) {
24
+ switch (listSelected.status) {
25
+ case UNSUBSCRIBE_LIST_STATUS.INACTIVE:
26
+ errorMessage = UNSUBSCRIBE_LIST_MESSAGE_ERRORS.DISABLED;
27
+ break;
28
+ default:
29
+ errorMessage = '';
30
+ break;
31
+ }
32
+ }
33
+ else {
34
+ errorMessage = UNSUBSCRIBE_LIST_MESSAGE_ERRORS.UNAUTHORIZED;
35
+ }
36
+ return { errorMessage };
37
+ };
38
+ export const buildOptionPreferencesList = (list, selected) => {
39
+ const arrSelected = Array.isArray(selected) ? selected : [selected];
40
+ const result = list
41
+ ?.filter(each => !arrSelected.includes(each.list_id) &&
42
+ [GLOBAL_UNSUBSCRIBED_LIST, GLOBAL_UNSUBSCRIBED_WHATSAPP].every(({ list_id }) => compareStrings(each.list_id, list_id) !== 0))
43
+ .map(each => {
44
+ let messageError;
45
+ if (compareStrings(each.status, UNSUBSCRIBE_LIST_STATUS.INACTIVE) === 0) {
46
+ messageError = UNSUBSCRIBE_LIST_MESSAGE_ERRORS.DISABLED;
47
+ }
48
+ return {
49
+ value: each.list_id,
50
+ label: each.list_name,
51
+ key: each.list_id,
52
+ errorMessage: messageError,
53
+ };
54
+ }) || [];
55
+ return result;
56
+ };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { TUnsubscribePayloadInfo } from '@antscorp/antsomi-ui/es/services/Unsubscribe';
3
+ import { TUnsubscribeSettings, TUnsubscribeType } from '@antscorp/antsomi-ui/es';
4
+ interface PreferencesProps {
5
+ preferences: TUnsubscribeSettings['unsubscribePreferences'];
6
+ identifier: string[];
7
+ onOptOutAll?: () => void;
8
+ apiConfig: TUnsubscribePayloadInfo;
9
+ type: TUnsubscribeType;
10
+ }
11
+ export declare const Preferences: React.FC<PreferencesProps>;
12
+ export {};
@@ -0,0 +1,159 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Libraries
3
+ import { useEffect, useMemo, useState } from 'react';
4
+ // Icons
5
+ import { DataIcon, UnsubscribeIcon } from '@antscorp/antsomi-ui/es/components/icons';
6
+ // Utils
7
+ import { maskEmail, maskPhone } from '../../utils';
8
+ import { compareStrings } from '@antscorp/antsomi-ui/es/utils';
9
+ // Queries
10
+ import { useGetUnsubscribeList } from '@antscorp/antsomi-ui/es/queries/Unsubscribe';
11
+ // Constants
12
+ import { UNSUBSCRIBE_LIST_STATUS } from '../../../UnsubscribePreferences/constants';
13
+ // Components
14
+ import { Button, EmptyData, Flex, Spin, Typography, } from '@antscorp/antsomi-ui/es';
15
+ import { TestAlert } from '../TestAlert';
16
+ import { CheckboxStyled, Description, Identifier, ListStyled, LogoContainer, LogoImg, Title, Wrapper, } from '../styled';
17
+ import { SpinContainer } from '../../styled';
18
+ export const Preferences = props => {
19
+ const { preferences, identifier, onOptOutAll, apiConfig, type } = props;
20
+ const identifierLabel = useMemo(() => {
21
+ switch (type) {
22
+ case 'sms':
23
+ case 'whatsapp':
24
+ return identifier.length > 1
25
+ ? identifier.map(item => maskPhone(item)).join(', ')
26
+ : maskPhone(identifier[0]);
27
+ default:
28
+ return identifier.length > 1
29
+ ? identifier.map(item => maskEmail(item)).join(', ')
30
+ : maskEmail(identifier[0]);
31
+ }
32
+ }, [type, identifier]);
33
+ const DESCRIPTION = {
34
+ email: 'Please check the types of emails you would like to receive. Uncheck any that you do not wish to subscribe to.',
35
+ sms: 'Select the SMS message types you wish to receive. Uncheck any to stop.',
36
+ whatsapp: 'Select the WhatsApp message types you wish to receive. Uncheck any to stop.',
37
+ };
38
+ const BTN_UNSUBSCRIBE_ALL = {
39
+ email: 'Unsubscribe from all emails',
40
+ sms: 'Unsubscribe from all messages',
41
+ whatsapp: 'Unsubscribe from all messages',
42
+ };
43
+ // Hooks
44
+ const { data: unsubscribeData, isLoading: isLoadingUnsubscribeList, isFetching: isFetchingUnsubscribeList, } = useGetUnsubscribeList({
45
+ args: {
46
+ data: {
47
+ type,
48
+ portalId: Number(apiConfig.portalId),
49
+ },
50
+ },
51
+ options: {
52
+ enabled: !!apiConfig.portalId,
53
+ },
54
+ }, apiConfig);
55
+ // Memo
56
+ const allUnsubscribeList = useMemo(() => unsubscribeData?.entries[0], [unsubscribeData]);
57
+ const preferencesUnsubscribeList = useMemo(() => {
58
+ if (!allUnsubscribeList)
59
+ return [];
60
+ // Lấy listId đang được chọn (mảng hoặc 1 id)
61
+ const prefIds = Array.isArray(preferences.preferenceListIds)
62
+ ? preferences.preferenceListIds
63
+ : preferences.preferenceListIds
64
+ ? [`${preferences.preferenceListIds}`]
65
+ : [];
66
+ // Lọc theo preferenceListIds
67
+ let filtered = allUnsubscribeList.filter(list => prefIds.includes(list.list_id) &&
68
+ compareStrings(list.status, UNSUBSCRIBE_LIST_STATUS.ACTIVE) === 0);
69
+ // Tìm thêm list theo unsubscribeListId
70
+ const unsubscribeItem = allUnsubscribeList.find(list => compareStrings(list.list_id, preferences.unsubscribeListId) === 0 &&
71
+ compareStrings(list.status, UNSUBSCRIBE_LIST_STATUS.ACTIVE) === 0);
72
+ // Nếu có và chưa nằm trong filtered thì thêm vào
73
+ if (unsubscribeItem && !filtered.some(l => l.list_id === unsubscribeItem.list_id)) {
74
+ filtered = [unsubscribeItem, ...filtered];
75
+ }
76
+ return filtered;
77
+ }, [allUnsubscribeList, preferences.preferenceListIds, preferences.unsubscribeListId]);
78
+ // States
79
+ const initialState = {
80
+ isUpdated: false,
81
+ isChanged: false,
82
+ };
83
+ const [preferenceList, setPreferenceList] = useState([]);
84
+ const [pageStatus, setPageStatus] = useState(initialState);
85
+ const { isUpdated, isChanged } = pageStatus;
86
+ // Effects
87
+ useEffect(() => {
88
+ // setState(prevState => ({
89
+ // ...prevState,
90
+ // preferenceList: [
91
+ // ...(preferencesUnsubscribeList || []),
92
+ // // ...(Array.isArray(allUnsubscribeList)
93
+ // // ? allUnsubscribeList?.filter(
94
+ // // list =>
95
+ // // (Array.isArray(preferences.preferenceListIds)
96
+ // // ? [...preferences.preferenceListIds]
97
+ // // : preferences.preferenceListIds
98
+ // // ? [`${preferences.preferenceListIds}`]
99
+ // // : []
100
+ // // )?.includes(list.list_id) &&
101
+ // // compareStrings(list.status, UNSUBSCRIBE_LIST_STATUS.ACTIVE) === 0,
102
+ // // )
103
+ // // : []),
104
+ // ],
105
+ // }));
106
+ setPreferenceList((preferencesUnsubscribeList || []).map(item => ({
107
+ ...item,
108
+ checked: true,
109
+ })));
110
+ }, [preferencesUnsubscribeList, allUnsubscribeList]);
111
+ const onChangeSelectPreference = (event, index) => {
112
+ const { checked } = event.target;
113
+ setPreferenceList(prev => prev.map((item, i) => (i === index ? { ...item, checked } : item)));
114
+ setPageStatus(prev => ({
115
+ ...prev,
116
+ isChanged: true,
117
+ }));
118
+ };
119
+ const onClickSavePreferences = () => {
120
+ // If already updated, do nothing
121
+ if (!isChanged) {
122
+ return;
123
+ }
124
+ const timeout = setTimeout(() => {
125
+ setPageStatus(prevState => ({ ...prevState, isUpdated: true }));
126
+ }, 1000);
127
+ setPageStatus(prevState => ({ ...prevState, isChanged: false }));
128
+ return () => clearTimeout(timeout);
129
+ };
130
+ const onClickOptOutAll = async () => {
131
+ onOptOutAll?.();
132
+ };
133
+ const renderPreferencesList = () => {
134
+ if (isLoadingUnsubscribeList || isFetchingUnsubscribeList) {
135
+ return (_jsx(SpinContainer, { children: _jsx(Spin, { spinning: true }) }));
136
+ }
137
+ return preferenceList?.length > 0 ? (preferenceList?.map((preference, index) => (_jsx(ListStyled.Item, { style: { gap: '9px' }, children: _jsxs(CheckboxStyled, { checked: preference?.checked, className: "ants-flex ants-self-start", onChange: event => onChangeSelectPreference(event, index), style: {
138
+ alignItems: 'flex-start',
139
+ }, children: [_jsx("div", { style: { width: '100%', fontSize: '12px' }, children: preference?.list_name }), _jsx(Typography.Paragraph, { style: { fontSize: '11px', color: '#595959', marginBottom: '0px' }, children: preference?.description })] }) }, preference?.list_id)))) : (_jsx(EmptyData, { style: { marginBottom: '10px' }, icon: _jsx(DataIcon, {}), size: "medium", title: "No data available" }));
140
+ };
141
+ const renderActions = () => {
142
+ if (!preferenceList?.length)
143
+ return null;
144
+ return (_jsxs(Flex, { justify: "space-between", align: "center", style: {
145
+ width: '100%',
146
+ fontSize: '12px',
147
+ paddingTop: 15,
148
+ borderTop: '1px solid #E5E5E5',
149
+ }, children: [_jsx(Button, { type: "primary", onClick: onClickSavePreferences, disabled: !isChanged, children: "Save preferences" }), _jsx(Button, { onClick: onClickOptOutAll, icon: _jsx(UnsubscribeIcon, { color: "#005EB8" }), disabled: preferenceList?.length === 0, children: BTN_UNSUBSCRIBE_ALL[type] })] }));
150
+ };
151
+ return (_jsxs(Wrapper, { children: [_jsx(LogoContainer, { children: _jsx(LogoImg, { src: preferences.logo, alt: "Antsomi Logo" }) }), _jsx(Identifier, { children: identifierLabel }), !isUpdated || isChanged ? (_jsx(Title, { children: "Communication Preference" })) : (_jsx(Title, { style: { color: '#12B800' }, children: "Communication Preferences Updated!" })), _jsx(Description, { style: {
152
+ marginBottom: preferences.haveResubscribeButton || preferenceList?.length > 0 ? '30px' : 0,
153
+ }, children: DESCRIPTION[type] }), _jsx(ListStyled, { style: {
154
+ maxHeight: '400px',
155
+ overflow: 'auto',
156
+ }, header: _jsx("span", {}), children: renderPreferencesList() }), renderActions(), !!preferenceList?.length && (_jsx(TestAlert, { type: type, style: {
157
+ marginTop: !preferences.haveResubscribeButton ? '30px' : '10px',
158
+ } }))] }));
159
+ };
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { RESULT_PAGE_TYPES } from '@antscorp/antsomi-ui/es/constants';
3
+ import { TUnsubscribeSettings, TUnsubscribeType } from '@antscorp/antsomi-ui/es/types';
4
+ type ResultPageType = (typeof RESULT_PAGE_TYPES)[keyof typeof RESULT_PAGE_TYPES];
5
+ interface ResultProps {
6
+ unsubscribeType: TUnsubscribeType;
7
+ type: ResultPageType;
8
+ preferences: TUnsubscribeSettings['unsubscribePreferences'];
9
+ identifier: string[];
10
+ onClickOptIn?: () => void;
11
+ }
12
+ export declare const Result: React.FC<ResultProps>;
13
+ export {};
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Libraries
3
+ import { useMemo } from 'react';
4
+ // Constants
5
+ import { RESULT_PAGE_TYPES, RESULT_PAGE_MESSAGES } from '@antscorp/antsomi-ui/es/constants';
6
+ // Utils
7
+ import { maskEmail, maskPhone } from '../../utils';
8
+ // Components
9
+ import { Button } from '@antscorp/antsomi-ui/es/components';
10
+ import { TestAlert } from '../TestAlert';
11
+ import { Description, Identifier, LogoContainer, LogoImg, TaskAltIconStyled, Title, Wrapper, } from '../styled';
12
+ export const Result = props => {
13
+ const { unsubscribeType, preferences, identifier, type, onClickOptIn } = props;
14
+ const identifierLabel = useMemo(() => {
15
+ switch (unsubscribeType) {
16
+ case 'sms':
17
+ case 'whatsapp':
18
+ return identifier.length > 1
19
+ ? identifier.map(item => maskPhone(item)).join(', ')
20
+ : maskPhone(identifier[0]);
21
+ default:
22
+ return identifier.length > 1
23
+ ? identifier.map(item => maskEmail(item)).join(', ')
24
+ : maskEmail(identifier[0]);
25
+ }
26
+ }, [unsubscribeType, identifier]);
27
+ return (_jsxs(Wrapper, { children: [_jsx(LogoContainer, { children: _jsx(LogoImg, { src: preferences.logo, alt: "Antsomi Logo" }) }), _jsx(Identifier, { style: { textAlign: 'center' }, children: identifierLabel }), _jsx(TaskAltIconStyled, { size: 100, color: "#005EB8", style: { margin: '0px auto 30px' } }), RESULT_PAGE_MESSAGES[type][unsubscribeType].title && (_jsx(Title, { children: RESULT_PAGE_MESSAGES[type][unsubscribeType].title })), _jsx(Description, { style: { marginBottom: 0, textAlign: 'center' }, children: RESULT_PAGE_MESSAGES[type][unsubscribeType].description || '' }), _jsx(TestAlert, { type: unsubscribeType, showIcon: false, justify: "center", className: "ants-text-center !ants-m-[-9px]", style: { margin: '15px 0px' } }), type === RESULT_PAGE_TYPES.OPT_OUT && (_jsx(Button, { style: { height: '30px', width: 'fit-content', margin: '0px auto' }, onClick: onClickOptIn, children: "Opt In + Restore Preferences" }))] }));
28
+ };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { TUnsubscribeType } from '@antscorp/antsomi-ui/es/types';
3
+ import { FlexProps } from '@antscorp/antsomi-ui/es/components';
4
+ interface TestAlertProps extends Omit<FlexProps, 'children'> {
5
+ showIcon?: boolean;
6
+ type: TUnsubscribeType;
7
+ }
8
+ export declare const TestAlert: React.FC<TestAlertProps>;
9
+ export {};
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Libraries
3
+ import { memo } from 'react';
4
+ import classNames from 'classnames';
5
+ // Icons
6
+ import { ViewDetailsInformationIcon } from '@antscorp/antsomi-ui/es/components/icons';
7
+ // Components
8
+ import { Flex } from '@antscorp/antsomi-ui/es/components';
9
+ const TEXT_ALERT = {
10
+ email: 'Unsubscribers from emails are not recorded',
11
+ sms: 'Unsubscribers from SMS messages are not recorded',
12
+ whatsapp: 'Unsubscribers from test WhatsApp messages are not recorded',
13
+ };
14
+ export const TestAlert = memo(({ className, showIcon = true, type, ...props }) => (_jsxs(Flex, { className: classNames(className), gap: 6, align: "center", ...props, children: [showIcon && (_jsx(ViewDetailsInformationIcon, { color: "#005EB8", size: 24, className: "ants-text-primary" })), _jsx("span", { style: {
15
+ fontSize: 11,
16
+ color: '#7F7F7F',
17
+ }, children: TEXT_ALERT[type] })] })));
18
+ TestAlert.displayName = 'TestAlert';
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { TUnsubscribeSettings, TUnsubscribeType } from '@antscorp/antsomi-ui/es/types';
3
+ import { TUnsubscribePayloadInfo } from '@antscorp/antsomi-ui/es/services/Unsubscribe';
4
+ interface UnsubscribedProps {
5
+ preferences: TUnsubscribeSettings['unsubscribePreferences'];
6
+ identifier: string[];
7
+ onViewPreferences?: () => void;
8
+ onResubscribe?: () => void;
9
+ apiConfig: TUnsubscribePayloadInfo;
10
+ type: TUnsubscribeType;
11
+ }
12
+ export declare const Unsubscribed: React.FC<UnsubscribedProps>;
13
+ export {};
@@ -0,0 +1,85 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Libraries
3
+ import { useMemo } from 'react';
4
+ // Utils
5
+ import { maskEmail, maskPhone } from '../../utils';
6
+ import { compareStrings } from '@antscorp/antsomi-ui/es/utils';
7
+ // Constants
8
+ import { UNSUBSCRIBE_LIST_STATUS } from '../../../UnsubscribePreferences/constants';
9
+ import { GLOBAL_UNSUBSCRIBED_LIST, GLOBAL_UNSUBSCRIBED_WHATSAPP, } from '@antscorp/antsomi-ui/es/constants';
10
+ // Icons
11
+ import { DataIcon } from '@antscorp/antsomi-ui/es/components/icons';
12
+ // Queries
13
+ import { useGetUnsubscribeList } from '@antscorp/antsomi-ui/es/queries/Unsubscribe';
14
+ // Components
15
+ import { Button, EmptyData, Flex, Spin, Typography } from '@antscorp/antsomi-ui/es/components';
16
+ import { TestAlert } from '../TestAlert';
17
+ import { Description, Identifier, ListStyled, LogoContainer, LogoImg, Title, Wrapper, } from '../styled';
18
+ export const Unsubscribed = props => {
19
+ const { preferences, identifier, onViewPreferences, onResubscribe, apiConfig, type } = props;
20
+ // Hooks
21
+ const { data: unsubscribeData, isLoading: isLoadingUnsubscribe, isFetching: isFetchingUnsubscribeList, } = useGetUnsubscribeList({
22
+ args: {
23
+ data: {
24
+ type,
25
+ portalId: Number(apiConfig.portalId),
26
+ },
27
+ },
28
+ options: {
29
+ enabled: !!apiConfig.portalId,
30
+ },
31
+ }, apiConfig);
32
+ // Memo
33
+ const isGlobal = useMemo(() => [GLOBAL_UNSUBSCRIBED_LIST, GLOBAL_UNSUBSCRIBED_WHATSAPP].some(({ list_id }) => compareStrings(list_id, preferences.unsubscribeListId) === 0), [preferences.unsubscribeListId]);
34
+ const unsubscribeList = useMemo(() => {
35
+ const unsubscribeDataList = unsubscribeData?.entries[0];
36
+ return (unsubscribeDataList?.find(list => compareStrings(list.list_id, preferences.unsubscribeListId) === 0 &&
37
+ compareStrings(list.status, UNSUBSCRIBE_LIST_STATUS.ACTIVE) === 0) || null);
38
+ }, [unsubscribeData, preferences.unsubscribeListId]);
39
+ const identifierLabel = useMemo(() => {
40
+ switch (type) {
41
+ case 'sms':
42
+ case 'whatsapp':
43
+ return identifier.length > 1
44
+ ? identifier.map(item => maskPhone(item)).join(', ')
45
+ : maskPhone(identifier[0]);
46
+ default:
47
+ return identifier.length > 1
48
+ ? identifier.map(item => maskEmail(item)).join(', ')
49
+ : maskEmail(identifier[0]);
50
+ }
51
+ }, [type, identifier]);
52
+ // Handlers
53
+ const onClickResubscribe = async () => {
54
+ onResubscribe?.();
55
+ };
56
+ const renderUnsubscribedList = () => {
57
+ if (isLoadingUnsubscribe || isFetchingUnsubscribeList) {
58
+ if (isGlobal) {
59
+ return (_jsx("div", { className: "ants-absolute ants-inset-0 ants-h-full ants-top-0 ants-bottom-0 ants-flex ants-justify-center ants-items-center ants-bg-white/70 ants-z-10", children: _jsx(Spin, { spinning: true }) }));
60
+ }
61
+ return (_jsx("div", { className: "ants-my-5 ants-flex ants-justify-center", children: _jsx(Spin, { spinning: true }) }));
62
+ }
63
+ return isGlobal ? null : unsubscribeList ? (_jsx(ListStyled, { header: _jsx("span", {}), children: _jsxs(ListStyled.Item, { children: [_jsx("div", { style: { fontSize: 12 }, children: unsubscribeList?.list_name }), _jsx(Typography.Paragraph, { style: { fontSize: '11px', color: '#595959', marginBottom: '0px' }, children: unsubscribeList?.description })] }) })) : (_jsx(EmptyData, { icon: _jsx(DataIcon, {}), size: "medium", title: "No data available" }));
64
+ };
65
+ const renderActions = () => {
66
+ let actionItem = null;
67
+ if (!isGlobal) {
68
+ actionItem = (_jsx(Button, { type: "primary", className: "!ants-text-[12px] ants-p-2.5", onClick: onViewPreferences, disabled: isLoadingUnsubscribe, children: "View preferences" }));
69
+ }
70
+ if (isGlobal && preferences.haveResubscribeButton) {
71
+ actionItem = (_jsx(Button, { type: "primary", danger: true, className: "ants-color-primary !ants-text-[14px] !ants-p-2.5", onClick: onClickResubscribe, children: "Resubscribe" }));
72
+ }
73
+ if (actionItem) {
74
+ return (_jsx(Flex, { align: "center", justify: "center", style: {
75
+ paddingTop: 15,
76
+ borderTop: '1px solid #E5E5E5',
77
+ }, children: actionItem }));
78
+ }
79
+ };
80
+ return (_jsxs(Wrapper, { style: {
81
+ paddingBottom: isGlobal ? (!preferences.haveResubscribeButton ? '20px' : '10px') : '10px',
82
+ }, children: [_jsx(LogoContainer, { children: _jsx(LogoImg, { src: preferences.logo, alt: "Antsomi Logo" }) }), _jsx(Identifier, { children: identifierLabel }), _jsx(Title, { children: preferences.title }), _jsx(Description, { children: preferences.description }), renderUnsubscribedList(), renderActions(), _jsx(TestAlert, { type: type, showIcon: isGlobal && !preferences.haveResubscribeButton, justify: isGlobal && !preferences.haveResubscribeButton ? 'left' : 'center', style: {
83
+ marginTop: '10px',
84
+ } })] }));
85
+ };
@@ -0,0 +1,3 @@
1
+ export * from './UnsubscribedPage';
2
+ export * from './PreferencesPage';
3
+ export * from './ResultPage';
@@ -0,0 +1,3 @@
1
+ export * from './UnsubscribedPage';
2
+ export * from './PreferencesPage';
3
+ export * from './ResultPage';