@schematichq/schematic-components 2.18.0 → 2.19.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.
- package/README.md +26 -0
- package/dist/schematic-components.browser.cjs.js +28708 -0
- package/dist/schematic-components.browser.esm.js +28736 -0
- package/dist/schematic-components.cjs.js +3593 -3147
- package/dist/schematic-components.d.ts +110 -1
- package/dist/schematic-components.esm.js +632 -439
- package/package.json +33 -12
package/README.md
CHANGED
|
@@ -79,6 +79,32 @@ the final checkout step with the quantities already set.
|
|
|
79
79
|
The Plans and Add-ons available to the checkout flows must be live in your
|
|
80
80
|
Schematic account [Catalog configuration](https://docs.schematichq.com/catalog/overview).
|
|
81
81
|
|
|
82
|
+
## Programmatic Unsubscribe
|
|
83
|
+
|
|
84
|
+
We provide a function `requestUnsubscribe` for starting the unsubscribe flow
|
|
85
|
+
from your own UI, without using the built-in `UnsubscribeButton`. Like
|
|
86
|
+
`initializeWithPlan`, it's suitable for click handlers and must be extracted
|
|
87
|
+
from the library's embedded context.
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const { requestUnsubscribe } = useEmbed();
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
This lets developers create their own button — for example, a custom
|
|
94
|
+
"are you sure?" retention flow — that hands off to the same unsubscribe
|
|
95
|
+
experience the built-in component uses.
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
requestUnsubscribe();
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The function takes no arguments. If there is no active subscription to cancel,
|
|
102
|
+
the request is ignored and a warning is logged to the console.
|
|
103
|
+
|
|
104
|
+
The unsubscribe flow is rendered by the embed itself, so a Schematic embed (the
|
|
105
|
+
`Viewport` that hosts it) must be mounted on the page where you call
|
|
106
|
+
`requestUnsubscribe`. This is the same requirement as `initializeWithPlan`.
|
|
107
|
+
|
|
82
108
|
## License
|
|
83
109
|
|
|
84
110
|
MIT
|