@capillarytech/creatives-library 9.0.67-beta.test-cap-204791-beta-publish-yogesh.4 → 9.0.67

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "9.0.67-beta.test-cap-204791-beta-publish-yogesh.4",
4
+ "version": "9.0.67",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -592,6 +592,12 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
592
592
  }
593
593
  }
594
594
 
595
+ componentDidUpdate(prevProps) {
596
+ if (!_.isEqual(prevProps.isTransactional, this.props.isTransactional)) {
597
+ this.validateForm(this.props.tags, this.props.injectedTags);
598
+ }
599
+ }
600
+
595
601
  onEdit() {
596
602
 
597
603
  }
@@ -1581,7 +1587,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1581
1587
  const contentForValidation = isEmail ? convert(content, GLOBAL_CONVERT_OPTIONS) : content;
1582
1588
  const isOutboundModule = (currentModule || '').toUpperCase() === OUTBOUND;
1583
1589
 
1584
- const initialMissingTags = (tags && tags.length && !isFullMode && isEmail && isOutboundModule && !isEmailUnsubscribeTagOptional() && !hasUnsubscribeTag(content))
1590
+ const isTransactional = this.props.isTransactional;
1591
+
1592
+ const initialMissingTags = (tags && tags.length && !isFullMode && isEmail && isOutboundModule && !isEmailUnsubscribeTagOptional() && !isTransactional && !hasUnsubscribeTag(content))
1585
1593
  ? ['unsubscribe']
1586
1594
  : [];
1587
1595
 
@@ -1598,7 +1606,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1598
1606
 
1599
1607
  // When unsubscribe tag is optional (isEmailUnsubscribeTagOptional): do not enforce unsubscribe (defensive splice); set isContentEmpty only when content is empty. Do not override response.valid so brace/format errors are preserved.
1600
1608
  const validString = /\S/.test(contentForValidation);
1601
- if (isEmailUnsubscribeTagOptional() && isEmail && isOutboundModule) {
1609
+ if ((isEmailUnsubscribeTagOptional() || isTransactional) && isEmail && isOutboundModule) {
1602
1610
  const missingTagIndex = response.missingTags.indexOf('unsubscribe');
1603
1611
  if (missingTagIndex !== -1) {
1604
1612
  response.missingTags.splice(missingTagIndex, 1);
@@ -143,6 +143,7 @@ export function SlideBoxContent(props) {
143
143
  supportedTags = [],
144
144
  selectedOfferDetails,
145
145
  channelsToDisable,
146
+ isTransactional,
146
147
  weChatTemplateType,
147
148
  onWechatTemplateChange,
148
149
  selectedWeChatAccount,
@@ -734,6 +735,7 @@ export function SlideBoxContent(props) {
734
735
  onHtmlEditorValidationStateChange={onHtmlEditorValidationStateChange}
735
736
  restrictPersonalization={restrictPersonalization}
736
737
  isAnonymousType={isAnonymousType}
738
+ isTransactional={isTransactional}
737
739
  />
738
740
  )}
739
741
  {(isEditEmailWithId || isEmailEditWithContent) && (
@@ -783,7 +785,8 @@ export function SlideBoxContent(props) {
783
785
  handleCloseTestAndPreview={handleCloseTestAndPreview}
784
786
  isTestAndPreviewMode={isTestAndPreviewMode}
785
787
  onHtmlEditorValidationStateChange={onHtmlEditorValidationStateChange}
786
- />
788
+ isTransactional={isTransactional}
789
+ />
787
790
  );
788
791
  }
789
792
  // HTML template: Use EmailWrapper component (which uses EmailWithoutSaga)
@@ -823,6 +826,7 @@ export function SlideBoxContent(props) {
823
826
  handleCloseTestAndPreview={handleCloseTestAndPreview}
824
827
  isTestAndPreviewMode={isTestAndPreviewMode}
825
828
  onHtmlEditorValidationStateChange={onHtmlEditorValidationStateChange}
829
+ isTransactional={isTransactional}
826
830
  location={{
827
831
  pathname: `/email/edit/${templateData._id || ''}`,
828
832
  query: {
@@ -2398,6 +2398,7 @@ export class Creatives extends React.Component {
2398
2398
  forwardedTags={forwardedTags}
2399
2399
  selectedOfferDetails={selectedOfferDetails}
2400
2400
  channelsToDisable={channelsToDisable}
2401
+ isTransactional={this.props.isTransactional}
2401
2402
  restrictPersonalization={restrictPersonalization}
2402
2403
  isAnonymousType={isAnonymousType}
2403
2404
  customerType={customerType}
@@ -3278,6 +3278,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
3278
3278
  exportHtmlLocked={this.state.exportHtmlContentLocked}
3279
3279
  exportHtmlTooltip={getExportHtmlDisabledTooltip(this.state.isEdit, this.state.exportHtmlContentLocked, this.props.intl.formatMessage)}
3280
3280
  isTestAndPreviewMode={this.state.isTestAndPreviewMode} // Add flag to prevent validation
3281
+ isTransactional={this.props.isTransactional}
3281
3282
  /> : ''}
3282
3283
  </CapColumn>
3283
3284
  </CapRow>
@@ -93,10 +93,13 @@ const EmailHTMLEditor = (props) => {
93
93
  forwardedRef,
94
94
  // Module type for unsubscribe tag validation
95
95
  moduleType,
96
+ isTransactional,
96
97
  // Validation state callback
97
98
  onHtmlEditorValidationStateChange,
98
99
  } = props;
99
100
 
101
+ const isUnsubscribeOptional = isEmailUnsubscribeTagOptional() || isTransactional;
102
+
100
103
  const { formatMessage } = intl;
101
104
 
102
105
  // State for content and subject
@@ -127,7 +130,7 @@ const EmailHTMLEditor = (props) => {
127
130
  // Merge tag validation errors (missing) into apiValidationErrors so they show in ValidationErrorDisplay
128
131
  const mergedApiValidationErrors = useMemo(() => {
129
132
  const tagMessages = [];
130
- if (tagValidationError?.missingTags?.length && !isEmailUnsubscribeTagOptional()) {
133
+ if (tagValidationError?.missingTags?.length && !isUnsubscribeOptional) {
131
134
  tagMessages.push(`Missing tags are: ${tagValidationError.missingTags.join(', ')}`);
132
135
  }
133
136
  if (tagMessages.length === 0) {
@@ -137,7 +140,7 @@ const EmailHTMLEditor = (props) => {
137
140
  liquidErrors: apiValidationErrors?.liquidErrors || [],
138
141
  standardErrors: [...(apiValidationErrors?.standardErrors || []), ...tagMessages],
139
142
  };
140
- }, [apiValidationErrors, tagValidationError]);
143
+ }, [apiValidationErrors, tagValidationError, isUnsubscribeOptional]);
141
144
 
142
145
  // Refs for tracking initialization and previous values
143
146
  const contentInitializedRef = useRef(false);
@@ -738,7 +741,7 @@ const EmailHTMLEditor = (props) => {
738
741
  // When EMAIL_UNSUBSCRIBE_TAG_MANDATORY is false: validate and require unsubscribe tag.
739
742
  // Run for both library and full mode so liquid-enabled orgs also get the error (notification + ValidationErrorDisplay).
740
743
  const isModuleTypeOutbound = (moduleType || '').toUpperCase() === OUTBOUND;
741
- if (!isEmailUnsubscribeTagOptional() && isModuleTypeOutbound) {
744
+ if (!isUnsubscribeOptional && isModuleTypeOutbound) {
742
745
  const unsubscribeRegex = /{{unsubscribe(\(#[a-zA-Z\d]{6}\))?}}/g; // eslint-disable-line no-useless-escape
743
746
  const hasUnsubscribeTag = unsubscribeRegex.test(htmlContent);
744
747
 
@@ -1009,6 +1012,7 @@ const EmailHTMLEditor = (props) => {
1009
1012
  globalActions,
1010
1013
  intl,
1011
1014
  extractedTemplateName,
1015
+ isUnsubscribeOptional,
1012
1016
  ]);
1013
1017
 
1014
1018
  // Keep handleSave ref up to date - MUST be before isGetFormData effect
@@ -193,6 +193,7 @@ const EmailWrapperView = ({
193
193
  showTemplateName,
194
194
  onHtmlEditorValidationStateChange,
195
195
  moduleType,
196
+ isTransactional,
196
197
  }) => {
197
198
  const htmlEditorRef = useRef(null);
198
199
  const supportCKEditor = hasSupportCKEditor();
@@ -275,6 +276,7 @@ const EmailWrapperView = ({
275
276
  onFormDataChange: handleFormDataChange,
276
277
  // Module type for unsubscribe tag validation
277
278
  moduleType,
279
+ isTransactional,
278
280
  // Loading states
279
281
  fetchingLiquidTags: fetchingLiquidTags || false,
280
282
  createTemplateInProgress: createTemplateInProgress || false,
@@ -51,6 +51,7 @@ const useEmailWrapper = ({
51
51
  editor,
52
52
  moduleType,
53
53
  eventContextTags,
54
+ isTransactional,
54
55
  waitEventContextTags,
55
56
  isLoyaltyModule,
56
57
  // Props for CmsTemplates component
@@ -746,6 +747,7 @@ const useEmailWrapper = ({
746
747
  eventContextTags,
747
748
  waitEventContextTags,
748
749
  isLoyaltyModule,
750
+ isTransactional,
749
751
  showTestAndPreviewSlidebox,
750
752
  handleTestAndPreview,
751
753
  handleCloseTestAndPreview,
@@ -776,6 +778,7 @@ const useEmailWrapper = ({
776
778
  eventContextTags,
777
779
  waitEventContextTags,
778
780
  isLoyaltyModule,
781
+ isTransactional,
779
782
  showTestAndPreviewSlidebox,
780
783
  handleTestAndPreview,
781
784
  handleCloseTestAndPreview,
@@ -87,6 +87,7 @@ const EmailWrapper = (props) => {
87
87
  fetchingCmsData,
88
88
  onHtmlEditorValidationStateChange,
89
89
  isEditEmail = true,
90
+ isTransactional,
90
91
  } = props;
91
92
 
92
93
  // Pass destructured props to the custom hook
@@ -207,6 +208,7 @@ const EmailWrapper = (props) => {
207
208
  fetchingCmsData={fetchingCmsData}
208
209
  onHtmlEditorValidationStateChange={onHtmlEditorValidationStateChange}
209
210
  moduleType={moduleType}
211
+ isTransactional={isTransactional}
210
212
  />
211
213
 
212
214
  {/* HTMLEditor Testing Component - Console Controlled */}