@withone/connect 0.11.0 → 0.12.1

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
@@ -78,17 +78,18 @@ ONE_API_URL=https://api.withone.ai # optional: production when unset
78
78
 
79
79
  ## 2 · The button
80
80
 
81
- Any element wired to `open()` works. The pre-built button draws connector logos from their slugs, and manages Connect → Connecting → Connected on its own.
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
82
 
83
83
  ```tsx
84
- // React / Next.js
84
+ // React / Next.js: safe to import from a Server Component (the bundle is "use client")
85
85
  import { ConnectButton } from "@withone/connect/react";
86
86
 
87
87
  <ConnectButton
88
88
  authorizeUrl="/api/one/authorize"
89
89
  platforms={["stripe", "google-calendar", "gmail"]}
90
+ connected={user.hasOneGrant} // from your server; see below
90
91
  onSuccess={() => refreshAppState()}
91
- onError={(message) => showBanner(message)}
92
+ onError={(message, code) => showBanner(message)}
92
93
  />
93
94
  ```
94
95
 
@@ -98,7 +99,7 @@ import { ConnectButton } from "@withone/connect/react";
98
99
  import { ConnectButton } from "@withone/connect/vue";
99
100
  </script>
100
101
  <template>
101
- <ConnectButton authorize-url="/api/one/authorize" :platforms="['stripe', 'notion']" @success="onConnected" />
102
+ <ConnectButton authorize-url="/api/one/authorize" :platforms="['stripe', 'notion']" :connected="hasGrant" @success="onConnected" />
102
103
  </template>
103
104
  ```
104
105
 
@@ -107,45 +108,79 @@ import { ConnectButton } from "@withone/connect/vue";
107
108
  <script>
108
109
  import { connectButton } from "@withone/connect/svelte";
109
110
  </script>
110
- <div use:connectButton={{ authorizeUrl: "/api/one/authorize", platforms: ["stripe", "notion"], onSuccess }} />
111
+ <div use:connectButton={{ authorizeUrl: "/api/one/authorize", platforms: ["stripe", "notion"], connected: data.hasGrant, onSuccess }} />
111
112
  ```
112
113
 
113
114
  ```html
114
115
  <!-- Plain HTML or any other framework: importing the package registers the element -->
115
- <one-connect-button authorize-url="/api/one/authorize" platforms="stripe, notion"></one-connect-button>
116
+ <one-connect-button authorize-url="/api/one/authorize" platforms="stripe, notion" connected></one-connect-button>
116
117
  <script type="module">
117
118
  import "@withone/connect";
118
119
  document.querySelector("one-connect-button").addEventListener("success", () => location.reload());
119
120
  </script>
120
121
  ```
121
122
 
123
+ Every surface takes the same props. Attributes are the kebab-case names, and `connected`, `disabled` and `full-width` are boolean attributes. The React and Vue components render the host element themselves, `<span class="one-connect">`, and React's `className` and `style` apply to it. The button inside never changes the host's attributes, so server-rendered pages hydrate without a mismatch, and `fullWidth` fills whatever container you put the button in, flex rows included.
124
+
122
125
  | Prop (attribute) | What it does |
123
126
  |---|---|
124
127
  | `authorizeUrl` (`authorize-url`) | Your authorize route. Relative paths resolve against the page. Required. |
125
- | `platforms` | Connector slugs: `["stripe", "google-calendar"]`. Logos and names come from One. To override either, pass `{ slug, name, imageUrl }`. As an attribute: `"stripe, notion"`. The first three render as logos; anything beyond them becomes a `+N` chip. |
126
- | `label` | Button text. Default "Connect your apps". |
127
- | `connectedLabel` (`connected-label`) | Text after a successful return. Default "Connected". |
128
- | `variant` | `default` pill · `accent` brand-colored pill · `block` card with a description |
129
- | `description` | Sub-line on the `block` variant |
130
- | `theme` | `light` or `dark`, matching *your* page |
131
- | `appTheme` (`app-theme`) | `light` or `dark` for One's page |
132
- | `accentColor` (`accent-color`) | Fill of the `accent` variant. One's lime when omitted. |
133
- | `onSuccess` / `onError` | Fire once when the tab returns. `onError` receives a message safe to show. The element also dispatches `success` and `error` events. |
134
-
135
- Your own element:
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>
166
+ ```
167
+
168
+ Anywhere else, use `createConnectFlow`:
136
169
 
137
170
  ```ts
138
- import { useOneConnect } from "@withone/connect";
171
+ import { createConnectFlow } from "@withone/connect";
139
172
 
140
- const { open } = useOneConnect({
173
+ const flow = createConnectFlow({
141
174
  authorizeUrl: "/api/one/authorize",
142
175
  onSuccess: () => {},
143
- onError: (message) => {},
176
+ onError: (message, code) => {},
177
+ onCancel: () => {},
144
178
  });
145
- button.addEventListener("click", open);
179
+ button.addEventListener("click", flow.open);
180
+ // later: flow.destroy()
146
181
  ```
147
182
 
148
- 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_message=…`); the SDK reads that on load, fires your callback once, and removes the params from the address bar.
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.
149
184
 
150
185
  ## 3 · The two routes, as one import
151
186
 
@@ -203,7 +238,7 @@ app.get("/api/one/authorize", authorize);
203
238
  app.get("/api/one/callback", callback);
204
239
  ```
205
240
 
206
- 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 all come back as `?one_connect=error` with a message you can show.
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.
207
242
 
208
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.
209
244
 
package/dist/button.d.ts CHANGED
@@ -1,17 +1,26 @@
1
- import type { ConnectButtonHandle, ConnectButtonOptions } from "./types";
2
- export declare const mountConnectButton: (container: HTMLElement, options: ConnectButtonOptions) => ConnectButtonHandle;
1
+ import type { ConnectButtonHandle, ConnectButtonProps } from "./types";
2
+ /** Black or white, whichever has the higher WCAG contrast on `color`. */
3
+ export declare function readableTextOn(color: string): string;
3
4
  /**
4
- * <one-connect-button>: one tag for any framework. The element wires the
5
- * whole flow from its attributes and manages Connect, Connecting and
6
- * Connected. Registered automatically in the browser on import; defined
7
- * inside a function so importing this module on a server never touches
8
- * HTMLElement.
9
- *
10
- * Attributes: authorize-url (required), app-theme, label, variant,
11
- * theme, platforms ("stripe, notion" or a JSON array),
12
- * description, accent-color, connected-label.
13
- * Events: "success" and "error" (detail: message), plus the matching
14
- * onSuccess and onError function properties that React 19, Vue and
15
- * Svelte set naturally as props.
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.
10
+ */
11
+ export declare function renderConnectButton(host: HTMLElement, initial: ConnectButtonProps): ConnectButtonHandle;
12
+ /**
13
+ * Mounts the button into `container`: React, Vue, Svelte and plain DOM
14
+ * all use this. The button lives in its own host element,
15
+ * `<span class="one-connect">`, whose `::part(button)` the page may style.
16
+ */
17
+ export declare function mountConnectButton(container: HTMLElement, props: ConnectButtonProps): ConnectButtonHandle;
18
+ /**
19
+ * <one-connect-button>: one tag for any framework, registered on import
20
+ * in the browser. Attributes mirror the props in kebab case; `connected`,
21
+ * `disabled` and `full-width` are boolean attributes. Events: `success`,
22
+ * `error` (detail: { message, code }) and `cancel`, plus the matching
23
+ * onSuccess / onError / onCancel properties that React 19, Vue and
24
+ * Svelte set naturally as props. Style it with `::part(button)`.
16
25
  */
17
26
  export declare function registerConnectButton(): void;
@@ -2,7 +2,11 @@
2
2
  * The SDK reads them off the page URL when the tab comes home, so
3
3
  * there is no completion page to build. */
4
4
  export declare const RETURN_STATUS_PARAM = "one_connect";
5
- export declare const RETURN_MESSAGE_PARAM = "one_connect_message";
5
+ /** Why the flow failed, as a code (see ConnectFailureCode). */
6
+ export declare const RETURN_ERROR_PARAM = "one_connect_error";
7
+ /** Free text that routes before 0.12 put on the URL. Stripped from the
8
+ * address bar, never shown: anyone can write a link that carries it. */
9
+ export declare const LEGACY_MESSAGE_PARAM = "one_connect_message";
6
10
  /** Fragment key on the authorize URL carrying the app-chosen theme.
7
11
  * A fragment never reaches any server and survives the whole redirect
8
12
  * chain, so the app's backend forwards nothing. */
package/dist/flow.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ import type { OneConnectFlow, OneConnectFlowOptions, OneConnectReturn } from "./types";
2
+ /** How this page load ended a flow, if it did: `{ status: "success" }`,
3
+ * `{ status: "error", code, message }`, or null. Read once per load, so
4
+ * every caller sees the same answer after the address bar is cleaned. */
5
+ export declare function readConnectReturn(): OneConnectReturn | null;
6
+ /**
7
+ * Wires the connect flow to any element: call it once where your button
8
+ * lives, pass `open` to a click, and `destroy` when the element goes.
9
+ * A plain function, so it works from every framework; React apps can use
10
+ * the `useOneConnect` hook from `@withone/connect/react` instead.
11
+ */
12
+ export declare function createConnectFlow(options: OneConnectFlowOptions): OneConnectFlow;
13
+ /** @deprecated Renamed to `createConnectFlow` (it is not a React hook;
14
+ * React apps can use `useOneConnect` from `@withone/connect/react`).
15
+ * Removed in the next minor. */
16
+ export declare const useOneConnect: (options: OneConnectFlowOptions) => OneConnectFlow;
17
+ /** Test seam: forget this page load's outcome. */
18
+ export declare function resetPageReturnForTests(): void;
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";const e="one_connect",t="one_connect_message";let n=!1;const o=o=>{if("undefined"!=typeof window&&!n){const r=function(n){var o;const r=new URLSearchParams(n),i=r.get(e);if("success"!==i&&"error"!==i)return null;const c=null!==(o=r.get(t))&&void 0!==o?o:void 0;return c?{status:i,message:c}:{status:i}}(window.location.search);if(r){n=!0;const i=()=>{(function(n){const o=new URLSearchParams(n);return o.has(e)||o.has(t)})(window.location.search)&&window.history.replaceState(null,"",function(n){const o=new URLSearchParams(n.search);o.delete(e),o.delete(t);const r=o.toString();return`${n.pathname}${r?`?${r}`:""}${n.hash}`}(window.location))};i();for(const e of[50,500,2e3])window.setTimeout(i,e);window.setTimeout(()=>{try{var e,t,n;"success"===r.status?null===(e=o.onSuccess)||void 0===e||e.call(o):null===(t=o.onError)||void 0===t||t.call(o,null!==(n=r.message)&&void 0!==n?n:"The connection was not completed.")}catch{}},0)}}return{open:()=>{"undefined"!=typeof window&&window.location.assign((()=>{try{const e=new URL(o.authorizeUrl,"undefined"==typeof window?void 0:window.location.origin);return o.appTheme&&(e.hash=`one_theme=${o.appTheme}`),e.toString()}catch{return o.authorizeUrl}})())}}};function r(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 i(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function c(e){return e.split(/[-_]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function l(e){return e?`https://assets.withone.ai/connectors/${e}.svg`:""}function a(e){var t,n,o,r;const a="string"==typeof e?{slug:e}:e,s=null!==(t=a.slug)&&void 0!==t&&t.trim()?i(a.slug):null!==(n=a.name)&&void 0!==n&&n.trim()?i(a.name):"";return s?{slug:s,name:(null===(o=a.name)||void 0===o?void 0:o.trim())||c(s),imageUrl:(null===(r=a.imageUrl)||void 0===r?void 0:r.trim())||l(s)}:null}function s(e){return(null!=e?e:[]).map(a).filter(e=>null!==e)}function d(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 p="one-connect-button-styles",u="cubic-bezier(.2,.9,.25,1)",C="#CCFF00",h="#3FE3A5",m="#0A0C0B",f={buttonBackground:m,buttonForeground:"#FFFFFF",surface:"#FFFFFF",foreground:m,muted:"#6B7280",line:"#D1D5DB",shadow:"0 1px 2px rgba(10,12,11,.08), 0 4px 14px rgba(10,12,11,.06)"},b={buttonBackground:"#F2F5F3",buttonForeground:m,surface:"#101312",foreground:"#F2F5F3",muted:"#8A938E",line:"#2A302D",shadow:"0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35)"};const w=(e,t)=>{var n,r,i;!function(){if("undefined"==typeof document||document.getElementById(p))return;const e=document.createElement("style");e.id=p,e.textContent=[`.owcb{font:500 14.5px/1.2 inherit;font-family:inherit;letter-spacing:-.01em;cursor:pointer;border:0;display:inline-flex;align-items:center;gap:12px;padding:12px 16px 12px 14px;border-radius:12px;transition:transform .2s ${u},box-shadow .2s ${u},opacity .2s ${u}}`,".owcb:hover{transform:translateY(-1px)}",".owcb:active{transform:translateY(0)}",`.owcb:focus-visible{outline:2px solid ${h};outline-offset:3px}`,".owcb[disabled]{cursor:default;opacity:.75;transform:none}",".owcb-stack{display:inline-flex;align-items:center;flex-shrink:0}",`.owcb-chip{width:22px;height:22px;border-radius:6px;display:grid;place-items:center;overflow:hidden;margin-left:-7px;transition:margin-left .28s ${u};position:relative;background:#FFFFFF}`,".owcb-chip:first-child{margin-left:0}",".owcb-chip img{width:14px;height:14px;display:block;object-fit:contain}",`.owcb-chip.owcb-more{font-family:ui-monospace,monospace;font-size:9px;font-weight:500;letter-spacing:-.02em;color:${m}}`,`.owcb-chip.owcb-letter{font:600 10px ui-monospace,monospace;color:${m}}`,".owcb:hover .owcb-chip{margin-left:-2px}",".owcb:hover .owcb-chip:first-child{margin-left:0}",".owcb-label{white-space:nowrap}",`.owcb-arrow{opacity:.5;transition:transform .2s ${u},opacity .2s ${u}}`,".owcb:hover .owcb-arrow{transform:translateX(2px);opacity:.8}",".owcb-spinner{width:16px;height:16px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;opacity:.7;animation:owcb-spin .7s linear infinite}","@keyframes owcb-spin{to{transform:rotate(360deg)}}",".owcb.owcb-block{display:flex;flex-direction:column;align-items:stretch;width:100%;max-width:420px;text-align:left;padding:16px;border-radius:14px;gap:0}",".owcb-block-top{display:flex;align-items:center;justify-content:space-between;gap:12px}",".owcb-block-title{font-size:15px;font-weight:600;letter-spacing:-.01em}",".owcb-block-sub{font-size:13px;line-height:1.5;margin-top:6px;font-weight:400}",".owcb-block-foot{margin-top:14px;padding-top:12px;display:flex;align-items:center;gap:6px;font-size:11.5px;font-weight:400}","@media (prefers-reduced-motion:reduce){.owcb,.owcb-chip,.owcb-arrow{transition:none}.owcb-spinner{animation-duration:1.4s}}"].join("\n"),document.head.appendChild(e)}();const c="dark"===t.theme?b:f,l=null!==(n=t.variant)&&void 0!==n?n:"default",a=null!==(r=t.label)&&void 0!==r?r:"Connect your apps",d=null!==(i=t.connectedLabel)&&void 0!==i?i:"Connected";let w="idle",g=!1;const v=o({...t.connect,onSuccess:()=>{var e,n;E("connected"),null===(e=(n=t.connect).onSuccess)||void 0===e||e.call(n)},onError:e=>{var n,o;E("idle"),null===(n=(o=t.connect).onError)||void 0===n||n.call(o,e)}}),x=document.createElement("button");x.type="button",x.className="block"===l?"owcb owcb-block":"owcb",x.addEventListener("click",()=>{"connecting"!==w&&(E("connecting"),v.open())});const y=()=>"connecting"===w?"Connecting…":"connected"===w?d:a,k=()=>{var e,n;const o="accent"===l,r="block"===l,i=r?c.surface:o?null!==(e=t.accentColor)&&void 0!==e?e:C:c.buttonBackground,a=r?c.foreground:o?m:c.buttonForeground,d=r?c.surface:i;x.style.background="connected"!==w||r?i:h,x.style.color="connected"!==w||r?a:m,x.style.boxShadow=r?`inset 0 0 0 1px ${c.line}`:"connected"===w?"none":o?`0 1px 2px rgba(10,12,11,.1), 0 6px 20px ${null!==(n=t.accentColor)&&void 0!==n?n:C}38`:c.shadow,x.disabled="connecting"===w,x.innerHTML="";const p=function(e,t){const n=s(e.platforms);if(0===n.length)return null;const o=document.createElement("span");o.className="owcb-stack",o.setAttribute("aria-hidden","true");for(const e of n.slice(0,3)){const n=document.createElement("span");n.className="owcb-chip",n.title=e.name,n.style.boxShadow=`0 0 0 1.5px ${t}`;const r=document.createElement("img");r.alt="",r.src=e.imageUrl,r.addEventListener("error",()=>{r.remove(),n.classList.add("owcb-letter"),n.textContent=e.name.charAt(0).toUpperCase()}),n.appendChild(r),o.appendChild(n)}const r=Math.max(0,n.length-3);if(r>0){const e=document.createElement("span");e.className="owcb-chip owcb-more",e.style.boxShadow=`0 0 0 1.5px ${t}`,e.textContent=`+${r}`,o.appendChild(e)}return o}(t,d);if(r){const e=document.createElement("span");e.className="owcb-block-top";const n=document.createElement("span");if(n.className="owcb-block-title",n.textContent=y(),e.appendChild(n),"connecting"===w){const t=document.createElement("span");t.className="owcb-spinner",e.appendChild(t)}else p&&e.appendChild(p);if(x.appendChild(e),t.description&&"idle"===w){const e=document.createElement("span");e.className="owcb-block-sub",e.style.color=c.muted,e.textContent=t.description,x.appendChild(e)}const o=document.createElement("span");return o.className="owcb-block-foot",o.style.color=c.muted,o.style.borderTop=`1px solid ${c.line}`,o.innerHTML=`<span style="font-size:11px;color:${c.muted}">Secured by</span><span style="display:inline-flex;color:${c.foreground}"><svg viewBox="0 0 3152 990" width="35" height="11" fill="none" aria-hidden="true" style="flex-shrink:0;display:block"><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></span>`,void x.appendChild(o)}if("connecting"===w){const e=document.createElement("span");e.className="owcb-spinner",x.appendChild(e)}else if("connected"===w){const e=document.createElement("span");e.innerHTML='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="width:16px;height:16px"><path d="M3 8.5l3.5 3.5L13 5"/></svg>',e.style.display="inline-flex",x.appendChild(e)}else p&&x.appendChild(p);const u=document.createElement("span");if(u.className="owcb-label",u.textContent=y(),x.appendChild(u),"idle"===w){const e=document.createElement("span");e.innerHTML='<svg class="owcb-arrow" width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M6 3l5 5-5 5"/></svg>',e.style.display="inline-flex",x.appendChild(e)}},E=e=>{g||(w=e,k())};return k(),e.appendChild(x),{setState:E,destroy:()=>{g=!0,x.remove()}}};function g(){if("undefined"!=typeof window&&"undefined"!=typeof customElements&&!customElements.get("one-connect-button")){class e extends HTMLElement{constructor(...e){super(...e),r(this,"onSuccess",null),r(this,"onError",null),r(this,"handle",null)}connectedCallback(){this.mount()}disconnectedCallback(){var e;null===(e=this.handle)||void 0===e||e.destroy(),this.handle=null}attributeChangedCallback(){this.isConnected&&this.handle&&this.mount()}mount(){var e,t,n,o,r;null===(e=this.handle)||void 0===e||e.destroy(),this.handle=null;const i=this.getAttribute("authorize-url");i&&(this.handle=w(this,{connect:{authorizeUrl:i,appTheme:v(this,"app-theme",["light","dark"]),onSuccess:()=>{var e;null===(e=this.onSuccess)||void 0===e||e.call(this),this.dispatchEvent(new CustomEvent("success"))},onError:e=>{var t;null===(t=this.onError)||void 0===t||t.call(this,e),this.dispatchEvent(new CustomEvent("error",{detail:e}))}},label:null!==(t=this.getAttribute("label"))&&void 0!==t?t:void 0,variant:v(this,"variant",["default","accent","block"]),theme:v(this,"theme",["light","dark"]),platforms:d(this.getAttribute("platforms")),description:null!==(n=this.getAttribute("description"))&&void 0!==n?n:void 0,accentColor:null!==(o=this.getAttribute("accent-color"))&&void 0!==o?o:void 0,connectedLabel:null!==(r=this.getAttribute("connected-label"))&&void 0!==r?r:void 0}))}}r(e,"observedAttributes",["authorize-url","app-theme","label","variant","theme","platforms","description","accent-color","connected-label"]),customElements.define("one-connect-button",e)}}function v(e,t,n){const o=e.getAttribute(t);return o&&n.includes(o)?o:void 0}g(),exports.mountConnectButton=w,exports.normalizePlatform=a,exports.normalizePlatforms=s,exports.optionsFromProps=function(e,t=e){return{connect:{authorizeUrl:e.authorizeUrl,appTheme:e.appTheme,onSuccess:()=>{var e;return null===(e=t.onSuccess)||void 0===e?void 0:e.call(t)},onError:e=>{var n;return null===(n=t.onError)||void 0===n?void 0:n.call(t,e)}},label:e.label,variant:e.variant,theme:e.theme,platforms:e.platforms,description:e.description,accentColor:e.accentColor,connectedLabel:e.connectedLabel}},exports.parsePlatformsAttribute=d,exports.propsIdentity=function(e){var t;return JSON.stringify([e.authorizeUrl,e.appTheme,e.label,e.variant,e.theme,null!==(t=e.platforms)&&void 0!==t?t:[],e.description,e.accentColor,e.connectedLabel])},exports.registerConnectButton=g,exports.useOneConnect=o;
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,8 @@
1
- export { useOneConnect } from "./useOneConnect";
2
- export { mountConnectButton, registerConnectButton } from "./button";
3
- export { optionsFromProps, propsIdentity, type ConnectButtonProps, type ConnectButtonCallbacks, } from "./wrapper-options";
4
- export { normalizePlatform, normalizePlatforms, parsePlatformsAttribute, } from "./platforms";
5
- export type { OneConnectOptions, OneConnectHandle, OneConnectReturn, OneConnectTheme, ConnectButtonOptions, ConnectButtonPlatform, ConnectButtonPlatformInput, ConnectButtonVariant, ConnectButtonState, ConnectButtonHandle, } from "./types";
1
+ export { createConnectFlow, readConnectReturn, useOneConnect } from "./flow";
2
+ export { mountConnectButton, registerConnectButton, renderConnectButton, } from "./button";
3
+ export type { ConnectButtonHandle, ConnectButtonPlatform, ConnectButtonPlatformInput, ConnectButtonProps, ConnectButtonSize, ConnectButtonState, ConnectButtonTheme, ConnectButtonVariant, ConnectFailureCode, OneConnectFlow, OneConnectFlowOptions, OneConnectReturn, OneConnectTheme, } from "./types";
4
+ import type { OneConnectFlow, OneConnectFlowOptions } from "./types";
5
+ /** @deprecated Renamed to `OneConnectFlowOptions`; removed in the next minor. */
6
+ export type OneConnectOptions = OneConnectFlowOptions;
7
+ /** @deprecated Renamed to `OneConnectFlow`; removed in the next minor. */
8
+ export type OneConnectHandle = OneConnectFlow;
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- const e="one_connect",t="one_connect_message";let n=!1;const o=o=>{if("undefined"!=typeof window&&!n){const r=function(n){var o;const r=new URLSearchParams(n),i=r.get(e);if("success"!==i&&"error"!==i)return null;const c=null!==(o=r.get(t))&&void 0!==o?o:void 0;return c?{status:i,message:c}:{status:i}}(window.location.search);if(r){n=!0;const i=()=>{(function(n){const o=new URLSearchParams(n);return o.has(e)||o.has(t)})(window.location.search)&&window.history.replaceState(null,"",function(n){const o=new URLSearchParams(n.search);o.delete(e),o.delete(t);const r=o.toString();return`${n.pathname}${r?`?${r}`:""}${n.hash}`}(window.location))};i();for(const e of[50,500,2e3])window.setTimeout(i,e);window.setTimeout(()=>{try{var e,t,n;"success"===r.status?null===(e=o.onSuccess)||void 0===e||e.call(o):null===(t=o.onError)||void 0===t||t.call(o,null!==(n=r.message)&&void 0!==n?n:"The connection was not completed.")}catch{}},0)}}return{open:()=>{"undefined"!=typeof window&&window.location.assign((()=>{try{const e=new URL(o.authorizeUrl,"undefined"==typeof window?void 0:window.location.origin);return o.appTheme&&(e.hash=`one_theme=${o.appTheme}`),e.toString()}catch{return o.authorizeUrl}})())}}};function r(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 i(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function c(e){return e.split(/[-_]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function l(e){return e?`https://assets.withone.ai/connectors/${e}.svg`:""}function a(e){var t,n,o,r;const a="string"==typeof e?{slug:e}:e,s=null!==(t=a.slug)&&void 0!==t&&t.trim()?i(a.slug):null!==(n=a.name)&&void 0!==n&&n.trim()?i(a.name):"";return s?{slug:s,name:(null===(o=a.name)||void 0===o?void 0:o.trim())||c(s),imageUrl:(null===(r=a.imageUrl)||void 0===r?void 0:r.trim())||l(s)}:null}function s(e){return(null!=e?e:[]).map(a).filter(e=>null!==e)}function d(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 p="one-connect-button-styles",u="cubic-bezier(.2,.9,.25,1)",C="#CCFF00",h="#3FE3A5",m="#0A0C0B",f={buttonBackground:m,buttonForeground:"#FFFFFF",surface:"#FFFFFF",foreground:m,muted:"#6B7280",line:"#D1D5DB",shadow:"0 1px 2px rgba(10,12,11,.08), 0 4px 14px rgba(10,12,11,.06)"},b={buttonBackground:"#F2F5F3",buttonForeground:m,surface:"#101312",foreground:"#F2F5F3",muted:"#8A938E",line:"#2A302D",shadow:"0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35)"};const w=(e,t)=>{var n,r,i;!function(){if("undefined"==typeof document||document.getElementById(p))return;const e=document.createElement("style");e.id=p,e.textContent=[`.owcb{font:500 14.5px/1.2 inherit;font-family:inherit;letter-spacing:-.01em;cursor:pointer;border:0;display:inline-flex;align-items:center;gap:12px;padding:12px 16px 12px 14px;border-radius:12px;transition:transform .2s ${u},box-shadow .2s ${u},opacity .2s ${u}}`,".owcb:hover{transform:translateY(-1px)}",".owcb:active{transform:translateY(0)}",`.owcb:focus-visible{outline:2px solid ${h};outline-offset:3px}`,".owcb[disabled]{cursor:default;opacity:.75;transform:none}",".owcb-stack{display:inline-flex;align-items:center;flex-shrink:0}",`.owcb-chip{width:22px;height:22px;border-radius:6px;display:grid;place-items:center;overflow:hidden;margin-left:-7px;transition:margin-left .28s ${u};position:relative;background:#FFFFFF}`,".owcb-chip:first-child{margin-left:0}",".owcb-chip img{width:14px;height:14px;display:block;object-fit:contain}",`.owcb-chip.owcb-more{font-family:ui-monospace,monospace;font-size:9px;font-weight:500;letter-spacing:-.02em;color:${m}}`,`.owcb-chip.owcb-letter{font:600 10px ui-monospace,monospace;color:${m}}`,".owcb:hover .owcb-chip{margin-left:-2px}",".owcb:hover .owcb-chip:first-child{margin-left:0}",".owcb-label{white-space:nowrap}",`.owcb-arrow{opacity:.5;transition:transform .2s ${u},opacity .2s ${u}}`,".owcb:hover .owcb-arrow{transform:translateX(2px);opacity:.8}",".owcb-spinner{width:16px;height:16px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;opacity:.7;animation:owcb-spin .7s linear infinite}","@keyframes owcb-spin{to{transform:rotate(360deg)}}",".owcb.owcb-block{display:flex;flex-direction:column;align-items:stretch;width:100%;max-width:420px;text-align:left;padding:16px;border-radius:14px;gap:0}",".owcb-block-top{display:flex;align-items:center;justify-content:space-between;gap:12px}",".owcb-block-title{font-size:15px;font-weight:600;letter-spacing:-.01em}",".owcb-block-sub{font-size:13px;line-height:1.5;margin-top:6px;font-weight:400}",".owcb-block-foot{margin-top:14px;padding-top:12px;display:flex;align-items:center;gap:6px;font-size:11.5px;font-weight:400}","@media (prefers-reduced-motion:reduce){.owcb,.owcb-chip,.owcb-arrow{transition:none}.owcb-spinner{animation-duration:1.4s}}"].join("\n"),document.head.appendChild(e)}();const c="dark"===t.theme?b:f,l=null!==(n=t.variant)&&void 0!==n?n:"default",a=null!==(r=t.label)&&void 0!==r?r:"Connect your apps",d=null!==(i=t.connectedLabel)&&void 0!==i?i:"Connected";let w="idle",g=!1;const v=o({...t.connect,onSuccess:()=>{var e,n;E("connected"),null===(e=(n=t.connect).onSuccess)||void 0===e||e.call(n)},onError:e=>{var n,o;E("idle"),null===(n=(o=t.connect).onError)||void 0===n||n.call(o,e)}}),x=document.createElement("button");x.type="button",x.className="block"===l?"owcb owcb-block":"owcb",x.addEventListener("click",()=>{"connecting"!==w&&(E("connecting"),v.open())});const y=()=>"connecting"===w?"Connecting…":"connected"===w?d:a,k=()=>{var e,n;const o="accent"===l,r="block"===l,i=r?c.surface:o?null!==(e=t.accentColor)&&void 0!==e?e:C:c.buttonBackground,a=r?c.foreground:o?m:c.buttonForeground,d=r?c.surface:i;x.style.background="connected"!==w||r?i:h,x.style.color="connected"!==w||r?a:m,x.style.boxShadow=r?`inset 0 0 0 1px ${c.line}`:"connected"===w?"none":o?`0 1px 2px rgba(10,12,11,.1), 0 6px 20px ${null!==(n=t.accentColor)&&void 0!==n?n:C}38`:c.shadow,x.disabled="connecting"===w,x.innerHTML="";const p=function(e,t){const n=s(e.platforms);if(0===n.length)return null;const o=document.createElement("span");o.className="owcb-stack",o.setAttribute("aria-hidden","true");for(const e of n.slice(0,3)){const n=document.createElement("span");n.className="owcb-chip",n.title=e.name,n.style.boxShadow=`0 0 0 1.5px ${t}`;const r=document.createElement("img");r.alt="",r.src=e.imageUrl,r.addEventListener("error",()=>{r.remove(),n.classList.add("owcb-letter"),n.textContent=e.name.charAt(0).toUpperCase()}),n.appendChild(r),o.appendChild(n)}const r=Math.max(0,n.length-3);if(r>0){const e=document.createElement("span");e.className="owcb-chip owcb-more",e.style.boxShadow=`0 0 0 1.5px ${t}`,e.textContent=`+${r}`,o.appendChild(e)}return o}(t,d);if(r){const e=document.createElement("span");e.className="owcb-block-top";const n=document.createElement("span");if(n.className="owcb-block-title",n.textContent=y(),e.appendChild(n),"connecting"===w){const t=document.createElement("span");t.className="owcb-spinner",e.appendChild(t)}else p&&e.appendChild(p);if(x.appendChild(e),t.description&&"idle"===w){const e=document.createElement("span");e.className="owcb-block-sub",e.style.color=c.muted,e.textContent=t.description,x.appendChild(e)}const o=document.createElement("span");return o.className="owcb-block-foot",o.style.color=c.muted,o.style.borderTop=`1px solid ${c.line}`,o.innerHTML=`<span style="font-size:11px;color:${c.muted}">Secured by</span><span style="display:inline-flex;color:${c.foreground}"><svg viewBox="0 0 3152 990" width="35" height="11" fill="none" aria-hidden="true" style="flex-shrink:0;display:block"><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></span>`,void x.appendChild(o)}if("connecting"===w){const e=document.createElement("span");e.className="owcb-spinner",x.appendChild(e)}else if("connected"===w){const e=document.createElement("span");e.innerHTML='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="width:16px;height:16px"><path d="M3 8.5l3.5 3.5L13 5"/></svg>',e.style.display="inline-flex",x.appendChild(e)}else p&&x.appendChild(p);const u=document.createElement("span");if(u.className="owcb-label",u.textContent=y(),x.appendChild(u),"idle"===w){const e=document.createElement("span");e.innerHTML='<svg class="owcb-arrow" width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M6 3l5 5-5 5"/></svg>',e.style.display="inline-flex",x.appendChild(e)}},E=e=>{g||(w=e,k())};return k(),e.appendChild(x),{setState:E,destroy:()=>{g=!0,x.remove()}}};function g(){if("undefined"!=typeof window&&"undefined"!=typeof customElements&&!customElements.get("one-connect-button")){class e extends HTMLElement{constructor(...e){super(...e),r(this,"onSuccess",null),r(this,"onError",null),r(this,"handle",null)}connectedCallback(){this.mount()}disconnectedCallback(){var e;null===(e=this.handle)||void 0===e||e.destroy(),this.handle=null}attributeChangedCallback(){this.isConnected&&this.handle&&this.mount()}mount(){var e,t,n,o,r;null===(e=this.handle)||void 0===e||e.destroy(),this.handle=null;const i=this.getAttribute("authorize-url");i&&(this.handle=w(this,{connect:{authorizeUrl:i,appTheme:v(this,"app-theme",["light","dark"]),onSuccess:()=>{var e;null===(e=this.onSuccess)||void 0===e||e.call(this),this.dispatchEvent(new CustomEvent("success"))},onError:e=>{var t;null===(t=this.onError)||void 0===t||t.call(this,e),this.dispatchEvent(new CustomEvent("error",{detail:e}))}},label:null!==(t=this.getAttribute("label"))&&void 0!==t?t:void 0,variant:v(this,"variant",["default","accent","block"]),theme:v(this,"theme",["light","dark"]),platforms:d(this.getAttribute("platforms")),description:null!==(n=this.getAttribute("description"))&&void 0!==n?n:void 0,accentColor:null!==(o=this.getAttribute("accent-color"))&&void 0!==o?o:void 0,connectedLabel:null!==(r=this.getAttribute("connected-label"))&&void 0!==r?r:void 0}))}}r(e,"observedAttributes",["authorize-url","app-theme","label","variant","theme","platforms","description","accent-color","connected-label"]),customElements.define("one-connect-button",e)}}function v(e,t,n){const o=e.getAttribute(t);return o&&n.includes(o)?o:void 0}function x(e,t=e){return{connect:{authorizeUrl:e.authorizeUrl,appTheme:e.appTheme,onSuccess:()=>{var e;return null===(e=t.onSuccess)||void 0===e?void 0:e.call(t)},onError:e=>{var n;return null===(n=t.onError)||void 0===n?void 0:n.call(t,e)}},label:e.label,variant:e.variant,theme:e.theme,platforms:e.platforms,description:e.description,accentColor:e.accentColor,connectedLabel:e.connectedLabel}}function y(e){var t;return JSON.stringify([e.authorizeUrl,e.appTheme,e.label,e.variant,e.theme,null!==(t=e.platforms)&&void 0!==t?t:[],e.description,e.accentColor,e.connectedLabel])}g();export{w as mountConnectButton,a as normalizePlatform,s as normalizePlatforms,x as optionsFromProps,d as parsePlatformsAttribute,y as propsIdentity,g as registerConnectButton,o as useOneConnect};
1
+ 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)}}}const C=e=>h(e);function f(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 b(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}const g={"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 v(e){var t;return null!==(t=g[e])&&void 0!==t?t:e.split(/[-_]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function m(e){return e?`https://assets.withone.ai/connectors/${e}.svg`:""}function x(e){var t,n,o,i;const r="string"==typeof e?{slug:e}:e,a=null!==(t=r.slug)&&void 0!==t&&t.trim()?b(r.slug):null!==(n=r.name)&&void 0!==n&&n.trim()?b(r.name):"";return a?{slug:a,name:(null===(o=r.name)||void 0===o?void 0:o.trim())||v(a),imageUrl:(null===(i=r.imageUrl)||void 0===i?void 0:i.trim())||m(a)}:null}function w(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 y="#CCFF00",k="#0A0C0B",S="#FFFFFF",A=`\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:${k};--ink-fg:${S};--surface:${S};--surface-fg:${k};\n --muted:#5B6560;--line:#D5DAD7;--ring:${k};--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:${k};--surface:#101312;--surface-fg:#F2F5F3;\n --muted:#9AA39E;--line:#2A302D;--ring:${y};--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:${k};--surface:#101312;--surface-fg:#F2F5F3;\n --muted:#9AA39E;--line:#2A302D;--ring:${y};--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,${y});--fg:var(--one-connect-accent-fg,${k});\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:${S};color:${k};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 L=null;function E(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,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 z(e){const t=function(e){const t=E(e);if(t)return t;try{const t=document.createElement("canvas").getContext("2d");return t?(t.fillStyle="#000",t.fillStyle=e,E(String(t.fillStyle))):null}catch{return null}}(e);if(!t)return k;const n=$(t);return 1.05/(n+.05)>(n+.05)/($([10,12,11])+.05)?S:k}const F=(e,t,n)=>{const o=document.createElement(e);return t&&(o.className=t),void 0!==n&&(o.textContent=n),o},M=(e,t="icon")=>{const n=F("span",t);return n.innerHTML=e,n};function T(e){const t=(null!=(n=e.platforms)?n:[]).map(x).filter(e=>null!==e);var n;if(0===t.length)return null;const o=F("span","stack");o.setAttribute("aria-hidden","true");for(const e of t.slice(0,3)){const t=F("span","chip");t.title=e.name;const n=F("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(F("span","chip more",`+${i}`)),o}const P=(e,t)=>{var n;return{authorizeUrl:e.authorizeUrl,connectTheme:null!==(n=e.connectTheme)&&void 0!==n?n:e.appTheme,...t}};function U(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 L||(L=new CSSStyleSheet,L.replaceSync(A)),void(e.adoptedStyleSheets=[L])}catch{}const t=document.createElement("style");t.textContent=A,e.appendChild(t)}(o);let i=t,r=!1,a=!1,l=null;const s=F("button","b");s.type="button",s.setAttribute("part","button");const c=F("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(P(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())||y;s.style.setProperty("--one-connect-accent",e),s.style.setProperty("--one-connect-accent-fg",z(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?T(i):null,b="connecting"===u?F("span","spinner"):"connected"===u?M('<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=F("span","top"),t=F("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=F("span","sub",i.description);e.id="one-connect-description",s.appendChild(e),s.setAttribute("aria-describedby",e.id)}const n=F("span","foot");n.setAttribute("aria-hidden","true"),n.append(F("span","","Secured by"),M('<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=F("span","label",h);e.setAttribute("part","label"),s.appendChild(e),"idle"===u&&s.appendChild(M('<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(P(i,p)),f()},destroy:()=>{a=!0,C.destroy(),o.replaceChildren()}}}function Z(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=U(n,t);return{update:e=>{o(e),i.update(e)},destroy:()=>{i.destroy(),n.remove()}}}const B=["authorize-url","platforms","connected","disabled","variant","size","full-width","theme","connect-theme","app-theme","accent-color","label","connected-label","description"];function H(e,t,n){const o=e.getAttribute(t);return o&&n.includes(o)?o:void 0}const j=(e,t)=>e.hasAttribute(t)?"false"!==e.getAttribute(t):void 0;function O(){if("undefined"!=typeof window&&"undefined"!=typeof customElements&&!customElements.get("one-connect-button")){class e extends HTMLElement{constructor(...e){super(...e),f(this,"onSuccess",null),f(this,"onError",null),f(this,"onCancel",null),f(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:w(this.getAttribute("platforms")),connected:j(this,"connected"),disabled:j(this,"disabled"),variant:H(this,"variant",["default","accent","block"]),size:H(this,"size",["sm","md","lg"]),fullWidth:j(this,"full-width"),theme:H(this,"theme",["light","dark","auto"]),connectTheme:null!==(t=H(this,"connect-theme",["light","dark"]))&&void 0!==t?t:H(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=U(this,n)}}f(e,"observedAttributes",[...B]),customElements.define("one-connect-button",e)}}O();export{h as createConnectFlow,Z as mountConnectButton,u as readConnectReturn,O as registerConnectButton,U as renderConnectButton,C as useOneConnect};
@@ -1,7 +1,7 @@
1
1
  import type { ConnectButtonPlatform, ConnectButtonPlatformInput } from "./types";
2
2
  /** "Google Calendar" -> "google-calendar". */
3
3
  export declare function slugFromName(name: string): string;
4
- /** "google-calendar" -> "Google Calendar". */
4
+ /** "google-calendar" -> "Google Calendar"; "hubspot" -> "HubSpot". */
5
5
  export declare function nameFromSlug(slug: string): string;
6
6
  /** One's logo for a connector slug. */
7
7
  export declare function logoUrlForSlug(slug: string): string;
package/dist/react.cjs.js CHANGED
@@ -1 +1,2 @@
1
- "use strict";var r=require("react"),e=require("@withone/connect");exports.ConnectButton=function(n){const o=r.useRef(null),t=r.useRef(null),c=r.useRef({onSuccess:n.onSuccess,onError:n.onError});c.current={onSuccess:n.onSuccess,onError:n.onError};const u=e.propsIdentity(n);return r.useEffect(()=>{if(o.current)return t.current=e.mountConnectButton(o.current,e.optionsFromProps(n,{onSuccess:()=>{var r,e;return null===(r=(e=c.current).onSuccess)||void 0===r?void 0:r.call(e)},onError:r=>{var e,n;return null===(e=(n=c.current).onError)||void 0===e?void 0:e.call(n,r)}})),()=>{var r;null===(r=t.current)||void 0===r||r.destroy(),t.current=null}},[u]),r.createElement("div",{ref:o,className:n.className,style:n.style})};
1
+ "use client";
2
+ "use strict";var e=require("react"),n=require("@withone/connect");const r=e=>{var n,r;return JSON.stringify([e.authorizeUrl,null!==(n=e.platforms)&&void 0!==n?n:[],e.connected,e.disabled,e.variant,e.size,e.fullWidth,e.theme,null!==(r=e.connectTheme)&&void 0!==r?r:e.appTheme,e.accentColor,e.label,e.connectedLabel,e.description])};exports.ConnectButton=function(t){var u;const c=e.useRef(null),l=e.useRef(null),o=e.useRef(""),s=e.useRef(t);s.current=t;const a=()=>({...s.current,onSuccess:()=>{var e,n;return null===(e=(n=s.current).onSuccess)||void 0===e?void 0:e.call(n)},onError:(e,n)=>{var r,t;return null===(r=(t=s.current).onError)||void 0===r?void 0:r.call(t,e,n)},onCancel:()=>{var e,n;return null===(e=(n=s.current).onCancel)||void 0===e?void 0:e.call(n)}});e.useEffect(()=>{if(c.current)return l.current=n.renderConnectButton(c.current,a()),o.current=r(s.current),()=>{var e;null===(e=l.current)||void 0===e||e.destroy(),l.current=null}},[]);const i=r(t);return e.useEffect(()=>{l.current&&i!==o.current&&(o.current=i,l.current.update(a()))},[i]),e.createElement("span",{ref:c,className:t.className?`one-connect ${t.className}`:"one-connect",style:t.style,"data-variant":null!==(u=t.variant)&&void 0!==u?u:"default","data-full-width":t.fullWidth?"":void 0})},exports.useOneConnect=function(r){const[t,u]=e.useState("idle"),[c,l]=e.useState(null),o=e.useRef(r);o.current=r;const s=e.useRef(null),a=()=>({...o.current,onSuccess:()=>{var e,n;return null===(e=(n=o.current).onSuccess)||void 0===e?void 0:e.call(n)},onError:(e,n)=>{var r,t;return null===(r=(t=o.current).onError)||void 0===r?void 0:r.call(t,e,n)},onCancel:()=>{var e,n;u("idle"),null===(e=(n=o.current).onCancel)||void 0===e||e.call(n)}});return e.useEffect(()=>{const e=n.createConnectFlow(a());s.current=e;const r=n.readConnectReturn();if("success"===(null==r?void 0:r.status))u("connected");else if("error"===(null==r?void 0:r.status)){var t,c;u("error"),l({message:null!==(t=r.message)&&void 0!==t?t:"",code:null!==(c=r.code)&&void 0!==c?c:"failed"})}return()=>{e.destroy(),s.current=null}},[]),e.useEffect(()=>{var e;null===(e=s.current)||void 0===e||e.update(a())}),{open:e.useCallback(()=>{s.current&&(l(null),u("connecting"),s.current.open())},[]),status:t,error:c}};
package/dist/react.d.ts CHANGED
@@ -1,7 +1,26 @@
1
1
  import type { CSSProperties, ReactElement } from "react";
2
- import { type ConnectButtonProps as ConnectButtonCoreProps } from "@withone/connect";
2
+ import { type ConnectButtonProps as ConnectButtonCoreProps, type ConnectFailureCode, type OneConnectFlowOptions } from "@withone/connect";
3
3
  export interface ConnectButtonProps extends ConnectButtonCoreProps {
4
+ /** On the host element, `<span class="one-connect">`. */
4
5
  className?: string;
5
6
  style?: CSSProperties;
6
7
  }
7
8
  export declare function ConnectButton(props: ConnectButtonProps): ReactElement;
9
+ export type OneConnectStatus = "idle" | "connecting" | "connected" | "error";
10
+ export interface UseOneConnectResult {
11
+ /** Sends the tab to One's hosted connect flow. */
12
+ open: () => void;
13
+ /** "connected" and "error" reflect how this page load ended a flow. */
14
+ status: OneConnectStatus;
15
+ error: {
16
+ message: string;
17
+ code: ConnectFailureCode;
18
+ } | null;
19
+ }
20
+ /**
21
+ * The flow for your own button:
22
+ *
23
+ * const { open, status, error } = useOneConnect({ authorizeUrl: "/api/one/authorize" });
24
+ * <button onClick={open} disabled={status === "connecting"}>Connect</button>
25
+ */
26
+ export declare function useOneConnect(options: OneConnectFlowOptions): UseOneConnectResult;
package/dist/react.esm.js CHANGED
@@ -1 +1,2 @@
1
- import{useRef as r,useEffect as n,createElement as o}from"react";import{propsIdentity as c,mountConnectButton as e,optionsFromProps as u}from"@withone/connect";function t(t){const s=r(null),l=r(null),i=r({onSuccess:t.onSuccess,onError:t.onError});i.current={onSuccess:t.onSuccess,onError:t.onError};const a=c(t);return n(()=>{if(s.current)return l.current=e(s.current,u(t,{onSuccess:()=>{var r,n;return null===(r=(n=i.current).onSuccess)||void 0===r?void 0:r.call(n)},onError:r=>{var n,o;return null===(n=(o=i.current).onError)||void 0===n?void 0:n.call(o,r)}})),()=>{var r;null===(r=l.current)||void 0===r||r.destroy(),l.current=null}},[a]),o("div",{ref:s,className:t.className,style:t.style})}export{t as ConnectButton};
1
+ "use client";
2
+ import{useRef as r,useEffect as n,createElement as e,useState as t,useCallback as l}from"react";import{renderConnectButton as c,createConnectFlow as o,readConnectReturn as u}from"@withone/connect";const a=r=>{var n,e;return JSON.stringify([r.authorizeUrl,null!==(n=r.platforms)&&void 0!==n?n:[],r.connected,r.disabled,r.variant,r.size,r.fullWidth,r.theme,null!==(e=r.connectTheme)&&void 0!==e?e:r.appTheme,r.accentColor,r.label,r.connectedLabel,r.description])};function i(t){var l;const o=r(null),u=r(null),i=r(""),s=r(t);s.current=t;const d=()=>({...s.current,onSuccess:()=>{var r,n;return null===(r=(n=s.current).onSuccess)||void 0===r?void 0:r.call(n)},onError:(r,n)=>{var e,t;return null===(e=(t=s.current).onError)||void 0===e?void 0:e.call(t,r,n)},onCancel:()=>{var r,n;return null===(r=(n=s.current).onCancel)||void 0===r?void 0:r.call(n)}});n(()=>{if(o.current)return u.current=c(o.current,d()),i.current=a(s.current),()=>{var r;null===(r=u.current)||void 0===r||r.destroy(),u.current=null}},[]);const v=a(t);return n(()=>{u.current&&v!==i.current&&(i.current=v,u.current.update(d()))},[v]),e("span",{ref:o,className:t.className?`one-connect ${t.className}`:"one-connect",style:t.style,"data-variant":null!==(l=t.variant)&&void 0!==l?l:"default","data-full-width":t.fullWidth?"":void 0})}function s(e){const[c,a]=t("idle"),[i,s]=t(null),d=r(e);d.current=e;const v=r(null),f=()=>({...d.current,onSuccess:()=>{var r,n;return null===(r=(n=d.current).onSuccess)||void 0===r?void 0:r.call(n)},onError:(r,n)=>{var e,t;return null===(e=(t=d.current).onError)||void 0===e?void 0:e.call(t,r,n)},onCancel:()=>{var r,n;a("idle"),null===(r=(n=d.current).onCancel)||void 0===r||r.call(n)}});n(()=>{const r=o(f());v.current=r;const n=u();if("success"===(null==n?void 0:n.status))a("connected");else if("error"===(null==n?void 0:n.status)){var e,t;a("error"),s({message:null!==(e=n.message)&&void 0!==e?e:"",code:null!==(t=n.code)&&void 0!==t?t:"failed"})}return()=>{r.destroy(),v.current=null}},[]),n(()=>{var r;null===(r=v.current)||void 0===r||r.update(f())});return{open:l(()=>{v.current&&(s(null),a("connecting"),v.current.open())},[]),status:c,error:i}}export{i as ConnectButton,s as useOneConnect};
package/dist/return.d.ts CHANGED
@@ -1,5 +1,8 @@
1
- import type { OneConnectReturn } from "./types";
2
- /** Reads the outcome the callback route put on the return URL. */
1
+ import type { ConnectFailureCode, OneConnectReturn } from "./types";
2
+ /** The only text the SDK ever shows for a failed flow. */
3
+ export declare const ERROR_MESSAGES: Record<ConnectFailureCode, string>;
4
+ /** Reads the outcome the callback route put on the return URL. The
5
+ * message always comes from ERROR_MESSAGES, never from the URL. */
3
6
  export declare function parseReturn(search: string): OneConnectReturn | null;
4
7
  /** The same URL without the return params, so a refresh does not
5
8
  * re-fire the callbacks. */