@appgram/react 0.1.1 → 0.1.3
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/dist/{useVote-CLhkwtLT.d.mts → StatusBoard-DhKRu-An.d.mts} +125 -1
- package/dist/{useVote-CLhkwtLT.d.ts → StatusBoard-DhKRu-An.d.ts} +125 -1
- package/dist/{chunk-N6PJDQCU.mjs → chunk-NABMGLTY.mjs} +210 -6
- package/dist/chunk-NABMGLTY.mjs.map +1 -0
- package/dist/chunk-NSV6Q6QQ.js +202 -0
- package/dist/chunk-NSV6Q6QQ.js.map +1 -0
- package/dist/chunk-ONZ7RQBM.mjs +199 -0
- package/dist/chunk-ONZ7RQBM.mjs.map +1 -0
- package/dist/{chunk-75P634IK.js → chunk-UPTP7QX5.js} +213 -5
- package/dist/chunk-UPTP7QX5.js.map +1 -0
- package/dist/{chunk-AIDLOCVJ.mjs → chunk-UWIJR4ZY.mjs} +760 -15
- package/dist/chunk-UWIJR4ZY.mjs.map +1 -0
- package/dist/{chunk-3UBJGXCO.js → chunk-WZIN7KEM.js} +820 -74
- package/dist/chunk-WZIN7KEM.js.map +1 -0
- package/dist/components/index.d.mts +68 -106
- package/dist/components/index.d.ts +68 -106
- package/dist/components/index.js +29 -21
- package/dist/components/index.mjs +2 -2
- package/dist/hooks/index.d.mts +3 -572
- package/dist/hooks/index.d.ts +3 -572
- package/dist/hooks/index.js +33 -13
- package/dist/hooks/index.mjs +2 -2
- package/dist/index-DpZz_TZE.d.ts +917 -0
- package/dist/index-X95JANOa.d.mts +917 -0
- package/dist/index.d.mts +32 -5
- package/dist/index.d.ts +32 -5
- package/dist/index.js +123 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +60 -41
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-3UBJGXCO.js.map +0 -1
- package/dist/chunk-75P634IK.js.map +0 -1
- package/dist/chunk-AIDLOCVJ.mjs.map +0 -1
- package/dist/chunk-KPIKYXAN.mjs +0 -47
- package/dist/chunk-KPIKYXAN.mjs.map +0 -1
- package/dist/chunk-N6PJDQCU.mjs.map +0 -1
- package/dist/chunk-ZJZ3A2S3.js +0 -49
- package/dist/chunk-ZJZ3A2S3.js.map +0 -1
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkUPTP7QX5_js = require('./chunk-UPTP7QX5.js');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var framerMotion = require('framer-motion');
|
|
6
6
|
var lucideReact = require('lucide-react');
|
|
7
7
|
var React12 = require('react');
|
|
8
8
|
var ReactMarkdown = require('react-markdown');
|
|
9
9
|
var remarkGfm = require('remark-gfm');
|
|
10
|
-
var DOMPurify = require('dompurify');
|
|
11
10
|
|
|
12
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
12
|
|
|
14
13
|
var React12__default = /*#__PURE__*/_interopDefault(React12);
|
|
15
14
|
var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
|
|
16
15
|
var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
|
|
17
|
-
var DOMPurify__default = /*#__PURE__*/_interopDefault(DOMPurify);
|
|
18
16
|
|
|
19
17
|
var sizeClasses = {
|
|
20
18
|
sm: "px-2 py-1 text-xs min-w-[50px]",
|
|
@@ -37,8 +35,8 @@ function VoteButton({
|
|
|
37
35
|
className,
|
|
38
36
|
renderContent
|
|
39
37
|
}) {
|
|
40
|
-
const { theme } =
|
|
41
|
-
const { hasVoted, voteCount, isLoading, toggle } =
|
|
38
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
39
|
+
const { hasVoted, voteCount, isLoading, toggle } = chunkUPTP7QX5_js.useVote({
|
|
42
40
|
wishId,
|
|
43
41
|
initialVoteCount,
|
|
44
42
|
initialHasVoted,
|
|
@@ -50,7 +48,7 @@ function VoteButton({
|
|
|
50
48
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
51
49
|
"svg",
|
|
52
50
|
{
|
|
53
|
-
className:
|
|
51
|
+
className: chunkUPTP7QX5_js.cn(
|
|
54
52
|
iconSizes[size],
|
|
55
53
|
"transition-transform duration-200",
|
|
56
54
|
hasVoted && "animate-appgram-vote-pop"
|
|
@@ -77,7 +75,7 @@ function VoteButton({
|
|
|
77
75
|
type: "button",
|
|
78
76
|
onClick: toggle,
|
|
79
77
|
disabled: isLoading,
|
|
80
|
-
className:
|
|
78
|
+
className: chunkUPTP7QX5_js.cn(
|
|
81
79
|
"inline-flex flex-col items-center justify-center gap-0.5 rounded-lg",
|
|
82
80
|
"border transition-all duration-200",
|
|
83
81
|
"focus:outline-none focus:ring-2 focus:ring-offset-2",
|
|
@@ -129,7 +127,7 @@ function WishCard({
|
|
|
129
127
|
showAuthor = true,
|
|
130
128
|
animationIndex = 0
|
|
131
129
|
}) {
|
|
132
|
-
const { theme } =
|
|
130
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
133
131
|
const primaryColor = theme.colors?.primary || "#0EA5E9";
|
|
134
132
|
const borderRadius = theme.borderRadius || 16;
|
|
135
133
|
const isDark = theme.isDark ?? false;
|
|
@@ -157,7 +155,7 @@ function WishCard({
|
|
|
157
155
|
duration: 0.4,
|
|
158
156
|
ease: [0.25, 0.46, 0.45, 0.94]
|
|
159
157
|
},
|
|
160
|
-
className:
|
|
158
|
+
className: chunkUPTP7QX5_js.cn("cursor-pointer group", className),
|
|
161
159
|
onClick,
|
|
162
160
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
163
161
|
"div",
|
|
@@ -323,11 +321,11 @@ function WishList({
|
|
|
323
321
|
showSearch = false,
|
|
324
322
|
className
|
|
325
323
|
}) {
|
|
326
|
-
const { theme } =
|
|
324
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
327
325
|
const [searchQuery, setSearchQuery] = React12.useState("");
|
|
328
326
|
const [hasInitiallyLoaded, setHasInitiallyLoaded] = React12.useState(false);
|
|
329
327
|
const [localVotes, setLocalVotes] = React12.useState({});
|
|
330
|
-
const { wishes, isLoading, error, page, totalPages, setPage, setFilters, refetch } =
|
|
328
|
+
const { wishes, isLoading, error, page, totalPages, setPage, setFilters, refetch } = chunkUPTP7QX5_js.useWishes({
|
|
331
329
|
filters: initialFilters,
|
|
332
330
|
refreshInterval
|
|
333
331
|
});
|
|
@@ -414,7 +412,7 @@ function WishList({
|
|
|
414
412
|
)
|
|
415
413
|
] });
|
|
416
414
|
}
|
|
417
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
415
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkUPTP7QX5_js.cn("space-y-6", className), children: [
|
|
418
416
|
heading && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
419
417
|
framerMotion.motion.div,
|
|
420
418
|
{
|
|
@@ -504,7 +502,7 @@ function WishList({
|
|
|
504
502
|
wishes.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
505
503
|
"div",
|
|
506
504
|
{
|
|
507
|
-
className:
|
|
505
|
+
className: chunkUPTP7QX5_js.cn(
|
|
508
506
|
variant === "cards" && "grid gap-4",
|
|
509
507
|
variant === "compact" && "space-y-2",
|
|
510
508
|
variant === "masonry" && "columns-1 md:columns-2 lg:columns-3 gap-4"
|
|
@@ -647,7 +645,7 @@ function WishDetail({
|
|
|
647
645
|
onCommentAdded,
|
|
648
646
|
className
|
|
649
647
|
}) {
|
|
650
|
-
const { theme } =
|
|
648
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
651
649
|
const primaryColor = theme.colors?.primary || "#0EA5E9";
|
|
652
650
|
const borderRadius = theme.borderRadius || 16;
|
|
653
651
|
const isDark = theme.isDark ?? false;
|
|
@@ -664,7 +662,7 @@ function WishDetail({
|
|
|
664
662
|
voteCount,
|
|
665
663
|
toggle: toggleVote,
|
|
666
664
|
isLoading: isVoteLoading
|
|
667
|
-
} =
|
|
665
|
+
} = chunkUPTP7QX5_js.useVote({
|
|
668
666
|
wishId: wish?.id || "",
|
|
669
667
|
initialVoteCount: wish?.vote_count,
|
|
670
668
|
initialHasVoted: wish?.has_voted
|
|
@@ -674,7 +672,7 @@ function WishDetail({
|
|
|
674
672
|
isLoading: isLoadingComments,
|
|
675
673
|
createComment,
|
|
676
674
|
isCreating: isAddingComment
|
|
677
|
-
} =
|
|
675
|
+
} = chunkUPTP7QX5_js.useComments({
|
|
678
676
|
wishId: wish?.id || ""
|
|
679
677
|
});
|
|
680
678
|
if (!wish) return null;
|
|
@@ -722,7 +720,7 @@ function WishDetail({
|
|
|
722
720
|
animate: { x: 0 },
|
|
723
721
|
exit: { x: "100%" },
|
|
724
722
|
transition: { type: "spring", damping: 30, stiffness: 300 },
|
|
725
|
-
className:
|
|
723
|
+
className: chunkUPTP7QX5_js.cn(
|
|
726
724
|
"fixed right-0 top-0 bottom-0 w-full sm:w-[500px] md:w-[600px] z-50 shadow-2xl flex flex-col overflow-hidden",
|
|
727
725
|
className
|
|
728
726
|
),
|
|
@@ -749,7 +747,7 @@ function WishDetail({
|
|
|
749
747
|
disabled: isVoteLoading,
|
|
750
748
|
whileHover: { scale: 1.05 },
|
|
751
749
|
whileTap: { scale: 0.95 },
|
|
752
|
-
className:
|
|
750
|
+
className: chunkUPTP7QX5_js.cn(
|
|
753
751
|
"flex flex-col items-center justify-center gap-1 px-4 py-3 rounded-xl border-2 transition-all min-w-[70px] shrink-0",
|
|
754
752
|
isVoteLoading && "opacity-50"
|
|
755
753
|
),
|
|
@@ -762,7 +760,7 @@ function WishDetail({
|
|
|
762
760
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
763
761
|
lucideReact.ChevronUp,
|
|
764
762
|
{
|
|
765
|
-
className:
|
|
763
|
+
className: chunkUPTP7QX5_js.cn("w-6 h-6 transition-all", hasVoted && "fill-current"),
|
|
766
764
|
strokeWidth: 2
|
|
767
765
|
}
|
|
768
766
|
),
|
|
@@ -929,7 +927,7 @@ function WishDetail({
|
|
|
929
927
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
930
928
|
"p",
|
|
931
929
|
{
|
|
932
|
-
className:
|
|
930
|
+
className: chunkUPTP7QX5_js.cn(
|
|
933
931
|
"text-sm leading-relaxed",
|
|
934
932
|
comment.is_official && "p-3 rounded-lg"
|
|
935
933
|
),
|
|
@@ -962,7 +960,6 @@ function WishDetail({
|
|
|
962
960
|
placeholder: "Your name (optional)",
|
|
963
961
|
value: authorName,
|
|
964
962
|
onChange: (e) => setAuthorName(e.target.value),
|
|
965
|
-
maxLength: 100,
|
|
966
963
|
className: "w-full h-10 px-4 text-sm border focus:outline-none focus:ring-2 transition-all",
|
|
967
964
|
style: {
|
|
968
965
|
borderColor: isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.1)",
|
|
@@ -979,7 +976,6 @@ function WishDetail({
|
|
|
979
976
|
placeholder: "Write a comment...",
|
|
980
977
|
value: newComment,
|
|
981
978
|
onChange: (e) => setNewComment(e.target.value),
|
|
982
|
-
maxLength: 1e3,
|
|
983
979
|
className: "flex-1 min-h-[60px] px-4 py-3 text-sm border focus:outline-none focus:ring-2 resize-none transition-all",
|
|
984
980
|
style: {
|
|
985
981
|
borderColor: isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.1)",
|
|
@@ -1022,7 +1018,7 @@ function SubmitWishForm({
|
|
|
1022
1018
|
submitButtonText = "Submit Feature Request",
|
|
1023
1019
|
className
|
|
1024
1020
|
}) {
|
|
1025
|
-
const { theme, client } =
|
|
1021
|
+
const { theme, client } = chunkUPTP7QX5_js.useAppgramContext();
|
|
1026
1022
|
const primaryColor = theme.colors?.primary || "#0EA5E9";
|
|
1027
1023
|
const secondaryColor = theme.colors?.secondary || "#38BDF8";
|
|
1028
1024
|
const borderRadius = theme.borderRadius || 16;
|
|
@@ -1091,7 +1087,7 @@ function SubmitWishForm({
|
|
|
1091
1087
|
animate: { x: 0 },
|
|
1092
1088
|
exit: { x: "100%" },
|
|
1093
1089
|
transition: { type: "spring", damping: 30, stiffness: 300 },
|
|
1094
|
-
className:
|
|
1090
|
+
className: chunkUPTP7QX5_js.cn(
|
|
1095
1091
|
"fixed right-0 top-0 bottom-0 w-full sm:w-[480px] md:w-[540px] z-50 shadow-2xl flex flex-col overflow-hidden",
|
|
1096
1092
|
className
|
|
1097
1093
|
),
|
|
@@ -1172,7 +1168,6 @@ function SubmitWishForm({
|
|
|
1172
1168
|
value: formData.title,
|
|
1173
1169
|
onChange: (e) => setFormData({ ...formData, title: e.target.value }),
|
|
1174
1170
|
required: true,
|
|
1175
|
-
maxLength: 150,
|
|
1176
1171
|
className: "w-full h-11 px-4 text-sm border focus:outline-none focus:ring-2 transition-all",
|
|
1177
1172
|
style: {
|
|
1178
1173
|
borderColor: isDark ? "rgba(255, 255, 255, 0.15)" : "rgba(0, 0, 0, 0.15)",
|
|
@@ -1226,7 +1221,6 @@ function SubmitWishForm({
|
|
|
1226
1221
|
value: formData.description,
|
|
1227
1222
|
onChange: (e) => setFormData({ ...formData, description: e.target.value }),
|
|
1228
1223
|
required: true,
|
|
1229
|
-
maxLength: 500,
|
|
1230
1224
|
rows: 5,
|
|
1231
1225
|
className: "w-full px-4 py-3 text-sm border focus:outline-none focus:ring-2 resize-none transition-all",
|
|
1232
1226
|
style: {
|
|
@@ -1421,11 +1415,11 @@ function RoadmapColumn({
|
|
|
1421
1415
|
renderItem,
|
|
1422
1416
|
className
|
|
1423
1417
|
}) {
|
|
1424
|
-
const { theme } =
|
|
1418
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
1425
1419
|
const borderRadius = theme.borderRadius || 8;
|
|
1426
1420
|
const isDark = theme.isDark ?? false;
|
|
1427
1421
|
const items = column.items || [];
|
|
1428
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
1422
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkUPTP7QX5_js.cn("flex flex-col min-w-[280px] max-w-[320px]", className), children: [
|
|
1429
1423
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1430
1424
|
"div",
|
|
1431
1425
|
{
|
|
@@ -1450,7 +1444,7 @@ function RoadmapColumn({
|
|
|
1450
1444
|
"div",
|
|
1451
1445
|
{
|
|
1452
1446
|
onClick: onItemClick ? () => onItemClick(item) : void 0,
|
|
1453
|
-
className:
|
|
1447
|
+
className: chunkUPTP7QX5_js.cn(
|
|
1454
1448
|
"p-3 shadow-sm",
|
|
1455
1449
|
"hover:shadow-md transition-shadow duration-200",
|
|
1456
1450
|
onItemClick && "cursor-pointer"
|
|
@@ -1705,8 +1699,8 @@ function RoadmapBoard({
|
|
|
1705
1699
|
refreshInterval = 0,
|
|
1706
1700
|
className
|
|
1707
1701
|
}) {
|
|
1708
|
-
const { theme } =
|
|
1709
|
-
const { columns, isLoading, error, refetch } =
|
|
1702
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
1703
|
+
const { columns, isLoading, error, refetch } = chunkUPTP7QX5_js.useRoadmap({
|
|
1710
1704
|
refreshInterval
|
|
1711
1705
|
});
|
|
1712
1706
|
const [selectedWish, setSelectedWish] = React12.useState(null);
|
|
@@ -1778,7 +1772,7 @@ function RoadmapBoard({
|
|
|
1778
1772
|
)
|
|
1779
1773
|
] });
|
|
1780
1774
|
}
|
|
1781
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
1775
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkUPTP7QX5_js.cn("space-y-8", className), children: [
|
|
1782
1776
|
heading && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1783
1777
|
framerMotion.motion.div,
|
|
1784
1778
|
{
|
|
@@ -1970,7 +1964,7 @@ function ReleaseCard({
|
|
|
1970
1964
|
showDate = true,
|
|
1971
1965
|
className
|
|
1972
1966
|
}) {
|
|
1973
|
-
const { theme } =
|
|
1967
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
1974
1968
|
const borderRadius = theme.borderRadius || 8;
|
|
1975
1969
|
const date = release.published_at || release.created_at;
|
|
1976
1970
|
const formattedDate = date ? new Date(date).toLocaleDateString("en-US", {
|
|
@@ -1982,7 +1976,7 @@ function ReleaseCard({
|
|
|
1982
1976
|
"article",
|
|
1983
1977
|
{
|
|
1984
1978
|
onClick,
|
|
1985
|
-
className:
|
|
1979
|
+
className: chunkUPTP7QX5_js.cn(
|
|
1986
1980
|
"bg-white border border-gray-200 overflow-hidden",
|
|
1987
1981
|
"hover:shadow-md transition-shadow duration-200",
|
|
1988
1982
|
onClick && "cursor-pointer",
|
|
@@ -2006,7 +2000,7 @@ function ReleaseCard({
|
|
|
2006
2000
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2007
2001
|
"span",
|
|
2008
2002
|
{
|
|
2009
|
-
className:
|
|
2003
|
+
className: chunkUPTP7QX5_js.cn("px-2 py-0.5 text-xs rounded-full", style.bg, style.text),
|
|
2010
2004
|
children: label
|
|
2011
2005
|
},
|
|
2012
2006
|
label
|
|
@@ -2053,7 +2047,7 @@ function ModernReleaseCard({
|
|
|
2053
2047
|
framerMotion.motion.article,
|
|
2054
2048
|
{
|
|
2055
2049
|
whileHover: { y: -2 },
|
|
2056
|
-
className:
|
|
2050
|
+
className: chunkUPTP7QX5_js.cn(
|
|
2057
2051
|
"group cursor-pointer rounded-lg border transition-all duration-200",
|
|
2058
2052
|
featured ? "p-6 sm:p-8" : "p-5"
|
|
2059
2053
|
),
|
|
@@ -2104,7 +2098,7 @@ function ModernReleaseCard({
|
|
|
2104
2098
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2105
2099
|
"h3",
|
|
2106
2100
|
{
|
|
2107
|
-
className:
|
|
2101
|
+
className: chunkUPTP7QX5_js.cn(
|
|
2108
2102
|
"font-semibold mb-3 transition-opacity group-hover:opacity-70",
|
|
2109
2103
|
featured ? "text-2xl" : "text-lg"
|
|
2110
2104
|
),
|
|
@@ -2115,7 +2109,7 @@ function ModernReleaseCard({
|
|
|
2115
2109
|
(release.excerpt || release.content) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2116
2110
|
"p",
|
|
2117
2111
|
{
|
|
2118
|
-
className:
|
|
2112
|
+
className: chunkUPTP7QX5_js.cn(
|
|
2119
2113
|
"leading-relaxed mb-5",
|
|
2120
2114
|
featured ? "text-base" : "text-sm"
|
|
2121
2115
|
),
|
|
@@ -2218,8 +2212,8 @@ function ReleaseList({
|
|
|
2218
2212
|
renderError,
|
|
2219
2213
|
className
|
|
2220
2214
|
}) {
|
|
2221
|
-
const { theme } =
|
|
2222
|
-
const { releases, isLoading, error, refetch } =
|
|
2215
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
2216
|
+
const { releases, isLoading, error, refetch } = chunkUPTP7QX5_js.useReleases({ limit });
|
|
2223
2217
|
const primaryColor = theme.colors?.primary || "#0EA5E9";
|
|
2224
2218
|
const borderRadius = theme.borderRadius || 16;
|
|
2225
2219
|
const isDark = theme.isDark ?? false;
|
|
@@ -2250,7 +2244,7 @@ function ReleaseList({
|
|
|
2250
2244
|
)
|
|
2251
2245
|
] });
|
|
2252
2246
|
}
|
|
2253
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
2247
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkUPTP7QX5_js.cn("max-w-3xl mx-auto", className), children: [
|
|
2254
2248
|
(heading || description) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2255
2249
|
framerMotion.motion.header,
|
|
2256
2250
|
{
|
|
@@ -2551,13 +2545,13 @@ function ReleaseDetail({
|
|
|
2551
2545
|
renderError,
|
|
2552
2546
|
className
|
|
2553
2547
|
}) {
|
|
2554
|
-
const { theme } =
|
|
2548
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
2555
2549
|
const {
|
|
2556
2550
|
release: fetchedRelease,
|
|
2557
2551
|
isLoading,
|
|
2558
2552
|
error,
|
|
2559
2553
|
refetch
|
|
2560
|
-
} =
|
|
2554
|
+
} = chunkUPTP7QX5_js.useRelease({
|
|
2561
2555
|
releaseSlug: releaseSlug || "",
|
|
2562
2556
|
skip: !releaseSlug || !!providedRelease
|
|
2563
2557
|
});
|
|
@@ -2597,7 +2591,7 @@ function ReleaseDetail({
|
|
|
2597
2591
|
acc[item.type].push(item);
|
|
2598
2592
|
return acc;
|
|
2599
2593
|
}, {});
|
|
2600
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
2594
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUPTP7QX5_js.cn("w-full", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-3xl mx-auto px-6 py-8", children: [
|
|
2601
2595
|
showBackButton && onBack && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2602
2596
|
framerMotion.motion.button,
|
|
2603
2597
|
{
|
|
@@ -2823,7 +2817,7 @@ function Releases({
|
|
|
2823
2817
|
animate: { opacity: 1, x: 0 },
|
|
2824
2818
|
exit: { opacity: 0, x: -20 }
|
|
2825
2819
|
};
|
|
2826
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
2820
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUPTP7QX5_js.cn("w-full", className), children: /* @__PURE__ */ jsxRuntime.jsxs(framerMotion.AnimatePresence, { mode: "wait", children: [
|
|
2827
2821
|
viewState.type === "list" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2828
2822
|
framerMotion.motion.div,
|
|
2829
2823
|
{
|
|
@@ -2950,7 +2944,6 @@ function MediaCarousel({
|
|
|
2950
2944
|
{
|
|
2951
2945
|
src: getEmbedUrl(currentMedia.url),
|
|
2952
2946
|
className: "w-full h-full",
|
|
2953
|
-
sandbox: "allow-scripts allow-same-origin allow-presentation",
|
|
2954
2947
|
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
2955
2948
|
allowFullScreen: true,
|
|
2956
2949
|
title: currentMedia.title || "Video"
|
|
@@ -3042,8 +3035,8 @@ function WhatsNewPopup({
|
|
|
3042
3035
|
autoPlayInterval = 5e3,
|
|
3043
3036
|
className
|
|
3044
3037
|
}) {
|
|
3045
|
-
const { theme, client } =
|
|
3046
|
-
const { releases, isLoading } =
|
|
3038
|
+
const { theme, client } = chunkUPTP7QX5_js.useAppgramContext();
|
|
3039
|
+
const { releases, isLoading } = chunkUPTP7QX5_js.useReleases({ limit: 1 });
|
|
3047
3040
|
const [internalOpen, setInternalOpen] = React12.useState(false);
|
|
3048
3041
|
const [features, setFeatures] = React12.useState([]);
|
|
3049
3042
|
const isControlled = controlledOpen !== void 0;
|
|
@@ -3131,7 +3124,7 @@ function WhatsNewPopup({
|
|
|
3131
3124
|
animate: { opacity: 1, y: 0, scale: 1 },
|
|
3132
3125
|
exit: { opacity: 0, y: 50, scale: 0.95 },
|
|
3133
3126
|
transition: { type: "spring", damping: 25, stiffness: 300 },
|
|
3134
|
-
className:
|
|
3127
|
+
className: chunkUPTP7QX5_js.cn(
|
|
3135
3128
|
"fixed z-50 w-[380px] max-w-[calc(100vw-2rem)]",
|
|
3136
3129
|
positionClasses[position],
|
|
3137
3130
|
className
|
|
@@ -3352,8 +3345,8 @@ function HelpCollections({
|
|
|
3352
3345
|
renderError,
|
|
3353
3346
|
className
|
|
3354
3347
|
}) {
|
|
3355
|
-
const { theme } =
|
|
3356
|
-
const { flows, isLoading, error, refetch } =
|
|
3348
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
3349
|
+
const { flows, isLoading, error, refetch } = chunkUPTP7QX5_js.useHelpCenter();
|
|
3357
3350
|
const [searchQuery, setSearchQuery] = React12.useState("");
|
|
3358
3351
|
const [showAllArticles, setShowAllArticles] = React12.useState(false);
|
|
3359
3352
|
const [hasInitiallyLoaded, setHasInitiallyLoaded] = React12.useState(false);
|
|
@@ -3423,7 +3416,7 @@ function HelpCollections({
|
|
|
3423
3416
|
...onLiveChatClick ? [{ label: "Live Chat", icon: lucideReact.MessageCircle, onClick: onLiveChatClick }] : []
|
|
3424
3417
|
];
|
|
3425
3418
|
const actions = quickActions || defaultQuickActions;
|
|
3426
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
3419
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUPTP7QX5_js.cn("w-full", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-4xl mx-auto px-6 py-8", children: [
|
|
3427
3420
|
(heading || description) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3428
3421
|
framerMotion.motion.header,
|
|
3429
3422
|
{
|
|
@@ -3554,7 +3547,7 @@ function HelpCollections({
|
|
|
3554
3547
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3555
3548
|
"div",
|
|
3556
3549
|
{
|
|
3557
|
-
className:
|
|
3550
|
+
className: chunkUPTP7QX5_js.cn(
|
|
3558
3551
|
variant === "grid" && "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",
|
|
3559
3552
|
variant === "list" && "space-y-3"
|
|
3560
3553
|
),
|
|
@@ -3832,14 +3825,14 @@ function HelpArticles({
|
|
|
3832
3825
|
renderError,
|
|
3833
3826
|
className
|
|
3834
3827
|
}) {
|
|
3835
|
-
const { theme } =
|
|
3828
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
3836
3829
|
const isDark = theme.isDark ?? false;
|
|
3837
3830
|
const {
|
|
3838
3831
|
flow: fetchedFlow,
|
|
3839
3832
|
isLoading,
|
|
3840
3833
|
error,
|
|
3841
3834
|
refetch
|
|
3842
|
-
} =
|
|
3835
|
+
} = chunkUPTP7QX5_js.useHelpFlow({
|
|
3843
3836
|
flowSlug: flowSlug || "",
|
|
3844
3837
|
skip: !flowSlug || !!providedFlow
|
|
3845
3838
|
});
|
|
@@ -3901,7 +3894,7 @@ function HelpArticles({
|
|
|
3901
3894
|
(article) => article.title.toLowerCase().includes(debouncedQuery.toLowerCase()) || article.excerpt?.toLowerCase().includes(debouncedQuery.toLowerCase()) || article.content.toLowerCase().includes(debouncedQuery.toLowerCase())
|
|
3902
3895
|
) : articles;
|
|
3903
3896
|
const publishedArticles = filteredArticles.filter((a) => a.is_published).sort((a, b) => a.sort_order - b.sort_order);
|
|
3904
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
3897
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUPTP7QX5_js.cn("w-full", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-4xl mx-auto px-6 py-8", children: [
|
|
3905
3898
|
showBackButton && onBack && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3906
3899
|
framerMotion.motion.button,
|
|
3907
3900
|
{
|
|
@@ -4181,14 +4174,14 @@ function HelpArticleDetail({
|
|
|
4181
4174
|
renderError,
|
|
4182
4175
|
className
|
|
4183
4176
|
}) {
|
|
4184
|
-
const { theme } =
|
|
4177
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
4185
4178
|
const isDark = theme.isDark ?? false;
|
|
4186
4179
|
const {
|
|
4187
4180
|
article: fetchedArticle,
|
|
4188
4181
|
isLoading,
|
|
4189
4182
|
error,
|
|
4190
4183
|
refetch
|
|
4191
|
-
} =
|
|
4184
|
+
} = chunkUPTP7QX5_js.useHelpArticle({
|
|
4192
4185
|
articleSlug: articleSlug || "",
|
|
4193
4186
|
flowId: flowId || "",
|
|
4194
4187
|
skip: !articleSlug || !flowId || !!providedArticle
|
|
@@ -4224,7 +4217,7 @@ function HelpArticleDetail({
|
|
|
4224
4217
|
}
|
|
4225
4218
|
if (!article) return null;
|
|
4226
4219
|
const typeConfig = ARTICLE_TYPE_CONFIG2[article.article_type];
|
|
4227
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
4220
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkUPTP7QX5_js.cn("w-full", className), children: [
|
|
4228
4221
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-4xl mx-auto px-6 py-8", children: [
|
|
4229
4222
|
showBackButton && onBack && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4230
4223
|
framerMotion.motion.button,
|
|
@@ -4339,7 +4332,7 @@ function HelpArticleDetail({
|
|
|
4339
4332
|
"div",
|
|
4340
4333
|
{
|
|
4341
4334
|
className: "article-content",
|
|
4342
|
-
dangerouslySetInnerHTML: { __html:
|
|
4335
|
+
dangerouslySetInnerHTML: { __html: article.content }
|
|
4343
4336
|
}
|
|
4344
4337
|
)
|
|
4345
4338
|
}
|
|
@@ -4481,7 +4474,7 @@ function HelpCenter({
|
|
|
4481
4474
|
animate: { opacity: 1, x: 0 },
|
|
4482
4475
|
exit: { opacity: 0, x: -20 }
|
|
4483
4476
|
};
|
|
4484
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
4477
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUPTP7QX5_js.cn("w-full", className), children: /* @__PURE__ */ jsxRuntime.jsxs(framerMotion.AnimatePresence, { mode: "wait", children: [
|
|
4485
4478
|
viewState.type === "collections" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4486
4479
|
framerMotion.motion.div,
|
|
4487
4480
|
{
|
|
@@ -4597,7 +4590,7 @@ function SupportForm({
|
|
|
4597
4590
|
accessToken,
|
|
4598
4591
|
className
|
|
4599
4592
|
}) {
|
|
4600
|
-
const { theme } =
|
|
4593
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
4601
4594
|
const {
|
|
4602
4595
|
submitTicket,
|
|
4603
4596
|
isSubmitting,
|
|
@@ -4608,7 +4601,7 @@ function SupportForm({
|
|
|
4608
4601
|
isSendingMagicLink,
|
|
4609
4602
|
verifyToken,
|
|
4610
4603
|
isVerifying
|
|
4611
|
-
} =
|
|
4604
|
+
} = chunkUPTP7QX5_js.useSupport({
|
|
4612
4605
|
onSubmitSuccess,
|
|
4613
4606
|
onSubmitError
|
|
4614
4607
|
});
|
|
@@ -4696,7 +4689,7 @@ function SupportForm({
|
|
|
4696
4689
|
setAttachments((prev) => prev.filter((_, i) => i !== index));
|
|
4697
4690
|
};
|
|
4698
4691
|
if (successMessage) {
|
|
4699
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
4692
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUPTP7QX5_js.cn("max-w-3xl mx-auto", className), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4700
4693
|
framerMotion.motion.div,
|
|
4701
4694
|
{
|
|
4702
4695
|
initial: { opacity: 0, scale: 0.95 },
|
|
@@ -4747,7 +4740,7 @@ function SupportForm({
|
|
|
4747
4740
|
}
|
|
4748
4741
|
) });
|
|
4749
4742
|
}
|
|
4750
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
4743
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkUPTP7QX5_js.cn("max-w-3xl mx-auto", className), children: [
|
|
4751
4744
|
(heading || description) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4752
4745
|
framerMotion.motion.header,
|
|
4753
4746
|
{
|
|
@@ -4891,7 +4884,6 @@ function SupportForm({
|
|
|
4891
4884
|
placeholder: "Your name",
|
|
4892
4885
|
value: formData.user_name,
|
|
4893
4886
|
onChange: handleChange,
|
|
4894
|
-
maxLength: 100,
|
|
4895
4887
|
className: "w-full h-10 px-4 text-sm border focus:outline-none focus:ring-2 transition-all",
|
|
4896
4888
|
style: {
|
|
4897
4889
|
backgroundColor: isDark ? "var(--appgram-card)" : "white",
|
|
@@ -4959,7 +4951,6 @@ function SupportForm({
|
|
|
4959
4951
|
value: formData.subject,
|
|
4960
4952
|
onChange: handleChange,
|
|
4961
4953
|
required: true,
|
|
4962
|
-
maxLength: 200,
|
|
4963
4954
|
className: "w-full h-10 px-4 text-sm border focus:outline-none focus:ring-2 transition-all",
|
|
4964
4955
|
style: {
|
|
4965
4956
|
backgroundColor: isDark ? "var(--appgram-card)" : "white",
|
|
@@ -4983,7 +4974,6 @@ function SupportForm({
|
|
|
4983
4974
|
value: formData.description,
|
|
4984
4975
|
onChange: handleChange,
|
|
4985
4976
|
required: true,
|
|
4986
|
-
maxLength: 2e3,
|
|
4987
4977
|
rows: 5,
|
|
4988
4978
|
className: "w-full px-4 py-3 text-sm border focus:outline-none focus:ring-2 resize-none transition-all",
|
|
4989
4979
|
style: {
|
|
@@ -5564,7 +5554,7 @@ function StatusBoard({
|
|
|
5564
5554
|
renderIncident,
|
|
5565
5555
|
className
|
|
5566
5556
|
}) {
|
|
5567
|
-
const { theme } =
|
|
5557
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
5568
5558
|
const primaryColor = theme.colors?.primary || "#0EA5E9";
|
|
5569
5559
|
const borderRadius = theme.borderRadius || 16;
|
|
5570
5560
|
const isDark = theme.isDark ?? false;
|
|
@@ -5596,7 +5586,7 @@ function StatusBoard({
|
|
|
5596
5586
|
},
|
|
5597
5587
|
{}
|
|
5598
5588
|
);
|
|
5599
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
5589
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkUPTP7QX5_js.cn("max-w-4xl mx-auto space-y-8", className), children: [
|
|
5600
5590
|
(heading || description) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5601
5591
|
framerMotion.motion.header,
|
|
5602
5592
|
{
|
|
@@ -6088,7 +6078,7 @@ function StatusIncidentDetail({
|
|
|
6088
6078
|
showAffectedComponents = true,
|
|
6089
6079
|
className
|
|
6090
6080
|
}) {
|
|
6091
|
-
const { theme } =
|
|
6081
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
6092
6082
|
const primaryColor = theme.colors?.primary || "#0EA5E9";
|
|
6093
6083
|
const borderRadius = theme.borderRadius || 16;
|
|
6094
6084
|
const isDark = theme.isDark ?? false;
|
|
@@ -6096,7 +6086,7 @@ function StatusIncidentDetail({
|
|
|
6096
6086
|
const impact = impactConfig2[incident.impact];
|
|
6097
6087
|
const StatusIcon = statusConfig3.icon;
|
|
6098
6088
|
const isResolved = incident.status === "resolved";
|
|
6099
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
6089
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUPTP7QX5_js.cn("w-full", className), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-3xl mx-auto px-6 py-8", children: [
|
|
6100
6090
|
showBackButton && onBack && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6101
6091
|
framerMotion.motion.button,
|
|
6102
6092
|
{
|
|
@@ -6344,7 +6334,762 @@ function StatusIncidentDetail({
|
|
|
6344
6334
|
)
|
|
6345
6335
|
] }) });
|
|
6346
6336
|
}
|
|
6337
|
+
function SurveyRenderer({
|
|
6338
|
+
slug,
|
|
6339
|
+
title,
|
|
6340
|
+
description,
|
|
6341
|
+
onComplete,
|
|
6342
|
+
onError,
|
|
6343
|
+
externalUserId,
|
|
6344
|
+
metadata,
|
|
6345
|
+
className
|
|
6346
|
+
}) {
|
|
6347
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
6348
|
+
const { survey, nodes, isLoading, error: fetchError } = chunkUPTP7QX5_js.useSurvey(slug);
|
|
6349
|
+
const { submitResponse, isSubmitting, error: submitError, successMessage } = chunkUPTP7QX5_js.useSurveySubmit({
|
|
6350
|
+
onSuccess: () => onComplete?.(),
|
|
6351
|
+
onError
|
|
6352
|
+
});
|
|
6353
|
+
const [answers, setAnswers] = React12.useState(/* @__PURE__ */ new Map());
|
|
6354
|
+
const [visitedNodes, setVisitedNodes] = React12.useState([]);
|
|
6355
|
+
const primaryColor = theme.colors?.primary || "#0EA5E9";
|
|
6356
|
+
const borderRadius = theme.borderRadius || 16;
|
|
6357
|
+
const isDark = theme.isDark ?? false;
|
|
6358
|
+
const sortedNodes = React12.useMemo(() => {
|
|
6359
|
+
return [...nodes].sort((a, b) => a.sort_order - b.sort_order);
|
|
6360
|
+
}, [nodes]);
|
|
6361
|
+
const rootNode = React12.useMemo(() => {
|
|
6362
|
+
return sortedNodes.find((n) => n.parent_id === null) || sortedNodes[0];
|
|
6363
|
+
}, [sortedNodes]);
|
|
6364
|
+
const currentNodeId = visitedNodes.length > 0 ? visitedNodes[visitedNodes.length - 1] : rootNode?.id;
|
|
6365
|
+
const currentNode = nodes.find((n) => n.id === currentNodeId) || null;
|
|
6366
|
+
const getNextNode = React12.useCallback((node, answer) => {
|
|
6367
|
+
if (node.question_type === "yes_no") {
|
|
6368
|
+
const isYes = answer.answer_text === "yes" || answer.answer === true;
|
|
6369
|
+
const nextId = isYes ? node.answer_yes_node_id : node.answer_no_node_id;
|
|
6370
|
+
if (nextId) {
|
|
6371
|
+
return nodes.find((n) => n.id === nextId) || null;
|
|
6372
|
+
}
|
|
6373
|
+
}
|
|
6374
|
+
if (node.branches && node.branches.length > 0) {
|
|
6375
|
+
for (const branch of node.branches) {
|
|
6376
|
+
const { condition } = branch;
|
|
6377
|
+
let matches = false;
|
|
6378
|
+
if (condition.type === "equals") {
|
|
6379
|
+
if (answer.answer_text !== void 0) matches = answer.answer_text === String(condition.value);
|
|
6380
|
+
if (answer.answer_rating !== void 0) matches = answer.answer_rating === Number(condition.value);
|
|
6381
|
+
if (answer.answer_options?.length === 1) matches = answer.answer_options[0] === String(condition.value);
|
|
6382
|
+
} else if (condition.type === "contains") {
|
|
6383
|
+
if (answer.answer_text) matches = answer.answer_text.includes(String(condition.value));
|
|
6384
|
+
if (answer.answer_options) matches = answer.answer_options.includes(String(condition.value));
|
|
6385
|
+
} else if (condition.type === "gt" && answer.answer_rating !== void 0) {
|
|
6386
|
+
matches = answer.answer_rating > Number(condition.value);
|
|
6387
|
+
} else if (condition.type === "lt" && answer.answer_rating !== void 0) {
|
|
6388
|
+
matches = answer.answer_rating < Number(condition.value);
|
|
6389
|
+
} else if (condition.type === "gte" && answer.answer_rating !== void 0) {
|
|
6390
|
+
matches = answer.answer_rating >= Number(condition.value);
|
|
6391
|
+
} else if (condition.type === "lte" && answer.answer_rating !== void 0) {
|
|
6392
|
+
matches = answer.answer_rating <= Number(condition.value);
|
|
6393
|
+
}
|
|
6394
|
+
if (matches) {
|
|
6395
|
+
return nodes.find((n) => n.id === branch.next_node_id) || null;
|
|
6396
|
+
}
|
|
6397
|
+
}
|
|
6398
|
+
}
|
|
6399
|
+
if (node.next_node_id) {
|
|
6400
|
+
return nodes.find((n) => n.id === node.next_node_id) || null;
|
|
6401
|
+
}
|
|
6402
|
+
return null;
|
|
6403
|
+
}, [nodes]);
|
|
6404
|
+
const handleNext = React12.useCallback(() => {
|
|
6405
|
+
if (!currentNode) return;
|
|
6406
|
+
const answer = answers.get(currentNode.id);
|
|
6407
|
+
if (!answer && currentNode.is_required) return;
|
|
6408
|
+
const nextNode = answer ? getNextNode(currentNode, answer) : null;
|
|
6409
|
+
if (nextNode) {
|
|
6410
|
+
setVisitedNodes((prev) => [...prev, nextNode.id]);
|
|
6411
|
+
} else {
|
|
6412
|
+
handleSubmit();
|
|
6413
|
+
}
|
|
6414
|
+
}, [currentNode, answers, getNextNode]);
|
|
6415
|
+
const handleBack = React12.useCallback(() => {
|
|
6416
|
+
setVisitedNodes((prev) => prev.slice(0, -1));
|
|
6417
|
+
}, []);
|
|
6418
|
+
const handleSubmit = React12.useCallback(async () => {
|
|
6419
|
+
if (!survey) return;
|
|
6420
|
+
const fingerprint = chunkUPTP7QX5_js.getFingerprint();
|
|
6421
|
+
const answerEntries = Array.from(answers.entries()).map(([nodeId, ans]) => ({
|
|
6422
|
+
node_id: nodeId,
|
|
6423
|
+
answer: ans.answer,
|
|
6424
|
+
answer_text: ans.answer_text,
|
|
6425
|
+
answer_options: ans.answer_options,
|
|
6426
|
+
answer_rating: ans.answer_rating
|
|
6427
|
+
}));
|
|
6428
|
+
await submitResponse(survey.id, {
|
|
6429
|
+
fingerprint,
|
|
6430
|
+
external_user_id: externalUserId,
|
|
6431
|
+
metadata,
|
|
6432
|
+
answers: answerEntries
|
|
6433
|
+
});
|
|
6434
|
+
}, [survey, answers, submitResponse, externalUserId, metadata]);
|
|
6435
|
+
const updateAnswer = React12.useCallback((nodeId, answer) => {
|
|
6436
|
+
setAnswers((prev) => {
|
|
6437
|
+
const next = new Map(prev);
|
|
6438
|
+
next.set(nodeId, answer);
|
|
6439
|
+
return next;
|
|
6440
|
+
});
|
|
6441
|
+
}, []);
|
|
6442
|
+
if (currentNode?.result_message) {
|
|
6443
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUPTP7QX5_js.cn("max-w-2xl mx-auto", className), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6444
|
+
"div",
|
|
6445
|
+
{
|
|
6446
|
+
className: "rounded-lg border p-8 text-center",
|
|
6447
|
+
style: {
|
|
6448
|
+
backgroundColor: isDark ? "var(--appgram-card)" : "rgba(255, 255, 255, 0.7)",
|
|
6449
|
+
borderColor: isDark ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.05)",
|
|
6450
|
+
borderRadius: `${Math.min(borderRadius, 12)}px`
|
|
6451
|
+
},
|
|
6452
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6453
|
+
"p",
|
|
6454
|
+
{
|
|
6455
|
+
className: "text-lg font-medium",
|
|
6456
|
+
style: { color: "var(--appgram-foreground)" },
|
|
6457
|
+
children: currentNode.result_message
|
|
6458
|
+
}
|
|
6459
|
+
)
|
|
6460
|
+
}
|
|
6461
|
+
) });
|
|
6462
|
+
}
|
|
6463
|
+
if (successMessage) {
|
|
6464
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUPTP7QX5_js.cn("max-w-2xl mx-auto", className), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6465
|
+
"div",
|
|
6466
|
+
{
|
|
6467
|
+
className: "rounded-lg border p-8 text-center",
|
|
6468
|
+
style: {
|
|
6469
|
+
backgroundColor: isDark ? "var(--appgram-card)" : "rgba(255, 255, 255, 0.7)",
|
|
6470
|
+
borderColor: isDark ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.05)",
|
|
6471
|
+
borderRadius: `${Math.min(borderRadius, 12)}px`
|
|
6472
|
+
},
|
|
6473
|
+
children: [
|
|
6474
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6475
|
+
"div",
|
|
6476
|
+
{
|
|
6477
|
+
className: "inline-flex items-center justify-center w-16 h-16 rounded-full mb-6",
|
|
6478
|
+
style: { backgroundColor: "#10b98115" },
|
|
6479
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-8 h-8", style: { color: "#10b981" }, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) })
|
|
6480
|
+
}
|
|
6481
|
+
),
|
|
6482
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6483
|
+
"h2",
|
|
6484
|
+
{
|
|
6485
|
+
className: "text-2xl font-bold mb-3",
|
|
6486
|
+
style: { color: "var(--appgram-foreground)" },
|
|
6487
|
+
children: "Thank You"
|
|
6488
|
+
}
|
|
6489
|
+
),
|
|
6490
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6491
|
+
"p",
|
|
6492
|
+
{
|
|
6493
|
+
className: "text-base",
|
|
6494
|
+
style: { color: isDark ? "rgba(255, 255, 255, 0.6)" : "rgba(0, 0, 0, 0.6)" },
|
|
6495
|
+
children: successMessage
|
|
6496
|
+
}
|
|
6497
|
+
)
|
|
6498
|
+
]
|
|
6499
|
+
}
|
|
6500
|
+
) });
|
|
6501
|
+
}
|
|
6502
|
+
if (isLoading) {
|
|
6503
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUPTP7QX5_js.cn("max-w-2xl mx-auto flex items-center justify-center py-12", className), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6504
|
+
"div",
|
|
6505
|
+
{
|
|
6506
|
+
className: "w-8 h-8 border-2 border-t-transparent rounded-full animate-spin",
|
|
6507
|
+
style: { borderColor: primaryColor, borderTopColor: "transparent" }
|
|
6508
|
+
}
|
|
6509
|
+
) });
|
|
6510
|
+
}
|
|
6511
|
+
if (fetchError || submitError) {
|
|
6512
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUPTP7QX5_js.cn("max-w-2xl mx-auto", className), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6513
|
+
"div",
|
|
6514
|
+
{
|
|
6515
|
+
className: "p-4 text-sm",
|
|
6516
|
+
style: {
|
|
6517
|
+
backgroundColor: "rgba(239, 68, 68, 0.1)",
|
|
6518
|
+
color: "#dc2626",
|
|
6519
|
+
borderRadius: `${Math.min(borderRadius, 8)}px`
|
|
6520
|
+
},
|
|
6521
|
+
children: fetchError || submitError
|
|
6522
|
+
}
|
|
6523
|
+
) });
|
|
6524
|
+
}
|
|
6525
|
+
if (!currentNode || !survey) return /* @__PURE__ */ jsxRuntime.jsx("div", {});
|
|
6526
|
+
const currentAnswer = answers.get(currentNode.id);
|
|
6527
|
+
const isAnswered = !!currentAnswer;
|
|
6528
|
+
const isRequired = currentNode.is_required !== false;
|
|
6529
|
+
const canProceed = !isRequired || isAnswered;
|
|
6530
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkUPTP7QX5_js.cn("max-w-2xl mx-auto", className), children: [
|
|
6531
|
+
(title || survey.name) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-8", children: [
|
|
6532
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6533
|
+
"h1",
|
|
6534
|
+
{
|
|
6535
|
+
className: "text-2xl font-bold mb-2",
|
|
6536
|
+
style: { color: "var(--appgram-foreground)" },
|
|
6537
|
+
children: title || survey.name
|
|
6538
|
+
}
|
|
6539
|
+
),
|
|
6540
|
+
(description || survey.description) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6541
|
+
"p",
|
|
6542
|
+
{
|
|
6543
|
+
className: "text-base",
|
|
6544
|
+
style: { color: isDark ? "rgba(255, 255, 255, 0.6)" : "rgba(0, 0, 0, 0.6)" },
|
|
6545
|
+
children: description || survey.description
|
|
6546
|
+
}
|
|
6547
|
+
)
|
|
6548
|
+
] }),
|
|
6549
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6550
|
+
"div",
|
|
6551
|
+
{
|
|
6552
|
+
className: "rounded-lg border p-6",
|
|
6553
|
+
style: {
|
|
6554
|
+
backgroundColor: isDark ? "var(--appgram-card)" : "rgba(255, 255, 255, 0.7)",
|
|
6555
|
+
borderColor: isDark ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.05)",
|
|
6556
|
+
borderRadius: `${Math.min(borderRadius, 12)}px`
|
|
6557
|
+
},
|
|
6558
|
+
children: [
|
|
6559
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6560
|
+
"h2",
|
|
6561
|
+
{
|
|
6562
|
+
className: "text-lg font-semibold mb-6",
|
|
6563
|
+
style: { color: "var(--appgram-foreground)" },
|
|
6564
|
+
children: [
|
|
6565
|
+
currentNode.question,
|
|
6566
|
+
isRequired && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#dc2626" }, children: " *" })
|
|
6567
|
+
]
|
|
6568
|
+
}
|
|
6569
|
+
),
|
|
6570
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6571
|
+
QuestionInput,
|
|
6572
|
+
{
|
|
6573
|
+
node: currentNode,
|
|
6574
|
+
answer: currentAnswer,
|
|
6575
|
+
onChange: (answer) => updateAnswer(currentNode.id, answer),
|
|
6576
|
+
primaryColor,
|
|
6577
|
+
borderRadius,
|
|
6578
|
+
isDark
|
|
6579
|
+
}
|
|
6580
|
+
),
|
|
6581
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mt-8 pt-6 border-t", style: { borderColor: isDark ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.05)" }, children: [
|
|
6582
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6583
|
+
"button",
|
|
6584
|
+
{
|
|
6585
|
+
onClick: handleBack,
|
|
6586
|
+
disabled: visitedNodes.length === 0,
|
|
6587
|
+
className: "px-4 py-2 text-sm font-medium transition-opacity disabled:opacity-30",
|
|
6588
|
+
style: { color: isDark ? "rgba(255, 255, 255, 0.6)" : "rgba(0, 0, 0, 0.6)" },
|
|
6589
|
+
children: "Back"
|
|
6590
|
+
}
|
|
6591
|
+
),
|
|
6592
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6593
|
+
"button",
|
|
6594
|
+
{
|
|
6595
|
+
onClick: handleNext,
|
|
6596
|
+
disabled: !canProceed || isSubmitting,
|
|
6597
|
+
className: "px-6 py-2.5 text-sm text-white font-medium transition-all hover:shadow-lg disabled:opacity-50",
|
|
6598
|
+
style: {
|
|
6599
|
+
backgroundColor: primaryColor,
|
|
6600
|
+
borderRadius: `${Math.min(borderRadius, 8)}px`
|
|
6601
|
+
},
|
|
6602
|
+
children: isSubmitting ? "Submitting..." : "Next"
|
|
6603
|
+
}
|
|
6604
|
+
)
|
|
6605
|
+
] })
|
|
6606
|
+
]
|
|
6607
|
+
}
|
|
6608
|
+
)
|
|
6609
|
+
] });
|
|
6610
|
+
}
|
|
6611
|
+
function QuestionInput({
|
|
6612
|
+
node,
|
|
6613
|
+
answer,
|
|
6614
|
+
onChange,
|
|
6615
|
+
primaryColor,
|
|
6616
|
+
borderRadius,
|
|
6617
|
+
isDark
|
|
6618
|
+
}) {
|
|
6619
|
+
switch (node.question_type) {
|
|
6620
|
+
case "yes_no":
|
|
6621
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: ["yes", "no"].map((value) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6622
|
+
"button",
|
|
6623
|
+
{
|
|
6624
|
+
onClick: () => onChange({ answer_text: value, answer: value === "yes" }),
|
|
6625
|
+
className: "flex-1 py-3 text-sm font-medium border transition-all",
|
|
6626
|
+
style: {
|
|
6627
|
+
backgroundColor: answer?.answer_text === value ? `${primaryColor}15` : "transparent",
|
|
6628
|
+
borderColor: answer?.answer_text === value ? primaryColor : isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.1)",
|
|
6629
|
+
color: answer?.answer_text === value ? primaryColor : "var(--appgram-foreground)",
|
|
6630
|
+
borderRadius: `${Math.min(borderRadius, 8)}px`
|
|
6631
|
+
},
|
|
6632
|
+
children: value.charAt(0).toUpperCase() + value.slice(1)
|
|
6633
|
+
},
|
|
6634
|
+
value
|
|
6635
|
+
)) });
|
|
6636
|
+
case "short_answer":
|
|
6637
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6638
|
+
"input",
|
|
6639
|
+
{
|
|
6640
|
+
type: "text",
|
|
6641
|
+
value: answer?.answer_text || "",
|
|
6642
|
+
onChange: (e) => onChange({ answer_text: e.target.value }),
|
|
6643
|
+
placeholder: "Type your answer...",
|
|
6644
|
+
className: "w-full h-10 px-4 text-sm border focus:outline-none focus:ring-2 transition-all",
|
|
6645
|
+
style: {
|
|
6646
|
+
backgroundColor: isDark ? "var(--appgram-card)" : "white",
|
|
6647
|
+
borderColor: isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.1)",
|
|
6648
|
+
color: "var(--appgram-foreground)",
|
|
6649
|
+
borderRadius: `${Math.min(borderRadius, 8)}px`
|
|
6650
|
+
}
|
|
6651
|
+
}
|
|
6652
|
+
);
|
|
6653
|
+
case "paragraph":
|
|
6654
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6655
|
+
"textarea",
|
|
6656
|
+
{
|
|
6657
|
+
value: answer?.answer_text || "",
|
|
6658
|
+
onChange: (e) => onChange({ answer_text: e.target.value }),
|
|
6659
|
+
placeholder: "Type your answer...",
|
|
6660
|
+
rows: 4,
|
|
6661
|
+
className: "w-full px-4 py-3 text-sm border focus:outline-none focus:ring-2 resize-none transition-all",
|
|
6662
|
+
style: {
|
|
6663
|
+
backgroundColor: isDark ? "var(--appgram-card)" : "white",
|
|
6664
|
+
borderColor: isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.1)",
|
|
6665
|
+
color: "var(--appgram-foreground)",
|
|
6666
|
+
borderRadius: `${Math.min(borderRadius, 8)}px`
|
|
6667
|
+
}
|
|
6668
|
+
}
|
|
6669
|
+
);
|
|
6670
|
+
case "multiple_choice":
|
|
6671
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: (node.options || []).map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6672
|
+
"button",
|
|
6673
|
+
{
|
|
6674
|
+
onClick: () => onChange({ answer_options: [option.value] }),
|
|
6675
|
+
className: "w-full text-left px-4 py-3 text-sm border transition-all",
|
|
6676
|
+
style: {
|
|
6677
|
+
backgroundColor: answer?.answer_options?.[0] === option.value ? `${primaryColor}15` : "transparent",
|
|
6678
|
+
borderColor: answer?.answer_options?.[0] === option.value ? primaryColor : isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.1)",
|
|
6679
|
+
color: "var(--appgram-foreground)",
|
|
6680
|
+
borderRadius: `${Math.min(borderRadius, 8)}px`
|
|
6681
|
+
},
|
|
6682
|
+
children: option.label
|
|
6683
|
+
},
|
|
6684
|
+
option.value
|
|
6685
|
+
)) });
|
|
6686
|
+
case "checkboxes":
|
|
6687
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: (node.options || []).map((option) => {
|
|
6688
|
+
const selected = answer?.answer_options?.includes(option.value) || false;
|
|
6689
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6690
|
+
"button",
|
|
6691
|
+
{
|
|
6692
|
+
onClick: () => {
|
|
6693
|
+
const current = answer?.answer_options || [];
|
|
6694
|
+
const next = selected ? current.filter((v) => v !== option.value) : [...current, option.value];
|
|
6695
|
+
onChange({ answer_options: next });
|
|
6696
|
+
},
|
|
6697
|
+
className: "w-full text-left px-4 py-3 text-sm border transition-all flex items-center gap-3",
|
|
6698
|
+
style: {
|
|
6699
|
+
backgroundColor: selected ? `${primaryColor}15` : "transparent",
|
|
6700
|
+
borderColor: selected ? primaryColor : isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.1)",
|
|
6701
|
+
color: "var(--appgram-foreground)",
|
|
6702
|
+
borderRadius: `${Math.min(borderRadius, 8)}px`
|
|
6703
|
+
},
|
|
6704
|
+
children: [
|
|
6705
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6706
|
+
"div",
|
|
6707
|
+
{
|
|
6708
|
+
className: "w-4 h-4 border rounded flex items-center justify-center shrink-0",
|
|
6709
|
+
style: {
|
|
6710
|
+
borderColor: selected ? primaryColor : isDark ? "rgba(255, 255, 255, 0.3)" : "rgba(0, 0, 0, 0.3)",
|
|
6711
|
+
backgroundColor: selected ? primaryColor : "transparent"
|
|
6712
|
+
},
|
|
6713
|
+
children: selected && /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M5 13l4 4L19 7" }) })
|
|
6714
|
+
}
|
|
6715
|
+
),
|
|
6716
|
+
option.label
|
|
6717
|
+
]
|
|
6718
|
+
},
|
|
6719
|
+
option.value
|
|
6720
|
+
);
|
|
6721
|
+
}) });
|
|
6722
|
+
case "rating": {
|
|
6723
|
+
const min = node.min_rating ?? 1;
|
|
6724
|
+
const max = node.max_rating ?? 5;
|
|
6725
|
+
const ratings = Array.from({ length: max - min + 1 }, (_, i) => min + i);
|
|
6726
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-2 justify-center", children: ratings.map((value) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6727
|
+
"button",
|
|
6728
|
+
{
|
|
6729
|
+
onClick: () => onChange({ answer_rating: value }),
|
|
6730
|
+
className: "w-12 h-12 text-sm font-medium border transition-all",
|
|
6731
|
+
style: {
|
|
6732
|
+
backgroundColor: answer?.answer_rating === value ? primaryColor : "transparent",
|
|
6733
|
+
borderColor: answer?.answer_rating === value ? primaryColor : isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.1)",
|
|
6734
|
+
color: answer?.answer_rating === value ? "white" : "var(--appgram-foreground)",
|
|
6735
|
+
borderRadius: `${Math.min(borderRadius, 8)}px`
|
|
6736
|
+
},
|
|
6737
|
+
children: value
|
|
6738
|
+
},
|
|
6739
|
+
value
|
|
6740
|
+
)) });
|
|
6741
|
+
}
|
|
6742
|
+
default:
|
|
6743
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", {});
|
|
6744
|
+
}
|
|
6745
|
+
}
|
|
6746
|
+
function ContactFormRenderer({
|
|
6747
|
+
formId,
|
|
6748
|
+
projectId,
|
|
6749
|
+
title,
|
|
6750
|
+
description,
|
|
6751
|
+
onSuccess,
|
|
6752
|
+
onError,
|
|
6753
|
+
className
|
|
6754
|
+
}) {
|
|
6755
|
+
const { theme } = chunkUPTP7QX5_js.useAppgramContext();
|
|
6756
|
+
const { form, isLoading, error: fetchError } = chunkUPTP7QX5_js.useContactForm(formId);
|
|
6757
|
+
const {
|
|
6758
|
+
submitForm,
|
|
6759
|
+
isSubmitting,
|
|
6760
|
+
error: submitError,
|
|
6761
|
+
successMessage,
|
|
6762
|
+
validateField,
|
|
6763
|
+
clearMessages
|
|
6764
|
+
} = chunkUPTP7QX5_js.useContactFormSubmit({
|
|
6765
|
+
onSuccess: () => onSuccess?.(),
|
|
6766
|
+
onError
|
|
6767
|
+
});
|
|
6768
|
+
const [formData, setFormData] = React12.useState({});
|
|
6769
|
+
const [fieldErrors, setFieldErrors] = React12.useState({});
|
|
6770
|
+
const primaryColor = theme.colors?.primary || "#0EA5E9";
|
|
6771
|
+
const borderRadius = theme.borderRadius || 16;
|
|
6772
|
+
const isDark = theme.isDark ?? false;
|
|
6773
|
+
const handleFieldChange = React12.useCallback((fieldId, value) => {
|
|
6774
|
+
setFormData((prev) => ({ ...prev, [fieldId]: value }));
|
|
6775
|
+
setFieldErrors((prev) => {
|
|
6776
|
+
const next = { ...prev };
|
|
6777
|
+
delete next[fieldId];
|
|
6778
|
+
return next;
|
|
6779
|
+
});
|
|
6780
|
+
}, []);
|
|
6781
|
+
const handleSubmit = React12.useCallback(async (e) => {
|
|
6782
|
+
e.preventDefault();
|
|
6783
|
+
if (!form) return;
|
|
6784
|
+
const errors = {};
|
|
6785
|
+
for (const field of form.fields) {
|
|
6786
|
+
const value = formData[field.id];
|
|
6787
|
+
if (field.type === "checkbox") continue;
|
|
6788
|
+
const error = validateField(String(value || ""), field);
|
|
6789
|
+
if (error) errors[field.id] = error;
|
|
6790
|
+
}
|
|
6791
|
+
if (Object.keys(errors).length > 0) {
|
|
6792
|
+
setFieldErrors(errors);
|
|
6793
|
+
return;
|
|
6794
|
+
}
|
|
6795
|
+
const result = await submitForm(projectId, formId, { data: formData });
|
|
6796
|
+
if (result) {
|
|
6797
|
+
setFormData({});
|
|
6798
|
+
setFieldErrors({});
|
|
6799
|
+
}
|
|
6800
|
+
}, [form, formData, validateField, submitForm, projectId, formId]);
|
|
6801
|
+
if (successMessage) {
|
|
6802
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUPTP7QX5_js.cn("max-w-2xl mx-auto", className), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6803
|
+
"div",
|
|
6804
|
+
{
|
|
6805
|
+
className: "rounded-lg border p-8 text-center",
|
|
6806
|
+
style: {
|
|
6807
|
+
backgroundColor: isDark ? "var(--appgram-card)" : "rgba(255, 255, 255, 0.7)",
|
|
6808
|
+
borderColor: isDark ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.05)",
|
|
6809
|
+
borderRadius: `${Math.min(borderRadius, 12)}px`
|
|
6810
|
+
},
|
|
6811
|
+
children: [
|
|
6812
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6813
|
+
"div",
|
|
6814
|
+
{
|
|
6815
|
+
className: "inline-flex items-center justify-center w-16 h-16 rounded-full mb-6",
|
|
6816
|
+
style: { backgroundColor: "#10b98115" },
|
|
6817
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-8 h-8", style: { color: "#10b981" }, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) })
|
|
6818
|
+
}
|
|
6819
|
+
),
|
|
6820
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6821
|
+
"h2",
|
|
6822
|
+
{
|
|
6823
|
+
className: "text-2xl font-bold mb-3",
|
|
6824
|
+
style: { color: "var(--appgram-foreground)" },
|
|
6825
|
+
children: form?.successMessage || "Thank You"
|
|
6826
|
+
}
|
|
6827
|
+
),
|
|
6828
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6829
|
+
"p",
|
|
6830
|
+
{
|
|
6831
|
+
className: "text-base mb-6",
|
|
6832
|
+
style: { color: isDark ? "rgba(255, 255, 255, 0.6)" : "rgba(0, 0, 0, 0.6)" },
|
|
6833
|
+
children: successMessage
|
|
6834
|
+
}
|
|
6835
|
+
),
|
|
6836
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6837
|
+
"button",
|
|
6838
|
+
{
|
|
6839
|
+
onClick: clearMessages,
|
|
6840
|
+
className: "px-6 py-3 text-white font-medium transition-all hover:shadow-lg",
|
|
6841
|
+
style: {
|
|
6842
|
+
backgroundColor: primaryColor,
|
|
6843
|
+
borderRadius: `${Math.min(borderRadius, 12)}px`
|
|
6844
|
+
},
|
|
6845
|
+
children: "Submit Another"
|
|
6846
|
+
}
|
|
6847
|
+
)
|
|
6848
|
+
]
|
|
6849
|
+
}
|
|
6850
|
+
) });
|
|
6851
|
+
}
|
|
6852
|
+
if (isLoading) {
|
|
6853
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUPTP7QX5_js.cn("max-w-2xl mx-auto flex items-center justify-center py-12", className), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6854
|
+
"div",
|
|
6855
|
+
{
|
|
6856
|
+
className: "w-8 h-8 border-2 border-t-transparent rounded-full animate-spin",
|
|
6857
|
+
style: { borderColor: primaryColor, borderTopColor: "transparent" }
|
|
6858
|
+
}
|
|
6859
|
+
) });
|
|
6860
|
+
}
|
|
6861
|
+
if (fetchError) {
|
|
6862
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkUPTP7QX5_js.cn("max-w-2xl mx-auto", className), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6863
|
+
"div",
|
|
6864
|
+
{
|
|
6865
|
+
className: "p-4 text-sm",
|
|
6866
|
+
style: {
|
|
6867
|
+
backgroundColor: "rgba(239, 68, 68, 0.1)",
|
|
6868
|
+
color: "#dc2626",
|
|
6869
|
+
borderRadius: `${Math.min(borderRadius, 8)}px`
|
|
6870
|
+
},
|
|
6871
|
+
children: fetchError
|
|
6872
|
+
}
|
|
6873
|
+
) });
|
|
6874
|
+
}
|
|
6875
|
+
if (!form) return /* @__PURE__ */ jsxRuntime.jsx("div", {});
|
|
6876
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkUPTP7QX5_js.cn("max-w-2xl mx-auto", className), children: [
|
|
6877
|
+
(title || form.name) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-8", children: [
|
|
6878
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6879
|
+
"h1",
|
|
6880
|
+
{
|
|
6881
|
+
className: "text-2xl font-bold mb-2",
|
|
6882
|
+
style: { color: "var(--appgram-foreground)" },
|
|
6883
|
+
children: title || form.name
|
|
6884
|
+
}
|
|
6885
|
+
),
|
|
6886
|
+
(description || form.description) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6887
|
+
"p",
|
|
6888
|
+
{
|
|
6889
|
+
className: "text-base",
|
|
6890
|
+
style: { color: isDark ? "rgba(255, 255, 255, 0.6)" : "rgba(0, 0, 0, 0.6)" },
|
|
6891
|
+
children: description || form.description
|
|
6892
|
+
}
|
|
6893
|
+
)
|
|
6894
|
+
] }),
|
|
6895
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6896
|
+
"div",
|
|
6897
|
+
{
|
|
6898
|
+
className: "rounded-lg border p-6",
|
|
6899
|
+
style: {
|
|
6900
|
+
backgroundColor: isDark ? "var(--appgram-card)" : "rgba(255, 255, 255, 0.7)",
|
|
6901
|
+
borderColor: isDark ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.05)",
|
|
6902
|
+
borderRadius: `${Math.min(borderRadius, 12)}px`
|
|
6903
|
+
},
|
|
6904
|
+
children: [
|
|
6905
|
+
submitError && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6906
|
+
"div",
|
|
6907
|
+
{
|
|
6908
|
+
className: "p-3 text-sm mb-4",
|
|
6909
|
+
style: {
|
|
6910
|
+
backgroundColor: "rgba(239, 68, 68, 0.1)",
|
|
6911
|
+
color: "#dc2626",
|
|
6912
|
+
borderRadius: `${Math.min(borderRadius, 8)}px`
|
|
6913
|
+
},
|
|
6914
|
+
children: submitError
|
|
6915
|
+
}
|
|
6916
|
+
),
|
|
6917
|
+
/* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, className: "space-y-5", children: [
|
|
6918
|
+
form.fields.map((field) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6919
|
+
FormFieldInput,
|
|
6920
|
+
{
|
|
6921
|
+
field,
|
|
6922
|
+
value: formData[field.id],
|
|
6923
|
+
error: fieldErrors[field.id],
|
|
6924
|
+
onChange: (value) => handleFieldChange(field.id, value),
|
|
6925
|
+
primaryColor,
|
|
6926
|
+
borderRadius,
|
|
6927
|
+
isDark
|
|
6928
|
+
},
|
|
6929
|
+
field.id
|
|
6930
|
+
)),
|
|
6931
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6932
|
+
"button",
|
|
6933
|
+
{
|
|
6934
|
+
type: "submit",
|
|
6935
|
+
disabled: isSubmitting,
|
|
6936
|
+
className: "w-full flex items-center justify-center gap-2 py-3 text-white font-medium transition-all hover:shadow-lg disabled:opacity-50",
|
|
6937
|
+
style: {
|
|
6938
|
+
backgroundColor: primaryColor,
|
|
6939
|
+
borderRadius: `${Math.min(borderRadius, 8)}px`
|
|
6940
|
+
},
|
|
6941
|
+
children: isSubmitting ? "Submitting..." : form.submitButtonText || "Submit"
|
|
6942
|
+
}
|
|
6943
|
+
)
|
|
6944
|
+
] })
|
|
6945
|
+
]
|
|
6946
|
+
}
|
|
6947
|
+
)
|
|
6948
|
+
] });
|
|
6949
|
+
}
|
|
6950
|
+
function FormFieldInput({
|
|
6951
|
+
field,
|
|
6952
|
+
value,
|
|
6953
|
+
error,
|
|
6954
|
+
onChange,
|
|
6955
|
+
primaryColor,
|
|
6956
|
+
borderRadius,
|
|
6957
|
+
isDark
|
|
6958
|
+
}) {
|
|
6959
|
+
const inputStyles = {
|
|
6960
|
+
backgroundColor: isDark ? "var(--appgram-card)" : "white",
|
|
6961
|
+
borderColor: error ? "#dc2626" : isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.1)",
|
|
6962
|
+
color: "var(--appgram-foreground)",
|
|
6963
|
+
borderRadius: `${Math.min(borderRadius, 8)}px`
|
|
6964
|
+
};
|
|
6965
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
6966
|
+
field.type !== "checkbox" && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "text-sm font-medium", style: { color: "var(--appgram-foreground)" }, children: [
|
|
6967
|
+
field.label,
|
|
6968
|
+
field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#dc2626" }, children: " *" })
|
|
6969
|
+
] }),
|
|
6970
|
+
field.type === "text" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6971
|
+
"input",
|
|
6972
|
+
{
|
|
6973
|
+
type: "text",
|
|
6974
|
+
value: String(value || ""),
|
|
6975
|
+
onChange: (e) => onChange(e.target.value),
|
|
6976
|
+
placeholder: field.placeholder,
|
|
6977
|
+
required: field.required,
|
|
6978
|
+
className: "w-full h-10 px-4 text-sm border focus:outline-none focus:ring-2 transition-all",
|
|
6979
|
+
style: inputStyles
|
|
6980
|
+
}
|
|
6981
|
+
),
|
|
6982
|
+
field.type === "email" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6983
|
+
"input",
|
|
6984
|
+
{
|
|
6985
|
+
type: "email",
|
|
6986
|
+
value: String(value || ""),
|
|
6987
|
+
onChange: (e) => onChange(e.target.value),
|
|
6988
|
+
placeholder: field.placeholder || "you@example.com",
|
|
6989
|
+
required: field.required,
|
|
6990
|
+
className: "w-full h-10 px-4 text-sm border focus:outline-none focus:ring-2 transition-all",
|
|
6991
|
+
style: inputStyles
|
|
6992
|
+
}
|
|
6993
|
+
),
|
|
6994
|
+
field.type === "textarea" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6995
|
+
"textarea",
|
|
6996
|
+
{
|
|
6997
|
+
value: String(value || ""),
|
|
6998
|
+
onChange: (e) => onChange(e.target.value),
|
|
6999
|
+
placeholder: field.placeholder,
|
|
7000
|
+
required: field.required,
|
|
7001
|
+
rows: 4,
|
|
7002
|
+
className: "w-full px-4 py-3 text-sm border focus:outline-none focus:ring-2 resize-none transition-all",
|
|
7003
|
+
style: inputStyles
|
|
7004
|
+
}
|
|
7005
|
+
),
|
|
7006
|
+
field.type === "select" && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7007
|
+
"select",
|
|
7008
|
+
{
|
|
7009
|
+
value: String(value || ""),
|
|
7010
|
+
onChange: (e) => onChange(e.target.value),
|
|
7011
|
+
required: field.required,
|
|
7012
|
+
className: "w-full h-10 px-4 text-sm border focus:outline-none focus:ring-2 transition-all appearance-none",
|
|
7013
|
+
style: inputStyles,
|
|
7014
|
+
children: [
|
|
7015
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: field.placeholder || "Select an option" }),
|
|
7016
|
+
(field.options || []).map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt, children: opt }, opt))
|
|
7017
|
+
]
|
|
7018
|
+
}
|
|
7019
|
+
),
|
|
7020
|
+
field.type === "radio" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: (field.options || []).map((opt) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7021
|
+
"label",
|
|
7022
|
+
{
|
|
7023
|
+
className: "flex items-center gap-3 px-4 py-3 text-sm border cursor-pointer transition-all",
|
|
7024
|
+
style: {
|
|
7025
|
+
backgroundColor: value === opt ? `${primaryColor}15` : "transparent",
|
|
7026
|
+
borderColor: value === opt ? primaryColor : isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.1)",
|
|
7027
|
+
color: "var(--appgram-foreground)",
|
|
7028
|
+
borderRadius: `${Math.min(borderRadius, 8)}px`
|
|
7029
|
+
},
|
|
7030
|
+
children: [
|
|
7031
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7032
|
+
"input",
|
|
7033
|
+
{
|
|
7034
|
+
type: "radio",
|
|
7035
|
+
name: field.id,
|
|
7036
|
+
value: opt,
|
|
7037
|
+
checked: value === opt,
|
|
7038
|
+
onChange: () => onChange(opt),
|
|
7039
|
+
className: "sr-only"
|
|
7040
|
+
}
|
|
7041
|
+
),
|
|
7042
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7043
|
+
"div",
|
|
7044
|
+
{
|
|
7045
|
+
className: "w-4 h-4 rounded-full border-2 flex items-center justify-center shrink-0",
|
|
7046
|
+
style: {
|
|
7047
|
+
borderColor: value === opt ? primaryColor : isDark ? "rgba(255, 255, 255, 0.3)" : "rgba(0, 0, 0, 0.3)"
|
|
7048
|
+
},
|
|
7049
|
+
children: value === opt && /* @__PURE__ */ jsxRuntime.jsx(
|
|
7050
|
+
"div",
|
|
7051
|
+
{
|
|
7052
|
+
className: "w-2 h-2 rounded-full",
|
|
7053
|
+
style: { backgroundColor: primaryColor }
|
|
7054
|
+
}
|
|
7055
|
+
)
|
|
7056
|
+
}
|
|
7057
|
+
),
|
|
7058
|
+
opt
|
|
7059
|
+
]
|
|
7060
|
+
},
|
|
7061
|
+
opt
|
|
7062
|
+
)) }),
|
|
7063
|
+
field.type === "checkbox" && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7064
|
+
"label",
|
|
7065
|
+
{
|
|
7066
|
+
className: "flex items-center gap-3 cursor-pointer",
|
|
7067
|
+
style: { color: "var(--appgram-foreground)" },
|
|
7068
|
+
children: [
|
|
7069
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7070
|
+
"div",
|
|
7071
|
+
{
|
|
7072
|
+
className: "w-4 h-4 border rounded flex items-center justify-center shrink-0 cursor-pointer",
|
|
7073
|
+
style: {
|
|
7074
|
+
borderColor: value ? primaryColor : isDark ? "rgba(255, 255, 255, 0.3)" : "rgba(0, 0, 0, 0.3)",
|
|
7075
|
+
backgroundColor: value ? primaryColor : "transparent"
|
|
7076
|
+
},
|
|
7077
|
+
onClick: () => onChange(!value),
|
|
7078
|
+
children: value && /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3 h-3 text-white", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M5 13l4 4L19 7" }) })
|
|
7079
|
+
}
|
|
7080
|
+
),
|
|
7081
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm", onClick: () => onChange(!value), children: [
|
|
7082
|
+
field.label,
|
|
7083
|
+
field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#dc2626" }, children: " *" })
|
|
7084
|
+
] })
|
|
7085
|
+
]
|
|
7086
|
+
}
|
|
7087
|
+
),
|
|
7088
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs", style: { color: "#dc2626" }, children: error })
|
|
7089
|
+
] });
|
|
7090
|
+
}
|
|
6347
7091
|
|
|
7092
|
+
exports.ContactFormRenderer = ContactFormRenderer;
|
|
6348
7093
|
exports.HelpArticleDetail = HelpArticleDetail;
|
|
6349
7094
|
exports.HelpArticles = HelpArticles;
|
|
6350
7095
|
exports.HelpCenter = HelpCenter;
|
|
@@ -6359,10 +7104,11 @@ exports.StatusBoard = StatusBoard;
|
|
|
6359
7104
|
exports.StatusIncidentDetail = StatusIncidentDetail;
|
|
6360
7105
|
exports.SubmitWishForm = SubmitWishForm;
|
|
6361
7106
|
exports.SupportForm = SupportForm;
|
|
7107
|
+
exports.SurveyRenderer = SurveyRenderer;
|
|
6362
7108
|
exports.VoteButton = VoteButton;
|
|
6363
7109
|
exports.WhatsNewPopup = WhatsNewPopup;
|
|
6364
7110
|
exports.WishCard = WishCard;
|
|
6365
7111
|
exports.WishDetail = WishDetail;
|
|
6366
7112
|
exports.WishList = WishList;
|
|
6367
|
-
//# sourceMappingURL=chunk-
|
|
6368
|
-
//# sourceMappingURL=chunk-
|
|
7113
|
+
//# sourceMappingURL=chunk-WZIN7KEM.js.map
|
|
7114
|
+
//# sourceMappingURL=chunk-WZIN7KEM.js.map
|