@capillarytech/creatives-library 7.17.138 → 7.17.139

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.
@@ -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,28 @@ 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
+ <CapIcon
202
+ type={'launch'}
203
+ size="xs"
204
+ className='margin-r-4'
205
+ />
206
+ <FormattedMessage {...globalMessages.autofill} />
207
+ </CapLabel>);
208
+ }
209
+ return <></>
210
+ }
188
211
 
189
212
  export const getWhatsappCategory = (category, hostName) => (
190
213
  hostName === HOST_TWILIO ? TWILIO_CATEGORY_OPTIONS : [...KARIX_GUPSHUP_CATEGORY_OPTIONS, ...KARIX_GUPSHUP_OLDER_CATEGORY_OPTIONS]
@@ -2464,4 +2464,20 @@ export default {
2464
2464
  },
2465
2465
  demoVideoAndLinkJSONStatus: "SUCCESS",
2466
2466
  },
2467
+ getWhatsappAutoFillData:
2468
+ < CapLabel
2469
+ className="whatsapp-autofill-btn"
2470
+ type="label21"
2471
+ >
2472
+ <CapIcon
2473
+ className="margin-r-4"
2474
+ size="xs"
2475
+ type="launch"
2476
+ />
2477
+ <FormattedMessage
2478
+ defaultMessage="Autofill"
2479
+ id="creatives.componentsV2.autofill"
2480
+ values={{}}
2481
+ />
2482
+ </CapLabel>,
2467
2483
  };