nuxt-openreceive 0.1.0 → 0.1.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 CHANGED
@@ -12,7 +12,7 @@ OpenReceive doesn't ship a Nuxt package. Its docs have you copy a server route,
12
12
  - manages a `pg` pool for you, or takes your own handle, Supabase, or a custom repository
13
13
  - gives `authorize` a typed `event: H3Event`, so it can read your existing session
14
14
  - turns on per-IP rate limiting with `getRequestIP` wired in
15
- - registers `<OpenReceiveCheckout>` globally with the prefix already filled in, and handles CSS, `build.transpile` and Vite pre-bundling for the raw SFC
15
+ - registers `<OpenReceiveCheckout>` globally with the prefix already filled in, ships it pre-compiled, and handles the CSS and Vite pre-bundling
16
16
  - stops the build on edge presets, since the wallet client and SQL driver need Node
17
17
  - closes the wallet connection and the pool when Nitro shuts down
18
18
 
@@ -161,6 +161,8 @@ DATABASE_URL=postgres://... OPENRECEIVE_TEST_WALLET=1 pnpm dev # playground on
161
161
  DATABASE_URL=postgres://... pnpm test # builds the playground and runs a full payment e2e
162
162
  ```
163
163
 
164
+ After bumping `@openreceive/vue`, run `pnpm compile:checkout`. The module ships its `Checkout.vue` pre-compiled to JS, so apps never compile a third-party SFC or resolve its prop types (CI fails if the file is stale).
165
+
164
166
  `OPENRECEIVE_TEST_WALLET=1` swaps in a fake receive-only wallet, so you can run the whole flow without a real NWC code. It is **playground only**. `POST /api/dev/settle/:hash` marks an invoice paid.
165
167
 
166
168
  Known noise: the Vite build prints `postcss` "Lexical error" warnings for `mod()` / `round()` in OpenReceive's stylesheet. These are harmless: the CSS is valid and works in browsers.
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.13.0"
6
6
  },
7
- "version": "0.1.0",
7
+ "version": "0.1.2",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.3",
10
10
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -81,17 +81,9 @@ const module$1 = defineNuxtModule({
81
81
  `}`
82
82
  ].join("\n")
83
83
  }, { nitro: true, nuxt: true });
84
- nuxt.options.build.transpile.push("@openreceive/vue");
84
+ const direct = nuxt.options.modulesDir.some((dir) => existsSync(`${dir}/@openreceive/vue/package.json`));
85
85
  nuxt.options.vite.optimizeDeps = defu(nuxt.options.vite.optimizeDeps, {
86
- exclude: ["@openreceive/vue"],
87
- // Vite pre-bundles by exact specifier, so list the subpaths the raw SFC
88
- // reaches. This also converts the CommonJS `qrcode` dependency for dev.
89
- include: [
90
- "@openreceive/vue > @openreceive/elements",
91
- "@openreceive/vue > @openreceive/elements/wrapper-shared",
92
- "@openreceive/vue > @openreceive/browser",
93
- "@openreceive/vue > @openreceive/browser/headless"
94
- ]
86
+ include: [direct ? "@openreceive/vue" : "nuxt-openreceive > @openreceive/vue"]
95
87
  });
96
88
  if (options.css) {
97
89
  nuxt.options.css.push("@openreceive/vue/styles.css");
@@ -1,4 +1,4 @@
1
1
  import { type DefineComponent } from 'vue';
2
- import { type VueCheckoutProps } from '@openreceive/vue/checkout.vue';
3
- declare const _default: DefineComponent<VueCheckoutProps>;
2
+ import type { WrapperCheckoutComponentProps } from '@openreceive/vue';
3
+ declare const _default: DefineComponent<WrapperCheckoutComponentProps>;
4
4
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, h } from "vue";
2
- import Checkout from "@openreceive/vue/checkout.vue";
3
2
  import { useRuntimeConfig } from "#imports";
3
+ import Checkout from "./checkout.generated.js";
4
4
  const OpenReceiveCheckout = defineComponent({
5
5
  name: "OpenReceiveCheckout",
6
6
  inheritAttrs: false,
@@ -0,0 +1,5 @@
1
+ import type { DefineComponent } from 'vue'
2
+ import type { WrapperCheckoutComponentProps } from '@openreceive/vue'
3
+
4
+ declare const Checkout: DefineComponent<WrapperCheckoutComponentProps>
5
+ export default Checkout
@@ -0,0 +1,98 @@
1
+ // GENERATED by scripts/compile-checkout.mjs from @openreceive/vue@0.4.31 Checkout.vue. Do not edit.
2
+ // @ts-nocheck
3
+ /* eslint-disable */
4
+ import { defineComponent as _defineComponent } from 'vue';
5
+ import { resolveDynamicComponent as _resolveDynamicComponent, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, openBlock as _openBlock, createBlock as _createBlock, mergeProps as _mergeProps, createCommentVNode as _createCommentVNode, toHandlers as _toHandlers, createElementBlock as _createElementBlock } from "vue";
6
+ import { computed, onMounted, ref } from "vue";
7
+ import { createWrapperCheckoutShellBinding, defineElements, validateCheckoutProps, } from "@openreceive/vue";
8
+ export default _defineComponent({
9
+ ...{
10
+ name: "Checkout",
11
+ },
12
+ __name: 'Checkout',
13
+ props: {
14
+ options: { default: () => ({}) },
15
+ checkout: {},
16
+ reference: {},
17
+ prefix: {},
18
+ csrfHeader: {},
19
+ paymentWizard: { type: Boolean, default: undefined },
20
+ decodeLinkUrl: {},
21
+ themeToggle: { type: Boolean, default: undefined },
22
+ defaultTheme: {},
23
+ storageKey: {},
24
+ metadata: {},
25
+ syncUrl: { type: Boolean, default: undefined },
26
+ resumePathPrefix: {},
27
+ routeReference: {},
28
+ resumePaymentHash: { default: undefined },
29
+ resumePaymentRail: { default: undefined },
30
+ resumable: { type: Boolean, default: undefined },
31
+ onCopy: {},
32
+ onOpenWallet: {},
33
+ onState: {},
34
+ onSettled: {},
35
+ onProviderCopy: {},
36
+ onStartOver: {},
37
+ onError: {}
38
+ },
39
+ setup(__props) {
40
+ const props = __props;
41
+ const mounted = ref(false);
42
+ onMounted(() => {
43
+ mounted.value = true;
44
+ defineElements();
45
+ });
46
+ const shell = computed(() => {
47
+ validateCheckoutProps({
48
+ framework: "@openreceive/vue",
49
+ checkout: props.checkout,
50
+ reference: props.reference,
51
+ metadata: props.metadata,
52
+ syncUrl: props.syncUrl,
53
+ resumePathPrefix: props.resumePathPrefix,
54
+ routeReference: props.routeReference,
55
+ resumePaymentHash: props.resumePaymentHash,
56
+ resumePaymentRail: props.resumePaymentRail,
57
+ });
58
+ return createWrapperCheckoutShellBinding(props.checkout ?? null, {
59
+ ...props.options,
60
+ themeToggle: props.themeToggle ?? props.options.themeToggle ?? true,
61
+ deferThemeResolution: !mounted.value,
62
+ ...(props.reference === undefined ? {} : { reference: props.reference }),
63
+ ...(props.prefix === undefined ? {} : { prefix: props.prefix }),
64
+ ...(props.csrfHeader === undefined ? {} : { csrfHeader: props.csrfHeader }),
65
+ ...(props.paymentWizard === undefined ? {} : { paymentWizard: props.paymentWizard }),
66
+ ...(props.decodeLinkUrl === undefined ? {} : { decodeLinkUrl: props.decodeLinkUrl }),
67
+ ...(props.defaultTheme === undefined ? {} : { defaultTheme: props.defaultTheme }),
68
+ ...(props.storageKey === undefined ? {} : { storageKey: props.storageKey }),
69
+ ...(props.metadata === undefined ? {} : { metadata: props.metadata }),
70
+ ...(props.syncUrl === undefined ? {} : { syncUrl: props.syncUrl }),
71
+ ...(props.resumePathPrefix === undefined ? {} : { resumePathPrefix: props.resumePathPrefix }),
72
+ ...(props.routeReference === undefined ? {} : { routeReference: props.routeReference }),
73
+ ...(props.resumePaymentHash === undefined
74
+ ? {}
75
+ : { resumePaymentHash: props.resumePaymentHash }),
76
+ ...(props.resumePaymentRail === undefined
77
+ ? {}
78
+ : { resumePaymentRail: props.resumePaymentRail }),
79
+ ...(props.resumable === undefined ? {} : { resumable: props.resumable }),
80
+ ...(props.onCopy === undefined ? {} : { onCopy: props.onCopy }),
81
+ ...(props.onOpenWallet === undefined ? {} : { onOpenWallet: props.onOpenWallet }),
82
+ ...(props.onState === undefined ? {} : { onState: props.onState }),
83
+ ...(props.onSettled === undefined ? {} : { onSettled: props.onSettled }),
84
+ ...(props.onProviderCopy === undefined ? {} : { onProviderCopy: props.onProviderCopy }),
85
+ ...(props.onStartOver === undefined ? {} : { onStartOver: props.onStartOver }),
86
+ ...(props.onError === undefined ? {} : { onError: props.onError }),
87
+ });
88
+ });
89
+ return (_ctx, _cache) => {
90
+ return (_openBlock(), _createElementBlock("section", _normalizeProps(_guardReactiveProps(shell.value.rootAttributes)), [
91
+ (shell.value.themeToggle)
92
+ ? (_openBlock(), _createBlock(_resolveDynamicComponent(shell.value.themeToggle.tagName), _normalizeProps(_mergeProps({ key: 0 }, shell.value.themeToggle.attributes)), null, 16))
93
+ : _createCommentVNode("v-if", true),
94
+ (_openBlock(), _createBlock(_resolveDynamicComponent(shell.value.checkout.tagName), _mergeProps(shell.value.checkout.attributes, _toHandlers(shell.value.checkout.listeners)), null, 16))
95
+ ], 16));
96
+ };
97
+ }
98
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-openreceive",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Nuxt module for OpenReceive: Bitcoin Lightning (and optional USDT/USDC/ETH/SOL swap) checkout that settles straight into your own wallet.",
5
5
  "license": "MIT",
6
6
  "author": "Grygorii Liashenko (https://github.com/frontender-ua)",
@@ -47,7 +47,7 @@
47
47
  "@nuxt/kit": "^4.2.0",
48
48
  "@openreceive/http": "^0.4.31",
49
49
  "@openreceive/node": "^0.4.31",
50
- "@openreceive/vue": "^0.4.31",
50
+ "@openreceive/vue": "0.4.31",
51
51
  "defu": "^6.1.4",
52
52
  "h3": "^1.15.0"
53
53
  },
@@ -64,12 +64,14 @@
64
64
  "@nuxt/schema": "^4.6.4",
65
65
  "@types/node": "^22.10.0",
66
66
  "@types/pg": "^8.11.10",
67
+ "@vue/compiler-sfc": "3.5.45",
67
68
  "nuxt": "^4.6.4",
68
69
  "pg": "^8.23.1",
69
70
  "typescript": "~5.9.3",
70
71
  "vue-tsc": "^3.3.14"
71
72
  },
72
73
  "scripts": {
74
+ "compile:checkout": "node scripts/compile-checkout.mjs",
73
75
  "build": "nuxt-module-build build",
74
76
  "dev": "nuxi dev playground",
75
77
  "dev:build": "nuxi build playground",