@yuno-payments/sdk-web-types 5.7.1-CORECM-17780.1 → 5.8.1

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/global.d.ts CHANGED
@@ -479,13 +479,21 @@ type InitializeOptions = {
479
479
  * Whitelabel override for every Yuno-hosted runtime URL the SDK reads
480
480
  * from its environment (REST, payment/enrollment WebSockets, 3DS
481
481
  * challenge/setup/event-origin, the SDK web bundle base, the card form,
482
- * and the secure-field iframes). Path/query/hash/scheme of each URL are
483
- * preserved; only the host (and ws↔wss) is swapped. The merchant-side
484
- * gateway must therefore route every Yuno path under this single host.
482
+ * and the secure-field iframes). The host (and ws↔wss scheme) of each
483
+ * URL is swapped to this value while the env URL's own path/query/hash
484
+ * is kept.
485
+ *
486
+ * A base path on this value is supported: when the override carries one
487
+ * (e.g. a proxy mounted at `https://host/orchestrator`), that prefix is
488
+ * prepended to every resource path so all traffic stays under the
489
+ * sub-path. The 3DS postMessage event origin is the sole exception — it
490
+ * stays scheme+host only. The merchant-side gateway must therefore route
491
+ * every Yuno path under this single host (and optional base path).
485
492
  *
486
493
  * If `assetUrl` is unset, this also drives the lazy-chunk public path.
487
494
  *
488
495
  * @example 'https://payments.merchant.example.com'
496
+ * @example 'https://payments.merchant.example.com/orchestrator'
489
497
  */
490
498
  apiUrl?: string;
491
499
  /**
@@ -746,6 +754,59 @@ interface SecureFields {
746
754
  }
747
755
 
748
756
  declare namespace ExternalButtonsNameSpace {
757
+ type PaypalBraintreeButtonStyleConfig = {
758
+ type?: 'pay' | 'checkout' | 'buynow' | 'subscribe';
759
+ color?: 'gold' | 'blue' | 'white';
760
+ borderRadius?: number;
761
+ height?: number;
762
+ width?: number;
763
+ };
764
+ type ShippingAddressOverride = {
765
+ line1: string;
766
+ line2?: string;
767
+ city: string;
768
+ state: string;
769
+ postalCode: string;
770
+ countryCode: string;
771
+ phone?: string;
772
+ recipientName?: string;
773
+ recipientEmail?: string;
774
+ };
775
+ type GetShippingAddressOverride = () => ShippingAddressOverride | undefined;
776
+ type ShippingAddress = {
777
+ city: string;
778
+ state: string;
779
+ postalCode: string;
780
+ countryCode: string;
781
+ };
782
+ type OnShippingAddressChangeArgs = {
783
+ shippingAddress: ShippingAddress;
784
+ paypalOrderId: string;
785
+ };
786
+ type AmountBreakdown = {
787
+ itemTotal: string;
788
+ shipping?: string;
789
+ tax?: string;
790
+ };
791
+ type ShippingAddressUpdatePrice = {
792
+ action: 'UPDATE_PRICE';
793
+ amount: string;
794
+ breakdown?: AmountBreakdown;
795
+ };
796
+ type ShippingAddressAccept = {
797
+ action: 'ACCEPT';
798
+ };
799
+ type ShippingAddressReject = {
800
+ action: 'REJECT';
801
+ reason?: 'COUNTRY' | 'STATE' | 'POSTAL_CODE' | 'ADDRESS';
802
+ };
803
+ type ShippingAddressChangeResult = ShippingAddressUpdatePrice | ShippingAddressAccept | ShippingAddressReject;
804
+ type OnShippingAddressChange = (args: OnShippingAddressChangeArgs) => Promise<ShippingAddressChangeResult>;
805
+ type PaypalBraintreeButtonConfig = {
806
+ style?: PaypalBraintreeButtonStyleConfig;
807
+ shippingAddressOverride?: GetShippingAddressOverride;
808
+ onShippingAddressChange?: OnShippingAddressChange;
809
+ };
749
810
  type ExternalButton = {
750
811
  elementSelector: string;
751
812
  paymentMethodType: string;
@@ -796,6 +857,7 @@ declare namespace ExternalButtonsNameSpace {
796
857
  applePay?: ApplePayButtonConfig;
797
858
  paypal?: PayPalButtonConfig;
798
859
  revolutPay?: RevolutPayButtonConfig;
860
+ paypalBraintree?: PaypalBraintreeButtonConfig;
799
861
  };
800
862
  }
801
863
 
@@ -995,31 +1057,21 @@ interface MountStatusPaymentArgs {
995
1057
  yunoError?: SdkPaymentsConfig["error"];
996
1058
  }
997
1059
  type ContinuePaymentResponse = {
998
- /**
999
- * Redirect handed back to the integrator (`open_external_browser`):
1000
- * the SDK does NOT navigate in this case.
1001
- */
1002
- action: "REDIRECT_URL";
1003
1060
  type: string;
1004
- redirect_url: {
1005
- init_url: string;
1006
- success_url: string;
1007
- error_url: string;
1061
+ action: string;
1062
+ redirect_url?: {
1063
+ init_url?: string;
1064
+ success_url?: string;
1065
+ error_url?: string;
1008
1066
  };
1009
- } | {
1010
- /**
1011
- * In-page navigation redirect: the SDK navigates (window.location or
1012
- * form POST) right after resolving. Integrators can keep their own
1013
- * loader visible until the navigation commits.
1014
- */
1015
- action: "REDIRECT_URL" | "THREE_D_SECURE_REDIRECT_URL";
1016
- type: string;
1017
- } | null;
1067
+ };
1068
+ type OnActionExecuted = (result: ContinuePaymentResponse) => void;
1018
1069
  type ContinuePaymentArgs = {
1019
1070
  /**
1020
1071
  * @default true
1021
1072
  */
1022
1073
  showPaymentStatus?: boolean;
1074
+ onActionExecuted?: OnActionExecuted;
1023
1075
  };
1024
1076
  type StartSeamlessCheckoutArgs = Omit<StartCheckoutArgs, "createPayment" | "yunoCreatePayment">;
1025
1077
  type ShowLoaderOptions = {
@@ -1045,7 +1097,7 @@ interface SdkPaymentsInstance extends ExternalButtonsNameSpace.ExternalButtonMet
1045
1097
  updateCheckoutSession(checkout: string): Promise<void>;
1046
1098
  submitOneTimeTokenForm(): Promise<void>;
1047
1099
  startPayment(): Promise<void>;
1048
- continuePayment(args?: ContinuePaymentArgs): Promise<ContinuePaymentResponse>;
1100
+ continuePayment(args?: ContinuePaymentArgs): Promise<ContinuePaymentResponse | null>;
1049
1101
  notifyError(): Promise<void>;
1050
1102
  mountEnrollmentLite(args: MountEnrollmentLiteArgs): Promise<void>;
1051
1103
  showLoader(args?: ShowLoaderOptions): Promise<void>;
package/dist/index.d.ts CHANGED
@@ -479,13 +479,21 @@ type InitializeOptions = {
479
479
  * Whitelabel override for every Yuno-hosted runtime URL the SDK reads
480
480
  * from its environment (REST, payment/enrollment WebSockets, 3DS
481
481
  * challenge/setup/event-origin, the SDK web bundle base, the card form,
482
- * and the secure-field iframes). Path/query/hash/scheme of each URL are
483
- * preserved; only the host (and ws↔wss) is swapped. The merchant-side
484
- * gateway must therefore route every Yuno path under this single host.
482
+ * and the secure-field iframes). The host (and ws↔wss scheme) of each
483
+ * URL is swapped to this value while the env URL's own path/query/hash
484
+ * is kept.
485
+ *
486
+ * A base path on this value is supported: when the override carries one
487
+ * (e.g. a proxy mounted at `https://host/orchestrator`), that prefix is
488
+ * prepended to every resource path so all traffic stays under the
489
+ * sub-path. The 3DS postMessage event origin is the sole exception — it
490
+ * stays scheme+host only. The merchant-side gateway must therefore route
491
+ * every Yuno path under this single host (and optional base path).
485
492
  *
486
493
  * If `assetUrl` is unset, this also drives the lazy-chunk public path.
487
494
  *
488
495
  * @example 'https://payments.merchant.example.com'
496
+ * @example 'https://payments.merchant.example.com/orchestrator'
489
497
  */
490
498
  apiUrl?: string;
491
499
  /**
@@ -746,6 +754,59 @@ interface SecureFields {
746
754
  }
747
755
 
748
756
  declare namespace ExternalButtonsNameSpace {
757
+ type PaypalBraintreeButtonStyleConfig = {
758
+ type?: 'pay' | 'checkout' | 'buynow' | 'subscribe';
759
+ color?: 'gold' | 'blue' | 'white';
760
+ borderRadius?: number;
761
+ height?: number;
762
+ width?: number;
763
+ };
764
+ type ShippingAddressOverride = {
765
+ line1: string;
766
+ line2?: string;
767
+ city: string;
768
+ state: string;
769
+ postalCode: string;
770
+ countryCode: string;
771
+ phone?: string;
772
+ recipientName?: string;
773
+ recipientEmail?: string;
774
+ };
775
+ type GetShippingAddressOverride = () => ShippingAddressOverride | undefined;
776
+ type ShippingAddress = {
777
+ city: string;
778
+ state: string;
779
+ postalCode: string;
780
+ countryCode: string;
781
+ };
782
+ type OnShippingAddressChangeArgs = {
783
+ shippingAddress: ShippingAddress;
784
+ paypalOrderId: string;
785
+ };
786
+ type AmountBreakdown = {
787
+ itemTotal: string;
788
+ shipping?: string;
789
+ tax?: string;
790
+ };
791
+ type ShippingAddressUpdatePrice = {
792
+ action: 'UPDATE_PRICE';
793
+ amount: string;
794
+ breakdown?: AmountBreakdown;
795
+ };
796
+ type ShippingAddressAccept = {
797
+ action: 'ACCEPT';
798
+ };
799
+ type ShippingAddressReject = {
800
+ action: 'REJECT';
801
+ reason?: 'COUNTRY' | 'STATE' | 'POSTAL_CODE' | 'ADDRESS';
802
+ };
803
+ type ShippingAddressChangeResult = ShippingAddressUpdatePrice | ShippingAddressAccept | ShippingAddressReject;
804
+ type OnShippingAddressChange = (args: OnShippingAddressChangeArgs) => Promise<ShippingAddressChangeResult>;
805
+ type PaypalBraintreeButtonConfig = {
806
+ style?: PaypalBraintreeButtonStyleConfig;
807
+ shippingAddressOverride?: GetShippingAddressOverride;
808
+ onShippingAddressChange?: OnShippingAddressChange;
809
+ };
749
810
  type ExternalButton = {
750
811
  elementSelector: string;
751
812
  paymentMethodType: string;
@@ -796,6 +857,7 @@ declare namespace ExternalButtonsNameSpace {
796
857
  applePay?: ApplePayButtonConfig;
797
858
  paypal?: PayPalButtonConfig;
798
859
  revolutPay?: RevolutPayButtonConfig;
860
+ paypalBraintree?: PaypalBraintreeButtonConfig;
799
861
  };
800
862
  }
801
863
 
@@ -995,31 +1057,21 @@ interface MountStatusPaymentArgs {
995
1057
  yunoError?: SdkPaymentsConfig["error"];
996
1058
  }
997
1059
  type ContinuePaymentResponse = {
998
- /**
999
- * Redirect handed back to the integrator (`open_external_browser`):
1000
- * the SDK does NOT navigate in this case.
1001
- */
1002
- action: "REDIRECT_URL";
1003
1060
  type: string;
1004
- redirect_url: {
1005
- init_url: string;
1006
- success_url: string;
1007
- error_url: string;
1061
+ action: string;
1062
+ redirect_url?: {
1063
+ init_url?: string;
1064
+ success_url?: string;
1065
+ error_url?: string;
1008
1066
  };
1009
- } | {
1010
- /**
1011
- * In-page navigation redirect: the SDK navigates (window.location or
1012
- * form POST) right after resolving. Integrators can keep their own
1013
- * loader visible until the navigation commits.
1014
- */
1015
- action: "REDIRECT_URL" | "THREE_D_SECURE_REDIRECT_URL";
1016
- type: string;
1017
- } | null;
1067
+ };
1068
+ type OnActionExecuted = (result: ContinuePaymentResponse) => void;
1018
1069
  type ContinuePaymentArgs = {
1019
1070
  /**
1020
1071
  * @default true
1021
1072
  */
1022
1073
  showPaymentStatus?: boolean;
1074
+ onActionExecuted?: OnActionExecuted;
1023
1075
  };
1024
1076
  type StartSeamlessCheckoutArgs = Omit<StartCheckoutArgs, "createPayment" | "yunoCreatePayment">;
1025
1077
  type ShowLoaderOptions = {
@@ -1045,7 +1097,7 @@ interface SdkPaymentsInstance extends ExternalButtonsNameSpace.ExternalButtonMet
1045
1097
  updateCheckoutSession(checkout: string): Promise<void>;
1046
1098
  submitOneTimeTokenForm(): Promise<void>;
1047
1099
  startPayment(): Promise<void>;
1048
- continuePayment(args?: ContinuePaymentArgs): Promise<ContinuePaymentResponse>;
1100
+ continuePayment(args?: ContinuePaymentArgs): Promise<ContinuePaymentResponse | null>;
1049
1101
  notifyError(): Promise<void>;
1050
1102
  mountEnrollmentLite(args: MountEnrollmentLiteArgs): Promise<void>;
1051
1103
  showLoader(args?: ShowLoaderOptions): Promise<void>;
@@ -1076,4 +1128,4 @@ interface SdkPayments {
1076
1128
  interface Yuno extends SdkPayments {
1077
1129
  }
1078
1130
 
1079
- export { type ButtonTextCard, C2PHeadless, type CardConfig, type ContinuePaymentArgs, type ContinuePaymentResponse, type CreateArgsSF, type ExternalButton, type ExternalPaymentButtons, ExternalPaymentButtonsTypes, type ExternalProviderId, type Font, type FormElementSelector, type Language, type LoadingType, type MountCheckoutLiteArgs, type MountEnrollmentLiteArgs, type MountSeamlessCheckoutLiteArgs, type MountSeamlessExternalButtonsArgs, type MountStatusPaymentArgs, type OnChangeDataSF, type RenderMode, type SdkPayments, type SdkPaymentsConfig, type SdkPaymentsInstance, type SecureFieldInstance, type SecureFieldsArgs, type StartCheckoutArgs, type StartSeamlessCheckoutArgs, type TextsCustom, type Yuno, type YunoConfig, type YunoInstance, type mountFraudArgs };
1131
+ export { type ButtonTextCard, C2PHeadless, type CardConfig, type ContinuePaymentArgs, type ContinuePaymentResponse, type CreateArgsSF, type ExternalButton, type ExternalPaymentButtons, ExternalPaymentButtonsTypes, type ExternalProviderId, type Font, type FormElementSelector, type Language, type LoadingType, type MountCheckoutLiteArgs, type MountEnrollmentLiteArgs, type MountSeamlessCheckoutLiteArgs, type MountSeamlessExternalButtonsArgs, type MountStatusPaymentArgs, type OnActionExecuted, type OnChangeDataSF, type RenderMode, type SdkPayments, type SdkPaymentsConfig, type SdkPaymentsInstance, type SecureFieldInstance, type SecureFieldsArgs, type StartCheckoutArgs, type StartSeamlessCheckoutArgs, type TextsCustom, type Yuno, type YunoConfig, type YunoInstance, type mountFraudArgs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuno-payments/sdk-web-types",
3
- "version": "5.7.1-CORECM-17780.1",
3
+ "version": "5.8.1",
4
4
  "types": "dist/index.d.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -22,4 +22,4 @@
22
22
  "rollup-plugin-dts": "^6.1.1",
23
23
  "typescript": "^5.2.2"
24
24
  }
25
- }
25
+ }