@applicaster/zapp-react-native-utils 16.0.0-rc.136 → 16.0.0-rc.138

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.
@@ -98,14 +98,25 @@ export function createNavigateToScreenAction(
98
98
 
99
99
  if (!screenId) {
100
100
  log_error(
101
- `navigateToScreen: can not resolve screen type mapping: ${screenType}`
101
+ `navigateToScreen: can not resolve screen type mapping: ${screenType}`,
102
+ {
103
+ // For X-Ray diagnostics: keep when the message is reworded.
104
+ diagnostic: {
105
+ code: "action-type-mapping",
106
+ case: contentTypes?.[screenType] ? "no_screen" : "missing",
107
+ },
108
+ type_mapping: screenType,
109
+ }
102
110
  );
103
111
 
104
112
  return ActionResult.Error;
105
113
  }
106
114
 
107
115
  if (!river) {
108
- log_error("navigateToScreen: can not resolve river");
116
+ log_error("navigateToScreen: can not resolve river", {
117
+ diagnostic: { code: "action-type-mapping", case: "screen_deleted" },
118
+ type_mapping: screenType,
119
+ });
109
120
 
110
121
  return ActionResult.Error;
111
122
  }
@@ -121,8 +121,16 @@ export function HooksManager({
121
121
  `Could not find hook plugin ${identifier} - skipping execution`;
122
122
 
123
123
  return function () {
124
- logHookEvent(hooksManagerLogger.warn, hookMessage(hook.identifier), {
125
- hook,
124
+ // Not through logHookEvent: it drops data outside __DEV__, and the code and the identifier
125
+ // are what the X-Ray diagnostics read on QA builds.
126
+ hooksManagerLogger.warn({
127
+ message: hookMessage(hook.identifier),
128
+ data: {
129
+ diagnostic: { code: "hook-plugin-missing" },
130
+ identifier: hook.identifier,
131
+ screen_id: targetScreen.id,
132
+ ...(__DEV__ ? { hook } : {}),
133
+ },
126
134
  });
127
135
 
128
136
  return null;
@@ -14,6 +14,8 @@ export const getParsedResponse = (err): XRayEventData => {
14
14
 
15
15
  const xRayData: XRayEventData = {
16
16
  data: {
17
+ // What X-Ray diagnostics read is top level in `data`: the error's context carries it.
18
+ diagnostic: context?.diagnostic,
17
19
  context,
18
20
  name,
19
21
  params,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "16.0.0-rc.136",
3
+ "version": "16.0.0-rc.138",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/applicaster/quickbrick#readme",
29
29
  "dependencies": {
30
- "@applicaster/applicaster-types": "16.0.0-rc.136",
30
+ "@applicaster/applicaster-types": "16.0.0-rc.138",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",
@@ -5,7 +5,9 @@ export const warnEmptyContentType = (item) =>
5
5
  message:
6
6
  "The feed or feed item selected is missing content type. For more info see link to docs below.",
7
7
  data: {
8
- item,
8
+ // For X-Ray diagnostics: keep when the message is reworded.
9
+ diagnostic: { code: "entry-type-missing" },
10
+ entry: item,
9
11
  docs: "https://docs.applicaster.com/using-zapp/app-building-walk-through#add-type-mapping",
10
12
  },
11
13
  });
@@ -44,8 +44,11 @@ interface Dependencies {
44
44
  contentTypes: ZappContentTypes;
45
45
  }
46
46
 
47
- const failure = (error: string): Promise<PresentScreenResult> => {
48
- log_error(`presentScreen: ${error}`);
47
+ const failure = (
48
+ error: string,
49
+ data?: Record<string, unknown>
50
+ ): Promise<PresentScreenResult> => {
51
+ log_error(`presentScreen: ${error}`, data);
49
52
 
50
53
  return Promise.resolve({ success: false, cancelled: false, error });
51
54
  };
@@ -77,13 +80,23 @@ export const presentScreen = ({
77
80
  const screenId = contentTypes?.[typeMapping]?.screen_id;
78
81
 
79
82
  if (!screenId) {
80
- return failure(`can not resolve screen type mapping: ${typeMapping}`);
83
+ return failure(`can not resolve screen type mapping: ${typeMapping}`, {
84
+ // For X-Ray diagnostics: keep when the message is reworded.
85
+ diagnostic: {
86
+ code: "action-type-mapping",
87
+ case: contentTypes?.[typeMapping] ? "no_screen" : "missing",
88
+ },
89
+ type_mapping: typeMapping,
90
+ });
81
91
  }
82
92
 
83
93
  const river = rivers?.[screenId];
84
94
 
85
95
  if (!river) {
86
- return failure(`can not resolve river for screen id: ${screenId}`);
96
+ return failure(`can not resolve river for screen id: ${screenId}`, {
97
+ diagnostic: { code: "action-type-mapping", case: "screen_deleted" },
98
+ type_mapping: typeMapping,
99
+ });
87
100
  }
88
101
 
89
102
  return new Promise<PresentScreenResult>((resolve) => {
@@ -39,6 +39,16 @@ export function useComponentResolver(
39
39
  if (!component) {
40
40
  coreLogger.warn({
41
41
  message: `useComponentResolver: Component of type ${componentType} not found`,
42
+ data: {
43
+ // For X-Ray diagnostics: keep when the message is reworded. Not for a plugin that is in
44
+ // the build and only has no component to give.
45
+ ...(!plugins?.some(
46
+ (plugin) => plugin?.identifier === componentType
47
+ ) && {
48
+ diagnostic: { code: "component-plugin-missing" },
49
+ }),
50
+ component: { component_type: componentType },
51
+ },
42
52
  });
43
53
  }
44
54
 
@@ -91,7 +91,11 @@ export function resolveActionIdentifiers({
91
91
 
92
92
  log_warning(
93
93
  `resolveActionIdentifiers: configured action "${identifier}" has no registered provider - its button will not be shown`,
94
- { identifier, entryId: (entry as ZappEntry)?.id }
94
+ {
95
+ diagnostic: { code: "action-plugin-missing" },
96
+ identifier,
97
+ entryId: (entry as ZappEntry)?.id,
98
+ }
95
99
  );
96
100
  }
97
101