@payrails/web-sdk 5.44.1 → 5.45.0-RC.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payrails/web-sdk",
3
- "version": "5.44.1",
3
+ "version": "5.45.0-RC.2",
4
4
  "description": "SDK providing tokenization options on the client for merchants",
5
5
  "main": "index.js",
6
6
  "types": "payrails.d.ts",
package/payrails.d.ts CHANGED
@@ -231,14 +231,14 @@ declare class WorkflowExecution {
231
231
  };
232
232
  static get url(): string;
233
233
  static get meta(): ExecutionMeta;
234
- static get availablePaymentMethods(): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined>[];
234
+ static get availablePaymentMethods(): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayWorkflowConfig | undefined>[];
235
235
  static get authorizeLink(): string | undefined;
236
236
  static get payoutLink(): string | undefined;
237
237
  static get createSessionLink(): string | undefined;
238
238
  static get createInstrumentLink(): string | undefined;
239
239
  static get storedPaymentInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
240
240
  static get storedDropinInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
241
- static getFullPaymentMethodConfig(paymentMethod: PaymentMethodCode): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined> | undefined;
241
+ static getFullPaymentMethodConfig(paymentMethod: PaymentMethodCode): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayWorkflowConfig | undefined> | undefined;
242
242
  static isAddressSelectorEnabled(paymentMethod: PaymentMethodCode): boolean | undefined;
243
243
  static isPaymentInstallmentsEnabled(paymentMethod: PaymentMethodCode): boolean | undefined;
244
244
  static getPaymentInstallmentOptions(paymentMethod: PaymentMethodCode): PaymentInstallmentsConfig;
@@ -248,7 +248,7 @@ declare class WorkflowExecution {
248
248
  description?: string;
249
249
  status: PAYMENT_INSTRUMENT_STATUS;
250
250
  integrationType: INTEGRATION_TYPE;
251
- config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
251
+ config: ApplePayConfig | PayPalConfig | GooglePayWorkflowConfig | undefined;
252
252
  clientConfig?: {
253
253
  flow?: PAYMENT_CLIENT_FLOW;
254
254
  displayName?: string;
@@ -268,7 +268,7 @@ declare class WorkflowExecution {
268
268
  description?: string;
269
269
  status: PAYMENT_INSTRUMENT_STATUS;
270
270
  integrationType: INTEGRATION_TYPE;
271
- config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
271
+ config: ApplePayConfig | PayPalConfig | GooglePayWorkflowConfig | undefined;
272
272
  clientConfig?: {
273
273
  flow?: PAYMENT_CLIENT_FLOW;
274
274
  displayName?: string;
@@ -378,7 +378,7 @@ interface InstallmentUpdateConfig {
378
378
  installmentCountry?: string | null;
379
379
  installmentOptions?: BaseInstallmentOption[] | null;
380
380
  }
381
- interface StorablePaymentCompositionOption<I = CardMetadata | PayPalMetadata, C = undefined | ApplePayConfig | PayPalConfig | GooglePayConfig> extends BasePaymentMethodConfig {
381
+ interface StorablePaymentCompositionOption<I = CardMetadata | PayPalMetadata, C = undefined | ApplePayConfig | PayPalConfig | GooglePayWorkflowConfig> extends BasePaymentMethodConfig {
382
382
  id: string;
383
383
  description?: string;
384
384
  status: PAYMENT_INSTRUMENT_STATUS;
@@ -397,7 +397,7 @@ interface StorablePaymentCompositionOption<I = CardMetadata | PayPalMetadata, C
397
397
  paymentInstruments?: Array<StoredPaymentInstrument<I>>;
398
398
  payoutInstruments?: Array<StoredPaymentInstrument<I>>;
399
399
  }
400
- interface GooglePayConfig {
400
+ interface GooglePayWorkflowConfig {
401
401
  parameters: {
402
402
  allowedAuthMethods: google.payments.api.CardAuthMethod[];
403
403
  allowedCardNetworks: google.payments.api.CardNetwork[];
@@ -725,7 +725,7 @@ interface ApplePayButtonOptions extends StoreInstrumentElementOptions {
725
725
  paymentScreenLabel?: string;
726
726
  };
727
727
  };
728
- events?: PaymentEvents & {
728
+ events?: PaymentEvents & UIEvents & {
729
729
  onApplePayAvailable?: () => void;
730
730
  };
731
731
  styles?: {
@@ -750,6 +750,16 @@ declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox
750
750
  private onAuthorizeFailedHandler;
751
751
  private completeApplePaySession;
752
752
  private createApplePaySession;
753
+ /**
754
+ * Apple Pay only exposes redacted contact fields here for privacy
755
+ * (`countryCode`, `administrativeArea`, `locality`, `postalCode`); full
756
+ * address is revealed in `onpaymentauthorized` after the user authorizes.
757
+ *
758
+ * The session must be answered with `completeShippingContactSelection`
759
+ * within ~30s or Apple aborts the sheet — so the merchant's
760
+ * `onDeliveryAddressChanged` callback must be fast.
761
+ */
762
+ private onApplePayShippingContactSelected;
753
763
  private onApplePayAuthorized;
754
764
  private doAuthorizedPayment;
755
765
  private doTokenize;
@@ -1502,7 +1512,17 @@ interface LoadingScreenStyles {
1502
1512
  [StyleKeys.loader]?: Partial<CSSStyleDeclaration>;
1503
1513
  }
1504
1514
 
1505
- type GooglePayConfigInput = google.payments.api.IsReadyToPayPaymentMethodSpecification[] | GooglePayConfig;
1515
+ type GooglePayConfigInput = {
1516
+ apiVersion?: number;
1517
+ apiVersionMinor?: number;
1518
+ allowedPaymentMethods: google.payments.api.PaymentMethodSpecification[];
1519
+ merchantInfo: google.payments.api.MerchantInfo;
1520
+ emailRequired?: boolean;
1521
+ shippingAddressRequired?: boolean;
1522
+ shippingAddressParameters?: google.payments.api.ShippingAddressParameters;
1523
+ existingPaymentMethodRequired?: boolean;
1524
+ } | google.payments.api.PaymentMethodSpecification[];
1525
+
1506
1526
  interface GooglePayButtonOptions extends StoreInstrumentElementOptions {
1507
1527
  environment?: PayrailsEnvironment;
1508
1528
  merchantInfo?: google.payments.api.MerchantInfo;
@@ -1524,17 +1544,11 @@ interface GooglePayButtonOptions extends StoreInstrumentElementOptions {
1524
1544
  declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
1525
1545
  protected options: GooglePayButtonOptions;
1526
1546
  private readonly paymentExecutor;
1527
- private static googleSDKClient;
1528
- private sdkLoadedCalled;
1529
1547
  private isProcessing;
1530
- private buttonElement;
1531
1548
  private action;
1532
- private static getGooglePayConfigAsArray;
1533
- private static getSDKClient;
1549
+ private frame;
1534
1550
  static isGooglePayAvailable(allowedPaymentMethods: GooglePayConfigInput, environment?: PayrailsEnvironment, merchantInfo?: google.payments.api.MerchantInfo): Promise<boolean>;
1535
1551
  constructor(options: GooglePayButtonOptions);
1536
- private sdkLoaded;
1537
- private authorize;
1538
1552
  private onLoadPaymentData;
1539
1553
  private doTokenize;
1540
1554
  private doAuthorizePayment;
@@ -2188,6 +2202,23 @@ interface UIEvents {
2188
2202
  isValid: boolean;
2189
2203
  billingAddress?: IAddress;
2190
2204
  }) => void;
2205
+ /**
2206
+ * Fires when the shopper changes their delivery/shipping address inside an
2207
+ * express-checkout sheet (PayPal, Apple Pay).
2208
+ *
2209
+ * Apple Pay note: only redacted address fields are exposed before the
2210
+ * shopper authorizes the payment — `city`, `postalCode`, `state`, and
2211
+ * `country.code` (see Apple's privacy model). The full address is only
2212
+ * available on `onSuccess` after authorization.
2213
+ *
2214
+ * Apple Pay also requires the SDK to respond to the address-change event
2215
+ * within ~30 seconds, otherwise the sheet errors out. Keep this callback
2216
+ * fast — typically a region/ZIP validation, not a full cart recompute.
2217
+ *
2218
+ * Resolve to `true` to accept the address, `false` to reject it (the
2219
+ * Apple Pay sheet shows an error and prompts the user to pick another
2220
+ * address; PayPal cancels the address change).
2221
+ */
2191
2222
  onDeliveryAddressChanged?: (data?: onDeliveryAddressChangedResponse) => Promise<boolean>;
2192
2223
  }
2193
2224
  type onPaymentMethodSelectedParams = {