@capillarytech/creatives-library 8.0.316 → 8.0.317-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 (172) hide show
  1. package/constants/unified.js +15 -0
  2. package/package.json +1 -1
  3. package/services/api.js +6 -0
  4. package/services/tests/api.test.js +7 -0
  5. package/utils/common.js +6 -1
  6. package/utils/templateVarUtils.js +172 -0
  7. package/utils/tests/tagValidations.test.js +34 -0
  8. package/utils/tests/templateVarUtils.test.js +160 -0
  9. package/v2Components/CapTagList/index.js +25 -22
  10. package/v2Components/CapTagList/style.scss +48 -0
  11. package/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +63 -0
  12. package/v2Components/CapTagListWithInput/index.js +4 -0
  13. package/v2Components/CapWhatsappCTA/index.js +2 -0
  14. package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +70 -49
  15. package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +8 -2
  16. package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +207 -21
  17. package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +16 -0
  18. package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +85 -10
  19. package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +30 -0
  20. package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +79 -11
  21. package/v2Components/CommonTestAndPreview/SendTestMessage.js +11 -5
  22. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +20 -1
  23. package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +133 -4
  24. package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +12 -0
  25. package/v2Components/CommonTestAndPreview/constants.js +38 -0
  26. package/v2Components/CommonTestAndPreview/index.js +693 -155
  27. package/v2Components/CommonTestAndPreview/messages.js +41 -3
  28. package/v2Components/CommonTestAndPreview/previewApiUtils.js +59 -0
  29. package/v2Components/CommonTestAndPreview/sagas.js +15 -6
  30. package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +352 -0
  31. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +269 -1
  32. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +118 -5
  33. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +341 -0
  34. package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +25 -4
  35. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +199 -1
  36. package/v2Components/CommonTestAndPreview/tests/index.test.js +132 -4
  37. package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +67 -0
  38. package/v2Components/CommonTestAndPreview/tests/sagas.test.js +2 -2
  39. package/v2Components/FormBuilder/index.js +14 -1
  40. package/v2Components/HtmlEditor/HTMLEditor.js +6 -1
  41. package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -0
  42. package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +927 -2
  43. package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +3 -0
  44. package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +87 -0
  45. package/v2Components/SmsFallback/constants.js +73 -0
  46. package/v2Components/SmsFallback/index.js +956 -0
  47. package/v2Components/SmsFallback/index.scss +265 -0
  48. package/v2Components/SmsFallback/messages.js +78 -0
  49. package/v2Components/SmsFallback/smsFallbackUtils.js +107 -0
  50. package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +50 -0
  51. package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +147 -0
  52. package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +304 -0
  53. package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +197 -0
  54. package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +261 -0
  55. package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +422 -0
  56. package/v2Components/SmsFallback/useLocalTemplateList.js +92 -0
  57. package/v2Components/TestAndPreviewSlidebox/index.js +8 -1
  58. package/v2Components/TestAndPreviewSlidebox/sagas.js +11 -4
  59. package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +3 -1
  60. package/v2Components/VarSegmentMessageEditor/constants.js +2 -0
  61. package/v2Components/VarSegmentMessageEditor/index.js +125 -0
  62. package/v2Components/VarSegmentMessageEditor/index.scss +46 -0
  63. package/v2Containers/BeeEditor/index.js +3 -0
  64. package/v2Containers/CommunicationFlow/CommunicationFlow.js +291 -0
  65. package/v2Containers/CommunicationFlow/CommunicationFlow.scss +25 -0
  66. package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +255 -0
  67. package/v2Containers/CommunicationFlow/constants.js +200 -0
  68. package/v2Containers/CommunicationFlow/index.js +102 -0
  69. package/v2Containers/CommunicationFlow/messages.js +346 -0
  70. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +522 -0
  71. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.scss +170 -0
  72. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/ChannelSelectionStep.test.js +796 -0
  73. package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/index.js +5 -0
  74. package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/CommunicationStrategyStep.js +95 -0
  75. package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/Tests/CommunicationStrategyStep.test.js +133 -0
  76. package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/index.js +5 -0
  77. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +289 -0
  78. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.scss +70 -0
  79. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +319 -0
  80. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.scss +69 -0
  81. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +616 -0
  82. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +577 -0
  83. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/deliverySettingsConfig.test.js +1111 -0
  84. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/deliverySettingsConfig.js +696 -0
  85. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/index.js +7 -0
  86. package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.js +102 -0
  87. package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.scss +36 -0
  88. package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/Tests/DynamicControlsStep.test.js +91 -0
  89. package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/index.js +5 -0
  90. package/v2Containers/CommunicationFlow/steps/MessageTypeStep/MessageTypeStep.js +86 -0
  91. package/v2Containers/CommunicationFlow/steps/MessageTypeStep/Tests/MessageTypeStep.test.js +100 -0
  92. package/v2Containers/CommunicationFlow/steps/MessageTypeStep/index.js +5 -0
  93. package/v2Containers/CommunicationFlow/utils/getEnabledSteps.js +30 -0
  94. package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +43 -0
  95. package/v2Containers/CreativesContainer/SlideBoxContent.js +64 -5
  96. package/v2Containers/CreativesContainer/SlideBoxFooter.js +10 -1
  97. package/v2Containers/CreativesContainer/SlideBoxHeader.js +29 -4
  98. package/v2Containers/CreativesContainer/constants.js +12 -0
  99. package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +67 -0
  100. package/v2Containers/CreativesContainer/index.js +289 -93
  101. package/v2Containers/CreativesContainer/index.scss +51 -1
  102. package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +90 -0
  103. package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +104 -0
  104. package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +110 -0
  105. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +8 -0
  106. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +363 -0
  107. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +20 -10
  108. package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +258 -0
  109. package/v2Containers/CreativesContainer/tests/index.test.js +71 -9
  110. package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +125 -0
  111. package/v2Containers/Email/index.js +1 -0
  112. package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +7 -1
  113. package/v2Containers/EmailWrapper/components/EmailWrapperView.js +3 -0
  114. package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +20 -2
  115. package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +16 -1
  116. package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +3 -0
  117. package/v2Containers/EmailWrapper/index.js +4 -0
  118. package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +1 -0
  119. package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +9 -0
  120. package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +19 -0
  121. package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +3 -0
  122. package/v2Containers/InAppWrapper/index.js +3 -0
  123. package/v2Containers/MobilePush/Create/index.js +2 -0
  124. package/v2Containers/MobilePush/Edit/index.js +2 -0
  125. package/v2Containers/MobilepushWrapper/index.js +3 -1
  126. package/v2Containers/Rcs/constants.js +32 -1
  127. package/v2Containers/Rcs/index.js +951 -873
  128. package/v2Containers/Rcs/index.scss +85 -6
  129. package/v2Containers/Rcs/messages.js +10 -1
  130. package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +205 -0
  131. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +40834 -1963
  132. package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +0 -5
  133. package/v2Containers/Rcs/tests/index.test.js +41 -38
  134. package/v2Containers/Rcs/tests/mockData.js +38 -0
  135. package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +251 -0
  136. package/v2Containers/Rcs/tests/utils.test.js +379 -1
  137. package/v2Containers/Rcs/utils.js +358 -10
  138. package/v2Containers/Sms/Create/index.js +83 -36
  139. package/v2Containers/Sms/Edit/index.js +2 -0
  140. package/v2Containers/Sms/smsFormDataHelpers.js +67 -0
  141. package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +253 -0
  142. package/v2Containers/SmsTrai/Create/index.js +9 -4
  143. package/v2Containers/SmsTrai/Edit/constants.js +2 -0
  144. package/v2Containers/SmsTrai/Edit/index.js +611 -128
  145. package/v2Containers/SmsTrai/Edit/index.scss +121 -0
  146. package/v2Containers/SmsTrai/Edit/messages.js +9 -4
  147. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4327 -2374
  148. package/v2Containers/SmsWrapper/index.js +39 -8
  149. package/v2Containers/TagList/index.js +47 -2
  150. package/v2Containers/TagList/messages.js +4 -0
  151. package/v2Containers/TagList/tests/TagList.test.js +122 -20
  152. package/v2Containers/TagList/tests/mockdata.js +17 -0
  153. package/v2Containers/Templates/TemplatesActionBar.js +101 -0
  154. package/v2Containers/Templates/_templates.scss +61 -2
  155. package/v2Containers/Templates/actions.js +11 -0
  156. package/v2Containers/Templates/constants.js +2 -0
  157. package/v2Containers/Templates/index.js +90 -40
  158. package/v2Containers/Templates/sagas.js +57 -12
  159. package/v2Containers/Templates/tests/TemplatesActionBar.test.js +120 -0
  160. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1043 -1079
  161. package/v2Containers/Templates/tests/sagas.test.js +193 -12
  162. package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +180 -0
  163. package/v2Containers/Templates/utils/smsTemplatesListApi.js +79 -0
  164. package/v2Containers/TemplatesV2/TemplatesV2.style.js +72 -1
  165. package/v2Containers/TemplatesV2/index.js +86 -23
  166. package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +131 -0
  167. package/v2Containers/Viber/index.js +5 -0
  168. package/v2Containers/WebPush/Create/hooks/useTagManagement.js +0 -2
  169. package/v2Containers/WebPush/Create/index.js +9 -1
  170. package/v2Containers/Whatsapp/index.js +8 -20
  171. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +598 -34
  172. package/v2Containers/Zalo/index.js +2 -0
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
4
  import get from 'lodash/get';
5
5
  import isEmpty from 'lodash/isEmpty';
6
+ import pick from 'lodash/pick';
6
7
  import cloneDeep from 'lodash/cloneDeep';
7
8
  import TemplatesV2 from '../TemplatesV2';
8
9
  import TemplatePreview from '../../v2Components/TemplatePreview';
@@ -25,6 +26,7 @@ import Viber from '../Viber';
25
26
  import Whatsapp from '../Whatsapp';
26
27
  import InApp from '../InApp';
27
28
  import Rcs from '../Rcs';
29
+ import { isRcsTextOnlyCardMediaType, resolveRcsCardPreviewStrings } from '../Rcs/utils';
28
30
  import { getWhatsappContent } from '../Whatsapp/utils';
29
31
  import * as commonUtil from '../../utils/common';
30
32
  import Zalo from '../Zalo';
@@ -168,6 +170,7 @@ export function SlideBoxContent(props) {
168
170
  creativesMode,
169
171
  hostName = '',
170
172
  eventContextTags,
173
+ waitEventContextTags,
171
174
  isLoyaltyModule,
172
175
  loyaltyMetaData = {},
173
176
  showTestAndPreviewSlidebox,
@@ -179,6 +182,8 @@ export function SlideBoxContent(props) {
179
182
  isTestAndPreviewMode,
180
183
  onHtmlEditorValidationStateChange,
181
184
  } = props;
185
+ const localTemplatesConfig = props.localTemplatesConfig || pick(props, constants.LOCAL_TEMPLATE_CONFIG_KEYS);
186
+ const useLocalTemplates = !!get(localTemplatesConfig, 'useLocalTemplates');
182
187
  const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
183
188
  const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
184
189
  const creativesLocationProps = {
@@ -398,12 +403,37 @@ export function SlideBoxContent(props) {
398
403
  }
399
404
  case constants.RCS: {
400
405
  const template = cloneDeep(templateDataObject);
401
- const { description = "", media: { mediaUrl = "" } = {}, title = "", suggestions = [] } = get(template, 'versions.base.content.RCS.rcsContent.cardContent[0]', {});
406
+ const cardPath = 'versions.base.content.RCS.rcsContent.cardContent[0]';
407
+ const card = get(template, cardPath, {}) || {};
408
+ const {
409
+ description = '',
410
+ media: { mediaUrl = '' } = {},
411
+ title = '',
412
+ mediaType: cardMediaType,
413
+ suggestions = [],
414
+ cardVarMapped: nestedCardVarMapped,
415
+ } = card;
416
+ const rootMirror = templateDataObject?.rcsCardVarMapped;
417
+ const nestedRecord =
418
+ nestedCardVarMapped != null && typeof nestedCardVarMapped === 'object'
419
+ ? nestedCardVarMapped
420
+ : {};
421
+ const rootRecord =
422
+ rootMirror != null && typeof rootMirror === 'object' ? rootMirror : {};
423
+ const mergedCardVarMapped = { ...rootRecord, ...nestedRecord };
424
+ const textOnlyCard = isRcsTextOnlyCardMediaType(cardMediaType);
425
+ const { rcsTitle, rcsDesc } = resolveRcsCardPreviewStrings(
426
+ title,
427
+ description,
428
+ mergedCardVarMapped,
429
+ !isFullMode,
430
+ textOnlyCard,
431
+ );
402
432
  return {
403
433
  rcsPreviewContent: {
404
434
  rcsImageSrc: mediaUrl,
405
- rcsTitle: title,
406
- rcsDesc: description,
435
+ rcsTitle,
436
+ rcsDesc,
407
437
  ...(suggestions.length > 0 && {
408
438
  buttonText: suggestions[0]?.text,
409
439
  }),
@@ -424,11 +454,12 @@ export function SlideBoxContent(props) {
424
454
  selectedOfferDetails,
425
455
  getFormData,
426
456
  eventContextTags,
457
+ waitEventContextTags,
427
458
  };
428
459
 
429
460
  return (
430
461
  <CreativesWrapper>
431
- {!isFullMode && slidBoxContent === 'templates' && (
462
+ {slidBoxContent === 'templates' && (!isFullMode || useLocalTemplates) && (
432
463
  <TemplatesV2
433
464
  isFullMode={isFullMode}
434
465
  onSelectTemplate={onSelectTemplate}
@@ -458,8 +489,10 @@ export function SlideBoxContent(props) {
458
489
  enableNewChannels={enableNewChannels}
459
490
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
460
491
  eventContextTags={eventContextTags}
492
+ waitEventContextTags={waitEventContextTags}
461
493
  loyaltyMetaData={loyaltyMetaData}
462
494
  isLoyaltyModule={isLoyaltyModule}
495
+ localTemplatesConfig={localTemplatesConfig}
463
496
  />
464
497
  )}
465
498
  {isPreview && (
@@ -561,6 +594,7 @@ export function SlideBoxContent(props) {
561
594
  onCreateComplete={onCreateComplete}
562
595
  smsRegister={smsRegister}
563
596
  eventContextTags={eventContextTags}
597
+ waitEventContextTags={waitEventContextTags}
564
598
  getLiquidTags={getLiquidTags}
565
599
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
566
600
  handleTestAndPreview={handleTestAndPreview}
@@ -604,6 +638,7 @@ export function SlideBoxContent(props) {
604
638
  }}
605
639
  hostName={hostName}
606
640
  eventContextTags={eventContextTags}
641
+ waitEventContextTags={waitEventContextTags}
607
642
  showLiquidErrorInFooter={showLiquidErrorInFooter}
608
643
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
609
644
  handleTestAndPreview={handleTestAndPreview}
@@ -628,6 +663,7 @@ export function SlideBoxContent(props) {
628
663
  route={{ name: 'sms' }}
629
664
  isCreateSms={isCreateSms}
630
665
  isComponent
666
+ templateData={templateData}
631
667
  isGetFormData={isGetFormData}
632
668
  getFormSubscriptionData={getFormData}
633
669
  getLiquidTags={getLiquidTags}
@@ -644,6 +680,7 @@ export function SlideBoxContent(props) {
644
680
  eventContextTags={eventContextTags}
645
681
  restrictPersonalization={restrictPersonalization}
646
682
  isAnonymousType={isAnonymousType}
683
+ waitEventContextTags={waitEventContextTags}
647
684
  />
648
685
  )}
649
686
 
@@ -677,6 +714,7 @@ export function SlideBoxContent(props) {
677
714
  moduleType={moduleType}
678
715
  showLiquidErrorInFooter={showLiquidErrorInFooter}
679
716
  eventContextTags={eventContextTags}
717
+ waitEventContextTags={waitEventContextTags}
680
718
  isLoyaltyModule={isLoyaltyModule}
681
719
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
682
720
  handleTestAndPreview={handleTestAndPreview}
@@ -721,6 +759,7 @@ export function SlideBoxContent(props) {
721
759
  moduleType={moduleType}
722
760
  showLiquidErrorInFooter={showLiquidErrorInFooter}
723
761
  eventContextTags={eventContextTags}
762
+ waitEventContextTags={waitEventContextTags}
724
763
  isLoyaltyModule={isLoyaltyModule}
725
764
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
726
765
  handleTestAndPreview={handleTestAndPreview}
@@ -760,6 +799,7 @@ export function SlideBoxContent(props) {
760
799
  moduleType={moduleType}
761
800
  showLiquidErrorInFooter={showLiquidErrorInFooter}
762
801
  eventContextTags={eventContextTags}
802
+ waitEventContextTags={waitEventContextTags}
763
803
  isLoyaltyModule={isLoyaltyModule}
764
804
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
765
805
  handleTestAndPreview={handleTestAndPreview}
@@ -803,6 +843,7 @@ export function SlideBoxContent(props) {
803
843
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
804
844
  creativesMode={creativesMode}
805
845
  eventContextTags={eventContextTags}
846
+ waitEventContextTags={waitEventContextTags}
806
847
  showLiquidErrorInFooter={showLiquidErrorInFooter}
807
848
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
808
849
  handleTestAndPreview={handleTestAndPreview}
@@ -835,6 +876,7 @@ export function SlideBoxContent(props) {
835
876
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
836
877
  creativesMode={creativesMode}
837
878
  eventContextTags={eventContextTags}
879
+ waitEventContextTags={waitEventContextTags}
838
880
  showLiquidErrorInFooter={showLiquidErrorInFooter}
839
881
  handleClose={handleClose}
840
882
  restrictPersonalization={restrictPersonalization}
@@ -874,6 +916,7 @@ export function SlideBoxContent(props) {
874
916
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
875
917
  onTestContentClicked={onTestContentClicked}
876
918
  eventContextTags={eventContextTags}
919
+ waitEventContextTags={waitEventContextTags}
877
920
  showLiquidErrorInFooter={showLiquidErrorInFooter}
878
921
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
879
922
  handleTestAndPreview={handleTestAndPreview}
@@ -912,6 +955,7 @@ export function SlideBoxContent(props) {
912
955
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
913
956
  onTestContentClicked={onTestContentClicked}
914
957
  eventContextTags={eventContextTags}
958
+ waitEventContextTags={waitEventContextTags}
915
959
  showLiquidErrorInFooter={showLiquidErrorInFooter}
916
960
  onCreateComplete={onCreateComplete}
917
961
  creativesMode={creativesMode}
@@ -937,6 +981,7 @@ export function SlideBoxContent(props) {
937
981
  onSelectTemplate={onSelectTemplate}
938
982
  orgUnitId={orgUnitId}
939
983
  eventContextTags={eventContextTags}
984
+ waitEventContextTags={waitEventContextTags}
940
985
  showLiquidErrorInFooter={showLiquidErrorInFooter}
941
986
  />
942
987
  )
@@ -958,6 +1003,7 @@ export function SlideBoxContent(props) {
958
1003
  fbAdManager={fbAdManager}
959
1004
  onSelectTemplate={onSelectTemplate}
960
1005
  eventContextTags={eventContextTags}
1006
+ waitEventContextTags={waitEventContextTags}
961
1007
  showLiquidErrorInFooter={showLiquidErrorInFooter}
962
1008
  />
963
1009
  )
@@ -981,6 +1027,7 @@ export function SlideBoxContent(props) {
981
1027
  handleClose={handleClose}
982
1028
  selectedOfferDetails={selectedOfferDetails}
983
1029
  eventContextTags={eventContextTags}
1030
+ waitEventContextTags={waitEventContextTags}
984
1031
  showLiquidErrorInFooter={showLiquidErrorInFooter}
985
1032
  />
986
1033
  )
@@ -1001,6 +1048,7 @@ export function SlideBoxContent(props) {
1001
1048
  handleClose={handleClose}
1002
1049
  selectedOfferDetails={selectedOfferDetails}
1003
1050
  eventContextTags={eventContextTags}
1051
+ waitEventContextTags={waitEventContextTags}
1004
1052
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1005
1053
  />
1006
1054
  )
@@ -1017,6 +1065,7 @@ export function SlideBoxContent(props) {
1017
1065
  templateData={templateData}
1018
1066
  selectedOfferDetails={selectedOfferDetails}
1019
1067
  eventContextTags={eventContextTags}
1068
+ waitEventContextTags={waitEventContextTags}
1020
1069
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1021
1070
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
1022
1071
  handleTestAndPreview={handleTestAndPreview}
@@ -1041,6 +1090,7 @@ export function SlideBoxContent(props) {
1041
1090
  handleTestAndPreview={handleTestAndPreview}
1042
1091
  handleCloseTestAndPreview={handleCloseTestAndPreview}
1043
1092
  eventContextTags={eventContextTags}
1093
+ waitEventContextTags={waitEventContextTags}
1044
1094
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1045
1095
  createNew/> }
1046
1096
 
@@ -1048,6 +1098,7 @@ export function SlideBoxContent(props) {
1048
1098
  isFullMode={isFullMode}
1049
1099
  onCreateComplete={onCreateComplete}
1050
1100
  eventContextTags={eventContextTags}
1101
+ waitEventContextTags={waitEventContextTags}
1051
1102
  handleClose={handleClose}
1052
1103
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1053
1104
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
@@ -1065,6 +1116,7 @@ export function SlideBoxContent(props) {
1065
1116
  forwardedTags={forwardedTags}
1066
1117
  selectedOfferDetails={selectedOfferDetails}
1067
1118
  eventContextTags={eventContextTags}
1119
+ waitEventContextTags={waitEventContextTags}
1068
1120
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
1069
1121
  handleTestAndPreview={handleTestAndPreview}
1070
1122
  handleCloseTestAndPreview={handleCloseTestAndPreview}
@@ -1103,6 +1155,7 @@ export function SlideBoxContent(props) {
1103
1155
  onPreviewContentClicked={onPreviewContentClicked}
1104
1156
  onTestContentClicked={onTestContentClicked}
1105
1157
  eventContextTags={eventContextTags}
1158
+ waitEventContextTags={waitEventContextTags}
1106
1159
  onCreateComplete={onCreateComplete}
1107
1160
  handleClose={handleClose}
1108
1161
  moduleType={moduleType}
@@ -1138,6 +1191,7 @@ export function SlideBoxContent(props) {
1138
1191
  moduleType={moduleType}
1139
1192
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1140
1193
  eventContextTags={eventContextTags}
1194
+ waitEventContextTags={waitEventContextTags}
1141
1195
  onCreateComplete={onCreateComplete}
1142
1196
  handleClose={handleClose}
1143
1197
  getDefaultTags={type}
@@ -1161,6 +1215,7 @@ export function SlideBoxContent(props) {
1161
1215
  onCreateComplete={onCreateComplete}
1162
1216
  selectedOfferDetails={selectedOfferDetails}
1163
1217
  eventContextTags={eventContextTags}
1218
+ waitEventContextTags={waitEventContextTags}
1164
1219
  params={{
1165
1220
  id: templateData._id,
1166
1221
  }}
@@ -1199,10 +1254,12 @@ export function SlideBoxContent(props) {
1199
1254
  eventContextTags={eventContextTags}
1200
1255
  restrictPersonalization={restrictPersonalization}
1201
1256
  isAnonymousType={isAnonymousType}
1257
+ waitEventContextTags={waitEventContextTags}
1202
1258
  />
1203
1259
  )}
1204
1260
  {isCreateRcs && (<Rcs
1205
1261
  {...rcsCommonProps}
1262
+ templateData={templateData}
1206
1263
  showLiquidErrorInFooter={showLiquidErrorInFooter}
1207
1264
  showTestAndPreviewSlidebox={showTestAndPreviewSlidebox}
1208
1265
  handleTestAndPreview={handleTestAndPreview}
@@ -1292,6 +1349,8 @@ SlideBoxContent.propTypes = {
1292
1349
  showTestAndPreviewSlidebox: PropTypes.bool,
1293
1350
  handleTestAndPreview: PropTypes.func,
1294
1351
  handleCloseTestAndPreview: PropTypes.func,
1295
- isTestAndPreviewMode: PropTypes.bool
1352
+ isTestAndPreviewMode: PropTypes.bool,
1353
+ waitEventContextTags: PropTypes.object,
1354
+ eventContextTags: PropTypes.array,
1296
1355
  };
1297
1356
  export default SlideBoxContent;
@@ -48,6 +48,8 @@ function SlideBoxFooter(props) {
48
48
  isAnonymousType = false,
49
49
  templateData = {},
50
50
  hasPersonalizationTokenError: hasPersonalizationTokenErrorProp = false,
51
+ /** When set (e.g. SMS library create), overrides `creativesTemplatesSave` (“Done”) for the primary button */
52
+ primarySaveButtonMessage,
51
53
  } = props;
52
54
  // Calculate if buttons should be disabled
53
55
  // Only apply validation state checks for EMAIL channel in HTML Editor mode (not BEE/DragDrop)
@@ -186,7 +188,9 @@ function SlideBoxFooter(props) {
186
188
  onClick={onSave}
187
189
  disabled={isTemplateNameEmpty || fetchingCmsData || shouldDisableButtons || hasPersonalizationTokenError}
188
190
  >
189
- {isFullMode ? (
191
+ {primarySaveButtonMessage ? (
192
+ <FormattedMessage {...primarySaveButtonMessage} />
193
+ ) : isFullMode ? (
190
194
  getFullModeSaveBtn(slidBoxContent, isCreatingTemplate)
191
195
  ) : (
192
196
  <FormattedMessage {...messages.creativesTemplatesSave} />
@@ -262,6 +266,10 @@ SlideBoxFooter.propTypes = {
262
266
  templateData: PropTypes.object,
263
267
  formData: PropTypes.array,
264
268
  hasPersonalizationTokenError: PropTypes.bool,
269
+ primarySaveButtonMessage: PropTypes.shape({
270
+ id: PropTypes.string,
271
+ defaultMessage: PropTypes.string,
272
+ }),
265
273
  };
266
274
 
267
275
  SlideBoxFooter.defaultProps = {
@@ -289,5 +297,6 @@ SlideBoxFooter.defaultProps = {
289
297
  selectedEmailCreateMode: '',
290
298
  formData: [],
291
299
  hasPersonalizationTokenError: false,
300
+ primarySaveButtonMessage: undefined,
292
301
  };
293
302
  export default SlideBoxFooter;
@@ -16,6 +16,7 @@ import { isTraiDLTEnable } from '../../utils/common';
16
16
  import { formatString } from '../../utils/Formatter';
17
17
  import {
18
18
  CAP_SPACE_12,
19
+ CAP_SPACE_16,
19
20
  } from '@capillarytech/cap-ui-library/styled/variables';
20
21
  import { WHATSAPP_HELP_DOC_LINK, JOURNEY } from './constants';
21
22
 
@@ -24,7 +25,7 @@ const StyledLabel = styled(CapLabelInline)`
24
25
  margin-right: ${CAP_SPACE_12};
25
26
  `;
26
27
  const PrefixWrapper = styled.div`
27
- margin-right: 16px;
28
+ margin-right: ${CAP_SPACE_16};
28
29
  `;
29
30
  const renderData = (type, value, channel) => (
30
31
  <StyledLabel className={channel?.toLowerCase() === ZALO ? 'zalo-template-name-spacing' : ''} type={type}>
@@ -33,7 +34,25 @@ const renderData = (type, value, channel) => (
33
34
  );
34
35
 
35
36
  export function SlideBoxHeader(props) {
36
- const { slidBoxContent, templateData, onShowTemplates, creativesMode, isFullMode, showPrefix, shouldShowTemplateName, channel, templateNameRenderProp, weChatTemplateType, onWeChatMaptemplateStepChange, weChatMaptemplateStep, templateStep, smsRegister, handleClose, moduleType } = props;
37
+ const {
38
+ slidBoxContent,
39
+ templateData,
40
+ onShowTemplates,
41
+ creativesMode,
42
+ isFullMode,
43
+ showPrefix,
44
+ shouldShowTemplateName,
45
+ channel,
46
+ templateNameRenderProp,
47
+ weChatTemplateType,
48
+ onWeChatMaptemplateStepChange,
49
+ weChatMaptemplateStep,
50
+ templateStep,
51
+ smsRegister,
52
+ handleClose,
53
+ moduleType,
54
+ useLocalTemplates = false,
55
+ } = props;
37
56
  const showTemplateNameHeader = isFullMode && shouldShowTemplateName;
38
57
  const mapTemplateCreate = !showTemplateNameHeader && slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
39
58
  const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
@@ -81,6 +100,9 @@ export function SlideBoxHeader(props) {
81
100
  window.open(WHATSAPP_HELP_DOC_LINK, '_blank');
82
101
  };
83
102
 
103
+ const showCreativesTemplatesBackButton =
104
+ !isFullMode && (moduleType === JOURNEY || useLocalTemplates);
105
+
84
106
  return (
85
107
  <div key="creatives-container-slidebox-header-content">
86
108
  {slidBoxContent === 'templates' && !showTemplateNameHeader && (
@@ -89,7 +111,7 @@ export function SlideBoxHeader(props) {
89
111
  description={![NO_COMMUNICATION, FTP].includes(channel) &&
90
112
  <FormattedMessage {...messages.creativeTemplatesDesc} />
91
113
  }
92
- prefix={!isFullMode && moduleType === JOURNEY &&
114
+ prefix={showCreativesTemplatesBackButton &&
93
115
  <PrefixWrapper>
94
116
  <CapIcons.backIcon onClick={handleClose} />
95
117
  </PrefixWrapper>
@@ -135,7 +157,7 @@ export function SlideBoxHeader(props) {
135
157
  }
136
158
  </>
137
159
  }
138
- prefix={creativesMode !== 'edit' && !isFullMode && showPrefix &&
160
+ prefix={!isFullMode && showPrefix &&
139
161
  <PrefixWrapper>
140
162
  <CapIcons.backIcon onClick={onShowTemplates} />
141
163
  </PrefixWrapper>
@@ -191,5 +213,8 @@ SlideBoxHeader.propTypes = {
191
213
  shouldShowTemplateName: PropTypes.bool,
192
214
  templateNameRenderProp: PropTypes.func,
193
215
  smsRegister: PropTypes.any,
216
+ handleClose: PropTypes.func,
217
+ moduleType: PropTypes.string,
218
+ useLocalTemplates: PropTypes.bool,
194
219
  };
195
220
  export default SlideBoxHeader;
@@ -11,6 +11,7 @@ export const EBILL = "EBILL";
11
11
  export const LINE = "LINE";
12
12
  export const CALL_TASK = "CALL_TASK";
13
13
  export const MOBILE_PUSH = "MOBILEPUSH";
14
+ export const MPUSH = "MPUSH";
14
15
  export const WECHAT = "WECHAT";
15
16
  export const FACEBOOK = "FACEBOOK";
16
17
  export const FTP = "FTP";
@@ -57,6 +58,8 @@ export const COMMON_CHANNELS = ['sms', 'email', 'wechat', 'mobilepush', 'webpush
57
58
  export const NORMALIZED_CHANNEL_ALIASES = {
58
59
  we_chat: WECHAT.toLowerCase(),
59
60
  m_push: MOBILE_PUSH.toLowerCase(),
61
+ // paneKey `inApp` → `in_app`; TemplatesV2 pane uses key INAPP → `inapp` — both must match for channelsToHide
62
+ in_app: INAPP.toLowerCase(),
60
63
  };
61
64
  export const MIXED = "MIXED";
62
65
  export const VISITOR = "VISITOR";
@@ -64,3 +67,12 @@ export const ALLOWED_CHANNELS_FOR_ANONYMOUS = ['mobilepush', 'webpush'];
64
67
  export const ALL_CHANNELS_NEW = [
65
68
  'sms', 'email', 'whatsapp', 'facebook', 'line', 'viber', 'rcs', 'zalo', 'inapp', 'call_task', 'ftp',
66
69
  ];
70
+
71
+ export const LOCAL_TEMPLATE_CONFIG_KEYS = ['useLocalTemplates', 'localTemplates', 'localTemplatesLoading', 'localTemplatesFilterContent', 'localTemplatesUseSkeleton', 'localTemplatesOnPageChange'];
72
+
73
+ /** Keys passed from parents into `Templates` when using local SMS template list (extends `LOCAL_TEMPLATE_CONFIG_KEYS`). */
74
+ export const LOCAL_TEMPLATE_CONFIG_KEYS_FOR_PICK = [
75
+ ...LOCAL_TEMPLATE_CONFIG_KEYS,
76
+ 'localTemplatesLoadingTip',
77
+ 'localTemplatesFooterContent',
78
+ ];
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Shared logic for CreativesContainer slidebox + embedded flows (e.g. RCS SMS fallback)
3
+ * that mirror the same footer liquid errors and layout margins.
4
+ */
5
+ import get from 'lodash/get';
6
+ import {
7
+ CAP_SPACE_32,
8
+ CAP_SPACE_56,
9
+ CAP_SPACE_64,
10
+ } from '@capillarytech/cap-ui-library/styled/variables';
11
+ import * as constants from './constants';
12
+
13
+ /**
14
+ * Returns true if value is "deep empty": no errors present.
15
+ * Same rules as CreativesContainer (used for liquid / standard error payloads).
16
+ */
17
+ export function isDeepEmpty(value) {
18
+ if (value == null) return true;
19
+ if (typeof value === 'string') return value.length === 0;
20
+ if (Array.isArray(value)) return value.length === 0;
21
+ if (typeof value === 'object') {
22
+ return Object.values(value).every(isDeepEmpty);
23
+ }
24
+ return false;
25
+ }
26
+
27
+ /**
28
+ * Header/content margin below slidebox chrome when ErrorInfoNote stacks errors — same formula as CreativesContainer#render.
29
+ */
30
+ export function getSlideBoxWrapperMarginFromLiquidErrors(liquidErrorMessage) {
31
+ return (get(liquidErrorMessage, 'STANDARD_ERROR_MSG.length', 0) > 0
32
+ && get(liquidErrorMessage, 'LIQUID_ERROR_MSG.length', 0) > 0)
33
+ ? CAP_SPACE_64
34
+ : get(liquidErrorMessage, 'LIQUID_ERROR_MSG.length', 0) > 0
35
+ ? CAP_SPACE_56
36
+ : get(liquidErrorMessage, 'STANDARD_ERROR_MSG.length', 0) > 0
37
+ ? CAP_SPACE_32
38
+ : 0;
39
+ }
40
+
41
+ /**
42
+ * Maps FormBuilder `showLiquidErrorInFooter` args to slidebox footer state.
43
+ * Returns `null` when CreativesContainer intentionally skips updating (Mobile Push OLD empty clear).
44
+ */
45
+ export function computeLiquidFooterUpdateFromFormBuilder(
46
+ errorMessagesFromFormBuilder,
47
+ currentFormBuilderTab,
48
+ { previousIsLiquidValidationError, currentChannelUpper } = {},
49
+ ) {
50
+ const liquidMsgs = get(errorMessagesFromFormBuilder, constants.LIQUID_ERROR_MSG, []);
51
+ const standardMsgs = get(errorMessagesFromFormBuilder, constants.STANDARD_ERROR_MSG, []);
52
+ const hasLiquid = !isDeepEmpty(liquidMsgs);
53
+ const hasStandard = !isDeepEmpty(standardMsgs);
54
+ const isLiquidValidationError = hasLiquid || hasStandard;
55
+ const isMobilePush = currentChannelUpper === constants.MOBILE_PUSH;
56
+ if (!hasLiquid && !hasStandard && previousIsLiquidValidationError && isMobilePush) {
57
+ return null;
58
+ }
59
+ return {
60
+ isLiquidValidationError,
61
+ liquidErrorMessage: errorMessagesFromFormBuilder,
62
+ activeFormBuilderTab:
63
+ currentFormBuilderTab === 1
64
+ ? constants.ANDROID
65
+ : (currentFormBuilderTab === 2 ? constants.IOS : null),
66
+ };
67
+ }