@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,167 @@
|
|
|
1
|
+
/// <reference types="@applicaster/applicaster-types" />
|
|
2
|
+
import { createLogger } from "../logger";
|
|
3
|
+
import { ActionExecutionContext } from "../actionsExecutor/types";
|
|
4
|
+
import { RegisteredAction } from "../uiActionsRegistrator";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
resolveButtonAsset,
|
|
8
|
+
resolveButtonLabel,
|
|
9
|
+
resolveExplicitLabel,
|
|
10
|
+
} from "./aliasPresentation";
|
|
11
|
+
import { EntryAction, EntryActionDeps } from "./types";
|
|
12
|
+
|
|
13
|
+
const { log_info, log_warning, log_error } = createLogger({
|
|
14
|
+
subsystem: "core/actions",
|
|
15
|
+
category: "EntryAction",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const ENTRY_ACTION_IDENTIFIER_PREFIX = "entry_action";
|
|
19
|
+
|
|
20
|
+
/** True for actions inflated from `entry.extensions.entry_action`. */
|
|
21
|
+
export function isEntryAction(item: RegisteredAction): boolean {
|
|
22
|
+
return item?.source === "entry";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function isValidEntryAction(value: unknown): value is EntryAction {
|
|
26
|
+
if (typeof value !== "object" || value === null) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const { button, actions } = value as EntryAction;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
(typeof button?.title === "string" ||
|
|
34
|
+
typeof button?.label === "string" ||
|
|
35
|
+
typeof button?.alias === "string") &&
|
|
36
|
+
Array.isArray(actions)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function createEntryAction(
|
|
41
|
+
entryAction: EntryAction,
|
|
42
|
+
index: number,
|
|
43
|
+
entry: ZappEntry | ZappFeed,
|
|
44
|
+
deps: EntryActionDeps
|
|
45
|
+
): RegisteredAction {
|
|
46
|
+
const { button, actions, dismiss_on_action } = entryAction;
|
|
47
|
+
|
|
48
|
+
const identifier = `${ENTRY_ACTION_IDENTIFIER_PREFIX}_${index}`;
|
|
49
|
+
const primaryAction = actions.length > 0 ? actions[0] : null;
|
|
50
|
+
|
|
51
|
+
const actionState = primaryAction
|
|
52
|
+
? deps.actionExecutor?.getActionState?.(primaryAction.type, entry)
|
|
53
|
+
: null;
|
|
54
|
+
|
|
55
|
+
// An explicit title/label outranks the executor's action state; the
|
|
56
|
+
// alias-derived defaults only fill in when neither produced anything.
|
|
57
|
+
const label: CellActionEntryState["label"] =
|
|
58
|
+
resolveExplicitLabel(button) ||
|
|
59
|
+
actionState?.label ||
|
|
60
|
+
resolveButtonLabel(button, deps.aliasPresentation);
|
|
61
|
+
|
|
62
|
+
const asset: CellActionEntryState["asset"] =
|
|
63
|
+
button?.iconURL ||
|
|
64
|
+
actionState?.asset ||
|
|
65
|
+
resolveButtonAsset(button, deps.aliasPresentation);
|
|
66
|
+
|
|
67
|
+
const initialState = { state: 0, label, asset };
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
identifier,
|
|
71
|
+
source: "entry",
|
|
72
|
+
action: {
|
|
73
|
+
initialEntryState: () => initialState,
|
|
74
|
+
invokeAction: async (
|
|
75
|
+
invokedEntry: ZappEntry,
|
|
76
|
+
options: InvokeArgsOptions = {}
|
|
77
|
+
) => {
|
|
78
|
+
if (dismiss_on_action === true) {
|
|
79
|
+
options.dismiss?.();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
log_info(
|
|
83
|
+
`invokeAction: entry action "${identifier}" triggered for entry "${invokedEntry?.id}"`,
|
|
84
|
+
{ identifier, entryId: invokedEntry?.id, actionCount: actions.length }
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
// Both of these leave the user with a button that does nothing when
|
|
88
|
+
// tapped, and neither throws, so they would otherwise be invisible.
|
|
89
|
+
if (actions.length === 0) {
|
|
90
|
+
log_warning(
|
|
91
|
+
`invokeAction: entry action "${identifier}" on entry "${invokedEntry?.id}" declares no actions - the tap does nothing`,
|
|
92
|
+
{ identifier, entryId: invokedEntry?.id }
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (typeof deps.actionExecutor?.handleActions !== "function") {
|
|
97
|
+
log_warning(
|
|
98
|
+
`invokeAction: no action executor available for entry action "${identifier}" - the tap does nothing`,
|
|
99
|
+
{ identifier, entryId: invokedEntry?.id }
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
try {
|
|
104
|
+
await deps.actionExecutor?.handleActions(actions, {
|
|
105
|
+
entry: invokedEntry,
|
|
106
|
+
entryContext: invokedEntry,
|
|
107
|
+
...deps.actionContext,
|
|
108
|
+
...(options.component ? { component: options.component } : {}),
|
|
109
|
+
} as ActionExecutionContext);
|
|
110
|
+
} catch (error) {
|
|
111
|
+
log_error(
|
|
112
|
+
`invokeAction: entry action "${identifier}" failed for entry "${invokedEntry?.id}"`,
|
|
113
|
+
{
|
|
114
|
+
identifier,
|
|
115
|
+
entryId: invokedEntry?.id,
|
|
116
|
+
// Types only - the action payloads are backend supplied and may
|
|
117
|
+
// carry user data.
|
|
118
|
+
actionTypes: actions.map((action) => action?.type),
|
|
119
|
+
error,
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Builds the list of actions declared on an entry via
|
|
130
|
+
* `entry.extensions.entry_action`.
|
|
131
|
+
*/
|
|
132
|
+
export function buildEntryActions(
|
|
133
|
+
entry: ZappEntry | ZappFeed,
|
|
134
|
+
deps: EntryActionDeps
|
|
135
|
+
): RegisteredAction[] {
|
|
136
|
+
const entryId = (entry as ZappEntry)?.id;
|
|
137
|
+
const raw = (entry as any)?.extensions?.entry_action;
|
|
138
|
+
|
|
139
|
+
// Most entries simply declare no actions. This provider is resolved for
|
|
140
|
+
// every entry on every render, so saying so would drown everything else.
|
|
141
|
+
if (raw === undefined || raw === null) {
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (!Array.isArray(raw)) {
|
|
146
|
+
log_warning(
|
|
147
|
+
`buildEntryActions: entry "${entryId}" has extensions.entry_action of type ${typeof raw} instead of an array - no entry actions will be shown`,
|
|
148
|
+
{ entryId, receivedType: typeof raw }
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
return [];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const valid = raw.filter(isValidEntryAction);
|
|
155
|
+
const invalid = raw.length - valid.length;
|
|
156
|
+
|
|
157
|
+
if (invalid > 0) {
|
|
158
|
+
log_warning(
|
|
159
|
+
`buildEntryActions: ${invalid} invalid entry action(s) skipped for entry "${entryId}"`,
|
|
160
|
+
{ entryId, total: raw.length, invalid }
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return valid.map((entryAction, index) =>
|
|
165
|
+
createEntryAction(entryAction, index, entry, deps)
|
|
166
|
+
);
|
|
167
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { buildEntryActions, isEntryAction } from "./buildEntryActions";
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
resolveButtonAsset,
|
|
5
|
+
resolveButtonLabel,
|
|
6
|
+
resolveExplicitLabel,
|
|
7
|
+
} from "./aliasPresentation";
|
|
8
|
+
|
|
9
|
+
export type {
|
|
10
|
+
EntryAction,
|
|
11
|
+
EntryActionDeps,
|
|
12
|
+
EntryActionExecutionContext,
|
|
13
|
+
} from "./types";
|
|
14
|
+
|
|
15
|
+
export type { AliasPresentation } from "./aliasPresentation";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference types="@applicaster/applicaster-types" />
|
|
2
|
+
import type { ActionExecutorContextType } from "../actionsExecutor/ActionExecutorContext";
|
|
3
|
+
import type { AliasPresentation } from "./aliasPresentation";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A single action declared by the backend on an entry, under
|
|
7
|
+
* `entry.extensions.entry_action`.
|
|
8
|
+
*/
|
|
9
|
+
export type EntryAction = {
|
|
10
|
+
button: {
|
|
11
|
+
title?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
alias?: string;
|
|
14
|
+
iconURL?: string;
|
|
15
|
+
};
|
|
16
|
+
actions: ZappActionType[];
|
|
17
|
+
dismiss_on_action?: boolean;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Everything `buildEntryActions` needs from the surrounding React tree in order
|
|
22
|
+
* to execute an entry action. Supplied lazily so the registered provider always
|
|
23
|
+
* reads the freshest screen context.
|
|
24
|
+
*/
|
|
25
|
+
export type EntryActionDeps = {
|
|
26
|
+
actionExecutor: ActionExecutorContextType;
|
|
27
|
+
actionContext: EntryActionExecutionContext;
|
|
28
|
+
/** App-supplied labels/icons for backend aliases; defaults are used without it. */
|
|
29
|
+
aliasPresentation?: AliasPresentation;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** The screen the action is executed against, spread into the execution context. */
|
|
33
|
+
export type EntryActionExecutionContext = {
|
|
34
|
+
screenData?: unknown;
|
|
35
|
+
screenState?: unknown;
|
|
36
|
+
screenRoute?: string;
|
|
37
|
+
screenStateStore?: unknown;
|
|
38
|
+
screenEntry?: unknown;
|
|
39
|
+
};
|
|
@@ -224,12 +224,38 @@ class FocusManager {
|
|
|
224
224
|
|
|
225
225
|
unregisterFocusable(focusableId: string) {
|
|
226
226
|
const node = this.tree.find(focusableId);
|
|
227
|
+
const parentNode = this.tree.findParent(focusableId);
|
|
227
228
|
|
|
228
229
|
this.focusableComponents = this.focusableComponents.filter(
|
|
229
230
|
(c) => c !== node?.component
|
|
230
231
|
);
|
|
231
232
|
|
|
232
233
|
this.tree.remove(focusableId);
|
|
234
|
+
|
|
235
|
+
if (this._focusedId === focusableId) {
|
|
236
|
+
this._focusedId = null;
|
|
237
|
+
this.retainFocus(parentNode);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Empty groups drop their focusable list after the feed fails, which is
|
|
242
|
+
// after Layout's one-shot focus pass. Land on the nearest ancestor that is
|
|
243
|
+
// still mounted so key handlers keep a target.
|
|
244
|
+
private retainFocus(node: TreeNode | null) {
|
|
245
|
+
let current = node;
|
|
246
|
+
|
|
247
|
+
while (current) {
|
|
248
|
+
const ref = current.component;
|
|
249
|
+
|
|
250
|
+
if (ref?.current?.props?.id) {
|
|
251
|
+
this.setFocusLocal(ref);
|
|
252
|
+
ref.current.onFocus?.(ref.current, {}, undefined);
|
|
253
|
+
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
current = current.parentId ? this.tree.find(current.parentId) : null;
|
|
258
|
+
}
|
|
233
259
|
}
|
|
234
260
|
|
|
235
261
|
private setNextFocus(
|
|
@@ -231,6 +231,15 @@ describe("FocusManager", () => {
|
|
|
231
231
|
).toBeFalsy();
|
|
232
232
|
});
|
|
233
233
|
|
|
234
|
+
it("moves focus to the mounted parent when the focused element unregisters", () => {
|
|
235
|
+
focusManager.setFocus("child1");
|
|
236
|
+
|
|
237
|
+
focusManager.unregisterFocusable("child1");
|
|
238
|
+
|
|
239
|
+
expect(focusManager.focusedId).toBe("group");
|
|
240
|
+
expect(focusManager.focused).toBe(group.current);
|
|
241
|
+
});
|
|
242
|
+
|
|
234
243
|
it("focusManager registerFocusable should be defined", () => {
|
|
235
244
|
expect(focusManager.registerFocusable).toBeDefined();
|
|
236
245
|
});
|
package/focusManager/logger.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { getXray } from "@applicaster/zapp-react-native-utils/logger";
|
|
2
2
|
const { Logger } = getXray();
|
|
3
3
|
|
|
4
|
-
export const logger = new Logger(
|
|
5
|
-
"QuickBrick",
|
|
6
|
-
"packages/zapp-react-native-utils/focusManager/FocusManager"
|
|
7
|
-
);
|
|
4
|
+
export const logger = new Logger("FocusManager", "ui/focus");
|
package/headersUtils/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
|
|
2
2
|
import { getPlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
3
|
-
import {
|
|
3
|
+
import { subsystemLogger } from "../logger";
|
|
4
4
|
import { getUILanguage } from "../localizationUtils";
|
|
5
5
|
|
|
6
|
-
const logger =
|
|
6
|
+
const logger = subsystemLogger("network/headers", "HeadersUtils");
|
|
7
7
|
|
|
8
8
|
export const getAppDataHeaders = (screenId: string) => {
|
|
9
9
|
const appData = appStore.get("appData");
|
|
@@ -28,17 +28,23 @@ const RTL_LOCALES = [
|
|
|
28
28
|
"yi", // Yiddish
|
|
29
29
|
];
|
|
30
30
|
|
|
31
|
+
// The strings for the UI language, else the first language present
|
|
32
|
+
export const getLocalizedStrings = (
|
|
33
|
+
localizations = {},
|
|
34
|
+
languageCode = getUILanguage()
|
|
35
|
+
) =>
|
|
36
|
+
localizations?.[languageCode] ||
|
|
37
|
+
Object.values(localizations).find(
|
|
38
|
+
(value) => typeof value === "object" && value !== null
|
|
39
|
+
) ||
|
|
40
|
+
{};
|
|
41
|
+
|
|
31
42
|
export function useLocalizedStrings({ localizations = {} }) {
|
|
32
43
|
const languageCode = getUILanguage();
|
|
33
44
|
|
|
34
45
|
// TODO: probably we can call getLocalizations here from localizationsHelper.js
|
|
35
46
|
const result = useMemo(
|
|
36
|
-
() =>
|
|
37
|
-
localizations?.[languageCode] ||
|
|
38
|
-
Object.values(localizations).find(
|
|
39
|
-
(value) => typeof value === "object" && value !== null
|
|
40
|
-
) ||
|
|
41
|
-
{},
|
|
47
|
+
() => getLocalizedStrings(localizations, languageCode),
|
|
42
48
|
[languageCode, localizations]
|
|
43
49
|
);
|
|
44
50
|
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
import { XRAY_SUBSYSTEMS } from "../subsystems";
|
|
5
|
+
|
|
6
|
+
const REPO_ROOT = path.resolve(__dirname, "../../../..");
|
|
7
|
+
const SOURCE_DIRS = ["packages", "plugins"];
|
|
8
|
+
|
|
9
|
+
const SKIP_DIRS = new Set([
|
|
10
|
+
"node_modules",
|
|
11
|
+
"__tests__",
|
|
12
|
+
"__mocks__",
|
|
13
|
+
"dist",
|
|
14
|
+
"lib",
|
|
15
|
+
"android",
|
|
16
|
+
"ios",
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
// `subsystem: "x"`, `Subsystem = "x"`, `subsystemLogger("x"` and `new Logger("Category", "x"`
|
|
20
|
+
const SUBSYSTEM_LITERALS = [
|
|
21
|
+
/\bsubsystem:\s*"([^"]+)"/g,
|
|
22
|
+
/\b(?:Subsystem|SUBSYSTEM|BaseSubsystem)\s*=\s*"([^"]+)"/g,
|
|
23
|
+
/\bsubsystemLogger\(\s*"([^"]+)"/g,
|
|
24
|
+
/\bnew Logger\(\s*"[^"]*"\s*,\s*"([^"]+)"/g,
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const PLUGIN_NODE = /^plugins\/[a-z0-9_]+\/[a-z0-9_]+(\/[a-z0-9_]+)?$/;
|
|
28
|
+
|
|
29
|
+
// Native-side keys read by the X-Ray sinks, not nodes of the tree.
|
|
30
|
+
const NOT_TREE_NODES = new Set(["xray", "xray/logger"]);
|
|
31
|
+
|
|
32
|
+
// The default player moves onto the tree in its own change; its old names are not checked until then.
|
|
33
|
+
const LEFT_OUT = ["plugins/zapp-react-native-default-player/"];
|
|
34
|
+
|
|
35
|
+
const sourceFiles = (dir: string): string[] =>
|
|
36
|
+
fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
|
|
37
|
+
if (entry.isDirectory()) {
|
|
38
|
+
return SKIP_DIRS.has(entry.name)
|
|
39
|
+
? []
|
|
40
|
+
: sourceFiles(path.join(dir, entry.name));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return /\.(ts|tsx|js|jsx)$/.test(entry.name) &&
|
|
44
|
+
!entry.name.endsWith(".d.ts")
|
|
45
|
+
? [path.join(dir, entry.name)]
|
|
46
|
+
: [];
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe("X-Ray subsystems", () => {
|
|
50
|
+
it("only uses nodes of the subsystem tree", () => {
|
|
51
|
+
const known = new Set<string>(XRAY_SUBSYSTEMS);
|
|
52
|
+
const unknown: string[] = [];
|
|
53
|
+
|
|
54
|
+
SOURCE_DIRS.flatMap((dir) =>
|
|
55
|
+
sourceFiles(path.join(REPO_ROOT, dir))
|
|
56
|
+
).forEach((file) => {
|
|
57
|
+
if (
|
|
58
|
+
LEFT_OUT.some((dir) => path.relative(REPO_ROOT, file).startsWith(dir))
|
|
59
|
+
) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// commented-out code does not log
|
|
64
|
+
const text = fs.readFileSync(file, "utf8").replace(/^\s*\/\/.*$/gm, "");
|
|
65
|
+
|
|
66
|
+
SUBSYSTEM_LITERALS.forEach((pattern) => {
|
|
67
|
+
Array.from(text.matchAll(pattern)).forEach((match) => {
|
|
68
|
+
const node = match[1];
|
|
69
|
+
|
|
70
|
+
if (
|
|
71
|
+
!known.has(node) &&
|
|
72
|
+
!PLUGIN_NODE.test(node) &&
|
|
73
|
+
!NOT_TREE_NODES.has(node)
|
|
74
|
+
) {
|
|
75
|
+
unknown.push(`${path.relative(REPO_ROOT, file)}: "${node}"`);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// Add the node to the tree (xray-subsystems skill in Zapp-Frameworks) and to XRAY_SUBSYSTEMS first.
|
|
82
|
+
expect(unknown).toEqual([]);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const xray = require("@applicaster/quick-brick-xray");
|
|
2
|
+
|
|
3
|
+
const toolbox = { name: "test", description: "", tools: [] };
|
|
4
|
+
|
|
5
|
+
const load = (): typeof import("../xrayToolbox") => {
|
|
6
|
+
let module;
|
|
7
|
+
|
|
8
|
+
jest.isolateModules(() => {
|
|
9
|
+
module = require("../xrayToolbox");
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
return module;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
describe("registerXrayToolbox", () => {
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
delete xray.registerReactToolbox;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("registers once per name", async () => {
|
|
21
|
+
xray.registerReactToolbox = jest.fn().mockResolvedValue(undefined);
|
|
22
|
+
const { registerXrayToolbox } = load();
|
|
23
|
+
|
|
24
|
+
await expect(registerXrayToolbox(toolbox)).resolves.toBe(true);
|
|
25
|
+
await expect(registerXrayToolbox(toolbox)).resolves.toBe(true);
|
|
26
|
+
|
|
27
|
+
expect(xray.registerReactToolbox).toHaveBeenCalledTimes(1);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("resolves false without a toolbox API", async () => {
|
|
31
|
+
await expect(load().registerXrayToolbox(toolbox)).resolves.toBe(false);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("keeps a failed registration instead of retrying it", async () => {
|
|
35
|
+
xray.registerReactToolbox = jest
|
|
36
|
+
.fn()
|
|
37
|
+
.mockRejectedValue(new Error("XRayToolboxBridge is not available"));
|
|
38
|
+
|
|
39
|
+
const { registerXrayToolbox } = load();
|
|
40
|
+
|
|
41
|
+
await expect(registerXrayToolbox(toolbox)).resolves.toBe(false);
|
|
42
|
+
await expect(registerXrayToolbox(toolbox)).resolves.toBe(false);
|
|
43
|
+
|
|
44
|
+
expect(xray.registerReactToolbox).toHaveBeenCalledTimes(1);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("registers new tools under the same name again (Fast Refresh)", async () => {
|
|
48
|
+
xray.registerReactToolbox = jest.fn().mockResolvedValue(undefined);
|
|
49
|
+
const { registerXrayToolbox } = load();
|
|
50
|
+
|
|
51
|
+
await registerXrayToolbox(toolbox);
|
|
52
|
+
await registerXrayToolbox({ ...toolbox, tools: [] });
|
|
53
|
+
|
|
54
|
+
expect(xray.registerReactToolbox).toHaveBeenCalledTimes(2);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("stops trying every toolbox once the bridge is missing", async () => {
|
|
58
|
+
xray.registerReactToolbox = jest.fn().mockRejectedValue(new Error("no"));
|
|
59
|
+
const { registerXrayToolbox } = load();
|
|
60
|
+
|
|
61
|
+
await registerXrayToolbox(toolbox);
|
|
62
|
+
|
|
63
|
+
await expect(
|
|
64
|
+
registerXrayToolbox({ ...toolbox, name: "other" })
|
|
65
|
+
).resolves.toBe(false);
|
|
66
|
+
|
|
67
|
+
expect(xray.registerReactToolbox).toHaveBeenCalledTimes(1);
|
|
68
|
+
});
|
|
69
|
+
});
|
package/logger/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { useEffect } from "react";
|
|
|
2
2
|
import { identity } from "ramda";
|
|
3
3
|
|
|
4
4
|
import MockLogger from "./const";
|
|
5
|
+
import type { XraySubsystem } from "./subsystems";
|
|
5
6
|
|
|
6
7
|
const mockObj = new MockLogger("mock", "native-utils");
|
|
7
8
|
|
|
@@ -43,13 +44,27 @@ export const getUtilsLogger = (): XrayUtils => {
|
|
|
43
44
|
const { Logger } = xray || {};
|
|
44
45
|
|
|
45
46
|
if (xray && !Logger.mock) {
|
|
47
|
+
// A subsystem starts with its domain (xray-subsystems skill), so core and plugins are not under `app/`.
|
|
48
|
+
// The parent is only there to share the context.
|
|
46
49
|
const quickBrickLogger = new Logger("QuickBrick", "app");
|
|
47
|
-
const coreLogger =
|
|
48
|
-
const logger =
|
|
50
|
+
const coreLogger = new Logger("QuickBrick", "core", quickBrickLogger);
|
|
51
|
+
const logger = new Logger("QuickBrick", "plugins", quickBrickLogger);
|
|
49
52
|
const logLevels = Logger.logLevels;
|
|
50
|
-
const utilsLogger = coreLogger
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
const utilsLogger = coreLogger;
|
|
54
|
+
|
|
55
|
+
// A logger on a node of the tree, e.g. subsystemLogger("ui/navigation", "Navigator").
|
|
56
|
+
// The subsystem says where in the product, the category names the component or feature.
|
|
57
|
+
const subsystemLogger = (subsystem: string, category = "QuickBrick") =>
|
|
58
|
+
new Logger(category, subsystem, quickBrickLogger);
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
quickBrickLogger,
|
|
62
|
+
coreLogger,
|
|
63
|
+
logger,
|
|
64
|
+
logLevels,
|
|
65
|
+
utilsLogger,
|
|
66
|
+
subsystemLogger,
|
|
67
|
+
};
|
|
53
68
|
}
|
|
54
69
|
|
|
55
70
|
return {
|
|
@@ -58,11 +73,27 @@ export const getUtilsLogger = (): XrayUtils => {
|
|
|
58
73
|
logger: mockObj,
|
|
59
74
|
logLevels: MockLogger.logLevels,
|
|
60
75
|
utilsLogger: mockObj,
|
|
76
|
+
subsystemLogger: () => mockObj,
|
|
61
77
|
}; // TODO: check if this is the best approach
|
|
62
78
|
};
|
|
63
79
|
|
|
64
|
-
const {
|
|
65
|
-
|
|
80
|
+
const {
|
|
81
|
+
quickBrickLogger,
|
|
82
|
+
coreLogger,
|
|
83
|
+
logger,
|
|
84
|
+
logLevels,
|
|
85
|
+
utilsLogger,
|
|
86
|
+
subsystemLogger: anySubsystemLogger,
|
|
87
|
+
} = getUtilsLogger();
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* A logger on a node of the X-Ray subsystem tree (see ./subsystems), named after the component by `category`.
|
|
91
|
+
* Only nodes of the tree compile, so a new path has to be added to the list first.
|
|
92
|
+
*/
|
|
93
|
+
const subsystemLogger = anySubsystemLogger as (
|
|
94
|
+
subsystem: XraySubsystem,
|
|
95
|
+
category?: string
|
|
96
|
+
) => ReturnType<XrayUtils["subsystemLogger"]>;
|
|
66
97
|
|
|
67
98
|
/**
|
|
68
99
|
* useLogger is a React hook that can be used within the React lifecycle
|
|
@@ -133,6 +164,8 @@ const createLogger = ({
|
|
|
133
164
|
return { log_verbose, log_debug, log_info, log_error, log_warning };
|
|
134
165
|
};
|
|
135
166
|
|
|
167
|
+
export type { XraySubsystem } from "./subsystems";
|
|
168
|
+
|
|
136
169
|
export {
|
|
137
170
|
createLogger,
|
|
138
171
|
useLogger,
|
|
@@ -141,4 +174,5 @@ export {
|
|
|
141
174
|
logger,
|
|
142
175
|
logLevels,
|
|
143
176
|
utilsLogger,
|
|
177
|
+
subsystemLogger,
|
|
144
178
|
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The X-Ray subsystems QuickBrick logs to: nodes of the shared subsystem tree, not names of packages or classes.
|
|
3
|
+
* The tree and its rules are in the xray-subsystems skill of Zapp-Frameworks (plugins/quick-brick-xray).
|
|
4
|
+
* Do not invent a path at the call site: pick a node from this list, or add the node to the tree and to this list.
|
|
5
|
+
* Precision (which class, hook or feature) goes in the logger's `category`, not here.
|
|
6
|
+
*/
|
|
7
|
+
export const XRAY_SUBSYSTEMS = [
|
|
8
|
+
"analytics/player",
|
|
9
|
+
"analytics/utils",
|
|
10
|
+
"app",
|
|
11
|
+
"app/deep_linking",
|
|
12
|
+
"app/lifecycle",
|
|
13
|
+
"app/loading",
|
|
14
|
+
"app/remote_control",
|
|
15
|
+
"core",
|
|
16
|
+
"core/actions",
|
|
17
|
+
"core/actions/legacy_registry",
|
|
18
|
+
"core/actions/ui_registry",
|
|
19
|
+
"core/context",
|
|
20
|
+
"core/dom",
|
|
21
|
+
"core/numbers",
|
|
22
|
+
"core/platform",
|
|
23
|
+
"core/plugins",
|
|
24
|
+
"core/plugins/hooks",
|
|
25
|
+
"core/plugins/login",
|
|
26
|
+
"core/react",
|
|
27
|
+
"core/react/create_context",
|
|
28
|
+
"core/react_hooks",
|
|
29
|
+
"core/react_hooks/feed_loader",
|
|
30
|
+
"core/react_hooks/hook_modal",
|
|
31
|
+
"core/react_hooks/pipes_url",
|
|
32
|
+
"core/react_hooks/present_screen",
|
|
33
|
+
"core/react_hooks/screen_data",
|
|
34
|
+
"crash/error_boundary",
|
|
35
|
+
"network/feed",
|
|
36
|
+
"network/headers",
|
|
37
|
+
"network/reachability",
|
|
38
|
+
"network/zapp_pipes",
|
|
39
|
+
"network/zapp_pipes/app_data",
|
|
40
|
+
"network/zapp_pipes/filter",
|
|
41
|
+
"network/zapp_pipes/request",
|
|
42
|
+
"offline",
|
|
43
|
+
"player",
|
|
44
|
+
"player/audio",
|
|
45
|
+
"player/config",
|
|
46
|
+
"player/container",
|
|
47
|
+
"player/controls",
|
|
48
|
+
"player/ima",
|
|
49
|
+
"player/live",
|
|
50
|
+
"player/manager",
|
|
51
|
+
"player/modal",
|
|
52
|
+
"player/overlay",
|
|
53
|
+
"player/play_next",
|
|
54
|
+
"player/playable",
|
|
55
|
+
"player/preferences",
|
|
56
|
+
"player/seek",
|
|
57
|
+
"player/tts",
|
|
58
|
+
"plugins",
|
|
59
|
+
"react_native/bridge",
|
|
60
|
+
"react_native/push_topic",
|
|
61
|
+
"storage/app_store",
|
|
62
|
+
"storage/asset_cache",
|
|
63
|
+
"storage/native",
|
|
64
|
+
"ui",
|
|
65
|
+
"ui/accessibility",
|
|
66
|
+
"ui/bottom_sheet",
|
|
67
|
+
"ui/cells",
|
|
68
|
+
"ui/components",
|
|
69
|
+
"ui/focus",
|
|
70
|
+
"ui/focus/list",
|
|
71
|
+
"ui/images",
|
|
72
|
+
"ui/modal",
|
|
73
|
+
"ui/navigation",
|
|
74
|
+
"ui/orientation",
|
|
75
|
+
"ui/river",
|
|
76
|
+
"ui/screens",
|
|
77
|
+
"ui/styles",
|
|
78
|
+
] as const;
|
|
79
|
+
|
|
80
|
+
/** A plugin logs to its own node: `plugins/<kind>/<name>[/<component>]`, for example `plugins/ui_component/grid`. */
|
|
81
|
+
export type PluginSubsystem = `plugins/${string}/${string}`;
|
|
82
|
+
|
|
83
|
+
export type XraySubsystem = (typeof XRAY_SUBSYSTEMS)[number] | PluginSubsystem;
|