@vivoa/plugin-sdk 0.6.6 → 0.6.7
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-yX49e7zE.d.mts} +135 -18
- package/dist/{host-api-C1VylW5l.d.ts → host-api-yX49e7zE.d.ts} +135 -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",
|
|
@@ -608,6 +604,8 @@ interface ShippingStaticConfig {
|
|
|
608
604
|
displayName: string;
|
|
609
605
|
description: string;
|
|
610
606
|
iconUrl?: string;
|
|
607
|
+
authorName?: string;
|
|
608
|
+
authorUrl?: string;
|
|
611
609
|
supportedCountries: string[];
|
|
612
610
|
supportedFeatures: ShippingFeature[];
|
|
613
611
|
configSchema: PluginConfigField[];
|
|
@@ -750,6 +748,8 @@ interface SuppliersStaticConfig {
|
|
|
750
748
|
displayName: string;
|
|
751
749
|
description: string;
|
|
752
750
|
iconUrl?: string;
|
|
751
|
+
authorName?: string;
|
|
752
|
+
authorUrl?: string;
|
|
753
753
|
supportedCountries: string[];
|
|
754
754
|
supportedCapabilities: SuppliersFeature[];
|
|
755
755
|
configSchema: PluginConfigField[];
|
|
@@ -1054,6 +1054,8 @@ interface AnalyticsStaticConfig {
|
|
|
1054
1054
|
displayName: string;
|
|
1055
1055
|
description: string;
|
|
1056
1056
|
iconUrl?: string;
|
|
1057
|
+
authorName?: string;
|
|
1058
|
+
authorUrl?: string;
|
|
1057
1059
|
supportedCapabilities: AnalyticsFeature[];
|
|
1058
1060
|
configSchema: PluginConfigField[];
|
|
1059
1061
|
}
|
|
@@ -1257,6 +1259,8 @@ interface InvoicingStaticConfig {
|
|
|
1257
1259
|
displayName: string;
|
|
1258
1260
|
description: string;
|
|
1259
1261
|
iconUrl?: string;
|
|
1262
|
+
authorName?: string;
|
|
1263
|
+
authorUrl?: string;
|
|
1260
1264
|
supportedCountries: string[];
|
|
1261
1265
|
supportedFeatures: InvoicingFeature[];
|
|
1262
1266
|
supportedDocumentTypes: InvoiceDocumentType[];
|
|
@@ -1290,6 +1294,112 @@ interface IInvoicingPlugin extends IPlugin {
|
|
|
1290
1294
|
isConfigured?(ctx: DispatchContext): boolean;
|
|
1291
1295
|
}
|
|
1292
1296
|
|
|
1297
|
+
declare enum ContentBlockType {
|
|
1298
|
+
Text = "text",
|
|
1299
|
+
Banner = "banner",
|
|
1300
|
+
Badge = "badge",
|
|
1301
|
+
KeyValue = "keyValue",
|
|
1302
|
+
CopyField = "copyField",
|
|
1303
|
+
Link = "link",
|
|
1304
|
+
Divider = "divider",
|
|
1305
|
+
Action = "action",
|
|
1306
|
+
Card = "card"
|
|
1307
|
+
}
|
|
1308
|
+
declare enum ContentActionVariant {
|
|
1309
|
+
Primary = "primary",
|
|
1310
|
+
Secondary = "secondary",
|
|
1311
|
+
Danger = "danger"
|
|
1312
|
+
}
|
|
1313
|
+
/** Markdown/plain paragraph. Literal `content` or host-resolved `computedKey`. */
|
|
1314
|
+
interface TextBlock {
|
|
1315
|
+
type: ContentBlockType.Text;
|
|
1316
|
+
content?: string;
|
|
1317
|
+
computedKey?: string;
|
|
1318
|
+
}
|
|
1319
|
+
/** Prominent variant-styled message. */
|
|
1320
|
+
interface BannerBlock {
|
|
1321
|
+
type: ContentBlockType.Banner;
|
|
1322
|
+
variant: MessageVariant;
|
|
1323
|
+
title?: string;
|
|
1324
|
+
text: string;
|
|
1325
|
+
}
|
|
1326
|
+
/** Inline status pill. Literal `text` or host-resolved `computedKey`. */
|
|
1327
|
+
interface BadgeBlock {
|
|
1328
|
+
type: ContentBlockType.Badge;
|
|
1329
|
+
variant: MessageVariant;
|
|
1330
|
+
text?: string;
|
|
1331
|
+
computedKey?: string;
|
|
1332
|
+
}
|
|
1333
|
+
interface KeyValueRow {
|
|
1334
|
+
label: string;
|
|
1335
|
+
value?: string;
|
|
1336
|
+
computedKey?: string;
|
|
1337
|
+
}
|
|
1338
|
+
/** Read-only label/value list. */
|
|
1339
|
+
interface KeyValueBlock {
|
|
1340
|
+
type: ContentBlockType.KeyValue;
|
|
1341
|
+
rows: KeyValueRow[];
|
|
1342
|
+
}
|
|
1343
|
+
/** Read-only value with a copy affordance. Literal or host-resolved. */
|
|
1344
|
+
interface CopyFieldBlock {
|
|
1345
|
+
type: ContentBlockType.CopyField;
|
|
1346
|
+
label: string;
|
|
1347
|
+
value?: string;
|
|
1348
|
+
computedKey?: string;
|
|
1349
|
+
}
|
|
1350
|
+
/** Hyperlink (e.g. "Descargar PDF"). `href` literal or host-resolved. */
|
|
1351
|
+
interface LinkBlock {
|
|
1352
|
+
type: ContentBlockType.Link;
|
|
1353
|
+
label: string;
|
|
1354
|
+
href?: string;
|
|
1355
|
+
computedKey?: string;
|
|
1356
|
+
external?: boolean;
|
|
1357
|
+
}
|
|
1358
|
+
interface DividerBlock {
|
|
1359
|
+
type: ContentBlockType.Divider;
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* Triggers a plugin action. `id` matches a `manifest.setup.actions[id]`; the
|
|
1363
|
+
* host dispatches it through the SAME runtime path as a setup-screen action
|
|
1364
|
+
* (invokeAction), so a contribution reuses the plugin's existing action surface.
|
|
1365
|
+
*/
|
|
1366
|
+
interface ActionBlock {
|
|
1367
|
+
type: ContentBlockType.Action;
|
|
1368
|
+
id: string;
|
|
1369
|
+
label: string;
|
|
1370
|
+
variant?: ContentActionVariant;
|
|
1371
|
+
}
|
|
1372
|
+
/** Titled container. Recurses into child `blocks`. */
|
|
1373
|
+
interface CardBlock {
|
|
1374
|
+
type: ContentBlockType.Card;
|
|
1375
|
+
title?: string;
|
|
1376
|
+
description?: string;
|
|
1377
|
+
blocks: ContentBlock[];
|
|
1378
|
+
}
|
|
1379
|
+
type ContentBlock = TextBlock | BannerBlock | BadgeBlock | KeyValueBlock | CopyFieldBlock | LinkBlock | DividerBlock | ActionBlock | CardBlock;
|
|
1380
|
+
/**
|
|
1381
|
+
* One block tree the plugin injects into a host slot. `slot` names a host-owned
|
|
1382
|
+
* target (e.g. "admin:order.detail.sidebar", "storefront:product.below"); the
|
|
1383
|
+
* set of valid slots is owned by the host, not the SDK. `order` breaks ties when
|
|
1384
|
+
* several plugins target the same slot (ascending; absent sorts last).
|
|
1385
|
+
*/
|
|
1386
|
+
interface UiContribution {
|
|
1387
|
+
slot: string;
|
|
1388
|
+
blocks: ContentBlock[];
|
|
1389
|
+
order?: number;
|
|
1390
|
+
}
|
|
1391
|
+
/** Impl behind a `ui` capability — the static set a plugin declares up front. */
|
|
1392
|
+
interface IUiPlugin {
|
|
1393
|
+
readonly contributions: UiContribution[];
|
|
1394
|
+
}
|
|
1395
|
+
interface UiContributionsValidation {
|
|
1396
|
+
success: boolean;
|
|
1397
|
+
data?: UiContribution[];
|
|
1398
|
+
errors?: string[];
|
|
1399
|
+
}
|
|
1400
|
+
/** Validates a plugin's declared contributions, including recursive cards. */
|
|
1401
|
+
declare function validateUiContributions(input: unknown): UiContributionsValidation;
|
|
1402
|
+
|
|
1293
1403
|
/** A named unit of behaviour a plugin exposes to the host registry. */
|
|
1294
1404
|
interface Capability<T = unknown> {
|
|
1295
1405
|
kind: string;
|
|
@@ -1306,6 +1416,12 @@ declare const CapabilityKind: {
|
|
|
1306
1416
|
readonly Suppliers: "suppliers";
|
|
1307
1417
|
readonly Analytics: "analytics";
|
|
1308
1418
|
readonly Invoicing: "invoicing";
|
|
1419
|
+
/**
|
|
1420
|
+
* Cross-cutting DISPLAY capability: a plugin of ANY surface may ALSO expose
|
|
1421
|
+
* `ui` to contribute declarative blocks into host slots. Not a catalog
|
|
1422
|
+
* "surface" — the host's AppSurface derivation excludes it on purpose.
|
|
1423
|
+
*/
|
|
1424
|
+
readonly Ui: "ui";
|
|
1309
1425
|
};
|
|
1310
1426
|
type CapabilityKind = (typeof CapabilityKind)[keyof typeof CapabilityKind];
|
|
1311
1427
|
declare function capability<T>(kind: string, impl: T): Capability<T>;
|
|
@@ -1314,6 +1430,7 @@ declare function shippingCapability(impl: IShippingPlugin): Capability<IShipping
|
|
|
1314
1430
|
declare function suppliersCapability(impl: ISuppliersPlugin): Capability<ISuppliersPlugin>;
|
|
1315
1431
|
declare function analyticsCapability(impl: IAnalyticsPlugin): Capability<IAnalyticsPlugin>;
|
|
1316
1432
|
declare function invoicingCapability(impl: IInvoicingPlugin): Capability<IInvoicingPlugin>;
|
|
1433
|
+
declare function uiCapability(impl: IUiPlugin): Capability<IUiPlugin>;
|
|
1317
1434
|
/**
|
|
1318
1435
|
* A constructed plugin. `capabilities` is the static declaration the host reads
|
|
1319
1436
|
* up front; `onActivate` runs when the host mounts the plugin for a tenant and
|
|
@@ -1413,4 +1530,4 @@ interface HostApi {
|
|
|
1413
1530
|
registerCapability<T = unknown>(cap: Capability<T>): void;
|
|
1414
1531
|
}
|
|
1415
1532
|
|
|
1416
|
-
export { type
|
|
1533
|
+
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, StepStatusFrom 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 PaymentSessionResult as aA, type PaymentVerifyPayload as aB, type PlaceSupplierOrderInput as aC, type Plugin as aD, type PluginActionContext as aE, type PluginActionResult as aF, type PluginAuthor as aG, type PluginConfigFieldDependency as aH, type PluginFactory as aI, type PluginManifest as aJ, type RepeaterBlock as aK, RepeaterSource as aL, type SecretStore as aM, type SequenceStore as aN, type SetupAction as aO, type SetupLayout as aP, type SetupLayoutValidation as aQ, type SetupStep as aR, type ShipmentAddress as aS, type ShipmentParcel as aT, type ShipmentResult as aU, type ShippingDefaultConfig as aV, ShippingFeature as aW, type ShippingPluginConfig as aX, type ShippingQuote as aY, type ShippingQuoteParams as aZ, type ShippingStaticConfig 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 PaymentCustomer as at, type PaymentGatewayCode as au, type PaymentPayload as av, type PaymentPluginConfig as aw, type PaymentRenderMode as ax, type PaymentResult as ay, type PaymentSessionPayload as az, type AccordionSection as b, type StepStatusFromAction as b0, type StepStatusFromFields as b1, type StepStatusSource as b2, type StorageBroker as b3, type SupplierCatalogQuery as b4, type SupplierFulfillmentEvent as b5, type SupplierListing as b6, type SupplierListingAttribute as b7, type SupplierListingPage as b8, type SupplierListingVariant as b9, isConfigurablePlugin as bA, isPluginFactory as bB, paymentCapability as bC, shippingCapability as bD, suppliersCapability as bE, uiCapability as bF, validatePluginAuthor as bG, validateSetupLayout as bH, validateUiContributions as bI, type SupplierMoney as ba, type SupplierOrderAddressLevel as bb, type SupplierOrderCustomer as bc, type SupplierOrderLine as bd, type SupplierOrderResult as be, type SupplierOrderStatus as bf, type SupplierShipTo as bg, type SupplierStock as bh, type SuppliersDefaultConfig as bi, SuppliersFeature as bj, type SuppliersPluginConfig as bk, type SuppliersStaticConfig as bl, type TabItem as bm, type TabsBlock as bn, type ToggleBlock as bo, type TrackingEvent as bp, TransactionStatus as bq, type UiContribution as br, type UiContributionsValidation as bs, type VoidInvoiceInput as bt, type WebhookSignatureResult as bu, analyticsCapability as bv, capability as bw, crossValidateSetupLayout as bx, definePlugin as by, invoicingCapability 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",
|
|
@@ -608,6 +604,8 @@ interface ShippingStaticConfig {
|
|
|
608
604
|
displayName: string;
|
|
609
605
|
description: string;
|
|
610
606
|
iconUrl?: string;
|
|
607
|
+
authorName?: string;
|
|
608
|
+
authorUrl?: string;
|
|
611
609
|
supportedCountries: string[];
|
|
612
610
|
supportedFeatures: ShippingFeature[];
|
|
613
611
|
configSchema: PluginConfigField[];
|
|
@@ -750,6 +748,8 @@ interface SuppliersStaticConfig {
|
|
|
750
748
|
displayName: string;
|
|
751
749
|
description: string;
|
|
752
750
|
iconUrl?: string;
|
|
751
|
+
authorName?: string;
|
|
752
|
+
authorUrl?: string;
|
|
753
753
|
supportedCountries: string[];
|
|
754
754
|
supportedCapabilities: SuppliersFeature[];
|
|
755
755
|
configSchema: PluginConfigField[];
|
|
@@ -1054,6 +1054,8 @@ interface AnalyticsStaticConfig {
|
|
|
1054
1054
|
displayName: string;
|
|
1055
1055
|
description: string;
|
|
1056
1056
|
iconUrl?: string;
|
|
1057
|
+
authorName?: string;
|
|
1058
|
+
authorUrl?: string;
|
|
1057
1059
|
supportedCapabilities: AnalyticsFeature[];
|
|
1058
1060
|
configSchema: PluginConfigField[];
|
|
1059
1061
|
}
|
|
@@ -1257,6 +1259,8 @@ interface InvoicingStaticConfig {
|
|
|
1257
1259
|
displayName: string;
|
|
1258
1260
|
description: string;
|
|
1259
1261
|
iconUrl?: string;
|
|
1262
|
+
authorName?: string;
|
|
1263
|
+
authorUrl?: string;
|
|
1260
1264
|
supportedCountries: string[];
|
|
1261
1265
|
supportedFeatures: InvoicingFeature[];
|
|
1262
1266
|
supportedDocumentTypes: InvoiceDocumentType[];
|
|
@@ -1290,6 +1294,112 @@ interface IInvoicingPlugin extends IPlugin {
|
|
|
1290
1294
|
isConfigured?(ctx: DispatchContext): boolean;
|
|
1291
1295
|
}
|
|
1292
1296
|
|
|
1297
|
+
declare enum ContentBlockType {
|
|
1298
|
+
Text = "text",
|
|
1299
|
+
Banner = "banner",
|
|
1300
|
+
Badge = "badge",
|
|
1301
|
+
KeyValue = "keyValue",
|
|
1302
|
+
CopyField = "copyField",
|
|
1303
|
+
Link = "link",
|
|
1304
|
+
Divider = "divider",
|
|
1305
|
+
Action = "action",
|
|
1306
|
+
Card = "card"
|
|
1307
|
+
}
|
|
1308
|
+
declare enum ContentActionVariant {
|
|
1309
|
+
Primary = "primary",
|
|
1310
|
+
Secondary = "secondary",
|
|
1311
|
+
Danger = "danger"
|
|
1312
|
+
}
|
|
1313
|
+
/** Markdown/plain paragraph. Literal `content` or host-resolved `computedKey`. */
|
|
1314
|
+
interface TextBlock {
|
|
1315
|
+
type: ContentBlockType.Text;
|
|
1316
|
+
content?: string;
|
|
1317
|
+
computedKey?: string;
|
|
1318
|
+
}
|
|
1319
|
+
/** Prominent variant-styled message. */
|
|
1320
|
+
interface BannerBlock {
|
|
1321
|
+
type: ContentBlockType.Banner;
|
|
1322
|
+
variant: MessageVariant;
|
|
1323
|
+
title?: string;
|
|
1324
|
+
text: string;
|
|
1325
|
+
}
|
|
1326
|
+
/** Inline status pill. Literal `text` or host-resolved `computedKey`. */
|
|
1327
|
+
interface BadgeBlock {
|
|
1328
|
+
type: ContentBlockType.Badge;
|
|
1329
|
+
variant: MessageVariant;
|
|
1330
|
+
text?: string;
|
|
1331
|
+
computedKey?: string;
|
|
1332
|
+
}
|
|
1333
|
+
interface KeyValueRow {
|
|
1334
|
+
label: string;
|
|
1335
|
+
value?: string;
|
|
1336
|
+
computedKey?: string;
|
|
1337
|
+
}
|
|
1338
|
+
/** Read-only label/value list. */
|
|
1339
|
+
interface KeyValueBlock {
|
|
1340
|
+
type: ContentBlockType.KeyValue;
|
|
1341
|
+
rows: KeyValueRow[];
|
|
1342
|
+
}
|
|
1343
|
+
/** Read-only value with a copy affordance. Literal or host-resolved. */
|
|
1344
|
+
interface CopyFieldBlock {
|
|
1345
|
+
type: ContentBlockType.CopyField;
|
|
1346
|
+
label: string;
|
|
1347
|
+
value?: string;
|
|
1348
|
+
computedKey?: string;
|
|
1349
|
+
}
|
|
1350
|
+
/** Hyperlink (e.g. "Descargar PDF"). `href` literal or host-resolved. */
|
|
1351
|
+
interface LinkBlock {
|
|
1352
|
+
type: ContentBlockType.Link;
|
|
1353
|
+
label: string;
|
|
1354
|
+
href?: string;
|
|
1355
|
+
computedKey?: string;
|
|
1356
|
+
external?: boolean;
|
|
1357
|
+
}
|
|
1358
|
+
interface DividerBlock {
|
|
1359
|
+
type: ContentBlockType.Divider;
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* Triggers a plugin action. `id` matches a `manifest.setup.actions[id]`; the
|
|
1363
|
+
* host dispatches it through the SAME runtime path as a setup-screen action
|
|
1364
|
+
* (invokeAction), so a contribution reuses the plugin's existing action surface.
|
|
1365
|
+
*/
|
|
1366
|
+
interface ActionBlock {
|
|
1367
|
+
type: ContentBlockType.Action;
|
|
1368
|
+
id: string;
|
|
1369
|
+
label: string;
|
|
1370
|
+
variant?: ContentActionVariant;
|
|
1371
|
+
}
|
|
1372
|
+
/** Titled container. Recurses into child `blocks`. */
|
|
1373
|
+
interface CardBlock {
|
|
1374
|
+
type: ContentBlockType.Card;
|
|
1375
|
+
title?: string;
|
|
1376
|
+
description?: string;
|
|
1377
|
+
blocks: ContentBlock[];
|
|
1378
|
+
}
|
|
1379
|
+
type ContentBlock = TextBlock | BannerBlock | BadgeBlock | KeyValueBlock | CopyFieldBlock | LinkBlock | DividerBlock | ActionBlock | CardBlock;
|
|
1380
|
+
/**
|
|
1381
|
+
* One block tree the plugin injects into a host slot. `slot` names a host-owned
|
|
1382
|
+
* target (e.g. "admin:order.detail.sidebar", "storefront:product.below"); the
|
|
1383
|
+
* set of valid slots is owned by the host, not the SDK. `order` breaks ties when
|
|
1384
|
+
* several plugins target the same slot (ascending; absent sorts last).
|
|
1385
|
+
*/
|
|
1386
|
+
interface UiContribution {
|
|
1387
|
+
slot: string;
|
|
1388
|
+
blocks: ContentBlock[];
|
|
1389
|
+
order?: number;
|
|
1390
|
+
}
|
|
1391
|
+
/** Impl behind a `ui` capability — the static set a plugin declares up front. */
|
|
1392
|
+
interface IUiPlugin {
|
|
1393
|
+
readonly contributions: UiContribution[];
|
|
1394
|
+
}
|
|
1395
|
+
interface UiContributionsValidation {
|
|
1396
|
+
success: boolean;
|
|
1397
|
+
data?: UiContribution[];
|
|
1398
|
+
errors?: string[];
|
|
1399
|
+
}
|
|
1400
|
+
/** Validates a plugin's declared contributions, including recursive cards. */
|
|
1401
|
+
declare function validateUiContributions(input: unknown): UiContributionsValidation;
|
|
1402
|
+
|
|
1293
1403
|
/** A named unit of behaviour a plugin exposes to the host registry. */
|
|
1294
1404
|
interface Capability<T = unknown> {
|
|
1295
1405
|
kind: string;
|
|
@@ -1306,6 +1416,12 @@ declare const CapabilityKind: {
|
|
|
1306
1416
|
readonly Suppliers: "suppliers";
|
|
1307
1417
|
readonly Analytics: "analytics";
|
|
1308
1418
|
readonly Invoicing: "invoicing";
|
|
1419
|
+
/**
|
|
1420
|
+
* Cross-cutting DISPLAY capability: a plugin of ANY surface may ALSO expose
|
|
1421
|
+
* `ui` to contribute declarative blocks into host slots. Not a catalog
|
|
1422
|
+
* "surface" — the host's AppSurface derivation excludes it on purpose.
|
|
1423
|
+
*/
|
|
1424
|
+
readonly Ui: "ui";
|
|
1309
1425
|
};
|
|
1310
1426
|
type CapabilityKind = (typeof CapabilityKind)[keyof typeof CapabilityKind];
|
|
1311
1427
|
declare function capability<T>(kind: string, impl: T): Capability<T>;
|
|
@@ -1314,6 +1430,7 @@ declare function shippingCapability(impl: IShippingPlugin): Capability<IShipping
|
|
|
1314
1430
|
declare function suppliersCapability(impl: ISuppliersPlugin): Capability<ISuppliersPlugin>;
|
|
1315
1431
|
declare function analyticsCapability(impl: IAnalyticsPlugin): Capability<IAnalyticsPlugin>;
|
|
1316
1432
|
declare function invoicingCapability(impl: IInvoicingPlugin): Capability<IInvoicingPlugin>;
|
|
1433
|
+
declare function uiCapability(impl: IUiPlugin): Capability<IUiPlugin>;
|
|
1317
1434
|
/**
|
|
1318
1435
|
* A constructed plugin. `capabilities` is the static declaration the host reads
|
|
1319
1436
|
* up front; `onActivate` runs when the host mounts the plugin for a tenant and
|
|
@@ -1413,4 +1530,4 @@ interface HostApi {
|
|
|
1413
1530
|
registerCapability<T = unknown>(cap: Capability<T>): void;
|
|
1414
1531
|
}
|
|
1415
1532
|
|
|
1416
|
-
export { type
|
|
1533
|
+
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, StepStatusFrom 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 PaymentSessionResult as aA, type PaymentVerifyPayload as aB, type PlaceSupplierOrderInput as aC, type Plugin as aD, type PluginActionContext as aE, type PluginActionResult as aF, type PluginAuthor as aG, type PluginConfigFieldDependency as aH, type PluginFactory as aI, type PluginManifest as aJ, type RepeaterBlock as aK, RepeaterSource as aL, type SecretStore as aM, type SequenceStore as aN, type SetupAction as aO, type SetupLayout as aP, type SetupLayoutValidation as aQ, type SetupStep as aR, type ShipmentAddress as aS, type ShipmentParcel as aT, type ShipmentResult as aU, type ShippingDefaultConfig as aV, ShippingFeature as aW, type ShippingPluginConfig as aX, type ShippingQuote as aY, type ShippingQuoteParams as aZ, type ShippingStaticConfig 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 PaymentCustomer as at, type PaymentGatewayCode as au, type PaymentPayload as av, type PaymentPluginConfig as aw, type PaymentRenderMode as ax, type PaymentResult as ay, type PaymentSessionPayload as az, type AccordionSection as b, type StepStatusFromAction as b0, type StepStatusFromFields as b1, type StepStatusSource as b2, type StorageBroker as b3, type SupplierCatalogQuery as b4, type SupplierFulfillmentEvent as b5, type SupplierListing as b6, type SupplierListingAttribute as b7, type SupplierListingPage as b8, type SupplierListingVariant as b9, isConfigurablePlugin as bA, isPluginFactory as bB, paymentCapability as bC, shippingCapability as bD, suppliersCapability as bE, uiCapability as bF, validatePluginAuthor as bG, validateSetupLayout as bH, validateUiContributions as bI, type SupplierMoney as ba, type SupplierOrderAddressLevel as bb, type SupplierOrderCustomer as bc, type SupplierOrderLine as bd, type SupplierOrderResult as be, type SupplierOrderStatus as bf, type SupplierShipTo as bg, type SupplierStock as bh, type SuppliersDefaultConfig as bi, SuppliersFeature as bj, type SuppliersPluginConfig as bk, type SuppliersStaticConfig as bl, type TabItem as bm, type TabsBlock as bn, type ToggleBlock as bo, type TrackingEvent as bp, TransactionStatus as bq, type UiContribution as br, type UiContributionsValidation as bs, type VoidInvoiceInput as bt, type WebhookSignatureResult as bu, analyticsCapability as bv, capability as bw, crossValidateSetupLayout as bx, definePlugin as by, invoicingCapability 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-yX49e7zE.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 PaymentCustomer, au as PaymentGatewayCode, av as PaymentPayload, aw as PaymentPluginConfig, ax as PaymentRenderMode, ay as PaymentResult, az as PaymentSessionPayload, aA as PaymentSessionResult, aB as PaymentVerifyPayload, aC as PlaceSupplierOrderInput, aD as Plugin, aE as PluginActionContext, aF as PluginActionResult, aG as PluginAuthor, aH as PluginConfigFieldDependency, aI as PluginFactory, aJ as PluginManifest, aK as RepeaterBlock, aL as RepeaterSource, aM as SecretStore, aN as SequenceStore, aO as SetupAction, aP as SetupLayout, aQ as SetupLayoutValidation, aR as SetupStep, aS as ShipmentAddress, aT as ShipmentParcel, aU as ShipmentResult, aV as ShippingDefaultConfig, aW as ShippingFeature, aX as ShippingPluginConfig, aY as ShippingQuote, aZ as ShippingQuoteParams, a_ as ShippingStaticConfig, a$ as StepStatusFrom, b0 as StepStatusFromAction, b1 as StepStatusFromFields, b2 as StepStatusSource, b3 as StorageBroker, b4 as SupplierCatalogQuery, b5 as SupplierFulfillmentEvent, b6 as SupplierListing, b7 as SupplierListingAttribute, b8 as SupplierListingPage, b9 as SupplierListingVariant, ba as SupplierMoney, bb as SupplierOrderAddressLevel, bc as SupplierOrderCustomer, bd as SupplierOrderLine, be as SupplierOrderResult, bf as SupplierOrderStatus, bg as SupplierShipTo, bh as SupplierStock, bi as SuppliersDefaultConfig, bj as SuppliersFeature, bk as SuppliersPluginConfig, bl as SuppliersStaticConfig, bm as TabItem, bn as TabsBlock, bo as ToggleBlock, bp as TrackingEvent, bq as TransactionStatus, br as UiContribution, bs as UiContributionsValidation, bt as VoidInvoiceInput, bu as WebhookSignatureResult, bv as analyticsCapability, bw as capability, bx as crossValidateSetupLayout, by as definePlugin, bz as invoicingCapability, bA as isConfigurablePlugin, bB as isPluginFactory, bC as paymentCapability, bD as shippingCapability, bE as suppliersCapability, bF as uiCapability, bG as validatePluginAuthor, bH as validateSetupLayout, bI as validateUiContributions } from './host-api-yX49e7zE.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.7";
|
|
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-yX49e7zE.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 PaymentCustomer, au as PaymentGatewayCode, av as PaymentPayload, aw as PaymentPluginConfig, ax as PaymentRenderMode, ay as PaymentResult, az as PaymentSessionPayload, aA as PaymentSessionResult, aB as PaymentVerifyPayload, aC as PlaceSupplierOrderInput, aD as Plugin, aE as PluginActionContext, aF as PluginActionResult, aG as PluginAuthor, aH as PluginConfigFieldDependency, aI as PluginFactory, aJ as PluginManifest, aK as RepeaterBlock, aL as RepeaterSource, aM as SecretStore, aN as SequenceStore, aO as SetupAction, aP as SetupLayout, aQ as SetupLayoutValidation, aR as SetupStep, aS as ShipmentAddress, aT as ShipmentParcel, aU as ShipmentResult, aV as ShippingDefaultConfig, aW as ShippingFeature, aX as ShippingPluginConfig, aY as ShippingQuote, aZ as ShippingQuoteParams, a_ as ShippingStaticConfig, a$ as StepStatusFrom, b0 as StepStatusFromAction, b1 as StepStatusFromFields, b2 as StepStatusSource, b3 as StorageBroker, b4 as SupplierCatalogQuery, b5 as SupplierFulfillmentEvent, b6 as SupplierListing, b7 as SupplierListingAttribute, b8 as SupplierListingPage, b9 as SupplierListingVariant, ba as SupplierMoney, bb as SupplierOrderAddressLevel, bc as SupplierOrderCustomer, bd as SupplierOrderLine, be as SupplierOrderResult, bf as SupplierOrderStatus, bg as SupplierShipTo, bh as SupplierStock, bi as SuppliersDefaultConfig, bj as SuppliersFeature, bk as SuppliersPluginConfig, bl as SuppliersStaticConfig, bm as TabItem, bn as TabsBlock, bo as ToggleBlock, bp as TrackingEvent, bq as TransactionStatus, br as UiContribution, bs as UiContributionsValidation, bt as VoidInvoiceInput, bu as WebhookSignatureResult, bv as analyticsCapability, bw as capability, bx as crossValidateSetupLayout, by as definePlugin, bz as invoicingCapability, bA as isConfigurablePlugin, bB as isPluginFactory, bC as paymentCapability, bD as shippingCapability, bE as suppliersCapability, bF as uiCapability, bG as validatePluginAuthor, bH as validateSetupLayout, bI as validateUiContributions } from './host-api-yX49e7zE.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.7";
|
|
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.7";
|
|
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.7";
|
|
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-yX49e7zE.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-yX49e7zE.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.7",
|
|
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
|
+
}
|