@vio-live/web-sdk 0.32.0 → 0.35.0
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/CHANGELOG.md +123 -0
- package/README.md +156 -17
- package/dist/chunk-3YFJFDSN.js +3 -0
- package/dist/{chunk-QGJUBVH3.js.map → chunk-3YFJFDSN.js.map} +1 -1
- package/dist/{chunk-C5Q6W4B2.js → chunk-F7LE5AZY.js} +358 -56
- package/dist/chunk-F7LE5AZY.js.map +1 -0
- package/dist/{chunk-IR4XYTZL.js → chunk-QA5R4VYF.js} +943 -134
- package/dist/chunk-QA5R4VYF.js.map +1 -0
- package/dist/core/index.d.ts +819 -567
- package/dist/core/index.js +2 -2
- package/dist/detail-layout-BI556w8p.d.ts +76 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/react/index.d.ts +4 -2
- package/dist/react/index.js +5 -4
- package/dist/react/index.js.map +1 -1
- package/dist/{tokens-D1DCVzOf.d.ts → tokens-C-LsqKQH.d.ts} +130 -11
- package/dist/ui/index.d.ts +2 -1
- package/dist/ui/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-C5Q6W4B2.js.map +0 -1
- package/dist/chunk-IR4XYTZL.js.map +0 -1
- package/dist/chunk-QGJUBVH3.js +0 -3
package/dist/core/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { D as DetailLayout, A as AppliedDetailLayout } from '../detail-layout-BI556w8p.js';
|
|
2
|
+
export { a as DETAIL_SECTION_IDS, b as DetailLayoutAdjustment, c as DetailLayoutOrigin, d as DetailSectionId, E as ESSENTIAL_DETAIL_SECTIONS, e as defaultDetailLayout, f as effectiveDetailSections, n as normalizeDetailLayout, r as resolveDetailLayout } from '../detail-layout-BI556w8p.js';
|
|
1
3
|
import { GraphQLClient } from 'graphql-request';
|
|
2
4
|
|
|
3
5
|
/**
|
|
@@ -581,6 +583,20 @@ interface CartOrigin {
|
|
|
581
583
|
contentUrl?: string;
|
|
582
584
|
/** Its title (`content_title`, ≤ 255). */
|
|
583
585
|
contentTitle?: string;
|
|
586
|
+
/**
|
|
587
|
+
* The layout of `<vio-product-detail>` the units were added from (0.34):
|
|
588
|
+
* its `id`, `revision`, and the experiment / variant it belongs to — set by
|
|
589
|
+
* the detail from the layout it showed at that moment, only for a
|
|
590
|
+
* non-default layout. Kept with the line (localStorage) and never rewritten
|
|
591
|
+
* by a later configuration; reported per unit on the events with items
|
|
592
|
+
* (`layout_id`, `layout_revision`, `experiment_id`, `experiment_variant_id`).
|
|
593
|
+
* Never sent to Commerce. `variantId` here is the EXPERIMENT variant, not the
|
|
594
|
+
* product variant (`CartLineItem.variantId`).
|
|
595
|
+
*/
|
|
596
|
+
layoutId?: string;
|
|
597
|
+
layoutRevision?: string;
|
|
598
|
+
experimentId?: string;
|
|
599
|
+
variantId?: string;
|
|
584
600
|
}
|
|
585
601
|
/** One origin of a line and how many of its units came from it. */
|
|
586
602
|
interface CartLineOrigin extends CartOrigin {
|
|
@@ -627,6 +643,15 @@ interface SponsorCartState {
|
|
|
627
643
|
currency: string;
|
|
628
644
|
/** Backend (Vio Commerce) cart id, once created. */
|
|
629
645
|
cartId?: string;
|
|
646
|
+
/**
|
|
647
|
+
* The commerce channel the backend cart was created on (the sponsor's
|
|
648
|
+
* block for the campaign the first line came from). Every later cart and
|
|
649
|
+
* checkout call for this cart uses THAT channel's key; when the bootstrap
|
|
650
|
+
* no longer lists it, the cart is created again on the current channel with
|
|
651
|
+
* its lines. Absent on carts created before 0.33 (they keep the sponsor's
|
|
652
|
+
* first block, as then, and learn it on the next call).
|
|
653
|
+
*/
|
|
654
|
+
channelId?: string;
|
|
630
655
|
shippingCountry?: string;
|
|
631
656
|
subtotal?: number;
|
|
632
657
|
shipping?: number;
|
|
@@ -634,393 +659,88 @@ interface SponsorCartState {
|
|
|
634
659
|
}
|
|
635
660
|
|
|
636
661
|
/**
|
|
637
|
-
*
|
|
662
|
+
* What the commerce gateway may not know yet.
|
|
638
663
|
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
642
|
-
*
|
|
664
|
+
* The SDK ships ahead of the gateway more than once a quarter: a selection
|
|
665
|
+
* (`buyer_ref`, 2026-10-19), an argument (`origin` on the cart lines,
|
|
666
|
+
* `attribution` on the checkout — ADR-0035 phase B). A gateway that does not
|
|
667
|
+
* have the field refuses the WHOLE operation at validation — before anything
|
|
668
|
+
* runs, with no `data` — so each such operation is sent again without the
|
|
669
|
+
* field, once, and the answer remembered for the page load. An operation that
|
|
670
|
+
* DID run and failed is never repeated: for a mutation that would be a second
|
|
671
|
+
* charge, a second line in the cart.
|
|
643
672
|
*
|
|
644
|
-
*
|
|
645
|
-
*
|
|
646
|
-
|
|
647
|
-
|
|
673
|
+
* One mechanism for all of them, so the next field costs a token here and a
|
|
674
|
+
* call to `withGatewayFeature`, not a new copy of the retry.
|
|
675
|
+
*/
|
|
676
|
+
type GatewayFeature = 'buyer_ref' | 'line_origin' | 'checkout_attribution';
|
|
677
|
+
/** Whether this page load still expects the gateway to know `feature` (false once it refused it). */
|
|
678
|
+
declare function gatewayHas(feature: GatewayFeature): boolean;
|
|
679
|
+
/** Forget what this page load learned (tests). One feature, or all of them. */
|
|
680
|
+
declare function resetGatewayFeatures(feature?: GatewayFeature): void;
|
|
681
|
+
/**
|
|
682
|
+
* True when `err` is the gateway refusing something it does not know, named
|
|
683
|
+
* `token` (`Cannot query field "buyer_ref" on type …`, `Unknown argument
|
|
684
|
+
* "origin" on field …`, `Unknown type "CartLineOriginInput"`, `Field "origin" is
|
|
685
|
+
* not defined by type "LineItemInput"`): a validation error, with no `data`
|
|
686
|
+
* and no `path` because nothing ran — safe to send again without it, a
|
|
687
|
+
* mutation included. Anything that ran (data present, or an error with a
|
|
688
|
+
* path) or any other message is not.
|
|
689
|
+
*/
|
|
690
|
+
declare function isUnknownTokenError(err: unknown, token: string): boolean;
|
|
691
|
+
/** `isUnknownTokenError` for any of the names a feature goes by. */
|
|
692
|
+
declare function isUnknownFeatureError(err: unknown, feature: GatewayFeature): boolean;
|
|
693
|
+
/**
|
|
694
|
+
* Runs `request(true)` (the operation with the feature); when the gateway
|
|
695
|
+
* does not know it, `request(false)` (without it) — and from then on, for
|
|
696
|
+
* this page load, straight to the latter. Said once in the console: a
|
|
697
|
+
* gateway behind the SDK is worth knowing about, and so is a renamed type.
|
|
648
698
|
*/
|
|
699
|
+
declare function withGatewayFeature<T>(feature: GatewayFeature, request: (supported: boolean) => Promise<T>): Promise<T>;
|
|
649
700
|
|
|
650
|
-
interface CartChangeDetail {
|
|
651
|
-
cartsBySponsor: Map<number, SponsorCartState>;
|
|
652
|
-
itemCount: number;
|
|
653
|
-
}
|
|
654
701
|
/**
|
|
655
|
-
*
|
|
656
|
-
*
|
|
657
|
-
*
|
|
658
|
-
* (`
|
|
659
|
-
*
|
|
702
|
+
* A line origin as Commerce receives it (ADR-0035 phase B): `origin` on each
|
|
703
|
+
* line of `AddItem` and, when the quantity goes UP, on `UpdateItem` — the
|
|
704
|
+
* origin of the units that update adds. shopcart keeps every origin of a
|
|
705
|
+
* line with its units (`cart_item.origins`) and writes the order from them:
|
|
706
|
+
* `order_item.campaign_id` / `location_id` / `component_kind`, and the
|
|
707
|
+
* order's page when the checkout does not name one.
|
|
708
|
+
*
|
|
709
|
+
* snake_case on the wire, the caps of shopcart's `LineOriginDto` enforced
|
|
710
|
+
* here, once. Pure: `lineOriginWire()` takes the origin and the page.
|
|
660
711
|
*/
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
product: Product;
|
|
672
|
-
sponsorId: number;
|
|
673
|
-
sponsorName?: string;
|
|
674
|
-
quantity?: number;
|
|
675
|
-
variantId?: number;
|
|
676
|
-
/** Where these units come from (`Vio.attribution(slot)`); see `CartOrigin`. */
|
|
677
|
-
origin?: CartOrigin;
|
|
712
|
+
|
|
713
|
+
/** The largest `Int` GraphQL coerces; a bigger id would fail the whole mutation. */
|
|
714
|
+
declare const GRAPHQL_INT_MAX = 2147483647;
|
|
715
|
+
/** `LineOriginDto` (shopcart `cart/dtos/send/line-origin.dto.ts`). */
|
|
716
|
+
interface LineOriginWire {
|
|
717
|
+
campaign_id?: number;
|
|
718
|
+
location_id?: string;
|
|
719
|
+
component_kind?: string;
|
|
720
|
+
content_url?: string;
|
|
721
|
+
content_title?: string;
|
|
678
722
|
}
|
|
679
|
-
/**
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
variantId?: number;
|
|
691
|
-
/** Where these units come from (`Vio.attribution(slot)`); see `CartOrigin`. */
|
|
692
|
-
origin?: CartOrigin;
|
|
723
|
+
/** The caps of `LineOriginDto` — a longer value is refused whole by the API, so it is cut here. */
|
|
724
|
+
declare const LINE_ORIGIN_CAPS: Readonly<{
|
|
725
|
+
locationId: 100;
|
|
726
|
+
componentKind: 32;
|
|
727
|
+
contentUrl: 2048;
|
|
728
|
+
contentTitle: 255;
|
|
729
|
+
}>;
|
|
730
|
+
/** The page the units are added from, for an origin that does not carry its own. */
|
|
731
|
+
interface OriginPage {
|
|
732
|
+
contentUrl?: string;
|
|
733
|
+
contentTitle?: string;
|
|
693
734
|
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
* cart (two CreateCarts split the items and one silently disappears). */
|
|
698
|
-
private cartIdPromises;
|
|
699
|
-
/** Monotonic mutation counter per sponsor + last applied response, so a
|
|
700
|
-
* slow response can't overwrite the state of a newer one. */
|
|
701
|
-
private mutationSeq;
|
|
702
|
-
private appliedSeq;
|
|
703
|
-
/** In-flight AddItem/UpdateItem/DeleteItem per sponsor. Callers that need
|
|
704
|
-
* the backend cart to reflect a just-made change (e.g. fetching shippings
|
|
705
|
-
* right after an add) should `await waitForCartMutations(sponsorId)` first
|
|
706
|
-
* — otherwise they can race the mutation and see the cart from before it
|
|
707
|
-
* landed (Alan, 2026-08-18: shippings queried before AddItem settled,
|
|
708
|
-
* came back empty). */
|
|
709
|
-
private inFlightMutations;
|
|
710
|
-
/** Per-line quantity sync with the backend: at most ONE UpdateItem /
|
|
711
|
-
* DeleteItem in flight per line. Targets that arrive while one is in flight
|
|
712
|
-
* are coalesced into `pending` (only the latest survives) and sent when the
|
|
713
|
-
* current request settles. Keyed by `${sponsorId}:${cartItemId}`.
|
|
714
|
-
* (Alan, 2026-10-15: a burst of +/− clicks fired one UpdateItem per click
|
|
715
|
-
* in parallel; each response re-applied the whole backend cart, so an
|
|
716
|
-
* older one landing after a newer optimistic change rolled the line back.) */
|
|
717
|
-
private qtySyncs;
|
|
718
|
-
constructor();
|
|
719
|
-
private nextSeq;
|
|
720
|
-
/** Resolves once every in-flight AddItem/UpdateItem/DeleteItem for this
|
|
721
|
-
* sponsor has settled (success or failure), including ones started while
|
|
722
|
-
* waiting (a quantity intent replayed by an AddItem reconcile). No-op if
|
|
723
|
-
* nothing is pending. */
|
|
724
|
-
waitForCartMutations(sponsorId: number): Promise<void>;
|
|
725
|
-
/**
|
|
726
|
-
* True while an AddItem/UpdateItem/DeleteItem of this sponsor OTHER than
|
|
727
|
-
* `except` has not settled. A mutation applying its own answer passes
|
|
728
|
-
* itself: its response is current for what IT sent — only the others make
|
|
729
|
-
* it stale.
|
|
730
|
-
*/
|
|
731
|
-
private hasMutationsInFlight;
|
|
732
|
-
/** Register a backend mutation so `waitForCartMutations` can await it. */
|
|
733
|
-
private trackMutation;
|
|
734
|
-
private qtySyncKey;
|
|
735
|
-
/** The quantity a line is heading to (pending beats in flight), or
|
|
736
|
-
* undefined when no quantity sync is active for it. */
|
|
737
|
-
private intendedQuantity;
|
|
738
|
-
/** Apply a backend response only if no newer response was applied already.
|
|
739
|
-
* Returns false when it was discarded as stale. */
|
|
740
|
-
private applyBackendCart;
|
|
741
|
-
/** The final answer of a line's sync lost the per-sponsor seq race (another
|
|
742
|
-
* line answered later): the cart as a whole is stale, but for THIS line it
|
|
743
|
-
* is the latest word. Copy its quantity (and price) so a server-side clamp
|
|
744
|
-
* — stock — doesn't leave the optimistic value behind for good, with the
|
|
745
|
-
* checkout / Apple Pay total built on it. */
|
|
746
|
-
private reconcileLineFromResponse;
|
|
747
|
-
/** Surface a cart sync problem to hosts/UI (and the console). */
|
|
748
|
-
private emitError;
|
|
749
|
-
/** Ensure the sponsor cart exists server-side; returns its backend cart id. */
|
|
750
|
-
ensureCartId(sponsorId: number, currency?: string, shippingCountry?: string): Promise<string | undefined>;
|
|
735
|
+
interface LineOriginWireOptions {
|
|
736
|
+
/** The current page, for an origin that does not carry its own. */
|
|
737
|
+
page?: OriginPage;
|
|
751
738
|
/**
|
|
752
|
-
*
|
|
753
|
-
*
|
|
754
|
-
*
|
|
755
|
-
*
|
|
756
|
-
*
|
|
757
|
-
* empty, and the local lines go — not an add still on its way.
|
|
758
|
-
*/
|
|
759
|
-
updateFromBackendCart(sponsorId: number, backendCart: {
|
|
760
|
-
cart_id?: string;
|
|
761
|
-
currency?: string;
|
|
762
|
-
shipping_country?: string;
|
|
763
|
-
subtotal?: number;
|
|
764
|
-
shipping?: number;
|
|
765
|
-
available_shipping_countries?: string[];
|
|
766
|
-
line_items?: Array<{
|
|
767
|
-
id: string;
|
|
768
|
-
product_id: number;
|
|
769
|
-
variant_id?: number | string | null;
|
|
770
|
-
variant_title?: string | null;
|
|
771
|
-
brand?: string | null;
|
|
772
|
-
title?: string | null;
|
|
773
|
-
quantity: number;
|
|
774
|
-
image?: string | {
|
|
775
|
-
url?: string;
|
|
776
|
-
} | null;
|
|
777
|
-
imageUrl?: string | null;
|
|
778
|
-
image_url?: string | null;
|
|
779
|
-
price?: {
|
|
780
|
-
amount?: number;
|
|
781
|
-
amount_incl_taxes?: number | null;
|
|
782
|
-
currency_code?: string;
|
|
783
|
-
} | null;
|
|
784
|
-
shipping?: unknown;
|
|
785
|
-
available_shippings?: unknown[];
|
|
786
|
-
}>;
|
|
787
|
-
}, opts?: {
|
|
788
|
-
settling?: Promise<unknown>;
|
|
789
|
-
authoritative?: boolean;
|
|
790
|
-
}): void;
|
|
791
|
-
/** Add a Product DTO to a sponsor's cart. Bumps quantity if already present.
|
|
792
|
-
* When a variantId is given, the line uses the VARIANT's price / image / title
|
|
793
|
-
* (not the product base), so different combinations are priced correctly. */
|
|
794
|
-
addProduct(opts: AddProductOptions): CartLineItem;
|
|
795
|
-
/** Add a manually-specified line item (no Product DTO). */
|
|
796
|
-
addManual(opts: AddManualOptions): CartLineItem;
|
|
797
|
-
/** Quantity intents for lines whose backend id hasn't arrived yet — replayed
|
|
798
|
-
* when the AddItem response reconciles (keyed by product::variant). */
|
|
799
|
-
private pendingQtyIntents;
|
|
800
|
-
private intentKey;
|
|
801
|
-
private findLine;
|
|
802
|
-
/** Change a line's quantity by `delta`, computed on the manager's CURRENT
|
|
803
|
-
* quantity — not on whatever a UI rendered a moment ago. A burst of +/−
|
|
804
|
-
* clicks before a re-render therefore asks for 2, 3, 4… and not for the
|
|
805
|
-
* same target several times. Reaching 0 removes the line. */
|
|
806
|
-
adjustQuantity(lineItemId: string, sponsorId: number, delta: number, opts?: {
|
|
807
|
-
origin?: CartOrigin;
|
|
808
|
-
}): void;
|
|
809
|
-
/** Set a line's quantity (0 or less removes it). Optimistic: the local
|
|
810
|
-
* state and `change` update at once; the backend is synced through
|
|
811
|
-
* `syncQuantity`, one request in flight per line, latest target wins. */
|
|
812
|
-
updateQuantity(lineItemId: string, sponsorId: number, quantity: number, opts?: {
|
|
813
|
-
origin?: CartOrigin;
|
|
814
|
-
}): void;
|
|
815
|
-
/** Send a line's target quantity to the backend — ONE request in flight per
|
|
816
|
-
* line. Targets that arrive while one is in flight queue behind it as
|
|
817
|
-
* steps (`queueStep`): reduced like the line's origins, sent in order once
|
|
818
|
-
* the current request settles — one request per queued increase from a
|
|
819
|
-
* different origin, one for a net decrease — so the server ends on the
|
|
820
|
-
* last intent, credits every increase to its own origin, and never sees two
|
|
821
|
-
* updates racing each other. While the sync is active the line keeps its
|
|
822
|
-
* optimistic quantity through any backend response (see
|
|
823
|
-
* `updateFromBackendCart`); a rejection drops what was queued and
|
|
824
|
-
* reconciles the cart from the server. */
|
|
825
|
-
private syncQuantity;
|
|
826
|
-
removeItem(lineItemId: string, sponsorId: number): void;
|
|
827
|
-
clearSponsorCart(sponsorId: number): void;
|
|
828
|
-
clearAllCarts(): void;
|
|
829
|
-
/** Refresh the local cart from the backend (source of truth). */
|
|
830
|
-
fetchCartFromBackend(sponsorId: number): Promise<unknown>;
|
|
831
|
-
/**
|
|
832
|
-
* The cart as the server has it, for the moment a checkout is about to be
|
|
833
|
-
* built on it: what the shopper is about to pay must be what the page shows.
|
|
834
|
-
* Waits for this tab's own mutations (their answers are the server's too),
|
|
835
|
-
* then applies GetCart as it is — a line another tab added, one it removed,
|
|
836
|
-
* an empty cart — and tells the page: `change` for the drawer, and
|
|
837
|
-
* `vio:cart-updated` on `document` (`source: 'server'`) for a host that
|
|
838
|
-
* draws its own. A mutation that starts while the server is answering makes
|
|
839
|
-
* that answer old: it is asked once more. Nothing to ask without a backend
|
|
840
|
-
* cart. A GetCart that fails leaves the local state as it was and does not
|
|
841
|
-
* throw — the checkout then goes on with the lines the last mutation
|
|
842
|
-
* answered, as it always did. Resolves with the sponsor's cart.
|
|
843
|
-
*/
|
|
844
|
-
refreshFromServer(sponsorId: number): Promise<SponsorCartState | undefined>;
|
|
845
|
-
/** `vio:cart-updated` on `document` — see `CartUpdatedDetail`. */
|
|
846
|
-
private emitCartUpdated;
|
|
847
|
-
/**
|
|
848
|
-
* Another tab of the site wrote the carts: adopt what it wrote, sponsor by
|
|
849
|
-
* sponsor — its lines and its backend cart id, or nothing when it cleared
|
|
850
|
-
* the cart (a payment) — except for a sponsor this tab is mid-write for:
|
|
851
|
-
* its own answer lands in a moment and is persisted then, over whatever
|
|
852
|
-
* the other tab had. `key` is null when the other tab cleared the whole
|
|
853
|
-
* storage. Says `change` (the drawer) and `vio:cart-updated` per sponsor
|
|
854
|
-
* that changed (`source: 'storage'`); nothing when nothing did.
|
|
855
|
-
*/
|
|
856
|
-
private onStorage;
|
|
857
|
-
/** Line items grouped by supplier (shipping is per-supplier server-side). */
|
|
858
|
-
fetchLineItemsBySupplier(sponsorId: number): Promise<unknown>;
|
|
859
|
-
/** Set the chosen shipping option per supplier on the backend cart. */
|
|
860
|
-
updateShippingsBySupplier(sponsorId: number, data: Array<{
|
|
861
|
-
shipping_id: string;
|
|
862
|
-
supplier_id: number;
|
|
863
|
-
}>): Promise<unknown>;
|
|
864
|
-
getAllCarts(): Map<number, SponsorCartState>;
|
|
865
|
-
getCart(sponsorId: number): SponsorCartState | undefined;
|
|
866
|
-
get itemCount(): number;
|
|
867
|
-
subtotalForSponsor(sponsorId: number): number;
|
|
868
|
-
get totalAcrossSponsors(): number;
|
|
869
|
-
get primaryCurrency(): string;
|
|
870
|
-
formatTotal(): string;
|
|
871
|
-
/**
|
|
872
|
-
* Keep the carts for the next page and the other tabs. Where storage
|
|
873
|
-
* refuses (in-app browsers, private modes) nothing throws (safe-storage.ts):
|
|
874
|
-
* the carts stay in this manager's own map, the add to cart and the
|
|
875
|
-
* checkout go on, and the cart just does not survive a reload there.
|
|
876
|
-
*/
|
|
877
|
-
private persist;
|
|
878
|
-
private loadFromStorage;
|
|
879
|
-
private emit;
|
|
880
|
-
}
|
|
881
|
-
/**
|
|
882
|
-
* Only the attribution fields, trimmed; `{}` when nothing is known. The kind
|
|
883
|
-
* of element is kept as Commerce and the collector name it (`card`,
|
|
884
|
-
* `carousel`, `detail` — `componentKindOf`), from `componentKind` or from
|
|
885
|
-
* the `componentTemplateId` an element's attribution carries (`product-card`);
|
|
886
|
-
* the page as origin + path (`contentUrl`) and its title, within Commerce's caps.
|
|
887
|
-
*/
|
|
888
|
-
declare function normalizeOrigin(origin: CartOrigin | null | undefined): CartOrigin;
|
|
889
|
-
/** Two origins are the same place when campaign, slot, content and kind of element all match (the page's URL and title are attributes of the place, not its identity). */
|
|
890
|
-
declare function sameOrigin(a: CartOrigin, b: CartOrigin): boolean;
|
|
891
|
-
/**
|
|
892
|
-
* The origins of a line for reporting: what it carries, plus an empty origin
|
|
893
|
-
* for any units it does not account for (a cart persisted before origins
|
|
894
|
-
* existed, a server-side bump). Their quantities add up to the line's.
|
|
895
|
-
*/
|
|
896
|
-
declare function lineOrigins(line: Pick<CartLineItem, 'origins' | 'quantity'>): CartLineOrigin[];
|
|
897
|
-
|
|
898
|
-
/**
|
|
899
|
-
* Who sells — the sponsor's (brand's) display identity: its name and logo.
|
|
900
|
-
*
|
|
901
|
-
* ONE rule for every place that names a sponsor (the product detail, the
|
|
902
|
-
* carousel's retailer line, the cart, the checkout header, the confirmation,
|
|
903
|
-
* the payment event and `getOrderReference`): the bootstrap's sponsor block —
|
|
904
|
-
* the config's primary and secondaries, then every `campaigns[]` primary and
|
|
905
|
-
* secondaries, first match — and, when the bootstrap does not know the id,
|
|
906
|
-
* what this tab remembered of the checkout, then the cart's `sponsorName`.
|
|
907
|
-
*
|
|
908
|
-
* In a checkout and on its confirmation the sponsor is the CHECKOUT's (the
|
|
909
|
-
* cart's sponsor, the one the order is with), never the page's attribution:
|
|
910
|
-
* an article of brand A may sell a product of brand B.
|
|
911
|
-
*
|
|
912
|
-
* Pure helpers and a tiny per-checkout memory in `sessionStorage`; no DOM.
|
|
913
|
-
*/
|
|
914
|
-
|
|
915
|
-
/** What a sponsor looks like to a shopper. `name` is the brand's display name. */
|
|
916
|
-
interface SponsorIdentity {
|
|
917
|
-
id: number;
|
|
918
|
-
name: string;
|
|
919
|
-
/** The brand's logo, as the bootstrap gives it (never rewritten); `null` when it has none. */
|
|
920
|
-
logoUrl: string | null;
|
|
921
|
-
avatarUrl: string | null;
|
|
922
|
-
/** The brand's purchase terms page — https only; `null` when it has none. */
|
|
923
|
-
termsUrl?: string | null;
|
|
924
|
-
/** The brand's returns / refund policy page — https only; `null` when it has none. */
|
|
925
|
-
refundPolicyUrl?: string | null;
|
|
926
|
-
/** The brand's promises (at most three, each with a title); absent when it has none. */
|
|
927
|
-
highlights?: SponsorHighlight[];
|
|
928
|
-
}
|
|
929
|
-
/** The sponsor of a checkout / an order as events and `getOrderReference` carry it. */
|
|
930
|
-
type CheckoutSponsor = Pick<SponsorIdentity, 'id' | 'name' | 'logoUrl'>;
|
|
931
|
-
/** `sessionStorage` key of the per-checkout memory. */
|
|
932
|
-
declare const CHECKOUT_SPONSOR_STORAGE_KEY = "vio.checkoutSponsor.v1";
|
|
933
|
-
/**
|
|
934
|
-
* The identity of a sponsor from a bootstrap (`findSponsorIn`): its trimmed
|
|
935
|
-
* name and its logo / avatar URLs as given (an empty string is `null`).
|
|
936
|
-
* `null` when the bootstrap does not know the id, or the block says neither
|
|
937
|
-
* a name nor a logo. Pure, never throws.
|
|
938
|
-
*/
|
|
939
|
-
declare function sponsorIdentityFrom(boot: BootstrapResponse | null | undefined, sponsorId: number | string | null | undefined): SponsorIdentity | null;
|
|
940
|
-
|
|
941
|
-
/**
|
|
942
|
-
* What the commerce gateway may not know yet.
|
|
943
|
-
*
|
|
944
|
-
* The SDK ships ahead of the gateway more than once a quarter: a selection
|
|
945
|
-
* (`buyer_ref`, 2026-10-19), an argument (`origin` on the cart lines,
|
|
946
|
-
* `attribution` on the checkout — ADR-0035 phase B). A gateway that does not
|
|
947
|
-
* have the field refuses the WHOLE operation at validation — before anything
|
|
948
|
-
* runs, with no `data` — so each such operation is sent again without the
|
|
949
|
-
* field, once, and the answer remembered for the page load. An operation that
|
|
950
|
-
* DID run and failed is never repeated: for a mutation that would be a second
|
|
951
|
-
* charge, a second line in the cart.
|
|
952
|
-
*
|
|
953
|
-
* One mechanism for all of them, so the next field costs a token here and a
|
|
954
|
-
* call to `withGatewayFeature`, not a new copy of the retry.
|
|
955
|
-
*/
|
|
956
|
-
type GatewayFeature = 'buyer_ref' | 'line_origin' | 'checkout_attribution';
|
|
957
|
-
/** Whether this page load still expects the gateway to know `feature` (false once it refused it). */
|
|
958
|
-
declare function gatewayHas(feature: GatewayFeature): boolean;
|
|
959
|
-
/** Forget what this page load learned (tests). One feature, or all of them. */
|
|
960
|
-
declare function resetGatewayFeatures(feature?: GatewayFeature): void;
|
|
961
|
-
/**
|
|
962
|
-
* True when `err` is the gateway refusing something it does not know, named
|
|
963
|
-
* `token` (`Cannot query field "buyer_ref" on type …`, `Unknown argument
|
|
964
|
-
* "origin" on field …`, `Unknown type "CartLineOriginInput"`, `Field "origin" is
|
|
965
|
-
* not defined by type "LineItemInput"`): a validation error, with no `data`
|
|
966
|
-
* and no `path` because nothing ran — safe to send again without it, a
|
|
967
|
-
* mutation included. Anything that ran (data present, or an error with a
|
|
968
|
-
* path) or any other message is not.
|
|
969
|
-
*/
|
|
970
|
-
declare function isUnknownTokenError(err: unknown, token: string): boolean;
|
|
971
|
-
/** `isUnknownTokenError` for any of the names a feature goes by. */
|
|
972
|
-
declare function isUnknownFeatureError(err: unknown, feature: GatewayFeature): boolean;
|
|
973
|
-
/**
|
|
974
|
-
* Runs `request(true)` (the operation with the feature); when the gateway
|
|
975
|
-
* does not know it, `request(false)` (without it) — and from then on, for
|
|
976
|
-
* this page load, straight to the latter. Said once in the console: a
|
|
977
|
-
* gateway behind the SDK is worth knowing about, and so is a renamed type.
|
|
978
|
-
*/
|
|
979
|
-
declare function withGatewayFeature<T>(feature: GatewayFeature, request: (supported: boolean) => Promise<T>): Promise<T>;
|
|
980
|
-
|
|
981
|
-
/**
|
|
982
|
-
* A line origin as Commerce receives it (ADR-0035 phase B): `origin` on each
|
|
983
|
-
* line of `AddItem` and, when the quantity goes UP, on `UpdateItem` — the
|
|
984
|
-
* origin of the units that update adds. shopcart keeps every origin of a
|
|
985
|
-
* line with its units (`cart_item.origins`) and writes the order from them:
|
|
986
|
-
* `order_item.campaign_id` / `location_id` / `component_kind`, and the
|
|
987
|
-
* order's page when the checkout does not name one.
|
|
988
|
-
*
|
|
989
|
-
* snake_case on the wire, the caps of shopcart's `LineOriginDto` enforced
|
|
990
|
-
* here, once. Pure: `lineOriginWire()` takes the origin and the page.
|
|
991
|
-
*/
|
|
992
|
-
|
|
993
|
-
/** The largest `Int` GraphQL coerces; a bigger id would fail the whole mutation. */
|
|
994
|
-
declare const GRAPHQL_INT_MAX = 2147483647;
|
|
995
|
-
/** `LineOriginDto` (shopcart `cart/dtos/send/line-origin.dto.ts`). */
|
|
996
|
-
interface LineOriginWire {
|
|
997
|
-
campaign_id?: number;
|
|
998
|
-
location_id?: string;
|
|
999
|
-
component_kind?: string;
|
|
1000
|
-
content_url?: string;
|
|
1001
|
-
content_title?: string;
|
|
1002
|
-
}
|
|
1003
|
-
/** The caps of `LineOriginDto` — a longer value is refused whole by the API, so it is cut here. */
|
|
1004
|
-
declare const LINE_ORIGIN_CAPS: Readonly<{
|
|
1005
|
-
locationId: 100;
|
|
1006
|
-
componentKind: 32;
|
|
1007
|
-
contentUrl: 2048;
|
|
1008
|
-
contentTitle: 255;
|
|
1009
|
-
}>;
|
|
1010
|
-
/** The page the units are added from, for an origin that does not carry its own. */
|
|
1011
|
-
interface OriginPage {
|
|
1012
|
-
contentUrl?: string;
|
|
1013
|
-
contentTitle?: string;
|
|
1014
|
-
}
|
|
1015
|
-
interface LineOriginWireOptions {
|
|
1016
|
-
/** The current page, for an origin that does not carry its own. */
|
|
1017
|
-
page?: OriginPage;
|
|
1018
|
-
/**
|
|
1019
|
-
* The surface's privacy mode. Only on a `standard` surface do the slot
|
|
1020
|
-
* (`location_id`) and the page (`content_url`, `content_title`) travel —
|
|
1021
|
-
* which screen a unit was sold from is what `minimal` keeps private, the
|
|
1022
|
-
* same promise the collector keeps for the events. `campaign_id` and
|
|
1023
|
-
* `component_kind` always do. Default `unknown`: fail closed.
|
|
739
|
+
* The surface's privacy mode. Only on a `standard` surface do the slot
|
|
740
|
+
* (`location_id`) and the page (`content_url`, `content_title`) travel —
|
|
741
|
+
* which screen a unit was sold from is what `minimal` keeps private, the
|
|
742
|
+
* same promise the collector keeps for the events. `campaign_id` and
|
|
743
|
+
* `component_kind` always do. Default `unknown`: fail closed.
|
|
1024
744
|
*/
|
|
1025
745
|
privacyMode?: SurfacePrivacyMode | 'unknown';
|
|
1026
746
|
}
|
|
@@ -1245,6 +965,63 @@ declare function autoSlotDisplayName(kind: SlotKind, ordinal: number, scopeName?
|
|
|
1245
965
|
/** A scope value fit for an id: trimmed, inner whitespace → `-`. */
|
|
1246
966
|
declare function normalizeScope(scope: string | null | undefined): string;
|
|
1247
967
|
|
|
968
|
+
/**
|
|
969
|
+
* Who sells — the sponsor's (brand's) display identity: its name and logo.
|
|
970
|
+
*
|
|
971
|
+
* ONE rule for every place that names a sponsor (the product detail, the
|
|
972
|
+
* carousel's retailer line, the cart, the checkout header, the confirmation,
|
|
973
|
+
* the payment event and `getOrderReference`): the bootstrap's sponsor block —
|
|
974
|
+
* the config's primary and secondaries, then every `campaigns[]` primary and
|
|
975
|
+
* secondaries, first match — and, when the bootstrap does not know the id,
|
|
976
|
+
* what this tab remembered of the checkout, then the cart's `sponsorName`.
|
|
977
|
+
*
|
|
978
|
+
* In a checkout and on its confirmation the sponsor is the CHECKOUT's (the
|
|
979
|
+
* cart's sponsor, the one the order is with), never the page's attribution:
|
|
980
|
+
* an article of brand A may sell a product of brand B.
|
|
981
|
+
*
|
|
982
|
+
* Pure helpers and a tiny per-checkout memory in `sessionStorage`; no DOM.
|
|
983
|
+
*/
|
|
984
|
+
|
|
985
|
+
/** What a sponsor looks like to a shopper. `name` is the brand's display name. */
|
|
986
|
+
interface SponsorIdentity {
|
|
987
|
+
id: number;
|
|
988
|
+
name: string;
|
|
989
|
+
/** The brand's logo, as the bootstrap gives it (never rewritten); `null` when it has none. */
|
|
990
|
+
logoUrl: string | null;
|
|
991
|
+
avatarUrl: string | null;
|
|
992
|
+
/** The brand's purchase terms page — https only; `null` when it has none. */
|
|
993
|
+
termsUrl?: string | null;
|
|
994
|
+
/** The brand's returns / refund policy page — https only; `null` when it has none. */
|
|
995
|
+
refundPolicyUrl?: string | null;
|
|
996
|
+
/** The brand's promises (at most three, each with a title); absent when it has none. */
|
|
997
|
+
highlights?: SponsorHighlight[];
|
|
998
|
+
}
|
|
999
|
+
/** The sponsor of a checkout / an order as events and `getOrderReference` carry it. */
|
|
1000
|
+
type CheckoutSponsor = Pick<SponsorIdentity, 'id' | 'name' | 'logoUrl'>;
|
|
1001
|
+
/** `sessionStorage` key of the per-checkout memory. */
|
|
1002
|
+
declare const CHECKOUT_SPONSOR_STORAGE_KEY = "vio.checkoutSponsor.v1";
|
|
1003
|
+
/**
|
|
1004
|
+
* Where a sponsor sells right now: the campaign in context (`campaignId` —
|
|
1005
|
+
* the element's `vio-campaign`, an ancestor's `data-vio-campaign`, the
|
|
1006
|
+
* click's `campaignId`, `Vio.init`'s, in that order of precedence) or the
|
|
1007
|
+
* channel a cart was created on (`channelId`).
|
|
1008
|
+
*/
|
|
1009
|
+
interface SponsorCommerceContext {
|
|
1010
|
+
campaignId?: CampaignHint;
|
|
1011
|
+
channelId?: string | number | null;
|
|
1012
|
+
}
|
|
1013
|
+
/** A sponsor block that can sell: it carries a commerce block with an API key. */
|
|
1014
|
+
type SellingSponsor = Sponsor & {
|
|
1015
|
+
commerce: SponsorCommerceBlock;
|
|
1016
|
+
};
|
|
1017
|
+
/**
|
|
1018
|
+
* The identity of a sponsor from a bootstrap (`findSponsorIn`): its trimmed
|
|
1019
|
+
* name and its logo / avatar URLs as given (an empty string is `null`).
|
|
1020
|
+
* `null` when the bootstrap does not know the id, or the block says neither
|
|
1021
|
+
* a name nor a logo. Pure, never throws.
|
|
1022
|
+
*/
|
|
1023
|
+
declare function sponsorIdentityFrom(boot: BootstrapResponse | null | undefined, sponsorId: number | string | null | undefined): SponsorIdentity | null;
|
|
1024
|
+
|
|
1248
1025
|
/**
|
|
1249
1026
|
* Vio.analytics — the web SDK's half of the Vio Analytics pipeline.
|
|
1250
1027
|
*
|
|
@@ -1280,6 +1057,16 @@ declare const ANALYTICS_EVENT_NAMES: readonly ["view_item_list", "select_item",
|
|
|
1280
1057
|
type AnalyticsEventName = (typeof ANALYTICS_EVENT_NAMES)[number];
|
|
1281
1058
|
/** Camel-case for DX; mapped to the snake_case wire format at build time. */
|
|
1282
1059
|
interface AnalyticsContext {
|
|
1060
|
+
/**
|
|
1061
|
+
* The `<vio-product-detail>` layout shown (0.34), on `view_item` and only
|
|
1062
|
+
* for a non-default layout: `layout_id`, `layout_revision`, `experiment_id`,
|
|
1063
|
+
* `variant_id` in the event's `context` (next to `campaign_id` /
|
|
1064
|
+
* `location_id`). `variantId` is the experiment variant.
|
|
1065
|
+
*/
|
|
1066
|
+
layoutId?: string;
|
|
1067
|
+
layoutRevision?: string;
|
|
1068
|
+
experimentId?: string;
|
|
1069
|
+
variantId?: string;
|
|
1283
1070
|
campaignId?: number;
|
|
1284
1071
|
broadcastId?: string;
|
|
1285
1072
|
campaignComponentId?: number;
|
|
@@ -1314,9 +1101,22 @@ interface AnalyticsItemInput {
|
|
|
1314
1101
|
productId: number | string;
|
|
1315
1102
|
name?: string;
|
|
1316
1103
|
brand?: string;
|
|
1104
|
+
/** The PRODUCT variant (`variant_id` on the wire). */
|
|
1317
1105
|
variantId?: number | string;
|
|
1318
1106
|
price?: number;
|
|
1319
1107
|
quantity?: number;
|
|
1108
|
+
/**
|
|
1109
|
+
* The `<vio-product-detail>` layout these units were added from (0.34), from
|
|
1110
|
+
* the cart line's origin: `layout_id`, `layout_revision`, `experiment_id`,
|
|
1111
|
+
* `experiment_variant_id` on the wire. When any of them is given, all four
|
|
1112
|
+
* go out (`''` for the missing ones); the SDK's events with cart items give
|
|
1113
|
+
* them always (`''` when the units came from no layout).
|
|
1114
|
+
*/
|
|
1115
|
+
layoutId?: string;
|
|
1116
|
+
layoutRevision?: string;
|
|
1117
|
+
experimentId?: string;
|
|
1118
|
+
/** The EXPERIMENT variant of the layout — not the product variant. */
|
|
1119
|
+
experimentVariantId?: string;
|
|
1320
1120
|
}
|
|
1321
1121
|
interface AnalyticsCommerce {
|
|
1322
1122
|
items?: AnalyticsItemInput[];
|
|
@@ -1806,195 +1606,536 @@ interface CheckoutAttributionInput {
|
|
|
1806
1606
|
/** Where the session came in (`resolveLanding()`): referrer, utm, landing page. */
|
|
1807
1607
|
landing?: Landing | null;
|
|
1808
1608
|
/**
|
|
1809
|
-
* The surface's privacy mode. Only on a `standard` surface do the page
|
|
1810
|
-
* (`content_url`, `content_title`) and the entry context travel: which
|
|
1811
|
-
* screen the sale was made on and why the shopper was there is what
|
|
1812
|
-
* `minimal` keeps private — the same promise the collector keeps for the
|
|
1813
|
-
* events. `unknown` (it could not be learnt) counts as `minimal`: what can
|
|
1814
|
-
* reveal it is only sent when the surface is known to allow it. The surface
|
|
1815
|
-
* and the campaign always travel.
|
|
1609
|
+
* The surface's privacy mode. Only on a `standard` surface do the page
|
|
1610
|
+
* (`content_url`, `content_title`) and the entry context travel: which
|
|
1611
|
+
* screen the sale was made on and why the shopper was there is what
|
|
1612
|
+
* `minimal` keeps private — the same promise the collector keeps for the
|
|
1613
|
+
* events. `unknown` (it could not be learnt) counts as `minimal`: what can
|
|
1614
|
+
* reveal it is only sent when the surface is known to allow it. The surface
|
|
1615
|
+
* and the campaign always travel.
|
|
1616
|
+
*/
|
|
1617
|
+
privacyMode?: SurfacePrivacyMode | 'unknown';
|
|
1618
|
+
}
|
|
1619
|
+
/**
|
|
1620
|
+
* The attribution for the wire, or `undefined` when there is nothing to say.
|
|
1621
|
+
* The campaign is the page's; without one, the campaign that explains most
|
|
1622
|
+
* units of the cart under the same rule `purchase` is split by (ties: the
|
|
1623
|
+
* higher value, then the first). The page (origin + path) and the entry go
|
|
1624
|
+
* only on a `standard` surface.
|
|
1625
|
+
*/
|
|
1626
|
+
declare function checkoutAttributionOf(input: CheckoutAttributionInput): CheckoutAttributionWire | undefined;
|
|
1627
|
+
/** The landing as `entry`, capped; `undefined` when it says nothing. */
|
|
1628
|
+
declare function entryContextOf(landing: Landing | null | undefined): EntryContextWire | undefined;
|
|
1629
|
+
/**
|
|
1630
|
+
* The campaign that explains most units of the cart — over the slices
|
|
1631
|
+
* `purchase` is split by, so the order names the campaign the biggest
|
|
1632
|
+
* purchase event names. Ties go to the higher value, then to the first
|
|
1633
|
+
* slice. Units nobody attributes (a slice without campaign) never win.
|
|
1634
|
+
*/
|
|
1635
|
+
declare function dominantCampaignOf(slices: ReadonlyArray<CartSlice> | null | undefined): number | undefined;
|
|
1636
|
+
|
|
1637
|
+
/**
|
|
1638
|
+
* Vipps MobilePay Payment Adapter — GraphQL Integration & Types.
|
|
1639
|
+
*
|
|
1640
|
+
* Vipps payment integration uses 2 GraphQL operations:
|
|
1641
|
+
*
|
|
1642
|
+
* 1. `CreatePaymentVipps` mutation:
|
|
1643
|
+
* Initiates a Vipps payment session for a checkout and returns `payment_url`.
|
|
1644
|
+
*
|
|
1645
|
+
* 2. `GetVippsStatus` query:
|
|
1646
|
+
* Queries Vipps payment state directly for a checkout (`state`).
|
|
1647
|
+
*/
|
|
1648
|
+
|
|
1649
|
+
/**
|
|
1650
|
+
* GraphQL mutation to create a Vipps payment session.
|
|
1651
|
+
*/
|
|
1652
|
+
declare const CREATE_PAYMENT_VIPPS_MUTATION = "\nmutation CreatePaymentVipps($checkoutId: String!, $email: String, $returnUrl: String!, $express: Boolean) {\n Payment {\n CreatePaymentVipps(checkout_id: $checkoutId, email: $email, return_url: $returnUrl, express: $express) {\n payment_url\n reference\n express\n reason\n }\n }\n}\n";
|
|
1653
|
+
/**
|
|
1654
|
+
* GraphQL query to fetch current Vipps payment status.
|
|
1655
|
+
*/
|
|
1656
|
+
declare const GET_VIPPS_STATUS_QUERY = "\nquery GetVippsStatus($checkoutId: String!) {\n Payment {\n GetVippsStatus(checkout_id: $checkoutId) {\n state\n duplicate_of\n }\n }\n}\n";
|
|
1657
|
+
interface CreatePaymentVippsVariables extends Record<string, unknown> {
|
|
1658
|
+
checkoutId: string;
|
|
1659
|
+
/** Optional since Express: Vipps hands the email back with the payment. */
|
|
1660
|
+
email?: string;
|
|
1661
|
+
returnUrl: string;
|
|
1662
|
+
/**
|
|
1663
|
+
* `true` asks for Express — address and delivery chosen inside the Vipps
|
|
1664
|
+
* app. When the cart cannot have it, no payment is created and the answer
|
|
1665
|
+
* says `express: false` with the reason; the caller then opens the
|
|
1666
|
+
* ordinary checkout.
|
|
1667
|
+
*/
|
|
1668
|
+
express?: boolean;
|
|
1669
|
+
}
|
|
1670
|
+
interface CreatePaymentVippsResponse {
|
|
1671
|
+
/** Absent when Express was asked for and refused. */
|
|
1672
|
+
payment_url?: string;
|
|
1673
|
+
/** The reference the seller reads in its Vipps portal. */
|
|
1674
|
+
reference?: string;
|
|
1675
|
+
express?: boolean;
|
|
1676
|
+
reason?: string;
|
|
1677
|
+
}
|
|
1678
|
+
interface GetVippsStatusVariables extends Record<string, unknown> {
|
|
1679
|
+
checkoutId: string;
|
|
1680
|
+
}
|
|
1681
|
+
interface VippsStatusResult {
|
|
1682
|
+
state: string;
|
|
1683
|
+
/** Set when this checkout was closed as a duplicate: the checkout that paid the cart. */
|
|
1684
|
+
duplicate_of?: string | null;
|
|
1685
|
+
}
|
|
1686
|
+
type VippsPaymentState = 'CREATED' | 'INITIATED' | 'AUTHORIZED' | 'TERMINATED' | 'EXPIRED' | string;
|
|
1687
|
+
/**
|
|
1688
|
+
* Executes the `CreatePaymentVipps` GraphQL mutation.
|
|
1689
|
+
*/
|
|
1690
|
+
declare function createPaymentVipps(variables: CreatePaymentVippsVariables | Record<string, unknown>, options?: CartQueryOptions): Promise<CreatePaymentVippsResponse | null>;
|
|
1691
|
+
/**
|
|
1692
|
+
* Executes the `GetVippsStatus` GraphQL query.
|
|
1693
|
+
*/
|
|
1694
|
+
declare function getVippsStatus(variables: GetVippsStatusVariables | Record<string, unknown>, options?: CartQueryOptions): Promise<VippsStatusResult | null>;
|
|
1695
|
+
|
|
1696
|
+
declare const CREATE_CART_MUTATION = "\nmutation CreateCart($customerSessionId: String!, $currency: String!, $shippingCountry: String) {\n Cart {\n CreateCart(customer_session_id: $customerSessionId, currency: $currency, shipping_country: $shippingCountry) {\n cart_id\n customer_session_id\n shipping_country\n line_items {\n id\n supplier\n image {\n id\n url\n width\n height\n }\n sku\n barcode\n brand\n product_id\n title\n variant_id\n variant_title\n variant {\n option\n value\n }\n quantity\n price {\n amount\n currency_code\n discount\n compare_at\n compare_at_incl_taxes\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n shipping {\n id\n name\n description\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n available_shippings {\n id\n name\n description\n country_code\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n }\n subtotal\n shipping\n currency\n available_shipping_countries\n }\n }\n}\n";
|
|
1697
|
+
declare const ADD_ITEM_MUTATION = "\nmutation AddItem($cartId: String!, $lineItems: [LineItemInput!]!) {\n Cart {\n AddItem(cart_id: $cartId, line_items: $lineItems) {\n cart_id\n customer_session_id\n shipping_country\n line_items {\n id\n supplier\n image {\n id\n url\n width\n height\n }\n sku\n barcode\n brand\n product_id\n title\n variant_id\n variant_title\n variant {\n option\n value\n }\n quantity\n price {\n amount\n currency_code\n discount\n compare_at\n compare_at_incl_taxes\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n shipping {\n id\n name\n description\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n available_shippings {\n id\n name\n description\n country_code\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n }\n subtotal\n shipping\n currency\n available_shipping_countries\n }\n }\n}\n";
|
|
1698
|
+
declare const DELETE_ITEM_MUTATION = "\nmutation DeleteItem($cartId: String!, $cartItemId: String!) {\n Cart {\n DeleteItem(cart_id: $cartId, cart_item_id: $cartItemId) {\n cart_id\n customer_session_id\n shipping_country\n line_items {\n id\n supplier\n image {\n id\n url\n width\n height\n }\n sku\n barcode\n brand\n product_id\n title\n variant_id\n variant_title\n variant {\n option\n value\n }\n quantity\n price {\n amount\n currency_code\n discount\n compare_at\n compare_at_incl_taxes\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n shipping {\n id\n name\n description\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n available_shippings {\n id\n name\n description\n country_code\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n }\n subtotal\n shipping\n currency\n available_shipping_countries\n }\n }\n}\n";
|
|
1699
|
+
declare const UPDATE_ITEM_MUTATION: string;
|
|
1700
|
+
/** `UpdateItem` with the `origin` of the added units (`CartLineOriginInput`, snake_case fields — see `lineOriginWire`). */
|
|
1701
|
+
declare const UPDATE_ITEM_WITH_ORIGIN_MUTATION: string;
|
|
1702
|
+
declare const GET_CART_QUERY = "\nquery GetCart($cartId: String!) {\n Cart {\n GetCart(cart_id: $cartId) {\n cart_id\n customer_session_id\n shipping_country\n line_items {\n id\n supplier\n image {\n id\n url\n width\n height\n }\n sku\n barcode\n brand\n product_id\n title\n variant_id\n variant_title\n variant {\n option\n value\n }\n quantity\n price {\n amount\n currency_code\n discount\n compare_at\n compare_at_incl_taxes\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n shipping {\n id\n name\n description\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n available_shippings {\n id\n name\n description\n country_code\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n }\n subtotal\n shipping\n currency\n available_shipping_countries\n }\n }\n}\n";
|
|
1703
|
+
declare const GET_LINE_ITEMS_BY_SUPPLIER_QUERY = "\nquery GetLineItemsBySupplier($cartId: String!) {\n Cart {\n GetLineItemsBySupplier(cart_id: $cartId) {\n supplier {\n id\n name\n }\n available_shippings {\n id\n name\n description\n country_code\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n line_items {\n id\n supplier\n image {\n id\n url\n width\n height\n }\n sku\n barcode\n brand\n product_id\n title\n variant_id\n variant_title\n variant {\n option\n value\n }\n quantity\n price {\n amount\n currency_code\n discount\n compare_at\n compare_at_incl_taxes\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n shipping {\n id\n name\n description\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n }\n }\n }\n}\n";
|
|
1704
|
+
declare const UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION = "\nmutation UpdateShippingsBySupplier($cartId: String!, $data: [DataUpdateShippingsBySupplier!]!) {\n Cart {\n UpdateShippingsBySupplier(cart_id: $cartId, data: $data) {\n cart_id\n customer_session_id\n shipping_country\n line_items {\n id\n supplier\n image {\n id\n url\n width\n height\n }\n sku\n barcode\n brand\n product_id\n title\n variant_id\n variant_title\n variant {\n option\n value\n }\n quantity\n price {\n amount\n currency_code\n discount\n compare_at\n compare_at_incl_taxes\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n shipping {\n id\n name\n description\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n available_shippings {\n id\n name\n description\n country_code\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n }\n subtotal\n shipping\n currency\n available_shipping_countries\n }\n }\n}\n";
|
|
1705
|
+
declare const CREATE_CHECKOUT_MUTATION: string;
|
|
1706
|
+
/** `CreateCheckout` with the checkout's `attribution` (`CheckoutAttributionInput`, snake_case fields — see `checkoutAttributionOf`). */
|
|
1707
|
+
declare const CREATE_CHECKOUT_WITH_ATTRIBUTION_MUTATION: string;
|
|
1708
|
+
declare const UPDATE_CHECKOUT_MUTATION: string;
|
|
1709
|
+
/** `UpdateCheckout` with the checkout's `attribution` (`CheckoutAttributionInput`). */
|
|
1710
|
+
declare const UPDATE_CHECKOUT_WITH_ATTRIBUTION_MUTATION: string;
|
|
1711
|
+
declare const GET_CHECKOUT_QUERY = "\nquery GetCheckout($checkoutId: String!) {\n Checkout {\n GetCheckout(checkout_id: $checkoutId) {\n buyer_accepts_purchase_conditions\n buyer_accepts_terms_conditions\n created_at\n updated_at\n id\n deleted_at\n success_url\n cancel_url\n payment_method\n email\n status\n checkout_url\n origin_payment_id\n duplicate_of\n billing_address {\n id\n first_name\n last_name\n phone_code\n phone\n company\n address1\n address2\n city\n province\n province_code\n country\n country_code\n zip\n }\n shipping_address {\n id\n first_name\n last_name\n phone_code\n phone\n company\n address1\n address2\n city\n province\n province_code\n country\n country_code\n zip\n }\n available_payment_methods {\n name\n }\n discount_code\n cart {\n cart_id\n customer_session_id\n shipping_country\n line_items {\n id\n supplier\n image {\n id\n url\n width\n height\n }\n sku\n barcode\n brand\n product_id\n title\n variant_id\n variant_title\n variant {\n option\n value\n }\n quantity\n price {\n amount\n currency_code\n discount\n compare_at\n compare_at_incl_taxes\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n shipping {\n id\n name\n description\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n available_shippings {\n id\n name\n description\n country_code\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n }\n subtotal\n shipping\n currency\n available_shipping_countries\n }\n totals {\n currency_code\n subtotal\n shipping\n total\n taxes\n tax_rate\n discounts\n }\n }\n }\n}\n";
|
|
1712
|
+
declare const GET_AVAILABLE_PAYMENT_METHODS_QUERY = "\nquery Config {\n Payment {\n GetAvailablePaymentMethods {\n config {\n name\n type\n value\n }\n name\n }\n }\n}\n";
|
|
1713
|
+
|
|
1714
|
+
/** Transport options for a cart/checkout GraphQL call. */
|
|
1715
|
+
interface CartQueryOptions {
|
|
1716
|
+
endpoint?: string;
|
|
1717
|
+
apiKey?: string;
|
|
1718
|
+
/** Sponsor commerce key — goes in the Authorization header. */
|
|
1719
|
+
commerceKey?: string;
|
|
1720
|
+
/** True when the commerce key came from a resolved sponsor (bootstrap).
|
|
1721
|
+
* False = we fell back to the host apiKey — writes like CreateCart should
|
|
1722
|
+
* NOT proceed with the wrong key (the cart would be orphaned). */
|
|
1723
|
+
sponsorResolved?: boolean;
|
|
1724
|
+
/** The commerce channel of the key (`commerce.channelId` of the block it came from), when known. */
|
|
1725
|
+
channelId?: string;
|
|
1726
|
+
/**
|
|
1727
|
+
* True when a channel was asked for (`ctx.channelId`) and the bootstrap no
|
|
1728
|
+
* longer lists it for the sponsor: the call must not go out with another
|
|
1729
|
+
* channel's key — a cart on that channel is rebuilt on the current one.
|
|
1730
|
+
*/
|
|
1731
|
+
channelMissing?: boolean;
|
|
1732
|
+
}
|
|
1733
|
+
/** Which channel's key a cart / checkout call takes (see `getCartGraphQLOptions`). */
|
|
1734
|
+
interface CartKeyContext {
|
|
1735
|
+
/** The channel the cart (or checkout) lives on: only that channel's key. */
|
|
1736
|
+
channelId?: string | number | null;
|
|
1737
|
+
/** The campaign in context (candidates in precedence order); `null` = none at all, not even `Vio.init`'s. */
|
|
1738
|
+
campaignId?: number | string | null | ReadonlyArray<number | string | null | undefined>;
|
|
1739
|
+
/** A channel the bootstrap no longer lists still answers with the key this page saw for it (an open checkout). */
|
|
1740
|
+
retired?: boolean;
|
|
1741
|
+
}
|
|
1742
|
+
/**
|
|
1743
|
+
* Resolve endpoint + keys for cart GraphQL calls. Awaits Vio.bootstrap() once
|
|
1744
|
+
* if it hasn't run yet (the sponsor commerce keys come from bootstrap), then
|
|
1745
|
+
* uses the sponsor's commerce apiKey (via the Vio facade on globalThis,
|
|
1746
|
+
* avoiding an import cycle); falls back to the host apiKey.
|
|
1747
|
+
*/
|
|
1748
|
+
declare function getCartGraphQLOptions(sponsorId?: number, ctx?: CartKeyContext): Promise<CartQueryOptions>;
|
|
1749
|
+
/**
|
|
1750
|
+
* Stable per-browser customer session id (backend CreateCart requires one).
|
|
1751
|
+
* Never throws: where storage is refused (in-app browsers) the id lives in
|
|
1752
|
+
* this page's memory — still one per shopper, never the shared
|
|
1753
|
+
* `cs_session_default` every storage-less browser used to send.
|
|
1754
|
+
*/
|
|
1755
|
+
declare function getCustomerSessionId(): string;
|
|
1756
|
+
interface GraphQLEnvelope {
|
|
1757
|
+
data?: Record<string, Record<string, unknown>> | null;
|
|
1758
|
+
errors?: Array<{
|
|
1759
|
+
message?: string;
|
|
1760
|
+
path?: unknown;
|
|
1761
|
+
}>;
|
|
1762
|
+
}
|
|
1763
|
+
/** Execute a GraphQL query/mutation against the configured commerce endpoint.
|
|
1764
|
+
* Callers that skip `getCartGraphQLOptions()` (or pass a bare sponsorId) get
|
|
1765
|
+
* it resolved here instead of silently sending an unauthenticated request.
|
|
1766
|
+
* Rejects after `CART_GRAPHQL_TIMEOUT_MS` (and aborts the fetch). */
|
|
1767
|
+
declare function executeCartGraphQL(query: string, variables: Record<string, unknown>, options?: CartQueryOptions | number | undefined): Promise<GraphQLEnvelope>;
|
|
1768
|
+
declare function createCart(customerSessionId: string, currency: string, shippingCountry?: string | null, options?: CartQueryOptions): Promise<any>;
|
|
1769
|
+
/**
|
|
1770
|
+
* `AddItem`. A line may carry `origin` (`LineOriginWire`: where its units
|
|
1771
|
+
* come from — ADR-0035 phase B). A gateway that predates the field refuses
|
|
1772
|
+
* the whole mutation at validation (`LineItemInput` has no `origin`), so the
|
|
1773
|
+
* lines are sent again without it, once per page load — see gateway-features.
|
|
1774
|
+
*/
|
|
1775
|
+
declare function addItem(cartId: string, lineItems: unknown[], options?: CartQueryOptions): Promise<any>;
|
|
1776
|
+
declare function deleteItem(cartId: string, cartItemId: string, options?: CartQueryOptions): Promise<any>;
|
|
1777
|
+
/**
|
|
1778
|
+
* `UpdateItem`. `extra.origin` is where the units a quantity INCREASE adds
|
|
1779
|
+
* come from (ADR-0035 phase B); the server credits the new units to it. Sent
|
|
1780
|
+
* only with it; a gateway that predates the argument gets the legacy
|
|
1781
|
+
* mutation instead, once per page load — see gateway-features.
|
|
1782
|
+
*/
|
|
1783
|
+
declare function updateItem(cartId: string, cartItemId: string, shippingId?: string | null, qty?: number | null, options?: CartQueryOptions, extra?: {
|
|
1784
|
+
origin?: LineOriginWire;
|
|
1785
|
+
}): Promise<any>;
|
|
1786
|
+
declare function getCart(cartId: string, options?: CartQueryOptions): Promise<any>;
|
|
1787
|
+
declare function getLineItemsBySupplier(cartId: string, options?: CartQueryOptions): Promise<any>;
|
|
1788
|
+
declare function updateShippingsBySupplier(cartId: string, data: unknown[], options?: CartQueryOptions): Promise<any>;
|
|
1789
|
+
/**
|
|
1790
|
+
* `CreateCheckout`. With `extra.attribution` (`CheckoutAttributionWire`:
|
|
1791
|
+
* the surface, the page's campaign, the page and the entry — ADR-0035 phase
|
|
1792
|
+
* B) the checkout is born attributed; a gateway that predates the argument
|
|
1793
|
+
* gets the legacy mutation, once per page load — see gateway-features.
|
|
1794
|
+
*/
|
|
1795
|
+
declare function createCheckout(cartId: string, options?: CartQueryOptions, extra?: {
|
|
1796
|
+
attribution?: CheckoutAttributionWire;
|
|
1797
|
+
}): Promise<any>;
|
|
1798
|
+
/**
|
|
1799
|
+
* `UpdateCheckout`. `variables.attribution` (`CheckoutAttributionWire`) is
|
|
1800
|
+
* merged key by key over what the checkout has; a gateway that predates the
|
|
1801
|
+
* argument gets the legacy mutation without it, once per page load.
|
|
1802
|
+
*/
|
|
1803
|
+
declare function updateCheckout(variables: Record<string, unknown>, options?: CartQueryOptions): Promise<any>;
|
|
1804
|
+
declare function getCheckout(checkoutId: string, options?: CartQueryOptions): Promise<any>;
|
|
1805
|
+
/** What a checkout says of itself after paying: its Vio order number, once the order exists, and its buyer reference. */
|
|
1806
|
+
interface CheckoutReference {
|
|
1807
|
+
orderNumber: number | null;
|
|
1808
|
+
buyerRef: string | null;
|
|
1809
|
+
}
|
|
1810
|
+
/** The order number (null while the order does not exist yet) and the buyer reference (null when the API does not say it). */
|
|
1811
|
+
declare function getCheckoutReference(checkoutId: string, options?: CartQueryOptions): Promise<CheckoutReference>;
|
|
1812
|
+
declare function getAvailablePaymentMethods(options?: CartQueryOptions): Promise<any>;
|
|
1813
|
+
declare const CREATE_PAYMENT_STRIPE_MUTATION = "\nmutation CreatePaymentStripe($checkoutId: String!, $successUrl: String!, $paymentMethod: String!, $email: String!) {\n Payment {\n CreatePaymentStripe(checkout_id: $checkoutId, success_url: $successUrl, payment_method: $paymentMethod, email: $email) {\n order_id\n checkout_url\n }\n }\n}\n";
|
|
1814
|
+
declare function createPaymentStripe(variables: Record<string, unknown>, options?: CartQueryOptions): Promise<any>;
|
|
1815
|
+
|
|
1816
|
+
/**
|
|
1817
|
+
* CartManager — multi-sponsor cart state.
|
|
1818
|
+
*
|
|
1819
|
+
* Mirrors iOS's `CartManager` + `cartsBySponsor`. Holds local state in
|
|
1820
|
+
* memory and persists to localStorage. Reactive: dispatches a `change`
|
|
1821
|
+
* CustomEvent that UI components subscribe to (Web Components react via
|
|
1822
|
+
* `requestUpdate()`).
|
|
1823
|
+
*
|
|
1824
|
+
* The backend cart (Vio Commerce GraphQL CreateCart / AddItem / UpdateItem /
|
|
1825
|
+
* DeleteItem) is kept in sync optimistically from here; since 0.26 every add
|
|
1826
|
+
* and every increase tells it where the units come from (`origin`, ADR-0035
|
|
1827
|
+
* phase B) so the order is born attributed — see `origin-wire.ts`.
|
|
1828
|
+
*/
|
|
1829
|
+
|
|
1830
|
+
interface CartChangeDetail {
|
|
1831
|
+
cartsBySponsor: Map<number, SponsorCartState>;
|
|
1832
|
+
itemCount: number;
|
|
1833
|
+
}
|
|
1834
|
+
/**
|
|
1835
|
+
* Detail of `vio:cart-updated` (on `document`): a sponsor's cart as it stands
|
|
1836
|
+
* after this tab learned of it from somewhere other than its own taps —
|
|
1837
|
+
* `source: 'server'`: GetCart, applied right before a checkout is built on it
|
|
1838
|
+
* (`refreshFromServer`); `source: 'storage'`: another tab of the same site
|
|
1839
|
+
* wrote it (an add there, a payment that cleared it). The lines are copies.
|
|
1840
|
+
*/
|
|
1841
|
+
interface CartUpdatedDetail {
|
|
1842
|
+
sponsorId: number;
|
|
1843
|
+
cartId?: string;
|
|
1844
|
+
items: CartLineItem[];
|
|
1845
|
+
itemCount: number;
|
|
1846
|
+
subtotal: number;
|
|
1847
|
+
currency: string;
|
|
1848
|
+
source: 'server' | 'storage';
|
|
1849
|
+
}
|
|
1850
|
+
interface AddProductOptions {
|
|
1851
|
+
product: Product;
|
|
1852
|
+
sponsorId: number;
|
|
1853
|
+
sponsorName?: string;
|
|
1854
|
+
quantity?: number;
|
|
1855
|
+
variantId?: number;
|
|
1856
|
+
/** Where these units come from (`Vio.attribution(slot)`); see `CartOrigin`. */
|
|
1857
|
+
origin?: CartOrigin;
|
|
1858
|
+
}
|
|
1859
|
+
/** Minimal product shape — for callers who only have e.g. mock data, not a full Product. */
|
|
1860
|
+
interface AddManualOptions {
|
|
1861
|
+
productId: number;
|
|
1862
|
+
sponsorId: number;
|
|
1863
|
+
sponsorName?: string;
|
|
1864
|
+
brand: string;
|
|
1865
|
+
name: string;
|
|
1866
|
+
unitPrice: number;
|
|
1867
|
+
currency: string;
|
|
1868
|
+
imageUrl: string;
|
|
1869
|
+
quantity?: number;
|
|
1870
|
+
variantId?: number;
|
|
1871
|
+
/** Where these units come from (`Vio.attribution(slot)`); see `CartOrigin`. */
|
|
1872
|
+
origin?: CartOrigin;
|
|
1873
|
+
}
|
|
1874
|
+
declare class CartManager extends EventTarget {
|
|
1875
|
+
private cartsBySponsor;
|
|
1876
|
+
/** In-flight CreateCart per sponsor — two quick adds must share ONE backend
|
|
1877
|
+
* cart (two CreateCarts split the items and one silently disappears). */
|
|
1878
|
+
private cartIdPromises;
|
|
1879
|
+
/** Monotonic mutation counter per sponsor + last applied response, so a
|
|
1880
|
+
* slow response can't overwrite the state of a newer one. */
|
|
1881
|
+
private mutationSeq;
|
|
1882
|
+
private appliedSeq;
|
|
1883
|
+
/** In-flight AddItem/UpdateItem/DeleteItem per sponsor. Callers that need
|
|
1884
|
+
* the backend cart to reflect a just-made change (e.g. fetching shippings
|
|
1885
|
+
* right after an add) should `await waitForCartMutations(sponsorId)` first
|
|
1886
|
+
* — otherwise they can race the mutation and see the cart from before it
|
|
1887
|
+
* landed (Alan, 2026-08-18: shippings queried before AddItem settled,
|
|
1888
|
+
* came back empty). */
|
|
1889
|
+
private inFlightMutations;
|
|
1890
|
+
/** Per-line quantity sync with the backend: at most ONE UpdateItem /
|
|
1891
|
+
* DeleteItem in flight per line. Targets that arrive while one is in flight
|
|
1892
|
+
* are coalesced into `pending` (only the latest survives) and sent when the
|
|
1893
|
+
* current request settles. Keyed by `${sponsorId}:${cartItemId}`.
|
|
1894
|
+
* (Alan, 2026-10-15: a burst of +/− clicks fired one UpdateItem per click
|
|
1895
|
+
* in parallel; each response re-applied the whole backend cart, so an
|
|
1896
|
+
* older one landing after a newer optimistic change rolled the line back.) */
|
|
1897
|
+
private qtySyncs;
|
|
1898
|
+
/**
|
|
1899
|
+
* Bumped per sponsor each time its backend cart is dropped because its
|
|
1900
|
+
* channel went away: the lines as they stood then (`carryOver`) go to the
|
|
1901
|
+
* new backend cart, so an add whose local units were already counted in
|
|
1902
|
+
* them must not send its own AddItem as well (see `addManual`).
|
|
1903
|
+
*/
|
|
1904
|
+
private rebuildEpoch;
|
|
1905
|
+
/** The lines to give the next backend cart of a sponsor, after its channel went away. */
|
|
1906
|
+
private carryOver;
|
|
1907
|
+
/** The storage key of this connection's carts. */
|
|
1908
|
+
private readonly storageKey;
|
|
1909
|
+
/**
|
|
1910
|
+
* Whether this is the page's connection now. A manager left behind by a
|
|
1911
|
+
* re-init (another key) still finishes its requests and keeps its own
|
|
1912
|
+
* carts, but says nothing to the page: no `vio:cart-*` events.
|
|
1913
|
+
*/
|
|
1914
|
+
private active;
|
|
1915
|
+
constructor(scope?: string);
|
|
1916
|
+
/** The page's connection is (or is no longer) this one; see `active`. */
|
|
1917
|
+
setActive(active: boolean): void;
|
|
1918
|
+
/** Tell the listeners what this connection's carts hold now (after the page switched to it). */
|
|
1919
|
+
announce(): void;
|
|
1920
|
+
private nextSeq;
|
|
1921
|
+
/** Resolves once every in-flight AddItem/UpdateItem/DeleteItem for this
|
|
1922
|
+
* sponsor has settled (success or failure), including ones started while
|
|
1923
|
+
* waiting (a quantity intent replayed by an AddItem reconcile). No-op if
|
|
1924
|
+
* nothing is pending. */
|
|
1925
|
+
waitForCartMutations(sponsorId: number): Promise<void>;
|
|
1926
|
+
/**
|
|
1927
|
+
* True while an AddItem/UpdateItem/DeleteItem of this sponsor OTHER than
|
|
1928
|
+
* `except` has not settled. A mutation applying its own answer passes
|
|
1929
|
+
* itself: its response is current for what IT sent — only the others make
|
|
1930
|
+
* it stale.
|
|
1931
|
+
*/
|
|
1932
|
+
private hasMutationsInFlight;
|
|
1933
|
+
/** Register a backend mutation so `waitForCartMutations` can await it. */
|
|
1934
|
+
private trackMutation;
|
|
1935
|
+
private qtySyncKey;
|
|
1936
|
+
/** The quantity a line is heading to (pending beats in flight), or
|
|
1937
|
+
* undefined when no quantity sync is active for it. */
|
|
1938
|
+
private intendedQuantity;
|
|
1939
|
+
/** Apply a backend response only if no newer response was applied already.
|
|
1940
|
+
* Returns false when it was discarded as stale. */
|
|
1941
|
+
private applyBackendCart;
|
|
1942
|
+
/** The final answer of a line's sync lost the per-sponsor seq race (another
|
|
1943
|
+
* line answered later): the cart as a whole is stale, but for THIS line it
|
|
1944
|
+
* is the latest word. Copy its quantity (and price) so a server-side clamp
|
|
1945
|
+
* — stock — doesn't leave the optimistic value behind for good, with the
|
|
1946
|
+
* checkout / Apple Pay total built on it. */
|
|
1947
|
+
private reconcileLineFromResponse;
|
|
1948
|
+
/** Surface a cart sync problem to hosts/UI (and the console). */
|
|
1949
|
+
private emitError;
|
|
1950
|
+
/**
|
|
1951
|
+
* The options of a sponsor's backend cart: the key of the channel it was
|
|
1952
|
+
* created on (`channelMissing` when the bootstrap no longer lists it). A
|
|
1953
|
+
* cart from before channels were remembered keeps the sponsor's first
|
|
1954
|
+
* block, as when it was created, and remembers that channel from now on.
|
|
1955
|
+
*/
|
|
1956
|
+
private cartOptions;
|
|
1957
|
+
/**
|
|
1958
|
+
* The backend cart to call for a sponsor, with the key of its channel. When
|
|
1959
|
+
* the bootstrap no longer lists that channel the stale cart is dropped and a
|
|
1960
|
+
* new one is created on the sponsor's current channel with the same lines
|
|
1961
|
+
* (`dropStaleBackendCart` + `ensureCartId`) — never a call with a key of
|
|
1962
|
+
* another channel. `undefined` when there is no backend cart (or none could
|
|
1963
|
+
* be made).
|
|
1964
|
+
*/
|
|
1965
|
+
liveCart(sponsorId: number): Promise<{
|
|
1966
|
+
cartId: string;
|
|
1967
|
+
opts: CartQueryOptions;
|
|
1968
|
+
} | undefined>;
|
|
1969
|
+
/**
|
|
1970
|
+
* The channel of a sponsor's cart is gone from the bootstrap (the campaign
|
|
1971
|
+
* moved, a refresh after hours): forget the backend cart and its line ids,
|
|
1972
|
+
* keep the lines, and remember them as they stand now for the next backend
|
|
1973
|
+
* cart (`carryOver`). Queued quantity syncs of the old cart are dropped —
|
|
1974
|
+
* their quantities are in the lines carried.
|
|
1975
|
+
*/
|
|
1976
|
+
private dropStaleBackendCart;
|
|
1977
|
+
/** Give a new backend cart the lines of the one whose channel went away — each unit with its own origin. */
|
|
1978
|
+
private replayCarriedLines;
|
|
1979
|
+
/**
|
|
1980
|
+
* Ensure the sponsor cart exists server-side; returns its backend cart id.
|
|
1981
|
+
* A new backend cart is created on the channel of the campaign in context —
|
|
1982
|
+
* `ctx.campaignId` (the add's origin), else the campaign the cart's lines
|
|
1983
|
+
* came from, else `Vio.init`'s — and remembers it (`channelId`). An existing
|
|
1984
|
+
* one whose channel the bootstrap no longer lists is created again on the
|
|
1985
|
+
* current channel, with its lines (`liveCart`).
|
|
1986
|
+
*/
|
|
1987
|
+
ensureCartId(sponsorId: number, currency?: string, shippingCountry?: string, ctx?: Pick<CartKeyContext, 'campaignId'>): Promise<string | undefined>;
|
|
1988
|
+
/**
|
|
1989
|
+
* Overwrite local cart state with the backend cart response (source of
|
|
1990
|
+
* truth). `opts.settling` is the mutation whose answer this is: it does not
|
|
1991
|
+
* count as "in flight" for the origins (see `hasMutationsInFlight`).
|
|
1992
|
+
* `opts.authoritative` is a GetCart taken with nothing of this tab's in
|
|
1993
|
+
* flight (`refreshFromServer`): an empty answer then means the cart IS
|
|
1994
|
+
* empty, and the local lines go — not an add still on its way.
|
|
1995
|
+
*/
|
|
1996
|
+
updateFromBackendCart(sponsorId: number, backendCart: {
|
|
1997
|
+
cart_id?: string;
|
|
1998
|
+
currency?: string;
|
|
1999
|
+
shipping_country?: string;
|
|
2000
|
+
subtotal?: number;
|
|
2001
|
+
shipping?: number;
|
|
2002
|
+
available_shipping_countries?: string[];
|
|
2003
|
+
line_items?: Array<{
|
|
2004
|
+
id: string;
|
|
2005
|
+
product_id: number;
|
|
2006
|
+
variant_id?: number | string | null;
|
|
2007
|
+
variant_title?: string | null;
|
|
2008
|
+
brand?: string | null;
|
|
2009
|
+
title?: string | null;
|
|
2010
|
+
quantity: number;
|
|
2011
|
+
image?: string | {
|
|
2012
|
+
url?: string;
|
|
2013
|
+
} | null;
|
|
2014
|
+
imageUrl?: string | null;
|
|
2015
|
+
image_url?: string | null;
|
|
2016
|
+
price?: {
|
|
2017
|
+
amount?: number;
|
|
2018
|
+
amount_incl_taxes?: number | null;
|
|
2019
|
+
currency_code?: string;
|
|
2020
|
+
} | null;
|
|
2021
|
+
shipping?: unknown;
|
|
2022
|
+
available_shippings?: unknown[];
|
|
2023
|
+
}>;
|
|
2024
|
+
}, opts?: {
|
|
2025
|
+
settling?: Promise<unknown>;
|
|
2026
|
+
authoritative?: boolean;
|
|
2027
|
+
}): void;
|
|
2028
|
+
/** Add a Product DTO to a sponsor's cart. Bumps quantity if already present.
|
|
2029
|
+
* When a variantId is given, the line uses the VARIANT's price / image / title
|
|
2030
|
+
* (not the product base), so different combinations are priced correctly. */
|
|
2031
|
+
addProduct(opts: AddProductOptions): CartLineItem;
|
|
2032
|
+
/** Add a manually-specified line item (no Product DTO). */
|
|
2033
|
+
addManual(opts: AddManualOptions): CartLineItem;
|
|
2034
|
+
/** Quantity intents for lines whose backend id hasn't arrived yet — replayed
|
|
2035
|
+
* when the AddItem response reconciles (keyed by product::variant). */
|
|
2036
|
+
private pendingQtyIntents;
|
|
2037
|
+
private intentKey;
|
|
2038
|
+
private findLine;
|
|
2039
|
+
/** Change a line's quantity by `delta`, computed on the manager's CURRENT
|
|
2040
|
+
* quantity — not on whatever a UI rendered a moment ago. A burst of +/−
|
|
2041
|
+
* clicks before a re-render therefore asks for 2, 3, 4… and not for the
|
|
2042
|
+
* same target several times. Reaching 0 removes the line. */
|
|
2043
|
+
adjustQuantity(lineItemId: string, sponsorId: number, delta: number, opts?: {
|
|
2044
|
+
origin?: CartOrigin;
|
|
2045
|
+
}): void;
|
|
2046
|
+
/** Set a line's quantity (0 or less removes it). Optimistic: the local
|
|
2047
|
+
* state and `change` update at once; the backend is synced through
|
|
2048
|
+
* `syncQuantity`, one request in flight per line, latest target wins. */
|
|
2049
|
+
updateQuantity(lineItemId: string, sponsorId: number, quantity: number, opts?: {
|
|
2050
|
+
origin?: CartOrigin;
|
|
2051
|
+
}): void;
|
|
2052
|
+
/** Send a line's target quantity to the backend — ONE request in flight per
|
|
2053
|
+
* line. Targets that arrive while one is in flight queue behind it as
|
|
2054
|
+
* steps (`queueStep`): reduced like the line's origins, sent in order once
|
|
2055
|
+
* the current request settles — one request per queued increase from a
|
|
2056
|
+
* different origin, one for a net decrease — so the server ends on the
|
|
2057
|
+
* last intent, credits every increase to its own origin, and never sees two
|
|
2058
|
+
* updates racing each other. While the sync is active the line keeps its
|
|
2059
|
+
* optimistic quantity through any backend response (see
|
|
2060
|
+
* `updateFromBackendCart`); a rejection drops what was queued and
|
|
2061
|
+
* reconciles the cart from the server. */
|
|
2062
|
+
private syncQuantity;
|
|
2063
|
+
removeItem(lineItemId: string, sponsorId: number): void;
|
|
2064
|
+
clearSponsorCart(sponsorId: number): void;
|
|
2065
|
+
clearAllCarts(): void;
|
|
2066
|
+
/** Refresh the local cart from the backend (source of truth). */
|
|
2067
|
+
fetchCartFromBackend(sponsorId: number): Promise<unknown>;
|
|
2068
|
+
/**
|
|
2069
|
+
* The cart as the server has it, for the moment a checkout is about to be
|
|
2070
|
+
* built on it: what the shopper is about to pay must be what the page shows.
|
|
2071
|
+
* Waits for this tab's own mutations (their answers are the server's too),
|
|
2072
|
+
* then applies GetCart as it is — a line another tab added, one it removed,
|
|
2073
|
+
* an empty cart — and tells the page: `change` for the drawer, and
|
|
2074
|
+
* `vio:cart-updated` on `document` (`source: 'server'`) for a host that
|
|
2075
|
+
* draws its own. A mutation that starts while the server is answering makes
|
|
2076
|
+
* that answer old: it is asked once more. Nothing to ask without a backend
|
|
2077
|
+
* cart. A GetCart that fails leaves the local state as it was and does not
|
|
2078
|
+
* throw — the checkout then goes on with the lines the last mutation
|
|
2079
|
+
* answered, as it always did. Resolves with the sponsor's cart.
|
|
1816
2080
|
*/
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
* The attribution for the wire, or `undefined` when there is nothing to say.
|
|
1821
|
-
* The campaign is the page's; without one, the campaign that explains most
|
|
1822
|
-
* units of the cart under the same rule `purchase` is split by (ties: the
|
|
1823
|
-
* higher value, then the first). The page (origin + path) and the entry go
|
|
1824
|
-
* only on a `standard` surface.
|
|
1825
|
-
*/
|
|
1826
|
-
declare function checkoutAttributionOf(input: CheckoutAttributionInput): CheckoutAttributionWire | undefined;
|
|
1827
|
-
/** The landing as `entry`, capped; `undefined` when it says nothing. */
|
|
1828
|
-
declare function entryContextOf(landing: Landing | null | undefined): EntryContextWire | undefined;
|
|
1829
|
-
/**
|
|
1830
|
-
* The campaign that explains most units of the cart — over the slices
|
|
1831
|
-
* `purchase` is split by, so the order names the campaign the biggest
|
|
1832
|
-
* purchase event names. Ties go to the higher value, then to the first
|
|
1833
|
-
* slice. Units nobody attributes (a slice without campaign) never win.
|
|
1834
|
-
*/
|
|
1835
|
-
declare function dominantCampaignOf(slices: ReadonlyArray<CartSlice> | null | undefined): number | undefined;
|
|
1836
|
-
|
|
1837
|
-
/**
|
|
1838
|
-
* Vipps MobilePay Payment Adapter — GraphQL Integration & Types.
|
|
1839
|
-
*
|
|
1840
|
-
* Vipps payment integration uses 2 GraphQL operations:
|
|
1841
|
-
*
|
|
1842
|
-
* 1. `CreatePaymentVipps` mutation:
|
|
1843
|
-
* Initiates a Vipps payment session for a checkout and returns `payment_url`.
|
|
1844
|
-
*
|
|
1845
|
-
* 2. `GetVippsStatus` query:
|
|
1846
|
-
* Queries Vipps payment state directly for a checkout (`state`).
|
|
1847
|
-
*/
|
|
1848
|
-
|
|
1849
|
-
/**
|
|
1850
|
-
* GraphQL mutation to create a Vipps payment session.
|
|
1851
|
-
*/
|
|
1852
|
-
declare const CREATE_PAYMENT_VIPPS_MUTATION = "\nmutation CreatePaymentVipps($checkoutId: String!, $email: String, $returnUrl: String!, $express: Boolean) {\n Payment {\n CreatePaymentVipps(checkout_id: $checkoutId, email: $email, return_url: $returnUrl, express: $express) {\n payment_url\n reference\n express\n reason\n }\n }\n}\n";
|
|
1853
|
-
/**
|
|
1854
|
-
* GraphQL query to fetch current Vipps payment status.
|
|
1855
|
-
*/
|
|
1856
|
-
declare const GET_VIPPS_STATUS_QUERY = "\nquery GetVippsStatus($checkoutId: String!) {\n Payment {\n GetVippsStatus(checkout_id: $checkoutId) {\n state\n duplicate_of\n }\n }\n}\n";
|
|
1857
|
-
interface CreatePaymentVippsVariables extends Record<string, unknown> {
|
|
1858
|
-
checkoutId: string;
|
|
1859
|
-
/** Optional since Express: Vipps hands the email back with the payment. */
|
|
1860
|
-
email?: string;
|
|
1861
|
-
returnUrl: string;
|
|
2081
|
+
refreshFromServer(sponsorId: number): Promise<SponsorCartState | undefined>;
|
|
2082
|
+
/** `vio:cart-updated` on `document` — see `CartUpdatedDetail`. */
|
|
2083
|
+
private emitCartUpdated;
|
|
1862
2084
|
/**
|
|
1863
|
-
*
|
|
1864
|
-
*
|
|
1865
|
-
*
|
|
1866
|
-
*
|
|
2085
|
+
* Another tab of the site wrote the carts: adopt what it wrote, sponsor by
|
|
2086
|
+
* sponsor — its lines and its backend cart id, or nothing when it cleared
|
|
2087
|
+
* the cart (a payment) — except for a sponsor this tab is mid-write for:
|
|
2088
|
+
* its own answer lands in a moment and is persisted then, over whatever
|
|
2089
|
+
* the other tab had. `key` is null when the other tab cleared the whole
|
|
2090
|
+
* storage. Says `change` (the drawer) and `vio:cart-updated` per sponsor
|
|
2091
|
+
* that changed (`source: 'storage'`); nothing when nothing did.
|
|
1867
2092
|
*/
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
/**
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
/**
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
* Executes the `GetVippsStatus` GraphQL query.
|
|
1893
|
-
*/
|
|
1894
|
-
declare function getVippsStatus(variables: GetVippsStatusVariables | Record<string, unknown>, options?: CartQueryOptions): Promise<VippsStatusResult | null>;
|
|
1895
|
-
|
|
1896
|
-
declare const CREATE_CART_MUTATION = "\nmutation CreateCart($customerSessionId: String!, $currency: String!, $shippingCountry: String) {\n Cart {\n CreateCart(customer_session_id: $customerSessionId, currency: $currency, shipping_country: $shippingCountry) {\n cart_id\n customer_session_id\n shipping_country\n line_items {\n id\n supplier\n image {\n id\n url\n width\n height\n }\n sku\n barcode\n brand\n product_id\n title\n variant_id\n variant_title\n variant {\n option\n value\n }\n quantity\n price {\n amount\n currency_code\n discount\n compare_at\n compare_at_incl_taxes\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n shipping {\n id\n name\n description\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n available_shippings {\n id\n name\n description\n country_code\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n }\n subtotal\n shipping\n currency\n available_shipping_countries\n }\n }\n}\n";
|
|
1897
|
-
declare const ADD_ITEM_MUTATION = "\nmutation AddItem($cartId: String!, $lineItems: [LineItemInput!]!) {\n Cart {\n AddItem(cart_id: $cartId, line_items: $lineItems) {\n cart_id\n customer_session_id\n shipping_country\n line_items {\n id\n supplier\n image {\n id\n url\n width\n height\n }\n sku\n barcode\n brand\n product_id\n title\n variant_id\n variant_title\n variant {\n option\n value\n }\n quantity\n price {\n amount\n currency_code\n discount\n compare_at\n compare_at_incl_taxes\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n shipping {\n id\n name\n description\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n available_shippings {\n id\n name\n description\n country_code\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n }\n subtotal\n shipping\n currency\n available_shipping_countries\n }\n }\n}\n";
|
|
1898
|
-
declare const DELETE_ITEM_MUTATION = "\nmutation DeleteItem($cartId: String!, $cartItemId: String!) {\n Cart {\n DeleteItem(cart_id: $cartId, cart_item_id: $cartItemId) {\n cart_id\n customer_session_id\n shipping_country\n line_items {\n id\n supplier\n image {\n id\n url\n width\n height\n }\n sku\n barcode\n brand\n product_id\n title\n variant_id\n variant_title\n variant {\n option\n value\n }\n quantity\n price {\n amount\n currency_code\n discount\n compare_at\n compare_at_incl_taxes\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n shipping {\n id\n name\n description\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n available_shippings {\n id\n name\n description\n country_code\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n }\n subtotal\n shipping\n currency\n available_shipping_countries\n }\n }\n}\n";
|
|
1899
|
-
declare const UPDATE_ITEM_MUTATION: string;
|
|
1900
|
-
/** `UpdateItem` with the `origin` of the added units (`CartLineOriginInput`, snake_case fields — see `lineOriginWire`). */
|
|
1901
|
-
declare const UPDATE_ITEM_WITH_ORIGIN_MUTATION: string;
|
|
1902
|
-
declare const GET_CART_QUERY = "\nquery GetCart($cartId: String!) {\n Cart {\n GetCart(cart_id: $cartId) {\n cart_id\n customer_session_id\n shipping_country\n line_items {\n id\n supplier\n image {\n id\n url\n width\n height\n }\n sku\n barcode\n brand\n product_id\n title\n variant_id\n variant_title\n variant {\n option\n value\n }\n quantity\n price {\n amount\n currency_code\n discount\n compare_at\n compare_at_incl_taxes\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n shipping {\n id\n name\n description\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n available_shippings {\n id\n name\n description\n country_code\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n }\n subtotal\n shipping\n currency\n available_shipping_countries\n }\n }\n}\n";
|
|
1903
|
-
declare const GET_LINE_ITEMS_BY_SUPPLIER_QUERY = "\nquery GetLineItemsBySupplier($cartId: String!) {\n Cart {\n GetLineItemsBySupplier(cart_id: $cartId) {\n supplier {\n id\n name\n }\n available_shippings {\n id\n name\n description\n country_code\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n line_items {\n id\n supplier\n image {\n id\n url\n width\n height\n }\n sku\n barcode\n brand\n product_id\n title\n variant_id\n variant_title\n variant {\n option\n value\n }\n quantity\n price {\n amount\n currency_code\n discount\n compare_at\n compare_at_incl_taxes\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n shipping {\n id\n name\n description\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n }\n }\n }\n}\n";
|
|
1904
|
-
declare const UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION = "\nmutation UpdateShippingsBySupplier($cartId: String!, $data: [DataUpdateShippingsBySupplier!]!) {\n Cart {\n UpdateShippingsBySupplier(cart_id: $cartId, data: $data) {\n cart_id\n customer_session_id\n shipping_country\n line_items {\n id\n supplier\n image {\n id\n url\n width\n height\n }\n sku\n barcode\n brand\n product_id\n title\n variant_id\n variant_title\n variant {\n option\n value\n }\n quantity\n price {\n amount\n currency_code\n discount\n compare_at\n compare_at_incl_taxes\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n shipping {\n id\n name\n description\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n available_shippings {\n id\n name\n description\n country_code\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n }\n subtotal\n shipping\n currency\n available_shipping_countries\n }\n }\n}\n";
|
|
1905
|
-
declare const CREATE_CHECKOUT_MUTATION: string;
|
|
1906
|
-
/** `CreateCheckout` with the checkout's `attribution` (`CheckoutAttributionInput`, snake_case fields — see `checkoutAttributionOf`). */
|
|
1907
|
-
declare const CREATE_CHECKOUT_WITH_ATTRIBUTION_MUTATION: string;
|
|
1908
|
-
declare const UPDATE_CHECKOUT_MUTATION: string;
|
|
1909
|
-
/** `UpdateCheckout` with the checkout's `attribution` (`CheckoutAttributionInput`). */
|
|
1910
|
-
declare const UPDATE_CHECKOUT_WITH_ATTRIBUTION_MUTATION: string;
|
|
1911
|
-
declare const GET_CHECKOUT_QUERY = "\nquery GetCheckout($checkoutId: String!) {\n Checkout {\n GetCheckout(checkout_id: $checkoutId) {\n buyer_accepts_purchase_conditions\n buyer_accepts_terms_conditions\n created_at\n updated_at\n id\n deleted_at\n success_url\n cancel_url\n payment_method\n email\n status\n checkout_url\n origin_payment_id\n duplicate_of\n billing_address {\n id\n first_name\n last_name\n phone_code\n phone\n company\n address1\n address2\n city\n province\n province_code\n country\n country_code\n zip\n }\n shipping_address {\n id\n first_name\n last_name\n phone_code\n phone\n company\n address1\n address2\n city\n province\n province_code\n country\n country_code\n zip\n }\n available_payment_methods {\n name\n }\n discount_code\n cart {\n cart_id\n customer_session_id\n shipping_country\n line_items {\n id\n supplier\n image {\n id\n url\n width\n height\n }\n sku\n barcode\n brand\n product_id\n title\n variant_id\n variant_title\n variant {\n option\n value\n }\n quantity\n price {\n amount\n currency_code\n discount\n compare_at\n compare_at_incl_taxes\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n shipping {\n id\n name\n description\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n available_shippings {\n id\n name\n description\n country_code\n price {\n amount\n currency_code\n amount_incl_taxes\n tax_amount\n tax_rate\n }\n }\n }\n subtotal\n shipping\n currency\n available_shipping_countries\n }\n totals {\n currency_code\n subtotal\n shipping\n total\n taxes\n tax_rate\n discounts\n }\n }\n }\n}\n";
|
|
1912
|
-
declare const GET_AVAILABLE_PAYMENT_METHODS_QUERY = "\nquery Config {\n Payment {\n GetAvailablePaymentMethods {\n config {\n name\n type\n value\n }\n name\n }\n }\n}\n";
|
|
1913
|
-
|
|
1914
|
-
/** Transport options for a cart/checkout GraphQL call. */
|
|
1915
|
-
interface CartQueryOptions {
|
|
1916
|
-
endpoint?: string;
|
|
1917
|
-
apiKey?: string;
|
|
1918
|
-
/** Sponsor commerce key — goes in the Authorization header. */
|
|
1919
|
-
commerceKey?: string;
|
|
1920
|
-
/** True when the commerce key came from a resolved sponsor (bootstrap).
|
|
1921
|
-
* False = we fell back to the host apiKey — writes like CreateCart should
|
|
1922
|
-
* NOT proceed with the wrong key (the cart would be orphaned). */
|
|
1923
|
-
sponsorResolved?: boolean;
|
|
1924
|
-
}
|
|
1925
|
-
/**
|
|
1926
|
-
* Resolve endpoint + keys for cart GraphQL calls. Awaits Vio.bootstrap() once
|
|
1927
|
-
* if it hasn't run yet (the sponsor commerce keys come from bootstrap), then
|
|
1928
|
-
* uses the sponsor's commerce apiKey (via the Vio facade on globalThis,
|
|
1929
|
-
* avoiding an import cycle); falls back to the host apiKey.
|
|
1930
|
-
*/
|
|
1931
|
-
declare function getCartGraphQLOptions(sponsorId?: number): Promise<CartQueryOptions>;
|
|
1932
|
-
/**
|
|
1933
|
-
* Stable per-browser customer session id (backend CreateCart requires one).
|
|
1934
|
-
* Never throws: where storage is refused (in-app browsers) the id lives in
|
|
1935
|
-
* this page's memory — still one per shopper, never the shared
|
|
1936
|
-
* `cs_session_default` every storage-less browser used to send.
|
|
1937
|
-
*/
|
|
1938
|
-
declare function getCustomerSessionId(): string;
|
|
1939
|
-
interface GraphQLEnvelope {
|
|
1940
|
-
data?: Record<string, Record<string, unknown>> | null;
|
|
1941
|
-
errors?: Array<{
|
|
1942
|
-
message?: string;
|
|
1943
|
-
path?: unknown;
|
|
1944
|
-
}>;
|
|
2093
|
+
private onStorage;
|
|
2094
|
+
/** Line items grouped by supplier (shipping is per-supplier server-side). */
|
|
2095
|
+
fetchLineItemsBySupplier(sponsorId: number): Promise<unknown>;
|
|
2096
|
+
/** Set the chosen shipping option per supplier on the backend cart. */
|
|
2097
|
+
updateShippingsBySupplier(sponsorId: number, data: Array<{
|
|
2098
|
+
shipping_id: string;
|
|
2099
|
+
supplier_id: number;
|
|
2100
|
+
}>): Promise<unknown>;
|
|
2101
|
+
getAllCarts(): Map<number, SponsorCartState>;
|
|
2102
|
+
getCart(sponsorId: number): SponsorCartState | undefined;
|
|
2103
|
+
get itemCount(): number;
|
|
2104
|
+
subtotalForSponsor(sponsorId: number): number;
|
|
2105
|
+
get totalAcrossSponsors(): number;
|
|
2106
|
+
get primaryCurrency(): string;
|
|
2107
|
+
formatTotal(): string;
|
|
2108
|
+
/**
|
|
2109
|
+
* Keep the carts for the next page and the other tabs. Where storage
|
|
2110
|
+
* refuses (in-app browsers, private modes) nothing throws (safe-storage.ts):
|
|
2111
|
+
* the carts stay in this manager's own map, the add to cart and the
|
|
2112
|
+
* checkout go on, and the cart just does not survive a reload there.
|
|
2113
|
+
*/
|
|
2114
|
+
private persist;
|
|
2115
|
+
private loadFromStorage;
|
|
2116
|
+
private emit;
|
|
1945
2117
|
}
|
|
1946
|
-
/** Execute a GraphQL query/mutation against the configured commerce endpoint.
|
|
1947
|
-
* Callers that skip `getCartGraphQLOptions()` (or pass a bare sponsorId) get
|
|
1948
|
-
* it resolved here instead of silently sending an unauthenticated request.
|
|
1949
|
-
* Rejects after `CART_GRAPHQL_TIMEOUT_MS` (and aborts the fetch). */
|
|
1950
|
-
declare function executeCartGraphQL(query: string, variables: Record<string, unknown>, options?: CartQueryOptions | number | undefined): Promise<GraphQLEnvelope>;
|
|
1951
|
-
declare function createCart(customerSessionId: string, currency: string, shippingCountry?: string | null, options?: CartQueryOptions): Promise<any>;
|
|
1952
|
-
/**
|
|
1953
|
-
* `AddItem`. A line may carry `origin` (`LineOriginWire`: where its units
|
|
1954
|
-
* come from — ADR-0035 phase B). A gateway that predates the field refuses
|
|
1955
|
-
* the whole mutation at validation (`LineItemInput` has no `origin`), so the
|
|
1956
|
-
* lines are sent again without it, once per page load — see gateway-features.
|
|
1957
|
-
*/
|
|
1958
|
-
declare function addItem(cartId: string, lineItems: unknown[], options?: CartQueryOptions): Promise<any>;
|
|
1959
|
-
declare function deleteItem(cartId: string, cartItemId: string, options?: CartQueryOptions): Promise<any>;
|
|
1960
2118
|
/**
|
|
1961
|
-
*
|
|
1962
|
-
*
|
|
1963
|
-
*
|
|
1964
|
-
*
|
|
2119
|
+
* Only the attribution fields, trimmed; `{}` when nothing is known. The kind
|
|
2120
|
+
* of element is kept as Commerce and the collector name it (`card`,
|
|
2121
|
+
* `carousel`, `detail` — `componentKindOf`), from `componentKind` or from
|
|
2122
|
+
* the `componentTemplateId` an element's attribution carries (`product-card`);
|
|
2123
|
+
* the page as origin + path (`contentUrl`) and its title, within Commerce's caps.
|
|
1965
2124
|
*/
|
|
1966
|
-
declare function
|
|
1967
|
-
origin?: LineOriginWire;
|
|
1968
|
-
}): Promise<any>;
|
|
1969
|
-
declare function getCart(cartId: string, options?: CartQueryOptions): Promise<any>;
|
|
1970
|
-
declare function getLineItemsBySupplier(cartId: string, options?: CartQueryOptions): Promise<any>;
|
|
1971
|
-
declare function updateShippingsBySupplier(cartId: string, data: unknown[], options?: CartQueryOptions): Promise<any>;
|
|
2125
|
+
declare function normalizeOrigin(origin: CartOrigin | null | undefined): CartOrigin;
|
|
1972
2126
|
/**
|
|
1973
|
-
*
|
|
1974
|
-
*
|
|
1975
|
-
*
|
|
1976
|
-
*
|
|
2127
|
+
* Two origins are the same place when campaign, slot, content and kind of
|
|
2128
|
+
* element all match (the page's URL and title are attributes of the place, not
|
|
2129
|
+
* its identity) — and the same detail layout (0.34): units added under two
|
|
2130
|
+
* layouts stay two origins, so each layout is credited with its own.
|
|
1977
2131
|
*/
|
|
1978
|
-
declare function
|
|
1979
|
-
attribution?: CheckoutAttributionWire;
|
|
1980
|
-
}): Promise<any>;
|
|
2132
|
+
declare function sameOrigin(a: CartOrigin, b: CartOrigin): boolean;
|
|
1981
2133
|
/**
|
|
1982
|
-
*
|
|
1983
|
-
*
|
|
1984
|
-
*
|
|
2134
|
+
* The origins of a line for reporting: what it carries, plus an empty origin
|
|
2135
|
+
* for any units it does not account for (a cart persisted before origins
|
|
2136
|
+
* existed, a server-side bump). Their quantities add up to the line's.
|
|
1985
2137
|
*/
|
|
1986
|
-
declare function
|
|
1987
|
-
declare function getCheckout(checkoutId: string, options?: CartQueryOptions): Promise<any>;
|
|
1988
|
-
/** What a checkout says of itself after paying: its Vio order number, once the order exists, and its buyer reference. */
|
|
1989
|
-
interface CheckoutReference {
|
|
1990
|
-
orderNumber: number | null;
|
|
1991
|
-
buyerRef: string | null;
|
|
1992
|
-
}
|
|
1993
|
-
/** The order number (null while the order does not exist yet) and the buyer reference (null when the API does not say it). */
|
|
1994
|
-
declare function getCheckoutReference(checkoutId: string, options?: CartQueryOptions): Promise<CheckoutReference>;
|
|
1995
|
-
declare function getAvailablePaymentMethods(options?: CartQueryOptions): Promise<any>;
|
|
1996
|
-
declare const CREATE_PAYMENT_STRIPE_MUTATION = "\nmutation CreatePaymentStripe($checkoutId: String!, $successUrl: String!, $paymentMethod: String!, $email: String!) {\n Payment {\n CreatePaymentStripe(checkout_id: $checkoutId, success_url: $successUrl, payment_method: $paymentMethod, email: $email) {\n order_id\n checkout_url\n }\n }\n}\n";
|
|
1997
|
-
declare function createPaymentStripe(variables: Record<string, unknown>, options?: CartQueryOptions): Promise<any>;
|
|
2138
|
+
declare function lineOrigins(line: Pick<CartLineItem, 'origins' | 'quantity'>): CartLineOrigin[];
|
|
1998
2139
|
|
|
1999
2140
|
/**
|
|
2000
2141
|
* Stripe on our own page — the Payment Element, no redirect.
|
|
@@ -2601,6 +2742,8 @@ interface CheckoutState {
|
|
|
2601
2742
|
currency: string;
|
|
2602
2743
|
/** Backend checkout id (Vio Commerce CreateCheckout). */
|
|
2603
2744
|
checkoutId?: string;
|
|
2745
|
+
/** The commerce channel the checkout lives on (its cart's): every call for it uses that channel's key. */
|
|
2746
|
+
channelId?: string;
|
|
2604
2747
|
/** Full backend checkout payload (untyped upstream). */
|
|
2605
2748
|
checkout?: unknown;
|
|
2606
2749
|
/** Klarna Payments session id (native GraphQL flow). */
|
|
@@ -2729,6 +2872,17 @@ declare class CheckoutManager extends EventTarget {
|
|
|
2729
2872
|
*/
|
|
2730
2873
|
private get state();
|
|
2731
2874
|
private set state(value);
|
|
2875
|
+
/**
|
|
2876
|
+
* The options of a call for a sponsor's cart or checkout: the key of the
|
|
2877
|
+
* channel the checkout lives on — what this tab remembered for the
|
|
2878
|
+
* checkout (a return from a redirect, after the cart was cleared), the open
|
|
2879
|
+
* checkout's, else the cart's — even if a bootstrap refresh no longer lists
|
|
2880
|
+
* it (an open checkout keeps paying with its own key). Without any, the
|
|
2881
|
+
* sponsor's block as `getCartGraphQLOptions` resolves it.
|
|
2882
|
+
*/
|
|
2883
|
+
private gqlOptions;
|
|
2884
|
+
/** See `gqlOptions`. */
|
|
2885
|
+
private channelOf;
|
|
2732
2886
|
/** The last checkout + identity written to the memory — the state is set on every keystroke of the form. */
|
|
2733
2887
|
private lastRememberedSponsor;
|
|
2734
2888
|
/** Backend checkouts this page load announced with `vio:checkout-created`: one event each. */
|
|
@@ -3283,9 +3437,23 @@ declare function resolveContent(init?: ContentInit | null, doc?: Document | null
|
|
|
3283
3437
|
type PrivacyAnswer = SurfacePrivacyMode | 'unknown';
|
|
3284
3438
|
declare class VioFacade {
|
|
3285
3439
|
private apiInstance;
|
|
3440
|
+
/** Commerce clients by sponsor AND key: one sponsor may sell on several channels (one per campaign). */
|
|
3286
3441
|
private commerceClients;
|
|
3287
3442
|
private bootstrapPromise;
|
|
3288
3443
|
private cachedBootstrap;
|
|
3444
|
+
/** When the cached bootstrap arrived (ms epoch). */
|
|
3445
|
+
private bootstrapAt;
|
|
3446
|
+
/** A refresh of the bootstrap in flight (`refreshStaleBootstrap`). */
|
|
3447
|
+
private bootstrapRefresh;
|
|
3448
|
+
private bootstrapRefreshFailedAt;
|
|
3449
|
+
/** The `visibilitychange` listener is installed once per page. */
|
|
3450
|
+
private visibilityHooked;
|
|
3451
|
+
/**
|
|
3452
|
+
* Every selling block this page has seen, by `sponsorId:channelId` — so a
|
|
3453
|
+
* checkout opened on a channel keeps its key after a bootstrap refresh no
|
|
3454
|
+
* longer lists that channel (`sponsorCommerce(…, { retired: true })`).
|
|
3455
|
+
*/
|
|
3456
|
+
private seenChannels;
|
|
3289
3457
|
/** Last bootstrap failure — short backoff so cart mutations don't hammer a
|
|
3290
3458
|
* dead endpoint on every call. */
|
|
3291
3459
|
private bootstrapFailedAt;
|
|
@@ -3307,7 +3475,17 @@ declare class VioFacade {
|
|
|
3307
3475
|
/** Each cap warns once per page load. */
|
|
3308
3476
|
private warnedLocationCap;
|
|
3309
3477
|
private warnedDeclarationCap;
|
|
3310
|
-
|
|
3478
|
+
/**
|
|
3479
|
+
* One cart manager per connection (environment + key), each with its own
|
|
3480
|
+
* storage entry; `Vio.cart` is a stable front for the current one, so a
|
|
3481
|
+
* re-init with another key switches carts without the page re-subscribing.
|
|
3482
|
+
* A manager left behind keeps its carts (they come back if the page switches
|
|
3483
|
+
* back) and finishes its requests into ITS carts, never the new one's.
|
|
3484
|
+
*/
|
|
3485
|
+
private cartManagers;
|
|
3486
|
+
private cartScope;
|
|
3487
|
+
private cartFront;
|
|
3488
|
+
private readonly cartEvents;
|
|
3311
3489
|
private checkoutManager;
|
|
3312
3490
|
private analyticsManager;
|
|
3313
3491
|
/** What the surface answered of its privacy mode (`GET /v2/mobile/surface`) and when; `unknown` expires after a minute. */
|
|
@@ -3325,10 +3503,36 @@ declare class VioFacade {
|
|
|
3325
3503
|
* document.
|
|
3326
3504
|
*/
|
|
3327
3505
|
content(): ContentRef;
|
|
3506
|
+
/**
|
|
3507
|
+
* Page-wide options of every `<vio-product-detail>` (0.34). `layout` orders
|
|
3508
|
+
* the sections below the gallery — `{ id, revision, sections, experimentId?,
|
|
3509
|
+
* variantId? }`; `null` goes back to the default; a detail's own `layout`
|
|
3510
|
+
* wins. Open details re-render at once, later ones open with it. A key left
|
|
3511
|
+
* out of the call is left as it is. See README «Section order and layout
|
|
3512
|
+
* tracking».
|
|
3513
|
+
*/
|
|
3514
|
+
configureDetail(options?: {
|
|
3515
|
+
layout?: DetailLayout | null;
|
|
3516
|
+
}): void;
|
|
3517
|
+
/**
|
|
3518
|
+
* The layout a `<vio-product-detail>` without its own `layout` applies now:
|
|
3519
|
+
* the page's (`source: 'global'`) or the default. A detail's own is
|
|
3520
|
+
* `el.appliedLayout`. A copy; never throws.
|
|
3521
|
+
*/
|
|
3522
|
+
detailLayout(): AppliedDetailLayout;
|
|
3328
3523
|
get isInitialized(): boolean;
|
|
3329
3524
|
get config(): ResolvedConfig;
|
|
3330
3525
|
/** Multi-sponsor cart manager. Reactive — listen via addEventListener('change', ...). */
|
|
3331
3526
|
get cart(): CartManager;
|
|
3527
|
+
/** The cart manager of the page's connection now (created on first use). */
|
|
3528
|
+
private currentCartManager;
|
|
3529
|
+
/**
|
|
3530
|
+
* `Vio.cart`: every property and method is the current connection's
|
|
3531
|
+
* manager's; the listeners live on the front, so they survive a switch.
|
|
3532
|
+
*/
|
|
3533
|
+
private makeCartFront;
|
|
3534
|
+
/** After `init`: the carts are the new connection's. Says `change` when that switched them. */
|
|
3535
|
+
private switchCartScope;
|
|
3332
3536
|
/** Checkout flow manager. Subscribes to cart state via the CartManager; asks here for the order's attribution. */
|
|
3333
3537
|
get checkout(): CheckoutManager;
|
|
3334
3538
|
/**
|
|
@@ -3349,6 +3553,20 @@ declare class VioFacade {
|
|
|
3349
3553
|
*/
|
|
3350
3554
|
bootstrap(): Promise<BootstrapResponse>;
|
|
3351
3555
|
get bootstrapCache(): BootstrapResponse | null;
|
|
3556
|
+
/** A bootstrap becomes the page's: when it arrived, the channels it lists, and the tab-visible refresh. */
|
|
3557
|
+
private adoptBootstrap;
|
|
3558
|
+
/**
|
|
3559
|
+
* The bootstrap is cached for the page's life, but a tab can stay open for
|
|
3560
|
+
* days: when it becomes visible again and the cached one is older than
|
|
3561
|
+
* five minutes, it is fetched again (new campaigns, channels). The old one
|
|
3562
|
+
* stays until the new one arrives — and stays if the refresh fails. Carts
|
|
3563
|
+
* keep their lines; a cart whose channel the new bootstrap no longer lists
|
|
3564
|
+
* is moved to the current channel the next time it is used (CartManager),
|
|
3565
|
+
* and an open checkout keeps paying with the key of its own channel.
|
|
3566
|
+
*/
|
|
3567
|
+
private hookVisibility;
|
|
3568
|
+
/** Fetch the bootstrap again when the cached one is older than `maxAgeMs`; never throws, never clears the cache. */
|
|
3569
|
+
private refreshStaleBootstrap;
|
|
3352
3570
|
/**
|
|
3353
3571
|
* Who a sponsor is to a shopper — `{ id, name, logoUrl, avatarUrl }` — by
|
|
3354
3572
|
* the ONE rule every element uses (`sponsorIdentityFrom`): the live
|
|
@@ -3366,10 +3584,32 @@ declare class VioFacade {
|
|
|
3366
3584
|
checkoutId?: string | null;
|
|
3367
3585
|
}): SponsorIdentity | null;
|
|
3368
3586
|
/**
|
|
3369
|
-
*
|
|
3370
|
-
*
|
|
3371
|
-
|
|
3372
|
-
|
|
3587
|
+
* The block a sponsor sells with — its `commerce.apiKey` and `channelId` —
|
|
3588
|
+
* by the rule one article = one campaign = one channel = one sponsor (see
|
|
3589
|
+
* `sponsorCommerceIn`): `ctx.channelId` → that channel's block only (a cart
|
|
3590
|
+
* created on a channel is only called with its key); else the campaign in
|
|
3591
|
+
* context — `ctx.campaignId` candidates (the click's, the element's
|
|
3592
|
+
* `vio-campaign`, an ancestor's `data-vio-campaign`), then
|
|
3593
|
+
* `Vio.init({ campaignId })` — when the sponsor takes part in it; else the
|
|
3594
|
+
* sponsor's first block that sells (the behaviour before). `campaignId:
|
|
3595
|
+
* null` means no campaign at all, not even `Vio.init`'s. `retired: true`
|
|
3596
|
+
* also answers a channel the current bootstrap no longer lists with the
|
|
3597
|
+
* block this page saw for it (an open checkout after a bootstrap refresh).
|
|
3598
|
+
* Blocks with `commerce: null` are skipped. `null` when none; never throws.
|
|
3599
|
+
*/
|
|
3600
|
+
sponsorCommerce(sponsorId: number | string | null | undefined, ctx?: SponsorCommerceContext & {
|
|
3601
|
+
retired?: boolean;
|
|
3602
|
+
}): SellingSponsor | null;
|
|
3603
|
+
/**
|
|
3604
|
+
* Get a CommerceClient scoped to a sponsor (via bootstrap) — on the
|
|
3605
|
+
* channel of the campaign in context (`ctx.campaignId`, the element's
|
|
3606
|
+
* candidates first; see `sponsorCommerce`) or of `ctx.channelId`. Without
|
|
3607
|
+
* `ctx`, the page's campaign (`Vio.init`) when the sponsor takes part in
|
|
3608
|
+
* it, else the sponsor's first selling block, as before. Clients are kept
|
|
3609
|
+
* per sponsor and key. Throws if bootstrap hasn't been called or nothing of
|
|
3610
|
+
* the sponsor sells there.
|
|
3611
|
+
*/
|
|
3612
|
+
commerceFor(sponsorId: number, ctx?: SponsorCommerceContext): CommerceClient;
|
|
3373
3613
|
/** Get a CommerceClient using an explicit commerce apiKey (skip bootstrap). */
|
|
3374
3614
|
commerceWithKey(commerceApiKey: string): CommerceClient;
|
|
3375
3615
|
/**
|
|
@@ -3479,9 +3719,10 @@ declare class VioFacade {
|
|
|
3479
3719
|
* The attribution of the order a sponsor's cart is about to become
|
|
3480
3720
|
* (ADR-0035 phase B) — what `CreateCheckout` / `UpdateCheckout` send as
|
|
3481
3721
|
* `attribution` and shopcart writes on the order: the surface (its SDK
|
|
3482
|
-
* key), the
|
|
3483
|
-
*
|
|
3484
|
-
*
|
|
3722
|
+
* key), the campaign of the order — always one the cart's sponsor takes part
|
|
3723
|
+
* in (`orderCampaign`: the cart lines' own campaign, else the page's;
|
|
3724
|
+
* without one, the campaign that explains most units of the cart under the
|
|
3725
|
+
* same rule `purchase` is split by — `cartSlices`) and, on a surface KNOWN to be `standard`
|
|
3485
3726
|
* (`privacyModeNow`), the page (`content()`'s url as origin + path, and
|
|
3486
3727
|
* title) and where the session came in: the landing the session REMEMBERS
|
|
3487
3728
|
* (`storedLanding`, else the one analytics resolved on this page) — never
|
|
@@ -3490,6 +3731,17 @@ declare class VioFacade {
|
|
|
3490
3731
|
* limits. `undefined` when there is nothing to say; never throws.
|
|
3491
3732
|
*/
|
|
3492
3733
|
orderAttribution(sponsorId?: number): CheckoutAttributionWire | undefined;
|
|
3734
|
+
/**
|
|
3735
|
+
* The campaign an order of `sponsorId` is credited to — one article = one
|
|
3736
|
+
* campaign = one sponsor, so it is always one the sponsor takes part in:
|
|
3737
|
+
* the campaign the cart's own lines were added from (their origins; the one
|
|
3738
|
+
* that explains most units), else the page's — the elements' campaigns on
|
|
3739
|
+
* the page (`vio-campaign` / `data-vio-campaign`, in document order), then
|
|
3740
|
+
* `Vio.init({ campaignId })` — the first one active with that sponsor.
|
|
3741
|
+
* `undefined` when neither says one (the slices then decide). Without a
|
|
3742
|
+
* sponsor, the page's campaign as before.
|
|
3743
|
+
*/
|
|
3744
|
+
private orderCampaign;
|
|
3493
3745
|
/** The landing the session remembers: what the first page stored, else what analytics resolved on this page load (consent pending); null otherwise. */
|
|
3494
3746
|
private rememberedLanding;
|
|
3495
3747
|
/**
|
|
@@ -3586,7 +3838,7 @@ declare function writeInternal(internal: boolean, storage?: StorageLike | null |
|
|
|
3586
3838
|
*
|
|
3587
3839
|
* RELEASE CHECKLIST: bump together with package.json (see CONTRIBUTING).
|
|
3588
3840
|
*/
|
|
3589
|
-
declare const SDK_VERSION = "0.
|
|
3841
|
+
declare const SDK_VERSION = "0.35.0";
|
|
3590
3842
|
|
|
3591
3843
|
/**
|
|
3592
3844
|
* Vipps MobilePay's own button, the way the design guidelines ask for it.
|
|
@@ -3615,4 +3867,4 @@ declare function vippsButtonAttributes(verb?: 'buy' | 'pay' | 'express' | 'conti
|
|
|
3615
3867
|
language?: string;
|
|
3616
3868
|
}): Record<string, string>;
|
|
3617
3869
|
|
|
3618
|
-
export { ADD_ITEM_MUTATION, type AddManualOptions, type AddProductOptions, type AnalyticsCommerce, type AnalyticsContext, type AnalyticsEventName, type AnalyticsItemInput, AnalyticsManager, type AnalyticsStartOptions, type ApplePayConfig, type ApplePayResult, type Attribution, BUYER_REF_MAX_LENGTH, type BootstrapCampaign, type BootstrapCampaignEntry, type BootstrapCampaignStatus, type BootstrapResponse, type BootstrapSlot, CHECKOUT_ATTRIBUTION_CAPS, CHECKOUT_SPONSOR_STORAGE_KEY, CLIENT_LANDING_URL_MAX_LENGTH, CONTENT_URL_MAX_LENGTH, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_CHECKOUT_WITH_ATTRIBUTION_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, type CampaignHint, type CartChangeDetail, type CartLineItem, type CartLineOrigin, CartManager, type CartOrigin, type CartQueryOptions, type CartSlice, type CartUpdatedDetail, type CheckoutAddress, type CheckoutAttributionInput, type CheckoutAttributionWire, type CheckoutChangeDetail, CheckoutManager, type CheckoutManagerDeps, type CheckoutOpenDetail, type CheckoutReference, type CheckoutSponsor, type CheckoutState, type ClientContext, CommerceClient, Configuration, type ContentRef, type CreatePaymentVippsResponse, type CreatePaymentVippsVariables, DELETE_ITEM_MUTATION, type EntryContextWire, type Environment, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, GRAPHQL_INT_MAX, type GatewayFeature, type GetVippsStatusVariables, INTERNAL_KEY, INTERNAL_PARAM, type ImageSize, LINE_ORIGIN_CAPS, type Landing, type LineOriginWire, type LineOriginWireOptions, type ManifestLocation, type ManifestRequest, type ManifestResult, type OrderReference, type OriginPage, type PaymentCompleteDetail, type PaymentMethod, type PaymentSelectDetail, type PaymentSuccessDetail, type PaymentSuccessResult, type PlacementComponent, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductPrice, type ProductVariant, type PurchaseIds, type RegisterSlotOptions, type ResolvedConfig, SDK_VERSION, type SlotInput, type SlotKind, type Sponsor, type SponsorCartState, type SponsorCommerceBlock, type SponsorIdentity, type SurfacePrivacyMode, type SurfaceResponse, type TrackOptions, UPDATE_CHECKOUT_MUTATION, UPDATE_CHECKOUT_WITH_ATTRIBUTION_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_ITEM_WITH_ORIGIN_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, VIPPS_BUTTON_SCRIPT, VIPPS_BUTTON_TAG, Vio, VioApi, VioApiError, type VioConfig, type VioItem, type VioPlatform, type VippsPaymentState, type VippsStatusResult, activeCampaignEntry, addItem, autoSlotDisplayName, autoSlotId, buyerRefOf, campaignCandidates, capContentUrl, cartSlicesFrom, checkApplePayAvailability, checkoutAttributionOf, componentKindOf, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, dominantCampaignOf, ensureVippsButton, entryContextOf, executeCartGraphQL, formatPrice, gatewayHas, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCheckoutReference, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, isUnknownFeatureError, isUnknownTokenError, landingUrl, lineOriginWire, lineOrigins, normalizeBuyerRef, normalizeOrigin, normalizeScope, normalizeSlotKind, originAndPath, primaryImageUrl, purchaseFromPaymentSuccess, purchaseIdsOf, readInternal, resetGatewayFeatures, resolveCampaignId, resolveClientContext, resolveContent, resolveInternal, resolveLanding, resolveSlotCampaign, sameOrigin, showApplePaySheet, sponsorCampaignEntry, sponsorIdentityFrom, storedLanding, toCampaignId, updateCheckout, updateItem, updateShippingsBySupplier, vippsButtonAttributes, withGatewayFeature, writeInternal };
|
|
3870
|
+
export { ADD_ITEM_MUTATION, type AddManualOptions, type AddProductOptions, type AnalyticsCommerce, type AnalyticsContext, type AnalyticsEventName, type AnalyticsItemInput, AnalyticsManager, type AnalyticsStartOptions, type ApplePayConfig, type ApplePayResult, AppliedDetailLayout, type Attribution, BUYER_REF_MAX_LENGTH, type BootstrapCampaign, type BootstrapCampaignEntry, type BootstrapCampaignStatus, type BootstrapResponse, type BootstrapSlot, CHECKOUT_ATTRIBUTION_CAPS, CHECKOUT_SPONSOR_STORAGE_KEY, CLIENT_LANDING_URL_MAX_LENGTH, CONTENT_URL_MAX_LENGTH, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_CHECKOUT_WITH_ATTRIBUTION_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, type CampaignHint, type CartChangeDetail, type CartLineItem, type CartLineOrigin, CartManager, type CartOrigin, type CartQueryOptions, type CartSlice, type CartUpdatedDetail, type CheckoutAddress, type CheckoutAttributionInput, type CheckoutAttributionWire, type CheckoutChangeDetail, CheckoutManager, type CheckoutManagerDeps, type CheckoutOpenDetail, type CheckoutReference, type CheckoutSponsor, type CheckoutState, type ClientContext, CommerceClient, Configuration, type ContentRef, type CreatePaymentVippsResponse, type CreatePaymentVippsVariables, DELETE_ITEM_MUTATION, DetailLayout, type EntryContextWire, type Environment, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, GRAPHQL_INT_MAX, type GatewayFeature, type GetVippsStatusVariables, INTERNAL_KEY, INTERNAL_PARAM, type ImageSize, LINE_ORIGIN_CAPS, type Landing, type LineOriginWire, type LineOriginWireOptions, type ManifestLocation, type ManifestRequest, type ManifestResult, type OrderReference, type OriginPage, type PaymentCompleteDetail, type PaymentMethod, type PaymentSelectDetail, type PaymentSuccessDetail, type PaymentSuccessResult, type PlacementComponent, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductPrice, type ProductVariant, type PurchaseIds, type RegisterSlotOptions, type ResolvedConfig, SDK_VERSION, type SlotInput, type SlotKind, type Sponsor, type SponsorCartState, type SponsorCommerceBlock, type SponsorIdentity, type SurfacePrivacyMode, type SurfaceResponse, type TrackOptions, UPDATE_CHECKOUT_MUTATION, UPDATE_CHECKOUT_WITH_ATTRIBUTION_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_ITEM_WITH_ORIGIN_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, VIPPS_BUTTON_SCRIPT, VIPPS_BUTTON_TAG, Vio, VioApi, VioApiError, type VioConfig, type VioItem, type VioPlatform, type VippsPaymentState, type VippsStatusResult, activeCampaignEntry, addItem, autoSlotDisplayName, autoSlotId, buyerRefOf, campaignCandidates, capContentUrl, cartSlicesFrom, checkApplePayAvailability, checkoutAttributionOf, componentKindOf, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, dominantCampaignOf, ensureVippsButton, entryContextOf, executeCartGraphQL, formatPrice, gatewayHas, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCheckoutReference, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, isUnknownFeatureError, isUnknownTokenError, landingUrl, lineOriginWire, lineOrigins, normalizeBuyerRef, normalizeOrigin, normalizeScope, normalizeSlotKind, originAndPath, primaryImageUrl, purchaseFromPaymentSuccess, purchaseIdsOf, readInternal, resetGatewayFeatures, resolveCampaignId, resolveClientContext, resolveContent, resolveInternal, resolveLanding, resolveSlotCampaign, sameOrigin, showApplePaySheet, sponsorCampaignEntry, sponsorIdentityFrom, storedLanding, toCampaignId, updateCheckout, updateItem, updateShippingsBySupplier, vippsButtonAttributes, withGatewayFeature, writeInternal };
|