@capillarytech/creatives-library 7.17.138 → 7.17.140

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.
@@ -217,8 +217,11 @@ describe('Creatives Whatsapp test1/>', () => {
217
217
  });
218
218
 
219
219
  it('test addVariable in create mode', () => {
220
+
221
+
220
222
  renderHelper({});
221
- renderedComponent.find('CapHeader').at(1).props().suffix.props.onClick();
223
+ renderedComponent.update();
224
+ renderedComponent.find('[data-testid="suffix-button"]').at(1).props().onClick();
222
225
  expect(renderedComponent).toMatchSnapshot();
223
226
  });
224
227
 
@@ -5,7 +5,8 @@ import {
5
5
  getWhatsappCta,
6
6
  bytesConversion,
7
7
  getWhatsappDocPreview,
8
- getWhatsappQuickReply
8
+ getWhatsappQuickReply,
9
+ getWhatsappAutoFill
9
10
  } from '../utils';
10
11
  import mockdata from '../../mockdata';
11
12
 
@@ -21,7 +22,8 @@ const {
21
22
  getWhatsappDocPreviewOutput1,
22
23
  whatsappPreviewTemplateData3,
23
24
  whatsappPreviewTemplateData3Result,
24
- whatsappPreviewTemplateData3QuickReplyResult
25
+ whatsappPreviewTemplateData3QuickReplyResult,
26
+ getWhatsappAutoFillData
25
27
  } = mockdata;
26
28
 
27
29
  describe('Test utils', () => {
@@ -66,6 +68,11 @@ describe('Test utils', () => {
66
68
  getWhatsappCategoryOutput2,
67
69
  );
68
70
  });
71
+ it('test getWhatsappAutoFill', () => {
72
+ expect(getWhatsappAutoFill({versions:{base:{content:{whatsapp:{category: 'AUTHENTICATION'}}}}})).toEqual(
73
+ getWhatsappAutoFillData,
74
+ );
75
+ });
69
76
 
70
77
  it('test getWhatsappDocPreview', () => {
71
78
  const whatsappDocParams = {
@@ -5,6 +5,7 @@ import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
5
5
  import CapImage from '@capillarytech/cap-ui-library/CapImage';
6
6
  import CapDivider from '@capillarytech/cap-ui-library/CapDivider';
7
7
  import { get } from 'lodash';
8
+ import globalMessages from '../Cap/messages';
8
9
  import { WHATSAPP } from '../CreativesContainer/constants';
9
10
  import {
10
11
  STATUS_OPTIONS,
@@ -185,6 +186,23 @@ export const getWhatsappQuickReply= (template, templatePreview) => {
185
186
  }
186
187
  return renderArray;
187
188
  }
189
+ export const getWhatsappAutoFill = (template) => {
190
+ const {category}= get(
191
+ template,
192
+ `versions.base.content.whatsapp`,
193
+ {},
194
+ );
195
+ if (category === 'AUTHENTICATION') {
196
+ return (
197
+ <CapLabel
198
+ type="label21"
199
+ className='whatsapp-autofill-btn'
200
+ >
201
+ <FormattedMessage {...globalMessages.autofill} />
202
+ </CapLabel>);
203
+ }
204
+ return <></>
205
+ }
188
206
 
189
207
  export const getWhatsappCategory = (category, hostName) => (
190
208
  hostName === HOST_TWILIO ? TWILIO_CATEGORY_OPTIONS : [...KARIX_GUPSHUP_CATEGORY_OPTIONS, ...KARIX_GUPSHUP_OLDER_CATEGORY_OPTIONS]
@@ -2464,4 +2464,15 @@ export default {
2464
2464
  },
2465
2465
  demoVideoAndLinkJSONStatus: "SUCCESS",
2466
2466
  },
2467
+ getWhatsappAutoFillData:
2468
+ < CapLabel
2469
+ className="whatsapp-autofill-btn"
2470
+ type="label21"
2471
+ >
2472
+ <FormattedMessage
2473
+ defaultMessage="Autofill"
2474
+ id="creatives.componentsV2.autofill"
2475
+ values={{}}
2476
+ />
2477
+ </CapLabel>,
2467
2478
  };