@whereby.com/core 1.6.13 → 1.6.15

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/dist/index.cjs CHANGED
@@ -1158,7 +1158,7 @@ const createReactor = (selectors, callback) => {
1158
1158
  });
1159
1159
  };
1160
1160
 
1161
- const coreVersion = "1.6.13";
1161
+ const coreVersion = "1.6.15";
1162
1162
 
1163
1163
  const initialState$1 = {
1164
1164
  displayName: null,
@@ -1896,11 +1896,16 @@ const doStartLocalMedia = createAppAsyncThunk("localMedia/doStartLocalMedia", (p
1896
1896
  }
1897
1897
  }));
1898
1898
  const doStopLocalMedia = createAppThunk(() => (dispatch, getState) => {
1899
- const stream = selectLocalMediaStream(getState());
1900
- const onDeviceChange = selectLocalMediaRaw(getState()).onDeviceChange;
1899
+ const state = getState();
1900
+ const stream = selectLocalMediaStream(state);
1901
+ const onDeviceChange = selectLocalMediaRaw(state).onDeviceChange;
1902
+ const beforeEffectTracks = selectLocalMediaBeforeEffectTracks(state);
1901
1903
  stream === null || stream === void 0 ? void 0 : stream.getTracks().forEach((track) => {
1902
1904
  track.stop();
1903
1905
  });
1906
+ if (beforeEffectTracks) {
1907
+ Object.values(beforeEffectTracks).forEach((t) => t === null || t === void 0 ? void 0 : t.stop());
1908
+ }
1904
1909
  if (navigator.mediaDevices && onDeviceChange) {
1905
1910
  navigator.mediaDevices.removeEventListener("devicechange", onDeviceChange);
1906
1911
  }
@@ -4234,9 +4239,17 @@ const doCameraEffectsSwitchPreset = createAppAsyncThunk("cameraEffects/switchPre
4234
4239
  return rejectWithValue(error);
4235
4240
  }
4236
4241
  }));
4237
- createAppAsyncThunk("cameraEffects/clear", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch }) {
4242
+ const doCameraEffectsClear = createAppAsyncThunk("cameraEffects/clear", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch }) {
4238
4243
  yield dispatch(doCameraEffectsSwitchPreset({ effectId: null }));
4239
4244
  }));
4245
+ const selectCameraEffectsShouldStop = toolkit.createSelector(selectAppIsActive, selectCameraEffectsRaw, (appIsActive, raw) => {
4246
+ return !appIsActive && !!raw.stop;
4247
+ });
4248
+ createReactor([selectCameraEffectsShouldStop], ({ dispatch }, shouldStop) => {
4249
+ if (shouldStop) {
4250
+ dispatch(doCameraEffectsClear());
4251
+ }
4252
+ });
4240
4253
 
4241
4254
  const IS_DEV = undefined === "true";
4242
4255
  const appReducer = toolkit.combineReducers({
package/dist/index.mjs CHANGED
@@ -1156,7 +1156,7 @@ const createReactor = (selectors, callback) => {
1156
1156
  });
1157
1157
  };
1158
1158
 
1159
- const coreVersion = "1.6.13";
1159
+ const coreVersion = "1.6.15";
1160
1160
 
1161
1161
  const initialState$1 = {
1162
1162
  displayName: null,
@@ -1894,11 +1894,16 @@ const doStartLocalMedia = createAppAsyncThunk("localMedia/doStartLocalMedia", (p
1894
1894
  }
1895
1895
  }));
1896
1896
  const doStopLocalMedia = createAppThunk(() => (dispatch, getState) => {
1897
- const stream = selectLocalMediaStream(getState());
1898
- const onDeviceChange = selectLocalMediaRaw(getState()).onDeviceChange;
1897
+ const state = getState();
1898
+ const stream = selectLocalMediaStream(state);
1899
+ const onDeviceChange = selectLocalMediaRaw(state).onDeviceChange;
1900
+ const beforeEffectTracks = selectLocalMediaBeforeEffectTracks(state);
1899
1901
  stream === null || stream === void 0 ? void 0 : stream.getTracks().forEach((track) => {
1900
1902
  track.stop();
1901
1903
  });
1904
+ if (beforeEffectTracks) {
1905
+ Object.values(beforeEffectTracks).forEach((t) => t === null || t === void 0 ? void 0 : t.stop());
1906
+ }
1902
1907
  if (navigator.mediaDevices && onDeviceChange) {
1903
1908
  navigator.mediaDevices.removeEventListener("devicechange", onDeviceChange);
1904
1909
  }
@@ -4232,9 +4237,17 @@ const doCameraEffectsSwitchPreset = createAppAsyncThunk("cameraEffects/switchPre
4232
4237
  return rejectWithValue(error);
4233
4238
  }
4234
4239
  }));
4235
- createAppAsyncThunk("cameraEffects/clear", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch }) {
4240
+ const doCameraEffectsClear = createAppAsyncThunk("cameraEffects/clear", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch }) {
4236
4241
  yield dispatch(doCameraEffectsSwitchPreset({ effectId: null }));
4237
4242
  }));
4243
+ const selectCameraEffectsShouldStop = createSelector(selectAppIsActive, selectCameraEffectsRaw, (appIsActive, raw) => {
4244
+ return !appIsActive && !!raw.stop;
4245
+ });
4246
+ createReactor([selectCameraEffectsShouldStop], ({ dispatch }, shouldStop) => {
4247
+ if (shouldStop) {
4248
+ dispatch(doCameraEffectsClear());
4249
+ }
4250
+ });
4238
4251
 
4239
4252
  const IS_DEV = undefined === "true";
4240
4253
  const appReducer = combineReducers({
@@ -1156,7 +1156,7 @@ const createReactor = (selectors, callback) => {
1156
1156
  });
1157
1157
  };
1158
1158
 
1159
- const coreVersion = "1.6.13";
1159
+ const coreVersion = "1.6.15";
1160
1160
 
1161
1161
  const initialState$1 = {
1162
1162
  displayName: null,
@@ -1894,11 +1894,16 @@ const doStartLocalMedia = createAppAsyncThunk("localMedia/doStartLocalMedia", (p
1894
1894
  }
1895
1895
  }));
1896
1896
  const doStopLocalMedia = createAppThunk(() => (dispatch, getState) => {
1897
- const stream = selectLocalMediaStream(getState());
1898
- const onDeviceChange = selectLocalMediaRaw(getState()).onDeviceChange;
1897
+ const state = getState();
1898
+ const stream = selectLocalMediaStream(state);
1899
+ const onDeviceChange = selectLocalMediaRaw(state).onDeviceChange;
1900
+ const beforeEffectTracks = selectLocalMediaBeforeEffectTracks(state);
1899
1901
  stream === null || stream === void 0 ? void 0 : stream.getTracks().forEach((track) => {
1900
1902
  track.stop();
1901
1903
  });
1904
+ if (beforeEffectTracks) {
1905
+ Object.values(beforeEffectTracks).forEach((t) => t === null || t === void 0 ? void 0 : t.stop());
1906
+ }
1902
1907
  if (navigator.mediaDevices && onDeviceChange) {
1903
1908
  navigator.mediaDevices.removeEventListener("devicechange", onDeviceChange);
1904
1909
  }
@@ -4232,9 +4237,17 @@ const doCameraEffectsSwitchPreset = createAppAsyncThunk("cameraEffects/switchPre
4232
4237
  return rejectWithValue(error);
4233
4238
  }
4234
4239
  }));
4235
- createAppAsyncThunk("cameraEffects/clear", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch }) {
4240
+ const doCameraEffectsClear = createAppAsyncThunk("cameraEffects/clear", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch }) {
4236
4241
  yield dispatch(doCameraEffectsSwitchPreset({ effectId: null }));
4237
4242
  }));
4243
+ const selectCameraEffectsShouldStop = createSelector(selectAppIsActive, selectCameraEffectsRaw, (appIsActive, raw) => {
4244
+ return !appIsActive && !!raw.stop;
4245
+ });
4246
+ createReactor([selectCameraEffectsShouldStop], ({ dispatch }, shouldStop) => {
4247
+ if (shouldStop) {
4248
+ dispatch(doCameraEffectsClear());
4249
+ }
4250
+ });
4238
4251
 
4239
4252
  const IS_DEV = undefined === "true";
4240
4253
  const appReducer = combineReducers({
@@ -75,7 +75,7 @@ const createReactor = (selectors, callback) => {
75
75
  });
76
76
  };
77
77
 
78
- const coreVersion = "1.6.13";
78
+ const coreVersion = "1.6.15";
79
79
 
80
80
  const initialState$1 = {
81
81
  displayName: null,
@@ -787,11 +787,16 @@ const doStartLocalMedia = createAppAsyncThunk("localMedia/doStartLocalMedia", (p
787
787
  }
788
788
  }));
789
789
  const doStopLocalMedia = createAppThunk(() => (dispatch, getState) => {
790
- const stream = selectLocalMediaStream(getState());
791
- const onDeviceChange = selectLocalMediaRaw(getState()).onDeviceChange;
790
+ const state = getState();
791
+ const stream = selectLocalMediaStream(state);
792
+ const onDeviceChange = selectLocalMediaRaw(state).onDeviceChange;
793
+ const beforeEffectTracks = selectLocalMediaBeforeEffectTracks(state);
792
794
  stream === null || stream === void 0 ? void 0 : stream.getTracks().forEach((track) => {
793
795
  track.stop();
794
796
  });
797
+ if (beforeEffectTracks) {
798
+ Object.values(beforeEffectTracks).forEach((t) => t === null || t === void 0 ? void 0 : t.stop());
799
+ }
795
800
  if (navigator.mediaDevices && onDeviceChange) {
796
801
  navigator.mediaDevices.removeEventListener("devicechange", onDeviceChange);
797
802
  }
@@ -3150,9 +3155,17 @@ const doCameraEffectsSwitchPreset = createAppAsyncThunk("cameraEffects/switchPre
3150
3155
  return rejectWithValue(error);
3151
3156
  }
3152
3157
  }));
3153
- createAppAsyncThunk("cameraEffects/clear", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch }) {
3158
+ const doCameraEffectsClear = createAppAsyncThunk("cameraEffects/clear", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch }) {
3154
3159
  yield dispatch(doCameraEffectsSwitchPreset({ effectId: null }));
3155
3160
  }));
3161
+ const selectCameraEffectsShouldStop = toolkit.createSelector(selectAppIsActive, selectCameraEffectsRaw, (appIsActive, raw) => {
3162
+ return !appIsActive && !!raw.stop;
3163
+ });
3164
+ createReactor([selectCameraEffectsShouldStop], ({ dispatch }, shouldStop) => {
3165
+ if (shouldStop) {
3166
+ dispatch(doCameraEffectsClear());
3167
+ }
3168
+ });
3156
3169
 
3157
3170
  const IS_DEV = undefined === "true";
3158
3171
  const appReducer = toolkit.combineReducers({
@@ -73,7 +73,7 @@ const createReactor = (selectors, callback) => {
73
73
  });
74
74
  };
75
75
 
76
- const coreVersion = "1.6.13";
76
+ const coreVersion = "1.6.15";
77
77
 
78
78
  const initialState$1 = {
79
79
  displayName: null,
@@ -785,11 +785,16 @@ const doStartLocalMedia = createAppAsyncThunk("localMedia/doStartLocalMedia", (p
785
785
  }
786
786
  }));
787
787
  const doStopLocalMedia = createAppThunk(() => (dispatch, getState) => {
788
- const stream = selectLocalMediaStream(getState());
789
- const onDeviceChange = selectLocalMediaRaw(getState()).onDeviceChange;
788
+ const state = getState();
789
+ const stream = selectLocalMediaStream(state);
790
+ const onDeviceChange = selectLocalMediaRaw(state).onDeviceChange;
791
+ const beforeEffectTracks = selectLocalMediaBeforeEffectTracks(state);
790
792
  stream === null || stream === void 0 ? void 0 : stream.getTracks().forEach((track) => {
791
793
  track.stop();
792
794
  });
795
+ if (beforeEffectTracks) {
796
+ Object.values(beforeEffectTracks).forEach((t) => t === null || t === void 0 ? void 0 : t.stop());
797
+ }
793
798
  if (navigator.mediaDevices && onDeviceChange) {
794
799
  navigator.mediaDevices.removeEventListener("devicechange", onDeviceChange);
795
800
  }
@@ -3148,9 +3153,17 @@ const doCameraEffectsSwitchPreset = createAppAsyncThunk("cameraEffects/switchPre
3148
3153
  return rejectWithValue(error);
3149
3154
  }
3150
3155
  }));
3151
- createAppAsyncThunk("cameraEffects/clear", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch }) {
3156
+ const doCameraEffectsClear = createAppAsyncThunk("cameraEffects/clear", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch }) {
3152
3157
  yield dispatch(doCameraEffectsSwitchPreset({ effectId: null }));
3153
3158
  }));
3159
+ const selectCameraEffectsShouldStop = createSelector(selectAppIsActive, selectCameraEffectsRaw, (appIsActive, raw) => {
3160
+ return !appIsActive && !!raw.stop;
3161
+ });
3162
+ createReactor([selectCameraEffectsShouldStop], ({ dispatch }, shouldStop) => {
3163
+ if (shouldStop) {
3164
+ dispatch(doCameraEffectsClear());
3165
+ }
3166
+ });
3154
3167
 
3155
3168
  const IS_DEV = undefined === "true";
3156
3169
  const appReducer = combineReducers({
@@ -73,7 +73,7 @@ const createReactor = (selectors, callback) => {
73
73
  });
74
74
  };
75
75
 
76
- const coreVersion = "1.6.13";
76
+ const coreVersion = "1.6.15";
77
77
 
78
78
  const initialState$1 = {
79
79
  displayName: null,
@@ -785,11 +785,16 @@ const doStartLocalMedia = createAppAsyncThunk("localMedia/doStartLocalMedia", (p
785
785
  }
786
786
  }));
787
787
  const doStopLocalMedia = createAppThunk(() => (dispatch, getState) => {
788
- const stream = selectLocalMediaStream(getState());
789
- const onDeviceChange = selectLocalMediaRaw(getState()).onDeviceChange;
788
+ const state = getState();
789
+ const stream = selectLocalMediaStream(state);
790
+ const onDeviceChange = selectLocalMediaRaw(state).onDeviceChange;
791
+ const beforeEffectTracks = selectLocalMediaBeforeEffectTracks(state);
790
792
  stream === null || stream === void 0 ? void 0 : stream.getTracks().forEach((track) => {
791
793
  track.stop();
792
794
  });
795
+ if (beforeEffectTracks) {
796
+ Object.values(beforeEffectTracks).forEach((t) => t === null || t === void 0 ? void 0 : t.stop());
797
+ }
793
798
  if (navigator.mediaDevices && onDeviceChange) {
794
799
  navigator.mediaDevices.removeEventListener("devicechange", onDeviceChange);
795
800
  }
@@ -3148,9 +3153,17 @@ const doCameraEffectsSwitchPreset = createAppAsyncThunk("cameraEffects/switchPre
3148
3153
  return rejectWithValue(error);
3149
3154
  }
3150
3155
  }));
3151
- createAppAsyncThunk("cameraEffects/clear", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch }) {
3156
+ const doCameraEffectsClear = createAppAsyncThunk("cameraEffects/clear", (_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { dispatch }) {
3152
3157
  yield dispatch(doCameraEffectsSwitchPreset({ effectId: null }));
3153
3158
  }));
3159
+ const selectCameraEffectsShouldStop = createSelector(selectAppIsActive, selectCameraEffectsRaw, (appIsActive, raw) => {
3160
+ return !appIsActive && !!raw.stop;
3161
+ });
3162
+ createReactor([selectCameraEffectsShouldStop], ({ dispatch }, shouldStop) => {
3163
+ if (shouldStop) {
3164
+ dispatch(doCameraEffectsClear());
3165
+ }
3166
+ });
3154
3167
 
3155
3168
  const IS_DEV = undefined === "true";
3156
3169
  const appReducer = combineReducers({
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@whereby.com/core",
3
3
  "description": "Core library for whereby.com sdk",
4
4
  "author": "Whereby AS",
5
- "version": "1.6.13",
5
+ "version": "1.6.15",
6
6
  "license": "MIT",
7
7
  "publishConfig": {
8
8
  "access": "public"
@@ -59,14 +59,14 @@
59
59
  "prettier": "^3.5.3",
60
60
  "typescript": "^5.8.3",
61
61
  "@whereby.com/eslint-config": "0.1.0",
62
- "@whereby.com/jest-config": "0.1.0",
63
62
  "@whereby.com/prettier-config": "0.1.0",
63
+ "@whereby.com/jest-config": "0.1.0",
64
64
  "@whereby.com/rollup-config": "0.1.1",
65
65
  "@whereby.com/tsconfig": "0.1.0"
66
66
  },
67
67
  "dependencies": {
68
68
  "@reduxjs/toolkit": "^2.2.3",
69
- "@whereby.com/media": "3.0.0",
69
+ "@whereby.com/media": "3.1.0",
70
70
  "axios": "^1.11.0",
71
71
  "btoa": "^1.2.1",
72
72
  "events": "^3.3.0"