@capillarytech/creatives-library 8.0.68 → 8.0.69-alpha.0

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": "8.0.68",
4
+ "version": "8.0.69-alpha.0",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import Bugsnag from "@bugsnag/js";
3
4
  import {
4
5
  CapSlideBox,
5
6
  CapHeader,
@@ -139,21 +140,13 @@ export class Creatives extends React.Component {
139
140
  templateData.updatedByName = commonUtil.getUserNameById(userId, usersList);
140
141
  this.setState({ slidBoxContent: constants.PREVIEW, templateData });
141
142
  } else {
142
- const {
143
- name = "",
144
- sourceAccountIdentifier = "",
145
- configs: { token = "" } = {},
146
- } = get(this.props, "Templates.selectedZaloAccount", {});
147
- const { hostName = '' } = get(this.props, "Templates.senderDetails", {});
148
- this.props.zaloActions.getTemplateInfoById({
149
- username: name,
150
- oa_id: sourceAccountIdentifier,
151
- token,
152
- host: hostName,
153
- id: template?._id,
154
- preview: true,
155
- actionCallback: this.actionCallback,
156
- });
143
+ if (get(template, 'versions.base.content.zalo.previewUrl')) {
144
+ commonUtil.handlePreviewInNewTab(
145
+ template.versions.base.content.zalo.previewUrl
146
+ );
147
+ } else {
148
+ Bugsnag.leaveBreadcrumb("Zalo preview url not found");
149
+ }
157
150
  }
158
151
  };
159
152
 
@@ -12,6 +12,7 @@ import styled from 'styled-components';
12
12
  import {injectIntl, intlShape, FormattedMessage } from 'react-intl';
13
13
  import { createStructuredSelector } from 'reselect';
14
14
  import moment from "moment";
15
+ import Bugsnag from "@bugsnag/js";
15
16
  import get from 'lodash/get';
16
17
  import isEmpty from 'lodash/isEmpty';
17
18
  import isEqual from 'lodash/isEqual';
@@ -533,8 +534,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
533
534
  params.accountId = Number(query.account_id);
534
535
  this.getAllTemplates({params});
535
536
  }
536
- }
537
-
537
+ }
538
+
538
539
 
539
540
  if (selectedChannel === "ebill" && nextProps.CreateEbill && nextProps.CreateEbill.createResponse && nextProps.CreateEbill.createResponse.templateId && nextProps.CreateEbill.createResponse.templateId !== '') {
540
541
  const message = `${this.state.channel} ${this.props.intl.formatMessage(messages.templateDuplicateSuccess)}`;
@@ -920,7 +921,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
920
921
  }
921
922
  if (
922
923
  this.state.channel.toLowerCase() === ZALO_LOWERCASE &&
923
- !isEmpty(this.props.Templates?.selectedZaloAccount) &&
924
+ !isEmpty(this.props.Templates?.selectedZaloAccount) &&
924
925
  !params?.isAccountSelection && !isEmpty(this.props.Templates?.selectedZaloAccount?.hostName)
925
926
  ) {
926
927
  const {
@@ -982,7 +983,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
982
983
  default:
983
984
  return selectedWhatsappCategory === category;
984
985
  }
985
- }
986
+ }
986
987
  return true;
987
988
  }
988
989
  filterWhatsappTemplates = (templates) => {
@@ -1220,7 +1221,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1220
1221
  break;
1221
1222
  }
1222
1223
  case MOBILE_PUSH:
1223
- case INAPP:
1224
+ case INAPP:
1224
1225
  templateData.content = template;
1225
1226
  break;
1226
1227
  case WECHAT:
@@ -2189,21 +2190,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2189
2190
  this.setState({ previewTemplate: templateInfo });
2190
2191
  }
2191
2192
  } else {
2192
- const {
2193
- name = "",
2194
- sourceAccountIdentifier = "",
2195
- configs: { token = "" } = {},
2196
- hostName = "",
2197
- } = get(this.props, "Templates.selectedZaloAccount", {});
2198
- this.props.zaloActions.getTemplateInfoById({
2199
- username: name,
2200
- oa_id: sourceAccountIdentifier,
2201
- token: token,
2202
- host: hostName || this.state.hostName || this.props.Templates?.senderDetails?.hostName,
2203
- id: template?._id,
2204
- preview: true,
2205
- actionCallback: this.actionCallback,
2206
- });
2193
+ if (get(template, "versions.base.content.zalo.previewUrl", "")) {
2194
+ handlePreviewInNewTab(template.versions.base.content.zalo.previewUrl);
2195
+ } else {
2196
+ Bugsnag.leaveBreadcrumb("Zalo preview url not found");
2197
+ }
2207
2198
  }
2208
2199
  }
2209
2200