@uptick-ads/react-native-web-sdk 0.2.7 → 0.2.8
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/README.md +1 -1
- package/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/UptickFlow.js +5 -4
- package/src/embedUrl.js +3 -9
- package/src/index.js +1 -1
- package/src/version.js +1 -1
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ Because both presentations work from the same mount point, Uptick can switch a p
|
|
|
50
50
|
| `callback` | | `(event, data)`, the same events as the web SDK callback |
|
|
51
51
|
| `openUrl` | `Linking.openURL` | How accepted offers open; supply your own to use an in-app browser |
|
|
52
52
|
| `style` | | Style for the inline slot |
|
|
53
|
-
| `modal` | | Presentation options for the popup. Any option set here is reported to Uptick with the flow so performance can be read against it. |
|
|
53
|
+
| `modal` | | Presentation options for the popup. Any option set here is reported to Uptick with the flow as a `custom` parameter so performance can be read against it. |
|
|
54
54
|
| `webViewProps` | | Extra props passed through to `WebView` |
|
|
55
55
|
| `host` | `api.uptick.com` | API host, only for testing against other environments |
|
|
56
56
|
|
package/index.d.ts
CHANGED
|
@@ -42,8 +42,8 @@ export interface UptickFlowProps extends UptickFlowParams {
|
|
|
42
42
|
export function UptickFlow(props: UptickFlowProps): JSX.Element;
|
|
43
43
|
|
|
44
44
|
export const version: string;
|
|
45
|
-
export function
|
|
45
|
+
export function customizations(modal?: UptickModalOptions): string[];
|
|
46
46
|
export const FLOW_PARAMS: ReadonlyArray<keyof UptickFlowParams>;
|
|
47
47
|
export function pickFlowParams(props: Record<string, unknown>): UptickFlowParams;
|
|
48
|
-
export function buildEmbedUrl(options: { host: string; integrationId: string; placement?: string; params?: UptickFlowParams }): string;
|
|
48
|
+
export function buildEmbedUrl(options: { host: string; integrationId: string; placement?: string; params?: UptickFlowParams; version?: string; custom?: string[] }): string;
|
|
49
49
|
export function embedPath(host: string, integrationId: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uptick-ads/react-native-web-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "React Native component that runs the Uptick web SDK inside a WebView, inline or as a popup, with the web integration's parameters",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"uptick",
|
package/src/UptickFlow.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { Linking, Modal, Pressable, StyleSheet, View } from "react-native";
|
|
3
3
|
import { WebView } from "react-native-webview";
|
|
4
|
-
import { buildEmbedUrl,
|
|
4
|
+
import { buildEmbedUrl, customizations, embedPath, pickFlowParams } from "./embedUrl";
|
|
5
5
|
import { version as SDK_VERSION } from "./version";
|
|
6
6
|
|
|
7
7
|
const DEFAULT_HOST = "api.uptick.com";
|
|
@@ -34,12 +34,13 @@ export function UptickFlow({
|
|
|
34
34
|
|
|
35
35
|
const params = pickFlowParams(flowProps);
|
|
36
36
|
const paramsKey = JSON.stringify(params);
|
|
37
|
-
const
|
|
37
|
+
const custom = customizations(modal);
|
|
38
|
+
const customKey = custom.join(",");
|
|
38
39
|
const source = useMemo(
|
|
39
|
-
() => ({ uri: buildEmbedUrl({ host, integrationId, placement, params, version }) }),
|
|
40
|
+
() => ({ uri: buildEmbedUrl({ host, integrationId, placement, params, version: SDK_VERSION, custom }) }),
|
|
40
41
|
// Callers pass fresh prop values each render; key on the serialised params so the page does not reload on every parent render.
|
|
41
42
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
|
-
[host, integrationId, placement, paramsKey,
|
|
43
|
+
[host, integrationId, placement, paramsKey, customKey]
|
|
43
44
|
);
|
|
44
45
|
const ownPath = embedPath(host, integrationId);
|
|
45
46
|
|
package/src/embedUrl.js
CHANGED
|
@@ -41,7 +41,7 @@ export function embedPath(host, integrationId) {
|
|
|
41
41
|
return `https://${host}/v1/places/${encodeURIComponent(integrationId)}/embed`;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
// Names of the presentation options a host customised, so reporting can tell a stock integration from a tuned one when performance differs.
|
|
44
|
+
// Names of the presentation options a host customised. They travel as a flow parameter, so every event stores them in its data like any other extra parameter, and reporting can tell a stock integration from a tuned one when performance differs.
|
|
45
45
|
export function customizations(modal) {
|
|
46
46
|
if (!modal) return [];
|
|
47
47
|
const names = [];
|
|
@@ -52,16 +52,10 @@ export function customizations(modal) {
|
|
|
52
52
|
return names;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
export function integrationVersion(sdkVersion, modal) {
|
|
57
|
-
const names = customizations(modal);
|
|
58
|
-
return names.length ? `${sdkVersion}+custom.${names.join(",")}` : sdkVersion;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function buildEmbedUrl({ host, integrationId, placement, params, version }) {
|
|
55
|
+
export function buildEmbedUrl({ host, integrationId, placement, params, version, custom }) {
|
|
62
56
|
if (!integrationId) throw new Error("UptickFlow: integrationId is required");
|
|
63
57
|
// The page renders whatever presentation the placement's template defines; `native` only asks it to leave the popup chrome to the app.
|
|
64
58
|
const search = encodeQuery({ placement, variant: "native", integration_version: version });
|
|
65
|
-
const fragment = encodeQuery(params || {});
|
|
59
|
+
const fragment = encodeQuery({ ...(params || {}), custom: custom && custom.length ? custom.join(",") : undefined });
|
|
66
60
|
return `${embedPath(host, integrationId)}?${search}${fragment ? `#${fragment}` : ""}`;
|
|
67
61
|
}
|
package/src/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { UptickFlow } from "./UptickFlow";
|
|
2
|
-
export { buildEmbedUrl, embedPath, pickFlowParams,
|
|
2
|
+
export { buildEmbedUrl, embedPath, pickFlowParams, customizations, FLOW_PARAMS } from "./embedUrl";
|
|
3
3
|
export { version } from "./version";
|
package/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Kept in step with package.json by the release pipeline; the API records it on every event as integration_version.
|
|
2
|
-
export const version = "0.2.
|
|
2
|
+
export const version = "0.2.8";
|