@grizzlee/react 0.2.0 → 0.3.0

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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@grizzlee/react",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "homepage": "https://grizzlee.ca",
9
- "description": "Embed Grizzlee partner dashboards in React or plain JavaScript apps.",
9
+ "description": "Embed Grizzlee partner dashboards in React, React Native or plain JavaScript apps.",
10
10
  "type": "module",
11
11
  "sideEffects": false,
12
12
  "engines": {
@@ -19,6 +19,9 @@
19
19
  "*": {
20
20
  "embed": [
21
21
  "./types/embed.d.cts"
22
+ ],
23
+ "native": [
24
+ "./types/native.d.cts"
22
25
  ]
23
26
  }
24
27
  },
@@ -44,6 +47,17 @@
44
47
  "default": "./embed.cjs"
45
48
  },
46
49
  "default": "./embed.js"
50
+ },
51
+ "./native": {
52
+ "import": {
53
+ "types": "./types/native.d.ts",
54
+ "default": "./native.js"
55
+ },
56
+ "require": {
57
+ "types": "./types/native.d.cts",
58
+ "default": "./native.cjs"
59
+ },
60
+ "default": "./native.js"
47
61
  }
48
62
  },
49
63
  "files": [
@@ -56,11 +70,19 @@
56
70
  "CHANGELOG.md"
57
71
  ],
58
72
  "peerDependencies": {
59
- "react": ">=18"
73
+ "react": ">=18",
74
+ "react-native": ">=0.78",
75
+ "react-native-webview": ">=13"
60
76
  },
61
77
  "peerDependenciesMeta": {
62
78
  "react": {
63
79
  "optional": true
80
+ },
81
+ "react-native": {
82
+ "optional": true
83
+ },
84
+ "react-native-webview": {
85
+ "optional": true
64
86
  }
65
87
  }
66
88
  }
package/types/host.d.cts CHANGED
@@ -1,8 +1,6 @@
1
- export interface GrizzleeShare {
2
- programId: string;
3
- url: string;
4
- text: string;
5
- }
1
+ import { type GrizzleeShare } from "./protocol.cjs";
2
+ export { embedUrl } from "./protocol.cjs";
3
+ export type { GrizzleeShare } from "./protocol.cjs";
6
4
  export interface GrizzleeEmbedOptions {
7
5
  /** An absolute HTTP or HTTPS start URL minted by the merchant's server. */
8
6
  url: string;
@@ -17,6 +15,5 @@ export interface GrizzleeEmbedOptions {
17
15
  minHeight?: number;
18
16
  }
19
17
  export declare function minimumHeight(height?: number): number;
20
- export declare function embedUrl(url: string): URL;
21
18
  /** Both hosts use this listener so origin checks and renewal behave the same way. */
22
19
  export declare function listenToEmbed(frame: HTMLIFrameElement, options: () => GrizzleeEmbedOptions): () => void;
package/types/host.d.ts CHANGED
@@ -1,8 +1,6 @@
1
- export interface GrizzleeShare {
2
- programId: string;
3
- url: string;
4
- text: string;
5
- }
1
+ import { type GrizzleeShare } from "./protocol.js";
2
+ export { embedUrl } from "./protocol.js";
3
+ export type { GrizzleeShare } from "./protocol.js";
6
4
  export interface GrizzleeEmbedOptions {
7
5
  /** An absolute HTTP or HTTPS start URL minted by the merchant's server. */
8
6
  url: string;
@@ -17,6 +15,5 @@ export interface GrizzleeEmbedOptions {
17
15
  minHeight?: number;
18
16
  }
19
17
  export declare function minimumHeight(height?: number): number;
20
- export declare function embedUrl(url: string): URL;
21
18
  /** Both hosts use this listener so origin checks and renewal behave the same way. */
22
19
  export declare function listenToEmbed(frame: HTMLIFrameElement, options: () => GrizzleeEmbedOptions): () => void;
@@ -0,0 +1,18 @@
1
+ import { type ReactElement } from "react";
2
+ import { type StyleProp, type ViewStyle } from "react-native";
3
+ import { type GrizzleeShare } from "./protocol.cjs";
4
+ export type { GrizzleeShare } from "./protocol.cjs";
5
+ export interface GrizzleeNativeEmbedProps {
6
+ /** A one-use /embed/start URL minted by the merchant's server. */
7
+ startUrl: string;
8
+ /** Return a fresh start URL, or update startUrl in your app. */
9
+ onExpired?: () => string | void | Promise<string | void>;
10
+ onReady?: () => void;
11
+ /** Without this callback, the component opens React Native's share sheet. */
12
+ onShare?: (share: GrizzleeShare) => void | Promise<void>;
13
+ /** Loading, renewal and sharing errors. */
14
+ onError?: (error: Error) => void;
15
+ style?: StyleProp<ViewStyle>;
16
+ }
17
+ /** Render the dashboard directly in a WebView. No merchant wrapper page is needed. */
18
+ export declare function GrizzleeNativeEmbed(props: GrizzleeNativeEmbedProps): ReactElement;
@@ -0,0 +1,18 @@
1
+ import { type ReactElement } from "react";
2
+ import { type StyleProp, type ViewStyle } from "react-native";
3
+ import { type GrizzleeShare } from "./protocol.js";
4
+ export type { GrizzleeShare } from "./protocol.js";
5
+ export interface GrizzleeNativeEmbedProps {
6
+ /** A one-use /embed/start URL minted by the merchant's server. */
7
+ startUrl: string;
8
+ /** Return a fresh start URL, or update startUrl in your app. */
9
+ onExpired?: () => string | void | Promise<string | void>;
10
+ onReady?: () => void;
11
+ /** Without this callback, the component opens React Native's share sheet. */
12
+ onShare?: (share: GrizzleeShare) => void | Promise<void>;
13
+ /** Loading, renewal and sharing errors. */
14
+ onError?: (error: Error) => void;
15
+ style?: StyleProp<ViewStyle>;
16
+ }
17
+ /** Render the dashboard directly in a WebView. No merchant wrapper page is needed. */
18
+ export declare function GrizzleeNativeEmbed(props: GrizzleeNativeEmbedProps): ReactElement;
@@ -0,0 +1,7 @@
1
+ export interface GrizzleeShare {
2
+ programId: string;
3
+ url: string;
4
+ text: string;
5
+ }
6
+ export declare function embedUrl(url: string, Url?: new (value: string) => URL): URL;
7
+ export declare function parseShare(message: object, validateUrl?: (value: string) => unknown): GrizzleeShare | null;
@@ -0,0 +1,7 @@
1
+ export interface GrizzleeShare {
2
+ programId: string;
3
+ url: string;
4
+ text: string;
5
+ }
6
+ export declare function embedUrl(url: string, Url?: new (value: string) => URL): URL;
7
+ export declare function parseShare(message: object, validateUrl?: (value: string) => unknown): GrizzleeShare | null;