@flopay/js 1.20.3 → 1.20.4

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.
@@ -0,0 +1,25 @@
1
+ import type { CheckoutRuntimeContract } from './contract-manifest.js';
2
+ export interface ContractCompatibility {
3
+ compatible: boolean;
4
+ /** One entry per breaking change, each naming the member path, e.g. `options.sessionId`. */
5
+ breaking: string[];
6
+ }
7
+ export interface ContractNeutrality {
8
+ ok: boolean;
9
+ /** One entry per member that is processor-specific or unclassified, naming its path. */
10
+ violations: string[];
11
+ }
12
+ /**
13
+ * Whether `candidate` still honours every member of the `baseline` contract. Only additive,
14
+ * optional changes are compatible within 2.x: removing or renaming a member, making an optional
15
+ * one required, adding a required one, changing what a member means, dropping a lifecycle step
16
+ * or leaving the baseline's major version breaks it.
17
+ */
18
+ export declare function checkContractCompatibility(baseline: CheckoutRuntimeContract, candidate: CheckoutRuntimeContract): ContractCompatibility;
19
+ /**
20
+ * Whether every member of `contract`, nested fields included, has a neutral classification and
21
+ * none exists for one processor only. It holds no list of processors: a member is accepted only
22
+ * when its meaning is one of the closed {@link CONTRACT_SEMANTICS}, so a processor nobody listed
23
+ * fails as unclassified.
24
+ */
25
+ export declare function checkContractNeutrality(contract: CheckoutRuntimeContract): ContractNeutrality;
@@ -0,0 +1,45 @@
1
+ /** One option, message, message field or event of the public contract. */
2
+ export interface CheckoutRuntimeContractMember {
3
+ name: string;
4
+ /** True when a wrapper has to supply it. Within 2.x only the 2.0.0 baseline's are required. */
5
+ required: boolean;
6
+ /**
7
+ * What the member means, from the closed {@link CONTRACT_SEMANTICS} set: always a payment
8
+ * method or an outcome (or another neutral meaning), never a processor.
9
+ */
10
+ semantic: string;
11
+ /** The one processor a member exists for. The public contract has no such member. */
12
+ onlyFor?: string;
13
+ /** The fields of a message, or the declared parts of an event payload. */
14
+ fields?: CheckoutRuntimeContractMember[];
15
+ }
16
+ export interface CheckoutRuntimeContract {
17
+ version: string;
18
+ /** The steps of a mounted checkout's life, in order: mount, update, unmount. */
19
+ lifecycle: string[];
20
+ /** Options a wrapper hands the runtime to mount a checkout. */
21
+ options: CheckoutRuntimeContractMember[];
22
+ /** Options a mounted checkout accepts after it is mounted. */
23
+ updateOptions: CheckoutRuntimeContractMember[];
24
+ /** Messages the checkout frame sends the runtime. */
25
+ messagesFromFrame: CheckoutRuntimeContractMember[];
26
+ /** Messages the runtime sends the checkout frame. */
27
+ messagesToFrame: CheckoutRuntimeContractMember[];
28
+ /** Events the runtime relays to the wrapper. */
29
+ events: CheckoutRuntimeContractMember[];
30
+ }
31
+ /**
32
+ * The version of the contract below. It is not the npm or runtime build version: it starts at
33
+ * 2.0.0 and takes a minor bump with each additive change (see .gitea/README.md, "Runtime
34
+ * compatibility"), and each released version keeps a frozen copy in ./baselines.
35
+ */
36
+ export declare const CHECKOUT_RUNTIME_CONTRACT_VERSION: string;
37
+ /**
38
+ * The closed set of neutral meanings a contract member may have. Every member names what it is
39
+ * for (a payment method, an outcome, the session, the page's wording, ...), never the processor
40
+ * behind it. A new member that fits none of these needs a new neutral meaning, added here by
41
+ * review, not a processor's name.
42
+ */
43
+ export declare const CONTRACT_SEMANTICS: readonly string[];
44
+ /** The contract this runtime build accepts. */
45
+ export declare const checkoutRuntimeContract: CheckoutRuntimeContract;
@@ -25,6 +25,11 @@ export interface CheckoutRuntimeMountOptions {
25
25
  /** Merchant wording overrides, applied over the strings the API returns. */
26
26
  strings?: Record<string, string>;
27
27
  onEvent?: (event: CheckoutRuntimeEvent) => void;
28
+ /**
29
+ * The contract version this wrapper was built against. Optional: a wrapper that omits it is
30
+ * read as the 2.0.0 baseline.
31
+ */
32
+ contractVersion?: string;
28
33
  }
29
34
  /** The options a mounted checkout accepts after it is mounted. */
30
35
  export type CheckoutRuntimeUpdateOptions = Partial<Pick<CheckoutRuntimeMountOptions, 'appearance' | 'strings' | 'onEvent'>>;
@@ -43,6 +48,8 @@ export interface CheckoutRuntimeTelemetryEvent {
43
48
  /** The session's card gateway, exactly as the API names it, known to the runtime or not. */
44
49
  cardGateway?: string;
45
50
  reason?: string;
51
+ /** The contract version in force for this mount: the wrapper's, or 2.0.0 when it declared none. */
52
+ contractVersion?: string;
46
53
  }
47
54
  /** The runtime's own configuration. Wrappers never supply any of it. */
48
55
  export interface CheckoutRuntimeConfig {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flopay/js",
3
- "version": "1.20.3",
3
+ "version": "1.20.4",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "publishConfig": {
@@ -31,7 +31,7 @@
31
31
  "dist"
32
32
  ],
33
33
  "dependencies": {
34
- "@flopay/shared": "1.20.3",
34
+ "@flopay/shared": "1.20.4",
35
35
  "@stripe/stripe-js": "^10.3.0"
36
36
  },
37
37
  "devDependencies": {