@capillarytech/creatives-library 9.0.61-alpha.3 → 9.0.61

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.3",
4
+ "version": "9.0.61",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -19,9 +19,6 @@ 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
-
25
22
  export const UPLOAD_VIBER_ASSET_REQUEST = 'app/v2Containers/Viber/UPLOAD_ASSET_REQUEST';
26
23
  export const UPLOAD_VIBER_ASSET_SUCCESS = 'app/v2Containers/Viber/UPLOAD_ASSET_SUCCESS';
27
24
  export const UPLOAD_VIBER_ASSET_FAILURE = 'app/v2Containers/Viber/UPLOAD_ASSET_FAILURE';
@@ -6,7 +6,6 @@ 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';
10
9
  import messages from './messages';
11
10
 
12
11
  export function* uploadViberAsset(params) {
@@ -149,6 +148,9 @@ export default [
149
148
  watchEditTemplate,
150
149
  ];
151
150
 
151
+ // Cap + Viber each inject v2ViberSagas; module counter lets only the first task start takeLatest watchers (avoids duplicate API calls).
152
+ let viberSagasActive = 0;
153
+
152
154
  export function* v2ViberSagas() {
153
155
  if (viberSagasActive > 0) {
154
156
  return;
@@ -555,5 +555,26 @@ describe('Viber Sagas', () => {
555
555
 
556
556
  describe('v2ViberSagas Combined', () => {
557
557
  it('should initialize all Viber-related watcher sagas without error', () => expectSaga(sagas.v2ViberSagas).run());
558
+
559
+ // Double inject (Cap + Viber): only the first task registers watchers.
560
+ it('does not start the watchers again while another task already holds them', () => {
561
+ const first = sagas.v2ViberSagas();
562
+ expect(first.next().done).toBe(false);
563
+
564
+ const second = sagas.v2ViberSagas();
565
+ expect(second.next()).toEqual({ value: undefined, done: true });
566
+
567
+ first.return();
568
+ });
569
+
570
+ it('releases the guard when the running task is cancelled, so a remount re-arms', () => {
571
+ const first = sagas.v2ViberSagas();
572
+ expect(first.next().done).toBe(false);
573
+ first.return();
574
+
575
+ const afterCancel = sagas.v2ViberSagas();
576
+ expect(afterCancel.next().done).toBe(false);
577
+ afterCancel.return();
578
+ });
558
579
  });
559
580
  });