@capillarytech/creatives-library 8.0.345-alpha.12 → 8.0.345-alpha.13

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 (138) hide show
  1. package/constants/unified.js +0 -29
  2. package/package.json +1 -1
  3. package/services/api.js +20 -0
  4. package/services/tests/api.test.js +59 -13
  5. package/utils/commonUtils.js +1 -19
  6. package/v2Components/CapActionButton/constants.js +0 -7
  7. package/v2Components/CapActionButton/index.js +109 -167
  8. package/v2Components/CapActionButton/index.scss +6 -157
  9. package/v2Components/CapActionButton/messages.js +3 -19
  10. package/v2Components/CapActionButton/tests/index.test.js +17 -41
  11. package/v2Components/CapCustomSkeleton/index.js +1 -1
  12. package/v2Components/CapCustomSkeleton/tests/__snapshots__/index.test.js.snap +12 -12
  13. package/v2Components/CapTagList/index.js +0 -10
  14. package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +49 -70
  15. package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +2 -8
  16. package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +21 -207
  17. package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -16
  18. package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +10 -85
  19. package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -30
  20. package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +11 -79
  21. package/v2Components/CommonTestAndPreview/SendTestMessage.js +5 -10
  22. package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +15 -160
  23. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +76 -341
  24. package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +4 -133
  25. package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +0 -11
  26. package/v2Components/CommonTestAndPreview/constants.js +2 -38
  27. package/v2Components/CommonTestAndPreview/index.js +186 -676
  28. package/v2Components/CommonTestAndPreview/messages.js +3 -49
  29. package/v2Components/CommonTestAndPreview/sagas.js +6 -15
  30. package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +284 -308
  31. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +65 -231
  32. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +5 -118
  33. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -341
  34. package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +1 -8
  35. package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +13 -34
  36. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +283 -281
  37. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +1 -199
  38. package/v2Components/CommonTestAndPreview/tests/index.test.js +4 -132
  39. package/v2Components/CommonTestAndPreview/tests/sagas.test.js +2 -2
  40. package/v2Components/FormBuilder/index.js +10 -8
  41. package/v2Components/TemplatePreview/_templatePreview.scss +23 -33
  42. package/v2Components/TemplatePreview/index.js +28 -143
  43. package/v2Components/TemplatePreview/tests/index.test.js +0 -142
  44. package/v2Components/TestAndPreviewSlidebox/index.js +1 -13
  45. package/v2Components/TestAndPreviewSlidebox/sagas.js +4 -11
  46. package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +1 -3
  47. package/v2Containers/Assets/images/archive_Empty_Illustration.svg +9 -0
  48. package/v2Containers/CreativesContainer/SlideBoxContent.js +4 -36
  49. package/v2Containers/CreativesContainer/SlideBoxFooter.js +4 -11
  50. package/v2Containers/CreativesContainer/SlideBoxHeader.js +4 -29
  51. package/v2Containers/CreativesContainer/constants.js +0 -9
  52. package/v2Containers/CreativesContainer/index.js +108 -300
  53. package/v2Containers/CreativesContainer/index.scss +1 -51
  54. package/v2Containers/CreativesContainer/messages.js +4 -0
  55. package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +34 -78
  56. package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +16 -79
  57. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -8
  58. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +98 -357
  59. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +18 -20
  60. package/v2Containers/CreativesContainer/tests/index.test.js +9 -71
  61. package/v2Containers/Rcs/constants.js +8 -119
  62. package/v2Containers/Rcs/index.js +812 -2375
  63. package/v2Containers/Rcs/index.scss +6 -276
  64. package/v2Containers/Rcs/messages.js +3 -38
  65. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +70345 -98302
  66. package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +5 -0
  67. package/v2Containers/Rcs/tests/index.test.js +121 -152
  68. package/v2Containers/Rcs/tests/mockData.js +0 -38
  69. package/v2Containers/Rcs/tests/utils.test.js +30 -646
  70. package/v2Containers/Rcs/utils.js +11 -478
  71. package/v2Containers/Sms/Create/index.js +40 -100
  72. package/v2Containers/SmsTrai/Create/index.js +4 -9
  73. package/v2Containers/SmsTrai/Edit/constants.js +0 -2
  74. package/v2Containers/SmsTrai/Edit/index.js +130 -636
  75. package/v2Containers/SmsTrai/Edit/messages.js +4 -14
  76. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +2296 -4249
  77. package/v2Containers/SmsWrapper/index.js +8 -37
  78. package/v2Containers/TagList/index.js +0 -6
  79. package/v2Containers/Templates/ChannelTypeIllustration.js +23 -6
  80. package/v2Containers/Templates/_templates.scss +126 -181
  81. package/v2Containers/Templates/actions.js +36 -11
  82. package/v2Containers/Templates/constants.js +23 -2
  83. package/v2Containers/Templates/index.js +333 -142
  84. package/v2Containers/Templates/messages.js +68 -0
  85. package/v2Containers/Templates/reducer.js +68 -0
  86. package/v2Containers/Templates/sagas.js +98 -55
  87. package/v2Containers/Templates/selectors.js +12 -0
  88. package/v2Containers/Templates/tests/ChannelTypeIllustration.test.js +12 -0
  89. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1256 -1042
  90. package/v2Containers/Templates/tests/index.test.js +6 -0
  91. package/v2Containers/Templates/tests/reducer.test.js +178 -0
  92. package/v2Containers/Templates/tests/sagas.test.js +436 -200
  93. package/v2Containers/Templates/tests/selector.test.js +32 -0
  94. package/v2Containers/TemplatesV2/TemplatesV2.style.js +1 -72
  95. package/v2Containers/TemplatesV2/index.js +23 -86
  96. package/v2Containers/Whatsapp/index.js +20 -3
  97. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -578
  98. package/utils/rcsPayloadUtils.js +0 -92
  99. package/utils/templateVarUtils.js +0 -201
  100. package/utils/tests/templateVarUtils.test.js +0 -204
  101. package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js.rej +0 -18
  102. package/v2Components/CommonTestAndPreview/previewApiUtils.js +0 -59
  103. package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +0 -67
  104. package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +0 -87
  105. package/v2Components/SmsFallback/constants.js +0 -73
  106. package/v2Components/SmsFallback/index.js +0 -955
  107. package/v2Components/SmsFallback/index.scss +0 -265
  108. package/v2Components/SmsFallback/messages.js +0 -78
  109. package/v2Components/SmsFallback/smsFallbackUtils.js +0 -118
  110. package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +0 -50
  111. package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +0 -147
  112. package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +0 -304
  113. package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +0 -197
  114. package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +0 -277
  115. package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +0 -422
  116. package/v2Components/SmsFallback/useLocalTemplateList.js +0 -92
  117. package/v2Components/TemplatePreview/constants.js +0 -2
  118. package/v2Components/VarSegmentMessageEditor/constants.js +0 -2
  119. package/v2Components/VarSegmentMessageEditor/index.js +0 -125
  120. package/v2Components/VarSegmentMessageEditor/index.scss +0 -46
  121. package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +0 -43
  122. package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +0 -67
  123. package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +0 -90
  124. package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +0 -258
  125. package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +0 -125
  126. package/v2Containers/Rcs/index.js.rej +0 -1336
  127. package/v2Containers/Rcs/index.scss.rej +0 -74
  128. package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +0 -225
  129. package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap.rej +0 -128
  130. package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +0 -318
  131. package/v2Containers/Sms/smsFormDataHelpers.js +0 -67
  132. package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +0 -253
  133. package/v2Containers/SmsTrai/Edit/index.scss +0 -121
  134. package/v2Containers/Templates/TemplatesActionBar.js +0 -101
  135. package/v2Containers/Templates/tests/TemplatesActionBar.test.js +0 -120
  136. package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +0 -180
  137. package/v2Containers/Templates/utils/smsTemplatesListApi.js +0 -79
  138. package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +0 -131
@@ -21,21 +21,8 @@ import InAppPreviewContent from './InAppPreviewContent';
21
21
  import MobilePushPreviewContent from './MobilePushPreviewContent';
22
22
  import ViberPreviewContent from './ViberPreviewContent';
23
23
  import ZaloPreviewContent from './ZaloPreviewContent';
24
- import CapTab from '@capillarytech/cap-ui-library/CapTab';
25
- import {
26
- CHANNELS,
27
- DESKTOP,
28
- TABLET,
29
- MOBILE,
30
- ANDROID,
31
- IOS,
32
- PREVIEW_TAB_RCS,
33
- PREVIEW_TAB_SMS_FALLBACK,
34
- PREVIEW_TAB_KEYS,
35
- RCS_SMS_FALLBACK_VAR_MAPPED_PROP,
36
- } from '../constants';
24
+ import { CHANNELS, DESKTOP, TABLET, MOBILE, ANDROID, IOS } from '../constants';
37
25
  import messages from '../messages';
38
- import { getFallbackResolvedContent } from '../../../utils/templateVarUtils';
39
26
  import './_unifiedPreview.scss';
40
27
 
41
28
  const UnifiedPreview = ({
@@ -51,24 +38,7 @@ const UnifiedPreview = ({
51
38
  lastModified,
52
39
  updatedByName,
53
40
  showHeader, // Default to true for Test and Preview flow, false for channel component previews
54
- smsFallbackContent,
55
- smsFallbackResolvedText,
56
- activePreviewTab,
57
- onPreviewTabChange,
58
41
  }) => {
59
- const hasFallbackSmsTemplate = !!(smsFallbackContent?.templateContent || smsFallbackContent?.content);
60
- const showRcsSmsFallbackTabs = channel === CHANNELS.RCS && hasFallbackSmsTemplate;
61
- const rawFallbackTemplate = smsFallbackContent?.templateContent ?? smsFallbackContent?.content ?? '';
62
- const rcsFallbackVarMapped = smsFallbackContent?.[RCS_SMS_FALLBACK_VAR_MAPPED_PROP] ?? {};
63
- const hasRcsFallbackVarMapped = Object.keys(rcsFallbackVarMapped).length > 0;
64
- // When no varmap is present, show raw template so {{tags}} remain visible in the preview.
65
- // Only apply slot substitution when varmap entries exist or a resolved text is available.
66
- const smsFallbackDisplayContent =
67
- smsFallbackResolvedText != null && smsFallbackResolvedText !== ''
68
- ? smsFallbackResolvedText
69
- : hasRcsFallbackVarMapped
70
- ? getFallbackResolvedContent(rawFallbackTemplate, rcsFallbackVarMapped)
71
- : rawFallbackTemplate;
72
42
  /**
73
43
  * Render channel-specific preview content
74
44
  * For Phase 5, we'll render placeholders
@@ -154,21 +124,6 @@ const UnifiedPreview = ({
154
124
  case CHANNELS.RCS: {
155
125
  // RCS content is an object with rcsTitle, rcsDesc, rcsImageSrc, suggestions, etc.
156
126
  const rcsContent = typeof content === 'object' ? content : {};
157
-
158
- if (showRcsSmsFallbackTabs && activePreviewTab === PREVIEW_TAB_SMS_FALLBACK) {
159
- return (
160
- <SmsPreviewContent
161
- content={smsFallbackDisplayContent}
162
- device={ANDROID}
163
- isUpdating={isUpdating}
164
- error={error}
165
- formatMessage={formatMessage}
166
- senderId={smsFallbackContent?.senderId}
167
- showHeader={showHeader}
168
- />
169
- );
170
- }
171
-
172
127
  return (
173
128
  <RcsPreviewContent
174
129
  content={rcsContent}
@@ -313,79 +268,6 @@ const UnifiedPreview = ({
313
268
  * PreviewHeader is shown only when showHeader is true (for Test and Preview flow)
314
269
  * Channel-specific content will be in separate files in future phases
315
270
  */
316
- if (showRcsSmsFallbackTabs) {
317
- const renderPane = ({ paneChannel, paneDevice, paneShowDeviceToggle, paneContent }) => (
318
- <CapRow className="unified-preview-tab-pane">
319
- {showHeader && (
320
- <PreviewHeader
321
- selectedCustomer={selectedCustomer}
322
- device={paneDevice}
323
- showDeviceToggle={paneShowDeviceToggle}
324
- onDeviceChange={onDeviceChange}
325
- channel={paneChannel}
326
- />
327
- )}
328
-
329
- <CapRow className={`preview-content-container ${!showHeader ? 'preview-content-container-no-header' : ''}`}>
330
- {paneContent}
331
- </CapRow>
332
-
333
-
334
- </CapRow>
335
- );
336
-
337
- return (
338
- <CapRow className="unified-preview unified-preview-rcs-tabs">
339
- <CapTab
340
- activeKey={activePreviewTab}
341
- onChange={onPreviewTabChange}
342
- panes={[
343
- {
344
- tab: formatMessage(messages.rcsTab),
345
- key: PREVIEW_TAB_RCS,
346
- content: renderPane({
347
- paneChannel: CHANNELS.RCS,
348
- paneDevice: device,
349
- paneShowDeviceToggle: showDeviceToggle,
350
- paneContent: (
351
- <RcsPreviewContent
352
- content={typeof content === 'object' ? content : {}}
353
- device={device}
354
- isUpdating={isUpdating}
355
- error={error}
356
- formatMessage={formatMessage}
357
- senderId={content?.senderId}
358
- showHeader={showHeader}
359
- />
360
- ),
361
- }),
362
- },
363
- {
364
- tab: formatMessage(messages.smsFallbackTab),
365
- key: PREVIEW_TAB_SMS_FALLBACK,
366
- content: renderPane({
367
- paneChannel: CHANNELS.SMS,
368
- paneDevice: device,
369
- paneShowDeviceToggle: showDeviceToggle,
370
- paneContent: (
371
- <SmsPreviewContent
372
- content={smsFallbackDisplayContent}
373
- device={device}
374
- isUpdating={isUpdating}
375
- error={error}
376
- formatMessage={formatMessage}
377
- senderId={smsFallbackContent?.senderId}
378
- showHeader={showHeader}
379
- />
380
- ),
381
- }),
382
- },
383
- ]}
384
- />
385
- </CapRow>
386
- );
387
- }
388
-
389
271
  return (
390
272
  <CapRow className="unified-preview">
391
273
  {/* PreviewHeader - shown only in Test and Preview flow, hidden in channel component previews */}
@@ -423,7 +305,9 @@ const UnifiedPreview = ({
423
305
  )}
424
306
  {updatedByName && (
425
307
  <span className="metadata-item">
426
- {formatMessage(messages.byAuthor, { name: updatedByName })}
308
+ {formatMessage(messages.by)}
309
+ {' '}
310
+ {updatedByName}
427
311
  </span>
428
312
  )}
429
313
  </CapRow>
@@ -464,15 +348,6 @@ UnifiedPreview.propTypes = {
464
348
 
465
349
  // Header display
466
350
  showHeader: PropTypes.bool, // Show PreviewHeader (true for Test and Preview flow, false for channel component previews)
467
-
468
- // RCS: SMS fallback preview support (same shape as SmsFallback / RCS smsFallbackData)
469
- smsFallbackContent: PropTypes.shape({
470
- templateContent: PropTypes.string,
471
- senderId: PropTypes.string,
472
- templateName: PropTypes.string,
473
- }),
474
- activePreviewTab: PropTypes.oneOf(PREVIEW_TAB_KEYS),
475
- onPreviewTabChange: PropTypes.func,
476
351
  };
477
352
 
478
353
  UnifiedPreview.defaultProps = {
@@ -485,10 +360,6 @@ UnifiedPreview.defaultProps = {
485
360
  lastModified: null,
486
361
  updatedByName: null,
487
362
  showHeader: true, // Default to true for Test and Preview flow
488
- smsFallbackContent: null,
489
- smsFallbackResolvedText: undefined,
490
- activePreviewTab: PREVIEW_TAB_RCS,
491
- onPreviewTabChange: () => {},
492
363
  };
493
364
 
494
365
  export default UnifiedPreview;
@@ -213,10 +213,6 @@
213
213
  margin-right: 0.5rem;
214
214
  }
215
215
 
216
- .cap-slide-box-v2.common-test-and-preview-slidebox .cap-slide-box-v2-container {
217
- z-index: 10030;
218
- }
219
-
220
216
  .common-test-and-preview-slidebox {
221
217
 
222
218
  .ant-modal-mask,
@@ -490,13 +486,6 @@
490
486
  }
491
487
  }
492
488
 
493
- .tags-section-title {
494
- margin: $CAP_SPACE_12 0;
495
- display: block;
496
- color: $CAP_G01;
497
- font-weight: $FONT_WEIGHT_MEDIUM;
498
- }
499
-
500
489
  .values-table {
501
490
  margin-bottom: $CAP_SPACE_16;
502
491
  border: $CAP_SPACE_01 solid $CAP_G12;
@@ -66,6 +66,7 @@ export const GET_WECRM_ACCOUNTS_REQUESTED = 'app/CommonTestAndPreview/GET_WECRM_
66
66
  export const GET_WECRM_ACCOUNTS_SUCCESS = 'app/CommonTestAndPreview/GET_WECRM_ACCOUNTS_SUCCESS';
67
67
  export const GET_WECRM_ACCOUNTS_FAILURE = 'app/CommonTestAndPreview/GET_WECRM_ACCOUNTS_FAILURE';
68
68
 
69
+
69
70
  // ============================================
70
71
  // CUSTOMER MODAL TYPE (test customer addition)
71
72
  // ============================================
@@ -85,44 +86,7 @@ export const CHANNELS = {
85
86
  VIBER: 'VIBER',
86
87
  ZALO: 'ZALO',
87
88
  };
88
-
89
- /** Unified preview tab keys when RCS shows RCS + SMS fallback panes. */
90
- export const PREVIEW_TAB_RCS = 'rcs';
91
- export const PREVIEW_TAB_SMS_FALLBACK = 'smsFallback';
92
- export const PREVIEW_TAB_KEYS = [PREVIEW_TAB_RCS, PREVIEW_TAB_SMS_FALLBACK];
93
-
94
- /** Channels whose Test & Preview defaults to Android/iOS device frame (not desktop). */
95
- export const CHANNELS_USING_ANDROID_PREVIEW_DEVICE = [
96
- CHANNELS.SMS,
97
- CHANNELS.WHATSAPP,
98
- CHANNELS.RCS,
99
- CHANNELS.INAPP,
100
- CHANNELS.MOBILEPUSH,
101
- CHANNELS.VIBER,
102
- ];
103
-
104
- /** RCS createMessageMeta test payload — rich card envelope literals. */
105
- export const RCS_TEST_META_CONTENT_TYPE_RICHCARD = 'RICHCARD';
106
- export const RCS_TEST_META_CARD_TYPE_STANDALONE = 'STANDALONE';
107
- export const RCS_TEST_META_CARD_ORIENTATION_VERTICAL = 'VERTICAL';
108
- export const RCS_TEST_META_CARD_WIDTH_SMALL = 'SMALL';
109
-
110
- /** React key fallback when a custom-values section has no `key` or title id. */
111
- export const CUSTOM_VALUES_EDITOR_SECTION_FALLBACK_KEY = 'section';
112
-
113
- /**
114
- * Matches at least one `{{variableName}}` token in SMS / RCS fallback template text.
115
- */
116
- export const SMS_MUSTACHE_TAG_PATTERN = /\{\{[^}]+\}\}/;
117
-
118
- /** TRAI DLT `{#…#}` placeholders (same idea as `COMBINED_SMS_TEMPLATE_VAR_REGEX` in unified constants). */
119
- export const SMS_DLT_HASH_TAG_PATTERN = /\{\#[^#]*\#\}/;
120
-
121
- /**
122
- * Key on `smsFallbackContent` passed into Test & Preview — RCS slot map from SmsTraiEdit
123
- * (`onRcsFallbackEditorStateChange`), merged before tag extraction like the embedded SMS editor.
124
- */
125
- export const RCS_SMS_FALLBACK_VAR_MAPPED_PROP = 'rcsSmsFallbackVarMapped';
89
+ export const CHANNELS_USING_ANDROID_PREVIEW_DEVICE = [CHANNELS.SMS, CHANNELS.RCS, CHANNELS.WHATSAPP, CHANNELS.VIBER, CHANNELS.ZALO, CHANNELS.INAPP, CHANNELS.MOBILEPUSH];
126
90
 
127
91
  // ============================================
128
92
  // DEVICE CONSTANTS