@capillarytech/creatives-library 8.0.242-alpha.0 → 8.0.242-alpha.2

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 (216) hide show
  1. package/assets/Android.png +0 -0
  2. package/assets/iOS.png +0 -0
  3. package/constants/unified.js +2 -1
  4. package/initialReducer.js +2 -0
  5. package/package.json +1 -1
  6. package/sagas/__tests__/assetPolling.test.js +74 -3
  7. package/sagas/assetPolling.js +8 -1
  8. package/services/api.js +10 -5
  9. package/services/tests/api.test.js +18 -0
  10. package/translations/en.json +0 -1
  11. package/utils/common.js +5 -0
  12. package/utils/commonUtils.js +14 -1
  13. package/utils/tests/commonUtil.test.js +224 -0
  14. package/utils/transformTemplateConfig.js +0 -10
  15. package/utils/transformerUtils.js +0 -42
  16. package/v2Components/CapDeviceContent/index.js +61 -56
  17. package/v2Components/CapImageUpload/constants.js +0 -2
  18. package/v2Components/CapImageUpload/index.js +14 -54
  19. package/v2Components/CapImageUpload/index.scss +1 -4
  20. package/v2Components/CapImageUpload/messages.js +0 -4
  21. package/v2Components/CapTagList/index.js +6 -1
  22. package/v2Components/CapTagListWithInput/index.js +5 -1
  23. package/v2Components/CapTagListWithInput/messages.js +1 -1
  24. package/v2Components/CapWhatsappCTA/tests/index.test.js +5 -0
  25. package/v2Components/ErrorInfoNote/index.js +412 -72
  26. package/v2Components/ErrorInfoNote/messages.js +22 -0
  27. package/v2Components/ErrorInfoNote/style.scss +279 -2
  28. package/v2Components/HtmlEditor/HTMLEditor.js +217 -90
  29. package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +1132 -133
  30. package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +17 -12
  31. package/v2Components/HtmlEditor/_htmlEditor.scss +15 -23
  32. package/v2Components/HtmlEditor/_index.lazy.scss +1 -1
  33. package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +13 -101
  34. package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +148 -139
  35. package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +2 -1
  36. package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
  37. package/v2Components/HtmlEditor/components/EditorToolbar/_editorToolbar.scss +1 -0
  38. package/v2Components/HtmlEditor/components/EditorToolbar/index.js +1 -1
  39. package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +1 -0
  40. package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +4 -7
  41. package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +35 -45
  42. package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +1 -3
  43. package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
  44. package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +7 -6
  45. package/v2Components/HtmlEditor/components/PreviewPane/_previewPane.scss +3 -6
  46. package/v2Components/HtmlEditor/components/PreviewPane/index.js +10 -11
  47. package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
  48. package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +87 -62
  49. package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +49 -31
  50. package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +254 -0
  51. package/v2Components/HtmlEditor/components/ValidationTabs/index.js +362 -0
  52. package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +51 -0
  53. package/v2Components/HtmlEditor/constants.js +29 -20
  54. package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +373 -16
  55. package/v2Components/HtmlEditor/hooks/useEditorContent.js +5 -2
  56. package/v2Components/HtmlEditor/hooks/useInAppContent.js +88 -146
  57. package/v2Components/HtmlEditor/index.js +1 -1
  58. package/v2Components/HtmlEditor/messages.js +95 -85
  59. package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +99 -101
  60. package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +23 -25
  61. package/v2Components/HtmlEditor/utils/validationAdapter.js +34 -41
  62. package/v2Components/MobilePushPreviewV2/index.js +32 -7
  63. package/v2Components/TemplatePreview/_templatePreview.scss +44 -24
  64. package/v2Components/TemplatePreview/index.js +47 -32
  65. package/v2Components/TemplatePreview/messages.js +4 -0
  66. package/v2Components/TestAndPreviewSlidebox/index.js +31 -25
  67. package/v2Containers/App/constants.js +0 -5
  68. package/v2Containers/BeeEditor/index.js +82 -80
  69. package/v2Containers/BeePopupEditor/constants.js +10 -0
  70. package/v2Containers/BeePopupEditor/index.js +193 -0
  71. package/v2Containers/BeePopupEditor/tests/index.test.js +627 -0
  72. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +0 -1
  73. package/v2Containers/CreativesContainer/SlideBoxContent.js +148 -120
  74. package/v2Containers/CreativesContainer/SlideBoxFooter.js +9 -3
  75. package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -2
  76. package/v2Containers/CreativesContainer/constants.js +1 -2
  77. package/v2Containers/CreativesContainer/index.js +173 -193
  78. package/v2Containers/CreativesContainer/messages.js +4 -4
  79. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +38 -50
  80. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +36 -0
  81. package/v2Containers/Email/actions.js +7 -0
  82. package/v2Containers/Email/constants.js +5 -1
  83. package/v2Containers/Email/index.js +13 -0
  84. package/v2Containers/Email/messages.js +32 -0
  85. package/v2Containers/Email/reducer.js +12 -1
  86. package/v2Containers/Email/sagas.js +41 -6
  87. package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -0
  88. package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1046 -0
  89. package/v2Containers/EmailWrapper/components/EmailWrapperView.js +193 -7
  90. package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +40 -74
  91. package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +2 -67
  92. package/v2Containers/EmailWrapper/constants.js +2 -0
  93. package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +436 -67
  94. package/v2Containers/EmailWrapper/index.js +99 -23
  95. package/v2Containers/EmailWrapper/messages.js +61 -1
  96. package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +26 -1
  97. package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +111 -77
  98. package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +376 -0
  99. package/v2Containers/InApp/__tests__/sagas.test.js +363 -0
  100. package/v2Containers/InApp/actions.js +7 -0
  101. package/v2Containers/InApp/constants.js +20 -4
  102. package/v2Containers/InApp/index.js +800 -357
  103. package/v2Containers/InApp/index.scss +4 -3
  104. package/v2Containers/InApp/messages.js +7 -3
  105. package/v2Containers/InApp/reducer.js +21 -3
  106. package/v2Containers/InApp/sagas.js +29 -9
  107. package/v2Containers/InApp/selectors.js +25 -5
  108. package/v2Containers/InApp/tests/index.test.js +154 -50
  109. package/v2Containers/InApp/tests/reducer.test.js +34 -0
  110. package/v2Containers/InApp/tests/sagas.test.js +61 -9
  111. package/v2Containers/InApp/tests/selectors.test.js +612 -0
  112. package/v2Containers/InAppWrapper/components/InAppWrapperView.js +162 -0
  113. package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +267 -0
  114. package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +9 -0
  115. package/v2Containers/InAppWrapper/constants.js +16 -0
  116. package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +473 -0
  117. package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +198 -0
  118. package/v2Containers/InAppWrapper/index.js +148 -0
  119. package/v2Containers/InAppWrapper/messages.js +49 -0
  120. package/v2Containers/InappAdvance/index.js +1099 -0
  121. package/v2Containers/InappAdvance/index.scss +10 -0
  122. package/v2Containers/InappAdvance/tests/index.test.js +448 -0
  123. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -3
  124. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -2
  125. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -25
  126. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -18
  127. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +12 -46
  128. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +0 -4
  129. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -8
  130. package/v2Containers/TagList/index.js +67 -1
  131. package/v2Containers/Templates/ChannelTypeIllustration.js +1 -13
  132. package/v2Containers/Templates/_templates.scss +56 -200
  133. package/v2Containers/Templates/actions.js +1 -2
  134. package/v2Containers/Templates/constants.js +0 -1
  135. package/v2Containers/Templates/index.js +124 -277
  136. package/v2Containers/Templates/messages.js +4 -24
  137. package/v2Containers/Templates/reducer.js +0 -2
  138. package/v2Containers/Templates/tests/index.test.js +0 -10
  139. package/v2Containers/TemplatesV2/index.js +2 -3
  140. package/v2Containers/TemplatesV2/messages.js +0 -4
  141. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +35 -132
  142. package/v2Components/CapImageUrlUpload/constants.js +0 -19
  143. package/v2Components/CapImageUrlUpload/index.js +0 -455
  144. package/v2Components/CapImageUrlUpload/index.scss +0 -35
  145. package/v2Components/CapImageUrlUpload/messages.js +0 -47
  146. package/v2Containers/WebPush/Create/components/ButtonForm.js +0 -175
  147. package/v2Containers/WebPush/Create/components/ButtonItem.js +0 -101
  148. package/v2Containers/WebPush/Create/components/ButtonList.js +0 -144
  149. package/v2Containers/WebPush/Create/components/_buttons.scss +0 -246
  150. package/v2Containers/WebPush/Create/components/tests/ButtonForm.test.js +0 -554
  151. package/v2Containers/WebPush/Create/components/tests/ButtonItem.test.js +0 -607
  152. package/v2Containers/WebPush/Create/components/tests/ButtonList.test.js +0 -633
  153. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonForm.test.js.snap +0 -666
  154. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonItem.test.js.snap +0 -74
  155. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonList.test.js.snap +0 -80
  156. package/v2Containers/WebPush/Create/index.js +0 -1755
  157. package/v2Containers/WebPush/Create/index.scss +0 -123
  158. package/v2Containers/WebPush/Create/messages.js +0 -199
  159. package/v2Containers/WebPush/Create/preview/DevicePreviewContent.js +0 -241
  160. package/v2Containers/WebPush/Create/preview/NotificationContainer.js +0 -290
  161. package/v2Containers/WebPush/Create/preview/PreviewContent.js +0 -81
  162. package/v2Containers/WebPush/Create/preview/PreviewControls.js +0 -240
  163. package/v2Containers/WebPush/Create/preview/PreviewDisclaimer.js +0 -23
  164. package/v2Containers/WebPush/Create/preview/WebPushPreview.js +0 -144
  165. package/v2Containers/WebPush/Create/preview/assets/Light.svg +0 -53
  166. package/v2Containers/WebPush/Create/preview/assets/Top.svg +0 -5
  167. package/v2Containers/WebPush/Create/preview/assets/chrome-icon.png +0 -0
  168. package/v2Containers/WebPush/Create/preview/assets/edge-icon.png +0 -0
  169. package/v2Containers/WebPush/Create/preview/assets/firefox-icon.svg +0 -106
  170. package/v2Containers/WebPush/Create/preview/assets/iOS.svg +0 -26
  171. package/v2Containers/WebPush/Create/preview/assets/opera-icon.svg +0 -18
  172. package/v2Containers/WebPush/Create/preview/assets/safari-icon.svg +0 -29
  173. package/v2Containers/WebPush/Create/preview/components/AndroidMobileChromeHeader.js +0 -44
  174. package/v2Containers/WebPush/Create/preview/components/AndroidMobileExpanded.js +0 -110
  175. package/v2Containers/WebPush/Create/preview/components/IOSHeader.js +0 -45
  176. package/v2Containers/WebPush/Create/preview/components/NotificationExpandedContent.js +0 -72
  177. package/v2Containers/WebPush/Create/preview/components/NotificationHeader.js +0 -55
  178. package/v2Containers/WebPush/Create/preview/components/WindowsChromeExpanded.js +0 -70
  179. package/v2Containers/WebPush/Create/preview/components/tests/AndroidMobileExpanded.test.js +0 -512
  180. package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/AndroidMobileExpanded.test.js.snap +0 -77
  181. package/v2Containers/WebPush/Create/preview/config/notificationMappings.js +0 -527
  182. package/v2Containers/WebPush/Create/preview/constants.js +0 -162
  183. package/v2Containers/WebPush/Create/preview/notification-container.scss +0 -104
  184. package/v2Containers/WebPush/Create/preview/preview.scss +0 -409
  185. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-chrome.scss +0 -300
  186. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-edge.scss +0 -12
  187. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-firefox.scss +0 -12
  188. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-opera.scss +0 -12
  189. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-chrome.scss +0 -303
  190. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-edge.scss +0 -11
  191. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-firefox.scss +0 -11
  192. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-opera.scss +0 -11
  193. package/v2Containers/WebPush/Create/preview/styles/_base.scss +0 -188
  194. package/v2Containers/WebPush/Create/preview/styles/_ios.scss +0 -106
  195. package/v2Containers/WebPush/Create/preview/styles/_ipados.scss +0 -107
  196. package/v2Containers/WebPush/Create/preview/styles/_macos-chrome.scss +0 -75
  197. package/v2Containers/WebPush/Create/preview/styles/_windows-chrome.scss +0 -174
  198. package/v2Containers/WebPush/Create/preview/tests/DevicePreviewContent.test.js +0 -909
  199. package/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +0 -1077
  200. package/v2Containers/WebPush/Create/preview/tests/PreviewControls.test.js +0 -723
  201. package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +0 -943
  202. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/DevicePreviewContent.test.js.snap +0 -128
  203. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/NotificationContainer.test.js.snap +0 -121
  204. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/PreviewControls.test.js.snap +0 -144
  205. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/WebPushPreview.test.js.snap +0 -127
  206. package/v2Containers/WebPush/Create/utils/urlValidation.js +0 -116
  207. package/v2Containers/WebPush/Create/utils/urlValidation.test.js +0 -449
  208. package/v2Containers/WebPush/actions.js +0 -60
  209. package/v2Containers/WebPush/constants.js +0 -108
  210. package/v2Containers/WebPush/index.js +0 -2
  211. package/v2Containers/WebPush/reducer.js +0 -104
  212. package/v2Containers/WebPush/sagas.js +0 -119
  213. package/v2Containers/WebPush/selectors.js +0 -65
  214. package/v2Containers/WebPush/tests/reducer.test.js +0 -863
  215. package/v2Containers/WebPush/tests/sagas.test.js +0 -566
  216. package/v2Containers/WebPush/tests/selectors.test.js +0 -960
@@ -1,527 +0,0 @@
1
- import chromeIcon from '../assets/chrome-icon.png';
2
- import safariIcon from '../assets/safari-icon.svg';
3
- import operaIcon from '../assets/opera-icon.svg';
4
- import firefoxIcon from '../assets/firefox-icon.svg';
5
- import edgeIcon from '../assets/edge-icon.png';
6
- import topSvg from '../assets/Top.svg';
7
- import iosSvg from '../assets/iOS.svg';
8
- import lightSvg from '../assets/Light.svg';
9
- import {
10
- BROWSER_OPTIONS,
11
- } from '../constants';
12
-
13
- // macOS Chrome variant definition
14
- const MACOS_CHROME_VARIANT = {
15
- frameAsset: topSvg,
16
- icon: chromeIcon,
17
- notificationClassName: 'macos-chrome',
18
- states: {
19
- Collapsed: {
20
- supportsExpanded: false,
21
- showMedia: false,
22
- showCtas: false,
23
- position: { custom: { x: 580, y: 57 } },
24
- },
25
- Expanded: {
26
- supportsExpanded: true,
27
- showMedia: true,
28
- showCtas: true,
29
- position: { custom: { x: 580, y: 57 } },
30
- },
31
- },
32
- };
33
-
34
- /**
35
- * Preview variants describe which OS+Browser+State combinations are supported,
36
- * along with assets, style classes, and positioning data.
37
- */
38
- export const PREVIEW_VARIANTS = {
39
- macOS: {
40
- Chrome: MACOS_CHROME_VARIANT,
41
- Safari: {
42
- frameAsset: topSvg,
43
- icon: safariIcon,
44
- notificationClassName: 'macos-safari',
45
- states: {
46
- Collapsed: {
47
- supportsExpanded: false,
48
- showMedia: false,
49
- showCtas: false,
50
- position: { custom: { x: 580, y: 57 } },
51
- },
52
- },
53
- },
54
- Opera: {
55
- frameAsset: topSvg,
56
- icon: operaIcon,
57
- notificationClassName: 'macos-opera',
58
- states: {
59
- Collapsed: {
60
- supportsExpanded: false,
61
- showMedia: false,
62
- showCtas: false,
63
- position: { custom: { x: 580, y: 57 } },
64
- },
65
- Expanded: {
66
- supportsExpanded: true,
67
- showMedia: true,
68
- showCtas: true,
69
- position: { custom: { x: 580, y: 57 } },
70
- },
71
- },
72
- },
73
- Firefox: {
74
- frameAsset: topSvg,
75
- icon: firefoxIcon,
76
- notificationClassName: 'macos-firefox',
77
- states: {
78
- Collapsed: {
79
- supportsExpanded: false,
80
- showMedia: false,
81
- showCtas: false,
82
- position: { custom: { x: 580, y: 57 } },
83
- },
84
- Expanded: {
85
- supportsExpanded: true,
86
- showMedia: true,
87
- showCtas: true,
88
- position: { custom: { x: 580, y: 57 } },
89
- },
90
- },
91
- },
92
- Edge: {
93
- frameAsset: topSvg,
94
- icon: edgeIcon,
95
- notificationClassName: 'macos-edge',
96
- states: {
97
- Collapsed: {
98
- supportsExpanded: false,
99
- showMedia: false,
100
- showCtas: false,
101
- position: { custom: { x: 580, y: 57 } },
102
- },
103
- Expanded: {
104
- supportsExpanded: true,
105
- showMedia: true,
106
- showCtas: true,
107
- position: { custom: { x: 580, y: 57 } },
108
- },
109
- },
110
- },
111
- },
112
- Windows: {
113
- Chrome: {
114
- frameAsset: topSvg,
115
- icon: chromeIcon,
116
- notificationClassName: 'windows-chrome',
117
- states: {
118
- Collapsed: {
119
- supportsExpanded: false,
120
- showMedia: false,
121
- showCtas: false,
122
- position: { custom: { x: 580, bottom: 55 } },
123
- },
124
- Expanded: {
125
- supportsExpanded: true,
126
- showMedia: false,
127
- showCtas: false,
128
- position: { custom: { x: 580, bottom: 55 } },
129
- },
130
- },
131
- },
132
- Firefox: {
133
- frameAsset: topSvg,
134
- icon: firefoxIcon,
135
- notificationClassName: 'windows-firefox',
136
- states: {
137
- Collapsed: {
138
- supportsExpanded: false,
139
- showMedia: false,
140
- showCtas: false,
141
- position: { custom: { x: 580, bottom: 55 } },
142
- },
143
- Expanded: {
144
- supportsExpanded: true,
145
- showMedia: false,
146
- showCtas: false,
147
- position: { custom: { x: 580, bottom: 55 } },
148
- },
149
- },
150
- },
151
- Edge: {
152
- frameAsset: topSvg,
153
- icon: edgeIcon,
154
- notificationClassName: 'windows-edge',
155
- states: {
156
- Collapsed: {
157
- supportsExpanded: false,
158
- showMedia: false,
159
- showCtas: false,
160
- position: { custom: { x: 580, bottom: 55 } },
161
- },
162
- Expanded: {
163
- supportsExpanded: true,
164
- showMedia: false,
165
- showCtas: false,
166
- position: { custom: { x: 580, bottom: 55 } },
167
- },
168
- },
169
- },
170
- Opera: {
171
- frameAsset: topSvg,
172
- icon: operaIcon,
173
- notificationClassName: 'windows-opera',
174
- states: {
175
- Collapsed: {
176
- supportsExpanded: false,
177
- showMedia: false,
178
- showCtas: false,
179
- position: { custom: { x: 580, bottom: 55 } },
180
- },
181
- Expanded: {
182
- supportsExpanded: true,
183
- showMedia: false,
184
- showCtas: false,
185
- position: { custom: { x: 580, bottom: 55 } },
186
- },
187
- },
188
- },
189
- },
190
- 'Android (Mobile)': {
191
- Chrome: {
192
- frameAsset: iosSvg,
193
- icon: chromeIcon,
194
- notificationClassName: 'android-mobile-chrome',
195
- states: {
196
- Collapsed: {
197
- supportsExpanded: false,
198
- showMedia: false,
199
- showCtas: false,
200
- position: { custom: { x: 28, y: 210 } },
201
- },
202
- Expanded: {
203
- supportsExpanded: true,
204
- showMedia: true,
205
- showCtas: false,
206
- position: { custom: { x: 28, y: 210 } },
207
- },
208
- },
209
- },
210
- Firefox: {
211
- frameAsset: iosSvg,
212
- icon: firefoxIcon,
213
- notificationClassName: 'android-mobile-firefox',
214
- states: {
215
- Collapsed: {
216
- supportsExpanded: false,
217
- showMedia: false,
218
- showCtas: false,
219
- position: { custom: { x: 28, y: 210 } },
220
- },
221
- Expanded: {
222
- supportsExpanded: true,
223
- showMedia: true,
224
- showCtas: false,
225
- position: { custom: { x: 28, y: 210 } },
226
- },
227
- },
228
- },
229
- Edge: {
230
- frameAsset: iosSvg,
231
- icon: edgeIcon,
232
- notificationClassName: 'android-mobile-edge',
233
- states: {
234
- Collapsed: {
235
- supportsExpanded: false,
236
- showMedia: false,
237
- showCtas: false,
238
- position: { custom: { x: 28, y: 210 } },
239
- },
240
- Expanded: {
241
- supportsExpanded: true,
242
- showMedia: true,
243
- showCtas: false,
244
- position: { custom: { x: 28, y: 210 } },
245
- },
246
- },
247
- },
248
- Opera: {
249
- frameAsset: iosSvg,
250
- icon: operaIcon,
251
- notificationClassName: 'android-mobile-opera',
252
- states: {
253
- Collapsed: {
254
- supportsExpanded: false,
255
- showMedia: false,
256
- showCtas: false,
257
- position: { custom: { x: 28, y: 210 } },
258
- },
259
- Expanded: {
260
- supportsExpanded: true,
261
- showMedia: true,
262
- showCtas: false,
263
- position: { custom: { x: 28, y: 210 } },
264
- },
265
- },
266
- },
267
- },
268
- 'Android (Tablet)': {
269
- Chrome: {
270
- frameAsset: lightSvg,
271
- icon: chromeIcon,
272
- notificationClassName: 'android-tablet-chrome',
273
- states: {
274
- Collapsed: {
275
- supportsExpanded: false,
276
- showMedia: false,
277
- showCtas: false,
278
- position: { custom: { x: 78, y: 265 } },
279
- },
280
- Expanded: {
281
- supportsExpanded: true,
282
- showMedia: true,
283
- showCtas: false,
284
- position: { custom: { x: 78, y: 265 } },
285
- },
286
- },
287
- },
288
- Firefox: {
289
- frameAsset: lightSvg,
290
- icon: firefoxIcon,
291
- notificationClassName: 'android-tablet-firefox',
292
- states: {
293
- Collapsed: {
294
- supportsExpanded: false,
295
- showMedia: false,
296
- showCtas: false,
297
- position: { custom: { x: 78, y: 265 } },
298
- },
299
- Expanded: {
300
- supportsExpanded: true,
301
- showMedia: true,
302
- showCtas: false,
303
- position: { custom: { x: 78, y: 265 } },
304
- },
305
- },
306
- },
307
- Edge: {
308
- frameAsset: lightSvg,
309
- icon: edgeIcon,
310
- notificationClassName: 'android-tablet-edge',
311
- states: {
312
- Collapsed: {
313
- supportsExpanded: false,
314
- showMedia: false,
315
- showCtas: false,
316
- position: { custom: { x: 78, y: 265 } },
317
- },
318
- Expanded: {
319
- supportsExpanded: true,
320
- showMedia: true,
321
- showCtas: false,
322
- position: { custom: { x: 78, y: 265 } },
323
- },
324
- },
325
- },
326
- Opera: {
327
- frameAsset: lightSvg,
328
- icon: operaIcon,
329
- notificationClassName: 'android-tablet-opera',
330
- states: {
331
- Collapsed: {
332
- supportsExpanded: false,
333
- showMedia: false,
334
- showCtas: false,
335
- position: { custom: { x: 78, y: 265 } },
336
- },
337
- Expanded: {
338
- supportsExpanded: true,
339
- showMedia: true,
340
- showCtas: false,
341
- position: { custom: { x: 78, y: 265 } },
342
- },
343
- },
344
- },
345
- },
346
- iOS: {
347
- Chrome: {
348
- frameAsset: iosSvg,
349
- icon: chromeIcon,
350
- notificationClassName: 'ios-chrome',
351
- states: {
352
- Collapsed: {
353
- supportsExpanded: false,
354
- showMedia: false,
355
- showCtas: false,
356
- position: { custom: { x: 28, y: 210 } },
357
- },
358
- },
359
- },
360
- Safari: {
361
- frameAsset: iosSvg,
362
- icon: safariIcon,
363
- notificationClassName: 'ios-safari',
364
- states: {
365
- Collapsed: {
366
- supportsExpanded: false,
367
- showMedia: false,
368
- showCtas: false,
369
- position: { custom: { x: 28, y: 210 } },
370
- },
371
- },
372
- },
373
- Firefox: {
374
- frameAsset: iosSvg,
375
- icon: firefoxIcon,
376
- notificationClassName: 'ios-firefox',
377
- states: {
378
- Collapsed: {
379
- supportsExpanded: false,
380
- showMedia: false,
381
- showCtas: false,
382
- position: { custom: { x: 28, y: 210 } },
383
- },
384
- },
385
- },
386
- Edge: {
387
- frameAsset: iosSvg,
388
- icon: edgeIcon,
389
- notificationClassName: 'ios-edge',
390
- states: {
391
- Collapsed: {
392
- supportsExpanded: false,
393
- showMedia: false,
394
- showCtas: false,
395
- position: { custom: { x: 28, y: 210 } },
396
- },
397
- },
398
- },
399
- Opera: {
400
- frameAsset: iosSvg,
401
- icon: operaIcon,
402
- notificationClassName: 'ios-opera',
403
- states: {
404
- Collapsed: {
405
- supportsExpanded: false,
406
- showMedia: false,
407
- showCtas: false,
408
- position: { custom: { x: 28, y: 210 } },
409
- },
410
- },
411
- },
412
- },
413
- iPadOS: {
414
- Chrome: {
415
- frameAsset: lightSvg,
416
- icon: chromeIcon,
417
- notificationClassName: 'ipados-chrome',
418
- states: {
419
- Collapsed: {
420
- supportsExpanded: false,
421
- showMedia: false,
422
- showCtas: false,
423
- position: { custom: { x: 78, y: 265 } },
424
- },
425
- },
426
- },
427
- Safari: {
428
- frameAsset: lightSvg,
429
- icon: safariIcon,
430
- notificationClassName: 'ipados-safari',
431
- states: {
432
- Collapsed: {
433
- supportsExpanded: false,
434
- showMedia: false,
435
- showCtas: false,
436
- position: { custom: { x: 78, y: 265 } },
437
- },
438
- },
439
- },
440
- Firefox: {
441
- frameAsset: lightSvg,
442
- icon: firefoxIcon,
443
- notificationClassName: 'ipados-firefox',
444
- states: {
445
- Collapsed: {
446
- supportsExpanded: false,
447
- showMedia: false,
448
- showCtas: false,
449
- position: { custom: { x: 78, y: 265 } },
450
- },
451
- },
452
- },
453
- Edge: {
454
- frameAsset: lightSvg,
455
- icon: edgeIcon,
456
- notificationClassName: 'ipados-edge',
457
- states: {
458
- Collapsed: {
459
- supportsExpanded: false,
460
- showMedia: false,
461
- showCtas: false,
462
- position: { custom: { x: 78, y: 265 } },
463
- },
464
- },
465
- },
466
- Opera: {
467
- frameAsset: lightSvg,
468
- icon: operaIcon,
469
- notificationClassName: 'ipados-opera',
470
- states: {
471
- Collapsed: {
472
- supportsExpanded: false,
473
- showMedia: false,
474
- showCtas: false,
475
- position: { custom: { x: 78, y: 265 } },
476
- },
477
- },
478
- },
479
- },
480
- // TODO: Add additional OS + browser variants here. Ensure positioning stays anchored to the device frame.
481
- };
482
-
483
- /**
484
- * Returns the browser options allowed for a given OS.
485
- * Safari is supported on macOS, iOS, and iPadOS.
486
- * All browsers are supported on macOS, iOS, and iPadOS: Chrome, Safari, Opera, Firefox, Edge.
487
- * Other OSes exclude Safari.
488
- */
489
- export const getBrowserOptionsForOS = (os) => {
490
- if (os === 'macOS' || os === 'iOS' || os === 'iPadOS') {
491
- return BROWSER_OPTIONS;
492
- }
493
- return BROWSER_OPTIONS.filter((option) => option.value !== 'Safari');
494
- };
495
-
496
- /**
497
- * Returns the supported states for an OS+Browser pair.
498
- */
499
- export const getSupportedStates = (os, browser) => {
500
- const states = PREVIEW_VARIANTS[os]?.[browser]?.states;
501
- return states ? Object.keys(states) : [];
502
- };
503
-
504
- /**
505
- * Given a desired state, returns the best-fit state that is supported.
506
- */
507
- export const coerceStateForVariant = (os, browser, desiredState) => {
508
- const supportedStates = getSupportedStates(os, browser);
509
- if (!supportedStates.length) return null;
510
- if (supportedStates.includes(desiredState)) return desiredState;
511
- return supportedStates[0];
512
- };
513
-
514
- /**
515
- * Fetches the resolved variant config for OS+Browser+State.
516
- * Returns { variant, stateKey, stateConfig } or null if unsupported.
517
- */
518
- export const getResolvedVariant = (os, browser, state) => {
519
- const variant = PREVIEW_VARIANTS[os]?.[browser];
520
- if (!variant) return null;
521
- const stateKey = coerceStateForVariant(os, browser, state);
522
- if (!stateKey) return null;
523
- const stateConfig = variant.states[stateKey];
524
- return { variant, stateKey, stateConfig };
525
- };
526
-
527
-
@@ -1,162 +0,0 @@
1
- /**
2
- * Preview Constants
3
- *
4
- * Centralized constants for preview dropdown options and device configurations.
5
- * This file ensures DRY (Don't Repeat Yourself) principles by providing
6
- * a single source of truth for all preview-related options.
7
- */
8
-
9
- /**
10
- * Operating System Options
11
- * Available OS/Device types for preview selection
12
- */
13
- export const OS_OPTIONS = [
14
- { value: 'macOS', label: 'macOS' },
15
- { value: 'iOS', label: 'iOS' },
16
- { value: 'iPadOS', label: 'iPadOS' },
17
- { value: 'Windows', label: 'Windows' },
18
- { value: 'Android (Mobile)', label: 'Android (Mobile)' },
19
- { value: 'Android (Tablet)', label: 'Android (Tablet)' },
20
- ];
21
-
22
- /**
23
- * Browser Options
24
- * Available browsers for preview selection
25
- */
26
- export const BROWSER_OPTIONS = [
27
- { value: 'Chrome', label: 'Chrome' },
28
- { value: 'Firefox', label: 'Firefox' },
29
- { value: 'Edge', label: 'Edge' },
30
- { value: 'Safari', label: 'Safari' },
31
- { value: 'Opera', label: 'Opera' },
32
- ];
33
-
34
- /**
35
- * Notification State Options
36
- * Available states for notification preview (Collapsed/Expanded)
37
- */
38
- export const STATE_OPTIONS = [
39
- { value: 'Collapsed', label: 'Collapsed' },
40
- { value: 'Expanded', label: 'Expanded' },
41
- ];
42
-
43
- /**
44
- * Notification State Values
45
- * Individual state constants for use in components
46
- */
47
- export const NOTIFICATION_STATE_COLLAPSED = 'Collapsed';
48
- export const NOTIFICATION_STATE_EXPANDED = 'Expanded';
49
-
50
- /**
51
- * Default Selection Values
52
- */
53
- export const DEFAULT_OS = 'macOS';
54
- export const DEFAULT_BROWSER = 'Chrome';
55
- export const DEFAULT_STATE = 'Collapsed';
56
-
57
- /**
58
- * Layout Mode Constants
59
- * Available layout modes for PreviewControls component
60
- */
61
- export const LAYOUT_MODE = {
62
- INLINE: 'inline',
63
- NEW_ROW: 'newRow',
64
- COMPACT: 'compact',
65
- };
66
-
67
- /**
68
- * Select Width Constants
69
- * Width values for dropdown selects based on layout mode
70
- */
71
- export const SELECT_WIDTH = {
72
- COMPACT: '11rem',
73
- FULL: '100%',
74
- };
75
-
76
-
77
- /**
78
- * Device Frame Dimensions (in pixels)
79
- *
80
- * These are the natural dimensions of the device frame SVG assets.
81
- * Used for calculating notification positions relative to device frames.
82
- *
83
- * Note: These dimensions are based on the actual rendered SVG sizes.
84
- * If SVG assets are updated, these values should be updated accordingly.
85
- */
86
- export const DEVICE_FRAME_DIMENSIONS = {
87
- // Top.svg - Used for macOS and Windows
88
- 'macOS': { width: 952, height: 647 },
89
- 'Windows': { width: 952, height: 647 },
90
- // iOS.svg - Used for iOS and Android (Mobile)
91
- 'iOS': { width: 380, height: 778 },
92
- 'Android (Mobile)': { width: 380, height: 778 },
93
- // Light.svg - Used for iPadOS and Android (Tablet)
94
- 'iPadOS': { width: 640, height: 888 },
95
- 'Android (Tablet)': { width: 640, height: 888 },
96
- };
97
-
98
- /**
99
- * Operating System Name Constants
100
- * Individual OS name values for use in components
101
- */
102
- export const OS_MACOS = 'macOS';
103
- export const OS_IOS = 'iOS';
104
- export const OS_IPADOS = 'iPadOS';
105
- export const OS_WINDOWS = 'Windows';
106
- export const OS_ANDROID_MOBILE = 'Android (Mobile)';
107
- export const OS_ANDROID_TABLET = 'Android (Tablet)';
108
-
109
- /**
110
- * Browser Name Constants
111
- * Individual browser name values for use in components
112
- */
113
- export const BROWSER_CHROME = 'Chrome';
114
- export const BROWSER_FIREFOX = 'Firefox';
115
- export const BROWSER_EDGE = 'Edge';
116
- export const BROWSER_SAFARI = 'Safari';
117
- export const BROWSER_OPERA = 'Opera';
118
-
119
- /**
120
- * Browser Name Constants (lowercase)
121
- * Lowercase browser names used in class names and comparisons
122
- */
123
- export const BROWSER_CHROME_LOWER = 'chrome';
124
- export const BROWSER_FIREFOX_LOWER = 'firefox';
125
- export const BROWSER_EDGE_LOWER = 'edge';
126
- export const BROWSER_SAFARI_LOWER = 'safari';
127
- export const BROWSER_OPERA_LOWER = 'opera';
128
-
129
- /**
130
- * Browsers that Support Brand Icon
131
- * List of browsers that support brand icon display
132
- */
133
- export const BRAND_ICON_SUPPORTED_BROWSERS = [
134
- BROWSER_CHROME_LOWER,
135
- BROWSER_EDGE_LOWER,
136
- BROWSER_OPERA_LOWER,
137
- BROWSER_FIREFOX_LOWER,
138
- ];
139
-
140
- /**
141
- * Browser Display Name Mapping
142
- * Maps browser names to their full display names for UI
143
- */
144
- export const BROWSER_DISPLAY_NAMES = {
145
- [BROWSER_CHROME]: 'Google Chrome',
146
- [BROWSER_FIREFOX]: 'Mozilla Firefox',
147
- [BROWSER_EDGE]: 'Microsoft Edge',
148
- [BROWSER_OPERA]: 'Opera',
149
- };
150
-
151
-
152
- /**
153
- * Dummy CTA Button Data
154
- * Placeholder data for CTA buttons in expanded notification preview
155
- * TODO: Replace with actual CTA buttons from form/props
156
- */
157
- export const DUMMY_CTA_BUTTONS = [
158
- { id: '1', label: 'Features', icon: '⚡' },
159
- { id: '2', label: 'Signup for Free', icon: '📋' },
160
- ];
161
-
162
-