@vivoa/plugin-sdk 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{host-api-DVbKGytN.d.mts → host-api-C5EsRbsA.d.mts} +173 -7
- package/dist/{host-api-DVbKGytN.d.ts → host-api-C5EsRbsA.d.ts} +173 -7
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +87 -8
- package/dist/index.mjs +88 -8
- package/dist/testing/index.d.mts +7 -1
- package/dist/testing/index.d.ts +7 -1
- package/dist/testing/index.js +9 -0
- package/dist/testing/index.mjs +9 -0
- package/package.json +1 -1
|
@@ -991,6 +991,12 @@ interface SupplierStock {
|
|
|
991
991
|
interface SupplierListing {
|
|
992
992
|
/** Native id in the supplier catalog (product or catalog-item id). */
|
|
993
993
|
externalId: string;
|
|
994
|
+
/**
|
|
995
|
+
* When `externalId` is an item of the SELLER's catalog (e.g. Drop's
|
|
996
|
+
* catalogId), the id of the marketplace product it wraps: the one the
|
|
997
|
+
* supplier's public catalog uses. Absent when both are the same id.
|
|
998
|
+
*/
|
|
999
|
+
catalogProductId?: string | null;
|
|
994
1000
|
title: string;
|
|
995
1001
|
description?: string | null;
|
|
996
1002
|
sku?: string | null;
|
|
@@ -1586,8 +1592,28 @@ declare enum ContentBlockType {
|
|
|
1586
1592
|
/** Read-only table of scalar cells. Pure JSON data. */
|
|
1587
1593
|
Table = "table",
|
|
1588
1594
|
/** Simple bar/line chart over labelled series. Pure JSON data. */
|
|
1589
|
-
Chart = "chart"
|
|
1595
|
+
Chart = "chart",
|
|
1596
|
+
/**
|
|
1597
|
+
* Segmented choice bound to a page param (e.g. `days`). Picking an option
|
|
1598
|
+
* makes the host re-resolve the slot with `params[param] = value`. A VIEW
|
|
1599
|
+
* control, not config input: it never writes plugin settings.
|
|
1600
|
+
*/
|
|
1601
|
+
Filter = "filter",
|
|
1602
|
+
/** Lays its child blocks side by side in N responsive columns. */
|
|
1603
|
+
Grid = "grid",
|
|
1604
|
+
/** Free-text box bound to a page param (debounced by the host). */
|
|
1605
|
+
Search = "search",
|
|
1606
|
+
/** Collapsible section (closed by default): "how to read this", details. */
|
|
1607
|
+
Details = "details",
|
|
1608
|
+
/** One row of view controls (search, filters, links) above a list. */
|
|
1609
|
+
Toolbar = "toolbar"
|
|
1590
1610
|
}
|
|
1611
|
+
/**
|
|
1612
|
+
* A patch over the page params, for IN-PAGE navigation (links, table rows,
|
|
1613
|
+
* stats): the host merges it into the current params; `null` removes one.
|
|
1614
|
+
* It navigates (history entry, so "back" works); filters only replace.
|
|
1615
|
+
*/
|
|
1616
|
+
type PageParams = Record<string, string | null>;
|
|
1591
1617
|
/**
|
|
1592
1618
|
* Host-owned slots the SDK knows by name. `slot` stays a free string on the
|
|
1593
1619
|
* wire (an older host ignores a slot it does not know); these constants only
|
|
@@ -1647,6 +1673,8 @@ interface LinkBlock {
|
|
|
1647
1673
|
href?: string;
|
|
1648
1674
|
computedKey?: string;
|
|
1649
1675
|
external?: boolean;
|
|
1676
|
+
/** In-page navigation instead of `href` (see `PageParams`). */
|
|
1677
|
+
params?: PageParams;
|
|
1650
1678
|
}
|
|
1651
1679
|
interface DividerBlock {
|
|
1652
1680
|
type: ContentBlockType.Divider;
|
|
@@ -1682,14 +1710,58 @@ interface StatBlock {
|
|
|
1682
1710
|
hint?: string;
|
|
1683
1711
|
variant?: MessageVariant;
|
|
1684
1712
|
estimate?: boolean;
|
|
1713
|
+
/** Makes the stat a link to more detail on the same page (e.g. what the KPI means). */
|
|
1714
|
+
params?: PageParams;
|
|
1715
|
+
}
|
|
1716
|
+
/**
|
|
1717
|
+
* A cell with more than its text: a second line, a thumbnail, a tone. Still
|
|
1718
|
+
* pure data; the host decides how each part looks.
|
|
1719
|
+
*/
|
|
1720
|
+
interface TableRichCell {
|
|
1721
|
+
text: string;
|
|
1722
|
+
/** Muted second line under the text (e.g. vendor, category). */
|
|
1723
|
+
caption?: string;
|
|
1724
|
+
/**
|
|
1725
|
+
* Thumbnail URL shown before the text. `null` = this row has no picture: the
|
|
1726
|
+
* host shows a placeholder so the column stays aligned.
|
|
1727
|
+
*/
|
|
1728
|
+
image?: string | null;
|
|
1729
|
+
/** Tints the text (e.g. `danger` for "sold out"). Never the only signal: say it in `text`. */
|
|
1730
|
+
tone?: MessageVariant;
|
|
1731
|
+
}
|
|
1732
|
+
type TableCell = string | number | boolean | null | TableRichCell;
|
|
1733
|
+
/** Makes a column header sort the table: the value its param takes when clicked. */
|
|
1734
|
+
interface TableColumnSort {
|
|
1735
|
+
value: string;
|
|
1736
|
+
/** Direction that value sorts in, for the header arrow (default `desc`). */
|
|
1737
|
+
dir?: 'asc' | 'desc';
|
|
1685
1738
|
}
|
|
1686
|
-
type TableCell = string | number | boolean | null;
|
|
1687
1739
|
interface TableColumn {
|
|
1688
1740
|
key: string;
|
|
1689
1741
|
label: string;
|
|
1690
1742
|
align?: 'left' | 'right';
|
|
1743
|
+
/** Short explanation of the column, shown on demand next to its header. */
|
|
1744
|
+
hint?: string;
|
|
1745
|
+
sort?: TableColumnSort;
|
|
1746
|
+
}
|
|
1747
|
+
/** The page param the sortable headers write, and the value the plugin sorted by. */
|
|
1748
|
+
interface TableSort {
|
|
1749
|
+
param: string;
|
|
1750
|
+
value: string;
|
|
1751
|
+
/** Params cleared when the sort changes (e.g. `page`). */
|
|
1752
|
+
resets?: string[];
|
|
1691
1753
|
}
|
|
1692
|
-
/**
|
|
1754
|
+
/**
|
|
1755
|
+
* Paging through a page param (1-based; the host removes the param on page 1).
|
|
1756
|
+
* The plugin already sliced `rows`: the host only shows the range and the pager.
|
|
1757
|
+
*/
|
|
1758
|
+
interface TablePagination {
|
|
1759
|
+
param: string;
|
|
1760
|
+
page: number;
|
|
1761
|
+
pageSize: number;
|
|
1762
|
+
total: number;
|
|
1763
|
+
}
|
|
1764
|
+
/** Read-only table. Cells are looked up by `columns[].key`. */
|
|
1693
1765
|
interface TableBlock {
|
|
1694
1766
|
type: ContentBlockType.Table;
|
|
1695
1767
|
title?: string;
|
|
@@ -1697,23 +1769,86 @@ interface TableBlock {
|
|
|
1697
1769
|
rows: Array<Record<string, TableCell>>;
|
|
1698
1770
|
/** Shown instead of the body when `rows` is empty. */
|
|
1699
1771
|
emptyText?: string;
|
|
1772
|
+
/** Aligned with `rows`: a row with params is clickable (in-page navigation). */
|
|
1773
|
+
rowParams?: Array<PageParams | null>;
|
|
1774
|
+
/** Columns with `sort` become clickable headers bound to this param. */
|
|
1775
|
+
sort?: TableSort;
|
|
1776
|
+
pagination?: TablePagination;
|
|
1700
1777
|
}
|
|
1701
1778
|
interface ChartSeries {
|
|
1702
1779
|
name: string;
|
|
1703
1780
|
/** One value per label; `null` = no observation (a gap, not a zero). */
|
|
1704
1781
|
data: Array<number | null>;
|
|
1705
1782
|
}
|
|
1706
|
-
/**
|
|
1783
|
+
/**
|
|
1784
|
+
* Simple chart: `labels` is the category axis, every series aligns to it.
|
|
1785
|
+
* `hbar` = horizontal bars, one row per label (best for long category names).
|
|
1786
|
+
*/
|
|
1707
1787
|
interface ChartBlock {
|
|
1708
1788
|
type: ContentBlockType.Chart;
|
|
1709
|
-
kind: 'bar' | 'line';
|
|
1789
|
+
kind: 'bar' | 'line' | 'hbar';
|
|
1710
1790
|
title?: string;
|
|
1711
1791
|
labels: string[];
|
|
1712
1792
|
series: ChartSeries[];
|
|
1713
1793
|
unit?: string;
|
|
1714
1794
|
emptyText?: string;
|
|
1715
1795
|
}
|
|
1716
|
-
|
|
1796
|
+
interface FilterOption {
|
|
1797
|
+
value: string;
|
|
1798
|
+
label: string;
|
|
1799
|
+
}
|
|
1800
|
+
/**
|
|
1801
|
+
* Choice over one page param. `value` is the option the plugin rendered with
|
|
1802
|
+
* (it read it from `UiSlotContext.params`, or chose a default).
|
|
1803
|
+
*/
|
|
1804
|
+
interface FilterBlock {
|
|
1805
|
+
type: ContentBlockType.Filter;
|
|
1806
|
+
param: string;
|
|
1807
|
+
label?: string;
|
|
1808
|
+
value: string;
|
|
1809
|
+
options: FilterOption[];
|
|
1810
|
+
/**
|
|
1811
|
+
* `segmented` (default) for a few options; `select` for many (in a `select`
|
|
1812
|
+
* an option with an empty value means "no filter"); `tabs` for the views of
|
|
1813
|
+
* the page.
|
|
1814
|
+
*/
|
|
1815
|
+
display?: 'segmented' | 'select' | 'tabs';
|
|
1816
|
+
/** Params cleared when this one changes (e.g. `page`). */
|
|
1817
|
+
resets?: string[];
|
|
1818
|
+
}
|
|
1819
|
+
/** Free-text box over one page param; the host debounces and replaces the URL. */
|
|
1820
|
+
interface SearchBlock {
|
|
1821
|
+
type: ContentBlockType.Search;
|
|
1822
|
+
param: string;
|
|
1823
|
+
value: string;
|
|
1824
|
+
label?: string;
|
|
1825
|
+
placeholder?: string;
|
|
1826
|
+
/** Params cleared when the text changes (e.g. `page`). */
|
|
1827
|
+
resets?: string[];
|
|
1828
|
+
}
|
|
1829
|
+
/** Collapsible section, closed unless `open`. Recurses into child `blocks`. */
|
|
1830
|
+
interface DetailsBlock {
|
|
1831
|
+
type: ContentBlockType.Details;
|
|
1832
|
+
summary: string;
|
|
1833
|
+
blocks: ContentBlock[];
|
|
1834
|
+
open?: boolean;
|
|
1835
|
+
}
|
|
1836
|
+
/**
|
|
1837
|
+
* One row of view controls above a list: search, filters, a "clear" link. It
|
|
1838
|
+
* wraps on a narrow screen and a search box takes the free width. Use `grid`
|
|
1839
|
+
* for content, this for controls.
|
|
1840
|
+
*/
|
|
1841
|
+
interface ToolbarBlock {
|
|
1842
|
+
type: ContentBlockType.Toolbar;
|
|
1843
|
+
blocks: ContentBlock[];
|
|
1844
|
+
}
|
|
1845
|
+
/** Child blocks in `columns` responsive columns (one column on narrow screens). */
|
|
1846
|
+
interface GridBlock {
|
|
1847
|
+
type: ContentBlockType.Grid;
|
|
1848
|
+
columns: 2 | 3 | 4;
|
|
1849
|
+
blocks: ContentBlock[];
|
|
1850
|
+
}
|
|
1851
|
+
type ContentBlock = TextBlock | BannerBlock | BadgeBlock | KeyValueBlock | CopyFieldBlock | LinkBlock | DividerBlock | ActionBlock | CardBlock | StatBlock | TableBlock | ChartBlock | FilterBlock | GridBlock | SearchBlock | DetailsBlock | ToolbarBlock;
|
|
1717
1852
|
/**
|
|
1718
1853
|
* One block tree the plugin injects into a host slot. `slot` names a host-owned
|
|
1719
1854
|
* target (e.g. "admin:order.detail.sidebar", "storefront:product.below"); the
|
|
@@ -1859,6 +1994,32 @@ interface StorageBroker {
|
|
|
1859
1994
|
interface SequenceStore {
|
|
1860
1995
|
next(scope: string): Promise<number>;
|
|
1861
1996
|
}
|
|
1997
|
+
/**
|
|
1998
|
+
* A product of THIS store that was imported from a supplier's catalog
|
|
1999
|
+
* (dropshipping). `externalId` is the supplier's own product id, so a plugin
|
|
2000
|
+
* can join it with that supplier's data without reading the host database.
|
|
2001
|
+
*/
|
|
2002
|
+
interface SourcedProduct {
|
|
2003
|
+
/** Local product id in this store. */
|
|
2004
|
+
productId: string;
|
|
2005
|
+
/** Local product title (what the merchant named it). */
|
|
2006
|
+
title: string;
|
|
2007
|
+
/** The supplier's product id. */
|
|
2008
|
+
externalId: string;
|
|
2009
|
+
/**
|
|
2010
|
+
* The supplier marketplace product this one comes from, when the host knows
|
|
2011
|
+
* it (see `SupplierListing.catalogProductId`). `null` = not linked yet.
|
|
2012
|
+
*/
|
|
2013
|
+
catalogProductId: string | null;
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Read-only view of the store catalog, scoped by the host to the tenant of the
|
|
2017
|
+
* current call.
|
|
2018
|
+
*/
|
|
2019
|
+
interface CatalogReader {
|
|
2020
|
+
/** Products of this store sourced from `supplierCode` (e.g. `soydrop`). */
|
|
2021
|
+
listSourcedProducts(supplierCode: string): Promise<SourcedProduct[]>;
|
|
2022
|
+
}
|
|
1862
2023
|
type DomainEventName = string;
|
|
1863
2024
|
type DomainEventHandler = (payload: unknown) => void | Promise<void>;
|
|
1864
2025
|
/**
|
|
@@ -1874,10 +2035,15 @@ interface HostApi {
|
|
|
1874
2035
|
readonly secrets: SecretStore;
|
|
1875
2036
|
readonly storage: StorageBroker;
|
|
1876
2037
|
readonly sequence: SequenceStore;
|
|
2038
|
+
/**
|
|
2039
|
+
* Store catalog reads. Optional: a host that does not offer it leaves it
|
|
2040
|
+
* out, so a plugin must handle its absence (degrade, never assume).
|
|
2041
|
+
*/
|
|
2042
|
+
readonly catalog?: CatalogReader;
|
|
1877
2043
|
/** Subscribe to a host domain event (order.created, product.updated, ...). */
|
|
1878
2044
|
on(event: DomainEventName, handler: DomainEventHandler): void;
|
|
1879
2045
|
/** Expose a capability to the host's generic registry. */
|
|
1880
2046
|
registerCapability<T = unknown>(cap: Capability<T>): void;
|
|
1881
2047
|
}
|
|
1882
2048
|
|
|
1883
|
-
export { type
|
|
2049
|
+
export { type DomainEventName as $, AUTHOR_HANDLE_RE as A, type BannerBlock$1 as B, ConfigScope as C, type CarrierSettlement as D, type CatalogReader as E, FieldType as F, type ChartBlock as G, type ChartSeries as H, type CodConfig as I, type CodFeeConfig as J, CodFeeType as K, type CodPurchaseTrigger as L, type ConditionalBlock as M, type ConditionalEquals as N, type ConditionalWhen as O, type PluginConfigField as P, type ConfigurablePlugin as Q, ContentActionVariant as R, type SelectOption as S, type ContentBlock as T, ContentBlockType as U, type CopyFieldBlock$1 as V, type CreateShipmentParams as W, type DetailsBlock as X, type DispatchContext as Y, type DividerBlock$1 as Z, type DomainEventHandler as _, type AccordionBlock as a, type PluginActionResult as a$, type EmbedInit as a0, type FieldBlock as a1, type FieldOption as a2, FieldVariant as a3, type FilterBlock as a4, type FilterOption as a5, GatewayEnvironment as a6, type GatewayFeeConfig as a7, type GatewayStaticConfig as a8, type GridBlock as a9, type KeyValueRow$1 as aA, LayoutMode as aB, type LinkBlock as aC, type Logger as aD, type MarkdownBlock as aE, MessageVariant as aF, type PageParams as aG, type PaymentCard as aH, type PaymentConnect as aI, type PaymentConnectExchange as aJ, type PaymentConnectParams as aK, type PaymentCustomer as aL, type PaymentGatewayCode as aM, type PaymentMerchantPricing as aN, type PaymentPayload as aO, type PaymentPluginConfig as aP, type PaymentRenderMode as aQ, type PaymentResult as aR, type PaymentSessionFees as aS, type PaymentSessionPayload as aT, type PaymentSessionResult as aU, type PaymentSettlementFees as aV, type PaymentVerifyPayload as aW, type PaymentWebhookSettlement as aX, type PlaceSupplierOrderInput as aY, type Plugin as aZ, type PluginActionContext as a_, type GroupBlock as aa, type HostApi as ab, type HttpClient as ac, type HttpRequest as ad, type HttpResponse as ae, type IAnalyticsPlugin as af, type IInvoicingPlugin as ag, type IPaymentPlugin as ah, type IPlugin as ai, type IShippingPlugin as aj, type ISuppliersPlugin as ak, type IUiPlugin as al, type InlineRowBlock as am, InvoiceDocumentType as an, type InvoiceLine as ao, type InvoiceMoney as ap, type InvoiceParty as aq, type InvoiceRequest as ar, type InvoiceResult as as, InvoiceStatus as at, type InvoiceTax as au, type InvoicingDefaultConfig as av, InvoicingFeature as aw, type InvoicingPluginConfig as ax, type InvoicingStaticConfig as ay, type KeyValueBlock$1 as az, type AccordionSection as b, type UiContributionsValidation as b$, type PluginAuthor as b0, type PluginConfigFieldDependency as b1, type PluginFactory as b2, type PluginManifest as b3, type RepeaterBlock as b4, RepeaterSource as b5, type SearchBlock as b6, type SecretStore as b7, type SequenceStore as b8, type SetupAction as b9, type SupplierOrderAddressLevel as bA, type SupplierOrderCustomer as bB, type SupplierOrderLine as bC, type SupplierOrderResult as bD, type SupplierOrderStatus as bE, type SupplierShipTo as bF, type SupplierShippingQuote as bG, type SupplierShippingQuoteInput as bH, type SupplierStock as bI, type SuppliersDefaultConfig as bJ, SuppliersFeature as bK, type SuppliersPluginConfig as bL, type SuppliersStaticConfig as bM, type TabItem as bN, type TableBlock as bO, type TableCell as bP, type TableColumn as bQ, type TableColumnSort as bR, type TablePagination as bS, type TableRichCell as bT, type TableSort as bU, type TabsBlock as bV, type ToggleBlock as bW, type ToolbarBlock as bX, type TrackingEvent as bY, TransactionStatus as bZ, type UiContribution as b_, type SetupLayout as ba, type SetupLayoutValidation as bb, type SetupStep as bc, type ShipmentAddress as bd, type ShipmentParcel as be, type ShipmentResult as bf, type ShippingDefaultConfig as bg, ShippingFeature as bh, type ShippingPluginConfig as bi, type ShippingQuote as bj, type ShippingQuoteParams as bk, type ShippingStaticConfig as bl, type SourcedProduct as bm, type StatBlock as bn, StepStatusFrom as bo, type StepStatusFromAction as bp, type StepStatusFromFields as bq, type StepStatusSource as br, type StorageBroker as bs, type SupplierCatalogQuery as bt, type SupplierFulfillmentEvent as bu, type SupplierListing as bv, type SupplierListingAttribute as bw, type SupplierListingPage as bx, type SupplierListingVariant as by, type SupplierMoney as bz, type ActionBlock$1 as c, UiSlot as c0, type UiSlotContext as c1, type VoidInvoiceInput as c2, type WebhookSignatureResult as c3, analyticsCapability as c4, capability as c5, crossValidateSetupLayout as c6, definePlugin as c7, invoicingCapability as c8, isConfigurablePlugin as c9, isPluginFactory as ca, minorUnitDigits as cb, paymentCapability as cc, shippingCapability as cd, suppliersCapability as ce, toMajorUnits as cf, toMinorUnits as cg, uiCapability as ch, validatePluginAuthor as ci, validateSetupLayout as cj, validateUiContributions as ck, 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 AnalyticsPurchasePolicy as m, type AnalyticsStaticConfig as n, type AnalyticsUserData as o, type AnalyticsUtm as p, type AuthorValidation as q, type Block as r, type BlockBase as s, BlockType as t, type CalloutBlock as u, type Capability as v, CapabilityKind as w, type CardBlock$1 as x, type CardBrand as y, type CarrierServiceMode as z };
|
|
@@ -991,6 +991,12 @@ interface SupplierStock {
|
|
|
991
991
|
interface SupplierListing {
|
|
992
992
|
/** Native id in the supplier catalog (product or catalog-item id). */
|
|
993
993
|
externalId: string;
|
|
994
|
+
/**
|
|
995
|
+
* When `externalId` is an item of the SELLER's catalog (e.g. Drop's
|
|
996
|
+
* catalogId), the id of the marketplace product it wraps: the one the
|
|
997
|
+
* supplier's public catalog uses. Absent when both are the same id.
|
|
998
|
+
*/
|
|
999
|
+
catalogProductId?: string | null;
|
|
994
1000
|
title: string;
|
|
995
1001
|
description?: string | null;
|
|
996
1002
|
sku?: string | null;
|
|
@@ -1586,8 +1592,28 @@ declare enum ContentBlockType {
|
|
|
1586
1592
|
/** Read-only table of scalar cells. Pure JSON data. */
|
|
1587
1593
|
Table = "table",
|
|
1588
1594
|
/** Simple bar/line chart over labelled series. Pure JSON data. */
|
|
1589
|
-
Chart = "chart"
|
|
1595
|
+
Chart = "chart",
|
|
1596
|
+
/**
|
|
1597
|
+
* Segmented choice bound to a page param (e.g. `days`). Picking an option
|
|
1598
|
+
* makes the host re-resolve the slot with `params[param] = value`. A VIEW
|
|
1599
|
+
* control, not config input: it never writes plugin settings.
|
|
1600
|
+
*/
|
|
1601
|
+
Filter = "filter",
|
|
1602
|
+
/** Lays its child blocks side by side in N responsive columns. */
|
|
1603
|
+
Grid = "grid",
|
|
1604
|
+
/** Free-text box bound to a page param (debounced by the host). */
|
|
1605
|
+
Search = "search",
|
|
1606
|
+
/** Collapsible section (closed by default): "how to read this", details. */
|
|
1607
|
+
Details = "details",
|
|
1608
|
+
/** One row of view controls (search, filters, links) above a list. */
|
|
1609
|
+
Toolbar = "toolbar"
|
|
1590
1610
|
}
|
|
1611
|
+
/**
|
|
1612
|
+
* A patch over the page params, for IN-PAGE navigation (links, table rows,
|
|
1613
|
+
* stats): the host merges it into the current params; `null` removes one.
|
|
1614
|
+
* It navigates (history entry, so "back" works); filters only replace.
|
|
1615
|
+
*/
|
|
1616
|
+
type PageParams = Record<string, string | null>;
|
|
1591
1617
|
/**
|
|
1592
1618
|
* Host-owned slots the SDK knows by name. `slot` stays a free string on the
|
|
1593
1619
|
* wire (an older host ignores a slot it does not know); these constants only
|
|
@@ -1647,6 +1673,8 @@ interface LinkBlock {
|
|
|
1647
1673
|
href?: string;
|
|
1648
1674
|
computedKey?: string;
|
|
1649
1675
|
external?: boolean;
|
|
1676
|
+
/** In-page navigation instead of `href` (see `PageParams`). */
|
|
1677
|
+
params?: PageParams;
|
|
1650
1678
|
}
|
|
1651
1679
|
interface DividerBlock {
|
|
1652
1680
|
type: ContentBlockType.Divider;
|
|
@@ -1682,14 +1710,58 @@ interface StatBlock {
|
|
|
1682
1710
|
hint?: string;
|
|
1683
1711
|
variant?: MessageVariant;
|
|
1684
1712
|
estimate?: boolean;
|
|
1713
|
+
/** Makes the stat a link to more detail on the same page (e.g. what the KPI means). */
|
|
1714
|
+
params?: PageParams;
|
|
1715
|
+
}
|
|
1716
|
+
/**
|
|
1717
|
+
* A cell with more than its text: a second line, a thumbnail, a tone. Still
|
|
1718
|
+
* pure data; the host decides how each part looks.
|
|
1719
|
+
*/
|
|
1720
|
+
interface TableRichCell {
|
|
1721
|
+
text: string;
|
|
1722
|
+
/** Muted second line under the text (e.g. vendor, category). */
|
|
1723
|
+
caption?: string;
|
|
1724
|
+
/**
|
|
1725
|
+
* Thumbnail URL shown before the text. `null` = this row has no picture: the
|
|
1726
|
+
* host shows a placeholder so the column stays aligned.
|
|
1727
|
+
*/
|
|
1728
|
+
image?: string | null;
|
|
1729
|
+
/** Tints the text (e.g. `danger` for "sold out"). Never the only signal: say it in `text`. */
|
|
1730
|
+
tone?: MessageVariant;
|
|
1731
|
+
}
|
|
1732
|
+
type TableCell = string | number | boolean | null | TableRichCell;
|
|
1733
|
+
/** Makes a column header sort the table: the value its param takes when clicked. */
|
|
1734
|
+
interface TableColumnSort {
|
|
1735
|
+
value: string;
|
|
1736
|
+
/** Direction that value sorts in, for the header arrow (default `desc`). */
|
|
1737
|
+
dir?: 'asc' | 'desc';
|
|
1685
1738
|
}
|
|
1686
|
-
type TableCell = string | number | boolean | null;
|
|
1687
1739
|
interface TableColumn {
|
|
1688
1740
|
key: string;
|
|
1689
1741
|
label: string;
|
|
1690
1742
|
align?: 'left' | 'right';
|
|
1743
|
+
/** Short explanation of the column, shown on demand next to its header. */
|
|
1744
|
+
hint?: string;
|
|
1745
|
+
sort?: TableColumnSort;
|
|
1746
|
+
}
|
|
1747
|
+
/** The page param the sortable headers write, and the value the plugin sorted by. */
|
|
1748
|
+
interface TableSort {
|
|
1749
|
+
param: string;
|
|
1750
|
+
value: string;
|
|
1751
|
+
/** Params cleared when the sort changes (e.g. `page`). */
|
|
1752
|
+
resets?: string[];
|
|
1691
1753
|
}
|
|
1692
|
-
/**
|
|
1754
|
+
/**
|
|
1755
|
+
* Paging through a page param (1-based; the host removes the param on page 1).
|
|
1756
|
+
* The plugin already sliced `rows`: the host only shows the range and the pager.
|
|
1757
|
+
*/
|
|
1758
|
+
interface TablePagination {
|
|
1759
|
+
param: string;
|
|
1760
|
+
page: number;
|
|
1761
|
+
pageSize: number;
|
|
1762
|
+
total: number;
|
|
1763
|
+
}
|
|
1764
|
+
/** Read-only table. Cells are looked up by `columns[].key`. */
|
|
1693
1765
|
interface TableBlock {
|
|
1694
1766
|
type: ContentBlockType.Table;
|
|
1695
1767
|
title?: string;
|
|
@@ -1697,23 +1769,86 @@ interface TableBlock {
|
|
|
1697
1769
|
rows: Array<Record<string, TableCell>>;
|
|
1698
1770
|
/** Shown instead of the body when `rows` is empty. */
|
|
1699
1771
|
emptyText?: string;
|
|
1772
|
+
/** Aligned with `rows`: a row with params is clickable (in-page navigation). */
|
|
1773
|
+
rowParams?: Array<PageParams | null>;
|
|
1774
|
+
/** Columns with `sort` become clickable headers bound to this param. */
|
|
1775
|
+
sort?: TableSort;
|
|
1776
|
+
pagination?: TablePagination;
|
|
1700
1777
|
}
|
|
1701
1778
|
interface ChartSeries {
|
|
1702
1779
|
name: string;
|
|
1703
1780
|
/** One value per label; `null` = no observation (a gap, not a zero). */
|
|
1704
1781
|
data: Array<number | null>;
|
|
1705
1782
|
}
|
|
1706
|
-
/**
|
|
1783
|
+
/**
|
|
1784
|
+
* Simple chart: `labels` is the category axis, every series aligns to it.
|
|
1785
|
+
* `hbar` = horizontal bars, one row per label (best for long category names).
|
|
1786
|
+
*/
|
|
1707
1787
|
interface ChartBlock {
|
|
1708
1788
|
type: ContentBlockType.Chart;
|
|
1709
|
-
kind: 'bar' | 'line';
|
|
1789
|
+
kind: 'bar' | 'line' | 'hbar';
|
|
1710
1790
|
title?: string;
|
|
1711
1791
|
labels: string[];
|
|
1712
1792
|
series: ChartSeries[];
|
|
1713
1793
|
unit?: string;
|
|
1714
1794
|
emptyText?: string;
|
|
1715
1795
|
}
|
|
1716
|
-
|
|
1796
|
+
interface FilterOption {
|
|
1797
|
+
value: string;
|
|
1798
|
+
label: string;
|
|
1799
|
+
}
|
|
1800
|
+
/**
|
|
1801
|
+
* Choice over one page param. `value` is the option the plugin rendered with
|
|
1802
|
+
* (it read it from `UiSlotContext.params`, or chose a default).
|
|
1803
|
+
*/
|
|
1804
|
+
interface FilterBlock {
|
|
1805
|
+
type: ContentBlockType.Filter;
|
|
1806
|
+
param: string;
|
|
1807
|
+
label?: string;
|
|
1808
|
+
value: string;
|
|
1809
|
+
options: FilterOption[];
|
|
1810
|
+
/**
|
|
1811
|
+
* `segmented` (default) for a few options; `select` for many (in a `select`
|
|
1812
|
+
* an option with an empty value means "no filter"); `tabs` for the views of
|
|
1813
|
+
* the page.
|
|
1814
|
+
*/
|
|
1815
|
+
display?: 'segmented' | 'select' | 'tabs';
|
|
1816
|
+
/** Params cleared when this one changes (e.g. `page`). */
|
|
1817
|
+
resets?: string[];
|
|
1818
|
+
}
|
|
1819
|
+
/** Free-text box over one page param; the host debounces and replaces the URL. */
|
|
1820
|
+
interface SearchBlock {
|
|
1821
|
+
type: ContentBlockType.Search;
|
|
1822
|
+
param: string;
|
|
1823
|
+
value: string;
|
|
1824
|
+
label?: string;
|
|
1825
|
+
placeholder?: string;
|
|
1826
|
+
/** Params cleared when the text changes (e.g. `page`). */
|
|
1827
|
+
resets?: string[];
|
|
1828
|
+
}
|
|
1829
|
+
/** Collapsible section, closed unless `open`. Recurses into child `blocks`. */
|
|
1830
|
+
interface DetailsBlock {
|
|
1831
|
+
type: ContentBlockType.Details;
|
|
1832
|
+
summary: string;
|
|
1833
|
+
blocks: ContentBlock[];
|
|
1834
|
+
open?: boolean;
|
|
1835
|
+
}
|
|
1836
|
+
/**
|
|
1837
|
+
* One row of view controls above a list: search, filters, a "clear" link. It
|
|
1838
|
+
* wraps on a narrow screen and a search box takes the free width. Use `grid`
|
|
1839
|
+
* for content, this for controls.
|
|
1840
|
+
*/
|
|
1841
|
+
interface ToolbarBlock {
|
|
1842
|
+
type: ContentBlockType.Toolbar;
|
|
1843
|
+
blocks: ContentBlock[];
|
|
1844
|
+
}
|
|
1845
|
+
/** Child blocks in `columns` responsive columns (one column on narrow screens). */
|
|
1846
|
+
interface GridBlock {
|
|
1847
|
+
type: ContentBlockType.Grid;
|
|
1848
|
+
columns: 2 | 3 | 4;
|
|
1849
|
+
blocks: ContentBlock[];
|
|
1850
|
+
}
|
|
1851
|
+
type ContentBlock = TextBlock | BannerBlock | BadgeBlock | KeyValueBlock | CopyFieldBlock | LinkBlock | DividerBlock | ActionBlock | CardBlock | StatBlock | TableBlock | ChartBlock | FilterBlock | GridBlock | SearchBlock | DetailsBlock | ToolbarBlock;
|
|
1717
1852
|
/**
|
|
1718
1853
|
* One block tree the plugin injects into a host slot. `slot` names a host-owned
|
|
1719
1854
|
* target (e.g. "admin:order.detail.sidebar", "storefront:product.below"); the
|
|
@@ -1859,6 +1994,32 @@ interface StorageBroker {
|
|
|
1859
1994
|
interface SequenceStore {
|
|
1860
1995
|
next(scope: string): Promise<number>;
|
|
1861
1996
|
}
|
|
1997
|
+
/**
|
|
1998
|
+
* A product of THIS store that was imported from a supplier's catalog
|
|
1999
|
+
* (dropshipping). `externalId` is the supplier's own product id, so a plugin
|
|
2000
|
+
* can join it with that supplier's data without reading the host database.
|
|
2001
|
+
*/
|
|
2002
|
+
interface SourcedProduct {
|
|
2003
|
+
/** Local product id in this store. */
|
|
2004
|
+
productId: string;
|
|
2005
|
+
/** Local product title (what the merchant named it). */
|
|
2006
|
+
title: string;
|
|
2007
|
+
/** The supplier's product id. */
|
|
2008
|
+
externalId: string;
|
|
2009
|
+
/**
|
|
2010
|
+
* The supplier marketplace product this one comes from, when the host knows
|
|
2011
|
+
* it (see `SupplierListing.catalogProductId`). `null` = not linked yet.
|
|
2012
|
+
*/
|
|
2013
|
+
catalogProductId: string | null;
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Read-only view of the store catalog, scoped by the host to the tenant of the
|
|
2017
|
+
* current call.
|
|
2018
|
+
*/
|
|
2019
|
+
interface CatalogReader {
|
|
2020
|
+
/** Products of this store sourced from `supplierCode` (e.g. `soydrop`). */
|
|
2021
|
+
listSourcedProducts(supplierCode: string): Promise<SourcedProduct[]>;
|
|
2022
|
+
}
|
|
1862
2023
|
type DomainEventName = string;
|
|
1863
2024
|
type DomainEventHandler = (payload: unknown) => void | Promise<void>;
|
|
1864
2025
|
/**
|
|
@@ -1874,10 +2035,15 @@ interface HostApi {
|
|
|
1874
2035
|
readonly secrets: SecretStore;
|
|
1875
2036
|
readonly storage: StorageBroker;
|
|
1876
2037
|
readonly sequence: SequenceStore;
|
|
2038
|
+
/**
|
|
2039
|
+
* Store catalog reads. Optional: a host that does not offer it leaves it
|
|
2040
|
+
* out, so a plugin must handle its absence (degrade, never assume).
|
|
2041
|
+
*/
|
|
2042
|
+
readonly catalog?: CatalogReader;
|
|
1877
2043
|
/** Subscribe to a host domain event (order.created, product.updated, ...). */
|
|
1878
2044
|
on(event: DomainEventName, handler: DomainEventHandler): void;
|
|
1879
2045
|
/** Expose a capability to the host's generic registry. */
|
|
1880
2046
|
registerCapability<T = unknown>(cap: Capability<T>): void;
|
|
1881
2047
|
}
|
|
1882
2048
|
|
|
1883
|
-
export { type
|
|
2049
|
+
export { type DomainEventName as $, AUTHOR_HANDLE_RE as A, type BannerBlock$1 as B, ConfigScope as C, type CarrierSettlement as D, type CatalogReader as E, FieldType as F, type ChartBlock as G, type ChartSeries as H, type CodConfig as I, type CodFeeConfig as J, CodFeeType as K, type CodPurchaseTrigger as L, type ConditionalBlock as M, type ConditionalEquals as N, type ConditionalWhen as O, type PluginConfigField as P, type ConfigurablePlugin as Q, ContentActionVariant as R, type SelectOption as S, type ContentBlock as T, ContentBlockType as U, type CopyFieldBlock$1 as V, type CreateShipmentParams as W, type DetailsBlock as X, type DispatchContext as Y, type DividerBlock$1 as Z, type DomainEventHandler as _, type AccordionBlock as a, type PluginActionResult as a$, type EmbedInit as a0, type FieldBlock as a1, type FieldOption as a2, FieldVariant as a3, type FilterBlock as a4, type FilterOption as a5, GatewayEnvironment as a6, type GatewayFeeConfig as a7, type GatewayStaticConfig as a8, type GridBlock as a9, type KeyValueRow$1 as aA, LayoutMode as aB, type LinkBlock as aC, type Logger as aD, type MarkdownBlock as aE, MessageVariant as aF, type PageParams as aG, type PaymentCard as aH, type PaymentConnect as aI, type PaymentConnectExchange as aJ, type PaymentConnectParams as aK, type PaymentCustomer as aL, type PaymentGatewayCode as aM, type PaymentMerchantPricing as aN, type PaymentPayload as aO, type PaymentPluginConfig as aP, type PaymentRenderMode as aQ, type PaymentResult as aR, type PaymentSessionFees as aS, type PaymentSessionPayload as aT, type PaymentSessionResult as aU, type PaymentSettlementFees as aV, type PaymentVerifyPayload as aW, type PaymentWebhookSettlement as aX, type PlaceSupplierOrderInput as aY, type Plugin as aZ, type PluginActionContext as a_, type GroupBlock as aa, type HostApi as ab, type HttpClient as ac, type HttpRequest as ad, type HttpResponse as ae, type IAnalyticsPlugin as af, type IInvoicingPlugin as ag, type IPaymentPlugin as ah, type IPlugin as ai, type IShippingPlugin as aj, type ISuppliersPlugin as ak, type IUiPlugin as al, type InlineRowBlock as am, InvoiceDocumentType as an, type InvoiceLine as ao, type InvoiceMoney as ap, type InvoiceParty as aq, type InvoiceRequest as ar, type InvoiceResult as as, InvoiceStatus as at, type InvoiceTax as au, type InvoicingDefaultConfig as av, InvoicingFeature as aw, type InvoicingPluginConfig as ax, type InvoicingStaticConfig as ay, type KeyValueBlock$1 as az, type AccordionSection as b, type UiContributionsValidation as b$, type PluginAuthor as b0, type PluginConfigFieldDependency as b1, type PluginFactory as b2, type PluginManifest as b3, type RepeaterBlock as b4, RepeaterSource as b5, type SearchBlock as b6, type SecretStore as b7, type SequenceStore as b8, type SetupAction as b9, type SupplierOrderAddressLevel as bA, type SupplierOrderCustomer as bB, type SupplierOrderLine as bC, type SupplierOrderResult as bD, type SupplierOrderStatus as bE, type SupplierShipTo as bF, type SupplierShippingQuote as bG, type SupplierShippingQuoteInput as bH, type SupplierStock as bI, type SuppliersDefaultConfig as bJ, SuppliersFeature as bK, type SuppliersPluginConfig as bL, type SuppliersStaticConfig as bM, type TabItem as bN, type TableBlock as bO, type TableCell as bP, type TableColumn as bQ, type TableColumnSort as bR, type TablePagination as bS, type TableRichCell as bT, type TableSort as bU, type TabsBlock as bV, type ToggleBlock as bW, type ToolbarBlock as bX, type TrackingEvent as bY, TransactionStatus as bZ, type UiContribution as b_, type SetupLayout as ba, type SetupLayoutValidation as bb, type SetupStep as bc, type ShipmentAddress as bd, type ShipmentParcel as be, type ShipmentResult as bf, type ShippingDefaultConfig as bg, ShippingFeature as bh, type ShippingPluginConfig as bi, type ShippingQuote as bj, type ShippingQuoteParams as bk, type ShippingStaticConfig as bl, type SourcedProduct as bm, type StatBlock as bn, StepStatusFrom as bo, type StepStatusFromAction as bp, type StepStatusFromFields as bq, type StepStatusSource as br, type StorageBroker as bs, type SupplierCatalogQuery as bt, type SupplierFulfillmentEvent as bu, type SupplierListing as bv, type SupplierListingAttribute as bw, type SupplierListingPage as bx, type SupplierListingVariant as by, type SupplierMoney as bz, type ActionBlock$1 as c, UiSlot as c0, type UiSlotContext as c1, type VoidInvoiceInput as c2, type WebhookSignatureResult as c3, analyticsCapability as c4, capability as c5, crossValidateSetupLayout as c6, definePlugin as c7, invoicingCapability as c8, isConfigurablePlugin as c9, isPluginFactory as ca, minorUnitDigits as cb, paymentCapability as cc, shippingCapability as cd, suppliersCapability as ce, toMajorUnits as cf, toMinorUnits as cg, uiCapability as ch, validatePluginAuthor as ci, validateSetupLayout as cj, validateUiContributions as ck, 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 AnalyticsPurchasePolicy as m, type AnalyticsStaticConfig as n, type AnalyticsUserData as o, type AnalyticsUtm as p, type AuthorValidation as q, type Block as r, type BlockBase as s, BlockType as t, type CalloutBlock as u, type Capability as v, CapabilityKind as w, type CardBlock$1 as x, type CardBrand as y, type CarrierServiceMode 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 AnalyticsPurchasePolicy, n as AnalyticsStaticConfig, o as AnalyticsUserData, p as AnalyticsUtm, q as AuthorValidation, B as BannerBlock, r as Block, s as BlockBase, t as BlockType, u as CalloutBlock, v as Capability, w as CapabilityKind, x as CardBlock, y as CardBrand, z as CarrierServiceMode, D as CarrierSettlement, E as
|
|
1
|
+
import { F as FieldType, C as ConfigScope, S as SelectOption, P as PluginConfigField } from './host-api-C5EsRbsA.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 AnalyticsPurchasePolicy, n as AnalyticsStaticConfig, o as AnalyticsUserData, p as AnalyticsUtm, q as AuthorValidation, B as BannerBlock, r as Block, s as BlockBase, t as BlockType, u as CalloutBlock, v as Capability, w as CapabilityKind, x as CardBlock, y as CardBrand, z as CarrierServiceMode, D as CarrierSettlement, E as CatalogReader, G as ChartBlock, H as ChartSeries, I as CodConfig, J as CodFeeConfig, K as CodFeeType, L as CodPurchaseTrigger, M as ConditionalBlock, N as ConditionalEquals, O as ConditionalWhen, Q as ConfigurablePlugin, R as ContentActionVariant, T as ContentBlock, U as ContentBlockType, V as CopyFieldBlock, W as CreateShipmentParams, X as DetailsBlock, Y as DispatchContext, Z as DividerBlock, _ as DomainEventHandler, $ as DomainEventName, a0 as EmbedInit, a1 as FieldBlock, a2 as FieldOption, a3 as FieldVariant, a4 as FilterBlock, a5 as FilterOption, a6 as GatewayEnvironment, a7 as GatewayFeeConfig, a8 as GatewayStaticConfig, a9 as GridBlock, aa as GroupBlock, ab as HostApi, ac as HttpClient, ad as HttpRequest, ae as HttpResponse, af as IAnalyticsPlugin, ag as IInvoicingPlugin, ah as IPaymentPlugin, ai as IPlugin, aj as IShippingPlugin, ak as ISuppliersPlugin, al as IUiPlugin, am as InlineRowBlock, an as InvoiceDocumentType, ao as InvoiceLine, ap as InvoiceMoney, aq as InvoiceParty, ar as InvoiceRequest, as as InvoiceResult, at as InvoiceStatus, au as InvoiceTax, av as InvoicingDefaultConfig, aw as InvoicingFeature, ax as InvoicingPluginConfig, ay as InvoicingStaticConfig, az as KeyValueBlock, aA as KeyValueRow, aB as LayoutMode, aC as LinkBlock, aD as Logger, aE as MarkdownBlock, aF as MessageVariant, aG as PageParams, aH as PaymentCard, aI as PaymentConnect, aJ as PaymentConnectExchange, aK as PaymentConnectParams, aL as PaymentCustomer, aM as PaymentGatewayCode, aN as PaymentMerchantPricing, aO as PaymentPayload, aP as PaymentPluginConfig, aQ as PaymentRenderMode, aR as PaymentResult, aS as PaymentSessionFees, aT as PaymentSessionPayload, aU as PaymentSessionResult, aV as PaymentSettlementFees, aW as PaymentVerifyPayload, aX as PaymentWebhookSettlement, aY as PlaceSupplierOrderInput, aZ as Plugin, a_ as PluginActionContext, a$ as PluginActionResult, b0 as PluginAuthor, b1 as PluginConfigFieldDependency, b2 as PluginFactory, b3 as PluginManifest, b4 as RepeaterBlock, b5 as RepeaterSource, b6 as SearchBlock, b7 as SecretStore, b8 as SequenceStore, b9 as SetupAction, ba as SetupLayout, bb as SetupLayoutValidation, bc as SetupStep, bd as ShipmentAddress, be as ShipmentParcel, bf as ShipmentResult, bg as ShippingDefaultConfig, bh as ShippingFeature, bi as ShippingPluginConfig, bj as ShippingQuote, bk as ShippingQuoteParams, bl as ShippingStaticConfig, bm as SourcedProduct, bn as StatBlock, bo as StepStatusFrom, bp as StepStatusFromAction, bq as StepStatusFromFields, br as StepStatusSource, bs as StorageBroker, bt as SupplierCatalogQuery, bu as SupplierFulfillmentEvent, bv as SupplierListing, bw as SupplierListingAttribute, bx as SupplierListingPage, by as SupplierListingVariant, bz as SupplierMoney, bA as SupplierOrderAddressLevel, bB as SupplierOrderCustomer, bC as SupplierOrderLine, bD as SupplierOrderResult, bE as SupplierOrderStatus, bF as SupplierShipTo, bG as SupplierShippingQuote, bH as SupplierShippingQuoteInput, bI as SupplierStock, bJ as SuppliersDefaultConfig, bK as SuppliersFeature, bL as SuppliersPluginConfig, bM as SuppliersStaticConfig, bN as TabItem, bO as TableBlock, bP as TableCell, bQ as TableColumn, bR as TableColumnSort, bS as TablePagination, bT as TableRichCell, bU as TableSort, bV as TabsBlock, bW as ToggleBlock, bX as ToolbarBlock, bY as TrackingEvent, bZ as TransactionStatus, b_ as UiContribution, b$ as UiContributionsValidation, c0 as UiSlot, c1 as UiSlotContext, c2 as VoidInvoiceInput, c3 as WebhookSignatureResult, c4 as analyticsCapability, c5 as capability, c6 as crossValidateSetupLayout, c7 as definePlugin, c8 as invoicingCapability, c9 as isConfigurablePlugin, ca as isPluginFactory, cb as minorUnitDigits, cc as paymentCapability, cd as shippingCapability, ce as suppliersCapability, cf as toMajorUnits, cg as toMinorUnits, ch as uiCapability, ci as validatePluginAuthor, cj as validateSetupLayout, ck as validateUiContributions } from './host-api-C5EsRbsA.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.7.
|
|
77
|
+
declare const SDK_VERSION = "0.7.2";
|
|
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 AnalyticsPurchasePolicy, n as AnalyticsStaticConfig, o as AnalyticsUserData, p as AnalyticsUtm, q as AuthorValidation, B as BannerBlock, r as Block, s as BlockBase, t as BlockType, u as CalloutBlock, v as Capability, w as CapabilityKind, x as CardBlock, y as CardBrand, z as CarrierServiceMode, D as CarrierSettlement, E as
|
|
1
|
+
import { F as FieldType, C as ConfigScope, S as SelectOption, P as PluginConfigField } from './host-api-C5EsRbsA.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 AnalyticsPurchasePolicy, n as AnalyticsStaticConfig, o as AnalyticsUserData, p as AnalyticsUtm, q as AuthorValidation, B as BannerBlock, r as Block, s as BlockBase, t as BlockType, u as CalloutBlock, v as Capability, w as CapabilityKind, x as CardBlock, y as CardBrand, z as CarrierServiceMode, D as CarrierSettlement, E as CatalogReader, G as ChartBlock, H as ChartSeries, I as CodConfig, J as CodFeeConfig, K as CodFeeType, L as CodPurchaseTrigger, M as ConditionalBlock, N as ConditionalEquals, O as ConditionalWhen, Q as ConfigurablePlugin, R as ContentActionVariant, T as ContentBlock, U as ContentBlockType, V as CopyFieldBlock, W as CreateShipmentParams, X as DetailsBlock, Y as DispatchContext, Z as DividerBlock, _ as DomainEventHandler, $ as DomainEventName, a0 as EmbedInit, a1 as FieldBlock, a2 as FieldOption, a3 as FieldVariant, a4 as FilterBlock, a5 as FilterOption, a6 as GatewayEnvironment, a7 as GatewayFeeConfig, a8 as GatewayStaticConfig, a9 as GridBlock, aa as GroupBlock, ab as HostApi, ac as HttpClient, ad as HttpRequest, ae as HttpResponse, af as IAnalyticsPlugin, ag as IInvoicingPlugin, ah as IPaymentPlugin, ai as IPlugin, aj as IShippingPlugin, ak as ISuppliersPlugin, al as IUiPlugin, am as InlineRowBlock, an as InvoiceDocumentType, ao as InvoiceLine, ap as InvoiceMoney, aq as InvoiceParty, ar as InvoiceRequest, as as InvoiceResult, at as InvoiceStatus, au as InvoiceTax, av as InvoicingDefaultConfig, aw as InvoicingFeature, ax as InvoicingPluginConfig, ay as InvoicingStaticConfig, az as KeyValueBlock, aA as KeyValueRow, aB as LayoutMode, aC as LinkBlock, aD as Logger, aE as MarkdownBlock, aF as MessageVariant, aG as PageParams, aH as PaymentCard, aI as PaymentConnect, aJ as PaymentConnectExchange, aK as PaymentConnectParams, aL as PaymentCustomer, aM as PaymentGatewayCode, aN as PaymentMerchantPricing, aO as PaymentPayload, aP as PaymentPluginConfig, aQ as PaymentRenderMode, aR as PaymentResult, aS as PaymentSessionFees, aT as PaymentSessionPayload, aU as PaymentSessionResult, aV as PaymentSettlementFees, aW as PaymentVerifyPayload, aX as PaymentWebhookSettlement, aY as PlaceSupplierOrderInput, aZ as Plugin, a_ as PluginActionContext, a$ as PluginActionResult, b0 as PluginAuthor, b1 as PluginConfigFieldDependency, b2 as PluginFactory, b3 as PluginManifest, b4 as RepeaterBlock, b5 as RepeaterSource, b6 as SearchBlock, b7 as SecretStore, b8 as SequenceStore, b9 as SetupAction, ba as SetupLayout, bb as SetupLayoutValidation, bc as SetupStep, bd as ShipmentAddress, be as ShipmentParcel, bf as ShipmentResult, bg as ShippingDefaultConfig, bh as ShippingFeature, bi as ShippingPluginConfig, bj as ShippingQuote, bk as ShippingQuoteParams, bl as ShippingStaticConfig, bm as SourcedProduct, bn as StatBlock, bo as StepStatusFrom, bp as StepStatusFromAction, bq as StepStatusFromFields, br as StepStatusSource, bs as StorageBroker, bt as SupplierCatalogQuery, bu as SupplierFulfillmentEvent, bv as SupplierListing, bw as SupplierListingAttribute, bx as SupplierListingPage, by as SupplierListingVariant, bz as SupplierMoney, bA as SupplierOrderAddressLevel, bB as SupplierOrderCustomer, bC as SupplierOrderLine, bD as SupplierOrderResult, bE as SupplierOrderStatus, bF as SupplierShipTo, bG as SupplierShippingQuote, bH as SupplierShippingQuoteInput, bI as SupplierStock, bJ as SuppliersDefaultConfig, bK as SuppliersFeature, bL as SuppliersPluginConfig, bM as SuppliersStaticConfig, bN as TabItem, bO as TableBlock, bP as TableCell, bQ as TableColumn, bR as TableColumnSort, bS as TablePagination, bT as TableRichCell, bU as TableSort, bV as TabsBlock, bW as ToggleBlock, bX as ToolbarBlock, bY as TrackingEvent, bZ as TransactionStatus, b_ as UiContribution, b$ as UiContributionsValidation, c0 as UiSlot, c1 as UiSlotContext, c2 as VoidInvoiceInput, c3 as WebhookSignatureResult, c4 as analyticsCapability, c5 as capability, c6 as crossValidateSetupLayout, c7 as definePlugin, c8 as invoicingCapability, c9 as isConfigurablePlugin, ca as isPluginFactory, cb as minorUnitDigits, cc as paymentCapability, cd as shippingCapability, ce as suppliersCapability, cf as toMajorUnits, cg as toMinorUnits, ch as uiCapability, ci as validatePluginAuthor, cj as validateSetupLayout, ck as validateUiContributions } from './host-api-C5EsRbsA.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.7.
|
|
77
|
+
declare const SDK_VERSION = "0.7.2";
|
|
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
|
@@ -572,6 +572,11 @@ var ContentBlockType = /* @__PURE__ */ ((ContentBlockType2) => {
|
|
|
572
572
|
ContentBlockType2["Stat"] = "stat";
|
|
573
573
|
ContentBlockType2["Table"] = "table";
|
|
574
574
|
ContentBlockType2["Chart"] = "chart";
|
|
575
|
+
ContentBlockType2["Filter"] = "filter";
|
|
576
|
+
ContentBlockType2["Grid"] = "grid";
|
|
577
|
+
ContentBlockType2["Search"] = "search";
|
|
578
|
+
ContentBlockType2["Details"] = "details";
|
|
579
|
+
ContentBlockType2["Toolbar"] = "toolbar";
|
|
575
580
|
return ContentBlockType2;
|
|
576
581
|
})(ContentBlockType || {});
|
|
577
582
|
var UiSlot = {
|
|
@@ -619,12 +624,14 @@ var sCopyFieldBlock2 = (0, import_superstruct3.object)({
|
|
|
619
624
|
value: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
620
625
|
computedKey: (0, import_superstruct3.optional)((0, import_superstruct3.string)())
|
|
621
626
|
});
|
|
627
|
+
var sPageParams = (0, import_superstruct3.record)((0, import_superstruct3.string)(), (0, import_superstruct3.union)([(0, import_superstruct3.string)(), (0, import_superstruct3.literal)(null)]));
|
|
622
628
|
var sLinkBlock = (0, import_superstruct3.object)({
|
|
623
629
|
type: (0, import_superstruct3.literal)("link" /* Link */),
|
|
624
630
|
label: (0, import_superstruct3.string)(),
|
|
625
631
|
href: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
626
632
|
computedKey: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
627
|
-
external: (0, import_superstruct3.optional)((0, import_superstruct3.boolean)())
|
|
633
|
+
external: (0, import_superstruct3.optional)((0, import_superstruct3.boolean)()),
|
|
634
|
+
params: (0, import_superstruct3.optional)(sPageParams)
|
|
628
635
|
});
|
|
629
636
|
var sDividerBlock2 = (0, import_superstruct3.object)({ type: (0, import_superstruct3.literal)("divider" /* Divider */) });
|
|
630
637
|
var sActionBlock2 = (0, import_superstruct3.object)({
|
|
@@ -633,7 +640,18 @@ var sActionBlock2 = (0, import_superstruct3.object)({
|
|
|
633
640
|
label: (0, import_superstruct3.string)(),
|
|
634
641
|
variant: (0, import_superstruct3.optional)(sContentActionVariant)
|
|
635
642
|
});
|
|
636
|
-
var sTableCell = (0, import_superstruct3.union)([
|
|
643
|
+
var sTableCell = (0, import_superstruct3.union)([
|
|
644
|
+
(0, import_superstruct3.string)(),
|
|
645
|
+
(0, import_superstruct3.number)(),
|
|
646
|
+
(0, import_superstruct3.boolean)(),
|
|
647
|
+
(0, import_superstruct3.literal)(null),
|
|
648
|
+
(0, import_superstruct3.object)({
|
|
649
|
+
text: (0, import_superstruct3.string)(),
|
|
650
|
+
caption: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
651
|
+
image: (0, import_superstruct3.optional)((0, import_superstruct3.union)([(0, import_superstruct3.string)(), (0, import_superstruct3.literal)(null)])),
|
|
652
|
+
tone: (0, import_superstruct3.optional)(sMessageVariant2)
|
|
653
|
+
})
|
|
654
|
+
]);
|
|
637
655
|
var sStatBlock = (0, import_superstruct3.object)({
|
|
638
656
|
type: (0, import_superstruct3.literal)("stat" /* Stat */),
|
|
639
657
|
label: (0, import_superstruct3.string)(),
|
|
@@ -641,7 +659,8 @@ var sStatBlock = (0, import_superstruct3.object)({
|
|
|
641
659
|
computedKey: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
642
660
|
hint: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
643
661
|
variant: (0, import_superstruct3.optional)(sMessageVariant2),
|
|
644
|
-
estimate: (0, import_superstruct3.optional)((0, import_superstruct3.boolean)())
|
|
662
|
+
estimate: (0, import_superstruct3.optional)((0, import_superstruct3.boolean)()),
|
|
663
|
+
params: (0, import_superstruct3.optional)(sPageParams)
|
|
645
664
|
});
|
|
646
665
|
var sTableBlock = (0, import_superstruct3.object)({
|
|
647
666
|
type: (0, import_superstruct3.literal)("table" /* Table */),
|
|
@@ -650,15 +669,38 @@ var sTableBlock = (0, import_superstruct3.object)({
|
|
|
650
669
|
(0, import_superstruct3.object)({
|
|
651
670
|
key: (0, import_superstruct3.string)(),
|
|
652
671
|
label: (0, import_superstruct3.string)(),
|
|
653
|
-
align: (0, import_superstruct3.optional)((0, import_superstruct3.enums)(["left", "right"]))
|
|
672
|
+
align: (0, import_superstruct3.optional)((0, import_superstruct3.enums)(["left", "right"])),
|
|
673
|
+
hint: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
674
|
+
sort: (0, import_superstruct3.optional)(
|
|
675
|
+
(0, import_superstruct3.object)({
|
|
676
|
+
value: (0, import_superstruct3.string)(),
|
|
677
|
+
dir: (0, import_superstruct3.optional)((0, import_superstruct3.enums)(["asc", "desc"]))
|
|
678
|
+
})
|
|
679
|
+
)
|
|
654
680
|
})
|
|
655
681
|
),
|
|
656
682
|
rows: (0, import_superstruct3.array)((0, import_superstruct3.record)((0, import_superstruct3.string)(), sTableCell)),
|
|
657
|
-
emptyText: (0, import_superstruct3.optional)((0, import_superstruct3.string)())
|
|
683
|
+
emptyText: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
684
|
+
rowParams: (0, import_superstruct3.optional)((0, import_superstruct3.array)((0, import_superstruct3.union)([sPageParams, (0, import_superstruct3.literal)(null)]))),
|
|
685
|
+
sort: (0, import_superstruct3.optional)(
|
|
686
|
+
(0, import_superstruct3.object)({
|
|
687
|
+
param: (0, import_superstruct3.string)(),
|
|
688
|
+
value: (0, import_superstruct3.string)(),
|
|
689
|
+
resets: (0, import_superstruct3.optional)((0, import_superstruct3.array)((0, import_superstruct3.string)()))
|
|
690
|
+
})
|
|
691
|
+
),
|
|
692
|
+
pagination: (0, import_superstruct3.optional)(
|
|
693
|
+
(0, import_superstruct3.object)({
|
|
694
|
+
param: (0, import_superstruct3.string)(),
|
|
695
|
+
page: (0, import_superstruct3.number)(),
|
|
696
|
+
pageSize: (0, import_superstruct3.number)(),
|
|
697
|
+
total: (0, import_superstruct3.number)()
|
|
698
|
+
})
|
|
699
|
+
)
|
|
658
700
|
});
|
|
659
701
|
var sChartBlock = (0, import_superstruct3.object)({
|
|
660
702
|
type: (0, import_superstruct3.literal)("chart" /* Chart */),
|
|
661
|
-
kind: (0, import_superstruct3.enums)(["bar", "line"]),
|
|
703
|
+
kind: (0, import_superstruct3.enums)(["bar", "line", "hbar"]),
|
|
662
704
|
title: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
663
705
|
labels: (0, import_superstruct3.array)((0, import_superstruct3.string)()),
|
|
664
706
|
series: (0, import_superstruct3.array)(
|
|
@@ -670,6 +712,38 @@ var sChartBlock = (0, import_superstruct3.object)({
|
|
|
670
712
|
unit: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
671
713
|
emptyText: (0, import_superstruct3.optional)((0, import_superstruct3.string)())
|
|
672
714
|
});
|
|
715
|
+
var sFilterBlock = (0, import_superstruct3.object)({
|
|
716
|
+
type: (0, import_superstruct3.literal)("filter" /* Filter */),
|
|
717
|
+
param: (0, import_superstruct3.string)(),
|
|
718
|
+
label: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
719
|
+
value: (0, import_superstruct3.string)(),
|
|
720
|
+
options: (0, import_superstruct3.size)((0, import_superstruct3.array)((0, import_superstruct3.object)({ value: (0, import_superstruct3.string)(), label: (0, import_superstruct3.string)() })), 1, Infinity),
|
|
721
|
+
display: (0, import_superstruct3.optional)((0, import_superstruct3.enums)(["segmented", "select", "tabs"])),
|
|
722
|
+
resets: (0, import_superstruct3.optional)((0, import_superstruct3.array)((0, import_superstruct3.string)()))
|
|
723
|
+
});
|
|
724
|
+
var sSearchBlock = (0, import_superstruct3.object)({
|
|
725
|
+
type: (0, import_superstruct3.literal)("search" /* Search */),
|
|
726
|
+
param: (0, import_superstruct3.string)(),
|
|
727
|
+
value: (0, import_superstruct3.string)(),
|
|
728
|
+
label: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
729
|
+
placeholder: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
730
|
+
resets: (0, import_superstruct3.optional)((0, import_superstruct3.array)((0, import_superstruct3.string)()))
|
|
731
|
+
});
|
|
732
|
+
var sToolbarBlock = (0, import_superstruct3.object)({
|
|
733
|
+
type: (0, import_superstruct3.literal)("toolbar" /* Toolbar */),
|
|
734
|
+
blocks: (0, import_superstruct3.array)((0, import_superstruct3.lazy)(() => sContentBlock))
|
|
735
|
+
});
|
|
736
|
+
var sGridBlock = (0, import_superstruct3.object)({
|
|
737
|
+
type: (0, import_superstruct3.literal)("grid" /* Grid */),
|
|
738
|
+
columns: (0, import_superstruct3.union)([(0, import_superstruct3.literal)(2), (0, import_superstruct3.literal)(3), (0, import_superstruct3.literal)(4)]),
|
|
739
|
+
blocks: (0, import_superstruct3.array)((0, import_superstruct3.lazy)(() => sContentBlock))
|
|
740
|
+
});
|
|
741
|
+
var sDetailsBlock = (0, import_superstruct3.object)({
|
|
742
|
+
type: (0, import_superstruct3.literal)("details" /* Details */),
|
|
743
|
+
summary: (0, import_superstruct3.string)(),
|
|
744
|
+
blocks: (0, import_superstruct3.array)((0, import_superstruct3.lazy)(() => sContentBlock)),
|
|
745
|
+
open: (0, import_superstruct3.optional)((0, import_superstruct3.boolean)())
|
|
746
|
+
});
|
|
673
747
|
var sCardBlock2 = (0, import_superstruct3.object)({
|
|
674
748
|
type: (0, import_superstruct3.literal)("card" /* Card */),
|
|
675
749
|
title: (0, import_superstruct3.optional)((0, import_superstruct3.string)()),
|
|
@@ -688,7 +762,12 @@ var sContentBlock = (0, import_superstruct3.union)([
|
|
|
688
762
|
sCardBlock2,
|
|
689
763
|
sStatBlock,
|
|
690
764
|
sTableBlock,
|
|
691
|
-
sChartBlock
|
|
765
|
+
sChartBlock,
|
|
766
|
+
sFilterBlock,
|
|
767
|
+
sGridBlock,
|
|
768
|
+
sSearchBlock,
|
|
769
|
+
sDetailsBlock,
|
|
770
|
+
sToolbarBlock
|
|
692
771
|
]);
|
|
693
772
|
var sUiContribution = (0, import_superstruct3.object)({
|
|
694
773
|
slot: (0, import_superstruct3.string)(),
|
|
@@ -789,7 +868,7 @@ function checkPermissions(required, grantedRaw) {
|
|
|
789
868
|
}
|
|
790
869
|
|
|
791
870
|
// src/version.ts
|
|
792
|
-
var SDK_VERSION = "0.7.
|
|
871
|
+
var SDK_VERSION = "0.7.2";
|
|
793
872
|
function isSdkCompatible(pluginSdkVersion, hostSdkVersion) {
|
|
794
873
|
const parse = (v) => {
|
|
795
874
|
const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v);
|
package/dist/index.mjs
CHANGED
|
@@ -518,6 +518,7 @@ import {
|
|
|
518
518
|
object as object2,
|
|
519
519
|
optional as optional3,
|
|
520
520
|
record,
|
|
521
|
+
size,
|
|
521
522
|
string as string3,
|
|
522
523
|
union as union2,
|
|
523
524
|
validate as validate3
|
|
@@ -535,6 +536,11 @@ var ContentBlockType = /* @__PURE__ */ ((ContentBlockType2) => {
|
|
|
535
536
|
ContentBlockType2["Stat"] = "stat";
|
|
536
537
|
ContentBlockType2["Table"] = "table";
|
|
537
538
|
ContentBlockType2["Chart"] = "chart";
|
|
539
|
+
ContentBlockType2["Filter"] = "filter";
|
|
540
|
+
ContentBlockType2["Grid"] = "grid";
|
|
541
|
+
ContentBlockType2["Search"] = "search";
|
|
542
|
+
ContentBlockType2["Details"] = "details";
|
|
543
|
+
ContentBlockType2["Toolbar"] = "toolbar";
|
|
538
544
|
return ContentBlockType2;
|
|
539
545
|
})(ContentBlockType || {});
|
|
540
546
|
var UiSlot = {
|
|
@@ -582,12 +588,14 @@ var sCopyFieldBlock2 = object2({
|
|
|
582
588
|
value: optional3(string3()),
|
|
583
589
|
computedKey: optional3(string3())
|
|
584
590
|
});
|
|
591
|
+
var sPageParams = record(string3(), union2([string3(), literal2(null)]));
|
|
585
592
|
var sLinkBlock = object2({
|
|
586
593
|
type: literal2("link" /* Link */),
|
|
587
594
|
label: string3(),
|
|
588
595
|
href: optional3(string3()),
|
|
589
596
|
computedKey: optional3(string3()),
|
|
590
|
-
external: optional3(boolean3())
|
|
597
|
+
external: optional3(boolean3()),
|
|
598
|
+
params: optional3(sPageParams)
|
|
591
599
|
});
|
|
592
600
|
var sDividerBlock2 = object2({ type: literal2("divider" /* Divider */) });
|
|
593
601
|
var sActionBlock2 = object2({
|
|
@@ -596,7 +604,18 @@ var sActionBlock2 = object2({
|
|
|
596
604
|
label: string3(),
|
|
597
605
|
variant: optional3(sContentActionVariant)
|
|
598
606
|
});
|
|
599
|
-
var sTableCell = union2([
|
|
607
|
+
var sTableCell = union2([
|
|
608
|
+
string3(),
|
|
609
|
+
number3(),
|
|
610
|
+
boolean3(),
|
|
611
|
+
literal2(null),
|
|
612
|
+
object2({
|
|
613
|
+
text: string3(),
|
|
614
|
+
caption: optional3(string3()),
|
|
615
|
+
image: optional3(union2([string3(), literal2(null)])),
|
|
616
|
+
tone: optional3(sMessageVariant2)
|
|
617
|
+
})
|
|
618
|
+
]);
|
|
600
619
|
var sStatBlock = object2({
|
|
601
620
|
type: literal2("stat" /* Stat */),
|
|
602
621
|
label: string3(),
|
|
@@ -604,7 +623,8 @@ var sStatBlock = object2({
|
|
|
604
623
|
computedKey: optional3(string3()),
|
|
605
624
|
hint: optional3(string3()),
|
|
606
625
|
variant: optional3(sMessageVariant2),
|
|
607
|
-
estimate: optional3(boolean3())
|
|
626
|
+
estimate: optional3(boolean3()),
|
|
627
|
+
params: optional3(sPageParams)
|
|
608
628
|
});
|
|
609
629
|
var sTableBlock = object2({
|
|
610
630
|
type: literal2("table" /* Table */),
|
|
@@ -613,15 +633,38 @@ var sTableBlock = object2({
|
|
|
613
633
|
object2({
|
|
614
634
|
key: string3(),
|
|
615
635
|
label: string3(),
|
|
616
|
-
align: optional3(enums3(["left", "right"]))
|
|
636
|
+
align: optional3(enums3(["left", "right"])),
|
|
637
|
+
hint: optional3(string3()),
|
|
638
|
+
sort: optional3(
|
|
639
|
+
object2({
|
|
640
|
+
value: string3(),
|
|
641
|
+
dir: optional3(enums3(["asc", "desc"]))
|
|
642
|
+
})
|
|
643
|
+
)
|
|
617
644
|
})
|
|
618
645
|
),
|
|
619
646
|
rows: array2(record(string3(), sTableCell)),
|
|
620
|
-
emptyText: optional3(string3())
|
|
647
|
+
emptyText: optional3(string3()),
|
|
648
|
+
rowParams: optional3(array2(union2([sPageParams, literal2(null)]))),
|
|
649
|
+
sort: optional3(
|
|
650
|
+
object2({
|
|
651
|
+
param: string3(),
|
|
652
|
+
value: string3(),
|
|
653
|
+
resets: optional3(array2(string3()))
|
|
654
|
+
})
|
|
655
|
+
),
|
|
656
|
+
pagination: optional3(
|
|
657
|
+
object2({
|
|
658
|
+
param: string3(),
|
|
659
|
+
page: number3(),
|
|
660
|
+
pageSize: number3(),
|
|
661
|
+
total: number3()
|
|
662
|
+
})
|
|
663
|
+
)
|
|
621
664
|
});
|
|
622
665
|
var sChartBlock = object2({
|
|
623
666
|
type: literal2("chart" /* Chart */),
|
|
624
|
-
kind: enums3(["bar", "line"]),
|
|
667
|
+
kind: enums3(["bar", "line", "hbar"]),
|
|
625
668
|
title: optional3(string3()),
|
|
626
669
|
labels: array2(string3()),
|
|
627
670
|
series: array2(
|
|
@@ -633,6 +676,38 @@ var sChartBlock = object2({
|
|
|
633
676
|
unit: optional3(string3()),
|
|
634
677
|
emptyText: optional3(string3())
|
|
635
678
|
});
|
|
679
|
+
var sFilterBlock = object2({
|
|
680
|
+
type: literal2("filter" /* Filter */),
|
|
681
|
+
param: string3(),
|
|
682
|
+
label: optional3(string3()),
|
|
683
|
+
value: string3(),
|
|
684
|
+
options: size(array2(object2({ value: string3(), label: string3() })), 1, Infinity),
|
|
685
|
+
display: optional3(enums3(["segmented", "select", "tabs"])),
|
|
686
|
+
resets: optional3(array2(string3()))
|
|
687
|
+
});
|
|
688
|
+
var sSearchBlock = object2({
|
|
689
|
+
type: literal2("search" /* Search */),
|
|
690
|
+
param: string3(),
|
|
691
|
+
value: string3(),
|
|
692
|
+
label: optional3(string3()),
|
|
693
|
+
placeholder: optional3(string3()),
|
|
694
|
+
resets: optional3(array2(string3()))
|
|
695
|
+
});
|
|
696
|
+
var sToolbarBlock = object2({
|
|
697
|
+
type: literal2("toolbar" /* Toolbar */),
|
|
698
|
+
blocks: array2(lazy2(() => sContentBlock))
|
|
699
|
+
});
|
|
700
|
+
var sGridBlock = object2({
|
|
701
|
+
type: literal2("grid" /* Grid */),
|
|
702
|
+
columns: union2([literal2(2), literal2(3), literal2(4)]),
|
|
703
|
+
blocks: array2(lazy2(() => sContentBlock))
|
|
704
|
+
});
|
|
705
|
+
var sDetailsBlock = object2({
|
|
706
|
+
type: literal2("details" /* Details */),
|
|
707
|
+
summary: string3(),
|
|
708
|
+
blocks: array2(lazy2(() => sContentBlock)),
|
|
709
|
+
open: optional3(boolean3())
|
|
710
|
+
});
|
|
636
711
|
var sCardBlock2 = object2({
|
|
637
712
|
type: literal2("card" /* Card */),
|
|
638
713
|
title: optional3(string3()),
|
|
@@ -651,7 +726,12 @@ var sContentBlock = union2([
|
|
|
651
726
|
sCardBlock2,
|
|
652
727
|
sStatBlock,
|
|
653
728
|
sTableBlock,
|
|
654
|
-
sChartBlock
|
|
729
|
+
sChartBlock,
|
|
730
|
+
sFilterBlock,
|
|
731
|
+
sGridBlock,
|
|
732
|
+
sSearchBlock,
|
|
733
|
+
sDetailsBlock,
|
|
734
|
+
sToolbarBlock
|
|
655
735
|
]);
|
|
656
736
|
var sUiContribution = object2({
|
|
657
737
|
slot: string3(),
|
|
@@ -720,7 +800,7 @@ function isPluginFactory(value) {
|
|
|
720
800
|
}
|
|
721
801
|
|
|
722
802
|
// src/version.ts
|
|
723
|
-
var SDK_VERSION = "0.7.
|
|
803
|
+
var SDK_VERSION = "0.7.2";
|
|
724
804
|
function isSdkCompatible(pluginSdkVersion, hostSdkVersion) {
|
|
725
805
|
const parse = (v) => {
|
|
726
806
|
const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v);
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ab as HostApi, ad as HttpRequest, $ as DomainEventName, v as Capability, _ as DomainEventHandler, ae as HttpResponse, bm as SourcedProduct, Y as DispatchContext } from '../host-api-C5EsRbsA.mjs';
|
|
2
2
|
|
|
3
3
|
/** Every recorded interaction, keyed by `"port.method"`. */
|
|
4
4
|
interface MockHostCalls {
|
|
@@ -10,6 +10,7 @@ interface MockHostCalls {
|
|
|
10
10
|
body: Uint8Array | string;
|
|
11
11
|
}>;
|
|
12
12
|
'sequence.next': string[];
|
|
13
|
+
'catalog.listSourcedProducts': string[];
|
|
13
14
|
'host.on': DomainEventName[];
|
|
14
15
|
}
|
|
15
16
|
interface MockHostOptions {
|
|
@@ -29,6 +30,11 @@ interface MockHostOptions {
|
|
|
29
30
|
httpResponses?: Record<string, HttpResponse>;
|
|
30
31
|
/** Seed values for named sequence scopes (monotonic from here). */
|
|
31
32
|
sequences?: Record<string, number>;
|
|
33
|
+
/**
|
|
34
|
+
* Canned store products by supplier code (sourced products). When set, the mock exposes
|
|
35
|
+
* `catalog`; omit it to test a plugin against a host without that port.
|
|
36
|
+
*/
|
|
37
|
+
sourcedProducts?: Record<string, SourcedProduct[]>;
|
|
32
38
|
}
|
|
33
39
|
interface MockHostApi extends HostApi {
|
|
34
40
|
/** Every port call recorded in order. */
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ab as HostApi, ad as HttpRequest, $ as DomainEventName, v as Capability, _ as DomainEventHandler, ae as HttpResponse, bm as SourcedProduct, Y as DispatchContext } from '../host-api-C5EsRbsA.js';
|
|
2
2
|
|
|
3
3
|
/** Every recorded interaction, keyed by `"port.method"`. */
|
|
4
4
|
interface MockHostCalls {
|
|
@@ -10,6 +10,7 @@ interface MockHostCalls {
|
|
|
10
10
|
body: Uint8Array | string;
|
|
11
11
|
}>;
|
|
12
12
|
'sequence.next': string[];
|
|
13
|
+
'catalog.listSourcedProducts': string[];
|
|
13
14
|
'host.on': DomainEventName[];
|
|
14
15
|
}
|
|
15
16
|
interface MockHostOptions {
|
|
@@ -29,6 +30,11 @@ interface MockHostOptions {
|
|
|
29
30
|
httpResponses?: Record<string, HttpResponse>;
|
|
30
31
|
/** Seed values for named sequence scopes (monotonic from here). */
|
|
31
32
|
sequences?: Record<string, number>;
|
|
33
|
+
/**
|
|
34
|
+
* Canned store products by supplier code (sourced products). When set, the mock exposes
|
|
35
|
+
* `catalog`; omit it to test a plugin against a host without that port.
|
|
36
|
+
*/
|
|
37
|
+
sourcedProducts?: Record<string, SourcedProduct[]>;
|
|
32
38
|
}
|
|
33
39
|
interface MockHostApi extends HostApi {
|
|
34
40
|
/** Every port call recorded in order. */
|
package/dist/testing/index.js
CHANGED
|
@@ -66,6 +66,7 @@ function createMockHostApi(opts = {}) {
|
|
|
66
66
|
"storage.getUrl": [],
|
|
67
67
|
"storage.put": [],
|
|
68
68
|
"sequence.next": [],
|
|
69
|
+
"catalog.listSourcedProducts": [],
|
|
69
70
|
"host.on": []
|
|
70
71
|
};
|
|
71
72
|
const registered = [];
|
|
@@ -128,12 +129,20 @@ function createMockHostApi(opts = {}) {
|
|
|
128
129
|
return Promise.resolve(next);
|
|
129
130
|
}
|
|
130
131
|
};
|
|
132
|
+
const listings = opts.sourcedProducts;
|
|
133
|
+
const catalog = listings ? {
|
|
134
|
+
listSourcedProducts: (code) => {
|
|
135
|
+
calls["catalog.listSourcedProducts"].push(code);
|
|
136
|
+
return Promise.resolve(listings[code] ?? []);
|
|
137
|
+
}
|
|
138
|
+
} : void 0;
|
|
131
139
|
const host = {
|
|
132
140
|
logger,
|
|
133
141
|
http,
|
|
134
142
|
secrets,
|
|
135
143
|
storage,
|
|
136
144
|
sequence,
|
|
145
|
+
...catalog ? { catalog } : {},
|
|
137
146
|
calls,
|
|
138
147
|
registered,
|
|
139
148
|
handlers,
|
package/dist/testing/index.mjs
CHANGED
|
@@ -11,6 +11,7 @@ function createMockHostApi(opts = {}) {
|
|
|
11
11
|
"storage.getUrl": [],
|
|
12
12
|
"storage.put": [],
|
|
13
13
|
"sequence.next": [],
|
|
14
|
+
"catalog.listSourcedProducts": [],
|
|
14
15
|
"host.on": []
|
|
15
16
|
};
|
|
16
17
|
const registered = [];
|
|
@@ -73,12 +74,20 @@ function createMockHostApi(opts = {}) {
|
|
|
73
74
|
return Promise.resolve(next);
|
|
74
75
|
}
|
|
75
76
|
};
|
|
77
|
+
const listings = opts.sourcedProducts;
|
|
78
|
+
const catalog = listings ? {
|
|
79
|
+
listSourcedProducts: (code) => {
|
|
80
|
+
calls["catalog.listSourcedProducts"].push(code);
|
|
81
|
+
return Promise.resolve(listings[code] ?? []);
|
|
82
|
+
}
|
|
83
|
+
} : void 0;
|
|
76
84
|
const host = {
|
|
77
85
|
logger,
|
|
78
86
|
http,
|
|
79
87
|
secrets,
|
|
80
88
|
storage,
|
|
81
89
|
sequence,
|
|
90
|
+
...catalog ? { catalog } : {},
|
|
82
91
|
calls,
|
|
83
92
|
registered,
|
|
84
93
|
handlers,
|