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

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.3",
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 & Pick<UIEvents, 'onDeliveryAddressChanged'> & {
729
729
  onApplePayAvailable?: () => void;
730
730
  };
731
731
  styles?: {
@@ -750,6 +750,20 @@ 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
+ * `amount` is passed in (rather than read from `getSDKConfig()`) so the
763
+ * response carries the same total the session was created with, even if
764
+ * the SDK config is mutated mid-flow.
765
+ */
766
+ private onApplePayShippingContactSelected;
753
767
  private onApplePayAuthorized;
754
768
  private doAuthorizedPayment;
755
769
  private doTokenize;
@@ -1502,7 +1516,17 @@ interface LoadingScreenStyles {
1502
1516
  [StyleKeys.loader]?: Partial<CSSStyleDeclaration>;
1503
1517
  }
1504
1518
 
1505
- type GooglePayConfigInput = google.payments.api.IsReadyToPayPaymentMethodSpecification[] | GooglePayConfig;
1519
+ type GooglePayConfigInput = {
1520
+ apiVersion?: number;
1521
+ apiVersionMinor?: number;
1522
+ allowedPaymentMethods: google.payments.api.PaymentMethodSpecification[];
1523
+ merchantInfo: google.payments.api.MerchantInfo;
1524
+ emailRequired?: boolean;
1525
+ shippingAddressRequired?: boolean;
1526
+ shippingAddressParameters?: google.payments.api.ShippingAddressParameters;
1527
+ existingPaymentMethodRequired?: boolean;
1528
+ } | google.payments.api.PaymentMethodSpecification[];
1529
+
1506
1530
  interface GooglePayButtonOptions extends StoreInstrumentElementOptions {
1507
1531
  environment?: PayrailsEnvironment;
1508
1532
  merchantInfo?: google.payments.api.MerchantInfo;
@@ -1524,17 +1548,11 @@ interface GooglePayButtonOptions extends StoreInstrumentElementOptions {
1524
1548
  declare class GooglePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
1525
1549
  protected options: GooglePayButtonOptions;
1526
1550
  private readonly paymentExecutor;
1527
- private static googleSDKClient;
1528
- private sdkLoadedCalled;
1529
1551
  private isProcessing;
1530
- private buttonElement;
1531
1552
  private action;
1532
- private static getGooglePayConfigAsArray;
1533
- private static getSDKClient;
1553
+ private frame;
1534
1554
  static isGooglePayAvailable(allowedPaymentMethods: GooglePayConfigInput, environment?: PayrailsEnvironment, merchantInfo?: google.payments.api.MerchantInfo): Promise<boolean>;
1535
1555
  constructor(options: GooglePayButtonOptions);
1536
- private sdkLoaded;
1537
- private authorize;
1538
1556
  private onLoadPaymentData;
1539
1557
  private doTokenize;
1540
1558
  private doAuthorizePayment;
@@ -2188,6 +2206,23 @@ interface UIEvents {
2188
2206
  isValid: boolean;
2189
2207
  billingAddress?: IAddress;
2190
2208
  }) => void;
2209
+ /**
2210
+ * Fires when the shopper changes their delivery/shipping address inside an
2211
+ * express-checkout sheet (PayPal, Apple Pay).
2212
+ *
2213
+ * Apple Pay note: only redacted address fields are exposed before the
2214
+ * shopper authorizes the payment — `city`, `postalCode`, `state`, and
2215
+ * `country.code` (see Apple's privacy model). The full address is only
2216
+ * available on `onSuccess` after authorization.
2217
+ *
2218
+ * Apple Pay also requires the SDK to respond to the address-change event
2219
+ * within ~30 seconds, otherwise the sheet errors out. Keep this callback
2220
+ * fast — typically a region/ZIP validation, not a full cart recompute.
2221
+ *
2222
+ * Resolve to `true` to accept the address, `false` to reject it (the
2223
+ * Apple Pay sheet shows an error and prompts the user to pick another
2224
+ * address; PayPal cancels the address change).
2225
+ */
2191
2226
  onDeliveryAddressChanged?: (data?: onDeliveryAddressChangedResponse) => Promise<boolean>;
2192
2227
  }
2193
2228
  type onPaymentMethodSelectedParams = {