@capillarytech/creatives-library 7.12.111 → 7.12.113

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": "7.12.111",
4
+ "version": "7.12.113",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -24,7 +24,6 @@
24
24
  "jest-date-mock": "^1.0.8",
25
25
  "jquery": "^3.3.1",
26
26
  "load-script": "^1.0.0",
27
- "node-html-parser": "^5.4.2-0",
28
27
  "normalizr": "^3.2.3",
29
28
  "papaparse": "^5.3.1",
30
29
  "pre-push": "^0.1.2",
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This is not an integration test rather it's created to run the integration test script for now.
3
+ * The tests case and file name will be re-written as per the requirement in future.
4
+ */
5
+
6
+ describe('Create Templates ', () => {
7
+ it('Should pass the test case for truthy values', async () => {
8
+ expect(true).toBeTruthy();
9
+ });
10
+
11
+ it('Should pass the test case for falsy values', async () => {
12
+ expect(false).toBeFalsy();
13
+ });
14
+
15
+ it('Should pass the test case for falsy values', async () => {
16
+ expect({}).toEqual({});
17
+ });
18
+ });
@@ -11,7 +11,7 @@ import PropTypes from 'prop-types';
11
11
  import React from 'react';
12
12
  import _ from 'lodash';
13
13
  import { Tabs, Table, Modal} from 'antd';
14
- import { CapSpin, CapDrawer, CapButton, CapInput, CapPopover, CapImage, CapCheckbox, CapRadio, CapSelect, CapTable, CapRow, CapColumn, CapNotification, CapUploader, CapHeading, CapIcon} from '@capillarytech/cap-ui-library';
14
+ import { CapSpin, CapDrawer, CapButton, CapInput, CapPopover, CapImage, CapCheckbox, CapRadio, CapSelect, CapTable, CapRow, CapColumn, CapNotification, CapUploader, CapHeading, CapIcon, CapTooltip} from '@capillarytech/cap-ui-library';
15
15
  import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
16
16
  import LabelHOC from '@capillarytech/cap-ui-library/assets/HOCs/ComponentWithLabelHOC';
17
17
  import { CAP_SPACE_12, CAP_SPACE_08, FONT_COLOR_05, FONT_COLOR_04 } from '@capillarytech/cap-ui-library/styled/variables';
@@ -2800,22 +2800,28 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
2800
2800
  break;
2801
2801
  case "checkbox":
2802
2802
  ifError = this.state.checkValidation && (isVersionEnable ? this.state.errorData[`${this.state.currentTab - 1}`][val.id] : this.state.errorData[val.id]);
2803
+ const { disabled , hoverText } = val || {};
2803
2804
  if (styling === 'semantic') {
2804
2805
  columns.push(
2805
2806
  <CapColumn key="input" span={val.width} offset={val.offset}>
2806
- <CapCheckbox
2807
- key={val.id}
2808
- className={`${ifError ? 'error' : ''}`}
2809
- errorMessage={val.errorMessage && ifError ? val.errorMessage : ''}
2810
- onChange={(e) => this.updateFormData(e.target.checked, val, val.submitAction)}
2811
- checked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
2812
- defaultChecked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
2813
- style={val.style ? val.style : {}}
2814
- disabled={val.disabled}
2815
- inductiveText={val.inductiveText}
2807
+ <CapTooltip
2808
+ title={ disabled && hoverText ? hoverText : '' }
2809
+ placement="topLeft"
2816
2810
  >
2811
+ <CapCheckbox
2812
+ key={val.id}
2813
+ className={`${ifError ? 'error' : ''}`}
2814
+ errorMessage={val.errorMessage && ifError ? val.errorMessage : ''}
2815
+ onChange={(e) => this.updateFormData(e.target.checked, val, val.submitAction)}
2816
+ checked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
2817
+ defaultChecked={isVersionEnable ? this.state.formData[`${this.state.currentTab - 1}`][val.id] : this.state.formData[val.id]}
2818
+ style={val.style ? val.style : {}}
2819
+ disabled={val.disabled}
2820
+ inductiveText={val.inductiveText}
2821
+ >
2817
2822
  {val.label}
2818
- </CapCheckbox>
2823
+ </CapCheckbox>
2824
+ </CapTooltip>
2819
2825
  </CapColumn>
2820
2826
  );
2821
2827
  }
@@ -0,0 +1,41 @@
1
+ import React from "react";
2
+ import { injectIntl } from 'react-intl';
3
+ import '@testing-library/jest-dom';
4
+ import FormBuilder from '../index';
5
+ import { Provider } from 'react-redux';
6
+ import configureStore from '../../../store';
7
+ import {
8
+ render,
9
+ screen,
10
+ fireEvent,
11
+ waitFor
12
+ } from '../../../utils/test-utils';
13
+ import { mockData } from './mockData';
14
+
15
+
16
+ const ComponentToRender = injectIntl(FormBuilder);
17
+ const renderComponent = props => {
18
+ const store = configureStore({}, null);
19
+ return render(
20
+ <Provider store={store}>
21
+ <ComponentToRender {...props} />
22
+ </Provider>,
23
+ );
24
+ };
25
+
26
+ describe("test for checkbox form builder",() => {
27
+ const onFormValidityChange=jest.fn();
28
+ const props={
29
+ ...mockData,
30
+ onFormValidityChange
31
+ }
32
+ renderComponent(props);
33
+ it("add action button to notification disabled in ios", async () => {
34
+ const addNotifBtn=screen.getByLabelText("Add action buttons to notification")
35
+ expect(addNotifBtn).toBeDisabled();
36
+ fireEvent.mouseOver(addNotifBtn);
37
+ await waitFor(() => {
38
+ expect(screen.getByText("This section is being revamped. Till then it will remain disabled.")).toBeInTheDocument();
39
+ })
40
+ })
41
+ })
@@ -0,0 +1,120 @@
1
+ export const mockData = {
2
+ schema:{
3
+ "containers": [
4
+ {
5
+ "id": "pane",
6
+ "supportedEvents": [
7
+ "onTabChange"
8
+ ],
9
+ "panes": [
10
+ {
11
+ "isSupported": true,
12
+ "sectionsHeaders": [
13
+ {
14
+ "type": "multicols",
15
+ "inputFields": [
16
+ {
17
+ "rowStyle": {
18
+ "display": "flex",
19
+ "flex": 1
20
+ },
21
+ "cols": [
22
+ {
23
+ "id": "tab-header",
24
+ "metaType": "label",
25
+ "value": "iOS",
26
+ "primitive": true,
27
+ "dynamicTab": false,
28
+ "type": "div",
29
+ "width": 5,
30
+ "offset": 0,
31
+ "onlyDisplay": true,
32
+ "colStyle": {
33
+ "flex": 1
34
+ },
35
+ "injectedEvents": {}
36
+ }
37
+ ]
38
+ }
39
+ ],
40
+ "actionFields": []
41
+ }
42
+ ],
43
+ "sections": [
44
+ {
45
+ "type": "parent",
46
+ "width": 16,
47
+ "rowStyle": {
48
+ "height": "100%"
49
+ },
50
+ "childSections": [
51
+ {
52
+ "colStyle": {
53
+ "paddingTop": "16px",
54
+ "paddingLeft": "16px",
55
+ "borderRight": "1px solid #d9d9d9",
56
+ "height": "70vh",
57
+ "overflowY": "auto"
58
+ },
59
+ "width": 16,
60
+ "type": "parent",
61
+ "childSections": [
62
+ {
63
+ "type": "multicols",
64
+ "inputFields": [
65
+ {
66
+ "identifier": "add-sec-cta-ios",
67
+ "cols": [
68
+ {
69
+ "id": "add-sec-cta-ios",
70
+ "metaType": "label",
71
+ "dynamicTab": false,
72
+ "label": "Add action buttons to notification",
73
+ "styling": "semantic",
74
+ "type": "checkbox",
75
+ "customComponent": false,
76
+ "datatype": "boolean",
77
+ "fluid": true,
78
+ "onlyDisplay": false,
79
+ "offset": 0,
80
+ "colStyle": {
81
+ "flex": 1
82
+ },
83
+ "submitAction": "addSecondaryCtaIos",
84
+ "supportedEvents": [
85
+ "addSecondaryCtaIos"
86
+ ],
87
+ "disabled": true,
88
+ "hoverText": "This section is being revamped. Till then it will remain disabled.",
89
+ "injectedEvents": {}
90
+ }
91
+ ]
92
+ }
93
+ ],
94
+ "actionFields": []
95
+ }
96
+ ]
97
+ },
98
+ ]
99
+ }
100
+ ]
101
+ }
102
+ ],
103
+ "type": "tabs",
104
+ "defaultPanes": 1,
105
+ "additionalPanes": 0,
106
+ "injectedEvents": {}
107
+ }
108
+ ],
109
+ "channel": "MOBILEPUSH",
110
+ "module": "Campaigns",
111
+ "type": "LAYOUT"
112
+ },
113
+ location:{
114
+ "pathname": "/mobilepush/create/image",
115
+ "query": {
116
+ "type": false,
117
+ "module": "default"
118
+ }
119
+ }
120
+ }
@@ -99,7 +99,7 @@ class NewCallTask extends React.Component { // eslint-disable-line react/prefer-
99
99
  };
100
100
 
101
101
  render() {
102
- const { intl, isLoading, metaEntities, selectedOfferDetails } = this.props;
102
+ const { intl, isLoading, metaEntities, selectedOfferDetails , injectedTags} = this.props;
103
103
  const { formatMessage } = intl;
104
104
  const { subject, messageBody, description, callTaskActionType } = this.state;
105
105
  const tags = metaEntities && metaEntities.tags ? metaEntities.tags.standard : [];
@@ -125,6 +125,7 @@ class NewCallTask extends React.Component { // eslint-disable-line react/prefer-
125
125
  tags={tags}
126
126
  onTagSelect={this.onTagSelect}
127
127
  selectedOfferDetails={selectedOfferDetails}
128
+ injectedTags={injectedTags}
128
129
  />
129
130
  <CapInput.TextArea
130
131
  setInputRef={this.setInputRef}
@@ -177,6 +178,7 @@ NewCallTask.propTypes = {
177
178
  selectedOfferDetails: PropTypes.array,
178
179
  messageDetails: PropTypes.object,
179
180
  mode: PropTypes.string,
181
+ injectedTags: PropTypes.object,
180
182
  };
181
183
 
182
184
  export default injectIntl(NewCallTask);
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+ import { injectIntl } from 'react-intl';
3
+ import '@testing-library/jest-dom';
4
+ import { Provider } from 'react-redux';
5
+ import { browserHistory } from 'react-router';
6
+ import NewCallTask from '../index';
7
+ import configureStore from '../../../store';
8
+ import mockData from './mockData'
9
+ import {
10
+ render,
11
+ } from '../../../utils/test-utils';
12
+ import { Router } from "express";
13
+ const ComponentToRender = injectIntl(NewCallTask);
14
+
15
+ const renderComponent = (props) => {
16
+ const store = configureStore({}, browserHistory);
17
+ return render(
18
+ <Router>
19
+ <Provider store={store}>
20
+ <ComponentToRender {...props} />
21
+ </Provider>
22
+ </Router>,
23
+ );
24
+ };
25
+
26
+ describe("test for NewCallTask", () => {
27
+ const onCallTaskSubmit = jest.fn();
28
+ const props = {
29
+ ...mockData,
30
+ onCallTaskSubmit,
31
+ };
32
+
33
+ it("New call task", async () => {
34
+ renderComponent(props);
35
+ });
36
+ });
@@ -0,0 +1,20 @@
1
+ const mockData= {
2
+ injectedTags: {},
3
+ templateData: {},
4
+ messageDetails: {},
5
+ isLoading: true,
6
+ selectedOfferDetails: [],
7
+ location: {
8
+ pathname: "/NewCallTask",
9
+ query: {
10
+ type: false,
11
+ module: "default",
12
+ },
13
+ },
14
+ match: {
15
+ path: '/NewCallTask',
16
+ url: '/creatives/ui/v2',
17
+ isExact: true,
18
+ params: {},
19
+ }
20
+ }
@@ -16,7 +16,7 @@ import {
16
16
  } from '@capillarytech/cap-ui-library';
17
17
  import { injectIntl, intlShape } from 'react-intl';
18
18
  import { createStructuredSelector } from 'reselect';
19
- import { makeSelectMetaEntities, isLoadingMetaEntities } from '../Cap/selectors';
19
+ import { makeSelectMetaEntities, isLoadingMetaEntities, setInjectedTags } from '../Cap/selectors';
20
20
  import * as globalActions from '../Cap/actions';
21
21
  import * as actions from "./actions";
22
22
  import makeSelectCallTask from './selectors';
@@ -71,7 +71,7 @@ export class CallTask extends React.Component { // eslint-disable-line react/pre
71
71
  };
72
72
  }
73
73
  render() {
74
- const { intl, onCallTaskSubmit, templateData, loadingMetaEntities, metaEntities, selectedOfferDetails, messageDetails } = this.props;
74
+ const { intl, onCallTaskSubmit, templateData, loadingMetaEntities, metaEntities, selectedOfferDetails, messageDetails, injectedTags } = this.props;
75
75
  const { formatMessage } = intl;
76
76
  const { mode } = this.state;
77
77
  return (
@@ -85,6 +85,7 @@ export class CallTask extends React.Component { // eslint-disable-line react/pre
85
85
  onCallTaskSubmit={onCallTaskSubmit}
86
86
  selectedOfferDetails={selectedOfferDetails}
87
87
  messageDetails={messageDetails}
88
+ injectedTags={injectedTags || {}}
88
89
  />
89
90
  :
90
91
  <div>
@@ -144,6 +145,7 @@ const mapStateToProps = createStructuredSelector({
144
145
  CallTask: makeSelectCallTask(),
145
146
  metaEntities: makeSelectMetaEntities(),
146
147
  loadingMetaEntities: isLoadingMetaEntities(),
148
+ injectedTags: setInjectedTags(),
147
149
  });
148
150
 
149
151
  function mapDispatchToProps(dispatch) {
@@ -782,6 +782,8 @@ export const response = {
782
782
  supportedEvents: [
783
783
  "addSecondaryCtaIos",
784
784
  ],
785
+ disabled: true,
786
+ hoverText: "This section is being revamped. Till then it will remain disabled.",
785
787
  },
786
788
  ],
787
789
  },
@@ -1688,8 +1690,10 @@ export const response = {
1688
1690
  },
1689
1691
  submitAction: "addSecondaryCtaIos",
1690
1692
  supportedEvents: [
1691
- "addSecondaryCtaIos",
1693
+ "addSecondaryCtaIos"
1692
1694
  ],
1695
+ disabled: true,
1696
+ hoverText: "This section is being revamped. Till then it will remain disabled.",
1693
1697
  },
1694
1698
  ],
1695
1699
  },