@uptick-ads/react-native-web-sdk 0.3.1 → 0.3.2
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 +2 -2
- package/index.d.ts +16 -3
- package/package.json +1 -1
- package/src/UptickFlow.js +7 -6
- package/src/version.js +1 -1
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ Because both presentations work from the same mount point, Uptick can switch a p
|
|
|
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
53
|
| `modal` | | Presentation options for the popup. Any option set here is reported to Uptick with the flow, with its value, so performance can be read against it. |
|
|
54
|
-
| `webViewProps` | | Extra props passed through to `WebView` |
|
|
54
|
+
| `webViewProps` | | Extra props passed through to `WebView`, except the ones the component sets itself: `source`, `originWhitelist`, `javaScriptEnabled`, `domStorageEnabled`, `setSupportMultipleWindows`, `onMessage`, `onShouldStartLoadWithRequest` and `onOpenWindow` |
|
|
55
55
|
| `host` | `api.uptick.com` | API host, only for testing against other environments |
|
|
56
56
|
|
|
57
57
|
### Flow parameters
|
|
@@ -71,7 +71,7 @@ The component adds `render_type` (`{ rendered: "inline" | "popup" }`) once the f
|
|
|
71
71
|
|
|
72
72
|
## How click-out works
|
|
73
73
|
|
|
74
|
-
When a user accepts an offer the SDK opens the advertiser link with `window.open`. The component receives that through `onOpenWindow`, hands the URL to `openUrl`, and the page inside the WebView stays put, so the SDK moves on to the next offer while the user is in the browser.
|
|
74
|
+
When a user accepts an offer the SDK opens the advertiser link with `window.open`. The component receives that through `onOpenWindow`, hands the URL to `openUrl`, and the page inside the WebView stays put, so the SDK moves on to the next offer while the user is in the browser.
|
|
75
75
|
|
|
76
76
|
## Demo
|
|
77
77
|
|
package/index.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export interface UptickFlowParams {
|
|
|
20
20
|
country_code?: string;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
export type UptickPlacement = "checkout" | "order_confirmation" | "order_status" | (string & {});
|
|
24
|
+
|
|
23
25
|
export interface UptickModalOptions {
|
|
24
26
|
/** Colour of the dimmed layer behind the card. */
|
|
25
27
|
backgroundColor?: string;
|
|
@@ -28,14 +30,25 @@ export interface UptickModalOptions {
|
|
|
28
30
|
maxCardHeight?: number;
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
/** Props the component sets on the WebView itself, which webViewProps cannot override. */
|
|
34
|
+
export type ReservedWebViewProp =
|
|
35
|
+
| "source"
|
|
36
|
+
| "originWhitelist"
|
|
37
|
+
| "javaScriptEnabled"
|
|
38
|
+
| "domStorageEnabled"
|
|
39
|
+
| "setSupportMultipleWindows"
|
|
40
|
+
| "onMessage"
|
|
41
|
+
| "onShouldStartLoadWithRequest"
|
|
42
|
+
| "onOpenWindow";
|
|
43
|
+
|
|
31
44
|
export interface UptickFlowProps extends UptickFlowParams {
|
|
32
45
|
integrationId: string;
|
|
33
|
-
placement?:
|
|
46
|
+
placement?: UptickPlacement;
|
|
34
47
|
callback?: (event: string, data: unknown) => void;
|
|
35
48
|
openUrl?: (url: string) => void | Promise<unknown>;
|
|
36
49
|
style?: StyleProp<ViewStyle>;
|
|
37
50
|
modal?: UptickModalOptions;
|
|
38
|
-
webViewProps?: Partial<ComponentProps<typeof WebView
|
|
51
|
+
webViewProps?: Omit<Partial<ComponentProps<typeof WebView>>, ReservedWebViewProp>;
|
|
39
52
|
host?: string;
|
|
40
53
|
}
|
|
41
54
|
|
|
@@ -45,5 +58,5 @@ export const version: string;
|
|
|
45
58
|
export function customizations(modal?: UptickModalOptions): Record<string, string>;
|
|
46
59
|
export const FLOW_PARAMS: ReadonlyArray<keyof UptickFlowParams>;
|
|
47
60
|
export function pickFlowParams(props: Record<string, unknown>): UptickFlowParams;
|
|
48
|
-
export function buildEmbedUrl(options: { host: string; integrationId: string; placement?:
|
|
61
|
+
export function buildEmbedUrl(options: { host: string; integrationId: string; placement?: UptickPlacement; params?: UptickFlowParams; version?: string; customization?: Record<string, string> }): string;
|
|
49
62
|
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.3.
|
|
3
|
+
"version": "0.3.2",
|
|
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
|
@@ -114,6 +114,13 @@ export function UptickFlow({
|
|
|
114
114
|
|
|
115
115
|
const webView = (
|
|
116
116
|
<WebView
|
|
117
|
+
onError={(event) => emit.current && emit.current("webview_error", { description: event.nativeEvent.description })}
|
|
118
|
+
onHttpError={(event) => emit.current && emit.current("webview_http_error", { status: event.nativeEvent.statusCode, url: event.nativeEvent.url })}
|
|
119
|
+
scrollEnabled={false}
|
|
120
|
+
nestedScrollEnabled
|
|
121
|
+
opaque={false}
|
|
122
|
+
{...webViewProps}
|
|
123
|
+
// These follow the spread so webViewProps can't break messaging or click-out.
|
|
117
124
|
source={source}
|
|
118
125
|
originWhitelist={["*"]}
|
|
119
126
|
javaScriptEnabled
|
|
@@ -122,12 +129,6 @@ export function UptickFlow({
|
|
|
122
129
|
onMessage={onMessage}
|
|
123
130
|
onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
|
|
124
131
|
onOpenWindow={onOpenWindow}
|
|
125
|
-
onError={(event) => emit.current && emit.current("webview_error", { description: event.nativeEvent.description })}
|
|
126
|
-
onHttpError={(event) => emit.current && emit.current("webview_http_error", { status: event.nativeEvent.statusCode, url: event.nativeEvent.url })}
|
|
127
|
-
scrollEnabled={false}
|
|
128
|
-
nestedScrollEnabled
|
|
129
|
-
opaque={false}
|
|
130
|
-
{...webViewProps}
|
|
131
132
|
style={[styles.transparent, { height: isPopup ? Math.min(contentHeight, maxCardHeight) : contentHeight }, webViewProps && webViewProps.style]}
|
|
132
133
|
/>
|
|
133
134
|
);
|
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.3.
|
|
2
|
+
export const version = "0.3.2";
|