@capillarytech/creatives-library 7.7.14 → 7.7.16

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.7.14",
4
+ "version": "7.7.16",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/services/api.js CHANGED
@@ -32,6 +32,14 @@ function parseJSON(response) {
32
32
  return response.json();
33
33
  }
34
34
 
35
+ function getUrlWithQueryParams({url, queryParams}) {
36
+ let updatedUrl = url;
37
+ Object.entries(queryParams).forEach(([key, value]) => {
38
+ updatedUrl += `${key}=${key === 'name' ? encodeURIComponent(value) : value}&`;
39
+ });
40
+ return updatedUrl;
41
+ };
42
+
35
43
  // const loginUrl = (process.env.NODE_ENV === 'production') ?
36
44
  // config.production.login_url : config.development.login_url;
37
45
 
@@ -250,20 +258,25 @@ export const getTemplateDetails = ({id, channel}) => {
250
258
  return request(url, getAPICallObject('GET'));
251
259
  };
252
260
 
253
- export const getAllTemplates = ({channel, queryParams}) => {
254
- const url = `${API_ENDPOINT}/templates/${channel}?query=${encodeURIComponent(JSON.stringify(queryParams))}`;
261
+ export const getAllTemplates = ({channel, queryParams = {}}) => {
262
+ const url = getUrlWithQueryParams({
263
+ url: `${API_ENDPOINT}/templates/${channel}?`,
264
+ queryParams,
265
+ });
255
266
  return request(url, getAPICallObject('GET'));
256
267
  };
257
268
 
258
269
  export const deleteTemplate = ({channel, id}) => {
259
-
260
270
  const url = `${API_ENDPOINT}/templates/${id}/${channel}`;
261
271
  return request(url, getAPICallObject('DELETE'));
262
272
  //return API.deleteResource(url);
263
273
  };
264
274
 
265
- export const getAllAssets = ({assetType, queryParams}) => {
266
- const url = `${API_ENDPOINT}/assets/${assetType}?query=${JSON.stringify(queryParams)}`;
275
+ export const getAllAssets = ({assetType, queryParams = {}}) => {
276
+ const url = getUrlWithQueryParams({
277
+ url: `${API_ENDPOINT}/assets/${assetType}?`,
278
+ queryParams,
279
+ });
267
280
  // const url = `https://nightly.capillary.in/arya/api/v1/creatives/assets/${assetType}?query=${JSON.stringify(queryParams)}`;
268
281
  return API.get(url);
269
282
  }
@@ -578,6 +578,7 @@ function SlideBoxContent(props) {
578
578
  templateData={templateData}
579
579
  messageDetails={messageDetails}
580
580
  cap={cap}
581
+ createNew={onCreateNew}
581
582
  onFacebookSubmit={onFacebookSubmit}
582
583
  onCreateComplete={onCreateComplete}
583
584
  isFullMode={isFullMode}
@@ -586,6 +587,7 @@ function SlideBoxContent(props) {
586
587
  }}
587
588
  getFormSubscriptionData={getFormData}
588
589
  fbAdManager={fbAdManager}
590
+ onSelectTemplate={onSelectTemplate}
589
591
  />
590
592
  )
591
593
  }
@@ -269,7 +269,11 @@ const Facebook = (props) => {
269
269
  ]);
270
270
  const query = {type: 'embedded', module: 'library'};
271
271
  const location = {pathname: `/FACEBOOK`, search: '', query};
272
- return (showTemplateList ? (
272
+
273
+ // fbAdManager ==cretaives only the case for default startegy and user selected "capillary ad manager"
274
+ // below condition (fbAdManager !==CREATIVE) is for edit fb ad manager from campaign
275
+ //-> select capillary ad manager-> select template
276
+ return ((showTemplateList && fbAdManager !==CREATIVE) ? (
273
277
  <Templates
274
278
  key={"FACEBOOK"}
275
279
  location={location}
@@ -280,11 +284,18 @@ const Facebook = (props) => {
280
284
  onSelectTemplate={onSelectTemplate}
281
285
  renderNewCardGrid={renderNewCardGrid}
282
286
  handlePeviewTemplate={handlePeviewTemplate}
283
- fbAdManager={CREATIVE}
287
+ fbAdManager={CREATIVE} // it means we are selecting capillary ad manager from campaign
284
288
  />
285
289
  ) :
286
- (!isFullMode && (fbAdManager !== CREATIVE && messageStrategy === "DEFAULT" || (templateData?.edit && templateData?.fbContentType !==CREATIVE)) ) ?
287
- (<div className={className}>
290
+ (!isFullMode && ((fbAdManager !== CREATIVE && messageStrategy === "DEFAULT")
291
+ || (templateData?.edit && templateData?.fbContentType !==CREATIVE && fbAdManager !== CREATIVE )) ) ?
292
+
293
+ // not fullmode +
294
+ // default strtaegy and not selected "capillary ad manager" from campaign message +
295
+ //edit template && not coming from campaign message where user selected "capillary ad manager" (means edit "fb ad manager" from campaign) &&
296
+ // & also we are not selecting capillary ad manager from campaign
297
+
298
+ (<div className={className}>
288
299
 
289
300
  <div className="is-scrollable-section" >
290
301
  <div className="account-details-wrapper">
@@ -158,7 +158,11 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
158
158
  );
159
159
 
160
160
  getFacebookComponent = () => {
161
- const { messageDetails, cap, onFacebookSubmit, messageStrategy, showDisabledFBInfo, orgUnitId } = this.props;
161
+ const { messageDetails, cap, onFacebookSubmit,
162
+ messageStrategy,
163
+ showDisabledFBInfo,
164
+ orgUnitId,
165
+ onSelectTemplate } = this.props;
162
166
  return (
163
167
  <Facebook
164
168
  {...this.props}
@@ -168,6 +172,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
168
172
  messageStrategy={messageStrategy}
169
173
  showDisabledFBInfo={showDisabledFBInfo}
170
174
  orgUnitId={orgUnitId}
175
+ onSelectTemplate={onSelectTemplate}
171
176
  />
172
177
  );
173
178
  }