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/dist/snippet.cjs
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* arcy.js — https://arcyai.com */
|
|
4
|
+
|
|
5
|
+
// src/loader/snippet.ts
|
|
6
|
+
var CDN_BASE = "https://cdn.arcyai.com";
|
|
7
|
+
function buildInstallSnippet({
|
|
8
|
+
token,
|
|
9
|
+
cdnBase = CDN_BASE
|
|
10
|
+
}) {
|
|
11
|
+
return `<script>
|
|
12
|
+
(function(w,d){
|
|
13
|
+
if(w.arcy)return;
|
|
14
|
+
var q=[];
|
|
15
|
+
function push(m,a,r){q.push({method:m,args:a,resolve:r})}
|
|
16
|
+
var a={q:q};
|
|
17
|
+
['init','identify','identifyAnonymous','updateUser'].forEach(function(m){
|
|
18
|
+
a[m]=function(){var x=arguments;return new Promise(function(r){push(m,[].slice.call(x),r)})}
|
|
19
|
+
});
|
|
20
|
+
['reset','open','close','on'].forEach(function(m){
|
|
21
|
+
a[m]=function(){var e={method:m,args:[].slice.call(arguments),resolve:function(){}};q.push(e);
|
|
22
|
+
if(m==='on')return function(){var i=q.indexOf(e);if(i!==-1)q.splice(i,1)}}
|
|
23
|
+
});
|
|
24
|
+
w.arcy=a;
|
|
25
|
+
if(!w.__arcyHistoryPatched){
|
|
26
|
+
w.__arcyHistoryPatched=1;
|
|
27
|
+
var fire=function(){try{w.dispatchEvent(new CustomEvent('arcy:routechange'))}catch(e){}};
|
|
28
|
+
['pushState','replaceState'].forEach(function(m){
|
|
29
|
+
var o=w.history[m];
|
|
30
|
+
if(typeof o==='function')w.history[m]=function(){var v=o.apply(this,arguments);fire();return v}
|
|
31
|
+
});
|
|
32
|
+
w.addEventListener('popstate',fire);
|
|
33
|
+
}
|
|
34
|
+
var s=d.createElement('script');
|
|
35
|
+
s.async=1;
|
|
36
|
+
s.src='${cdnBase}/arcy.loader.js';
|
|
37
|
+
s.onerror=function(){console&&console.warn&&console.warn('[arcy] Failed to load. ARCY is disabled.')};
|
|
38
|
+
var f=d.getElementsByTagName('script')[0];
|
|
39
|
+
f&&f.parentNode?f.parentNode.insertBefore(s,f):(d.head||d.documentElement).appendChild(s);
|
|
40
|
+
a.init('${token}');
|
|
41
|
+
})(window,document);
|
|
42
|
+
<\/script>`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
exports.CDN_BASE = CDN_BASE;
|
|
46
|
+
exports.buildInstallSnippet = buildInstallSnippet;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The HTML install snippet (PRODUCT_SCOPE.md §1.2, ADR 0051).
|
|
3
|
+
*
|
|
4
|
+
* This is the exact text a customer pastes before `</body>`, and slice 5.2
|
|
5
|
+
* renders it on the Installation page with the environment's Token injected.
|
|
6
|
+
*
|
|
7
|
+
* **It is frozen at paste time.** Everything here is unfixable for anyone who
|
|
8
|
+
* has already installed, which is why it is this small and why it contains no
|
|
9
|
+
* version, no browser list, and no product logic. All of that lives in the
|
|
10
|
+
* fetched script, where it can be changed for every existing install at once.
|
|
11
|
+
*/
|
|
12
|
+
/** Unversioned on purpose: see ADR 0051. Pinning would freeze every install. */
|
|
13
|
+
declare const CDN_BASE = "https://cdn.arcyai.com";
|
|
14
|
+
interface SnippetOptions {
|
|
15
|
+
/** The environment Token. Public by construction; it ships in page source. */
|
|
16
|
+
token: string;
|
|
17
|
+
/** Overrides the CDN origin. For local development and tests only. */
|
|
18
|
+
cdnBase?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Builds the paste-ready `<script>` block.
|
|
22
|
+
*
|
|
23
|
+
* The minified body, expanded:
|
|
24
|
+
*
|
|
25
|
+
* 1. Bail out if `window.arcy` already exists, so a snippet pasted twice (very
|
|
26
|
+
* common with tag managers) does not clobber a live queue.
|
|
27
|
+
* 2. Create the stub, queueing every public method so `arcy.init()` on the very
|
|
28
|
+
* next line works before the script has downloaded.
|
|
29
|
+
* 3. Patch `pushState`/`replaceState` and announce navigations as a DOM event.
|
|
30
|
+
* 4. Inject `arcy.loader.js` (ADR 0119), unhashed and revalidated on every
|
|
31
|
+
* load, which itself does the ES-modules probe and injects the real,
|
|
32
|
+
* content-hashed core bundle. This snippet never names `arcy.modern.js` /
|
|
33
|
+
* `arcy.legacy.js` directly, so it never needs to change again once a
|
|
34
|
+
* customer has pasted it (ADR 0051).
|
|
35
|
+
* 5. Call `init` with the token, which queues like any other call.
|
|
36
|
+
*/
|
|
37
|
+
declare function buildInstallSnippet({ token, cdnBase, }: SnippetOptions): string;
|
|
38
|
+
|
|
39
|
+
export { CDN_BASE, type SnippetOptions, buildInstallSnippet };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The HTML install snippet (PRODUCT_SCOPE.md §1.2, ADR 0051).
|
|
3
|
+
*
|
|
4
|
+
* This is the exact text a customer pastes before `</body>`, and slice 5.2
|
|
5
|
+
* renders it on the Installation page with the environment's Token injected.
|
|
6
|
+
*
|
|
7
|
+
* **It is frozen at paste time.** Everything here is unfixable for anyone who
|
|
8
|
+
* has already installed, which is why it is this small and why it contains no
|
|
9
|
+
* version, no browser list, and no product logic. All of that lives in the
|
|
10
|
+
* fetched script, where it can be changed for every existing install at once.
|
|
11
|
+
*/
|
|
12
|
+
/** Unversioned on purpose: see ADR 0051. Pinning would freeze every install. */
|
|
13
|
+
declare const CDN_BASE = "https://cdn.arcyai.com";
|
|
14
|
+
interface SnippetOptions {
|
|
15
|
+
/** The environment Token. Public by construction; it ships in page source. */
|
|
16
|
+
token: string;
|
|
17
|
+
/** Overrides the CDN origin. For local development and tests only. */
|
|
18
|
+
cdnBase?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Builds the paste-ready `<script>` block.
|
|
22
|
+
*
|
|
23
|
+
* The minified body, expanded:
|
|
24
|
+
*
|
|
25
|
+
* 1. Bail out if `window.arcy` already exists, so a snippet pasted twice (very
|
|
26
|
+
* common with tag managers) does not clobber a live queue.
|
|
27
|
+
* 2. Create the stub, queueing every public method so `arcy.init()` on the very
|
|
28
|
+
* next line works before the script has downloaded.
|
|
29
|
+
* 3. Patch `pushState`/`replaceState` and announce navigations as a DOM event.
|
|
30
|
+
* 4. Inject `arcy.loader.js` (ADR 0119), unhashed and revalidated on every
|
|
31
|
+
* load, which itself does the ES-modules probe and injects the real,
|
|
32
|
+
* content-hashed core bundle. This snippet never names `arcy.modern.js` /
|
|
33
|
+
* `arcy.legacy.js` directly, so it never needs to change again once a
|
|
34
|
+
* customer has pasted it (ADR 0051).
|
|
35
|
+
* 5. Call `init` with the token, which queues like any other call.
|
|
36
|
+
*/
|
|
37
|
+
declare function buildInstallSnippet({ token, cdnBase, }: SnippetOptions): string;
|
|
38
|
+
|
|
39
|
+
export { CDN_BASE, type SnippetOptions, buildInstallSnippet };
|
package/dist/snippet.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* arcy.js — https://arcyai.com */
|
|
2
|
+
|
|
3
|
+
// src/loader/snippet.ts
|
|
4
|
+
var CDN_BASE = "https://cdn.arcyai.com";
|
|
5
|
+
function buildInstallSnippet({
|
|
6
|
+
token,
|
|
7
|
+
cdnBase = CDN_BASE
|
|
8
|
+
}) {
|
|
9
|
+
return `<script>
|
|
10
|
+
(function(w,d){
|
|
11
|
+
if(w.arcy)return;
|
|
12
|
+
var q=[];
|
|
13
|
+
function push(m,a,r){q.push({method:m,args:a,resolve:r})}
|
|
14
|
+
var a={q:q};
|
|
15
|
+
['init','identify','identifyAnonymous','updateUser'].forEach(function(m){
|
|
16
|
+
a[m]=function(){var x=arguments;return new Promise(function(r){push(m,[].slice.call(x),r)})}
|
|
17
|
+
});
|
|
18
|
+
['reset','open','close','on'].forEach(function(m){
|
|
19
|
+
a[m]=function(){var e={method:m,args:[].slice.call(arguments),resolve:function(){}};q.push(e);
|
|
20
|
+
if(m==='on')return function(){var i=q.indexOf(e);if(i!==-1)q.splice(i,1)}}
|
|
21
|
+
});
|
|
22
|
+
w.arcy=a;
|
|
23
|
+
if(!w.__arcyHistoryPatched){
|
|
24
|
+
w.__arcyHistoryPatched=1;
|
|
25
|
+
var fire=function(){try{w.dispatchEvent(new CustomEvent('arcy:routechange'))}catch(e){}};
|
|
26
|
+
['pushState','replaceState'].forEach(function(m){
|
|
27
|
+
var o=w.history[m];
|
|
28
|
+
if(typeof o==='function')w.history[m]=function(){var v=o.apply(this,arguments);fire();return v}
|
|
29
|
+
});
|
|
30
|
+
w.addEventListener('popstate',fire);
|
|
31
|
+
}
|
|
32
|
+
var s=d.createElement('script');
|
|
33
|
+
s.async=1;
|
|
34
|
+
s.src='${cdnBase}/arcy.loader.js';
|
|
35
|
+
s.onerror=function(){console&&console.warn&&console.warn('[arcy] Failed to load. ARCY is disabled.')};
|
|
36
|
+
var f=d.getElementsByTagName('script')[0];
|
|
37
|
+
f&&f.parentNode?f.parentNode.insertBefore(s,f):(d.head||d.documentElement).appendChild(s);
|
|
38
|
+
a.init('${token}');
|
|
39
|
+
})(window,document);
|
|
40
|
+
<\/script>`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { CDN_BASE, buildInstallSnippet };
|
package/package.json
CHANGED
|
@@ -1,13 +1,77 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arcy.js",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "ARCY — the universal JavaScript utility for embedding an AI agent that talks to, learns from, and acts on behalf of your users.
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "ARCY — the universal JavaScript utility for embedding an AI agent that talks to, learns from, and acts on behalf of your users.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"main": "./index.js",
|
|
8
7
|
"private": false,
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"main": "./dist/index.cjs",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"source": "./src/index.ts",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
|
+
},
|
|
19
|
+
"./snippet": {
|
|
20
|
+
"source": "./src/loader/snippet.ts",
|
|
21
|
+
"types": "./dist/snippet.d.ts",
|
|
22
|
+
"import": "./dist/snippet.js",
|
|
23
|
+
"require": "./dist/snippet.cjs"
|
|
24
|
+
},
|
|
25
|
+
"./design-mode": {
|
|
26
|
+
"source": "./src/picker/message.ts",
|
|
27
|
+
"types": "./dist/design-mode.d.ts",
|
|
28
|
+
"import": "./dist/design-mode.js",
|
|
29
|
+
"require": "./dist/design-mode.cjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"README.md"
|
|
35
|
+
],
|
|
9
36
|
"publishConfig": {
|
|
10
|
-
"access": "public"
|
|
37
|
+
"access": "public",
|
|
38
|
+
"registry": "https://registry.npmjs.org"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "node scripts/build.mjs && node scripts/size-check.mjs",
|
|
42
|
+
"dev": "tsup --watch",
|
|
43
|
+
"size": "node scripts/size-check.mjs",
|
|
44
|
+
"size:update": "node scripts/size-check.mjs --update",
|
|
45
|
+
"lint": "eslint",
|
|
46
|
+
"test": "vitest run",
|
|
47
|
+
"test:watch": "vitest",
|
|
48
|
+
"typecheck": "tsc --noEmit",
|
|
49
|
+
"prepublishOnly": "pnpm build"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@workspace/eslint-config": "workspace:*",
|
|
53
|
+
"@workspace/typescript-config": "workspace:*",
|
|
54
|
+
"jsdom": "^29.1.1",
|
|
55
|
+
"modern-screenshot": "4.7.0",
|
|
56
|
+
"tsup": "^8.0.0",
|
|
57
|
+
"typescript": "^5.9.3",
|
|
58
|
+
"vitest": "^3.0.0"
|
|
59
|
+
},
|
|
60
|
+
"engines": {
|
|
61
|
+
"node": ">=22.0.0"
|
|
62
|
+
},
|
|
63
|
+
"homepage": "https://arcyai.com",
|
|
64
|
+
"repository": {
|
|
65
|
+
"type": "git",
|
|
66
|
+
"url": "https://github.com/arcy-ai/arcy-ai-frontend-monorepo.git",
|
|
67
|
+
"directory": "packages/arcy.js"
|
|
11
68
|
},
|
|
12
|
-
"
|
|
69
|
+
"keywords": [
|
|
70
|
+
"arcy",
|
|
71
|
+
"ai",
|
|
72
|
+
"agent",
|
|
73
|
+
"widget",
|
|
74
|
+
"onboarding",
|
|
75
|
+
"product-adoption"
|
|
76
|
+
]
|
|
13
77
|
}
|