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

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-alpha.0",
4
+ "version": "8.0.68-alpha.3",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Created by vivek on 22/5/17.
3
3
  */
4
- import { fromJS, Map as ImmutableMap } from 'immutable';
4
+ import { fromJS } from 'immutable';
5
5
  import _ from 'lodash';
6
6
  import * as types from './constants';
7
7
  import initialState from '../../initialState';
@@ -113,19 +113,12 @@ function capReducer(state = fromJS(initialState.cap), action) {
113
113
  // Process extended tags
114
114
  const extendedSubtags = getTagMapValue(action?.data?.metaEntities?.extended);
115
115
 
116
- const getExistingTagLookupMap = (state) => {
117
- const tagLookupMap = state.getIn(['metaEntities', 'tagLookupMap']);
118
- return state.get('metaEntities') && ImmutableMap.isMap(tagLookupMap)
119
- ? tagLookupMap.toJS()
120
- : {};
121
- };
122
-
123
116
  // Combine all maps
124
117
  const combinedTagMap = {
125
118
  ...standardTagMap,
126
119
  ...customSubtags,
127
120
  ...extendedSubtags,
128
- ...getExistingTagLookupMap(state),
121
+ ...state.getIn(['metaEntities', 'tagLookupMap'])?.toJS(),
129
122
  };
130
123
  const stateMeta = state.get("metaEntities");
131
124
  return state
@@ -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 (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,13 @@ 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 (template?.versions?.base?.content?.zalo?.previewUrl) {
2194
+ handlePreviewInNewTab(
2195
+ template.versions.base.content.zalo.previewUrl
2196
+ );
2197
+ } else {
2198
+ Bugsnag.leaveBreadcrumb("Zalo preview url not found");
2199
+ }
2207
2200
  }
2208
2201
  }
2209
2202