@vivoa/plugin-sdk 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -509,7 +509,14 @@ declare enum ShippingFeature {
509
509
  Tracking = "tracking",
510
510
  Cod = "cod",
511
511
  Quotes = "quotes",
512
- Labels = "labels"
512
+ Labels = "labels",
513
+ /**
514
+ * The carrier pushes shipment status changes to a registered webhook URL,
515
+ * and the plugin can normalize + authenticate that payload via
516
+ * {@link IShippingPlugin.parseWebhook}. Enables unattended order transitions
517
+ * (e.g. → delivered) instead of manual admin updates.
518
+ */
519
+ TrackingSync = "tracking-sync"
513
520
  }
514
521
  declare enum CodFeeType {
515
522
  Percentage = "percentage",
@@ -610,6 +617,24 @@ interface ShipmentResult {
610
617
  status: string;
611
618
  rawResponse?: Record<string, unknown>;
612
619
  }
620
+ /**
621
+ * Normalized, carrier-agnostic shipment status event produced by
622
+ * {@link IShippingPlugin.parseWebhook}. The host matches `trackingNumber`
623
+ * against its stored shipment to resolve the order, so the plugin never needs
624
+ * host identifiers. `status: 'unknown'` is a first-class value for carrier
625
+ * states the plugin does not map — the host treats it as a no-op instead of
626
+ * guessing a transition.
627
+ */
628
+ interface TrackingEvent {
629
+ trackingNumber: string;
630
+ status: 'in_transit' | 'delivered' | 'cancelled' | 'unknown';
631
+ /** ISO-8601 instant the carrier reported the change, when available. */
632
+ occurredAt?: string;
633
+ /** Human-readable carrier status, for audit/logging. */
634
+ statusDescription?: string;
635
+ /** Untouched carrier payload, for diagnostics. Never trusted for control flow. */
636
+ raw?: unknown;
637
+ }
613
638
  interface IShippingPlugin extends IPlugin {
614
639
  readonly name: string;
615
640
  readonly shippingConfig: ShippingPluginConfig;
@@ -617,6 +642,7 @@ interface IShippingPlugin extends IPlugin {
617
642
  getQuotes?(params: ShippingQuoteParams, ctx: DispatchContext): Promise<ShippingQuote[]>;
618
643
  /** Pure — a tracking URL never depends on tenant config. */
619
644
  getTrackingUrl(trackingNumber: string): string;
645
+ parseWebhook?(body: unknown, headers: Record<string, string>, ctx: DispatchContext): TrackingEvent | null;
620
646
  isConfigured?(ctx: DispatchContext): boolean;
621
647
  }
622
648
 
@@ -776,7 +802,7 @@ declare function checkPermissions(required: string[], grantedRaw: string[]): Per
776
802
  * - MINOR: additive (new optional fields, new tokens) — backwards compatible.
777
803
  * - PATCH: docs/fixes with zero shape changes.
778
804
  */
779
- declare const SDK_VERSION = "0.5.0";
805
+ declare const SDK_VERSION = "0.5.1";
780
806
  /**
781
807
  * True when a plugin built against `pluginSdkVersion` can run on a host that
782
808
  * ships `hostSdkVersion`. Rule: same major, host minor >= plugin minor.
@@ -785,4 +811,4 @@ declare const SDK_VERSION = "0.5.0";
785
811
  */
786
812
  declare function isSdkCompatible(pluginSdkVersion: string, hostSdkVersion: string): boolean;
787
813
 
788
- export { type AccordionBlock, type AccordionSection, type ActionBlock, ActionVariant, type BannerBlock, type Block, type BlockBase, BlockType, type CalloutBlock, type Capability, CapabilityKind, type CardBlock, type CodConfig, type CodFeeConfig, CodFeeType, type ConditionalBlock, type ConditionalEquals, type ConditionalWhen, ConfigScope, type ConfigurablePlugin, type CopyFieldBlock, type CreateShipmentParams, type DispatchContext, type DividerBlock, type DomainEventHandler, type DomainEventName, type FieldBlock, type FieldDefinition, type FieldDependsOn, type FieldMap, type FieldOption, FieldType, FieldVariant, GatewayEnvironment, type GatewayStaticConfig, type GroupBlock, type HostApi, type HttpClient, type HttpRequest, type HttpResponse, type IPaymentPlugin, type IPlugin, type IShippingPlugin, type InlineRowBlock, type KeyValueBlock, type KeyValueRow, LayoutMode, type Logger, type MarkdownBlock, MessageVariant, PAYMENT_PLUGIN_TOKEN, type PaymentCard, type PaymentCustomer, type PaymentGatewayCode, type PaymentPayload, type PaymentPluginConfig, type PaymentResult, type PaymentVerifyPayload, type Permission, type PermissionCheck, type Plugin, type PluginActionContext, type PluginActionResult, type PluginConfigField, type PluginConfigFieldDependency, type PluginConfigResult, type PluginConfigValidation, type PluginFactory, type PluginManifest, PluginType, type RepeaterBlock, RepeaterSource, SDK_VERSION, SHIPPING_PLUGIN_TOKEN, type SecretStore, type SelectOption, type SequenceStore, type SetupAction, type SetupLayout, type SetupLayoutValidation, type SetupStep, type ShipmentAddress, type ShipmentParcel, type ShipmentResult, type ShippingDefaultConfig, ShippingFeature, type ShippingPluginConfig, type ShippingQuote, type ShippingQuoteParams, type ShippingStaticConfig, StepStatusFrom, type StepStatusFromAction, type StepStatusFromFields, type StepStatusSource, type StorageBroker, type TabItem, type TabsBlock, type ToggleBlock, TransactionStatus, type WebhookSignatureResult, capability, checkPermissions, createPluginConfig, crossValidateSetupLayout, definePlugin, field, isConfigurablePlugin, isPermissionGranted, isPluginFactory, isSdkCompatible, parsePermission, paymentCapability, shippingCapability, validateSetupLayout };
814
+ export { type AccordionBlock, type AccordionSection, type ActionBlock, ActionVariant, type BannerBlock, type Block, type BlockBase, BlockType, type CalloutBlock, type Capability, CapabilityKind, type CardBlock, type CodConfig, type CodFeeConfig, CodFeeType, type ConditionalBlock, type ConditionalEquals, type ConditionalWhen, ConfigScope, type ConfigurablePlugin, type CopyFieldBlock, type CreateShipmentParams, type DispatchContext, type DividerBlock, type DomainEventHandler, type DomainEventName, type FieldBlock, type FieldDefinition, type FieldDependsOn, type FieldMap, type FieldOption, FieldType, FieldVariant, GatewayEnvironment, type GatewayStaticConfig, type GroupBlock, type HostApi, type HttpClient, type HttpRequest, type HttpResponse, type IPaymentPlugin, type IPlugin, type IShippingPlugin, type InlineRowBlock, type KeyValueBlock, type KeyValueRow, LayoutMode, type Logger, type MarkdownBlock, MessageVariant, PAYMENT_PLUGIN_TOKEN, type PaymentCard, type PaymentCustomer, type PaymentGatewayCode, type PaymentPayload, type PaymentPluginConfig, type PaymentResult, type PaymentVerifyPayload, type Permission, type PermissionCheck, type Plugin, type PluginActionContext, type PluginActionResult, type PluginConfigField, type PluginConfigFieldDependency, type PluginConfigResult, type PluginConfigValidation, type PluginFactory, type PluginManifest, PluginType, type RepeaterBlock, RepeaterSource, SDK_VERSION, SHIPPING_PLUGIN_TOKEN, type SecretStore, type SelectOption, type SequenceStore, type SetupAction, type SetupLayout, type SetupLayoutValidation, type SetupStep, type ShipmentAddress, type ShipmentParcel, type ShipmentResult, type ShippingDefaultConfig, ShippingFeature, type ShippingPluginConfig, type ShippingQuote, type ShippingQuoteParams, type ShippingStaticConfig, StepStatusFrom, type StepStatusFromAction, type StepStatusFromFields, type StepStatusSource, type StorageBroker, type TabItem, type TabsBlock, type ToggleBlock, type TrackingEvent, TransactionStatus, type WebhookSignatureResult, capability, checkPermissions, createPluginConfig, crossValidateSetupLayout, definePlugin, field, isConfigurablePlugin, isPermissionGranted, isPluginFactory, isSdkCompatible, parsePermission, paymentCapability, shippingCapability, validateSetupLayout };
package/dist/index.d.ts CHANGED
@@ -509,7 +509,14 @@ declare enum ShippingFeature {
509
509
  Tracking = "tracking",
510
510
  Cod = "cod",
511
511
  Quotes = "quotes",
512
- Labels = "labels"
512
+ Labels = "labels",
513
+ /**
514
+ * The carrier pushes shipment status changes to a registered webhook URL,
515
+ * and the plugin can normalize + authenticate that payload via
516
+ * {@link IShippingPlugin.parseWebhook}. Enables unattended order transitions
517
+ * (e.g. → delivered) instead of manual admin updates.
518
+ */
519
+ TrackingSync = "tracking-sync"
513
520
  }
514
521
  declare enum CodFeeType {
515
522
  Percentage = "percentage",
@@ -610,6 +617,24 @@ interface ShipmentResult {
610
617
  status: string;
611
618
  rawResponse?: Record<string, unknown>;
612
619
  }
620
+ /**
621
+ * Normalized, carrier-agnostic shipment status event produced by
622
+ * {@link IShippingPlugin.parseWebhook}. The host matches `trackingNumber`
623
+ * against its stored shipment to resolve the order, so the plugin never needs
624
+ * host identifiers. `status: 'unknown'` is a first-class value for carrier
625
+ * states the plugin does not map — the host treats it as a no-op instead of
626
+ * guessing a transition.
627
+ */
628
+ interface TrackingEvent {
629
+ trackingNumber: string;
630
+ status: 'in_transit' | 'delivered' | 'cancelled' | 'unknown';
631
+ /** ISO-8601 instant the carrier reported the change, when available. */
632
+ occurredAt?: string;
633
+ /** Human-readable carrier status, for audit/logging. */
634
+ statusDescription?: string;
635
+ /** Untouched carrier payload, for diagnostics. Never trusted for control flow. */
636
+ raw?: unknown;
637
+ }
613
638
  interface IShippingPlugin extends IPlugin {
614
639
  readonly name: string;
615
640
  readonly shippingConfig: ShippingPluginConfig;
@@ -617,6 +642,7 @@ interface IShippingPlugin extends IPlugin {
617
642
  getQuotes?(params: ShippingQuoteParams, ctx: DispatchContext): Promise<ShippingQuote[]>;
618
643
  /** Pure — a tracking URL never depends on tenant config. */
619
644
  getTrackingUrl(trackingNumber: string): string;
645
+ parseWebhook?(body: unknown, headers: Record<string, string>, ctx: DispatchContext): TrackingEvent | null;
620
646
  isConfigured?(ctx: DispatchContext): boolean;
621
647
  }
622
648
 
@@ -776,7 +802,7 @@ declare function checkPermissions(required: string[], grantedRaw: string[]): Per
776
802
  * - MINOR: additive (new optional fields, new tokens) — backwards compatible.
777
803
  * - PATCH: docs/fixes with zero shape changes.
778
804
  */
779
- declare const SDK_VERSION = "0.5.0";
805
+ declare const SDK_VERSION = "0.5.1";
780
806
  /**
781
807
  * True when a plugin built against `pluginSdkVersion` can run on a host that
782
808
  * ships `hostSdkVersion`. Rule: same major, host minor >= plugin minor.
@@ -785,4 +811,4 @@ declare const SDK_VERSION = "0.5.0";
785
811
  */
786
812
  declare function isSdkCompatible(pluginSdkVersion: string, hostSdkVersion: string): boolean;
787
813
 
788
- export { type AccordionBlock, type AccordionSection, type ActionBlock, ActionVariant, type BannerBlock, type Block, type BlockBase, BlockType, type CalloutBlock, type Capability, CapabilityKind, type CardBlock, type CodConfig, type CodFeeConfig, CodFeeType, type ConditionalBlock, type ConditionalEquals, type ConditionalWhen, ConfigScope, type ConfigurablePlugin, type CopyFieldBlock, type CreateShipmentParams, type DispatchContext, type DividerBlock, type DomainEventHandler, type DomainEventName, type FieldBlock, type FieldDefinition, type FieldDependsOn, type FieldMap, type FieldOption, FieldType, FieldVariant, GatewayEnvironment, type GatewayStaticConfig, type GroupBlock, type HostApi, type HttpClient, type HttpRequest, type HttpResponse, type IPaymentPlugin, type IPlugin, type IShippingPlugin, type InlineRowBlock, type KeyValueBlock, type KeyValueRow, LayoutMode, type Logger, type MarkdownBlock, MessageVariant, PAYMENT_PLUGIN_TOKEN, type PaymentCard, type PaymentCustomer, type PaymentGatewayCode, type PaymentPayload, type PaymentPluginConfig, type PaymentResult, type PaymentVerifyPayload, type Permission, type PermissionCheck, type Plugin, type PluginActionContext, type PluginActionResult, type PluginConfigField, type PluginConfigFieldDependency, type PluginConfigResult, type PluginConfigValidation, type PluginFactory, type PluginManifest, PluginType, type RepeaterBlock, RepeaterSource, SDK_VERSION, SHIPPING_PLUGIN_TOKEN, type SecretStore, type SelectOption, type SequenceStore, type SetupAction, type SetupLayout, type SetupLayoutValidation, type SetupStep, type ShipmentAddress, type ShipmentParcel, type ShipmentResult, type ShippingDefaultConfig, ShippingFeature, type ShippingPluginConfig, type ShippingQuote, type ShippingQuoteParams, type ShippingStaticConfig, StepStatusFrom, type StepStatusFromAction, type StepStatusFromFields, type StepStatusSource, type StorageBroker, type TabItem, type TabsBlock, type ToggleBlock, TransactionStatus, type WebhookSignatureResult, capability, checkPermissions, createPluginConfig, crossValidateSetupLayout, definePlugin, field, isConfigurablePlugin, isPermissionGranted, isPluginFactory, isSdkCompatible, parsePermission, paymentCapability, shippingCapability, validateSetupLayout };
814
+ export { type AccordionBlock, type AccordionSection, type ActionBlock, ActionVariant, type BannerBlock, type Block, type BlockBase, BlockType, type CalloutBlock, type Capability, CapabilityKind, type CardBlock, type CodConfig, type CodFeeConfig, CodFeeType, type ConditionalBlock, type ConditionalEquals, type ConditionalWhen, ConfigScope, type ConfigurablePlugin, type CopyFieldBlock, type CreateShipmentParams, type DispatchContext, type DividerBlock, type DomainEventHandler, type DomainEventName, type FieldBlock, type FieldDefinition, type FieldDependsOn, type FieldMap, type FieldOption, FieldType, FieldVariant, GatewayEnvironment, type GatewayStaticConfig, type GroupBlock, type HostApi, type HttpClient, type HttpRequest, type HttpResponse, type IPaymentPlugin, type IPlugin, type IShippingPlugin, type InlineRowBlock, type KeyValueBlock, type KeyValueRow, LayoutMode, type Logger, type MarkdownBlock, MessageVariant, PAYMENT_PLUGIN_TOKEN, type PaymentCard, type PaymentCustomer, type PaymentGatewayCode, type PaymentPayload, type PaymentPluginConfig, type PaymentResult, type PaymentVerifyPayload, type Permission, type PermissionCheck, type Plugin, type PluginActionContext, type PluginActionResult, type PluginConfigField, type PluginConfigFieldDependency, type PluginConfigResult, type PluginConfigValidation, type PluginFactory, type PluginManifest, PluginType, type RepeaterBlock, RepeaterSource, SDK_VERSION, SHIPPING_PLUGIN_TOKEN, type SecretStore, type SelectOption, type SequenceStore, type SetupAction, type SetupLayout, type SetupLayoutValidation, type SetupStep, type ShipmentAddress, type ShipmentParcel, type ShipmentResult, type ShippingDefaultConfig, ShippingFeature, type ShippingPluginConfig, type ShippingQuote, type ShippingQuoteParams, type ShippingStaticConfig, StepStatusFrom, type StepStatusFromAction, type StepStatusFromFields, type StepStatusSource, type StorageBroker, type TabItem, type TabsBlock, type ToggleBlock, type TrackingEvent, TransactionStatus, type WebhookSignatureResult, capability, checkPermissions, createPluginConfig, crossValidateSetupLayout, definePlugin, field, isConfigurablePlugin, isPermissionGranted, isPluginFactory, isSdkCompatible, parsePermission, paymentCapability, shippingCapability, validateSetupLayout };
package/dist/index.js CHANGED
@@ -177,6 +177,7 @@ var ShippingFeature = /* @__PURE__ */ ((ShippingFeature2) => {
177
177
  ShippingFeature2["Cod"] = "cod";
178
178
  ShippingFeature2["Quotes"] = "quotes";
179
179
  ShippingFeature2["Labels"] = "labels";
180
+ ShippingFeature2["TrackingSync"] = "tracking-sync";
180
181
  return ShippingFeature2;
181
182
  })(ShippingFeature || {});
182
183
  var CodFeeType = /* @__PURE__ */ ((CodFeeType2) => {
@@ -511,7 +512,7 @@ function checkPermissions(required, grantedRaw) {
511
512
  }
512
513
 
513
514
  // src/version.ts
514
- var SDK_VERSION = "0.5.0";
515
+ var SDK_VERSION = "0.5.1";
515
516
  function isSdkCompatible(pluginSdkVersion, hostSdkVersion) {
516
517
  const parse = (v) => {
517
518
  const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v);
package/dist/index.mjs CHANGED
@@ -128,6 +128,7 @@ var ShippingFeature = /* @__PURE__ */ ((ShippingFeature2) => {
128
128
  ShippingFeature2["Cod"] = "cod";
129
129
  ShippingFeature2["Quotes"] = "quotes";
130
130
  ShippingFeature2["Labels"] = "labels";
131
+ ShippingFeature2["TrackingSync"] = "tracking-sync";
131
132
  return ShippingFeature2;
132
133
  })(ShippingFeature || {});
133
134
  var CodFeeType = /* @__PURE__ */ ((CodFeeType2) => {
@@ -475,7 +476,7 @@ function checkPermissions(required, grantedRaw) {
475
476
  }
476
477
 
477
478
  // src/version.ts
478
- var SDK_VERSION = "0.5.0";
479
+ var SDK_VERSION = "0.5.1";
479
480
  function isSdkCompatible(pluginSdkVersion, hostSdkVersion) {
480
481
  const parse = (v) => {
481
482
  const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vivoa/plugin-sdk",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Public contracts for Vivoa plugins (types, DI tokens, config + setup-layout validators)",
5
5
  "license": "MIT",
6
6
  "author": "Vivoa",