@capillarytech/creatives-library 8.0.357 → 8.0.359-alpha.0

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 (36) hide show
  1. package/index.html +0 -1
  2. package/package.json +1 -1
  3. package/utils/cdnTransformation.js +3 -75
  4. package/utils/tests/cdnTransformation.test.js +0 -127
  5. package/v2Components/CommonTestAndPreview/UnifiedPreview/PreviewHeader.js +0 -16
  6. package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberPreviewContent.js +132 -14
  7. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +163 -54
  8. package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +6 -52
  9. package/v2Components/CommonTestAndPreview/constants.js +0 -2
  10. package/v2Components/CommonTestAndPreview/index.js +231 -77
  11. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/PreviewHeader.test.js +0 -163
  12. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/ViberPreviewContent.test.js +364 -0
  13. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +0 -255
  14. package/v2Components/CommonTestAndPreview/tests/constants.test.js +1 -2
  15. package/v2Components/CommonTestAndPreview/tests/index.test.js +0 -194
  16. package/v2Components/FormBuilder/index.js +52 -162
  17. package/v2Components/TestAndPreviewSlidebox/index.js +2 -2
  18. package/v2Containers/App/constants.js +0 -3
  19. package/v2Containers/CreativesContainer/index.js +24 -60
  20. package/v2Containers/Templates/_templates.scss +77 -0
  21. package/v2Containers/Templates/index.js +92 -82
  22. package/v2Containers/Templates/sagas.js +1 -6
  23. package/v2Containers/Templates/tests/sagas.test.js +6 -23
  24. package/v2Containers/Viber/constants.js +19 -0
  25. package/v2Containers/Viber/index.js +714 -47
  26. package/v2Containers/Viber/index.scss +148 -0
  27. package/v2Containers/Viber/messages.js +116 -0
  28. package/v2Containers/Viber/tests/index.test.js +80 -0
  29. package/v2Containers/WebPush/Create/index.js +8 -91
  30. package/v2Containers/WebPush/Create/index.scss +0 -7
  31. package/v2Components/CommonTestAndPreview/UnifiedPreview/WebPushPreviewContent.js +0 -169
  32. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/WebPushPreviewContent.test.js +0 -522
  33. package/v2Containers/App/tests/constants.test.js +0 -61
  34. package/v2Containers/Templates/tests/webpush.test.js +0 -375
  35. package/v2Containers/WebPush/Create/tests/getTemplateContent.test.js +0 -348
  36. package/v2Containers/WebPush/Create/tests/testAndPreviewIntegration.test.js +0 -325
@@ -2116,6 +2116,8 @@
2116
2116
  flex: 1;
2117
2117
  display: flex;
2118
2118
  flex-direction: column;
2119
+ overflow-y: auto;
2120
+ -webkit-overflow-scrolling: touch;
2119
2121
  padding: 0 $CAP_SPACE_16;
2120
2122
  background-color: #ffffff;
2121
2123
  margin-left: $CAP_SPACE_06;
@@ -2141,6 +2143,12 @@
2141
2143
  margin-top: $CAP_SPACE_16;
2142
2144
  width: 68%;
2143
2145
 
2146
+ &.viber-preview-carousel {
2147
+ width: 100%;
2148
+ margin-left: $CAP_SPACE_12;
2149
+ max-height: none;
2150
+ }
2151
+
2144
2152
  // Account icon (from TemplatePreview line 1146-1160)
2145
2153
  .viber-account-icon {
2146
2154
  width: $CAP_SPACE_20;
@@ -2169,6 +2177,18 @@
2169
2177
  border-radius: $CAP_SPACE_04;
2170
2178
  padding: $CAP_SPACE_04;
2171
2179
 
2180
+ &.viber-message-pop-carousel {
2181
+ width: 100%;
2182
+ left: 0;
2183
+ margin-top: 0;
2184
+ padding: 0;
2185
+ background: transparent;
2186
+ display: flex;
2187
+ flex-direction: column;
2188
+ align-items: flex-start;
2189
+ gap: $CAP_SPACE_06;
2190
+ }
2191
+
2172
2192
  // Text Viber preview (from TemplatePreview line 1166-1174)
2173
2193
  .viber-message-text {
2174
2194
  margin: 0.107rem $CAP_SPACE_06 $CAP_SPACE_01 0.5rem;
@@ -2240,6 +2260,149 @@
2240
2260
  }
2241
2261
  }
2242
2262
 
2263
+ .viber-carousel-message-pop,
2264
+ .viber-carousel-cards-pop {
2265
+ width: 100%;
2266
+ background: $CAP_G08;
2267
+ border-radius: $CAP_SPACE_06;
2268
+ padding: $CAP_SPACE_08;
2269
+ }
2270
+
2271
+ .viber-carousel-message-pop {
2272
+ margin-top: 0;
2273
+ width: 68%;
2274
+ border-radius: 0 $CAP_SPACE_06 $CAP_SPACE_06 $CAP_SPACE_06;
2275
+ }
2276
+
2277
+ .viber-carousel-cards-pop {
2278
+ margin-top: 0;
2279
+ width: 100%;
2280
+ background: transparent;
2281
+ border: none;
2282
+ border-radius: 0;
2283
+ padding: 0;
2284
+ }
2285
+
2286
+ .viber-carousel-message-box {
2287
+ width: 100%;
2288
+ min-height: 2.25rem;
2289
+ height: auto;
2290
+ border-radius: $CAP_SPACE_04;
2291
+ background: transparent;
2292
+ padding: 0 $CAP_SPACE_08;
2293
+ display: flex;
2294
+ align-items: center;
2295
+ }
2296
+
2297
+ .viber-carousel-message-box-text {
2298
+ color: $CAP_G01;
2299
+ margin: 0.107rem $CAP_SPACE_06 $CAP_SPACE_01 0.5rem;
2300
+ white-space: normal;
2301
+ word-break: break-word;
2302
+ overflow: visible;
2303
+ width: 100%;
2304
+ }
2305
+
2306
+ .viber-carousel-message-box-placeholder {
2307
+ width: 100%;
2308
+ height: 0.875rem;
2309
+ border-radius: $CAP_SPACE_04;
2310
+ background: $CAP_G07;
2311
+ }
2312
+
2313
+ .viber-carousel-message-timestamp,
2314
+ .viber-carousel-cards-timestamp {
2315
+ display: block;
2316
+ text-align: right;
2317
+ margin-top: $CAP_SPACE_06;
2318
+ color: $CAP_G04;
2319
+ }
2320
+
2321
+ .viber-carousel-preview-scroll {
2322
+ display: flex;
2323
+ width: 100%;
2324
+ overflow-x: auto;
2325
+ overflow-y: visible;
2326
+
2327
+ scrollbar-width: none;
2328
+ -webkit-overflow-scrolling: touch;
2329
+
2330
+ &::-webkit-scrollbar {
2331
+ display: none;
2332
+ }
2333
+
2334
+ .viber-carousel-preview-card {
2335
+ flex: 0 0 68%;
2336
+ min-width: 68%;
2337
+ margin-right: $CAP_SPACE_08;
2338
+ background: $CAP_G09;
2339
+ border: 1px solid $CAP_G07;
2340
+ border-radius: $CAP_SPACE_12;
2341
+ overflow: hidden;
2342
+ display: flex;
2343
+ flex-direction: column;
2344
+
2345
+ &:last-child {
2346
+ margin-right: 0;
2347
+ }
2348
+
2349
+ .viber-carousel-preview-card-body {
2350
+ padding: $CAP_SPACE_08;
2351
+ display: flex;
2352
+ flex-direction: column;
2353
+ gap: $CAP_SPACE_06;
2354
+ }
2355
+
2356
+ .viber-carousel-preview-image {
2357
+ width: 100%;
2358
+ height: 10rem;
2359
+ object-fit: cover;
2360
+ border-radius: 0;
2361
+ }
2362
+
2363
+ .viber-carousel-preview-image-placeholder {
2364
+ width: 100%;
2365
+ height: 10rem;
2366
+ border-radius: 0;
2367
+ background: $CAP_G07;
2368
+ }
2369
+
2370
+ .viber-carousel-preview-text {
2371
+ color: $CAP_G01;
2372
+ line-height: 1.3;
2373
+ white-space: normal;
2374
+ }
2375
+
2376
+ .viber-carousel-preview-text-placeholder {
2377
+ width: 100%;
2378
+ height: 0.875rem;
2379
+ border-radius: $CAP_SPACE_04;
2380
+ background: $CAP_G07;
2381
+ min-height: 0.875rem;
2382
+ }
2383
+
2384
+ .viber-carousel-preview-button {
2385
+ color: $CAP_WHITE;
2386
+ background: $CAP_PURPLE01;
2387
+ border-radius: $CAP_SPACE_12;
2388
+ text-align: center;
2389
+ width: 100%;
2390
+ display: flex;
2391
+ align-items: center;
2392
+ justify-content: center;
2393
+ min-height: 1.5rem;
2394
+ padding: $CAP_SPACE_06 $CAP_SPACE_08;
2395
+ white-space: normal;
2396
+ }
2397
+
2398
+ .viber-carousel-preview-button-secondary {
2399
+ color: $CAP_PURPLE01;
2400
+ background: transparent;
2401
+ border: none;
2402
+ }
2403
+ }
2404
+ }
2405
+
2243
2406
  .empty-placeholder {
2244
2407
  height: $CAP_SPACE_08;
2245
2408
  }
@@ -2350,60 +2513,6 @@
2350
2513
  }
2351
2514
  }
2352
2515
 
2353
- // WebPush Test & Preview Styles
2354
- .webpush-test-preview-container {
2355
- width: 100%;
2356
- position: relative;
2357
- padding-left: $CAP_SPACE_16;
2358
- padding-right: $CAP_SPACE_16;
2359
- }
2360
-
2361
- .webpush-preview-panel {
2362
- position: relative;
2363
- width: 100%;
2364
- }
2365
-
2366
- .webpush-fullscreen-modal {
2367
- .webpush-fullscreen-divider {
2368
- margin-top: 0;
2369
- margin-bottom: $CAP_SPACE_16;
2370
- }
2371
- .ant-modal.cap-modal-v2 {
2372
- width: 90%;
2373
- max-width: 100%;
2374
- margin-top: $CAP_SPACE_40;
2375
- }
2376
- // Preview Chrome wrapper (matches old TestAndPreviewSlidebox design)
2377
- .webpush-preview-header {
2378
- background: $CAP_WHITE;
2379
- overflow: hidden;
2380
-
2381
- .preview-divider {
2382
- margin: 0;
2383
- }
2384
-
2385
- .webpush-heading-container {
2386
- display: flex;
2387
- justify-content: space-between;
2388
- align-items: center;
2389
- padding: $CAP_SPACE_16 0 $CAP_SPACE_16 0;
2390
-
2391
- .preview-for {
2392
- gap: $CAP_SPACE_04;
2393
- align-items: center;
2394
- b {
2395
- margin-left: $CAP_SPACE_08;
2396
- }
2397
- }
2398
-
2399
- .webpush-fullscreen-close-icon {
2400
- width: $CAP_SPACE_24;
2401
- height: $CAP_SPACE_24;
2402
- }
2403
- }
2404
- }
2405
- }
2406
-
2407
2516
  // Responsive adjustments
2408
2517
  @media (max-width: 85.714rem) {
2409
2518
  .unified-preview {
@@ -6,7 +6,7 @@
6
6
  * Routes to channel-specific preview content components
7
7
  */
8
8
 
9
- import React, { useState } from 'react';
9
+ import React from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import CapRow from '@capillarytech/cap-ui-library/CapRow';
12
12
  import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
@@ -21,7 +21,6 @@ import InAppPreviewContent from './InAppPreviewContent';
21
21
  import MobilePushPreviewContent from './MobilePushPreviewContent';
22
22
  import ViberPreviewContent from './ViberPreviewContent';
23
23
  import ZaloPreviewContent from './ZaloPreviewContent';
24
- import WebPushPreviewContent from './WebPushPreviewContent';
25
24
  import { CHANNELS, DESKTOP, TABLET, MOBILE, ANDROID, IOS } from '../constants';
26
25
  import messages from '../messages';
27
26
  import './_unifiedPreview.scss';
@@ -45,7 +44,6 @@ const UnifiedPreview = ({
45
44
  * For Phase 5, we'll render placeholders
46
45
  * Phase 6+ will implement actual content components
47
46
  */
48
- const [isFullscreenOpen, setIsFullscreenOpen] = useState(false);
49
47
  const renderChannelContent = () => {
50
48
  // Phase 5: Placeholder content for all channels
51
49
  // Phase 6+: Import and render actual channel-specific components
@@ -199,45 +197,6 @@ const UnifiedPreview = ({
199
197
  );
200
198
  }
201
199
 
202
- case CHANNELS.WEBPUSH: {
203
- // WebPush content arrives as a JSON string (from getCurrentContent or preview API response)
204
- let webPushOuter = {};
205
- try {
206
- webPushOuter = typeof content === 'string' ? JSON.parse(content) : (typeof content === 'object' && content !== null ? content : {});
207
- } catch (e) {
208
- webPushOuter = {};
209
- }
210
- const { content: webPushInner = {} } = webPushOuter;
211
- const {
212
- title,
213
- message,
214
- iconImageUrl,
215
- cta,
216
- expandableDetails = {},
217
- } = webPushInner;
218
- const { media: webPushMedia = [], ctas: webPushCtas = [] } = expandableDetails;
219
- const webPushButtons = webPushCtas.map(({ title: text = '', actionLink: url = '', type = '' }) => ({
220
- text,
221
- url,
222
- type,
223
- }));
224
- return (
225
- <WebPushPreviewContent
226
- notificationTitle={title || ''}
227
- notificationBody={message || ''}
228
- imageSrc={webPushMedia[0]?.url || ''}
229
- brandIconSrc={iconImageUrl || ''}
230
- buttons={webPushButtons}
231
- url={cta?.actionLink || ''}
232
- isUpdating={isUpdating}
233
- error={error}
234
- isFullscreenOpen={isFullscreenOpen}
235
- setIsFullscreenOpen={setIsFullscreenOpen}
236
- selectedCustomer={selectedCustomer}
237
- />
238
- );
239
- }
240
-
241
200
  default:
242
201
  return (
243
202
  <div className="channel-preview-placeholder">
@@ -253,8 +212,6 @@ const UnifiedPreview = ({
253
212
  }
254
213
  };
255
214
 
256
- const showToggle = channel !== CHANNELS.WEBPUSH && showDeviceToggle;
257
-
258
215
  /**
259
216
  * Render loading state for all channels
260
217
  */
@@ -265,10 +222,9 @@ const UnifiedPreview = ({
265
222
  <PreviewHeader
266
223
  selectedCustomer={selectedCustomer}
267
224
  device={device}
268
- showDeviceToggle={showToggle}
225
+ showDeviceToggle={showDeviceToggle}
269
226
  onDeviceChange={onDeviceChange}
270
227
  channel={channel}
271
- setIsFullscreenOpen={setIsFullscreenOpen}
272
228
  />
273
229
  )}
274
230
  <CapRow className="preview-loading-container">
@@ -291,10 +247,9 @@ const UnifiedPreview = ({
291
247
  <PreviewHeader
292
248
  selectedCustomer={selectedCustomer}
293
249
  device={device}
294
- showDeviceToggle={showToggle}
250
+ showDeviceToggle={showDeviceToggle}
295
251
  onDeviceChange={onDeviceChange}
296
252
  channel={channel}
297
- setIsFullscreenOpen={setIsFullscreenOpen}
298
253
  />
299
254
  )}
300
255
  <CapRow className="preview-error-container">
@@ -320,16 +275,15 @@ const UnifiedPreview = ({
320
275
  <PreviewHeader
321
276
  selectedCustomer={selectedCustomer}
322
277
  device={device}
323
- showDeviceToggle={showToggle}
278
+ showDeviceToggle={showDeviceToggle}
324
279
  onDeviceChange={onDeviceChange}
325
280
  channel={channel}
326
- setIsFullscreenOpen={setIsFullscreenOpen}
327
281
  />
328
282
  )}
329
283
 
330
284
  {/* Channel-specific preview content */}
331
285
  <CapRow className={`preview-content-container ${!showHeader ? 'preview-content-container-no-header' : ''}`}>
332
- {[CHANNELS.EMAIL, CHANNELS.SMS, CHANNELS.WHATSAPP, CHANNELS.RCS, CHANNELS.INAPP, CHANNELS.MOBILEPUSH, CHANNELS.VIBER, CHANNELS.WEBPUSH].includes(channel) ? (
286
+ {[CHANNELS.EMAIL, CHANNELS.SMS, CHANNELS.WHATSAPP, CHANNELS.RCS, CHANNELS.INAPP, CHANNELS.MOBILEPUSH, CHANNELS.VIBER].includes(channel) ? (
333
287
  renderChannelContent()
334
288
  ) : (
335
289
  <DeviceFrame device={device || DESKTOP}>
@@ -365,7 +319,7 @@ const UnifiedPreview = ({
365
319
  UnifiedPreview.propTypes = {
366
320
  // Core
367
321
  channel: PropTypes.oneOf(Object.values(CHANNELS)).isRequired,
368
- content: PropTypes.oneOfType([PropTypes.object, PropTypes.string]).isRequired,
322
+ content: PropTypes.object.isRequired,
369
323
 
370
324
  // Display options
371
325
  device: PropTypes.oneOf([DESKTOP, TABLET, MOBILE, ANDROID, IOS]),
@@ -85,7 +85,6 @@ export const CHANNELS = {
85
85
  MOBILEPUSH: 'MOBILEPUSH',
86
86
  VIBER: 'VIBER',
87
87
  ZALO: 'ZALO',
88
- WEBPUSH: 'WEBPUSH',
89
88
  };
90
89
  export const CHANNELS_USING_ANDROID_PREVIEW_DEVICE = [CHANNELS.SMS, CHANNELS.RCS, CHANNELS.WHATSAPP, CHANNELS.VIBER, CHANNELS.ZALO, CHANNELS.INAPP, CHANNELS.MOBILEPUSH];
91
90
 
@@ -204,7 +203,6 @@ export const DYNAMIC_URL = 'DYNAMIC_URL';
204
203
  export const IMAGE = 'IMAGE';
205
204
  export const VIDEO = 'VIDEO';
206
205
  export const URL = 'URL';
207
- export const DAYS = 'DAYS';
208
206
 
209
207
  // Initial Payload Template (for reference)
210
208
  export const INITIAL_PAYLOAD = {