@capillarytech/creatives-library 8.0.168-alpha.0 → 8.0.168-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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.168-alpha.0",
4
+ "version": "8.0.168-alpha.1",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -37,6 +37,7 @@ import { createStructuredSelector } from 'reselect';
37
37
  import { CAP_SPACE_12, CAP_SPACE_08, FONT_COLOR_05, FONT_COLOR_04 } from '@capillarytech/cap-ui-library/styled/variables';
38
38
  import TemplatePreview from '../TemplatePreview';
39
39
  import TagList from '../../v2Containers/TagList';
40
+ import CapTagListWithInput from '../CapTagListWithInput';
40
41
  import SlideBox from '../SlideBox';
41
42
  import CardGrid from '../CardGrid';
42
43
  import CKEditor from "../Ckeditor/";
@@ -2743,6 +2744,40 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2743
2744
  </CapColumn>
2744
2745
  );
2745
2746
  break;
2747
+ case "cap-tag-list-with-input":
2748
+ ifError = this.state.checkValidation && this.state.errorData[val.id];
2749
+ columns.push(
2750
+ <CapColumn key={`input-${val.id}`} span={val.width || 10} offset={val.offset}>
2751
+ <CapTagListWithInput
2752
+ key={`input-${val.id}`}
2753
+ inputId={val.id}
2754
+ inputValue={this.state.formData[val.id] || ''}
2755
+ inputOnChange={(e) => this.updateFormData(e.target.value, val)}
2756
+ inputPlaceholder={val.placeholder || ''}
2757
+ inputErrorMessage={val.errorMessage && ifError ? val.errorMessage : ''}
2758
+ inputRequired={val.required || false}
2759
+ inputDisabled={val.disabled || false}
2760
+ headingText={val.label || ''}
2761
+ headingStyle={val.headingStyle || { marginTop: '3%', marginRight: '79%' }}
2762
+ headingType="h4"
2763
+ onTagSelect={(data) => this.callChildEvent(data, val, 'onTagSelect')}
2764
+ onContextChange={this.props.onContextChange}
2765
+ location={this.props.location}
2766
+ tags={this.props.tags ? this.props.tags : []}
2767
+ injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
2768
+ className={val.className ? val.className : ''}
2769
+ userLocale={this.props.userLocale}
2770
+ selectedOfferDetails={this.props.selectedOfferDetails}
2771
+ eventContextTags={this.props?.eventContextTags}
2772
+ moduleFilterEnabled={this.props.location && this.props.location.query && this.props.location.query.type !== 'embedded'}
2773
+ containerStyle={val.style || {}}
2774
+ inputProps={val.inputProps || {}}
2775
+ showInput={val.showInput !== false}
2776
+ showTagList={val.showTagList !== false}
2777
+ />
2778
+ </CapColumn>
2779
+ );
2780
+ break;
2746
2781
  case "tabs":
2747
2782
  columns.push(
2748
2783
  <CapColumn key="input" span={10}>
@@ -3372,6 +3407,57 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3372
3407
  );
3373
3408
  }
3374
3409
  break;
3410
+ case "cap-tag-list-with-input":
3411
+ let moduleFilterEnabledForCapTagList = this.props.location && this.props.location.query && this.props.location.query.type !== 'embedded';
3412
+ const channelForCapTagList = _.get(this.props, 'schema.channel', "");
3413
+ if (channelForCapTagList === 'EMAIL') {
3414
+ moduleFilterEnabledForCapTagList = this.props.isFullMode;
3415
+ }
3416
+ const langIndexForCapTagList = 0;
3417
+ const currentLangForCapTagList = (!_.isEmpty(this.state.formData) && !_.isEmpty(this.state.formData[`${this.state.currentTab - 1}`]) && !_.isEmpty(this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages) && this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages[langIndexForCapTagList]) ? this.state.formData[`${this.state.currentTab - 1}`].selectedLanguages[langIndexForCapTagList] : this.props.baseLanguage;
3418
+ const isBEEAppEnableForCapTagList = this.checkBeeEditorAllowedForLibrary();
3419
+ ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
3420
+
3421
+ // Always render Subject CapTagListWithInput even when Bee editor is active for EMAIL channel
3422
+ if (
3423
+ val.id === 'template-subject' ||
3424
+ !(_.get(this.state, `formData[${this.state.currentTab - 1}][${currentLangForCapTagList}].is_drag_drop`, false)) ||
3425
+ isBEEAppEnableForCapTagList === false ||
3426
+ channelForCapTagList !== 'EMAIL'
3427
+ ) {
3428
+ columns.push(
3429
+ <CapColumn key={`input-${val.id}`} offset={val.offset} span={val.width ? val.width : ''} style={val.style ? val.style : {marginBottom: '16px'}}>
3430
+ <CapTagListWithInput
3431
+ key={`input-${val.id}`}
3432
+ inputId={val.id}
3433
+ inputValue={this.state.formData[val.id] || ''}
3434
+ inputOnChange={(e) => this.updateFormData(e.target.value, val)}
3435
+ inputPlaceholder={val.placeholder || ''}
3436
+ inputErrorMessage={val.errorMessage && ifError ? val.errorMessage : ''}
3437
+ inputRequired={val.required || false}
3438
+ inputDisabled={val.disabled || false}
3439
+ headingText={val.label || ''}
3440
+ headingStyle={val.headingStyle || { marginTop: '3%', marginRight: '79%' }}
3441
+ headingType="h4"
3442
+ onTagSelect={(data) => this.callChildEvent(data, val, 'onTagSelect')}
3443
+ onContextChange={this.props.onContextChange}
3444
+ location={this.props.location}
3445
+ tags={this.props.tags ? this.props.tags : []}
3446
+ injectedTags={this.props.injectedTags ? this.props.injectedTags : {}}
3447
+ className={val.className ? val.className : ''}
3448
+ userLocale={this.state.translationLang}
3449
+ selectedOfferDetails={this.props.selectedOfferDetails}
3450
+ eventContextTags={this.props?.eventContextTags}
3451
+ moduleFilterEnabled={moduleFilterEnabledForCapTagList}
3452
+ containerStyle={val.style || {}}
3453
+ inputProps={val.inputProps || {}}
3454
+ showInput={val.showInput !== false}
3455
+ showTagList={val.showTagList !== false}
3456
+ />
3457
+ </CapColumn>
3458
+ );
3459
+ }
3460
+ break;
3375
3461
  case "button":
3376
3462
  if (styling === 'semantic' && val.metaType === 'submit-button') {
3377
3463
  columns.push(
@@ -104,6 +104,10 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
104
104
  "title-tagList": {
105
105
  onTagSelect: this.onTagSelect,
106
106
  },
107
+ // unified subject field with input and tag selection
108
+ "template-subject": {
109
+ onTagSelect: this.onTagSelect,
110
+ },
107
111
  "template-version": {
108
112
  onSelect: this.handleVersionSelect,
109
113
  addVersion: this.addVersion,
@@ -651,8 +655,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
651
655
  }
652
656
 
653
657
  onTagSelect = (data, currentTab, sourceVal) => {
654
- // If tag is selected from Subject's TagList, insert into subject input
655
- if (sourceVal && sourceVal.id === 'title-tagList') {
658
+ // If tag is selected from Subject's TagList or unified subject field, insert into subject input
659
+ if (sourceVal && (sourceVal.id === 'title-tagList' || sourceVal.id === 'template-subject')) {
656
660
  const tagToInsert = `{{${data}}}`;
657
661
  const formData = _.cloneDeep(this.state.formData);
658
662
  const fieldId = 'template-subject';
@@ -1587,8 +1591,24 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
1587
1591
  if (schema.standalone) {
1588
1592
  if ((this.props.location.query.module === "loyalty" || this.props.location.query.module === "dvs" || this.props.location.query.module === "timeline" || this.props.location.query.module === "coupon_expiry" ||
1589
1593
  this.props.location.query.module === "library")) {
1590
- _.set(schema, 'standalone.sections[0].inputFields[0].style.display', "" );
1591
- _.set(schema, 'standalone.sections[0].inputFields[0].labelStyle.display', "");
1594
+ // For the new unified cap-tag-list-with-input component, we want to show the Add label button
1595
+ // but hide the input field in library mode
1596
+ const subjectField = schema.standalone.sections[0].inputFields[0];
1597
+ if (subjectField && subjectField.type === "cap-tag-list-with-input") {
1598
+ // Only hide input in library mode, keep it visible in other modes
1599
+ if (this.props.location.query.module === "library") {
1600
+ _.set(schema, 'standalone.sections[0].inputFields[0].showInput', false);
1601
+ _.set(schema, 'standalone.sections[0].inputFields[0].showTagList', true);
1602
+ } else {
1603
+ // In other modes (loyalty, dvs, timeline, coupon_expiry), keep both input and tag list visible
1604
+ _.set(schema, 'standalone.sections[0].inputFields[0].showInput', true);
1605
+ _.set(schema, 'standalone.sections[0].inputFields[0].showTagList', true);
1606
+ }
1607
+ } else {
1608
+ // For backward compatibility with old separate fields
1609
+ _.set(schema, 'standalone.sections[0].inputFields[0].style.display', "" );
1610
+ _.set(schema, 'standalone.sections[0].inputFields[0].labelStyle.display', "");
1611
+ }
1592
1612
  }
1593
1613
  this.setState({schema});
1594
1614
  }
@@ -20,7 +20,7 @@ export const response = {
20
20
  {
21
21
  id: "template-subject",
22
22
  placeholder: "Enter Email Subject",
23
- type: "input",
23
+ type: "cap-tag-list-with-input",
24
24
  metaType: "text",
25
25
  datatype: "string",
26
26
  required: true,
@@ -28,32 +28,12 @@ export const response = {
28
28
  styling: "semantic",
29
29
  order: 1,
30
30
  width: 16,
31
- customComponent: false,
31
+ customComponent: true,
32
32
  standalone: true,
33
33
  onlyDisplay: false,
34
34
  errorMessage: "Email Subject cannot be empty.",
35
- },
36
- {
37
- // Add label control for subject input
38
- id: "title-tagList",
39
- label: "Add label",
40
- type: "tag-list",
41
- metaType: "List",
42
- datatype: "select",
43
- required: true,
44
- fluid: true,
45
- onlyDisplay: true,
46
- style: {
47
- float: "none",
48
- marginTop: "2%",
49
- marginRight: "20%",
50
- },
51
- styling: "semantic",
52
- order: 2,
53
- customComponent: true,
54
- // Helps handler identify the destination input
55
- target: "template-subject",
56
35
  supportedEvents: [
36
+ "onChange",
57
37
  "onTagSelect",
58
38
  ],
59
39
  },
@@ -289,7 +269,7 @@ export const response = {
289
269
  metaType: "label",
290
270
  type: "div",
291
271
  primitive: true,
292
- value: <CapButton isAddBtn type="flat"><FormattedMessage {...messages.image}/></CapButton>,
272
+ value: <CapButton isAddBtn type="flat"><FormattedMessage {...messages.image} /></CapButton>,
293
273
  fluid: true,
294
274
  onlyDisplay: false,
295
275
  styling: "semantic",