@tensorpass/aiconnect-react 0.1.3 → 0.1.5
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/ConnectModal.js +2 -1
- package/dist/ConnectModal.js.map +1 -1
- package/dist/ProviderMarks.d.ts +1 -0
- package/dist/ProviderMarks.js +10 -0
- package/dist/ProviderMarks.js.map +1 -0
- package/dist/modules/parts/ConnectNote.js +2 -1
- package/dist/modules/parts/ConnectNote.js.map +1 -1
- package/dist/styles.css +22 -0
- package/package.json +3 -3
package/dist/ConnectModal.js
CHANGED
|
@@ -10,6 +10,7 @@ import { AboutView } from "./AboutView.js";
|
|
|
10
10
|
import { useAiConnect } from "./AiConnectProvider.js";
|
|
11
11
|
import { ConnectRing } from "./ConnectRing.js";
|
|
12
12
|
import { alreadyAddedLine, installLabel, installText, refusalStep } from "./messages.js";
|
|
13
|
+
import { ProviderMarks } from "./ProviderMarks.js";
|
|
13
14
|
import { WebAccountConnected, WebSignIns, WebSigningIn } from "./WebAccountStep.js";
|
|
14
15
|
function useEscapeToClose(onClose) {
|
|
15
16
|
useEffect(() => {
|
|
@@ -35,7 +36,7 @@ function WalletStep() {
|
|
|
35
36
|
return _jsx(Step, { live: true, title: messages.waitingTitle, text: messages.waitingText });
|
|
36
37
|
case 'noWallet': {
|
|
37
38
|
const alreadyAdded = alreadyAddedLine(messages, client.browser);
|
|
38
|
-
return (_jsxs(Step, { live: false, title: messages.installTitle, text: installText(messages, client.browser), children: [
|
|
39
|
+
return (_jsxs(Step, { live: false, title: messages.installTitle, text: installText(messages, client.browser), children: [_jsxs("a", { className: "aic-primary", href: client.installUrl, target: "_blank", rel: "noreferrer", children: [_jsx(ProviderMarks, {}), installLabel(messages, client.browser)] }), alreadyAdded ? _jsx("p", { className: "aic-hint", children: alreadyAdded }) : null] }));
|
|
39
40
|
}
|
|
40
41
|
case 'error': {
|
|
41
42
|
const refusal = refusalStep(state, messages);
|
package/dist/ConnectModal.js.map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AAS,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACnD,OAAO,CACL,cAAK,SAAS,EAAC,cAAc,EAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,YACnE,eAAK,GAAG,EAAE,OAAO,EAAE,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,QAAQ,gBAAY,MAAM,qBAAiB,WAAW,EAAC,QAAQ,EAAE,CAAC,CAAC,EAC9G,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE,aAC3C,kBAAQ,SAAS,EAAC,YAAY,aAC5B,aAAI,EAAE,EAAC,WAAW,EAAC,SAAS,EAAC,WAAW,YAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,GAAM,EACtF,iBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,iBAAiB,gBAAa,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,uBAAY,IACvG,EACR,KAAK,CAAC,CAAC,CAAC,KAAC,SAAS,KAAG,CAAC,CAAC,CAAC,KAAC,UAAU,KAAG,EACvC,iBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,UAAU,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,YACvE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,GAC/B,IACL,GACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// The connect window a site shows: one card over the page that connects the visitor's AI through\n// the AI Wallet. It says what happens, waits while the wallet asks the visitor, explains how to\n// install the wallet when it is missing (and, in Safari, how to allow a wallet already added on every\n// website), and lets the visitor try again after a refusal. The wallet's accounts stay in the extension.\n// A visitor without the wallet can sign in to a web account on the page instead (WebAccountStep.tsx), whose\n// credential the site keeps.\n\nimport { useEffect, useRef, useState } from 'react';\nimport type { ReactNode } from 'react';\nimport { AboutView } from './AboutView.tsx';\nimport { useAiConnect } from './AiConnectProvider.tsx';\nimport { ConnectRing } from './ConnectRing.tsx';\nimport { alreadyAddedLine, installLabel, installText, refusalStep } from './messages.ts';\nimport { ProviderMarks } from './ProviderMarks.tsx';\nimport { WebAccountConnected, WebSignIns, WebSigningIn } from './WebAccountStep.tsx';\n\nfunction useEscapeToClose(onClose: () => void) {\n useEffect(() => {\n const onKey = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onClose();\n }\n };\n document.addEventListener('keydown', onKey);\n return () => document.removeEventListener('keydown', onKey);\n }, [onClose]);\n}\n\nfunction Step({ live, title, text, children }: { live: boolean; title: string; text: string; children?: ReactNode }) {\n return (\n <div className=\"aic-step\">\n <ConnectRing live={live} />\n <p className=\"aic-step-title\" role=\"status\">{title}</p>\n <p className=\"aic-hint\">{text}</p>\n {children}\n </div>\n );\n}\n\nfunction WalletStep() {\n const { client, state, messages } = useAiConnect();\n const connect = () => client.connect();\n switch (state.status) {\n case 'checking':\n return <Step live={false} title={messages.checking} text=\"\" />;\n case 'connecting':\n return <Step live title={messages.waitingTitle} text={messages.waitingText} />;\n case 'noWallet': {\n const alreadyAdded = alreadyAddedLine(messages, client.browser);\n return (\n <Step live={false} title={messages.installTitle} text={installText(messages, client.browser)}>\n <a className=\"aic-primary\" href={client.installUrl} target=\"_blank\" rel=\"noreferrer\">\n <ProviderMarks />\n {installLabel(messages, client.browser)}\n </a>\n {alreadyAdded ? <p className=\"aic-hint\">{alreadyAdded}</p> : null}\n </Step>\n );\n }\n case 'error': {\n const refusal = refusalStep(state, messages);\n return (\n <Step live={false} title={refusal.title} text={refusal.text}>\n <button type=\"button\" className=\"aic-primary\" onClick={connect}>{refusal.action}</button>\n </Step>\n );\n }\n default:\n return (\n <Step live={false} title={messages.connectTitle} text={messages.connectText}>\n <button type=\"button\" className=\"aic-primary\" onClick={connect}>{messages.connectButton}</button>\n </Step>\n );\n }\n}\n\n// The card's body: the wallet's step, with the sign ins under it when the wallet is missing, the step of a\n// sign in in progress, or the web account that answers.\nfunction WindowBody() {\n const { state } = useAiConnect();\n if (state.status === 'signingIn') {\n return <WebSigningIn account={state.account} placement=\"window\" />;\n }\n if (state.status === 'connected' && state.account) {\n return <WebAccountConnected account={state.account} />;\n }\n return (\n <>\n <WalletStep />\n {state.status === 'noWallet' ? <WebSignIns placement=\"window\" /> : null}\n </>\n );\n}\n\nexport function ConnectModal() {\n const { messages, closePicker } = useAiConnect();\n const [about, setAbout] = useState(false);\n const cardRef = useRef<HTMLDivElement>(null);\n useEscapeToClose(closePicker);\n useEffect(() => cardRef.current?.focus(), [about]);\n return (\n <div className=\"aic-backdrop\" dir={messages.dir} onClick={closePicker}>\n <div ref={cardRef} className=\"aic-card\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"aic-title\" tabIndex={-1}\n onClick={(event) => event.stopPropagation()}>\n <header className=\"aic-header\">\n <h2 id=\"aic-title\" className=\"aic-title\">{about ? messages.help : messages.title}</h2>\n <button type=\"button\" className=\"aic-icon-button\" aria-label={messages.close} onClick={closePicker}>×</button>\n </header>\n {about ? <AboutView /> : <WindowBody />}\n <button type=\"button\" className=\"aic-link\" onClick={() => setAbout(!about)}>\n {about ? messages.back : messages.help}\n </button>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ProviderMarks(): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// The marks of the AI plans most visitors already pay for, side by side on the button that adds AI Wallet,
|
|
3
|
+
// so a visitor with ChatGPT, Claude, Gemini, Grok or Muse sees at a glance that this button is for them.
|
|
4
|
+
// Each mark sits on a chip of its own, in its provider's colours, in a light and a dark theme alike.
|
|
5
|
+
import { CHATGPT_ICON, CLAUDE_ICON, GEMINI_ICON, GROK_ICON, MUSE_ICON, } from '@tensorpass/aiconnect-design/provider-marks';
|
|
6
|
+
const PLAN_MARKS = [CHATGPT_ICON, CLAUDE_ICON, GEMINI_ICON, GROK_ICON, MUSE_ICON];
|
|
7
|
+
export function ProviderMarks() {
|
|
8
|
+
return (_jsx("span", { className: "aic-provider-marks", "aria-hidden": "true", children: PLAN_MARKS.map((icon) => (_jsx("span", { className: "aic-provider-mark", children: _jsx("img", { src: icon, alt: "" }) }, icon))) }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ProviderMarks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProviderMarks.js","sourceRoot":"","sources":["../src/ProviderMarks.tsx"],"names":[],"mappings":";AAAA,2GAA2G;AAC3G,yGAAyG;AACzG,qGAAqG;AAErG,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,EACX,SAAS,EACT,SAAS,GACV,MAAM,6CAA6C,CAAC;AAErD,MAAM,UAAU,GAAG,CAAC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAElF,MAAM,UAAU,aAAa;IAC3B,OAAO,CACL,eAAM,SAAS,EAAC,oBAAoB,iBAAa,MAAM,YACpD,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACxB,eAAiB,SAAS,EAAC,mBAAmB,YAC5C,cAAK,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,EAAE,GAAG,IADhB,IAAI,CAER,CACR,CAAC,GACG,CACR,CAAC;AACJ,CAAC","sourcesContent":["// The marks of the AI plans most visitors already pay for, side by side on the button that adds AI Wallet,\n// so a visitor with ChatGPT, Claude, Gemini, Grok or Muse sees at a glance that this button is for them.\n// Each mark sits on a chip of its own, in its provider's colours, in a light and a dark theme alike.\n\nimport {\n CHATGPT_ICON,\n CLAUDE_ICON,\n GEMINI_ICON,\n GROK_ICON,\n MUSE_ICON,\n} from '@tensorpass/aiconnect-design/provider-marks';\n\nconst PLAN_MARKS = [CHATGPT_ICON, CLAUDE_ICON, GEMINI_ICON, GROK_ICON, MUSE_ICON];\n\nexport function ProviderMarks() {\n return (\n <span className=\"aic-provider-marks\" aria-hidden=\"true\">\n {PLAN_MARKS.map((icon) => (\n <span key={icon} className=\"aic-provider-mark\">\n <img src={icon} alt=\"\" />\n </span>\n ))}\n </span>\n );\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useAiConnect } from "../../AiConnectProvider.js";
|
|
3
3
|
import { ConnectRing } from "../../ConnectRing.js";
|
|
4
|
+
import { ProviderMarks } from "../../ProviderMarks.js";
|
|
4
5
|
import { alreadyAddedLine, installLabel, installText, refusalStep } from "../../messages.js";
|
|
5
6
|
import { useActionAttribute } from "./moduleAnalytics.js";
|
|
6
7
|
function connectionStep(state, copy) {
|
|
@@ -36,7 +37,7 @@ function StepButton({ action }) {
|
|
|
36
37
|
const { client } = useAiConnect();
|
|
37
38
|
const tracking = useActionAttribute(action.kind);
|
|
38
39
|
if (action.kind === 'install') {
|
|
39
|
-
return (
|
|
40
|
+
return (_jsxs("a", { className: "aic-button", href: client.installUrl, target: "_blank", rel: "noreferrer", ...tracking, children: [_jsx(ProviderMarks, {}), action.label] }));
|
|
40
41
|
}
|
|
41
42
|
return (_jsx("button", { type: "button", className: "aic-button", onClick: () => client.connect(), ...tracking, children: action.label }));
|
|
42
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectNote.js","sourceRoot":"","sources":["../../../src/modules/parts/ConnectNote.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ConnectNote.js","sourceRoot":"","sources":["../../../src/modules/parts/ConnectNote.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA6B,CAAC;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c,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACnG,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,eAAK,SAAS,EAAC,UAAU,kBAAe,OAAO,IAAI,SAAS,EAAE,IAAI,EAAC,QAAQ,aACzE,KAAC,WAAW,IAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAI,EACzC,eAAK,SAAS,EAAC,eAAe,aAC5B,YAAG,SAAS,EAAC,gBAAgB,YAAE,IAAI,CAAC,KAAK,GAAK,EAC7C,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,YAAG,SAAS,EAAC,eAAe,YAAE,IAAI,CAAC,IAAI,GAAK,CAAC,CAAC,CAAC,IAAI,EAC/D,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,YAAG,SAAS,EAAC,eAAe,YAAE,IAAI,CAAC,KAAK,GAAK,CAAC,CAAC,CAAC,IAAI,IAC9D,EACL,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAC,UAAU,IAAC,MAAM,EAAE,IAAI,CAAC,MAAM,GAAI,CAAC,CAAC,CAAC,IAAI,IACrD,CACP,CAAC;AACJ,CAAC","sourcesContent":["// The connection step a module shows until the visitor's AI is connected, in the connect window's\n// words: connect the wallet, add it to the browser (with, in Safari, how to allow a wallet already added\n// on every website), approve the site, or try again after a refusal.\n// Its button runs the step itself, as the connect window's button does: the install link opens the\n// wallet's store listing, under the marks of the plans it answers with, and connect asks the wallet, whose\n// window opens at once.\n\nimport type { ConnectionState, VisitorBrowser } from '@tensorpass/aiconnect';\nimport { useAiConnect } from '../../AiConnectProvider.tsx';\nimport { ConnectRing } from '../../ConnectRing.tsx';\nimport { ProviderMarks } from '../../ProviderMarks.tsx';\nimport { alreadyAddedLine, installLabel, installText, refusalStep } from '../../messages.ts';\nimport { useActionAttribute } from './moduleAnalytics.ts';\nimport type { ModuleMessages, PickerMessages } from '../../messages.ts';\n\ntype StepAction = { kind: 'install' | 'connect'; label: string };\n\ninterface Step {\n title: string;\n text: string;\n // A second line under the text, for the visitor the main text does not cover.\n aside?: string;\n action?: StepAction;\n live?: boolean;\n}\n\ninterface StepCopy {\n messages: PickerMessages;\n moduleMessages: ModuleMessages;\n // Whether the visitor already asked a question that waits for the connection.\n pending: boolean;\n browser: VisitorBrowser;\n}\n\nfunction connectionStep(state: ConnectionState, copy: StepCopy): Step | null {\n const { messages, moduleMessages, pending, browser } = copy;\n switch (state.status) {\n case 'connected':\n return null;\n // A site the visitor approved connects in a moment, so the check shows only for a waiting question.\n case 'checking':\n return pending ? { title: messages.checking, text: '' } : null;\n case 'noWallet':\n return {\n title: messages.installTitle,\n text: installText(messages, browser),\n aside: alreadyAddedLine(messages, browser),\n action: { kind: 'install', label: installLabel(messages, browser) },\n };\n case 'connecting':\n return { title: messages.waitingTitle, text: messages.waitingText, live: true };\n case 'error': {\n const refusal = refusalStep(state, messages);\n return { title: refusal.title, text: refusal.text, action: { kind: 'connect', label: refusal.action } };\n }\n default:\n return {\n title: messages.connectTitle,\n text: pending ? moduleMessages.pendingText : messages.connectText,\n action: { kind: 'connect', label: moduleMessages.connect },\n };\n }\n}\n\nfunction StepButton({ action }: { action: StepAction }) {\n const { client } = useAiConnect();\n const tracking = useActionAttribute(action.kind);\n if (action.kind === 'install') {\n return (\n <a className=\"aic-button\" href={client.installUrl} target=\"_blank\" rel=\"noreferrer\" {...tracking}>\n <ProviderMarks />\n {action.label}\n </a>\n );\n }\n return (\n <button type=\"button\" className=\"aic-button\" onClick={() => client.connect()} {...tracking}>{action.label}</button>\n );\n}\n\nexport function ConnectNote({ pending, compact = false }: { pending: boolean; compact?: boolean }) {\n const { client, state, messages, moduleMessages } = useAiConnect();\n const step = connectionStep(state, { messages, moduleMessages, pending, browser: client.browser });\n if (!step) {\n return null;\n }\n return (\n <div className=\"aic-note\" data-compact={compact || undefined} role=\"status\">\n <ConnectRing live={Boolean(step.live)} />\n <div className=\"aic-note-copy\">\n <p className=\"aic-note-title\">{step.title}</p>\n {step.text ? <p className=\"aic-note-text\">{step.text}</p> : null}\n {step.aside ? <p className=\"aic-note-text\">{step.aside}</p> : null}\n </div>\n {step.action ? <StepButton action={step.action} /> : null}\n </div>\n );\n}\n"]}
|
package/dist/styles.css
CHANGED
|
@@ -1672,6 +1672,28 @@ svg.aic-web-mark {
|
|
|
1672
1672
|
height: 20px;
|
|
1673
1673
|
flex: none;
|
|
1674
1674
|
}
|
|
1675
|
+
.aic-provider-marks {
|
|
1676
|
+
display: inline-flex;
|
|
1677
|
+
flex: none;
|
|
1678
|
+
margin-inline-end: 10px;
|
|
1679
|
+
}
|
|
1680
|
+
.aic-provider-mark {
|
|
1681
|
+
display: grid;
|
|
1682
|
+
place-items: center;
|
|
1683
|
+
width: 22px;
|
|
1684
|
+
height: 22px;
|
|
1685
|
+
border-radius: 50%;
|
|
1686
|
+
background: var(--aic-chip);
|
|
1687
|
+
box-shadow: 0 0 0 2px var(--aic-accent);
|
|
1688
|
+
}
|
|
1689
|
+
.aic-provider-mark + .aic-provider-mark {
|
|
1690
|
+
margin-inline-start: -5px;
|
|
1691
|
+
}
|
|
1692
|
+
.aic-provider-mark img {
|
|
1693
|
+
display: block;
|
|
1694
|
+
width: 14px;
|
|
1695
|
+
height: 14px;
|
|
1696
|
+
}
|
|
1675
1697
|
.aic-primary:focus-visible,
|
|
1676
1698
|
.aic-connect-button:focus-visible,
|
|
1677
1699
|
.aic-link:focus-visible,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tensorpass/aiconnect-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "React provider picker and chat hook for AI Connect.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -b && esbuild src/styles.css --bundle --outfile=dist/styles.css --log-level=warning && cp src/modules/styles/launchers.css dist/launchers.css"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tensorpass/aiconnect": "0.1.
|
|
37
|
-
"@tensorpass/aiconnect-design": "0.1.
|
|
36
|
+
"@tensorpass/aiconnect": "0.1.5",
|
|
37
|
+
"@tensorpass/aiconnect-design": "0.1.5"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": ">=19"
|