@nextblock-cms/ecom 0.12.12 → 0.12.14
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/index.cjs.js +1 -1
- package/index.d.ts +2 -0
- package/index.es.js +108 -106
- package/lib/components/Checkout.cjs.js +1 -1
- package/lib/components/Checkout.es.js +32 -33
- package/lib/components/CustomerProfileForm.cjs.js +1 -1
- package/lib/components/CustomerProfileForm.es.js +185 -238
- package/lib/components/FreemiusLicensePanel.cjs.js +1 -0
- package/lib/components/FreemiusLicensePanel.d.ts +6 -0
- package/lib/components/FreemiusLicensePanel.es.js +66 -0
- package/lib/components/InvoiceViewerShell.cjs.js +2 -2
- package/lib/components/InvoiceViewerShell.d.ts +3 -1
- package/lib/components/InvoiceViewerShell.es.js +13 -11
- package/lib/customer-orders.cjs.js +1 -1
- package/lib/customer-orders.d.ts +2 -0
- package/lib/customer-orders.es.js +30 -27
- package/lib/freemius-license-types.d.ts +19 -0
- package/lib/freemius-license.cjs.js +1 -0
- package/lib/freemius-license.d.ts +20 -0
- package/lib/freemius-license.es.js +41 -0
- package/lib/freemius-order-sync.cjs.js +1 -1
- package/lib/freemius-order-sync.es.js +62 -52
- package/lib/pages/cms/orders/types.d.ts +0 -1
- package/lib/pages/cms/products/actions.cjs.js +1 -1
- package/lib/pages/cms/products/actions.es.js +1 -1
- package/lib/pages/cms/products/components/CurrencyPriceFields.cjs.js +1 -1
- package/lib/pages/cms/products/components/CurrencyPriceFields.es.js +104 -62
- package/lib/product-actions.cjs.js +3 -3
- package/lib/product-actions.d.ts +2 -1
- package/lib/product-actions.es.js +45 -44
- package/lib/server-actions/customer-actions.cjs.js +1 -1
- package/lib/server-actions/customer-actions.d.ts +0 -1
- package/lib/server-actions/customer-actions.es.js +12 -13
- package/package.json +4 -4
- package/server.cjs.js +1 -1
- package/server.d.ts +1 -0
- package/server.es.js +77 -75
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
4
|
-
import { useForm as
|
|
5
|
-
import { AccountNavigationMenu as
|
|
6
|
-
import { Avatar as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { Checkbox as ne } from "@nextblock-cms/ui/checkbox";
|
|
2
|
+
import { jsxs as s, jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import x, { useState as S } from "react";
|
|
4
|
+
import { useForm as H } from "react-hook-form";
|
|
5
|
+
import { AccountNavigationMenu as O } from "./AccountNavigationMenu.es.js";
|
|
6
|
+
import { Avatar as q, AvatarImage as J, AvatarFallback as K } from "@nextblock-cms/ui/avatar";
|
|
7
|
+
import { Button as M } from "@nextblock-cms/ui/button";
|
|
8
|
+
import { Card as R, CardHeader as T, CardTitle as B, CardContent as I, CardFooter as Q } from "@nextblock-cms/ui/card";
|
|
9
|
+
import { Checkbox as Y } from "@nextblock-cms/ui/checkbox";
|
|
11
10
|
import { Input as d } from "@nextblock-cms/ui/input";
|
|
12
|
-
import { Label as
|
|
13
|
-
import { Select as
|
|
14
|
-
import { Separator as
|
|
15
|
-
import { updateProfile as
|
|
16
|
-
import { addressesMatch as
|
|
17
|
-
import { createClient as
|
|
18
|
-
import { User as
|
|
19
|
-
import { useTranslations as
|
|
20
|
-
import { normalizeCountryCode as
|
|
21
|
-
function
|
|
11
|
+
import { Label as n } from "@nextblock-cms/ui/label";
|
|
12
|
+
import { Select as Z, SelectTrigger as D, SelectValue as ee, SelectContent as le, SelectItem as $ } from "@nextblock-cms/ui/select";
|
|
13
|
+
import { Separator as se } from "@nextblock-cms/ui/separator";
|
|
14
|
+
import { updateProfile as re } from "../server-actions/customer-actions.es.js";
|
|
15
|
+
import { addressesMatch as L, normalizeCustomerAddress as k, emptyCustomerAddress as ae } from "../customer.es.js";
|
|
16
|
+
import { createClient as ne } from "@nextblock-cms/db";
|
|
17
|
+
import { User as j, Upload as ce, Phone as de, Globe as ie } from "lucide-react";
|
|
18
|
+
import { useTranslations as V } from "@nextblock-cms/utils";
|
|
19
|
+
import { normalizeCountryCode as te, countries as oe } from "../countries.es.js";
|
|
20
|
+
function me(e) {
|
|
22
21
|
return e ? e.startsWith("http") ? e : process.env.NEXT_PUBLIC_R2_BASE_URL ? `${process.env.NEXT_PUBLIC_R2_BASE_URL}/${e}` : process.env.NEXT_PUBLIC_SUPABASE_URL ? `${process.env.NEXT_PUBLIC_SUPABASE_URL}/storage/v1/object/public/media/${e}` : e : null;
|
|
23
22
|
}
|
|
24
|
-
function
|
|
23
|
+
function y(e) {
|
|
25
24
|
return {
|
|
26
25
|
company_name: e?.company_name || "",
|
|
27
26
|
recipient_name: e?.recipient_name || "",
|
|
@@ -30,318 +29,266 @@ function $(e) {
|
|
|
30
29
|
city: e?.city || "",
|
|
31
30
|
state: e?.state || "",
|
|
32
31
|
postal_code: e?.postal_code || "",
|
|
33
|
-
country_code:
|
|
32
|
+
country_code: te(e?.country_code) || "CA"
|
|
34
33
|
};
|
|
35
34
|
}
|
|
36
|
-
function
|
|
35
|
+
function P({
|
|
37
36
|
prefix: e,
|
|
38
|
-
title:
|
|
39
|
-
register:
|
|
37
|
+
title: h,
|
|
38
|
+
register: i
|
|
40
39
|
}) {
|
|
41
|
-
const { t:
|
|
42
|
-
return /* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
40
|
+
const { t: c } = V(), b = c("company_name") === "company_name" ? "Company name" : c("company_name");
|
|
41
|
+
return /* @__PURE__ */ s("div", { className: "space-y-4 rounded-xl border p-4", children: [
|
|
42
|
+
/* @__PURE__ */ s("div", { children: [
|
|
43
|
+
/* @__PURE__ */ l("h3", { className: "text-lg font-medium", children: h }),
|
|
44
|
+
/* @__PURE__ */ l("p", { className: "text-sm text-muted-foreground", children: c("profile_address_defaults_help") })
|
|
46
45
|
] }),
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ s("div", { className: "grid gap-4 md:grid-cols-3", children: [
|
|
47
|
+
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
48
|
+
/* @__PURE__ */ l(n, { htmlFor: `${e}-company_name`, children: b }),
|
|
49
|
+
/* @__PURE__ */ l(d, { id: `${e}-company_name`, ...i(`${e}.company_name`) })
|
|
51
50
|
] }),
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
52
|
+
/* @__PURE__ */ l(n, { htmlFor: `${e}-recipient_name`, children: c("full_name") }),
|
|
53
|
+
/* @__PURE__ */ l(d, { id: `${e}-recipient_name`, ...i(`${e}.recipient_name`) })
|
|
55
54
|
] }),
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
56
|
+
/* @__PURE__ */ l(n, { htmlFor: `${e}-country_code`, children: c("country") }),
|
|
57
|
+
/* @__PURE__ */ l(
|
|
59
58
|
"select",
|
|
60
59
|
{
|
|
61
60
|
id: `${e}-country_code`,
|
|
62
61
|
className: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",
|
|
63
|
-
...
|
|
64
|
-
children:
|
|
62
|
+
...i(`${e}.country_code`),
|
|
63
|
+
children: oe.map((o) => /* @__PURE__ */ l("option", { value: o.code, children: o.name }, o.code))
|
|
65
64
|
}
|
|
66
65
|
)
|
|
67
66
|
] })
|
|
68
67
|
] }),
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
69
|
+
/* @__PURE__ */ l(n, { htmlFor: `${e}-line1`, children: c("address_line_1") }),
|
|
70
|
+
/* @__PURE__ */ l(d, { id: `${e}-line1`, ...i(`${e}.line1`) })
|
|
72
71
|
] }),
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
73
|
+
/* @__PURE__ */ l(n, { htmlFor: `${e}-line2`, children: c("address_line_2") }),
|
|
74
|
+
/* @__PURE__ */ l(d, { id: `${e}-line2`, ...i(`${e}.line2`) })
|
|
76
75
|
] }),
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ s("div", { className: "grid gap-4 md:grid-cols-3", children: [
|
|
77
|
+
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
78
|
+
/* @__PURE__ */ l(n, { htmlFor: `${e}-city`, children: c("city") }),
|
|
79
|
+
/* @__PURE__ */ l(d, { id: `${e}-city`, ...i(`${e}.city`) })
|
|
81
80
|
] }),
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
82
|
+
/* @__PURE__ */ l(n, { htmlFor: `${e}-state`, children: c("state_province") }),
|
|
83
|
+
/* @__PURE__ */ l(d, { id: `${e}-state`, ...i(`${e}.state`) })
|
|
85
84
|
] }),
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
86
|
+
/* @__PURE__ */ l(n, { htmlFor: `${e}-postal_code`, children: c("postal_zip_code") }),
|
|
87
|
+
/* @__PURE__ */ l(d, { id: `${e}-postal_code`, ...i(`${e}.postal_code`) })
|
|
89
88
|
] })
|
|
90
89
|
] })
|
|
91
90
|
] });
|
|
92
91
|
}
|
|
93
|
-
function
|
|
92
|
+
function Se({
|
|
94
93
|
initialData: e,
|
|
95
|
-
MediaPickerComponent:
|
|
96
|
-
isAdmin:
|
|
97
|
-
email:
|
|
98
|
-
accountLinks:
|
|
99
|
-
onAction:
|
|
100
|
-
initialSuccessMessage:
|
|
94
|
+
MediaPickerComponent: h,
|
|
95
|
+
isAdmin: i,
|
|
96
|
+
email: c,
|
|
97
|
+
accountLinks: b,
|
|
98
|
+
onAction: o,
|
|
99
|
+
initialSuccessMessage: u
|
|
101
100
|
}) {
|
|
102
|
-
const { t: r } =
|
|
103
|
-
|
|
104
|
-
),
|
|
105
|
-
register:
|
|
106
|
-
handleSubmit:
|
|
107
|
-
setValue:
|
|
108
|
-
getValues:
|
|
109
|
-
watch:
|
|
110
|
-
reset:
|
|
111
|
-
} =
|
|
101
|
+
const { t: r } = V(), [w, C] = S(!1), [v, N] = S(
|
|
102
|
+
u ? { type: "success", text: u } : null
|
|
103
|
+
), X = e?.use_billing_for_shipping ?? (!e?.shipping_address || L(e?.billing_address, e?.shipping_address)), {
|
|
104
|
+
register: m,
|
|
105
|
+
handleSubmit: z,
|
|
106
|
+
setValue: _,
|
|
107
|
+
getValues: E,
|
|
108
|
+
watch: g,
|
|
109
|
+
reset: F
|
|
110
|
+
} = H({
|
|
112
111
|
defaultValues: {
|
|
113
112
|
full_name: e?.full_name || "",
|
|
114
113
|
avatar_url: e?.avatar_url || "",
|
|
115
114
|
website: e?.website || "",
|
|
116
|
-
github_username: e?.github_username || "",
|
|
117
115
|
phone: e?.phone || "",
|
|
118
116
|
role: e?.role,
|
|
119
|
-
use_billing_for_shipping:
|
|
120
|
-
billing_address:
|
|
121
|
-
shipping_address:
|
|
117
|
+
use_billing_for_shipping: X,
|
|
118
|
+
billing_address: y(e?.billing_address),
|
|
119
|
+
shipping_address: y(e?.shipping_address)
|
|
122
120
|
}
|
|
123
121
|
});
|
|
124
|
-
|
|
125
|
-
e &&
|
|
122
|
+
x.useEffect(() => {
|
|
123
|
+
e && F({
|
|
126
124
|
full_name: e.full_name || "",
|
|
127
125
|
avatar_url: e.avatar_url || "",
|
|
128
126
|
website: e.website || "",
|
|
129
|
-
github_username: e.github_username || "",
|
|
130
127
|
phone: e.phone || "",
|
|
131
128
|
role: e.role,
|
|
132
|
-
use_billing_for_shipping: e.use_billing_for_shipping ?? (!e.shipping_address ||
|
|
133
|
-
billing_address:
|
|
134
|
-
shipping_address:
|
|
129
|
+
use_billing_for_shipping: e.use_billing_for_shipping ?? (!e.shipping_address || L(e.billing_address, e.shipping_address)),
|
|
130
|
+
billing_address: y(e.billing_address),
|
|
131
|
+
shipping_address: y(e.shipping_address)
|
|
135
132
|
});
|
|
136
|
-
}, [e,
|
|
137
|
-
|
|
138
|
-
}, [
|
|
139
|
-
const
|
|
133
|
+
}, [e, F]), x.useEffect(() => {
|
|
134
|
+
u && N({ type: "success", text: u });
|
|
135
|
+
}, [u]), x.useEffect(() => {
|
|
136
|
+
const a = ne();
|
|
140
137
|
(async () => {
|
|
141
138
|
const {
|
|
142
|
-
data: { user:
|
|
143
|
-
} = await
|
|
144
|
-
|
|
145
|
-
return;
|
|
146
|
-
const a = u.identities?.find((_) => _.provider === "github");
|
|
147
|
-
if (a) {
|
|
148
|
-
q(!0);
|
|
149
|
-
const _ = a.identity_data?.email || (u.app_metadata.provider === "github" ? u.email : null);
|
|
150
|
-
if (J(_), !x("website")) {
|
|
151
|
-
const N = a.identity_data?.custom_claims?.blog || a.identity_data?.blog || a.identity_data?.html_url;
|
|
152
|
-
N && m("website", N);
|
|
153
|
-
}
|
|
154
|
-
if (!x("avatar_url")) {
|
|
155
|
-
const N = a.identity_data?.avatar_url;
|
|
156
|
-
N && m("avatar_url", N);
|
|
157
|
-
}
|
|
158
|
-
const T = a.identity_data?.user_name || a.identity_data?.preferred_username;
|
|
159
|
-
T && m("github_username", T);
|
|
160
|
-
}
|
|
161
|
-
!x("full_name") && u.user_metadata?.full_name && m("full_name", u.user_metadata.full_name);
|
|
139
|
+
data: { user: f }
|
|
140
|
+
} = await a.auth.getUser();
|
|
141
|
+
f && !E("full_name") && f.user_metadata?.full_name && _("full_name", f.user_metadata.full_name);
|
|
162
142
|
})();
|
|
163
|
-
}, [
|
|
164
|
-
const
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}, Z = (t) => {
|
|
171
|
-
const o = ve(t?.object_key ?? t?.file_path);
|
|
172
|
-
o && m("avatar_url", o);
|
|
173
|
-
}, D = async (t) => {
|
|
174
|
-
S(!0), b(null);
|
|
175
|
-
const o = z(t.billing_address) ?? pe(), u = t.use_billing_for_shipping ? o : z(t.shipping_address);
|
|
143
|
+
}, [E, _]);
|
|
144
|
+
const W = (a) => {
|
|
145
|
+
const p = me(a?.object_key ?? a?.file_path);
|
|
146
|
+
p && _("avatar_url", p);
|
|
147
|
+
}, G = async (a) => {
|
|
148
|
+
C(!0), N(null);
|
|
149
|
+
const p = k(a.billing_address) ?? ae(), f = a.use_billing_for_shipping ? p : k(a.shipping_address);
|
|
176
150
|
try {
|
|
177
|
-
const
|
|
178
|
-
...
|
|
179
|
-
billing_address:
|
|
180
|
-
shipping_address:
|
|
151
|
+
const t = {
|
|
152
|
+
...a,
|
|
153
|
+
billing_address: p,
|
|
154
|
+
shipping_address: f
|
|
181
155
|
};
|
|
182
|
-
if (
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
185
|
-
throw new Error(
|
|
156
|
+
if (o) {
|
|
157
|
+
const A = await o(t);
|
|
158
|
+
if (A?.error)
|
|
159
|
+
throw new Error(A.error);
|
|
186
160
|
} else
|
|
187
|
-
await
|
|
188
|
-
|
|
189
|
-
} catch (
|
|
190
|
-
if (
|
|
161
|
+
await re(t);
|
|
162
|
+
N({ type: "success", text: r("profile_updated_success") });
|
|
163
|
+
} catch (t) {
|
|
164
|
+
if (t.message === "NEXT_REDIRECT" || t.message?.includes("NEXT_REDIRECT"))
|
|
191
165
|
return;
|
|
192
|
-
console.error(
|
|
166
|
+
console.error(t), N({ type: "error", text: t.message || r("profile_update_failed") });
|
|
193
167
|
} finally {
|
|
194
|
-
|
|
168
|
+
C(!1);
|
|
195
169
|
}
|
|
196
|
-
},
|
|
197
|
-
return /* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
/* @__PURE__ */
|
|
201
|
-
/* @__PURE__ */
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
/* @__PURE__ */
|
|
204
|
-
/* @__PURE__ */
|
|
170
|
+
}, U = g("use_billing_for_shipping");
|
|
171
|
+
return /* @__PURE__ */ s("div", { className: "grid gap-6 md:grid-cols-12 max-w-5xl mx-auto", children: [
|
|
172
|
+
/* @__PURE__ */ s(R, { className: "md:col-span-4 h-fit", children: [
|
|
173
|
+
/* @__PURE__ */ l(T, { children: /* @__PURE__ */ l(B, { className: "text-xl", children: r("public_profile") }) }),
|
|
174
|
+
/* @__PURE__ */ s(I, { className: "flex flex-col items-center text-center space-y-4", children: [
|
|
175
|
+
/* @__PURE__ */ s("div", { className: "relative group", children: [
|
|
176
|
+
/* @__PURE__ */ s(q, { className: "h-32 w-32 border-4 border-muted", children: [
|
|
177
|
+
/* @__PURE__ */ l(J, { src: g("avatar_url") || void 0, className: "object-cover" }),
|
|
178
|
+
/* @__PURE__ */ l(K, { className: "text-4xl bg-secondary", children: g("full_name")?.charAt(0)?.toUpperCase() || /* @__PURE__ */ l(j, { className: "h-12 w-12" }) })
|
|
205
179
|
] }),
|
|
206
|
-
|
|
207
|
-
|
|
180
|
+
h && /* @__PURE__ */ l("div", { className: "absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-black/40 rounded-full cursor-pointer", children: /* @__PURE__ */ l(
|
|
181
|
+
h,
|
|
208
182
|
{
|
|
209
|
-
triggerLabel: /* @__PURE__ */
|
|
183
|
+
triggerLabel: /* @__PURE__ */ l(ce, { className: "h-6 w-6 text-white" }),
|
|
210
184
|
triggerVariant: "ghost",
|
|
211
185
|
title: r("customer_profile"),
|
|
212
|
-
onSelect:
|
|
213
|
-
accept: (
|
|
186
|
+
onSelect: W,
|
|
187
|
+
accept: (a) => a.file_type.startsWith("image/"),
|
|
214
188
|
hideTrigger: !1
|
|
215
189
|
}
|
|
216
190
|
) })
|
|
217
191
|
] }),
|
|
218
|
-
!
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
/* @__PURE__ */
|
|
192
|
+
!h && /* @__PURE__ */ s("div", { className: "w-full", children: [
|
|
193
|
+
/* @__PURE__ */ l(n, { htmlFor: "avatar_url", className: "sr-only", children: r("avatar_url") }),
|
|
194
|
+
/* @__PURE__ */ l(d, { id: "avatar_url", ...m("avatar_url"), placeholder: "https://...", className: "mt-2" })
|
|
221
195
|
] }),
|
|
222
|
-
/* @__PURE__ */
|
|
223
|
-
/* @__PURE__ */
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
-
R && /* @__PURE__ */ l(ae, { variant: "secondary", className: "mt-2 w-fit gap-1", children: [
|
|
226
|
-
/* @__PURE__ */ s(U, { className: "h-3 w-3" }),
|
|
227
|
-
" ",
|
|
228
|
-
r("github_connected") || "GitHub Connected"
|
|
229
|
-
] })
|
|
196
|
+
/* @__PURE__ */ s("div", { className: "w-full space-y-1 text-left mt-4", children: [
|
|
197
|
+
/* @__PURE__ */ l("div", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: r("identity") }),
|
|
198
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ l("span", { className: "font-semibold text-lg", children: g("full_name") || r("full_name") }) })
|
|
230
199
|
] }),
|
|
231
|
-
|
|
232
|
-
|
|
200
|
+
b?.length ? /* @__PURE__ */ l(
|
|
201
|
+
O,
|
|
233
202
|
{
|
|
234
|
-
links:
|
|
203
|
+
links: b,
|
|
235
204
|
className: "mt-2 text-left"
|
|
236
205
|
}
|
|
237
206
|
) : null
|
|
238
207
|
] })
|
|
239
208
|
] }),
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
-
/* @__PURE__ */
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
|
|
244
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ l(R, { className: "md:col-span-8", children: /* @__PURE__ */ s("form", { onSubmit: z(G), children: [
|
|
210
|
+
/* @__PURE__ */ l(T, { children: /* @__PURE__ */ l(B, { children: r("details") }) }),
|
|
211
|
+
/* @__PURE__ */ s(I, { className: "space-y-6", children: [
|
|
212
|
+
c && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
213
|
+
/* @__PURE__ */ s(n, { htmlFor: "email", children: [
|
|
245
214
|
r("email") || "Email",
|
|
246
215
|
" (Read-only)"
|
|
247
216
|
] }),
|
|
248
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ l(d, { id: "email", value: c, readOnly: !0, disabled: !0, className: "bg-muted/50" })
|
|
249
218
|
] }),
|
|
250
|
-
/* @__PURE__ */
|
|
251
|
-
/* @__PURE__ */
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ l("div", { className: "rounded-xl border bg-muted/20 p-4 text-sm text-muted-foreground", children: r("profile_basic_info_help") }),
|
|
220
|
+
/* @__PURE__ */ s("div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
221
|
+
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
222
|
+
/* @__PURE__ */ s(n, { htmlFor: "full_name", className: "flex items-center gap-2", children: [
|
|
223
|
+
/* @__PURE__ */ l(j, { className: "h-4 w-4" }),
|
|
255
224
|
" ",
|
|
256
225
|
r("full_name")
|
|
257
226
|
] }),
|
|
258
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ l(d, { id: "full_name", ...m("full_name") })
|
|
259
228
|
] }),
|
|
260
|
-
/* @__PURE__ */
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
230
|
+
/* @__PURE__ */ s(n, { htmlFor: "phone", className: "flex items-center gap-2", children: [
|
|
231
|
+
/* @__PURE__ */ l(de, { className: "h-4 w-4" }),
|
|
263
232
|
" ",
|
|
264
233
|
r("phone_number")
|
|
265
234
|
] }),
|
|
266
|
-
/* @__PURE__ */
|
|
235
|
+
/* @__PURE__ */ l(d, { id: "phone", ...m("phone") })
|
|
267
236
|
] })
|
|
268
237
|
] }),
|
|
269
|
-
/* @__PURE__ */
|
|
270
|
-
/* @__PURE__ */
|
|
271
|
-
/* @__PURE__ */ l(
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
r("website")
|
|
275
|
-
] }),
|
|
276
|
-
/* @__PURE__ */ s(d, { id: "website", ...h("website"), placeholder: "https://example.com" })
|
|
238
|
+
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
239
|
+
/* @__PURE__ */ s(n, { htmlFor: "website", className: "flex items-center gap-2", children: [
|
|
240
|
+
/* @__PURE__ */ l(ie, { className: "h-4 w-4" }),
|
|
241
|
+
" ",
|
|
242
|
+
r("website")
|
|
277
243
|
] }),
|
|
278
|
-
/* @__PURE__ */ l(
|
|
279
|
-
/* @__PURE__ */ l(i, { htmlFor: "github_username", className: "flex items-center gap-2", children: [
|
|
280
|
-
/* @__PURE__ */ s(U, { className: "h-4 w-4" }),
|
|
281
|
-
" ",
|
|
282
|
-
r("github_username")
|
|
283
|
-
] }),
|
|
284
|
-
R ? /* @__PURE__ */ l("div", { className: "space-y-2", children: [
|
|
285
|
-
/* @__PURE__ */ s(d, { id: "github_username", ...h("github_username"), disabled: !0, className: "bg-muted" }),
|
|
286
|
-
k && /* @__PURE__ */ l("p", { className: "text-xs text-muted-foreground flex items-center gap-1", children: [
|
|
287
|
-
/* @__PURE__ */ s(be, { className: "h-3 w-3" }),
|
|
288
|
-
" ",
|
|
289
|
-
r("linked_to") || "Linked to",
|
|
290
|
-
" ",
|
|
291
|
-
k
|
|
292
|
-
] })
|
|
293
|
-
] }) : /* @__PURE__ */ l(B, { type: "button", variant: "outline", className: "w-full", onClick: Y, children: [
|
|
294
|
-
/* @__PURE__ */ s(U, { className: "mr-2 h-4 w-4" }),
|
|
295
|
-
r("connect_github")
|
|
296
|
-
] })
|
|
297
|
-
] })
|
|
244
|
+
/* @__PURE__ */ l(d, { id: "website", ...m("website"), placeholder: "https://example.com" })
|
|
298
245
|
] }),
|
|
299
|
-
/* @__PURE__ */
|
|
300
|
-
/* @__PURE__ */
|
|
301
|
-
/* @__PURE__ */
|
|
302
|
-
/* @__PURE__ */
|
|
303
|
-
|
|
246
|
+
/* @__PURE__ */ l(se, { className: "my-2" }),
|
|
247
|
+
/* @__PURE__ */ l(P, { prefix: "billing_address", title: r("billing_address"), register: m }),
|
|
248
|
+
/* @__PURE__ */ s("div", { className: "flex items-center space-x-3 rounded-lg border p-4", children: [
|
|
249
|
+
/* @__PURE__ */ l(
|
|
250
|
+
Y,
|
|
304
251
|
{
|
|
305
252
|
id: "use_billing_for_shipping",
|
|
306
|
-
checked: !!
|
|
307
|
-
onCheckedChange: (
|
|
253
|
+
checked: !!U,
|
|
254
|
+
onCheckedChange: (a) => _("use_billing_for_shipping", !!a, { shouldDirty: !0 })
|
|
308
255
|
}
|
|
309
256
|
),
|
|
310
|
-
/* @__PURE__ */
|
|
311
|
-
/* @__PURE__ */
|
|
312
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ s("div", { className: "space-y-1", children: [
|
|
258
|
+
/* @__PURE__ */ l(n, { htmlFor: "use_billing_for_shipping", className: "cursor-pointer", children: r("use_billing_for_shipping") }),
|
|
259
|
+
/* @__PURE__ */ l("p", { className: "text-sm text-muted-foreground", children: r("profile_use_billing_for_shipping_help") })
|
|
313
260
|
] })
|
|
314
261
|
] }),
|
|
315
|
-
!
|
|
316
|
-
|
|
262
|
+
!U && /* @__PURE__ */ l(
|
|
263
|
+
P,
|
|
317
264
|
{
|
|
318
265
|
prefix: "shipping_address",
|
|
319
266
|
title: r("shipping_address"),
|
|
320
|
-
register:
|
|
267
|
+
register: m
|
|
321
268
|
}
|
|
322
269
|
),
|
|
323
|
-
|
|
270
|
+
v && /* @__PURE__ */ l(
|
|
324
271
|
"div",
|
|
325
272
|
{
|
|
326
|
-
className: `mt-4 rounded-xl border p-4 text-sm ${
|
|
327
|
-
children:
|
|
273
|
+
className: `mt-4 rounded-xl border p-4 text-sm ${v.type === "success" ? "border-emerald-200 bg-emerald-50 text-emerald-700" : "border-red-200 bg-red-50 text-red-700"}`,
|
|
274
|
+
children: v.text
|
|
328
275
|
}
|
|
329
276
|
),
|
|
330
|
-
|
|
331
|
-
/* @__PURE__ */
|
|
332
|
-
/* @__PURE__ */
|
|
333
|
-
/* @__PURE__ */
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
-
|
|
277
|
+
i && /* @__PURE__ */ s("div", { className: "border-t pt-4 mt-4", children: [
|
|
278
|
+
/* @__PURE__ */ l("h3", { className: "text-sm font-medium mb-3", children: "Admin Settings" }),
|
|
279
|
+
/* @__PURE__ */ s("div", { className: "grid gap-2", children: [
|
|
280
|
+
/* @__PURE__ */ l(n, { htmlFor: "role", children: "Role" }),
|
|
281
|
+
/* @__PURE__ */ s(
|
|
282
|
+
Z,
|
|
336
283
|
{
|
|
337
|
-
value:
|
|
338
|
-
onValueChange: (
|
|
284
|
+
value: g("role") || "USER",
|
|
285
|
+
onValueChange: (a) => _("role", a),
|
|
339
286
|
children: [
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
/* @__PURE__ */
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
-
/* @__PURE__ */
|
|
344
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ l(D, { children: /* @__PURE__ */ l(ee, { placeholder: "Select role" }) }),
|
|
288
|
+
/* @__PURE__ */ s(le, { children: [
|
|
289
|
+
/* @__PURE__ */ l($, { value: "USER", children: "User" }),
|
|
290
|
+
/* @__PURE__ */ l($, { value: "WRITER", children: "Writer" }),
|
|
291
|
+
/* @__PURE__ */ l($, { value: "ADMIN", children: "Admin" })
|
|
345
292
|
] })
|
|
346
293
|
]
|
|
347
294
|
}
|
|
@@ -349,10 +296,10 @@ function Xe({
|
|
|
349
296
|
] })
|
|
350
297
|
] })
|
|
351
298
|
] }),
|
|
352
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ l(Q, { className: "flex justify-end", children: /* @__PURE__ */ l(M, { type: "submit", disabled: w, size: "lg", children: r(w ? "saving" : "save_changes") }) })
|
|
353
300
|
] }) })
|
|
354
301
|
] });
|
|
355
302
|
}
|
|
356
303
|
export {
|
|
357
|
-
|
|
304
|
+
Se as CustomerProfileForm
|
|
358
305
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),r=require("lucide-react"),x=require("@nextblock-cms/ui/button"),p=require("@nextblock-cms/utils"),a=require("../invoice-ui.cjs.js"),f=require("../invoice.cjs.js");function y({license:s}){const{t,lang:o}=p.useTranslations(),[l,n]=u.useState(!1);if(!s)return null;const m=a.getInvoiceLocale(o),c=s.expiration??s.trialEndsAt,i=c?f.formatInvoiceDate(c,m):null,d=async()=>{if(!(!s.licenseKey||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(s.licenseKey),n(!0),window.setTimeout(()=>n(!1),2e3)}catch{}};return e.jsxs("div",{className:"mb-6 rounded-2xl border border-primary/30 bg-primary/5 p-5 print:hidden",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(r.KeyRound,{className:"h-5 w-5 text-primary"}),e.jsx("h2",{className:"text-lg font-semibold",children:a.translateOrFallback(t,"ecommerce.license_panel_title","Your license")})]}),s.licenseKey?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:a.translateOrFallback(t,"ecommerce.license_panel_help","Activate this key in your NextBlock install under Settings → Packages.")}),e.jsxs("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx("code",{className:"flex-1 overflow-x-auto rounded-lg border bg-background px-3 py-2 font-mono text-sm",children:s.licenseKey}),e.jsxs(x.Button,{type:"button",variant:"default",onClick:d,className:"shrink-0",children:[l?e.jsx(r.Check,{className:"mr-2 h-4 w-4"}):e.jsx(r.Copy,{className:"mr-2 h-4 w-4"}),l?a.translateOrFallback(t,"ecommerce.license_copied","Copied"):a.translateOrFallback(t,"ecommerce.license_copy","Copy key")]})]})]}):e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:a.translateOrFallback(t,"ecommerce.license_panel_email_fallback","Your license key was sent to your email. It will also appear here once your purchase is confirmed.")}),e.jsxs("dl",{className:"mt-4 grid gap-x-6 gap-y-1 text-xs text-muted-foreground sm:grid-cols-2",children:[e.jsxs("div",{className:"flex justify-between gap-3 sm:block",children:[e.jsx("dt",{className:"font-medium",children:a.translateOrFallback(t,"ecommerce.license_number","License #")}),e.jsx("dd",{className:"font-mono",children:s.licenseId})]}),i?e.jsxs("div",{className:"flex justify-between gap-3 sm:block",children:[e.jsx("dt",{className:"font-medium",children:s.isCancelled?a.translateOrFallback(t,"ecommerce.license_expires","Expires"):s.trialEndsAt?a.translateOrFallback(t,"ecommerce.license_trial_ends","Trial ends"):a.translateOrFallback(t,"ecommerce.license_renews","Renews / expires")}),e.jsx("dd",{children:i})]}):null]})]})}exports.FreemiusLicensePanel=y;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FreemiusOrderLicense } from '../freemius-license-types';
|
|
2
|
+
interface FreemiusLicensePanelProps {
|
|
3
|
+
license?: FreemiusOrderLicense | null;
|
|
4
|
+
}
|
|
5
|
+
export declare function FreemiusLicensePanel({ license }: FreemiusLicensePanelProps): import("react").JSX.Element | null;
|
|
6
|
+
export {};
|