@applicaster/zapp-react-native-utils 12.0.0-alpha.8242130253 → 12.0.0-alpha.8310462382

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.
Files changed (35) hide show
  1. package/analyticsUtils/AnalyticsEvents/index.ts +6 -0
  2. package/analyticsUtils/AnalyticsEvents/searchEvents.ts +21 -0
  3. package/analyticsUtils/events.ts +6 -0
  4. package/analyticsUtils/index.tsx +6 -0
  5. package/appUtils/playerManager/DelayedSeekPlayerWrapper.tsx +209 -0
  6. package/appUtils/playerManager/player.ts +8 -1
  7. package/appUtils/playerManager/playerNative.ts +5 -0
  8. package/appUtils/playerManager/usePlayerControllerSetup.tsx +16 -2
  9. package/cellUtils/__tests__/cellUtils.test.ts +9 -20
  10. package/cellUtils/index.ts +6 -12
  11. package/dateUtils/index.ts +11 -0
  12. package/headersUtils/index.ts +1 -0
  13. package/inflatedUrlUtils/index.ts +4 -4
  14. package/manifestUtils/defaultManifestConfigurations/generalContent.js +6 -0
  15. package/numberUtils/index.ts +4 -0
  16. package/package.json +2 -2
  17. package/reactHooks/autoscrolling/__tests__/{useTrackedView.test.ts → useTrackedView.test.tsx} +16 -1
  18. package/reactHooks/feed/__tests__/useInflatedUrl.test.ts +18 -3
  19. package/reactHooks/feed/useInflatedUrl.ts +44 -15
  20. package/reactHooks/layout/__tests__/{index.test.js → index.test.tsx} +43 -29
  21. package/reactHooks/layout/getDeviceInfo/index.ts +4 -2
  22. package/reactHooks/layout/types/index.ts +1 -0
  23. package/reactHooks/layout/useDimensions/useDimensions.ts +5 -2
  24. package/reactHooks/navigation/__mocks__/index.ts +13 -0
  25. package/reactHooks/navigation/__mocks__/useNavigation.ts +3 -0
  26. package/reactHooks/navigation/index.ts +5 -0
  27. package/reactHooks/player/useAutoSeek.tsx +15 -1
  28. package/reactHooks/player/useSeek.tsx +8 -0
  29. package/reactHooks/player/useTapSeek.tsx +6 -0
  30. package/reactHooks/screen/useScreenContext.ts +1 -1
  31. package/screenState/index.ts +0 -8
  32. package/stringUtils/index.ts +5 -0
  33. package/testUtils/getByTestId.ts +14 -0
  34. package/testUtils/index.tsx +24 -22
  35. package/types.ts +4 -0
@@ -7,6 +7,10 @@ import { sendHeaderClickEvent } from "./sendHeaderClickEvent";
7
7
  import { sendHardwareBackButtonClickEvent } from "./sendHardwareBackButtonClickEvent";
8
8
  import { sendDownloadsEvent } from "./sendDownloadsEvent";
9
9
  import { sendScreenEvent } from "./sendScreenEvent";
10
+ import {
11
+ sendSearchCanceledEvent,
12
+ sendSearchExecutedEvent,
13
+ } from "./searchEvents";
10
14
 
11
15
  export {
12
16
  sendScreenEvent,
@@ -18,4 +22,6 @@ export {
18
22
  sendHeaderClickEvent,
19
23
  sendHardwareBackButtonClickEvent,
20
24
  sendDownloadsEvent,
25
+ sendSearchCanceledEvent,
26
+ sendSearchExecutedEvent,
21
27
  };
@@ -0,0 +1,21 @@
1
+ import { log_debug } from "../logger";
2
+ import { postAnalyticEvent } from "../manager";
3
+ import { ANALYTICS_CORE_EVENTS } from "../events";
4
+
5
+ export const sendSearchCanceledEvent = (analyticsProps) => {
6
+ const eventName = ANALYTICS_CORE_EVENTS.SEARCH_CANCELED;
7
+ postAnalyticEvent(eventName, analyticsProps);
8
+
9
+ log_debug(`sendSearchCanceledEvent: send event: ${eventName}`, {
10
+ analyticsProps,
11
+ });
12
+ };
13
+
14
+ export const sendSearchExecutedEvent = (analyticsProps) => {
15
+ const eventName = ANALYTICS_CORE_EVENTS.SEARCH_EXECUTED;
16
+ postAnalyticEvent(eventName, analyticsProps);
17
+
18
+ log_debug(`sendSearchExecutedEvent: send event: ${eventName}`, {
19
+ analyticsProps,
20
+ });
21
+ };
@@ -23,10 +23,16 @@ export const TAPPING_EVENTS = {
23
23
  TAP_NAVBAR_BACK_BUTTON: "tap_navbar_back_button",
24
24
  };
25
25
 
26
+ export const SEARCH_EVENTS = {
27
+ SEARCH_EXECUTED: "search_executed",
28
+ SEARCH_CANCELED: "search_canceled",
29
+ };
30
+
26
31
  export const ANALYTICS_CORE_EVENTS = {
27
32
  ...LEGACY_EVENTS,
28
33
  ...SCREEN_VIEW_EVENTS,
29
34
  ...TAPPING_EVENTS,
35
+ ...SEARCH_EVENTS,
30
36
  };
31
37
 
32
38
  export const WEBVIEW_EVENTS = {
@@ -18,6 +18,8 @@ import {
18
18
  sendHardwareBackButtonClickEvent,
19
19
  sendDownloadsEvent,
20
20
  sendScreenEvent,
21
+ sendSearchCanceledEvent,
22
+ sendSearchExecutedEvent,
21
23
  } from "./AnalyticsEvents";
22
24
 
23
25
  import { postAnalyticEvent } from "./manager";
@@ -66,6 +68,8 @@ type AnalyticsFunctions = {
66
68
  item: ZappEntry;
67
69
  state: OfflineItemState;
68
70
  }) => void;
71
+ sendSearchCanceledEvent: (props: AnalyticsDefaultProperties) => void;
72
+ sendSearchExecutedEvent: (props: AnalyticsDefaultProperties) => void;
69
73
  };
70
74
 
71
75
  type GetAnalyticsFunctions = (
@@ -102,6 +106,8 @@ export function getAnalyticsFunctions({
102
106
  sendHardwareBackButtonClickEvent,
103
107
  sendScreenEvent,
104
108
  sendDownloadsEvent,
109
+ sendSearchCanceledEvent,
110
+ sendSearchExecutedEvent,
105
111
  };
106
112
  }
107
113
 
@@ -0,0 +1,209 @@
1
+ import { Player } from "./player";
2
+
3
+ export class DelayedSeekPlayerWrapper extends Player {
4
+ private wrappedPlayer: Player;
5
+ private delayedSeek: boolean;
6
+ private wasPlaying: boolean;
7
+ private delayedSeekTimer: NodeJS.Timeout;
8
+
9
+ constructor(props, player: Player) {
10
+ super(props);
11
+ // this.playerState = this.wrappedPlayer.playerState;
12
+ this.wrappedPlayer = player;
13
+
14
+ this.wrappedPlayer.addListener({
15
+ id: "Master-Wrapper-Listener",
16
+ listener: this,
17
+ });
18
+ }
19
+
20
+ getListener = (): QuickBrickPlayer.SharedPlayerCallBacks => {
21
+ return this.wrappedPlayer.getListener();
22
+ };
23
+
24
+ togglePlayPause = () => {
25
+ this.wrappedPlayer.togglePlayPause();
26
+ };
27
+
28
+ // Implement all default methods by delegating them to wrapped player
29
+ public seekTo = (position: number) => {
30
+ this.wrappedPlayer.seekTo(position);
31
+ };
32
+
33
+ public isPlaying = () => {
34
+ return this.wrappedPlayer.isPlaying();
35
+ };
36
+
37
+ public isPaused = () => {
38
+ return this.wrappedPlayer.isPaused();
39
+ };
40
+
41
+ public play = () => {
42
+ this.wrappedPlayer.play();
43
+ };
44
+
45
+ public pause = () => {
46
+ this.wrappedPlayer.pause();
47
+ };
48
+
49
+ getState = () => {
50
+ const currentState = this.wrappedPlayer.getState();
51
+
52
+ if (!this.delayedSeek) {
53
+ return currentState;
54
+ }
55
+
56
+ return {
57
+ ...currentState,
58
+ contentPosition: this.playerState.seekPosition,
59
+ isPaused: false,
60
+ seekPosition: this.playerState.seekPosition,
61
+ };
62
+ };
63
+
64
+ forward = (deltaTime: number) => {
65
+ if (this.delayedSeek || this.delayedSeekTimer) {
66
+ if (this.playerState.seekPosition == null) {
67
+ console.log(
68
+ "Anton forward Postion is NULL",
69
+ this.playerState.seekPosition
70
+ );
71
+
72
+ return;
73
+ }
74
+
75
+ this.playerState.seekPosition += deltaTime;
76
+
77
+ this.onVideoProgress({
78
+ currentTime: this.playerState.seekPosition,
79
+ duration: this.getDuration(),
80
+ seekableDuration: this.playerState.seekableDuration,
81
+ isLive: this.playerState.isLive,
82
+ });
83
+
84
+ console.log(
85
+ "Anton forward SKIP new position",
86
+ this.playerState.seekPosition
87
+ );
88
+
89
+ return;
90
+ }
91
+
92
+ if (this.playerState.seekPosition == null) {
93
+ this.playerState.seekPosition = this.playerState.contentPosition;
94
+ }
95
+
96
+ this.playerState.seekPosition += deltaTime;
97
+
98
+ this.delayedSeekTimer && clearTimeout(this.delayedSeekTimer);
99
+
100
+ this.delayedSeekTimer = setTimeout(() => {
101
+ this.delayedSeekTimer = null;
102
+ this.wrappedPlayer.seekTo(this.playerState.seekPosition);
103
+
104
+ console.log(
105
+ "Anton forward TIMEOUT: SeekPosition",
106
+ this.playerState.seekPosition
107
+ );
108
+
109
+ this.logState("forward", { deltaTime });
110
+ }, 3000);
111
+ };
112
+
113
+ rewind = (deltaTime: number) => {
114
+ if (this.delayedSeek || this.delayedSeekTimer) {
115
+ if (this.playerState.seekPosition == null) {
116
+ console.log(
117
+ "Anton forward Postion is NULL",
118
+ this.playerState.seekPosition
119
+ );
120
+
121
+ return;
122
+ }
123
+
124
+ this.playerState.seekPosition -= deltaTime;
125
+
126
+ this.onVideoProgress({
127
+ currentTime: this.playerState.seekPosition,
128
+ duration: this.getDuration(),
129
+ seekableDuration: this.playerState.seekableDuration,
130
+ isLive: this.playerState.isLive,
131
+ });
132
+
133
+ console.log(
134
+ "Anton forward SKIP new position",
135
+ this.playerState.seekPosition
136
+ );
137
+
138
+ return;
139
+ }
140
+
141
+ this.delayedSeekTimer && clearTimeout(this.delayedSeekTimer);
142
+
143
+ if (this.playerState.seekPosition == null) {
144
+ this.playerState.seekPosition = this.playerState.contentPosition;
145
+ }
146
+
147
+ this.playerState.seekPosition -= deltaTime;
148
+
149
+ this.delayedSeekTimer = setTimeout(() => {
150
+ this.delayedSeekTimer = null;
151
+ this.wrappedPlayer.seekTo(this.playerState.seekPosition);
152
+
153
+ // this.currentPlayerComponent()?.["rewind"]?.(deltaTime);
154
+ this.logState("rewind", { deltaTime });
155
+ }, 3000);
156
+ };
157
+
158
+ public enterDelayedSeek() {
159
+ this.delayedSeekTimer && clearTimeout(this.delayedSeekTimer);
160
+ this.delayedSeekTimer = null;
161
+
162
+ if (this.delayedSeek) {
163
+ return;
164
+ }
165
+
166
+ this.delayedSeek = true;
167
+
168
+ console.log(
169
+ `Anton enterDelayedSeek wasPlaying: ${this.wasPlaying}`,
170
+ this.playerState.seekPosition
171
+ );
172
+
173
+ this.playerState.seekPosition = this.playerState.contentPosition;
174
+
175
+ if (!this.isPaused()) {
176
+ this.wasPlaying = true;
177
+ this.wrappedPlayer.pause();
178
+ }
179
+ }
180
+
181
+ public exitDelayedSeek() {
182
+ if (!this.delayedSeek) {
183
+ return;
184
+ }
185
+
186
+ if (this.delayedSeekTimer) {
187
+ return;
188
+ }
189
+
190
+ this.delayedSeek = false;
191
+
192
+ console.log(
193
+ `Anton exitDelayedSeek wasPlaying: ${this.wasPlaying}`,
194
+ this.playerState.seekPosition
195
+ );
196
+
197
+ if (this.playerState.seekPosition != null) {
198
+ this.wrappedPlayer.seekTo(this.playerState.seekPosition);
199
+ } else {
200
+ console.log("Anton exitDelayedSeek fucking NULL");
201
+ }
202
+
203
+ if (this.wasPlaying) {
204
+ // Disabled by ticket definition
205
+ // this.wrappedPlayer.play();
206
+ this.wasPlaying = true;
207
+ }
208
+ }
209
+ }
@@ -323,6 +323,7 @@ export class Player {
323
323
  */
324
324
  onSeekStart = (event: QuickBrickPlayer.OnSeekStartEvent) => {
325
325
  const { isLive, seekableDuration, currentTime, duration, seekTime } = event;
326
+ console.log("Anton onSeekStart");
326
327
 
327
328
  this.setPlaybackState({ currentTime, duration, seekableDuration, isLive });
328
329
 
@@ -338,8 +339,9 @@ export class Player {
338
339
 
339
340
  onSeekComplete = (event: QuickBrickPlayer.OnSeekCompleteEvent) => {
340
341
  const { isLive, seekableDuration, currentTime, duration } = event;
341
-
342
+ console.log("Anton onSeekComplete");
342
343
  this.setPlaybackState({ currentTime, duration, seekableDuration, isLive });
344
+
343
345
  this.playerState.seekPosition = null;
344
346
 
345
347
  if (!isLive) {
@@ -727,4 +729,9 @@ export class Player {
727
729
  }
728
730
 
729
731
  public supportsNativeControls = (): boolean => false;
732
+ public supportNativeCast = (): boolean => false;
733
+
734
+ public enterDelayedSeek() {}
735
+
736
+ public exitDelayedSeek() {}
730
737
  }
@@ -295,4 +295,9 @@ export class PlayerNative extends Player {
295
295
 
296
296
  supportsNativeControls = (): boolean =>
297
297
  toBooleanWithDefaultFalse(this.getConfig()?.["supports_native_controls"]);
298
+
299
+ supportNativeCast = (): boolean =>
300
+ toBooleanWithDefaultFalse(
301
+ this.playerPluginId === "quick-brick-player-brightcove"
302
+ );
298
303
  }
@@ -4,6 +4,8 @@ import { useEffect } from "react";
4
4
  import { playerManager } from "./index";
5
5
  import { useValidatePlayerConfig } from "../../playerUtils/useValidatePlayerConfig";
6
6
  import { PlayerRole } from "./conts";
7
+ import { isTV } from "../../reactUtils";
8
+ import { DelayedSeekPlayerWrapper } from "./DelayedSeekPlayerWrapper";
7
9
 
8
10
  // TODO: Rename to ControllerType
9
11
  export const usePlayerControllerSetup = ({
@@ -34,7 +36,7 @@ export const usePlayerControllerSetup = ({
34
36
  useValidatePlayerConfig(config);
35
37
 
36
38
  useEffect(() => {
37
- const newPlayerController = new ControllerType({
39
+ const combinedProps = {
38
40
  player: ref,
39
41
  listener: props as any,
40
42
  config,
@@ -42,9 +44,21 @@ export const usePlayerControllerSetup = ({
42
44
  entry,
43
45
  playerPluginId: pluginId,
44
46
  playerRole: PlayerRole.Primary,
47
+ };
48
+
49
+ const newPlayerController = new ControllerType({
50
+ ...combinedProps,
51
+ playerRole: PlayerRole.Unspecified,
52
+ playerId: playerId + "." + "wrapped",
45
53
  });
46
54
 
47
- setPlayerController(newPlayerController);
55
+ if (isTV()) {
56
+ setPlayerController(
57
+ new DelayedSeekPlayerWrapper(combinedProps, newPlayerController)
58
+ );
59
+ } else {
60
+ setPlayerController(newPlayerController);
61
+ }
48
62
  }, [playerId, entry?.id]);
49
63
 
50
64
  React.useEffect(() => {
@@ -24,7 +24,6 @@ import {
24
24
  EMPTY,
25
25
  FALLBACK,
26
26
  TRANSFORM,
27
- defaultColor,
28
27
  } from "./fixtures";
29
28
 
30
29
  describe("getKeyForLabel", () => {
@@ -395,9 +394,7 @@ describe("getColorFromData", () => {
395
394
  it("should return value directly if valid color", () => {
396
395
  const result = getColorFromData({
397
396
  data: entry,
398
- key: "background_color",
399
- getValue: getValue(componentStyle),
400
- defaultColor,
397
+ valueFromLayout: "#123456",
401
398
  });
402
399
 
403
400
  expect(result).toBe("#123456");
@@ -406,9 +403,7 @@ describe("getColorFromData", () => {
406
403
  it("should return valid rgba color name", () => {
407
404
  const result = getColorFromData({
408
405
  data: entry,
409
- key: "component_background_color",
410
- getValue: getValue(componentStyle),
411
- defaultColor,
406
+ valueFromLayout: "rgba(255, 255, 255, 0)",
412
407
  });
413
408
 
414
409
  expect(result).toBe("rgba(255, 255, 255, 0)");
@@ -417,33 +412,27 @@ describe("getColorFromData", () => {
417
412
  it("should return path value if path value is set and is valid color", () => {
418
413
  const result = getColorFromData({
419
414
  data: entry,
420
- key: VAL.colorKeyPath,
421
- getValue: getValue(componentStyle),
422
- defaultColor,
415
+ valueFromLayout: "background_color",
423
416
  });
424
417
 
425
418
  expect(result).toBe("#123456");
426
419
  });
427
420
 
428
- it("should return defaultColor if key value and path value are invalid", () => {
421
+ it("should return path value if path value is set, nested and is valid color", () => {
429
422
  const result = getColorFromData({
430
423
  data: entry,
431
- key: VAL.invalidColorKey,
432
- getValue: getValue(componentStyle),
433
- defaultColor,
424
+ valueFromLayout: "extensions.background_color",
434
425
  });
435
426
 
436
- expect(result).toBe(defaultColor);
427
+ expect(result).toBe("#123456");
437
428
  });
438
429
 
439
- it("should return defaultColor if path does not exist", () => {
430
+ it("should return valueFromLayout if path does not exist", () => {
440
431
  const result = getColorFromData({
441
432
  data: entry,
442
- key: VAL.invalidColorKeyPath,
443
- getValue: getValue(componentStyle),
444
- defaultColor,
433
+ valueFromLayout: "invalid_color",
445
434
  });
446
435
 
447
- expect(result).toBe(defaultColor);
436
+ expect(result).toBe("invalid_color");
448
437
  });
449
438
  });
@@ -447,30 +447,24 @@ export const toResizeMode = (
447
447
 
448
448
  type GetColorFromData = {
449
449
  data: Record<string, any>;
450
- key: string;
451
- getValue: Function;
452
- defaultColor: string;
450
+ valueFromLayout: string;
453
451
  };
454
452
 
455
453
  export const getColorFromData = ({
456
454
  data,
457
- key,
458
- getValue,
459
- defaultColor,
455
+ valueFromLayout,
460
456
  }: GetColorFromData): string => {
461
- const value = getValue(key);
462
-
463
457
  // Temporary hack to fix color validation when alpha is floating point number
464
458
  // https://github.com/dreamyguy/validate-color/issues/44
465
- if (validateColor(value.replace(".00", ""))) {
466
- return value;
459
+ if (validateColor(valueFromLayout.replace(".00", ""))) {
460
+ return valueFromLayout;
467
461
  }
468
462
 
469
- const pathValue = R.path(value.split("."), data);
463
+ const pathValue = R.path(valueFromLayout.split("."), data);
470
464
 
471
465
  if (pathValue && validateColor(pathValue)) {
472
466
  return pathValue;
473
467
  }
474
468
 
475
- return defaultColor;
469
+ return valueFromLayout;
476
470
  };
@@ -0,0 +1,11 @@
1
+ import dayjs from "dayjs";
2
+ import utc from "dayjs/plugin/utc";
3
+ import timezone from "dayjs/plugin/timezone";
4
+ import isoWeek from "dayjs/plugin/isoWeek";
5
+
6
+ // Extend dayjs with plugins
7
+ dayjs.extend(utc);
8
+ dayjs.extend(timezone);
9
+ dayjs.extend(isoWeek);
10
+
11
+ export { dayjs };
@@ -28,5 +28,6 @@ export const getAppDataHeaders = (screenId: string) => {
28
28
  "x-applicaster-signed-device-info-token": appData.signedDeviceInfoToken,
29
29
  "x-applicaster-device-make": appData.deviceMake,
30
30
  "x-applicaster-device-model": appData.deviceModel,
31
+ "x-applicaster-uuid": appData?.uuid,
31
32
  };
32
33
  };
@@ -1,4 +1,4 @@
1
- import { last, head, isNil, includes, all, pathOr } from "ramda";
1
+ import { last, head, isNil, includes, pathOr } from "ramda";
2
2
 
3
3
  const stripBrackets = (path) => {
4
4
  const withoutPrepened = last(path.split("{{"));
@@ -13,15 +13,15 @@ const hasValue = (context) => (path) => {
13
13
  return !isNil(value);
14
14
  };
15
15
 
16
- export const isEnoughDataToInflateString = (context, string): boolean => {
16
+ export const getMissingValues = (context, string): string[] => {
17
17
  if (!includes("{{", string)) {
18
- return true;
18
+ return [];
19
19
  }
20
20
 
21
21
  const SEARCH_REGEX = new RegExp(/{{.*?}}/g);
22
22
  const paths = string.toString().match(SEARCH_REGEX);
23
23
 
24
- return all(hasValue(context), paths);
24
+ return paths.filter((path) => !hasValue(context)(path));
25
25
  };
26
26
 
27
27
  export const isNonInflatedUrl = (url: string): boolean =>
@@ -245,6 +245,12 @@ const generalContent = () => ({
245
245
  ],
246
246
  initial_value: "reloading...",
247
247
  },
248
+ {
249
+ type: "text_input",
250
+ label: "Navigation Bar Screen Title",
251
+ key: "screen_title",
252
+ initial_value: null,
253
+ },
248
254
  ],
249
255
  },
250
256
  advertising: {
@@ -75,3 +75,7 @@ export const isLikeNumber = (value: any): boolean => {
75
75
 
76
76
  export const isZero = (value: unknown): boolean =>
77
77
  Object.is(value, -0) || Object.is(value, 0);
78
+
79
+ export const isMinusZero = (value: number) => {
80
+ return 1 / value === -Infinity;
81
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "12.0.0-alpha.8242130253",
3
+ "version": "12.0.0-alpha.8310462382",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "12.0.0-alpha.8242130253",
31
+ "@applicaster/applicaster-types": "12.0.0-alpha.8310462382",
32
32
  "buffer": "^5.2.1",
33
33
  "camelize": "^1.0.0",
34
34
  "create-react-context": "^0.2.3",
@@ -1,4 +1,8 @@
1
+ import React from "react";
2
+
1
3
  import { act, renderHook } from "@testing-library/react-hooks";
4
+ import { Provider } from "react-redux";
5
+ import configureStore from "redux-mock-store";
2
6
 
3
7
  const mockUpdateComponentsPositions = jest.fn();
4
8
 
@@ -19,11 +23,22 @@ jest.useFakeTimers();
19
23
 
20
24
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation");
21
25
 
26
+ const mockStore = configureStore();
27
+
28
+ const store = mockStore({ appData: {} });
29
+
30
+ const Wrapper = ({ children }: { children: React.ReactChild }) => (
31
+ /* @ts-ignore */
32
+ <Provider store={store}>{children}</Provider>
33
+ );
34
+
22
35
  const { useTrackedView } = require("../useTrackedView");
23
36
 
24
37
  describe("useTrackCurrentAutoScrollingElement", () => {
25
38
  it("should update position for selected component", async () => {
26
- const { result } = renderHook(() => useTrackedView("123"));
39
+ const { result } = renderHook(() => useTrackedView("123"), {
40
+ wrapper: Wrapper,
41
+ });
27
42
 
28
43
  // Fast-forward until all timers have been executed
29
44
  jest.advanceTimersByTime(3000);
@@ -12,9 +12,21 @@ const {
12
12
 
13
13
  const { reactHooksLogger } = require("../../logger");
14
14
 
15
+ let mockStore;
16
+
15
17
  describe("getInflatedDataSourceUrl", () => {
16
18
  beforeEach(() => {
17
19
  reactHooksLogger.warning.mockClear();
20
+
21
+ const {
22
+ appStore,
23
+ } = require("@applicaster/zapp-react-native-redux/AppStore");
24
+
25
+ mockStore = {
26
+ getState: jest.fn().mockReturnValue({ pipesEndpoints: {} }),
27
+ };
28
+
29
+ appStore.set(mockStore);
18
30
  });
19
31
 
20
32
  it("returns the url inflated with the right params", () => {
@@ -72,7 +84,8 @@ describe("getInflatedDataSourceUrl", () => {
72
84
  expect(reactHooksLogger.warning).toHaveBeenCalledTimes(1);
73
85
 
74
86
  expect(reactHooksLogger.warning).toHaveBeenCalledWith({
75
- message: "Not enough data to fully inflate url",
87
+ message:
88
+ "Not enough data to fully inflate url: {{entry.id}} source: http://foo.com/show/seriesId={{seriesId}}",
76
89
  data: { source, contexts, mapping },
77
90
  });
78
91
  });
@@ -107,7 +120,8 @@ describe("getInflatedDataSourceUrl", () => {
107
120
  expect(reactHooksLogger.warning).toHaveBeenCalledTimes(1);
108
121
 
109
122
  expect(reactHooksLogger.warning).toHaveBeenCalledWith({
110
- message: "Not enough data to fully inflate url",
123
+ message:
124
+ "Not enough data to fully inflate url: {{entry.extensions.groupName}} source: https://zapp-1689-emmys.web.app/emmys/group-categories/{{groupName}}",
111
125
  data: { source, contexts, mapping },
112
126
  });
113
127
  });
@@ -148,7 +162,8 @@ describe("getInflatedDataSourceUrl", () => {
148
162
  expect(reactHooksLogger.warning).toHaveBeenCalledTimes(1);
149
163
 
150
164
  expect(reactHooksLogger.warning).toHaveBeenCalledWith({
151
- message: "Not enough data to fully inflate url",
165
+ message:
166
+ "Not enough data to fully inflate url: {{entry.extensions.groupName2}} source: https://zapp-1689-emmys.web.app/emmys/group-categories/{{groupName1}}?test={{groupName2}}",
152
167
  data: { source, contexts, mapping },
153
168
  });
154
169
  });
@@ -9,9 +9,15 @@ import {
9
9
 
10
10
  import { inflateString } from "../../stringUtils";
11
11
  import { useRoute } from "../navigation";
12
- import { isEnoughDataToInflateString } from "../../inflatedUrlUtils";
12
+ import { getMissingValues } from "../../inflatedUrlUtils";
13
13
  import { reactHooksLogger as logger } from "../logger";
14
14
  import { isTV } from "../../reactUtils";
15
+ import {
16
+ findEndpointForURL,
17
+ HTTP_METHODS,
18
+ } from "@applicaster/zapp-pipes-v2-client";
19
+ import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
20
+ import { ENDPOINT_TAGS } from "../../types";
15
21
 
16
22
  /**
17
23
  * will match any occurrence in a string of one or more word characters
@@ -105,24 +111,47 @@ export const getInflatedDataSourceUrl: GetInflatedDataSourceUrl = ({
105
111
  R.keys(mapping)
106
112
  );
107
113
 
108
- if (!isEnoughDataToInflateString(contexts, string)) {
109
- const message = "Not enough data to fully inflate url";
114
+ const missingValues = getMissingValues(contexts, string);
110
115
 
111
- // todo: add js only payload instead
112
- if (__DEV__) {
113
- logger.warning({
114
- message,
115
- data: { source, contexts, mapping },
116
- });
116
+ if (missingValues && missingValues.length > 0) {
117
+ const pipesEndpoints = appStore.get("pipesEndpoints");
118
+
119
+ const endpointURL = findEndpointForURL(
120
+ source,
121
+ pipesEndpoints,
122
+ HTTP_METHODS.GET
123
+ );
124
+
125
+ const tags = pipesEndpoints?.[endpointURL]?.tags;
126
+ const allowMissingKeys = tags?.includes(ENDPOINT_TAGS.allow_missing_keys);
127
+
128
+ if (!allowMissingKeys) {
129
+ const message = `Not enough data to fully inflate url: ${missingValues.join(
130
+ ","
131
+ )} source: ${source}`;
132
+
133
+ // todo: add js only payload instead
134
+ if (__DEV__) {
135
+ logger.warning({
136
+ message,
137
+ data: { source, contexts, mapping },
138
+ });
139
+ } else {
140
+ // todo: log values we've failed to resolve
141
+ logger.warning({
142
+ message,
143
+ });
144
+ }
145
+
146
+ // return null in order to prevent start fetching data with invalid url
147
+ return null;
117
148
  } else {
118
- // todo: log values we've failed to resolve
119
- logger.warning({
120
- message,
149
+ logger.debug({
150
+ message: `Ignoring missing values in url because ${
151
+ ENDPOINT_TAGS.allow_missing_keys
152
+ } endpoint tag, keys: ${missingValues.join(",")}`,
121
153
  });
122
154
  }
123
-
124
- // return null in order to prevent start fetching data with invalid url
125
- return null;
126
155
  }
127
156
 
128
157
  return inflateString({ string, data: contexts });
@@ -1,4 +1,8 @@
1
+ import React from "react";
2
+
1
3
  import { cleanup, renderHook } from "@testing-library/react-hooks";
4
+ import { Provider } from "react-redux";
5
+ import configureStore from "redux-mock-store";
2
6
 
3
7
  import * as ReactNative from "react-native";
4
8
 
@@ -48,19 +52,43 @@ jest.mock("../../navigation", () => ({
48
52
  }));
49
53
 
50
54
  const { Dimensions } = require("react-native");
51
- const { useDimensions } = require("../");
55
+ const { useDimensions } = require("..");
56
+
57
+ const mockStore = configureStore();
58
+
59
+ const getWrapper = () => {
60
+ const store = mockStore({ appData: {} });
61
+
62
+ const Wrapper = ({ children }: { children: React.ReactChild }) => (
63
+ /* @ts-ignore */
64
+ <Provider store={store}>{children}</Provider>
65
+ );
66
+
67
+ return Wrapper;
68
+ };
69
+
70
+ const testHook = (context, params?) => {
71
+ const wrapper = getWrapper();
72
+
73
+ const {
74
+ result,
75
+ result: { current: dimensions },
76
+ } = renderHook(() => useDimensions(context, params), {
77
+ wrapper,
78
+ });
79
+
80
+ return { result, dimensions };
81
+ };
52
82
 
53
83
  describe("useDimensions", () => {
54
84
  it("renders", () => {
55
- const { result } = renderHook(() =>
56
- useDimensions("window", { fullDimensions: true })
57
- );
85
+ const { result } = testHook("window", { fullDimensions: true });
58
86
 
59
87
  expect(result).toBeDefined();
60
88
  });
61
89
 
62
90
  it("sets event listener", () => {
63
- renderHook(() => useDimensions("window", { fullDimensions: true }));
91
+ testHook("window", { fullDimensions: true });
64
92
 
65
93
  expect(Dimensions.addEventListener).toBeCalledWith(
66
94
  "change",
@@ -69,16 +97,14 @@ describe("useDimensions", () => {
69
97
  });
70
98
 
71
99
  it("removes event listener", () => {
72
- renderHook(() => useDimensions("window", { fullDimensions: true }));
100
+ testHook("window", { fullDimensions: true });
73
101
  cleanup();
74
102
 
75
103
  expect(mockRemoveFn).toBeCalled();
76
104
  });
77
105
 
78
106
  it("Returns full dimensions object", () => {
79
- const {
80
- result: { current: dimensions },
81
- } = renderHook(() => useDimensions("window", { fullDimensions: true }));
107
+ const { dimensions } = testHook("window", { fullDimensions: true });
82
108
 
83
109
  expect(dimensions).toHaveProperty("height");
84
110
  expect(dimensions).toHaveProperty("width");
@@ -87,20 +113,17 @@ describe("useDimensions", () => {
87
113
  });
88
114
 
89
115
  it("Returns shorthand dimensions object", () => {
90
- const {
91
- result: { current: dimensions },
92
- } = renderHook(() => useDimensions("window"));
116
+ const { dimensions } = testHook("window");
93
117
 
94
118
  expect(dimensions).toHaveProperty("height");
95
119
  expect(dimensions).toHaveProperty("width");
96
120
  });
97
121
 
98
122
  it("Returns the device info object", () => {
99
- const {
100
- result: { current: dimensions },
101
- } = renderHook(() =>
102
- useDimensions("window", { fullDimensions: true, deviceInfo: true })
103
- );
123
+ const { dimensions } = testHook("window", {
124
+ fullDimensions: true,
125
+ deviceInfo: true,
126
+ });
104
127
 
105
128
  expect(dimensions).toHaveProperty("height");
106
129
  expect(dimensions).toHaveProperty("width");
@@ -113,10 +136,7 @@ describe("useDimensions", () => {
113
136
  it("applies the scale on TV, and screen context", () => {
114
137
  tv_flag = true;
115
138
  const { screen } = mocked_return_value(tv_flag);
116
-
117
- const {
118
- result: { current: dimensions },
119
- } = renderHook(() => useDimensions("screen"));
139
+ const { dimensions } = testHook("screen");
120
140
 
121
141
  expect(dimensions).toHaveProperty("height", screen.height * screen.scale);
122
142
  expect(dimensions).toHaveProperty("width", screen.width * screen.scale);
@@ -128,10 +148,7 @@ describe("useDimensions", () => {
128
148
  it("doesn't apply the scale on mobile with screen context", () => {
129
149
  tv_flag = false;
130
150
  const { screen } = mocked_return_value(tv_flag);
131
-
132
- const {
133
- result: { current: dimensions },
134
- } = renderHook(() => useDimensions("screen"));
151
+ const { dimensions } = testHook("screen");
135
152
 
136
153
  expect(dimensions).toHaveProperty("height", screen.height);
137
154
  expect(dimensions).toHaveProperty("width", screen.width);
@@ -141,10 +158,7 @@ describe("useDimensions", () => {
141
158
  it("doesn't apply the scale on TV with window context", () => {
142
159
  tv_flag = true;
143
160
  const { window } = mocked_return_value(tv_flag);
144
-
145
- const {
146
- result: { current: dimensions },
147
- } = renderHook(() => useDimensions("window"));
161
+ const { dimensions } = testHook("window");
148
162
 
149
163
  expect(dimensions).toHaveProperty("height", window.height);
150
164
  expect(dimensions).toHaveProperty("width", window.width);
@@ -3,13 +3,15 @@ import { isTablet } from "../isTablet";
3
3
  /**
4
4
  * Returns an object with additional device info that can be used to determine if tablet
5
5
  * @param {Number} dimensions - Dimensions object passed to the function
6
+ * @param {Object} appData - application data object passed to the function
6
7
  * @returns {DeviceInfo} deviceInfo - returns an object with scale, isTablet, and orientation
7
8
  */
8
- export const getDeviceInfo = (dimensions) => {
9
+ export const getDeviceInfo = (dimensions, appData) => {
9
10
  const scale = dimensions?.scale;
10
11
  const isLandscape = dimensions?.width > dimensions?.height;
11
12
  const orientation = isLandscape ? "landscape" : "portrait";
12
13
  const tablet = isTablet(dimensions, orientation) || false;
14
+ const isTabletLandscape = tablet && !appData?.isTabletPortrait;
13
15
 
14
- return { scale, isTablet: tablet, orientation };
16
+ return { scale, isTablet: tablet, orientation, isTabletLandscape };
15
17
  };
@@ -2,6 +2,7 @@ type DeviceInfo = {
2
2
  isTablet: boolean;
3
3
  scale: number;
4
4
  orientation: string;
5
+ isTabletLandscape: boolean;
5
6
  };
6
7
 
7
8
  type RNDimensions = {
@@ -3,6 +3,8 @@ import { useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
  import * as R from "ramda";
4
4
 
5
5
  import { Dimensions, Platform, StatusBar } from "react-native";
6
+ import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
7
+
6
8
  import { isTV } from "../../../reactUtils";
7
9
 
8
10
  import { Options, UseDimensions } from "../types";
@@ -36,6 +38,7 @@ export const useDimensions: UseDimensions = (
36
38
  fullDimensions = { fullDimensions: false, updateForInactiveScreens: true }
37
39
  ) => {
38
40
  const isActive = useIsScreenActive();
41
+ const { appData } = usePickFromState(["appData"]);
39
42
 
40
43
  if (typeof fullDimensions === "boolean") {
41
44
  // eslint-disable-next-line no-console
@@ -50,7 +53,7 @@ export const useDimensions: UseDimensions = (
50
53
  : { ...fullDimensions };
51
54
 
52
55
  const [dimensions, setDimensions] = useState(getInitialDimensions(context));
53
- const deviceInfo = useRef(getDeviceInfo(dimensions));
56
+ const deviceInfo = useRef(getDeviceInfo(dimensions, appData));
54
57
 
55
58
  const applyOptions = R.compose(
56
59
  R.when(() => options.deviceInfo, R.assoc("deviceInfo", deviceInfo.current)),
@@ -85,7 +88,7 @@ export const useDimensions: UseDimensions = (
85
88
  // eslint-disable-next-line no-console
86
89
  console.log("change: wrong values - width equal to height, ignoring");
87
90
  } else if (isActive || options.updateForInactiveScreens) {
88
- deviceInfo.current = getDeviceInfo(newDimensions);
91
+ deviceInfo.current = getDeviceInfo(newDimensions, appData);
89
92
  setDimensions(newDimensions);
90
93
  }
91
94
  };
@@ -15,8 +15,21 @@ export const mockMenu: ZappNavigation = {
15
15
  // preset_id?: null | unknown;
16
16
  };
17
17
 
18
+ export const useRoute = jest.fn(() => ({
19
+ screenData: {
20
+ name: "someName",
21
+ },
22
+ pathname: "someRoute",
23
+ }));
24
+
18
25
  export const useNavigation = jest.fn(() => ({
19
26
  data: {},
27
+ screenData: {
28
+ name: "someName",
29
+ },
30
+ activeRiver: {
31
+ id: "someId",
32
+ },
20
33
  currentRoute: "someRoute",
21
34
  }));
22
35
 
@@ -1,4 +1,7 @@
1
1
  export const useNavigation = jest.fn(() => ({
2
2
  data: {},
3
+ screenData: {
4
+ name: "someName",
5
+ },
3
6
  currentRoute: "someRoute",
4
7
  }));
@@ -251,6 +251,11 @@ export const useRoute = (): {
251
251
  return composeRouteData(screenData);
252
252
  }
253
253
 
254
+ // case 1: stack not yet updated in navigator context, but navigator.screenData is updated already.
255
+ if (!currentStack) {
256
+ return composeRouteData(navigator.screenData);
257
+ }
258
+
254
259
  return composeRouteData(currentRouteScreenData);
255
260
  };
256
261
 
@@ -14,6 +14,7 @@ export const useAutoSeek = (resetHUDTimer = noop) => {
14
14
  const [isRunning, setIsRunning] = useState<boolean>(false);
15
15
  const [direction, setDirection] = useState<Nullable<SEEK_TYPE>>(null);
16
16
  const [multiplier, setMultiplier] = useState(1);
17
+
17
18
  const intervalTimer = React.useRef(null);
18
19
  const prevRunning = usePrevious(isRunning);
19
20
 
@@ -36,6 +37,19 @@ export const useAutoSeek = (resetHUDTimer = noop) => {
36
37
  clearIntervalTimer();
37
38
  };
38
39
 
40
+ useEffect(() => {
41
+ const player = playerManager.getInstanceController();
42
+ if (!player) return;
43
+
44
+ if (isRunning) {
45
+ if (player.isPlaying()) {
46
+ player?.enterDelayedSeek();
47
+ }
48
+ } else if (!isRunning) {
49
+ player.exitDelayedSeek();
50
+ }
51
+ }, [isRunning]);
52
+
39
53
  useEffect(() => {
40
54
  const player = playerManager.getInstanceController();
41
55
 
@@ -75,7 +89,7 @@ export const useAutoSeek = (resetHUDTimer = noop) => {
75
89
  setDirection(eventType);
76
90
  setIsRunning(true);
77
91
  },
78
- [isRunning]
92
+ [isRunning, autoSeekStop]
79
93
  );
80
94
 
81
95
  return React.useMemo(
@@ -10,34 +10,42 @@ export const useSeek = (resetHUDTimer = noop) => {
10
10
 
11
11
  const onForwardPress = () => {
12
12
  handlePressEvent(SEEK_TYPE.FORWARD);
13
+ console.log("Anton onForwardPress");
13
14
  };
14
15
 
15
16
  const onRewindPress = () => {
16
17
  handlePressEvent(SEEK_TYPE.REWIND);
18
+ console.log("Anton onRewindPress");
17
19
  };
18
20
 
19
21
  const onForwardPressIn = () => {
20
22
  autoSeekStart(SEEK_TYPE.FORWARD);
23
+ console.log("Anton onForwardPressIn");
21
24
  };
22
25
 
23
26
  const onForwardPressOut = () => {
24
27
  autoSeekStop();
28
+ console.log("Anton onForwardPressOut");
25
29
  };
26
30
 
27
31
  const onRewindPressIn = () => {
28
32
  autoSeekStart(SEEK_TYPE.REWIND);
33
+ console.log("Anton onRewindPressIn");
29
34
  };
30
35
 
31
36
  const onRewindLongPress = () => {
32
37
  autoSeekStart(SEEK_TYPE.REWIND);
38
+ console.log("Anton onRewindLongPress");
33
39
  };
34
40
 
35
41
  const onForwardLongPress = () => {
36
42
  autoSeekStart(SEEK_TYPE.FORWARD);
43
+ console.log("Anton onForwardLongPress");
37
44
  };
38
45
 
39
46
  const onRewindPressOut = () => {
40
47
  autoSeekStop();
48
+ console.log("Anton onRewindPressOut");
41
49
  };
42
50
 
43
51
  return React.useMemo(
@@ -46,6 +46,12 @@ export const useTapSeek = () => {
46
46
  }
47
47
 
48
48
  const seekTime = getSkipTime(onPressMultiplier.current);
49
+
50
+ console.log(
51
+ `Anton123 handlePressEvent: ${eventType} shouldIncreaseMultiplier:${shouldIncreaseMultiplier} currentM: ${onPressMultiplier.current}, seekTime:${seekTime}`,
52
+ { isSameEventType, isWithinResetDuration }
53
+ );
54
+
49
55
  player[eventType](seekTime);
50
56
 
51
57
  lastPressTime.current = now;
@@ -6,7 +6,7 @@ import { useNavigation } from "../navigation/useNavigation";
6
6
 
7
7
  import { ScreenContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ScreenContext";
8
8
 
9
- function useScreenContextV2() {
9
+ export function useScreenContextV2() {
10
10
  return useContext(ScreenContext);
11
11
  }
12
12
 
@@ -49,11 +49,3 @@ export function useScreenState(
49
49
  setSelectedEntry: (entryId) => setSelectedEntry(screenId, entryId),
50
50
  };
51
51
  }
52
-
53
- export const useScreenScrollStore = create<{
54
- scrollPosition: number;
55
- scrollingVelocity: number;
56
- }>(() => ({
57
- scrollPosition: 0,
58
- scrollingVelocity: 0,
59
- }));
@@ -152,3 +152,8 @@ export function objectToCamelCase(obj) {
152
152
  export function isString(value: unknown): value is string {
153
153
  return typeof value === "string" || value instanceof String;
154
154
  }
155
+
156
+ /** Checks if a value is a non-empty string */
157
+ export function isNotEmptyString(value: unknown): value is string {
158
+ return isString(value) && value.length > 0;
159
+ }
@@ -0,0 +1,14 @@
1
+ export const getByTestId = (wrapper, testId) => {
2
+ try {
3
+ if (wrapper?.getByTestId) {
4
+ return wrapper?.queryAllByTestId(testId)?.[0] ?? undefined;
5
+ } else if (wrapper?.root?.findByProps) {
6
+ return wrapper.root.findAllByProps({ testID: testId })?.[0] ?? undefined;
7
+ }
8
+ } catch (e) {
9
+ // eslint-disable-next-line no-console
10
+ console.log("getByTestId E:", e);
11
+
12
+ return undefined;
13
+ }
14
+ };
@@ -1,6 +1,6 @@
1
1
  import * as R from "ramda";
2
2
 
3
- import React from "react";
3
+ import React, { PropsWithChildren } from "react";
4
4
  import { View } from "react-native";
5
5
 
6
6
  import { Provider } from "react-redux";
@@ -11,6 +11,8 @@ import { SafeAreaProvider } from "react-native-safe-area-context";
11
11
  import { render } from "@testing-library/react-native";
12
12
  import { AnalyticsProvider } from "../analyticsUtils";
13
13
 
14
+ export { getByTestId } from "./getByTestId";
15
+
14
16
  /**
15
17
  * Function to be used in tandem with enzyme findWhere(node => node.prop('testID') === 'yourID')
16
18
  * Example:
@@ -21,17 +23,6 @@ import { AnalyticsProvider } from "../analyticsUtils";
21
23
  export const testIDEquals = (testId: any): boolean =>
22
24
  R.compose(R.equals(testId), R.invoker(1, "prop")("testID"));
23
25
 
24
- export const getByTestId = (wrapper, testId) => {
25
- try {
26
- return wrapper?.queryAllByTestId(testId)?.[0] ?? undefined;
27
- } catch (e) {
28
- // eslint-disable-next-line no-console
29
- console.log("getByTestId E:", e);
30
-
31
- return undefined;
32
- }
33
- };
34
-
35
26
  /** Helper function for react-test-renderer, accepts type and renderer
36
27
  * * @param {*} type React Component type instance or name of component
37
28
  * * @param {*} renderer renderer instance
@@ -47,11 +38,11 @@ export const findByType = (type, renderer) => {
47
38
  export function createComponentMock(mockName, hasChildren = false) {
48
39
  return hasChildren
49
40
  ? jest.fn(({ children }) => (
50
- <View comp={mockName} testID={mockName}>
41
+ <View testID={mockName}>
51
42
  {typeof children === "function" ? children() : children}
52
43
  </View>
53
44
  ))
54
- : jest.fn(() => <View comp={mockName} testID={mockName} />);
45
+ : jest.fn(() => <View testID={mockName} />);
55
46
  }
56
47
 
57
48
  const initialState = {
@@ -64,14 +55,21 @@ const initialState = {
64
55
  AppContainer: createComponentMock("appContainer", true),
65
56
  DisplayError: createComponentMock("displayError"),
66
57
  },
67
- rivers: [{ id: "A1234", home: true }],
58
+ rivers: { id: "A1234", home: true },
68
59
  appSettings: {},
69
60
  plugins: [],
70
- appState: { appReady: true },
61
+ appState: { appReady: true, appLaunched: true },
62
+ appData: { layoutVersion: "v1" },
63
+ contentTypes: null,
71
64
  };
72
65
 
73
- export const WrappedWithProviders = ({ children, store = {} }: any) => {
74
- const _store = configureStore([thunk])({ ...initialState, ...store });
66
+ export const WrappedWithProviders = ({
67
+ children,
68
+ store: storeObj = {},
69
+ }: any) => {
70
+ const _store = configureStore([thunk])(
71
+ R.mergeDeepWith(R.concat, { ...initialState }, storeObj)
72
+ );
75
73
 
76
74
  return (
77
75
  <SafeAreaProvider
@@ -93,8 +91,12 @@ export const WrappedWithProviders = ({ children, store = {} }: any) => {
93
91
  * @param store optional store to pass to the provider
94
92
  * @returns
95
93
  */
96
- export const renderWithProviders = (component, store?: unknown) => {
97
- return render(
98
- <WrappedWithProviders store={store}>{component}</WrappedWithProviders>
99
- );
94
+ export const renderWithProviders = (component, storeObj?: unknown) => {
95
+ return render(component, {
96
+ wrapper: function TestWrapper({ children }: PropsWithChildren<any>) {
97
+ return (
98
+ <WrappedWithProviders store={storeObj}>{children}</WrappedWithProviders>
99
+ );
100
+ },
101
+ });
100
102
  };
package/types.ts CHANGED
@@ -5,3 +5,7 @@ export type ManifestField<T> = {
5
5
  group?: boolean;
6
6
  fields?: ManifestField<any>[];
7
7
  };
8
+
9
+ export enum ENDPOINT_TAGS {
10
+ allow_missing_keys = "allow_missing_keys",
11
+ }