@primer-io/primer-js 1.7.0 → 1.8.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 +44 -0
- package/dist/custom-elements.json +580 -521
- package/dist/jsx/index.d.ts +0 -2
- package/dist/primer-loader.d.ts +232 -54
- package/dist/primer-loader.js +19 -17
- package/dist/web-types.json +1 -2
- package/package.json +1 -1
package/dist/jsx/index.d.ts
CHANGED
|
@@ -71,8 +71,6 @@ export type PrimerCheckoutComponentProps = {
|
|
|
71
71
|
This is used to control the CSS-only loader visibility */
|
|
72
72
|
"js-initialized"?: boolean;
|
|
73
73
|
/** */
|
|
74
|
-
jsInitialized?: boolean;
|
|
75
|
-
/** */
|
|
76
74
|
primerJS?: PrimerJS | undefined;
|
|
77
75
|
/** */
|
|
78
76
|
options?: PrimerCheckoutOptions;
|
package/dist/primer-loader.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ContextProvider } from '@lit/context';
|
|
2
2
|
import { Task, initialState } from '@lit/task';
|
|
3
|
-
import { PayPalButtonStyle } from '@paypal/paypal-js';
|
|
4
|
-
import { FUNDING_SOURCE } from '@paypal/paypal-js/types/components/funding-eligibility';
|
|
3
|
+
import { FUNDING_SOURCE, PayPalButtonStyle } from '@paypal/paypal-js';
|
|
5
4
|
import { CSSResult, LitElement, PropertyValues, ReactiveController, ReactiveControllerHost, SVGTemplateResult, TemplateResult, nothing } from 'lit';
|
|
6
5
|
|
|
7
6
|
declare global {
|
|
@@ -268,7 +267,9 @@ export interface GooglePayClientOptions {
|
|
|
268
267
|
*/
|
|
269
268
|
captureBillingAddress?: boolean;
|
|
270
269
|
/**
|
|
271
|
-
* When true, requests shipping address from Google Pay and updates client
|
|
270
|
+
* When true, requests shipping address from Google Pay and updates client
|
|
271
|
+
* session. Register `onShippingAddressChange` to supply shipping options
|
|
272
|
+
* for display in the sheet.
|
|
272
273
|
*/
|
|
273
274
|
captureShippingAddress?: boolean;
|
|
274
275
|
/**
|
|
@@ -281,10 +282,9 @@ export interface GooglePayClientOptions {
|
|
|
281
282
|
*/
|
|
282
283
|
emailRequired?: boolean;
|
|
283
284
|
/**
|
|
284
|
-
* When true, enables shipping method selection in the Google Pay payment
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
* on the client session API to update the order on the backend.
|
|
285
|
+
* When true, enables shipping method selection in the Google Pay payment
|
|
286
|
+
* sheet. Register `onShippingAddressChange` to supply the option list and
|
|
287
|
+
* `onShippingOptionChange` to commit the shopper's selection.
|
|
288
288
|
*/
|
|
289
289
|
requireShippingMethod?: boolean;
|
|
290
290
|
/**
|
|
@@ -371,29 +371,15 @@ export interface BillingAddressCheckoutModule {
|
|
|
371
371
|
type: "BILLING_ADDRESS";
|
|
372
372
|
options: BillingAddressModuleOptions;
|
|
373
373
|
}
|
|
374
|
-
/**
|
|
375
|
-
* Shipping method for express checkout flows (Google Pay, Apple Pay).
|
|
376
|
-
*/
|
|
377
|
-
export interface ShippingMethod {
|
|
378
|
-
/** Unique identifier for the shipping method */
|
|
379
|
-
id: string;
|
|
380
|
-
/** Display name for the shipping method */
|
|
381
|
-
name: string;
|
|
382
|
-
/** Description (e.g., "5-7 business days") */
|
|
383
|
-
description: string;
|
|
384
|
-
/** Shipping cost in minor units */
|
|
385
|
-
amount: number;
|
|
386
|
-
/** Type of shipping method */
|
|
387
|
-
type?: "shipping" | "pickup";
|
|
388
|
-
}
|
|
389
374
|
/**
|
|
390
375
|
* Shipping checkout module options
|
|
391
376
|
*/
|
|
392
377
|
export interface ShippingModuleOptions {
|
|
393
|
-
/** Available shipping methods */
|
|
394
|
-
shippingMethods:
|
|
378
|
+
/** Available shipping methods (legacy `shippingMethodsUrl` path only) */
|
|
379
|
+
shippingMethods: ShippingOption[];
|
|
395
380
|
/** Currently selected shipping method ID */
|
|
396
381
|
selectedShippingMethod?: string;
|
|
382
|
+
callbackMode?: boolean;
|
|
397
383
|
}
|
|
398
384
|
/**
|
|
399
385
|
* Shipping checkout module
|
|
@@ -407,6 +393,20 @@ export interface ShippingCheckoutModule {
|
|
|
407
393
|
* Supports billing address and shipping modules
|
|
408
394
|
*/
|
|
409
395
|
export type CheckoutModuleConfig = BillingAddressCheckoutModule | ShippingCheckoutModule;
|
|
396
|
+
/**
|
|
397
|
+
* A shipping option offered to the shopper inside an Express Checkout
|
|
398
|
+
* (Apple Pay / Google Pay) payment sheet — either the legacy
|
|
399
|
+
* `shippingMethodsUrl`-resolved list (read from `ShippingCheckoutModule`),
|
|
400
|
+
* or merchant-supplied via the newer event-driven flow: returned via the
|
|
401
|
+
* `setShippingOptions` handler on `onShippingAddressChange`, and passed back
|
|
402
|
+
* via `onShippingOptionChange` once the shopper selects one.
|
|
403
|
+
*/
|
|
404
|
+
export interface ShippingOption {
|
|
405
|
+
amount: number;
|
|
406
|
+
id: string;
|
|
407
|
+
name: string;
|
|
408
|
+
description: string;
|
|
409
|
+
}
|
|
410
410
|
export type ApprovalMode = "AUTO" | "MANUAL";
|
|
411
411
|
export interface ClientSession {
|
|
412
412
|
clientSessionId: string;
|
|
@@ -722,6 +722,51 @@ export interface PayPalOptionsWithPaypalJsTypes {
|
|
|
722
722
|
enableFunding?: FUNDING_SOURCE[];
|
|
723
723
|
integrationDate?: string;
|
|
724
724
|
debug?: boolean;
|
|
725
|
+
/**
|
|
726
|
+
* PayPal App Switch configuration.
|
|
727
|
+
*
|
|
728
|
+
* When enabled, tapping the PayPal button attempts to open the PayPal app
|
|
729
|
+
* (falling back to the web flow when unavailable), and the buyer is
|
|
730
|
+
* returned to complete checkout. The SDK uses your `returnUrl` as the PayPal
|
|
731
|
+
* order/billing-agreement return and cancel URLs, and resumes the pending
|
|
732
|
+
* session on return.
|
|
733
|
+
*/
|
|
734
|
+
appSwitch?: {
|
|
735
|
+
/**
|
|
736
|
+
* Whether App Switch is enabled.
|
|
737
|
+
* @default false
|
|
738
|
+
*/
|
|
739
|
+
enabled?: boolean;
|
|
740
|
+
/**
|
|
741
|
+
* The full URL PayPal returns and cancels to after the app switch.
|
|
742
|
+
* **Required when App Switch is enabled**, and PayPal requires it to be the
|
|
743
|
+
* same URL the SDK was initialized on. The SDK appends `?clientToken=…` so
|
|
744
|
+
* that page can resume the pending session.
|
|
745
|
+
*/
|
|
746
|
+
returnUrl?: string;
|
|
747
|
+
/**
|
|
748
|
+
* Host-app bridge for checkout embedded in a native app's webview, where
|
|
749
|
+
* PayPal's in-browser App Switch cannot return. The SDK hands the approval
|
|
750
|
+
* deep link to the host app, which opens it and calls `resumeAppSwitch()`
|
|
751
|
+
* on the native return.
|
|
752
|
+
*/
|
|
753
|
+
hostApp?: {
|
|
754
|
+
/** Return the host native app's return deep link, OS, and OS version. */
|
|
755
|
+
getContext: () => Promise<{
|
|
756
|
+
appUrl: string;
|
|
757
|
+
osType: "IOS" | "ANDROID" | "OTHER";
|
|
758
|
+
/** Host OS version, e.g. "14". */
|
|
759
|
+
osVersion?: string;
|
|
760
|
+
}>;
|
|
761
|
+
/**
|
|
762
|
+
* Open the PayPal approval deep link. The native return appends
|
|
763
|
+
* `/success` or `/cancel` to the return URL and carries the `token`
|
|
764
|
+
* (order id) on both — route by path: `resumeAppSwitch(token)` on
|
|
765
|
+
* success, `cancelAppSwitch()` on cancel.
|
|
766
|
+
*/
|
|
767
|
+
openApprovalUrl: (approvalUrl: string) => void | Promise<void>;
|
|
768
|
+
};
|
|
769
|
+
};
|
|
725
770
|
}
|
|
726
771
|
export interface LegacyApplePayOptions {
|
|
727
772
|
/**
|
|
@@ -769,6 +814,11 @@ export interface ApplePayClientOptions {
|
|
|
769
814
|
* @see https://developer.apple.com/documentation/applepayontheweb/applepaypaymentrequest/requiredshippingcontactfields
|
|
770
815
|
*/
|
|
771
816
|
requiredShippingContactFields?: ("postalAddress" | "name" | "phoneticName" | "phone" | "email")[];
|
|
817
|
+
/**
|
|
818
|
+
* When true, enables shipping method selection in the Apple Pay sheet.
|
|
819
|
+
* Register `onShippingAddressChange` to supply the option list and
|
|
820
|
+
* `onShippingOptionChange` to commit the shopper's selection.
|
|
821
|
+
*/
|
|
772
822
|
requireShippingMethod?: boolean;
|
|
773
823
|
};
|
|
774
824
|
}
|
|
@@ -1145,8 +1195,11 @@ export interface BlikPaymentMethod {
|
|
|
1145
1195
|
*/
|
|
1146
1196
|
start(): Promise<void>;
|
|
1147
1197
|
}
|
|
1198
|
+
/**
|
|
1199
|
+
* A payment method rendered as a branded button by an external SDK.
|
|
1200
|
+
*/
|
|
1148
1201
|
export interface NativePaymentMethod {
|
|
1149
|
-
type: typeof PaymentMethodType.APPLE_PAY | typeof PaymentMethodType.GOOGLE_PAY
|
|
1202
|
+
type: typeof PaymentMethodType.APPLE_PAY | typeof PaymentMethodType.GOOGLE_PAY;
|
|
1150
1203
|
managerType: HeadlessManagerType.NATIVE;
|
|
1151
1204
|
/**
|
|
1152
1205
|
* Initialize the payment method (e.g. load the external SDK)
|
|
@@ -1158,6 +1211,22 @@ export interface NativePaymentMethod {
|
|
|
1158
1211
|
render(container: HTMLElement, buttonOptions?: PaymentRenderButtonOptions): Promise<void>;
|
|
1159
1212
|
setDisabled(disabled: boolean): Promise<void>;
|
|
1160
1213
|
}
|
|
1214
|
+
/**
|
|
1215
|
+
* PayPal renders like the other native methods, plus the host-app App Switch
|
|
1216
|
+
* entry points. Both warn and do nothing unless `paypal.appSwitch.hostApp` is
|
|
1217
|
+
* configured.
|
|
1218
|
+
*/
|
|
1219
|
+
export interface PayPalPaymentMethod {
|
|
1220
|
+
type: typeof PaymentMethodType.PAYPAL;
|
|
1221
|
+
managerType: HeadlessManagerType.NATIVE;
|
|
1222
|
+
start(): Promise<void>;
|
|
1223
|
+
render(container: HTMLElement, buttonOptions?: PaymentRenderButtonOptions): Promise<void>;
|
|
1224
|
+
setDisabled(disabled: boolean): Promise<void>;
|
|
1225
|
+
/** Finishes the payment after the buyer returns, with the `orderId` the host app captured. */
|
|
1226
|
+
resumeAppSwitch(orderId: string): Promise<void>;
|
|
1227
|
+
/** Propagates a user cancellation when the buyer returns without approving. */
|
|
1228
|
+
cancelAppSwitch(): Promise<void>;
|
|
1229
|
+
}
|
|
1161
1230
|
/**
|
|
1162
1231
|
* Payment method types that have a surface of their own. Everything else is
|
|
1163
1232
|
* driven generically — by a redirect, or by the backend.
|
|
@@ -1459,12 +1528,67 @@ export interface CreateHeadlessOptions {
|
|
|
1459
1528
|
* is resolved. Not fired for a fresh checkout (no attempt in flight).
|
|
1460
1529
|
*/
|
|
1461
1530
|
onCheckoutResume?: () => void;
|
|
1531
|
+
/**
|
|
1532
|
+
* Express Checkout (Apple Pay / Google Pay): invoked when the shopper
|
|
1533
|
+
* changes/enters their shipping address inside the native payment sheet.
|
|
1534
|
+
* The merchant computes shipping options for that address and calls
|
|
1535
|
+
* `setShippingOptions` with the result; the SDK displays them in the
|
|
1536
|
+
* sheet. Display-only — the SDK does not persist the list.
|
|
1537
|
+
*
|
|
1538
|
+
* Required for `captureShippingAddress`/`requireShippingMethod` (Google
|
|
1539
|
+
* Pay) or `shippingOptions.requireShippingMethod` (Apple Pay) to show any
|
|
1540
|
+
* shipping options. If not registered, no options are shown and a warning
|
|
1541
|
+
* is logged.
|
|
1542
|
+
*
|
|
1543
|
+
* Must call `setShippingOptions` within 20 seconds or the payment attempt
|
|
1544
|
+
* fails with a `REQUEST_TIMEOUT` error. If integrating via
|
|
1545
|
+
* `addEventListener('primer:shipping-address-change', ...)` instead of
|
|
1546
|
+
* this callback, call `event.preventDefault()` synchronously to signal you
|
|
1547
|
+
* will respond asynchronously — otherwise the SDK assumes nothing is
|
|
1548
|
+
* listening, logs a warning, and your later response is ignored.
|
|
1549
|
+
*
|
|
1550
|
+
* Not invoked at all if a legacy `shippingMethodsUrl`-configured `SHIPPING`
|
|
1551
|
+
* checkout module is present on the client session — that legacy,
|
|
1552
|
+
* server-resolved flow takes priority silently (a warning is logged, but
|
|
1553
|
+
* this callback is simply never called). The two are mutually exclusive;
|
|
1554
|
+
* remove the `shippingMethodsUrl` configuration to use this callback.
|
|
1555
|
+
*/
|
|
1556
|
+
onShippingAddressChange?: (data: {
|
|
1557
|
+
paymentMethodType: PaymentMethodType;
|
|
1558
|
+
shippingAddress: NullableAddress;
|
|
1559
|
+
}, handler: {
|
|
1560
|
+
setShippingOptions: (options: ShippingOption[]) => void;
|
|
1561
|
+
}) => void;
|
|
1562
|
+
/**
|
|
1563
|
+
* Express Checkout (Apple Pay / Google Pay): invoked when the shopper
|
|
1564
|
+
* selects one of the shipping options supplied via
|
|
1565
|
+
* `onShippingAddressChange`. The merchant's backend should PATCH the
|
|
1566
|
+
* client session with the authoritative shipping amount (+ tax) before
|
|
1567
|
+
* calling `continue()` to acknowledge. Payment authorization is gated on
|
|
1568
|
+
* this ack.
|
|
1569
|
+
*
|
|
1570
|
+
* Must call `continue()` within 20 seconds or the payment attempt fails
|
|
1571
|
+
* with a `REQUEST_TIMEOUT` error. If integrating via
|
|
1572
|
+
* `addEventListener('primer:shipping-option-change', ...)` instead of
|
|
1573
|
+
* this callback, call `event.preventDefault()` synchronously to signal you
|
|
1574
|
+
* will respond asynchronously — otherwise the SDK assumes nothing is
|
|
1575
|
+
* listening, logs a warning, and your later response is ignored.
|
|
1576
|
+
*
|
|
1577
|
+
* Not invoked at all if a legacy `shippingMethodsUrl`-configured `SHIPPING`
|
|
1578
|
+
* checkout module is present — see `onShippingAddressChange`.
|
|
1579
|
+
*/
|
|
1580
|
+
onShippingOptionChange?: (data: {
|
|
1581
|
+
paymentMethodType: PaymentMethodType;
|
|
1582
|
+
selectedShippingOption: ShippingOption;
|
|
1583
|
+
}, handler: {
|
|
1584
|
+
continue: () => void;
|
|
1585
|
+
}) => void;
|
|
1462
1586
|
onBinDataAvailable?: (event: BinDataAvailableEvent) => void;
|
|
1463
1587
|
onBinDataLoadingChange?: (loading: boolean) => void;
|
|
1464
1588
|
onCardNetworksChange?: (event: CardNetworkChangeEvent) => void;
|
|
1465
1589
|
onCardNetworksLoading?: () => void;
|
|
1466
1590
|
}
|
|
1467
|
-
export type InitializedPaymentMethod = CardPaymentMethod | KlarnaPaymentMethod | AdyenKlarnaPaymentMethod | QRCodePaymentMethod | BlikPaymentMethod | MbwayPaymentMethod | RedirectPaymentMethod | BackendDrivenPaymentMethod | NativePaymentMethod;
|
|
1591
|
+
export type InitializedPaymentMethod = CardPaymentMethod | KlarnaPaymentMethod | AdyenKlarnaPaymentMethod | QRCodePaymentMethod | BlikPaymentMethod | MbwayPaymentMethod | RedirectPaymentMethod | BackendDrivenPaymentMethod | NativePaymentMethod | PayPalPaymentMethod;
|
|
1468
1592
|
export interface CardSecurityCodeInputOptions {
|
|
1469
1593
|
ariaLabel?: string;
|
|
1470
1594
|
container: string | Element | HTMLElement;
|
|
@@ -1485,7 +1609,7 @@ export interface InputMetadata {
|
|
|
1485
1609
|
touched: boolean;
|
|
1486
1610
|
submitted: boolean;
|
|
1487
1611
|
}
|
|
1488
|
-
export interface PrimerCheckoutOptions extends Omit<CreateHeadlessOptions, "dialogProvider"> {
|
|
1612
|
+
export interface PrimerCheckoutOptions extends Omit<CreateHeadlessOptions, "dialogProvider" | "onShippingAddressChange" | "onShippingOptionChange"> {
|
|
1489
1613
|
giftCard?: {
|
|
1490
1614
|
logoSrc: string;
|
|
1491
1615
|
background: string;
|
|
@@ -1680,11 +1804,17 @@ export type SdkState = {
|
|
|
1680
1804
|
*/
|
|
1681
1805
|
isProcessing: boolean;
|
|
1682
1806
|
/**
|
|
1683
|
-
* SDK
|
|
1684
|
-
*
|
|
1685
|
-
*
|
|
1686
|
-
|
|
1687
|
-
|
|
1807
|
+
* SDK initialization errors — never payment-processing failures (those go
|
|
1808
|
+
* to `paymentFailure`). The error thrown during initialization is kept
|
|
1809
|
+
* as-is; common codes:
|
|
1810
|
+
* - `INVALID_CLIENT_TOKEN`: the client token is malformed, expired, or was
|
|
1811
|
+
* rejected — generate a new one
|
|
1812
|
+
* - `INITIALIZATION_ERROR`: any other initialization failure (e.g. the
|
|
1813
|
+
* configuration failed to load)
|
|
1814
|
+
* `origin` says who should act on it ('network' marks retryable failures);
|
|
1815
|
+
* the underlying cause is nested in `error`.
|
|
1816
|
+
*/
|
|
1817
|
+
primerJsError: SdkError | null;
|
|
1688
1818
|
isLoading: boolean;
|
|
1689
1819
|
/**
|
|
1690
1820
|
* Payment processing failure information.
|
|
@@ -2115,13 +2245,6 @@ export declare class PrimerJS {
|
|
|
2115
2245
|
* Returns the cached list of payment methods.
|
|
2116
2246
|
*/
|
|
2117
2247
|
getPaymentMethods(): InitializedPaymentMethod[];
|
|
2118
|
-
/**
|
|
2119
|
-
* Internal accessor that returns the initialized payment methods (with their
|
|
2120
|
-
* managers), used by the refresh path to preserve manager identity across
|
|
2121
|
-
* client-session refreshes.
|
|
2122
|
-
* @internal
|
|
2123
|
-
*/
|
|
2124
|
-
getInitializedPaymentMethods(): InitializedPaymentMethod[];
|
|
2125
2248
|
/**
|
|
2126
2249
|
* Internal method to handle the onPaymentStart callback
|
|
2127
2250
|
* @internal - This is only used internally by the SDK
|
|
@@ -2150,6 +2273,29 @@ export declare class PrimerJS {
|
|
|
2150
2273
|
* ```
|
|
2151
2274
|
*/
|
|
2152
2275
|
setCardholderName(cardholderName: string): void;
|
|
2276
|
+
/**
|
|
2277
|
+
* PayPal host-app App Switch: finishes the payment after the buyer returns
|
|
2278
|
+
* from the PayPal app, with the `orderId` the host app read from the return
|
|
2279
|
+
* deep link's `token` param. The outcome arrives through the usual
|
|
2280
|
+
* onCheckoutComplete/onCheckoutFail callbacks.
|
|
2281
|
+
*
|
|
2282
|
+
* Does not need the PayPal button to have rendered.
|
|
2283
|
+
*
|
|
2284
|
+
* @example
|
|
2285
|
+
* ```typescript
|
|
2286
|
+
* const checkout = document.querySelector('primer-checkout');
|
|
2287
|
+
* await checkout.primerJS?.resumeAppSwitch(orderIdFromDeepLink);
|
|
2288
|
+
* ```
|
|
2289
|
+
*/
|
|
2290
|
+
resumeAppSwitch(orderId: string): Promise<void>;
|
|
2291
|
+
/** PayPal host-app App Switch: cancels when the buyer returns without approving. */
|
|
2292
|
+
cancelAppSwitch(): Promise<void>;
|
|
2293
|
+
/**
|
|
2294
|
+
* Warns rather than throwing when PayPal is absent: the host app calls these
|
|
2295
|
+
* on a deep-link return, where whether PayPal is in the session is not its
|
|
2296
|
+
* business.
|
|
2297
|
+
*/
|
|
2298
|
+
private findPayPalMethod;
|
|
2153
2299
|
}
|
|
2154
2300
|
export interface CardSubmitResult {
|
|
2155
2301
|
success?: boolean;
|
|
@@ -2223,6 +2369,18 @@ export interface PrimerEvents {
|
|
|
2223
2369
|
"primer:payment-approval-required": CustomEvent<PaymentApprovalRequiredData & {
|
|
2224
2370
|
timestamp: number;
|
|
2225
2371
|
}>;
|
|
2372
|
+
"primer:shipping-address-change": CustomEvent<{
|
|
2373
|
+
paymentMethodType: PaymentMethodType;
|
|
2374
|
+
shippingAddress: NullableAddress;
|
|
2375
|
+
setShippingOptions: (options: ShippingOption[]) => void;
|
|
2376
|
+
timestamp: number;
|
|
2377
|
+
}>;
|
|
2378
|
+
"primer:shipping-option-change": CustomEvent<{
|
|
2379
|
+
paymentMethodType: PaymentMethodType;
|
|
2380
|
+
selectedShippingOption: ShippingOption;
|
|
2381
|
+
continue: () => void;
|
|
2382
|
+
timestamp: number;
|
|
2383
|
+
}>;
|
|
2226
2384
|
"primer:vault-methods-update": CustomEvent<{
|
|
2227
2385
|
vaultedPayments: VaultedPaymentMethodSummary[];
|
|
2228
2386
|
cvvRecapture: boolean;
|
|
@@ -2302,6 +2460,26 @@ declare class PrimerEventsController {
|
|
|
2302
2460
|
* backend to call /approve or /abort, and continueFlow() to resume the SDK.
|
|
2303
2461
|
*/
|
|
2304
2462
|
dispatchPaymentApprovalRequired(detail: PaymentApprovalRequiredData): void;
|
|
2463
|
+
/**
|
|
2464
|
+
* @returns true if a listener called `preventDefault()` or
|
|
2465
|
+
* `setShippingOptions` synchronously; false if nothing is listening, so
|
|
2466
|
+
* the caller can resolve on its own rather than waiting out its timeout.
|
|
2467
|
+
*/
|
|
2468
|
+
dispatchShippingAddressChange(detail: {
|
|
2469
|
+
paymentMethodType: PaymentMethodType;
|
|
2470
|
+
shippingAddress: NullableAddress;
|
|
2471
|
+
setShippingOptions: (options: ShippingOption[]) => void;
|
|
2472
|
+
}): boolean;
|
|
2473
|
+
/**
|
|
2474
|
+
* @returns true if a listener called `preventDefault()` or `continue()`
|
|
2475
|
+
* synchronously; false if nothing is listening, so the caller can resolve
|
|
2476
|
+
* on its own rather than waiting out its timeout.
|
|
2477
|
+
*/
|
|
2478
|
+
dispatchShippingOptionChange(detail: {
|
|
2479
|
+
paymentMethodType: PaymentMethodType;
|
|
2480
|
+
selectedShippingOption: ShippingOption;
|
|
2481
|
+
continue: () => void;
|
|
2482
|
+
}): boolean;
|
|
2305
2483
|
/**
|
|
2306
2484
|
* Dispatch vault methods update event.
|
|
2307
2485
|
* Called when vaulted payment methods are loaded or updated.
|
|
@@ -2460,8 +2638,6 @@ declare class HeadlessSdkController implements ReactiveController {
|
|
|
2460
2638
|
host: PrimerCheckoutType;
|
|
2461
2639
|
private currentSdkInstance;
|
|
2462
2640
|
private primerJS;
|
|
2463
|
-
private loadingTimeout;
|
|
2464
|
-
private isDisconnected;
|
|
2465
2641
|
/**
|
|
2466
2642
|
* Session-bound telemetry of the current SDK instance. Held here (in
|
|
2467
2643
|
* addition to the Lit context) so teardown paths can still emit
|
|
@@ -2472,8 +2648,6 @@ declare class HeadlessSdkController implements ReactiveController {
|
|
|
2472
2648
|
get primerJSInstance(): PrimerJS | null;
|
|
2473
2649
|
hostConnected(): void;
|
|
2474
2650
|
hostDisconnected(): void;
|
|
2475
|
-
private setupLoadingTimeout;
|
|
2476
|
-
private clearLoadingTimeout;
|
|
2477
2651
|
private cleanupResources;
|
|
2478
2652
|
/**
|
|
2479
2653
|
* Datadog error reporting that works across the whole lifecycle: uses the
|
|
@@ -2489,6 +2663,19 @@ declare class HeadlessSdkController implements ReactiveController {
|
|
|
2489
2663
|
* synchronously read state see `isProcessing: true`.
|
|
2490
2664
|
*/
|
|
2491
2665
|
private handlePaymentApprovalRequired;
|
|
2666
|
+
/**
|
|
2667
|
+
* Bridges sdk-core's shipping-address-change callback to the
|
|
2668
|
+
* primer:shipping-address-change DOM event, auto-resolving with no
|
|
2669
|
+
* options so sdk-core's promise doesn't time out if nothing responds.
|
|
2670
|
+
*/
|
|
2671
|
+
private handleShippingAddressChange;
|
|
2672
|
+
/**
|
|
2673
|
+
* Express Checkout (Apple Pay / Google Pay): sdk-core invokes this when the
|
|
2674
|
+
* shopper selects one of the shipping options previously supplied via
|
|
2675
|
+
* onShippingAddressChange. Same bridge/auto-resolve shape as
|
|
2676
|
+
* handleShippingAddressChange above.
|
|
2677
|
+
*/
|
|
2678
|
+
private handleShippingOptionChange;
|
|
2492
2679
|
initializeHeadless(): ([clientToken, options]: readonly [
|
|
2493
2680
|
string | null,
|
|
2494
2681
|
PrimerCheckoutOptions | null
|
|
@@ -2512,8 +2699,6 @@ declare class HeadlessSdkController implements ReactiveController {
|
|
|
2512
2699
|
* 2. Setting the CSS custom property --primer-loader-disabled: 1
|
|
2513
2700
|
*/
|
|
2514
2701
|
export declare class PrimerCheckoutComponent extends LitElement implements PrimerCheckoutType {
|
|
2515
|
-
set jsInitialized(value: boolean);
|
|
2516
|
-
get jsInitialized(): boolean;
|
|
2517
2702
|
get primerJS(): PrimerJS | undefined;
|
|
2518
2703
|
static styles: CSSResult[];
|
|
2519
2704
|
customStyles: string;
|
|
@@ -2525,11 +2710,9 @@ export declare class PrimerCheckoutComponent extends LitElement implements Prime
|
|
|
2525
2710
|
* This is used to control the CSS-only loader visibility
|
|
2526
2711
|
* @private
|
|
2527
2712
|
*/
|
|
2528
|
-
private
|
|
2713
|
+
private jsInitialized;
|
|
2529
2714
|
defaultSlot: HTMLSlotElement;
|
|
2530
|
-
private previousLoadingState;
|
|
2531
2715
|
private hasAssignedContent;
|
|
2532
|
-
private _loadingTimeoutId;
|
|
2533
2716
|
private _eventListenerController;
|
|
2534
2717
|
private _classObserver;
|
|
2535
2718
|
locale: LocaleCode;
|
|
@@ -2541,7 +2724,7 @@ export declare class PrimerCheckoutComponent extends LitElement implements Prime
|
|
|
2541
2724
|
headlessSdkController: HeadlessSdkController;
|
|
2542
2725
|
constructor();
|
|
2543
2726
|
connectedCallback(): void;
|
|
2544
|
-
attributeChangedCallback(attrName: string, oldVal: string, newVal: string): void;
|
|
2727
|
+
attributeChangedCallback(attrName: "custom-styles" | (string & {}), oldVal: string, newVal: string): void;
|
|
2545
2728
|
disconnectedCallback(): void;
|
|
2546
2729
|
willUpdate(changedProperties: PropertyValues): void;
|
|
2547
2730
|
updated(): void;
|
|
@@ -2560,11 +2743,6 @@ export declare class PrimerCheckoutComponent extends LitElement implements Prime
|
|
|
2560
2743
|
* Uses AbortController signal to prevent circular event loops more safely
|
|
2561
2744
|
*/
|
|
2562
2745
|
private handleExternalShowOtherPaymentsToggle;
|
|
2563
|
-
/**
|
|
2564
|
-
* Check if the loading state has changed and update the CSS loader visibility accordingly.
|
|
2565
|
-
* This method is called after each update cycle to detect when loading is complete.
|
|
2566
|
-
*/
|
|
2567
|
-
private checkLoadingStateChange;
|
|
2568
2746
|
render(): TemplateResult;
|
|
2569
2747
|
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: PrimerCheckoutComponent, ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|
|
2570
2748
|
addEventListener<K extends keyof ShadowRootEventMap>(type: K, listener: (this: PrimerCheckoutComponent, ev: ShadowRootEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
|