@vivoa/plugin-sdk 0.6.6 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{host-api-C1VylW5l.d.mts → host-api-BbIT_sLc.d.mts} +171 -18
- package/dist/{host-api-C1VylW5l.d.ts → host-api-BbIT_sLc.d.ts} +171 -18
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +127 -14
- package/dist/index.mjs +134 -12
- package/dist/testing/index.d.mts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/package.json +10 -9
|
@@ -31,6 +31,8 @@ interface PluginConfigField {
|
|
|
31
31
|
internal?: boolean;
|
|
32
32
|
/** Visual group header rendered above the first field of each new group. */
|
|
33
33
|
group?: string;
|
|
34
|
+
/** External URL shown as "¿Cómo obtenerlo?" link below the field label. */
|
|
35
|
+
helpUrl?: string;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
declare enum FieldVariant {
|
|
@@ -116,6 +118,8 @@ interface GroupBlock extends BlockBase {
|
|
|
116
118
|
type: BlockType.Group;
|
|
117
119
|
title: string;
|
|
118
120
|
description?: string;
|
|
121
|
+
/** External URL shown as "¿Cómo obtenerlo?" link in the annotated aside. */
|
|
122
|
+
helpUrl?: string;
|
|
119
123
|
/** configSchema keys included in this group. */
|
|
120
124
|
fields: string[];
|
|
121
125
|
collapsible?: boolean;
|
|
@@ -128,7 +132,7 @@ interface ToggleBlock extends BlockBase {
|
|
|
128
132
|
label: string;
|
|
129
133
|
description?: string;
|
|
130
134
|
}
|
|
131
|
-
interface ActionBlock extends BlockBase {
|
|
135
|
+
interface ActionBlock$1 extends BlockBase {
|
|
132
136
|
type: BlockType.Action;
|
|
133
137
|
/** Matches a manifest.actions[id]. */
|
|
134
138
|
id: string;
|
|
@@ -148,7 +152,7 @@ interface MarkdownBlock extends BlockBase {
|
|
|
148
152
|
type: BlockType.Markdown;
|
|
149
153
|
content: string;
|
|
150
154
|
}
|
|
151
|
-
interface DividerBlock extends BlockBase {
|
|
155
|
+
interface DividerBlock$1 extends BlockBase {
|
|
152
156
|
type: BlockType.Divider;
|
|
153
157
|
}
|
|
154
158
|
type ConditionalEquals = string | number | boolean | null;
|
|
@@ -168,14 +172,14 @@ interface RepeaterBlock extends BlockBase {
|
|
|
168
172
|
blocks: Block[];
|
|
169
173
|
}
|
|
170
174
|
/** Titled container. Recurses into `blocks`. */
|
|
171
|
-
interface CardBlock extends BlockBase {
|
|
175
|
+
interface CardBlock$1 extends BlockBase {
|
|
172
176
|
type: BlockType.Card;
|
|
173
177
|
title?: string;
|
|
174
178
|
description?: string;
|
|
175
179
|
blocks: Block[];
|
|
176
180
|
}
|
|
177
181
|
/** Prominent variant-styled message. Leaf. */
|
|
178
|
-
interface BannerBlock extends BlockBase {
|
|
182
|
+
interface BannerBlock$1 extends BlockBase {
|
|
179
183
|
type: BlockType.Banner;
|
|
180
184
|
variant: MessageVariant;
|
|
181
185
|
title?: string;
|
|
@@ -185,7 +189,7 @@ interface BannerBlock extends BlockBase {
|
|
|
185
189
|
* Read-only value with a copy affordance. EXACTLY ONE source of the value:
|
|
186
190
|
* a literal, a host `computedValues` key, or a read-only echo of a config key.
|
|
187
191
|
*/
|
|
188
|
-
interface CopyFieldBlock extends BlockBase {
|
|
192
|
+
interface CopyFieldBlock$1 extends BlockBase {
|
|
189
193
|
type: BlockType.CopyField;
|
|
190
194
|
label: string;
|
|
191
195
|
/** Literal value. */
|
|
@@ -221,17 +225,17 @@ interface AccordionBlock extends BlockBase {
|
|
|
221
225
|
type: BlockType.Accordion;
|
|
222
226
|
sections: AccordionSection[];
|
|
223
227
|
}
|
|
224
|
-
interface KeyValueRow {
|
|
228
|
+
interface KeyValueRow$1 {
|
|
225
229
|
label: string;
|
|
226
230
|
value?: string;
|
|
227
231
|
computedKey?: string;
|
|
228
232
|
}
|
|
229
233
|
/** Read-only label/value list. Leaf. */
|
|
230
|
-
interface KeyValueBlock extends BlockBase {
|
|
234
|
+
interface KeyValueBlock$1 extends BlockBase {
|
|
231
235
|
type: BlockType.KeyValue;
|
|
232
|
-
rows: KeyValueRow[];
|
|
236
|
+
rows: KeyValueRow$1[];
|
|
233
237
|
}
|
|
234
|
-
type Block = FieldBlock | GroupBlock | ToggleBlock | ActionBlock | CalloutBlock | MarkdownBlock | DividerBlock | ConditionalBlock | RepeaterBlock | CardBlock | BannerBlock | CopyFieldBlock | InlineRowBlock | TabsBlock | AccordionBlock | KeyValueBlock;
|
|
238
|
+
type Block = FieldBlock | GroupBlock | ToggleBlock | ActionBlock$1 | CalloutBlock | MarkdownBlock | DividerBlock$1 | ConditionalBlock | RepeaterBlock | CardBlock$1 | BannerBlock$1 | CopyFieldBlock$1 | InlineRowBlock | TabsBlock | AccordionBlock | KeyValueBlock$1;
|
|
235
239
|
interface StepStatusFromFields {
|
|
236
240
|
from: StepStatusFrom.Fields;
|
|
237
241
|
}
|
|
@@ -310,7 +314,6 @@ interface PluginManifest {
|
|
|
310
314
|
displayName?: string;
|
|
311
315
|
version: string;
|
|
312
316
|
entry: string;
|
|
313
|
-
type?: PluginType;
|
|
314
317
|
icon?: string;
|
|
315
318
|
description?: string;
|
|
316
319
|
dependencies?: string[];
|
|
@@ -336,13 +339,6 @@ interface PluginManifest {
|
|
|
336
339
|
setup?: SetupLayout;
|
|
337
340
|
}
|
|
338
341
|
|
|
339
|
-
declare enum PluginType {
|
|
340
|
-
Payment = "payment",
|
|
341
|
-
Shipping = "shipping",
|
|
342
|
-
Analytics = "analytics",
|
|
343
|
-
Invoicing = "invoicing",
|
|
344
|
-
Generic = "generic"
|
|
345
|
-
}
|
|
346
342
|
/** Visual tone for messages, callouts and action results. */
|
|
347
343
|
declare enum MessageVariant {
|
|
348
344
|
Info = "info",
|
|
@@ -544,6 +540,40 @@ interface WebhookSignatureResult {
|
|
|
544
540
|
isValid: boolean;
|
|
545
541
|
error?: string;
|
|
546
542
|
}
|
|
543
|
+
/**
|
|
544
|
+
* "Connect" handshake (authorization code + PKCE) a gateway can offer so a
|
|
545
|
+
* merchant links their account with one click instead of pasting credentials.
|
|
546
|
+
* The HOST owns state, code_verifier and the callback route; the plugin only
|
|
547
|
+
* knows the gateway's URLs and wire format. STATELESS like every other verb.
|
|
548
|
+
*/
|
|
549
|
+
interface PaymentConnectParams {
|
|
550
|
+
/** Opaque anti-CSRF value; echoed back on the callback. */
|
|
551
|
+
state: string;
|
|
552
|
+
/** base64url(SHA-256(code_verifier)) — S256. */
|
|
553
|
+
codeChallenge: string;
|
|
554
|
+
/** Host callback the gateway redirects the merchant to (`?code&state`). */
|
|
555
|
+
redirectUri: string;
|
|
556
|
+
/** Host webhook endpoint for this gateway, to register on the gateway side. */
|
|
557
|
+
webhookUrl: string;
|
|
558
|
+
/** Store origin (https://host) — the only origin the gateway may wire to. */
|
|
559
|
+
origin: string;
|
|
560
|
+
/** Store display name, shown on the gateway's consent screen. */
|
|
561
|
+
storeName: string;
|
|
562
|
+
}
|
|
563
|
+
interface PaymentConnectExchange {
|
|
564
|
+
code: string;
|
|
565
|
+
codeVerifier: string;
|
|
566
|
+
redirectUri: string;
|
|
567
|
+
}
|
|
568
|
+
interface PaymentConnect {
|
|
569
|
+
/** Where to send the merchant to log in and approve the store. */
|
|
570
|
+
authorizeUrl(params: PaymentConnectParams, ctx: DispatchContext): string;
|
|
571
|
+
/**
|
|
572
|
+
* Redeem the authorization code. Returns a CONFIG PATCH (credentials etc.)
|
|
573
|
+
* the host persists exactly like an admin save.
|
|
574
|
+
*/
|
|
575
|
+
exchange(params: PaymentConnectExchange, ctx: DispatchContext): Promise<Record<string, unknown>>;
|
|
576
|
+
}
|
|
547
577
|
interface IPaymentPlugin extends IPlugin {
|
|
548
578
|
readonly gatewayCode: PaymentGatewayCode;
|
|
549
579
|
readonly staticConfig: GatewayStaticConfig;
|
|
@@ -568,6 +598,8 @@ interface IPaymentPlugin extends IPlugin {
|
|
|
568
598
|
* call via `ctx.config` (INV-4); no card data is ever passed here (INV-1).
|
|
569
599
|
*/
|
|
570
600
|
createPaymentSession?(payload: PaymentSessionPayload, ctx: DispatchContext): Promise<PaymentSessionResult>;
|
|
601
|
+
/** OPTIONAL one-click account linking (see {@link PaymentConnect}). */
|
|
602
|
+
readonly connect?: PaymentConnect;
|
|
571
603
|
}
|
|
572
604
|
|
|
573
605
|
declare enum ShippingFeature {
|
|
@@ -608,6 +640,8 @@ interface ShippingStaticConfig {
|
|
|
608
640
|
displayName: string;
|
|
609
641
|
description: string;
|
|
610
642
|
iconUrl?: string;
|
|
643
|
+
authorName?: string;
|
|
644
|
+
authorUrl?: string;
|
|
611
645
|
supportedCountries: string[];
|
|
612
646
|
supportedFeatures: ShippingFeature[];
|
|
613
647
|
configSchema: PluginConfigField[];
|
|
@@ -750,6 +784,8 @@ interface SuppliersStaticConfig {
|
|
|
750
784
|
displayName: string;
|
|
751
785
|
description: string;
|
|
752
786
|
iconUrl?: string;
|
|
787
|
+
authorName?: string;
|
|
788
|
+
authorUrl?: string;
|
|
753
789
|
supportedCountries: string[];
|
|
754
790
|
supportedCapabilities: SuppliersFeature[];
|
|
755
791
|
configSchema: PluginConfigField[];
|
|
@@ -1054,6 +1090,8 @@ interface AnalyticsStaticConfig {
|
|
|
1054
1090
|
displayName: string;
|
|
1055
1091
|
description: string;
|
|
1056
1092
|
iconUrl?: string;
|
|
1093
|
+
authorName?: string;
|
|
1094
|
+
authorUrl?: string;
|
|
1057
1095
|
supportedCapabilities: AnalyticsFeature[];
|
|
1058
1096
|
configSchema: PluginConfigField[];
|
|
1059
1097
|
}
|
|
@@ -1257,6 +1295,8 @@ interface InvoicingStaticConfig {
|
|
|
1257
1295
|
displayName: string;
|
|
1258
1296
|
description: string;
|
|
1259
1297
|
iconUrl?: string;
|
|
1298
|
+
authorName?: string;
|
|
1299
|
+
authorUrl?: string;
|
|
1260
1300
|
supportedCountries: string[];
|
|
1261
1301
|
supportedFeatures: InvoicingFeature[];
|
|
1262
1302
|
supportedDocumentTypes: InvoiceDocumentType[];
|
|
@@ -1290,6 +1330,112 @@ interface IInvoicingPlugin extends IPlugin {
|
|
|
1290
1330
|
isConfigured?(ctx: DispatchContext): boolean;
|
|
1291
1331
|
}
|
|
1292
1332
|
|
|
1333
|
+
declare enum ContentBlockType {
|
|
1334
|
+
Text = "text",
|
|
1335
|
+
Banner = "banner",
|
|
1336
|
+
Badge = "badge",
|
|
1337
|
+
KeyValue = "keyValue",
|
|
1338
|
+
CopyField = "copyField",
|
|
1339
|
+
Link = "link",
|
|
1340
|
+
Divider = "divider",
|
|
1341
|
+
Action = "action",
|
|
1342
|
+
Card = "card"
|
|
1343
|
+
}
|
|
1344
|
+
declare enum ContentActionVariant {
|
|
1345
|
+
Primary = "primary",
|
|
1346
|
+
Secondary = "secondary",
|
|
1347
|
+
Danger = "danger"
|
|
1348
|
+
}
|
|
1349
|
+
/** Markdown/plain paragraph. Literal `content` or host-resolved `computedKey`. */
|
|
1350
|
+
interface TextBlock {
|
|
1351
|
+
type: ContentBlockType.Text;
|
|
1352
|
+
content?: string;
|
|
1353
|
+
computedKey?: string;
|
|
1354
|
+
}
|
|
1355
|
+
/** Prominent variant-styled message. */
|
|
1356
|
+
interface BannerBlock {
|
|
1357
|
+
type: ContentBlockType.Banner;
|
|
1358
|
+
variant: MessageVariant;
|
|
1359
|
+
title?: string;
|
|
1360
|
+
text: string;
|
|
1361
|
+
}
|
|
1362
|
+
/** Inline status pill. Literal `text` or host-resolved `computedKey`. */
|
|
1363
|
+
interface BadgeBlock {
|
|
1364
|
+
type: ContentBlockType.Badge;
|
|
1365
|
+
variant: MessageVariant;
|
|
1366
|
+
text?: string;
|
|
1367
|
+
computedKey?: string;
|
|
1368
|
+
}
|
|
1369
|
+
interface KeyValueRow {
|
|
1370
|
+
label: string;
|
|
1371
|
+
value?: string;
|
|
1372
|
+
computedKey?: string;
|
|
1373
|
+
}
|
|
1374
|
+
/** Read-only label/value list. */
|
|
1375
|
+
interface KeyValueBlock {
|
|
1376
|
+
type: ContentBlockType.KeyValue;
|
|
1377
|
+
rows: KeyValueRow[];
|
|
1378
|
+
}
|
|
1379
|
+
/** Read-only value with a copy affordance. Literal or host-resolved. */
|
|
1380
|
+
interface CopyFieldBlock {
|
|
1381
|
+
type: ContentBlockType.CopyField;
|
|
1382
|
+
label: string;
|
|
1383
|
+
value?: string;
|
|
1384
|
+
computedKey?: string;
|
|
1385
|
+
}
|
|
1386
|
+
/** Hyperlink (e.g. "Descargar PDF"). `href` literal or host-resolved. */
|
|
1387
|
+
interface LinkBlock {
|
|
1388
|
+
type: ContentBlockType.Link;
|
|
1389
|
+
label: string;
|
|
1390
|
+
href?: string;
|
|
1391
|
+
computedKey?: string;
|
|
1392
|
+
external?: boolean;
|
|
1393
|
+
}
|
|
1394
|
+
interface DividerBlock {
|
|
1395
|
+
type: ContentBlockType.Divider;
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Triggers a plugin action. `id` matches a `manifest.setup.actions[id]`; the
|
|
1399
|
+
* host dispatches it through the SAME runtime path as a setup-screen action
|
|
1400
|
+
* (invokeAction), so a contribution reuses the plugin's existing action surface.
|
|
1401
|
+
*/
|
|
1402
|
+
interface ActionBlock {
|
|
1403
|
+
type: ContentBlockType.Action;
|
|
1404
|
+
id: string;
|
|
1405
|
+
label: string;
|
|
1406
|
+
variant?: ContentActionVariant;
|
|
1407
|
+
}
|
|
1408
|
+
/** Titled container. Recurses into child `blocks`. */
|
|
1409
|
+
interface CardBlock {
|
|
1410
|
+
type: ContentBlockType.Card;
|
|
1411
|
+
title?: string;
|
|
1412
|
+
description?: string;
|
|
1413
|
+
blocks: ContentBlock[];
|
|
1414
|
+
}
|
|
1415
|
+
type ContentBlock = TextBlock | BannerBlock | BadgeBlock | KeyValueBlock | CopyFieldBlock | LinkBlock | DividerBlock | ActionBlock | CardBlock;
|
|
1416
|
+
/**
|
|
1417
|
+
* One block tree the plugin injects into a host slot. `slot` names a host-owned
|
|
1418
|
+
* target (e.g. "admin:order.detail.sidebar", "storefront:product.below"); the
|
|
1419
|
+
* set of valid slots is owned by the host, not the SDK. `order` breaks ties when
|
|
1420
|
+
* several plugins target the same slot (ascending; absent sorts last).
|
|
1421
|
+
*/
|
|
1422
|
+
interface UiContribution {
|
|
1423
|
+
slot: string;
|
|
1424
|
+
blocks: ContentBlock[];
|
|
1425
|
+
order?: number;
|
|
1426
|
+
}
|
|
1427
|
+
/** Impl behind a `ui` capability — the static set a plugin declares up front. */
|
|
1428
|
+
interface IUiPlugin {
|
|
1429
|
+
readonly contributions: UiContribution[];
|
|
1430
|
+
}
|
|
1431
|
+
interface UiContributionsValidation {
|
|
1432
|
+
success: boolean;
|
|
1433
|
+
data?: UiContribution[];
|
|
1434
|
+
errors?: string[];
|
|
1435
|
+
}
|
|
1436
|
+
/** Validates a plugin's declared contributions, including recursive cards. */
|
|
1437
|
+
declare function validateUiContributions(input: unknown): UiContributionsValidation;
|
|
1438
|
+
|
|
1293
1439
|
/** A named unit of behaviour a plugin exposes to the host registry. */
|
|
1294
1440
|
interface Capability<T = unknown> {
|
|
1295
1441
|
kind: string;
|
|
@@ -1306,6 +1452,12 @@ declare const CapabilityKind: {
|
|
|
1306
1452
|
readonly Suppliers: "suppliers";
|
|
1307
1453
|
readonly Analytics: "analytics";
|
|
1308
1454
|
readonly Invoicing: "invoicing";
|
|
1455
|
+
/**
|
|
1456
|
+
* Cross-cutting DISPLAY capability: a plugin of ANY surface may ALSO expose
|
|
1457
|
+
* `ui` to contribute declarative blocks into host slots. Not a catalog
|
|
1458
|
+
* "surface" — the host's AppSurface derivation excludes it on purpose.
|
|
1459
|
+
*/
|
|
1460
|
+
readonly Ui: "ui";
|
|
1309
1461
|
};
|
|
1310
1462
|
type CapabilityKind = (typeof CapabilityKind)[keyof typeof CapabilityKind];
|
|
1311
1463
|
declare function capability<T>(kind: string, impl: T): Capability<T>;
|
|
@@ -1314,6 +1466,7 @@ declare function shippingCapability(impl: IShippingPlugin): Capability<IShipping
|
|
|
1314
1466
|
declare function suppliersCapability(impl: ISuppliersPlugin): Capability<ISuppliersPlugin>;
|
|
1315
1467
|
declare function analyticsCapability(impl: IAnalyticsPlugin): Capability<IAnalyticsPlugin>;
|
|
1316
1468
|
declare function invoicingCapability(impl: IInvoicingPlugin): Capability<IInvoicingPlugin>;
|
|
1469
|
+
declare function uiCapability(impl: IUiPlugin): Capability<IUiPlugin>;
|
|
1317
1470
|
/**
|
|
1318
1471
|
* A constructed plugin. `capabilities` is the static declaration the host reads
|
|
1319
1472
|
* up front; `onActivate` runs when the host mounts the plugin for a tenant and
|
|
@@ -1413,4 +1566,4 @@ interface HostApi {
|
|
|
1413
1566
|
registerCapability<T = unknown>(cap: Capability<T>): void;
|
|
1414
1567
|
}
|
|
1415
1568
|
|
|
1416
|
-
export { type
|
|
1569
|
+
export { type HttpClient as $, AUTHOR_HANDLE_RE as A, type BannerBlock$1 as B, ConfigScope as C, type ConditionalBlock as D, type ConditionalEquals as E, FieldType as F, type ConditionalWhen as G, type ConfigurablePlugin as H, ContentActionVariant as I, type ContentBlock as J, ContentBlockType as K, type CopyFieldBlock$1 as L, type CreateShipmentParams as M, type DispatchContext as N, type DividerBlock$1 as O, type PluginConfigField as P, type DomainEventHandler as Q, type DomainEventName as R, type SelectOption as S, type EmbedInit as T, type FieldBlock as U, type FieldOption as V, FieldVariant as W, GatewayEnvironment as X, type GatewayStaticConfig as Y, type GroupBlock as Z, type HostApi as _, type AccordionBlock as a, type ShippingQuote as a$, type HttpRequest as a0, type HttpResponse as a1, type IAnalyticsPlugin as a2, type IInvoicingPlugin as a3, type IPaymentPlugin as a4, type IPlugin as a5, type IShippingPlugin as a6, type ISuppliersPlugin as a7, type IUiPlugin as a8, type InlineRowBlock as a9, type PaymentRenderMode as aA, type PaymentResult as aB, type PaymentSessionPayload as aC, type PaymentSessionResult as aD, type PaymentVerifyPayload as aE, type PlaceSupplierOrderInput as aF, type Plugin as aG, type PluginActionContext as aH, type PluginActionResult as aI, type PluginAuthor as aJ, type PluginConfigFieldDependency as aK, type PluginFactory as aL, type PluginManifest as aM, type RepeaterBlock as aN, RepeaterSource as aO, type SecretStore as aP, type SequenceStore as aQ, type SetupAction as aR, type SetupLayout as aS, type SetupLayoutValidation as aT, type SetupStep as aU, type ShipmentAddress as aV, type ShipmentParcel as aW, type ShipmentResult as aX, type ShippingDefaultConfig as aY, ShippingFeature as aZ, type ShippingPluginConfig as a_, InvoiceDocumentType as aa, type InvoiceLine as ab, type InvoiceMoney as ac, type InvoiceParty as ad, type InvoiceRequest as ae, type InvoiceResult as af, InvoiceStatus as ag, type InvoiceTax as ah, type InvoicingDefaultConfig as ai, InvoicingFeature as aj, type InvoicingPluginConfig as ak, type InvoicingStaticConfig as al, type KeyValueBlock$1 as am, type KeyValueRow$1 as an, LayoutMode as ao, type Logger as ap, type MarkdownBlock as aq, MessageVariant as ar, type PaymentCard as as, type PaymentConnect as at, type PaymentConnectExchange as au, type PaymentConnectParams as av, type PaymentCustomer as aw, type PaymentGatewayCode as ax, type PaymentPayload as ay, type PaymentPluginConfig as az, type AccordionSection as b, type ShippingQuoteParams as b0, type ShippingStaticConfig as b1, StepStatusFrom as b2, type StepStatusFromAction as b3, type StepStatusFromFields as b4, type StepStatusSource as b5, type StorageBroker as b6, type SupplierCatalogQuery as b7, type SupplierFulfillmentEvent as b8, type SupplierListing as b9, crossValidateSetupLayout as bA, definePlugin as bB, invoicingCapability as bC, isConfigurablePlugin as bD, isPluginFactory as bE, paymentCapability as bF, shippingCapability as bG, suppliersCapability as bH, uiCapability as bI, validatePluginAuthor as bJ, validateSetupLayout as bK, validateUiContributions as bL, type SupplierListingAttribute as ba, type SupplierListingPage as bb, type SupplierListingVariant as bc, type SupplierMoney as bd, type SupplierOrderAddressLevel as be, type SupplierOrderCustomer as bf, type SupplierOrderLine as bg, type SupplierOrderResult as bh, type SupplierOrderStatus as bi, type SupplierShipTo as bj, type SupplierStock as bk, type SuppliersDefaultConfig as bl, SuppliersFeature as bm, type SuppliersPluginConfig as bn, type SuppliersStaticConfig as bo, type TabItem as bp, type TabsBlock as bq, type ToggleBlock as br, type TrackingEvent as bs, TransactionStatus as bt, type UiContribution as bu, type UiContributionsValidation as bv, type VoidInvoiceInput as bw, type WebhookSignatureResult as bx, analyticsCapability as by, capability as bz, type ActionBlock$1 as c, ActionVariant as d, type AnalyticsActionSource as e, type AnalyticsConsent as f, type AnalyticsEvent as g, type AnalyticsEventName as h, AnalyticsFeature as i, type AnalyticsItem as j, type AnalyticsMoney as k, type AnalyticsPluginConfig as l, type AnalyticsStaticConfig as m, type AnalyticsUserData as n, type AnalyticsUtm as o, type AuthorValidation as p, type Block as q, type BlockBase as r, BlockType as s, type CalloutBlock as t, type Capability as u, CapabilityKind as v, type CardBlock$1 as w, type CodConfig as x, type CodFeeConfig as y, CodFeeType as z };
|
|
@@ -31,6 +31,8 @@ interface PluginConfigField {
|
|
|
31
31
|
internal?: boolean;
|
|
32
32
|
/** Visual group header rendered above the first field of each new group. */
|
|
33
33
|
group?: string;
|
|
34
|
+
/** External URL shown as "¿Cómo obtenerlo?" link below the field label. */
|
|
35
|
+
helpUrl?: string;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
declare enum FieldVariant {
|
|
@@ -116,6 +118,8 @@ interface GroupBlock extends BlockBase {
|
|
|
116
118
|
type: BlockType.Group;
|
|
117
119
|
title: string;
|
|
118
120
|
description?: string;
|
|
121
|
+
/** External URL shown as "¿Cómo obtenerlo?" link in the annotated aside. */
|
|
122
|
+
helpUrl?: string;
|
|
119
123
|
/** configSchema keys included in this group. */
|
|
120
124
|
fields: string[];
|
|
121
125
|
collapsible?: boolean;
|
|
@@ -128,7 +132,7 @@ interface ToggleBlock extends BlockBase {
|
|
|
128
132
|
label: string;
|
|
129
133
|
description?: string;
|
|
130
134
|
}
|
|
131
|
-
interface ActionBlock extends BlockBase {
|
|
135
|
+
interface ActionBlock$1 extends BlockBase {
|
|
132
136
|
type: BlockType.Action;
|
|
133
137
|
/** Matches a manifest.actions[id]. */
|
|
134
138
|
id: string;
|
|
@@ -148,7 +152,7 @@ interface MarkdownBlock extends BlockBase {
|
|
|
148
152
|
type: BlockType.Markdown;
|
|
149
153
|
content: string;
|
|
150
154
|
}
|
|
151
|
-
interface DividerBlock extends BlockBase {
|
|
155
|
+
interface DividerBlock$1 extends BlockBase {
|
|
152
156
|
type: BlockType.Divider;
|
|
153
157
|
}
|
|
154
158
|
type ConditionalEquals = string | number | boolean | null;
|
|
@@ -168,14 +172,14 @@ interface RepeaterBlock extends BlockBase {
|
|
|
168
172
|
blocks: Block[];
|
|
169
173
|
}
|
|
170
174
|
/** Titled container. Recurses into `blocks`. */
|
|
171
|
-
interface CardBlock extends BlockBase {
|
|
175
|
+
interface CardBlock$1 extends BlockBase {
|
|
172
176
|
type: BlockType.Card;
|
|
173
177
|
title?: string;
|
|
174
178
|
description?: string;
|
|
175
179
|
blocks: Block[];
|
|
176
180
|
}
|
|
177
181
|
/** Prominent variant-styled message. Leaf. */
|
|
178
|
-
interface BannerBlock extends BlockBase {
|
|
182
|
+
interface BannerBlock$1 extends BlockBase {
|
|
179
183
|
type: BlockType.Banner;
|
|
180
184
|
variant: MessageVariant;
|
|
181
185
|
title?: string;
|
|
@@ -185,7 +189,7 @@ interface BannerBlock extends BlockBase {
|
|
|
185
189
|
* Read-only value with a copy affordance. EXACTLY ONE source of the value:
|
|
186
190
|
* a literal, a host `computedValues` key, or a read-only echo of a config key.
|
|
187
191
|
*/
|
|
188
|
-
interface CopyFieldBlock extends BlockBase {
|
|
192
|
+
interface CopyFieldBlock$1 extends BlockBase {
|
|
189
193
|
type: BlockType.CopyField;
|
|
190
194
|
label: string;
|
|
191
195
|
/** Literal value. */
|
|
@@ -221,17 +225,17 @@ interface AccordionBlock extends BlockBase {
|
|
|
221
225
|
type: BlockType.Accordion;
|
|
222
226
|
sections: AccordionSection[];
|
|
223
227
|
}
|
|
224
|
-
interface KeyValueRow {
|
|
228
|
+
interface KeyValueRow$1 {
|
|
225
229
|
label: string;
|
|
226
230
|
value?: string;
|
|
227
231
|
computedKey?: string;
|
|
228
232
|
}
|
|
229
233
|
/** Read-only label/value list. Leaf. */
|
|
230
|
-
interface KeyValueBlock extends BlockBase {
|
|
234
|
+
interface KeyValueBlock$1 extends BlockBase {
|
|
231
235
|
type: BlockType.KeyValue;
|
|
232
|
-
rows: KeyValueRow[];
|
|
236
|
+
rows: KeyValueRow$1[];
|
|
233
237
|
}
|
|
234
|
-
type Block = FieldBlock | GroupBlock | ToggleBlock | ActionBlock | CalloutBlock | MarkdownBlock | DividerBlock | ConditionalBlock | RepeaterBlock | CardBlock | BannerBlock | CopyFieldBlock | InlineRowBlock | TabsBlock | AccordionBlock | KeyValueBlock;
|
|
238
|
+
type Block = FieldBlock | GroupBlock | ToggleBlock | ActionBlock$1 | CalloutBlock | MarkdownBlock | DividerBlock$1 | ConditionalBlock | RepeaterBlock | CardBlock$1 | BannerBlock$1 | CopyFieldBlock$1 | InlineRowBlock | TabsBlock | AccordionBlock | KeyValueBlock$1;
|
|
235
239
|
interface StepStatusFromFields {
|
|
236
240
|
from: StepStatusFrom.Fields;
|
|
237
241
|
}
|
|
@@ -310,7 +314,6 @@ interface PluginManifest {
|
|
|
310
314
|
displayName?: string;
|
|
311
315
|
version: string;
|
|
312
316
|
entry: string;
|
|
313
|
-
type?: PluginType;
|
|
314
317
|
icon?: string;
|
|
315
318
|
description?: string;
|
|
316
319
|
dependencies?: string[];
|
|
@@ -336,13 +339,6 @@ interface PluginManifest {
|
|
|
336
339
|
setup?: SetupLayout;
|
|
337
340
|
}
|
|
338
341
|
|
|
339
|
-
declare enum PluginType {
|
|
340
|
-
Payment = "payment",
|
|
341
|
-
Shipping = "shipping",
|
|
342
|
-
Analytics = "analytics",
|
|
343
|
-
Invoicing = "invoicing",
|
|
344
|
-
Generic = "generic"
|
|
345
|
-
}
|
|
346
342
|
/** Visual tone for messages, callouts and action results. */
|
|
347
343
|
declare enum MessageVariant {
|
|
348
344
|
Info = "info",
|
|
@@ -544,6 +540,40 @@ interface WebhookSignatureResult {
|
|
|
544
540
|
isValid: boolean;
|
|
545
541
|
error?: string;
|
|
546
542
|
}
|
|
543
|
+
/**
|
|
544
|
+
* "Connect" handshake (authorization code + PKCE) a gateway can offer so a
|
|
545
|
+
* merchant links their account with one click instead of pasting credentials.
|
|
546
|
+
* The HOST owns state, code_verifier and the callback route; the plugin only
|
|
547
|
+
* knows the gateway's URLs and wire format. STATELESS like every other verb.
|
|
548
|
+
*/
|
|
549
|
+
interface PaymentConnectParams {
|
|
550
|
+
/** Opaque anti-CSRF value; echoed back on the callback. */
|
|
551
|
+
state: string;
|
|
552
|
+
/** base64url(SHA-256(code_verifier)) — S256. */
|
|
553
|
+
codeChallenge: string;
|
|
554
|
+
/** Host callback the gateway redirects the merchant to (`?code&state`). */
|
|
555
|
+
redirectUri: string;
|
|
556
|
+
/** Host webhook endpoint for this gateway, to register on the gateway side. */
|
|
557
|
+
webhookUrl: string;
|
|
558
|
+
/** Store origin (https://host) — the only origin the gateway may wire to. */
|
|
559
|
+
origin: string;
|
|
560
|
+
/** Store display name, shown on the gateway's consent screen. */
|
|
561
|
+
storeName: string;
|
|
562
|
+
}
|
|
563
|
+
interface PaymentConnectExchange {
|
|
564
|
+
code: string;
|
|
565
|
+
codeVerifier: string;
|
|
566
|
+
redirectUri: string;
|
|
567
|
+
}
|
|
568
|
+
interface PaymentConnect {
|
|
569
|
+
/** Where to send the merchant to log in and approve the store. */
|
|
570
|
+
authorizeUrl(params: PaymentConnectParams, ctx: DispatchContext): string;
|
|
571
|
+
/**
|
|
572
|
+
* Redeem the authorization code. Returns a CONFIG PATCH (credentials etc.)
|
|
573
|
+
* the host persists exactly like an admin save.
|
|
574
|
+
*/
|
|
575
|
+
exchange(params: PaymentConnectExchange, ctx: DispatchContext): Promise<Record<string, unknown>>;
|
|
576
|
+
}
|
|
547
577
|
interface IPaymentPlugin extends IPlugin {
|
|
548
578
|
readonly gatewayCode: PaymentGatewayCode;
|
|
549
579
|
readonly staticConfig: GatewayStaticConfig;
|
|
@@ -568,6 +598,8 @@ interface IPaymentPlugin extends IPlugin {
|
|
|
568
598
|
* call via `ctx.config` (INV-4); no card data is ever passed here (INV-1).
|
|
569
599
|
*/
|
|
570
600
|
createPaymentSession?(payload: PaymentSessionPayload, ctx: DispatchContext): Promise<PaymentSessionResult>;
|
|
601
|
+
/** OPTIONAL one-click account linking (see {@link PaymentConnect}). */
|
|
602
|
+
readonly connect?: PaymentConnect;
|
|
571
603
|
}
|
|
572
604
|
|
|
573
605
|
declare enum ShippingFeature {
|
|
@@ -608,6 +640,8 @@ interface ShippingStaticConfig {
|
|
|
608
640
|
displayName: string;
|
|
609
641
|
description: string;
|
|
610
642
|
iconUrl?: string;
|
|
643
|
+
authorName?: string;
|
|
644
|
+
authorUrl?: string;
|
|
611
645
|
supportedCountries: string[];
|
|
612
646
|
supportedFeatures: ShippingFeature[];
|
|
613
647
|
configSchema: PluginConfigField[];
|
|
@@ -750,6 +784,8 @@ interface SuppliersStaticConfig {
|
|
|
750
784
|
displayName: string;
|
|
751
785
|
description: string;
|
|
752
786
|
iconUrl?: string;
|
|
787
|
+
authorName?: string;
|
|
788
|
+
authorUrl?: string;
|
|
753
789
|
supportedCountries: string[];
|
|
754
790
|
supportedCapabilities: SuppliersFeature[];
|
|
755
791
|
configSchema: PluginConfigField[];
|
|
@@ -1054,6 +1090,8 @@ interface AnalyticsStaticConfig {
|
|
|
1054
1090
|
displayName: string;
|
|
1055
1091
|
description: string;
|
|
1056
1092
|
iconUrl?: string;
|
|
1093
|
+
authorName?: string;
|
|
1094
|
+
authorUrl?: string;
|
|
1057
1095
|
supportedCapabilities: AnalyticsFeature[];
|
|
1058
1096
|
configSchema: PluginConfigField[];
|
|
1059
1097
|
}
|
|
@@ -1257,6 +1295,8 @@ interface InvoicingStaticConfig {
|
|
|
1257
1295
|
displayName: string;
|
|
1258
1296
|
description: string;
|
|
1259
1297
|
iconUrl?: string;
|
|
1298
|
+
authorName?: string;
|
|
1299
|
+
authorUrl?: string;
|
|
1260
1300
|
supportedCountries: string[];
|
|
1261
1301
|
supportedFeatures: InvoicingFeature[];
|
|
1262
1302
|
supportedDocumentTypes: InvoiceDocumentType[];
|
|
@@ -1290,6 +1330,112 @@ interface IInvoicingPlugin extends IPlugin {
|
|
|
1290
1330
|
isConfigured?(ctx: DispatchContext): boolean;
|
|
1291
1331
|
}
|
|
1292
1332
|
|
|
1333
|
+
declare enum ContentBlockType {
|
|
1334
|
+
Text = "text",
|
|
1335
|
+
Banner = "banner",
|
|
1336
|
+
Badge = "badge",
|
|
1337
|
+
KeyValue = "keyValue",
|
|
1338
|
+
CopyField = "copyField",
|
|
1339
|
+
Link = "link",
|
|
1340
|
+
Divider = "divider",
|
|
1341
|
+
Action = "action",
|
|
1342
|
+
Card = "card"
|
|
1343
|
+
}
|
|
1344
|
+
declare enum ContentActionVariant {
|
|
1345
|
+
Primary = "primary",
|
|
1346
|
+
Secondary = "secondary",
|
|
1347
|
+
Danger = "danger"
|
|
1348
|
+
}
|
|
1349
|
+
/** Markdown/plain paragraph. Literal `content` or host-resolved `computedKey`. */
|
|
1350
|
+
interface TextBlock {
|
|
1351
|
+
type: ContentBlockType.Text;
|
|
1352
|
+
content?: string;
|
|
1353
|
+
computedKey?: string;
|
|
1354
|
+
}
|
|
1355
|
+
/** Prominent variant-styled message. */
|
|
1356
|
+
interface BannerBlock {
|
|
1357
|
+
type: ContentBlockType.Banner;
|
|
1358
|
+
variant: MessageVariant;
|
|
1359
|
+
title?: string;
|
|
1360
|
+
text: string;
|
|
1361
|
+
}
|
|
1362
|
+
/** Inline status pill. Literal `text` or host-resolved `computedKey`. */
|
|
1363
|
+
interface BadgeBlock {
|
|
1364
|
+
type: ContentBlockType.Badge;
|
|
1365
|
+
variant: MessageVariant;
|
|
1366
|
+
text?: string;
|
|
1367
|
+
computedKey?: string;
|
|
1368
|
+
}
|
|
1369
|
+
interface KeyValueRow {
|
|
1370
|
+
label: string;
|
|
1371
|
+
value?: string;
|
|
1372
|
+
computedKey?: string;
|
|
1373
|
+
}
|
|
1374
|
+
/** Read-only label/value list. */
|
|
1375
|
+
interface KeyValueBlock {
|
|
1376
|
+
type: ContentBlockType.KeyValue;
|
|
1377
|
+
rows: KeyValueRow[];
|
|
1378
|
+
}
|
|
1379
|
+
/** Read-only value with a copy affordance. Literal or host-resolved. */
|
|
1380
|
+
interface CopyFieldBlock {
|
|
1381
|
+
type: ContentBlockType.CopyField;
|
|
1382
|
+
label: string;
|
|
1383
|
+
value?: string;
|
|
1384
|
+
computedKey?: string;
|
|
1385
|
+
}
|
|
1386
|
+
/** Hyperlink (e.g. "Descargar PDF"). `href` literal or host-resolved. */
|
|
1387
|
+
interface LinkBlock {
|
|
1388
|
+
type: ContentBlockType.Link;
|
|
1389
|
+
label: string;
|
|
1390
|
+
href?: string;
|
|
1391
|
+
computedKey?: string;
|
|
1392
|
+
external?: boolean;
|
|
1393
|
+
}
|
|
1394
|
+
interface DividerBlock {
|
|
1395
|
+
type: ContentBlockType.Divider;
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Triggers a plugin action. `id` matches a `manifest.setup.actions[id]`; the
|
|
1399
|
+
* host dispatches it through the SAME runtime path as a setup-screen action
|
|
1400
|
+
* (invokeAction), so a contribution reuses the plugin's existing action surface.
|
|
1401
|
+
*/
|
|
1402
|
+
interface ActionBlock {
|
|
1403
|
+
type: ContentBlockType.Action;
|
|
1404
|
+
id: string;
|
|
1405
|
+
label: string;
|
|
1406
|
+
variant?: ContentActionVariant;
|
|
1407
|
+
}
|
|
1408
|
+
/** Titled container. Recurses into child `blocks`. */
|
|
1409
|
+
interface CardBlock {
|
|
1410
|
+
type: ContentBlockType.Card;
|
|
1411
|
+
title?: string;
|
|
1412
|
+
description?: string;
|
|
1413
|
+
blocks: ContentBlock[];
|
|
1414
|
+
}
|
|
1415
|
+
type ContentBlock = TextBlock | BannerBlock | BadgeBlock | KeyValueBlock | CopyFieldBlock | LinkBlock | DividerBlock | ActionBlock | CardBlock;
|
|
1416
|
+
/**
|
|
1417
|
+
* One block tree the plugin injects into a host slot. `slot` names a host-owned
|
|
1418
|
+
* target (e.g. "admin:order.detail.sidebar", "storefront:product.below"); the
|
|
1419
|
+
* set of valid slots is owned by the host, not the SDK. `order` breaks ties when
|
|
1420
|
+
* several plugins target the same slot (ascending; absent sorts last).
|
|
1421
|
+
*/
|
|
1422
|
+
interface UiContribution {
|
|
1423
|
+
slot: string;
|
|
1424
|
+
blocks: ContentBlock[];
|
|
1425
|
+
order?: number;
|
|
1426
|
+
}
|
|
1427
|
+
/** Impl behind a `ui` capability — the static set a plugin declares up front. */
|
|
1428
|
+
interface IUiPlugin {
|
|
1429
|
+
readonly contributions: UiContribution[];
|
|
1430
|
+
}
|
|
1431
|
+
interface UiContributionsValidation {
|
|
1432
|
+
success: boolean;
|
|
1433
|
+
data?: UiContribution[];
|
|
1434
|
+
errors?: string[];
|
|
1435
|
+
}
|
|
1436
|
+
/** Validates a plugin's declared contributions, including recursive cards. */
|
|
1437
|
+
declare function validateUiContributions(input: unknown): UiContributionsValidation;
|
|
1438
|
+
|
|
1293
1439
|
/** A named unit of behaviour a plugin exposes to the host registry. */
|
|
1294
1440
|
interface Capability<T = unknown> {
|
|
1295
1441
|
kind: string;
|
|
@@ -1306,6 +1452,12 @@ declare const CapabilityKind: {
|
|
|
1306
1452
|
readonly Suppliers: "suppliers";
|
|
1307
1453
|
readonly Analytics: "analytics";
|
|
1308
1454
|
readonly Invoicing: "invoicing";
|
|
1455
|
+
/**
|
|
1456
|
+
* Cross-cutting DISPLAY capability: a plugin of ANY surface may ALSO expose
|
|
1457
|
+
* `ui` to contribute declarative blocks into host slots. Not a catalog
|
|
1458
|
+
* "surface" — the host's AppSurface derivation excludes it on purpose.
|
|
1459
|
+
*/
|
|
1460
|
+
readonly Ui: "ui";
|
|
1309
1461
|
};
|
|
1310
1462
|
type CapabilityKind = (typeof CapabilityKind)[keyof typeof CapabilityKind];
|
|
1311
1463
|
declare function capability<T>(kind: string, impl: T): Capability<T>;
|
|
@@ -1314,6 +1466,7 @@ declare function shippingCapability(impl: IShippingPlugin): Capability<IShipping
|
|
|
1314
1466
|
declare function suppliersCapability(impl: ISuppliersPlugin): Capability<ISuppliersPlugin>;
|
|
1315
1467
|
declare function analyticsCapability(impl: IAnalyticsPlugin): Capability<IAnalyticsPlugin>;
|
|
1316
1468
|
declare function invoicingCapability(impl: IInvoicingPlugin): Capability<IInvoicingPlugin>;
|
|
1469
|
+
declare function uiCapability(impl: IUiPlugin): Capability<IUiPlugin>;
|
|
1317
1470
|
/**
|
|
1318
1471
|
* A constructed plugin. `capabilities` is the static declaration the host reads
|
|
1319
1472
|
* up front; `onActivate` runs when the host mounts the plugin for a tenant and
|
|
@@ -1413,4 +1566,4 @@ interface HostApi {
|
|
|
1413
1566
|
registerCapability<T = unknown>(cap: Capability<T>): void;
|
|
1414
1567
|
}
|
|
1415
1568
|
|
|
1416
|
-
export { type
|
|
1569
|
+
export { type HttpClient as $, AUTHOR_HANDLE_RE as A, type BannerBlock$1 as B, ConfigScope as C, type ConditionalBlock as D, type ConditionalEquals as E, FieldType as F, type ConditionalWhen as G, type ConfigurablePlugin as H, ContentActionVariant as I, type ContentBlock as J, ContentBlockType as K, type CopyFieldBlock$1 as L, type CreateShipmentParams as M, type DispatchContext as N, type DividerBlock$1 as O, type PluginConfigField as P, type DomainEventHandler as Q, type DomainEventName as R, type SelectOption as S, type EmbedInit as T, type FieldBlock as U, type FieldOption as V, FieldVariant as W, GatewayEnvironment as X, type GatewayStaticConfig as Y, type GroupBlock as Z, type HostApi as _, type AccordionBlock as a, type ShippingQuote as a$, type HttpRequest as a0, type HttpResponse as a1, type IAnalyticsPlugin as a2, type IInvoicingPlugin as a3, type IPaymentPlugin as a4, type IPlugin as a5, type IShippingPlugin as a6, type ISuppliersPlugin as a7, type IUiPlugin as a8, type InlineRowBlock as a9, type PaymentRenderMode as aA, type PaymentResult as aB, type PaymentSessionPayload as aC, type PaymentSessionResult as aD, type PaymentVerifyPayload as aE, type PlaceSupplierOrderInput as aF, type Plugin as aG, type PluginActionContext as aH, type PluginActionResult as aI, type PluginAuthor as aJ, type PluginConfigFieldDependency as aK, type PluginFactory as aL, type PluginManifest as aM, type RepeaterBlock as aN, RepeaterSource as aO, type SecretStore as aP, type SequenceStore as aQ, type SetupAction as aR, type SetupLayout as aS, type SetupLayoutValidation as aT, type SetupStep as aU, type ShipmentAddress as aV, type ShipmentParcel as aW, type ShipmentResult as aX, type ShippingDefaultConfig as aY, ShippingFeature as aZ, type ShippingPluginConfig as a_, InvoiceDocumentType as aa, type InvoiceLine as ab, type InvoiceMoney as ac, type InvoiceParty as ad, type InvoiceRequest as ae, type InvoiceResult as af, InvoiceStatus as ag, type InvoiceTax as ah, type InvoicingDefaultConfig as ai, InvoicingFeature as aj, type InvoicingPluginConfig as ak, type InvoicingStaticConfig as al, type KeyValueBlock$1 as am, type KeyValueRow$1 as an, LayoutMode as ao, type Logger as ap, type MarkdownBlock as aq, MessageVariant as ar, type PaymentCard as as, type PaymentConnect as at, type PaymentConnectExchange as au, type PaymentConnectParams as av, type PaymentCustomer as aw, type PaymentGatewayCode as ax, type PaymentPayload as ay, type PaymentPluginConfig as az, type AccordionSection as b, type ShippingQuoteParams as b0, type ShippingStaticConfig as b1, StepStatusFrom as b2, type StepStatusFromAction as b3, type StepStatusFromFields as b4, type StepStatusSource as b5, type StorageBroker as b6, type SupplierCatalogQuery as b7, type SupplierFulfillmentEvent as b8, type SupplierListing as b9, crossValidateSetupLayout as bA, definePlugin as bB, invoicingCapability as bC, isConfigurablePlugin as bD, isPluginFactory as bE, paymentCapability as bF, shippingCapability as bG, suppliersCapability as bH, uiCapability as bI, validatePluginAuthor as bJ, validateSetupLayout as bK, validateUiContributions as bL, type SupplierListingAttribute as ba, type SupplierListingPage as bb, type SupplierListingVariant as bc, type SupplierMoney as bd, type SupplierOrderAddressLevel as be, type SupplierOrderCustomer as bf, type SupplierOrderLine as bg, type SupplierOrderResult as bh, type SupplierOrderStatus as bi, type SupplierShipTo as bj, type SupplierStock as bk, type SuppliersDefaultConfig as bl, SuppliersFeature as bm, type SuppliersPluginConfig as bn, type SuppliersStaticConfig as bo, type TabItem as bp, type TabsBlock as bq, type ToggleBlock as br, type TrackingEvent as bs, TransactionStatus as bt, type UiContribution as bu, type UiContributionsValidation as bv, type VoidInvoiceInput as bw, type WebhookSignatureResult as bx, analyticsCapability as by, capability as bz, type ActionBlock$1 as c, ActionVariant as d, type AnalyticsActionSource as e, type AnalyticsConsent as f, type AnalyticsEvent as g, type AnalyticsEventName as h, AnalyticsFeature as i, type AnalyticsItem as j, type AnalyticsMoney as k, type AnalyticsPluginConfig as l, type AnalyticsStaticConfig as m, type AnalyticsUserData as n, type AnalyticsUtm as o, type AuthorValidation as p, type Block as q, type BlockBase as r, BlockType as s, type CalloutBlock as t, type Capability as u, CapabilityKind as v, type CardBlock$1 as w, type CodConfig as x, type CodFeeConfig as y, CodFeeType as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FieldType, C as ConfigScope, S as SelectOption, P as PluginConfigField } from './host-api-
|
|
2
|
-
export { A as AUTHOR_HANDLE_RE, a as AccordionBlock, b as AccordionSection, c as ActionBlock, d as ActionVariant, e as AnalyticsActionSource, f as AnalyticsConsent, g as AnalyticsEvent, h as AnalyticsEventName, i as AnalyticsFeature, j as AnalyticsItem, k as AnalyticsMoney, l as AnalyticsPluginConfig, m as AnalyticsStaticConfig, n as AnalyticsUserData, o as AnalyticsUtm, p as AuthorValidation, B as BannerBlock, q as Block, r as BlockBase, s as BlockType, t as CalloutBlock, u as Capability, v as CapabilityKind, w as CardBlock, x as CodConfig, y as CodFeeConfig, z as CodFeeType, D as ConditionalBlock, E as ConditionalEquals, G as ConditionalWhen, H as ConfigurablePlugin, I as
|
|
1
|
+
import { F as FieldType, C as ConfigScope, S as SelectOption, P as PluginConfigField } from './host-api-BbIT_sLc.mjs';
|
|
2
|
+
export { A as AUTHOR_HANDLE_RE, a as AccordionBlock, b as AccordionSection, c as ActionBlock, d as ActionVariant, e as AnalyticsActionSource, f as AnalyticsConsent, g as AnalyticsEvent, h as AnalyticsEventName, i as AnalyticsFeature, j as AnalyticsItem, k as AnalyticsMoney, l as AnalyticsPluginConfig, m as AnalyticsStaticConfig, n as AnalyticsUserData, o as AnalyticsUtm, p as AuthorValidation, B as BannerBlock, q as Block, r as BlockBase, s as BlockType, t as CalloutBlock, u as Capability, v as CapabilityKind, w as CardBlock, x as CodConfig, y as CodFeeConfig, z as CodFeeType, D as ConditionalBlock, E as ConditionalEquals, G as ConditionalWhen, H as ConfigurablePlugin, I as ContentActionVariant, J as ContentBlock, K as ContentBlockType, L as CopyFieldBlock, M as CreateShipmentParams, N as DispatchContext, O as DividerBlock, Q as DomainEventHandler, R as DomainEventName, T as EmbedInit, U as FieldBlock, V as FieldOption, W as FieldVariant, X as GatewayEnvironment, Y as GatewayStaticConfig, Z as GroupBlock, _ as HostApi, $ as HttpClient, a0 as HttpRequest, a1 as HttpResponse, a2 as IAnalyticsPlugin, a3 as IInvoicingPlugin, a4 as IPaymentPlugin, a5 as IPlugin, a6 as IShippingPlugin, a7 as ISuppliersPlugin, a8 as IUiPlugin, a9 as InlineRowBlock, aa as InvoiceDocumentType, ab as InvoiceLine, ac as InvoiceMoney, ad as InvoiceParty, ae as InvoiceRequest, af as InvoiceResult, ag as InvoiceStatus, ah as InvoiceTax, ai as InvoicingDefaultConfig, aj as InvoicingFeature, ak as InvoicingPluginConfig, al as InvoicingStaticConfig, am as KeyValueBlock, an as KeyValueRow, ao as LayoutMode, ap as Logger, aq as MarkdownBlock, ar as MessageVariant, as as PaymentCard, at as PaymentConnect, au as PaymentConnectExchange, av as PaymentConnectParams, aw as PaymentCustomer, ax as PaymentGatewayCode, ay as PaymentPayload, az as PaymentPluginConfig, aA as PaymentRenderMode, aB as PaymentResult, aC as PaymentSessionPayload, aD as PaymentSessionResult, aE as PaymentVerifyPayload, aF as PlaceSupplierOrderInput, aG as Plugin, aH as PluginActionContext, aI as PluginActionResult, aJ as PluginAuthor, aK as PluginConfigFieldDependency, aL as PluginFactory, aM as PluginManifest, aN as RepeaterBlock, aO as RepeaterSource, aP as SecretStore, aQ as SequenceStore, aR as SetupAction, aS as SetupLayout, aT as SetupLayoutValidation, aU as SetupStep, aV as ShipmentAddress, aW as ShipmentParcel, aX as ShipmentResult, aY as ShippingDefaultConfig, aZ as ShippingFeature, a_ as ShippingPluginConfig, a$ as ShippingQuote, b0 as ShippingQuoteParams, b1 as ShippingStaticConfig, b2 as StepStatusFrom, b3 as StepStatusFromAction, b4 as StepStatusFromFields, b5 as StepStatusSource, b6 as StorageBroker, b7 as SupplierCatalogQuery, b8 as SupplierFulfillmentEvent, b9 as SupplierListing, ba as SupplierListingAttribute, bb as SupplierListingPage, bc as SupplierListingVariant, bd as SupplierMoney, be as SupplierOrderAddressLevel, bf as SupplierOrderCustomer, bg as SupplierOrderLine, bh as SupplierOrderResult, bi as SupplierOrderStatus, bj as SupplierShipTo, bk as SupplierStock, bl as SuppliersDefaultConfig, bm as SuppliersFeature, bn as SuppliersPluginConfig, bo as SuppliersStaticConfig, bp as TabItem, bq as TabsBlock, br as ToggleBlock, bs as TrackingEvent, bt as TransactionStatus, bu as UiContribution, bv as UiContributionsValidation, bw as VoidInvoiceInput, bx as WebhookSignatureResult, by as analyticsCapability, bz as capability, bA as crossValidateSetupLayout, bB as definePlugin, bC as invoicingCapability, bD as isConfigurablePlugin, bE as isPluginFactory, bF as paymentCapability, bG as shippingCapability, bH as suppliersCapability, bI as uiCapability, bJ as validatePluginAuthor, bK as validateSetupLayout, bL as validateUiContributions } from './host-api-BbIT_sLc.mjs';
|
|
3
3
|
|
|
4
4
|
declare const PAYMENT_PLUGIN_TOKEN: "PAYMENT_PLUGINS";
|
|
5
5
|
declare const SHIPPING_PLUGIN_TOKEN: "SHIPPING_PLUGINS";
|
|
@@ -74,7 +74,7 @@ declare function checkPermissions(required: string[], grantedRaw: string[]): Per
|
|
|
74
74
|
* - MINOR: additive (new optional fields, new tokens) — backwards compatible.
|
|
75
75
|
* - PATCH: docs/fixes with zero shape changes.
|
|
76
76
|
*/
|
|
77
|
-
declare const SDK_VERSION = "0.6.
|
|
77
|
+
declare const SDK_VERSION = "0.6.8";
|
|
78
78
|
/**
|
|
79
79
|
* True when a plugin built against `pluginSdkVersion` can run on a host that
|
|
80
80
|
* ships `hostSdkVersion`. Rule: same major, host minor >= plugin minor.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FieldType, C as ConfigScope, S as SelectOption, P as PluginConfigField } from './host-api-
|
|
2
|
-
export { A as AUTHOR_HANDLE_RE, a as AccordionBlock, b as AccordionSection, c as ActionBlock, d as ActionVariant, e as AnalyticsActionSource, f as AnalyticsConsent, g as AnalyticsEvent, h as AnalyticsEventName, i as AnalyticsFeature, j as AnalyticsItem, k as AnalyticsMoney, l as AnalyticsPluginConfig, m as AnalyticsStaticConfig, n as AnalyticsUserData, o as AnalyticsUtm, p as AuthorValidation, B as BannerBlock, q as Block, r as BlockBase, s as BlockType, t as CalloutBlock, u as Capability, v as CapabilityKind, w as CardBlock, x as CodConfig, y as CodFeeConfig, z as CodFeeType, D as ConditionalBlock, E as ConditionalEquals, G as ConditionalWhen, H as ConfigurablePlugin, I as
|
|
1
|
+
import { F as FieldType, C as ConfigScope, S as SelectOption, P as PluginConfigField } from './host-api-BbIT_sLc.js';
|
|
2
|
+
export { A as AUTHOR_HANDLE_RE, a as AccordionBlock, b as AccordionSection, c as ActionBlock, d as ActionVariant, e as AnalyticsActionSource, f as AnalyticsConsent, g as AnalyticsEvent, h as AnalyticsEventName, i as AnalyticsFeature, j as AnalyticsItem, k as AnalyticsMoney, l as AnalyticsPluginConfig, m as AnalyticsStaticConfig, n as AnalyticsUserData, o as AnalyticsUtm, p as AuthorValidation, B as BannerBlock, q as Block, r as BlockBase, s as BlockType, t as CalloutBlock, u as Capability, v as CapabilityKind, w as CardBlock, x as CodConfig, y as CodFeeConfig, z as CodFeeType, D as ConditionalBlock, E as ConditionalEquals, G as ConditionalWhen, H as ConfigurablePlugin, I as ContentActionVariant, J as ContentBlock, K as ContentBlockType, L as CopyFieldBlock, M as CreateShipmentParams, N as DispatchContext, O as DividerBlock, Q as DomainEventHandler, R as DomainEventName, T as EmbedInit, U as FieldBlock, V as FieldOption, W as FieldVariant, X as GatewayEnvironment, Y as GatewayStaticConfig, Z as GroupBlock, _ as HostApi, $ as HttpClient, a0 as HttpRequest, a1 as HttpResponse, a2 as IAnalyticsPlugin, a3 as IInvoicingPlugin, a4 as IPaymentPlugin, a5 as IPlugin, a6 as IShippingPlugin, a7 as ISuppliersPlugin, a8 as IUiPlugin, a9 as InlineRowBlock, aa as InvoiceDocumentType, ab as InvoiceLine, ac as InvoiceMoney, ad as InvoiceParty, ae as InvoiceRequest, af as InvoiceResult, ag as InvoiceStatus, ah as InvoiceTax, ai as InvoicingDefaultConfig, aj as InvoicingFeature, ak as InvoicingPluginConfig, al as InvoicingStaticConfig, am as KeyValueBlock, an as KeyValueRow, ao as LayoutMode, ap as Logger, aq as MarkdownBlock, ar as MessageVariant, as as PaymentCard, at as PaymentConnect, au as PaymentConnectExchange, av as PaymentConnectParams, aw as PaymentCustomer, ax as PaymentGatewayCode, ay as PaymentPayload, az as PaymentPluginConfig, aA as PaymentRenderMode, aB as PaymentResult, aC as PaymentSessionPayload, aD as PaymentSessionResult, aE as PaymentVerifyPayload, aF as PlaceSupplierOrderInput, aG as Plugin, aH as PluginActionContext, aI as PluginActionResult, aJ as PluginAuthor, aK as PluginConfigFieldDependency, aL as PluginFactory, aM as PluginManifest, aN as RepeaterBlock, aO as RepeaterSource, aP as SecretStore, aQ as SequenceStore, aR as SetupAction, aS as SetupLayout, aT as SetupLayoutValidation, aU as SetupStep, aV as ShipmentAddress, aW as ShipmentParcel, aX as ShipmentResult, aY as ShippingDefaultConfig, aZ as ShippingFeature, a_ as ShippingPluginConfig, a$ as ShippingQuote, b0 as ShippingQuoteParams, b1 as ShippingStaticConfig, b2 as StepStatusFrom, b3 as StepStatusFromAction, b4 as StepStatusFromFields, b5 as StepStatusSource, b6 as StorageBroker, b7 as SupplierCatalogQuery, b8 as SupplierFulfillmentEvent, b9 as SupplierListing, ba as SupplierListingAttribute, bb as SupplierListingPage, bc as SupplierListingVariant, bd as SupplierMoney, be as SupplierOrderAddressLevel, bf as SupplierOrderCustomer, bg as SupplierOrderLine, bh as SupplierOrderResult, bi as SupplierOrderStatus, bj as SupplierShipTo, bk as SupplierStock, bl as SuppliersDefaultConfig, bm as SuppliersFeature, bn as SuppliersPluginConfig, bo as SuppliersStaticConfig, bp as TabItem, bq as TabsBlock, br as ToggleBlock, bs as TrackingEvent, bt as TransactionStatus, bu as UiContribution, bv as UiContributionsValidation, bw as VoidInvoiceInput, bx as WebhookSignatureResult, by as analyticsCapability, bz as capability, bA as crossValidateSetupLayout, bB as definePlugin, bC as invoicingCapability, bD as isConfigurablePlugin, bE as isPluginFactory, bF as paymentCapability, bG as shippingCapability, bH as suppliersCapability, bI as uiCapability, bJ as validatePluginAuthor, bK as validateSetupLayout, bL as validateUiContributions } from './host-api-BbIT_sLc.js';
|
|
3
3
|
|
|
4
4
|
declare const PAYMENT_PLUGIN_TOKEN: "PAYMENT_PLUGINS";
|
|
5
5
|
declare const SHIPPING_PLUGIN_TOKEN: "SHIPPING_PLUGINS";
|
|
@@ -74,7 +74,7 @@ declare function checkPermissions(required: string[], grantedRaw: string[]): Per
|
|
|
74
74
|
* - MINOR: additive (new optional fields, new tokens) — backwards compatible.
|
|
75
75
|
* - PATCH: docs/fixes with zero shape changes.
|
|
76
76
|
*/
|
|
77
|
-
declare const SDK_VERSION = "0.6.
|
|
77
|
+
declare const SDK_VERSION = "0.6.8";
|
|
78
78
|
/**
|
|
79
79
|
* True when a plugin built against `pluginSdkVersion` can run on a host that
|
|
80
80
|
* ships `hostSdkVersion`. Rule: same major, host minor >= plugin minor.
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,8 @@ __export(index_exports, {
|
|
|
28
28
|
CapabilityKind: () => CapabilityKind,
|
|
29
29
|
CodFeeType: () => CodFeeType,
|
|
30
30
|
ConfigScope: () => ConfigScope,
|
|
31
|
+
ContentActionVariant: () => ContentActionVariant,
|
|
32
|
+
ContentBlockType: () => ContentBlockType,
|
|
31
33
|
FieldType: () => FieldType,
|
|
32
34
|
FieldVariant: () => FieldVariant,
|
|
33
35
|
GatewayEnvironment: () => GatewayEnvironment,
|
|
@@ -38,7 +40,6 @@ __export(index_exports, {
|
|
|
38
40
|
LayoutMode: () => LayoutMode,
|
|
39
41
|
MessageVariant: () => MessageVariant,
|
|
40
42
|
PAYMENT_PLUGIN_TOKEN: () => PAYMENT_PLUGIN_TOKEN,
|
|
41
|
-
PluginType: () => PluginType,
|
|
42
43
|
RepeaterSource: () => RepeaterSource,
|
|
43
44
|
SDK_VERSION: () => SDK_VERSION,
|
|
44
45
|
SHIPPING_PLUGIN_TOKEN: () => SHIPPING_PLUGIN_TOKEN,
|
|
@@ -63,8 +64,10 @@ __export(index_exports, {
|
|
|
63
64
|
paymentCapability: () => paymentCapability,
|
|
64
65
|
shippingCapability: () => shippingCapability,
|
|
65
66
|
suppliersCapability: () => suppliersCapability,
|
|
67
|
+
uiCapability: () => uiCapability,
|
|
66
68
|
validatePluginAuthor: () => validatePluginAuthor,
|
|
67
|
-
validateSetupLayout: () => validateSetupLayout
|
|
69
|
+
validateSetupLayout: () => validateSetupLayout,
|
|
70
|
+
validateUiContributions: () => validateUiContributions
|
|
68
71
|
});
|
|
69
72
|
module.exports = __toCommonJS(index_exports);
|
|
70
73
|
|
|
@@ -76,14 +79,6 @@ var ANALYTICS_PLUGIN_TOKEN = "ANALYTICS_PLUGINS";
|
|
|
76
79
|
var INVOICING_PLUGIN_TOKEN = "INVOICING_PLUGINS";
|
|
77
80
|
|
|
78
81
|
// src/plugin.ts
|
|
79
|
-
var PluginType = /* @__PURE__ */ ((PluginType2) => {
|
|
80
|
-
PluginType2["Payment"] = "payment";
|
|
81
|
-
PluginType2["Shipping"] = "shipping";
|
|
82
|
-
PluginType2["Analytics"] = "analytics";
|
|
83
|
-
PluginType2["Invoicing"] = "invoicing";
|
|
84
|
-
PluginType2["Generic"] = "generic";
|
|
85
|
-
return PluginType2;
|
|
86
|
-
})(PluginType || {});
|
|
87
82
|
var MessageVariant = /* @__PURE__ */ ((MessageVariant2) => {
|
|
88
83
|
MessageVariant2["Info"] = "info";
|
|
89
84
|
MessageVariant2["Warning"] = "warning";
|
|
@@ -340,6 +335,7 @@ var sGroupBlock = (0, import_superstruct2.object)({
|
|
|
340
335
|
type: (0, import_superstruct2.literal)("group" /* Group */),
|
|
341
336
|
title: (0, import_superstruct2.string)(),
|
|
342
337
|
description: (0, import_superstruct2.optional)((0, import_superstruct2.string)()),
|
|
338
|
+
helpUrl: (0, import_superstruct2.optional)((0, import_superstruct2.string)()),
|
|
343
339
|
fields: (0, import_superstruct2.array)((0, import_superstruct2.string)()),
|
|
344
340
|
collapsible: (0, import_superstruct2.optional)((0, import_superstruct2.boolean)()),
|
|
345
341
|
defaultOpen: (0, import_superstruct2.optional)((0, import_superstruct2.boolean)()),
|
|
@@ -536,13 +532,124 @@ function crossValidateSetupLayout(layout, configSchema) {
|
|
|
536
532
|
return errors;
|
|
537
533
|
}
|
|
538
534
|
|
|
535
|
+
// src/ui.ts
|
|
536
|
+
var import_superstruct3 = require("superstruct");
|
|
537
|
+
var ContentBlockType = /* @__PURE__ */ ((ContentBlockType2) => {
|
|
538
|
+
ContentBlockType2["Text"] = "text";
|
|
539
|
+
ContentBlockType2["Banner"] = "banner";
|
|
540
|
+
ContentBlockType2["Badge"] = "badge";
|
|
541
|
+
ContentBlockType2["KeyValue"] = "keyValue";
|
|
542
|
+
ContentBlockType2["CopyField"] = "copyField";
|
|
543
|
+
ContentBlockType2["Link"] = "link";
|
|
544
|
+
ContentBlockType2["Divider"] = "divider";
|
|
545
|
+
ContentBlockType2["Action"] = "action";
|
|
546
|
+
ContentBlockType2["Card"] = "card";
|
|
547
|
+
return ContentBlockType2;
|
|
548
|
+
})(ContentBlockType || {});
|
|
549
|
+
var ContentActionVariant = /* @__PURE__ */ ((ContentActionVariant2) => {
|
|
550
|
+
ContentActionVariant2["Primary"] = "primary";
|
|
551
|
+
ContentActionVariant2["Secondary"] = "secondary";
|
|
552
|
+
ContentActionVariant2["Danger"] = "danger";
|
|
553
|
+
return ContentActionVariant2;
|
|
554
|
+
})(ContentActionVariant || {});
|
|
555
|
+
var sMessageVariant2 = (0, import_superstruct3.enums)(Object.values(MessageVariant));
|
|
556
|
+
var sContentActionVariant = (0, import_superstruct3.enums)(Object.values(ContentActionVariant));
|
|
557
|
+
var sTextBlock = (0, import_superstruct3.object)({
|
|
558
|
+
type: (0, import_superstruct3.literal)("text" /* Text */),
|
|
559
|
+
content: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
560
|
+
computedKey: (0, import_superstruct3.optional)((0, import_superstruct3.string)())
|
|
561
|
+
});
|
|
562
|
+
var sBannerBlock2 = (0, import_superstruct3.object)({
|
|
563
|
+
type: (0, import_superstruct3.literal)("banner" /* Banner */),
|
|
564
|
+
variant: sMessageVariant2,
|
|
565
|
+
title: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
566
|
+
text: (0, import_superstruct3.string)()
|
|
567
|
+
});
|
|
568
|
+
var sBadgeBlock = (0, import_superstruct3.object)({
|
|
569
|
+
type: (0, import_superstruct3.literal)("badge" /* Badge */),
|
|
570
|
+
variant: sMessageVariant2,
|
|
571
|
+
text: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
572
|
+
computedKey: (0, import_superstruct3.optional)((0, import_superstruct3.string)())
|
|
573
|
+
});
|
|
574
|
+
var sKeyValueBlock2 = (0, import_superstruct3.object)({
|
|
575
|
+
type: (0, import_superstruct3.literal)("keyValue" /* KeyValue */),
|
|
576
|
+
rows: (0, import_superstruct3.array)(
|
|
577
|
+
(0, import_superstruct3.object)({
|
|
578
|
+
label: (0, import_superstruct3.string)(),
|
|
579
|
+
value: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
580
|
+
computedKey: (0, import_superstruct3.optional)((0, import_superstruct3.string)())
|
|
581
|
+
})
|
|
582
|
+
)
|
|
583
|
+
});
|
|
584
|
+
var sCopyFieldBlock2 = (0, import_superstruct3.object)({
|
|
585
|
+
type: (0, import_superstruct3.literal)("copyField" /* CopyField */),
|
|
586
|
+
label: (0, import_superstruct3.string)(),
|
|
587
|
+
value: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
588
|
+
computedKey: (0, import_superstruct3.optional)((0, import_superstruct3.string)())
|
|
589
|
+
});
|
|
590
|
+
var sLinkBlock = (0, import_superstruct3.object)({
|
|
591
|
+
type: (0, import_superstruct3.literal)("link" /* Link */),
|
|
592
|
+
label: (0, import_superstruct3.string)(),
|
|
593
|
+
href: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
594
|
+
computedKey: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
595
|
+
external: (0, import_superstruct3.optional)((0, import_superstruct3.boolean)())
|
|
596
|
+
});
|
|
597
|
+
var sDividerBlock2 = (0, import_superstruct3.object)({ type: (0, import_superstruct3.literal)("divider" /* Divider */) });
|
|
598
|
+
var sActionBlock2 = (0, import_superstruct3.object)({
|
|
599
|
+
type: (0, import_superstruct3.literal)("action" /* Action */),
|
|
600
|
+
id: (0, import_superstruct3.string)(),
|
|
601
|
+
label: (0, import_superstruct3.string)(),
|
|
602
|
+
variant: (0, import_superstruct3.optional)(sContentActionVariant)
|
|
603
|
+
});
|
|
604
|
+
var sCardBlock2 = (0, import_superstruct3.object)({
|
|
605
|
+
type: (0, import_superstruct3.literal)("card" /* Card */),
|
|
606
|
+
title: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
607
|
+
description: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
608
|
+
blocks: (0, import_superstruct3.array)((0, import_superstruct3.lazy)(() => sContentBlock))
|
|
609
|
+
});
|
|
610
|
+
var sContentBlock = (0, import_superstruct3.union)([
|
|
611
|
+
sTextBlock,
|
|
612
|
+
sBannerBlock2,
|
|
613
|
+
sBadgeBlock,
|
|
614
|
+
sKeyValueBlock2,
|
|
615
|
+
sCopyFieldBlock2,
|
|
616
|
+
sLinkBlock,
|
|
617
|
+
sDividerBlock2,
|
|
618
|
+
sActionBlock2,
|
|
619
|
+
sCardBlock2
|
|
620
|
+
]);
|
|
621
|
+
var sUiContribution = (0, import_superstruct3.object)({
|
|
622
|
+
slot: (0, import_superstruct3.string)(),
|
|
623
|
+
blocks: (0, import_superstruct3.array)(sContentBlock),
|
|
624
|
+
order: (0, import_superstruct3.optional)((0, import_superstruct3.number)())
|
|
625
|
+
});
|
|
626
|
+
function validateUiContributions(input) {
|
|
627
|
+
const [error, result] = (0, import_superstruct3.validate)(input, (0, import_superstruct3.array)(sUiContribution));
|
|
628
|
+
if (error) {
|
|
629
|
+
return {
|
|
630
|
+
success: false,
|
|
631
|
+
errors: error.failures().map((f) => {
|
|
632
|
+
const path = f.path.join(".");
|
|
633
|
+
return path ? `${path}: ${f.message}` : f.message;
|
|
634
|
+
})
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
return { success: true, data: result };
|
|
638
|
+
}
|
|
639
|
+
|
|
539
640
|
// src/capability.ts
|
|
540
641
|
var CapabilityKind = {
|
|
541
642
|
Payment: "payment",
|
|
542
643
|
Shipping: "shipping",
|
|
543
644
|
Suppliers: "suppliers",
|
|
544
645
|
Analytics: "analytics",
|
|
545
|
-
Invoicing: "invoicing"
|
|
646
|
+
Invoicing: "invoicing",
|
|
647
|
+
/**
|
|
648
|
+
* Cross-cutting DISPLAY capability: a plugin of ANY surface may ALSO expose
|
|
649
|
+
* `ui` to contribute declarative blocks into host slots. Not a catalog
|
|
650
|
+
* "surface" — the host's AppSurface derivation excludes it on purpose.
|
|
651
|
+
*/
|
|
652
|
+
Ui: "ui"
|
|
546
653
|
};
|
|
547
654
|
function capability(kind, impl) {
|
|
548
655
|
return { kind, impl };
|
|
@@ -562,6 +669,9 @@ function analyticsCapability(impl) {
|
|
|
562
669
|
function invoicingCapability(impl) {
|
|
563
670
|
return { kind: CapabilityKind.Invoicing, impl };
|
|
564
671
|
}
|
|
672
|
+
function uiCapability(impl) {
|
|
673
|
+
return { kind: CapabilityKind.Ui, impl };
|
|
674
|
+
}
|
|
565
675
|
var PLUGIN_FACTORY_BRAND = /* @__PURE__ */ Symbol.for("vivoa.plugin.factory");
|
|
566
676
|
function definePlugin(factory) {
|
|
567
677
|
Object.defineProperty(factory, PLUGIN_FACTORY_BRAND, {
|
|
@@ -607,7 +717,7 @@ function checkPermissions(required, grantedRaw) {
|
|
|
607
717
|
}
|
|
608
718
|
|
|
609
719
|
// src/version.ts
|
|
610
|
-
var SDK_VERSION = "0.6.
|
|
720
|
+
var SDK_VERSION = "0.6.8";
|
|
611
721
|
function isSdkCompatible(pluginSdkVersion, hostSdkVersion) {
|
|
612
722
|
const parse = (v) => {
|
|
613
723
|
const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v);
|
|
@@ -632,6 +742,8 @@ function isSdkCompatible(pluginSdkVersion, hostSdkVersion) {
|
|
|
632
742
|
CapabilityKind,
|
|
633
743
|
CodFeeType,
|
|
634
744
|
ConfigScope,
|
|
745
|
+
ContentActionVariant,
|
|
746
|
+
ContentBlockType,
|
|
635
747
|
FieldType,
|
|
636
748
|
FieldVariant,
|
|
637
749
|
GatewayEnvironment,
|
|
@@ -642,7 +754,6 @@ function isSdkCompatible(pluginSdkVersion, hostSdkVersion) {
|
|
|
642
754
|
LayoutMode,
|
|
643
755
|
MessageVariant,
|
|
644
756
|
PAYMENT_PLUGIN_TOKEN,
|
|
645
|
-
PluginType,
|
|
646
757
|
RepeaterSource,
|
|
647
758
|
SDK_VERSION,
|
|
648
759
|
SHIPPING_PLUGIN_TOKEN,
|
|
@@ -667,6 +778,8 @@ function isSdkCompatible(pluginSdkVersion, hostSdkVersion) {
|
|
|
667
778
|
paymentCapability,
|
|
668
779
|
shippingCapability,
|
|
669
780
|
suppliersCapability,
|
|
781
|
+
uiCapability,
|
|
670
782
|
validatePluginAuthor,
|
|
671
|
-
validateSetupLayout
|
|
783
|
+
validateSetupLayout,
|
|
784
|
+
validateUiContributions
|
|
672
785
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -12,14 +12,6 @@ var ANALYTICS_PLUGIN_TOKEN = "ANALYTICS_PLUGINS";
|
|
|
12
12
|
var INVOICING_PLUGIN_TOKEN = "INVOICING_PLUGINS";
|
|
13
13
|
|
|
14
14
|
// src/plugin.ts
|
|
15
|
-
var PluginType = /* @__PURE__ */ ((PluginType2) => {
|
|
16
|
-
PluginType2["Payment"] = "payment";
|
|
17
|
-
PluginType2["Shipping"] = "shipping";
|
|
18
|
-
PluginType2["Analytics"] = "analytics";
|
|
19
|
-
PluginType2["Invoicing"] = "invoicing";
|
|
20
|
-
PluginType2["Generic"] = "generic";
|
|
21
|
-
return PluginType2;
|
|
22
|
-
})(PluginType || {});
|
|
23
15
|
var MessageVariant = /* @__PURE__ */ ((MessageVariant2) => {
|
|
24
16
|
MessageVariant2["Info"] = "info";
|
|
25
17
|
MessageVariant2["Warning"] = "warning";
|
|
@@ -297,6 +289,7 @@ var sGroupBlock = object({
|
|
|
297
289
|
type: literal("group" /* Group */),
|
|
298
290
|
title: string2(),
|
|
299
291
|
description: optional2(string2()),
|
|
292
|
+
helpUrl: optional2(string2()),
|
|
300
293
|
fields: array(string2()),
|
|
301
294
|
collapsible: optional2(boolean2()),
|
|
302
295
|
defaultOpen: optional2(boolean2()),
|
|
@@ -493,13 +486,136 @@ function crossValidateSetupLayout(layout, configSchema) {
|
|
|
493
486
|
return errors;
|
|
494
487
|
}
|
|
495
488
|
|
|
489
|
+
// src/ui.ts
|
|
490
|
+
import {
|
|
491
|
+
array as array2,
|
|
492
|
+
boolean as boolean3,
|
|
493
|
+
enums as enums3,
|
|
494
|
+
lazy as lazy2,
|
|
495
|
+
literal as literal2,
|
|
496
|
+
number as number3,
|
|
497
|
+
object as object2,
|
|
498
|
+
optional as optional3,
|
|
499
|
+
string as string3,
|
|
500
|
+
union as union2,
|
|
501
|
+
validate as validate3
|
|
502
|
+
} from "superstruct";
|
|
503
|
+
var ContentBlockType = /* @__PURE__ */ ((ContentBlockType2) => {
|
|
504
|
+
ContentBlockType2["Text"] = "text";
|
|
505
|
+
ContentBlockType2["Banner"] = "banner";
|
|
506
|
+
ContentBlockType2["Badge"] = "badge";
|
|
507
|
+
ContentBlockType2["KeyValue"] = "keyValue";
|
|
508
|
+
ContentBlockType2["CopyField"] = "copyField";
|
|
509
|
+
ContentBlockType2["Link"] = "link";
|
|
510
|
+
ContentBlockType2["Divider"] = "divider";
|
|
511
|
+
ContentBlockType2["Action"] = "action";
|
|
512
|
+
ContentBlockType2["Card"] = "card";
|
|
513
|
+
return ContentBlockType2;
|
|
514
|
+
})(ContentBlockType || {});
|
|
515
|
+
var ContentActionVariant = /* @__PURE__ */ ((ContentActionVariant2) => {
|
|
516
|
+
ContentActionVariant2["Primary"] = "primary";
|
|
517
|
+
ContentActionVariant2["Secondary"] = "secondary";
|
|
518
|
+
ContentActionVariant2["Danger"] = "danger";
|
|
519
|
+
return ContentActionVariant2;
|
|
520
|
+
})(ContentActionVariant || {});
|
|
521
|
+
var sMessageVariant2 = enums3(Object.values(MessageVariant));
|
|
522
|
+
var sContentActionVariant = enums3(Object.values(ContentActionVariant));
|
|
523
|
+
var sTextBlock = object2({
|
|
524
|
+
type: literal2("text" /* Text */),
|
|
525
|
+
content: optional3(string3()),
|
|
526
|
+
computedKey: optional3(string3())
|
|
527
|
+
});
|
|
528
|
+
var sBannerBlock2 = object2({
|
|
529
|
+
type: literal2("banner" /* Banner */),
|
|
530
|
+
variant: sMessageVariant2,
|
|
531
|
+
title: optional3(string3()),
|
|
532
|
+
text: string3()
|
|
533
|
+
});
|
|
534
|
+
var sBadgeBlock = object2({
|
|
535
|
+
type: literal2("badge" /* Badge */),
|
|
536
|
+
variant: sMessageVariant2,
|
|
537
|
+
text: optional3(string3()),
|
|
538
|
+
computedKey: optional3(string3())
|
|
539
|
+
});
|
|
540
|
+
var sKeyValueBlock2 = object2({
|
|
541
|
+
type: literal2("keyValue" /* KeyValue */),
|
|
542
|
+
rows: array2(
|
|
543
|
+
object2({
|
|
544
|
+
label: string3(),
|
|
545
|
+
value: optional3(string3()),
|
|
546
|
+
computedKey: optional3(string3())
|
|
547
|
+
})
|
|
548
|
+
)
|
|
549
|
+
});
|
|
550
|
+
var sCopyFieldBlock2 = object2({
|
|
551
|
+
type: literal2("copyField" /* CopyField */),
|
|
552
|
+
label: string3(),
|
|
553
|
+
value: optional3(string3()),
|
|
554
|
+
computedKey: optional3(string3())
|
|
555
|
+
});
|
|
556
|
+
var sLinkBlock = object2({
|
|
557
|
+
type: literal2("link" /* Link */),
|
|
558
|
+
label: string3(),
|
|
559
|
+
href: optional3(string3()),
|
|
560
|
+
computedKey: optional3(string3()),
|
|
561
|
+
external: optional3(boolean3())
|
|
562
|
+
});
|
|
563
|
+
var sDividerBlock2 = object2({ type: literal2("divider" /* Divider */) });
|
|
564
|
+
var sActionBlock2 = object2({
|
|
565
|
+
type: literal2("action" /* Action */),
|
|
566
|
+
id: string3(),
|
|
567
|
+
label: string3(),
|
|
568
|
+
variant: optional3(sContentActionVariant)
|
|
569
|
+
});
|
|
570
|
+
var sCardBlock2 = object2({
|
|
571
|
+
type: literal2("card" /* Card */),
|
|
572
|
+
title: optional3(string3()),
|
|
573
|
+
description: optional3(string3()),
|
|
574
|
+
blocks: array2(lazy2(() => sContentBlock))
|
|
575
|
+
});
|
|
576
|
+
var sContentBlock = union2([
|
|
577
|
+
sTextBlock,
|
|
578
|
+
sBannerBlock2,
|
|
579
|
+
sBadgeBlock,
|
|
580
|
+
sKeyValueBlock2,
|
|
581
|
+
sCopyFieldBlock2,
|
|
582
|
+
sLinkBlock,
|
|
583
|
+
sDividerBlock2,
|
|
584
|
+
sActionBlock2,
|
|
585
|
+
sCardBlock2
|
|
586
|
+
]);
|
|
587
|
+
var sUiContribution = object2({
|
|
588
|
+
slot: string3(),
|
|
589
|
+
blocks: array2(sContentBlock),
|
|
590
|
+
order: optional3(number3())
|
|
591
|
+
});
|
|
592
|
+
function validateUiContributions(input) {
|
|
593
|
+
const [error, result] = validate3(input, array2(sUiContribution));
|
|
594
|
+
if (error) {
|
|
595
|
+
return {
|
|
596
|
+
success: false,
|
|
597
|
+
errors: error.failures().map((f) => {
|
|
598
|
+
const path = f.path.join(".");
|
|
599
|
+
return path ? `${path}: ${f.message}` : f.message;
|
|
600
|
+
})
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
return { success: true, data: result };
|
|
604
|
+
}
|
|
605
|
+
|
|
496
606
|
// src/capability.ts
|
|
497
607
|
var CapabilityKind = {
|
|
498
608
|
Payment: "payment",
|
|
499
609
|
Shipping: "shipping",
|
|
500
610
|
Suppliers: "suppliers",
|
|
501
611
|
Analytics: "analytics",
|
|
502
|
-
Invoicing: "invoicing"
|
|
612
|
+
Invoicing: "invoicing",
|
|
613
|
+
/**
|
|
614
|
+
* Cross-cutting DISPLAY capability: a plugin of ANY surface may ALSO expose
|
|
615
|
+
* `ui` to contribute declarative blocks into host slots. Not a catalog
|
|
616
|
+
* "surface" — the host's AppSurface derivation excludes it on purpose.
|
|
617
|
+
*/
|
|
618
|
+
Ui: "ui"
|
|
503
619
|
};
|
|
504
620
|
function capability(kind, impl) {
|
|
505
621
|
return { kind, impl };
|
|
@@ -519,6 +635,9 @@ function analyticsCapability(impl) {
|
|
|
519
635
|
function invoicingCapability(impl) {
|
|
520
636
|
return { kind: CapabilityKind.Invoicing, impl };
|
|
521
637
|
}
|
|
638
|
+
function uiCapability(impl) {
|
|
639
|
+
return { kind: CapabilityKind.Ui, impl };
|
|
640
|
+
}
|
|
522
641
|
var PLUGIN_FACTORY_BRAND = /* @__PURE__ */ Symbol.for("vivoa.plugin.factory");
|
|
523
642
|
function definePlugin(factory) {
|
|
524
643
|
Object.defineProperty(factory, PLUGIN_FACTORY_BRAND, {
|
|
@@ -532,7 +651,7 @@ function isPluginFactory(value) {
|
|
|
532
651
|
}
|
|
533
652
|
|
|
534
653
|
// src/version.ts
|
|
535
|
-
var SDK_VERSION = "0.6.
|
|
654
|
+
var SDK_VERSION = "0.6.8";
|
|
536
655
|
function isSdkCompatible(pluginSdkVersion, hostSdkVersion) {
|
|
537
656
|
const parse = (v) => {
|
|
538
657
|
const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v);
|
|
@@ -556,6 +675,8 @@ export {
|
|
|
556
675
|
CapabilityKind,
|
|
557
676
|
CodFeeType,
|
|
558
677
|
ConfigScope,
|
|
678
|
+
ContentActionVariant,
|
|
679
|
+
ContentBlockType,
|
|
559
680
|
FieldType,
|
|
560
681
|
FieldVariant,
|
|
561
682
|
GatewayEnvironment,
|
|
@@ -566,7 +687,6 @@ export {
|
|
|
566
687
|
LayoutMode,
|
|
567
688
|
MessageVariant,
|
|
568
689
|
PAYMENT_PLUGIN_TOKEN,
|
|
569
|
-
PluginType,
|
|
570
690
|
RepeaterSource,
|
|
571
691
|
SDK_VERSION,
|
|
572
692
|
SHIPPING_PLUGIN_TOKEN,
|
|
@@ -591,6 +711,8 @@ export {
|
|
|
591
711
|
paymentCapability,
|
|
592
712
|
shippingCapability,
|
|
593
713
|
suppliersCapability,
|
|
714
|
+
uiCapability,
|
|
594
715
|
validatePluginAuthor,
|
|
595
|
-
validateSetupLayout
|
|
716
|
+
validateSetupLayout,
|
|
717
|
+
validateUiContributions
|
|
596
718
|
};
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as HostApi, a0 as HttpRequest, R as DomainEventName, u as Capability, Q as DomainEventHandler, a1 as HttpResponse, N as DispatchContext } from '../host-api-BbIT_sLc.mjs';
|
|
2
2
|
|
|
3
3
|
/** Every recorded interaction, keyed by `"port.method"`. */
|
|
4
4
|
interface MockHostCalls {
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as HostApi, a0 as HttpRequest, R as DomainEventName, u as Capability, Q as DomainEventHandler, a1 as HttpResponse, N as DispatchContext } from '../host-api-BbIT_sLc.js';
|
|
2
2
|
|
|
3
3
|
/** Every recorded interaction, keyed by `"port.method"`. */
|
|
4
4
|
interface MockHostCalls {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vivoa/plugin-sdk",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"description": "Public contracts for Vivoa plugins (types, DI tokens, config + setup-layout validators)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Vivoa",
|
|
@@ -39,6 +39,14 @@
|
|
|
39
39
|
"registry": "https://registry.npmjs.org",
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsup src/index.ts src/testing/index.ts --format cjs,esm --dts --clean --target node18",
|
|
44
|
+
"dev": "tsup src/index.ts src/testing/index.ts --format cjs,esm --dts --watch --target node18",
|
|
45
|
+
"test": "vitest run",
|
|
46
|
+
"test:watch": "vitest",
|
|
47
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
48
|
+
"prepublishOnly": "pnpm run typecheck && pnpm run test && pnpm run build"
|
|
49
|
+
},
|
|
42
50
|
"dependencies": {
|
|
43
51
|
"superstruct": "^2.0.2"
|
|
44
52
|
},
|
|
@@ -47,12 +55,5 @@
|
|
|
47
55
|
"tsup": "^8.3.5",
|
|
48
56
|
"typescript": "^5.7.3",
|
|
49
57
|
"vitest": "^2.1.8"
|
|
50
|
-
},
|
|
51
|
-
"scripts": {
|
|
52
|
-
"build": "tsup src/index.ts src/testing/index.ts --format cjs,esm --dts --clean --target node18",
|
|
53
|
-
"dev": "tsup src/index.ts src/testing/index.ts --format cjs,esm --dts --watch --target node18",
|
|
54
|
-
"test": "vitest run",
|
|
55
|
-
"test:watch": "vitest",
|
|
56
|
-
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
57
58
|
}
|
|
58
|
-
}
|
|
59
|
+
}
|