@capillarytech/creatives-library 8.0.168 → 8.0.170-beta.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.
Files changed (38) hide show
  1. package/app.js +4 -0
  2. package/containers/App/constants.js +2 -0
  3. package/package.json +2 -1
  4. package/utils/commonUtils.js +50 -0
  5. package/utils/test-utils.js +6 -2
  6. package/utils/tests/newrelic.test.js +546 -0
  7. package/v2Components/CapActionButton/index.js +52 -12
  8. package/v2Components/CapActionButton/messages.js +4 -0
  9. package/v2Components/CapActionButton/tests/index.test.js +135 -0
  10. package/v2Components/CapDeviceContent/index.js +5 -0
  11. package/v2Components/CapInAppCTA/index.js +29 -14
  12. package/v2Components/CapInAppCTA/index.scss +0 -2
  13. package/v2Components/CapInAppCTA/messages.js +4 -0
  14. package/v2Components/CapMpushCTA/index.js +54 -38
  15. package/v2Components/CapMpushCTA/index.scss +2 -2
  16. package/v2Components/CapMpushCTA/messages.js +4 -0
  17. package/v2Components/CapTagListWithInput/index.js +169 -0
  18. package/v2Components/CapTagListWithInput/messages.js +10 -0
  19. package/v2Components/FormBuilder/index.js +93 -1
  20. package/v2Components/TestAndPreviewSlidebox/PreviewSection.js +1 -1
  21. package/v2Components/TestAndPreviewSlidebox/index.js +24 -4
  22. package/v2Containers/Email/index.js +64 -3
  23. package/v2Containers/Email/initialSchema.js +7 -21
  24. package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +2 -2
  25. package/v2Containers/Line/Container/Wrapper/tests/index.test.js +56 -1
  26. package/v2Containers/Line/Container/Wrapper/utils.js +6 -4
  27. package/v2Containers/MobilePush/Create/index.js +24 -3
  28. package/v2Containers/MobilePush/commonMethods.js +25 -3
  29. package/v2Containers/MobilePushNew/components/CtaButtons.js +20 -0
  30. package/v2Containers/MobilePushNew/components/MediaUploaders.js +31 -3
  31. package/v2Containers/MobilePushNew/components/PlatformContentFields.js +34 -3
  32. package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +200 -5
  33. package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +59 -1
  34. package/v2Containers/MobilePushNew/index.js +9 -0
  35. package/v2Containers/MobilePushNew/index.scss +2 -1
  36. package/v2Containers/Rcs/index.js +77 -71
  37. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +15270 -492
  38. package/v2Containers/Viber/index.js +102 -76
@@ -111,7 +111,7 @@ export const Rcs = (props) => {
111
111
  isDltEnabled,
112
112
  smsRegister,
113
113
  selectedOfferDetails,
114
- currentOrgDetails
114
+ currentOrgDetails,
115
115
  } = props || {};
116
116
  const { formatMessage } = intl;
117
117
  const { TextArea } = CapInput;
@@ -189,6 +189,76 @@ export const Rcs = (props) => {
189
189
  display: flex;
190
190
  margin-top: 20px;
191
191
  `;
192
+
193
+ // tag Code start from here
194
+ useEffect(() => {
195
+ if (!showDltContainer) {
196
+ //fetching tags
197
+ const { type, module } = location.query || {};
198
+ const isEmbedded = type === EMBEDDED;
199
+ const context = isEmbedded ? module : DEFAULT;
200
+ const embedded = isEmbedded ? type : FULL;
201
+ const query = {
202
+ layout: SMS,
203
+ type: TAG,
204
+ context,
205
+ embedded,
206
+ };
207
+ if (getDefaultTags) {
208
+ query.context = getDefaultTags;
209
+ }
210
+ globalActions.fetchSchemaForEntity(query);
211
+ }
212
+ }, [showDltContainer]);
213
+
214
+ useEffect(() => {
215
+ let tag = get(metaEntities, `tags.standard`, []);
216
+ const { type, module } = location.query || {};
217
+ if (type === EMBEDDED && module === LIBRARY && !getDefaultTags) {
218
+ tag = supportedTags;
219
+ }
220
+ updateTags(tag);
221
+ }, [metaEntities]);
222
+
223
+ const handleOnTagsContextChange = (data) => {
224
+ const { type } = location.query || {};
225
+ const tempData = (data || '').toLowerCase();
226
+ const isEmbedded = type === EMBEDDED;
227
+ const embedded = isEmbedded ? type : FULL;
228
+ const context = tempData === ALL ? DEFAULT : tempData;
229
+ const query = {
230
+ layout: SMS,
231
+ type: TAG,
232
+ context,
233
+ embedded,
234
+ };
235
+ globalActions.fetchSchemaForEntity(query);
236
+ };
237
+
238
+ const onTagSelect = (data) => {
239
+ const tempMsg = `${templateDesc}{{${data}}}`;
240
+ const error = templateDescErrorHandler(tempMsg);
241
+ setTemplateDesc(tempMsg);
242
+ setTemplateDescError(error);
243
+ };
244
+
245
+ const onTagSelectFallback = (data) => {
246
+ const tempMsg = `${fallbackMessage}{{${data}}}`;
247
+ const error = fallbackMessageErrorHandler(tempMsg);
248
+ setFallbackMessage(tempMsg);
249
+ setFallbackMessageError(error);
250
+ };
251
+
252
+ //removing optout tag for rcs
253
+ const getRcsTags = () => {
254
+ const tempTags = cloneDeep(tags);
255
+ // eslint-disable-next-line no-undef
256
+ if (tempTags?.length > 0 && tempTags[0]?.definition?.value === 'optout') {
257
+ tempTags.shift();
258
+ }
259
+ return tempTags;
260
+ };
261
+ // tag Code end
192
262
  const rcsButtonTypeOptions = [
193
263
  {
194
264
  label: (
@@ -207,6 +277,12 @@ export const Rcs = (props) => {
207
277
  buttonTextlen={TEMPLATE_BUTTON_TEXT_MAX_LENGTH}
208
278
  updateButtonChange={updateButtonChange}
209
279
  suggestions={suggestions}
280
+ onTagSelect={onTagSelect}
281
+ location={location}
282
+ tags={getRcsTags()}
283
+ onContextChange={handleOnTagsContextChange}
284
+ injectedTags={injectedTags || {}}
285
+ selectedOfferDetails={selectedOfferDetails}
210
286
  />
211
287
  )}
212
288
  </>
@@ -306,76 +382,6 @@ export const Rcs = (props) => {
306
382
  }
307
383
  }, [rcsData.templateDetails || templateData]);
308
384
 
309
- // tag Code start from here
310
- useEffect(() => {
311
- if (!showDltContainer) {
312
- //fetching tags
313
- const { type, module } = location.query || {};
314
- const isEmbedded = type === EMBEDDED;
315
- const context = isEmbedded ? module : DEFAULT;
316
- const embedded = isEmbedded ? type : FULL;
317
- const query = {
318
- layout: SMS,
319
- type: TAG,
320
- context,
321
- embedded,
322
- };
323
- if (getDefaultTags) {
324
- query.context = getDefaultTags;
325
- }
326
- globalActions.fetchSchemaForEntity(query);
327
- }
328
- }, [showDltContainer]);
329
-
330
- useEffect(() => {
331
- let tag = get(metaEntities, `tags.standard`, []);
332
- const { type, module } = location.query || {};
333
- if (type === EMBEDDED && module === LIBRARY && !getDefaultTags) {
334
- tag = supportedTags;
335
- }
336
- updateTags(tag);
337
- }, [metaEntities]);
338
-
339
- const handleOnTagsContextChange = (data) => {
340
- const { type } = location.query || {};
341
- const tempData = (data || '').toLowerCase();
342
- const isEmbedded = type === EMBEDDED;
343
- const embedded = isEmbedded ? type : FULL;
344
- const context = tempData === ALL ? DEFAULT : tempData;
345
- const query = {
346
- layout: SMS,
347
- type: TAG,
348
- context,
349
- embedded,
350
- };
351
- globalActions.fetchSchemaForEntity(query);
352
- };
353
-
354
- const onTagSelect = (data) => {
355
- const tempMsg = `${templateDesc}{{${data}}}`;
356
- const error = templateDescErrorHandler(tempMsg);
357
- setTemplateDesc(tempMsg);
358
- setTemplateDescError(error);
359
- };
360
-
361
- const onTagSelectFallback = (data) => {
362
- const tempMsg = `${fallbackMessage}{{${data}}}`;
363
- const error = fallbackMessageErrorHandler(tempMsg);
364
- setFallbackMessage(tempMsg);
365
- setFallbackMessageError(error);
366
- };
367
-
368
- //removing optout tag for rcs
369
- const getRcsTags = () => {
370
- const tempTags = cloneDeep(tags);
371
- // eslint-disable-next-line no-undef
372
- if (tempTags?.length > 0 && tempTags[0]?.definition?.value === 'optout') {
373
- tempTags.shift();
374
- }
375
- return tempTags;
376
- };
377
- // tag Code end
378
-
379
385
  const renderLabel = (value, showLabel, desc) => (
380
386
  <>
381
387
  <RcsLabel>