@applicaster/zapp-react-native-utils 12.0.0-rc.57 → 12.0.0-rc.58

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.
@@ -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,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 };
@@ -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-rc.57",
3
+ "version": "12.0.0-rc.58",
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-rc.57",
31
+ "@applicaster/applicaster-types": "12.0.0-rc.58",
32
32
  "buffer": "^5.2.1",
33
33
  "camelize": "^1.0.0",
34
34
  "create-react-context": "^0.2.3",
@@ -84,7 +84,8 @@ describe("getInflatedDataSourceUrl", () => {
84
84
  expect(reactHooksLogger.warning).toHaveBeenCalledTimes(1);
85
85
 
86
86
  expect(reactHooksLogger.warning).toHaveBeenCalledWith({
87
- message: "Not enough data to fully inflate url: {{entry.id}}",
87
+ message:
88
+ "Not enough data to fully inflate url: {{entry.id}} source: http://foo.com/show/seriesId={{seriesId}}",
88
89
  data: { source, contexts, mapping },
89
90
  });
90
91
  });
@@ -120,7 +121,7 @@ describe("getInflatedDataSourceUrl", () => {
120
121
 
121
122
  expect(reactHooksLogger.warning).toHaveBeenCalledWith({
122
123
  message:
123
- "Not enough data to fully inflate url: {{entry.extensions.groupName}}",
124
+ "Not enough data to fully inflate url: {{entry.extensions.groupName}} source: https://zapp-1689-emmys.web.app/emmys/group-categories/{{groupName}}",
124
125
  data: { source, contexts, mapping },
125
126
  });
126
127
  });
@@ -162,7 +163,7 @@ describe("getInflatedDataSourceUrl", () => {
162
163
 
163
164
  expect(reactHooksLogger.warning).toHaveBeenCalledWith({
164
165
  message:
165
- "Not enough data to fully inflate url: {{entry.extensions.groupName2}}",
166
+ "Not enough data to fully inflate url: {{entry.extensions.groupName2}} source: https://zapp-1689-emmys.web.app/emmys/group-categories/{{groupName1}}?test={{groupName2}}",
166
167
  data: { source, contexts, mapping },
167
168
  });
168
169
  });
@@ -12,7 +12,10 @@ import { useRoute } from "../navigation";
12
12
  import { getMissingValues } from "../../inflatedUrlUtils";
13
13
  import { reactHooksLogger as logger } from "../logger";
14
14
  import { isTV } from "../../reactUtils";
15
- import { findEndpointForURL } from "@applicaster/zapp-pipes-v2-client";
15
+ import {
16
+ findEndpointForURL,
17
+ HTTP_METHODS,
18
+ } from "@applicaster/zapp-pipes-v2-client";
16
19
  import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
17
20
  import { ENDPOINT_TAGS } from "../../types";
18
21
 
@@ -112,14 +115,20 @@ export const getInflatedDataSourceUrl: GetInflatedDataSourceUrl = ({
112
115
 
113
116
  if (missingValues && missingValues.length > 0) {
114
117
  const pipesEndpoints = appStore.get("pipesEndpoints");
115
- const endpointURL = findEndpointForURL(string, pipesEndpoints);
118
+
119
+ const endpointURL = findEndpointForURL(
120
+ source,
121
+ pipesEndpoints,
122
+ HTTP_METHODS.GET
123
+ );
124
+
116
125
  const tags = pipesEndpoints?.[endpointURL]?.tags;
117
126
  const allowMissingKeys = tags?.includes(ENDPOINT_TAGS.allow_missing_keys);
118
127
 
119
128
  if (!allowMissingKeys) {
120
129
  const message = `Not enough data to fully inflate url: ${missingValues.join(
121
130
  ","
122
- )}`;
131
+ )} source: ${source}`;
123
132
 
124
133
  // todo: add js only payload instead
125
134
  if (__DEV__) {