@vivoa/plugin-sdk 0.6.1 → 0.6.3
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 +145 -4
- package/dist/index.d.ts +145 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -473,6 +473,13 @@ interface PaymentResult {
|
|
|
473
473
|
redirectUrl?: string;
|
|
474
474
|
rawResponse?: unknown;
|
|
475
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* How the host should render the payment step for this gateway.
|
|
478
|
+
* - `card-in` host-owned card form, charged via `processPayment` (default).
|
|
479
|
+
* - `offsite-redirect` host sends the shopper to `redirectUrl`.
|
|
480
|
+
* - `embed` gateway-owned iframe initialised via `createPaymentSession`.
|
|
481
|
+
*/
|
|
482
|
+
type PaymentRenderMode = 'card-in' | 'offsite-redirect' | 'embed';
|
|
476
483
|
interface GatewayStaticConfig {
|
|
477
484
|
code: PaymentGatewayCode;
|
|
478
485
|
displayName: string;
|
|
@@ -480,6 +487,53 @@ interface GatewayStaticConfig {
|
|
|
480
487
|
environment: GatewayEnvironment;
|
|
481
488
|
supportedMethods: string[];
|
|
482
489
|
requiredEnvVars: string[];
|
|
490
|
+
/**
|
|
491
|
+
* OPTIONAL render mode. Absent ⇒ host treats the gateway as `'card-in'`.
|
|
492
|
+
* Back-compat: existing card-in plugins (Wompi/Serfinsa) omit this field.
|
|
493
|
+
*/
|
|
494
|
+
renderMode?: PaymentRenderMode;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Cardless payload for creating a gateway-hosted payment session (INV-1).
|
|
498
|
+
* Used by `embed` / `offsite-redirect` gateways where the host never touches
|
|
499
|
+
* card data — the shopper enters it inside the gateway's own surface.
|
|
500
|
+
*/
|
|
501
|
+
interface PaymentSessionPayload {
|
|
502
|
+
/**
|
|
503
|
+
* Charge amount in DECIMAL major units, 2 decimal places (e.g. `12.34`).
|
|
504
|
+
* Matches Boxful `@boxful/contracts` `getTwoDecimals` / `toFixed(2)`.
|
|
505
|
+
*/
|
|
506
|
+
amount: number;
|
|
507
|
+
currency: string;
|
|
508
|
+
orderId: string;
|
|
509
|
+
customer: PaymentCustomer;
|
|
510
|
+
/** Optional display/reconciliation hints shown on the gateway surface. */
|
|
511
|
+
orderSummary?: {
|
|
512
|
+
description?: string;
|
|
513
|
+
merchant?: string;
|
|
514
|
+
reference?: string;
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Everything the host needs to mount a gateway-owned payment iframe.
|
|
519
|
+
* `sessionToken` is OPAQUE to the host; the amount is sealed server-side by the
|
|
520
|
+
* gateway, so the host cannot tamper with it.
|
|
521
|
+
*/
|
|
522
|
+
interface EmbedInit {
|
|
523
|
+
sessionToken: string;
|
|
524
|
+
iframeUrl: string;
|
|
525
|
+
allowedOrigins: string[];
|
|
526
|
+
/** Expiry as epoch SECONDS. Owner TTL guidance: 15 minutes. */
|
|
527
|
+
expiresAt?: number;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Result of `createPaymentSession`. `embedInit` is present iff
|
|
531
|
+
* `renderMode === 'embed'`; `redirectUrl` iff `renderMode === 'offsite-redirect'`.
|
|
532
|
+
*/
|
|
533
|
+
interface PaymentSessionResult {
|
|
534
|
+
renderMode: PaymentRenderMode;
|
|
535
|
+
embedInit?: EmbedInit;
|
|
536
|
+
redirectUrl?: string;
|
|
483
537
|
}
|
|
484
538
|
interface PaymentPluginConfig {
|
|
485
539
|
configSchema: PluginConfigField[];
|
|
@@ -505,6 +559,13 @@ interface IPaymentPlugin extends IPlugin {
|
|
|
505
559
|
queryTransaction?(ref: {
|
|
506
560
|
transactionId: string;
|
|
507
561
|
}, ctx: DispatchContext): Promise<PaymentResult>;
|
|
562
|
+
/**
|
|
563
|
+
* Create a gateway-hosted payment session for `embed` / `offsite-redirect`
|
|
564
|
+
* render modes. OPTIONAL — `card-in` plugins never implement it and charge
|
|
565
|
+
* via `processPayment` instead. STATELESS: gateway credentials arrive per
|
|
566
|
+
* call via `ctx.config` (INV-4); no card data is ever passed here (INV-1).
|
|
567
|
+
*/
|
|
568
|
+
createPaymentSession?(payload: PaymentSessionPayload, ctx: DispatchContext): Promise<PaymentSessionResult>;
|
|
508
569
|
}
|
|
509
570
|
|
|
510
571
|
declare enum ShippingFeature {
|
|
@@ -860,10 +921,14 @@ interface AnalyticsMoney {
|
|
|
860
921
|
}
|
|
861
922
|
/** A single line item attached to an ecommerce event. */
|
|
862
923
|
interface AnalyticsItem {
|
|
863
|
-
/** Product
|
|
924
|
+
/** Product id as the store knows it (Meta `content_ids`, GA4 `item_id`). */
|
|
864
925
|
id: string;
|
|
926
|
+
/** Variant id for catalog-level granularity, when the line resolves one. */
|
|
927
|
+
variantId?: string | null;
|
|
865
928
|
name?: string;
|
|
866
929
|
sku?: string | null;
|
|
930
|
+
/** Brand for catalog feeds that key on it. */
|
|
931
|
+
brand?: string | null;
|
|
867
932
|
quantity?: number;
|
|
868
933
|
price?: AnalyticsMoney;
|
|
869
934
|
category?: string | null;
|
|
@@ -874,21 +939,91 @@ interface AnalyticsItem {
|
|
|
874
939
|
* about a given name simply ignores it.
|
|
875
940
|
*/
|
|
876
941
|
type AnalyticsEventName = 'page_view' | 'view_item' | 'add_to_cart' | 'remove_from_cart' | 'begin_checkout' | 'purchase';
|
|
942
|
+
/**
|
|
943
|
+
* Where the action physically happened. Maps to Meta `action_source`; other
|
|
944
|
+
* providers ignore it. Defaults to `website` when the host omits it.
|
|
945
|
+
*/
|
|
946
|
+
type AnalyticsActionSource = 'website' | 'app' | 'server' | 'phone_call' | 'chat' | 'email' | 'physical_store' | 'other';
|
|
947
|
+
/**
|
|
948
|
+
* Identity + match-quality signals. EVERYTHING here is optional — the host
|
|
949
|
+
* populates whatever it can resolve for the event in scope.
|
|
950
|
+
*
|
|
951
|
+
* @rule The `*Sha256` fields arrive ALREADY hashed by the host (SHA256 hex of
|
|
952
|
+
* the normalized value: lowercased + trimmed; phone in E.164 digits).
|
|
953
|
+
* The plugin NEVER receives raw PII. `externalId`, `clientIpAddress`,
|
|
954
|
+
* `clientUserAgent` and the click ids are the exception — providers
|
|
955
|
+
* require them PLAIN.
|
|
956
|
+
*/
|
|
957
|
+
interface AnalyticsUserData {
|
|
958
|
+
emailSha256?: string | null;
|
|
959
|
+
phoneSha256?: string | null;
|
|
960
|
+
firstNameSha256?: string | null;
|
|
961
|
+
lastNameSha256?: string | null;
|
|
962
|
+
citySha256?: string | null;
|
|
963
|
+
stateSha256?: string | null;
|
|
964
|
+
zipSha256?: string | null;
|
|
965
|
+
countrySha256?: string | null;
|
|
966
|
+
genderSha256?: string | null;
|
|
967
|
+
/** Date of birth, YYYYMMDD normalized then SHA256. */
|
|
968
|
+
dobSha256?: string | null;
|
|
969
|
+
/** Store customer/user id — Meta `external_id` (not hashed by spec). */
|
|
970
|
+
externalId?: string | null;
|
|
971
|
+
/** Plain IPv4/IPv6 — never hashed (geo match). */
|
|
972
|
+
clientIpAddress?: string | null;
|
|
973
|
+
/** Plain browser UA — never hashed (device match). */
|
|
974
|
+
clientUserAgent?: string | null;
|
|
975
|
+
/** Meta browser cookie `_fbp`. */
|
|
976
|
+
fbp?: string | null;
|
|
977
|
+
/** Meta click id `_fbc`. */
|
|
978
|
+
fbc?: string | null;
|
|
979
|
+
/** Google Ads click id. */
|
|
980
|
+
gclid?: string | null;
|
|
981
|
+
/** TikTok click id. */
|
|
982
|
+
ttclid?: string | null;
|
|
983
|
+
}
|
|
984
|
+
/** Marketing attribution captured at the session that led to the event. */
|
|
985
|
+
interface AnalyticsUtm {
|
|
986
|
+
source?: string | null;
|
|
987
|
+
medium?: string | null;
|
|
988
|
+
campaign?: string | null;
|
|
989
|
+
term?: string | null;
|
|
990
|
+
content?: string | null;
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* Consent signals the host resolved for this event. Providers that honor
|
|
994
|
+
* consent (Meta LDU, Google Consent Mode) gate on it; others ignore it.
|
|
995
|
+
*/
|
|
996
|
+
interface AnalyticsConsent {
|
|
997
|
+
adStorage?: boolean;
|
|
998
|
+
adUserData?: boolean;
|
|
999
|
+
adPersonalization?: boolean;
|
|
1000
|
+
}
|
|
877
1001
|
/**
|
|
878
1002
|
* Normalized analytics event. The host builds this from a DomainEvent and hands
|
|
879
1003
|
* it to every active analytics adapter. The adapter translates it to its own
|
|
880
|
-
* wire format (GA4 event, Meta event, ...).
|
|
1004
|
+
* wire format (GA4 event, Meta event, ...). See the @rule SUPERSET note at the
|
|
1005
|
+
* top of the module: this is the superset of what Meta CAPI needs.
|
|
881
1006
|
*/
|
|
882
1007
|
interface AnalyticsEvent {
|
|
883
1008
|
name: AnalyticsEventName;
|
|
884
1009
|
/** ISO-8601 instant the underlying action happened. */
|
|
885
1010
|
occurredAt: string;
|
|
1011
|
+
/**
|
|
1012
|
+
* Stable id for cross-channel deduplication against the browser pixel (Meta
|
|
1013
|
+
* `event_id`). For `purchase` the host sets it to the order id so the pixel
|
|
1014
|
+
* and the server event collapse into one.
|
|
1015
|
+
*/
|
|
1016
|
+
eventId?: string | null;
|
|
1017
|
+
/** Where the action happened — Meta `action_source`. Defaults to `website`. */
|
|
1018
|
+
actionSource?: AnalyticsActionSource;
|
|
886
1019
|
/**
|
|
887
1020
|
* Pseudonymous client identity for sessionization (maps to GA4 `client_id`
|
|
888
1021
|
* / Meta `external_id`). Null when the host cannot resolve a stable id.
|
|
889
1022
|
*/
|
|
890
1023
|
clientId?: string | null;
|
|
891
1024
|
sessionId?: string | null;
|
|
1025
|
+
/** Hashed identity + client signals + click ids. See {@link AnalyticsUserData}. */
|
|
1026
|
+
user?: AnalyticsUserData;
|
|
892
1027
|
/** Monetary value for value-bearing events (purchase, begin_checkout). */
|
|
893
1028
|
value?: AnalyticsMoney | null;
|
|
894
1029
|
/** Order id for `purchase` — providers dedupe transactions on it. */
|
|
@@ -896,7 +1031,13 @@ interface AnalyticsEvent {
|
|
|
896
1031
|
items?: AnalyticsItem[];
|
|
897
1032
|
/** Page context for `page_view`. */
|
|
898
1033
|
pageLocation?: string | null;
|
|
1034
|
+
/** Referring URL, when the host knows it. */
|
|
1035
|
+
pageReferrer?: string | null;
|
|
899
1036
|
pageTitle?: string | null;
|
|
1037
|
+
/** Marketing attribution for the session that produced the event. */
|
|
1038
|
+
utm?: AnalyticsUtm;
|
|
1039
|
+
/** Consent signals resolved by the host for this event. */
|
|
1040
|
+
consent?: AnalyticsConsent;
|
|
900
1041
|
/** Extra params forwarded verbatim as custom dimensions. */
|
|
901
1042
|
params?: Record<string, unknown>;
|
|
902
1043
|
}
|
|
@@ -1091,7 +1232,7 @@ declare function checkPermissions(required: string[], grantedRaw: string[]): Per
|
|
|
1091
1232
|
* - MINOR: additive (new optional fields, new tokens) — backwards compatible.
|
|
1092
1233
|
* - PATCH: docs/fixes with zero shape changes.
|
|
1093
1234
|
*/
|
|
1094
|
-
declare const SDK_VERSION = "0.6.
|
|
1235
|
+
declare const SDK_VERSION = "0.6.3";
|
|
1095
1236
|
/**
|
|
1096
1237
|
* True when a plugin built against `pluginSdkVersion` can run on a host that
|
|
1097
1238
|
* ships `hostSdkVersion`. Rule: same major, host minor >= plugin minor.
|
|
@@ -1100,4 +1241,4 @@ declare const SDK_VERSION = "0.6.1";
|
|
|
1100
1241
|
*/
|
|
1101
1242
|
declare function isSdkCompatible(pluginSdkVersion: string, hostSdkVersion: string): boolean;
|
|
1102
1243
|
|
|
1103
|
-
export { ANALYTICS_PLUGIN_TOKEN, type AccordionBlock, type AccordionSection, type ActionBlock, ActionVariant, type AnalyticsEvent, type AnalyticsEventName, AnalyticsFeature, type AnalyticsItem, type AnalyticsMoney, type AnalyticsPluginConfig, type AnalyticsStaticConfig, 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 IAnalyticsPlugin, type IPaymentPlugin, type IPlugin, type IShippingPlugin, type ISuppliersPlugin, 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 PlaceSupplierOrderInput, 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, SUPPLIERS_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 SupplierCatalogQuery, type SupplierFulfillmentEvent, type SupplierListing, type SupplierListingAttribute, type SupplierListingPage, type SupplierListingVariant, type SupplierMoney, type SupplierOrderAddressLevel, type SupplierOrderCustomer, type SupplierOrderLine, type SupplierOrderResult, type SupplierOrderStatus, type SupplierShipTo, type SupplierStock, type SuppliersDefaultConfig, SuppliersFeature, type SuppliersPluginConfig, type SuppliersStaticConfig, type TabItem, type TabsBlock, type ToggleBlock, type TrackingEvent, TransactionStatus, type WebhookSignatureResult, analyticsCapability, capability, checkPermissions, createPluginConfig, crossValidateSetupLayout, definePlugin, field, isConfigurablePlugin, isPermissionGranted, isPluginFactory, isSdkCompatible, parsePermission, paymentCapability, shippingCapability, suppliersCapability, validateSetupLayout };
|
|
1244
|
+
export { ANALYTICS_PLUGIN_TOKEN, type AccordionBlock, type AccordionSection, type ActionBlock, ActionVariant, type AnalyticsActionSource, type AnalyticsConsent, type AnalyticsEvent, type AnalyticsEventName, AnalyticsFeature, type AnalyticsItem, type AnalyticsMoney, type AnalyticsPluginConfig, type AnalyticsStaticConfig, type AnalyticsUserData, type AnalyticsUtm, 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 EmbedInit, 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 IAnalyticsPlugin, type IPaymentPlugin, type IPlugin, type IShippingPlugin, type ISuppliersPlugin, 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 PaymentRenderMode, type PaymentResult, type PaymentSessionPayload, type PaymentSessionResult, type PaymentVerifyPayload, type Permission, type PermissionCheck, type PlaceSupplierOrderInput, 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, SUPPLIERS_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 SupplierCatalogQuery, type SupplierFulfillmentEvent, type SupplierListing, type SupplierListingAttribute, type SupplierListingPage, type SupplierListingVariant, type SupplierMoney, type SupplierOrderAddressLevel, type SupplierOrderCustomer, type SupplierOrderLine, type SupplierOrderResult, type SupplierOrderStatus, type SupplierShipTo, type SupplierStock, type SuppliersDefaultConfig, SuppliersFeature, type SuppliersPluginConfig, type SuppliersStaticConfig, type TabItem, type TabsBlock, type ToggleBlock, type TrackingEvent, TransactionStatus, type WebhookSignatureResult, analyticsCapability, capability, checkPermissions, createPluginConfig, crossValidateSetupLayout, definePlugin, field, isConfigurablePlugin, isPermissionGranted, isPluginFactory, isSdkCompatible, parsePermission, paymentCapability, shippingCapability, suppliersCapability, validateSetupLayout };
|
package/dist/index.d.ts
CHANGED
|
@@ -473,6 +473,13 @@ interface PaymentResult {
|
|
|
473
473
|
redirectUrl?: string;
|
|
474
474
|
rawResponse?: unknown;
|
|
475
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* How the host should render the payment step for this gateway.
|
|
478
|
+
* - `card-in` host-owned card form, charged via `processPayment` (default).
|
|
479
|
+
* - `offsite-redirect` host sends the shopper to `redirectUrl`.
|
|
480
|
+
* - `embed` gateway-owned iframe initialised via `createPaymentSession`.
|
|
481
|
+
*/
|
|
482
|
+
type PaymentRenderMode = 'card-in' | 'offsite-redirect' | 'embed';
|
|
476
483
|
interface GatewayStaticConfig {
|
|
477
484
|
code: PaymentGatewayCode;
|
|
478
485
|
displayName: string;
|
|
@@ -480,6 +487,53 @@ interface GatewayStaticConfig {
|
|
|
480
487
|
environment: GatewayEnvironment;
|
|
481
488
|
supportedMethods: string[];
|
|
482
489
|
requiredEnvVars: string[];
|
|
490
|
+
/**
|
|
491
|
+
* OPTIONAL render mode. Absent ⇒ host treats the gateway as `'card-in'`.
|
|
492
|
+
* Back-compat: existing card-in plugins (Wompi/Serfinsa) omit this field.
|
|
493
|
+
*/
|
|
494
|
+
renderMode?: PaymentRenderMode;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Cardless payload for creating a gateway-hosted payment session (INV-1).
|
|
498
|
+
* Used by `embed` / `offsite-redirect` gateways where the host never touches
|
|
499
|
+
* card data — the shopper enters it inside the gateway's own surface.
|
|
500
|
+
*/
|
|
501
|
+
interface PaymentSessionPayload {
|
|
502
|
+
/**
|
|
503
|
+
* Charge amount in DECIMAL major units, 2 decimal places (e.g. `12.34`).
|
|
504
|
+
* Matches Boxful `@boxful/contracts` `getTwoDecimals` / `toFixed(2)`.
|
|
505
|
+
*/
|
|
506
|
+
amount: number;
|
|
507
|
+
currency: string;
|
|
508
|
+
orderId: string;
|
|
509
|
+
customer: PaymentCustomer;
|
|
510
|
+
/** Optional display/reconciliation hints shown on the gateway surface. */
|
|
511
|
+
orderSummary?: {
|
|
512
|
+
description?: string;
|
|
513
|
+
merchant?: string;
|
|
514
|
+
reference?: string;
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Everything the host needs to mount a gateway-owned payment iframe.
|
|
519
|
+
* `sessionToken` is OPAQUE to the host; the amount is sealed server-side by the
|
|
520
|
+
* gateway, so the host cannot tamper with it.
|
|
521
|
+
*/
|
|
522
|
+
interface EmbedInit {
|
|
523
|
+
sessionToken: string;
|
|
524
|
+
iframeUrl: string;
|
|
525
|
+
allowedOrigins: string[];
|
|
526
|
+
/** Expiry as epoch SECONDS. Owner TTL guidance: 15 minutes. */
|
|
527
|
+
expiresAt?: number;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Result of `createPaymentSession`. `embedInit` is present iff
|
|
531
|
+
* `renderMode === 'embed'`; `redirectUrl` iff `renderMode === 'offsite-redirect'`.
|
|
532
|
+
*/
|
|
533
|
+
interface PaymentSessionResult {
|
|
534
|
+
renderMode: PaymentRenderMode;
|
|
535
|
+
embedInit?: EmbedInit;
|
|
536
|
+
redirectUrl?: string;
|
|
483
537
|
}
|
|
484
538
|
interface PaymentPluginConfig {
|
|
485
539
|
configSchema: PluginConfigField[];
|
|
@@ -505,6 +559,13 @@ interface IPaymentPlugin extends IPlugin {
|
|
|
505
559
|
queryTransaction?(ref: {
|
|
506
560
|
transactionId: string;
|
|
507
561
|
}, ctx: DispatchContext): Promise<PaymentResult>;
|
|
562
|
+
/**
|
|
563
|
+
* Create a gateway-hosted payment session for `embed` / `offsite-redirect`
|
|
564
|
+
* render modes. OPTIONAL — `card-in` plugins never implement it and charge
|
|
565
|
+
* via `processPayment` instead. STATELESS: gateway credentials arrive per
|
|
566
|
+
* call via `ctx.config` (INV-4); no card data is ever passed here (INV-1).
|
|
567
|
+
*/
|
|
568
|
+
createPaymentSession?(payload: PaymentSessionPayload, ctx: DispatchContext): Promise<PaymentSessionResult>;
|
|
508
569
|
}
|
|
509
570
|
|
|
510
571
|
declare enum ShippingFeature {
|
|
@@ -860,10 +921,14 @@ interface AnalyticsMoney {
|
|
|
860
921
|
}
|
|
861
922
|
/** A single line item attached to an ecommerce event. */
|
|
862
923
|
interface AnalyticsItem {
|
|
863
|
-
/** Product
|
|
924
|
+
/** Product id as the store knows it (Meta `content_ids`, GA4 `item_id`). */
|
|
864
925
|
id: string;
|
|
926
|
+
/** Variant id for catalog-level granularity, when the line resolves one. */
|
|
927
|
+
variantId?: string | null;
|
|
865
928
|
name?: string;
|
|
866
929
|
sku?: string | null;
|
|
930
|
+
/** Brand for catalog feeds that key on it. */
|
|
931
|
+
brand?: string | null;
|
|
867
932
|
quantity?: number;
|
|
868
933
|
price?: AnalyticsMoney;
|
|
869
934
|
category?: string | null;
|
|
@@ -874,21 +939,91 @@ interface AnalyticsItem {
|
|
|
874
939
|
* about a given name simply ignores it.
|
|
875
940
|
*/
|
|
876
941
|
type AnalyticsEventName = 'page_view' | 'view_item' | 'add_to_cart' | 'remove_from_cart' | 'begin_checkout' | 'purchase';
|
|
942
|
+
/**
|
|
943
|
+
* Where the action physically happened. Maps to Meta `action_source`; other
|
|
944
|
+
* providers ignore it. Defaults to `website` when the host omits it.
|
|
945
|
+
*/
|
|
946
|
+
type AnalyticsActionSource = 'website' | 'app' | 'server' | 'phone_call' | 'chat' | 'email' | 'physical_store' | 'other';
|
|
947
|
+
/**
|
|
948
|
+
* Identity + match-quality signals. EVERYTHING here is optional — the host
|
|
949
|
+
* populates whatever it can resolve for the event in scope.
|
|
950
|
+
*
|
|
951
|
+
* @rule The `*Sha256` fields arrive ALREADY hashed by the host (SHA256 hex of
|
|
952
|
+
* the normalized value: lowercased + trimmed; phone in E.164 digits).
|
|
953
|
+
* The plugin NEVER receives raw PII. `externalId`, `clientIpAddress`,
|
|
954
|
+
* `clientUserAgent` and the click ids are the exception — providers
|
|
955
|
+
* require them PLAIN.
|
|
956
|
+
*/
|
|
957
|
+
interface AnalyticsUserData {
|
|
958
|
+
emailSha256?: string | null;
|
|
959
|
+
phoneSha256?: string | null;
|
|
960
|
+
firstNameSha256?: string | null;
|
|
961
|
+
lastNameSha256?: string | null;
|
|
962
|
+
citySha256?: string | null;
|
|
963
|
+
stateSha256?: string | null;
|
|
964
|
+
zipSha256?: string | null;
|
|
965
|
+
countrySha256?: string | null;
|
|
966
|
+
genderSha256?: string | null;
|
|
967
|
+
/** Date of birth, YYYYMMDD normalized then SHA256. */
|
|
968
|
+
dobSha256?: string | null;
|
|
969
|
+
/** Store customer/user id — Meta `external_id` (not hashed by spec). */
|
|
970
|
+
externalId?: string | null;
|
|
971
|
+
/** Plain IPv4/IPv6 — never hashed (geo match). */
|
|
972
|
+
clientIpAddress?: string | null;
|
|
973
|
+
/** Plain browser UA — never hashed (device match). */
|
|
974
|
+
clientUserAgent?: string | null;
|
|
975
|
+
/** Meta browser cookie `_fbp`. */
|
|
976
|
+
fbp?: string | null;
|
|
977
|
+
/** Meta click id `_fbc`. */
|
|
978
|
+
fbc?: string | null;
|
|
979
|
+
/** Google Ads click id. */
|
|
980
|
+
gclid?: string | null;
|
|
981
|
+
/** TikTok click id. */
|
|
982
|
+
ttclid?: string | null;
|
|
983
|
+
}
|
|
984
|
+
/** Marketing attribution captured at the session that led to the event. */
|
|
985
|
+
interface AnalyticsUtm {
|
|
986
|
+
source?: string | null;
|
|
987
|
+
medium?: string | null;
|
|
988
|
+
campaign?: string | null;
|
|
989
|
+
term?: string | null;
|
|
990
|
+
content?: string | null;
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* Consent signals the host resolved for this event. Providers that honor
|
|
994
|
+
* consent (Meta LDU, Google Consent Mode) gate on it; others ignore it.
|
|
995
|
+
*/
|
|
996
|
+
interface AnalyticsConsent {
|
|
997
|
+
adStorage?: boolean;
|
|
998
|
+
adUserData?: boolean;
|
|
999
|
+
adPersonalization?: boolean;
|
|
1000
|
+
}
|
|
877
1001
|
/**
|
|
878
1002
|
* Normalized analytics event. The host builds this from a DomainEvent and hands
|
|
879
1003
|
* it to every active analytics adapter. The adapter translates it to its own
|
|
880
|
-
* wire format (GA4 event, Meta event, ...).
|
|
1004
|
+
* wire format (GA4 event, Meta event, ...). See the @rule SUPERSET note at the
|
|
1005
|
+
* top of the module: this is the superset of what Meta CAPI needs.
|
|
881
1006
|
*/
|
|
882
1007
|
interface AnalyticsEvent {
|
|
883
1008
|
name: AnalyticsEventName;
|
|
884
1009
|
/** ISO-8601 instant the underlying action happened. */
|
|
885
1010
|
occurredAt: string;
|
|
1011
|
+
/**
|
|
1012
|
+
* Stable id for cross-channel deduplication against the browser pixel (Meta
|
|
1013
|
+
* `event_id`). For `purchase` the host sets it to the order id so the pixel
|
|
1014
|
+
* and the server event collapse into one.
|
|
1015
|
+
*/
|
|
1016
|
+
eventId?: string | null;
|
|
1017
|
+
/** Where the action happened — Meta `action_source`. Defaults to `website`. */
|
|
1018
|
+
actionSource?: AnalyticsActionSource;
|
|
886
1019
|
/**
|
|
887
1020
|
* Pseudonymous client identity for sessionization (maps to GA4 `client_id`
|
|
888
1021
|
* / Meta `external_id`). Null when the host cannot resolve a stable id.
|
|
889
1022
|
*/
|
|
890
1023
|
clientId?: string | null;
|
|
891
1024
|
sessionId?: string | null;
|
|
1025
|
+
/** Hashed identity + client signals + click ids. See {@link AnalyticsUserData}. */
|
|
1026
|
+
user?: AnalyticsUserData;
|
|
892
1027
|
/** Monetary value for value-bearing events (purchase, begin_checkout). */
|
|
893
1028
|
value?: AnalyticsMoney | null;
|
|
894
1029
|
/** Order id for `purchase` — providers dedupe transactions on it. */
|
|
@@ -896,7 +1031,13 @@ interface AnalyticsEvent {
|
|
|
896
1031
|
items?: AnalyticsItem[];
|
|
897
1032
|
/** Page context for `page_view`. */
|
|
898
1033
|
pageLocation?: string | null;
|
|
1034
|
+
/** Referring URL, when the host knows it. */
|
|
1035
|
+
pageReferrer?: string | null;
|
|
899
1036
|
pageTitle?: string | null;
|
|
1037
|
+
/** Marketing attribution for the session that produced the event. */
|
|
1038
|
+
utm?: AnalyticsUtm;
|
|
1039
|
+
/** Consent signals resolved by the host for this event. */
|
|
1040
|
+
consent?: AnalyticsConsent;
|
|
900
1041
|
/** Extra params forwarded verbatim as custom dimensions. */
|
|
901
1042
|
params?: Record<string, unknown>;
|
|
902
1043
|
}
|
|
@@ -1091,7 +1232,7 @@ declare function checkPermissions(required: string[], grantedRaw: string[]): Per
|
|
|
1091
1232
|
* - MINOR: additive (new optional fields, new tokens) — backwards compatible.
|
|
1092
1233
|
* - PATCH: docs/fixes with zero shape changes.
|
|
1093
1234
|
*/
|
|
1094
|
-
declare const SDK_VERSION = "0.6.
|
|
1235
|
+
declare const SDK_VERSION = "0.6.3";
|
|
1095
1236
|
/**
|
|
1096
1237
|
* True when a plugin built against `pluginSdkVersion` can run on a host that
|
|
1097
1238
|
* ships `hostSdkVersion`. Rule: same major, host minor >= plugin minor.
|
|
@@ -1100,4 +1241,4 @@ declare const SDK_VERSION = "0.6.1";
|
|
|
1100
1241
|
*/
|
|
1101
1242
|
declare function isSdkCompatible(pluginSdkVersion: string, hostSdkVersion: string): boolean;
|
|
1102
1243
|
|
|
1103
|
-
export { ANALYTICS_PLUGIN_TOKEN, type AccordionBlock, type AccordionSection, type ActionBlock, ActionVariant, type AnalyticsEvent, type AnalyticsEventName, AnalyticsFeature, type AnalyticsItem, type AnalyticsMoney, type AnalyticsPluginConfig, type AnalyticsStaticConfig, 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 IAnalyticsPlugin, type IPaymentPlugin, type IPlugin, type IShippingPlugin, type ISuppliersPlugin, 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 PlaceSupplierOrderInput, 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, SUPPLIERS_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 SupplierCatalogQuery, type SupplierFulfillmentEvent, type SupplierListing, type SupplierListingAttribute, type SupplierListingPage, type SupplierListingVariant, type SupplierMoney, type SupplierOrderAddressLevel, type SupplierOrderCustomer, type SupplierOrderLine, type SupplierOrderResult, type SupplierOrderStatus, type SupplierShipTo, type SupplierStock, type SuppliersDefaultConfig, SuppliersFeature, type SuppliersPluginConfig, type SuppliersStaticConfig, type TabItem, type TabsBlock, type ToggleBlock, type TrackingEvent, TransactionStatus, type WebhookSignatureResult, analyticsCapability, capability, checkPermissions, createPluginConfig, crossValidateSetupLayout, definePlugin, field, isConfigurablePlugin, isPermissionGranted, isPluginFactory, isSdkCompatible, parsePermission, paymentCapability, shippingCapability, suppliersCapability, validateSetupLayout };
|
|
1244
|
+
export { ANALYTICS_PLUGIN_TOKEN, type AccordionBlock, type AccordionSection, type ActionBlock, ActionVariant, type AnalyticsActionSource, type AnalyticsConsent, type AnalyticsEvent, type AnalyticsEventName, AnalyticsFeature, type AnalyticsItem, type AnalyticsMoney, type AnalyticsPluginConfig, type AnalyticsStaticConfig, type AnalyticsUserData, type AnalyticsUtm, 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 EmbedInit, 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 IAnalyticsPlugin, type IPaymentPlugin, type IPlugin, type IShippingPlugin, type ISuppliersPlugin, 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 PaymentRenderMode, type PaymentResult, type PaymentSessionPayload, type PaymentSessionResult, type PaymentVerifyPayload, type Permission, type PermissionCheck, type PlaceSupplierOrderInput, 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, SUPPLIERS_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 SupplierCatalogQuery, type SupplierFulfillmentEvent, type SupplierListing, type SupplierListingAttribute, type SupplierListingPage, type SupplierListingVariant, type SupplierMoney, type SupplierOrderAddressLevel, type SupplierOrderCustomer, type SupplierOrderLine, type SupplierOrderResult, type SupplierOrderStatus, type SupplierShipTo, type SupplierStock, type SuppliersDefaultConfig, SuppliersFeature, type SuppliersPluginConfig, type SuppliersStaticConfig, type TabItem, type TabsBlock, type ToggleBlock, type TrackingEvent, TransactionStatus, type WebhookSignatureResult, analyticsCapability, capability, checkPermissions, createPluginConfig, crossValidateSetupLayout, definePlugin, field, isConfigurablePlugin, isPermissionGranted, isPluginFactory, isSdkCompatible, parsePermission, paymentCapability, shippingCapability, suppliersCapability, validateSetupLayout };
|
package/dist/index.js
CHANGED
|
@@ -544,7 +544,7 @@ function checkPermissions(required, grantedRaw) {
|
|
|
544
544
|
}
|
|
545
545
|
|
|
546
546
|
// src/version.ts
|
|
547
|
-
var SDK_VERSION = "0.6.
|
|
547
|
+
var SDK_VERSION = "0.6.3";
|
|
548
548
|
function isSdkCompatible(pluginSdkVersion, hostSdkVersion) {
|
|
549
549
|
const parse = (v) => {
|
|
550
550
|
const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v);
|
package/dist/index.mjs
CHANGED
|
@@ -502,7 +502,7 @@ function checkPermissions(required, grantedRaw) {
|
|
|
502
502
|
}
|
|
503
503
|
|
|
504
504
|
// src/version.ts
|
|
505
|
-
var SDK_VERSION = "0.6.
|
|
505
|
+
var SDK_VERSION = "0.6.3";
|
|
506
506
|
function isSdkCompatible(pluginSdkVersion, hostSdkVersion) {
|
|
507
507
|
const parse = (v) => {
|
|
508
508
|
const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v);
|