@capillarytech/creatives-library 8.0.136-alpha.4 → 8.0.136-beta.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 (292) hide show
  1. package/components/BreadCrumbs/index.js +65 -0
  2. package/components/BreadCrumbs/messages.js +13 -0
  3. package/components/CapTagList/index.js +235 -0
  4. package/components/CapTagList/messages.js +45 -0
  5. package/components/Card/_customCard.scss +40 -0
  6. package/components/Card/index.js +78 -0
  7. package/components/Card/tests/__snapshots__/index.test.js.snap +22 -0
  8. package/components/Card/tests/index.test.js +20 -0
  9. package/components/CardGrid/index.js +71 -0
  10. package/components/Ckeditor/index.js +238 -0
  11. package/components/Ckeditor/messages.js +13 -0
  12. package/components/Ckeditor/style.scss +3 -0
  13. package/components/Component/index.js +29 -0
  14. package/components/CustomPopOver/index.js +81 -0
  15. package/components/CustomPopOver/messages.js +17 -0
  16. package/components/DateFilter/index.js +349 -0
  17. package/components/DateFilter/messages.js +57 -0
  18. package/components/DateRange/index.js +114 -0
  19. package/components/DateRange/messages.js +25 -0
  20. package/components/Edmeditor/index.js +65 -0
  21. package/components/Edmeditor/messages.js +13 -0
  22. package/components/EmailPreview/_emailPreview.scss +119 -0
  23. package/components/EmailPreview/assets/images/iPad.svg +10 -0
  24. package/components/EmailPreview/assets/images/mobile.png +0 -0
  25. package/components/EmailPreview/index.js +107 -0
  26. package/components/EmailPreview/messages.js +33 -0
  27. package/components/Footer/index.js +27 -0
  28. package/components/Footer/messages.js +13 -0
  29. package/components/FormBuilder/_formBuilder.scss +83 -0
  30. package/components/FormBuilder/index.js +3279 -0
  31. package/components/FormBuilder/messages.js +61 -0
  32. package/components/Header/index.js +44 -0
  33. package/components/Header/messages.js +29 -0
  34. package/components/ImagePreview/_imagePreview.scss +63 -0
  35. package/components/ImagePreview/index.js +52 -0
  36. package/components/ImagePreview/messages.js +17 -0
  37. package/components/PageHeader/_pageHeader.scss +22 -0
  38. package/components/PageHeader/index.js +37 -0
  39. package/components/PageHeader/messages.js +13 -0
  40. package/components/Pagination/_pagination.scss +5 -0
  41. package/components/Pagination/index.js +49 -0
  42. package/components/PreviewSideBar/_previewsidebar.scss +28 -0
  43. package/components/PreviewSideBar/index.js +152 -0
  44. package/components/PreviewSideBar/messages.js +41 -0
  45. package/components/Sidebar/_sidebar.scss +115 -0
  46. package/components/Sidebar/index.js +214 -0
  47. package/components/Sidebar/messages.js +21 -0
  48. package/components/SlideBox/_slideBox.scss +63 -0
  49. package/components/SlideBox/index.js +47 -0
  50. package/components/SlideBox/tests/index.test.js +103 -0
  51. package/components/SmsEditor/index.js +55 -0
  52. package/components/SmsTest/index.js +117 -0
  53. package/components/SmsTest/messages.js +21 -0
  54. package/components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +42 -0
  55. package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +141 -0
  56. package/components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +21 -0
  57. package/components/TemplatePreview/_templatePreview.scss +642 -0
  58. package/components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
  59. package/components/TemplatePreview/assets/images/androidPushMessage.svg +45 -0
  60. package/components/TemplatePreview/assets/images/home-screen-android.svg +21 -0
  61. package/components/TemplatePreview/assets/images/home-screen-ios.svg +16 -0
  62. package/components/TemplatePreview/assets/images/iPhonePushMessage.svg +135 -0
  63. package/components/TemplatePreview/assets/images/mobile.svg +24 -0
  64. package/components/TemplatePreview/assets/images/sms-body.png +0 -0
  65. package/components/TemplatePreview/assets/images/sms-icon.png +0 -0
  66. package/components/TemplatePreview/assets/images/sms_mobile.png +0 -0
  67. package/components/TemplatePreview/assets/images/sms_mobile_android.svg +22 -0
  68. package/components/TemplatePreview/assets/images/sms_mobile_ios.svg +16 -0
  69. package/components/TemplatePreview/assets/images/user-icon.svg +19 -0
  70. package/components/TemplatePreview/assets/images/wechat-mobile.svg +78 -0
  71. package/components/TemplatePreview/assets/images/wechat_mobile_android.svg +20 -0
  72. package/components/TemplatePreview/index.js +617 -0
  73. package/components/TemplatePreview/messages.js +78 -0
  74. package/components/Toastr/index.js +60 -0
  75. package/components/Toastr/messages.js +13 -0
  76. package/components/ToastrMessage/index.js +113 -0
  77. package/components/ToastrMessage/messages.js +17 -0
  78. package/components/TopBar/_topbar.scss +46 -0
  79. package/components/TopBar/assets/images/capillary_logo.png +0 -0
  80. package/components/TopBar/assets/images/old_capillary_logo.png +0 -0
  81. package/components/TopBar/index.js +113 -0
  82. package/components/TopBar/messages.js +29 -0
  83. package/containers/App/actions.js +7 -0
  84. package/containers/App/constants.js +114 -0
  85. package/containers/App/index.js +52 -0
  86. package/containers/App/reducer.js +19 -0
  87. package/containers/App/sagas.js +31 -0
  88. package/containers/App/selectors.js +25 -0
  89. package/containers/App/test/saga.test.js +11 -0
  90. package/containers/Assets/Gallery/_gallery.scss +126 -0
  91. package/containers/Assets/Gallery/actions.js +37 -0
  92. package/containers/Assets/Gallery/constants.js +23 -0
  93. package/containers/Assets/Gallery/index.js +473 -0
  94. package/containers/Assets/Gallery/messages.js +93 -0
  95. package/containers/Assets/Gallery/reducer.js +81 -0
  96. package/containers/Assets/Gallery/sagas.js +80 -0
  97. package/containers/Assets/Gallery/selectors.js +25 -0
  98. package/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +9 -0
  99. package/containers/Assets/Gallery/tests/actions.test.js +25 -0
  100. package/containers/Assets/Gallery/tests/reducer.test.js +96 -0
  101. package/containers/Assets/Gallery/tests/saga.test.js +157 -0
  102. package/containers/Cap/actions.js +66 -0
  103. package/containers/Cap/constants.js +25 -0
  104. package/containers/Cap/index.js +402 -0
  105. package/containers/Cap/messages.js +75 -0
  106. package/containers/Cap/reducer.js +113 -0
  107. package/containers/Cap/sagas.js +159 -0
  108. package/containers/Cap/selectors.js +75 -0
  109. package/containers/Cap/tests/__snapshots__/index.test.js.snap +2269 -0
  110. package/containers/Cap/tests/index.test.js +22 -0
  111. package/containers/Cap/tests/saga.test.js +284 -0
  112. package/containers/Dashboard/actions.js +15 -0
  113. package/containers/Dashboard/constants.js +7 -0
  114. package/containers/Dashboard/index.js +76 -0
  115. package/containers/Dashboard/messages.js +13 -0
  116. package/containers/Dashboard/reducer.js +21 -0
  117. package/containers/Dashboard/sagas.js +17 -0
  118. package/containers/Dashboard/selectors.js +25 -0
  119. package/containers/Dashboard/test/saga.test.js +9 -0
  120. package/containers/Ebill/_ebill.scss +5 -0
  121. package/containers/Ebill/actions.js +43 -0
  122. package/containers/Ebill/constants.js +20 -0
  123. package/containers/Ebill/index.js +1278 -0
  124. package/containers/Ebill/messages.js +77 -0
  125. package/containers/Ebill/reducer.js +72 -0
  126. package/containers/Ebill/sagas.js +74 -0
  127. package/containers/Ebill/selectors.js +25 -0
  128. package/containers/Ebill/test/saga.test.js +11 -0
  129. package/containers/Email/_email.scss +141 -0
  130. package/containers/Email/actions.js +81 -0
  131. package/containers/Email/constants.js +36 -0
  132. package/containers/Email/index.js +3325 -0
  133. package/containers/Email/messages.js +289 -0
  134. package/containers/Email/reducer.js +142 -0
  135. package/containers/Email/sagas.js +135 -0
  136. package/containers/Email/selectors.js +31 -0
  137. package/containers/Email/test/saga.test.js +671 -0
  138. package/containers/LanguageProvider/actions.js +17 -0
  139. package/containers/LanguageProvider/constants.js +8 -0
  140. package/containers/LanguageProvider/index.js +80 -0
  141. package/containers/LanguageProvider/reducer.js +30 -0
  142. package/containers/LanguageProvider/selectors.js +20 -0
  143. package/containers/LanguageProvider/tests/actions.test.js +19 -0
  144. package/containers/LanguageProvider/tests/index.test.js +78 -0
  145. package/containers/LanguageProvider/tests/reducer.test.js +20 -0
  146. package/containers/LanguageProvider/tests/selectors.test.js +15 -0
  147. package/containers/Line/Create/_lineCreate.scss +54 -0
  148. package/containers/Line/Create/actions.js +90 -0
  149. package/containers/Line/Create/constants.js +39 -0
  150. package/containers/Line/Create/index.js +836 -0
  151. package/containers/Line/Create/messages.js +189 -0
  152. package/containers/Line/Create/reducer.js +99 -0
  153. package/containers/Line/Create/sagas.js +121 -0
  154. package/containers/Line/Create/selectors.js +36 -0
  155. package/containers/Line/Create/tests/saga.test.js +202 -0
  156. package/containers/Line/Edit/_lineEdit.scss +35 -0
  157. package/containers/Line/Edit/actions.js +79 -0
  158. package/containers/Line/Edit/constants.js +27 -0
  159. package/containers/Line/Edit/index.js +1050 -0
  160. package/containers/Line/Edit/messages.js +177 -0
  161. package/containers/Line/Edit/reducer.js +83 -0
  162. package/containers/Line/Edit/sagas.js +80 -0
  163. package/containers/Line/Edit/selectors.js +29 -0
  164. package/containers/Line/Edit/test/saga.test.js +160 -0
  165. package/containers/Login/assets/images/capillary_logo.png +0 -0
  166. package/containers/Login/components/LoginForm/index.js +62 -0
  167. package/containers/Login/components/LoginForm/messages.js +33 -0
  168. package/containers/Login/index.js +130 -0
  169. package/containers/Login/messages.js +25 -0
  170. package/containers/Login/selectors.js +25 -0
  171. package/containers/MobilePush/Create/_mobilePushCreate.scss +39 -0
  172. package/containers/MobilePush/Create/actions.js +46 -0
  173. package/containers/MobilePush/Create/constants.js +23 -0
  174. package/containers/MobilePush/Create/index.js +2303 -0
  175. package/containers/MobilePush/Create/messages.js +269 -0
  176. package/containers/MobilePush/Create/reducer.js +70 -0
  177. package/containers/MobilePush/Create/sagas.js +74 -0
  178. package/containers/MobilePush/Create/selectors.js +28 -0
  179. package/containers/MobilePush/Create/test/saga.test.js +19 -0
  180. package/containers/MobilePush/Edit/_mobilePushCreate.scss +39 -0
  181. package/containers/MobilePush/Edit/actions.js +91 -0
  182. package/containers/MobilePush/Edit/constants.js +35 -0
  183. package/containers/MobilePush/Edit/index.js +2601 -0
  184. package/containers/MobilePush/Edit/messages.js +266 -0
  185. package/containers/MobilePush/Edit/reducer.js +112 -0
  186. package/containers/MobilePush/Edit/sagas.js +126 -0
  187. package/containers/MobilePush/Edit/selectors.js +29 -0
  188. package/containers/MobilePush/Edit/tests/saga.test.js +255 -0
  189. package/containers/NotFoundPage/index.js +25 -0
  190. package/containers/NotFoundPage/messages.js +13 -0
  191. package/containers/NotFoundPage/tests/index.test.js +17 -0
  192. package/containers/Sms/Create/_smsCreate.scss +42 -0
  193. package/containers/Sms/Create/actions.js +27 -0
  194. package/containers/Sms/Create/constants.js +16 -0
  195. package/containers/Sms/Create/index.js +1488 -0
  196. package/containers/Sms/Create/messages.js +109 -0
  197. package/containers/Sms/Create/reducer.js +41 -0
  198. package/containers/Sms/Create/sagas.js +40 -0
  199. package/containers/Sms/Create/selectors.js +28 -0
  200. package/containers/Sms/Create/test/saga.test.js +11 -0
  201. package/containers/Sms/Edit/actions.js +40 -0
  202. package/containers/Sms/Edit/constants.js +17 -0
  203. package/containers/Sms/Edit/index.js +1472 -0
  204. package/containers/Sms/Edit/messages.js +105 -0
  205. package/containers/Sms/Edit/reducer.js +50 -0
  206. package/containers/Sms/Edit/sagas.js +60 -0
  207. package/containers/Sms/Edit/selectors.js +32 -0
  208. package/containers/Sms/Edit/test/saga.test.js +13 -0
  209. package/containers/TagList/_tagList.scss +8 -0
  210. package/containers/TagList/actions.js +15 -0
  211. package/containers/TagList/constants.js +32 -0
  212. package/containers/TagList/index.js +236 -0
  213. package/containers/TagList/messages.js +13 -0
  214. package/containers/TagList/reducer.js +23 -0
  215. package/containers/TagList/sagas.js +11 -0
  216. package/containers/TagList/selectors.js +25 -0
  217. package/containers/Templates/_templates.scss +333 -0
  218. package/containers/Templates/actions.js +103 -0
  219. package/containers/Templates/constants.js +60 -0
  220. package/containers/Templates/index.js +1756 -0
  221. package/containers/Templates/messages.js +337 -0
  222. package/containers/Templates/reducer.js +142 -0
  223. package/containers/Templates/sagas.js +163 -0
  224. package/containers/Templates/selectors.js +28 -0
  225. package/containers/Templates/test/saga.test.js +241 -0
  226. package/containers/WeChat/MapTemplates/_mapTemplates.scss +8 -0
  227. package/containers/WeChat/MapTemplates/actions.js +52 -0
  228. package/containers/WeChat/MapTemplates/constants.js +28 -0
  229. package/containers/WeChat/MapTemplates/index.js +1610 -0
  230. package/containers/WeChat/MapTemplates/messages.js +157 -0
  231. package/containers/WeChat/MapTemplates/reducer.js +74 -0
  232. package/containers/WeChat/MapTemplates/sagas.js +84 -0
  233. package/containers/WeChat/MapTemplates/selectors.js +25 -0
  234. package/containers/WeChat/MapTemplates/test/saga.test.js +155 -0
  235. package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +57 -0
  236. package/containers/WeChat/RichmediaTemplates/Create/actions.js +36 -0
  237. package/containers/WeChat/RichmediaTemplates/Create/constants.js +15 -0
  238. package/containers/WeChat/RichmediaTemplates/Create/index.js +1071 -0
  239. package/containers/WeChat/RichmediaTemplates/Create/messages.js +165 -0
  240. package/containers/WeChat/RichmediaTemplates/Create/reducer.js +60 -0
  241. package/containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +497 -0
  242. package/containers/WeChat/RichmediaTemplates/Create/sagas.js +51 -0
  243. package/containers/WeChat/RichmediaTemplates/Create/selectors.js +37 -0
  244. package/containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +13 -0
  245. package/containers/WeChat/RichmediaTemplates/Edit/actions.js +20 -0
  246. package/containers/WeChat/RichmediaTemplates/Edit/constants.js +10 -0
  247. package/containers/WeChat/RichmediaTemplates/Edit/index.js +136 -0
  248. package/containers/WeChat/RichmediaTemplates/Edit/messages.js +13 -0
  249. package/containers/WeChat/RichmediaTemplates/Edit/reducer.js +28 -0
  250. package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +36 -0
  251. package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +30 -0
  252. package/containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +12 -0
  253. package/containers/WeChat/RichmediaTemplates/View/actions.js +15 -0
  254. package/containers/WeChat/RichmediaTemplates/View/constants.js +7 -0
  255. package/containers/WeChat/RichmediaTemplates/View/index.js +47 -0
  256. package/containers/WeChat/RichmediaTemplates/View/messages.js +21 -0
  257. package/containers/WeChat/RichmediaTemplates/View/reducer.js +23 -0
  258. package/containers/WeChat/RichmediaTemplates/View/sagas.js +11 -0
  259. package/containers/WeChat/RichmediaTemplates/View/selectors.js +25 -0
  260. package/index.js +2 -4
  261. package/package.json +1 -1
  262. package/routes.js +202 -136
  263. package/services/getSchema.js +1 -1
  264. package/services/localStorageApi.js +0 -1
  265. package/tests/i18n.test.js +1 -1
  266. package/utils/asyncInjectors.js +78 -0
  267. package/utils/authWrapper.js +1 -1
  268. package/utils/callNativeEvent.js +16 -0
  269. package/utils/checkStore.js +21 -0
  270. package/utils/common.js +2 -2
  271. package/utils/customAuthWrapper.js +62 -0
  272. package/utils/customConnectedAuthWrapper.js +26 -0
  273. package/utils/tagValidations.js +1 -1
  274. package/utils/tests/checkStore.test.js +1 -1
  275. package/utils/tests/customAuth.test.js +1 -1
  276. package/utils/transformerUtils.js +195 -1
  277. package/v2Components/CapTagList/index.js +14 -9
  278. package/v2Components/Carousel/style.scss +1 -1
  279. package/v2Components/EmailMobilePreview/index.js +2 -2
  280. package/v2Components/FormBuilder/index.js +2 -2
  281. package/v2Components/TemplatePreview/index.js +1 -2
  282. package/v2Containers/Cap/tests/saga.test.js +1 -1
  283. package/v2Containers/Email/index.js +1 -1
  284. package/v2Containers/FTP/index.js +1 -1
  285. package/v2Containers/Line/Container/Text/index.js +6 -6
  286. package/v2Containers/Sms/Create/index.js +2 -2
  287. package/v2Containers/Sms/Edit/index.js +1 -1
  288. package/v2Containers/TagList/index.js +1 -1
  289. package/v2Containers/TagList/utils.js +1 -1
  290. package/v2Containers/Templates/index.js +1 -1
  291. package/v2Containers/Templates/sagas.js +1 -1
  292. package/constants/unified.js +0 -189
package/routes.js CHANGED
@@ -1,146 +1,212 @@
1
1
  import withReactRouterV3Compatibility from './hoc/withReactRouterV3Compatibility';
2
-
2
+ import Dashboard from './containers/Dashboard';
3
+ import SmsCreate from './containers/Sms/Create';
4
+ import SmsEdit from './containers/Sms/Edit';
5
+ import Templates from './containers/Templates';
6
+ import Gallary from './containers/Assets/Gallery';
7
+ import WeChatMapTemplate from './containers/WeChat/MapTemplates';
8
+ import WeChatRichmediaCreate from './containers/WeChat/RichmediaTemplates/Create';
9
+ import WeChatRichmediaEdit from './containers/WeChat/RichmediaTemplates/Edit';
10
+ import Email from './containers/Email';
11
+ import Ebill from './containers/Ebill';
12
+ import MobilePushCreate from './containers/MobilePush/Create';
13
+ import MobilePushEdit from './containers/MobilePush/Edit';
14
+ import LineCreate from './containers/Line/Create';
3
15
  import SomethingWentWrong from '@capillarytech/cap-ui-library/CapSomethingWentWrong';
4
- import NotFoundPage from './v2Containers/NotFoundPage';
16
+ import NotFoundPage from './containers/NotFoundPage';
5
17
  import TemplatesV2 from './v2Containers/TemplatesV2';
18
+ import { updateCharCount } from './utils/smsCharCountV2';
6
19
 
7
- // Utility function to detect if we're in embedded mode
8
- const isEmbeddedMode = () => {
9
- // Check if we're in embedded mode by looking for embedded mode indicators
10
- // This could be from URL params, environment variables, or build configuration
11
- if (typeof window !== 'undefined') {
12
- const urlParams = new URLSearchParams(window.location.search);
13
- return urlParams.get('type') === 'embedded';
14
- }
15
- // Fallback: check if containers folder exists (indicating non-embedded mode)
16
- try {
17
- // This will throw an error in embedded mode since containers are excluded
18
- require('./containers/Dashboard');
19
- return false;
20
- } catch (error) {
21
- return true;
22
- }
23
- };
24
-
25
- // Check if we're in embedded mode at module load time
26
- const isEmbedded = isEmbeddedMode();
27
-
28
- // Clean all-or-nothing approach for static imports
29
- const getStaticImports = () => {
30
- if (isEmbedded) return {}; // Only v2 uses static imports
31
-
32
- try {
33
- return {
34
- Dashboard: require('./containers/Dashboard').default,
35
- SmsCreate: require('./containers/Sms/Create').default,
36
- SmsEdit: require('./containers/Sms/Edit').default,
37
- Templates: require('./containers/Templates').default,
38
- WeChatMapTemplate: require('./containers/WeChat/MapTemplates').default,
39
- Gallary: require('./containers/Assets/Gallery').default,
40
- WeChatRichmediaCreate: require('./containers/WeChat/RichmediaTemplates/Create').default,
41
- WeChatRichmediaEdit: require('./containers/WeChat/RichmediaTemplates/Edit').default,
42
- Email: require('./containers/Email').default,
43
- Ebill: require('./containers/Ebill').default,
44
- MobilePushCreate: require('./containers/MobilePush/Create').default,
45
- MobilePushEdit: require('./containers/MobilePush/Edit').default,
46
- LineCreate: require('./containers/Line/Create').default,
47
- };
48
- } catch (error) {
49
- console.log('Error importing v1 components:', error.message);
50
- return {}; // Fallback to v2 only
51
- }
52
- };
53
-
54
- // Declarative route configuration
55
- const ROUTES = [
56
- // ✅ V2 Routes (always included)
57
- { path: '/v2/somethingwentwrong', name: 'somethingwentwrong', component: SomethingWentWrong },
58
- { path: '/v2', name: 'templatesV2', component: TemplatesV2 },
59
- { path: '/v2/loyalty', name: 'loyalty', component: TemplatesV2 },
60
-
61
- // ✅ V1 Routes (conditional based on `!isEmbedded`)
62
- { path: '/', componentKey: 'Dashboard' },
63
-
64
- // SMS routes v1
65
- { path: '/sms/create', name: 'create', componentKey: 'SmsCreate' },
66
- { path: '/sms/view', name: 'view', componentKey: 'SmsCreate' },
67
- { path: '/sms/edit/:id', name: 'edit', componentKey: 'SmsEdit' },
68
- { path: '/sms', name: 'sms', componentKey: 'Templates' },
69
-
70
- // WeChat routes v1
71
- { path: '/wechat', name: 'wechat', componentKey: 'Templates' },
72
- { path: '/wechat/create', name: 'create weChat', componentKey: 'WeChatMapTemplate' },
73
- { path: '/wechat/edit/:id', name: 'edit weChat', componentKey: 'WeChatMapTemplate' },
74
- { path: '/wechat/richmedia/create', name: 'wechat_richmedia_create', componentKey: 'WeChatRichmediaCreate' },
75
- { path: '/wechat/richmedia/edit/:id', name: 'wechat_richmedia_edit', componentKey: 'WeChatRichmediaEdit' },
76
-
77
- // Email routes v1
78
- { path: '/email', name: 'email', componentKey: 'Templates' },
79
- { path: '/email/create', name: 'EmailCreate', componentKey: 'Email' },
80
- { path: '/email/view', name: 'EmailView', componentKey: 'Email' },
81
- { path: '/email/edit/:id', name: 'EmailEdit', componentKey: 'Email' },
82
-
83
- // Ebill routes v1
84
- { path: '/ebill', name: 'Ebill', componentKey: 'Templates' },
85
- { path: '/ebill/create', name: 'Ebill', componentKey: 'Ebill' },
86
- { path: '/ebill/edit/:id', name: 'Ebill', componentKey: 'Ebill' },
87
-
88
- // MobilePush routes v1
89
- { path: '/mobilepush', name: 'mobilepush', componentKey: 'Templates' },
90
- { path: '/mobilepush/create/:mode', name: 'create', componentKey: 'MobilePushCreate' },
91
- { path: '/mobilepush/edit/:id', name: 'edit', componentKey: 'MobilePushEdit' },
92
-
93
- // Assets routes v1
94
- { path: '/assets', name: 'GALLERY', componentKey: 'Gallary' },
95
-
96
- // Line routes v1
97
- { path: '/line', name: 'line', componentKey: 'Templates' },
98
- { path: '/line/create/:mode', name: 'create line', componentKey: 'LineCreate' },
99
- { path: '/line/view/:mode', name: 'view', componentKey: 'LineCreate' },
100
- { path: '/line/edit/text/:id', name: 'edit_text', componentKey: 'LineCreate' },
101
- { path: '/line/edit/image/:id', name: 'edit_image', componentKey: 'LineCreate' },
102
- ];
103
-
104
- // Simplified route creation
105
- const createRoutes = (components = {}) => {
106
- const routes = ROUTES.flatMap(({ path, component, componentKey, name }) => {
107
- // V2 component is statically imported
108
- if (component) {
109
- return [{
110
- exact: true,
111
- path,
112
- name,
113
- component: withReactRouterV3Compatibility(component),
114
- }];
115
- }
116
-
117
- // V1 component: only include if available
118
- const resolved = components[componentKey];
119
- if (resolved) {
120
- return [{
121
- exact: true,
122
- path,
123
- name,
124
- component: withReactRouterV3Compatibility(resolved),
125
- }];
126
- }
127
-
128
- return []; // Skip if not in embedded or missing
129
- });
130
-
131
- // Catch-all fallback
132
- routes.push({
20
+ const routes = [
21
+ {
22
+ exact: true,
23
+ path: '/',
24
+ component: withReactRouterV3Compatibility(Dashboard),
25
+ },
26
+ //sms routes v1
27
+ {
28
+ exact: true,
29
+ path: '/sms/create',
30
+ name: 'create',
31
+ component: withReactRouterV3Compatibility(SmsCreate),
32
+ },
33
+ {
34
+ exact: true,
35
+ path: '/sms/view',
36
+ name: 'view',
37
+ component: withReactRouterV3Compatibility(SmsCreate),
38
+ },
39
+ {
40
+ exact: true,
41
+ path: '/sms/edit/:id',
42
+ name: 'edit',
43
+ component: withReactRouterV3Compatibility(SmsEdit),
44
+ },
45
+ {
46
+ exact: true,
47
+ path: '/sms',
48
+ name: 'sms',
49
+ component: withReactRouterV3Compatibility(Templates),
50
+ },
51
+ //wechat routes v1
52
+ {
53
+ exact: true,
54
+ path: '/wechat',
55
+ name: 'wechat',
56
+ component: withReactRouterV3Compatibility(Templates),
57
+ },
58
+ {
59
+ exact: true,
60
+ path: '/wechat/create',
61
+ name: 'create weChat',
62
+ component: withReactRouterV3Compatibility(WeChatMapTemplate),
63
+ },
64
+ {
65
+ exact: true,
66
+ path: '/wechat/edit/:id',
67
+ name: 'edit weChat',
68
+ component: withReactRouterV3Compatibility(WeChatMapTemplate),
69
+ },
70
+ {
71
+ exact: true,
72
+ path: '/wechat/richmedia/create',
73
+ name: 'wechat_richmedia_create',
74
+ component: withReactRouterV3Compatibility(WeChatRichmediaCreate),
75
+ },
76
+ {
77
+ exact: true,
78
+ path: '/wechat/richmedia/edit/:id',
79
+ name: 'wechat_richmedia_edit',
80
+ component: withReactRouterV3Compatibility(WeChatRichmediaEdit),
81
+ },
82
+ //email routes v1
83
+ {
84
+ exact: true,
85
+ path: '/email',
86
+ name: 'email',
87
+ component: withReactRouterV3Compatibility(Templates),
88
+ },
89
+ {
90
+ exact: true,
91
+ path: '/email/create',
92
+ name: 'EmailCreate',
93
+ component: withReactRouterV3Compatibility(Email),
94
+ },
95
+ {
96
+ exact: true,
97
+ path: '/email/view',
98
+ name: 'EmailView',
99
+ component: withReactRouterV3Compatibility(Email),
100
+ },
101
+ {
102
+ exact: true,
103
+ path: '/email/edit/:id',
104
+ name: 'EmailEdit',
105
+ component: withReactRouterV3Compatibility(Email),
106
+ },
107
+ //ebill routes v1
108
+ {
109
+ exact: true,
110
+ path: '/ebill',
111
+ name: 'Ebill',
112
+ component: withReactRouterV3Compatibility(Templates),
113
+ },
114
+ {
115
+ exact: true,
116
+ path: '/ebill/create',
117
+ name: 'Ebill',
118
+ component: withReactRouterV3Compatibility(Ebill),
119
+ },
120
+ {
121
+ exact: true,
122
+ path: '/ebill/edit/:id',
123
+ name: 'Ebill',
124
+ component: withReactRouterV3Compatibility(Ebill),
125
+ },
126
+ //mobilepush routes v1
127
+ {
128
+ exact: true,
129
+ path: '/mobilepush',
130
+ name: 'mobilepush',
131
+ component: withReactRouterV3Compatibility(Templates),
132
+ },
133
+ {
134
+ exact: true,
135
+ path: '/mobilepush/create/:mode',
136
+ name: 'create',
137
+ component: withReactRouterV3Compatibility(MobilePushCreate),
138
+ },
139
+ {
140
+ exact: true,
141
+ path: '/mobilepush/edit/:id',
142
+ name: 'edit',
143
+ component: withReactRouterV3Compatibility(MobilePushEdit),
144
+ },
145
+ // assets routes v1
146
+ {
147
+ exact: true,
148
+ path: '/assets',
149
+ name: 'GALLERY',
150
+ component: withReactRouterV3Compatibility(Gallary),
151
+ },
152
+ // line routes v1
153
+ {
154
+ exact: true,
155
+ path: '/line',
156
+ name: 'line',
157
+ component: withReactRouterV3Compatibility(Templates),
158
+ },
159
+ {
160
+ exact: true,
161
+ path: '/line/create/:mode',
162
+ name: 'create line',
163
+ component: withReactRouterV3Compatibility(LineCreate),
164
+ },
165
+ {
166
+ exact: true,
167
+ path: '/line/view/:mode',
168
+ name: 'view',
169
+ component: withReactRouterV3Compatibility(LineCreate),
170
+ },
171
+ {
172
+ exact: true,
173
+ path: '/line/edit/text/:id',
174
+ name: 'edit_text',
175
+ component: withReactRouterV3Compatibility(LineCreate),
176
+ },
177
+ {
178
+ exact: true,
179
+ path: '/line/edit/image/:id',
180
+ name: 'edit_image',
181
+ component: withReactRouterV3Compatibility(LineCreate),
182
+ },
183
+ {
184
+ exact: true,
185
+ path: '/v2/somethingwentwrong',
186
+ name: 'somethingwentwrong',
187
+ component: withReactRouterV3Compatibility(SomethingWentWrong),
188
+ },
189
+ {
190
+ exact: true,
191
+ path: '/v2',
192
+ name: 'templatesV2',
193
+ component: withReactRouterV3Compatibility(TemplatesV2),
194
+ },
195
+ {
196
+ exact: true,
197
+ path: '/v2/loyalty',
198
+ name: 'loyalty',
199
+ component: withReactRouterV3Compatibility(TemplatesV2),
200
+ },
201
+ {
133
202
  path: '*',
134
203
  name: 'notfound',
135
204
  component: withReactRouterV3Compatibility(NotFoundPage),
136
- });
137
-
138
- return routes;
139
- };
205
+ },
206
+ ];
140
207
 
141
- // Initialize routes synchronously with available components
142
- const staticImports = getStaticImports();
143
- const routes = createRoutes(staticImports);
208
+ // export function createRoutes(store) {
209
+ // updateCharCount("", false); // TODO:: React18, need to see why this call was made from here and can we remove this?
210
+ // }
144
211
 
145
- // Export the routes array
146
212
  export default routes;
@@ -1,4 +1,4 @@
1
- import { SMS, EMAIL, MOBILE_PUSH, WECHAT } from '../v2Containers/CreativesContainer/constants';
1
+ import {SMS, EMAIL, MOBILE_PUSH, WECHAT, LINE} from '../v2Containers/CreativesContainer/constants';
2
2
  export default function getSchema(channel) {
3
3
  let schemaPath = '../containers/';
4
4
  switch (channel.toUpperCase()) {
@@ -2,7 +2,6 @@
2
2
  * Created by vivek on 17/2/17.
3
3
  */
4
4
 
5
- //This is being used in the v2 containers and legacy flow aswell, please make sure to validate the DVS flow.
6
5
  export const loadItem = (key) => {
7
6
  try {
8
7
  const serializedState = localStorage.getItem(key);
@@ -1,4 +1,4 @@
1
- import { DEFAULT_LOCALE } from '../constants/unified';
1
+ import { DEFAULT_LOCALE } from '../containers/App/constants';
2
2
  import { formatTranslationMessages } from '../i18n';
3
3
 
4
4
  jest.mock('../translations/en.json', () => (
@@ -0,0 +1,78 @@
1
+ import conformsTo from 'lodash/conformsTo';
2
+ import isEmpty from 'lodash/isEmpty';
3
+ import isFunction from 'lodash/isFunction';
4
+ import isObject from 'lodash/isObject';
5
+ import isString from 'lodash/isString';
6
+ import invariant from 'invariant';
7
+ import warning from 'warning';
8
+ import createReducer from 'reducers';
9
+
10
+ /**
11
+ * Validate the shape of redux store
12
+ */
13
+ export function checkStore(store) {
14
+ const shape = {
15
+ dispatch: isFunction,
16
+ subscribe: isFunction,
17
+ getState: isFunction,
18
+ replaceReducer: isFunction,
19
+ runSaga: isFunction,
20
+ asyncReducers: isObject,
21
+ };
22
+ invariant(
23
+ conformsTo(store, shape),
24
+ '(app/utils...) asyncInjectors: Expected a valid redux store'
25
+ );
26
+ }
27
+
28
+ /**
29
+ * Inject an asynchronously loaded reducer
30
+ */
31
+ export function injectAsyncReducer(store, isValid) {
32
+ return function injectReducer(name, asyncReducer) {
33
+ if (!isValid) checkStore(store);
34
+
35
+ invariant(
36
+ isString(name) && !isEmpty(name) && isFunction(asyncReducer),
37
+ '(app/utils...) injectAsyncReducer: Expected `asyncReducer` to be a reducer function'
38
+ );
39
+
40
+ if (Reflect.has(store.asyncReducers, name)) return;
41
+
42
+ store.asyncReducers[name] = asyncReducer; // eslint-disable-line no-param-reassign
43
+ store.replaceReducer(createReducer(store.asyncReducers));
44
+ };
45
+ }
46
+
47
+ /**
48
+ * Inject an asynchronously loaded saga
49
+ */
50
+ export function injectAsyncSagas(store, isValid) {
51
+ return function injectSagas(sagas) {
52
+ if (!isValid) checkStore(store);
53
+
54
+ invariant(
55
+ Array.isArray(sagas),
56
+ '(app/utils...) injectAsyncSagas: Expected `sagas` to be an array of generator functions'
57
+ );
58
+
59
+ warning(
60
+ !isEmpty(sagas),
61
+ '(app/utils...) injectAsyncSagas: Received an empty `sagas` array'
62
+ );
63
+
64
+ sagas.map(store.runSaga);
65
+ };
66
+ }
67
+
68
+ /**
69
+ * Helper for creating injectors
70
+ */
71
+ export function getAsyncInjectors(store) {
72
+ checkStore(store);
73
+
74
+ return {
75
+ injectReducer: injectAsyncReducer(store, true),
76
+ injectSagas: injectAsyncSagas(store, true),
77
+ };
78
+ }
@@ -8,7 +8,7 @@ import { routerActions } from 'connected-react-router';
8
8
  // import { routerActions } from 'react-router-redux';
9
9
  // import { UserAuthWrapper } from 'redux-auth-wrapper';
10
10
  import { createSelector } from 'reselect';
11
- import { makeSelectAuthenticated } from '../v2Containers/Cap/selectors';
11
+ import { makeSelectAuthenticated } from '../containers/Cap/selectors';
12
12
  // import config from '../config/app';
13
13
  const orginUrl = window.location.origin;
14
14
  // const loginUrl = '/auth/login';
@@ -0,0 +1,16 @@
1
+ //https://github.com/facebook/react/issues/11488#issuecomment-470623779
2
+ export default function callNativeEvent({field, value, event}) {
3
+ //cuz in react 16 native events does not work
4
+ const ev = event;
5
+ const input = field;
6
+ const lastValue = input.value;
7
+ input.value = value;
8
+ // hack React15
9
+ ev.simulated = true;
10
+ // hack React16 内部定义了descriptor拦截value,此处重置状态
11
+ const tracker = input._valueTracker;
12
+ if (tracker) {
13
+ tracker.setValue(lastValue);
14
+ }
15
+ input.dispatchEvent(ev);
16
+ }
@@ -0,0 +1,21 @@
1
+ import { conformsTo, isFunction, isObject } from 'lodash';
2
+ import invariant from 'invariant';
3
+
4
+ /**
5
+ * Validate the shape of redux store
6
+ */
7
+ export default function checkStore(store) {
8
+ const shape = {
9
+ dispatch: isFunction,
10
+ subscribe: isFunction,
11
+ getState: isFunction,
12
+ replaceReducer: isFunction,
13
+ runSaga: isFunction,
14
+ injectedReducers: isObject,
15
+ injectedSagas: isObject,
16
+ };
17
+ invariant(
18
+ conformsTo(store, shape),
19
+ '(app/utils...) injectors: Expected a valid redux store',
20
+ );
21
+ }
package/utils/common.js CHANGED
@@ -22,8 +22,8 @@ import {
22
22
  BADGES_ISSUE,
23
23
  ENABLE_WECHAT,
24
24
  LIQUID_SUPPORT,
25
- ENABLE_NEW_MPUSH
26
- } from '../constants/unified';
25
+ ENABLE_NEW_MPUSH,
26
+ } from '../containers/App/constants';
27
27
  import { apiMessageFormatHandler } from './commonUtils';
28
28
 
29
29
  export function getUserNameById(userId, allUserList) {
@@ -0,0 +1,62 @@
1
+ /* eslint-disable no-unused-vars */
2
+ /* eslint-disable react/no-multi-comp */
3
+ /* eslint-disable react/prefer-stateless-function */
4
+ import React, { Component } from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import hoistStatics from 'hoist-non-react-statics';
7
+
8
+ const AuthenticatingComponentWithRef = React.forwardRef((props, ref) => (
9
+ <div ref={ref} />
10
+ ));
11
+ const FailureComponentWithRef = React.forwardRef((props, ref) => (
12
+ <div ref={ref} />
13
+ ));
14
+ const defaults = {
15
+ AuthenticatingComponent: AuthenticatingComponentWithRef, // dont render anything while authenticating
16
+ FailureComponent: FailureComponentWithRef, // dont render anything on failure of the predicate
17
+ wrapperDisplayName: 'AuthWrapper',
18
+ };
19
+
20
+ export default args => {
21
+ const { AuthenticatingComponent, FailureComponent, wrapperDisplayName } = {
22
+ ...defaults,
23
+ ...args,
24
+ };
25
+
26
+ // Wraps the component that needs the auth enforcement
27
+ return function wrapComponent(DecoratedComponent) {
28
+ const displayName =
29
+ DecoratedComponent.displayName || DecoratedComponent.name || 'Component';
30
+
31
+ class UserAuthWrapper extends Component {
32
+ static displayName = `${wrapperDisplayName}(${displayName})`;
33
+
34
+ static propTypes = {
35
+ isAuthenticated: PropTypes.bool,
36
+ isAuthenticating: PropTypes.bool,
37
+ };
38
+
39
+ static defaultProps = {
40
+ isAuthenticating: false,
41
+ };
42
+
43
+ render() {
44
+ const { isAuthenticated, isAuthenticating, forwardedRef } = this.props;
45
+ if (isAuthenticated) {
46
+ return <DecoratedComponent {...this.props} ref={forwardedRef} />;
47
+ }
48
+ if (isAuthenticating) {
49
+ return <AuthenticatingComponent {...this.props} ref={forwardedRef} />;
50
+ }
51
+ return <FailureComponent {...this.props} ref={forwardedRef} />;
52
+ }
53
+ }
54
+
55
+ /** forwardRef from HOC to the Wrapped Component */
56
+ const UserAuthWrapperWithRef = React.forwardRef((props, ref) => (
57
+ <UserAuthWrapper {...props} forwardedRef={ref} />
58
+ ));
59
+
60
+ return hoistStatics(UserAuthWrapperWithRef, DecoratedComponent);
61
+ };
62
+ };
@@ -0,0 +1,26 @@
1
+ import { connect } from 'react-redux';
2
+
3
+ import authWrapper from './customAuthWrapper';
4
+
5
+ const connectedDefaults = {
6
+ authenticatingSelector: () => false,
7
+ };
8
+
9
+ export default args => {
10
+ const { authenticatedSelector, authenticatingSelector } = {
11
+ ...connectedDefaults,
12
+ ...args,
13
+ };
14
+
15
+ /** Passed withRef option set to true for forwarding Ref to Wrapped Component */
16
+ return DecoratedComponent =>
17
+ connect(
18
+ (state, ownProps) => ({
19
+ isAuthenticated: authenticatedSelector(state, ownProps),
20
+ isAuthenticating: authenticatingSelector(state, ownProps),
21
+ }),
22
+ null,
23
+ null,
24
+ { withRef: true },
25
+ )(authWrapper(args)(DecoratedComponent));
26
+ };
@@ -8,7 +8,7 @@
8
8
 
9
9
  import lodashForEach from 'lodash/forEach';
10
10
  import lodashCloneDeep from 'lodash/cloneDeep';
11
- import { ENTRY_TRIGGER_TAG_REGEX } from '../constants/unified';
11
+ import { ENTRY_TRIGGER_TAG_REGEX } from '../containers/App/constants';
12
12
 
13
13
  const DEFAULT = 'default';
14
14
  const SUBTAGS = 'subtags';
@@ -1,4 +1,4 @@
1
- import checkStore from '../../legacy/checkStore';
1
+ import checkStore from '../checkStore';
2
2
 
3
3
  describe('checkStore', () => {
4
4
  it('should not throw if the store is valid', () => {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { render } from '@testing-library/react';
3
- import UserAuthWrapper from '../../legacy/customAuthWrapper';
3
+ import UserAuthWrapper from '../customAuthWrapper';
4
4
 
5
5
  const MockComponent = React.forwardRef((props, ref) => <div ref={ref} {...props}>Mock Component</div>);
6
6