@nextblock-cms/ecom 0.12.7 → 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,h]=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:p=>h(m=>({...m,stripe:p})),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(b,{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:p=>h(m=>({...m,freemius:p})),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(b,{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(j,{})})]})]})]})]})}function j(){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:"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?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(j,{})})]})})]})}function x({id:s,label:t,description:i,checked:a,disabled:l,ready:d,onCheckedChange:h,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=>h(!!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 b({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,30 +1,32 @@
1
1
  'use client';
2
2
  import { jsxs as r, jsx as e } from "react/jsx-runtime";
3
- import { useState as C } from "react";
4
- import { Card as v, CardHeader as y, CardTitle as g, CardDescription as x, CardContent as N, Checkbox as P, 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";
7
- function j({
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
+ function T({
8
8
  initialEnabledProviders: s,
9
- configStatus: t,
10
- credentials: i,
11
- saveAction: d,
9
+ configStatus: i,
10
+ credentials: t,
11
+ saveAction: a,
12
12
  saveCredentialsAction: l
13
13
  }) {
14
- const [a, p] = C(s), o = t?.stripe?.hasKeys, c = 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(D, { credentials: i, saveAction: l }),
21
- /* @__PURE__ */ r("form", { action: d, className: "space-y-6", children: [
22
+ /* @__PURE__ */ e(A, { credentials: t, saveAction: l }),
23
+ /* @__PURE__ */ r("form", { action: a, className: "space-y-6", children: [
22
24
  /* @__PURE__ */ e(
23
25
  "input",
24
26
  {
25
27
  type: "hidden",
26
28
  name: "stripe_enabled",
27
- value: a.stripe ? "true" : "false"
29
+ value: d.stripe ? "true" : "false"
28
30
  }
29
31
  ),
30
32
  /* @__PURE__ */ e(
@@ -32,36 +34,36 @@ function j({
32
34
  {
33
35
  type: "hidden",
34
36
  name: "freemius_enabled",
35
- value: a.freemius ? "true" : "false"
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
- checked: a.stripe,
51
- disabled: !o,
52
- onCheckedChange: (h) => p((m) => ({
53
- ...m,
54
- stripe: h
52
+ checked: d.stripe,
53
+ disabled: !h,
54
+ onCheckedChange: (u) => o((f) => ({
55
+ ...f,
56
+ stripe: u
55
57
  })),
56
- ready: o,
57
- children: o ? /* @__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,82 +71,82 @@ function j({
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
- checked: a.freemius,
78
- disabled: !c,
79
- onCheckedChange: (h) => p((m) => ({
80
- ...m,
81
- freemius: h
79
+ checked: d.freemius,
80
+ disabled: !m,
81
+ onCheckedChange: (u) => o((f) => ({
82
+ ...f,
83
+ freemius: u
82
84
  })),
83
- ready: c,
84
- children: c ? /* @__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(w, {}) })
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 w() {
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
- defaultValue: d,
112
+ label: i,
113
+ type: t = "text",
114
+ defaultValue: a,
113
115
  placeholder: l,
114
- hint: a
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,
124
- defaultValue: d,
125
+ type: t,
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
- a && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: a })
131
+ d && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: d })
130
132
  ] });
131
133
  }
132
- function D({
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)" }),
150
152
  /* @__PURE__ */ r("div", { className: "rounded-md border border-dashed p-3 text-xs text-muted-foreground space-y-1.5", children: [
@@ -181,7 +183,7 @@ function D({
181
183
  id: "stripe_secretKey",
182
184
  label: "Secret key",
183
185
  type: "password",
184
- placeholder: s.stripe.hasSecretKey ? i : "sk_live_…"
186
+ placeholder: s.stripe.hasSecretKey ? t : "sk_live_…"
185
187
  }
186
188
  ),
187
189
  /* @__PURE__ */ e(
@@ -190,7 +192,7 @@ function D({
190
192
  id: "stripe_webhookSecret",
191
193
  label: "Webhook signing secret",
192
194
  type: "password",
193
- placeholder: s.stripe.hasWebhookSecret ? i : "whsec_…"
195
+ placeholder: s.stripe.hasWebhookSecret ? t : "whsec_…"
194
196
  }
195
197
  )
196
198
  ] })
@@ -229,7 +231,7 @@ function D({
229
231
  id: "freemius_secretKey",
230
232
  label: "Secret key",
231
233
  type: "password",
232
- placeholder: s.freemius.hasSecretKey ? i : "sk_…"
234
+ placeholder: s.freemius.hasSecretKey ? t : "sk_…"
233
235
  }
234
236
  ),
235
237
  /* @__PURE__ */ e(
@@ -238,63 +240,63 @@ function D({
238
240
  id: "freemius_apiKey",
239
241
  label: "API key",
240
242
  type: "password",
241
- placeholder: s.freemius.hasApiKey ? i : "API key"
243
+ placeholder: s.freemius.hasApiKey ? t : "API key"
242
244
  }
243
245
  )
244
246
  ] })
245
247
  ] }),
246
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." }),
247
- /* @__PURE__ */ e("div", { className: "flex justify-end", children: /* @__PURE__ */ e(w, {}) })
249
+ /* @__PURE__ */ e("div", { className: "flex justify-end", children: /* @__PURE__ */ e(P, {}) })
248
250
  ] }) })
249
251
  ] });
250
252
  }
251
- function b({
253
+ function v({
252
254
  id: s,
253
- label: t,
254
- description: i,
255
- checked: d,
255
+ label: i,
256
+ description: t,
257
+ checked: a,
256
258
  disabled: l,
257
- ready: a,
258
- onCheckedChange: p,
259
- children: o
259
+ ready: d,
260
+ onCheckedChange: o,
261
+ children: c
260
262
  }) {
261
263
  return /* @__PURE__ */ e("div", { className: "rounded-md border p-4", children: /* @__PURE__ */ r("div", { className: "flex items-start gap-3", children: [
262
264
  /* @__PURE__ */ e(
263
- P,
265
+ K,
264
266
  {
265
267
  id: s,
266
- checked: d,
268
+ checked: a,
267
269
  disabled: l,
268
- onCheckedChange: (c) => p(!!c),
270
+ onCheckedChange: (p) => o(!!p),
269
271
  className: "mt-1"
270
272
  }
271
273
  ),
272
274
  /* @__PURE__ */ r("div", { className: "grid gap-1.5 leading-none w-full", children: [
273
275
  /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-3 flex-wrap", children: [
274
- /* @__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 }),
275
277
  /* @__PURE__ */ e(
276
278
  "span",
277
279
  {
278
- className: `text-xs font-medium ${d ? "text-foreground" : "text-muted-foreground"}`,
279
- children: d ? "Enabled" : "Disabled"
280
+ className: `text-xs font-medium ${a ? "text-foreground" : "text-muted-foreground"}`,
281
+ children: a ? "Enabled" : "Disabled"
280
282
  }
281
283
  )
282
284
  ] }),
283
- /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: i }),
284
- !a && /* @__PURE__ */ e("p", { className: "text-xs text-amber-700", children: "This provider cannot be enabled until all required environment variables are present." }),
285
- o
285
+ /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t }),
286
+ !d && /* @__PURE__ */ e("p", { className: "text-xs text-amber-700", children: "This provider cannot be enabled until all required environment variables are present." }),
287
+ c
286
288
  ] })
287
289
  ] }) });
288
290
  }
289
- function f({
291
+ function g({
290
292
  provider: s,
291
- missingKeys: t,
292
- docsUrl: i,
293
- docsLabel: d
293
+ missingKeys: i,
294
+ docsUrl: t,
295
+ docsLabel: a
294
296
  }) {
295
297
  return /* @__PURE__ */ r("div", { className: "mt-3 text-sm p-4 rounded-md border border-destructive/20 bg-destructive/5 text-foreground", children: [
296
298
  /* @__PURE__ */ r("div", { className: "flex items-center gap-2 font-semibold text-destructive mb-2", children: [
297
- /* @__PURE__ */ e(_, { className: "w-4 h-4" }),
299
+ /* @__PURE__ */ e(D, { className: "w-4 h-4" }),
298
300
  /* @__PURE__ */ e("span", { children: "Configuration Required" })
299
301
  ] }),
300
302
  /* @__PURE__ */ r("p", { className: "mb-2", children: [
@@ -302,7 +304,7 @@ function f({
302
304
  s,
303
305
  " integration still needs the following:"
304
306
  ] }),
305
- /* @__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)) }),
306
308
  /* @__PURE__ */ e("p", { className: "mb-2", children: /* @__PURE__ */ e("strong", { children: "How to fix:" }) }),
307
309
  /* @__PURE__ */ r("ol", { className: "list-decimal list-inside space-y-1 ml-1 mb-3", children: [
308
310
  /* @__PURE__ */ r("li", { children: [
@@ -311,11 +313,11 @@ function f({
311
313
  /* @__PURE__ */ e(
312
314
  "a",
313
315
  {
314
- href: i,
316
+ href: t,
315
317
  target: "_blank",
316
318
  rel: "noopener noreferrer",
317
319
  className: "underline font-medium hover:text-destructive/80",
318
- children: d
320
+ children: a
319
321
  }
320
322
  ),
321
323
  "."
@@ -330,5 +332,5 @@ function f({
330
332
  ] });
331
333
  }
332
334
  export {
333
- j as PaymentsClient
335
+ T as PaymentsClient
334
336
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextblock-cms/ecom",
3
- "version": "0.12.7",
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.7",
14
- "@nextblock-cms/ui": "^0.12.7",
15
- "@nextblock-cms/utils": "^0.12.7",
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",