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

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 (215) 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 +210 -89
  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 +8 -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/index.js +1 -1
  38. package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +1 -0
  39. package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +4 -7
  40. package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +35 -45
  41. package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +1 -3
  42. package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
  43. package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +7 -6
  44. package/v2Components/HtmlEditor/components/PreviewPane/_previewPane.scss +3 -6
  45. package/v2Components/HtmlEditor/components/PreviewPane/index.js +10 -11
  46. package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
  47. package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +87 -62
  48. package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +49 -31
  49. package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +254 -0
  50. package/v2Components/HtmlEditor/components/ValidationTabs/index.js +362 -0
  51. package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +51 -0
  52. package/v2Components/HtmlEditor/constants.js +29 -20
  53. package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +373 -16
  54. package/v2Components/HtmlEditor/hooks/useEditorContent.js +5 -2
  55. package/v2Components/HtmlEditor/hooks/useInAppContent.js +88 -146
  56. package/v2Components/HtmlEditor/index.js +1 -1
  57. package/v2Components/HtmlEditor/messages.js +95 -85
  58. package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +99 -101
  59. package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +23 -25
  60. package/v2Components/HtmlEditor/utils/validationAdapter.js +34 -41
  61. package/v2Components/MobilePushPreviewV2/index.js +32 -7
  62. package/v2Components/TemplatePreview/_templatePreview.scss +44 -24
  63. package/v2Components/TemplatePreview/index.js +47 -32
  64. package/v2Components/TemplatePreview/messages.js +4 -0
  65. package/v2Components/TestAndPreviewSlidebox/index.js +31 -25
  66. package/v2Containers/App/constants.js +0 -5
  67. package/v2Containers/BeeEditor/index.js +82 -80
  68. package/v2Containers/BeePopupEditor/constants.js +10 -0
  69. package/v2Containers/BeePopupEditor/index.js +193 -0
  70. package/v2Containers/BeePopupEditor/tests/index.test.js +627 -0
  71. package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +0 -1
  72. package/v2Containers/CreativesContainer/SlideBoxContent.js +148 -120
  73. package/v2Containers/CreativesContainer/SlideBoxFooter.js +9 -3
  74. package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -2
  75. package/v2Containers/CreativesContainer/constants.js +1 -2
  76. package/v2Containers/CreativesContainer/index.js +173 -193
  77. package/v2Containers/CreativesContainer/messages.js +4 -4
  78. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +38 -50
  79. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +36 -0
  80. package/v2Containers/Email/actions.js +7 -0
  81. package/v2Containers/Email/constants.js +5 -1
  82. package/v2Containers/Email/index.js +13 -0
  83. package/v2Containers/Email/messages.js +32 -0
  84. package/v2Containers/Email/reducer.js +12 -1
  85. package/v2Containers/Email/sagas.js +41 -6
  86. package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -0
  87. package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1045 -0
  88. package/v2Containers/EmailWrapper/components/EmailWrapperView.js +193 -7
  89. package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +40 -74
  90. package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +2 -67
  91. package/v2Containers/EmailWrapper/constants.js +2 -0
  92. package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +436 -67
  93. package/v2Containers/EmailWrapper/index.js +99 -23
  94. package/v2Containers/EmailWrapper/messages.js +61 -1
  95. package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +26 -1
  96. package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +111 -77
  97. package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +376 -0
  98. package/v2Containers/InApp/__tests__/sagas.test.js +363 -0
  99. package/v2Containers/InApp/actions.js +7 -0
  100. package/v2Containers/InApp/constants.js +20 -4
  101. package/v2Containers/InApp/index.js +800 -357
  102. package/v2Containers/InApp/index.scss +4 -3
  103. package/v2Containers/InApp/messages.js +7 -3
  104. package/v2Containers/InApp/reducer.js +21 -3
  105. package/v2Containers/InApp/sagas.js +29 -9
  106. package/v2Containers/InApp/selectors.js +25 -5
  107. package/v2Containers/InApp/tests/index.test.js +154 -50
  108. package/v2Containers/InApp/tests/reducer.test.js +34 -0
  109. package/v2Containers/InApp/tests/sagas.test.js +61 -9
  110. package/v2Containers/InApp/tests/selectors.test.js +612 -0
  111. package/v2Containers/InAppWrapper/components/InAppWrapperView.js +162 -0
  112. package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +267 -0
  113. package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +9 -0
  114. package/v2Containers/InAppWrapper/constants.js +16 -0
  115. package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +473 -0
  116. package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +198 -0
  117. package/v2Containers/InAppWrapper/index.js +148 -0
  118. package/v2Containers/InAppWrapper/messages.js +49 -0
  119. package/v2Containers/InappAdvance/index.js +1099 -0
  120. package/v2Containers/InappAdvance/index.scss +10 -0
  121. package/v2Containers/InappAdvance/tests/index.test.js +448 -0
  122. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -3
  123. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -2
  124. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -25
  125. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -18
  126. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +12 -46
  127. package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +0 -4
  128. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -8
  129. package/v2Containers/TagList/index.js +67 -1
  130. package/v2Containers/Templates/ChannelTypeIllustration.js +1 -13
  131. package/v2Containers/Templates/_templates.scss +56 -200
  132. package/v2Containers/Templates/actions.js +1 -2
  133. package/v2Containers/Templates/constants.js +0 -1
  134. package/v2Containers/Templates/index.js +124 -277
  135. package/v2Containers/Templates/messages.js +4 -24
  136. package/v2Containers/Templates/reducer.js +0 -2
  137. package/v2Containers/Templates/tests/index.test.js +0 -10
  138. package/v2Containers/TemplatesV2/index.js +2 -3
  139. package/v2Containers/TemplatesV2/messages.js +0 -4
  140. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +35 -132
  141. package/v2Components/CapImageUrlUpload/constants.js +0 -19
  142. package/v2Components/CapImageUrlUpload/index.js +0 -455
  143. package/v2Components/CapImageUrlUpload/index.scss +0 -35
  144. package/v2Components/CapImageUrlUpload/messages.js +0 -47
  145. package/v2Containers/WebPush/Create/components/ButtonForm.js +0 -175
  146. package/v2Containers/WebPush/Create/components/ButtonItem.js +0 -101
  147. package/v2Containers/WebPush/Create/components/ButtonList.js +0 -144
  148. package/v2Containers/WebPush/Create/components/_buttons.scss +0 -246
  149. package/v2Containers/WebPush/Create/components/tests/ButtonForm.test.js +0 -554
  150. package/v2Containers/WebPush/Create/components/tests/ButtonItem.test.js +0 -607
  151. package/v2Containers/WebPush/Create/components/tests/ButtonList.test.js +0 -633
  152. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonForm.test.js.snap +0 -666
  153. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonItem.test.js.snap +0 -74
  154. package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonList.test.js.snap +0 -80
  155. package/v2Containers/WebPush/Create/index.js +0 -1755
  156. package/v2Containers/WebPush/Create/index.scss +0 -123
  157. package/v2Containers/WebPush/Create/messages.js +0 -199
  158. package/v2Containers/WebPush/Create/preview/DevicePreviewContent.js +0 -241
  159. package/v2Containers/WebPush/Create/preview/NotificationContainer.js +0 -290
  160. package/v2Containers/WebPush/Create/preview/PreviewContent.js +0 -81
  161. package/v2Containers/WebPush/Create/preview/PreviewControls.js +0 -240
  162. package/v2Containers/WebPush/Create/preview/PreviewDisclaimer.js +0 -23
  163. package/v2Containers/WebPush/Create/preview/WebPushPreview.js +0 -144
  164. package/v2Containers/WebPush/Create/preview/assets/Light.svg +0 -53
  165. package/v2Containers/WebPush/Create/preview/assets/Top.svg +0 -5
  166. package/v2Containers/WebPush/Create/preview/assets/chrome-icon.png +0 -0
  167. package/v2Containers/WebPush/Create/preview/assets/edge-icon.png +0 -0
  168. package/v2Containers/WebPush/Create/preview/assets/firefox-icon.svg +0 -106
  169. package/v2Containers/WebPush/Create/preview/assets/iOS.svg +0 -26
  170. package/v2Containers/WebPush/Create/preview/assets/opera-icon.svg +0 -18
  171. package/v2Containers/WebPush/Create/preview/assets/safari-icon.svg +0 -29
  172. package/v2Containers/WebPush/Create/preview/components/AndroidMobileChromeHeader.js +0 -44
  173. package/v2Containers/WebPush/Create/preview/components/AndroidMobileExpanded.js +0 -110
  174. package/v2Containers/WebPush/Create/preview/components/IOSHeader.js +0 -45
  175. package/v2Containers/WebPush/Create/preview/components/NotificationExpandedContent.js +0 -72
  176. package/v2Containers/WebPush/Create/preview/components/NotificationHeader.js +0 -55
  177. package/v2Containers/WebPush/Create/preview/components/WindowsChromeExpanded.js +0 -70
  178. package/v2Containers/WebPush/Create/preview/components/tests/AndroidMobileExpanded.test.js +0 -512
  179. package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/AndroidMobileExpanded.test.js.snap +0 -77
  180. package/v2Containers/WebPush/Create/preview/config/notificationMappings.js +0 -527
  181. package/v2Containers/WebPush/Create/preview/constants.js +0 -162
  182. package/v2Containers/WebPush/Create/preview/notification-container.scss +0 -104
  183. package/v2Containers/WebPush/Create/preview/preview.scss +0 -409
  184. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-chrome.scss +0 -300
  185. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-edge.scss +0 -12
  186. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-firefox.scss +0 -12
  187. package/v2Containers/WebPush/Create/preview/styles/_android-mobile-opera.scss +0 -12
  188. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-chrome.scss +0 -303
  189. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-edge.scss +0 -11
  190. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-firefox.scss +0 -11
  191. package/v2Containers/WebPush/Create/preview/styles/_android-tablet-opera.scss +0 -11
  192. package/v2Containers/WebPush/Create/preview/styles/_base.scss +0 -188
  193. package/v2Containers/WebPush/Create/preview/styles/_ios.scss +0 -106
  194. package/v2Containers/WebPush/Create/preview/styles/_ipados.scss +0 -107
  195. package/v2Containers/WebPush/Create/preview/styles/_macos-chrome.scss +0 -75
  196. package/v2Containers/WebPush/Create/preview/styles/_windows-chrome.scss +0 -174
  197. package/v2Containers/WebPush/Create/preview/tests/DevicePreviewContent.test.js +0 -909
  198. package/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +0 -1077
  199. package/v2Containers/WebPush/Create/preview/tests/PreviewControls.test.js +0 -723
  200. package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +0 -943
  201. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/DevicePreviewContent.test.js.snap +0 -128
  202. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/NotificationContainer.test.js.snap +0 -121
  203. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/PreviewControls.test.js.snap +0 -144
  204. package/v2Containers/WebPush/Create/preview/tests/__snapshots__/WebPushPreview.test.js.snap +0 -127
  205. package/v2Containers/WebPush/Create/utils/urlValidation.js +0 -116
  206. package/v2Containers/WebPush/Create/utils/urlValidation.test.js +0 -449
  207. package/v2Containers/WebPush/actions.js +0 -60
  208. package/v2Containers/WebPush/constants.js +0 -108
  209. package/v2Containers/WebPush/index.js +0 -2
  210. package/v2Containers/WebPush/reducer.js +0 -104
  211. package/v2Containers/WebPush/sagas.js +0 -119
  212. package/v2Containers/WebPush/selectors.js +0 -65
  213. package/v2Containers/WebPush/tests/reducer.test.js +0 -863
  214. package/v2Containers/WebPush/tests/sagas.test.js +0 -566
  215. package/v2Containers/WebPush/tests/selectors.test.js +0 -960
@@ -1,128 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`DevicePreviewContent Basic Rendering should render correctly with default props 1`] = `
4
- <CapRow>
5
- <CapColumn
6
- span={24}
7
- >
8
- <MockPreviewControls
9
- browserOptions={
10
- Array [
11
- Object {
12
- "label": "Chrome",
13
- "value": "Chrome",
14
- },
15
- Object {
16
- "label": "Firefox",
17
- "value": "Firefox",
18
- },
19
- Object {
20
- "label": "Edge",
21
- "value": "Edge",
22
- },
23
- Object {
24
- "label": "Safari",
25
- "value": "Safari",
26
- },
27
- Object {
28
- "label": "Opera",
29
- "value": "Opera",
30
- },
31
- ]
32
- }
33
- layoutMode="compact"
34
- onBrowserChange={[Function]}
35
- onOSChange={[Function]}
36
- onStateChange={[Function]}
37
- osOptions={
38
- Array [
39
- Object {
40
- "label": "macOS",
41
- "value": "macOS",
42
- },
43
- Object {
44
- "label": "iOS",
45
- "value": "iOS",
46
- },
47
- Object {
48
- "label": "iPadOS",
49
- "value": "iPadOS",
50
- },
51
- Object {
52
- "label": "Windows",
53
- "value": "Windows",
54
- },
55
- Object {
56
- "label": "Android (Mobile)",
57
- "value": "Android (Mobile)",
58
- },
59
- Object {
60
- "label": "Android (Tablet)",
61
- "value": "Android (Tablet)",
62
- },
63
- ]
64
- }
65
- selectedBrowser="Chrome"
66
- selectedOS="macOS"
67
- selectedState="Collapsed"
68
- showStateDropdown={true}
69
- stateOptions={
70
- Array [
71
- Object {
72
- "label": "Collapsed",
73
- "value": "Collapsed",
74
- },
75
- Object {
76
- "label": "Expanded",
77
- "value": "Expanded",
78
- },
79
- ]
80
- }
81
- />
82
- <div
83
- className="device-preview-container"
84
- >
85
- <div
86
- className="device-frame-wrapper"
87
- >
88
- <div
89
- className="device-frame-asset"
90
- >
91
- <img
92
- alt="macOS device frame"
93
- className="device-frame"
94
- src="test-file-stub"
95
- />
96
- <div
97
- className="device-notification-wrapper"
98
- style={
99
- Object {
100
- "left": "580px",
101
- "position": "absolute",
102
- "top": "57px",
103
- "zIndex": 10,
104
- }
105
- }
106
- >
107
- <MockNotificationContainer
108
- brandIconSrc="https://example.com/icon.png"
109
- className="macos-chrome"
110
- enableCtas={false}
111
- enableMedia={false}
112
- icon="test-file-stub"
113
- imageSrc="https://example.com/image.jpg"
114
- notificationBody="Test notification body text"
115
- notificationState="Collapsed"
116
- notificationTitle="Test Notification Title"
117
- selectedBrowser="Chrome"
118
- selectedOS="macOS"
119
- supportsExpanded={false}
120
- url="https://www.example.com"
121
- />
122
- </div>
123
- </div>
124
- </div>
125
- </div>
126
- </CapColumn>
127
- </CapRow>
128
- `;
@@ -1,121 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`NotificationContainer Basic Rendering should render correctly with default props 1`] = `
4
- <div
5
- className="notification-container macos-chrome collapsed"
6
- >
7
- <NotificationHeader
8
- brandIcon=""
9
- displayUrl="example.com"
10
- icon="test-file-stub"
11
- isExpanded={false}
12
- notificationBody="Test notification body text"
13
- notificationTitle="Test Notification Title"
14
- selectedBrowser="Chrome"
15
- shouldShowBrandIcon={false}
16
- />
17
- </div>
18
- `;
19
-
20
- exports[`NotificationContainer Snapshot Tests should match snapshot for Android Mobile Chrome expanded 1`] = `
21
- <div
22
- className="notification-container android-mobile-chrome expanded"
23
- >
24
- <AndroidMobileExpanded
25
- brandIcon=""
26
- displayUrl="example.com"
27
- icon="test-file-stub"
28
- mediaImageUrl=""
29
- notificationBody="Test notification body text"
30
- notificationTitle="Test Notification Title"
31
- selectedBrowser="Chrome"
32
- shouldShowBrandIcon={false}
33
- shouldShowBrandIconExpanded={false}
34
- />
35
- </div>
36
- `;
37
-
38
- exports[`NotificationContainer Snapshot Tests should match snapshot for Windows Chrome expanded 1`] = `
39
- <div
40
- className="notification-container windows-chrome expanded windows-chrome-expanded"
41
- >
42
- <WindowsChromeExpanded
43
- brandIcon=""
44
- browserName="Google Chrome"
45
- displayUrl="example.com"
46
- enableBrandIconPreview={true}
47
- icon="test-file-stub"
48
- mediaImageUrl=""
49
- notificationBody="Test notification body text"
50
- notificationTitle="Test Notification Title"
51
- />
52
- </div>
53
- `;
54
-
55
- exports[`NotificationContainer Snapshot Tests should match snapshot for iOS Safari collapsed 1`] = `
56
- <div
57
- className="notification-container ios-safari collapsed"
58
- >
59
- <IOSHeader
60
- icon="test-file-stub"
61
- notificationBody="Test notification body text"
62
- notificationTitle="Test Notification Title"
63
- selectedBrowser="Safari"
64
- />
65
- </div>
66
- `;
67
-
68
- exports[`NotificationContainer Snapshot Tests should match snapshot for macOS Chrome collapsed 1`] = `
69
- <div
70
- className="notification-container macos-chrome collapsed"
71
- >
72
- <NotificationHeader
73
- brandIcon=""
74
- displayUrl="example.com"
75
- icon="test-file-stub"
76
- isExpanded={false}
77
- notificationBody="Test notification body text"
78
- notificationTitle="Test Notification Title"
79
- selectedBrowser="Chrome"
80
- shouldShowBrandIcon={false}
81
- />
82
- </div>
83
- `;
84
-
85
- exports[`NotificationContainer Snapshot Tests should match snapshot for macOS Chrome expanded 1`] = `
86
- <div
87
- className="notification-container macos-chrome expanded"
88
- >
89
- <NotificationHeader
90
- brandIcon=""
91
- displayUrl="example.com"
92
- icon="test-file-stub"
93
- isExpanded={true}
94
- notificationBody="Test notification body text"
95
- notificationTitle="Test Notification Title"
96
- selectedBrowser="Chrome"
97
- shouldShowBrandIcon={false}
98
- />
99
- <NotificationExpandedContent
100
- brandIcon=""
101
- ctaButtons={
102
- Array [
103
- Object {
104
- "icon": "⚡",
105
- "id": "1",
106
- "label": "Features",
107
- },
108
- Object {
109
- "icon": "📋",
110
- "id": "2",
111
- "label": "Signup for Free",
112
- },
113
- ]
114
- }
115
- enableCtas={true}
116
- mediaImageUrl=""
117
- shouldRenderExpandedMedia={false}
118
- shouldShowBrandIconInExpandedMac={false}
119
- />
120
- </div>
121
- `;
@@ -1,144 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`PreviewControls Basic Rendering should render correctly with default props 1`] = `
4
- <Fragment>
5
- <CapRow
6
- className="preview-controls"
7
- >
8
- <CapColumn
9
- className="preview-control-os"
10
- span={12}
11
- >
12
- <CapLabel
13
- className="preview-control-label"
14
- fontWeight="bold"
15
- type="label1"
16
- >
17
- <FormattedMessage
18
- defaultMessage="Operating system"
19
- id="creatives.containersV2.WebPush.operatingSystem"
20
- values={Object {}}
21
- />
22
- </CapLabel>
23
- <_Class
24
- labelPosition="top"
25
- onChange={[Function]}
26
- options={
27
- Array [
28
- Object {
29
- "label": "macOS",
30
- "value": "macOS",
31
- },
32
- Object {
33
- "label": "iOS",
34
- "value": "iOS",
35
- },
36
- Object {
37
- "label": "iPadOS",
38
- "value": "iPadOS",
39
- },
40
- Object {
41
- "label": "Windows",
42
- "value": "Windows",
43
- },
44
- Object {
45
- "label": "Android (Mobile)",
46
- "value": "Android (Mobile)",
47
- },
48
- Object {
49
- "label": "Android (Tablet)",
50
- "value": "Android (Tablet)",
51
- },
52
- ]
53
- }
54
- value="macOS"
55
- width="100%"
56
- />
57
- </CapColumn>
58
- <CapColumn
59
- className="preview-control-browser"
60
- span={12}
61
- >
62
- <CapLabel
63
- className="preview-control-label"
64
- fontWeight="bold"
65
- type="label1"
66
- >
67
- <FormattedMessage
68
- defaultMessage="Browser"
69
- id="creatives.containersV2.WebPush.browser"
70
- values={Object {}}
71
- />
72
- </CapLabel>
73
- <_Class
74
- labelPosition="top"
75
- onChange={[Function]}
76
- options={
77
- Array [
78
- Object {
79
- "label": "Chrome",
80
- "value": "Chrome",
81
- },
82
- Object {
83
- "label": "Firefox",
84
- "value": "Firefox",
85
- },
86
- Object {
87
- "label": "Edge",
88
- "value": "Edge",
89
- },
90
- Object {
91
- "label": "Safari",
92
- "value": "Safari",
93
- },
94
- Object {
95
- "label": "Opera",
96
- "value": "Opera",
97
- },
98
- ]
99
- }
100
- value="Chrome"
101
- width="100%"
102
- />
103
- </CapColumn>
104
- </CapRow>
105
- <CapRow
106
- className="preview-controls-state"
107
- >
108
- <CapColumn
109
- className="preview-control-state"
110
- span={12}
111
- >
112
- <CapLabel
113
- className="preview-control-label"
114
- fontWeight="bold"
115
- type="label1"
116
- >
117
- <FormattedMessage
118
- defaultMessage="State"
119
- id="creatives.containersV2.WebPush.state"
120
- values={Object {}}
121
- />
122
- </CapLabel>
123
- <_Class
124
- labelPosition="top"
125
- onChange={[MockFunction]}
126
- options={
127
- Array [
128
- Object {
129
- "label": "Collapsed",
130
- "value": "Collapsed",
131
- },
132
- Object {
133
- "label": "Expanded",
134
- "value": "Expanded",
135
- },
136
- ]
137
- }
138
- value="Collapsed"
139
- width="100%"
140
- />
141
- </CapColumn>
142
- </CapRow>
143
- </Fragment>
144
- `;
@@ -1,127 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`WebPushPreview Basic Rendering should render correctly with default props 1`] = `
4
- <CapRow
5
- className="webpush-preview-container"
6
- >
7
- <CapColumn
8
- span={24}
9
- >
10
- <PreviewControls
11
- browserOptions={
12
- Array [
13
- Object {
14
- "label": "Chrome",
15
- "value": "Chrome",
16
- },
17
- Object {
18
- "label": "Firefox",
19
- "value": "Firefox",
20
- },
21
- Object {
22
- "label": "Edge",
23
- "value": "Edge",
24
- },
25
- Object {
26
- "label": "Safari",
27
- "value": "Safari",
28
- },
29
- Object {
30
- "label": "Opera",
31
- "value": "Opera",
32
- },
33
- ]
34
- }
35
- layoutMode="newRow"
36
- onBrowserChange={[Function]}
37
- onOSChange={[Function]}
38
- osOptions={
39
- Array [
40
- Object {
41
- "label": "macOS",
42
- "value": "macOS",
43
- },
44
- Object {
45
- "label": "iOS",
46
- "value": "iOS",
47
- },
48
- Object {
49
- "label": "iPadOS",
50
- "value": "iPadOS",
51
- },
52
- Object {
53
- "label": "Windows",
54
- "value": "Windows",
55
- },
56
- Object {
57
- "label": "Android (Mobile)",
58
- "value": "Android (Mobile)",
59
- },
60
- Object {
61
- "label": "Android (Tablet)",
62
- "value": "Android (Tablet)",
63
- },
64
- ]
65
- }
66
- selectedBrowser="Chrome"
67
- selectedOS="macOS"
68
- showStateDropdown={false}
69
- />
70
- <PreviewContent
71
- brandIconSrc="https://example.com/icon.png"
72
- imageSrc="https://example.com/image.jpg"
73
- notificationBody="Test notification body text"
74
- notificationState="Collapsed"
75
- notificationTitle="Test Notification Title"
76
- selectedBrowser="Chrome"
77
- selectedOS="macOS"
78
- url="https://www.example.com"
79
- />
80
- <PreviewDisclaimer />
81
- <CapRow
82
- className="preview-all-devices-button"
83
- >
84
- <CapColumn
85
- span={24}
86
- >
87
- <CapButton
88
- className="preview-all-devices-trigger"
89
- data-test-id="webpush-preview-toggle"
90
- isAddBtn={false}
91
- onClick={[Function]}
92
- type="flat"
93
- >
94
- <FormattedMessage
95
- defaultMessage="Preview in all devices"
96
- id="creatives.containersV2.WebPush.previewInAllDevices"
97
- values={Object {}}
98
- />
99
- </CapButton>
100
- </CapColumn>
101
- </CapRow>
102
- </CapColumn>
103
- <MockCapSlideBox
104
- className="webpush-preview-slidebox"
105
- content={
106
- <DevicePreviewContent
107
- brandIconSrc="https://example.com/icon.png"
108
- imageSrc="https://example.com/image.jpg"
109
- layoutMode="compact"
110
- notificationBody="Test notification body text"
111
- notificationTitle="Test Notification Title"
112
- url="https://www.example.com"
113
- />
114
- }
115
- handleClose={[Function]}
116
- header={
117
- <FormattedMessage
118
- defaultMessage="Web push notification preview"
119
- id="creatives.containersV2.WebPush.webPushNotificationPreview"
120
- values={Object {}}
121
- />
122
- }
123
- show={false}
124
- size="size-xl"
125
- />
126
- </CapRow>
127
- `;
@@ -1,116 +0,0 @@
1
- /**
2
- * URL Validation Utilities
3
- *
4
- * Provides robust URL validation that works across different environments
5
- * (browser, Node.js, Jest) with multiple fallback strategies.
6
- */
7
-
8
- const SUPPORTED_PROTOCOLS = new Set(['http:', 'https:']);
9
- const HTTP_URL_PATTERN = /^https?:\/\/.+/i;
10
- // Pattern to ensure URL has a TLD (Top Level Domain): protocol://domain.tld
11
- // Requires at least one dot in the domain part, followed by 2+ word characters
12
- // before path separator (/), query (?), hash (#), port (:), or end of string
13
- const TLD_PATTERN = /^https?:\/\/[^/?#:]+\.\w{2,}(?:\/|$|\?|#|:)/i;
14
-
15
- /**
16
- * Resolves the URL constructor available in the current environment
17
- * @returns {Function|null} URL constructor function or null if not available
18
- */
19
- const resolveUrlConstructor = () => {
20
- if (typeof window !== 'undefined' && typeof window.URL === 'function') {
21
- return window.URL;
22
- }
23
-
24
- if (typeof URL === 'function') {
25
- return URL;
26
- }
27
-
28
- return null;
29
- };
30
-
31
- /**
32
- * Checks if document API is available for DOM-based validation
33
- * @returns {boolean} True if document.createElement is available
34
- */
35
- const canUseDocument = () => typeof document !== 'undefined' && typeof document.createElement === 'function';
36
-
37
- /**
38
- * Validates if a value is a valid HTTP/HTTPS URL
39
- * Uses multiple validation strategies for maximum compatibility:
40
- * 1. Regex pattern check for http:// or https:// prefix
41
- * 2. URL constructor validation (if available)
42
- * 3. DOM-based validation using anchor element (if available)
43
- *
44
- * @param {string} value - The URL string to validate
45
- * @returns {boolean} True if the value is a valid HTTP/HTTPS URL
46
- */
47
- export const isValidHttpUrl = (value) => {
48
- if (!value) {
49
- return false;
50
- }
51
-
52
- const trimmedValue = value.trim();
53
- if (!trimmedValue) {
54
- return false;
55
- }
56
-
57
- // First check: regex pattern for http:// or https:// prefix
58
- if (!HTTP_URL_PATTERN.test(trimmedValue)) {
59
- return false;
60
- }
61
-
62
- // Second check: ensure URL has a valid TLD (Top Level Domain)
63
- // URLs like https://google are invalid, but https://google.com is valid
64
- if (!TLD_PATTERN.test(trimmedValue)) {
65
- return false;
66
- }
67
-
68
- // Third check: try URL constructor if available
69
- const UrlConstructor = resolveUrlConstructor();
70
- if (UrlConstructor) {
71
- try {
72
- const parsedUrl = new UrlConstructor(trimmedValue);
73
- if (SUPPORTED_PROTOCOLS.has(parsedUrl.protocol)) {
74
- return true;
75
- }
76
- } catch (error) {
77
- // URL constructor failed, fall back to DOM-based validation
78
- }
79
- }
80
-
81
- // Fourth check: DOM-based validation using anchor element
82
- if (canUseDocument()) {
83
- const parser = document.createElement('a');
84
- parser.href = trimmedValue;
85
- if (SUPPORTED_PROTOCOLS.has(parser.protocol)) {
86
- return true;
87
- }
88
- }
89
-
90
- // If all validation methods failed, return false
91
- return false;
92
- };
93
-
94
- /**
95
- * Validates a URL value and returns an error message if invalid
96
- * This is a higher-level validation function that can be used with form validation
97
- *
98
- * @param {string} value - The URL string to validate
99
- * @param {Function} formatMessage - Function to format error messages (e.g., react-intl formatMessage)
100
- * @param {Object} messages - Object containing error message keys:
101
- * - urlRequired: Message for empty URL
102
- * - urlInvalid: Message for invalid URL format
103
- * @returns {string} Empty string if valid, error message if invalid
104
- */
105
- export const validateUrl = (value, formatMessage, messages) => {
106
- if (!value || value.trim() === '') {
107
- return formatMessage(messages.urlRequired);
108
- }
109
-
110
- if (!isValidHttpUrl(value)) {
111
- return formatMessage(messages.urlInvalid);
112
- }
113
-
114
- return '';
115
- };
116
-