@withone/connect 0.12.0 → 0.12.2

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 CHANGED
@@ -20,171 +20,84 @@
20
20
  <a href="https://npmjs.com/package/@withone/connect"><img src="https://img.shields.io/npm/v/%40withone%2Fconnect" alt="npm version"></a>
21
21
  </p>
22
22
 
23
- One Connect lets your users grant your app **scoped, revocable access to their own One-connected tools**: Gmail, Slack, Notion, Stripe and 500 more. Your user keeps their connections in One. Your app holds only what they granted, and One checks that on every call.
23
+ One Connect lets your users grant your app **scoped, revocable access to their own tools**: Gmail, Slack, Notion, Stripe and 500 more. The connections stay in your user's One account. Your app holds only what they granted, and One checks that on every call.
24
24
 
25
- You build three things: a button, two backend routes, and the calls you make with the grant. This package gives you all three.
25
+ You add three things: a button, two backend routes, and the calls you make with the grant.
26
26
 
27
27
  ```
28
- Browser Your server One
29
- <ConnectButton> ───────► GET /api/one/authorize ──302──► One's hosted connect page
30
- sign in · pick tools · set access
28
+ Browser Your server One
29
+ <ConnectButton> ──────► GET /api/one/authorize ──302──► hosted page: sign in, pick tools, set access
31
30
  GET /api/one/callback ◄──302── ?code&state
32
- exchanges the code, stores the tokens
33
- 302 → /?one_connect=success
34
- onSuccess() fires ◄────────
35
- later: oneConnect.runAction(userId, …) ──► /v1/passthrough (grant enforced)
31
+ stores the tokens, redirects home
32
+ onSuccess() ◄──────
33
+ later: oneConnect.runAction(userId, …) ──► One, grant enforced
36
34
  ```
37
35
 
38
- > **Connect vs. Auth.** [`@withone/auth`](https://github.com/withoneai/auth) puts connections in *your* One project: you own them. Connect puts connections in *your user's* One account and hands you a grant.
39
-
40
36
  ## Install
41
37
 
42
38
  ```bash
43
39
  npm install @withone/connect
44
40
  ```
45
41
 
46
- Or let your coding agent do the whole setup:
47
-
48
- ```bash
49
- npx skills add withoneai/connect
50
- ```
42
+ Using a coding agent? `npx skills add withoneai/connect` teaches it the whole setup.
51
43
 
52
44
  ## 1 · Create your app in One
53
45
 
54
- Dashboard → **Developers → Connect → New app**.
55
-
56
- - You get a **client id** (public) and a **client secret** (shown once; server only).
57
- - Register the **redirect URI** of your callback route, exactly: `https://yourapp.com/api/one/callback`.
58
- - Choose what the app asks for: specific connectors and levels (an *ask*, which gives you a permission set id), or everything the user has connected.
59
- - Optionally write the one line users see about why you ask.
60
-
61
- Environment variables, server side:
46
+ Dashboard → **Developers → Connect → New app**. Register your callback URL exactly, for example `https://yourapp.com/api/one/callback`. Optionally choose the tools and access levels to ask for; the consent page lists them in the order you add them.
62
47
 
63
48
  ```env
64
49
  ONE_CLIENT_ID=…
65
- ONE_CLIENT_SECRET=one_secret_…
66
- ONE_REDIRECT_URI=https://yourapp.com/api/one/callback
67
- ONE_PERMISSION_SET=… # optional: the ask to open on
68
- ONE_API_URL=https://api.withone.ai # optional: production when unset
50
+ ONE_CLIENT_SECRET=one_secret_… # server only
51
+ ONE_REDIRECT_URI=https://yourapp.com/api/one/callback # exactly the registered URL
52
+ ONE_PERMISSION_SET=… # optional: the tools you ask for
53
+ ONE_API_URL=https://api.withone.ai # optional: production when unset
69
54
  ```
70
55
 
71
- | Variable | Required | What it is |
72
- |---|---|---|
73
- | `ONE_CLIENT_ID` | yes | Public client id from your app |
74
- | `ONE_CLIENT_SECRET` | yes | Server only. Never in a browser, a log or an error report. |
75
- | `ONE_REDIRECT_URI` | yes | Must equal the registered URI character for character |
76
- | `ONE_PERMISSION_SET` | no | The ask the consent page opens on. Without it, the page lists everything the user has connected. |
77
- | `ONE_API_URL` | no | `https://development-api.withone.ai` for the development environment |
78
-
79
56
  ## 2 · The button
80
57
 
81
- Any element wired to `open()` works. The pre-built button draws connector logos from their slugs and handles Connect → Connecting → Connected itself. It renders in its own shadow root, so your page's CSS can't break it, and it keeps its look under a strict Content Security Policy (`style-src 'self'`).
82
-
83
58
  ```tsx
84
- // React / Next.js: safe to import from a Server Component (the bundle is "use client")
85
59
  import { ConnectButton } from "@withone/connect/react";
86
60
 
87
61
  <ConnectButton
88
62
  authorizeUrl="/api/one/authorize"
89
- platforms={["stripe", "google-calendar", "gmail"]}
90
- connected={user.hasOneGrant} // from your server; see below
91
- onSuccess={() => refreshAppState()}
92
- onError={(message, code) => showBanner(message)}
63
+ platforms={["gmail", "google-calendar", "stripe"]}
64
+ connected={user.hasOneGrant} // from your server
65
+ onSuccess={() => refresh()}
66
+ onError={(message) => showError(message)}
93
67
  />
94
68
  ```
95
69
 
96
- ```vue
97
- <!-- Vue 3 -->
98
- <script setup>
99
- import { ConnectButton } from "@withone/connect/vue";
100
- </script>
101
- <template>
102
- <ConnectButton authorize-url="/api/one/authorize" :platforms="['stripe', 'notion']" :connected="hasGrant" @success="onConnected" />
103
- </template>
104
- ```
70
+ | Prop | What it does |
71
+ |---|---|
72
+ | `authorizeUrl` | Your authorize route. Required. |
73
+ | `platforms` | Connector slugs to show as logos. |
74
+ | `connected` | Whether the user already has a grant, from your server. |
75
+ | `variant` | `default`, `accent` (your brand colour via `accentColor`), or `block` (a card with a `description`). |
76
+ | `size` | `sm`, `md` or `lg`. |
77
+ | `fullWidth` | Fills its container. |
78
+ | `theme` | `light`, `dark` or `auto`. `connectTheme` sets One's page. |
79
+ | `label` | Button text. |
80
+ | `disabled` | Not clickable. |
81
+ | `onSuccess` / `onError` / `onCancel` | How the flow ended. |
82
+
83
+ Other frameworks take the same props:
105
84
 
106
- ```svelte
107
- <!-- Svelte, as an action -->
108
- <script>
109
- import { connectButton } from "@withone/connect/svelte";
110
- </script>
111
- <div use:connectButton={{ authorizeUrl: "/api/one/authorize", platforms: ["stripe", "notion"], connected: data.hasGrant, onSuccess }} />
85
+ ```vue
86
+ <ConnectButton authorize-url="/api/one/authorize" :platforms="['gmail']" @success="onConnected" /> <!-- @withone/connect/vue -->
112
87
  ```
113
88
 
114
89
  ```html
115
- <!-- Plain HTML or any other framework: importing the package registers the element -->
116
- <one-connect-button authorize-url="/api/one/authorize" platforms="stripe, notion" connected></one-connect-button>
117
- <script type="module">
118
- import "@withone/connect";
119
- document.querySelector("one-connect-button").addEventListener("success", () => location.reload());
120
- </script>
121
- ```
122
-
123
- Every surface takes the same props. Attributes are the kebab-case names, and `connected`, `disabled` and `full-width` are boolean attributes.
124
-
125
- | Prop (attribute) | What it does |
126
- |---|---|
127
- | `authorizeUrl` (`authorize-url`) | Your authorize route. Relative paths resolve against the page. Required. |
128
- | `platforms` | Connector slugs: `["stripe", "google-calendar"]`. Logos come from One's CDN and names from the slug, spelled the way each brand spells itself (`hubspot` → HubSpot). Pass `{ slug, name, imageUrl }` to override either. As an attribute: `"stripe, notion"`. The first three draw as logos; the rest fold into a `+N` chip. |
129
- | `connected` | Whether this user has a live grant, **from your server**. When set, it decides the Connected state, so the button stays right after a reload. When omitted, the button shows Connected only right after a successful return. |
130
- | `disabled` | Not clickable, for example until terms are accepted. |
131
- | `variant` | `default` neutral · `accent` your brand colour · `block` a card with a description and a "Secured by One" foot |
132
- | `size` | `sm` · `md` (default) · `lg` |
133
- | `fullWidth` (`full-width`) | Stretches to its container. |
134
- | `theme` | `light` (default), `dark`, or `auto` to follow the visitor's setting. Matches *your* page. |
135
- | `connectTheme` (`connect-theme`) | `light` or `dark` for One's hosted page. `appTheme` still works and is deprecated. |
136
- | `accentColor` (`accent-color`) | Fill of the `accent` variant; One's lime when omitted. The label is black or white, whichever reads better on it. |
137
- | `label` · `connectedLabel` (`connected-label`) | Button text. Defaults: "Connect your apps" · "Connected". |
138
- | `description` | Sub-line on the `block` variant. |
139
- | `onSuccess` | The grant was stored. Fires once per page load, on the first button still mounted. Refetch; your server is the truth. |
140
- | `onError(message, code)` | The flow ended without a grant. `code` is `declined`, `expired` or `failed`, and `message` is the SDK's fixed text for it, safe to show. |
141
- | `onCancel` | The user came back with the browser's Back button before finishing. The button is already clickable again. |
142
-
143
- The custom element dispatches `success`, `error` (`detail: { message, code }`) and `cancel` events.
144
-
145
- **Matching your design system.** The button inherits your page's font. Two custom properties and two parts do the rest:
146
-
147
- ```css
148
- one-connect-button, .one-connect {
149
- --one-connect-font: var(--font-sans);
150
- --one-connect-radius: 8px;
151
- }
152
- .one-connect::part(button) { box-shadow: none; } /* the React, Vue and Svelte host */
153
- one-connect-button::part(label) { font-weight: 600; }
154
- ```
155
-
156
- Under a strict CSP, allow One's connector logos in `img-src` (`https://assets.withone.ai`). If they're blocked, each chip falls back to the connector's first letter.
157
-
158
- **Your own element.** In React, use the hook:
159
-
160
- ```tsx
161
- import { useOneConnect } from "@withone/connect/react";
162
-
163
- const { open, status, error } = useOneConnect({ authorizeUrl: "/api/one/authorize" });
164
- // status: "idle" | "connecting" | "connected" | "error"
165
- <button onClick={open} disabled={status === "connecting"}>Connect your tools</button>
90
+ <one-connect-button authorize-url="/api/one/authorize" platforms="gmail, stripe"></one-connect-button>
91
+ <script type="module">import "@withone/connect";</script>
166
92
  ```
167
93
 
168
- Anywhere else, use `createConnectFlow`:
169
-
170
- ```ts
171
- import { createConnectFlow } from "@withone/connect";
172
-
173
- const flow = createConnectFlow({
174
- authorizeUrl: "/api/one/authorize",
175
- onSuccess: () => {},
176
- onError: (message, code) => {},
177
- onCancel: () => {},
178
- });
179
- button.addEventListener("click", flow.open);
180
- // later: flow.destroy()
181
- ```
94
+ Svelte: `use:connectButton={{ authorizeUrl, platforms }}` from `@withone/connect/svelte`.
182
95
 
183
- **How the return works.** The flow is a full-page redirect in the same tab, so it works in every browser with no popup or iframe. When your callback route redirects home, it appends `?one_connect=success` or `?one_connect=error&one_connect_error=<code>`. The SDK reads that once per page load, shows it on every button, calls back once, and removes the params from the address bar. Only the code travels on the URL. The text comes from the SDK, so a crafted link can't put its own words in front of your users. `readConnectReturn()` returns the same outcome if you want to show it yourself.
96
+ Your own button in React: `const { open, status } = useOneConnect({ authorizeUrl: "/api/one/authorize" })`.
184
97
 
185
- ## 3 · The two routes, as one import
98
+ To match your design, set `--one-connect-font` and `--one-connect-radius`, or style `::part(button)`.
186
99
 
187
- Create the client once, on the server:
100
+ ## 3 · The two routes
188
101
 
189
102
  ```ts
190
103
  // lib/one.ts
@@ -197,178 +110,50 @@ export const oneConnect = createOneConnect({
197
110
  permissionSet: process.env.ONE_PERMISSION_SET,
198
111
  oneApiUrl: process.env.ONE_API_URL,
199
112
  tokenStore: {
200
- // Your database, keyed by your own user id. Store them encrypted.
201
113
  saveTokens: (userId, tokens) => db.oneTokens.upsert(userId, tokens),
202
114
  loadTokens: (userId) => db.oneTokens.find(userId),
203
115
  clearTokens: (userId) => db.oneTokens.delete(userId),
204
- // Required when you run more than one server or a worker. See "Tokens" below.
205
- withLock: (userId, run) => db.withUserLock(userId, run),
206
116
  },
207
117
  });
208
118
  ```
209
119
 
210
- Then mount the routes for your server.
211
-
212
- **Next.js (App Router), Remix, SvelteKit, Hono, Bun** and anything else that speaks the web `Request`:
213
-
214
120
  ```ts
215
- // app/api/one/[action]/route.ts
121
+ // app/api/one/[action]/route.ts (Next.js; also Remix, SvelteKit, Hono, Bun)
216
122
  import { createOneConnectRoutes } from "@withone/connect/next";
217
123
  import { oneConnect } from "@/lib/one";
218
124
 
219
125
  export const { GET } = createOneConnectRoutes(oneConnect, {
220
126
  identifyUser: async (request) => (await getSession(request))?.userId ?? null,
221
- loginHintFor: async (request) => (await getSession(request))?.email ?? null,
222
- signInUrl: "/login",
223
127
  });
224
128
  ```
225
129
 
226
- That one file serves `/api/one/authorize` and `/api/one/callback`.
227
-
228
- **Express, Fastify, Koa, plain Node:**
229
-
230
- ```ts
231
- import { createOneConnectHandlers } from "@withone/connect/node";
232
- import { oneConnect } from "./one";
233
-
234
- const { authorize, callback } = createOneConnectHandlers(oneConnect, {
235
- identifyUser: (request) => request.session?.userId ?? null,
236
- });
237
- app.get("/api/one/authorize", authorize);
238
- app.get("/api/one/callback", callback);
239
- ```
240
-
241
- What the routes do for you: mint `state` and a PKCE verifier, keep them in a per-flow httpOnly cookie, send the browser to One, verify the returned state, exchange the code with your secret over HTTP Basic, store both tokens through your `tokenStore`, and redirect home with the outcome. A declined consent, an expired attempt and a failed exchange come back as `?one_connect=error&one_connect_error=declined|expired|failed`. `completeAuthorization` also returns a `message` describing what happened, for your logs only.
242
-
243
- **Another language?** The routes are ordinary OAuth 2.1 authorization code with PKCE. The reference behaviour is in `src/server/index.ts`; the same steps work in Python, Go or Ruby.
130
+ That file serves `/api/one/authorize` and `/api/one/callback`. For Express or plain Node, use `createOneConnectHandlers` from `@withone/connect/node`.
244
131
 
245
132
  ## 4 · Using the grant
246
133
 
247
- Everything runs on your server through the same client. Every call refreshes the tokens first when they are about to expire (see [Tokens](#5--tokens-storing-refreshing-keeping-alive)).
248
-
249
134
  ```ts
250
- // What the grant reaches, each connection with its access
251
- const connections = await oneConnect.listConnections(userId);
252
- // [{ key, platform, name, title, image, access: { policy: "full" | "methods" | "actions", … } }]
135
+ const connections = await oneConnect.listConnections(userId); // what the user granted
136
+ const actions = await oneConnect.listActions(userId, "gmail"); // what a platform can do
253
137
 
254
- // What actions a platform has (what exists, not what is permitted)
255
- const actions = await oneConnect.listActions(userId, "gmail");
256
- // [{ _id, title, method, path }]
257
-
258
- // Run one
259
138
  const reply = await oneConnect.runAction(userId, {
260
139
  connectionKey: connections[0].key,
261
140
  actionId: actions[0]._id,
262
141
  method: actions[0].method,
263
142
  path: actions[0].path,
264
- body: { … },
265
143
  });
266
- // { status, ok, blockedByGrant, data }
144
+ // { status, ok, data }
267
145
  ```
268
146
 
269
- `blockedByGrant` is true when One refused the call because it is outside what the user granted. The provider was never called. Do not retry; the user chose that. Anything else on One's `/v1` API: `oneConnect.fetch(userId, "/connections", init)` adds the bearer and the tenancy headers for you.
270
-
271
- Other calls on the client: `isConnected`, `getAccessToken`, `getTokens`, `refreshTokens`, `refreshIfExpiring`, `disconnect`.
272
-
273
- ## 5 · Tokens: storing, refreshing, keeping alive
274
-
275
- Your app owns the tokens. The SDK never stores anything itself: it calls your `tokenStore`, and it refreshes through it.
276
-
277
- **What One issues**
278
-
279
- | | Lifetime | On refresh |
280
- |---|---|---|
281
- | Access token | The lifetime set on your app: 1 hour by default, or 7, 30, 90 or 365 days | Replaced |
282
- | Refresh token | 30 days | Replaced, with a fresh 30 days |
283
-
284
- Every refresh returns a **new pair** and retires the old refresh token. If the old refresh token is ever used again, One treats it as stolen and **revokes the whole grant**. The user then has to connect again.
285
-
286
- **Store them in your database, encrypted, keyed by your user id**
287
-
288
- ```sql
289
- create table one_tokens (
290
- user_id text primary key,
291
- access_token text not null, -- encrypted
292
- refresh_token text not null, -- encrypted
293
- expires_at timestamptz not null -- tokens.expiresAt
294
- );
295
- ```
296
-
297
- **Give the store a lock when more than one process can refresh**
298
-
299
- Serverless functions, several instances, a background worker: any two of them can decide to refresh the same user at the same moment.
300
-
301
- ```
302
- without a lock with withLock
303
- web ──refresh(R1)──► One: here is R2 web ──lock──refresh(R1)──► R2 ──save──unlock
304
- worker ─refresh(R1)─► One: R1 reused! worker ──wait─────────────────────────────┐
305
- revoke everything ✗ reload: R2 is fresh, use it ✓
306
- ```
307
-
308
- The SDK takes the lock around every refresh and around the save in the callback. It re-reads the store inside the lock, so the process that waited uses the pair the first one saved instead of spending the old refresh token again. The SDK never takes the lock twice for the same call. Postgres, with a transaction-scoped advisory lock:
309
-
310
- ```ts
311
- withLock: async (userId, run) => {
312
- const client = await pool.connect();
313
- try {
314
- await client.query("begin");
315
- await client.query("select pg_advisory_xact_lock(hashtextextended($1, 0))", [`one-connect:${userId}`]);
316
- return await run();
317
- } finally {
318
- await client.query("commit").catch(() => {});
319
- client.release();
320
- }
321
- },
322
- ```
147
+ A `403` means the call is outside what the user granted. Don't retry it.
323
148
 
324
- A single long-running process can leave `withLock` out; the SDK already runs one refresh per user at a time inside a process. If your lock has a timeout, make it at least 60 seconds, because it spans one call to One.
149
+ ## 5 · Tokens
325
150
 
326
- **Refreshing ahead of time**
151
+ - Store them in your database, encrypted, keyed by your user id. The SDK refreshes them for you.
152
+ - Running more than one server or a background worker? Add `withLock(userId, run)` to your token store, for example a Postgres advisory lock. Two servers refreshing at once would otherwise disconnect the user.
153
+ - Keep idle users connected: once a day, call `oneConnect.refreshIfExpiring(userId, { withinMs: 7 * 24 * 3_600_000 })`.
154
+ - A `refresh_failed` error means the grant ended (revoked or expired). Ask the user to connect again.
327
155
 
328
- `getAccessToken`, `runAction`, `listConnections` and `fetch` refresh on their own when the access token has less than a minute left. For work that runs in the background, refresh ahead with `refreshIfExpiring`. It refreshes only when the access token **or** the refresh token expires within the window, and otherwise returns the stored pair without calling One.
329
-
330
- ```ts
331
- // Every 10 minutes: users whose access token expires in the next 15 minutes
332
- // (your table knows expires_at).
333
- await oneConnect.refreshIfExpiring(userId, { withinMs: 15 * 60_000 });
334
-
335
- // Once a day, for every connected user: renews refresh tokens before their
336
- // 30 days run out, so a user who has not been active stays connected.
337
- await oneConnect.refreshIfExpiring(userId, { withinMs: 7 * 24 * 3_600_000 });
338
- ```
339
-
340
- **When a refresh fails**
341
-
342
- | `OneConnectError.code` | What happened | Tokens | What to do |
343
- |---|---|---|---|
344
- | `refresh_failed` | One declared the grant dead: the user revoked it, the refresh token expired, or it was reused | Cleared | Show "Reconnect", which runs Connect again |
345
- | `request_failed` | One could not be reached, answered with a server error, or refused your client credentials | **Kept** | Retry later. Check `status` for a 401, which means your client secret is wrong. |
346
- | `not_connected` | No tokens are stored for this user | — | Show "Connect" |
347
-
348
- The SDK clears tokens only when One says the grant is dead (`invalid_grant`), or when the refresh token's own expiry has passed. It calls `clearTokens(userId, failed)` with the pair that failed. Just before that, it re-reads the store: if a newer pair has landed (the user reconnected while an old refresh was failing), it keeps and returns the newer pair. To make that check atomic, delete only when the stored refresh token is still `failed.refreshToken`. `disconnect(userId)` calls `clearTokens(userId)` without `failed`, and always deletes.
349
-
350
- **Asking for more tools later**
351
-
352
- Edit the app's permission set in the dashboard (Developers → Connect). The next time a user presses the button, One shows them the new tools as "{your app} needs one more connection", with what they already granted pre-selected. Authorizing replaces the user's grant and old tokens at once, and the callback saves the new pair.
353
-
354
- ## What your users see
355
-
356
- In their One dashboard the app appears under **Access control**, with what they granted and when it was last used. They can lower a level, remove an account, or revoke the app at any time. Your next call reflects it: a `401` means reconnect, a `403` means outside the grant.
357
-
358
- In *your* dashboard the app lists every user who said yes, what each one granted, and lets you revoke a user.
359
-
360
- ## Security notes
361
-
362
- - The client secret is used on your server only, for the code exchange and refresh, over HTTP Basic.
363
- - The authorization code is single use and expires ten minutes after consent.
364
- - Refresh tokens rotate on every use. Reusing an old one revokes the whole family, which is why the client refreshes one user at a time: inside a process on its own, and across processes through `tokenStore.withLock`.
365
- - The browser half of this package never sees a token. It navigates and reads one query parameter.
366
-
367
- ## Development
368
-
369
- ```bash
370
- npm run check # typecheck, tests, build
371
- ```
156
+ To ask for more tools later, edit your app's tools in the dashboard. Users see only the new ones the next time they connect.
372
157
 
373
158
  ## License
374
159
 
package/dist/button.d.ts CHANGED
@@ -2,8 +2,11 @@ import type { ConnectButtonHandle, ConnectButtonProps } from "./types";
2
2
  /** Black or white, whichever has the higher WCAG contrast on `color`. */
3
3
  export declare function readableTextOn(color: string): string;
4
4
  /**
5
- * Draws the button inside `host`'s shadow root. `host` must not have a
6
- * shadow root yet; `mountConnectButton` creates one for you.
5
+ * Draws the button inside the shadow root of an element you render, for
6
+ * wrappers that own their host (React, Vue). Nothing is written to the
7
+ * host's own attributes. For the layout rules, give the host
8
+ * `data-variant="<variant>"` and, for fullWidth, `data-full-width`;
9
+ * `mountConnectButton` does that for you.
7
10
  */
8
11
  export declare function renderConnectButton(host: HTMLElement, initial: ConnectButtonProps): ConnectButtonHandle;
9
12
  /**
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";const e="one_connect",t="one_connect_error",n={declined:"You cancelled the connection.",expired:"The connection attempt expired. Please try again.",failed:"The connection could not be completed. Please try again."};function o(o){const i=new URLSearchParams(o),r=i.get(e);if("success"===r)return{status:r};if("error"!==r)return null;const a=i.get(t),l=null!==(s=a)&&Object.prototype.hasOwnProperty.call(n,s)?a:"failed";var s;return{status:r,code:l,message:n[l]}}const i=[e,t,"one_connect_message"];function r(e){const t=new URLSearchParams(e);return i.some(e=>t.has(e))}let a,l=!1,s=!1,c=!1;const d=[];function p(){return u()}function u(){return"undefined"==typeof window?null:(void 0===a&&(a=o(window.location.search),(a||r(window.location.search))&&function(){const e=()=>{r(window.location.search)&&window.history.replaceState(window.history.state,"",function(e){const t=new URLSearchParams(e.search);for(const e of i)t.delete(e);const n=t.toString();return`${e.pathname}${n?`?${n}`:""}${e.hash}`}(window.location))};e();for(const t of[50,500,2e3])window.setTimeout(e,t)}()),a)}function h(e){let t=e,n=!1;const o={deliver:e=>{try{var n,o,i,r,a,l;"success"===e.status?null===(n=(o=t).onSuccess)||void 0===n||n.call(o):null===(i=(r=t).onError)||void 0===i||i.call(r,null!==(a=e.message)&&void 0!==a?a:"",null!==(l=e.code)&&void 0!==l?l:"failed")}catch{}},restored:()=>{if(n){n=!1;try{var e,o;null===(e=(o=t).onCancel)||void 0===e||e.call(o)}catch{}}}};return"undefined"!=typeof window&&(d.push(o),c||"undefined"==typeof window||(c=!0,window.addEventListener("pageshow",e=>{if(e.persisted)for(const e of[...d])e.restored()})),function(){if(l||s)return;const e=u();e&&(s=!0,window.setTimeout(()=>{s=!1;const t=d[0];t&&!l&&(l=!0,t.deliver(e))},0))}()),{open:()=>{"undefined"!=typeof window&&(n=!0,window.location.assign((e=>{var t;const n=null!==(t=e.connectTheme)&&void 0!==t?t:e.appTheme;try{const t=new URL(e.authorizeUrl,window.location.origin);return n&&(t.hash=`one_theme=${n}`),t.toString()}catch{return e.authorizeUrl}})(t)))},update:e=>{t=e},destroy:()=>{const e=d.indexOf(o);e>=0&&d.splice(e,1)}}}function C(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}const b={"cal-com":"Cal.com","click-up":"ClickUp",clickup:"ClickUp",docusign:"DocuSign",elevenlabs:"ElevenLabs","fireflies-ai":"Fireflies.ai",github:"GitHub",gitlab:"GitLab",hubspot:"HubSpot","linked-in":"LinkedIn",linkedin:"LinkedIn","one-drive":"OneDrive",onedrive:"OneDrive",openai:"OpenAI","otter-ai":"Otter.ai",paypal:"PayPal",posthog:"PostHog",quickbooks:"QuickBooks",sharepoint:"SharePoint","spotify-web":"Spotify",teams:"Microsoft Teams","telegram-bot":"Telegram","whatsapp-business":"WhatsApp Business",woocommerce:"WooCommerce",x:"X","youtube-data":"YouTube",youtube:"YouTube"};function g(e){var t;return null!==(t=b[e])&&void 0!==t?t:e.split(/[-_]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function v(e){return e?`https://assets.withone.ai/connectors/${e}.svg`:""}function m(e){var t,n,o,i;const r="string"==typeof e?{slug:e}:e,a=null!==(t=r.slug)&&void 0!==t&&t.trim()?f(r.slug):null!==(n=r.name)&&void 0!==n&&n.trim()?f(r.name):"";return a?{slug:a,name:(null===(o=r.name)||void 0===o?void 0:o.trim())||g(a),imageUrl:(null===(i=r.imageUrl)||void 0===i?void 0:i.trim())||v(a)}:null}function x(e){const t=null==e?void 0:e.trim();if(!t)return[];if(t.startsWith("["))try{const e=JSON.parse(t);return Array.isArray(e)?e.filter(e=>"string"==typeof e||"object"==typeof e&&null!==e):[]}catch{return[]}return t.split(",").map(e=>e.trim()).filter(Boolean)}const w="#CCFF00",y="#0A0C0B",k="#FFFFFF",S=`\n:host{display:inline-block;vertical-align:middle;max-width:100%}\n:host([data-full-width]),:host([data-variant="block"]){display:block}\n.b{all:unset;box-sizing:border-box;position:relative;display:inline-flex;align-items:center;gap:var(--gap);\n max-width:100%;cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent;\n font-family:var(--one-connect-font,inherit);font-size:var(--fs);font-weight:500;line-height:1.2;letter-spacing:-.01em;\n padding:var(--pad);border-radius:var(--one-connect-radius,12px);background:var(--bg);color:var(--fg);\n box-shadow:var(--shadow);transition:box-shadow .2s var(--ease),background-color .2s var(--ease),opacity .2s var(--ease)}\n.b[data-full-width]{display:flex;width:100%;justify-content:center}\n.b:focus-visible{outline:2px solid var(--ring);outline-offset:2px}\n.b:hover{box-shadow:var(--shadow-hover)}\n.b[disabled]{cursor:not-allowed;opacity:.5;box-shadow:none}\n.b[aria-busy="true"]{cursor:progress}\n.b{--ease:cubic-bezier(.2,.9,.25,1)}\n.b[data-size="sm"]{--fs:13px;--pad:8px 12px 8px 10px;--gap:8px;--chip:18px;--logo:12px}\n.b[data-size="md"]{--fs:14.5px;--pad:12px 16px 12px 14px;--gap:12px;--chip:22px;--logo:14px}\n.b[data-size="lg"]{--fs:16px;--pad:14px 20px 14px 16px;--gap:12px;--chip:26px;--logo:16px}\n.b[data-theme="light"],.b[data-theme="auto"]{--ink-bg:${y};--ink-fg:${k};--surface:${k};--surface-fg:${y};\n --muted:#5B6560;--line:#D5DAD7;--ring:${y};--shadow-base:0 1px 2px rgba(10,12,11,.08),0 4px 14px rgba(10,12,11,.06);\n --shadow-strong:0 1px 2px rgba(10,12,11,.12),0 6px 18px rgba(10,12,11,.1)}\n.b[data-theme="dark"]{--ink-bg:#F2F5F3;--ink-fg:${y};--surface:#101312;--surface-fg:#F2F5F3;\n --muted:#9AA39E;--line:#2A302D;--ring:${w};--shadow-base:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.35);\n --shadow-strong:0 1px 2px rgba(0,0,0,.5),0 10px 28px rgba(0,0,0,.45)}\n@media (prefers-color-scheme:dark){.b[data-theme="auto"]{--ink-bg:#F2F5F3;--ink-fg:${y};--surface:#101312;--surface-fg:#F2F5F3;\n --muted:#9AA39E;--line:#2A302D;--ring:${w};--shadow-base:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.35);\n --shadow-strong:0 1px 2px rgba(0,0,0,.5),0 10px 28px rgba(0,0,0,.45)}}\n.b[data-variant="default"]{--bg:var(--ink-bg);--fg:var(--ink-fg);--shadow:var(--shadow-base);--shadow-hover:var(--shadow-strong)}\n.b[data-variant="accent"]{--bg:var(--one-connect-accent,${w});--fg:var(--one-connect-accent-fg,${y});\n --shadow:0 1px 2px rgba(10,12,11,.1);--shadow-hover:0 1px 2px rgba(10,12,11,.12),0 6px 18px rgba(10,12,11,.12)}\n.b[data-variant="block"]{--bg:var(--surface);--fg:var(--surface-fg);--shadow:inset 0 0 0 1px var(--line);\n --shadow-hover:inset 0 0 0 1px var(--muted);flex-direction:column;align-items:stretch;gap:0;\n width:100%;max-width:420px;text-align:left;padding:16px;border-radius:var(--one-connect-radius,14px)}\n.b[data-variant="block"][data-full-width]{max-width:none}\n.stack{display:inline-flex;align-items:center;flex-shrink:0}\n.chip{width:var(--chip);height:var(--chip);border-radius:6px;display:grid;place-items:center;overflow:hidden;\n margin-left:-7px;position:relative;background:${k};color:${y};box-shadow:0 0 0 1.5px var(--bg);\n transition:margin-left .28s var(--ease)}\n.chip:first-child{margin-left:0}\n.b[data-variant="block"] .chip{box-shadow:0 0 0 1.5px var(--bg),0 0 0 2.5px var(--line)}\n.chip img{width:var(--logo);height:var(--logo);display:block;object-fit:contain}\n.chip.more,.chip.letter{font:500 9px/1 ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:-.02em}\n.chip.letter{font-size:10px;font-weight:600}\n.b:hover .chip{margin-left:-2px}.b:hover .chip:first-child{margin-left:0}\n.label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.icon{display:inline-flex;flex-shrink:0}\n.arrow{opacity:.55;transition:transform .2s var(--ease),opacity .2s var(--ease)}\n.b:hover .arrow{transform:translateX(2px);opacity:.85}\n.spinner{width:16px;height:16px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;\n opacity:.7;animation:spin .7s linear infinite;flex-shrink:0}\n@keyframes spin{to{transform:rotate(360deg)}}\n.top{display:flex;align-items:center;justify-content:space-between;gap:12px}\n.title{font-size:15px;font-weight:600;letter-spacing:-.01em}\n.sub{font-size:13px;line-height:1.5;margin-top:6px;font-weight:400;color:var(--muted)}\n.foot{margin-top:14px;padding-top:12px;display:flex;align-items:center;gap:6px;font-size:11px;font-weight:400;\n color:var(--muted);border-top:1px solid var(--line)}\n.lockup{display:inline-flex;color:var(--surface-fg)}\n.sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}\n@media (prefers-reduced-motion:reduce){.b,.chip,.arrow{transition:none}.spinner{animation-duration:1.6s}}\n@media (forced-colors:active){.b{border:1px solid ButtonText}.b:focus-visible{outline-color:Highlight}}\n`;let A=null;function L(e){const t=e.trim().toLowerCase(),n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/.exec(t);if(n){const e=3===n[1].length?n[1].replace(/./g,"$&$&"):n[1];return[0,2,4].map(t=>parseInt(e.slice(t,t+2),16))}const o=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/.exec(t);return o?[Number(o[1]),Number(o[2]),Number(o[3])]:null}const E=([e,t,n])=>{const o=e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return.2126*o(e)+.7152*o(t)+.0722*o(n)};function $(e){const t=function(e){const t=L(e);if(t)return t;try{const t=document.createElement("canvas").getContext("2d");return t?(t.fillStyle="#000",t.fillStyle=e,L(String(t.fillStyle))):null}catch{return null}}(e);if(!t)return y;const n=E(t);return 1.05/(n+.05)>(n+.05)/(E([10,12,11])+.05)?k:y}const z=(e,t,n)=>{const o=document.createElement(e);return t&&(o.className=t),void 0!==n&&(o.textContent=n),o},F=(e,t="icon")=>{const n=z("span",t);return n.innerHTML=e,n};function M(e){const t=(null!=(n=e.platforms)?n:[]).map(m).filter(e=>null!==e);var n;if(0===t.length)return null;const o=z("span","stack");o.setAttribute("aria-hidden","true");for(const e of t.slice(0,3)){const t=z("span","chip");t.title=e.name;const n=z("img");n.alt="",n.decoding="async",n.src=e.imageUrl,n.addEventListener("error",()=>{n.remove(),t.classList.add("letter"),t.textContent=e.name.charAt(0).toUpperCase()}),t.appendChild(n),o.appendChild(t)}const i=t.length-3;return i>0&&o.appendChild(z("span","chip more",`+${i}`)),o}const T=(e,t)=>{var n;return{authorizeUrl:e.authorizeUrl,connectTheme:null!==(n=e.connectTheme)&&void 0!==n?n:e.appTheme,...t}};function P(e,t){var n;const o=null!==(n=e.shadowRoot)&&void 0!==n?n:e.attachShadow({mode:"open"});!function(e){if("undefined"!=typeof CSSStyleSheet&&"replaceSync"in CSSStyleSheet.prototype&&"adoptedStyleSheets"in e)try{return A||(A=new CSSStyleSheet,A.replaceSync(S)),void(e.adoptedStyleSheets=[A])}catch{}const t=document.createElement("style");t.textContent=S,e.appendChild(t)}(o);let i=t,r=!1,a=!1,l=null;const s=z("button","b");s.type="button",s.setAttribute("part","button");const c=z("span","sr");c.setAttribute("role","status"),c.setAttribute("aria-live","polite"),o.append(s,c);const d=()=>{return r?"connecting":void 0!==i.connected?i.connected?"connected":"idle":"success"===(null===(e=p())||void 0===e?void 0:e.status)?"connected":"idle";var e},u={onSuccess:()=>{var e,t;return null===(e=(t=i).onSuccess)||void 0===e?void 0:e.call(t)},onError:(e,t)=>{var n,o;return null===(n=(o=i).onError)||void 0===n?void 0:n.call(o,e,t)},onCancel:()=>{var e,t;r=!1,f(),null===(e=(t=i).onCancel)||void 0===e||e.call(t)}},C=h(T(i,u)),f=()=>{var t,n,o,r,p;if(a)return;const u=d(),h=null!==(t=i.variant)&&void 0!==t?t:"default",C="connecting"===u?"Connecting…":"connected"===u?null!==(n=i.connectedLabel)&&void 0!==n?n:"Connected":null!==(o=i.label)&&void 0!==o?o:"Connect your apps";if("accent"===h){var f;const t=(null===(f=i.accentColor)||void 0===f?void 0:f.trim())||w;e.style.setProperty("--one-connect-accent",t),e.style.setProperty("--one-connect-accent-fg",$(t))}else e.style.removeProperty("--one-connect-accent"),e.style.removeProperty("--one-connect-accent-fg");e.toggleAttribute("data-full-width",Boolean(i.fullWidth)),e.setAttribute("data-variant",h),s.dataset.variant=h,s.dataset.size=null!==(r=i.size)&&void 0!==r?r:"md",s.dataset.theme=null!==(p=i.theme)&&void 0!==p?p:"light",s.dataset.state=u,s.toggleAttribute("data-full-width",Boolean(i.fullWidth)),s.disabled=Boolean(i.disabled),s.setAttribute("aria-busy",String("connecting"===u)),"connecting"===u?s.setAttribute("aria-disabled","true"):s.removeAttribute("aria-disabled");const b="idle"===u?M(i):null,g="connecting"===u?z("span","spinner"):"connected"===u?F('<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M3 8.5l3.5 3.5L13 5"/></svg>'):b;if(s.replaceChildren(),s.removeAttribute("aria-labelledby"),s.removeAttribute("aria-describedby"),"block"===h){const e=z("span","top"),t=z("span","title",C);if(t.id="one-connect-title",t.setAttribute("part","label"),e.appendChild(t),g&&e.appendChild(g),s.appendChild(e),s.setAttribute("aria-labelledby",t.id),i.description){const e=z("span","sub",i.description);e.id="one-connect-description",s.appendChild(e),s.setAttribute("aria-describedby",e.id)}const n=z("span","foot");n.setAttribute("aria-hidden","true"),n.append(z("span","","Secured by"),F('<svg viewBox="0 0 3152 990" width="35" height="11" fill="none" aria-hidden="true" focusable="false"><path d="M1698.02 793.203C1525.75 793.203 1401 666.834 1401 495.102C1401 323.909 1524.67 197 1698.02 197C1870.83 197 1996.12 323.909 1996.12 495.102C1996.12 666.834 1869.75 793.203 1698.02 793.203ZM1698.02 694.916C1801.71 694.916 1884.88 615.53 1884.88 495.102C1884.88 374.133 1801.71 295.827 1698.02 295.827C1594.87 295.827 1511.71 373.053 1511.71 495.102C1511.71 616.61 1595.41 694.916 1698.02 694.916Z" fill="currentColor"/><path d="M2326.71 197.54C2480.62 197.54 2565.95 289.887 2565.95 467.56V779.702H2455.24V468.64C2455.24 361.172 2411.5 292.587 2308.35 292.587C2217.63 292.587 2140.4 356.852 2140.4 484.841V779.702H2030.77V211.041H2140.4V272.065C2185.76 225.082 2248.41 197.54 2326.71 197.54Z" fill="currentColor"/><path d="M3151.98 493.481C3151.98 514.003 3150.36 520.483 3148.74 529.124H2700.51C2715.63 637.672 2794.47 686.815 2922.46 686.815C3031.01 686.815 3099.6 650.633 3116.88 643.072V747.84C3100.68 755.4 3023.45 793.203 2908.96 793.203C2699.97 793.203 2588.18 661.434 2588.18 497.802C2588.18 332.55 2702.67 197 2871.7 197C3031.55 197 3151.98 317.969 3151.98 493.481ZM2876.02 300.688C2784.75 300.688 2720.49 345.511 2702.67 434.617H3050.45C3034.79 344.971 2967.29 300.688 2876.02 300.688Z" fill="currentColor"/><path d="M537.494 782.175C641.011 827.7 767.922 858.83 880.501 839.875C983.155 822.599 1069.64 764.946 1094.39 659.271C1114.47 573.493 1088.54 481.273 1047.27 405.311C983.124 287.246 874.768 183.791 759.847 114.657C644.926 45.5225 507.181 -5.02605 372.102 0.398669C289.698 3.69665 205.938 26.536 146.544 85.6685C112.069 119.989 88.3818 171.231 83.1266 219.823C78.1642 265.64 84.3749 310.317 99.8478 354.007C168.243 547.14 354.009 701.467 537.51 782.191L537.494 782.175ZM751.956 818.053C583.05 796.2 415.7 707.108 292.472 593.004C222.536 528.246 159.366 444.979 125.985 355.471C102.961 293.734 96.3956 223.367 122.41 161.969C137.158 127.14 160.367 98.244 190.743 75.9133C275.581 13.5752 395.819 6.99464 495.977 26.8596C608.848 49.252 713.875 99.4615 806.712 166.515C907.085 239.025 999.537 339.922 1048.42 454.627C1072.45 511.001 1083.99 570.103 1075.64 630.869C1067.38 690.957 1034.57 742.353 983.987 775.379C917.626 818.715 830.861 828.255 751.972 818.053H751.956Z" fill="currentColor"/><path d="M1103.27 661.228C1086.68 755.313 1024.9 818.622 934.021 848.69C821.751 885.846 685.146 860.263 576.251 818.915C452.515 771.942 340.336 699.91 245.157 607.813C209.002 572.83 177.255 534.456 148.837 493.031C100.384 422.402 61.7024 335.19 65.8326 248.071C68.2213 197.769 83.987 159.241 111.403 116.938C45.8289 171.308 31.404 262.511 47.1543 342.002C53.4728 373.841 62.9815 403.23 76.528 432.958C100.338 485.202 130.914 532.992 167.747 577.238C255.452 682.573 367.83 765.13 491.073 824.124C614.317 883.118 769.307 920.691 900.471 889.128C985.788 868.601 1061.47 816.095 1090.83 730.856C1098.18 708.71 1104.61 686.564 1103.25 661.244L1103.27 661.228Z" fill="currentColor"/><path d="M883.297 963.502C923.15 947.074 960.877 926.022 988.309 893.967C954.265 917.839 920.931 934.807 882.403 944.993C751.747 979.53 595.123 942.589 474.731 886.57C422.102 862.082 372.617 834.018 325.181 800.591C205.128 715.984 89.4825 597.996 36.7762 458.756C20.2092 414.973 11.7793 370.404 11.5327 323.739C11.4249 302.641 15.4627 283.747 19.0226 263.004C-2.52219 310.486 -3.66265 380.915 5.21419 431.617C32.0605 584.881 147.151 721.146 266.988 813.983C343.443 873.224 436.403 924.913 528.424 954.672C620.444 984.431 713.851 999.426 808.491 983.598C834.459 979.252 858.362 973.781 883.297 963.502Z" fill="currentColor"/><path d="M1045.09 830.737C1053.55 816.158 1061.75 802.95 1066.99 787.061C1043.75 824.541 1013.3 854.408 974.29 874.982C947.752 888.991 920.228 899.27 890.577 905.219C864.578 910.428 839.673 914.481 812.781 914.851C739.716 915.852 668.717 903.092 599.459 880.854C418.686 822.8 238.422 697.6 127.985 543.165C94.8819 496.87 68.8679 447.847 50.7135 394.031C28.1978 324.45 25.7782 258.69 53.4104 189.078C36.1345 211.825 26.9956 237.793 20.4151 264.916C18.3654 282.732 14.713 299.345 15.0828 317.561C15.9613 360.774 23.5436 402.692 38.477 443.562C73.1522 538.464 134.936 621.869 207.368 691.913C307.34 788.587 426.762 862.268 558.127 907.993C689.491 953.718 871.975 973.768 992.614 885.446C1013.28 870.312 1029.39 851.773 1045.07 830.752L1045.09 830.737Z" fill="currentColor"/><path d="M552.552 745.664C671.079 797.831 835.825 835.526 954.768 769.12C999.137 744.354 1031.99 705.626 1047.99 657.312C1086.75 540.264 1020.28 405.817 947.124 315.631C855.536 202.745 729.688 114.516 592.76 66.0323C506.349 35.4412 418.968 22.0797 328.211 37.46C262.313 48.6177 195.29 81.7054 157.563 138.234C118.912 196.133 115.891 270.785 136.758 335.882C176.519 459.926 276.769 570.763 381.01 646.277C434.995 685.391 491.662 718.864 552.567 745.664H552.552ZM210.162 422.955C199.898 402.381 189.141 382.701 184.733 360.385C182.267 347.918 184.625 333.477 184.564 320.64C184.44 293.223 194.072 269.059 209.992 247.93C219.609 235.17 229.456 224.844 243.018 215.906C341.218 151.179 476.051 175.991 576.763 223.904C661.971 264.435 737.394 321.534 796.11 395.862C836.919 447.52 871.193 513.634 880.502 579.501C888.238 634.272 873.243 695.485 826.763 729.189C807.853 742.905 785.045 751.721 761.728 755.974C721.921 763.217 688.802 758.008 649.565 748.916C594.27 736.094 542.488 715.212 492.279 688.889C441.977 662.521 396.745 631.483 353.008 595.436C314.372 563.597 280.252 537.845 248.458 498.007L248.274 497.837L221.504 461.945L211.379 445.84C194.103 418.408 177.398 391.346 165.238 361.202C151.291 326.604 142.676 291.852 143.678 254.279C146.19 160.564 203.766 96.7467 290.238 67.82C434.394 19.5985 611.561 79.4246 735.298 157.636C825.099 214.411 904.435 286.581 963.321 375.134C989.767 414.894 1010.42 456.998 1023.78 502.646C1049.84 591.66 1036.79 685.884 957.404 742.659C890.257 790.68 785.6 793.146 707.295 776.486C680.403 769.736 654.065 766.007 629.222 754.818C732.107 783.93 882.397 797.723 963.938 715.35C990.599 688.412 1007.55 656.218 1013.75 618.537C1020.87 575.232 1016.12 531.634 1002.62 489.931C985.498 437.071 956.34 384.026 922.405 340.289C876.911 281.665 823.188 230.531 762.468 187.981C681.112 130.975 588.783 88.887 490.799 71.0872C425.595 59.2514 349.463 60.4072 287.557 85.0959C256.441 97.5019 228.501 114.5 205.924 138.85C158.303 190.2 147.176 256.036 161.539 323.383C166.856 348.334 175.456 371.296 185.596 394.737C194.488 415.295 222.676 461.883 236.022 477.649L226.729 456.196L210.162 423.001V422.955ZM832.342 286.936C756.904 211.544 666.44 154.076 564.896 120.249C526.553 107.473 487.948 99.4899 447.648 96.084C401.26 92.1696 356.167 96.7313 312.215 111.341C222.337 141.208 169.399 217.277 175.255 312.333C177.567 324.847 179.555 335.774 180.603 348.503C152.971 264.944 174.454 175.236 251.356 125.581C310.797 87.2072 387.39 78.2071 456.694 86.7603C503.714 92.5549 555.387 106.656 599.078 124.317C706.016 167.546 800.764 234.615 876.741 321.395C912.002 361.664 942.085 405.756 963.876 454.532C996.779 528.166 1011.85 610.046 965.895 681.369C952.379 702.359 935.427 718.818 914.283 731.871C884.432 747.421 852.947 758.671 818.872 761.06C839.523 755.959 859.404 750.981 878.637 740.424C929.186 717.061 964.601 671.567 974.818 616.488C987.671 547.245 964.693 475.429 930.881 415.357C903.834 367.305 871.471 326.049 832.311 286.905L832.342 286.936ZM890.673 420.18C861.623 370.387 825.515 327.621 783.288 287.999C721.659 230.161 650.028 185.345 570.598 156.033C513.623 135.013 454.506 124.394 393.786 128.108C353.316 130.59 315.728 139.867 280.498 159.516C245.268 179.166 216.819 204.918 201.023 240.394L188.617 268.242C204.583 180.445 278.325 132.054 361.931 119.355C412.757 111.634 462.658 116.643 512.421 129.048C596.905 150.116 674.1 189.923 743.45 242.028C816.607 296.999 885.526 373.531 924.578 456.982C949.713 510.675 965.094 571.61 949.837 630.234C939.018 671.768 912.511 706.566 875.308 727.987C847.013 744.292 816.191 754.679 783.242 758.101C825.915 745.926 863.75 731.917 895.327 698.799C913.512 679.72 926.535 657.62 933.054 631.714C951.347 558.989 927.49 483.274 890.642 420.134L890.673 420.18ZM726.19 279.369C625.678 198.799 493.404 141.917 362.655 156.973C343.854 159.131 326.547 164.17 308.639 169.195C301.18 171.29 295.201 177.732 286.493 176.253C378.313 130.081 492.063 149.545 583.143 188.119C684.102 230.87 775.952 302.825 840.664 391.069C871.794 433.527 895.805 479.652 909.506 530.386C918.382 563.273 920.232 596.654 911.941 629.294C905.622 654.153 895.481 677.778 875.786 694.9C893.987 666.327 905.452 637.693 907.086 604.128C908.72 570.562 903.141 536.565 891.567 503.57C861.392 417.53 797.066 336.19 726.205 279.384L726.19 279.369Z" fill="currentColor"/></svg>',"lockup")),s.appendChild(n)}else{g&&s.appendChild(g);const e=z("span","label",C);e.setAttribute("part","label"),s.appendChild(e),"idle"===u&&s.appendChild(F('<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M6 3l5 5-5 5"/></svg>',"icon arrow"))}var v,m;v=u,null!==l?v!==l&&(l=v,c.textContent="connecting"===v?"Connecting to One…":"connected"===v?null!==(m=i.connectedLabel)&&void 0!==m?m:"Connected":""):l=v};return s.addEventListener("click",()=>{a||i.disabled||r||(r=!0,f(),C.open())}),f(),{update:e=>{i=e,C.update(T(i,u)),f()},destroy:()=>{a=!0,C.destroy(),o.replaceChildren()}}}const U=["authorize-url","platforms","connected","disabled","variant","size","full-width","theme","connect-theme","app-theme","accent-color","label","connected-label","description"];function B(e,t,n){const o=e.getAttribute(t);return o&&n.includes(o)?o:void 0}const Z=(e,t)=>e.hasAttribute(t)?"false"!==e.getAttribute(t):void 0;function H(){if("undefined"!=typeof window&&"undefined"!=typeof customElements&&!customElements.get("one-connect-button")){class e extends HTMLElement{constructor(...e){super(...e),C(this,"onSuccess",null),C(this,"onError",null),C(this,"onCancel",null),C(this,"handle",null)}connectedCallback(){this.sync()}disconnectedCallback(){var e;null===(e=this.handle)||void 0===e||e.destroy(),this.handle=null}attributeChangedCallback(){this.isConnected&&this.sync()}props(e){var t,n,o,i,r;return{authorizeUrl:e,platforms:x(this.getAttribute("platforms")),connected:Z(this,"connected"),disabled:Z(this,"disabled"),variant:B(this,"variant",["default","accent","block"]),size:B(this,"size",["sm","md","lg"]),fullWidth:Z(this,"full-width"),theme:B(this,"theme",["light","dark","auto"]),connectTheme:null!==(t=B(this,"connect-theme",["light","dark"]))&&void 0!==t?t:B(this,"app-theme",["light","dark"]),accentColor:null!==(n=this.getAttribute("accent-color"))&&void 0!==n?n:void 0,label:null!==(o=this.getAttribute("label"))&&void 0!==o?o:void 0,connectedLabel:null!==(i=this.getAttribute("connected-label"))&&void 0!==i?i:void 0,description:null!==(r=this.getAttribute("description"))&&void 0!==r?r:void 0,onSuccess:()=>{var e;null===(e=this.onSuccess)||void 0===e||e.call(this),this.dispatchEvent(new CustomEvent("success"))},onError:(e,t)=>{var n;null===(n=this.onError)||void 0===n||n.call(this,e,t),this.dispatchEvent(new CustomEvent("error",{detail:{message:e,code:t}}))},onCancel:()=>{var e;null===(e=this.onCancel)||void 0===e||e.call(this),this.dispatchEvent(new CustomEvent("cancel"))}}}sync(){const e=this.getAttribute("authorize-url");var t;if(!e)return null===(t=this.handle)||void 0===t||t.destroy(),void(this.handle=null);const n=this.props(e);this.handle?this.handle.update(n):this.handle=P(this,n)}}C(e,"observedAttributes",[...U]),customElements.define("one-connect-button",e)}}H(),exports.createConnectFlow=h,exports.mountConnectButton=function(e,t){const n=document.createElement("span");n.className="one-connect",e.appendChild(n);const o=P(n,t);return{update:o.update,destroy:()=>{o.destroy(),n.remove()}}},exports.readConnectReturn=p,exports.registerConnectButton=H,exports.useOneConnect=e=>h(e);
1
+ "use strict";const e="one_connect",t="one_connect_error",n={declined:"You cancelled the connection.",expired:"The connection attempt expired. Please try again.",failed:"The connection could not be completed. Please try again."};function o(o){const i=new URLSearchParams(o),r=i.get(e);if("success"===r)return{status:r};if("error"!==r)return null;const a=i.get(t),l=null!==(s=a)&&Object.prototype.hasOwnProperty.call(n,s)?a:"failed";var s;return{status:r,code:l,message:n[l]}}const i=[e,t,"one_connect_message"];function r(e){const t=new URLSearchParams(e);return i.some(e=>t.has(e))}let a,l=!1,s=!1,c=!1;const d=[];function u(){return p()}function p(){return"undefined"==typeof window?null:(void 0===a&&(a=o(window.location.search),(a||r(window.location.search))&&function(){const e=()=>{r(window.location.search)&&window.history.replaceState(window.history.state,"",function(e){const t=new URLSearchParams(e.search);for(const e of i)t.delete(e);const n=t.toString();return`${e.pathname}${n?`?${n}`:""}${e.hash}`}(window.location))};e();for(const t of[50,500,2e3])window.setTimeout(e,t)}()),a)}function h(e){let t=e,n=!1;const o={deliver:e=>{try{var n,o,i,r,a,l;"success"===e.status?null===(n=(o=t).onSuccess)||void 0===n||n.call(o):null===(i=(r=t).onError)||void 0===i||i.call(r,null!==(a=e.message)&&void 0!==a?a:"",null!==(l=e.code)&&void 0!==l?l:"failed")}catch{}},restored:()=>{if(n){n=!1;try{var e,o;null===(e=(o=t).onCancel)||void 0===e||e.call(o)}catch{}}}};return"undefined"!=typeof window&&(d.push(o),c||"undefined"==typeof window||(c=!0,window.addEventListener("pageshow",e=>{if(e.persisted)for(const e of[...d])e.restored()})),function(){if(l||s)return;const e=p();e&&(s=!0,window.setTimeout(()=>{s=!1;const t=d[0];t&&!l&&(l=!0,t.deliver(e))},0))}()),{open:()=>{"undefined"!=typeof window&&(n=!0,window.location.assign((e=>{var t;const n=null!==(t=e.connectTheme)&&void 0!==t?t:e.appTheme;try{const t=new URL(e.authorizeUrl,window.location.origin);return n&&(t.hash=`one_theme=${n}`),t.toString()}catch{return e.authorizeUrl}})(t)))},update:e=>{t=e},destroy:()=>{const e=d.indexOf(o);e>=0&&d.splice(e,1)}}}function C(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}const b={"cal-com":"Cal.com","click-up":"ClickUp",clickup:"ClickUp",docusign:"DocuSign",elevenlabs:"ElevenLabs","fireflies-ai":"Fireflies.ai",github:"GitHub",gitlab:"GitLab",hubspot:"HubSpot","linked-in":"LinkedIn",linkedin:"LinkedIn","one-drive":"OneDrive",onedrive:"OneDrive",openai:"OpenAI","otter-ai":"Otter.ai",paypal:"PayPal",posthog:"PostHog",quickbooks:"QuickBooks",sharepoint:"SharePoint","spotify-web":"Spotify",teams:"Microsoft Teams","telegram-bot":"Telegram","whatsapp-business":"WhatsApp Business",woocommerce:"WooCommerce",x:"X","youtube-data":"YouTube",youtube:"YouTube"};function g(e){var t;return null!==(t=b[e])&&void 0!==t?t:e.split(/[-_]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function v(e){return e?`https://assets.withone.ai/connectors/${e}.svg`:""}function m(e){var t,n,o,i;const r="string"==typeof e?{slug:e}:e,a=null!==(t=r.slug)&&void 0!==t&&t.trim()?f(r.slug):null!==(n=r.name)&&void 0!==n&&n.trim()?f(r.name):"";return a?{slug:a,name:(null===(o=r.name)||void 0===o?void 0:o.trim())||g(a),imageUrl:(null===(i=r.imageUrl)||void 0===i?void 0:i.trim())||v(a)}:null}function x(e){const t=null==e?void 0:e.trim();if(!t)return[];if(t.startsWith("["))try{const e=JSON.parse(t);return Array.isArray(e)?e.filter(e=>"string"==typeof e||"object"==typeof e&&null!==e):[]}catch{return[]}return t.split(",").map(e=>e.trim()).filter(Boolean)}const w="#CCFF00",y="#0A0C0B",k="#FFFFFF",S=`\n:host{display:inline-block;vertical-align:middle;max-width:100%}\n:host([data-full-width]),:host([full-width]:not([full-width="false"])),\n:host([data-variant="block"]),:host([variant="block"]){display:block;width:100%}\n.b{all:unset;box-sizing:border-box;position:relative;display:inline-flex;align-items:center;gap:var(--gap);\n max-width:100%;cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent;\n font-family:var(--one-connect-font,inherit);font-size:var(--fs);font-weight:500;line-height:1.2;letter-spacing:-.01em;\n padding:var(--pad);border-radius:var(--one-connect-radius,12px);background:var(--bg);color:var(--fg);\n box-shadow:var(--shadow);transition:box-shadow .2s var(--ease),background-color .2s var(--ease),opacity .2s var(--ease)}\n.b[data-full-width]{display:flex;width:100%;justify-content:center}\n.b:focus-visible{outline:2px solid var(--ring);outline-offset:2px}\n.b:hover{box-shadow:var(--shadow-hover)}\n.b[disabled]{cursor:not-allowed;opacity:.5;box-shadow:none}\n.b[aria-busy="true"]{cursor:progress}\n.b{--ease:cubic-bezier(.2,.9,.25,1)}\n.b[data-size="sm"]{--fs:13px;--pad:8px 12px 8px 10px;--gap:8px;--chip:18px;--logo:12px}\n.b[data-size="md"]{--fs:14.5px;--pad:12px 16px 12px 14px;--gap:12px;--chip:22px;--logo:14px}\n.b[data-size="lg"]{--fs:16px;--pad:14px 20px 14px 16px;--gap:12px;--chip:26px;--logo:16px}\n.b[data-theme="light"],.b[data-theme="auto"]{--ink-bg:${y};--ink-fg:${k};--surface:${k};--surface-fg:${y};\n --muted:#5B6560;--line:#D5DAD7;--ring:${y};--shadow-base:0 1px 2px rgba(10,12,11,.08),0 4px 14px rgba(10,12,11,.06);\n --shadow-strong:0 1px 2px rgba(10,12,11,.12),0 6px 18px rgba(10,12,11,.1)}\n.b[data-theme="dark"]{--ink-bg:#F2F5F3;--ink-fg:${y};--surface:#101312;--surface-fg:#F2F5F3;\n --muted:#9AA39E;--line:#2A302D;--ring:${w};--shadow-base:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.35);\n --shadow-strong:0 1px 2px rgba(0,0,0,.5),0 10px 28px rgba(0,0,0,.45)}\n@media (prefers-color-scheme:dark){.b[data-theme="auto"]{--ink-bg:#F2F5F3;--ink-fg:${y};--surface:#101312;--surface-fg:#F2F5F3;\n --muted:#9AA39E;--line:#2A302D;--ring:${w};--shadow-base:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.35);\n --shadow-strong:0 1px 2px rgba(0,0,0,.5),0 10px 28px rgba(0,0,0,.45)}}\n.b[data-variant="default"]{--bg:var(--ink-bg);--fg:var(--ink-fg);--shadow:var(--shadow-base);--shadow-hover:var(--shadow-strong)}\n.b[data-variant="accent"]{--bg:var(--one-connect-accent,${w});--fg:var(--one-connect-accent-fg,${y});\n --shadow:0 1px 2px rgba(10,12,11,.1);--shadow-hover:0 1px 2px rgba(10,12,11,.12),0 6px 18px rgba(10,12,11,.12)}\n.b[data-variant="block"]{--bg:var(--surface);--fg:var(--surface-fg);--shadow:inset 0 0 0 1px var(--line);\n --shadow-hover:inset 0 0 0 1px var(--muted);flex-direction:column;align-items:stretch;gap:0;\n width:100%;max-width:420px;text-align:left;padding:16px;border-radius:var(--one-connect-radius,14px)}\n.b[data-variant="block"][data-full-width]{max-width:none}\n.stack{display:inline-flex;align-items:center;flex-shrink:0}\n.chip{width:var(--chip);height:var(--chip);border-radius:6px;display:grid;place-items:center;overflow:hidden;\n margin-left:-7px;position:relative;background:${k};color:${y};box-shadow:0 0 0 1.5px var(--bg);\n transition:margin-left .28s var(--ease)}\n.chip:first-child{margin-left:0}\n.b[data-variant="block"] .chip{box-shadow:0 0 0 1.5px var(--bg),0 0 0 2.5px var(--line)}\n.chip img{width:var(--logo);height:var(--logo);display:block;object-fit:contain}\n.chip.more,.chip.letter{font:500 9px/1 ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:-.02em}\n.chip.letter{font-size:10px;font-weight:600}\n.b:hover .chip{margin-left:-2px}.b:hover .chip:first-child{margin-left:0}\n.label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.icon{display:inline-flex;flex-shrink:0}\n.arrow{opacity:.55;transition:transform .2s var(--ease),opacity .2s var(--ease)}\n.b:hover .arrow{transform:translateX(2px);opacity:.85}\n.spinner{width:16px;height:16px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;\n opacity:.7;animation:spin .7s linear infinite;flex-shrink:0}\n@keyframes spin{to{transform:rotate(360deg)}}\n.top{display:flex;align-items:center;justify-content:space-between;gap:12px}\n.title{font-size:15px;font-weight:600;letter-spacing:-.01em}\n.sub{font-size:13px;line-height:1.5;margin-top:6px;font-weight:400;color:var(--muted)}\n.foot{margin-top:14px;padding-top:12px;display:flex;align-items:center;gap:6px;font-size:11px;font-weight:400;\n color:var(--muted);border-top:1px solid var(--line)}\n.lockup{display:inline-flex;color:var(--surface-fg)}\n.sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}\n@media (prefers-reduced-motion:reduce){.b,.chip,.arrow{transition:none}.spinner{animation-duration:1.6s}}\n@media (forced-colors:active){.b{border:1px solid ButtonText}.b:focus-visible{outline-color:Highlight}}\n`;let A=null;function L(e){const t=e.trim().toLowerCase(),n=/^#([0-9a-f]{3}|[0-9a-f]{6})$/.exec(t);if(n){const e=3===n[1].length?n[1].replace(/./g,"$&$&"):n[1];return[0,2,4].map(t=>parseInt(e.slice(t,t+2),16))}const o=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/.exec(t);return o?[Number(o[1]),Number(o[2]),Number(o[3])]:null}const E=([e,t,n])=>{const o=e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return.2126*o(e)+.7152*o(t)+.0722*o(n)};function $(e){const t=function(e){const t=L(e);if(t)return t;try{const t=document.createElement("canvas").getContext("2d");return t?(t.fillStyle="#000",t.fillStyle=e,L(String(t.fillStyle))):null}catch{return null}}(e);if(!t)return y;const n=E(t);return 1.05/(n+.05)>(n+.05)/(E([10,12,11])+.05)?k:y}const z=(e,t,n)=>{const o=document.createElement(e);return t&&(o.className=t),void 0!==n&&(o.textContent=n),o},F=(e,t="icon")=>{const n=z("span",t);return n.innerHTML=e,n};function M(e){const t=(null!=(n=e.platforms)?n:[]).map(m).filter(e=>null!==e);var n;if(0===t.length)return null;const o=z("span","stack");o.setAttribute("aria-hidden","true");for(const e of t.slice(0,3)){const t=z("span","chip");t.title=e.name;const n=z("img");n.alt="",n.decoding="async",n.src=e.imageUrl,n.addEventListener("error",()=>{n.remove(),t.classList.add("letter"),t.textContent=e.name.charAt(0).toUpperCase()}),t.appendChild(n),o.appendChild(t)}const i=t.length-3;return i>0&&o.appendChild(z("span","chip more",`+${i}`)),o}const T=(e,t)=>{var n;return{authorizeUrl:e.authorizeUrl,connectTheme:null!==(n=e.connectTheme)&&void 0!==n?n:e.appTheme,...t}};function P(e,t){var n;const o=null!==(n=e.shadowRoot)&&void 0!==n?n:e.attachShadow({mode:"open"});!function(e){if("undefined"!=typeof CSSStyleSheet&&"replaceSync"in CSSStyleSheet.prototype&&"adoptedStyleSheets"in e)try{return A||(A=new CSSStyleSheet,A.replaceSync(S)),void(e.adoptedStyleSheets=[A])}catch{}const t=document.createElement("style");t.textContent=S,e.appendChild(t)}(o);let i=t,r=!1,a=!1,l=null;const s=z("button","b");s.type="button",s.setAttribute("part","button");const c=z("span","sr");c.setAttribute("role","status"),c.setAttribute("aria-live","polite"),o.append(s,c);const d=()=>{return r?"connecting":void 0!==i.connected?i.connected?"connected":"idle":"success"===(null===(e=u())||void 0===e?void 0:e.status)?"connected":"idle";var e},p={onSuccess:()=>{var e,t;return null===(e=(t=i).onSuccess)||void 0===e?void 0:e.call(t)},onError:(e,t)=>{var n,o;return null===(n=(o=i).onError)||void 0===n?void 0:n.call(o,e,t)},onCancel:()=>{var e,t;r=!1,f(),null===(e=(t=i).onCancel)||void 0===e||e.call(t)}},C=h(T(i,p)),f=()=>{var e,t,n,o,r;if(a)return;const u=d(),p=null!==(e=i.variant)&&void 0!==e?e:"default",h="connecting"===u?"Connecting…":"connected"===u?null!==(t=i.connectedLabel)&&void 0!==t?t:"Connected":null!==(n=i.label)&&void 0!==n?n:"Connect your apps";if("accent"===p){var C;const e=(null===(C=i.accentColor)||void 0===C?void 0:C.trim())||w;s.style.setProperty("--one-connect-accent",e),s.style.setProperty("--one-connect-accent-fg",$(e))}else s.style.removeProperty("--one-connect-accent"),s.style.removeProperty("--one-connect-accent-fg");s.dataset.variant=p,s.dataset.size=null!==(o=i.size)&&void 0!==o?o:"md",s.dataset.theme=null!==(r=i.theme)&&void 0!==r?r:"light",s.dataset.state=u,s.toggleAttribute("data-full-width",Boolean(i.fullWidth)),s.disabled=Boolean(i.disabled),s.setAttribute("aria-busy",String("connecting"===u)),"connecting"===u?s.setAttribute("aria-disabled","true"):s.removeAttribute("aria-disabled");const f="idle"===u?M(i):null,b="connecting"===u?z("span","spinner"):"connected"===u?F('<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M3 8.5l3.5 3.5L13 5"/></svg>'):f;if(s.replaceChildren(),s.removeAttribute("aria-labelledby"),s.removeAttribute("aria-describedby"),"block"===p){const e=z("span","top"),t=z("span","title",h);if(t.id="one-connect-title",t.setAttribute("part","label"),e.appendChild(t),b&&e.appendChild(b),s.appendChild(e),s.setAttribute("aria-labelledby",t.id),i.description){const e=z("span","sub",i.description);e.id="one-connect-description",s.appendChild(e),s.setAttribute("aria-describedby",e.id)}const n=z("span","foot");n.setAttribute("aria-hidden","true"),n.append(z("span","","Secured by"),F('<svg viewBox="0 0 3152 990" width="35" height="11" fill="none" aria-hidden="true" focusable="false"><path d="M1698.02 793.203C1525.75 793.203 1401 666.834 1401 495.102C1401 323.909 1524.67 197 1698.02 197C1870.83 197 1996.12 323.909 1996.12 495.102C1996.12 666.834 1869.75 793.203 1698.02 793.203ZM1698.02 694.916C1801.71 694.916 1884.88 615.53 1884.88 495.102C1884.88 374.133 1801.71 295.827 1698.02 295.827C1594.87 295.827 1511.71 373.053 1511.71 495.102C1511.71 616.61 1595.41 694.916 1698.02 694.916Z" fill="currentColor"/><path d="M2326.71 197.54C2480.62 197.54 2565.95 289.887 2565.95 467.56V779.702H2455.24V468.64C2455.24 361.172 2411.5 292.587 2308.35 292.587C2217.63 292.587 2140.4 356.852 2140.4 484.841V779.702H2030.77V211.041H2140.4V272.065C2185.76 225.082 2248.41 197.54 2326.71 197.54Z" fill="currentColor"/><path d="M3151.98 493.481C3151.98 514.003 3150.36 520.483 3148.74 529.124H2700.51C2715.63 637.672 2794.47 686.815 2922.46 686.815C3031.01 686.815 3099.6 650.633 3116.88 643.072V747.84C3100.68 755.4 3023.45 793.203 2908.96 793.203C2699.97 793.203 2588.18 661.434 2588.18 497.802C2588.18 332.55 2702.67 197 2871.7 197C3031.55 197 3151.98 317.969 3151.98 493.481ZM2876.02 300.688C2784.75 300.688 2720.49 345.511 2702.67 434.617H3050.45C3034.79 344.971 2967.29 300.688 2876.02 300.688Z" fill="currentColor"/><path d="M537.494 782.175C641.011 827.7 767.922 858.83 880.501 839.875C983.155 822.599 1069.64 764.946 1094.39 659.271C1114.47 573.493 1088.54 481.273 1047.27 405.311C983.124 287.246 874.768 183.791 759.847 114.657C644.926 45.5225 507.181 -5.02605 372.102 0.398669C289.698 3.69665 205.938 26.536 146.544 85.6685C112.069 119.989 88.3818 171.231 83.1266 219.823C78.1642 265.64 84.3749 310.317 99.8478 354.007C168.243 547.14 354.009 701.467 537.51 782.191L537.494 782.175ZM751.956 818.053C583.05 796.2 415.7 707.108 292.472 593.004C222.536 528.246 159.366 444.979 125.985 355.471C102.961 293.734 96.3956 223.367 122.41 161.969C137.158 127.14 160.367 98.244 190.743 75.9133C275.581 13.5752 395.819 6.99464 495.977 26.8596C608.848 49.252 713.875 99.4615 806.712 166.515C907.085 239.025 999.537 339.922 1048.42 454.627C1072.45 511.001 1083.99 570.103 1075.64 630.869C1067.38 690.957 1034.57 742.353 983.987 775.379C917.626 818.715 830.861 828.255 751.972 818.053H751.956Z" fill="currentColor"/><path d="M1103.27 661.228C1086.68 755.313 1024.9 818.622 934.021 848.69C821.751 885.846 685.146 860.263 576.251 818.915C452.515 771.942 340.336 699.91 245.157 607.813C209.002 572.83 177.255 534.456 148.837 493.031C100.384 422.402 61.7024 335.19 65.8326 248.071C68.2213 197.769 83.987 159.241 111.403 116.938C45.8289 171.308 31.404 262.511 47.1543 342.002C53.4728 373.841 62.9815 403.23 76.528 432.958C100.338 485.202 130.914 532.992 167.747 577.238C255.452 682.573 367.83 765.13 491.073 824.124C614.317 883.118 769.307 920.691 900.471 889.128C985.788 868.601 1061.47 816.095 1090.83 730.856C1098.18 708.71 1104.61 686.564 1103.25 661.244L1103.27 661.228Z" fill="currentColor"/><path d="M883.297 963.502C923.15 947.074 960.877 926.022 988.309 893.967C954.265 917.839 920.931 934.807 882.403 944.993C751.747 979.53 595.123 942.589 474.731 886.57C422.102 862.082 372.617 834.018 325.181 800.591C205.128 715.984 89.4825 597.996 36.7762 458.756C20.2092 414.973 11.7793 370.404 11.5327 323.739C11.4249 302.641 15.4627 283.747 19.0226 263.004C-2.52219 310.486 -3.66265 380.915 5.21419 431.617C32.0605 584.881 147.151 721.146 266.988 813.983C343.443 873.224 436.403 924.913 528.424 954.672C620.444 984.431 713.851 999.426 808.491 983.598C834.459 979.252 858.362 973.781 883.297 963.502Z" fill="currentColor"/><path d="M1045.09 830.737C1053.55 816.158 1061.75 802.95 1066.99 787.061C1043.75 824.541 1013.3 854.408 974.29 874.982C947.752 888.991 920.228 899.27 890.577 905.219C864.578 910.428 839.673 914.481 812.781 914.851C739.716 915.852 668.717 903.092 599.459 880.854C418.686 822.8 238.422 697.6 127.985 543.165C94.8819 496.87 68.8679 447.847 50.7135 394.031C28.1978 324.45 25.7782 258.69 53.4104 189.078C36.1345 211.825 26.9956 237.793 20.4151 264.916C18.3654 282.732 14.713 299.345 15.0828 317.561C15.9613 360.774 23.5436 402.692 38.477 443.562C73.1522 538.464 134.936 621.869 207.368 691.913C307.34 788.587 426.762 862.268 558.127 907.993C689.491 953.718 871.975 973.768 992.614 885.446C1013.28 870.312 1029.39 851.773 1045.07 830.752L1045.09 830.737Z" fill="currentColor"/><path d="M552.552 745.664C671.079 797.831 835.825 835.526 954.768 769.12C999.137 744.354 1031.99 705.626 1047.99 657.312C1086.75 540.264 1020.28 405.817 947.124 315.631C855.536 202.745 729.688 114.516 592.76 66.0323C506.349 35.4412 418.968 22.0797 328.211 37.46C262.313 48.6177 195.29 81.7054 157.563 138.234C118.912 196.133 115.891 270.785 136.758 335.882C176.519 459.926 276.769 570.763 381.01 646.277C434.995 685.391 491.662 718.864 552.567 745.664H552.552ZM210.162 422.955C199.898 402.381 189.141 382.701 184.733 360.385C182.267 347.918 184.625 333.477 184.564 320.64C184.44 293.223 194.072 269.059 209.992 247.93C219.609 235.17 229.456 224.844 243.018 215.906C341.218 151.179 476.051 175.991 576.763 223.904C661.971 264.435 737.394 321.534 796.11 395.862C836.919 447.52 871.193 513.634 880.502 579.501C888.238 634.272 873.243 695.485 826.763 729.189C807.853 742.905 785.045 751.721 761.728 755.974C721.921 763.217 688.802 758.008 649.565 748.916C594.27 736.094 542.488 715.212 492.279 688.889C441.977 662.521 396.745 631.483 353.008 595.436C314.372 563.597 280.252 537.845 248.458 498.007L248.274 497.837L221.504 461.945L211.379 445.84C194.103 418.408 177.398 391.346 165.238 361.202C151.291 326.604 142.676 291.852 143.678 254.279C146.19 160.564 203.766 96.7467 290.238 67.82C434.394 19.5985 611.561 79.4246 735.298 157.636C825.099 214.411 904.435 286.581 963.321 375.134C989.767 414.894 1010.42 456.998 1023.78 502.646C1049.84 591.66 1036.79 685.884 957.404 742.659C890.257 790.68 785.6 793.146 707.295 776.486C680.403 769.736 654.065 766.007 629.222 754.818C732.107 783.93 882.397 797.723 963.938 715.35C990.599 688.412 1007.55 656.218 1013.75 618.537C1020.87 575.232 1016.12 531.634 1002.62 489.931C985.498 437.071 956.34 384.026 922.405 340.289C876.911 281.665 823.188 230.531 762.468 187.981C681.112 130.975 588.783 88.887 490.799 71.0872C425.595 59.2514 349.463 60.4072 287.557 85.0959C256.441 97.5019 228.501 114.5 205.924 138.85C158.303 190.2 147.176 256.036 161.539 323.383C166.856 348.334 175.456 371.296 185.596 394.737C194.488 415.295 222.676 461.883 236.022 477.649L226.729 456.196L210.162 423.001V422.955ZM832.342 286.936C756.904 211.544 666.44 154.076 564.896 120.249C526.553 107.473 487.948 99.4899 447.648 96.084C401.26 92.1696 356.167 96.7313 312.215 111.341C222.337 141.208 169.399 217.277 175.255 312.333C177.567 324.847 179.555 335.774 180.603 348.503C152.971 264.944 174.454 175.236 251.356 125.581C310.797 87.2072 387.39 78.2071 456.694 86.7603C503.714 92.5549 555.387 106.656 599.078 124.317C706.016 167.546 800.764 234.615 876.741 321.395C912.002 361.664 942.085 405.756 963.876 454.532C996.779 528.166 1011.85 610.046 965.895 681.369C952.379 702.359 935.427 718.818 914.283 731.871C884.432 747.421 852.947 758.671 818.872 761.06C839.523 755.959 859.404 750.981 878.637 740.424C929.186 717.061 964.601 671.567 974.818 616.488C987.671 547.245 964.693 475.429 930.881 415.357C903.834 367.305 871.471 326.049 832.311 286.905L832.342 286.936ZM890.673 420.18C861.623 370.387 825.515 327.621 783.288 287.999C721.659 230.161 650.028 185.345 570.598 156.033C513.623 135.013 454.506 124.394 393.786 128.108C353.316 130.59 315.728 139.867 280.498 159.516C245.268 179.166 216.819 204.918 201.023 240.394L188.617 268.242C204.583 180.445 278.325 132.054 361.931 119.355C412.757 111.634 462.658 116.643 512.421 129.048C596.905 150.116 674.1 189.923 743.45 242.028C816.607 296.999 885.526 373.531 924.578 456.982C949.713 510.675 965.094 571.61 949.837 630.234C939.018 671.768 912.511 706.566 875.308 727.987C847.013 744.292 816.191 754.679 783.242 758.101C825.915 745.926 863.75 731.917 895.327 698.799C913.512 679.72 926.535 657.62 933.054 631.714C951.347 558.989 927.49 483.274 890.642 420.134L890.673 420.18ZM726.19 279.369C625.678 198.799 493.404 141.917 362.655 156.973C343.854 159.131 326.547 164.17 308.639 169.195C301.18 171.29 295.201 177.732 286.493 176.253C378.313 130.081 492.063 149.545 583.143 188.119C684.102 230.87 775.952 302.825 840.664 391.069C871.794 433.527 895.805 479.652 909.506 530.386C918.382 563.273 920.232 596.654 911.941 629.294C905.622 654.153 895.481 677.778 875.786 694.9C893.987 666.327 905.452 637.693 907.086 604.128C908.72 570.562 903.141 536.565 891.567 503.57C861.392 417.53 797.066 336.19 726.205 279.384L726.19 279.369Z" fill="currentColor"/></svg>',"lockup")),s.appendChild(n)}else{b&&s.appendChild(b);const e=z("span","label",h);e.setAttribute("part","label"),s.appendChild(e),"idle"===u&&s.appendChild(F('<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M6 3l5 5-5 5"/></svg>',"icon arrow"))}var g,v;g=u,null!==l?g!==l&&(l=g,c.textContent="connecting"===g?"Connecting to One…":"connected"===g?null!==(v=i.connectedLabel)&&void 0!==v?v:"Connected":""):l=g};return s.addEventListener("click",()=>{a||i.disabled||r||(r=!0,f(),C.open())}),f(),{update:e=>{i=e,C.update(T(i,p)),f()},destroy:()=>{a=!0,C.destroy(),o.replaceChildren()}}}const B=["authorize-url","platforms","connected","disabled","variant","size","full-width","theme","connect-theme","app-theme","accent-color","label","connected-label","description"];function U(e,t,n){const o=e.getAttribute(t);return o&&n.includes(o)?o:void 0}const Z=(e,t)=>e.hasAttribute(t)?"false"!==e.getAttribute(t):void 0;function H(){if("undefined"!=typeof window&&"undefined"!=typeof customElements&&!customElements.get("one-connect-button")){class e extends HTMLElement{constructor(...e){super(...e),C(this,"onSuccess",null),C(this,"onError",null),C(this,"onCancel",null),C(this,"handle",null)}connectedCallback(){this.sync()}disconnectedCallback(){var e;null===(e=this.handle)||void 0===e||e.destroy(),this.handle=null}attributeChangedCallback(){this.isConnected&&this.sync()}props(e){var t,n,o,i,r;return{authorizeUrl:e,platforms:x(this.getAttribute("platforms")),connected:Z(this,"connected"),disabled:Z(this,"disabled"),variant:U(this,"variant",["default","accent","block"]),size:U(this,"size",["sm","md","lg"]),fullWidth:Z(this,"full-width"),theme:U(this,"theme",["light","dark","auto"]),connectTheme:null!==(t=U(this,"connect-theme",["light","dark"]))&&void 0!==t?t:U(this,"app-theme",["light","dark"]),accentColor:null!==(n=this.getAttribute("accent-color"))&&void 0!==n?n:void 0,label:null!==(o=this.getAttribute("label"))&&void 0!==o?o:void 0,connectedLabel:null!==(i=this.getAttribute("connected-label"))&&void 0!==i?i:void 0,description:null!==(r=this.getAttribute("description"))&&void 0!==r?r:void 0,onSuccess:()=>{var e;null===(e=this.onSuccess)||void 0===e||e.call(this),this.dispatchEvent(new CustomEvent("success"))},onError:(e,t)=>{var n;null===(n=this.onError)||void 0===n||n.call(this,e,t),this.dispatchEvent(new CustomEvent("error",{detail:{message:e,code:t}}))},onCancel:()=>{var e;null===(e=this.onCancel)||void 0===e||e.call(this),this.dispatchEvent(new CustomEvent("cancel"))}}}sync(){const e=this.getAttribute("authorize-url");var t;if(!e)return null===(t=this.handle)||void 0===t||t.destroy(),void(this.handle=null);const n=this.props(e);this.handle?this.handle.update(n):this.handle=P(this,n)}}C(e,"observedAttributes",[...B]),customElements.define("one-connect-button",e)}}H(),exports.createConnectFlow=h,exports.mountConnectButton=function(e,t){const n=document.createElement("span");n.className="one-connect";const o=e=>{var t;n.setAttribute("data-variant",null!==(t=e.variant)&&void 0!==t?t:"default"),n.toggleAttribute("data-full-width",Boolean(e.fullWidth))};o(t),e.appendChild(n);const i=P(n,t);return{update:e=>{o(e),i.update(e)},destroy:()=>{i.destroy(),n.remove()}}},exports.readConnectReturn=u,exports.registerConnectButton=H,exports.renderConnectButton=P,exports.useOneConnect=e=>h(e);
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { createConnectFlow, readConnectReturn, useOneConnect } from "./flow";
2
- export { mountConnectButton, registerConnectButton } from "./button";
2
+ export { mountConnectButton, registerConnectButton, renderConnectButton, } from "./button";
3
3
  export type { ConnectButtonHandle, ConnectButtonPlatform, ConnectButtonPlatformInput, ConnectButtonProps, ConnectButtonSize, ConnectButtonState, ConnectButtonTheme, ConnectButtonVariant, ConnectFailureCode, OneConnectFlow, OneConnectFlowOptions, OneConnectReturn, OneConnectTheme, } from "./types";
4
4
  import type { OneConnectFlow, OneConnectFlowOptions } from "./types";
5
5
  /** @deprecated Renamed to `OneConnectFlowOptions`; removed in the next minor. */