@nextblock-cms/ecom 0.12.6 → 0.12.8

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),f=require("react"),r=require("@nextblock-cms/ui"),u=require("lucide-react"),y=require("react-dom");function v({initialEnabledProviders:s,configStatus:t,credentials:i,saveAction:a,saveCredentialsAction:l}){const[d,m]=f.useState(s),c=t?.stripe?.hasKeys,o=t?.freemius?.hasKeys;return e.jsxs("div",{className:"space-y-6 max-w-3xl p-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Payment Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your provider API keys, then enable the providers your store needs. Physical products use Stripe and digital products use Freemius."})]}),e.jsx(g,{credentials:i,saveAction:l}),e.jsxs("form",{action:a,className:"space-y-6",children:[e.jsx("input",{type:"hidden",name:"stripe_enabled",value:d.stripe?"true":"false"}),e.jsx("input",{type:"hidden",name:"freemius_enabled",value:d.freemius?"true":"false"}),e.jsxs(r.Card,{children:[e.jsxs(r.CardHeader,{children:[e.jsx(r.CardTitle,{children:"Payment Providers"}),e.jsx(r.CardDescription,{children:"You can run both providers at the same time. Each product picks its provider from its product type."})]}),e.jsxs(r.CardContent,{className:"space-y-6",children:[e.jsx(x,{id:"stripe-enabled",label:"Stripe for Physical Products",description:"Use Stripe Checkout for physical merchandise and other shippable goods.",checked:d.stripe,disabled:!c,onCheckedChange:h=>m(p=>({...p,stripe:h})),ready:c,children:c?e.jsxs("div",{className:"mt-2 text-sm text-green-600 flex items-center gap-2",children:[e.jsx(u.CheckCircle2,{className:"w-4 h-4"}),e.jsx("span",{children:"Ready to process physical product checkout"})]}):e.jsx(j,{provider:"Stripe",missingKeys:t.stripe.missing,docsUrl:"https://dashboard.stripe.com/apikeys",docsLabel:"Stripe Dashboard -> Developers -> API Keys"})}),e.jsx(x,{id:"freemius-enabled",label:"Freemius for Digital Products",description:"Use Freemius for software licenses, SaaS plans, and other digital products.",checked:d.freemius,disabled:!o,onCheckedChange:h=>m(p=>({...p,freemius:h})),ready:o,children:o?e.jsxs("div",{className:"mt-2 text-sm text-green-600 flex items-center gap-2",children:[e.jsx(u.CheckCircle2,{className:"w-4 h-4"}),e.jsx("span",{children:"Ready to process digital product checkout"})]}):e.jsx(j,{provider:"Freemius",missingKeys:t.freemius.missing,docsUrl:"https://dashboard.freemius.com/",docsLabel:"Freemius Dashboard -> Developers -> Credentials"})}),e.jsx("div",{className:"flex justify-end pt-4",children:e.jsx(b,{})})]})]})]})]})}function b(){const{pending:s}=y.useFormStatus();return e.jsx(r.Button,{type:"submit",disabled:s,children:s?"Saving...":"Save Changes"})}function n({id:s,label:t,type:i="text",defaultValue:a,placeholder:l,hint:d}){return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(r.Label,{htmlFor:s,children:t}),e.jsx(r.Input,{id:s,name:s,type:i,defaultValue:a,placeholder:l,autoComplete:i==="password"?"new-password":"off"}),d&&e.jsx("p",{className:"text-xs text-muted-foreground",children:d})]})}function g({credentials:s,saveAction:t}){const i="•••••••• (stored — leave blank to keep)";return e.jsxs(r.Card,{children:[e.jsxs(r.CardHeader,{children:[e.jsx(r.CardTitle,{children:"Provider API Keys"}),e.jsxs(r.CardDescription,{children:["Keys are encrypted at rest and used DB-first (these override any ",e.jsx("code",{children:".env"})," ","values). Leave a secret blank to keep the stored value."]})]}),e.jsx(r.CardContent,{children:e.jsxs("form",{action:t,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Stripe (physical products)"}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(n,{id:"stripe_publishableKey",label:"Publishable key",defaultValue:s.stripe.publishableKey,placeholder:"pk_live_…"}),e.jsx(n,{id:"stripe_secretKey",label:"Secret key",type:"password",placeholder:s.stripe.hasSecretKey?i:"sk_live_…"}),e.jsx(n,{id:"stripe_webhookSecret",label:"Webhook signing secret",type:"password",placeholder:s.stripe.hasWebhookSecret?i:"whsec_…"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Freemius (digital products)"}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(n,{id:"freemius_developerId",label:"Developer ID",defaultValue:s.freemius.developerId}),e.jsx(n,{id:"freemius_productId",label:"Product ID",defaultValue:s.freemius.productId}),e.jsx(n,{id:"freemius_publicKey",label:"Public key",defaultValue:s.freemius.publicKey,placeholder:"pk_…"}),e.jsx(n,{id:"freemius_secretKey",label:"Secret key",type:"password",placeholder:s.freemius.hasSecretKey?i:"sk_…"}),e.jsx(n,{id:"freemius_apiKey",label:"API key",type:"password",placeholder:s.freemius.hasApiKey?i:"API key"})]})]}),s.envFallbackActive&&e.jsx("p",{className:"text-xs text-amber-700",children:"Stripe keys are currently read from environment variables. Saving here moves them into the database and takes precedence."}),e.jsx("div",{className:"flex justify-end",children:e.jsx(b,{})})]})})]})}function x({id:s,label:t,description:i,checked:a,disabled:l,ready:d,onCheckedChange:m,children:c}){return e.jsx("div",{className:"rounded-md border p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(r.Checkbox,{id:s,checked:a,disabled:l,onCheckedChange:o=>m(!!o),className:"mt-1"}),e.jsxs("div",{className:"grid gap-1.5 leading-none w-full",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsx(r.Label,{htmlFor:s,className:"font-semibold text-base cursor-pointer",children:t}),e.jsx("span",{className:`text-xs font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:a?"Enabled":"Disabled"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i}),!d&&e.jsx("p",{className:"text-xs text-amber-700",children:"This provider cannot be enabled until all required environment variables are present."}),c]})]})})}function j({provider:s,missingKeys:t,docsUrl:i,docsLabel:a}){return e.jsxs("div",{className:"mt-3 text-sm p-4 rounded-md border border-destructive/20 bg-destructive/5 text-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold text-destructive mb-2",children:[e.jsx(u.AlertCircle,{className:"w-4 h-4"}),e.jsx("span",{children:"Configuration Required"})]}),e.jsxs("p",{className:"mb-2",children:["The ",s," integration still needs the following:"]}),e.jsx("ul",{className:"list-disc list-inside bg-white/50 dark:bg-black/20 p-2 rounded mb-3 text-xs",children:t.map(l=>e.jsx("li",{children:l},l))}),e.jsx("p",{className:"mb-2",children:e.jsx("strong",{children:"How to fix:"})}),e.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-1 mb-3",children:[e.jsxs("li",{children:["Get your API keys from"," ",e.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium hover:text-destructive/80",children:a}),"."]}),e.jsxs("li",{children:["Enter them in the ",e.jsx("strong",{children:"Provider API Keys"})," section above and save."]}),e.jsx("li",{children:"This provider can then be enabled."})]})]})}exports.PaymentsClient=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("react"),r=require("@nextblock-cms/ui"),j=require("lucide-react"),g=require("react-dom");function k({initialEnabledProviders:s,configStatus:i,credentials:t,saveAction:a,saveCredentialsAction:l}){const[d,c]=b.useState(s),[o,h]=b.useState(s);(o.stripe!==s.stripe||o.freemius!==s.freemius)&&(h(s),c(s));const p=i?.stripe?.hasKeys,m=i?.freemius?.hasKeys;return e.jsxs("div",{className:"space-y-6 max-w-3xl p-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Payment Settings"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your provider API keys, then enable the providers your store needs. Physical products use Stripe and digital products use Freemius."})]}),e.jsx(N,{credentials:t,saveAction:l}),e.jsxs("form",{action:a,className:"space-y-6",children:[e.jsx("input",{type:"hidden",name:"stripe_enabled",value:d.stripe?"true":"false"}),e.jsx("input",{type:"hidden",name:"freemius_enabled",value:d.freemius?"true":"false"}),e.jsxs(r.Card,{children:[e.jsxs(r.CardHeader,{children:[e.jsx(r.CardTitle,{children:"Payment Providers"}),e.jsx(r.CardDescription,{children:"You can run both providers at the same time. Each product picks its provider from its product type."})]}),e.jsxs(r.CardContent,{className:"space-y-6",children:[e.jsx(f,{id:"stripe-enabled",label:"Stripe for Physical Products",description:"Use Stripe Checkout for physical merchandise and other shippable goods.",checked:d.stripe,disabled:!p,onCheckedChange:u=>c(x=>({...x,stripe:u})),ready:p,children:p?e.jsxs("div",{className:"mt-2 text-sm text-green-600 flex items-center gap-2",children:[e.jsx(j.CheckCircle2,{className:"w-4 h-4"}),e.jsx("span",{children:"Ready to process physical product checkout"})]}):e.jsx(y,{provider:"Stripe",missingKeys:i.stripe.missing,docsUrl:"https://dashboard.stripe.com/apikeys",docsLabel:"Stripe Dashboard -> Developers -> API Keys"})}),e.jsx(f,{id:"freemius-enabled",label:"Freemius for Digital Products",description:"Use Freemius for software licenses, SaaS plans, and other digital products.",checked:d.freemius,disabled:!m,onCheckedChange:u=>c(x=>({...x,freemius:u})),ready:m,children:m?e.jsxs("div",{className:"mt-2 text-sm text-green-600 flex items-center gap-2",children:[e.jsx(j.CheckCircle2,{className:"w-4 h-4"}),e.jsx("span",{children:"Ready to process digital product checkout"})]}):e.jsx(y,{provider:"Freemius",missingKeys:i.freemius.missing,docsUrl:"https://dashboard.freemius.com/",docsLabel:"Freemius Dashboard -> Developers -> Credentials"})}),e.jsx("div",{className:"flex justify-end pt-4",children:e.jsx(v,{})})]})]})]})]})}function v(){const{pending:s}=g.useFormStatus();return e.jsx(r.Button,{type:"submit",disabled:s,children:s?"Saving...":"Save Changes"})}function n({id:s,label:i,type:t="text",defaultValue:a,placeholder:l,hint:d}){return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(r.Label,{htmlFor:s,children:i}),e.jsx(r.Input,{id:s,name:s,type:t,defaultValue:a,placeholder:l,autoComplete:t==="password"?"new-password":"off"}),d&&e.jsx("p",{className:"text-xs text-muted-foreground",children:d})]})}function N({credentials:s,saveAction:i}){const t="•••••••• (stored — leave blank to keep)";return e.jsxs(r.Card,{children:[e.jsxs(r.CardHeader,{children:[e.jsx(r.CardTitle,{children:"Provider API Keys"}),e.jsxs(r.CardDescription,{children:["Keys are encrypted at rest and used DB-first (these override any ",e.jsx("code",{children:".env"})," ","values). Leave a secret blank to keep the stored value."]})]}),e.jsx(r.CardContent,{children:e.jsxs("form",{action:i,className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Stripe (physical products)"}),e.jsxs("div",{className:"rounded-md border border-dashed p-3 text-xs text-muted-foreground space-y-1.5",children:[e.jsxs("p",{children:["In the Stripe Dashboard (Developers → Webhooks → Add endpoint), set the endpoint URL to ",e.jsx("code",{children:"https://your-domain/api/webhooks/stripe"}),", then paste that endpoint's signing secret below."]}),e.jsxs("p",{children:["For local testing, forward events with the Stripe CLI:"," ",e.jsx("code",{children:"stripe listen --forward-to localhost:4200/api/webhooks/stripe"})," ","(or ",e.jsx("code",{children:"npm run stripe"}),"). Use the ",e.jsx("code",{children:"whsec_…"})," secret it prints on startup as the signing secret below — it differs from a Dashboard endpoint's."]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(n,{id:"stripe_publishableKey",label:"Publishable key",defaultValue:s.stripe.publishableKey,placeholder:"pk_live_…"}),e.jsx(n,{id:"stripe_secretKey",label:"Secret key",type:"password",placeholder:s.stripe.hasSecretKey?t:"sk_live_…"}),e.jsx(n,{id:"stripe_webhookSecret",label:"Webhook signing secret",type:"password",placeholder:s.stripe.hasWebhookSecret?t:"whsec_…"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Freemius (digital products)"}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(n,{id:"freemius_developerId",label:"Developer ID",defaultValue:s.freemius.developerId}),e.jsx(n,{id:"freemius_productId",label:"Product ID",defaultValue:s.freemius.productId}),e.jsx(n,{id:"freemius_publicKey",label:"Public key",defaultValue:s.freemius.publicKey,placeholder:"pk_…"}),e.jsx(n,{id:"freemius_secretKey",label:"Secret key",type:"password",placeholder:s.freemius.hasSecretKey?t:"sk_…"}),e.jsx(n,{id:"freemius_apiKey",label:"API key",type:"password",placeholder:s.freemius.hasApiKey?t:"API key"})]})]}),s.envFallbackActive&&e.jsx("p",{className:"text-xs text-amber-700",children:"Stripe keys are currently read from environment variables. Saving here moves them into the database and takes precedence."}),e.jsx("div",{className:"flex justify-end",children:e.jsx(v,{})})]})})]})}function f({id:s,label:i,description:t,checked:a,disabled:l,ready:d,onCheckedChange:c,children:o}){return e.jsx("div",{className:"rounded-md border p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(r.Checkbox,{id:s,checked:a,disabled:l,onCheckedChange:h=>c(!!h),className:"mt-1"}),e.jsxs("div",{className:"grid gap-1.5 leading-none w-full",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsx(r.Label,{htmlFor:s,className:"font-semibold text-base cursor-pointer",children:i}),e.jsx("span",{className:`text-xs font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:a?"Enabled":"Disabled"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t}),!d&&e.jsx("p",{className:"text-xs text-amber-700",children:"This provider cannot be enabled until all required environment variables are present."}),o]})]})})}function y({provider:s,missingKeys:i,docsUrl:t,docsLabel:a}){return e.jsxs("div",{className:"mt-3 text-sm p-4 rounded-md border border-destructive/20 bg-destructive/5 text-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold text-destructive mb-2",children:[e.jsx(j.AlertCircle,{className:"w-4 h-4"}),e.jsx("span",{children:"Configuration Required"})]}),e.jsxs("p",{className:"mb-2",children:["The ",s," integration still needs the following:"]}),e.jsx("ul",{className:"list-disc list-inside bg-white/50 dark:bg-black/20 p-2 rounded mb-3 text-xs",children:i.map(l=>e.jsx("li",{children:l},l))}),e.jsx("p",{className:"mb-2",children:e.jsx("strong",{children:"How to fix:"})}),e.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-1 mb-3",children:[e.jsxs("li",{children:["Get your API keys from"," ",e.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium hover:text-destructive/80",children:a}),"."]}),e.jsxs("li",{children:["Enter them in the ",e.jsx("strong",{children:"Provider API Keys"})," section above and save."]}),e.jsx("li",{children:"This provider can then be enabled."})]})]})}exports.PaymentsClient=k;
@@ -1,23 +1,25 @@
1
1
  'use client';
2
2
  import { jsxs as r, jsx as e } from "react/jsx-runtime";
3
- import { useState as P } from "react";
4
- import { Card as v, CardHeader as y, CardTitle as g, CardDescription as x, CardContent as N, Checkbox as w, Label as k, Button as S, Input as K } from "@nextblock-cms/ui";
5
- import { CheckCircle2 as u, AlertCircle as _ } from "lucide-react";
6
- import { useFormStatus as I } from "react-dom";
3
+ import { useState as b } from "react";
4
+ import { Card as x, CardHeader as N, CardTitle as k, CardDescription as w, CardContent as C, Checkbox as K, Label as S, Button as _, Input as I } from "@nextblock-cms/ui";
5
+ import { CheckCircle2 as y, AlertCircle as D } from "lucide-react";
6
+ import { useFormStatus as F } from "react-dom";
7
7
  function T({
8
8
  initialEnabledProviders: s,
9
- configStatus: t,
10
- credentials: i,
9
+ configStatus: i,
10
+ credentials: t,
11
11
  saveAction: a,
12
12
  saveCredentialsAction: l
13
13
  }) {
14
- const [d, m] = P(s), c = t?.stripe?.hasKeys, o = t?.freemius?.hasKeys;
14
+ const [d, o] = b(s), [c, p] = b(s);
15
+ (c.stripe !== s.stripe || c.freemius !== s.freemius) && (p(s), o(s));
16
+ const h = i?.stripe?.hasKeys, m = i?.freemius?.hasKeys;
15
17
  return /* @__PURE__ */ r("div", { className: "space-y-6 max-w-3xl p-8", children: [
16
18
  /* @__PURE__ */ r("div", { children: [
17
19
  /* @__PURE__ */ e("h1", { className: "text-3xl font-bold tracking-tight", children: "Payment Settings" }),
18
20
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "Enter your provider API keys, then enable the providers your store needs. Physical products use Stripe and digital products use Freemius." })
19
21
  ] }),
20
- /* @__PURE__ */ e(F, { credentials: i, saveAction: l }),
22
+ /* @__PURE__ */ e(A, { credentials: t, saveAction: l }),
21
23
  /* @__PURE__ */ r("form", { action: a, className: "space-y-6", children: [
22
24
  /* @__PURE__ */ e(
23
25
  "input",
@@ -35,33 +37,33 @@ function T({
35
37
  value: d.freemius ? "true" : "false"
36
38
  }
37
39
  ),
38
- /* @__PURE__ */ r(v, { children: [
39
- /* @__PURE__ */ r(y, { children: [
40
- /* @__PURE__ */ e(g, { children: "Payment Providers" }),
41
- /* @__PURE__ */ e(x, { children: "You can run both providers at the same time. Each product picks its provider from its product type." })
40
+ /* @__PURE__ */ r(x, { children: [
41
+ /* @__PURE__ */ r(N, { children: [
42
+ /* @__PURE__ */ e(k, { children: "Payment Providers" }),
43
+ /* @__PURE__ */ e(w, { children: "You can run both providers at the same time. Each product picks its provider from its product type." })
42
44
  ] }),
43
- /* @__PURE__ */ r(N, { className: "space-y-6", children: [
45
+ /* @__PURE__ */ r(C, { className: "space-y-6", children: [
44
46
  /* @__PURE__ */ e(
45
- b,
47
+ v,
46
48
  {
47
49
  id: "stripe-enabled",
48
50
  label: "Stripe for Physical Products",
49
51
  description: "Use Stripe Checkout for physical merchandise and other shippable goods.",
50
52
  checked: d.stripe,
51
- disabled: !c,
52
- onCheckedChange: (p) => m((h) => ({
53
- ...h,
54
- stripe: p
53
+ disabled: !h,
54
+ onCheckedChange: (u) => o((f) => ({
55
+ ...f,
56
+ stripe: u
55
57
  })),
56
- ready: c,
57
- children: c ? /* @__PURE__ */ r("div", { className: "mt-2 text-sm text-green-600 flex items-center gap-2", children: [
58
- /* @__PURE__ */ e(u, { className: "w-4 h-4" }),
58
+ ready: h,
59
+ children: h ? /* @__PURE__ */ r("div", { className: "mt-2 text-sm text-green-600 flex items-center gap-2", children: [
60
+ /* @__PURE__ */ e(y, { className: "w-4 h-4" }),
59
61
  /* @__PURE__ */ e("span", { children: "Ready to process physical product checkout" })
60
62
  ] }) : /* @__PURE__ */ e(
61
- f,
63
+ g,
62
64
  {
63
65
  provider: "Stripe",
64
- missingKeys: t.stripe.missing,
66
+ missingKeys: i.stripe.missing,
65
67
  docsUrl: "https://dashboard.stripe.com/apikeys",
66
68
  docsLabel: "Stripe Dashboard -> Developers -> API Keys"
67
69
  }
@@ -69,84 +71,102 @@ function T({
69
71
  }
70
72
  ),
71
73
  /* @__PURE__ */ e(
72
- b,
74
+ v,
73
75
  {
74
76
  id: "freemius-enabled",
75
77
  label: "Freemius for Digital Products",
76
78
  description: "Use Freemius for software licenses, SaaS plans, and other digital products.",
77
79
  checked: d.freemius,
78
- disabled: !o,
79
- onCheckedChange: (p) => m((h) => ({
80
- ...h,
81
- freemius: p
80
+ disabled: !m,
81
+ onCheckedChange: (u) => o((f) => ({
82
+ ...f,
83
+ freemius: u
82
84
  })),
83
- ready: o,
84
- children: o ? /* @__PURE__ */ r("div", { className: "mt-2 text-sm text-green-600 flex items-center gap-2", children: [
85
- /* @__PURE__ */ e(u, { className: "w-4 h-4" }),
85
+ ready: m,
86
+ children: m ? /* @__PURE__ */ r("div", { className: "mt-2 text-sm text-green-600 flex items-center gap-2", children: [
87
+ /* @__PURE__ */ e(y, { className: "w-4 h-4" }),
86
88
  /* @__PURE__ */ e("span", { children: "Ready to process digital product checkout" })
87
89
  ] }) : /* @__PURE__ */ e(
88
- f,
90
+ g,
89
91
  {
90
92
  provider: "Freemius",
91
- missingKeys: t.freemius.missing,
93
+ missingKeys: i.freemius.missing,
92
94
  docsUrl: "https://dashboard.freemius.com/",
93
95
  docsLabel: "Freemius Dashboard -> Developers -> Credentials"
94
96
  }
95
97
  )
96
98
  }
97
99
  ),
98
- /* @__PURE__ */ e("div", { className: "flex justify-end pt-4", children: /* @__PURE__ */ e(C, {}) })
100
+ /* @__PURE__ */ e("div", { className: "flex justify-end pt-4", children: /* @__PURE__ */ e(P, {}) })
99
101
  ] })
100
102
  ] })
101
103
  ] })
102
104
  ] });
103
105
  }
104
- function C() {
105
- const { pending: s } = I();
106
- return /* @__PURE__ */ e(S, { type: "submit", disabled: s, children: s ? "Saving..." : "Save Changes" });
106
+ function P() {
107
+ const { pending: s } = F();
108
+ return /* @__PURE__ */ e(_, { type: "submit", disabled: s, children: s ? "Saving..." : "Save Changes" });
107
109
  }
108
110
  function n({
109
111
  id: s,
110
- label: t,
111
- type: i = "text",
112
+ label: i,
113
+ type: t = "text",
112
114
  defaultValue: a,
113
115
  placeholder: l,
114
116
  hint: d
115
117
  }) {
116
118
  return /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
117
- /* @__PURE__ */ e(k, { htmlFor: s, children: t }),
119
+ /* @__PURE__ */ e(S, { htmlFor: s, children: i }),
118
120
  /* @__PURE__ */ e(
119
- K,
121
+ I,
120
122
  {
121
123
  id: s,
122
124
  name: s,
123
- type: i,
125
+ type: t,
124
126
  defaultValue: a,
125
127
  placeholder: l,
126
- autoComplete: i === "password" ? "new-password" : "off"
128
+ autoComplete: t === "password" ? "new-password" : "off"
127
129
  }
128
130
  ),
129
131
  d && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: d })
130
132
  ] });
131
133
  }
132
- function F({
134
+ function A({
133
135
  credentials: s,
134
- saveAction: t
136
+ saveAction: i
135
137
  }) {
136
- const i = "•••••••• (stored — leave blank to keep)";
137
- return /* @__PURE__ */ r(v, { children: [
138
- /* @__PURE__ */ r(y, { children: [
139
- /* @__PURE__ */ e(g, { children: "Provider API Keys" }),
140
- /* @__PURE__ */ r(x, { children: [
138
+ const t = "•••••••• (stored — leave blank to keep)";
139
+ return /* @__PURE__ */ r(x, { children: [
140
+ /* @__PURE__ */ r(N, { children: [
141
+ /* @__PURE__ */ e(k, { children: "Provider API Keys" }),
142
+ /* @__PURE__ */ r(w, { children: [
141
143
  "Keys are encrypted at rest and used DB-first (these override any ",
142
144
  /* @__PURE__ */ e("code", { children: ".env" }),
143
145
  " ",
144
146
  "values). Leave a secret blank to keep the stored value."
145
147
  ] })
146
148
  ] }),
147
- /* @__PURE__ */ e(N, { children: /* @__PURE__ */ r("form", { action: t, className: "space-y-6", children: [
149
+ /* @__PURE__ */ e(C, { children: /* @__PURE__ */ r("form", { action: i, className: "space-y-6", children: [
148
150
  /* @__PURE__ */ r("div", { className: "space-y-4", children: [
149
151
  /* @__PURE__ */ e("h3", { className: "text-sm font-semibold", children: "Stripe (physical products)" }),
152
+ /* @__PURE__ */ r("div", { className: "rounded-md border border-dashed p-3 text-xs text-muted-foreground space-y-1.5", children: [
153
+ /* @__PURE__ */ r("p", { children: [
154
+ "In the Stripe Dashboard (Developers → Webhooks → Add endpoint), set the endpoint URL to ",
155
+ /* @__PURE__ */ e("code", { children: "https://your-domain/api/webhooks/stripe" }),
156
+ ", then paste that endpoint's signing secret below."
157
+ ] }),
158
+ /* @__PURE__ */ r("p", { children: [
159
+ "For local testing, forward events with the Stripe CLI:",
160
+ " ",
161
+ /* @__PURE__ */ e("code", { children: "stripe listen --forward-to localhost:4200/api/webhooks/stripe" }),
162
+ " ",
163
+ "(or ",
164
+ /* @__PURE__ */ e("code", { children: "npm run stripe" }),
165
+ "). Use the ",
166
+ /* @__PURE__ */ e("code", { children: "whsec_…" }),
167
+ " secret it prints on startup as the signing secret below — it differs from a Dashboard endpoint's."
168
+ ] })
169
+ ] }),
150
170
  /* @__PURE__ */ r("div", { className: "grid gap-4 sm:grid-cols-2", children: [
151
171
  /* @__PURE__ */ e(
152
172
  n,
@@ -163,7 +183,7 @@ function F({
163
183
  id: "stripe_secretKey",
164
184
  label: "Secret key",
165
185
  type: "password",
166
- placeholder: s.stripe.hasSecretKey ? i : "sk_live_…"
186
+ placeholder: s.stripe.hasSecretKey ? t : "sk_live_…"
167
187
  }
168
188
  ),
169
189
  /* @__PURE__ */ e(
@@ -172,7 +192,7 @@ function F({
172
192
  id: "stripe_webhookSecret",
173
193
  label: "Webhook signing secret",
174
194
  type: "password",
175
- placeholder: s.stripe.hasWebhookSecret ? i : "whsec_…"
195
+ placeholder: s.stripe.hasWebhookSecret ? t : "whsec_…"
176
196
  }
177
197
  )
178
198
  ] })
@@ -211,7 +231,7 @@ function F({
211
231
  id: "freemius_secretKey",
212
232
  label: "Secret key",
213
233
  type: "password",
214
- placeholder: s.freemius.hasSecretKey ? i : "sk_…"
234
+ placeholder: s.freemius.hasSecretKey ? t : "sk_…"
215
235
  }
216
236
  ),
217
237
  /* @__PURE__ */ e(
@@ -220,40 +240,40 @@ function F({
220
240
  id: "freemius_apiKey",
221
241
  label: "API key",
222
242
  type: "password",
223
- placeholder: s.freemius.hasApiKey ? i : "API key"
243
+ placeholder: s.freemius.hasApiKey ? t : "API key"
224
244
  }
225
245
  )
226
246
  ] })
227
247
  ] }),
228
248
  s.envFallbackActive && /* @__PURE__ */ e("p", { className: "text-xs text-amber-700", children: "Stripe keys are currently read from environment variables. Saving here moves them into the database and takes precedence." }),
229
- /* @__PURE__ */ e("div", { className: "flex justify-end", children: /* @__PURE__ */ e(C, {}) })
249
+ /* @__PURE__ */ e("div", { className: "flex justify-end", children: /* @__PURE__ */ e(P, {}) })
230
250
  ] }) })
231
251
  ] });
232
252
  }
233
- function b({
253
+ function v({
234
254
  id: s,
235
- label: t,
236
- description: i,
255
+ label: i,
256
+ description: t,
237
257
  checked: a,
238
258
  disabled: l,
239
259
  ready: d,
240
- onCheckedChange: m,
260
+ onCheckedChange: o,
241
261
  children: c
242
262
  }) {
243
263
  return /* @__PURE__ */ e("div", { className: "rounded-md border p-4", children: /* @__PURE__ */ r("div", { className: "flex items-start gap-3", children: [
244
264
  /* @__PURE__ */ e(
245
- w,
265
+ K,
246
266
  {
247
267
  id: s,
248
268
  checked: a,
249
269
  disabled: l,
250
- onCheckedChange: (o) => m(!!o),
270
+ onCheckedChange: (p) => o(!!p),
251
271
  className: "mt-1"
252
272
  }
253
273
  ),
254
274
  /* @__PURE__ */ r("div", { className: "grid gap-1.5 leading-none w-full", children: [
255
275
  /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-3 flex-wrap", children: [
256
- /* @__PURE__ */ e(k, { htmlFor: s, className: "font-semibold text-base cursor-pointer", children: t }),
276
+ /* @__PURE__ */ e(S, { htmlFor: s, className: "font-semibold text-base cursor-pointer", children: i }),
257
277
  /* @__PURE__ */ e(
258
278
  "span",
259
279
  {
@@ -262,21 +282,21 @@ function b({
262
282
  }
263
283
  )
264
284
  ] }),
265
- /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: i }),
285
+ /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t }),
266
286
  !d && /* @__PURE__ */ e("p", { className: "text-xs text-amber-700", children: "This provider cannot be enabled until all required environment variables are present." }),
267
287
  c
268
288
  ] })
269
289
  ] }) });
270
290
  }
271
- function f({
291
+ function g({
272
292
  provider: s,
273
- missingKeys: t,
274
- docsUrl: i,
293
+ missingKeys: i,
294
+ docsUrl: t,
275
295
  docsLabel: a
276
296
  }) {
277
297
  return /* @__PURE__ */ r("div", { className: "mt-3 text-sm p-4 rounded-md border border-destructive/20 bg-destructive/5 text-foreground", children: [
278
298
  /* @__PURE__ */ r("div", { className: "flex items-center gap-2 font-semibold text-destructive mb-2", children: [
279
- /* @__PURE__ */ e(_, { className: "w-4 h-4" }),
299
+ /* @__PURE__ */ e(D, { className: "w-4 h-4" }),
280
300
  /* @__PURE__ */ e("span", { children: "Configuration Required" })
281
301
  ] }),
282
302
  /* @__PURE__ */ r("p", { className: "mb-2", children: [
@@ -284,7 +304,7 @@ function f({
284
304
  s,
285
305
  " integration still needs the following:"
286
306
  ] }),
287
- /* @__PURE__ */ e("ul", { className: "list-disc list-inside bg-white/50 dark:bg-black/20 p-2 rounded mb-3 text-xs", children: t.map((l) => /* @__PURE__ */ e("li", { children: l }, l)) }),
307
+ /* @__PURE__ */ e("ul", { className: "list-disc list-inside bg-white/50 dark:bg-black/20 p-2 rounded mb-3 text-xs", children: i.map((l) => /* @__PURE__ */ e("li", { children: l }, l)) }),
288
308
  /* @__PURE__ */ e("p", { className: "mb-2", children: /* @__PURE__ */ e("strong", { children: "How to fix:" }) }),
289
309
  /* @__PURE__ */ r("ol", { className: "list-decimal list-inside space-y-1 ml-1 mb-3", children: [
290
310
  /* @__PURE__ */ r("li", { children: [
@@ -293,7 +313,7 @@ function f({
293
313
  /* @__PURE__ */ e(
294
314
  "a",
295
315
  {
296
- href: i,
316
+ href: t,
297
317
  target: "_blank",
298
318
  rel: "noopener noreferrer",
299
319
  className: "underline font-medium hover:text-destructive/80",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextblock-cms/ecom",
3
- "version": "0.12.6",
3
+ "version": "0.12.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -10,9 +10,9 @@
10
10
  },
11
11
  "type": "module",
12
12
  "dependencies": {
13
- "@nextblock-cms/db": "^0.12.6",
14
- "@nextblock-cms/ui": "^0.12.6",
15
- "@nextblock-cms/utils": "^0.12.6",
13
+ "@nextblock-cms/db": "^0.12.8",
14
+ "@nextblock-cms/ui": "^0.12.8",
15
+ "@nextblock-cms/utils": "^0.12.8",
16
16
  "@freemius/checkout": "^1.4.1",
17
17
  "@freemius/sdk": "^0.3.0",
18
18
  "@hookform/resolvers": "^5.2.2",