@eazo/sdk 0.8.0 → 0.9.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/PROTOCOL.md +4 -3
- package/README.md +21 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/auth-primitive/EazoAuthClient.d.ts +1 -1
- package/dist/internal/auth-primitive/EazoAuthClient.d.ts.map +1 -1
- package/dist/internal/auth-primitive/EazoAuthClient.js +22 -6
- package/dist/internal/auth-primitive/EazoAuthClient.js.map +1 -1
- package/dist/internal/auth-primitive/types.d.ts +2 -2
- package/dist/internal/auth-primitive/types.d.ts.map +1 -1
- package/dist/internal/bootstrap.js +1 -1
- package/dist/internal/bootstrap.js.map +1 -1
- package/dist/internal/bridge/client.d.ts +1 -1
- package/dist/internal/bridge/client.d.ts.map +1 -1
- package/dist/internal/bridge/client.js +2 -2
- package/dist/internal/bridge/client.js.map +1 -1
- package/dist/internal/bridge/protocol.d.ts +5 -5
- package/dist/internal/bridge/protocol.d.ts.map +1 -1
- package/dist/internal/bridge/protocol.js +2 -1
- package/dist/internal/bridge/protocol.js.map +1 -1
- package/dist/internal/capabilities/auth.d.ts +2 -2
- package/dist/internal/capabilities/auth.d.ts.map +1 -1
- package/dist/internal/capabilities/auth.js +7 -7
- package/dist/internal/capabilities/auth.js.map +1 -1
- package/dist/internal/capabilities/memory.d.ts +16 -9
- package/dist/internal/capabilities/memory.d.ts.map +1 -1
- package/dist/internal/capabilities/memory.js +36 -8
- package/dist/internal/capabilities/memory.js.map +1 -1
- package/dist/internal/capabilities/share.d.ts +41 -0
- package/dist/internal/capabilities/share.d.ts.map +1 -0
- package/dist/internal/capabilities/share.js +95 -0
- package/dist/internal/capabilities/share.js.map +1 -0
- package/dist/internal/capabilities/storage.js +4 -4
- package/dist/internal/capabilities/storage.js.map +1 -1
- package/dist/internal/config.d.ts +5 -5
- package/dist/internal/config.d.ts.map +1 -1
- package/dist/internal/config.js +14 -14
- package/dist/internal/config.js.map +1 -1
- package/dist/internal/share-ui/icons.d.ts +13 -0
- package/dist/internal/share-ui/icons.d.ts.map +1 -0
- package/dist/internal/share-ui/icons.js +18 -0
- package/dist/internal/share-ui/icons.js.map +1 -0
- package/dist/internal/share-ui/index.d.ts +8 -0
- package/dist/internal/share-ui/index.d.ts.map +1 -0
- package/dist/internal/share-ui/index.js +63 -0
- package/dist/internal/share-ui/index.js.map +1 -0
- package/dist/internal/share-ui/styles.d.ts +3 -0
- package/dist/internal/share-ui/styles.d.ts.map +1 -0
- package/dist/internal/share-ui/styles.js +135 -0
- package/dist/internal/share-ui/styles.js.map +1 -0
- package/dist/internal/store.d.ts +5 -0
- package/dist/internal/store.d.ts.map +1 -1
- package/dist/internal/store.js +13 -0
- package/dist/internal/store.js.map +1 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +2 -1
- package/dist/react.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
|
@@ -2,8 +2,28 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.memory = void 0;
|
|
4
4
|
const config_1 = require("../config");
|
|
5
|
+
const env_1 = require("../env");
|
|
5
6
|
const auth_1 = require("./auth");
|
|
6
7
|
// ---------------------------------------------------------------------------
|
|
8
|
+
// Helpers
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
/**
|
|
11
|
+
* Detect platform from the runtime environment.
|
|
12
|
+
* Returns "ios" or "android" when running inside the Eazo Mobile WebView,
|
|
13
|
+
* "web" otherwise.
|
|
14
|
+
*/
|
|
15
|
+
function detectPlatform() {
|
|
16
|
+
if (typeof window === "undefined")
|
|
17
|
+
return "web";
|
|
18
|
+
if ((0, env_1.getHost)() === "eazoMobile") {
|
|
19
|
+
const ua = navigator.userAgent;
|
|
20
|
+
if (/android/i.test(ua))
|
|
21
|
+
return "android";
|
|
22
|
+
return "ios";
|
|
23
|
+
}
|
|
24
|
+
return "web";
|
|
25
|
+
}
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
7
27
|
// Public API
|
|
8
28
|
// ---------------------------------------------------------------------------
|
|
9
29
|
exports.memory = {
|
|
@@ -11,8 +31,11 @@ exports.memory = {
|
|
|
11
31
|
* Report a user action event to Gum memory service.
|
|
12
32
|
*
|
|
13
33
|
* Requires the user to be authenticated — the current session is forwarded
|
|
14
|
-
* automatically via `x-eazo-session`. The
|
|
15
|
-
* `
|
|
34
|
+
* automatically via `x-eazo-session`. The app ID is read from
|
|
35
|
+
* `NEXT_PUBLIC_EAZO_APP_ID` or set via `auth.configure({ appId })`.
|
|
36
|
+
*
|
|
37
|
+
* `metadata.appid` is automatically set to the app ID when not supplied.
|
|
38
|
+
* `platform` is auto-detected ("ios" / "android" / "web") when not supplied.
|
|
16
39
|
*
|
|
17
40
|
* @example
|
|
18
41
|
* ```ts
|
|
@@ -20,27 +43,32 @@ exports.memory = {
|
|
|
20
43
|
* content: "User clicked the publish button on the app editor page",
|
|
21
44
|
* event_type: "click",
|
|
22
45
|
* page: "app_editor",
|
|
23
|
-
*
|
|
46
|
+
* metadata: { type: "click" },
|
|
24
47
|
* });
|
|
25
48
|
* ```
|
|
26
49
|
*/
|
|
27
50
|
async reportAction(params) {
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
30
|
-
throw new Error("@eazo/sdk: missing
|
|
51
|
+
const appId = (0, config_1.getAppId)();
|
|
52
|
+
if (!appId) {
|
|
53
|
+
throw new Error("@eazo/sdk: missing app id. Set NEXT_PUBLIC_EAZO_APP_ID or call auth.configure({ appId }).");
|
|
31
54
|
}
|
|
32
55
|
const session = await auth_1.auth.getSessionHeader();
|
|
33
56
|
if (!session) {
|
|
34
57
|
throw new Error("@eazo/sdk: user is not authenticated. Call auth.login() before reporting memory actions.");
|
|
35
58
|
}
|
|
59
|
+
// Ensure metadata.appid is always present.
|
|
60
|
+
const metadata = { appid: appId, ...params.metadata };
|
|
61
|
+
// Auto-detect platform when not provided by the caller.
|
|
62
|
+
const platform = params.platform ?? detectPlatform();
|
|
63
|
+
const payload = { ...params, metadata, platform };
|
|
36
64
|
const res = await fetch(`${(0, config_1.getApiBase)()}/api/open/gum/action`, {
|
|
37
65
|
method: "POST",
|
|
38
66
|
headers: {
|
|
39
67
|
"Content-Type": "application/json",
|
|
40
|
-
"x-eazo-
|
|
68
|
+
"x-eazo-appid": appId,
|
|
41
69
|
"x-eazo-session": session,
|
|
42
70
|
},
|
|
43
|
-
body: JSON.stringify(
|
|
71
|
+
body: JSON.stringify(payload),
|
|
44
72
|
});
|
|
45
73
|
if (!res.ok) {
|
|
46
74
|
let message = `Failed to report memory action: ${res.status}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../src/internal/capabilities/memory.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../src/internal/capabilities/memory.ts"],"names":[],"mappings":";;;AAAA,sCAAiD;AACjD,gCAAiC;AACjC,iCAA8B;AAmC9B,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;GAIG;AACH,SAAS,cAAc;IACrB,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IAChD,IAAI,IAAA,aAAO,GAAE,KAAK,YAAY,EAAE,CAAC;QAC/B,MAAM,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC;QAC/B,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAAE,OAAO,SAAS,CAAC;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAEjE,QAAA,MAAM,GAAG;IACpB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,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IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare function getShareDownloadUrl(): string;
|
|
2
|
+
export interface ShareComposeInput {
|
|
3
|
+
/** Free-form text the app wants to seed the post with. */
|
|
4
|
+
text?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Up to 4 images. Each item is either an `https://...` URL or a
|
|
7
|
+
* `data:image/(png|jpeg|webp|gif);base64,...` data URL. The host
|
|
8
|
+
* uploads any data URLs server-side before drafting.
|
|
9
|
+
*/
|
|
10
|
+
images?: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Optional attribution — the id of the app that originated the share.
|
|
13
|
+
* The host may use this to attach an "app mention" pill to the post.
|
|
14
|
+
*/
|
|
15
|
+
sourceAppId?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ShareComposeResult {
|
|
18
|
+
/**
|
|
19
|
+
* `true` when the host accepted the payload (mobile bridge path).
|
|
20
|
+
* `false` when the SDK fell back to the web download CTA modal — apps
|
|
21
|
+
* can use this to keep the source UI in a sane state.
|
|
22
|
+
*/
|
|
23
|
+
accepted: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare function __resetShareCapability(): void;
|
|
26
|
+
export declare const share: {
|
|
27
|
+
/**
|
|
28
|
+
* Hand share materials to the host's compose surface.
|
|
29
|
+
*
|
|
30
|
+
* - **Inside the Eazo mobile WebView** the host opens its native compose
|
|
31
|
+
* page, AI-drafts a post from the inputs, and lets the user edit and
|
|
32
|
+
* publish. Resolves `{ accepted: true }`.
|
|
33
|
+
* - **In a plain browser** the SDK shows a "Continue in the Eazo app"
|
|
34
|
+
* modal pointing to https://eazo.ai/. Resolves `{ accepted: false }`.
|
|
35
|
+
*
|
|
36
|
+
* Throws `BridgeError('INVALID_ARGS')` synchronously when neither `text`
|
|
37
|
+
* nor `images` are provided, or when more than 4 images are passed.
|
|
38
|
+
*/
|
|
39
|
+
compose(input: ShareComposeInput): Promise<ShareComposeResult>;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=share.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../../../src/internal/capabilities/share.ts"],"names":[],"mappings":"AAMA,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C;AA4CD,eAAO,MAAM,KAAK;IAChB;;;;;;;;;;;OAWG;mBACkB,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAgCrE,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.share = void 0;
|
|
4
|
+
exports.getShareDownloadUrl = getShareDownloadUrl;
|
|
5
|
+
exports.__resetShareCapability = __resetShareCapability;
|
|
6
|
+
const config_1 = require("../config");
|
|
7
|
+
const bootstrap_1 = require("../bootstrap");
|
|
8
|
+
const protocol_1 = require("../bridge/protocol");
|
|
9
|
+
const store_1 = require("../store");
|
|
10
|
+
const MAX_IMAGES = 4;
|
|
11
|
+
function getShareDownloadUrl() {
|
|
12
|
+
return `${(0, config_1.getApiBase)()}/`;
|
|
13
|
+
}
|
|
14
|
+
function __resetShareCapability() {
|
|
15
|
+
(0, store_1.setShareUI)({ open: false });
|
|
16
|
+
}
|
|
17
|
+
function validate(input) {
|
|
18
|
+
if (!input || typeof input !== "object") {
|
|
19
|
+
throw new protocol_1.BridgeErrorObject("INVALID_ARGS", "share.compose requires an input object");
|
|
20
|
+
}
|
|
21
|
+
const hasText = typeof input.text === "string" && input.text.trim().length > 0;
|
|
22
|
+
const hasImages = Array.isArray(input.images) && input.images.length > 0;
|
|
23
|
+
if (!hasText && !hasImages) {
|
|
24
|
+
throw new protocol_1.BridgeErrorObject("INVALID_ARGS", "share.compose requires at least one of `text` or `images`");
|
|
25
|
+
}
|
|
26
|
+
if (Array.isArray(input.images)) {
|
|
27
|
+
if (input.images.length > MAX_IMAGES) {
|
|
28
|
+
throw new protocol_1.BridgeErrorObject("INVALID_ARGS", `share.compose accepts at most ${MAX_IMAGES} images`);
|
|
29
|
+
}
|
|
30
|
+
for (const url of input.images) {
|
|
31
|
+
if (typeof url !== "string" || url.length === 0) {
|
|
32
|
+
throw new protocol_1.BridgeErrorObject("INVALID_ARGS", "share.compose images must be non-empty strings");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function normalize(input) {
|
|
38
|
+
const out = {};
|
|
39
|
+
if (typeof input.text === "string") {
|
|
40
|
+
const trimmed = input.text.trim();
|
|
41
|
+
if (trimmed.length > 0)
|
|
42
|
+
out.text = trimmed;
|
|
43
|
+
}
|
|
44
|
+
if (Array.isArray(input.images) && input.images.length > 0) {
|
|
45
|
+
out.images = input.images.slice();
|
|
46
|
+
}
|
|
47
|
+
if (typeof input.sourceAppId === "string" && input.sourceAppId.trim().length > 0) {
|
|
48
|
+
out.sourceAppId = input.sourceAppId.trim();
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
}
|
|
52
|
+
exports.share = {
|
|
53
|
+
/**
|
|
54
|
+
* Hand share materials to the host's compose surface.
|
|
55
|
+
*
|
|
56
|
+
* - **Inside the Eazo mobile WebView** the host opens its native compose
|
|
57
|
+
* page, AI-drafts a post from the inputs, and lets the user edit and
|
|
58
|
+
* publish. Resolves `{ accepted: true }`.
|
|
59
|
+
* - **In a plain browser** the SDK shows a "Continue in the Eazo app"
|
|
60
|
+
* modal pointing to https://eazo.ai/. Resolves `{ accepted: false }`.
|
|
61
|
+
*
|
|
62
|
+
* Throws `BridgeError('INVALID_ARGS')` synchronously when neither `text`
|
|
63
|
+
* nor `images` are provided, or when more than 4 images are passed.
|
|
64
|
+
*/
|
|
65
|
+
async compose(input) {
|
|
66
|
+
validate(input);
|
|
67
|
+
const payload = normalize(input);
|
|
68
|
+
const hello = await (0, bootstrap_1.waitForBootstrap)();
|
|
69
|
+
const bridge = (0, bootstrap_1.getBridge)();
|
|
70
|
+
if (hello && bridge?.getStatus().ready) {
|
|
71
|
+
try {
|
|
72
|
+
const result = await bridge.request(protocol_1.SHARE_COMPOSE, payload);
|
|
73
|
+
// Hosts that don't echo `accepted` are treated as having taken the
|
|
74
|
+
// payload (the request resolved successfully).
|
|
75
|
+
return { accepted: result?.accepted ?? true };
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
if (err instanceof protocol_1.BridgeErrorObject &&
|
|
79
|
+
(err.code === "NOT_SUPPORTED" || err.code === "TIMEOUT")) {
|
|
80
|
+
// Fall through to the web fallback (download CTA).
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
throw err;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Web fallback: open the download modal. Keep this behavior side-
|
|
88
|
+
// effectful but predictable — apps can detect it via `accepted: false`.
|
|
89
|
+
if (typeof document !== "undefined") {
|
|
90
|
+
(0, store_1.setShareUI)({ open: true });
|
|
91
|
+
}
|
|
92
|
+
return { accepted: false };
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=share.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share.js","sourceRoot":"","sources":["../../../src/internal/capabilities/share.ts"],"names":[],"mappings":";;;AAMA,kDAEC;AA2BD,wDAEC;AArCD,sCAAuC;AACvC,4CAA2D;AAC3D,iDAAsE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AAa,EAAE,OAAO,CAAC,CAAC;gBAChF,mEAAmE;gBACnE,+CAA+C;gBAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,IAAI,IAAI,EAAE,CAAC;YAChD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IACE,GAAG,YAAY,4BAAiB;oBAChC,CAAC,GAAG,CAAC,IAAI,KAAK,eAAe,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,EACxD,CAAC;oBACD,mDAAmD;gBACrD,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,CAAC;gBACZ,CAAC;YACH,CAAC;QACH,CAAC;QAED,kEAAkE;QAClE,wEAAwE;QACxE,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;YACpC,IAAA,kBAAU,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;CACF,CAAC"}
|
|
@@ -6,14 +6,14 @@ const config_1 = require("../config");
|
|
|
6
6
|
// Internal helpers
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
async function fetchCredentials(path) {
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
11
|
-
throw new Error("@eazo/sdk: missing
|
|
9
|
+
const appId = (0, config_1.getAppId)();
|
|
10
|
+
if (!appId) {
|
|
11
|
+
throw new Error("@eazo/sdk: missing app id. Set NEXT_PUBLIC_EAZO_APP_ID or call auth.configure({ appId }).");
|
|
12
12
|
}
|
|
13
13
|
const res = await fetch(`${(0, config_1.getApiBase)()}/api/open/storage-credentials`, {
|
|
14
14
|
method: "POST",
|
|
15
15
|
headers: { "Content-Type": "application/json" },
|
|
16
|
-
body: JSON.stringify({
|
|
16
|
+
body: JSON.stringify({ appId, path }),
|
|
17
17
|
});
|
|
18
18
|
if (!res.ok) {
|
|
19
19
|
let message = `Failed to get storage credentials: ${res.status}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../src/internal/capabilities/storage.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../src/internal/capabilities/storage.ts"],"names":[],"mappings":";;;AAAA,sCAAiD;AA0BjD,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,KAAK,UAAU,gBAAgB,CAAC,IAAY;IAC1C,MAAM,KAAK,GAAG,IAAA,iBAAQ,GAAE,CAAC;IACzB,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAC;IACJ,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAA,mBAAU,GAAE,+BAA+B,EAAE;QACtE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;KACtC,CAAC,CAAC;IAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,IAAI,OAAO,GAAG,sCAAsC,GAAG,CAAC,MAAM,EAAE,CAAC;QACjE,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAA0B,CAAC;YACtD,IAAI,IAAI,EAAE,OAAO;gBAAE,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5C,CAAC;QAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAkC,CAAC;IAC9D,OAAO,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC;AAED,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAEjE,QAAA,OAAO,GAAG;IACrB;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,MAAM,CACV,IAAY,EACZ,IAAiB,EACjB,UAAoC,EAAE;QAEtC,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,CAAC,IAAI,YAAY,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC;QAE3G,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE;YAC1C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE;SACzC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,qCAAqC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,IAAY;QACzB,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACF,CAAC"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* Shared runtime configuration — kept dependency-free so both bootstrap
|
|
3
3
|
* and capability modules can read/write without circular imports.
|
|
4
4
|
*/
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function setAppId(id: string | null): void;
|
|
6
6
|
/**
|
|
7
|
-
* Returns the configured
|
|
8
|
-
*
|
|
9
|
-
* `auth.configure({
|
|
7
|
+
* Returns the configured Eazo app ID. Falls back to
|
|
8
|
+
* NEXT_PUBLIC_EAZO_APP_ID when no explicit override has been set via
|
|
9
|
+
* `auth.configure({ appId })`.
|
|
10
10
|
*/
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function getAppId(): string | null;
|
|
12
12
|
/**
|
|
13
13
|
* Returns the configured API base URL.
|
|
14
14
|
* Priority: explicit override -> NEXT_PUBLIC_EAZO_API_URL -> default.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/internal/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,wBAAgB,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/internal/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,IAAI,MAAM,GAAG,IAAI,CAMxC;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAMpD;AAED,wBAAgB,aAAa,IAAI,IAAI,CAEpC"}
|
package/dist/internal/config.js
CHANGED
|
@@ -4,25 +4,25 @@
|
|
|
4
4
|
* and capability modules can read/write without circular imports.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
7
|
+
exports.setAppId = setAppId;
|
|
8
|
+
exports.getAppId = getAppId;
|
|
9
9
|
exports.getApiBase = getApiBase;
|
|
10
10
|
exports.__resetConfig = __resetConfig;
|
|
11
|
-
let
|
|
11
|
+
let appId = null;
|
|
12
12
|
const DEFAULT_API_BASE = "https://eazo.ai";
|
|
13
|
-
function
|
|
14
|
-
|
|
13
|
+
function setAppId(id) {
|
|
14
|
+
appId = id;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Returns the configured
|
|
18
|
-
*
|
|
19
|
-
* `auth.configure({
|
|
17
|
+
* Returns the configured Eazo app ID. Falls back to
|
|
18
|
+
* NEXT_PUBLIC_EAZO_APP_ID when no explicit override has been set via
|
|
19
|
+
* `auth.configure({ appId })`.
|
|
20
20
|
*/
|
|
21
|
-
function
|
|
22
|
-
if (
|
|
23
|
-
return
|
|
24
|
-
if (typeof process !== "undefined" && process.env.
|
|
25
|
-
return process.env.
|
|
21
|
+
function getAppId() {
|
|
22
|
+
if (appId)
|
|
23
|
+
return appId;
|
|
24
|
+
if (typeof process !== "undefined" && process.env.NEXT_PUBLIC_EAZO_APP_ID) {
|
|
25
|
+
return process.env.NEXT_PUBLIC_EAZO_APP_ID;
|
|
26
26
|
}
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
@@ -39,6 +39,6 @@ function getApiBase(override) {
|
|
|
39
39
|
return DEFAULT_API_BASE;
|
|
40
40
|
}
|
|
41
41
|
function __resetConfig() {
|
|
42
|
-
|
|
42
|
+
appId = null;
|
|
43
43
|
}
|
|
44
44
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/internal/config.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAKH,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/internal/config.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAKH,4BAEC;AAOD,4BAMC;AAMD,gCAMC;AAED,sCAEC;AAlCD,IAAI,KAAK,GAAkB,IAAI,CAAC;AAChC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAE3C,SAAgB,QAAQ,CAAC,EAAiB;IACxC,KAAK,GAAG,EAAE,CAAC;AACb,CAAC;AAED;;;;GAIG;AACH,SAAgB,QAAQ;IACtB,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IACxB,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,CAAC;QAC1E,OAAO,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC;IAC7C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,SAAgB,UAAU,CAAC,QAAiB;IAC1C,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACjD,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,CAAC;QAC3E,OAAO,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,SAAgB,aAAa;IAC3B,KAAK,GAAG,IAAI,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare function CloseIcon({ size }: {
|
|
3
|
+
size?: number;
|
|
4
|
+
}): React.ReactElement;
|
|
5
|
+
/**
|
|
6
|
+
* A minimal phone-with-arrow glyph: hints the modal is about continuing
|
|
7
|
+
* the share flow inside a mobile app. Inline SVG keeps the SDK free of
|
|
8
|
+
* an icon-pack dependency.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ShareToPhoneIcon({ size }: {
|
|
11
|
+
size?: number;
|
|
12
|
+
}): React.ReactElement;
|
|
13
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/internal/share-ui/icons.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,wBAAgB,SAAS,CAAC,EAAE,IAAS,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,KAAK,CAAC,YAAY,CAiB9E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,IAAS,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,KAAK,CAAC,YAAY,CAmBrF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CloseIcon = CloseIcon;
|
|
5
|
+
exports.ShareToPhoneIcon = ShareToPhoneIcon;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
function CloseIcon({ size = 16 }) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { "aria-hidden": "true", width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), (0, jsx_runtime_1.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })] }));
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A minimal phone-with-arrow glyph: hints the modal is about continuing
|
|
12
|
+
* the share flow inside a mobile app. Inline SVG keeps the SDK free of
|
|
13
|
+
* an icon-pack dependency.
|
|
14
|
+
*/
|
|
15
|
+
function ShareToPhoneIcon({ size = 28 }) {
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { "aria-hidden": "true", width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("rect", { x: "7", y: "2.5", width: "10", height: "19", rx: "2.4" }), (0, jsx_runtime_1.jsx)("line", { x1: "11", y1: "18.5", x2: "13", y2: "18.5" }), (0, jsx_runtime_1.jsx)("path", { d: "M3 10.5h7" }), (0, jsx_runtime_1.jsx)("path", { d: "M7 7l-3.5 3.5L7 14" })] }));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","sour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B,GAAG,IAC3B,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* "Continue in the Eazo app" modal, mounted by `<EazoProvider>`. Opens
|
|
4
|
+
* automatically when `share.compose()` is called outside the mobile
|
|
5
|
+
* WebView (or when the host doesn't advertise `share.compose`).
|
|
6
|
+
*/
|
|
7
|
+
export declare function ShareDownloadModal(): React.ReactElement | null;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/share-ui/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,KAAK,CAAC,YAAY,GAAG,IAAI,CAgD9D"}
|
|
@@ -0,0 +1,63 @@
|
|
|
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.ShareDownloadModal = ShareDownloadModal;
|
|
38
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
+
const Dialog = __importStar(require("@radix-ui/react-dialog"));
|
|
40
|
+
const React = __importStar(require("react"));
|
|
41
|
+
const share_1 = require("../capabilities/share");
|
|
42
|
+
const store_1 = require("../store");
|
|
43
|
+
const icons_1 = require("./icons");
|
|
44
|
+
const styles_1 = require("./styles");
|
|
45
|
+
function useShareUI() {
|
|
46
|
+
return React.useSyncExternalStore(store_1.store.subscribe, () => store_1.store.getSnapshot().shareUI, () => store_1.store.getSnapshot().shareUI);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* "Continue in the Eazo app" modal, mounted by `<EazoProvider>`. Opens
|
|
50
|
+
* automatically when `share.compose()` is called outside the mobile
|
|
51
|
+
* WebView (or when the host doesn't advertise `share.compose`).
|
|
52
|
+
*/
|
|
53
|
+
function ShareDownloadModal() {
|
|
54
|
+
const ui = useShareUI();
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
(0, styles_1.ensureShareStylesInjected)();
|
|
57
|
+
}, []);
|
|
58
|
+
if (typeof document === "undefined")
|
|
59
|
+
return null;
|
|
60
|
+
const close = () => (0, store_1.setShareUI)({ open: false });
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(Dialog.Root, { open: ui.open, onOpenChange: (next) => !next && close(), children: (0, jsx_runtime_1.jsxs)(Dialog.Portal, { children: [(0, jsx_runtime_1.jsx)(Dialog.Overlay, { className: "eazo-share-overlay" }), (0, jsx_runtime_1.jsxs)(Dialog.Content, { className: "eazo-share-content", "aria-describedby": undefined, children: [(0, jsx_runtime_1.jsx)(Dialog.Close, { className: "eazo-share-close", "aria-label": "Close", children: (0, jsx_runtime_1.jsx)(icons_1.CloseIcon, { size: 16 }) }), (0, jsx_runtime_1.jsx)("div", { className: "eazo-share-icon-frame", "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)(icons_1.ShareToPhoneIcon, { size: 28 }) }), (0, jsx_runtime_1.jsx)(Dialog.Title, { className: "eazo-share-title", children: "Continue in the Eazo app" }), (0, jsx_runtime_1.jsx)(Dialog.Description, { className: "eazo-share-subtitle", children: "Sharing to the Eazo Community is available in the mobile app. Open Eazo to draft and publish this post." }), (0, jsx_runtime_1.jsx)("a", { className: "eazo-share-cta", href: (0, share_1.getShareDownloadUrl)(), target: "_blank", rel: "noreferrer noopener", onClick: close, children: "Get the Eazo app" }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "eazo-share-secondary", onClick: close, children: "Not now" })] })] }) }));
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internal/share-ui/index.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBb,gDAgDC;;AArED,+DAAiD;AACjD,6CAA+B;AAE/B,iDAA4D;AAC5D,oCAA6C;AAC7C,mCAAsD;AACtD,qCAAqD;AAErD,SAAS,UAAU;IACjB,OAAO,KAAK,CAAC,oB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AAS,EAAC,gBAAgB,EAC1B,IAAI,EAAE,IAAA,2BAAmB,GAAE,EAC3B,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,OAAO,EAAE,KAAK,iCAGZ,EACJ,mCAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,sBAAsB,EAAC,OAAO,EAAE,KAAK,wBAE5D,IACM,IACH,GACJ,CACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const SHARE_UI_CSS = "\n.eazo-share-overlay {\n position: fixed;\n inset: 0;\n z-index: 2147483600;\n background: rgba(15, 23, 42, 0.36);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n animation: eazo-share-fade-in 180ms ease-out;\n}\n\n.eazo-share-content {\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 2147483601;\n width: calc(100vw - 32px);\n max-width: 380px;\n transform: translate(-50%, -50%);\n border-radius: 24px;\n padding: 28px 24px 22px;\n background: linear-gradient(145deg, #ffffff 0%, #f8f6f3 100%);\n box-shadow: 0 32px 80px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.8);\n color: #0f172a;\n font-family: inherit;\n animation: eazo-share-pop-in 200ms cubic-bezier(0.16, 1, 0.3, 1);\n text-align: center;\n}\n\n@keyframes eazo-share-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n@keyframes eazo-share-pop-in {\n from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }\n to { opacity: 1; transform: translate(-50%, -50%) scale(1); }\n}\n\n.eazo-share-close {\n position: absolute;\n top: 14px;\n right: 14px;\n width: 32px;\n height: 32px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border: 0;\n border-radius: 999px;\n background: rgba(255, 255, 255, 0.88);\n color: #78716c;\n box-shadow: 0 4px 12px rgba(22, 28, 40, 0.08);\n cursor: pointer;\n transition: color 120ms ease, background 120ms ease;\n}\n.eazo-share-close:hover { color: #292524; background: #ffffff; }\n\n.eazo-share-icon-frame {\n width: 56px;\n height: 56px;\n margin: 4px auto 14px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: 18px;\n background: linear-gradient(180deg, rgba(244, 122, 66, 0.18) 0%, rgba(238, 92, 42, 0.08) 100%);\n color: #EE5C2A;\n}\n\n.eazo-share-title {\n margin: 0;\n font-size: 22px;\n font-weight: 600;\n letter-spacing: -0.01em;\n color: rgba(15, 23, 42, 0.92);\n}\n.eazo-share-subtitle {\n margin: 8px 4px 22px;\n font-size: 14px;\n font-weight: 500;\n line-height: 1.5;\n color: rgba(15, 23, 42, 0.58);\n}\n\n.eazo-share-cta {\n display: inline-flex;\n width: 100%;\n height: 48px;\n align-items: center;\n justify-content: center;\n border: 0;\n border-radius: 14px;\n background: linear-gradient(180deg, #F47A42 0%, #EE5C2A 100%);\n color: #ffffff;\n font-size: 15px;\n font-weight: 600;\n text-decoration: none;\n cursor: pointer;\n box-shadow: 0 12px 24px rgba(238, 92, 42, 0.32);\n transition: filter 160ms ease, box-shadow 160ms ease;\n}\n.eazo-share-cta:hover {\n filter: brightness(1.05);\n box-shadow: 0 14px 30px rgba(238, 92, 42, 0.36);\n}\n\n.eazo-share-secondary {\n margin-top: 10px;\n background: transparent;\n border: 0;\n color: rgba(15, 23, 42, 0.52);\n font-size: 13px;\n font-weight: 500;\n cursor: pointer;\n padding: 8px 12px;\n}\n.eazo-share-secondary:hover { color: rgba(15, 23, 42, 0.78); }\n";
|
|
2
|
+
export declare function ensureShareStylesInjected(): void;
|
|
3
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/internal/share-ui/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,m4FAqHxB,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,IAAI,CAQhD"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SHARE_UI_CSS = void 0;
|
|
4
|
+
exports.ensureShareStylesInjected = ensureShareStylesInjected;
|
|
5
|
+
const STYLE_ID = "eazo-sdk-share-ui";
|
|
6
|
+
exports.SHARE_UI_CSS = `
|
|
7
|
+
.eazo-share-overlay {
|
|
8
|
+
position: fixed;
|
|
9
|
+
inset: 0;
|
|
10
|
+
z-index: 2147483600;
|
|
11
|
+
background: rgba(15, 23, 42, 0.36);
|
|
12
|
+
backdrop-filter: blur(8px);
|
|
13
|
+
-webkit-backdrop-filter: blur(8px);
|
|
14
|
+
animation: eazo-share-fade-in 180ms ease-out;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.eazo-share-content {
|
|
18
|
+
position: fixed;
|
|
19
|
+
top: 50%;
|
|
20
|
+
left: 50%;
|
|
21
|
+
z-index: 2147483601;
|
|
22
|
+
width: calc(100vw - 32px);
|
|
23
|
+
max-width: 380px;
|
|
24
|
+
transform: translate(-50%, -50%);
|
|
25
|
+
border-radius: 24px;
|
|
26
|
+
padding: 28px 24px 22px;
|
|
27
|
+
background: linear-gradient(145deg, #ffffff 0%, #f8f6f3 100%);
|
|
28
|
+
box-shadow: 0 32px 80px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.8);
|
|
29
|
+
color: #0f172a;
|
|
30
|
+
font-family: inherit;
|
|
31
|
+
animation: eazo-share-pop-in 200ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
32
|
+
text-align: center;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@keyframes eazo-share-fade-in {
|
|
36
|
+
from { opacity: 0; }
|
|
37
|
+
to { opacity: 1; }
|
|
38
|
+
}
|
|
39
|
+
@keyframes eazo-share-pop-in {
|
|
40
|
+
from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
|
|
41
|
+
to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.eazo-share-close {
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 14px;
|
|
47
|
+
right: 14px;
|
|
48
|
+
width: 32px;
|
|
49
|
+
height: 32px;
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
border: 0;
|
|
54
|
+
border-radius: 999px;
|
|
55
|
+
background: rgba(255, 255, 255, 0.88);
|
|
56
|
+
color: #78716c;
|
|
57
|
+
box-shadow: 0 4px 12px rgba(22, 28, 40, 0.08);
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
transition: color 120ms ease, background 120ms ease;
|
|
60
|
+
}
|
|
61
|
+
.eazo-share-close:hover { color: #292524; background: #ffffff; }
|
|
62
|
+
|
|
63
|
+
.eazo-share-icon-frame {
|
|
64
|
+
width: 56px;
|
|
65
|
+
height: 56px;
|
|
66
|
+
margin: 4px auto 14px;
|
|
67
|
+
display: inline-flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
border-radius: 18px;
|
|
71
|
+
background: linear-gradient(180deg, rgba(244, 122, 66, 0.18) 0%, rgba(238, 92, 42, 0.08) 100%);
|
|
72
|
+
color: #EE5C2A;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.eazo-share-title {
|
|
76
|
+
margin: 0;
|
|
77
|
+
font-size: 22px;
|
|
78
|
+
font-weight: 600;
|
|
79
|
+
letter-spacing: -0.01em;
|
|
80
|
+
color: rgba(15, 23, 42, 0.92);
|
|
81
|
+
}
|
|
82
|
+
.eazo-share-subtitle {
|
|
83
|
+
margin: 8px 4px 22px;
|
|
84
|
+
font-size: 14px;
|
|
85
|
+
font-weight: 500;
|
|
86
|
+
line-height: 1.5;
|
|
87
|
+
color: rgba(15, 23, 42, 0.58);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.eazo-share-cta {
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
width: 100%;
|
|
93
|
+
height: 48px;
|
|
94
|
+
align-items: center;
|
|
95
|
+
justify-content: center;
|
|
96
|
+
border: 0;
|
|
97
|
+
border-radius: 14px;
|
|
98
|
+
background: linear-gradient(180deg, #F47A42 0%, #EE5C2A 100%);
|
|
99
|
+
color: #ffffff;
|
|
100
|
+
font-size: 15px;
|
|
101
|
+
font-weight: 600;
|
|
102
|
+
text-decoration: none;
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
box-shadow: 0 12px 24px rgba(238, 92, 42, 0.32);
|
|
105
|
+
transition: filter 160ms ease, box-shadow 160ms ease;
|
|
106
|
+
}
|
|
107
|
+
.eazo-share-cta:hover {
|
|
108
|
+
filter: brightness(1.05);
|
|
109
|
+
box-shadow: 0 14px 30px rgba(238, 92, 42, 0.36);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.eazo-share-secondary {
|
|
113
|
+
margin-top: 10px;
|
|
114
|
+
background: transparent;
|
|
115
|
+
border: 0;
|
|
116
|
+
color: rgba(15, 23, 42, 0.52);
|
|
117
|
+
font-size: 13px;
|
|
118
|
+
font-weight: 500;
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
padding: 8px 12px;
|
|
121
|
+
}
|
|
122
|
+
.eazo-share-secondary:hover { color: rgba(15, 23, 42, 0.78); }
|
|
123
|
+
`;
|
|
124
|
+
function ensureShareStylesInjected() {
|
|
125
|
+
if (typeof document === "undefined")
|
|
126
|
+
return;
|
|
127
|
+
if (document.getElementById(STYLE_ID))
|
|
128
|
+
return;
|
|
129
|
+
const style = document.createElement("style");
|
|
130
|
+
style.id = STYLE_ID;
|
|
131
|
+
style.setAttribute("data-eazo-sdk", "share-ui");
|
|
132
|
+
style.textContent = exports.SHARE_UI_CSS;
|
|
133
|
+
document.head.appendChild(style);
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/internal/share-ui/styles.ts"],"names":[],"mappings":";;;AAyHA,8DAQC;AAjID,MAAM,QAAQ,GAAG,mBAAmB,CAAC;AAExB,QAAA,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqH3B,CAAC;AAEF,SAAgB,yBAAyB;IACvC,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO;IAC5C,IAAI,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC;QAAE,OAAO;IAC9C,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,EAAE,GAAG,QAAQ,CAAC;IACpB,KAAK,CAAC,YAAY,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IAChD,KAAK,CAAC,WAAW,GAAG,oBAAY,CAAC;IACjC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC"}
|