@capillarytech/creatives-library 7.17.103 → 7.17.104

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.17.103",
4
+ "version": "7.17.104",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -138,6 +138,11 @@ const CapDeviceContent = (props) => {
138
138
  setCtaData(INITIAL_CTA_DATA);
139
139
  };
140
140
 
141
+ const onActionLinkCheckBoxChange = () => {
142
+ setAddActionLink(!addActionLink);
143
+ setDeepLinkValue('');
144
+ };
145
+
141
146
  const uploadInAppAsset = (file, type, fileParams) => {
142
147
  actions.uploadInAppAsset(file, type, fileParams, 0);
143
148
  };
@@ -251,7 +256,7 @@ const CapDeviceContent = (props) => {
251
256
  </CapRow>
252
257
  </CapRow>
253
258
  <CapRow className="inapp-action-link">
254
- <CapCheckbox onChange={() => setAddActionLink(!addActionLink)} checked={addActionLink} />
259
+ <CapCheckbox onChange={onActionLinkCheckBoxChange} checked={addActionLink} />
255
260
  <CapRow className="inapp-render-heading">
256
261
  <CapHeader
257
262
  title={<CapRow type="flex">
@@ -89,7 +89,7 @@ export const InApp = (props) => {
89
89
  const [accountId, setAccountId] = useState("");
90
90
  const [accessToken, setAccessToken] = useState("");
91
91
  const [accountName, setAccountName] = useState("");
92
- const [deepLink, setDeepLink] = useState("");
92
+ const [deepLink, setDeepLink] = useState([]);
93
93
  const [spin, setSpin] = useState(false);
94
94
  const [inAppImageSrcAndroid, setInAppImageSrcAndroid] = useState("");
95
95
  const [inAppImageSrcIos, setInAppImageSrcIos] = useState("");
@@ -113,7 +113,7 @@ export const InApp = (props) => {
113
113
  //gets account details
114
114
  useEffect(() => {
115
115
  const accountObj = accountData?.selectedWeChatAccount || {};
116
- const deepLinkObj = accountData?.weCrmAccounts[0]?.configs?.deeplink || {};
116
+ const deepLinkObj = accountObj?.configs?.deeplink || '';
117
117
  if (!isEmpty(accountObj)) {
118
118
  const {
119
119
  sourceAccountIdentifier = "",
@@ -123,12 +123,12 @@ export const InApp = (props) => {
123
123
  const isAndroidSupported = configs?.android === DEVICE_SUPPORTED;
124
124
  // DEVICE_SUPPORTED is '1', which indicates if the particular account is supported, and '0' if the devive is not supported
125
125
  //get deep link keys in an array
126
- const deepLinkKeys = Object.values(JSON.parse(deepLinkObj));
127
- const keys = deepLinkKeys.map((link) => ({label: link.name, value: link.link, title: link.link }));
126
+ const deepLinkKeys = Object.values(JSON.parse(deepLinkObj || '{}'));
127
+ const keys = deepLinkKeys?.map((link) => ({label: link.name, value: link.link, title: link.link }));
128
128
  setPanes(isAndroidSupported ? ANDROID : IOS);
129
129
  setDeepLink(keys);
130
130
  setAccountId(sourceAccountIdentifier);
131
- setAccessToken(configs.accessToken || "");
131
+ setAccessToken(configs?.accessToken || "");
132
132
  setAccountName(name);
133
133
  }
134
134
  }, [accountData?.selectedWeChatAccount, accountData?.weCrmAccounts[0]] );
@@ -183,7 +183,7 @@ export const InApp = (props) => {
183
183
  : INAPP_MEDIA_TYPES.IMAGE
184
184
  );
185
185
  setInAppImageSrcAndroid(androidImage);
186
- setDeepLinkValueAndroid(androidCta[0]?.actionLink);
186
+ setDeepLinkValueAndroid(androidCta[0]?.actionLink || '');
187
187
  setAddActionLinkAndroid(!isEmpty(androidCta) && true);
188
188
  setButtonTypeAndroid(
189
189
  androidCtaLength ? INAPP_BUTTON_TYPES.CTA : INAPP_BUTTON_TYPES.NONE
@@ -212,7 +212,7 @@ export const InApp = (props) => {
212
212
  setInAppImageSrcIos(iosImage);
213
213
  setButtonTypeIos(iosCtaLength ? INAPP_BUTTON_TYPES.CTA : INAPP_BUTTON_TYPES.NONE);
214
214
  setAddActionLinkIos(!isEmpty(iosCta) && true);
215
- setDeepLinkValueIos(iosCta[0]?.actionLink);
215
+ setDeepLinkValueIos(iosCta[0]?.actionLink || '');
216
216
  if (iosCtaLength > 0) {
217
217
  setCtaDataIos(getCtaObject(iosCtas));
218
218
  }
@@ -536,6 +536,15 @@ export const InApp = (props) => {
536
536
  //if button type is cta and there are no buttons saved
537
537
  return true;
538
538
  }
539
+
540
+ // action link
541
+ if (addActionLinkAndroid && !deepLinkValueAndroid) {
542
+ return true;
543
+ }
544
+ if (addActionLinkIos && !deepLinkValueIos) {
545
+ return true;
546
+ }
547
+
539
548
  return false;
540
549
  };
541
550