@ekanos/sdk 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -11
- package/api-report.md +27 -6
- package/dist/components/base-activation-dialog.js +2 -2
- package/dist/components/base-activation-dialog.js.map +1 -1
- package/dist/components/base-activation-form.js +1 -1
- package/dist/components/base-activation-form.js.map +1 -1
- package/dist/components/base-marketplace-tile.js +2 -2
- package/dist/components/base-marketplace-tile.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/oauth-activation-form.d.ts +8 -0
- package/dist/components/oauth-activation-form.js +10 -4
- package/dist/components/oauth-activation-form.js.map +1 -1
- package/dist/components/widgets/ai-prompt-chip.js +3 -3
- package/dist/components/widgets/ai-prompt-chip.js.map +1 -1
- package/dist/components/widgets/widget-ask-bar.js +1 -1
- package/dist/components/widgets/widget-ask-bar.js.map +1 -1
- package/dist/components/widgets/widget-ask-presentation.d.ts +35 -0
- package/dist/components/widgets/widget-ask-presentation.js +35 -0
- package/dist/components/widgets/widget-ask-presentation.js.map +1 -0
- package/dist/components/widgets/widget-state-components.d.ts +6 -1
- package/dist/components/widgets/widget-state-components.js +9 -9
- package/dist/components/widgets/widget-state-components.js.map +1 -1
- package/dist/components/widgets/widget.d.ts +4 -4
- package/dist/components/widgets/widget.js +43 -31
- package/dist/components/widgets/widget.js.map +1 -1
- package/dist/context/types.d.ts +1 -1
- package/dist/context/types.js.map +1 -1
- package/dist/contract/derive-contract.js +16 -10
- package/dist/contract/derive-contract.js.map +1 -1
- package/dist/contract/types.d.ts +1 -1
- package/dist/contract/types.js.map +1 -1
- package/dist/experience/client.d.ts +76 -0
- package/dist/experience/client.js +103 -2
- package/dist/experience/client.js.map +1 -1
- package/dist/experience/runtime.d.ts +16 -0
- package/dist/experience/runtime.js.map +1 -1
- package/dist/experience/sdk-instances.d.ts +11 -0
- package/dist/experience/sdk-instances.js +47 -0
- package/dist/experience/sdk-instances.js.map +1 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/partner-oauth.d.ts +15 -2
- package/dist/hooks/partner-oauth.js +3 -0
- package/dist/hooks/partner-oauth.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integration/index.d.ts +4 -2
- package/dist/integration/index.js +4 -1
- package/dist/integration/index.js.map +1 -1
- package/dist/testing/mock-context.d.ts +21 -2
- package/dist/testing/mock-context.js +102 -45
- package/dist/testing/mock-context.js.map +1 -1
- package/dist/types/workspace-target.d.ts +1 -1
- package/dist/types/workspace-target.js.map +1 -1
- package/dist/version.d.ts +7 -0
- package/dist/version.js +8 -0
- package/dist/version.js.map +1 -0
- package/eslint.design-preset.mjs +6 -4
- package/eslint.design-rules.mjs +218 -9
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ bundling reaches it just as easily. `@ekanos/ui` shipped a version where five
|
|
|
74
74
|
built entries each inlined their own copy of the icon module, and so each got
|
|
75
75
|
its own `createContext()`. A consumer's `IconStyleOverrideProvider` set one
|
|
76
76
|
instance; the chevron inside the select entry read another, found no provider,
|
|
77
|
-
and
|
|
77
|
+
and drew in a weight the consumer had not asked for.
|
|
78
78
|
Three of five icons rendered as `□`. The monorepo could not reproduce it at all
|
|
79
79
|
— it resolves from source, where one module means one context — so it was only
|
|
80
80
|
visible from an installed tarball. If you bundle `@ekanos/*` into your own
|
|
@@ -641,7 +641,7 @@ export function AcmePaymentsMarketplaceTile({
|
|
|
641
641
|
<CardHeader className="gap-3">
|
|
642
642
|
<div className="flex items-start justify-between gap-3">
|
|
643
643
|
<div className="bg-muted flex h-12 w-12 items-center justify-center rounded-lg">
|
|
644
|
-
<Icon name="
|
|
644
|
+
<Icon name="credit-card" className="h-6 w-6" aria-hidden />
|
|
645
645
|
</div>
|
|
646
646
|
{isActivated && <Badge variant="secondary">Connected</Badge>}
|
|
647
647
|
</div>
|
|
@@ -1386,6 +1386,7 @@ itself.
|
|
|
1386
1386
|
| `@ekanos/sdk/context` | anywhere (isomorphic, dependency-pure) | `EgressDeniedError`, `SecretAccessError`, `StorageValidationError`, the `isEgressAllowed` matcher, the storage validators — one implementation shared by the production wrapper and the mock |
|
|
1387
1387
|
| `@ekanos/sdk/testing` | anywhere (tests) | `createMockContext()`, `invokeWebhook()`, `invokeSchedule()` |
|
|
1388
1388
|
| `@ekanos/sdk/integration` | anywhere (isomorphic, dependency-pure) | `defineIntegration()`, `validateIntegrationDefinitions()`, `IntegrationDefinitionSchema`, and every `Partner*Declaration` type |
|
|
1389
|
+
| `@ekanos/sdk/experience/client` | client | The hooks an experience widget uses to reach an integration: `useOperation` (a read), `useInfiniteOperation` (a cursor-paginated read, one page at a time), `useOperationMutation` (a write on a person's click), `ExperienceRuntimeProvider` |
|
|
1389
1390
|
|
|
1390
1391
|
`@ekanos/sdk/mcp` is **not in the published package.** It is excluded from the
|
|
1391
1392
|
tarball (`files` carries `!dist/mcp`) and dropped from `publishConfig.exports`,
|
|
@@ -1404,15 +1405,12 @@ and the host adapts the definition internally.
|
|
|
1404
1405
|
### Styling
|
|
1405
1406
|
|
|
1406
1407
|
`@ekanos/ui` components emit Tailwind class strings against Ekanos's semantic
|
|
1407
|
-
tokens, and icons are
|
|
1408
|
-
`@ekanos/ui/styles.css` (or the narrower `tokens.css` / `theme.css` /
|
|
1409
|
-
`base.css`) to get the token layer
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
renders a circle-question disc instead, and `@ekanos/ui/icon` warns once per
|
|
1414
|
-
name in development. See `@ekanos/ui`'s README ("Icons: you must supply Font
|
|
1415
|
-
Awesome") for the Free-vs-Pro gap and how to size and re-family icons.
|
|
1408
|
+
tokens, and icons are Phosphor glyphs whose fonts ship inside `@ekanos/ui`.
|
|
1409
|
+
Import `@ekanos/ui/styles.css` (or the narrower `tokens.css` / `theme.css` /
|
|
1410
|
+
`base.css`) to get the token layer and the icon fonts. A name that is not a
|
|
1411
|
+
Phosphor icon draws the `shapes` fallback, and `ekanos validate` warns on it.
|
|
1412
|
+
See `@ekanos/ui`'s README ("Icons: Phosphor, included") for icon styles and
|
|
1413
|
+
sizing.
|
|
1416
1414
|
|
|
1417
1415
|
## Naming and validation rules, in one table
|
|
1418
1416
|
|
package/api-report.md
CHANGED
|
@@ -9,9 +9,9 @@ This is the complete surface of every entrypoint. The authoring guide
|
|
|
9
9
|
for these symbols is README.md. Entrypoints marked WORKSPACE-ONLY are
|
|
10
10
|
not reachable from a published install — see the note in each section.
|
|
11
11
|
|
|
12
|
-
Total exported names: **
|
|
12
|
+
Total exported names: **376** across 12 entrypoints.
|
|
13
13
|
|
|
14
|
-
## `@ekanos/sdk` (
|
|
14
|
+
## `@ekanos/sdk` (39 exports)
|
|
15
15
|
|
|
16
16
|
| Export | Kind |
|
|
17
17
|
| --- | --- |
|
|
@@ -29,9 +29,11 @@ Total exported names: **355** across 12 entrypoints.
|
|
|
29
29
|
| `IntegrationConnection` | interface |
|
|
30
30
|
| `IntegrationContext` | interface |
|
|
31
31
|
| `IntegrationFetch` | type alias |
|
|
32
|
+
| `IntegrationIdentity` | interface |
|
|
32
33
|
| `IntegrationLogger` | interface |
|
|
33
34
|
| `IntegrationMetadata` | interface |
|
|
34
35
|
| `IntegrationPermission` | interface |
|
|
36
|
+
| `IntegrationPrincipal` | type alias |
|
|
35
37
|
| `IntegrationRouting` | interface |
|
|
36
38
|
| `IntegrationSecrets` | interface |
|
|
37
39
|
| `IntegrationStorage` | interface |
|
|
@@ -53,7 +55,7 @@ Total exported names: **355** across 12 entrypoints.
|
|
|
53
55
|
| `WidgetVerdictTone` | type alias |
|
|
54
56
|
| `WorkspaceTargetDefinition` | interface |
|
|
55
57
|
|
|
56
|
-
## `@ekanos/sdk/components` (
|
|
58
|
+
## `@ekanos/sdk/components` (45 exports)
|
|
57
59
|
|
|
58
60
|
| Export | Kind |
|
|
59
61
|
| --- | --- |
|
|
@@ -74,6 +76,8 @@ Total exported names: **355** across 12 entrypoints.
|
|
|
74
76
|
| `Widget` | variable |
|
|
75
77
|
| `WidgetActions` | interface |
|
|
76
78
|
| `WidgetAskBar` | function |
|
|
79
|
+
| `WidgetAskPresentation` | interface |
|
|
80
|
+
| `WidgetAskPresentationProvider` | function |
|
|
77
81
|
| `WidgetConnectionGate` | interface |
|
|
78
82
|
| `WidgetContext` | variable |
|
|
79
83
|
| `WidgetContextValue` | interface |
|
|
@@ -101,7 +105,7 @@ Total exported names: **355** across 12 entrypoints.
|
|
|
101
105
|
| `widgetQueryState` | function |
|
|
102
106
|
| `widgetQueryStatus` | function |
|
|
103
107
|
|
|
104
|
-
## `@ekanos/sdk/hooks` (
|
|
108
|
+
## `@ekanos/sdk/hooks` (46 exports)
|
|
105
109
|
|
|
106
110
|
| Export | Kind |
|
|
107
111
|
| --- | --- |
|
|
@@ -124,6 +128,7 @@ Total exported names: **355** across 12 entrypoints.
|
|
|
124
128
|
| `OAuthErrorParam` | interface |
|
|
125
129
|
| `OAuthWidgetGateOptions` | type alias |
|
|
126
130
|
| `PartnerOAuthPathOptions` | interface |
|
|
131
|
+
| `PartnerOAuthStatusOptions` | interface |
|
|
127
132
|
| `PublishEventInput` | interface |
|
|
128
133
|
| `UseIntegrationActionOptions` | interface |
|
|
129
134
|
| `UseOAuthConnectionStatusOptions` | interface |
|
|
@@ -229,11 +234,12 @@ Total exported names: **355** across 12 entrypoints.
|
|
|
229
234
|
| `verifyDeclaredWebhookSignature` | function |
|
|
230
235
|
| `verifyWebhookSignature` | function |
|
|
231
236
|
|
|
232
|
-
## `@ekanos/sdk/integration` (
|
|
237
|
+
## `@ekanos/sdk/integration` (87 exports)
|
|
233
238
|
|
|
234
239
|
| Export | Kind |
|
|
235
240
|
| --- | --- |
|
|
236
241
|
| `ADMIN_HIERARCHY_LEVEL` | variable |
|
|
242
|
+
| `ActivationCredentialDeclaration` | type alias |
|
|
237
243
|
| `ActivationDeclaration` | type alias |
|
|
238
244
|
| `ActivationFieldDeclaration` | type alias |
|
|
239
245
|
| `AgentChannelDeliveryResult` | type alias |
|
|
@@ -244,14 +250,19 @@ Total exported names: **355** across 12 entrypoints.
|
|
|
244
250
|
| `AgentConversation` | interface |
|
|
245
251
|
| `AgentEventDeclaration` | interface |
|
|
246
252
|
| `AgentRouteValue` | interface |
|
|
253
|
+
| `AgentRunCancel` | interface |
|
|
247
254
|
| `AgentTriggerFilter` | type alias |
|
|
248
255
|
| `AgentTriggerFilterField` | type alias |
|
|
249
256
|
| `AgentUnroutedEvent` | interface |
|
|
250
257
|
| `AttentionHandler` | type alias |
|
|
251
258
|
| `AttentionSignal` | interface |
|
|
259
|
+
| `CREDENTIAL_LEVELS` | variable |
|
|
260
|
+
| `CredentialLevel` | type alias |
|
|
261
|
+
| `DEFAULT_CREDENTIAL_LEVEL` | variable |
|
|
252
262
|
| `DEFAULT_OAUTH_CONNECTION_ID` | variable |
|
|
253
263
|
| `DEFAULT_SIGNATURE_TOLERANCE_SECONDS` | variable |
|
|
254
264
|
| `DEFAULT_UNTRUSTED_TEXT_MAX_CHARS` | variable |
|
|
265
|
+
| `DeclaredCredential` | interface |
|
|
255
266
|
| `DefinitionCollisionInput` | interface |
|
|
256
267
|
| `FirstPartyInventory` | interface |
|
|
257
268
|
| `IntegrationCapabilityDeclaration` | type alias |
|
|
@@ -260,7 +271,9 @@ Total exported names: **355** across 12 entrypoints.
|
|
|
260
271
|
| `IntegrationDefinitionSchema` | variable |
|
|
261
272
|
| `IntegrationPermissionDeclaration` | type alias |
|
|
262
273
|
| `IntegrationProposals` | type alias |
|
|
274
|
+
| `MAX_AGENT_CONVERSATION_KEY_LENGTH` | variable |
|
|
263
275
|
| `MAX_AGENT_EVENT_DEDUPE_KEY_LENGTH` | variable |
|
|
276
|
+
| `MAX_AGENT_RUN_CANCELS` | variable |
|
|
264
277
|
| `MAX_RAISED_AGENT_EVENTS` | variable |
|
|
265
278
|
| `MAX_ROUTE_VALUE_LENGTH` | variable |
|
|
266
279
|
| `MAX_ROUTING_KEYS` | variable |
|
|
@@ -299,8 +312,11 @@ Total exported names: **355** across 12 entrypoints.
|
|
|
299
312
|
| `WidgetVerdict` | interface |
|
|
300
313
|
| `WidgetVerdictTone` | type alias |
|
|
301
314
|
| `actorIsAtLeast` | function |
|
|
315
|
+
| `declaredCredentialLevels` | function |
|
|
316
|
+
| `declaredCredentials` | function |
|
|
302
317
|
| `defineAgentEvent` | function |
|
|
303
318
|
| `defineIntegration` | function |
|
|
319
|
+
| `joinOAuthScopes` | function |
|
|
304
320
|
| `normalizeOAuthUrlValue` | function |
|
|
305
321
|
| `oauthProviderPlaceholders` | function |
|
|
306
322
|
| `parseCronExpression` | function |
|
|
@@ -397,17 +413,22 @@ Total exported names: **355** across 12 entrypoints.
|
|
|
397
413
|
| `step` | variable |
|
|
398
414
|
| `surfaceProblems` | function |
|
|
399
415
|
|
|
400
|
-
## `@ekanos/sdk/experience/client` (
|
|
416
|
+
## `@ekanos/sdk/experience/client` (15 exports)
|
|
401
417
|
|
|
402
418
|
| Export | Kind |
|
|
403
419
|
| --- | --- |
|
|
404
420
|
| `ExperienceRuntimeProvider` | function |
|
|
405
421
|
| `MutateOptions` | interface |
|
|
422
|
+
| `UseInfiniteOperationOptions` | interface |
|
|
423
|
+
| `UseInfiniteOperationResult` | interface |
|
|
406
424
|
| `UseOperationMutationOptions` | interface |
|
|
407
425
|
| `UseOperationMutationResult` | interface |
|
|
408
426
|
| `UseOperationOptions` | interface |
|
|
409
427
|
| `UseOperationResult` | interface |
|
|
428
|
+
| `useConnectIntegration` | function |
|
|
429
|
+
| `useExperiencePageHref` | function |
|
|
410
430
|
| `useExperienceRuntime` | function |
|
|
431
|
+
| `useInfiniteOperation` | function |
|
|
411
432
|
| `useIntegrationInfo` | function |
|
|
412
433
|
| `useOperation` | function |
|
|
413
434
|
| `useOperationMutation` | function |
|
|
@@ -10,13 +10,13 @@ import { Separator } from '@ekanos/ui/separator';
|
|
|
10
10
|
import { Trans } from '@ekanos/ui/trans';
|
|
11
11
|
import { cn } from '@ekanos/ui/utils';
|
|
12
12
|
function SuccessContent({ successTitle = 'Integration Activated!', successMessage = 'Your integration is now active and ready to use.', onClose, showSeparator = false, }) {
|
|
13
|
-
return (_jsxs("div", { className: "flex flex-col items-center space-y-4 py-6", children: [_jsx("div", { className: "bg-success-surface flex h-16 w-16 items-center justify-center rounded-full", children: _jsx(Icon, { name: "
|
|
13
|
+
return (_jsxs("div", { className: "flex flex-col items-center space-y-4 py-6", children: [_jsx("div", { className: "bg-success-surface flex h-16 w-16 items-center justify-center rounded-full", children: _jsx(Icon, { name: "check-circle", className: "text-success h-8 w-8" }) }), _jsxs("div", { className: "text-center", children: [_jsx("h3", { className: "text-lg font-semibold", children: successTitle }), _jsx("p", { className: "text-muted-foreground mt-1 text-sm", children: successMessage })] }), showSeparator && _jsx(Separator, {}), _jsxs("div", { className: "flex gap-2", children: [showSeparator && (_jsx(Button, { variant: "outline", onClick: onClose, children: _jsx(Trans, { i18nKey: "common:stayOnMarketplace", defaults: "Stay on Marketplace" }) })), _jsx(Button, { onClick: onClose, children: _jsx(Trans, { i18nKey: "common:continue", defaults: "Continue" }) })] })] }));
|
|
14
14
|
}
|
|
15
15
|
function ErrorAlert({ error }) {
|
|
16
16
|
return (_jsx(Alert, { variant: "destructive", role: "alert", children: _jsx(AlertDescription, { children: error }) }));
|
|
17
17
|
}
|
|
18
18
|
function LoadingOverlay() {
|
|
19
|
-
return (_jsx("div", { className: "bg-background fixed inset-0 z-50 flex items-center justify-center", children: _jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx(Icon, { name: "
|
|
19
|
+
return (_jsx("div", { className: "bg-background fixed inset-0 z-50 flex items-center justify-center", children: _jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx(Icon, { name: "spinner-gap", className: "text-muted-foreground h-8 w-8 animate-spin" }), _jsx("span", { className: "text-muted-foreground text-sm", children: "Loading..." })] }) }));
|
|
20
20
|
}
|
|
21
21
|
export function BaseActivationDialog({ isOpen, onClose, title, description, children, isLoading = false, error = null, success = false, successTitle, successMessage, onSuccessClose, maxWidth = 'sm:max-w-[600px]', inline = false, }) {
|
|
22
22
|
const handleClose = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-activation-dialog.js","sourceRoot":"","sources":["../../src/components/base-activation-dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAa,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAmBtC,SAAS,cAAc,CAAC,EACtB,YAAY,GAAG,wBAAwB,EACvC,cAAc,GAAG,kDAAkD,EACnE,OAAO,EACP,aAAa,GAAG,KAAK,GAMtB;IACC,OAAO,CACL,eAAK,SAAS,EAAC,2CAA2C,aACxD,cAAK,SAAS,EAAC,4EAA4E,YACzF,KAAC,IAAI,IAAC,IAAI,EAAC,iBAAiB,EAAC,SAAS,EAAC,sBAAsB,GAAG,GAC5D,EACN,eAAK,SAAS,EAAC,aAAa,aAC1B,aAAI,SAAS,EAAC,uBAAuB,YAAE,YAAY,GAAM,EACzD,YAAG,SAAS,EAAC,oCAAoC,YAAE,cAAc,G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AAS,IAAI,YAAY,CAAC,eACpD,SAAS,aAEpB,KAAC,EAAE,IAAC,SAAS,EAAE,CAAC,CAAC,KAAK,YACpB,KAAC,UAAU,IAAC,KAAK,EAAE,KAAM,GAAI,GAC1B,EACJ,QAAQ,IACL,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,EAC/B,MAAM,EACN,OAAO,EACP,KAAK,EACL,WAAW,EACX,QAAQ,EACR,SAAS,GAAG,KAAK,EACjB,KAAK,GAAG,IAAI,EACZ,OAAO,GAAG,KAAK,EACf,YAAY,EACZ,cAAc,EACd,QAAQ,GAAG,kBAAkB,GAa9B;IACC,OAAO,CACL,KAAC,MAAM,IAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,OAAO,EAAE,YAC9D,MAAC,aAAa,IAAC,SAAS,EAAE,GAAG,QAAQ,+BAA+B,aAClE,MAAC,YAAY,eACX,KAAC,WAAW,cAAE,KAAK,GAAe,EAClC,KAAC,iBAAiB,cAAE,WAAW,GAAqB,IACvC,EAEf,KAAC,EAAE,IAAC,SAAS,EAAE,CAAC,CAAC,KAAK,YACpB,KAAC,UAAU,IAAC,KAAK,EAAE,KAAM,GAAI,GAC1B,EAEL,KAAC,EAAE,IAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,YACxC,KAAC,cAAc,IACb,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,EAChB,aAAa,SACb,GACC,EAEJ,SAAS,IAAI,KAAC,cAAc,KAAG,IAClB,GACT,CACV,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { ReactNode, useEffect, useRef } from 'react';\n\nimport { Alert, AlertDescription } from '@ekanos/ui/alert';\nimport { Button } from '@ekanos/ui/button';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from '@ekanos/ui/dialog';\nimport { Icon } from '@ekanos/ui/icon';\nimport { If } from '@ekanos/ui/if';\nimport { Separator } from '@ekanos/ui/separator';\nimport { Trans } from '@ekanos/ui/trans';\nimport { cn } from '@ekanos/ui/utils';\n\ninterface BaseActivationDialogProps {\n isOpen: boolean;\n onClose: () => void;\n title: string;\n description: string;\n children: ReactNode;\n isLoading?: boolean;\n error?: string | null;\n success?: boolean;\n successTitle?: string;\n successMessage?: string;\n onSuccessClose?: () => void;\n maxWidth?: string;\n /** @deprecated Use `ActivationInline` instead for inline rendering */\n inline?: boolean;\n}\n\nfunction SuccessContent({\n successTitle = 'Integration Activated!',\n successMessage = 'Your integration is now active and ready to use.',\n onClose,\n showSeparator = false,\n}: {\n successTitle?: string;\n successMessage?: string;\n onClose: () => void;\n showSeparator?: boolean;\n}) {\n return (\n <div className=\"flex flex-col items-center space-y-4 py-6\">\n <div className=\"bg-success-surface flex h-16 w-16 items-center justify-center rounded-full\">\n <Icon name=\"fa-circle-check\" className=\"text-success h-8 w-8\" />\n </div>\n <div className=\"text-center\">\n <h3 className=\"text-lg font-semibold\">{successTitle}</h3>\n <p className=\"text-muted-foreground mt-1 text-sm\">{successMessage}</p>\n </div>\n {showSeparator && <Separator />}\n <div className=\"flex gap-2\">\n {showSeparator && (\n <Button variant=\"outline\" onClick={onClose}>\n <Trans\n i18nKey=\"common:stayOnMarketplace\"\n defaults=\"Stay on Marketplace\"\n />\n </Button>\n )}\n <Button onClick={onClose}>\n <Trans i18nKey=\"common:continue\" defaults=\"Continue\" />\n </Button>\n </div>\n </div>\n );\n}\n\nfunction ErrorAlert({ error }: { error: string }) {\n return (\n <Alert variant=\"destructive\" role=\"alert\">\n <AlertDescription>{error}</AlertDescription>\n </Alert>\n );\n}\n\nfunction LoadingOverlay() {\n return (\n <div className=\"bg-background fixed inset-0 z-50 flex items-center justify-center\">\n <div className=\"flex flex-col items-center gap-2\">\n <Icon\n name=\"fa-spinner-third\"\n className=\"text-muted-foreground h-8 w-8 animate-spin\"\n />\n <span className=\"text-muted-foreground text-sm\">Loading...</span>\n </div>\n </div>\n );\n}\n\nexport function BaseActivationDialog({\n isOpen,\n onClose,\n title,\n description,\n children,\n isLoading = false,\n error = null,\n success = false,\n successTitle,\n successMessage,\n onSuccessClose,\n maxWidth = 'sm:max-w-[600px]',\n inline = false,\n}: BaseActivationDialogProps) {\n const handleClose = () => {\n if (success && onSuccessClose) {\n onSuccessClose();\n } else {\n onClose();\n }\n };\n\n if (inline) {\n return (\n <ActivationInline\n isLoading={isLoading}\n error={error}\n success={success}\n onSuccessClose={success ? handleClose : undefined}\n >\n {children}\n </ActivationInline>\n );\n }\n\n return (\n <ActivationDialog\n isOpen={isOpen}\n onClose={handleClose}\n title={title}\n description={description}\n isLoading={isLoading}\n error={error}\n success={success}\n successTitle={successTitle}\n successMessage={successMessage}\n maxWidth={maxWidth}\n >\n {children}\n </ActivationDialog>\n );\n}\n\n// --- Explicit Variants ---\n\n/**\n * The form's body when it sits inside chrome the HOST owns (the connect\n * dialog, the workspace notice, first-use). The host already shows the\n * integration's name, what it does and what it can access, and it owns\n * the success moment (it closes and toasts) — so this renders the fields,\n * the error, and nothing else.\n *\n * `success` is a hand-off, not a screen: the moment it turns true,\n * `onSuccessClose` runs once, which is what lets a form written for the\n * old \"Continue\" panel finish the same way as one that reports success\n * directly. Nothing renders after it fires; the host takes over.\n */\nexport function ActivationInline({\n isLoading = false,\n error = null,\n success = false,\n onSuccessClose,\n children,\n}: {\n isLoading?: boolean;\n error?: string | null;\n success?: boolean;\n onSuccessClose?: () => void;\n children: ReactNode;\n}) {\n const handedOff = useRef(false);\n\n // Hands the success state to the host exactly once. An effect is the\n // right tool here: this reacts to a state transition that the form's own\n // submit handler set, and the host callback it calls navigates.\n useEffect(() => {\n if (!success || !onSuccessClose || handedOff.current) return;\n\n handedOff.current = true;\n onSuccessClose();\n }, [success, onSuccessClose]);\n\n if (success) {\n return null;\n }\n\n return (\n <div\n className={cn('flex flex-col gap-4', isLoading && 'opacity-70')}\n aria-busy={isLoading}\n >\n <If condition={!!error}>\n <ErrorAlert error={error!} />\n </If>\n {children}\n </div>\n );\n}\n\nexport function ActivationDialog({\n isOpen,\n onClose,\n title,\n description,\n children,\n isLoading = false,\n error = null,\n success = false,\n successTitle,\n successMessage,\n maxWidth = 'sm:max-w-[600px]',\n}: {\n isOpen: boolean;\n onClose: () => void;\n title: string;\n description: string;\n children: ReactNode;\n isLoading?: boolean;\n error?: string | null;\n success?: boolean;\n successTitle?: string;\n successMessage?: string;\n maxWidth?: string;\n}) {\n return (\n <Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>\n <DialogContent className={`${maxWidth} max-h-[80vh] overflow-y-auto`}>\n <DialogHeader>\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n\n <If condition={!!error}>\n <ErrorAlert error={error!} />\n </If>\n\n <If condition={success} fallback={children}>\n <SuccessContent\n successTitle={successTitle}\n successMessage={successMessage}\n onClose={onClose}\n showSeparator\n />\n </If>\n\n {isLoading && <LoadingOverlay />}\n </DialogContent>\n </Dialog>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base-activation-dialog.js","sourceRoot":"","sources":["../../src/components/base-activation-dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAa,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CA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CAAC,CAAC,KAAK,YACpB,KAAC,UAAU,IAAC,KAAK,EAAE,KAAM,GAAI,GAC1B,EAEL,KAAC,EAAE,IAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,YACxC,KAAC,cAAc,IACb,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,EAChB,aAAa,SACb,GACC,EAEJ,SAAS,IAAI,KAAC,cAAc,KAAG,IAClB,GACT,CACV,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { ReactNode, useEffect, useRef } from 'react';\n\nimport { Alert, AlertDescription } from '@ekanos/ui/alert';\nimport { Button } from '@ekanos/ui/button';\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from '@ekanos/ui/dialog';\nimport { Icon } from '@ekanos/ui/icon';\nimport { If } from '@ekanos/ui/if';\nimport { Separator } from '@ekanos/ui/separator';\nimport { Trans } from '@ekanos/ui/trans';\nimport { cn } from '@ekanos/ui/utils';\n\ninterface BaseActivationDialogProps {\n isOpen: boolean;\n onClose: () => void;\n title: string;\n description: string;\n children: ReactNode;\n isLoading?: boolean;\n error?: string | null;\n success?: boolean;\n successTitle?: string;\n successMessage?: string;\n onSuccessClose?: () => void;\n maxWidth?: string;\n /** @deprecated Use `ActivationInline` instead for inline rendering */\n inline?: boolean;\n}\n\nfunction SuccessContent({\n successTitle = 'Integration Activated!',\n successMessage = 'Your integration is now active and ready to use.',\n onClose,\n showSeparator = false,\n}: {\n successTitle?: string;\n successMessage?: string;\n onClose: () => void;\n showSeparator?: boolean;\n}) {\n return (\n <div className=\"flex flex-col items-center space-y-4 py-6\">\n <div className=\"bg-success-surface flex h-16 w-16 items-center justify-center rounded-full\">\n <Icon name=\"check-circle\" className=\"text-success h-8 w-8\" />\n </div>\n <div className=\"text-center\">\n <h3 className=\"text-lg font-semibold\">{successTitle}</h3>\n <p className=\"text-muted-foreground mt-1 text-sm\">{successMessage}</p>\n </div>\n {showSeparator && <Separator />}\n <div className=\"flex gap-2\">\n {showSeparator && (\n <Button variant=\"outline\" onClick={onClose}>\n <Trans\n i18nKey=\"common:stayOnMarketplace\"\n defaults=\"Stay on Marketplace\"\n />\n </Button>\n )}\n <Button onClick={onClose}>\n <Trans i18nKey=\"common:continue\" defaults=\"Continue\" />\n </Button>\n </div>\n </div>\n );\n}\n\nfunction ErrorAlert({ error }: { error: string }) {\n return (\n <Alert variant=\"destructive\" role=\"alert\">\n <AlertDescription>{error}</AlertDescription>\n </Alert>\n );\n}\n\nfunction LoadingOverlay() {\n return (\n <div className=\"bg-background fixed inset-0 z-50 flex items-center justify-center\">\n <div className=\"flex flex-col items-center gap-2\">\n <Icon\n name=\"spinner-gap\"\n className=\"text-muted-foreground h-8 w-8 animate-spin\"\n />\n <span className=\"text-muted-foreground text-sm\">Loading...</span>\n </div>\n </div>\n );\n}\n\nexport function BaseActivationDialog({\n isOpen,\n onClose,\n title,\n description,\n children,\n isLoading = false,\n error = null,\n success = false,\n successTitle,\n successMessage,\n onSuccessClose,\n maxWidth = 'sm:max-w-[600px]',\n inline = false,\n}: BaseActivationDialogProps) {\n const handleClose = () => {\n if (success && onSuccessClose) {\n onSuccessClose();\n } else {\n onClose();\n }\n };\n\n if (inline) {\n return (\n <ActivationInline\n isLoading={isLoading}\n error={error}\n success={success}\n onSuccessClose={success ? handleClose : undefined}\n >\n {children}\n </ActivationInline>\n );\n }\n\n return (\n <ActivationDialog\n isOpen={isOpen}\n onClose={handleClose}\n title={title}\n description={description}\n isLoading={isLoading}\n error={error}\n success={success}\n successTitle={successTitle}\n successMessage={successMessage}\n maxWidth={maxWidth}\n >\n {children}\n </ActivationDialog>\n );\n}\n\n// --- Explicit Variants ---\n\n/**\n * The form's body when it sits inside chrome the HOST owns (the connect\n * dialog, the workspace notice, first-use). The host already shows the\n * integration's name, what it does and what it can access, and it owns\n * the success moment (it closes and toasts) — so this renders the fields,\n * the error, and nothing else.\n *\n * `success` is a hand-off, not a screen: the moment it turns true,\n * `onSuccessClose` runs once, which is what lets a form written for the\n * old \"Continue\" panel finish the same way as one that reports success\n * directly. Nothing renders after it fires; the host takes over.\n */\nexport function ActivationInline({\n isLoading = false,\n error = null,\n success = false,\n onSuccessClose,\n children,\n}: {\n isLoading?: boolean;\n error?: string | null;\n success?: boolean;\n onSuccessClose?: () => void;\n children: ReactNode;\n}) {\n const handedOff = useRef(false);\n\n // Hands the success state to the host exactly once. An effect is the\n // right tool here: this reacts to a state transition that the form's own\n // submit handler set, and the host callback it calls navigates.\n useEffect(() => {\n if (!success || !onSuccessClose || handedOff.current) return;\n\n handedOff.current = true;\n onSuccessClose();\n }, [success, onSuccessClose]);\n\n if (success) {\n return null;\n }\n\n return (\n <div\n className={cn('flex flex-col gap-4', isLoading && 'opacity-70')}\n aria-busy={isLoading}\n >\n <If condition={!!error}>\n <ErrorAlert error={error!} />\n </If>\n {children}\n </div>\n );\n}\n\nexport function ActivationDialog({\n isOpen,\n onClose,\n title,\n description,\n children,\n isLoading = false,\n error = null,\n success = false,\n successTitle,\n successMessage,\n maxWidth = 'sm:max-w-[600px]',\n}: {\n isOpen: boolean;\n onClose: () => void;\n title: string;\n description: string;\n children: ReactNode;\n isLoading?: boolean;\n error?: string | null;\n success?: boolean;\n successTitle?: string;\n successMessage?: string;\n maxWidth?: string;\n}) {\n return (\n <Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>\n <DialogContent className={`${maxWidth} max-h-[80vh] overflow-y-auto`}>\n <DialogHeader>\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n\n <If condition={!!error}>\n <ErrorAlert error={error!} />\n </If>\n\n <If condition={success} fallback={children}>\n <SuccessContent\n successTitle={successTitle}\n successMessage={successMessage}\n onClose={onClose}\n showSeparator\n />\n </If>\n\n {isLoading && <LoadingOverlay />}\n </DialogContent>\n </Dialog>\n );\n}\n"]}
|
|
@@ -39,7 +39,7 @@ function ActivationFormBody({ form, submit, children, onCancel, submitLabel, sub
|
|
|
39
39
|
const hasFields = children !== null && children !== undefined;
|
|
40
40
|
return (_jsx(Form, Object.assign({}, form, { children: _jsxs("form", { onSubmit: form.handleSubmit(submit.handle), className: "flex flex-col gap-5", "data-test": "activation-form", children: [hasFields ? (_jsx("fieldset", { className: "flex min-w-0 flex-col gap-5", disabled: loading, children: children })) : null, _jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("div", { className: hasFields
|
|
41
41
|
? 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end'
|
|
42
|
-
: 'flex flex-col', children: [onCancel && hasFields ? (_jsx(Button, { type: "button", variant: "ghost", onClick: onCancel, disabled: loading, "data-test": "activation-cancel", children: _jsx(Trans, { i18nKey: "common:cancel", defaults: "Cancel" }) })) : null, _jsx(Button, { type: "submit", size: hasFields ? 'default' : 'lg', className: hasFields ? undefined : 'w-full', disabled: loading || submitDisabled, "data-test": "activation-submit", children: loading ? (_jsxs(_Fragment, { children: [_jsx(Icon, { name: "
|
|
42
|
+
: 'flex flex-col', children: [onCancel && hasFields ? (_jsx(Button, { type: "button", variant: "ghost", onClick: onCancel, disabled: loading, "data-test": "activation-cancel", children: _jsx(Trans, { i18nKey: "common:cancel", defaults: "Cancel" }) })) : null, _jsx(Button, { type: "submit", size: hasFields ? 'default' : 'lg', className: hasFields ? undefined : 'w-full', disabled: loading || submitDisabled, "data-test": "activation-submit", children: loading ? (_jsxs(_Fragment, { children: [_jsx(Icon, { name: "spinner-gap", className: "h-4 w-4 animate-spin" }), submitLoadingLabel !== null && submitLoadingLabel !== void 0 ? submitLoadingLabel : (_jsx(Trans, { i18nKey: "common:integrationConnect.connecting", defaults: "Connecting\u2026" }))] })) : ((submitLabel !== null && submitLabel !== void 0 ? submitLabel : (_jsx(Trans, { i18nKey: "common:integrationConnect.connect", defaults: "Connect" })))) })] }), footnote ? (_jsx("p", { className: hasFields
|
|
43
43
|
? 'text-muted-foreground text-sm sm:text-right'
|
|
44
44
|
: 'text-muted-foreground text-center text-sm', children: footnote })) : null] })] }) })));
|
|
45
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-activation-form.js","sourceRoot":"","sources":["../../src/components/base-activation-form.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAa,aAAa,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAwClC;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAiD,EAC7E,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,SAAS,GAAG,KAAK,EACjB,KAAK,GAAG,IAAI,EACZ,QAAQ,EACR,WAAW,EACX,kBAAkB,EAClB,cAAc,GAAG,KAAK,EACtB,QAAQ,GACmC;IAC3C,MAAM,MAAM,GAAG,mBAAmB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAExD,OAAO,CACL,KAAC,gBAAgB,IAAC,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,YACvD,KAAC,kBAAkB,IACjB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,kBAAkB,EAAE,kBAAkB,EACtC,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,QAAQ,YAEjB,QAAQ,GACU,GACJ,CACpB,CAAC;AACJ,CAAC;AAED,oFAAoF;AACpF,SAAS,mBAAmB,CAC1B,QAAsD,EACtD,SAAkB;IAElB,MAAM,CAAC,OAAO,EAAE,eAAe,C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,EACR,MAAM,GAAG,KAAK,GACwB;IACtC,MAAM,MAAM,GAAG,mBAAmB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAExD,MAAM,IAAI,GAAG,CACX,KAAC,kBAAkB,IACjB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,IAAI,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAC1D,WAAW,EAAE,gBAAgB,EAC7B,kBAAkB,EAAE,uBAAuB,EAC3C,cAAc,EAAE,oBAAoB,EACpC,QAAQ,EAAE,QAAQ,YAEjB,QAAQ,GACU,CACtB,CAAC;IAEF,OAAO,CACL,KAAC,oBAAoB,IACnB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,MAAM,CAAC,OAAO,EACzB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,YAEb,IAAI,GACgB,CACxB,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { ReactNode, useTransition } from 'react';\n\nimport { Button } from '@ekanos/ui/button';\nimport { Form } from '@ekanos/ui/form';\nimport { Icon } from '@ekanos/ui/icon';\nimport { Trans } from '@ekanos/ui/trans';\nimport { FieldValues, UseFormReturn } from 'react-hook-form';\n\nimport {\n ActivationInline,\n BaseActivationDialog,\n} from './base-activation-dialog';\n\nexport interface ActivationFormComponentProps<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /**\n * Generic rather than `UseFormReturn<any>`: with current react-hook-form\n * typings a concrete `UseFormReturn<T>` is NOT assignable to\n * `UseFormReturn<any>` (the `control._options.validate` parameter is\n * checked contravariantly), which broke every out-of-repo consumer — the\n * clean-room pack test caught it. Inference from the `form` prop keeps\n * every call site source-compatible.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n form: UseFormReturn<TFieldValues, any, any>;\n onSubmit: (data: TFieldValues) => Promise<void> | void;\n /** The fields. Leave out for a form that is only its button (a sign-in). */\n children?: ReactNode;\n isLoading?: boolean;\n error?: string | null;\n /**\n * Shows a Cancel button beside Connect that calls this. Leave out for a\n * surface that supplies its own way out. A form with no fields never shows\n * one — its single button spans the frame and the host's close is the way\n * out.\n */\n onCancel?: () => void;\n /** Defaults to \"Connect\" — the one verb every integration shares. */\n submitLabel?: ReactNode;\n /** Defaults to \"Connecting…\". */\n submitLoadingLabel?: ReactNode;\n submitDisabled?: boolean;\n /**\n * One quiet line under the action row — what happens next (\"You'll sign\n * in on QuickBooks' site and come back here.\"). Nothing else belongs\n * there: not features, not permissions, the host shows those.\n */\n footnote?: ReactNode;\n}\n\n/**\n * An integration's connect form: its fields, the error, and the action row.\n *\n * The host owns the frame around it — the connect dialog, the workspace\n * notice, first use — and with it the integration's name, what it does, what\n * it can access and the success moment. So this renders no title and no\n * success screen: when the connection is made, call the `onSuccess` the host\n * passed your form.\n */\nexport function ActivationForm<TFieldValues extends FieldValues = FieldValues>({\n form,\n onSubmit,\n children,\n isLoading = false,\n error = null,\n onCancel,\n submitLabel,\n submitLoadingLabel,\n submitDisabled = false,\n footnote,\n}: ActivationFormComponentProps<TFieldValues>) {\n const submit = useSubmitTransition(onSubmit, isLoading);\n\n return (\n <ActivationInline isLoading={submit.loading} error={error}>\n <ActivationFormBody\n form={form}\n submit={submit}\n onCancel={onCancel}\n submitLabel={submitLabel}\n submitLoadingLabel={submitLoadingLabel}\n submitDisabled={submitDisabled}\n footnote={footnote}\n >\n {children}\n </ActivationFormBody>\n </ActivationInline>\n );\n}\n\n/** Runs the submit in a transition, so the form reads as busy until it resolves. */\nfunction useSubmitTransition<TFieldValues extends FieldValues>(\n onSubmit: (data: TFieldValues) => Promise<void> | void,\n isLoading: boolean,\n) {\n const [pending, startTransition] = useTransition();\n\n return {\n loading: pending || isLoading,\n handle: (data: TFieldValues) => {\n startTransition(async () => {\n await onSubmit(data);\n });\n },\n };\n}\n\nfunction ActivationFormBody<TFieldValues extends FieldValues>({\n form,\n submit,\n children,\n onCancel,\n submitLabel,\n submitLoadingLabel,\n submitDisabled = false,\n footnote,\n}: Omit<\n ActivationFormComponentProps<TFieldValues>,\n 'error' | 'onSubmit' | 'isLoading'\n> & {\n submit: ReturnType<typeof useSubmitTransition<TFieldValues>>;\n}) {\n const { loading } = submit;\n\n // `children` is null for a form with nothing to fill in (an OAuth button,\n // a one-click connect), and the action row is then the whole form —\n // no empty field block above it.\n const hasFields = children !== null && children !== undefined;\n\n return (\n <Form {...form}>\n <form\n onSubmit={form.handleSubmit(submit.handle)}\n className=\"flex flex-col gap-5\"\n data-test=\"activation-form\"\n >\n {hasFields ? (\n <fieldset className=\"flex min-w-0 flex-col gap-5\" disabled={loading}>\n {children}\n </fieldset>\n ) : null}\n\n {/*\n Two shapes. With fields: Cancel + Connect, right-aligned, under\n what was filled in. Without (a sign-in button, a one-click\n connect): the button IS the form, so it spans the frame and needs\n no Cancel of its own — the dialog's close does that job.\n */}\n <div className=\"flex flex-col gap-2\">\n <div\n className={\n hasFields\n ? 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end'\n : 'flex flex-col'\n }\n >\n {onCancel && hasFields ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={onCancel}\n disabled={loading}\n data-test=\"activation-cancel\"\n >\n <Trans i18nKey=\"common:cancel\" defaults=\"Cancel\" />\n </Button>\n ) : null}\n\n <Button\n type=\"submit\"\n size={hasFields ? 'default' : 'lg'}\n className={hasFields ? undefined : 'w-full'}\n disabled={loading || submitDisabled}\n data-test=\"activation-submit\"\n >\n {loading ? (\n <>\n <Icon\n name=\"fa-spinner-third\"\n className=\"h-4 w-4 animate-spin\"\n />\n {submitLoadingLabel ?? (\n <Trans\n i18nKey=\"common:integrationConnect.connecting\"\n defaults=\"Connecting…\"\n />\n )}\n </>\n ) : (\n (submitLabel ?? (\n <Trans\n i18nKey=\"common:integrationConnect.connect\"\n defaults=\"Connect\"\n />\n ))\n )}\n </Button>\n </div>\n\n {footnote ? (\n <p\n className={\n hasFields\n ? 'text-muted-foreground text-sm sm:text-right'\n : 'text-muted-foreground text-center text-sm'\n }\n >\n {footnote}\n </p>\n ) : null}\n </div>\n </form>\n </Form>\n );\n}\n\n/**\n * @deprecated Use `ActivationForm`. Every host renders a connect form inline\n * in its own frame, so the dialog mode, its title and description, and the\n * success screen go unused; `ActivationForm` is the inline form without them.\n */\nexport interface BaseActivationFormProps<\n TFieldValues extends FieldValues = FieldValues,\n> {\n isOpen: boolean;\n onClose: () => void;\n /** Shown only when NOT inline. Inline, the host names the integration. */\n title: string;\n /** Shown only when NOT inline. */\n description: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n form: UseFormReturn<TFieldValues, any, any>;\n onSubmit: (data: TFieldValues) => Promise<void> | void;\n children: ReactNode;\n isLoading?: boolean;\n error?: string | null;\n success?: boolean;\n successTitle?: string;\n successMessage?: string;\n onSuccessClose?: () => void;\n submitButtonText?: ReactNode;\n submitButtonLoadingText?: ReactNode;\n submitButtonDisabled?: boolean;\n /** Inline, shows Cancel beside Connect, calling `onClose`. Default true. */\n showCancelButton?: boolean;\n /** @deprecated The action row is right-aligned; this is ignored. */\n centerSubmitButton?: boolean;\n footnote?: ReactNode;\n maxWidth?: string;\n /** Render inline instead of in a dialog */\n inline?: boolean;\n}\n\n/**\n * @deprecated Use `ActivationForm` — the same inline form, with Cancel shown\n * by passing `onCancel` and success reported by calling the host's\n * `onSuccess`. Kept so forms built against 0.22 keep working; removed in the\n * next major.\n */\nexport function BaseActivationForm<\n TFieldValues extends FieldValues = FieldValues,\n>({\n isOpen,\n onClose,\n title,\n description,\n form,\n onSubmit,\n children,\n isLoading = false,\n error = null,\n success = false,\n successTitle,\n successMessage,\n onSuccessClose,\n submitButtonText,\n submitButtonLoadingText,\n submitButtonDisabled = false,\n showCancelButton = true,\n footnote,\n maxWidth,\n inline = false,\n}: BaseActivationFormProps<TFieldValues>) {\n const submit = useSubmitTransition(onSubmit, isLoading);\n\n const body = (\n <ActivationFormBody\n form={form}\n submit={submit}\n onCancel={inline && showCancelButton ? onClose : undefined}\n submitLabel={submitButtonText}\n submitLoadingLabel={submitButtonLoadingText}\n submitDisabled={submitButtonDisabled}\n footnote={footnote}\n >\n {children}\n </ActivationFormBody>\n );\n\n return (\n <BaseActivationDialog\n isOpen={isOpen}\n onClose={onClose}\n title={title}\n description={description}\n isLoading={submit.loading}\n error={error}\n success={success}\n successTitle={successTitle}\n successMessage={successMessage}\n onSuccessClose={onSuccessClose}\n maxWidth={maxWidth}\n inline={inline}\n >\n {body}\n </BaseActivationDialog>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base-activation-form.js","sourceRoot":"","sources":["../../src/components/base-activation-form.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAa,aAAa,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAwClC;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAiD,EAC7E,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,SAAS,GAAG,KAAK,EACjB,KAAK,GAAG,IAAI,EACZ,QAAQ,EACR,WAAW,EACX,kBAAkB,EAClB,cAAc,GAAG,KAAK,EACtB,QAAQ,GACmC;IAC3C,MAAM,MAAM,GAAG,mBAAmB,CAAC,QAAQ,EAAE,SAAS,CAA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C;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { ReactNode, useTransition } from 'react';\n\nimport { Button } from '@ekanos/ui/button';\nimport { Form } from '@ekanos/ui/form';\nimport { Icon } from '@ekanos/ui/icon';\nimport { Trans } from '@ekanos/ui/trans';\nimport { FieldValues, UseFormReturn } from 'react-hook-form';\n\nimport {\n ActivationInline,\n BaseActivationDialog,\n} from './base-activation-dialog';\n\nexport interface ActivationFormComponentProps<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /**\n * Generic rather than `UseFormReturn<any>`: with current react-hook-form\n * typings a concrete `UseFormReturn<T>` is NOT assignable to\n * `UseFormReturn<any>` (the `control._options.validate` parameter is\n * checked contravariantly), which broke every out-of-repo consumer — the\n * clean-room pack test caught it. Inference from the `form` prop keeps\n * every call site source-compatible.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n form: UseFormReturn<TFieldValues, any, any>;\n onSubmit: (data: TFieldValues) => Promise<void> | void;\n /** The fields. Leave out for a form that is only its button (a sign-in). */\n children?: ReactNode;\n isLoading?: boolean;\n error?: string | null;\n /**\n * Shows a Cancel button beside Connect that calls this. Leave out for a\n * surface that supplies its own way out. A form with no fields never shows\n * one — its single button spans the frame and the host's close is the way\n * out.\n */\n onCancel?: () => void;\n /** Defaults to \"Connect\" — the one verb every integration shares. */\n submitLabel?: ReactNode;\n /** Defaults to \"Connecting…\". */\n submitLoadingLabel?: ReactNode;\n submitDisabled?: boolean;\n /**\n * One quiet line under the action row — what happens next (\"You'll sign\n * in on QuickBooks' site and come back here.\"). Nothing else belongs\n * there: not features, not permissions, the host shows those.\n */\n footnote?: ReactNode;\n}\n\n/**\n * An integration's connect form: its fields, the error, and the action row.\n *\n * The host owns the frame around it — the connect dialog, the workspace\n * notice, first use — and with it the integration's name, what it does, what\n * it can access and the success moment. So this renders no title and no\n * success screen: when the connection is made, call the `onSuccess` the host\n * passed your form.\n */\nexport function ActivationForm<TFieldValues extends FieldValues = FieldValues>({\n form,\n onSubmit,\n children,\n isLoading = false,\n error = null,\n onCancel,\n submitLabel,\n submitLoadingLabel,\n submitDisabled = false,\n footnote,\n}: ActivationFormComponentProps<TFieldValues>) {\n const submit = useSubmitTransition(onSubmit, isLoading);\n\n return (\n <ActivationInline isLoading={submit.loading} error={error}>\n <ActivationFormBody\n form={form}\n submit={submit}\n onCancel={onCancel}\n submitLabel={submitLabel}\n submitLoadingLabel={submitLoadingLabel}\n submitDisabled={submitDisabled}\n footnote={footnote}\n >\n {children}\n </ActivationFormBody>\n </ActivationInline>\n );\n}\n\n/** Runs the submit in a transition, so the form reads as busy until it resolves. */\nfunction useSubmitTransition<TFieldValues extends FieldValues>(\n onSubmit: (data: TFieldValues) => Promise<void> | void,\n isLoading: boolean,\n) {\n const [pending, startTransition] = useTransition();\n\n return {\n loading: pending || isLoading,\n handle: (data: TFieldValues) => {\n startTransition(async () => {\n await onSubmit(data);\n });\n },\n };\n}\n\nfunction ActivationFormBody<TFieldValues extends FieldValues>({\n form,\n submit,\n children,\n onCancel,\n submitLabel,\n submitLoadingLabel,\n submitDisabled = false,\n footnote,\n}: Omit<\n ActivationFormComponentProps<TFieldValues>,\n 'error' | 'onSubmit' | 'isLoading'\n> & {\n submit: ReturnType<typeof useSubmitTransition<TFieldValues>>;\n}) {\n const { loading } = submit;\n\n // `children` is null for a form with nothing to fill in (an OAuth button,\n // a one-click connect), and the action row is then the whole form —\n // no empty field block above it.\n const hasFields = children !== null && children !== undefined;\n\n return (\n <Form {...form}>\n <form\n onSubmit={form.handleSubmit(submit.handle)}\n className=\"flex flex-col gap-5\"\n data-test=\"activation-form\"\n >\n {hasFields ? (\n <fieldset className=\"flex min-w-0 flex-col gap-5\" disabled={loading}>\n {children}\n </fieldset>\n ) : null}\n\n {/*\n Two shapes. With fields: Cancel + Connect, right-aligned, under\n what was filled in. Without (a sign-in button, a one-click\n connect): the button IS the form, so it spans the frame and needs\n no Cancel of its own — the dialog's close does that job.\n */}\n <div className=\"flex flex-col gap-2\">\n <div\n className={\n hasFields\n ? 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end'\n : 'flex flex-col'\n }\n >\n {onCancel && hasFields ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={onCancel}\n disabled={loading}\n data-test=\"activation-cancel\"\n >\n <Trans i18nKey=\"common:cancel\" defaults=\"Cancel\" />\n </Button>\n ) : null}\n\n <Button\n type=\"submit\"\n size={hasFields ? 'default' : 'lg'}\n className={hasFields ? undefined : 'w-full'}\n disabled={loading || submitDisabled}\n data-test=\"activation-submit\"\n >\n {loading ? (\n <>\n <Icon name=\"spinner-gap\" className=\"h-4 w-4 animate-spin\" />\n {submitLoadingLabel ?? (\n <Trans\n i18nKey=\"common:integrationConnect.connecting\"\n defaults=\"Connecting…\"\n />\n )}\n </>\n ) : (\n (submitLabel ?? (\n <Trans\n i18nKey=\"common:integrationConnect.connect\"\n defaults=\"Connect\"\n />\n ))\n )}\n </Button>\n </div>\n\n {footnote ? (\n <p\n className={\n hasFields\n ? 'text-muted-foreground text-sm sm:text-right'\n : 'text-muted-foreground text-center text-sm'\n }\n >\n {footnote}\n </p>\n ) : null}\n </div>\n </form>\n </Form>\n );\n}\n\n/**\n * @deprecated Use `ActivationForm`. Every host renders a connect form inline\n * in its own frame, so the dialog mode, its title and description, and the\n * success screen go unused; `ActivationForm` is the inline form without them.\n */\nexport interface BaseActivationFormProps<\n TFieldValues extends FieldValues = FieldValues,\n> {\n isOpen: boolean;\n onClose: () => void;\n /** Shown only when NOT inline. Inline, the host names the integration. */\n title: string;\n /** Shown only when NOT inline. */\n description: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n form: UseFormReturn<TFieldValues, any, any>;\n onSubmit: (data: TFieldValues) => Promise<void> | void;\n children: ReactNode;\n isLoading?: boolean;\n error?: string | null;\n success?: boolean;\n successTitle?: string;\n successMessage?: string;\n onSuccessClose?: () => void;\n submitButtonText?: ReactNode;\n submitButtonLoadingText?: ReactNode;\n submitButtonDisabled?: boolean;\n /** Inline, shows Cancel beside Connect, calling `onClose`. Default true. */\n showCancelButton?: boolean;\n /** @deprecated The action row is right-aligned; this is ignored. */\n centerSubmitButton?: boolean;\n footnote?: ReactNode;\n maxWidth?: string;\n /** Render inline instead of in a dialog */\n inline?: boolean;\n}\n\n/**\n * @deprecated Use `ActivationForm` — the same inline form, with Cancel shown\n * by passing `onCancel` and success reported by calling the host's\n * `onSuccess`. Kept so forms built against 0.22 keep working; removed in the\n * next major.\n */\nexport function BaseActivationForm<\n TFieldValues extends FieldValues = FieldValues,\n>({\n isOpen,\n onClose,\n title,\n description,\n form,\n onSubmit,\n children,\n isLoading = false,\n error = null,\n success = false,\n successTitle,\n successMessage,\n onSuccessClose,\n submitButtonText,\n submitButtonLoadingText,\n submitButtonDisabled = false,\n showCancelButton = true,\n footnote,\n maxWidth,\n inline = false,\n}: BaseActivationFormProps<TFieldValues>) {\n const submit = useSubmitTransition(onSubmit, isLoading);\n\n const body = (\n <ActivationFormBody\n form={form}\n submit={submit}\n onCancel={inline && showCancelButton ? onClose : undefined}\n submitLabel={submitButtonText}\n submitLoadingLabel={submitButtonLoadingText}\n submitDisabled={submitButtonDisabled}\n footnote={footnote}\n >\n {children}\n </ActivationFormBody>\n );\n\n return (\n <BaseActivationDialog\n isOpen={isOpen}\n onClose={onClose}\n title={title}\n description={description}\n isLoading={submit.loading}\n error={error}\n success={success}\n successTitle={successTitle}\n successMessage={successMessage}\n onSuccessClose={onSuccessClose}\n maxWidth={maxWidth}\n inline={inline}\n >\n {body}\n </BaseActivationDialog>\n );\n}\n"]}
|
|
@@ -21,13 +21,13 @@ export function BaseMarketplaceTile(props) {
|
|
|
21
21
|
const displayTitle = name || 'Unknown Product';
|
|
22
22
|
const displaySummary = summary;
|
|
23
23
|
const displayBrandName = brandName || displayTitle;
|
|
24
|
-
const cardContent = (_jsxs(Card, { className: cn('group bg-card relative flex h-full w-full cursor-pointer flex-col overflow-hidden border-0 pt-3 pb-2 shadow-sm transition-
|
|
24
|
+
const cardContent = (_jsxs(Card, { className: cn('group bg-card hover:bg-muted relative flex h-full w-full cursor-pointer flex-col overflow-hidden border-0 pt-3 pb-2 shadow-sm transition-colors duration-(--duration-colour)', className), children: [_jsxs(CardHeader, { className: "flex flex-col items-center pt-6 pb-3 text-center", children: [_jsx("div", { className: "mb-3", children: logoPath ? (_jsxs("div", { className: "flex h-16 w-16 items-center justify-center", children: [_jsx("img", { src: logoPath, alt: `${displayBrandName} logo`, width: 64, height: 64, className: "max-h-full max-w-full object-contain", onError: (e) => {
|
|
25
25
|
const target = e.target;
|
|
26
26
|
target.style.display = 'none';
|
|
27
27
|
if (target.nextSibling) {
|
|
28
28
|
target.nextSibling.style.display = 'flex';
|
|
29
29
|
}
|
|
30
|
-
} }), _jsx("div", { className: "bg-border ring-border font-heading hidden h-full w-full items-center justify-center rounded-lg text-2xl
|
|
30
|
+
} }), _jsx("div", { className: "bg-border ring-border font-heading font-heading-semibold hidden h-full w-full items-center justify-center rounded-lg text-2xl tracking-tight ring-1", children: displayBrandName.charAt(0).toUpperCase() })] })) : (_jsx("div", { className: "bg-border ring-border font-heading font-heading-semibold flex h-16 w-16 items-center justify-center rounded-lg border-2 text-2xl tracking-tight ring-1", children: displayBrandName.charAt(0).toUpperCase() })) }), _jsx(CardTitle, { className: "font-heading font-heading-semibold line-clamp-2 text-xl", children: displayTitle }), _jsx(If, { condition: categories.length > 0, children: _jsxs("div", { className: "mt-2 flex flex-wrap justify-center gap-1", children: [categories.slice(0, 2).map((cat) => (_jsx(CategoryChip, { productColor: productColor, children: cat.name }, cat.id))), _jsx(If, { condition: categories.length > 2, children: _jsxs(CategoryChip, { productColor: productColor, children: ["+", categories.length - 2] }) })] }) })] }), _jsx(CardContent, { className: "flex-1 pb-8 text-center", children: _jsx(If, { condition: displaySummary, children: _jsx(CardDescription, { className: "text-muted-foreground line-clamp-2 text-base leading-relaxed", children: displaySummary }) }) }), _jsx(If, { condition: displayBrandName !== displayTitle, children: _jsx("p", { className: "text-muted-foreground absolute right-3 bottom-3 text-sm", children: displayBrandName }) }), _jsx(If, { condition: !!ctaLink, children: _jsx("div", { className: "text-muted-foreground group-hover:text-foreground absolute bottom-3 left-3 transition-colors", "aria-hidden": "true", children: _jsx(Icon, { name: "arrow-square-out", className: "h-4 w-4" }) }) })] }));
|
|
31
31
|
// External link: opens in new tab
|
|
32
32
|
if (ctaLink) {
|
|
33
33
|
return (_jsx("a", { href: ctaLink, target: "_blank", rel: "noopener noreferrer", className: "block h-full", "aria-label": `${displayTitle} (opens in new tab)`, children: cardContent }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-marketplace-tile.js","sourceRoot":"","sources":["../../src/components/base-marketplace-tile.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAIb,yEAAyE;AACzE,8EAA8E;AAC9E,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AA0CtC,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EACJ,IAAI,EACJ,OAAO,EACP,SAAS,EACT,QAAQ,EACR,UAAU,GAAG,EAAE,EACf,YAAY,EACZ,SAAS,EACT,IAAI,EACJ,OAAO,GACR,GAAG,KAAK,CAAC;IAEV,MAAM,YAAY,GAAG,IAAI,IAAI,iBAAiB,CAAC;IAC/C,MAAM,cAAc,GAAG,OAAO,CAAC;IAC/B,MAAM,gBAAgB,GAAG,SAAS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CACL,eACE,SAAS,EAAE,EAAE,CACX,uKAAuK,EACvK,YAAY,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,cAAc,CAC1D,EACD,KAAK,EACH,YAAY;YACV,CAAC,CAAE,EAAE,iBAAiB,EAAE,YAAY,EAAoB;YACxD,CAAC,CAAC,SAAS,YAGd,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport type { CSSProperties, ReactNode } from 'react';\n\n// `next/link.js`, not `next/link`. `next` ships no `exports` map, so the\n// extensionless subpath only resolves under a bundler — Node's own ESM loader\n// throws ERR_MODULE_NOT_FOUND, and any partner running vitest or plain Node\n// against the published tarball loses this whole module. The `.js` form is not\n// a bypass of Next's resolution: `create-compiler-aliases.js` keys its aliases\n// on the RESOLVED FILE PATH (`<next>/link.js`, with the comment \"Handle fully\n// specified imports like `next/image.js`\"), so an App Router build still gets\n// `next/dist/client/app-dir/link`, exactly as `next/link` would. Next's dist\n// also ends with `Object.assign(exports.default, exports); module.exports =\n// exports.default`, so Node's CJS-default interop and a bundler's `__esModule`\n// interop land on the same component object. Do not \"tidy\" the extension away.\nimport Link from 'next/link.js';\n\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '@ekanos/ui/card';\nimport { Icon } from '@ekanos/ui/icon';\nimport { If } from '@ekanos/ui/if';\nimport { cn } from '@ekanos/ui/utils';\n\nimport type { MarketplaceTileProps } from '../types/integration';\n\n// Type for product category\nexport interface ProductCategory {\n id: string;\n name: string;\n slug: string;\n description?: string;\n}\n\nexport type BaseMarketplaceTileProps = MarketplaceTileProps & {\n /** The display name of the product */\n name: string;\n /** Full description of the product (used for detail pages) */\n description: string;\n /** URL-friendly identifier for the product */\n slug: string;\n /** Short summary text displayed on the tile (1-2 sentences) */\n summary?: string;\n /** Name of the company/brand that provides this product */\n brandName?: string;\n /** Path to the product logo image */\n logoPath?: string;\n /** Text for the call-to-action button */\n ctaText?: string;\n /** External URL for the CTA (opens in new tab when set) */\n ctaLink?: string;\n\n /** Array of categories this product belongs to */\n categories?: ProductCategory[];\n\n /** Hex color from product schema for tile theming */\n productColor?: string;\n /** Additional CSS classes to apply to the tile */\n className?: string;\n\n /** Internal navigation URL for the integration detail page */\n href?: string;\n};\n\nexport function BaseMarketplaceTile(props: BaseMarketplaceTileProps) {\n const {\n name,\n summary,\n brandName,\n logoPath,\n categories = [],\n productColor,\n className,\n href,\n ctaLink,\n } = props;\n\n const displayTitle = name || 'Unknown Product';\n const displaySummary = summary;\n const displayBrandName = brandName || displayTitle;\n\n const cardContent = (\n <Card\n className={cn(\n 'group bg-card relative flex h-full w-full cursor-pointer flex-col overflow-hidden border-0 pt-3 pb-2 shadow-sm transition-all duration-300 hover:shadow-md',\n className,\n )}\n >\n {/* Header: Centered Logo, Title, Categories */}\n <CardHeader className=\"flex flex-col items-center pt-6 pb-3 text-center\">\n {/* Logo */}\n <div className=\"mb-3\">\n {logoPath ? (\n <div className=\"flex h-16 w-16 items-center justify-center\">\n {/* eslint-disable-next-line @next/next/no-img-element */}\n <img\n src={logoPath}\n alt={`${displayBrandName} logo`}\n width={64}\n height={64}\n className=\"max-h-full max-w-full object-contain\"\n onError={(e) => {\n const target = e.target as HTMLImageElement;\n target.style.display = 'none';\n if (target.nextSibling) {\n (target.nextSibling as HTMLElement).style.display = 'flex';\n }\n }}\n />\n <div className=\"bg-border ring-border font-heading hidden h-full w-full items-center justify-center rounded-lg text-2xl font-semibold tracking-tight ring-1\">\n {displayBrandName.charAt(0).toUpperCase()}\n </div>\n </div>\n ) : (\n <div className=\"bg-border ring-border font-heading flex h-16 w-16 items-center justify-center rounded-lg border-2 text-2xl font-semibold tracking-tight ring-1\">\n {displayBrandName.charAt(0).toUpperCase()}\n </div>\n )}\n </div>\n\n {/* Title */}\n <CardTitle className=\"font-heading line-clamp-2 text-xl font-semibold\">\n {displayTitle}\n </CardTitle>\n\n {/* Category Badges - Under Title */}\n <If condition={categories.length > 0}>\n <div className=\"mt-2 flex flex-wrap justify-center gap-1\">\n {categories.slice(0, 2).map((cat) => (\n <CategoryChip key={cat.id} productColor={productColor}>\n {cat.name}\n </CategoryChip>\n ))}\n <If condition={categories.length > 2}>\n <CategoryChip productColor={productColor}>\n +{categories.length - 2}\n </CategoryChip>\n </If>\n </div>\n </If>\n </CardHeader>\n\n {/* Content: Summary */}\n <CardContent className=\"flex-1 pb-8 text-center\">\n <If condition={displaySummary}>\n <CardDescription className=\"text-muted-foreground line-clamp-2 text-base leading-relaxed\">\n {displaySummary}\n </CardDescription>\n </If>\n </CardContent>\n\n {/* Brand Name - Bottom Right */}\n <If condition={displayBrandName !== displayTitle}>\n <p className=\"text-muted-foreground/70 absolute right-3 bottom-3 text-sm\">\n {displayBrandName}\n </p>\n </If>\n\n {/* External Link Indicator */}\n <If condition={!!ctaLink}>\n <div\n className=\"text-muted-foreground group-hover:text-foreground absolute bottom-3 left-3 transition-colors\"\n aria-hidden=\"true\"\n >\n <Icon name=\"fa-arrow-up-right-from-square\" className=\"h-4 w-4\" />\n </div>\n </If>\n </Card>\n );\n\n // External link: opens in new tab\n if (ctaLink) {\n return (\n <a\n href={ctaLink}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"block h-full\"\n aria-label={`${displayTitle} (opens in new tab)`}\n >\n {cardContent}\n </a>\n );\n }\n\n // Internal link: uses Next.js Link\n if (href) {\n return (\n <Link href={href} className=\"block h-full\">\n {cardContent}\n </Link>\n );\n }\n\n // Fallback: render without Link (for backwards compatibility)\n return cardContent;\n}\n\n/**\n * A category chip, tinted with the product's own colour when it has one. The\n * colour is a partner's product colour from the product schema, not a theme\n * token — a data colour, so it is a chip rather than a `Badge` (a Badge owns\n * its colour). The tint is that colour at 40% alpha.\n */\nfunction CategoryChip({\n productColor,\n children,\n}: {\n productColor?: string;\n children: ReactNode;\n}) {\n return (\n <span\n className={cn(\n 'text-secondary-foreground inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap',\n productColor ? 'bg-(--product-color)/40' : 'bg-secondary',\n )}\n style={\n productColor\n ? ({ '--product-color': productColor } as CSSProperties)\n : undefined\n }\n >\n {children}\n </span>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base-marketplace-tile.js","sourceRoot":"","sources":["../../src/components/base-marketplace-tile.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAIb,yEAAyE;AACzE,8EAA8E;AAC9E,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AA0CtC,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EACJ,IAAI,EACJ,OAAO,EACP,SAAS,EACT,QAAQ,EACR,UAAU,GAAG,EAAE,EACf,YAAY,EACZ,SAAS,EACT,IAAI,EACJ,OAAO,GACR,GAAG,KAAK,CAAC;IAEV,MAAM,YAAY,GAAG,IAAI,IAAI,iBAAiB,CAAC;IAC/C,MAAM,cAAc,GAAG,OAAO,CAAC;IAC/B,MAAM,gBAAgB,GAAG,SAAS,IAAI,YAAY,CAAC;IAEnD,MAAM,WAAW,GAAG,CAClB,MAAC,IAAI,IACH,SAAS,EAAE,EAAE,CACX,8KAA8K,EAC9K,SAAS,CACV,aAGD,MAAC,UAAU,IAAC,SAAS,EAAC,kDAAkD,aAEtE,cAAK,SAAS,EAAC,MAAM,YAClB,QAAQ,CA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Gd,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport type { CSSProperties, ReactNode } from 'react';\n\n// `next/link.js`, not `next/link`. `next` ships no `exports` map, so the\n// extensionless subpath only resolves under a bundler — Node's own ESM loader\n// throws ERR_MODULE_NOT_FOUND, and any partner running vitest or plain Node\n// against the published tarball loses this whole module. The `.js` form is not\n// a bypass of Next's resolution: `create-compiler-aliases.js` keys its aliases\n// on the RESOLVED FILE PATH (`<next>/link.js`, with the comment \"Handle fully\n// specified imports like `next/image.js`\"), so an App Router build still gets\n// `next/dist/client/app-dir/link`, exactly as `next/link` would. Next's dist\n// also ends with `Object.assign(exports.default, exports); module.exports =\n// exports.default`, so Node's CJS-default interop and a bundler's `__esModule`\n// interop land on the same component object. Do not \"tidy\" the extension away.\nimport Link from 'next/link.js';\n\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '@ekanos/ui/card';\nimport { Icon } from '@ekanos/ui/icon';\nimport { If } from '@ekanos/ui/if';\nimport { cn } from '@ekanos/ui/utils';\n\nimport type { MarketplaceTileProps } from '../types/integration';\n\n// Type for product category\nexport interface ProductCategory {\n id: string;\n name: string;\n slug: string;\n description?: string;\n}\n\nexport type BaseMarketplaceTileProps = MarketplaceTileProps & {\n /** The display name of the product */\n name: string;\n /** Full description of the product (used for detail pages) */\n description: string;\n /** URL-friendly identifier for the product */\n slug: string;\n /** Short summary text displayed on the tile (1-2 sentences) */\n summary?: string;\n /** Name of the company/brand that provides this product */\n brandName?: string;\n /** Path to the product logo image */\n logoPath?: string;\n /** Text for the call-to-action button */\n ctaText?: string;\n /** External URL for the CTA (opens in new tab when set) */\n ctaLink?: string;\n\n /** Array of categories this product belongs to */\n categories?: ProductCategory[];\n\n /** Hex color from product schema for tile theming */\n productColor?: string;\n /** Additional CSS classes to apply to the tile */\n className?: string;\n\n /** Internal navigation URL for the integration detail page */\n href?: string;\n};\n\nexport function BaseMarketplaceTile(props: BaseMarketplaceTileProps) {\n const {\n name,\n summary,\n brandName,\n logoPath,\n categories = [],\n productColor,\n className,\n href,\n ctaLink,\n } = props;\n\n const displayTitle = name || 'Unknown Product';\n const displaySummary = summary;\n const displayBrandName = brandName || displayTitle;\n\n const cardContent = (\n <Card\n className={cn(\n 'group bg-card hover:bg-muted relative flex h-full w-full cursor-pointer flex-col overflow-hidden border-0 pt-3 pb-2 shadow-sm transition-colors duration-(--duration-colour)',\n className,\n )}\n >\n {/* Header: Centered Logo, Title, Categories */}\n <CardHeader className=\"flex flex-col items-center pt-6 pb-3 text-center\">\n {/* Logo */}\n <div className=\"mb-3\">\n {logoPath ? (\n <div className=\"flex h-16 w-16 items-center justify-center\">\n {/* eslint-disable-next-line @next/next/no-img-element */}\n <img\n src={logoPath}\n alt={`${displayBrandName} logo`}\n width={64}\n height={64}\n className=\"max-h-full max-w-full object-contain\"\n onError={(e) => {\n const target = e.target as HTMLImageElement;\n target.style.display = 'none';\n if (target.nextSibling) {\n (target.nextSibling as HTMLElement).style.display = 'flex';\n }\n }}\n />\n <div className=\"bg-border ring-border font-heading font-heading-semibold hidden h-full w-full items-center justify-center rounded-lg text-2xl tracking-tight ring-1\">\n {displayBrandName.charAt(0).toUpperCase()}\n </div>\n </div>\n ) : (\n <div className=\"bg-border ring-border font-heading font-heading-semibold flex h-16 w-16 items-center justify-center rounded-lg border-2 text-2xl tracking-tight ring-1\">\n {displayBrandName.charAt(0).toUpperCase()}\n </div>\n )}\n </div>\n\n {/* Title */}\n <CardTitle className=\"font-heading font-heading-semibold line-clamp-2 text-xl\">\n {displayTitle}\n </CardTitle>\n\n {/* Category Badges - Under Title */}\n <If condition={categories.length > 0}>\n <div className=\"mt-2 flex flex-wrap justify-center gap-1\">\n {categories.slice(0, 2).map((cat) => (\n <CategoryChip key={cat.id} productColor={productColor}>\n {cat.name}\n </CategoryChip>\n ))}\n <If condition={categories.length > 2}>\n <CategoryChip productColor={productColor}>\n +{categories.length - 2}\n </CategoryChip>\n </If>\n </div>\n </If>\n </CardHeader>\n\n {/* Content: Summary */}\n <CardContent className=\"flex-1 pb-8 text-center\">\n <If condition={displaySummary}>\n <CardDescription className=\"text-muted-foreground line-clamp-2 text-base leading-relaxed\">\n {displaySummary}\n </CardDescription>\n </If>\n </CardContent>\n\n {/* Brand Name - Bottom Right */}\n <If condition={displayBrandName !== displayTitle}>\n <p className=\"text-muted-foreground absolute right-3 bottom-3 text-sm\">\n {displayBrandName}\n </p>\n </If>\n\n {/* External Link Indicator */}\n <If condition={!!ctaLink}>\n <div\n className=\"text-muted-foreground group-hover:text-foreground absolute bottom-3 left-3 transition-colors\"\n aria-hidden=\"true\"\n >\n <Icon name=\"arrow-square-out\" className=\"h-4 w-4\" />\n </div>\n </If>\n </Card>\n );\n\n // External link: opens in new tab\n if (ctaLink) {\n return (\n <a\n href={ctaLink}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"block h-full\"\n aria-label={`${displayTitle} (opens in new tab)`}\n >\n {cardContent}\n </a>\n );\n }\n\n // Internal link: uses Next.js Link\n if (href) {\n return (\n <Link href={href} className=\"block h-full\">\n {cardContent}\n </Link>\n );\n }\n\n // Fallback: render without Link (for backwards compatibility)\n return cardContent;\n}\n\n/**\n * A category chip, tinted with the product's own colour when it has one. The\n * colour is a partner's product colour from the product schema, not a theme\n * token — a data colour, so it is a chip rather than a `Badge` (a Badge owns\n * its colour). The tint is that colour at 40% alpha.\n */\nfunction CategoryChip({\n productColor,\n children,\n}: {\n productColor?: string;\n children: ReactNode;\n}) {\n return (\n <span\n className={cn(\n 'text-secondary-foreground inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap',\n productColor ? 'bg-(--product-color)/40' : 'bg-secondary',\n )}\n style={\n productColor\n ? ({ '--product-color': productColor } as CSSProperties)\n : undefined\n }\n >\n {children}\n </span>\n );\n}\n"]}
|
|
@@ -33,6 +33,7 @@ export type { WidgetPreviewProviderProps } from './widgets/widget-preview-provid
|
|
|
33
33
|
export { AiPromptChip } from './widgets/ai-prompt-chip.js';
|
|
34
34
|
export { AskIcon } from './widgets/ask-icon.js';
|
|
35
35
|
export { WidgetAskBar } from './widgets/widget-ask-bar.js';
|
|
36
|
+
export { WidgetAskPresentationProvider, type WidgetAskPresentation, } from './widgets/widget-ask-presentation.js';
|
|
36
37
|
export { WidgetDataLoading, type WidgetEmptyStateProps, WidgetInactiveState, type WidgetInactiveReason, type WidgetInactiveStateProps, type WidgetSkeletonVariant, type WidgetStateAction, } from './widgets/widget-state-components.js';
|
|
37
38
|
export { ActivationForm, BaseActivationForm } from './base-activation-form.js';
|
|
38
39
|
export type { ActivationFormComponentProps, BaseActivationFormProps, } from './base-activation-form.js';
|
package/dist/components/index.js
CHANGED
|
@@ -32,6 +32,7 @@ export { WidgetPreviewProvider } from './widgets/widget-preview-provider.js';
|
|
|
32
32
|
export { AiPromptChip } from './widgets/ai-prompt-chip.js';
|
|
33
33
|
export { AskIcon } from './widgets/ask-icon.js';
|
|
34
34
|
export { WidgetAskBar } from './widgets/widget-ask-bar.js';
|
|
35
|
+
export { WidgetAskPresentationProvider, } from './widgets/widget-ask-presentation.js';
|
|
35
36
|
export { WidgetDataLoading, WidgetInactiveState, } from './widgets/widget-state-components.js';
|
|
36
37
|
export { ActivationForm, BaseActivationForm } from './base-activation-form.js';
|
|
37
38
|
export { ActivationDialog, ActivationInline, BaseActivationDialog, } from './base-activation-dialog.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACL,MAAM,EACN,gBAAgB,GAGjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,gBAAgB,EAChB,iBAAiB,GAIlB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,aAAa,GASd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAG1E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EACL,iBAAiB,EAEjB,mBAAmB,GAKpB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAK5E,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["/**\n * @ekanos/sdk/components — client-side building blocks.\n *\n * Import from client components only. `Widget` is the compound API every\n * dashboard widget renders through; the activation forms are the two\n * sanctioned activation UX bases (credential-style and OAuth-style), and\n * `BaseMarketplaceTile` is the matching base for the marketplace tile.\n *\n * The SDK OWNS these implementations — the pre-inversion re-exports through\n * `@kit/integrations-core/components/*` are gone; core now re-exports FROM\n * here for first-party code (one source of truth, two consumption paths —\n * one source of truth with two consumption paths. UI primitives come from\n * `@ekanos/ui`\n * (the published slice of the host design system), never `@kit/ui`.\n *\n * Server seam: nothing here imports a server module. `OAuthActivationForm`\n * performs activation through the host-injected actions seam\n * (`IntegrationActivationProvider`, @ekanos/sdk/hooks) — a server-action\n * REFERENCE bound by the host, not server code shipped to the browser.\n *\n * `WidgetContext` is the single context identity both sides share: the\n * host's `DashboardWidgetProvider` (host chrome — persistence callbacks,\n * config hierarchy) provides it, the SDK's `Widget.*` reads it.\n *\n * Surface discipline: additions require an entry in\n * api-report.md, regenerated by `pnpm --filter @ekanos/sdk api-report`.\n */\n\nexport {\n Widget,\n useWidgetVerdict,\n type WidgetDataStatus,\n type WidgetHeaderTrailing,\n} from './widgets/widget';\nexport {\n widgetQueryState,\n widgetQueryStatus,\n type WidgetConnectionGate,\n type WidgetQuery,\n type WidgetQueryState,\n} from './widgets/widget-query-state';\nexport {\n WidgetContext,\n type WidgetActions,\n type WidgetContextValue,\n type WidgetData,\n type WidgetHealth,\n type WidgetMeta,\n type WidgetRenderState,\n type WidgetSource,\n type WidgetState,\n} from './widgets/widget-context';\nexport { WidgetPreviewProvider } from './widgets/widget-preview-provider';\n\nexport type { WidgetPreviewProviderProps } from './widgets/widget-preview-provider';\nexport { AiPromptChip } from './widgets/ai-prompt-chip';\nexport { AskIcon } from './widgets/ask-icon';\nexport { WidgetAskBar } from './widgets/widget-ask-bar';\nexport {\n WidgetDataLoading,\n type WidgetEmptyStateProps,\n WidgetInactiveState,\n type WidgetInactiveReason,\n type WidgetInactiveStateProps,\n type WidgetSkeletonVariant,\n type WidgetStateAction,\n} from './widgets/widget-state-components';\n\nexport { ActivationForm, BaseActivationForm } from './base-activation-form';\nexport type {\n ActivationFormComponentProps,\n BaseActivationFormProps,\n} from './base-activation-form';\nexport {\n ActivationDialog,\n ActivationInline,\n BaseActivationDialog,\n} from './base-activation-dialog';\n\nexport { BaseMarketplaceTile } from './base-marketplace-tile';\nexport type { BaseMarketplaceTileProps } from './base-marketplace-tile';\n\nexport { OAuthActivationForm } from './oauth-activation-form';\nexport type { OAuthActivationFormConfig } from './oauth-activation-form';\n\nexport { FIRST_CONNECT_PARAM, currentReturnPath } from './current-return-path';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACL,MAAM,EACN,gBAAgB,GAGjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,gBAAgB,EAChB,iBAAiB,GAIlB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,aAAa,GASd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAG1E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EACL,6BAA6B,GAE9B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,iBAAiB,EAEjB,mBAAmB,GAKpB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAK5E,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["/**\n * @ekanos/sdk/components — client-side building blocks.\n *\n * Import from client components only. `Widget` is the compound API every\n * dashboard widget renders through; the activation forms are the two\n * sanctioned activation UX bases (credential-style and OAuth-style), and\n * `BaseMarketplaceTile` is the matching base for the marketplace tile.\n *\n * The SDK OWNS these implementations — the pre-inversion re-exports through\n * `@kit/integrations-core/components/*` are gone; core now re-exports FROM\n * here for first-party code (one source of truth, two consumption paths —\n * one source of truth with two consumption paths. UI primitives come from\n * `@ekanos/ui`\n * (the published slice of the host design system), never `@kit/ui`.\n *\n * Server seam: nothing here imports a server module. `OAuthActivationForm`\n * performs activation through the host-injected actions seam\n * (`IntegrationActivationProvider`, @ekanos/sdk/hooks) — a server-action\n * REFERENCE bound by the host, not server code shipped to the browser.\n *\n * `WidgetContext` is the single context identity both sides share: the\n * host's `DashboardWidgetProvider` (host chrome — persistence callbacks,\n * config hierarchy) provides it, the SDK's `Widget.*` reads it.\n *\n * Surface discipline: additions require an entry in\n * api-report.md, regenerated by `pnpm --filter @ekanos/sdk api-report`.\n */\n\nexport {\n Widget,\n useWidgetVerdict,\n type WidgetDataStatus,\n type WidgetHeaderTrailing,\n} from './widgets/widget';\nexport {\n widgetQueryState,\n widgetQueryStatus,\n type WidgetConnectionGate,\n type WidgetQuery,\n type WidgetQueryState,\n} from './widgets/widget-query-state';\nexport {\n WidgetContext,\n type WidgetActions,\n type WidgetContextValue,\n type WidgetData,\n type WidgetHealth,\n type WidgetMeta,\n type WidgetRenderState,\n type WidgetSource,\n type WidgetState,\n} from './widgets/widget-context';\nexport { WidgetPreviewProvider } from './widgets/widget-preview-provider';\n\nexport type { WidgetPreviewProviderProps } from './widgets/widget-preview-provider';\nexport { AiPromptChip } from './widgets/ai-prompt-chip';\nexport { AskIcon } from './widgets/ask-icon';\nexport { WidgetAskBar } from './widgets/widget-ask-bar';\nexport {\n WidgetAskPresentationProvider,\n type WidgetAskPresentation,\n} from './widgets/widget-ask-presentation';\nexport {\n WidgetDataLoading,\n type WidgetEmptyStateProps,\n WidgetInactiveState,\n type WidgetInactiveReason,\n type WidgetInactiveStateProps,\n type WidgetSkeletonVariant,\n type WidgetStateAction,\n} from './widgets/widget-state-components';\n\nexport { ActivationForm, BaseActivationForm } from './base-activation-form';\nexport type {\n ActivationFormComponentProps,\n BaseActivationFormProps,\n} from './base-activation-form';\nexport {\n ActivationDialog,\n ActivationInline,\n BaseActivationDialog,\n} from './base-activation-dialog';\n\nexport { BaseMarketplaceTile } from './base-marketplace-tile';\nexport type { BaseMarketplaceTileProps } from './base-marketplace-tile';\n\nexport { OAuthActivationForm } from './oauth-activation-form';\nexport type { OAuthActivationFormConfig } from './oauth-activation-form';\n\nexport { FIRST_CONNECT_PARAM, currentReturnPath } from './current-return-path';\n"]}
|
|
@@ -16,6 +16,14 @@ export interface OAuthActivationFormConfig {
|
|
|
16
16
|
successTitle?: string;
|
|
17
17
|
/** Defaults to `/api/integrations/<slug>/connect`. */
|
|
18
18
|
connectPath?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Which declared OAuth connection this form connects: an
|
|
21
|
+
* `oauthConnections` key (e.g. `agent`). Sent to the connect route as
|
|
22
|
+
* `?connection=<id>`; absent or `default` is the main `oauth`. Pair it
|
|
23
|
+
* with `createPartnerConnectionCheck(slug, { connection })` so the status
|
|
24
|
+
* read asks about the same connection.
|
|
25
|
+
*/
|
|
26
|
+
connection?: string;
|
|
19
27
|
/** @deprecated No banner renders on return; the host toasts instead. */
|
|
20
28
|
connectedBanner?: string;
|
|
21
29
|
/** Defaults to `Continue with <displayName>`. */
|
|
@@ -19,11 +19,14 @@ import { currentReturnPath } from './current-return-path.js';
|
|
|
19
19
|
export function OAuthActivationForm(props) {
|
|
20
20
|
var _a;
|
|
21
21
|
const { config, checkConnection, errorParam, children, accountId, sourceId, teamAccountId, onSuccess, onCancel, isLoading: externalLoading = false, reconnect = false, } = props;
|
|
22
|
-
const { slug, displayName, connectPath = `/api/integrations/${slug}/connect`, connectButtonText, activateButtonText, externalIdPrefix = slug, autoActivateOnConnect = true, } = config;
|
|
22
|
+
const { slug, displayName, connectPath = `/api/integrations/${slug}/connect`, connectButtonText, activateButtonText, externalIdPrefix = slug, autoActivateOnConnect = true, connection, } = config;
|
|
23
|
+
const namedConnection = connection && connection !== 'default' ? connection : undefined;
|
|
23
24
|
const [error, setError] = useState(null);
|
|
24
25
|
const [activated, setActivated] = useState(false);
|
|
25
26
|
const { data: connectionStatus, oauthJustCompleted, oauthError, isLoading: isCheckingConnection, } = useOAuthConnectionStatus(accountId, {
|
|
26
|
-
connectionKey:
|
|
27
|
+
connectionKey: namedConnection
|
|
28
|
+
? `${slug}-${namedConnection}-connection`
|
|
29
|
+
: `${slug}-connection`,
|
|
27
30
|
checkConnection,
|
|
28
31
|
errorParam,
|
|
29
32
|
});
|
|
@@ -45,8 +48,11 @@ export function OAuthActivationForm(props) {
|
|
|
45
48
|
if (teamAccountId) {
|
|
46
49
|
params.set('teamAccountId', teamAccountId);
|
|
47
50
|
}
|
|
51
|
+
if (namedConnection) {
|
|
52
|
+
params.set('connection', namedConnection);
|
|
53
|
+
}
|
|
48
54
|
window.location.href = `${connectPath}?${params.toString()}`;
|
|
49
|
-
}, [accountId, teamAccountId, connectPath, reconnect, slug]);
|
|
55
|
+
}, [accountId, teamAccountId, connectPath, reconnect, slug, namedConnection]);
|
|
50
56
|
// Reports success exactly once, straight to the host — no in-form panel,
|
|
51
57
|
// no second call from a "Continue" button.
|
|
52
58
|
const handleActivate = useCallback(async () => {
|
|
@@ -128,6 +134,6 @@ export function OAuthActivationForm(props) {
|
|
|
128
134
|
: isConnected
|
|
129
135
|
? (activateButtonText !== null && activateButtonText !== void 0 ? activateButtonText : (_jsx(Trans, { i18nKey: "common:integrationConnect.connect", defaults: "Connect" })))
|
|
130
136
|
: (connectButtonText !== null && connectButtonText !== void 0 ? connectButtonText : (_jsx(Trans, { i18nKey: "common:integrationConnect.continueWith", values: { name: displayName }, defaults: `Continue with ${displayName}` })));
|
|
131
|
-
return (_jsx(ActivationForm, { onCancel: onCancel, form: form, onSubmit: handleSubmit, isLoading: externalLoading || activateIntegration.isPending || finishing, error: displayError, submitLabel: buttonText, submitLoadingLabel: isConnected && !signInAgain ? (_jsx(Trans, { i18nKey: "common:integrationConnect.finishing", defaults: "Finishing setup\u2026" })) : (_jsx(Trans, { i18nKey: "common:integrationConnect.redirecting", defaults: "Opening sign-in\u2026" })), submitDisabled: isCheckingConnection, footnote: signInAgain ? (_jsx(Trans, { i18nKey: "common:integrationConnect.reconnectFootnote", values: { name: displayName }, defaults: `You'll sign in on ${displayName}'s site again and come straight back here.` })) : isConnected ? (_jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(Icon, { name: "
|
|
137
|
+
return (_jsx(ActivationForm, { onCancel: onCancel, form: form, onSubmit: handleSubmit, isLoading: externalLoading || activateIntegration.isPending || finishing, error: displayError, submitLabel: buttonText, submitLoadingLabel: isConnected && !signInAgain ? (_jsx(Trans, { i18nKey: "common:integrationConnect.finishing", defaults: "Finishing setup\u2026" })) : (_jsx(Trans, { i18nKey: "common:integrationConnect.redirecting", defaults: "Opening sign-in\u2026" })), submitDisabled: isCheckingConnection, footnote: signInAgain ? (_jsx(Trans, { i18nKey: "common:integrationConnect.reconnectFootnote", values: { name: displayName }, defaults: `You'll sign in on ${displayName}'s site again and come straight back here.` })) : isConnected ? (_jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(Icon, { name: "check-circle", className: "text-success h-4 w-4" }), _jsx(Trans, { i18nKey: "common:integrationConnect.signedIn", values: { name: displayName }, defaults: `Signed in to ${displayName}.` })] })) : (_jsx(Trans, { i18nKey: "common:integrationConnect.oauthFootnote", values: { name: displayName }, defaults: `You'll sign in on ${displayName}'s site and come straight back here.` })), children: isConnected && children ? children : null }));
|
|
132
138
|
}
|
|
133
139
|
//# sourceMappingURL=oauth-activation-form.js.map
|