@eazo/sdk 0.15.0 → 0.17.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 +2 -38
- 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/internal/runtime-provider.d.ts +10 -0
- package/dist/internal/runtime-provider.d.ts.map +1 -0
- package/dist/internal/runtime-provider.js +97 -0
- package/dist/internal/runtime-provider.js.map +1 -0
- package/dist/react.d.ts +9 -32
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +15 -63
- package/dist/react.js.map +1 -1
- package/dist/react.server.d.ts +1 -17
- package/dist/react.server.d.ts.map +1 -1
- package/dist/react.server.js +21 -53
- package/dist/react.server.js.map +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +2 -0
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,7 +61,6 @@ await auth.logout()
|
|
|
61
61
|
auth.fetchSocialConnections() // SocialConnection[]
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
The SDK reads its app id from the environment (`NEXT_PUBLIC_EAZO_APP_ID`, `EAZO_APP_ID`, `EXPO_PUBLIC_EAZO_APP_ID`). If you need to inject it programmatically — for example in a Next.js layout that resolves the value at SSR — pass it to `<EazoProvider appId={...}>`.
|
|
65
64
|
|
|
66
65
|
#### `auth.login()` — unified login flow
|
|
67
66
|
|
|
@@ -172,41 +171,6 @@ export async function POST() {
|
|
|
172
171
|
}
|
|
173
172
|
```
|
|
174
173
|
|
|
175
|
-
The appId is a deployment-time constant, not a per-call argument. **Convention: set `EAZO_APP_ID`** (one name, no framework prefix). The recommended way to thread it into the SDK on the client side is through the `<EazoProvider appId={...}>` prop, populated from a Server Component:
|
|
176
|
-
|
|
177
|
-
```tsx
|
|
178
|
-
// app/layout.tsx (Server Component — Next.js App Router)
|
|
179
|
-
import { EazoProvider } from "@eazo/sdk/react";
|
|
180
|
-
|
|
181
|
-
export default function RootLayout({ children }) {
|
|
182
|
-
return (
|
|
183
|
-
<html>
|
|
184
|
-
<body>
|
|
185
|
-
<EazoProvider appId={process.env.EAZO_APP_ID}>
|
|
186
|
-
{children}
|
|
187
|
-
</EazoProvider>
|
|
188
|
-
</body>
|
|
189
|
-
</html>
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
```sh
|
|
195
|
-
# .env
|
|
196
|
-
EAZO_APP_ID=iVW3asOFoOvYr9sl
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
That's it — one canonical name, no `NEXT_PUBLIC_` alias required.
|
|
200
|
-
|
|
201
|
-
For frameworks without a Server Component layer (Vite, plain Webpack apps, etc.) call `setAppId(...)` at app startup with whatever value you've sourced (env, runtime config endpoint, etc.):
|
|
202
|
-
|
|
203
|
-
```ts
|
|
204
|
-
import { setAppId } from "@eazo/sdk";
|
|
205
|
-
setAppId(import.meta.env.VITE_EAZO_APP_ID);
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
If neither path is convenient, the SDK also reads any of these env vars as a fallback (priority top-down): `EAZO_APP_ID`, `NEXT_PUBLIC_EAZO_APP_ID`, `EXPO_PUBLIC_EAZO_APP_ID`, `VITE_EAZO_APP_ID`, `PUBLIC_EAZO_APP_ID`, `REACT_APP_EAZO_APP_ID`. The framework prefixes are kept for backward compatibility — new projects should prefer the prop or `setAppId()`.
|
|
209
|
-
|
|
210
174
|
`audience` defaults to `"subscribers"` (v1's only value).
|
|
211
175
|
|
|
212
176
|
Throws `EazoNotificationPublishError` on platform-level errors (`code` 401 = bad JWT, 403 = appId doesn't belong to your key, 413 = >5,000 subscribers, etc.).
|
|
@@ -245,6 +209,6 @@ App code never branches on environment — the capability API is the same on bot
|
|
|
245
209
|
|
|
246
210
|
| Variable | Required | Used by |
|
|
247
211
|
|---|---|---|
|
|
248
|
-
| `EAZO_APP_ID` | yes |
|
|
249
|
-
| `
|
|
212
|
+
| `EAZO_APP_ID` | yes | App ID; auto-resolved by `<EazoProvider>`. |
|
|
213
|
+
| `EAZO_PLATFORM_API_BASE` | optional | Override the Eazo platform base URL (defaults to `https://eazo.ai`). |
|
|
250
214
|
| `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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { PublicAppInfo } from "./banner-ui/app-info";
|
|
3
|
+
export declare const MountedContext: React.Context<boolean>;
|
|
4
|
+
export declare function _EazoRuntimeProvider(props: {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
appId: string;
|
|
7
|
+
apiBase: string | null;
|
|
8
|
+
initialAppInfo: PublicAppInfo | null;
|
|
9
|
+
}): React.ReactElement;
|
|
10
|
+
//# sourceMappingURL=runtime-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-provider.d.ts","sourceRoot":"","sources":["../../src/internal/runtime-provider.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAW1D,eAAO,MAAM,cAAc,wBAA6B,CAAC;AAEzD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,cAAc,EAAE,aAAa,GAAG,IAAI,CAAC;CACtC,GAAG,KAAK,CAAC,YAAY,CA+FrB"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.MountedContext = void 0;
|
|
38
|
+
exports._EazoRuntimeProvider = _EazoRuntimeProvider;
|
|
39
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
40
|
+
// Internal runtime provider — receives the resolved `appId` / `apiBase` /
|
|
41
|
+
// `initialAppInfo` as required props and mounts the SDK runtime. The
|
|
42
|
+
// public `EazoProvider` in `react.tsx` / `react.server.tsx` resolves
|
|
43
|
+
// these values from env (and prefetches `PublicAppInfo` on the server)
|
|
44
|
+
// and forwards them here. Keeping this layer separate is what lets the
|
|
45
|
+
// public `EazoProvider` expose a zero-prop API while still passing the
|
|
46
|
+
// SSR-resolved values across the server/client boundary via React props.
|
|
47
|
+
const React = __importStar(require("react"));
|
|
48
|
+
const banner_ui_1 = require("./banner-ui");
|
|
49
|
+
const initial_info_1 = require("./banner-ui/initial-info");
|
|
50
|
+
const styles_1 = require("./banner-ui/styles");
|
|
51
|
+
const bootstrap_1 = require("./bootstrap");
|
|
52
|
+
const auth_1 = require("./capabilities/auth");
|
|
53
|
+
const device_1 = require("./capabilities/device");
|
|
54
|
+
const config_1 = require("./config");
|
|
55
|
+
const env_1 = require("./env");
|
|
56
|
+
const login_ui_1 = require("./login-ui");
|
|
57
|
+
const share_ui_1 = require("./share-ui");
|
|
58
|
+
exports.MountedContext = React.createContext(false);
|
|
59
|
+
function _EazoRuntimeProvider(props) {
|
|
60
|
+
(0, config_1.setAppId)(props.appId);
|
|
61
|
+
// Setter ignores null/empty — calling unconditionally keeps the
|
|
62
|
+
// "clear on Provider unmount with apiBase removed" semantics simple.
|
|
63
|
+
(0, config_1.setHostApiBase)(props.apiBase);
|
|
64
|
+
(0, initial_info_1.setInitialAppInfo)(props.initialAppInfo);
|
|
65
|
+
// Inject the banner-ui stylesheet eagerly (before EazoBrandBanner mounts)
|
|
66
|
+
// so the `.eazo-app-area` wrapper has its `display: contents`/active
|
|
67
|
+
// styles ready on first paint. Banner-ui re-injects the same sheet on
|
|
68
|
+
// its own mount; ensureBannerStylesInjected is idempotent via STYLE_ID.
|
|
69
|
+
// The function self-gates on `getHost() === "web"` internally, so in
|
|
70
|
+
// mobile WebView / iframe hosts this is a no-op — no banner CSS ever
|
|
71
|
+
// lands in `document.head`.
|
|
72
|
+
if (typeof document !== "undefined") {
|
|
73
|
+
(0, styles_1.ensureBannerStylesInjected)();
|
|
74
|
+
}
|
|
75
|
+
// Detect the runtime host so banner-related React components don't
|
|
76
|
+
// even mount in mobile WebView / iframe. `null` until the post-mount
|
|
77
|
+
// effect resolves it; treat null as "render the banner UI" so SSR
|
|
78
|
+
// and the first client render emit the same JSX (no hydration mismatch).
|
|
79
|
+
// After the effect resolves on the client:
|
|
80
|
+
// - web: `host === "web"` → banner UI stays mounted
|
|
81
|
+
// - other: `host === "eazoMobile" | "embeddedIframe"` → unmounts.
|
|
82
|
+
//
|
|
83
|
+
// Banner UI components are SIBLINGS of the .eazo-app-area wrapper, so
|
|
84
|
+
// unmounting them does NOT affect host children — children stay at the
|
|
85
|
+
// same JSX position throughout, no remount.
|
|
86
|
+
const [host, setHost] = React.useState(null);
|
|
87
|
+
React.useEffect(() => {
|
|
88
|
+
// Starting the bridge is idempotent; capability access may have already done so.
|
|
89
|
+
(0, bootstrap_1.getBridge)();
|
|
90
|
+
void (0, auth_1._bootstrapAuth)();
|
|
91
|
+
void (0, device_1._bootstrapDevice)();
|
|
92
|
+
setHost((0, env_1.getHost)());
|
|
93
|
+
}, []);
|
|
94
|
+
const showBannerUI = host === null || host === "web";
|
|
95
|
+
return ((0, jsx_runtime_1.jsxs)(exports.MountedContext.Provider, { value: true, children: [(0, jsx_runtime_1.jsx)("div", { className: "eazo-app-area", children: (0, jsx_runtime_1.jsx)("div", { className: "eazo-app-area-scroller", children: props.children }) }), showBannerUI && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(banner_ui_1.EazoBrandBanner, {}), (0, jsx_runtime_1.jsx)(login_ui_1.LoginUI, {}), (0, jsx_runtime_1.jsx)(share_ui_1.ShareDownloadModal, {})] }))] }));
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=runtime-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-provider.js","sourceRoot":"","sources":["../../src/internal/runtime-provider.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0Bb,oDAoGC;;AA5HD,0EAA0E;AAC1E,qEAAqE;AACrE,qEAAqE;AACrE,uEAAuE;AACvE,uEAAuE;AACvE,uEAAuE;AACvE,yEAAyE;AAEzE,6CAA+B;AAE/B,2CAA8C;AAE9C,2DAA6D;AAC7D,+CAAgE;AAChE,2CAAwC;AACxC,8CAAqD;AACrD,kDAAyD;AACzD,qCAAoD;AACpD,+BAA2C;AAC3C,yCAAqC;AACrC,yCAAgD;AAEnC,QAAA,cAAc,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAEzD,SAAgB,oBAAoB,CAAC,KAKpC;IACC,IAAA,iBAAQ,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,gEAAgE;IAChE,qEAAqE;IACrE,IAAA,uBAAc,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9B,IAAA,gCAAiB,EAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAExC,0EAA0E;IAC1E,qEAAqE;IACrE,sEAAsE;IACtE,wEAAwE;IACxE,qEAAqE;IACrE,qEAAqE;IACrE,4BAA4B;IAC5B,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpC,IAAA,mCAA0B,GAAE,CAAC;IAC/B,CAAC;IAED,mEAAmE;IACnE,qEAAqE;IACrE,kEAAkE;IAClE,yEAAyE;IACzE,2CAA2C;IAC3C,+DAA+D;IAC/D,oEAAoE;IACpE,EAAE;IACF,sEAAsE;IACtE,uEAAuE;IACvE,4CAA4C;IAC5C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAc,IAAI,CAAC,CAAC;IAC1D,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,iFAAiF;QACjF,IAAA,qBAAS,GAAE,CAAC;QACZ,KAAK,IAAA,qBAAc,GAAE,CAAC;QACtB,KAAK,IAAA,yBAAgB,GAAE,CAAC;QACxB,OAAO,CAAC,IAAA,aAAO,GAAE,CAAC,CAAC;IACrB,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,MAAM,YAAY,GAAG,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,CAAC;IAErD,OAAO,CACL,wBAAC,sBAAc,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"}
|
package/dist/react.d.ts
CHANGED
|
@@ -1,46 +1,23 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { PublicAppInfo } from "./internal/banner-ui/app-info";
|
|
3
2
|
import type { EazoState } from "./types";
|
|
4
3
|
/**
|
|
5
4
|
* Mounts the SDK runtime. Place once at the root of your React tree.
|
|
6
5
|
*
|
|
7
|
-
* <EazoProvider
|
|
8
|
-
* appId={process.env.EAZO_APP_ID}
|
|
9
|
-
* apiBase={process.env.EAZO_API_BASE}
|
|
10
|
-
* >
|
|
6
|
+
* <EazoProvider>
|
|
11
7
|
* <App />
|
|
12
8
|
* </EazoProvider>
|
|
13
9
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
10
|
+
* Zero-config: the SDK auto-reads `EAZO_APP_ID` (and
|
|
11
|
+
* `EAZO_PLATFORM_API_BASE` when set) from env. For non-RSC frameworks
|
|
12
|
+
* set a framework-prefixed alias (`NEXT_PUBLIC_EAZO_APP_ID`,
|
|
13
|
+
* `EXPO_PUBLIC_EAZO_APP_ID`, …) or call `setAppId(...)` at startup.
|
|
18
14
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* how a server-only env like `EAZO_API_BASE` (which Next.js does NOT
|
|
23
|
-
* inline into the client bundle) reaches the browser side of the SDK.
|
|
15
|
+
* Under Next.js App Router this resolves to the server variant
|
|
16
|
+
* (`react.server.tsx`), which prefetches the handoff `PublicAppInfo`
|
|
17
|
+
* during SSR and forwards everything to the runtime via internal props.
|
|
24
18
|
*/
|
|
25
|
-
export declare function EazoProvider(
|
|
19
|
+
export declare function EazoProvider({ children, }: {
|
|
26
20
|
children: React.ReactNode;
|
|
27
|
-
/** Eazo app ID. Required. */
|
|
28
|
-
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
|
-
*/
|
|
35
|
-
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
|
-
*/
|
|
43
|
-
initialAppInfo?: PublicAppInfo | null;
|
|
44
21
|
}): React.ReactElement;
|
|
45
22
|
/**
|
|
46
23
|
* Subscribe to a slice of state. Re-renders only when the selector's
|
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;
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,GAAG,KAAK,CAAC,YAAY,CAgBrB;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
|
@@ -37,79 +37,31 @@ exports.EazoProvider = EazoProvider;
|
|
|
37
37
|
exports.useEazo = useEazo;
|
|
38
38
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
39
|
const React = __importStar(require("react"));
|
|
40
|
-
const banner_ui_1 = require("./internal/banner-ui");
|
|
41
|
-
const initial_info_1 = require("./internal/banner-ui/initial-info");
|
|
42
|
-
const styles_1 = require("./internal/banner-ui/styles");
|
|
43
|
-
const bootstrap_1 = require("./internal/bootstrap");
|
|
44
|
-
const auth_1 = require("./internal/capabilities/auth");
|
|
45
|
-
const device_1 = require("./internal/capabilities/device");
|
|
46
40
|
const config_1 = require("./internal/config");
|
|
47
|
-
const
|
|
48
|
-
const login_ui_1 = require("./internal/login-ui");
|
|
49
|
-
const share_ui_1 = require("./internal/share-ui");
|
|
41
|
+
const runtime_provider_1 = require("./internal/runtime-provider");
|
|
50
42
|
const store_1 = require("./internal/store");
|
|
51
|
-
const MountedContext = React.createContext(false);
|
|
52
43
|
/**
|
|
53
44
|
* Mounts the SDK runtime. Place once at the root of your React tree.
|
|
54
45
|
*
|
|
55
|
-
* <EazoProvider
|
|
56
|
-
* appId={process.env.EAZO_APP_ID}
|
|
57
|
-
* apiBase={process.env.EAZO_API_BASE}
|
|
58
|
-
* >
|
|
46
|
+
* <EazoProvider>
|
|
59
47
|
* <App />
|
|
60
48
|
* </EazoProvider>
|
|
61
49
|
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
50
|
+
* Zero-config: the SDK auto-reads `EAZO_APP_ID` (and
|
|
51
|
+
* `EAZO_PLATFORM_API_BASE` when set) from env. For non-RSC frameworks
|
|
52
|
+
* set a framework-prefixed alias (`NEXT_PUBLIC_EAZO_APP_ID`,
|
|
53
|
+
* `EXPO_PUBLIC_EAZO_APP_ID`, …) or call `setAppId(...)` at startup.
|
|
66
54
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* how a server-only env like `EAZO_API_BASE` (which Next.js does NOT
|
|
71
|
-
* inline into the client bundle) reaches the browser side of the SDK.
|
|
55
|
+
* Under Next.js App Router this resolves to the server variant
|
|
56
|
+
* (`react.server.tsx`), which prefetches the handoff `PublicAppInfo`
|
|
57
|
+
* during SSR and forwards everything to the runtime via internal props.
|
|
72
58
|
*/
|
|
73
|
-
function EazoProvider(
|
|
74
|
-
|
|
75
|
-
|
|
59
|
+
function EazoProvider({ children, }) {
|
|
60
|
+
const appId = (0, config_1.readAppIdFromEnv)();
|
|
61
|
+
if (!appId) {
|
|
62
|
+
throw new Error("@eazo/sdk: EAZO_APP_ID is not set. Add it to .env (or a framework-prefixed variant for SPA bundlers).");
|
|
76
63
|
}
|
|
77
|
-
(0,
|
|
78
|
-
// Setter ignores null/empty — calling unconditionally keeps the
|
|
79
|
-
// "clear on Provider unmount with apiBase removed" semantics simple.
|
|
80
|
-
(0, config_1.setHostApiBase)(props.apiBase ?? null);
|
|
81
|
-
(0, initial_info_1.setInitialAppInfo)(props.initialAppInfo ?? null);
|
|
82
|
-
// Inject the banner-ui stylesheet eagerly (before EazoBrandBanner mounts)
|
|
83
|
-
// so the `.eazo-app-area` wrapper has its `display: contents`/active
|
|
84
|
-
// styles ready on first paint. Banner-ui re-injects the same sheet on
|
|
85
|
-
// its own mount; ensureBannerStylesInjected is idempotent via STYLE_ID.
|
|
86
|
-
// The function self-gates on `getHost() === "web"` internally, so in
|
|
87
|
-
// mobile WebView / iframe hosts this is a no-op — no banner CSS ever
|
|
88
|
-
// lands in `document.head`.
|
|
89
|
-
if (typeof document !== "undefined") {
|
|
90
|
-
(0, styles_1.ensureBannerStylesInjected)();
|
|
91
|
-
}
|
|
92
|
-
// Detect the runtime host so banner-related React components don't
|
|
93
|
-
// even mount in mobile WebView / iframe. `null` until the post-mount
|
|
94
|
-
// effect resolves it; treat null as "render the banner UI" so SSR
|
|
95
|
-
// and the first client render emit the same JSX (no hydration mismatch).
|
|
96
|
-
// After the effect resolves on the client:
|
|
97
|
-
// - web: `host === "web"` → banner UI stays mounted
|
|
98
|
-
// - other: `host === "eazoMobile" | "embeddedIframe"` → unmounts.
|
|
99
|
-
//
|
|
100
|
-
// Banner UI components are SIBLINGS of the .eazo-app-area wrapper, so
|
|
101
|
-
// unmounting them does NOT affect host children — children stay at the
|
|
102
|
-
// same JSX position throughout, no remount.
|
|
103
|
-
const [host, setHost] = React.useState(null);
|
|
104
|
-
React.useEffect(() => {
|
|
105
|
-
// Starting the bridge is idempotent; capability access may have already done so.
|
|
106
|
-
(0, bootstrap_1.getBridge)();
|
|
107
|
-
void (0, auth_1._bootstrapAuth)();
|
|
108
|
-
void (0, device_1._bootstrapDevice)();
|
|
109
|
-
setHost((0, env_1.getHost)());
|
|
110
|
-
}, []);
|
|
111
|
-
const showBannerUI = host === null || host === "web";
|
|
112
|
-
return ((0, jsx_runtime_1.jsxs)(MountedContext.Provider, { value: true, children: [(0, jsx_runtime_1.jsx)("div", { className: "eazo-app-area", children: (0, jsx_runtime_1.jsx)("div", { className: "eazo-app-area-scroller", children: props.children }) }), showBannerUI && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(banner_ui_1.EazoBrandBanner, {}), (0, jsx_runtime_1.jsx)(login_ui_1.LoginUI, {}), (0, jsx_runtime_1.jsx)(share_ui_1.ShareDownloadModal, {})] }))] }));
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)(runtime_provider_1._EazoRuntimeProvider, { appId: appId, apiBase: (0, config_1.readApiBaseFromEnv)(), initialAppInfo: null, children: children }));
|
|
113
65
|
}
|
|
114
66
|
/**
|
|
115
67
|
* Subscribe to a slice of state. Re-renders only when the selector's
|
|
@@ -119,7 +71,7 @@ function EazoProvider(props) {
|
|
|
119
71
|
* const { platform, locale } = useEazo(s => s.device);
|
|
120
72
|
*/
|
|
121
73
|
function useEazo(selector) {
|
|
122
|
-
const mounted = React.useContext(MountedContext);
|
|
74
|
+
const mounted = React.useContext(runtime_provider_1.MountedContext);
|
|
123
75
|
if (process.env.NODE_ENV !== "production" && !mounted) {
|
|
124
76
|
console.warn("[@eazo/sdk] useEazo() called without <EazoProvider>. Mount it at the root of your app.");
|
|
125
77
|
}
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBb,oCAoBC;AASD,0BAkBC;;AAtED,6CAA+B;AAE/B,8CAAyE;AACzE,kEAAmF;AACnF,4CAAwD;AAGxD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,YAAY,CAAC,EAC3B,QAAQ,GAGT;IACC,MAAM,KAAK,GAAG,IAAA,yBAAgB,GAAE,CAAC;IACjC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,uGAAuG,CACxG,CAAC;IACJ,CAAC;IACD,OAAO,CACL,uBAAC,uCAAoB,IACnB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,IAAA,2BAAkB,GAAE,EAC7B,cAAc,EAAE,IAAI,YAEnB,QAAQ,GACY,CACxB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,OAAO,CAAI,QAAiC;IAC1D,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,iCAAc,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
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
export { useEazo } from "./react";
|
|
3
|
-
export declare function EazoProvider(
|
|
3
|
+
export declare function EazoProvider({ children, }: {
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
-
/** Eazo app ID. Required. */
|
|
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
|
-
*/
|
|
13
|
-
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
|
-
*/
|
|
20
|
-
initialAppInfo?: import("./internal/banner-ui/app-info").PublicAppInfo | null;
|
|
21
5
|
}): Promise<React.ReactElement>;
|
|
22
6
|
//# 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":"AAWA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AA+BlC,wBAAsB,YAAY,CAAC,EACjC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CA0B9B"}
|
package/dist/react.server.js
CHANGED
|
@@ -36,28 +36,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.useEazo = void 0;
|
|
37
37
|
exports.EazoProvider = EazoProvider;
|
|
38
38
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
-
const react_1 = require("./react");
|
|
40
39
|
const app_info_1 = require("./internal/banner-ui/app-info");
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* WebView. When the SDK detects any of these on the SSR request, it
|
|
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
|
-
*/
|
|
40
|
+
const config_1 = require("./internal/config");
|
|
41
|
+
const runtime_provider_1 = require("./internal/runtime-provider");
|
|
42
|
+
var react_1 = require("./react");
|
|
43
|
+
Object.defineProperty(exports, "useEazo", { enumerable: true, get: function () { return react_1.useEazo; } });
|
|
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();
|
|
@@ -91,28 +68,19 @@ async function getRequestUserAgent() {
|
|
|
91
68
|
return null;
|
|
92
69
|
}
|
|
93
70
|
}
|
|
94
|
-
async function EazoProvider(
|
|
95
|
-
|
|
96
|
-
|
|
71
|
+
async function EazoProvider({ children, }) {
|
|
72
|
+
const appId = (0, config_1.readAppIdFromEnv)();
|
|
73
|
+
if (!appId) {
|
|
74
|
+
throw new Error("@eazo/sdk: EAZO_APP_ID is not set. Add it to .env so the SDK can resolve the host app.");
|
|
97
75
|
}
|
|
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.
|
|
76
|
+
const apiBase = (0, config_1.readApiBaseFromEnv)();
|
|
77
|
+
// Skip the prefetch inside Eazo Mobile WebView — the handoff overlay
|
|
78
|
+
// is `getHost()`-gated and never renders there.
|
|
104
79
|
let initialAppInfo = null;
|
|
105
|
-
|
|
106
|
-
|
|
80
|
+
const ua = await getRequestUserAgent();
|
|
81
|
+
if (!isMobileWebViewUserAgent(ua)) {
|
|
82
|
+
initialAppInfo = await (0, app_info_1.fetchPublicAppInfo)(appId, { apiBase });
|
|
107
83
|
}
|
|
108
|
-
|
|
109
|
-
const ua = await getRequestUserAgent();
|
|
110
|
-
if (!isMobileWebViewUserAgent(ua)) {
|
|
111
|
-
initialAppInfo = await (0, app_info_1.fetchPublicAppInfo)(props.appId, {
|
|
112
|
-
apiBase: props.apiBase,
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return ((0, jsx_runtime_1.jsx)(react_1.EazoProvider, { appId: props.appId, apiBase: props.apiBase, initialAppInfo: initialAppInfo, children: props.children }));
|
|
84
|
+
return ((0, jsx_runtime_1.jsx)(runtime_provider_1._EazoRuntimeProvider, { appId: appId, apiBase: apiBase, initialAppInfo: initialAppInfo, children: children }));
|
|
117
85
|
}
|
|
118
86
|
//# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,oCA8BC;;AAjED,4DAAmE;AACnE,8CAAyE;AACzE,kEAAmE;AAEnE,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;AAED,wEAAwE;AACxE,qEAAqE;AACrE,2BAA2B;AAC3B,KAAK,UAAU,mBAAmB;IAChC,IAAI,CAAC;QACH,uEAAuE;QACvE,MAAM,aAAa,GAAG,CAAC,wDAAa,cAAc,GAAC,CAElD,CAAC;QACF,MAAM,cAAc,GAAG,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC;QACrD,OAAO,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,YAAY,CAAC,EACjC,QAAQ,GAGT;IACC,MAAM,KAAK,GAAG,IAAA,yBAAgB,GAAE,CAAC;IACjC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,wFAAwF,CACzF,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,IAAA,2BAAkB,GAAE,CAAC;IAErC,qEAAqE;IACrE,gDAAgD;IAChD,IAAI,cAAc,GAAiE,IAAI,CAAC;IACxF,MAAM,EAAE,GAAG,MAAM,mBAAmB,EAAE,CAAC;IACvC,IAAI,CAAC,wBAAwB,CAAC,EAAE,CAAC,EAAE,CAAC;QAClC,cAAc,GAAG,MAAM,IAAA,6BAAkB,EAAC,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,CACL,uBAAC,uCAAoB,IACnB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,YAE7B,QAAQ,GACY,CACxB,CAAC;AACJ,CAAC"}
|
package/dist/testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AAEH,wBAAgB,UAAU,IAAI,IAAI,CAcjC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAG7D"}
|
package/dist/testing.js
CHANGED
|
@@ -6,6 +6,7 @@ const bootstrap_1 = require("./internal/bootstrap");
|
|
|
6
6
|
const auth_1 = require("./internal/capabilities/auth");
|
|
7
7
|
const device_1 = require("./internal/capabilities/device");
|
|
8
8
|
const share_1 = require("./internal/capabilities/share");
|
|
9
|
+
const config_1 = require("./internal/config");
|
|
9
10
|
const store_1 = require("./internal/store");
|
|
10
11
|
/**
|
|
11
12
|
* Test helpers. NOT for production code paths.
|
|
@@ -18,6 +19,7 @@ function __resetSDK() {
|
|
|
18
19
|
(0, device_1.__resetDeviceCapability)();
|
|
19
20
|
(0, share_1.__resetShareCapability)();
|
|
20
21
|
(0, bootstrap_1.__resetBootstrap)();
|
|
22
|
+
(0, config_1.__resetConfig)();
|
|
21
23
|
store_1.store.reset();
|
|
22
24
|
if (typeof window !== "undefined") {
|
|
23
25
|
try {
|
package/dist/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":";;AAcA,gCAcC;AAMD,sDAGC;AArCD,oDAAwD;AACxD,uDAAqE;AACrE,2DAAyE;AACzE,yDAAuE;AACvE,8CAAkD;AAClD,4CAAyC;AAEzC;;;;;GAKG;AAEH,SAAgB,UAAU;IACxB,IAAA,4BAAqB,GAAE,CAAC;IACxB,IAAA,gCAAuB,GAAE,CAAC;IAC1B,IAAA,8BAAsB,GAAE,CAAC;IACzB,IAAA,4BAAgB,GAAE,CAAC;IACnB,IAAA,sBAAa,GAAE,CAAC;IAChB,aAAK,CAAC,KAAK,EAAE,CAAC;IACd,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,IAAI,CAAC;YACH,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QACjD,CAAC;QAAC,MAAM,CAAC;YACP,YAAY;QACd,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,QAAiB;IACrD,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAC1C,MAAM,CAAC,aAAa,CAAC,IAAI,YAAY,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AACxE,CAAC"}
|
package/package.json
CHANGED