@eazo/sdk 0.15.0 → 0.16.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/README.md +1 -1
- package/dist/internal/config.d.ts +2 -0
- package/dist/internal/config.d.ts.map +1 -1
- package/dist/internal/config.js +11 -6
- package/dist/internal/config.js.map +1 -1
- package/dist/react.d.ts +10 -26
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +8 -13
- package/dist/react.js.map +1 -1
- package/dist/react.server.d.ts +2 -12
- package/dist/react.server.d.ts.map +1 -1
- package/dist/react.server.js +12 -40
- package/dist/react.server.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -246,5 +246,5 @@ App code never branches on environment — the capability API is the same on bot
|
|
|
246
246
|
| Variable | Required | Used by |
|
|
247
247
|
|---|---|---|
|
|
248
248
|
| `EAZO_APP_ID` | yes | server-side; set framework-prefixed alias (`NEXT_PUBLIC_*`, `EXPO_PUBLIC_*` …) too if your bundler needs it for the browser, or pass via `<EazoProvider appId={...}>` |
|
|
249
|
-
| `
|
|
249
|
+
| `EAZO_PLATFORM_API_BASE` | optional | platform URL fallback when no host injects one (mobile WebView always injects via `hello.apiBase`). Auto-read by the server `<EazoProvider>` under Next.js RSC and forwarded to the client; also read by `notifications.publish` server-side. |
|
|
250
250
|
| `EAZO_PRIVATE_KEY` | server | `requireAuth`, `notifications.publish` |
|
|
@@ -11,5 +11,7 @@ export declare function getAppId(): string | null;
|
|
|
11
11
|
export declare function setHostApiBase(url: string | null): void;
|
|
12
12
|
export declare function getPlatformApiBase(override?: string): string;
|
|
13
13
|
export declare function readAppIdFromEnv(): string | null;
|
|
14
|
+
/** Env-only lookup; skips the host-injection cache used by getPlatformApiBase. */
|
|
15
|
+
export declare function readApiBaseFromEnv(): string | null;
|
|
14
16
|
export declare function __resetConfig(): void;
|
|
15
17
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/internal/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,yBAAyB,oBAAoB,CAAC;AA8B3D,2CAA2C;AAC3C,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAEhD;AAED,kEAAkE;AAClE,wBAAgB,QAAQ,IAAI,MAAM,GAAG,IAAI,CAGxC;AAED,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAEvD;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAM5D;AAED,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAEhD;AAED,wBAAgB,aAAa,IAAI,IAAI,CAGpC"}
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/internal/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,yBAAyB,oBAAoB,CAAC;AA8B3D,2CAA2C;AAC3C,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAEhD;AAED,kEAAkE;AAClE,wBAAgB,QAAQ,IAAI,MAAM,GAAG,IAAI,CAGxC;AAED,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAEvD;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAM5D;AAED,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAEhD;AAED,kFAAkF;AAClF,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAElD;AAED,wBAAgB,aAAa,IAAI,IAAI,CAGpC"}
|
package/dist/internal/config.js
CHANGED
|
@@ -10,6 +10,7 @@ exports.getAppId = getAppId;
|
|
|
10
10
|
exports.setHostApiBase = setHostApiBase;
|
|
11
11
|
exports.getPlatformApiBase = getPlatformApiBase;
|
|
12
12
|
exports.readAppIdFromEnv = readAppIdFromEnv;
|
|
13
|
+
exports.readApiBaseFromEnv = readApiBaseFromEnv;
|
|
13
14
|
exports.__resetConfig = __resetConfig;
|
|
14
15
|
let appId = null;
|
|
15
16
|
let hostInjectedApiBase = null;
|
|
@@ -33,13 +34,13 @@ const APP_ID_ENV_NAMES = [
|
|
|
33
34
|
"REACT_APP_EAZO_APP_ID",
|
|
34
35
|
];
|
|
35
36
|
const API_BASE_ENV_NAMES = [
|
|
37
|
+
"EAZO_PLATFORM_API_BASE",
|
|
36
38
|
"EAZO_API_BASE",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"REACT_APP_EAZO_API_URL",
|
|
39
|
+
"NEXT_PUBLIC_EAZO_PLATFORM_API_BASE",
|
|
40
|
+
"EXPO_PUBLIC_EAZO_PLATFORM_API_BASE",
|
|
41
|
+
"VITE_EAZO_PLATFORM_API_BASE",
|
|
42
|
+
"PUBLIC_EAZO_PLATFORM_API_BASE",
|
|
43
|
+
"REACT_APP_EAZO_PLATFORM_API_BASE",
|
|
43
44
|
];
|
|
44
45
|
/** Set by `<EazoProvider appId={...}>`. */
|
|
45
46
|
function setAppId(id) {
|
|
@@ -68,6 +69,10 @@ function getPlatformApiBase(override) {
|
|
|
68
69
|
function readAppIdFromEnv() {
|
|
69
70
|
return readEnvByNames(APP_ID_ENV_NAMES);
|
|
70
71
|
}
|
|
72
|
+
/** Env-only lookup; skips the host-injection cache used by getPlatformApiBase. */
|
|
73
|
+
function readApiBaseFromEnv() {
|
|
74
|
+
return readEnvByNames(API_BASE_ENV_NAMES);
|
|
75
|
+
}
|
|
71
76
|
function __resetConfig() {
|
|
72
77
|
appId = null;
|
|
73
78
|
hostInjectedApiBase = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/internal/config.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAoCH,4BAEC;AAGD,4BAGC;AAGD,wCAEC;AAED,gDAMC;AAED,4CAEC;AAED,sCAGC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/internal/config.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAoCH,4BAEC;AAGD,4BAGC;AAGD,wCAEC;AAED,gDAMC;AAED,4CAEC;AAGD,gDAEC;AAED,sCAGC;AArED,IAAI,KAAK,GAAkB,IAAI,CAAC;AAChC,IAAI,mBAAmB,GAAkB,IAAI,CAAC;AAEjC,QAAA,yBAAyB,GAAG,iBAAiB,CAAC;AAE3D,SAAS,cAAc,CAAC,KAAwB;IAC9C,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,OAAO,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IAChE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;IAClE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,gBAAgB,GAAG;IACvB,aAAa;IACb,yBAAyB;IACzB,yBAAyB;IACzB,kBAAkB;IAClB,oBAAoB;IACpB,uBAAuB;CACf,CAAC;AAEX,MAAM,kBAAkB,GAAG;IACzB,wBAAwB;IACxB,eAAe;IACf,oCAAoC;IACpC,oCAAoC;IACpC,6BAA6B;IAC7B,+BAA+B;IAC/B,kCAAkC;CAC1B,CAAC;AAEX,2CAA2C;AAC3C,SAAgB,QAAQ,CAAC,EAAiB;IACxC,KAAK,GAAG,EAAE,CAAC;AACb,CAAC;AAED,kEAAkE;AAClE,SAAgB,QAAQ;IACtB,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IACxB,OAAO,cAAc,CAAC,gBAAgB,CAAC,CAAC;AAC1C,CAAC;AAED,mEAAmE;AACnE,SAAgB,cAAc,CAAC,GAAkB;IAC/C,mBAAmB,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC;AAED,SAAgB,kBAAkB,CAAC,QAAiB;IAClD,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACjD,IAAI,mBAAmB;QAAE,OAAO,mBAAmB,CAAC;IACpD,MAAM,OAAO,GAAG,cAAc,CAAC,kBAAkB,CAAC,CAAC;IACnD,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC/C,OAAO,iCAAyB,CAAC;AACnC,CAAC;AAED,SAAgB,gBAAgB;IAC9B,OAAO,cAAc,CAAC,gBAAgB,CAAC,CAAC;AAC1C,CAAC;AAED,kFAAkF;AAClF,SAAgB,kBAAkB;IAChC,OAAO,cAAc,CAAC,kBAAkB,CAAC,CAAC;AAC5C,CAAC;AAED,SAAgB,aAAa;IAC3B,KAAK,GAAG,IAAI,CAAC;IACb,mBAAmB,GAAG,IAAI,CAAC;AAC7B,CAAC"}
|
package/dist/react.d.ts
CHANGED
|
@@ -4,42 +4,26 @@ import type { EazoState } from "./types";
|
|
|
4
4
|
/**
|
|
5
5
|
* Mounts the SDK runtime. Place once at the root of your React tree.
|
|
6
6
|
*
|
|
7
|
-
* <EazoProvider
|
|
8
|
-
* appId={process.env.EAZO_APP_ID}
|
|
9
|
-
* apiBase={process.env.EAZO_API_BASE}
|
|
10
|
-
* >
|
|
7
|
+
* <EazoProvider appId={process.env.EAZO_APP_ID}>
|
|
11
8
|
* <App />
|
|
12
9
|
* </EazoProvider>
|
|
13
10
|
*
|
|
14
|
-
*
|
|
15
|
-
* (`auth`, `device`, `share`, `storage`, `memory`)
|
|
16
|
-
*
|
|
17
|
-
* and `share.compose()` work anywhere in the tree.
|
|
11
|
+
* Every project must pass an `appId` — it's how the SDK reaches every
|
|
12
|
+
* capability (`auth`, `device`, `share`, `storage`, `memory`). Also
|
|
13
|
+
* mounts the shared login and share UIs.
|
|
18
14
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* inline into the client bundle) reaches the browser side of the SDK.
|
|
15
|
+
* Under Next.js App Router the bundler resolves this through the
|
|
16
|
+
* server variant (`react.server.tsx`) which auto-reads
|
|
17
|
+
* `EAZO_PLATFORM_API_BASE` from env and prefetches the handoff
|
|
18
|
+
* `PublicAppInfo` — host code doesn't need to plumb either.
|
|
24
19
|
*/
|
|
25
20
|
export declare function EazoProvider(props: {
|
|
26
21
|
children: React.ReactNode;
|
|
27
22
|
/** Eazo app ID. Required. */
|
|
28
23
|
appId: string;
|
|
29
|
-
/**
|
|
30
|
-
* Optional platform API base URL. Pass it from a Server Component when
|
|
31
|
-
* the value comes from a server-only env var (e.g. `process.env.EAZO_API_BASE`
|
|
32
|
-
* in a Next.js layout) so it reaches the client without needing a
|
|
33
|
-
* `NEXT_PUBLIC_*` alias. Falls back to `https://eazo.ai`.
|
|
34
|
-
*/
|
|
24
|
+
/** Optional override. Defaults to `EAZO_PLATFORM_API_BASE` from env, then `https://eazo.ai`. */
|
|
35
25
|
apiBase?: string | null;
|
|
36
|
-
/**
|
|
37
|
-
* Pre-fetched `PublicAppInfo` for the host app. When supplied (typically
|
|
38
|
-
* from a Server Component / SSR loader using
|
|
39
|
-
* `fetchPublicAppInfo` from `@eazo/sdk/server`), the handoff banner
|
|
40
|
-
* renders real content on first paint and skips the client-side fetch
|
|
41
|
-
* entirely. Omit it to fall back to the SDK's own client fetch + skeleton.
|
|
42
|
-
*/
|
|
26
|
+
/** Pre-fetched `PublicAppInfo`. When set, skips the client-side fetch + skeleton. */
|
|
43
27
|
initialAppInfo?: PublicAppInfo | null;
|
|
44
28
|
}): React.ReactElement;
|
|
45
29
|
/**
|
package/dist/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAWnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAWnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,gGAAgG;IAChG,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,qFAAqF;IACrF,cAAc,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;CACvC,GAAG,KAAK,CAAC,YAAY,CAoGrB;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,CAkB/D"}
|
package/dist/react.js
CHANGED
|
@@ -52,23 +52,18 @@ const MountedContext = React.createContext(false);
|
|
|
52
52
|
/**
|
|
53
53
|
* Mounts the SDK runtime. Place once at the root of your React tree.
|
|
54
54
|
*
|
|
55
|
-
* <EazoProvider
|
|
56
|
-
* appId={process.env.EAZO_APP_ID}
|
|
57
|
-
* apiBase={process.env.EAZO_API_BASE}
|
|
58
|
-
* >
|
|
55
|
+
* <EazoProvider appId={process.env.EAZO_APP_ID}>
|
|
59
56
|
* <App />
|
|
60
57
|
* </EazoProvider>
|
|
61
58
|
*
|
|
62
|
-
*
|
|
63
|
-
* (`auth`, `device`, `share`, `storage`, `memory`)
|
|
64
|
-
*
|
|
65
|
-
* and `share.compose()` work anywhere in the tree.
|
|
59
|
+
* Every project must pass an `appId` — it's how the SDK reaches every
|
|
60
|
+
* capability (`auth`, `device`, `share`, `storage`, `memory`). Also
|
|
61
|
+
* mounts the shared login and share UIs.
|
|
66
62
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* inline into the client bundle) reaches the browser side of the SDK.
|
|
63
|
+
* Under Next.js App Router the bundler resolves this through the
|
|
64
|
+
* server variant (`react.server.tsx`) which auto-reads
|
|
65
|
+
* `EAZO_PLATFORM_API_BASE` from env and prefetches the handoff
|
|
66
|
+
* `PublicAppInfo` — host code doesn't need to plumb either.
|
|
72
67
|
*/
|
|
73
68
|
function EazoProvider(props) {
|
|
74
69
|
if (!props.appId) {
|
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCb,oCA4GC;AASD,0BAkBC;;AAzKD,6CAA+B;AAE/B,oDAAuD;AAEvD,oEAAsE;AACtE,wDAAyE;AACzE,oDAAiD;AACjD,uDAA8D;AAC9D,2DAAkE;AAClE,8CAA6D;AAC7D,wCAAoD;AACpD,kDAA8C;AAC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I,KAAK,KAAK,CAAC;IAErD,OAAO,CACL,wBAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,aA2ClC,gCAAK,SAAS,EAAC,eAAe,YAC5B,gCAAK,SAAS,EAAC,wBAAwB,YAAE,KAAK,CAAC,QAAQ,GAAO,GAC1D,EACL,YAAY,IAAI,CACf,6DACE,uBAAC,2BAAe,KAAG,EACnB,uBAAC,kBAAO,KAAG,EACX,uBAAC,6BAAkB,KAAG,IACrB,CACJ,IACuB,CAC3B,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,OAAO,CAAI,QAAiC;IAC1D,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IACjD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,IAAI,CAAC,OAAO,EAAE,CAAC;QACtD,OAAO,CAAC,IAAI,CACV,wFAAwF,CACzF,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CACnC,GAAG,EAAE,CAAC,QAAQ,CAAC,aAAK,CAAC,WAAW,EAAE,CAAC,EACnC,CAAC,QAAQ,CAAC,CACX,CAAC;IACF,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CACzC,GAAG,EAAE,CAAC,QAAQ,CAAC,qBAAa,CAAC,EAC7B,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,KAAK,CAAC,oBAAoB,CAAC,aAAK,CAAC,SAAS,EAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC;AACrF,CAAC"}
|
package/dist/react.server.d.ts
CHANGED
|
@@ -4,19 +4,9 @@ export declare function EazoProvider(props: {
|
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
/** Eazo app ID. Required. */
|
|
6
6
|
appId: string;
|
|
7
|
-
/**
|
|
8
|
-
* Optional platform API base URL. Read here on the server to issue
|
|
9
|
-
* the prefetch against the right host (staging vs prod), and
|
|
10
|
-
* forwarded to the client `EazoProvider` so the rest of the SDK
|
|
11
|
-
* targets the same host post-hydration.
|
|
12
|
-
*/
|
|
7
|
+
/** Optional override. Defaults to `EAZO_PLATFORM_API_BASE` from env. */
|
|
13
8
|
apiBase?: string | null;
|
|
14
|
-
/**
|
|
15
|
-
* Escape hatch — pre-resolved `PublicAppInfo`. When the caller
|
|
16
|
-
* already has the data (e.g. fetched alongside other server-side
|
|
17
|
-
* queries) supplying it here skips the in-Provider fetch. When
|
|
18
|
-
* omitted, the server Provider does the fetch itself.
|
|
19
|
-
*/
|
|
9
|
+
/** Pre-resolved `PublicAppInfo`. When set, skips the in-Provider fetch. */
|
|
20
10
|
initialAppInfo?: import("./internal/banner-ui/app-info").PublicAppInfo | null;
|
|
21
11
|
}): Promise<React.ReactElement>;
|
|
22
12
|
//# sourceMappingURL=react.server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.server.d.ts","sourceRoot":"","sources":["../src/react.server.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react.server.d.ts","sourceRoot":"","sources":["../src/react.server.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AA+BlC,wBAAsB,YAAY,CAAC,KAAK,EAAE;IACxC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,2EAA2E;IAC3E,cAAc,CAAC,EAAE,OAAO,+BAA+B,EAAE,aAAa,GAAG,IAAI,CAAC;CAC/E,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CA6B9B"}
|
package/dist/react.server.js
CHANGED
|
@@ -38,26 +38,12 @@ exports.EazoProvider = EazoProvider;
|
|
|
38
38
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
39
|
const react_1 = require("./react");
|
|
40
40
|
const app_info_1 = require("./internal/banner-ui/app-info");
|
|
41
|
-
|
|
42
|
-
// entry keeps `import { useEazo } from "@eazo/sdk/react"` working for
|
|
43
|
-
// app code regardless of which entry the bundler picks.
|
|
41
|
+
const config_1 = require("./internal/config");
|
|
44
42
|
var react_2 = require("./react");
|
|
45
43
|
Object.defineProperty(exports, "useEazo", { enumerable: true, get: function () { return react_2.useEazo; } });
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
* skips the public-app-info prefetch — the handoff overlay never
|
|
50
|
-
* renders inside the host shell (`getHost() === "eazoMobile"`), so the
|
|
51
|
-
* fetch would be pure waste plus added TTFB.
|
|
52
|
-
*
|
|
53
|
-
* - `EazoMobile/` — explicit marker injected by `AppViewerFallback.tsx`
|
|
54
|
-
* via `applicationNameForUserAgent` on iOS.
|
|
55
|
-
* - `wv` — Android RN WebView default UA token (`Mozilla/5.0 (...; wv) ...`).
|
|
56
|
-
* Generic enough to catch the immersive iOS WebView too in some
|
|
57
|
-
* builds, and broad enough to cover any embedded RN WebView. False
|
|
58
|
-
* positives (a non-Eazo Android WebView hitting the template) just
|
|
59
|
-
* fall back to the existing client fetch — same as before SSR.
|
|
60
|
-
*/
|
|
44
|
+
// `EazoMobile/` is injected by `AppViewerFallback.tsx`; `wv` covers
|
|
45
|
+
// generic RN WebViews on Android and some iOS builds. False positives
|
|
46
|
+
// just fall back to the client-side fetch, same as pre-SSR behavior.
|
|
61
47
|
const MOBILE_WEBVIEW_UA_MARKERS = ["EazoMobile/", " wv)", "(wv;"];
|
|
62
48
|
function isMobileWebViewUserAgent(ua) {
|
|
63
49
|
if (!ua)
|
|
@@ -68,20 +54,11 @@ function isMobileWebViewUserAgent(ua) {
|
|
|
68
54
|
}
|
|
69
55
|
return false;
|
|
70
56
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
* returns `null` on any failure (header not available, runtime doesn't
|
|
75
|
-
* ship `next/headers`, etc.), which means the prefetch path runs
|
|
76
|
-
* unchanged outside Next.
|
|
77
|
-
*/
|
|
57
|
+
// `next/headers` is dynamically imported so non-Next RSC runtimes don't
|
|
58
|
+
// blow up at load time. Any failure → `null` → prefetch path runs as
|
|
59
|
+
// if no UA filter applied.
|
|
78
60
|
async function getRequestUserAgent() {
|
|
79
61
|
try {
|
|
80
|
-
// `next/headers` is intentionally NOT a dependency of `@eazo/sdk` —
|
|
81
|
-
// it's resolved at runtime only when the SDK ships inside a Next.js
|
|
82
|
-
// RSC bundle. The `@ts-expect-error` keeps tsc quiet about the
|
|
83
|
-
// unresolvable module path; the try/catch handles every other
|
|
84
|
-
// runtime where the import throws.
|
|
85
62
|
// @ts-expect-error - Optional peer; resolved only in Next.js runtimes.
|
|
86
63
|
const headersModule = (await Promise.resolve().then(() => __importStar(require("next/headers"))));
|
|
87
64
|
const requestHeaders = await headersModule.headers();
|
|
@@ -95,12 +72,9 @@ async function EazoProvider(props) {
|
|
|
95
72
|
if (!props.appId) {
|
|
96
73
|
throw new Error("@eazo/sdk: <EazoProvider appId> is required. Pass your Eazo app id explicitly.");
|
|
97
74
|
}
|
|
98
|
-
|
|
99
|
-
// Eazo Mobile WebView — the handoff overlay
|
|
100
|
-
// never renders there
|
|
101
|
-
// user-visible benefit. Detection is best-effort (UA-based); on a
|
|
102
|
-
// false-negative the fetch still runs and the bounded 2s timeout
|
|
103
|
-
// caps the worst-case impact.
|
|
75
|
+
const apiBase = props.apiBase ?? (0, config_1.readApiBaseFromEnv)();
|
|
76
|
+
// Skip the prefetch inside Eazo Mobile WebView — the handoff overlay
|
|
77
|
+
// is `getHost()`-gated and never renders there.
|
|
104
78
|
let initialAppInfo = null;
|
|
105
79
|
if (props.initialAppInfo !== undefined) {
|
|
106
80
|
initialAppInfo = props.initialAppInfo;
|
|
@@ -108,11 +82,9 @@ async function EazoProvider(props) {
|
|
|
108
82
|
else {
|
|
109
83
|
const ua = await getRequestUserAgent();
|
|
110
84
|
if (!isMobileWebViewUserAgent(ua)) {
|
|
111
|
-
initialAppInfo = await (0, app_info_1.fetchPublicAppInfo)(props.appId, {
|
|
112
|
-
apiBase: props.apiBase,
|
|
113
|
-
});
|
|
85
|
+
initialAppInfo = await (0, app_info_1.fetchPublicAppInfo)(props.appId, { apiBase });
|
|
114
86
|
}
|
|
115
87
|
}
|
|
116
|
-
return ((0, jsx_runtime_1.jsx)(react_1.EazoProvider, { appId: props.appId, apiBase:
|
|
88
|
+
return ((0, jsx_runtime_1.jsx)(react_1.EazoProvider, { appId: props.appId, apiBase: apiBase, initialAppInfo: initialAppInfo, children: props.children }));
|
|
117
89
|
}
|
|
118
90
|
//# sourceMappingURL=react.server.js.map
|
package/dist/react.server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.server.js","sourceRoot":"","sources":["../src/react.server.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"react.server.js","sourceRoot":"","sources":["../src/react.server.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,oCAqCC;;AAxED,mCAA6D;AAC7D,4DAAmE;AACnE,8CAAuD;AAEvD,iCAAkC;AAAzB,gGAAA,OAAO,OAAA;AAEhB,oEAAoE;AACpE,sEAAsE;AACtE,qEAAqE;AACrE,MAAM,yBAAyB,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAE3E,SAAS,wBAAwB,CAAC,EAA6B;IAC7D,IAAI,CAAC,EAAE;QAAE,OAAO,KAAK,CAAC;IACtB,KAAK,MAAM,MAAM,IAAI,yBAAyB,EAAE,CAAC;QAC/C,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;IAC7C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;A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