@dintero/checkout-web-sdk 0.5.9 → 0.6.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.
Files changed (28) hide show
  1. package/README.md +4 -2
  2. package/coverage/{Chrome Headless 115.0.5790.98 (Linux x86_64) → Chrome Headless 117.0.5938.92 (Linux x86_64)}/html/checkout.ts.html +92 -5
  3. package/coverage/{Chrome Headless 115.0.5790.98 (Linux x86_64) → Chrome Headless 117.0.5938.92 (Linux x86_64)}/html/createIframeAsync.ts.html +15 -15
  4. package/coverage/{Chrome Headless 115.0.5790.98 (Linux x86_64) → Chrome Headless 117.0.5938.92 (Linux x86_64)}/html/index.html +88 -43
  5. package/coverage/{Chrome Headless 115.0.5790.98 (Linux x86_64) → Chrome Headless 117.0.5938.92 (Linux x86_64)}/html/index.ts.html +1085 -95
  6. package/coverage/Chrome Headless 117.0.5938.92 (Linux x86_64)/html/popOut.ts.html +377 -0
  7. package/coverage/Chrome Headless 117.0.5938.92 (Linux x86_64)/html/popOutBackdrop.ts.html +1046 -0
  8. package/coverage/Chrome Headless 117.0.5938.92 (Linux x86_64)/html/popOutButton.ts.html +374 -0
  9. package/coverage/{Chrome Headless 115.0.5790.98 (Linux x86_64) → Chrome Headless 117.0.5938.92 (Linux x86_64)}/html/subscribe.ts.html +218 -29
  10. package/coverage/Chrome Headless 117.0.5938.92 (Linux x86_64)/html/url.ts.html +284 -0
  11. package/dist/declarations/src/checkout.d.ts +45 -17
  12. package/dist/declarations/src/index.d.ts +17 -1
  13. package/dist/declarations/src/session.d.ts +19 -35
  14. package/dist/declarations/src/subscribe.d.ts +62 -0
  15. package/dist/dintero-checkout-web-sdk.cjs.dev.js +927 -63
  16. package/dist/dintero-checkout-web-sdk.cjs.prod.js +927 -63
  17. package/dist/dintero-checkout-web-sdk.esm.js +927 -63
  18. package/dist/dintero-checkout-web-sdk.umd.min.js +1 -1
  19. package/dist/dintero-checkout-web-sdk.umd.min.js.map +1 -1
  20. package/package.json +5 -5
  21. package/coverage/Chrome Headless 115.0.5790.98 (Linux x86_64)/html/url.ts.html +0 -185
  22. /package/coverage/{Chrome Headless 115.0.5790.98 (Linux x86_64) → Chrome Headless 117.0.5938.92 (Linux x86_64)}/html/base.css +0 -0
  23. /package/coverage/{Chrome Headless 115.0.5790.98 (Linux x86_64) → Chrome Headless 117.0.5938.92 (Linux x86_64)}/html/block-navigation.js +0 -0
  24. /package/coverage/{Chrome Headless 115.0.5790.98 (Linux x86_64) → Chrome Headless 117.0.5938.92 (Linux x86_64)}/html/favicon.png +0 -0
  25. /package/coverage/{Chrome Headless 115.0.5790.98 (Linux x86_64) → Chrome Headless 117.0.5938.92 (Linux x86_64)}/html/prettify.css +0 -0
  26. /package/coverage/{Chrome Headless 115.0.5790.98 (Linux x86_64) → Chrome Headless 117.0.5938.92 (Linux x86_64)}/html/prettify.js +0 -0
  27. /package/coverage/{Chrome Headless 115.0.5790.98 (Linux x86_64) → Chrome Headless 117.0.5938.92 (Linux x86_64)}/html/sort-arrow-sprite.png +0 -0
  28. /package/coverage/{Chrome Headless 115.0.5790.98 (Linux x86_64) → Chrome Headless 117.0.5938.92 (Linux x86_64)}/html/sorter.js +0 -0
@@ -0,0 +1,284 @@
1
+
2
+ <!doctype html>
3
+ <html lang="en">
4
+
5
+ <head>
6
+ <title>Code coverage report for url.ts</title>
7
+ <meta charset="utf-8" />
8
+ <link rel="stylesheet" href="prettify.css" />
9
+ <link rel="stylesheet" href="base.css" />
10
+ <link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+ <style type='text/css'>
13
+ .coverage-summary .sorter {
14
+ background-image: url(sort-arrow-sprite.png);
15
+ }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <div class='wrapper'>
21
+ <div class='pad1'>
22
+ <h1><a href="index.html">All files</a> url.ts</h1>
23
+ <div class='clearfix'>
24
+
25
+ <div class='fl pad1y space-right2'>
26
+ <span class="strong">46.34% </span>
27
+ <span class="quiet">Statements</span>
28
+ <span class='fraction'>19/41</span>
29
+ </div>
30
+
31
+
32
+ <div class='fl pad1y space-right2'>
33
+ <span class="strong">38.89% </span>
34
+ <span class="quiet">Branches</span>
35
+ <span class='fraction'>7/18</span>
36
+ </div>
37
+
38
+
39
+ <div class='fl pad1y space-right2'>
40
+ <span class="strong">25% </span>
41
+ <span class="quiet">Functions</span>
42
+ <span class='fraction'>1/4</span>
43
+ </div>
44
+
45
+
46
+ <div class='fl pad1y space-right2'>
47
+ <span class="strong">48.48% </span>
48
+ <span class="quiet">Lines</span>
49
+ <span class='fraction'>16/33</span>
50
+ </div>
51
+
52
+
53
+ </div>
54
+ <p class="quiet">
55
+ Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
56
+ </p>
57
+ </div>
58
+ <div class='status-line low'></div>
59
+ <pre><table class="coverage">
60
+ <tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
61
+ <a name='L2'></a><a href='#L2'>2</a>
62
+ <a name='L3'></a><a href='#L3'>3</a>
63
+ <a name='L4'></a><a href='#L4'>4</a>
64
+ <a name='L5'></a><a href='#L5'>5</a>
65
+ <a name='L6'></a><a href='#L6'>6</a>
66
+ <a name='L7'></a><a href='#L7'>7</a>
67
+ <a name='L8'></a><a href='#L8'>8</a>
68
+ <a name='L9'></a><a href='#L9'>9</a>
69
+ <a name='L10'></a><a href='#L10'>10</a>
70
+ <a name='L11'></a><a href='#L11'>11</a>
71
+ <a name='L12'></a><a href='#L12'>12</a>
72
+ <a name='L13'></a><a href='#L13'>13</a>
73
+ <a name='L14'></a><a href='#L14'>14</a>
74
+ <a name='L15'></a><a href='#L15'>15</a>
75
+ <a name='L16'></a><a href='#L16'>16</a>
76
+ <a name='L17'></a><a href='#L17'>17</a>
77
+ <a name='L18'></a><a href='#L18'>18</a>
78
+ <a name='L19'></a><a href='#L19'>19</a>
79
+ <a name='L20'></a><a href='#L20'>20</a>
80
+ <a name='L21'></a><a href='#L21'>21</a>
81
+ <a name='L22'></a><a href='#L22'>22</a>
82
+ <a name='L23'></a><a href='#L23'>23</a>
83
+ <a name='L24'></a><a href='#L24'>24</a>
84
+ <a name='L25'></a><a href='#L25'>25</a>
85
+ <a name='L26'></a><a href='#L26'>26</a>
86
+ <a name='L27'></a><a href='#L27'>27</a>
87
+ <a name='L28'></a><a href='#L28'>28</a>
88
+ <a name='L29'></a><a href='#L29'>29</a>
89
+ <a name='L30'></a><a href='#L30'>30</a>
90
+ <a name='L31'></a><a href='#L31'>31</a>
91
+ <a name='L32'></a><a href='#L32'>32</a>
92
+ <a name='L33'></a><a href='#L33'>33</a>
93
+ <a name='L34'></a><a href='#L34'>34</a>
94
+ <a name='L35'></a><a href='#L35'>35</a>
95
+ <a name='L36'></a><a href='#L36'>36</a>
96
+ <a name='L37'></a><a href='#L37'>37</a>
97
+ <a name='L38'></a><a href='#L38'>38</a>
98
+ <a name='L39'></a><a href='#L39'>39</a>
99
+ <a name='L40'></a><a href='#L40'>40</a>
100
+ <a name='L41'></a><a href='#L41'>41</a>
101
+ <a name='L42'></a><a href='#L42'>42</a>
102
+ <a name='L43'></a><a href='#L43'>43</a>
103
+ <a name='L44'></a><a href='#L44'>44</a>
104
+ <a name='L45'></a><a href='#L45'>45</a>
105
+ <a name='L46'></a><a href='#L46'>46</a>
106
+ <a name='L47'></a><a href='#L47'>47</a>
107
+ <a name='L48'></a><a href='#L48'>48</a>
108
+ <a name='L49'></a><a href='#L49'>49</a>
109
+ <a name='L50'></a><a href='#L50'>50</a>
110
+ <a name='L51'></a><a href='#L51'>51</a>
111
+ <a name='L52'></a><a href='#L52'>52</a>
112
+ <a name='L53'></a><a href='#L53'>53</a>
113
+ <a name='L54'></a><a href='#L54'>54</a>
114
+ <a name='L55'></a><a href='#L55'>55</a>
115
+ <a name='L56'></a><a href='#L56'>56</a>
116
+ <a name='L57'></a><a href='#L57'>57</a>
117
+ <a name='L58'></a><a href='#L58'>58</a>
118
+ <a name='L59'></a><a href='#L59'>59</a>
119
+ <a name='L60'></a><a href='#L60'>60</a>
120
+ <a name='L61'></a><a href='#L61'>61</a>
121
+ <a name='L62'></a><a href='#L62'>62</a>
122
+ <a name='L63'></a><a href='#L63'>63</a>
123
+ <a name='L64'></a><a href='#L64'>64</a>
124
+ <a name='L65'></a><a href='#L65'>65</a>
125
+ <a name='L66'></a><a href='#L66'>66</a>
126
+ <a name='L67'></a><a href='#L67'>67</a>
127
+ <a name='L68'></a><a href='#L68'>68</a>
128
+ <a name='L69'></a><a href='#L69'>69</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
129
+ <span class="cline-any cline-neutral">&nbsp;</span>
130
+ <span class="cline-any cline-neutral">&nbsp;</span>
131
+ <span class="cline-any cline-neutral">&nbsp;</span>
132
+ <span class="cline-any cline-neutral">&nbsp;</span>
133
+ <span class="cline-any cline-yes">1x</span>
134
+ <span class="cline-any cline-no">&nbsp;</span>
135
+ <span class="cline-any cline-neutral">&nbsp;</span>
136
+ <span class="cline-any cline-neutral">&nbsp;</span>
137
+ <span class="cline-any cline-neutral">&nbsp;</span>
138
+ <span class="cline-any cline-neutral">&nbsp;</span>
139
+ <span class="cline-any cline-neutral">&nbsp;</span>
140
+ <span class="cline-any cline-neutral">&nbsp;</span>
141
+ <span class="cline-any cline-neutral">&nbsp;</span>
142
+ <span class="cline-any cline-neutral">&nbsp;</span>
143
+ <span class="cline-any cline-neutral">&nbsp;</span>
144
+ <span class="cline-any cline-neutral">&nbsp;</span>
145
+ <span class="cline-any cline-neutral">&nbsp;</span>
146
+ <span class="cline-any cline-neutral">&nbsp;</span>
147
+ <span class="cline-any cline-neutral">&nbsp;</span>
148
+ <span class="cline-any cline-neutral">&nbsp;</span>
149
+ <span class="cline-any cline-neutral">&nbsp;</span>
150
+ <span class="cline-any cline-yes">1x</span>
151
+ <span class="cline-any cline-yes">12x</span>
152
+ <span class="cline-any cline-yes">2x</span>
153
+ <span class="cline-any cline-no">&nbsp;</span>
154
+ <span class="cline-any cline-neutral">&nbsp;</span>
155
+ <span class="cline-any cline-yes">2x</span>
156
+ <span class="cline-any cline-yes">2x</span>
157
+ <span class="cline-any cline-yes">2x</span>
158
+ <span class="cline-any cline-no">&nbsp;</span>
159
+ <span class="cline-any cline-neutral">&nbsp;</span>
160
+ <span class="cline-any cline-yes">2x</span>
161
+ <span class="cline-any cline-yes">1x</span>
162
+ <span class="cline-any cline-neutral">&nbsp;</span>
163
+ <span class="cline-any cline-yes">2x</span>
164
+ <span class="cline-any cline-no">&nbsp;</span>
165
+ <span class="cline-any cline-neutral">&nbsp;</span>
166
+ <span class="cline-any cline-yes">2x</span>
167
+ <span class="cline-any cline-no">&nbsp;</span>
168
+ <span class="cline-any cline-neutral">&nbsp;</span>
169
+ <span class="cline-any cline-yes">2x</span>
170
+ <span class="cline-any cline-neutral">&nbsp;</span>
171
+ <span class="cline-any cline-yes">2x</span>
172
+ <span class="cline-any cline-neutral">&nbsp;</span>
173
+ <span class="cline-any cline-neutral">&nbsp;</span>
174
+ <span class="cline-any cline-neutral">&nbsp;</span>
175
+ <span class="cline-any cline-neutral">&nbsp;</span>
176
+ <span class="cline-any cline-no">&nbsp;</span>
177
+ <span class="cline-any cline-no">&nbsp;</span>
178
+ <span class="cline-any cline-neutral">&nbsp;</span>
179
+ <span class="cline-any cline-neutral">&nbsp;</span>
180
+ <span class="cline-any cline-yes">1x</span>
181
+ <span class="cline-any cline-neutral">&nbsp;</span>
182
+ <span class="cline-any cline-yes">1x</span>
183
+ <span class="cline-any cline-no">&nbsp;</span>
184
+ <span class="cline-any cline-no">&nbsp;</span>
185
+ <span class="cline-any cline-neutral">&nbsp;</span>
186
+ <span class="cline-any cline-no">&nbsp;</span>
187
+ <span class="cline-any cline-no">&nbsp;</span>
188
+ <span class="cline-any cline-no">&nbsp;</span>
189
+ <span class="cline-any cline-no">&nbsp;</span>
190
+ <span class="cline-any cline-no">&nbsp;</span>
191
+ <span class="cline-any cline-no">&nbsp;</span>
192
+ <span class="cline-any cline-no">&nbsp;</span>
193
+ <span class="cline-any cline-neutral">&nbsp;</span>
194
+ <span class="cline-any cline-no">&nbsp;</span>
195
+ <span class="cline-any cline-neutral">&nbsp;</span>
196
+ <span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import pkg from "../package.json";
197
+ &nbsp;
198
+ /**
199
+ * Wraps window.location.assign()
200
+ */
201
+ export const windowLocationAssign = <span class="fstat-no" title="function not covered" >(u</span>rl: string) =&gt; {
202
+ <span class="cstat-no" title="statement not covered" > window.location.assign(url);</span>
203
+ };
204
+ &nbsp;
205
+ /**
206
+ * Get the url for the session./yarn-error.log
207
+ .DS_Store
208
+ */
209
+ export interface SessionUrlOptions {
210
+ sid: string;
211
+ endpoint: string;
212
+ language: string | undefined;
213
+ ui?: "fullscreen" | "inline";
214
+ shouldCallValidateSession: boolean;
215
+ popOut?: boolean
216
+ }
217
+ &nbsp;
218
+ export const getSessionUrl = (options: SessionUrlOptions): string =&gt; {
219
+ const { sid, endpoint, language, ui, shouldCallValidateSession, popOut } = options;
220
+ <span class="missing-if-branch" title="if path not taken" >I</span>if (!endpoint) {
221
+ <span class="cstat-no" title="statement not covered" > throw new Error("Invalid endpoint");</span>
222
+ }
223
+ const params = new URLSearchParams();
224
+ params.append('sdk', pkg.version);
225
+ <span class="missing-if-branch" title="if path not taken" >I</span>if(ui){
226
+ <span class="cstat-no" title="statement not covered" > params.append('ui', ui);</span>
227
+ }
228
+ if(language){
229
+ params.append('language', language);
230
+ }
231
+ <span class="missing-if-branch" title="if path not taken" >I</span>if(shouldCallValidateSession){
232
+ <span class="cstat-no" title="statement not covered" > params.append('client_side_validation', 'true');</span>
233
+ }
234
+ <span class="missing-if-branch" title="if path not taken" >I</span>if(popOut) {
235
+ <span class="cstat-no" title="statement not covered" > params.append('role', 'pop_out_launcher');</span>
236
+ }
237
+ <span class="missing-if-branch" title="else path not taken" >E</span>if (endpoint === "https://checkout.dintero.com") {
238
+ // Default endpoint will redirect via the view endpoint
239
+ return `${endpoint}/v1/view/${sid}?${params.toString()}`;
240
+ }
241
+ // When a custom endpoint is set skip the view redirect endpoint since
242
+ // custom endpoints like localhost and PR builds does not support the
243
+ // serverside view flow.
244
+ <span class="cstat-no" title="statement not covered" > params.append('sid', sid);</span>
245
+ <span class="cstat-no" title="statement not covered" > return `${endpoint}/?${params.toString()}`;</span>
246
+ };
247
+ &nbsp;
248
+ const padTralingSlash = <span class="fstat-no" title="function not covered" >(e</span>ndpoint: string) =&gt; <span class="cstat-no" title="statement not covered" >endpoint.endsWith('/') ? endpoint : `${endpoint}/`;</span>
249
+ &nbsp;
250
+ export const getPopOutUrl = <span class="fstat-no" title="function not covered" >({</span> sid<span class="cstat-no" title="statement not covered" >, e</span>ndpoint<span class="cstat-no" title="statement not covered" >, l</span>anguage<span class="cstat-no" title="statement not covered" >, s</span>houldCallValidateSession<span class="cstat-no" title="statement not covered" > }: SessionUrlOptions)</span> =&gt; {
251
+ <span class="cstat-no" title="statement not covered" > if (shouldCallValidateSession) {</span>
252
+ <span class="cstat-no" title="statement not covered" > return `${padTralingSlash(endpoint)}?loader=true`;</span>
253
+ }
254
+ const params = <span class="cstat-no" title="statement not covered" >new URLSearchParams();</span>
255
+ <span class="cstat-no" title="statement not covered" > params.append('ui', 'fullscreen');</span>
256
+ <span class="cstat-no" title="statement not covered" > params.append('role', 'pop_out_payment');</span>
257
+ <span class="cstat-no" title="statement not covered" > params.append('sid', sid);</span>
258
+ <span class="cstat-no" title="statement not covered" > params.append('sdk', pkg.version);</span>
259
+ <span class="cstat-no" title="statement not covered" > if (language) {</span>
260
+ <span class="cstat-no" title="statement not covered" > params.append('language', language);</span>
261
+ }
262
+ <span class="cstat-no" title="statement not covered" > return `${endpoint}/?${params.toString()}`;</span>
263
+ };
264
+ &nbsp;</pre></td></tr></table></pre>
265
+
266
+ <div class='push'></div><!-- for sticky footer -->
267
+ </div><!-- /wrapper -->
268
+ <div class='footer quiet pad2 space-top1 center small'>
269
+ Code coverage generated by
270
+ <a href="https://istanbul.js.org/" target="_blank">istanbul</a>
271
+ at Wed Oct 04 2023 07:34:20 GMT+0000 (Coordinated Universal Time)
272
+ </div>
273
+ </div>
274
+ <script src="prettify.js"></script>
275
+ <script>
276
+ window.onload = function () {
277
+ prettyPrint();
278
+ };
279
+ </script>
280
+ <script src="sorter.js"></script>
281
+ <script src="block-navigation.js"></script>
282
+ </body>
283
+ </html>
284
+
@@ -1,4 +1,4 @@
1
- import { Session } from "./session.js";
1
+ import type { Session } from "./session.js";
2
2
  export declare enum CheckoutEvents {
3
3
  SessionNotFound = "SessionNotFound",
4
4
  SessionLoaded = "SessionLoaded",
@@ -15,48 +15,76 @@ export declare enum CheckoutEvents {
15
15
  export declare enum InternalCheckoutEvents {
16
16
  HeightChanged = "HeightChanged",
17
17
  LanguageChanged = "LanguageChanged",
18
- ScrollToTop = "ScrollToTop"
18
+ ScrollToTop = "ScrollToTop",
19
+ ShowPopOutButton = "ShowPopOutButton",
20
+ HidePopOutButton = "HidePopOutButton"
19
21
  }
20
- export declare type SessionNotFound = {
22
+ export type SessionNotFound = {
21
23
  type: CheckoutEvents.SessionNotFound;
22
24
  };
23
- export declare type SessionLoaded = {
25
+ export type SessionLoaded = {
24
26
  type: CheckoutEvents.SessionLoaded;
25
27
  session: Session;
26
28
  };
27
- export declare type SessionUpdated = {
29
+ export type SessionUpdated = {
28
30
  type: CheckoutEvents.SessionUpdated;
29
31
  session: Session;
30
32
  };
31
- export declare type SessionCancel = {
33
+ export type SessionCancel = {
32
34
  type: CheckoutEvents.SessionCancel;
33
35
  href: string;
34
36
  };
35
- export declare type SessionPaymentOnHold = {
37
+ export type SessionPaymentOnHold = {
36
38
  type: CheckoutEvents.SessionPaymentOnHold;
37
39
  transaction_id: string;
38
40
  merchant_reference: string;
39
41
  href: string;
40
42
  };
41
- export declare type SessionPaymentAuthorized = {
43
+ export type SessionPaymentAuthorized = {
42
44
  type: CheckoutEvents.SessionPaymentAuthorized;
43
45
  transaction_id: string;
44
46
  merchant_reference: string;
45
47
  href: string;
46
48
  };
47
- export declare type SessionLocked = {
49
+ export type SessionLocked = {
48
50
  type: CheckoutEvents.SessionLocked;
49
51
  pay_lock_id: string;
50
52
  callback: () => void;
51
53
  };
52
- export declare type SessionLockFailed = {
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
+ };
70
+ openLabel: string;
71
+ focusLabel: string;
72
+ closeLabel: string;
73
+ descriptionLabel: string;
74
+ top: string;
75
+ left: string;
76
+ right: string;
77
+ language: string;
78
+ disabled: 'true' | 'false';
79
+ };
80
+ export type SessionLockFailed = {
53
81
  type: CheckoutEvents.SessionLockFailed;
54
82
  };
55
- export declare type ActivePaymentProductType = {
83
+ export type ActivePaymentProductType = {
56
84
  type: CheckoutEvents.ActivePaymentProductType;
57
85
  payment_product_type: string | undefined;
58
86
  };
59
- export declare type ValidateSession = {
87
+ export type ValidateSession = {
60
88
  type: CheckoutEvents.ValidateSession;
61
89
  session: Session;
62
90
  callback: (result: SessionValidationCallback) => void;
@@ -65,12 +93,12 @@ export interface SessionValidationCallback {
65
93
  success: boolean;
66
94
  clientValidationError?: string;
67
95
  }
68
- export declare type WrappedValidateSession = Pick<ValidateSession, "type" | "session">;
69
- export declare type WrappedSessionLocked = Pick<SessionLocked, "type" | "pay_lock_id">;
70
- export declare type SessionPayment = SessionPaymentAuthorized | SessionPaymentOnHold;
71
- export declare type SessionPaymentError = {
96
+ export type WrappedValidateSession = Pick<ValidateSession, "type" | "session">;
97
+ export type WrappedSessionLocked = Pick<SessionLocked, "type" | "pay_lock_id">;
98
+ export type SessionPayment = SessionPaymentAuthorized | SessionPaymentOnHold;
99
+ export type SessionPaymentError = {
72
100
  type: CheckoutEvents.SessionPaymentError;
73
101
  error: string;
74
102
  href: string;
75
103
  };
76
- export declare type SessionEvent = SessionNotFound | SessionLoaded | SessionUpdated | SessionCancel | SessionPaymentOnHold | SessionPaymentAuthorized | SessionPaymentError | WrappedSessionLocked | SessionLockFailed | ActivePaymentProductType | WrappedValidateSession;
104
+ export type SessionEvent = SessionNotFound | SessionLoaded | SessionUpdated | SessionCancel | SessionPaymentOnHold | SessionPaymentAuthorized | SessionPaymentError | WrappedSessionLocked | SessionLockFailed | ActivePaymentProductType | WrappedValidateSession;
@@ -1,5 +1,7 @@
1
1
  import "native-promise-only";
2
- import { SessionNotFound, SessionLoaded, SessionUpdated, SessionCancel, SessionPaymentOnHold, SessionPaymentAuthorized, SessionPaymentError, SessionLocked, SessionLockFailed, ActivePaymentProductType, ValidateSession, SessionValidationCallback, SessionEvent } from "./checkout.js";
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";
3
5
  export interface DinteroCheckoutInstance {
4
6
  /**
5
7
  * Remove iframe and all event listeners.
@@ -11,6 +13,16 @@ export interface DinteroCheckoutInstance {
11
13
  refreshSession: () => Promise<SessionEvent>;
12
14
  setActivePaymentProductType: (paymentProductType: string) => void;
13
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;
14
26
  }
15
27
  export interface DinteroCheckoutOptions {
16
28
  sid: string;
@@ -19,6 +31,7 @@ export interface DinteroCheckoutOptions {
19
31
  }
20
32
  export interface DinteroEmbedCheckoutOptions extends DinteroCheckoutOptions {
21
33
  container: HTMLDivElement;
34
+ popOut?: boolean;
22
35
  onPayment?: (event: SessionPaymentAuthorized | SessionPaymentOnHold, checkout: DinteroCheckoutInstance) => void;
23
36
  /**
24
37
  * @deprecated Since version 0.0.1. Will be deleted in version 1.0.0. Use onPayment instead.
@@ -33,6 +46,9 @@ export interface DinteroEmbedCheckoutOptions extends DinteroCheckoutOptions {
33
46
  onActivePaymentType?: (event: ActivePaymentProductType, checkout: DinteroCheckoutInstance) => void;
34
47
  onValidateSession?: (event: ValidateSession, checkout: DinteroCheckoutInstance, callback: (result: SessionValidationCallback) => void) => void;
35
48
  }
49
+ interface InternalDinteroEmbedCheckoutOptions extends DinteroEmbedCheckoutOptions {
50
+ innerContainer: HTMLDivElement;
51
+ }
36
52
  /**
37
53
  * Show a dintero payment session in an embedded iframe.
38
54
  */
@@ -25,7 +25,7 @@ export interface Address {
25
25
  * example:
26
26
  * NO
27
27
  */
28
- country: string; // iso-3166-1
28
+ country: string;
29
29
  }
30
30
  export interface Store {
31
31
  /**
@@ -80,7 +80,7 @@ export interface Store {
80
80
  * example:
81
81
  * 5814
82
82
  */
83
- mcc?: string; // iso-18245
83
+ mcc?: string;
84
84
  /**
85
85
  * Merchant number associated with the stores
86
86
  * payment terminal
@@ -120,7 +120,7 @@ export interface ShippingOption {
120
120
  /**
121
121
  * Countries where this shipping option can be used
122
122
  */
123
- countries?: string /* iso3166-alpha2 */[];
123
+ countries?: string[];
124
124
  /**
125
125
  * The monetary amount of the shipping option
126
126
  *
@@ -184,12 +184,12 @@ export interface ShippingOption {
184
184
  * example:
185
185
  * 2020-10-14T19:00:00Z
186
186
  */
187
- starts_at?: string; // date-time
187
+ starts_at?: string;
188
188
  /**
189
189
  * example:
190
190
  * 2020-10-14T20:00:00Z
191
191
  */
192
- ends_at?: string; // date-time
192
+ ends_at?: string;
193
193
  };
194
194
  /**
195
195
  * A specified time for delivery to customer
@@ -199,12 +199,12 @@ export interface ShippingOption {
199
199
  * example:
200
200
  * 2020-10-14T19:00:00Z
201
201
  */
202
- starts_at?: string; // date-time
202
+ starts_at?: string;
203
203
  /**
204
204
  * example:
205
205
  * 2020-10-14T20:00:00Z
206
206
  */
207
- ends_at?: string; // date-time
207
+ ends_at?: string;
208
208
  };
209
209
  /**
210
210
  * Address
@@ -254,13 +254,13 @@ export interface ShippingOption {
254
254
  * example:
255
255
  * NO
256
256
  */
257
- country?: string; // iso3166-alpha2
257
+ country?: string;
258
258
  /**
259
259
  * mobile number of a person / company, ITU/E.123 format with
260
260
  * international prefix (+PPNNNNNNNNN...)
261
261
  *
262
262
  */
263
- phone_number?: string; // ^\+?\d{5,15}$
263
+ phone_number?: string;
264
264
  /**
265
265
  * The email address of a person or an organization
266
266
  *
@@ -328,13 +328,13 @@ export interface OrderAddress {
328
328
  * example:
329
329
  * NO
330
330
  */
331
- country?: string; // iso3166-alpha2
331
+ country?: string;
332
332
  /**
333
333
  * mobile number of a person / company, ITU/E.123 format with
334
334
  * international prefix (+PPNNNNNNNNN...)
335
335
  *
336
336
  */
337
- phone_number?: string; // ^\+?\d{5,15}$
337
+ phone_number?: string;
338
338
  /**
339
339
  * The email address of a person or an organization
340
340
  *
@@ -363,14 +363,7 @@ export interface DiscountItem {
363
363
  * 10
364
364
  */
365
365
  percentage?: number;
366
- discount_type?:
367
- | "customer"
368
- | "periodic"
369
- | "manual"
370
- | "loyalty"
371
- | "total"
372
- | "employee"
373
- | "external";
366
+ discount_type?: "customer" | "periodic" | "manual" | "loyalty" | "total" | "employee" | "external";
374
367
  /**
375
368
  * example:
376
369
  * 766da0ef-9283-42bd-b012-0582344ec53c
@@ -541,7 +534,7 @@ export interface Session {
541
534
  * example:
542
535
  * https://example.com/accept
543
536
  */
544
- return_url: string; // uri https?://*
537
+ return_url: string;
545
538
  /**
546
539
  * URL that Checkout will call when the session
547
540
  * payment is complete and the transaction has been authorized/captured.
@@ -580,7 +573,7 @@ export interface Session {
580
573
  * example:
581
574
  * https://example.com/callback
582
575
  */
583
- callback_url?: string; // uri https?://*
576
+ callback_url?: string;
584
577
  };
585
578
  customer?: {
586
579
  /**
@@ -625,7 +618,7 @@ export interface Session {
625
618
  * example:
626
619
  * NOK
627
620
  */
628
- currency: string; // iso4217-code
621
+ currency: string;
629
622
  /**
630
623
  * A reference by the merchant to identify the corresponding
631
624
  * order for the Checkout Session
@@ -773,7 +766,7 @@ export interface Session {
773
766
  * Checkout page wouldn't be available
774
767
  *
775
768
  */
776
- expires_at?: string; // date-time
769
+ expires_at?: string;
777
770
  /**
778
771
  * ### Present only for _Express Checkout_ sessions.
779
772
  *
@@ -859,7 +852,7 @@ export interface Session {
859
852
  * example:
860
853
  * https://example.com/order/00128110/address_updated
861
854
  */
862
- shipping_address_callback_url?: string; // uri https?://*
855
+ shipping_address_callback_url?: string;
863
856
  /**
864
857
  * Shipping options that will be presented to the end user after the
865
858
  * end user has submitted a shipping address.
@@ -902,15 +895,7 @@ export interface Session {
902
895
  * loading the checkout window. The value must be an enabled payment type.
903
896
  *
904
897
  */
905
- default_payment_type?:
906
- | "instabank.finance"
907
- | "instabank.invoice"
908
- | "vipps"
909
- | "payex.creditcard"
910
- | "payex.swish"
911
- | "collector.finance"
912
- | "collector.invoice"
913
- | "santander.debit_account";
898
+ default_payment_type?: "instabank.finance" | "instabank.invoice" | "vipps" | "payex.creditcard" | "payex.swish" | "collector.finance" | "collector.invoice" | "santander.debit_account";
914
899
  instabank?: InstabankConfiguration;
915
900
  payex?: PayExConfiguration;
916
901
  vipps?: VippsConfiguration;
@@ -944,10 +929,9 @@ export interface Session {
944
929
  /**
945
930
  * Time when the Checkout was created
946
931
  */
947
- created_at?: string; // date-time
932
+ created_at?: string;
948
933
  /**
949
934
  * Last time when the Checkout was updated
950
935
  */
951
-
952
936
  transaction_id?: string;
953
937
  }