@capillarytech/creatives-library 8.0.247 → 8.0.249

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.
@@ -6502,7 +6502,7 @@ FREE GIFTS-
6502
6502
  "creatives.componentsV2.CapDocumentUpload.imageDimenstionDescription": "Dimensions upto: {width}px x {height}px",
6503
6503
  "creatives.componentsV2.CapDocumentUpload.or": "OR",
6504
6504
  "creatives.componentsV2.CapDocumentUpload.uploadComputer": "Select from computer",
6505
- "creatives.componentsV2.CapDocumentUpload.whatsappDocSize": "Size upto: {size}",
6505
+ "creatives.componentsV2.CapDocumentUpload.whatsappDocSize": "Size up to: {size}",
6506
6506
  "creatives.componentsV2.CapImageUpload.aspectRatio": "Aspect ratio: 1:1",
6507
6507
  "creatives.componentsV2.CapImageUpload.dragAndDrop": "Drag and drop image here",
6508
6508
  "creatives.componentsV2.CapImageUpload.format": "Format: JPEG, JPG, PNG",
@@ -6510,13 +6510,13 @@ FREE GIFTS-
6510
6510
  "creatives.componentsV2.CapImageUpload.imageErrorDesc": "Please upload the image with allowed file extension, size, dimension and aspect ratio",
6511
6511
  "creatives.componentsV2.CapImageUpload.imageGallery": "Gallery",
6512
6512
  "creatives.componentsV2.CapImageUpload.imageReUpload": "Reupload",
6513
- "creatives.componentsV2.CapImageUpload.imageSize": "Size upto: 2MB",
6513
+ "creatives.componentsV2.CapImageUpload.imageSize": "Size up to: 2MB",
6514
6514
  "creatives.componentsV2.CapImageUpload.or": "OR",
6515
6515
  "creatives.componentsV2.CapImageUpload.uploadComputer": "Select from computer",
6516
6516
  "creatives.componentsV2.CapImageUpload.uploadGallery": "Gallery",
6517
6517
  "creatives.componentsV2.CapImageUpload.uploadImageDescription": "The relevant image that complements the message context.",
6518
6518
  "creatives.componentsV2.CapImageUpload.whatsappAspectRatio": "Max aspect ratio: 1.91:1",
6519
- "creatives.componentsV2.CapImageUpload.whatsappImageSize": "Size upto: 5MB",
6519
+ "creatives.componentsV2.CapImageUpload.whatsappImageSize": "Size up to: 5MB",
6520
6520
  "creatives.componentsV2.CapTagList.Cancel": "Cancel",
6521
6521
  "creatives.componentsV2.CapTagList.Ok": "Ok",
6522
6522
  "creatives.componentsV2.CapTagList.all": "All",
@@ -8209,6 +8209,7 @@ new message content.",
8209
8209
  "creatives.containersV2.WeChat.templateName": "Template Name",
8210
8210
  "creatives.containersV2.WeChat.wechatCreateSuccess": "WeChat template mapped successfully",
8211
8211
  "creatives.containersV2.WeChat.wechatEditSuccess": "WeChat template edited successfully",
8212
+ "creatives.containersV2.WebPush.addLabels": "Add labels",
8212
8213
  "creatives.containersV2.Whatsapp.IncorrectCategoryError": "INCORRECT CATEGORY: Message content different from expected content in the category selected. Refer {here} for expected content in each category.",
8213
8214
  "creatives.containersV2.Whatsapp.accountUpdate": "Account update",
8214
8215
  "creatives.containersV2.Whatsapp.accountUpdateTooltip": "Let customers know about updates or changes to their accounts.",
@@ -17296,7 +17297,7 @@ FREE GIFTS-
17296
17297
  "creatives.componentsV2.CapDocumentUpload.imageDimenstionDescription": "Dimensions upto: {width}px x {height}px",
17297
17298
  "creatives.componentsV2.CapDocumentUpload.or": "OR",
17298
17299
  "creatives.componentsV2.CapDocumentUpload.uploadComputer": "Select from computer",
17299
- "creatives.componentsV2.CapDocumentUpload.whatsappDocSize": "Size upto: {size}",
17300
+ "creatives.componentsV2.CapDocumentUpload.whatsappDocSize": "Size up to: {size}",
17300
17301
  "creatives.componentsV2.CapImageUpload.aspectRatio": "Aspect ratio: 1:1",
17301
17302
  "creatives.componentsV2.CapImageUpload.dragAndDrop": "Drag and drop image here",
17302
17303
  "creatives.componentsV2.CapImageUpload.format": "Format: JPEG, JPG, PNG",
@@ -17304,13 +17305,13 @@ FREE GIFTS-
17304
17305
  "creatives.componentsV2.CapImageUpload.imageErrorDesc": "Please upload the image with allowed file extension, size, dimension and aspect ratio",
17305
17306
  "creatives.componentsV2.CapImageUpload.imageGallery": "Gallery",
17306
17307
  "creatives.componentsV2.CapImageUpload.imageReUpload": "Reupload",
17307
- "creatives.componentsV2.CapImageUpload.imageSize": "Size upto: 2MB",
17308
+ "creatives.componentsV2.CapImageUpload.imageSize": "Size up to: 2MB",
17308
17309
  "creatives.componentsV2.CapImageUpload.or": "OR",
17309
17310
  "creatives.componentsV2.CapImageUpload.uploadComputer": "Select from computer",
17310
17311
  "creatives.componentsV2.CapImageUpload.uploadGallery": "Gallery",
17311
17312
  "creatives.componentsV2.CapImageUpload.uploadImageDescription": "The relevant image that complements the message context.",
17312
17313
  "creatives.componentsV2.CapImageUpload.whatsappAspectRatio": "Max aspect ratio: 1.91:1",
17313
- "creatives.componentsV2.CapImageUpload.whatsappImageSize": "Size upto: 5MB",
17314
+ "creatives.componentsV2.CapImageUpload.whatsappImageSize": "Size up to: 5MB",
17314
17315
  "creatives.componentsV2.CapTagList.Cancel": "Cancel",
17315
17316
  "creatives.componentsV2.CapTagList.Ok": "Ok",
17316
17317
  "creatives.componentsV2.CapTagList.all": "All",
@@ -19003,6 +19004,7 @@ new message content.",
19003
19004
  "creatives.containersV2.WeChat.templateName": "Template Name",
19004
19005
  "creatives.containersV2.WeChat.wechatCreateSuccess": "WeChat template mapped successfully",
19005
19006
  "creatives.containersV2.WeChat.wechatEditSuccess": "WeChat template edited successfully",
19007
+ "creatives.containersV2.WebPush.addLabels": "Add labels",
19006
19008
  "creatives.containersV2.Whatsapp.IncorrectCategoryError": "INCORRECT CATEGORY: Message content different from expected content in the category selected. Refer {here} for expected content in each category.",
19007
19009
  "creatives.containersV2.Whatsapp.accountUpdate": "Account update",
19008
19010
  "creatives.containersV2.Whatsapp.accountUpdateTooltip": "Let customers know about updates or changes to their accounts.",
@@ -28090,7 +28092,7 @@ FREE GIFTS-
28090
28092
  "creatives.componentsV2.CapDocumentUpload.imageDimenstionDescription": "Dimensions upto: {width}px x {height}px",
28091
28093
  "creatives.componentsV2.CapDocumentUpload.or": "OR",
28092
28094
  "creatives.componentsV2.CapDocumentUpload.uploadComputer": "Select from computer",
28093
- "creatives.componentsV2.CapDocumentUpload.whatsappDocSize": "Size upto: {size}",
28095
+ "creatives.componentsV2.CapDocumentUpload.whatsappDocSize": "Size up to: {size}",
28094
28096
  "creatives.componentsV2.CapImageUpload.aspectRatio": "Aspect ratio: 1:1",
28095
28097
  "creatives.componentsV2.CapImageUpload.dragAndDrop": "Drag and drop image here",
28096
28098
  "creatives.componentsV2.CapImageUpload.format": "Format: JPEG, JPG, PNG",
@@ -28098,13 +28100,13 @@ FREE GIFTS-
28098
28100
  "creatives.componentsV2.CapImageUpload.imageErrorDesc": "Please upload the image with allowed file extension, size, dimension and aspect ratio",
28099
28101
  "creatives.componentsV2.CapImageUpload.imageGallery": "Gallery",
28100
28102
  "creatives.componentsV2.CapImageUpload.imageReUpload": "Reupload",
28101
- "creatives.componentsV2.CapImageUpload.imageSize": "Size upto: 2MB",
28103
+ "creatives.componentsV2.CapImageUpload.imageSize": "Size up to: 2MB",
28102
28104
  "creatives.componentsV2.CapImageUpload.or": "OR",
28103
28105
  "creatives.componentsV2.CapImageUpload.uploadComputer": "Select from computer",
28104
28106
  "creatives.componentsV2.CapImageUpload.uploadGallery": "Gallery",
28105
28107
  "creatives.componentsV2.CapImageUpload.uploadImageDescription": "The relevant image that complements the message context.",
28106
28108
  "creatives.componentsV2.CapImageUpload.whatsappAspectRatio": "Max aspect ratio: 1.91:1",
28107
- "creatives.componentsV2.CapImageUpload.whatsappImageSize": "Size upto: 5MB",
28109
+ "creatives.componentsV2.CapImageUpload.whatsappImageSize": "Size up to: 5MB",
28108
28110
  "creatives.componentsV2.CapTagList.Cancel": "Cancel",
28109
28111
  "creatives.componentsV2.CapTagList.Ok": "Ok",
28110
28112
  "creatives.componentsV2.CapTagList.all": "All",
@@ -29797,6 +29799,7 @@ new message content.",
29797
29799
  "creatives.containersV2.WeChat.templateName": "Template Name",
29798
29800
  "creatives.containersV2.WeChat.wechatCreateSuccess": "WeChat template mapped successfully",
29799
29801
  "creatives.containersV2.WeChat.wechatEditSuccess": "WeChat template edited successfully",
29802
+ "creatives.containersV2.WebPush.addLabels": "Add labels",
29800
29803
  "creatives.containersV2.Whatsapp.IncorrectCategoryError": "INCORRECT CATEGORY: Message content different from expected content in the category selected. Refer {here} for expected content in each category.",
29801
29804
  "creatives.containersV2.Whatsapp.accountUpdate": "Account update",
29802
29805
  "creatives.containersV2.Whatsapp.accountUpdateTooltip": "Let customers know about updates or changes to their accounts.",
@@ -39265,7 +39268,7 @@ FREE GIFTS-
39265
39268
  "creatives.componentsV2.CapDocumentUpload.imageDimenstionDescription": "Dimensions upto: {width}px x {height}px",
39266
39269
  "creatives.componentsV2.CapDocumentUpload.or": "OR",
39267
39270
  "creatives.componentsV2.CapDocumentUpload.uploadComputer": "Select from computer",
39268
- "creatives.componentsV2.CapDocumentUpload.whatsappDocSize": "Size upto: {size}",
39271
+ "creatives.componentsV2.CapDocumentUpload.whatsappDocSize": "Size up to: {size}",
39269
39272
  "creatives.componentsV2.CapImageUpload.aspectRatio": "Aspect ratio: 1:1",
39270
39273
  "creatives.componentsV2.CapImageUpload.dragAndDrop": "Drag and drop image here",
39271
39274
  "creatives.componentsV2.CapImageUpload.format": "Format: JPEG, JPG, PNG",
@@ -39273,13 +39276,13 @@ FREE GIFTS-
39273
39276
  "creatives.componentsV2.CapImageUpload.imageErrorDesc": "Please upload the image with allowed file extension, size, dimension and aspect ratio",
39274
39277
  "creatives.componentsV2.CapImageUpload.imageGallery": "Gallery",
39275
39278
  "creatives.componentsV2.CapImageUpload.imageReUpload": "Reupload",
39276
- "creatives.componentsV2.CapImageUpload.imageSize": "Size upto: 2MB",
39279
+ "creatives.componentsV2.CapImageUpload.imageSize": "Size up to: 2MB",
39277
39280
  "creatives.componentsV2.CapImageUpload.or": "OR",
39278
39281
  "creatives.componentsV2.CapImageUpload.uploadComputer": "Select from computer",
39279
39282
  "creatives.componentsV2.CapImageUpload.uploadGallery": "Gallery",
39280
39283
  "creatives.componentsV2.CapImageUpload.uploadImageDescription": "The relevant image that complements the message context.",
39281
39284
  "creatives.componentsV2.CapImageUpload.whatsappAspectRatio": "Max aspect ratio: 1.91:1",
39282
- "creatives.componentsV2.CapImageUpload.whatsappImageSize": "Size upto: 5MB",
39285
+ "creatives.componentsV2.CapImageUpload.whatsappImageSize": "Size up to: 5MB",
39283
39286
  "creatives.componentsV2.CapTagList.Cancel": "Cancel",
39284
39287
  "creatives.componentsV2.CapTagList.Ok": "Ok",
39285
39288
  "creatives.componentsV2.CapTagList.all": "All",
@@ -40972,6 +40975,7 @@ new message content.",
40972
40975
  "creatives.containersV2.WeChat.templateName": "Template Name",
40973
40976
  "creatives.containersV2.WeChat.wechatCreateSuccess": "WeChat template mapped successfully",
40974
40977
  "creatives.containersV2.WeChat.wechatEditSuccess": "WeChat template edited successfully",
40978
+ "creatives.containersV2.WebPush.addLabels": "Add labels",
40975
40979
  "creatives.containersV2.Whatsapp.IncorrectCategoryError": "INCORRECT CATEGORY: Message content different from expected content in the category selected. Refer {here} for expected content in each category.",
40976
40980
  "creatives.containersV2.Whatsapp.accountUpdate": "Account update",
40977
40981
  "creatives.containersV2.Whatsapp.accountUpdateTooltip": "Let customers know about updates or changes to their accounts.",
@@ -34,7 +34,7 @@ import { CREATIVES_UI_VIEW, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, JP_LOCA
34
34
  import AccessForbidden from '../../v2Components/AccessForbidden';
35
35
  import { getObjFromQueryParams } from '../../utils/v2common';
36
36
  import { makeSelectAuthenticated, selectCurrentOrgDetails } from "../../v2Containers/Cap/selectors";
37
- import { LOYALTY_SUPPORTED_ACTION } from "../CreativesContainer/constants";
37
+ import { LOYALTY_SUPPORTED_ACTION, COMMON_CHANNELS } from "../CreativesContainer/constants";
38
38
 
39
39
  const {CapCustomCardList} = CapCustomCard;
40
40
 
@@ -66,7 +66,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
66
66
  //'wechat': {content: this.getTemplatesComponent('wechat'), tab: 'Wechat', key: 'wechat'},
67
67
  mPush: {content: <></>, tab: intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
68
68
  ...(commonUtil.hasWebPushFeatureEnabled() ? {
69
- webPush: {
69
+ webpush: {
70
70
  content: <div></div>,
71
71
  tab: intl.formatMessage(messages.webPush),
72
72
  key: WEBPUSH,
@@ -95,7 +95,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
95
95
  return obj;
96
96
  }, []);
97
97
 
98
- if (isFullMode ) {
98
+ if (isFullMode ) {
99
99
  filteredPanes.push({content: <div></div>, tab: intl.formatMessage(messages.gallery), key: 'assets'});
100
100
  } else {
101
101
  if (!channelsToHide.includes('callTask')) {
@@ -105,18 +105,19 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
105
105
  filteredPanes.push({content: <></>, tab: intl.formatMessage(messages.FTP), key: 'ftp'});
106
106
  defaultChannel = 'FTP';
107
107
  }
108
- const commonChannels = ['sms', 'email', 'wechat', 'mobilepush', 'line', 'viber', 'facebook', 'call_task', 'ftp', 'assets'];
109
108
 
109
+ // Create a local copy of COMMON_CHANNELS to avoid mutating the imported array
110
+ const channels = [...COMMON_CHANNELS];
110
111
  const { actionName = ''} = loyaltyMetaData;
111
112
  if (isLoyaltyModule && actionName === LOYALTY_SUPPORTED_ACTION) {
112
- commonChannels.push(WHATSAPP, ZALO);
113
+ channels.push(WHATSAPP, ZALO);
113
114
  }
114
115
 
115
- // we only show channels which other than commonChannels
116
+ // we only show channels which other than COMMON_CHANNELS
116
117
  // if it is coming in enableNewChannels array
117
118
  filteredPanes = filteredPanes.filter((item) => {
118
119
  const channel = item.key;
119
- if (!commonChannels.includes(channel)) {
120
+ if (!channels.includes(channel)) {
120
121
  return enableNewChannels.includes(channel.toUpperCase());
121
122
  }
122
123
  return true;
@@ -98,9 +98,9 @@ describe('ButtonsLinksSection', () => {
98
98
  });
99
99
 
100
100
  const defaultProps = {
101
- onClickBehaviour: ON_CLICK_BEHAVIOUR_OPTIONS.OPEN_SITE,
101
+ onClickBehaviour: ON_CLICK_BEHAVIOUR_OPTIONS.SITE_URL,
102
102
  onClickBehaviourOptions: [
103
- { value: ON_CLICK_BEHAVIOUR_OPTIONS.OPEN_SITE, label: 'Open Site' },
103
+ { value: ON_CLICK_BEHAVIOUR_OPTIONS.SITE_URL, label: 'Open Site' },
104
104
  { value: ON_CLICK_BEHAVIOUR_OPTIONS.REDIRECT_TO_URL, label: 'Redirect to URL' },
105
105
  ],
106
106
  onClickBehaviourChange: mockOnClickBehaviourChange,
@@ -151,7 +151,7 @@ describe('ButtonsLinksSection', () => {
151
151
  const radioGroup = wrapper.find(CapRadioGroup);
152
152
  expect(radioGroup.exists()).toBe(true);
153
153
  expect(radioGroup.prop('options')).toEqual(defaultProps.onClickBehaviourOptions);
154
- expect(radioGroup.prop('value')).toBe(ON_CLICK_BEHAVIOUR_OPTIONS.OPEN_SITE);
154
+ expect(radioGroup.prop('value')).toBe(ON_CLICK_BEHAVIOUR_OPTIONS.SITE_URL);
155
155
  });
156
156
  });
157
157
 
@@ -175,7 +175,7 @@ describe('ButtonsLinksSection', () => {
175
175
  expect(input.exists()).toBe(true);
176
176
  });
177
177
 
178
- it('should not render redirect URL input when OPEN_SITE is selected', () => {
178
+ it('should not render redirect URL input when SITE_URL is selected', () => {
179
179
  const wrapper = mountWithIntl(<ButtonsLinksSection {...defaultProps} />);
180
180
  const input = wrapper.find(CapInput).find('#webpush-redirect-url-input');
181
181
  expect(input.exists()).toBe(false);
@@ -32,7 +32,7 @@ exports[`ButtonsLinksSection Rendering should render correctly with default prop
32
32
  Array [
33
33
  Object {
34
34
  "label": "Open Site",
35
- "value": "OPEN_SITE",
35
+ "value": "SITE_URL",
36
36
  },
37
37
  Object {
38
38
  "label": "Redirect to URL",
@@ -40,7 +40,7 @@ exports[`ButtonsLinksSection Rendering should render correctly with default prop
40
40
  },
41
41
  ]
42
42
  }
43
- value="OPEN_SITE"
43
+ value="SITE_URL"
44
44
  />
45
45
  </CapRow>
46
46
  <CapRow
@@ -32,6 +32,9 @@ import { useImageUpload } from './hooks/useImageUpload';
32
32
  import { useTagManagement } from './hooks/useTagManagement';
33
33
  import isEmpty from 'lodash/isEmpty';
34
34
  import get from 'lodash/get';
35
+ import * as templateActions from '../../Templates/actions';
36
+ import { makeSelectTemplates } from '../../Templates/selectors';
37
+
35
38
  import {
36
39
  WEBPUSH_MEDIA_TYPES,
37
40
  BRAND_ICON_OPTIONS,
@@ -53,6 +56,7 @@ import {
53
56
  } from '../selectors';
54
57
  import webPushReducer from '../reducer';
55
58
  import webPushSagas from '../sagas';
59
+ import { v2TemplateSaga } from '../../Templates/sagas';
56
60
  import withCreatives from '../../../hoc/withCreatives';
57
61
  import messages from './messages';
58
62
  import { createWebPushPayload } from './utils/payloadBuilder';
@@ -67,6 +71,7 @@ import {
67
71
  setInjectedTags,
68
72
  } from '../../Cap/selectors';
69
73
  import './index.scss';
74
+ import { WEBPUSH } from '../../CreativesContainer/constants';
70
75
 
71
76
  // Memoized TagList wrapper components for better performance
72
77
  const MemoizedTagList = memo(({
@@ -123,6 +128,8 @@ const WebPushCreate = ({
123
128
  accountData,
124
129
  webPush,
125
130
  onCreateComplete,
131
+ getFormData,
132
+ isGetFormData,
126
133
  templateData,
127
134
  creativesMode,
128
135
  params,
@@ -135,6 +142,8 @@ const WebPushCreate = ({
135
142
  forwardedTags,
136
143
  selectedOfferDetails = [],
137
144
  eventContextTags = [],
145
+ templateActions: templateActionsProps,
146
+ Templates,
138
147
  }) => {
139
148
  const { formatMessage } = intl;
140
149
 
@@ -152,7 +161,7 @@ const WebPushCreate = ({
152
161
  message: false,
153
162
  });
154
163
  const [brandIconOption, setBrandIconOption] = useState(BRAND_ICON_OPTIONS.DONT_SHOW);
155
- const [onClickBehaviour, setOnClickBehaviour] = useState(ON_CLICK_BEHAVIOUR_OPTIONS.OPEN_SITE);
164
+ const [onClickBehaviour, setOnClickBehaviour] = useState(ON_CLICK_BEHAVIOUR_OPTIONS.SITE_URL);
156
165
  const [redirectUrl, setRedirectUrl] = useState('');
157
166
  const [redirectUrlError, setRedirectUrlError] = useState('');
158
167
  const [activeUploadField, setActiveUploadField] = useState(null);
@@ -213,6 +222,7 @@ const WebPushCreate = ({
213
222
  eventContextTags,
214
223
  });
215
224
  const { tags, handleOnTagsContextChange, validationConfig } = tagState;
225
+ const { weCrmAccounts } = Templates;
216
226
 
217
227
  // Edit mode detection: check creativesMode or presence of template ID
218
228
  const isEditMode = useMemo(
@@ -239,11 +249,22 @@ const WebPushCreate = ({
239
249
  templateData,
240
250
  ]);
241
251
 
252
+ const selectedWebPushAccount = useMemo(() =>
253
+ weCrmAccounts?.find(account => account?.id === accountId),
254
+ [weCrmAccounts, accountId]);
255
+
242
256
  const websiteLink = useMemo(
243
- () => accountData?.configs?.websiteLink || '',
244
- [accountData?.configs?.websiteLink],
257
+ () => accountData?.configs?.websiteLink || selectedWebPushAccount?.configs?.websiteLink || '',
258
+ [accountData?.configs?.websiteLink, selectedWebPushAccount?.configs?.websiteLink],
245
259
  );
246
260
 
261
+ // Fetch account details when websiteLink is missing but accountId exists
262
+ useEffect(() => {
263
+ if (!websiteLink && accountId && templateActionsProps?.getWeCrmAccounts) {
264
+ templateActionsProps.getWeCrmAccounts('WebPush');
265
+ }
266
+ }, [websiteLink, accountId, templateActionsProps?.getWeCrmAccounts]);
267
+
247
268
  const previewUrl = useMemo(
248
269
  () => (
249
270
  onClickBehaviour === ON_CLICK_BEHAVIOUR_OPTIONS.REDIRECT_TO_URL
@@ -255,7 +276,7 @@ const WebPushCreate = ({
255
276
 
256
277
  const onClickBehaviourOptions = useMemo(
257
278
  () => ([
258
- { value: ON_CLICK_BEHAVIOUR_OPTIONS.OPEN_SITE, label: formatMessage(messages.openSite) },
279
+ { value: ON_CLICK_BEHAVIOUR_OPTIONS.SITE_URL, label: formatMessage(messages.openSite) },
259
280
  { value: ON_CLICK_BEHAVIOUR_OPTIONS.REDIRECT_TO_URL, label: formatMessage(messages.redirectToSpecificUrl) },
260
281
  ]),
261
282
  [formatMessage],
@@ -349,13 +370,13 @@ const WebPushCreate = ({
349
370
  setOnClickBehaviour(ON_CLICK_BEHAVIOUR_OPTIONS.REDIRECT_TO_URL);
350
371
  setRedirectUrl(onClickAction?.url || '');
351
372
  setRedirectUrlError('');
352
- } else if (onClickAction?.type === ACTION_TYPES.OPEN_SITE) {
353
- setOnClickBehaviour(ON_CLICK_BEHAVIOUR_OPTIONS.OPEN_SITE);
354
- setRedirectUrl('');
373
+ } else if (onClickAction?.type === ACTION_TYPES.SITE_URL) {
374
+ setOnClickBehaviour(ON_CLICK_BEHAVIOUR_OPTIONS.SITE_URL);
375
+ setRedirectUrl(websiteLink);
355
376
  setRedirectUrlError('');
356
377
  } else {
357
- setOnClickBehaviour(ON_CLICK_BEHAVIOUR_OPTIONS.OPEN_SITE);
358
- setRedirectUrl('');
378
+ setOnClickBehaviour(ON_CLICK_BEHAVIOUR_OPTIONS.SITE_URL);
379
+ setRedirectUrl(websiteLink);
359
380
  setRedirectUrlError('');
360
381
  }
361
382
 
@@ -522,6 +543,15 @@ const WebPushCreate = ({
522
543
  });
523
544
  }, [isFullMode, templateName]);
524
545
 
546
+ // Pure validator that returns boolean without setting error state
547
+ const validateFormSilent = () => {
548
+ const templateNameInvalid = isFullMode && validateTemplateName(templateName);
549
+ const titleValidation = validateTitle(notificationTitle);
550
+ const messageValidation = validateMessageContent(message);
551
+
552
+ return !(templateNameInvalid || titleValidation || messageValidation);
553
+ };
554
+
525
555
  const isFormValid = () => {
526
556
  const templateNameInvalid = isFullMode && validateTemplateName(templateName);
527
557
  const titleValidation = validateTitle(notificationTitle);
@@ -558,8 +588,24 @@ const WebPushCreate = ({
558
588
  buttons,
559
589
  onClickBehaviour,
560
590
  redirectUrl,
591
+ websiteLink,
561
592
  });
562
593
 
594
+ // In library mode (not full mode), use getFormData to communicate with parent
595
+ if (!isFullMode && getFormData) {
596
+ const formDataForLibrary = {
597
+ validity: true,
598
+ value: payload,
599
+ type: WEBPUSH,
600
+ };
601
+ getFormData(formDataForLibrary);
602
+ if (handleClose) {
603
+ handleClose();
604
+ }
605
+ return;
606
+ }
607
+
608
+ // Full mode: proceed with API calls
563
609
  if (isEditMode) {
564
610
  // Get template ID from params or templateData
565
611
  const templateId = params?.id || templateData?._id;
@@ -649,6 +695,37 @@ const WebPushCreate = ({
649
695
  }
650
696
  }, [webPush?.editResponse, onCreateComplete, handleClose, isEditMode]);
651
697
 
698
+ // Handle getFormData request from parent (library mode)
699
+ useEffect(() => {
700
+ if (isGetFormData && getFormData && validateFormSilent()) {
701
+ const payload = createWebPushPayload({
702
+ templateName,
703
+ notificationTitle,
704
+ message,
705
+ mediaType,
706
+ accountId,
707
+ isFullMode,
708
+ imageSrc,
709
+ imageUrl,
710
+ imageUploadMethod: imageUpload?.uploadMethod,
711
+ brandIconOption,
712
+ brandIconSrc,
713
+ brandIconUrl,
714
+ buttons,
715
+ onClickBehaviour,
716
+ redirectUrl,
717
+ websiteLink,
718
+ });
719
+ const formDataForLibrary = {
720
+ validity: true,
721
+ value: payload,
722
+ type: WEBPUSH,
723
+ };
724
+ getFormData(formDataForLibrary);
725
+ }
726
+ // eslint-disable-next-line react-hooks/exhaustive-deps
727
+ }, [isGetFormData, getFormData]);
728
+
652
729
  const isUploadingAsset = useMemo(
653
730
  () => webPush?.assetUploading || false,
654
731
  [webPush?.assetUploading],
@@ -872,7 +949,7 @@ const WebPushCreate = ({
872
949
  () => (!accountId ? formatMessage(messages.accountRequired) : ''),
873
950
  [accountId, formatMessage],
874
951
  );
875
-
952
+
876
953
  return (
877
954
  <CapRow className="webpush-container">
878
955
  <CapColumn className="content-section" span={14}>
@@ -972,6 +1049,8 @@ WebPushCreate.propTypes = {
972
1049
  accountData: PropTypes.object,
973
1050
  webPush: PropTypes.object,
974
1051
  onCreateComplete: PropTypes.func,
1052
+ getFormData: PropTypes.func,
1053
+ isGetFormData: PropTypes.bool,
975
1054
  templateData: PropTypes.object,
976
1055
  creativesMode: PropTypes.string,
977
1056
  params: PropTypes.object,
@@ -984,6 +1063,7 @@ WebPushCreate.propTypes = {
984
1063
  forwardedTags: PropTypes.object,
985
1064
  selectedOfferDetails: PropTypes.array,
986
1065
  eventContextTags: PropTypes.array,
1066
+ templateActions: PropTypes.object,
987
1067
  };
988
1068
 
989
1069
  WebPushCreate.defaultProps = {
@@ -996,6 +1076,8 @@ WebPushCreate.defaultProps = {
996
1076
  accountData: {},
997
1077
  webPush: {},
998
1078
  onCreateComplete: () => { },
1079
+ getFormData: null,
1080
+ isGetFormData: false,
999
1081
  templateData: null,
1000
1082
  creativesMode: 'createTemplate',
1001
1083
  params: null,
@@ -1008,6 +1090,8 @@ WebPushCreate.defaultProps = {
1008
1090
  forwardedTags: {},
1009
1091
  selectedOfferDetails: [],
1010
1092
  eventContextTags: [],
1093
+ templateActions: {},
1094
+ Templates: {},
1011
1095
  };
1012
1096
 
1013
1097
  const mapStateToProps = createStructuredSelector({
@@ -1018,6 +1102,7 @@ const mapStateToProps = createStructuredSelector({
1018
1102
  editTemplateError: makeSelectEditError(),
1019
1103
  metaEntities: makeSelectMetaEntities(),
1020
1104
  injectedTags: setInjectedTags(),
1105
+ Templates: makeSelectTemplates(),
1021
1106
  accountData: createSelector(
1022
1107
  (state) => state.get('templates'),
1023
1108
  (templatesState) => {
@@ -1032,14 +1117,21 @@ const mapStateToProps = createStructuredSelector({
1032
1117
 
1033
1118
  const mapDispatchToProps = (dispatch) => ({
1034
1119
  webPushActions: bindActionCreators(actions, dispatch),
1120
+ templateActions: bindActionCreators(templateActions, dispatch),
1035
1121
  });
1036
1122
 
1037
- const withSaga = injectSaga({
1123
+ const withWebPushSaga = injectSaga({
1038
1124
  key: 'webPush',
1039
1125
  saga: webPushSagas,
1040
1126
  mode: DAEMON,
1041
1127
  });
1042
1128
 
1129
+ const withTemplateSaga = injectSaga({
1130
+ key: 'webPushTemplates',
1131
+ saga: v2TemplateSaga,
1132
+ mode: DAEMON,
1133
+ });
1134
+
1043
1135
  const withReducer = injectReducer({
1044
1136
  key: 'webPush',
1045
1137
  reducer: webPushReducer,
@@ -1050,7 +1142,7 @@ export default withCreatives({
1050
1142
  mapStateToProps,
1051
1143
  mapDispatchToProps,
1052
1144
  userAuth: true,
1053
- sagas: [withSaga],
1145
+ sagas: [withWebPushSaga, withTemplateSaga],
1054
1146
  reducers: [withReducer],
1055
1147
  });
1056
1148
 
@@ -32,6 +32,7 @@ const WebPushPreview = ({
32
32
  imageSrc,
33
33
  brandIconSrc,
34
34
  buttons,
35
+ onClickShowInAllDevices,
35
36
  }) => {
36
37
  const [selectedOS, setSelectedOS] = useState(DEFAULT_OS);
37
38
  const [selectedBrowser, setSelectedBrowser] = useState(DEFAULT_BROWSER);
@@ -56,7 +57,11 @@ const WebPushPreview = ({
56
57
  }, [browserOptionsForOS, selectedBrowser]);
57
58
 
58
59
  const handleOpenPreviewSlideBox = () => {
59
- setShowPreviewSlideBox(true);
60
+ if (onClickShowInAllDevices) {
61
+ onClickShowInAllDevices();
62
+ } else {
63
+ setShowPreviewSlideBox(true);
64
+ }
60
65
  };
61
66
 
62
67
  const handleClosePreviewSlideBox = () => {