arcy.js 0.0.2 → 0.1.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 +94 -3
- package/dist/arcy.chat.ab181cf5a84b.js +1258 -0
- package/dist/arcy.flow.fef131718e42.js +3 -0
- package/dist/arcy.legacy.ab4e9266b657.js +567 -0
- package/dist/arcy.loader.js +2 -0
- package/dist/arcy.modern.60faeffc62a2.js +567 -0
- package/dist/arcy.picker.c598a581d964.js +59 -0
- package/dist/design-mode.cjs +135 -0
- package/dist/design-mode.d.cts +197 -0
- package/dist/design-mode.d.ts +197 -0
- package/dist/design-mode.js +127 -0
- package/dist/fonts/dm-sans-latin-ext.woff2 +0 -0
- package/dist/fonts/dm-sans-latin.woff2 +0 -0
- package/dist/fonts/ibm-plex-sans-latin-ext.woff2 +0 -0
- package/dist/fonts/ibm-plex-sans-latin.woff2 +0 -0
- package/dist/fonts/inter-latin-ext.woff2 +0 -0
- package/dist/fonts/inter-latin.woff2 +0 -0
- package/dist/fonts/lato-latin-ext.woff2 +0 -0
- package/dist/fonts/lato-latin.woff2 +0 -0
- package/dist/fonts/manrope-latin-ext.woff2 +0 -0
- package/dist/fonts/manrope-latin.woff2 +0 -0
- package/dist/fonts/montserrat-latin-ext.woff2 +0 -0
- package/dist/fonts/montserrat-latin.woff2 +0 -0
- package/dist/fonts/nunito-latin-ext.woff2 +0 -0
- package/dist/fonts/nunito-latin.woff2 +0 -0
- package/dist/fonts/open-sans-latin-ext.woff2 +0 -0
- package/dist/fonts/open-sans-latin.woff2 +0 -0
- package/dist/fonts/playfair-display-latin-ext.woff2 +0 -0
- package/dist/fonts/playfair-display-latin.woff2 +0 -0
- package/dist/fonts/poppins-latin-ext.woff2 +0 -0
- package/dist/fonts/poppins-latin.woff2 +0 -0
- package/dist/fonts/roboto-latin-ext.woff2 +0 -0
- package/dist/fonts/roboto-latin.woff2 +0 -0
- package/dist/fonts/source-sans-3-latin-ext.woff2 +0 -0
- package/dist/fonts/source-sans-3-latin.woff2 +0 -0
- package/dist/fonts/work-sans-latin-ext.woff2 +0 -0
- package/dist/fonts/work-sans-latin.woff2 +0 -0
- package/dist/index.cjs +5114 -0
- package/dist/index.d.cts +133 -0
- package/dist/index.d.ts +133 -0
- package/dist/index.js +5109 -0
- package/dist/snippet.cjs +46 -0
- package/dist/snippet.d.cts +39 -0
- package/dist/snippet.d.ts +39 -0
- package/dist/snippet.js +43 -0
- package/package.json +69 -5
- package/index.js +0 -5
package/README.md
CHANGED
|
@@ -1,7 +1,98 @@
|
|
|
1
1
|
# arcy.js
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Embed an [ARCY](https://arcyai.com) AI agent in any web app. The agent talks to your users, learns what they are trying to do, and acts on their behalf.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
No framework required. arcy.js is plain JavaScript that runs on any page, and it ships its own TypeScript types.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
> BETA. The API below is frozen, but the product around it is still moving. Report anything broken at [arcyai.com](https://arcyai.com).
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install arcy.js
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Also works with `pnpm add arcy.js`, `bun add arcy.js`, and `yarn add arcy.js`.
|
|
16
|
+
|
|
17
|
+
There is no separate types package. Types are bundled, so `@types/arcy.js` does not exist and you do not need it.
|
|
18
|
+
|
|
19
|
+
## Use it
|
|
20
|
+
|
|
21
|
+
Two calls, once, where your app starts. `init()` connects your environment. `identify()` says who the current user is.
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import arcy from "arcy.js"
|
|
25
|
+
|
|
26
|
+
arcy.init("YOUR_ENVIRONMENT_TOKEN")
|
|
27
|
+
|
|
28
|
+
arcy.identify(user.id, {
|
|
29
|
+
user_first_name: user.firstName,
|
|
30
|
+
user_email: user.email,
|
|
31
|
+
user_signed_up_at: user.createdAt,
|
|
32
|
+
})
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Your environment token, with the real value already filled in, is in the dashboard under **Settings > Installation**.
|
|
36
|
+
|
|
37
|
+
arcy.js runs in the browser only. In Next.js, React Router, Nuxt, or any framework that renders on the server, keep both calls inside a client component or a mount effect.
|
|
38
|
+
|
|
39
|
+
### Without a bundler
|
|
40
|
+
|
|
41
|
+
Paste two script tags before `</body>`. Nothing to install.
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<script src="https://cdn.arcyai.com/arcy.loader.js"></script>
|
|
45
|
+
<script>
|
|
46
|
+
arcy.init("YOUR_ENVIRONMENT_TOKEN")
|
|
47
|
+
arcy.identify("USER_ID", {
|
|
48
|
+
user_first_name: "USER_FIRST_NAME",
|
|
49
|
+
user_email: "USER_EMAIL",
|
|
50
|
+
})
|
|
51
|
+
</script>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## API
|
|
55
|
+
|
|
56
|
+
| Method | What it does |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| `init(token, options?)` | Starts ARCY with your environment token. |
|
|
59
|
+
| `identify(userId, attributes?, options?)` | Names the signed-in user and sends their attributes. |
|
|
60
|
+
| `identifyAnonymous(attributes?)` | Same, for a user who has not signed in. |
|
|
61
|
+
| `updateUser(attributes?)` | Sends new attribute values for the current user. |
|
|
62
|
+
| `reset()` | Clears the session. Call it on sign-out. |
|
|
63
|
+
| `open()` / `close()` | Opens or closes the chat panel. |
|
|
64
|
+
| `on(event, handler)` | Listens for `"ready"`, `"open"`, or `"close"`. Returns an unsubscribe function. |
|
|
65
|
+
| `VERSION` | The version of arcy.js on the page. |
|
|
66
|
+
|
|
67
|
+
Nothing here throws, and no promise it returns rejects. A failure resolves and reports through a console warning, so ARCY can never take your page down.
|
|
68
|
+
|
|
69
|
+
Attribute values may be a string, number, boolean, string array, or `null`. Passing `null` clears the key.
|
|
70
|
+
|
|
71
|
+
### Options for `init()`
|
|
72
|
+
|
|
73
|
+
| Option | What it does |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| `telemetry` | Consent signal for behavioral telemetry. Wire this to your cookie banner. |
|
|
76
|
+
| `locale` | The reply language of the agent, as a two-letter code (`"en"`, `"tr"`). |
|
|
77
|
+
| `contentLocale` | The user's content locale, region qualified (`"en-US"`, `"tr-TR"`). |
|
|
78
|
+
| `defaultOpen` | Opens the panel on arrival. |
|
|
79
|
+
|
|
80
|
+
Everything else ARCY does is configured in the dashboard, not in code. There is no config file, no build step, and nothing to redeploy when you change a setting.
|
|
81
|
+
|
|
82
|
+
### Identity verification
|
|
83
|
+
|
|
84
|
+
Pass a `userHash` to prove the user is who your app says they are:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
arcy.identify(user.id, attributes, { userHash })
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`userHash` is `HMAC-SHA256(environment secret, userId)`, computed on your server. Never compute it in the browser.
|
|
91
|
+
|
|
92
|
+
## Docs
|
|
93
|
+
|
|
94
|
+
Full setup guides per framework, auth provider snippets, and troubleshooting: [docs.arcyai.com](https://docs.arcyai.com)
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
MIT
|