@dintero/checkout-web-sdk 0.6.6 → 0.6.7

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.
@@ -9,7 +9,7 @@ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
9
  the Software, and to permit persons to whom the Software is furnished to do so,
10
10
  subject to the following conditions:
11
11
 
12
- The above copyright notice and this permission notice shall be included in all
12
+ The above copyright notice and this permission notice shall be included in all
13
13
  copies or substantial portions of the Software.
14
14
 
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
@@ -17,4 +17,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
17
  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
18
  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
19
  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,112 @@
1
+ import type { Session } from "./session.js";
2
+ export declare enum CheckoutEvents {
3
+ SessionNotFound = "SessionNotFound",
4
+ SessionLoaded = "SessionLoaded",
5
+ SessionUpdated = "SessionUpdated",
6
+ SessionCancel = "SessionCancel",
7
+ SessionPaymentOnHold = "SessionPaymentOnHold",
8
+ SessionPaymentAuthorized = "SessionPaymentAuthorized",
9
+ SessionPaymentError = "SessionPaymentError",
10
+ SessionLocked = "SessionLocked",
11
+ SessionLockFailed = "SessionLockFailed",
12
+ ActivePaymentProductType = "ActivePaymentProductType",
13
+ ValidateSession = "ValidateSession"
14
+ }
15
+ export declare enum InternalCheckoutEvents {
16
+ HeightChanged = "HeightChanged",
17
+ LanguageChanged = "LanguageChanged",
18
+ ScrollToTop = "ScrollToTop",
19
+ ShowPopOutButton = "ShowPopOutButton",
20
+ HidePopOutButton = "HidePopOutButton"
21
+ }
22
+ export type SessionNotFound = {
23
+ type: CheckoutEvents.SessionNotFound;
24
+ };
25
+ export type SessionLoaded = {
26
+ type: CheckoutEvents.SessionLoaded;
27
+ session: Session;
28
+ };
29
+ export type SessionUpdated = {
30
+ type: CheckoutEvents.SessionUpdated;
31
+ session: Session;
32
+ };
33
+ export type SessionCancel = {
34
+ type: CheckoutEvents.SessionCancel;
35
+ href: string;
36
+ };
37
+ export type SessionPaymentOnHold = {
38
+ type: CheckoutEvents.SessionPaymentOnHold;
39
+ transaction_id: string;
40
+ merchant_reference: string;
41
+ href: string;
42
+ };
43
+ export type SessionPaymentAuthorized = {
44
+ type: CheckoutEvents.SessionPaymentAuthorized;
45
+ transaction_id: string;
46
+ merchant_reference: string;
47
+ href: string;
48
+ };
49
+ export type SessionLocked = {
50
+ type: CheckoutEvents.SessionLocked;
51
+ pay_lock_id: string;
52
+ callback: () => void;
53
+ };
54
+ export type ShowPopOutButton = {
55
+ type: "ShowPopOutButton";
56
+ styles: {
57
+ font: string;
58
+ height: string;
59
+ color: string;
60
+ background: string;
61
+ textAlign: string;
62
+ padding: string;
63
+ margin: string;
64
+ border: string;
65
+ borderRadius: string;
66
+ cursor: string;
67
+ fontWeight: string;
68
+ lineHeight: string;
69
+ transition: string;
70
+ outline: string;
71
+ };
72
+ stylesHover?: {
73
+ [key: string]: string;
74
+ };
75
+ stylesFocusVisible?: {
76
+ [key: string]: string;
77
+ };
78
+ openLabel: string;
79
+ focusLabel: string;
80
+ closeLabel: string;
81
+ descriptionLabel: string;
82
+ top: string;
83
+ left: string;
84
+ right: string;
85
+ language: string;
86
+ disabled: "true" | "false";
87
+ };
88
+ export type SessionLockFailed = {
89
+ type: CheckoutEvents.SessionLockFailed;
90
+ };
91
+ export type ActivePaymentProductType = {
92
+ type: CheckoutEvents.ActivePaymentProductType;
93
+ payment_product_type: string | undefined;
94
+ };
95
+ export type ValidateSession = {
96
+ type: CheckoutEvents.ValidateSession;
97
+ session: Session;
98
+ callback: (result: SessionValidationCallback) => void;
99
+ };
100
+ export interface SessionValidationCallback {
101
+ success: boolean;
102
+ clientValidationError?: string;
103
+ }
104
+ export type WrappedValidateSession = Pick<ValidateSession, "type" | "session">;
105
+ export type WrappedSessionLocked = Pick<SessionLocked, "type" | "pay_lock_id">;
106
+ export type SessionPayment = SessionPaymentAuthorized | SessionPaymentOnHold;
107
+ export type SessionPaymentError = {
108
+ type: CheckoutEvents.SessionPaymentError;
109
+ error: string;
110
+ href: string;
111
+ };
112
+ export type SessionEvent = SessionNotFound | SessionLoaded | SessionUpdated | SessionCancel | SessionPaymentOnHold | SessionPaymentAuthorized | SessionPaymentError | WrappedSessionLocked | SessionLockFailed | ActivePaymentProductType | WrappedValidateSession;
@@ -0,0 +1,60 @@
1
+ import "native-promise-only";
2
+ import { CheckoutEvents, InternalCheckoutEvents, SessionNotFound, SessionLoaded, SessionUpdated, SessionCancel, SessionPaymentOnHold, SessionPaymentAuthorized, SessionPaymentError, SessionLocked, SessionLockFailed, ActivePaymentProductType, ValidateSession, SessionValidationCallback, SessionEvent } from "./checkout.js";
3
+ import { SubscriptionHandler } from "./subscribe.js";
4
+ import { Session } from "./session.js";
5
+ export interface DinteroCheckoutInstance {
6
+ /**
7
+ * Remove iframe and all event listeners.
8
+ */
9
+ destroy: () => void;
10
+ iframe: HTMLIFrameElement;
11
+ language: string;
12
+ lockSession: () => Promise<SessionEvent>;
13
+ refreshSession: () => Promise<SessionEvent>;
14
+ setActivePaymentProductType: (paymentProductType: string) => void;
15
+ submitValidationResult: (result: SessionValidationCallback) => void;
16
+ options: InternalDinteroEmbedCheckoutOptions;
17
+ handlers: ({
18
+ handler: SubscriptionHandler;
19
+ eventTypes: InternalCheckoutEvents[];
20
+ } | {
21
+ handler: SubscriptionHandler;
22
+ eventTypes: CheckoutEvents[];
23
+ })[];
24
+ session: Session | undefined;
25
+ popOutWindow: Window | undefined;
26
+ }
27
+ export interface DinteroCheckoutOptions {
28
+ sid: string;
29
+ endpoint?: string;
30
+ language?: string;
31
+ }
32
+ export interface DinteroEmbedCheckoutOptions extends DinteroCheckoutOptions {
33
+ container: HTMLDivElement;
34
+ popOut?: boolean;
35
+ onPayment?: (event: SessionPaymentAuthorized | SessionPaymentOnHold, checkout: DinteroCheckoutInstance) => void;
36
+ /**
37
+ * @deprecated Since version 0.0.1. Will be deleted in version 1.0.0. Use onPayment instead.
38
+ */
39
+ onPaymentAuthorized?: (event: SessionPaymentAuthorized, checkout: DinteroCheckoutInstance) => void;
40
+ onSession?: (event: SessionLoaded | SessionUpdated, checkout: DinteroCheckoutInstance) => void;
41
+ onPaymentError?: (event: SessionPaymentError, checkout: DinteroCheckoutInstance) => void;
42
+ onSessionCancel?: (event: SessionCancel, checkout: DinteroCheckoutInstance) => void;
43
+ onSessionNotFound?: (event: SessionNotFound, checkout: DinteroCheckoutInstance) => void;
44
+ onSessionLocked?: (event: SessionLocked, checkout: DinteroCheckoutInstance, callback: () => void) => void;
45
+ onSessionLockFailed?: (event: SessionLockFailed, checkout: DinteroCheckoutInstance) => void;
46
+ onActivePaymentType?: (event: ActivePaymentProductType, checkout: DinteroCheckoutInstance) => void;
47
+ onValidateSession?: (event: ValidateSession, checkout: DinteroCheckoutInstance, callback: (result: SessionValidationCallback) => void) => void;
48
+ }
49
+ interface InternalDinteroEmbedCheckoutOptions extends DinteroEmbedCheckoutOptions {
50
+ innerContainer: HTMLDivElement;
51
+ }
52
+ /**
53
+ * Show a dintero payment session in an embedded iframe.
54
+ */
55
+ export declare const embed: (options: DinteroEmbedCheckoutOptions) => Promise<DinteroCheckoutInstance>;
56
+ /**
57
+ * Redirect the customer to a payment session in the Dintero Checkout.
58
+ */
59
+ export declare const redirect: (options: DinteroCheckoutOptions) => void;
60
+ export type { SessionNotFound, SessionLoaded, SessionUpdated, SessionCancel, SessionPaymentOnHold, SessionPaymentAuthorized, SessionPaymentError, SessionLocked, SessionLockFailed, ActivePaymentProductType, ValidateSession, SessionValidationCallback, } from "./checkout.js";