@applicaster/zapp-react-native-utils 16.0.0-alpha.7343517668 → 16.0.0-alpha.7354639420
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/actionUtils/index.ts +3 -1
- package/actionsExecutor/ActionExecutor.ts +59 -14
- package/actionsExecutor/ActionExecutorContext.tsx +113 -315
- package/actionsExecutor/__tests__/ActionExecutor.test.ts +71 -0
- package/actionsExecutor/__tests__/StorageActions.test.ts +98 -0
- package/actionsExecutor/__tests__/feedDecorator.test.ts +91 -0
- package/actionsExecutor/__tests__/screenToggleFlag.test.ts +90 -0
- package/actionsExecutor/actions/__tests__/dismissBottomSheet.test.ts +25 -0
- package/actionsExecutor/actions/__tests__/goBack.test.ts +62 -0
- package/actionsExecutor/actions/__tests__/goHome.test.ts +19 -0
- package/actionsExecutor/actions/__tests__/loadItemsFromSource.test.ts +88 -0
- package/actionsExecutor/actions/__tests__/navigateToScreen.test.ts +267 -0
- package/actionsExecutor/actions/__tests__/openBottomSheet.customContent.test.ts +100 -0
- package/actionsExecutor/actions/__tests__/openBottomSheet.inlineItems.test.ts +372 -0
- package/actionsExecutor/actions/__tests__/presentScreen.test.ts +127 -0
- package/actionsExecutor/actions/__tests__/showAlert.test.ts +49 -0
- package/actionsExecutor/actions/__tests__/showToast.test.ts +88 -0
- package/actionsExecutor/actions/appRestart.ts +24 -0
- package/actionsExecutor/actions/confirmDialog.ts +53 -0
- package/actionsExecutor/actions/dismissBottomSheet.ts +23 -0
- package/actionsExecutor/actions/goBack.ts +60 -0
- package/actionsExecutor/actions/goHome.ts +31 -0
- package/actionsExecutor/actions/index.ts +42 -0
- package/actionsExecutor/actions/localStorageRemove.ts +27 -0
- package/actionsExecutor/actions/localStorageSet.ts +28 -0
- package/actionsExecutor/actions/localStorageToggleFlag.ts +28 -0
- package/actionsExecutor/actions/navigateToScreen.ts +121 -0
- package/actionsExecutor/actions/openBottomSheet.ts +340 -0
- package/actionsExecutor/actions/presentScreen.ts +78 -0
- package/actionsExecutor/actions/refreshComponent.ts +85 -0
- package/actionsExecutor/actions/screenSetVariable.ts +35 -0
- package/actionsExecutor/actions/screenToggleFlag.ts +36 -0
- package/actionsExecutor/actions/sendCloudEvent.ts +93 -0
- package/actionsExecutor/actions/sessionStorageRemove.ts +19 -0
- package/actionsExecutor/actions/sessionStorageSet.ts +20 -0
- package/actionsExecutor/actions/sessionStorageToggleFlag.ts +15 -0
- package/actionsExecutor/actions/showAlert.ts +51 -0
- package/actionsExecutor/actions/showToast.ts +87 -0
- package/actionsExecutor/actions/switchLayout.ts +40 -0
- package/actionsExecutor/consts.ts +27 -0
- package/actionsExecutor/feedDecorator.ts +14 -8
- package/actionsExecutor/types.ts +59 -0
- package/analyticsUtils/PlayerAnalyticsManager.ts +1 -1
- package/analyticsUtils/__tests__/playerAnalyticsSafeguard.test.ts +62 -0
- package/analyticsUtils/logger.ts +9 -4
- package/analyticsUtils/playerAnalyticsTracker.ts +1 -0
- package/appUtils/HooksManager/index.ts +9 -0
- package/appUtils/HooksManager/logger.ts +5 -2
- package/appUtils/accessibilityManager/logger.ts +2 -4
- package/appUtils/accessibilityManager/utils.ts +1 -1
- package/appUtils/contextKeysManager/__tests__/getKey/failure.test.ts +2 -23
- package/appUtils/contextKeysManager/__tests__/getKey/success/fullSearch.test.ts +1 -25
- package/appUtils/contextKeysManager/__tests__/getKey/success/searchInSecure.test.ts +1 -7
- package/appUtils/contextKeysManager/__tests__/removeKey/failure.test.ts +1 -26
- package/appUtils/contextKeysManager/__tests__/removeKey/success.test.ts +0 -6
- package/appUtils/contextKeysManager/__tests__/setKey/failure/failedToSaveInStorage.test.ts +0 -40
- package/appUtils/contextKeysManager/__tests__/setKey/failure/invalidKey.test.ts +4 -4
- package/appUtils/contextKeysManager/__tests__/setKey/{success/saveItemAndReference.test.ts → success.test.ts} +2 -42
- package/appUtils/contextKeysManager/index.ts +31 -132
- package/appUtils/focusManager/index.ts +2 -2
- package/appUtils/focusManager/logger.ts +2 -2
- package/appUtils/focusManagerAux/index.ts +2 -2
- package/appUtils/orientationHelper.ts +2 -2
- package/appUtils/platform/platformUtils.ts +2 -2
- package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +143 -60
- package/appUtils/playerManager/OverlayObserver/__tests__/getUpcomingQueue.test.ts +67 -0
- package/appUtils/playerManager/OverlayObserver/__tests__/liveContent.test.ts +205 -0
- package/appUtils/playerManager/OverlayObserver/__tests__/utils.test.ts +56 -0
- package/appUtils/playerManager/OverlayObserver/getUpcomingQueue.android.tv.ts +4 -0
- package/appUtils/playerManager/OverlayObserver/getUpcomingQueue.ios.tv.ts +4 -0
- package/appUtils/playerManager/OverlayObserver/getUpcomingQueue.ts +24 -0
- package/appUtils/playerManager/OverlayObserver/getUpcomingQueue.web.ts +4 -0
- package/appUtils/playerManager/OverlayObserver/utils.ts +51 -20
- package/appUtils/playerManager/__tests__/playerContent.test.ts +403 -0
- package/appUtils/playerManager/__tests__/playerDiagnostics.test.ts +62 -0
- package/appUtils/playerManager/__tests__/playerFactory.test.ts +1 -1
- package/appUtils/playerManager/__tests__/playerNative.test.ts +114 -0
- package/appUtils/playerManager/__tests__/playerNativeCommand.test.ts +62 -0
- package/appUtils/playerManager/__tests__/playerToolbox.test.ts +281 -0
- package/appUtils/playerManager/__tests__/usePlayerContent.test.tsx +64 -0
- package/appUtils/playerManager/__tests__/usePlayerControllerSetup.test.tsx +62 -0
- package/appUtils/playerManager/{conts.ts → const.ts} +33 -0
- package/appUtils/playerManager/index.ts +10 -3
- package/appUtils/playerManager/player.ts +141 -4
- package/appUtils/playerManager/playerFactory.ts +1 -1
- package/appUtils/playerManager/playerNative.ts +29 -5
- package/appUtils/playerManager/playerNativeCommand.ts +3 -6
- package/appUtils/playerManager/playerToolbox.ts +196 -0
- package/appUtils/playerManager/usePlayNextOverlay.tsx +2 -2
- package/appUtils/playerManager/usePlayerContent.tsx +43 -0
- package/appUtils/playerManager/usePlayerControllerSetup.tsx +7 -1
- package/appUtils/playerManager/userCellPlayerMutedPreference.ts +1 -1
- package/appUtils/playerManager/userLanguagePreference.ts +2 -2
- package/arrayUtils/__tests__/{anyThruthy.test.ts → anyTruthy.test.ts} +8 -0
- package/arrayUtils/__tests__/arrayUtils.test.ts +165 -108
- package/arrayUtils/__tests__/isEmptyArray.test.ts +11 -0
- package/arrayUtils/__tests__/isFilledArray.test.ts +12 -0
- package/arrayUtils/__tests__/isFirst.test.ts +17 -0
- package/arrayUtils/__tests__/isIndexInRange.test.ts +14 -0
- package/arrayUtils/__tests__/isLast.test.ts +31 -0
- package/arrayUtils/__tests__/makeListOf.test.ts +31 -0
- package/arrayUtils/__tests__/makeListOfIndexes.test.ts +20 -0
- package/arrayUtils/__tests__/reorderByIds.test.ts +63 -0
- package/arrayUtils/__tests__/sample.test.ts +61 -0
- package/arrayUtils/index.ts +119 -20
- package/bottomSheet/__tests__/scrollContext.test.tsx +35 -0
- package/bottomSheet/index.ts +17 -0
- package/cellUtils/__tests__/getButtonsEnabled.test.ts +28 -0
- package/cellUtils/__tests__/getCellNavigationEnabled.test.ts +36 -0
- package/cellUtils/__tests__/getIsCellNavigationEnabled.test.ts +35 -0
- package/cellUtils/__tests__/isCellNavigationEnabled.test.ts +21 -0
- package/cellUtils/index.ts +70 -3
- package/cellUtils/logger.ts +2 -2
- package/configurationUtils/__tests__/manifestKeyParser.test.ts +21 -0
- package/configurationUtils/__tests__/modalBlocksParser.test.ts +403 -0
- package/configurationUtils/manifestKeyParser.ts +50 -10
- package/configurationUtils/modalBlocksParser.ts +252 -0
- package/domUtils/logger.ts +2 -2
- package/entryActions/__tests__/buildEntryActions.test.ts +235 -0
- package/entryActions/aliasPresentation.ts +108 -0
- package/entryActions/buildEntryActions.ts +167 -0
- package/entryActions/index.ts +15 -0
- package/entryActions/types.ts +39 -0
- package/focusManager/FocusManager.ts +26 -0
- package/focusManager/__tests__/FocusManager.test.ts +9 -0
- package/focusManager/logger.ts +1 -4
- package/headersUtils/index.ts +2 -2
- package/localizationUtils/index.ts +12 -6
- package/logger/__tests__/subsystems.test.ts +84 -0
- package/logger/__tests__/xrayToolbox.test.ts +69 -0
- package/logger/index.ts +41 -7
- package/logger/subsystems.ts +83 -0
- package/logger/xrayToolbox.ts +67 -0
- package/manifestUtils/__tests__/player.audioControls.test.js +158 -0
- package/manifestUtils/_internals/index.js +14 -3
- package/manifestUtils/defaultManifestConfigurations/generalContent.js +6 -0
- package/manifestUtils/defaultManifestConfigurations/player.js +357 -20
- package/manifestUtils/fieldUtils/__tests__/fieldUtils.test.js +84 -0
- package/manifestUtils/fieldUtils/index.js +125 -0
- package/manifestUtils/index.js +3 -0
- package/manifestUtils/keys.js +16 -2
- package/manifestUtils/mobileAction/button/index.js +16 -0
- package/manifestUtils/mobileAction/container/__tests__/mobileActionButtonsContainer.test.js +21 -0
- package/manifestUtils/mobileAction/container/index.js +3 -1
- package/manifestUtils/mobileAction/groups/__tests__/buildMobileActionButtonGroups.test.js +1 -1
- package/manifestUtils/mobileAction/groups/defaults.js +5 -2
- package/manifestUtils/modalBlocks.js +304 -0
- package/manifestUtils/platformIsTV.js +1 -0
- package/modalState/ContentViewModel.ts +113 -0
- package/modalState/EditableCollection.ts +17 -0
- package/modalState/EditableCollectionRegistry.ts +51 -0
- package/modalState/ModalOrchestrator.ts +213 -0
- package/modalState/RemoteEditableCollection.ts +235 -0
- package/modalState/__tests__/ContentViewModel.editable.test.ts +69 -0
- package/modalState/__tests__/ContentViewModel.test.ts +165 -0
- package/modalState/__tests__/EditableCollectionRegistry.test.ts +112 -0
- package/modalState/__tests__/ModalOrchestrator.phase3.test.ts +86 -0
- package/modalState/__tests__/RemoteEditableCollection.test.ts +415 -0
- package/modalState/__tests__/index.test.ts +30 -1
- package/modalState/__tests__/useBottomSheetContent.test.ts +349 -0
- package/modalState/__tests__/useModalStoreState.test.ts +142 -0
- package/modalState/index.ts +37 -83
- package/modalState/store.ts +109 -0
- package/modalState/types.ts +173 -0
- package/modalState/useBottomSheetContent.ts +109 -0
- package/navigationUtils/index.ts +5 -2
- package/navigationUtils/xrayNavigator.ts +12 -0
- package/numberUtils/__tests__/isMinusZero.test.ts +20 -0
- package/numberUtils/__tests__/isZero.test.ts +27 -0
- package/numberUtils/__tests__/requireNumber.test.ts +50 -0
- package/numberUtils/__tests__/toNumber.test.ts +27 -0
- package/numberUtils/__tests__/toNumberWithDefault.test.ts +64 -0
- package/numberUtils/__tests__/toNumberWithDefaultZero.test.ts +48 -0
- package/numberUtils/index.ts +29 -10
- package/package.json +3 -2
- package/playerUtils/PlayerTTS/PlayerTTS.ts +1 -1
- package/playerUtils/__tests__/contentDataKeys.test.ts +297 -0
- package/playerUtils/__tests__/resolvePlayerActions.test.ts +138 -0
- package/playerUtils/__tests__/resolvePlayerTitleSubtitle.test.ts +180 -0
- package/playerUtils/contentDataKeys.ts +134 -0
- package/playerUtils/imaScriptDom.ts +1 -1
- package/playerUtils/index.ts +37 -16
- package/playerUtils/isAudioItem.ts +26 -0
- package/playerUtils/resolvePlayerActions.ts +71 -0
- package/playerUtils/resolvePlayerTitleSubtitle.ts +76 -0
- package/playerUtils/useValidatePlayerConfig.tsx +1 -1
- package/pluginUtils/__tests__/pluginUtils.test.js +32 -0
- package/pluginUtils/index.ts +29 -0
- package/pluginUtils/logger.ts +2 -2
- package/quickBrickAssets/__tests__/index.test.ts +18 -0
- package/quickBrickAssets/index.ts +35 -0
- package/reactHooks/__tests__/getPluginConfiguration.test.ts +82 -0
- package/reactHooks/actions/index.ts +124 -3
- package/reactHooks/cell-click/__tests__/index.test.js +64 -0
- package/reactHooks/cell-click/index.ts +24 -17
- package/reactHooks/connection/index.tsx +8 -5
- package/reactHooks/feed/__tests__/feedInvalidation.test.tsx +338 -0
- package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +8 -2
- package/reactHooks/feed/__tests__/useInflatedUrl.test.tsx +25 -0
- package/reactHooks/feed/__tests__/useMarkPipesDataStale.test.tsx +243 -0
- package/reactHooks/feed/useBuildPipesUrl.ts +5 -2
- package/reactHooks/feed/useFeedLoader.tsx +30 -3
- package/reactHooks/feed/useLoadPipesDataDispatch.ts +12 -11
- package/reactHooks/feed/useMarkPipesDataStale.ts +68 -23
- package/reactHooks/hookModal/hooks/useHookModalScreenData.ts +5 -2
- package/reactHooks/index.ts +2 -0
- package/reactHooks/layout/index.ts +1 -1
- package/reactHooks/logger.ts +5 -2
- package/reactHooks/navigation/__mocks__/index.ts +4 -0
- package/reactHooks/navigation/__tests__/index.test.tsx +176 -1
- package/reactHooks/navigation/__tests__/useIsScreenActive.test.ts +42 -0
- package/reactHooks/navigation/__tests__/usePresentScreen.test.ts +154 -0
- package/reactHooks/navigation/index.ts +3 -1
- package/reactHooks/navigation/useIsScreenActive.ts +29 -8
- package/reactHooks/navigation/usePresentScreen.ts +157 -0
- package/reactHooks/navigation/useRoute.ts +22 -5
- package/reactHooks/player/TVSeekControlller/TVSeekController.ts +2 -2
- package/reactHooks/screen/useScreenData.ts +2 -2
- package/reactHooks/state/useComponentScreenState.ts +1 -1
- package/reactHooks/usePluginConfiguration.ts +88 -47
- package/reactHooks/utils/__tests__/index.test.js +22 -2
- package/reactHooks/utils/index.ts +11 -1
- package/reactHooks/videoModal/hooks/useChangeOrientation.ts +1 -4
- package/reactHooks/videoModal/hooks/useVideoModalScreenData.tsx +1 -1
- package/reactUtils/createContext/helpers.ts +2 -2
- package/reactUtils/logger.ts +2 -2
- package/riverComponetsMeasurementProvider/index.tsx +8 -2
- package/storage/ScreenSingleValueProvider.ts +1 -1
- package/storage/ScreenStateMultiSelectProvider.ts +1 -1
- package/storage/StorageMultiSelectProvider.ts +1 -1
- package/storage/StorageSingleSelectProvider.ts +1 -1
- package/stringUtils/__tests__/stringUtils.test.js +42 -0
- package/stringUtils/index.ts +2 -2
- package/stylesUtils/logger.ts +2 -2
- package/uiActionsRegistrator/__tests__/resolveActionIdentifiers.test.ts +93 -0
- package/uiActionsRegistrator/__tests__/subscribe.test.ts +133 -0
- package/uiActionsRegistrator/__tests__/usableActionItems.test.ts +52 -0
- package/uiActionsRegistrator/index.ts +25 -0
- package/uiActionsRegistrator/registry.ts +351 -0
- package/uiActionsRegistrator/resolveActionIdentifiers.ts +100 -0
- package/uiActionsRegistrator/usableActionItems.ts +66 -0
- package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +2 -1
- package/zappFrameworkUtils/__tests__/localStorageHelper.test.ts +146 -0
- package/zappFrameworkUtils/localStorageHelper.ts +19 -15
- package/zappFrameworkUtils/loginPluginUtils.ts +2 -1
- package/zappFrameworkUtils/presentPluginOneTime.ts +2 -1
- package/appUtils/contextKeysManager/__tests__/getKey/success/byReference.test.ts +0 -56
- package/appUtils/contextKeysManager/__tests__/getKeyByReference/failure.test.ts +0 -265
- package/appUtils/contextKeysManager/__tests__/getKeyByReference/success.test.ts +0 -303
- package/appUtils/contextKeysManager/__tests__/removeReferenceForKey/failure.test.ts +0 -82
- package/appUtils/contextKeysManager/__tests__/removeReferenceForKey/success.test.ts +0 -41
- package/appUtils/contextKeysManager/__tests__/setKey/success/saveItemButNotReference.test.ts +0 -208
- package/appUtils/contextKeysManager/__tests__/setReferenceForKey/failure.test.ts +0 -93
- package/appUtils/contextKeysManager/__tests__/setReferenceForKey/success.test.ts +0 -45
- package/appUtils/playerManager/usePlayerTitleSummaryOverlay.tsx +0 -56
- package/playerUtils/__tests__/getPlayerActionButtons.test.ts +0 -54
- package/playerUtils/getPlayerActionButtons.ts +0 -17
- /package/reactHooks/actions/__tests__/{index.test.js → index.test.tsx} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="@applicaster/applicaster-types" />
|
|
2
|
+
import { sessionStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/SessionStorage";
|
|
3
|
+
import { batchSave } from "../../zappFrameworkUtils/localStorageHelper";
|
|
4
|
+
import { ActionResult } from "../ActionExecutor";
|
|
5
|
+
import { ActionHandler } from "../types";
|
|
6
|
+
import { StorageSetOptions } from "./localStorageSet";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Saves values to session storage organized by namespaces.
|
|
10
|
+
* The values persist only for the current app session.
|
|
11
|
+
*/
|
|
12
|
+
export const sessionStorageSetAction: ActionHandler<StorageSetOptions> = async (
|
|
13
|
+
action
|
|
14
|
+
): Promise<ActionResult> => {
|
|
15
|
+
const namespaces = (action.options as StorageSetOptions).content;
|
|
16
|
+
await batchSave(namespaces, sessionStorage);
|
|
17
|
+
// TODO: Add support for ownershipKey and ownershipNamespace
|
|
18
|
+
|
|
19
|
+
return ActionResult.Success;
|
|
20
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="@applicaster/applicaster-types" />
|
|
2
|
+
import { sessionStorageToggleFlag } from "../StorageActions";
|
|
3
|
+
import { ActionResult } from "../ActionExecutor";
|
|
4
|
+
import { ActionHandler, ActionExecutionContext } from "../types";
|
|
5
|
+
import { StorageToggleFlagOptions } from "./localStorageToggleFlag";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Toggles a flag in session storage (adds or removes an item from a collection).
|
|
9
|
+
* Values persist only for the current app session.
|
|
10
|
+
*/
|
|
11
|
+
export const sessionStorageToggleFlagAction: ActionHandler<
|
|
12
|
+
StorageToggleFlagOptions
|
|
13
|
+
> = async (action, context?: ActionExecutionContext): Promise<ActionResult> => {
|
|
14
|
+
return await sessionStorageToggleFlag(context, action);
|
|
15
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/// <reference types="@applicaster/applicaster-types" />
|
|
2
|
+
import { showAlertDialog } from "../../alertUtils";
|
|
3
|
+
import { ActionResult } from "../ActionExecutor";
|
|
4
|
+
import { ActionHandler } from "../types";
|
|
5
|
+
import { createLogger } from "../../logger";
|
|
6
|
+
|
|
7
|
+
const { log_info } = createLogger({
|
|
8
|
+
subsystem: "core/actions",
|
|
9
|
+
category: "ActionExecutor",
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Options for the showAlert action.
|
|
14
|
+
*/
|
|
15
|
+
export interface ShowAlertOptions {
|
|
16
|
+
/** Dialog title (required) */
|
|
17
|
+
title: string;
|
|
18
|
+
|
|
19
|
+
/** Dialog message */
|
|
20
|
+
message?: string;
|
|
21
|
+
|
|
22
|
+
/** Dismiss button text. Defaults to "OK" */
|
|
23
|
+
okButtonText?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Tells the user something and waits for them to acknowledge it.
|
|
28
|
+
*
|
|
29
|
+
* One button, because there is nothing to decide. Use `confirmDialog` when the
|
|
30
|
+
* user is choosing between going on and backing out; a `confirmDialog` without
|
|
31
|
+
* a cancel label still renders two buttons, the second one blank.
|
|
32
|
+
*
|
|
33
|
+
* Always resolves to Success: dismissing a notice is not a cancellation, so the
|
|
34
|
+
* rest of the chain runs.
|
|
35
|
+
*/
|
|
36
|
+
export const showAlertAction: ActionHandler<ShowAlertOptions> = async (
|
|
37
|
+
action
|
|
38
|
+
): Promise<ActionResult> => {
|
|
39
|
+
log_info("handleAction: showAlert event");
|
|
40
|
+
|
|
41
|
+
const options = action.options as ShowAlertOptions;
|
|
42
|
+
|
|
43
|
+
return new Promise<ActionResult>((resolve) => {
|
|
44
|
+
showAlertDialog({
|
|
45
|
+
title: options?.title,
|
|
46
|
+
message: options?.message,
|
|
47
|
+
okButtonText: options?.okButtonText || "OK",
|
|
48
|
+
completion: () => resolve(ActionResult.Success),
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/// <reference types="@applicaster/applicaster-types" />
|
|
2
|
+
import { ActionResult } from "../ActionExecutor";
|
|
3
|
+
import { ActionHandler } from "../types";
|
|
4
|
+
import { postEvent } from "../../reactHooks/useSubscriberFor";
|
|
5
|
+
|
|
6
|
+
export const CONFIRMATION_TOAST_SOURCE = "confirmation";
|
|
7
|
+
|
|
8
|
+
export const CONFIRMATION_TOAST_DEFAULT_TIMEOUT = 5000;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Shows a mobile confirmation toast with Theme defaults from
|
|
12
|
+
* `Confirmation Toast / Message` in the base theme plugin.
|
|
13
|
+
*
|
|
14
|
+
* This action is confirmation-only by design: it always stamps
|
|
15
|
+
* `source: "confirmation"` (so Theme confirmation styles apply) and defaults
|
|
16
|
+
* `timeout` to 5000 ms. Non-confirmation toasts (e.g. Offline Experience)
|
|
17
|
+
* must post on the shared `"showToast"` event bus directly and omit `source`.
|
|
18
|
+
* Callers may override individual style fields; Theme supplies the rest.
|
|
19
|
+
*
|
|
20
|
+
* @example From React via ActionExecutorContext
|
|
21
|
+
* ```tsx
|
|
22
|
+
* import React, { useContext } from "react";
|
|
23
|
+
* import { ActionExecutorContext } from "@applicaster/zapp-react-native-utils/actionsExecutor/ActionExecutorContext";
|
|
24
|
+
*
|
|
25
|
+
* function QueueButton() {
|
|
26
|
+
* const { handleAction } = useContext(ActionExecutorContext);
|
|
27
|
+
*
|
|
28
|
+
* const onPress = () => {
|
|
29
|
+
* void handleAction({
|
|
30
|
+
* type: "showToast",
|
|
31
|
+
* options: { message: "Added to queue" },
|
|
32
|
+
* });
|
|
33
|
+
* };
|
|
34
|
+
*
|
|
35
|
+
* return <Button onPress={onPress} title="Add to queue" />;
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example From code via the actionExecutor singleton
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { actionExecutor } from "@applicaster/zapp-react-native-utils/actionsExecutor/ActionExecutor";
|
|
42
|
+
*
|
|
43
|
+
* await actionExecutor.handleAction({
|
|
44
|
+
* type: "showToast",
|
|
45
|
+
* options: {
|
|
46
|
+
* message: "Playlist created",
|
|
47
|
+
* style: { backgroundColor: "#00AA55" }, // optional partial override
|
|
48
|
+
* },
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example From entry / pipes actions JSON
|
|
53
|
+
* ```json
|
|
54
|
+
* {
|
|
55
|
+
* "type": "showToast",
|
|
56
|
+
* "options": {
|
|
57
|
+
* "message": "Item removed from playlist"
|
|
58
|
+
* }
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export interface ShowToastActionOptions {
|
|
63
|
+
id?: string;
|
|
64
|
+
message?: string;
|
|
65
|
+
extraMessage?: string;
|
|
66
|
+
style?: any;
|
|
67
|
+
timeout?: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const showToastAction: ActionHandler<ShowToastActionOptions> = async (
|
|
71
|
+
action
|
|
72
|
+
): Promise<ActionResult> => {
|
|
73
|
+
const options = action?.options;
|
|
74
|
+
|
|
75
|
+
postEvent("showToast", [
|
|
76
|
+
{
|
|
77
|
+
id: options?.id,
|
|
78
|
+
message: options?.message,
|
|
79
|
+
extraMessage: options?.extraMessage,
|
|
80
|
+
style: options?.style,
|
|
81
|
+
timeout: options?.timeout ?? CONFIRMATION_TOAST_DEFAULT_TIMEOUT,
|
|
82
|
+
source: CONFIRMATION_TOAST_SOURCE,
|
|
83
|
+
},
|
|
84
|
+
]);
|
|
85
|
+
|
|
86
|
+
return ActionResult.Success;
|
|
87
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/// <reference types="@applicaster/applicaster-types" />
|
|
2
|
+
import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
|
|
3
|
+
import * as QuickBrickManager from "@applicaster/zapp-react-native-bridge/QuickBrick";
|
|
4
|
+
import { QUICK_BRICK_EVENTS } from "@applicaster/zapp-react-native-bridge/QuickBrick";
|
|
5
|
+
import { ACTIVE_LAYOUT_ID_STORAGE_KEY } from "@applicaster/quick-brick-core/App/remoteContextReloader/consts";
|
|
6
|
+
import { ActionResult } from "../ActionExecutor";
|
|
7
|
+
import { ActionHandler } from "../types";
|
|
8
|
+
import { createLogger } from "../../logger";
|
|
9
|
+
|
|
10
|
+
const { log_info } = createLogger({
|
|
11
|
+
subsystem: "core/actions",
|
|
12
|
+
category: "ActionExecutor",
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Options for the switchLayout action.
|
|
17
|
+
*/
|
|
18
|
+
export interface SwitchLayoutOptions {
|
|
19
|
+
/** The ID of the layout to switch to */
|
|
20
|
+
layoutId: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Switches the active layout and triggers an app reload.
|
|
25
|
+
* Saves the new layout ID to local storage before reloading.
|
|
26
|
+
*/
|
|
27
|
+
export const switchLayoutAction: ActionHandler<SwitchLayoutOptions> = async (
|
|
28
|
+
action
|
|
29
|
+
): Promise<ActionResult> => {
|
|
30
|
+
log_info("handleAction: switchLayout event");
|
|
31
|
+
|
|
32
|
+
await localStorage.setItem(
|
|
33
|
+
ACTIVE_LAYOUT_ID_STORAGE_KEY,
|
|
34
|
+
action.options.layoutId
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
QuickBrickManager.sendQuickBrickEvent(QUICK_BRICK_EVENTS.FORCE_APP_RELOAD);
|
|
38
|
+
|
|
39
|
+
return ActionResult.Success;
|
|
40
|
+
};
|
|
@@ -2,3 +2,30 @@ export const TOGGLE_FLAG_MAX_ITEMS_REACHED_EVENT =
|
|
|
2
2
|
"action.localStorageToggleFlag.maxItemsReached";
|
|
3
3
|
|
|
4
4
|
export const ACTION_EXECUTOR_EVENT_SOURCE = "ActionExecutor";
|
|
5
|
+
|
|
6
|
+
export const ACTION_TYPES = {
|
|
7
|
+
OPEN_BOTTOM_SHEET: "openBottomSheet",
|
|
8
|
+
DISMISS_BOTTOM_SHEET: "dismissBottomSheet",
|
|
9
|
+
PRESENT_SUB_MENU: "presentSubMenu",
|
|
10
|
+
SEND_CLOUD_EVENT: "sendCloudEvent",
|
|
11
|
+
NAVIGATE_TO_SCREEN: "navigateToScreen",
|
|
12
|
+
PRESENT_SCREEN: "presentScreen",
|
|
13
|
+
GO_BACK: "goBack",
|
|
14
|
+
GO_HOME: "goHome",
|
|
15
|
+
SHOW_TOAST: "showToast",
|
|
16
|
+
LOCAL_STORAGE_SET: "localStorageSet",
|
|
17
|
+
LOCAL_STORAGE_REMOVE: "localStorageRemove",
|
|
18
|
+
LOCAL_STORAGE_TOGGLE_FLAG: "localStorageToggleFlag",
|
|
19
|
+
SESSION_STORAGE_SET: "sessionStorageSet",
|
|
20
|
+
SESSION_STORAGE_REMOVE: "sessionStorageRemove",
|
|
21
|
+
SESSION_STORAGE_TOGGLE_FLAG: "sessionStorageToggleFlag",
|
|
22
|
+
REFRESH_COMPONENT: "refreshComponent",
|
|
23
|
+
SWITCH_LAYOUT: "switchLayout",
|
|
24
|
+
APP_RESTART: "appRestart",
|
|
25
|
+
CONFIRM_DIALOG: "confirmDialog",
|
|
26
|
+
SHOW_ALERT: "showAlert",
|
|
27
|
+
SCREEN_SET_VARIABLE: "screenSetVariable",
|
|
28
|
+
SCREEN_TOGGLE_FLAG: "screenToggleFlag",
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
31
|
+
export type KnownActionType = (typeof ACTION_TYPES)[keyof typeof ACTION_TYPES];
|
|
@@ -3,8 +3,8 @@ import { getNamespaceAndKey } from "../appUtils/contextKeysManager/utils";
|
|
|
3
3
|
import { createLogger } from "../logger";
|
|
4
4
|
|
|
5
5
|
const { log_error, log_verbose } = createLogger({
|
|
6
|
-
subsystem: "
|
|
7
|
-
category: "
|
|
6
|
+
subsystem: "network/feed",
|
|
7
|
+
category: "FeedDecorator",
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
function getScope(scope) {
|
|
@@ -47,6 +47,11 @@ function makeMultiSelect(feed: ZappFeed, key, decoratedFeed) {
|
|
|
47
47
|
? "sessionStorageToggleFlag"
|
|
48
48
|
: "localStorageToggleFlag";
|
|
49
49
|
|
|
50
|
+
// the toggle actions read their limit from their own options
|
|
51
|
+
const maxItems = Number(
|
|
52
|
+
decoratedFeed.extensions?.preference_editor_options?.max_items
|
|
53
|
+
);
|
|
54
|
+
|
|
50
55
|
decoratedFeed.entry?.forEach((entry: ZappEntry) => {
|
|
51
56
|
entry.type.value = "action";
|
|
52
57
|
entry.id = entry.extensions?.tag || entry.id;
|
|
@@ -59,6 +64,7 @@ function makeMultiSelect(feed: ZappFeed, key, decoratedFeed) {
|
|
|
59
64
|
type: actionType,
|
|
60
65
|
options: {
|
|
61
66
|
key,
|
|
67
|
+
...(maxItems > 0 && { max_items: maxItems }),
|
|
62
68
|
},
|
|
63
69
|
},
|
|
64
70
|
],
|
|
@@ -159,13 +165,13 @@ export const decorateFeed = (feed: ZappFeed) => {
|
|
|
159
165
|
|
|
160
166
|
const decoratedFeed = R.clone(feed);
|
|
161
167
|
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
168
|
+
const selectMode =
|
|
169
|
+
feed.extensions?.preference_editor_options?.select_mode ||
|
|
170
|
+
feed.extensions?.behavior?.select_mode;
|
|
165
171
|
|
|
166
|
-
if (
|
|
172
|
+
if (selectMode === "single") {
|
|
167
173
|
return makeSingleSelect(feed, key, decoratedFeed);
|
|
168
|
-
} else {
|
|
169
|
-
return makeMultiSelect(feed, key, decoratedFeed);
|
|
170
174
|
}
|
|
175
|
+
|
|
176
|
+
return makeMultiSelect(feed, key, decoratedFeed);
|
|
171
177
|
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/// <reference types="@applicaster/applicaster-types" />
|
|
2
|
+
import { ActionResult } from "./ActionExecutor";
|
|
3
|
+
import { useScreenStateStore } from "../reactHooks/navigation/useScreenStateStore";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base context object passed to action handlers during execution.
|
|
7
|
+
* Contains references to the current entry, screen, and other execution state.
|
|
8
|
+
*/
|
|
9
|
+
export interface ActionExecutionContext {
|
|
10
|
+
/** The entry associated with this action (e.g., the item that was tapped) */
|
|
11
|
+
entry?: ZappEntry;
|
|
12
|
+
|
|
13
|
+
/** The current screen/river data */
|
|
14
|
+
screenData?: ZappRiver;
|
|
15
|
+
|
|
16
|
+
/** The entry that defines the screen (if screen was opened from an entry) */
|
|
17
|
+
screenEntry?: ZappEntry;
|
|
18
|
+
|
|
19
|
+
/** The UI component that triggered the action.
|
|
20
|
+
* From UIComponentContext as `{ ...component, parent }`.
|
|
21
|
+
*/
|
|
22
|
+
component?: ZappUIComponent & { parent?: ZappUIComponent };
|
|
23
|
+
|
|
24
|
+
/** The route identifier for the current screen */
|
|
25
|
+
screenRoute?: string;
|
|
26
|
+
|
|
27
|
+
/** The screen state store for managing screen-level state (Zustand store) */
|
|
28
|
+
screenStateStore?: ReturnType<typeof useScreenStateStore>;
|
|
29
|
+
|
|
30
|
+
/** Context entry for additional data */
|
|
31
|
+
entryContext?: ZappEntry;
|
|
32
|
+
|
|
33
|
+
/** Callback function for action completion */
|
|
34
|
+
callback?: (result: { success: boolean; error: any; abort: boolean }) => void;
|
|
35
|
+
|
|
36
|
+
screenState?: Record<any, any>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Type for action handler functions.
|
|
41
|
+
* Handlers receive the action (which may have typed options) and execution context.
|
|
42
|
+
*
|
|
43
|
+
* @template _TOptions - Optional type hint for the action's options object (for documentation/intellisense)
|
|
44
|
+
* @param action - The action to execute
|
|
45
|
+
* @param context - The execution context
|
|
46
|
+
* @returns A promise that resolves to the action result
|
|
47
|
+
*/
|
|
48
|
+
export type ActionHandler<_TOptions = any> = (
|
|
49
|
+
action: ActionType,
|
|
50
|
+
context?: ActionExecutionContext
|
|
51
|
+
) => Promise<ActionResult>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Factory function that creates an action handler.
|
|
55
|
+
* Used for actions that need to capture dependencies at registration time.
|
|
56
|
+
*/
|
|
57
|
+
export type ActionHandlerFactory<_TOptions = any> = (
|
|
58
|
+
...dependencies: any[]
|
|
59
|
+
) => ActionHandler<_TOptions>;
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "../appUtils/playerManager";
|
|
9
9
|
import { Player } from "../appUtils/playerManager/player";
|
|
10
10
|
import { AnalyticPlayerListener } from "./AnalyticPlayerListener";
|
|
11
|
-
import { PlayerRole } from "../appUtils/playerManager/
|
|
11
|
+
import { PlayerRole } from "../appUtils/playerManager/const";
|
|
12
12
|
|
|
13
13
|
enum PlayerAnalyticsTrackerType {
|
|
14
14
|
PlayerAnalyticsTracker = "PlayerAnalyticsTracker",
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { PlayerAnalyticsTracker } from "../playerAnalyticsTracker";
|
|
2
|
+
import { PLAYBACK_EVENT } from "../events";
|
|
3
|
+
|
|
4
|
+
const mockPostAnalyticEvent = jest.fn();
|
|
5
|
+
|
|
6
|
+
jest.mock("../manager", () => ({
|
|
7
|
+
postAnalyticEvent: (...args) => mockPostAnalyticEvent(...args),
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
describe("Player Analytics Safeguards against nativeEvent leakage", () => {
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
jest.clearAllMocks();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const mockEntry = {
|
|
16
|
+
id: "vod_123",
|
|
17
|
+
title: "Test Video",
|
|
18
|
+
type: { value: "video" },
|
|
19
|
+
content: { type: "video/mp4" },
|
|
20
|
+
extensions: { duration: 120 },
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const mockPlayer = {
|
|
24
|
+
playerPluginId: "quick_brick_player",
|
|
25
|
+
getEntry: () => mockEntry,
|
|
26
|
+
getState: () => ({ isPaused: false, contentPosition: 0.63 }),
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
it("omits nativeEvent from analytics payload if present in eventData", () => {
|
|
30
|
+
const tracker = new PlayerAnalyticsTracker();
|
|
31
|
+
tracker.setPlayer(mockPlayer as any);
|
|
32
|
+
|
|
33
|
+
const payload = tracker.prepareAnalyticPayload(PLAYBACK_EVENT.play, {
|
|
34
|
+
nativeEvent: { currentTime: 0.63, reason: "video_ready" },
|
|
35
|
+
player_type: "quick_brick_player",
|
|
36
|
+
} as any);
|
|
37
|
+
|
|
38
|
+
expect(payload.nativeEvent).toBeUndefined();
|
|
39
|
+
expect(payload.media_id).toBe("vod_123");
|
|
40
|
+
expect(payload.name).toBe("Test Video");
|
|
41
|
+
expect(payload.player_type).toBe("quick_brick_player");
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("properly prepares payload when eventData is unwrapped", () => {
|
|
45
|
+
const tracker = new PlayerAnalyticsTracker();
|
|
46
|
+
tracker.setPlayer(mockPlayer as any);
|
|
47
|
+
|
|
48
|
+
const payload = tracker.prepareAnalyticPayload(PLAYBACK_EVENT.play, {
|
|
49
|
+
currentTime: 0.63,
|
|
50
|
+
reason: "video_ready",
|
|
51
|
+
player_type: "quick_brick_player",
|
|
52
|
+
} as any);
|
|
53
|
+
|
|
54
|
+
expect(payload.nativeEvent).toBeUndefined();
|
|
55
|
+
expect(payload.currentTime).toBeUndefined();
|
|
56
|
+
expect(payload.current_position).toBe(0.63);
|
|
57
|
+
expect(payload.reason).toBe("video_ready");
|
|
58
|
+
expect(payload.media_id).toBe("vod_123");
|
|
59
|
+
expect(payload.name).toBe("Test Video");
|
|
60
|
+
expect(payload.player_type).toBe("quick_brick_player");
|
|
61
|
+
});
|
|
62
|
+
});
|
package/analyticsUtils/logger.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { subsystemLogger } from "../logger";
|
|
2
2
|
|
|
3
|
-
export const analyticsUtilsLogger =
|
|
3
|
+
export const analyticsUtilsLogger = subsystemLogger(
|
|
4
|
+
"analytics/utils",
|
|
5
|
+
"AnalyticsUtils"
|
|
6
|
+
);
|
|
4
7
|
|
|
5
8
|
export const log_verbose = (message, data: any = null) => {
|
|
6
9
|
analyticsUtilsLogger.log({
|
|
@@ -37,5 +40,7 @@ export const log_error = (message, data: any = null) => {
|
|
|
37
40
|
});
|
|
38
41
|
};
|
|
39
42
|
|
|
40
|
-
export const playerAnalyticsLogger =
|
|
41
|
-
|
|
43
|
+
export const playerAnalyticsLogger = subsystemLogger(
|
|
44
|
+
"analytics/player",
|
|
45
|
+
"PlayerAnalytics"
|
|
46
|
+
);
|
|
@@ -498,6 +498,15 @@ export function HooksManager({
|
|
|
498
498
|
presentUI
|
|
499
499
|
);
|
|
500
500
|
} catch (e) {
|
|
501
|
+
// Without this the failure is invisible: the hook stops right after the
|
|
502
|
+
// "Executing hook" line, with nothing in the log explaining why and no
|
|
503
|
+
// remaining hook ever running.
|
|
504
|
+
logHookEvent(
|
|
505
|
+
hooksManagerLogger.error,
|
|
506
|
+
`runInBackground: hook ${hookPlugin.identifier} threw: ${e?.message}`,
|
|
507
|
+
{ hook: hookPlugin, payload, error: e, stack: e?.stack }
|
|
508
|
+
);
|
|
509
|
+
|
|
501
510
|
hookPlugin.setStateAndNotify(HOOKS_EVENTS.ERROR, {
|
|
502
511
|
error: e,
|
|
503
512
|
hookPlugin,
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { subsystemLogger } from "../../logger";
|
|
2
2
|
|
|
3
|
-
export const hooksManagerLogger =
|
|
3
|
+
export const hooksManagerLogger = subsystemLogger(
|
|
4
|
+
"core/plugins/hooks",
|
|
5
|
+
"HooksManager"
|
|
6
|
+
);
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { subsystemLogger } from "../../logger";
|
|
2
2
|
|
|
3
|
-
export const accessibilityManagerLogger =
|
|
4
|
-
"accessibilityManager"
|
|
5
|
-
);
|
|
3
|
+
export const accessibilityManagerLogger = subsystemLogger("ui/accessibility");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContextKeysManager
|
|
1
|
+
import { ContextKeysManager } from "../..";
|
|
2
2
|
|
|
3
3
|
describe("Context Keys Manager - getKey", () => {
|
|
4
4
|
it("returns null if key is invalid", async () => {
|
|
@@ -34,8 +34,6 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
34
34
|
secureStorage: mockedSecureStorage,
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
const getKeyByReference = jest.spyOn(contextManager, "getKeyByReference");
|
|
38
|
-
|
|
39
37
|
// run
|
|
40
38
|
const result = await contextManager.getKey(invalidKey);
|
|
41
39
|
|
|
@@ -46,11 +44,10 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
46
44
|
|
|
47
45
|
expect(mockedLogger.warn).toHaveBeenCalledWith({
|
|
48
46
|
message:
|
|
49
|
-
"Provided key is not valid -
|
|
47
|
+
"Provided key is not valid - expecting an object with namespace and key properties",
|
|
50
48
|
data: { key: invalidKey },
|
|
51
49
|
});
|
|
52
50
|
|
|
53
|
-
expect(getKeyByReference).not.toHaveBeenCalled();
|
|
54
51
|
expect(mockedSessionStorage.getItem).not.toHaveBeenCalled();
|
|
55
52
|
expect(mockedLocalStorage.getItem).not.toHaveBeenCalled();
|
|
56
53
|
expect(mockedSecureStorage.getItem).not.toHaveBeenCalled();
|
|
@@ -90,10 +87,6 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
90
87
|
secureStorage: mockedSecureStorage,
|
|
91
88
|
});
|
|
92
89
|
|
|
93
|
-
const getKeyByReference = jest
|
|
94
|
-
.spyOn(contextManager, "getKeyByReference")
|
|
95
|
-
.mockResolvedValueOnce(NOTHING);
|
|
96
|
-
|
|
97
90
|
// run
|
|
98
91
|
const result = await contextManager.getKey(key);
|
|
99
92
|
|
|
@@ -107,8 +100,6 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
107
100
|
data: { key },
|
|
108
101
|
});
|
|
109
102
|
|
|
110
|
-
expect(getKeyByReference).toHaveBeenCalledWith("key", "namespace");
|
|
111
|
-
|
|
112
103
|
expect(mockedSessionStorage.getItem).toHaveBeenCalledWith(
|
|
113
104
|
"key",
|
|
114
105
|
"namespace"
|
|
@@ -152,10 +143,6 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
152
143
|
secureStorage: mockedSecureStorage,
|
|
153
144
|
});
|
|
154
145
|
|
|
155
|
-
const getKeyByReference = jest
|
|
156
|
-
.spyOn(contextManager, "getKeyByReference")
|
|
157
|
-
.mockResolvedValueOnce(NOTHING);
|
|
158
|
-
|
|
159
146
|
// run
|
|
160
147
|
const result = await contextManager.getKey(key);
|
|
161
148
|
|
|
@@ -169,8 +156,6 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
169
156
|
data: { key },
|
|
170
157
|
});
|
|
171
158
|
|
|
172
|
-
expect(getKeyByReference).toHaveBeenCalledWith("key", "namespace");
|
|
173
|
-
|
|
174
159
|
expect(mockedSessionStorage.getItem).toHaveBeenCalledWith(
|
|
175
160
|
"key",
|
|
176
161
|
"namespace"
|
|
@@ -214,10 +199,6 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
214
199
|
secureStorage: mockedSecureStorage,
|
|
215
200
|
});
|
|
216
201
|
|
|
217
|
-
const getKeyByReference = jest
|
|
218
|
-
.spyOn(contextManager, "getKeyByReference")
|
|
219
|
-
.mockResolvedValueOnce(NOTHING);
|
|
220
|
-
|
|
221
202
|
// run
|
|
222
203
|
const result = await contextManager.getKey(key);
|
|
223
204
|
|
|
@@ -231,8 +212,6 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
231
212
|
data: { key },
|
|
232
213
|
});
|
|
233
214
|
|
|
234
|
-
expect(getKeyByReference).toHaveBeenCalledWith("key", "namespace");
|
|
235
|
-
|
|
236
215
|
expect(mockedSessionStorage.getItem).toHaveBeenCalledWith(
|
|
237
216
|
"key",
|
|
238
217
|
"namespace"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContextKeysManager
|
|
1
|
+
import { ContextKeysManager } from "../../..";
|
|
2
2
|
|
|
3
3
|
describe("Context Keys Manager - getKey", () => {
|
|
4
4
|
it("returns value if found in session-storage", async () => {
|
|
@@ -35,10 +35,6 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
35
35
|
secureStorage: mockedSecureStorage,
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
const getKeyByReference = jest
|
|
39
|
-
.spyOn(contextManager, "getKeyByReference")
|
|
40
|
-
.mockResolvedValueOnce(NOTHING);
|
|
41
|
-
|
|
42
38
|
// run
|
|
43
39
|
const result = await contextManager.getKey(key);
|
|
44
40
|
|
|
@@ -47,8 +43,6 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
47
43
|
|
|
48
44
|
expect(mockedLogger.warn).not.toHaveBeenCalled();
|
|
49
45
|
|
|
50
|
-
expect(getKeyByReference).toHaveBeenCalledWith("key", "namespace");
|
|
51
|
-
|
|
52
46
|
expect(mockedSessionStorage.getItem).toHaveBeenCalledWith(
|
|
53
47
|
"key",
|
|
54
48
|
"namespace"
|
|
@@ -92,10 +86,6 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
92
86
|
secureStorage: mockedSecureStorage,
|
|
93
87
|
});
|
|
94
88
|
|
|
95
|
-
const getKeyByReference = jest
|
|
96
|
-
.spyOn(contextManager, "getKeyByReference")
|
|
97
|
-
.mockResolvedValueOnce(NOTHING);
|
|
98
|
-
|
|
99
89
|
// run
|
|
100
90
|
const result = await contextManager.getKey(key);
|
|
101
91
|
|
|
@@ -104,8 +94,6 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
104
94
|
|
|
105
95
|
expect(mockedLogger.warn).not.toHaveBeenCalled();
|
|
106
96
|
|
|
107
|
-
expect(getKeyByReference).toHaveBeenCalledWith("key", "namespace");
|
|
108
|
-
|
|
109
97
|
expect(mockedSessionStorage.getItem).toHaveBeenCalledWith(
|
|
110
98
|
"key",
|
|
111
99
|
"namespace"
|
|
@@ -149,10 +137,6 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
149
137
|
secureStorage: mockedSecureStorage,
|
|
150
138
|
});
|
|
151
139
|
|
|
152
|
-
const getKeyByReference = jest
|
|
153
|
-
.spyOn(contextManager, "getKeyByReference")
|
|
154
|
-
.mockResolvedValueOnce(NOTHING);
|
|
155
|
-
|
|
156
140
|
// run
|
|
157
141
|
const result = await contextManager.getKey(key);
|
|
158
142
|
|
|
@@ -161,8 +145,6 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
161
145
|
|
|
162
146
|
expect(mockedLogger.warn).not.toHaveBeenCalled();
|
|
163
147
|
|
|
164
|
-
expect(getKeyByReference).toHaveBeenCalledWith("key", "namespace");
|
|
165
|
-
|
|
166
148
|
expect(mockedSessionStorage.getItem).toHaveBeenCalledWith(
|
|
167
149
|
"key",
|
|
168
150
|
"namespace"
|
|
@@ -209,10 +191,6 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
209
191
|
secureStorage: mockedSecureStorage,
|
|
210
192
|
});
|
|
211
193
|
|
|
212
|
-
const getKeyByReference = jest
|
|
213
|
-
.spyOn(contextManager, "getKeyByReference")
|
|
214
|
-
.mockResolvedValueOnce(NOTHING);
|
|
215
|
-
|
|
216
194
|
// run
|
|
217
195
|
const result = await contextManager.getKey(key);
|
|
218
196
|
|
|
@@ -221,8 +199,6 @@ describe("Context Keys Manager - getKey", () => {
|
|
|
221
199
|
|
|
222
200
|
expect(mockedLogger.warn).not.toHaveBeenCalled();
|
|
223
201
|
|
|
224
|
-
expect(getKeyByReference).toHaveBeenCalledWith("key", "namespace");
|
|
225
|
-
|
|
226
202
|
expect(mockedSessionStorage.getItem).toHaveBeenCalledWith(
|
|
227
203
|
"key",
|
|
228
204
|
"namespace"
|