@capillarytech/creatives-library 7.12.34 → 7.12.36

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/config/app.js CHANGED
@@ -17,6 +17,7 @@ const config = {
17
17
  },
18
18
  development: {
19
19
  api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/creatives',
20
+ //api_endpoint: 'http://localhost:2022/arya/api/v1/creatives',
20
21
  campaigns_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/campaigns',
21
22
  campaigns_api_org_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/org/campaign',
22
23
  auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.12.34",
4
+ "version": "7.12.36",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -13,6 +13,7 @@ import CapInput from '@capillarytech/cap-ui-library/CapInput';
13
13
  import CapButton from '@capillarytech/cap-ui-library/CapButton';
14
14
  import CapLabel from '@capillarytech/cap-ui-library/CapLabel';
15
15
  import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
16
+ import CapTooltip from '@capillarytech/cap-ui-library/CapTooltip';
16
17
  import globalMessages from '../../v2Containers/Cap/messages';
17
18
  import whatsappMsg from '../../v2Containers/Whatsapp/messages';
18
19
  import messages from './messages';
@@ -274,13 +275,24 @@ export const CapWhatsappCTA = (props) => {
274
275
  </CapRow>
275
276
  )}
276
277
  <CapRow className="whatsapp-cta-save-delete-btn">
277
- <CapButton
278
- onClick={() => saveCta(index)}
279
- disabled={ctaSaveDisabled(index)}
280
- className="whatsapp-cta-save-btn"
278
+ <CapTooltip
279
+ title={
280
+ ctaSaveDisabled(index)
281
+ ? formatMessage(messages.ctaSaveDisabled)
282
+ : ''
283
+ }
284
+ placement={'bottom'}
281
285
  >
282
- {formatMessage(globalMessages.save)}
283
- </CapButton>
286
+ <div className="button-disabled-tooltip-wrapper">
287
+ <CapButton
288
+ onClick={() => saveCta(index)}
289
+ disabled={ctaSaveDisabled(index)}
290
+ className="whatsapp-cta-save-btn"
291
+ >
292
+ {formatMessage(globalMessages.save)}
293
+ </CapButton>
294
+ </div>
295
+ </CapTooltip>
284
296
  <CapButton
285
297
  onClick={() => deleteHandler(index)}
286
298
  className="whatsapp-cta-delete-btn"
@@ -299,16 +311,27 @@ export const CapWhatsappCTA = (props) => {
299
311
  ctaData.length < 2 &&
300
312
  renderArray.push(
301
313
  <CapRow>
302
- <CapButton
303
- type="flat"
304
- id="whatsapp-cta-add-button"
305
- disabled={ctaData?.length === 1 && !ctaData[0].isSaved}
306
- className="margin-t-12 margin-l-24"
307
- isAddBtn
308
- onClick={addCta}
314
+ <CapTooltip
315
+ title={
316
+ ctaData.length === 1 && !ctaData[0].isSaved
317
+ ? formatMessage(messages.ctaAddDisabled)
318
+ : ''
319
+ }
320
+ placement={'right'}
309
321
  >
310
- {formatMessage(messages.addButton)}
311
- </CapButton>
322
+ <div className="button-disabled-tooltip-wrapper">
323
+ <CapButton
324
+ type="flat"
325
+ id="whatsapp-cta-add-button"
326
+ disabled={ctaData.length === 1 && !ctaData[0].isSaved}
327
+ className="margin-t-12 margin-l-24"
328
+ isAddBtn
329
+ onClick={addCta}
330
+ >
331
+ {formatMessage(messages.addButton)}
332
+ </CapButton>
333
+ </div>
334
+ </CapTooltip>
312
335
  </CapRow>,
313
336
  );
314
337
  }
@@ -53,4 +53,13 @@ export default defineMessages({
53
53
  id: `${prefix}.addButton`,
54
54
  defaultMessage: 'Add button',
55
55
  },
56
+ ctaSaveDisabled: {
57
+ id: `${prefix}.ctaSaveDisabled`,
58
+ defaultMessage: 'Please complete the above fields to enable button',
59
+ },
60
+ ctaAddDisabled: {
61
+ id: `${prefix}.ctaAddDisabled`,
62
+ defaultMessage:
63
+ 'Please save the first button before proceeding to create second button',
64
+ },
56
65
  });
@@ -266,7 +266,6 @@
266
266
  margin: 8px 0;
267
267
  }
268
268
  .whatsapp-cta-preview{
269
- margin-bottom: 8px;
270
269
  font-size: 10px;
271
270
  text-align: center;
272
271
  }
@@ -375,8 +375,18 @@ export class Creatives extends React.Component {
375
375
  language,
376
376
  category,
377
377
  mediaType,
378
+ whatsappButtonType : buttonType = 'NONE',
379
+ buttons = [],
378
380
  } = {},
379
381
  } = templateData;
382
+ const modifiedButtons = cloneDeep(buttons).map((btn) => {
383
+ if (btn.type === 'PHONE_NUMBER') {
384
+ btn.phone_number = btn.phoneNumber;
385
+ delete btn.phoneNumber;
386
+ return btn;
387
+ }
388
+ return btn;
389
+ });
380
390
  creativesTemplateData = {
381
391
  _id: id,
382
392
  type: constants.WHATSAPP,
@@ -390,6 +400,8 @@ export class Creatives extends React.Component {
390
400
  category,
391
401
  varMapped,
392
402
  mediaType,
403
+ buttonType,
404
+ buttons : modifiedButtons,
393
405
  languages: [
394
406
  {
395
407
  language,
@@ -576,7 +588,17 @@ export class Creatives extends React.Component {
576
588
  category,
577
589
  templateEditor,
578
590
  varMapped,
591
+ buttonType : whatsappButtonType = 'NONE',
592
+ buttons = [],
579
593
  } = cloneDeep(versions.base.content.whatsapp);
594
+ const modifiedButtons = cloneDeep(buttons).map((btn) => {
595
+ if (btn.type === 'PHONE_NUMBER') {
596
+ btn.phoneNumber = btn.phone_number;
597
+ delete btn.phone_number;
598
+ return btn;
599
+ }
600
+ return btn;
601
+ });
580
602
  templateData = {
581
603
  channel,
582
604
  accountId,
@@ -590,6 +612,8 @@ export class Creatives extends React.Component {
590
612
  category,
591
613
  language: languages[0].language,
592
614
  mediaType,
615
+ whatsappButtonType,
616
+ buttons : modifiedButtons,
593
617
  },
594
618
  };
595
619
  }