@inttegro/svelte 0.4.0 → 0.5.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/README.md +3 -2
- package/dist/Checkout.svelte +7 -2
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +7 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -12,8 +12,9 @@ does not bundle the payment-collection runtime.
|
|
|
12
12
|
<Checkout {orderId} onCompleted={() => location.assign('/complete')} />
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
For a
|
|
16
|
-
|
|
15
|
+
For a Buy link, pass `purchaseIntentId` instead of `orderId`. Fixed pricing
|
|
16
|
+
continues directly to payment; customer-selected pricing renders the amount
|
|
17
|
+
picker first. This works in both embedded and modal presentations:
|
|
17
18
|
|
|
18
19
|
```svelte
|
|
19
20
|
<Checkout {purchaseIntentId} presentation="modal" />
|
package/dist/Checkout.svelte
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
locale,
|
|
17
17
|
onCanceled,
|
|
18
18
|
onCompleted,
|
|
19
|
+
onFailed,
|
|
19
20
|
onError,
|
|
20
21
|
onEvent,
|
|
21
22
|
onReady,
|
|
@@ -57,6 +58,7 @@
|
|
|
57
58
|
|
|
58
59
|
let active = true
|
|
59
60
|
let canceled = false
|
|
61
|
+
let failed = false
|
|
60
62
|
let instance: CheckoutController | undefined
|
|
61
63
|
let unsubscribe: (() => void) | undefined
|
|
62
64
|
|
|
@@ -87,13 +89,16 @@
|
|
|
87
89
|
}
|
|
88
90
|
if (event.type === 'ready') onReady?.(event)
|
|
89
91
|
if (event.type === 'completed') onCompleted?.(event)
|
|
90
|
-
if (event.type === '
|
|
92
|
+
if (event.type === 'failed') {
|
|
93
|
+
failed = true
|
|
94
|
+
onFailed?.(event)
|
|
95
|
+
}
|
|
91
96
|
})
|
|
92
97
|
if (identity.presentation === 'modal') await instance.present()
|
|
93
98
|
else await instance.mount(container)
|
|
94
99
|
})
|
|
95
100
|
.catch((error: unknown) => {
|
|
96
|
-
if (active && !canceled) {
|
|
101
|
+
if (active && !canceled && !failed) {
|
|
97
102
|
onError?.(
|
|
98
103
|
error instanceof Error
|
|
99
104
|
? error
|
package/dist/index.d.ts
CHANGED
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
*/
|
|
26
26
|
export { default as Checkout } from './Checkout.svelte';
|
|
27
27
|
export type { CheckoutProps, CheckoutPropsBase } from './types';
|
|
28
|
-
export type { CheckoutAppearance,
|
|
28
|
+
export type { CheckoutAppearance, CheckoutEvent, CheckoutFailedEvent, CheckoutOrder, CheckoutFeatures, CheckoutPresentation, CheckoutTheme, } from '@inttegro/js';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CheckoutAppearance,
|
|
1
|
+
import type { CheckoutAppearance, CheckoutEvent, CheckoutFeatures, CheckoutPresentation } from '@inttegro/js';
|
|
2
2
|
/**
|
|
3
3
|
* Props accepted by the Inttegro {@link Checkout} component.
|
|
4
4
|
*
|
|
@@ -29,8 +29,12 @@ export interface CheckoutPropsBase {
|
|
|
29
29
|
onCompleted?: ((event: Extract<CheckoutEvent, {
|
|
30
30
|
type: 'completed';
|
|
31
31
|
}>) => void) | undefined;
|
|
32
|
-
/** Called
|
|
33
|
-
|
|
32
|
+
/** Called when Checkout reaches a terminal failure state. */
|
|
33
|
+
onFailed?: ((event: Extract<CheckoutEvent, {
|
|
34
|
+
type: 'failed';
|
|
35
|
+
}>) => void) | undefined;
|
|
36
|
+
/** Called for loader or mount failures. */
|
|
37
|
+
onError?: ((error: Error) => void) | undefined;
|
|
34
38
|
/** Called for every sanitized lifecycle event. */
|
|
35
39
|
onEvent?: ((event: CheckoutEvent) => void) | undefined;
|
|
36
40
|
/** Called once Checkout is initialized and interactive. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inttegro/svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Svelte components for Inttegro hosted workflows",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"svelte": "./dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"typecheck": "svelte-check --tsconfig ./tsconfig.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@inttegro/js": "0.
|
|
29
|
+
"@inttegro/js": "0.5.2"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"svelte": ">=5"
|