@openreceive/elements 0.1.1 → 0.2.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 ADDED
@@ -0,0 +1,35 @@
1
+ # @openreceive/elements
2
+
3
+ The OpenReceive checkout custom element (`<openreceive-checkout>`) and theme toggle (`<openreceive-theme-toggle>`).
4
+
5
+ ## Mount
6
+
7
+ ```js
8
+ import { defineElements } from "@openreceive/elements";
9
+ import "@openreceive/elements/styles.css";
10
+
11
+ // Registers <openreceive-checkout> and <openreceive-theme-toggle> with the
12
+ // browser. Until this runs, those tags are unknown markup and render as
13
+ // nothing; once it runs, every such tag on the page — already in the HTML or
14
+ // added later — becomes the live checkout UI. Call once per page.
15
+ defineElements();
16
+ ```
17
+
18
+ ```html
19
+ <openreceive-checkout reference="order-123"></openreceive-checkout>
20
+ ```
21
+
22
+ The element creates the checkout for `reference`, then renders and polls itself.
23
+ It dispatches plain DOM `CustomEvent`s (`openreceive-settled`,
24
+ `openreceive-error`, …); the Vue/Svelte/Angular wrapper packages expose those as
25
+ handler props over the shared binding at
26
+ `@openreceive/elements/wrapper-shared`.
27
+
28
+ ## Icon assets
29
+
30
+ The checkout loads its payment-method icons by URL at runtime; your app must
31
+ serve them where the resolution lands. See
32
+ [Icon assets in `@openreceive/browser`](https://github.com/openreceive/openreceive/blob/master/packages/js/browser/README.md#icon-assets)
33
+ for the per-bundler recipes.
34
+
35
+ Part of [OpenReceive](https://openreceive.org). Start with the [Node quickstart](https://github.com/openreceive/openreceive/blob/master/docs/guides/quickstart-node.md); the full API is in the [API reference](https://github.com/openreceive/openreceive/blob/master/docs/guides/api-reference.md).