@vio-live/web-sdk 0.5.1 → 0.7.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/dist/{chunk-7Q4MJ5NQ.js → chunk-4ZEN4J7I.js} +230 -10
- package/dist/chunk-4ZEN4J7I.js.map +1 -0
- package/dist/{chunk-LRXVUOEG.js → chunk-GPMDZSC2.js} +246 -6
- package/dist/{chunk-LRXVUOEG.js.map → chunk-GPMDZSC2.js.map} +1 -1
- package/dist/core/index.d.ts +207 -100
- package/dist/core/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +3 -3
- package/dist/{tokens-TIH4RkPl.d.ts → tokens-CCZuuTN6.d.ts} +12 -0
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-7Q4MJ5NQ.js.map +0 -1
package/dist/core/index.d.ts
CHANGED
|
@@ -640,6 +640,168 @@ declare global {
|
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
642
|
|
|
643
|
+
/**
|
|
644
|
+
* Vipps MobilePay Payment Adapter — GraphQL Integration & Types.
|
|
645
|
+
*
|
|
646
|
+
* Vipps payment integration uses 2 GraphQL operations:
|
|
647
|
+
*
|
|
648
|
+
* 1. `CreatePaymentVipps` mutation:
|
|
649
|
+
* Initiates a Vipps payment session for a checkout and returns `payment_url`.
|
|
650
|
+
*
|
|
651
|
+
* 2. `GetVippsStatus` query:
|
|
652
|
+
* Queries Vipps payment state directly for a checkout (`state`).
|
|
653
|
+
*/
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* GraphQL mutation to create a Vipps payment session.
|
|
657
|
+
*/
|
|
658
|
+
declare const CREATE_PAYMENT_VIPPS_MUTATION = "\nmutation CreatePaymentVipps($checkoutId: String!, $email: String!, $returnUrl: String!) {\n Payment {\n CreatePaymentVipps(checkout_id: $checkoutId, email: $email, return_url: $returnUrl) {\n payment_url\n }\n }\n}\n";
|
|
659
|
+
/**
|
|
660
|
+
* GraphQL query to fetch current Vipps payment status.
|
|
661
|
+
*/
|
|
662
|
+
declare const GET_VIPPS_STATUS_QUERY = "\nquery GetVippsStatus($checkoutId: String!) {\n Payment {\n GetVippsStatus(checkout_id: $checkoutId) {\n state\n }\n }\n}\n";
|
|
663
|
+
interface CreatePaymentVippsVariables extends Record<string, unknown> {
|
|
664
|
+
checkoutId: string;
|
|
665
|
+
email: string;
|
|
666
|
+
returnUrl: string;
|
|
667
|
+
}
|
|
668
|
+
interface CreatePaymentVippsResponse {
|
|
669
|
+
payment_url: string;
|
|
670
|
+
}
|
|
671
|
+
interface GetVippsStatusVariables extends Record<string, unknown> {
|
|
672
|
+
checkoutId: string;
|
|
673
|
+
}
|
|
674
|
+
interface VippsStatusResult {
|
|
675
|
+
state: string;
|
|
676
|
+
}
|
|
677
|
+
type VippsPaymentState = 'CREATED' | 'INITIATED' | 'AUTHORIZED' | 'TERMINATED' | 'EXPIRED' | string;
|
|
678
|
+
/**
|
|
679
|
+
* Executes the `CreatePaymentVipps` GraphQL mutation.
|
|
680
|
+
*/
|
|
681
|
+
declare function createPaymentVipps(variables: CreatePaymentVippsVariables | Record<string, unknown>, options?: CartQueryOptions): Promise<CreatePaymentVippsResponse | null>;
|
|
682
|
+
/**
|
|
683
|
+
* Executes the `GetVippsStatus` GraphQL query.
|
|
684
|
+
*/
|
|
685
|
+
declare function getVippsStatus(variables: GetVippsStatusVariables | Record<string, unknown>, options?: CartQueryOptions): Promise<VippsStatusResult | null>;
|
|
686
|
+
|
|
687
|
+
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";
|
|
688
|
+
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";
|
|
689
|
+
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";
|
|
690
|
+
declare const UPDATE_ITEM_MUTATION = "\nmutation UpdateItem($cartId: String!, $cartItemId: String!, $shippingId: String, $qty: Int) {\n Cart {\n UpdateItem(cart_id: $cartId, cart_item_id: $cartItemId, shipping_id: $shippingId, qty: $qty) {\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";
|
|
691
|
+
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";
|
|
692
|
+
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";
|
|
693
|
+
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";
|
|
694
|
+
declare const CREATE_CHECKOUT_MUTATION = "\nmutation CreateCheckout($cartId: String!) {\n Checkout {\n CreateCheckout(cart_id: $cartId) {\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 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";
|
|
695
|
+
declare const UPDATE_CHECKOUT_MUTATION = "\nmutation UpdateCheckout($checkoutId: String!, $status: String, $successUrl: String, $email: String, $cancelUrl: String, $paymentMethod: String, $shippingAddress: AddressArgs, $billingAddress: AddressArgs, $buyerAcceptsPurchaseConditions: Boolean, $buyerAcceptsTermsConditions: Boolean) {\n Checkout {\n UpdateCheckout(checkout_id: $checkoutId, status: $status, success_url: $successUrl, email: $email, cancel_url: $cancelUrl, payment_method: $paymentMethod, shipping_address: $shippingAddress, billing_address: $billingAddress, buyer_accepts_purchase_conditions: $buyerAcceptsPurchaseConditions, buyer_accepts_terms_conditions: $buyerAcceptsTermsConditions) {\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 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";
|
|
696
|
+
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 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";
|
|
697
|
+
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";
|
|
698
|
+
/** Transport options for a cart/checkout GraphQL call. */
|
|
699
|
+
interface CartQueryOptions {
|
|
700
|
+
endpoint?: string;
|
|
701
|
+
apiKey?: string;
|
|
702
|
+
/** Sponsor commerce key — goes in the Authorization header. */
|
|
703
|
+
commerceKey?: string;
|
|
704
|
+
/** True when the commerce key came from a resolved sponsor (bootstrap).
|
|
705
|
+
* False = we fell back to the host apiKey — writes like CreateCart should
|
|
706
|
+
* NOT proceed with the wrong key (the cart would be orphaned). */
|
|
707
|
+
sponsorResolved?: boolean;
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Resolve endpoint + keys for cart GraphQL calls. Awaits Vio.bootstrap() once
|
|
711
|
+
* if it hasn't run yet (the sponsor commerce keys come from bootstrap), then
|
|
712
|
+
* uses the sponsor's commerce apiKey (via the Vio facade on globalThis,
|
|
713
|
+
* avoiding an import cycle); falls back to the host apiKey.
|
|
714
|
+
*/
|
|
715
|
+
declare function getCartGraphQLOptions(sponsorId?: number): Promise<CartQueryOptions>;
|
|
716
|
+
/** Stable per-browser customer session id (backend CreateCart requires one). */
|
|
717
|
+
declare function getCustomerSessionId(): string;
|
|
718
|
+
interface GraphQLEnvelope {
|
|
719
|
+
data?: Record<string, Record<string, unknown>>;
|
|
720
|
+
errors?: Array<{
|
|
721
|
+
message?: string;
|
|
722
|
+
}>;
|
|
723
|
+
}
|
|
724
|
+
/** Execute a GraphQL query/mutation against the configured commerce endpoint.
|
|
725
|
+
* Callers that skip `getCartGraphQLOptions()` (or pass a bare sponsorId) get
|
|
726
|
+
* it resolved here instead of silently sending an unauthenticated request. */
|
|
727
|
+
declare function executeCartGraphQL(query: string, variables: Record<string, unknown>, options?: CartQueryOptions | number | undefined): Promise<GraphQLEnvelope>;
|
|
728
|
+
declare function createCart(customerSessionId: string, currency: string, shippingCountry?: string | null, options?: CartQueryOptions): Promise<any>;
|
|
729
|
+
declare function addItem(cartId: string, lineItems: unknown[], options?: CartQueryOptions): Promise<any>;
|
|
730
|
+
declare function deleteItem(cartId: string, cartItemId: string, options?: CartQueryOptions): Promise<any>;
|
|
731
|
+
declare function updateItem(cartId: string, cartItemId: string, shippingId?: string | null, qty?: number | null, options?: CartQueryOptions): Promise<any>;
|
|
732
|
+
declare function getCart(cartId: string, options?: CartQueryOptions): Promise<any>;
|
|
733
|
+
declare function getLineItemsBySupplier(cartId: string, options?: CartQueryOptions): Promise<any>;
|
|
734
|
+
declare function updateShippingsBySupplier(cartId: string, data: unknown[], options?: CartQueryOptions): Promise<any>;
|
|
735
|
+
declare function createCheckout(cartId: string, options?: CartQueryOptions): Promise<any>;
|
|
736
|
+
declare function updateCheckout(variables: Record<string, unknown>, options?: CartQueryOptions): Promise<any>;
|
|
737
|
+
declare function getCheckout(checkoutId: string, options?: CartQueryOptions): Promise<any>;
|
|
738
|
+
declare function getAvailablePaymentMethods(options?: CartQueryOptions): Promise<any>;
|
|
739
|
+
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";
|
|
740
|
+
declare function createPaymentStripe(variables: Record<string, unknown>, options?: CartQueryOptions): Promise<any>;
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* Kustom (former Klarna Checkout) — embedded KCO v3 checkout.
|
|
744
|
+
*
|
|
745
|
+
* Kustom kept the Klarna Checkout dialect on its own hosts, so the flow is
|
|
746
|
+
* the classic KCO embed:
|
|
747
|
+
*
|
|
748
|
+
* 1. Vio Commerce creates the order (`Payment { CreatePaymentKustom }`,
|
|
749
|
+
* authed with the sponsor's commerce API key; the seller's own
|
|
750
|
+
* kco_*_api_* key lives server-side, per seller, never here).
|
|
751
|
+
* 2. The response's `html_snippet` is injected into a container — it
|
|
752
|
+
* renders Kustom's iframe, which collects address, shipping AND payment
|
|
753
|
+
* by itself (the widget does everything; no Vio address form).
|
|
754
|
+
* 3. On completion Kustom redirects to the confirmation URL
|
|
755
|
+
* (`?order_id=…&payment_processor=KUSTOM`), where the SDK re-reads the
|
|
756
|
+
* order (`Payment { GetKustomOrder }`) and renders its confirmation
|
|
757
|
+
* snippet — KCO's own receipt.
|
|
758
|
+
*
|
|
759
|
+
* The Commerce order itself is created server-side by Kustom's push webhook
|
|
760
|
+
* (shopcart /checkout/payment/kustom/ok) — the browser never confirms money.
|
|
761
|
+
*/
|
|
762
|
+
|
|
763
|
+
/** KCO order fields the SDK consumes (the full order is much larger). */
|
|
764
|
+
interface KustomOrder {
|
|
765
|
+
order_id: string;
|
|
766
|
+
status: string;
|
|
767
|
+
html_snippet: string;
|
|
768
|
+
purchase_country?: string;
|
|
769
|
+
purchase_currency?: string;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Qliro Checkout — embedded checkout via Vio Commerce.
|
|
774
|
+
*
|
|
775
|
+
* Same embed philosophy as Kustom (the widget collects address, shipping
|
|
776
|
+
* AND payment), different provider API underneath — shopcart normalizes
|
|
777
|
+
* Qliro's Merchant API (OrderId / CustomerCheckoutStatus / OrderHtmlSnippet)
|
|
778
|
+
* to the { order_id, status, html_snippet } shape both flows share:
|
|
779
|
+
*
|
|
780
|
+
* 1. `Payment { CreatePaymentQliro }` creates the order and returns the
|
|
781
|
+
* snippet (sponsor-key authed; the seller's MerchantApiKey/Secret live
|
|
782
|
+
* server-side, per seller, never here).
|
|
783
|
+
* 2. The snippet is injected (script-executing embed, shared with Kustom).
|
|
784
|
+
* 3. On completion Qliro redirects to the confirmation URL
|
|
785
|
+
* (`?checkout_id=…&payment_processor=QLIRO`); the SDK re-reads the
|
|
786
|
+
* order via `Payment { GetQliroOrder(checkout_id) }` — Qliro
|
|
787
|
+
* correlates by the OWNING CHECKOUT, not the order id — and renders
|
|
788
|
+
* the snippet again, which shows Qliro's own receipt.
|
|
789
|
+
*
|
|
790
|
+
* The Commerce order is created server-side by Qliro's push webhook
|
|
791
|
+
* (shopcart /checkout/payment/qliro/ok) — the browser never confirms money.
|
|
792
|
+
*/
|
|
793
|
+
|
|
794
|
+
/** Normalized Qliro order (shopcart maps the PascalCase Merchant API). */
|
|
795
|
+
interface QliroOrder {
|
|
796
|
+
order_id: string;
|
|
797
|
+
/** Qliro CustomerCheckoutStatus: InProcess | Completed | OnHold | Refused. */
|
|
798
|
+
status: string;
|
|
799
|
+
html_snippet: string;
|
|
800
|
+
purchase_country?: string;
|
|
801
|
+
purchase_currency?: string;
|
|
802
|
+
total_price?: number;
|
|
803
|
+
}
|
|
804
|
+
|
|
643
805
|
/**
|
|
644
806
|
* Checkout types — multi-sponsor compatible.
|
|
645
807
|
*
|
|
@@ -647,7 +809,7 @@ declare global {
|
|
|
647
809
|
* merchant, same as iOS multi-sponsor model). Multiple sponsors → multiple
|
|
648
810
|
* sequential checkouts.
|
|
649
811
|
*/
|
|
650
|
-
type PaymentMethod = 'apple-pay' | 'klarna' | 'vipps' | 'card' | 'stripe';
|
|
812
|
+
type PaymentMethod = 'apple-pay' | 'klarna' | 'vipps' | 'card' | 'stripe' | 'kustom' | 'qliro';
|
|
651
813
|
interface CheckoutAddress {
|
|
652
814
|
firstName: string;
|
|
653
815
|
lastName: string;
|
|
@@ -809,8 +971,35 @@ declare class CheckoutManager extends EventTarget {
|
|
|
809
971
|
getVippsStatus(checkoutId: string, sponsorId?: number): Promise<{
|
|
810
972
|
state?: string;
|
|
811
973
|
} | null>;
|
|
974
|
+
/**
|
|
975
|
+
* Kustom (former Klarna Checkout) — create the KCO order via Vio Commerce
|
|
976
|
+
* and render its html_snippet into `container`. The widget collects
|
|
977
|
+
* address, shipping and payment by itself; the SDK renders nothing else.
|
|
978
|
+
*/
|
|
979
|
+
mountKustomCheckout(container: HTMLElement, sponsorId?: number): Promise<KustomOrder>;
|
|
980
|
+
/** Re-read a Kustom order — used on the confirmation return trip. */
|
|
981
|
+
getKustomOrder(orderId: string, sponsorId?: number): Promise<KustomOrder | null>;
|
|
982
|
+
/** Render a Kustom html_snippet (e.g. the confirmation receipt) into a container. */
|
|
983
|
+
renderKustomSnippet(container: HTMLElement, htmlSnippet: string): void;
|
|
984
|
+
/**
|
|
985
|
+
* Qliro Checkout — create the order via Vio Commerce and render its
|
|
986
|
+
* html_snippet into `container` (widget-does-everything, like Kustom).
|
|
987
|
+
*/
|
|
988
|
+
mountQliroCheckout(container: HTMLElement, sponsorId?: number): Promise<QliroOrder>;
|
|
989
|
+
/** Re-read the Qliro order owned by a checkout — the confirmation trip. */
|
|
990
|
+
getQliroOrder(checkoutId: string, sponsorId?: number): Promise<QliroOrder | null>;
|
|
812
991
|
setAddress(address: CheckoutAddress): void;
|
|
813
992
|
selectPaymentMethod(method: PaymentMethod): void;
|
|
993
|
+
/**
|
|
994
|
+
* The Stripe publishable key for a sponsor, taken from its own commerce
|
|
995
|
+
* channel (`GetAvailablePaymentMethods` → Stripe → config.publishableKey).
|
|
996
|
+
*
|
|
997
|
+
* The channel is the right source: the key belongs to the brand's Stripe
|
|
998
|
+
* account, so two brands on one page each get theirs, and a host never has
|
|
999
|
+
* to configure it. `Vio.init({ stripePublishableKey })` still wins when set,
|
|
1000
|
+
* which keeps existing integrations working and allows an override.
|
|
1001
|
+
*/
|
|
1002
|
+
private resolveStripePublishableKey;
|
|
814
1003
|
/**
|
|
815
1004
|
* Returns true if Apple Pay can be shown on this device + Stripe config.
|
|
816
1005
|
* Result is memoised — call `clearApplePayCache()` if config changes.
|
|
@@ -978,6 +1167,13 @@ interface AnalyticsContext {
|
|
|
978
1167
|
sponsorId?: number;
|
|
979
1168
|
activationId?: number;
|
|
980
1169
|
contentUrl?: string;
|
|
1170
|
+
/**
|
|
1171
|
+
* The host's own id for the piece of content the component sits in — an
|
|
1172
|
+
* article id in a CMS, a page id in a site builder. Carried verbatim so the
|
|
1173
|
+
* host can join Vio's funnel back onto its own per-article reporting
|
|
1174
|
+
* (revenue stops being an estimate). Left alone by the SDK.
|
|
1175
|
+
*/
|
|
1176
|
+
contentId?: string | number;
|
|
981
1177
|
/** Human-readable content snapshot; auto-filled from document.title. */
|
|
982
1178
|
contentTitle?: string;
|
|
983
1179
|
variant?: string;
|
|
@@ -1014,6 +1210,14 @@ interface AnalyticsStartOptions {
|
|
|
1014
1210
|
* transport engine and call track() themselves.
|
|
1015
1211
|
*/
|
|
1016
1212
|
autoTrack?: boolean;
|
|
1213
|
+
/**
|
|
1214
|
+
* Adopt the host's session id instead of minting one. A host that already
|
|
1215
|
+
* tracks its readers (its own impressions, dwell, clicks) needs Vio's
|
|
1216
|
+
* purchases to land in the SAME session, or the two datasets cannot be
|
|
1217
|
+
* joined. Pass the id the host already stores; omit it and the SDK keeps
|
|
1218
|
+
* its own rotating session.
|
|
1219
|
+
*/
|
|
1220
|
+
sessionId?: string;
|
|
1017
1221
|
/** Send to the Vio collector. Default true. */
|
|
1018
1222
|
collector?: boolean;
|
|
1019
1223
|
/** Also push GA4 e-commerce events to window.dataLayer (publisher feature). */
|
|
@@ -1030,6 +1234,8 @@ declare class AnalyticsManager extends EventTarget {
|
|
|
1030
1234
|
private retryNotBefore;
|
|
1031
1235
|
private externalUserId;
|
|
1032
1236
|
private sessionId;
|
|
1237
|
+
/** Set via start({ sessionId }) — the host owns the session, we follow. */
|
|
1238
|
+
private externalSessionId;
|
|
1033
1239
|
private sessionStartedAt;
|
|
1034
1240
|
/** Impression once-per-(session, component) guard; reset on session rotation. */
|
|
1035
1241
|
private impressedComponents;
|
|
@@ -1123,105 +1329,6 @@ declare class VioFacade {
|
|
|
1123
1329
|
}
|
|
1124
1330
|
declare const Vio: VioFacade;
|
|
1125
1331
|
|
|
1126
|
-
/**
|
|
1127
|
-
* Vipps MobilePay Payment Adapter — GraphQL Integration & Types.
|
|
1128
|
-
*
|
|
1129
|
-
* Vipps payment integration uses 2 GraphQL operations:
|
|
1130
|
-
*
|
|
1131
|
-
* 1. `CreatePaymentVipps` mutation:
|
|
1132
|
-
* Initiates a Vipps payment session for a checkout and returns `payment_url`.
|
|
1133
|
-
*
|
|
1134
|
-
* 2. `GetVippsStatus` query:
|
|
1135
|
-
* Queries Vipps payment state directly for a checkout (`state`).
|
|
1136
|
-
*/
|
|
1137
|
-
|
|
1138
|
-
/**
|
|
1139
|
-
* GraphQL mutation to create a Vipps payment session.
|
|
1140
|
-
*/
|
|
1141
|
-
declare const CREATE_PAYMENT_VIPPS_MUTATION = "\nmutation CreatePaymentVipps($checkoutId: String!, $email: String!, $returnUrl: String!) {\n Payment {\n CreatePaymentVipps(checkout_id: $checkoutId, email: $email, return_url: $returnUrl) {\n payment_url\n }\n }\n}\n";
|
|
1142
|
-
/**
|
|
1143
|
-
* GraphQL query to fetch current Vipps payment status.
|
|
1144
|
-
*/
|
|
1145
|
-
declare const GET_VIPPS_STATUS_QUERY = "\nquery GetVippsStatus($checkoutId: String!) {\n Payment {\n GetVippsStatus(checkout_id: $checkoutId) {\n state\n }\n }\n}\n";
|
|
1146
|
-
interface CreatePaymentVippsVariables extends Record<string, unknown> {
|
|
1147
|
-
checkoutId: string;
|
|
1148
|
-
email: string;
|
|
1149
|
-
returnUrl: string;
|
|
1150
|
-
}
|
|
1151
|
-
interface CreatePaymentVippsResponse {
|
|
1152
|
-
payment_url: string;
|
|
1153
|
-
}
|
|
1154
|
-
interface GetVippsStatusVariables extends Record<string, unknown> {
|
|
1155
|
-
checkoutId: string;
|
|
1156
|
-
}
|
|
1157
|
-
interface VippsStatusResult {
|
|
1158
|
-
state: string;
|
|
1159
|
-
}
|
|
1160
|
-
type VippsPaymentState = 'CREATED' | 'INITIATED' | 'AUTHORIZED' | 'TERMINATED' | 'EXPIRED' | string;
|
|
1161
|
-
/**
|
|
1162
|
-
* Executes the `CreatePaymentVipps` GraphQL mutation.
|
|
1163
|
-
*/
|
|
1164
|
-
declare function createPaymentVipps(variables: CreatePaymentVippsVariables | Record<string, unknown>, options?: CartQueryOptions): Promise<CreatePaymentVippsResponse | null>;
|
|
1165
|
-
/**
|
|
1166
|
-
* Executes the `GetVippsStatus` GraphQL query.
|
|
1167
|
-
*/
|
|
1168
|
-
declare function getVippsStatus(variables: GetVippsStatusVariables | Record<string, unknown>, options?: CartQueryOptions): Promise<VippsStatusResult | null>;
|
|
1169
|
-
|
|
1170
|
-
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";
|
|
1171
|
-
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";
|
|
1172
|
-
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";
|
|
1173
|
-
declare const UPDATE_ITEM_MUTATION = "\nmutation UpdateItem($cartId: String!, $cartItemId: String!, $shippingId: String, $qty: Int) {\n Cart {\n UpdateItem(cart_id: $cartId, cart_item_id: $cartItemId, shipping_id: $shippingId, qty: $qty) {\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";
|
|
1174
|
-
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";
|
|
1175
|
-
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";
|
|
1176
|
-
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";
|
|
1177
|
-
declare const CREATE_CHECKOUT_MUTATION = "\nmutation CreateCheckout($cartId: String!) {\n Checkout {\n CreateCheckout(cart_id: $cartId) {\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 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";
|
|
1178
|
-
declare const UPDATE_CHECKOUT_MUTATION = "\nmutation UpdateCheckout($checkoutId: String!, $status: String, $successUrl: String, $email: String, $cancelUrl: String, $paymentMethod: String, $shippingAddress: AddressArgs, $billingAddress: AddressArgs, $buyerAcceptsPurchaseConditions: Boolean, $buyerAcceptsTermsConditions: Boolean) {\n Checkout {\n UpdateCheckout(checkout_id: $checkoutId, status: $status, success_url: $successUrl, email: $email, cancel_url: $cancelUrl, payment_method: $paymentMethod, shipping_address: $shippingAddress, billing_address: $billingAddress, buyer_accepts_purchase_conditions: $buyerAcceptsPurchaseConditions, buyer_accepts_terms_conditions: $buyerAcceptsTermsConditions) {\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 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";
|
|
1179
|
-
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 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";
|
|
1180
|
-
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";
|
|
1181
|
-
/** Transport options for a cart/checkout GraphQL call. */
|
|
1182
|
-
interface CartQueryOptions {
|
|
1183
|
-
endpoint?: string;
|
|
1184
|
-
apiKey?: string;
|
|
1185
|
-
/** Sponsor commerce key — goes in the Authorization header. */
|
|
1186
|
-
commerceKey?: string;
|
|
1187
|
-
/** True when the commerce key came from a resolved sponsor (bootstrap).
|
|
1188
|
-
* False = we fell back to the host apiKey — writes like CreateCart should
|
|
1189
|
-
* NOT proceed with the wrong key (the cart would be orphaned). */
|
|
1190
|
-
sponsorResolved?: boolean;
|
|
1191
|
-
}
|
|
1192
|
-
/**
|
|
1193
|
-
* Resolve endpoint + keys for cart GraphQL calls. Awaits Vio.bootstrap() once
|
|
1194
|
-
* if it hasn't run yet (the sponsor commerce keys come from bootstrap), then
|
|
1195
|
-
* uses the sponsor's commerce apiKey (via the Vio facade on globalThis,
|
|
1196
|
-
* avoiding an import cycle); falls back to the host apiKey.
|
|
1197
|
-
*/
|
|
1198
|
-
declare function getCartGraphQLOptions(sponsorId?: number): Promise<CartQueryOptions>;
|
|
1199
|
-
/** Stable per-browser customer session id (backend CreateCart requires one). */
|
|
1200
|
-
declare function getCustomerSessionId(): string;
|
|
1201
|
-
interface GraphQLEnvelope {
|
|
1202
|
-
data?: Record<string, Record<string, unknown>>;
|
|
1203
|
-
errors?: Array<{
|
|
1204
|
-
message?: string;
|
|
1205
|
-
}>;
|
|
1206
|
-
}
|
|
1207
|
-
/** Execute a GraphQL query/mutation against the configured commerce endpoint.
|
|
1208
|
-
* Callers that skip `getCartGraphQLOptions()` (or pass a bare sponsorId) get
|
|
1209
|
-
* it resolved here instead of silently sending an unauthenticated request. */
|
|
1210
|
-
declare function executeCartGraphQL(query: string, variables: Record<string, unknown>, options?: CartQueryOptions | number | undefined): Promise<GraphQLEnvelope>;
|
|
1211
|
-
declare function createCart(customerSessionId: string, currency: string, shippingCountry?: string | null, options?: CartQueryOptions): Promise<any>;
|
|
1212
|
-
declare function addItem(cartId: string, lineItems: unknown[], options?: CartQueryOptions): Promise<any>;
|
|
1213
|
-
declare function deleteItem(cartId: string, cartItemId: string, options?: CartQueryOptions): Promise<any>;
|
|
1214
|
-
declare function updateItem(cartId: string, cartItemId: string, shippingId?: string | null, qty?: number | null, options?: CartQueryOptions): Promise<any>;
|
|
1215
|
-
declare function getCart(cartId: string, options?: CartQueryOptions): Promise<any>;
|
|
1216
|
-
declare function getLineItemsBySupplier(cartId: string, options?: CartQueryOptions): Promise<any>;
|
|
1217
|
-
declare function updateShippingsBySupplier(cartId: string, data: unknown[], options?: CartQueryOptions): Promise<any>;
|
|
1218
|
-
declare function createCheckout(cartId: string, options?: CartQueryOptions): Promise<any>;
|
|
1219
|
-
declare function updateCheckout(variables: Record<string, unknown>, options?: CartQueryOptions): Promise<any>;
|
|
1220
|
-
declare function getCheckout(checkoutId: string, options?: CartQueryOptions): Promise<any>;
|
|
1221
|
-
declare function getAvailablePaymentMethods(options?: CartQueryOptions): Promise<any>;
|
|
1222
|
-
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";
|
|
1223
|
-
declare function createPaymentStripe(variables: Record<string, unknown>, options?: CartQueryOptions): Promise<any>;
|
|
1224
|
-
|
|
1225
1332
|
/**
|
|
1226
1333
|
* SDK version reported in analytics events (`sdk_version`) and available
|
|
1227
1334
|
* to consumers. Kept as a constant (not a package.json import) so the
|
package/dist/core/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../chunk-QYQQ5J6E.js';
|
|
2
|
-
export { ADD_ITEM_MUTATION, AnalyticsManager, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, CartManager, CheckoutManager, CommerceClient, Configuration, DELETE_ITEM_MUTATION, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, SDK_VERSION, UPDATE_CHECKOUT_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, Vio, VioApi, VioApiError, addItem, checkApplePayAvailability, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, executeCartGraphQL, formatPrice, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, primaryImageUrl, showApplePaySheet, updateCheckout, updateItem, updateShippingsBySupplier } from '../chunk-
|
|
2
|
+
export { ADD_ITEM_MUTATION, AnalyticsManager, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, CartManager, CheckoutManager, CommerceClient, Configuration, DELETE_ITEM_MUTATION, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, SDK_VERSION, UPDATE_CHECKOUT_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, Vio, VioApi, VioApiError, addItem, checkApplePayAvailability, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, executeCartGraphQL, formatPrice, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, primaryImageUrl, showApplePaySheet, updateCheckout, updateItem, updateShippingsBySupplier } from '../chunk-4ZEN4J7I.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import './chunk-QYQQ5J6E.js';
|
|
2
|
-
export { ADD_ITEM_MUTATION, AnalyticsManager, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, CartManager, CheckoutManager, CommerceClient, Configuration, DELETE_ITEM_MUTATION, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, SDK_VERSION, UPDATE_CHECKOUT_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, Vio, VioApi, VioApiError, addItem, checkApplePayAvailability, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, executeCartGraphQL, formatPrice, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, primaryImageUrl, showApplePaySheet, updateCheckout, updateItem, updateShippingsBySupplier } from './chunk-
|
|
2
|
+
export { ADD_ITEM_MUTATION, AnalyticsManager, CREATE_CART_MUTATION, CREATE_CHECKOUT_MUTATION, CREATE_PAYMENT_STRIPE_MUTATION, CREATE_PAYMENT_VIPPS_MUTATION, CartManager, CheckoutManager, CommerceClient, Configuration, DELETE_ITEM_MUTATION, GET_AVAILABLE_PAYMENT_METHODS_QUERY, GET_CART_QUERY, GET_CHECKOUT_QUERY, GET_LINE_ITEMS_BY_SUPPLIER_QUERY, GET_VIPPS_STATUS_QUERY, SDK_VERSION, UPDATE_CHECKOUT_MUTATION, UPDATE_ITEM_MUTATION, UPDATE_SHIPPINGS_BY_SUPPLIER_MUTATION, Vio, VioApi, VioApiError, addItem, checkApplePayAvailability, createCart, createCheckout, createCommerceClient, createPaymentStripe, createPaymentVipps, createVioApi, deleteItem, displayPrice, executeCartGraphQL, formatPrice, getAvailablePaymentMethods, getCart, getCartGraphQLOptions, getCheckout, getCustomerSessionId, getGlobalCurrency, getLineItemsBySupplier, getVippsStatus, primaryImageUrl, showApplePaySheet, updateCheckout, updateItem, updateShippingsBySupplier } from './chunk-4ZEN4J7I.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _lit_react from '@lit/react';
|
|
2
|
-
import { V as VioCart$1, a as VioCheckout$1, b as VioProduct$1, c as VioProductCarousel$1, d as VioProductDetail$1 } from '../tokens-
|
|
3
|
-
export { e as VioThemeOverrides, f as VioTokens, g as applyVioTheme } from '../tokens-
|
|
2
|
+
import { V as VioCart$1, a as VioCheckout$1, b as VioProduct$1, c as VioProductCarousel$1, d as VioProductDetail$1 } from '../tokens-CCZuuTN6.js';
|
|
3
|
+
export { e as VioThemeOverrides, f as VioTokens, g as applyVioTheme } from '../tokens-CCZuuTN6.js';
|
|
4
4
|
import 'lit-html';
|
|
5
5
|
import 'lit';
|
|
6
6
|
|
package/dist/react/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { registerVioElements, VioProduct, VioProductCarousel, VioProductDetail, VioCart, VioCheckout } from '../chunk-
|
|
2
|
-
export { VioTokens, applyVioTheme } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
import { registerVioElements, VioProduct, VioProductCarousel, VioProductDetail, VioCart, VioCheckout } from '../chunk-GPMDZSC2.js';
|
|
2
|
+
export { VioTokens, applyVioTheme } from '../chunk-GPMDZSC2.js';
|
|
3
|
+
import '../chunk-4ZEN4J7I.js';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
|
|
6
6
|
// node_modules/@lit/react/node/create-component.js
|
|
@@ -315,6 +315,10 @@ declare class VioCheckout extends LitElement {
|
|
|
315
315
|
/** Payment method names enabled for the sponsor (backend-configured).
|
|
316
316
|
* null = not loaded yet → all buttons render; [] = none enabled. */
|
|
317
317
|
private availableMethods;
|
|
318
|
+
private kustomMounting;
|
|
319
|
+
private kustomMountedOrderId;
|
|
320
|
+
private qliroMounting;
|
|
321
|
+
private qliroMountedOrderId;
|
|
318
322
|
/** Redirecting to the Stripe / Vipps hosted page. */
|
|
319
323
|
private stripeLoading;
|
|
320
324
|
private vippsLoading;
|
|
@@ -422,6 +426,14 @@ declare class VioCheckout extends LitElement {
|
|
|
422
426
|
render(): lit_html.TemplateResult<1>;
|
|
423
427
|
private renderConfirmation;
|
|
424
428
|
/** Klarna Payments widget panel: shipping + category chips + widget + pay button. */
|
|
429
|
+
/** Mount the Kustom embedded checkout once it's the chosen method. */
|
|
430
|
+
private mountKustomIfNeeded;
|
|
431
|
+
private unmountKustom;
|
|
432
|
+
private renderKustomPanel;
|
|
433
|
+
/** Mount the Qliro embedded checkout once it's the chosen method. */
|
|
434
|
+
private mountQliroIfNeeded;
|
|
435
|
+
private unmountQliro;
|
|
436
|
+
private renderQliroPanel;
|
|
425
437
|
private renderKlarnaPanel;
|
|
426
438
|
/** Express layout — only the Klarna widget + a compact order summary. */
|
|
427
439
|
private renderKlarnaExpress;
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { V as VioCart, a as VioCheckout, b as VioProduct, c as VioProductCarousel, d as VioProductDetail, e as VioThemeOverrides, f as VioTokens, g as applyVioTheme } from '../tokens-
|
|
1
|
+
export { V as VioCart, a as VioCheckout, b as VioProduct, c as VioProductCarousel, d as VioProductDetail, e as VioThemeOverrides, f as VioTokens, g as applyVioTheme } from '../tokens-CCZuuTN6.js';
|
|
2
2
|
import 'lit-html';
|
|
3
3
|
import 'lit';
|
|
4
4
|
|
package/dist/ui/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { registerVioElements } from '../chunk-
|
|
2
|
-
export { VioCart, VioCheckout, VioProduct, VioProductCarousel, VioProductDetail, VioTokens, applyVioTheme, registerVioElements } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
import { registerVioElements } from '../chunk-GPMDZSC2.js';
|
|
2
|
+
export { VioCart, VioCheckout, VioProduct, VioProductCarousel, VioProductDetail, VioTokens, applyVioTheme, registerVioElements } from '../chunk-GPMDZSC2.js';
|
|
3
|
+
import '../chunk-4ZEN4J7I.js';
|
|
4
4
|
|
|
5
5
|
// src/ui/index.ts
|
|
6
6
|
registerVioElements();
|