@capillarytech/creatives-library 9.0.61-alpha.1 → 9.0.61-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": "9.0.61-alpha.1",
4
+ "version": "9.0.61-alpha.3",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -19,6 +19,9 @@ export const EMPTY_INJECTED_TAGS = {};
19
19
  export const EMPTY_TAGS = [];
20
20
  export const EMPTY_TEMPLATE_DATA = {};
21
21
 
22
+ // Cap + Viber each inject v2ViberSagas; module counter lets only the first task start takeLatest watchers (avoids duplicate API calls).
23
+ export let viberSagasActive = 0;
24
+
22
25
  export const UPLOAD_VIBER_ASSET_REQUEST = 'app/v2Containers/Viber/UPLOAD_ASSET_REQUEST';
23
26
  export const UPLOAD_VIBER_ASSET_SUCCESS = 'app/v2Containers/Viber/UPLOAD_ASSET_SUCCESS';
24
27
  export const UPLOAD_VIBER_ASSET_FAILURE = 'app/v2Containers/Viber/UPLOAD_ASSET_FAILURE';
@@ -82,7 +82,9 @@ import CapVideoUpload from '../../v2Components/CapVideoUpload';
82
82
  import './index.scss';
83
83
  import { ViberFooter } from './style';
84
84
  import injectReducer from '../../utils/injectReducer';
85
+ import injectSaga from '../../utils/injectSaga';
85
86
  import v2ViberReducer from './reducer';
87
+ import { v2ViberSagas } from './sagas';
86
88
 
87
89
 
88
90
  const { TextArea } = CapInput;
@@ -1610,6 +1612,7 @@ const mapDispatchToProps = (dispatch) => ({
1610
1612
  });
1611
1613
 
1612
1614
  const withReducer = injectReducer({ key: 'viber', reducer: v2ViberReducer });
1615
+ const withViberSaga = injectSaga({ key: 'viber', saga: v2ViberSagas });
1613
1616
 
1614
1617
  export default withCreatives({
1615
1618
  WrappedComponent: injectIntl(Viber),
@@ -1617,4 +1620,5 @@ export default withCreatives({
1617
1620
  mapDispatchToProps,
1618
1621
  userAuth: true,
1619
1622
  reducers: [withReducer],
1623
+ sagas: [withViberSaga],
1620
1624
  });
@@ -6,6 +6,7 @@ import { pollAssetStatus } from '../../sagas/assetPolling';
6
6
  import { createPollingConfig } from '../../utils/asyncAssetUpload';
7
7
  import { ASSET_STATUS } from '../../utils/assetStatusConstants';
8
8
  import * as types from './constants';
9
+ import { viberSagasActive } from './constants';
9
10
  import messages from './messages';
10
11
 
11
12
  export function* uploadViberAsset(params) {
@@ -149,10 +150,18 @@ export default [
149
150
  ];
150
151
 
151
152
  export function* v2ViberSagas() {
152
- yield all([
153
- watchUploadViberAsset(),
154
- watchCreateTemplate(),
155
- watchGetTemplateDetails(),
156
- watchEditTemplate(),
157
- ]);
153
+ if (viberSagasActive > 0) {
154
+ return;
155
+ }
156
+ viberSagasActive += 1;
157
+ try {
158
+ yield all([
159
+ watchUploadViberAsset(),
160
+ watchCreateTemplate(),
161
+ watchGetTemplateDetails(),
162
+ watchEditTemplate(),
163
+ ]);
164
+ } finally {
165
+ viberSagasActive -= 1;
166
+ }
158
167
  }