@elizaos/plugin-contacts 2.0.3-beta.2 → 2.0.3-beta.3
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/dist/components/ContactsAppView.d.ts +16 -0
- package/dist/components/ContactsAppView.d.ts.map +1 -0
- package/dist/components/ContactsAppView.helpers.d.ts +11 -0
- package/dist/components/ContactsAppView.helpers.d.ts.map +1 -0
- package/dist/components/ContactsAppView.helpers.js +36 -0
- package/dist/components/ContactsAppView.helpers.js.map +1 -0
- package/dist/components/ContactsAppView.interact.d.ts +2 -0
- package/dist/components/ContactsAppView.interact.d.ts.map +1 -0
- package/dist/components/ContactsAppView.interact.js +59 -0
- package/dist/components/ContactsAppView.interact.js.map +1 -0
- package/dist/components/ContactsAppView.js +747 -0
- package/dist/components/ContactsAppView.js.map +1 -0
- package/dist/components/ContactsSpatialView.d.ts +48 -0
- package/dist/components/ContactsSpatialView.d.ts.map +1 -0
- package/dist/components/ContactsSpatialView.js +254 -0
- package/dist/components/ContactsSpatialView.js.map +1 -0
- package/dist/components/ContactsView.d.ts +18 -0
- package/dist/components/ContactsView.d.ts.map +1 -0
- package/dist/components/ContactsView.js +163 -0
- package/dist/components/ContactsView.js.map +1 -0
- package/dist/components/contacts-app.d.ts +13 -0
- package/dist/components/contacts-app.d.ts.map +1 -0
- package/dist/components/contacts-app.js +20 -0
- package/dist/components/contacts-app.js.map +1 -0
- package/dist/components/contacts-view-bundle.d.ts +3 -0
- package/dist/components/contacts-view-bundle.d.ts.map +1 -0
- package/dist/components/contacts-view-bundle.js +7 -0
- package/dist/components/contacts-view-bundle.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +13 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +32 -0
- package/dist/plugin.js.map +1 -0
- package/dist/providers/contacts.d.ts +11 -0
- package/dist/providers/contacts.d.ts.map +1 -0
- package/dist/providers/contacts.js +68 -0
- package/dist/providers/contacts.js.map +1 -0
- package/dist/register-terminal-view.d.ts +15 -0
- package/dist/register-terminal-view.d.ts.map +1 -0
- package/dist/register-terminal-view.js +21 -0
- package/dist/register-terminal-view.js.map +1 -0
- package/dist/register.d.ts +10 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +10 -0
- package/dist/register.js.map +1 -0
- package/dist/ui.d.ts +4 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +15 -0
- package/dist/ui.js.map +1 -0
- package/dist/views/bundle.js +467 -0
- package/dist/views/bundle.js.map +1 -0
- package/dist/views/dist-Cd2YtKy4.js +270 -0
- package/dist/views/dist-Cd2YtKy4.js.map +1 -0
- package/dist/views/web-DMSWpoWr.js +39 -0
- package/dist/views/web-DMSWpoWr.js.map +1 -0
- package/package.json +7 -6
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ContactsAppView — full-screen overlay app for the Android address book.
|
|
3
|
+
*
|
|
4
|
+
* Implements the OverlayApp Component contract. Backed by the
|
|
5
|
+
* @elizaos/capacitor-contacts native plugin which exposes:
|
|
6
|
+
* - listContacts({ query, limit })
|
|
7
|
+
* - createContact({ displayName, phoneNumber(s), emailAddress(es) })
|
|
8
|
+
* - importVCard({ vcardText })
|
|
9
|
+
*
|
|
10
|
+
* The native plugin does not currently expose update or delete, so the detail
|
|
11
|
+
* panel is read-only; "Edit" creates a new contact entry rather than mutating
|
|
12
|
+
* an existing row.
|
|
13
|
+
*/
|
|
14
|
+
import type { OverlayAppContext } from "@elizaos/ui";
|
|
15
|
+
export declare function ContactsAppView({ exitToApps, t }: OverlayAppContext): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=ContactsAppView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContactsAppView.d.ts","sourceRoot":"","sources":["../../src/components/ContactsAppView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AA8ErD,wBAAgB,eAAe,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,iBAAiB,2CAoQnE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ContactSummary } from "@elizaos/capacitor-contacts";
|
|
2
|
+
export declare function matchesQuery(contact: ContactSummary, q: string): boolean;
|
|
3
|
+
export declare function loadContactsState(options?: {
|
|
4
|
+
query?: string;
|
|
5
|
+
limit?: number;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
contacts: ContactSummary[];
|
|
8
|
+
query: string;
|
|
9
|
+
count: number;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=ContactsAppView.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContactsAppView.helpers.d.ts","sourceRoot":"","sources":["../../src/components/ContactsAppView.helpers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,6BAA6B,CAAC;AAE5E,wBAAgB,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAexE;AAOD,wBAAsB,iBAAiB,CAAC,OAAO,CAAC,EAAE;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;;;;GAkBA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Contacts } from "@elizaos/capacitor-contacts";
|
|
2
|
+
function matchesQuery(contact, q) {
|
|
3
|
+
if (q.length === 0) return true;
|
|
4
|
+
const needle = q.toLowerCase();
|
|
5
|
+
if (contact.displayName.toLowerCase().includes(needle)) return true;
|
|
6
|
+
if (contact.phoneNumbers.some((p) => p.toLowerCase().includes(needle))) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
if (contact.emailAddresses.some((e) => e.toLowerCase().includes(needle))) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
function normalizeContactsLimit(value, fallback = 200) {
|
|
15
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return fallback;
|
|
16
|
+
return Math.min(500, Math.max(1, Math.trunc(value)));
|
|
17
|
+
}
|
|
18
|
+
async function loadContactsState(options) {
|
|
19
|
+
const query = options?.query?.trim() ?? "";
|
|
20
|
+
const limit = typeof options?.limit === "number" ? normalizeContactsLimit(options.limit) : void 0;
|
|
21
|
+
const result = await Contacts.listContacts({
|
|
22
|
+
...query ? { query } : {},
|
|
23
|
+
...typeof limit === "number" ? { limit } : {}
|
|
24
|
+
});
|
|
25
|
+
const contacts = query ? result.contacts.filter((contact) => matchesQuery(contact, query)) : result.contacts;
|
|
26
|
+
return {
|
|
27
|
+
contacts,
|
|
28
|
+
query,
|
|
29
|
+
count: contacts.length
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
loadContactsState,
|
|
34
|
+
matchesQuery
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=ContactsAppView.helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/ContactsAppView.helpers.ts"],"sourcesContent":["// Shared (non-component) data helpers for the contacts overlay. Kept out of\n// ContactsAppView.tsx so that file exports only React components and stays\n// Fast-Refresh-compatible. Used by both the view components and the view-bundle\n// `interact` handler.\n\nimport { type ContactSummary, Contacts } from \"@elizaos/capacitor-contacts\";\n\nexport function matchesQuery(contact: ContactSummary, q: string): boolean {\n if (q.length === 0) return true;\n const needle = q.toLowerCase();\n if (contact.displayName.toLowerCase().includes(needle)) return true;\n if (\n contact.phoneNumbers.some((p: string) => p.toLowerCase().includes(needle))\n ) {\n return true;\n }\n if (\n contact.emailAddresses.some((e: string) => e.toLowerCase().includes(needle))\n ) {\n return true;\n }\n return false;\n}\n\nfunction normalizeContactsLimit(value: unknown, fallback = 200): number {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return fallback;\n return Math.min(500, Math.max(1, Math.trunc(value)));\n}\n\nexport async function loadContactsState(options?: {\n query?: string;\n limit?: number;\n}) {\n const query = options?.query?.trim() ?? \"\";\n const limit =\n typeof options?.limit === \"number\"\n ? normalizeContactsLimit(options.limit)\n : undefined;\n const result = await Contacts.listContacts({\n ...(query ? { query } : {}),\n ...(typeof limit === \"number\" ? { limit } : {}),\n });\n const contacts = query\n ? result.contacts.filter((contact) => matchesQuery(contact, query))\n : result.contacts;\n return {\n contacts,\n query,\n count: contacts.length,\n };\n}\n"],"mappings":"AAKA,SAA8B,gBAAgB;AAEvC,SAAS,aAAa,SAAyB,GAAoB;AACxE,MAAI,EAAE,WAAW,EAAG,QAAO;AAC3B,QAAM,SAAS,EAAE,YAAY;AAC7B,MAAI,QAAQ,YAAY,YAAY,EAAE,SAAS,MAAM,EAAG,QAAO;AAC/D,MACE,QAAQ,aAAa,KAAK,CAAC,MAAc,EAAE,YAAY,EAAE,SAAS,MAAM,CAAC,GACzE;AACA,WAAO;AAAA,EACT;AACA,MACE,QAAQ,eAAe,KAAK,CAAC,MAAc,EAAE,YAAY,EAAE,SAAS,MAAM,CAAC,GAC3E;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEA,SAAS,uBAAuB,OAAgB,WAAW,KAAa;AACtE,MAAI,OAAO,UAAU,YAAY,CAAC,OAAO,SAAS,KAAK,EAAG,QAAO;AACjE,SAAO,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,CAAC,CAAC;AACrD;AAEA,eAAsB,kBAAkB,SAGrC;AACD,QAAM,QAAQ,SAAS,OAAO,KAAK,KAAK;AACxC,QAAM,QACJ,OAAO,SAAS,UAAU,WACtB,uBAAuB,QAAQ,KAAK,IACpC;AACN,QAAM,SAAS,MAAM,SAAS,aAAa;AAAA,IACzC,GAAI,QAAQ,EAAE,MAAM,IAAI,CAAC;AAAA,IACzB,GAAI,OAAO,UAAU,WAAW,EAAE,MAAM,IAAI,CAAC;AAAA,EAC/C,CAAC;AACD,QAAM,WAAW,QACb,OAAO,SAAS,OAAO,CAAC,YAAY,aAAa,SAAS,KAAK,CAAC,IAChE,OAAO;AACX,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,OAAO,SAAS;AAAA,EAClB;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContactsAppView.interact.d.ts","sourceRoot":"","sources":["../../src/components/ContactsAppView.interact.ts"],"names":[],"mappings":"AAWA,wBAAsB,QAAQ,CAC5B,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,OAAO,CAAC,CA2DlB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Contacts
|
|
3
|
+
} from "@elizaos/capacitor-contacts";
|
|
4
|
+
import { loadContactsState } from "./ContactsAppView.helpers";
|
|
5
|
+
async function interact(capability, params) {
|
|
6
|
+
if (capability === "terminal-list-contacts") {
|
|
7
|
+
const state = await loadContactsState({
|
|
8
|
+
query: typeof params?.query === "string" ? params.query : void 0,
|
|
9
|
+
limit: typeof params?.limit === "number" ? params.limit : void 0
|
|
10
|
+
});
|
|
11
|
+
return {
|
|
12
|
+
viewType: "tui",
|
|
13
|
+
query: state.query,
|
|
14
|
+
count: state.count,
|
|
15
|
+
contacts: state.contacts.map((contact) => ({
|
|
16
|
+
id: contact.id,
|
|
17
|
+
lookupKey: contact.lookupKey,
|
|
18
|
+
displayName: contact.displayName,
|
|
19
|
+
phoneNumbers: contact.phoneNumbers,
|
|
20
|
+
emailAddresses: contact.emailAddresses,
|
|
21
|
+
starred: contact.starred
|
|
22
|
+
}))
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (capability === "terminal-create-contact") {
|
|
26
|
+
const displayName = typeof params?.displayName === "string" ? params.displayName.trim() : "";
|
|
27
|
+
if (!displayName) throw new Error("displayName is required");
|
|
28
|
+
const payload = { displayName };
|
|
29
|
+
const phoneNumber = typeof params?.phoneNumber === "string" ? params.phoneNumber.trim() : "";
|
|
30
|
+
const emailAddress = typeof params?.emailAddress === "string" ? params.emailAddress.trim() : "";
|
|
31
|
+
if (phoneNumber) payload.phoneNumber = phoneNumber;
|
|
32
|
+
if (emailAddress) payload.emailAddress = emailAddress;
|
|
33
|
+
const result = await Contacts.createContact(payload);
|
|
34
|
+
return { created: true, id: result.id, viewType: "tui" };
|
|
35
|
+
}
|
|
36
|
+
if (capability === "terminal-import-vcard") {
|
|
37
|
+
const vcardText = typeof params?.vcardText === "string" ? params.vcardText.trim() : "";
|
|
38
|
+
if (!vcardText) throw new Error("vcardText is required");
|
|
39
|
+
const result = await Contacts.importVCard({ vcardText });
|
|
40
|
+
return {
|
|
41
|
+
imported: result.imported.length,
|
|
42
|
+
contacts: result.imported.map((contact) => ({
|
|
43
|
+
id: contact.id,
|
|
44
|
+
lookupKey: contact.lookupKey,
|
|
45
|
+
displayName: contact.displayName,
|
|
46
|
+
phoneNumbers: contact.phoneNumbers,
|
|
47
|
+
emailAddresses: contact.emailAddresses,
|
|
48
|
+
starred: contact.starred,
|
|
49
|
+
sourceName: contact.sourceName
|
|
50
|
+
})),
|
|
51
|
+
viewType: "tui"
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
throw new Error(`Unsupported capability "${capability}"`);
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
interact
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=ContactsAppView.interact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/ContactsAppView.interact.ts"],"sourcesContent":["// View-bundle `interact` capability handler, split out of ContactsAppView.tsx so\n// that file exports only React components and stays Fast-Refresh-compatible\n// (Vite would full-reload a component file that also exports a plain function).\n// The view bundle re-exports `interact` via ./contacts-view-bundle.ts.\n\nimport {\n Contacts,\n type CreateContactOptions,\n} from \"@elizaos/capacitor-contacts\";\nimport { loadContactsState } from \"./ContactsAppView.helpers\";\n\nexport async function interact(\n capability: string,\n params?: Record<string, unknown>,\n): Promise<unknown> {\n if (capability === \"terminal-list-contacts\") {\n const state = await loadContactsState({\n query: typeof params?.query === \"string\" ? params.query : undefined,\n limit: typeof params?.limit === \"number\" ? params.limit : undefined,\n });\n return {\n viewType: \"tui\",\n query: state.query,\n count: state.count,\n contacts: state.contacts.map((contact) => ({\n id: contact.id,\n lookupKey: contact.lookupKey,\n displayName: contact.displayName,\n phoneNumbers: contact.phoneNumbers,\n emailAddresses: contact.emailAddresses,\n starred: contact.starred,\n })),\n };\n }\n\n if (capability === \"terminal-create-contact\") {\n const displayName =\n typeof params?.displayName === \"string\" ? params.displayName.trim() : \"\";\n if (!displayName) throw new Error(\"displayName is required\");\n const payload: CreateContactOptions = { displayName };\n const phoneNumber =\n typeof params?.phoneNumber === \"string\" ? params.phoneNumber.trim() : \"\";\n const emailAddress =\n typeof params?.emailAddress === \"string\"\n ? params.emailAddress.trim()\n : \"\";\n if (phoneNumber) payload.phoneNumber = phoneNumber;\n if (emailAddress) payload.emailAddress = emailAddress;\n const result = await Contacts.createContact(payload);\n return { created: true, id: result.id, viewType: \"tui\" };\n }\n\n if (capability === \"terminal-import-vcard\") {\n const vcardText =\n typeof params?.vcardText === \"string\" ? params.vcardText.trim() : \"\";\n if (!vcardText) throw new Error(\"vcardText is required\");\n const result = await Contacts.importVCard({ vcardText });\n return {\n imported: result.imported.length,\n contacts: result.imported.map((contact) => ({\n id: contact.id,\n lookupKey: contact.lookupKey,\n displayName: contact.displayName,\n phoneNumbers: contact.phoneNumbers,\n emailAddresses: contact.emailAddresses,\n starred: contact.starred,\n sourceName: contact.sourceName,\n })),\n viewType: \"tui\",\n };\n }\n\n throw new Error(`Unsupported capability \"${capability}\"`);\n}\n"],"mappings":"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