@hook-sdk/template 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +398 -356
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +362 -320
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/AppRoot.tsx
|
|
2
|
-
import { useCallback as useCallback7, useEffect as useEffect7, useRef as useRef2, useState as
|
|
2
|
+
import { useCallback as useCallback7, useEffect as useEffect7, useRef as useRef2, useState as useState11 } from "react";
|
|
3
3
|
import { useHook as useHook8 } from "@hook-sdk/sdk";
|
|
4
4
|
|
|
5
5
|
// src/internal/TemplateConfigContext.tsx
|
|
@@ -402,15 +402,6 @@ function useInstallPrompt(slug) {
|
|
|
402
402
|
setIsDismissedPermanent(true);
|
|
403
403
|
track("pwa_install_permanent_dismiss", { slug, platform, prior_skip_count: skipCount });
|
|
404
404
|
}, [slug, platform, skipCount]);
|
|
405
|
-
const redirectToSafari = useCallback2(() => {
|
|
406
|
-
if (typeof location === "undefined") return;
|
|
407
|
-
track("pwa_install_redirect_to_safari", { slug });
|
|
408
|
-
const url = `safari-https://${location.host}${location.pathname}${location.search}${location.hash}`;
|
|
409
|
-
try {
|
|
410
|
-
window.location.href = url;
|
|
411
|
-
} catch {
|
|
412
|
-
}
|
|
413
|
-
}, [slug]);
|
|
414
405
|
const copyLink = useCallback2(async () => {
|
|
415
406
|
if (typeof navigator === "undefined" || typeof location === "undefined") return;
|
|
416
407
|
try {
|
|
@@ -449,7 +440,6 @@ function useInstallPrompt(slug) {
|
|
|
449
440
|
promptInstall,
|
|
450
441
|
dismissSession,
|
|
451
442
|
dismissPermanent,
|
|
452
|
-
redirectToSafari,
|
|
453
443
|
copyLink,
|
|
454
444
|
reset
|
|
455
445
|
};
|
|
@@ -509,12 +499,21 @@ var INSTALL_COPY = {
|
|
|
509
499
|
skipPermanent: "N\xE3o me pergunte mais"
|
|
510
500
|
},
|
|
511
501
|
iosOther: {
|
|
512
|
-
title: "
|
|
513
|
-
subtitle: "
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
502
|
+
title: "Adicione \xE0 sua Tela de In\xEDcio",
|
|
503
|
+
subtitle: "Siga os 3 passos",
|
|
504
|
+
step1: {
|
|
505
|
+
title: "Toque em Compartilhar",
|
|
506
|
+
subtitle: "Geralmente no topo ou no menu do navegador"
|
|
507
|
+
},
|
|
508
|
+
step2: {
|
|
509
|
+
title: 'Role e toque em "Adicionar \xE0 Tela de In\xEDcio"',
|
|
510
|
+
iconLabel: "Adicionar \xE0 Tela de In\xEDcio"
|
|
511
|
+
},
|
|
512
|
+
step3: {
|
|
513
|
+
title: 'Toque em "Adicionar" pra confirmar',
|
|
514
|
+
buttonLabel: "Adicionar"
|
|
515
|
+
},
|
|
516
|
+
skip: "Continuar no navegador",
|
|
518
517
|
skipPermanent: "N\xE3o me pergunte mais"
|
|
519
518
|
},
|
|
520
519
|
inApp: {
|
|
@@ -650,18 +649,6 @@ var primaryButtonStyle = {
|
|
|
650
649
|
cursor: "pointer",
|
|
651
650
|
marginBottom: 12
|
|
652
651
|
};
|
|
653
|
-
var secondaryButtonStyle = {
|
|
654
|
-
width: "100%",
|
|
655
|
-
padding: "12px 20px",
|
|
656
|
-
background: "transparent",
|
|
657
|
-
color: "var(--hook-color-primary)",
|
|
658
|
-
border: "1px solid var(--hook-color-primary)",
|
|
659
|
-
borderRadius: 999,
|
|
660
|
-
fontSize: 15,
|
|
661
|
-
fontWeight: 500,
|
|
662
|
-
cursor: "pointer",
|
|
663
|
-
marginBottom: 12
|
|
664
|
-
};
|
|
665
652
|
var skipLinkStyle = {
|
|
666
653
|
display: "block",
|
|
667
654
|
width: "100%",
|
|
@@ -908,22 +895,70 @@ function Step({ n, icon, children }) {
|
|
|
908
895
|
);
|
|
909
896
|
}
|
|
910
897
|
|
|
911
|
-
// src/components/InstallGate/
|
|
898
|
+
// src/components/InstallGate/Step.tsx
|
|
912
899
|
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
900
|
+
function Step2({
|
|
901
|
+
n,
|
|
902
|
+
title,
|
|
903
|
+
subtitle,
|
|
904
|
+
visual
|
|
905
|
+
}) {
|
|
906
|
+
return /* @__PURE__ */ jsxs5(
|
|
907
|
+
"div",
|
|
908
|
+
{
|
|
909
|
+
style: {
|
|
910
|
+
display: "flex",
|
|
911
|
+
alignItems: "flex-start",
|
|
912
|
+
gap: 12,
|
|
913
|
+
marginBottom: 16,
|
|
914
|
+
textAlign: "left"
|
|
915
|
+
},
|
|
916
|
+
children: [
|
|
917
|
+
/* @__PURE__ */ jsx11(
|
|
918
|
+
"div",
|
|
919
|
+
{
|
|
920
|
+
style: {
|
|
921
|
+
width: 32,
|
|
922
|
+
height: 32,
|
|
923
|
+
borderRadius: 10,
|
|
924
|
+
background: "var(--hook-color-primary)",
|
|
925
|
+
color: "#fff",
|
|
926
|
+
display: "flex",
|
|
927
|
+
alignItems: "center",
|
|
928
|
+
justifyContent: "center",
|
|
929
|
+
fontSize: 15,
|
|
930
|
+
fontWeight: 700,
|
|
931
|
+
flexShrink: 0
|
|
932
|
+
},
|
|
933
|
+
children: n
|
|
934
|
+
}
|
|
935
|
+
),
|
|
936
|
+
/* @__PURE__ */ jsxs5("div", { style: { flex: 1 }, children: [
|
|
937
|
+
/* @__PURE__ */ jsx11("p", { style: { margin: 0, fontSize: 15, fontWeight: 500, color: "#111", lineHeight: 1.3 }, children: title }),
|
|
938
|
+
subtitle && /* @__PURE__ */ jsx11("p", { style: { margin: "4px 0 0 0", fontSize: 13, color: "#777" }, children: subtitle }),
|
|
939
|
+
visual
|
|
940
|
+
] })
|
|
941
|
+
]
|
|
942
|
+
}
|
|
943
|
+
);
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// src/components/InstallGate/variants/IOSafariVariant.tsx
|
|
947
|
+
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
913
948
|
function IOSafariVariant({
|
|
914
949
|
state,
|
|
915
950
|
actions
|
|
916
951
|
}) {
|
|
917
952
|
const copy = INSTALL_COPY.iosSafari;
|
|
918
953
|
const showPermanent = shouldShowPermanentOption(state);
|
|
919
|
-
return /* @__PURE__ */
|
|
920
|
-
/* @__PURE__ */
|
|
954
|
+
return /* @__PURE__ */ jsxs6(InstallSplash, { title: copy.title, subtitle: copy.subtitle, children: [
|
|
955
|
+
/* @__PURE__ */ jsx12(
|
|
921
956
|
Step2,
|
|
922
957
|
{
|
|
923
958
|
n: 1,
|
|
924
959
|
title: copy.step1.title,
|
|
925
960
|
subtitle: copy.step1.subtitle,
|
|
926
|
-
visual: /* @__PURE__ */
|
|
961
|
+
visual: /* @__PURE__ */ jsx12(
|
|
927
962
|
"div",
|
|
928
963
|
{
|
|
929
964
|
style: {
|
|
@@ -935,17 +970,17 @@ function IOSafariVariant({
|
|
|
935
970
|
padding: "12px 0",
|
|
936
971
|
marginTop: 8
|
|
937
972
|
},
|
|
938
|
-
children: /* @__PURE__ */
|
|
973
|
+
children: /* @__PURE__ */ jsx12(ShareIconIOS, { size: 32, style: { color: "var(--hook-color-primary)" } })
|
|
939
974
|
}
|
|
940
975
|
)
|
|
941
976
|
}
|
|
942
977
|
),
|
|
943
|
-
/* @__PURE__ */
|
|
978
|
+
/* @__PURE__ */ jsx12(
|
|
944
979
|
Step2,
|
|
945
980
|
{
|
|
946
981
|
n: 2,
|
|
947
982
|
title: copy.step2.title,
|
|
948
|
-
visual: /* @__PURE__ */
|
|
983
|
+
visual: /* @__PURE__ */ jsxs6(
|
|
949
984
|
"div",
|
|
950
985
|
{
|
|
951
986
|
style: {
|
|
@@ -958,19 +993,19 @@ function IOSafariVariant({
|
|
|
958
993
|
marginTop: 8
|
|
959
994
|
},
|
|
960
995
|
children: [
|
|
961
|
-
/* @__PURE__ */
|
|
962
|
-
/* @__PURE__ */
|
|
996
|
+
/* @__PURE__ */ jsx12(SquarePlusIcon, { size: 22, style: { color: "#555" } }),
|
|
997
|
+
/* @__PURE__ */ jsx12("span", { style: { fontSize: 14, color: "#333" }, children: copy.step2.iconLabel })
|
|
963
998
|
]
|
|
964
999
|
}
|
|
965
1000
|
)
|
|
966
1001
|
}
|
|
967
1002
|
),
|
|
968
|
-
/* @__PURE__ */
|
|
1003
|
+
/* @__PURE__ */ jsx12(
|
|
969
1004
|
Step2,
|
|
970
1005
|
{
|
|
971
1006
|
n: 3,
|
|
972
1007
|
title: copy.step3.title,
|
|
973
|
-
visual: /* @__PURE__ */
|
|
1008
|
+
visual: /* @__PURE__ */ jsx12(
|
|
974
1009
|
"div",
|
|
975
1010
|
{
|
|
976
1011
|
style: {
|
|
@@ -981,7 +1016,7 @@ function IOSafariVariant({
|
|
|
981
1016
|
padding: "10px 14px",
|
|
982
1017
|
marginTop: 8
|
|
983
1018
|
},
|
|
984
|
-
children: /* @__PURE__ */
|
|
1019
|
+
children: /* @__PURE__ */ jsx12(
|
|
985
1020
|
"span",
|
|
986
1021
|
{
|
|
987
1022
|
style: {
|
|
@@ -996,7 +1031,7 @@ function IOSafariVariant({
|
|
|
996
1031
|
)
|
|
997
1032
|
}
|
|
998
1033
|
),
|
|
999
|
-
/* @__PURE__ */
|
|
1034
|
+
/* @__PURE__ */ jsx12(
|
|
1000
1035
|
"button",
|
|
1001
1036
|
{
|
|
1002
1037
|
"data-testid": "install-prompt-skip-session",
|
|
@@ -1006,7 +1041,7 @@ function IOSafariVariant({
|
|
|
1006
1041
|
children: copy.skip
|
|
1007
1042
|
}
|
|
1008
1043
|
),
|
|
1009
|
-
showPermanent && /* @__PURE__ */
|
|
1044
|
+
showPermanent && /* @__PURE__ */ jsx12(
|
|
1010
1045
|
"button",
|
|
1011
1046
|
{
|
|
1012
1047
|
"data-testid": "install-prompt-skip-permanent",
|
|
@@ -1018,99 +1053,106 @@ function IOSafariVariant({
|
|
|
1018
1053
|
)
|
|
1019
1054
|
] });
|
|
1020
1055
|
}
|
|
1021
|
-
function Step2({
|
|
1022
|
-
n,
|
|
1023
|
-
title,
|
|
1024
|
-
subtitle,
|
|
1025
|
-
visual
|
|
1026
|
-
}) {
|
|
1027
|
-
return /* @__PURE__ */ jsxs5(
|
|
1028
|
-
"div",
|
|
1029
|
-
{
|
|
1030
|
-
style: {
|
|
1031
|
-
display: "flex",
|
|
1032
|
-
alignItems: "flex-start",
|
|
1033
|
-
gap: 12,
|
|
1034
|
-
marginBottom: 16,
|
|
1035
|
-
textAlign: "left"
|
|
1036
|
-
},
|
|
1037
|
-
children: [
|
|
1038
|
-
/* @__PURE__ */ jsx11(
|
|
1039
|
-
"div",
|
|
1040
|
-
{
|
|
1041
|
-
style: {
|
|
1042
|
-
width: 32,
|
|
1043
|
-
height: 32,
|
|
1044
|
-
borderRadius: 10,
|
|
1045
|
-
background: "var(--hook-color-primary)",
|
|
1046
|
-
color: "#fff",
|
|
1047
|
-
display: "flex",
|
|
1048
|
-
alignItems: "center",
|
|
1049
|
-
justifyContent: "center",
|
|
1050
|
-
fontSize: 15,
|
|
1051
|
-
fontWeight: 700,
|
|
1052
|
-
flexShrink: 0
|
|
1053
|
-
},
|
|
1054
|
-
children: n
|
|
1055
|
-
}
|
|
1056
|
-
),
|
|
1057
|
-
/* @__PURE__ */ jsxs5("div", { style: { flex: 1 }, children: [
|
|
1058
|
-
/* @__PURE__ */ jsx11("p", { style: { margin: 0, fontSize: 15, fontWeight: 500, color: "#111", lineHeight: 1.3 }, children: title }),
|
|
1059
|
-
subtitle && /* @__PURE__ */ jsx11("p", { style: { margin: "4px 0 0 0", fontSize: 13, color: "#777" }, children: subtitle }),
|
|
1060
|
-
visual
|
|
1061
|
-
] })
|
|
1062
|
-
]
|
|
1063
|
-
}
|
|
1064
|
-
);
|
|
1065
|
-
}
|
|
1066
1056
|
|
|
1067
1057
|
// src/components/InstallGate/variants/IOSOtherVariant.tsx
|
|
1068
|
-
import {
|
|
1069
|
-
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1058
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1070
1059
|
function IOSOtherVariant({
|
|
1071
1060
|
state,
|
|
1072
1061
|
actions
|
|
1073
1062
|
}) {
|
|
1074
1063
|
const copy = INSTALL_COPY.iosOther;
|
|
1075
1064
|
const showPermanent = shouldShowPermanentOption(state);
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
setCopied(true);
|
|
1080
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
1081
|
-
};
|
|
1082
|
-
return /* @__PURE__ */ jsxs6(InstallSplash, { title: copy.title, subtitle: copy.subtitle, children: [
|
|
1083
|
-
/* @__PURE__ */ jsx12(
|
|
1084
|
-
"button",
|
|
1065
|
+
return /* @__PURE__ */ jsxs7(InstallSplash, { title: copy.title, subtitle: copy.subtitle, children: [
|
|
1066
|
+
/* @__PURE__ */ jsx13(
|
|
1067
|
+
Step2,
|
|
1085
1068
|
{
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1069
|
+
n: 1,
|
|
1070
|
+
title: copy.step1.title,
|
|
1071
|
+
subtitle: copy.step1.subtitle,
|
|
1072
|
+
visual: /* @__PURE__ */ jsx13(
|
|
1073
|
+
"div",
|
|
1074
|
+
{
|
|
1075
|
+
style: {
|
|
1076
|
+
display: "flex",
|
|
1077
|
+
justifyContent: "center",
|
|
1078
|
+
alignItems: "center",
|
|
1079
|
+
background: "#f5f5f7",
|
|
1080
|
+
borderRadius: 12,
|
|
1081
|
+
padding: "12px 0",
|
|
1082
|
+
marginTop: 8
|
|
1083
|
+
},
|
|
1084
|
+
children: /* @__PURE__ */ jsx13(ShareIconIOS, { size: 32, style: { color: "var(--hook-color-primary)" } })
|
|
1085
|
+
}
|
|
1086
|
+
)
|
|
1091
1087
|
}
|
|
1092
1088
|
),
|
|
1093
|
-
/* @__PURE__ */
|
|
1094
|
-
|
|
1089
|
+
/* @__PURE__ */ jsx13(
|
|
1090
|
+
Step2,
|
|
1095
1091
|
{
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1092
|
+
n: 2,
|
|
1093
|
+
title: copy.step2.title,
|
|
1094
|
+
visual: /* @__PURE__ */ jsxs7(
|
|
1095
|
+
"div",
|
|
1096
|
+
{
|
|
1097
|
+
style: {
|
|
1098
|
+
display: "flex",
|
|
1099
|
+
alignItems: "center",
|
|
1100
|
+
gap: 10,
|
|
1101
|
+
background: "#f5f5f7",
|
|
1102
|
+
borderRadius: 12,
|
|
1103
|
+
padding: "12px 14px",
|
|
1104
|
+
marginTop: 8
|
|
1105
|
+
},
|
|
1106
|
+
children: [
|
|
1107
|
+
/* @__PURE__ */ jsx13(SquarePlusIcon, { size: 22, style: { color: "#555" } }),
|
|
1108
|
+
/* @__PURE__ */ jsx13("span", { style: { fontSize: 14, color: "#333" }, children: copy.step2.iconLabel })
|
|
1109
|
+
]
|
|
1110
|
+
}
|
|
1111
|
+
)
|
|
1101
1112
|
}
|
|
1102
1113
|
),
|
|
1103
|
-
/* @__PURE__ */
|
|
1114
|
+
/* @__PURE__ */ jsx13(
|
|
1115
|
+
Step2,
|
|
1116
|
+
{
|
|
1117
|
+
n: 3,
|
|
1118
|
+
title: copy.step3.title,
|
|
1119
|
+
visual: /* @__PURE__ */ jsx13(
|
|
1120
|
+
"div",
|
|
1121
|
+
{
|
|
1122
|
+
style: {
|
|
1123
|
+
display: "flex",
|
|
1124
|
+
justifyContent: "flex-end",
|
|
1125
|
+
background: "#f5f5f7",
|
|
1126
|
+
borderRadius: 12,
|
|
1127
|
+
padding: "10px 14px",
|
|
1128
|
+
marginTop: 8
|
|
1129
|
+
},
|
|
1130
|
+
children: /* @__PURE__ */ jsx13(
|
|
1131
|
+
"span",
|
|
1132
|
+
{
|
|
1133
|
+
style: {
|
|
1134
|
+
color: "var(--hook-color-primary)",
|
|
1135
|
+
fontSize: 15,
|
|
1136
|
+
fontWeight: 600
|
|
1137
|
+
},
|
|
1138
|
+
children: copy.step3.buttonLabel
|
|
1139
|
+
}
|
|
1140
|
+
)
|
|
1141
|
+
}
|
|
1142
|
+
)
|
|
1143
|
+
}
|
|
1144
|
+
),
|
|
1145
|
+
/* @__PURE__ */ jsx13(
|
|
1104
1146
|
"button",
|
|
1105
1147
|
{
|
|
1106
1148
|
"data-testid": "install-prompt-skip-session",
|
|
1107
1149
|
type: "button",
|
|
1108
1150
|
onClick: actions.dismissSession,
|
|
1109
|
-
style: skipLinkStyle,
|
|
1151
|
+
style: { ...skipLinkStyle, marginTop: 16 },
|
|
1110
1152
|
children: copy.skip
|
|
1111
1153
|
}
|
|
1112
1154
|
),
|
|
1113
|
-
showPermanent && /* @__PURE__ */
|
|
1155
|
+
showPermanent && /* @__PURE__ */ jsx13(
|
|
1114
1156
|
"button",
|
|
1115
1157
|
{
|
|
1116
1158
|
"data-testid": "install-prompt-skip-permanent",
|
|
@@ -1124,8 +1166,8 @@ function IOSOtherVariant({
|
|
|
1124
1166
|
}
|
|
1125
1167
|
|
|
1126
1168
|
// src/components/InstallGate/variants/InAppBrowserVariant.tsx
|
|
1127
|
-
import { useState as
|
|
1128
|
-
import { jsx as
|
|
1169
|
+
import { useState as useState4 } from "react";
|
|
1170
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1129
1171
|
function InAppBrowserVariant({
|
|
1130
1172
|
state,
|
|
1131
1173
|
actions
|
|
@@ -1134,17 +1176,17 @@ function InAppBrowserVariant({
|
|
|
1134
1176
|
const appCopy = INSTALL_COPY.inApp[app] ?? INSTALL_COPY.inApp.other;
|
|
1135
1177
|
const copy = INSTALL_COPY.inApp;
|
|
1136
1178
|
const showPermanent = shouldShowPermanentOption(state);
|
|
1137
|
-
const [copied, setCopied] =
|
|
1179
|
+
const [copied, setCopied] = useState4(false);
|
|
1138
1180
|
const handleCopy = async () => {
|
|
1139
1181
|
await actions.copyLink();
|
|
1140
1182
|
setCopied(true);
|
|
1141
1183
|
setTimeout(() => setCopied(false), 2e3);
|
|
1142
1184
|
};
|
|
1143
1185
|
const DotsIcon = app === "facebook" || app === "telegram" ? MenuDotsVerticalIcon : MenuDotsHorizontalIcon;
|
|
1144
|
-
return /* @__PURE__ */
|
|
1145
|
-
/* @__PURE__ */
|
|
1146
|
-
/* @__PURE__ */
|
|
1147
|
-
/* @__PURE__ */
|
|
1186
|
+
return /* @__PURE__ */ jsxs8(InstallSplash, { title: appCopy.title, children: [
|
|
1187
|
+
/* @__PURE__ */ jsx14(Step3, { n: 1, icon: /* @__PURE__ */ jsx14(DotsIcon, { size: 20 }), children: appCopy.step1 }),
|
|
1188
|
+
/* @__PURE__ */ jsx14(Step3, { n: 2, icon: /* @__PURE__ */ jsx14(ExternalLinkIcon, { size: 18 }), children: appCopy.step2 }),
|
|
1189
|
+
/* @__PURE__ */ jsx14(
|
|
1148
1190
|
"button",
|
|
1149
1191
|
{
|
|
1150
1192
|
"data-testid": "install-prompt-cta-inapp-copy",
|
|
@@ -1154,7 +1196,7 @@ function InAppBrowserVariant({
|
|
|
1154
1196
|
children: copied ? copy.copiedToast : copy.copy
|
|
1155
1197
|
}
|
|
1156
1198
|
),
|
|
1157
|
-
/* @__PURE__ */
|
|
1199
|
+
/* @__PURE__ */ jsx14(
|
|
1158
1200
|
"button",
|
|
1159
1201
|
{
|
|
1160
1202
|
"data-testid": "install-prompt-skip-session",
|
|
@@ -1164,7 +1206,7 @@ function InAppBrowserVariant({
|
|
|
1164
1206
|
children: copy.skip
|
|
1165
1207
|
}
|
|
1166
1208
|
),
|
|
1167
|
-
showPermanent && /* @__PURE__ */
|
|
1209
|
+
showPermanent && /* @__PURE__ */ jsx14(
|
|
1168
1210
|
"button",
|
|
1169
1211
|
{
|
|
1170
1212
|
"data-testid": "install-prompt-skip-permanent",
|
|
@@ -1181,7 +1223,7 @@ function Step3({
|
|
|
1181
1223
|
icon,
|
|
1182
1224
|
children
|
|
1183
1225
|
}) {
|
|
1184
|
-
return /* @__PURE__ */
|
|
1226
|
+
return /* @__PURE__ */ jsxs8(
|
|
1185
1227
|
"div",
|
|
1186
1228
|
{
|
|
1187
1229
|
style: {
|
|
@@ -1195,7 +1237,7 @@ function Step3({
|
|
|
1195
1237
|
textAlign: "left"
|
|
1196
1238
|
},
|
|
1197
1239
|
children: [
|
|
1198
|
-
/* @__PURE__ */
|
|
1240
|
+
/* @__PURE__ */ jsx14(
|
|
1199
1241
|
"div",
|
|
1200
1242
|
{
|
|
1201
1243
|
style: {
|
|
@@ -1214,15 +1256,15 @@ function Step3({
|
|
|
1214
1256
|
children: n
|
|
1215
1257
|
}
|
|
1216
1258
|
),
|
|
1217
|
-
/* @__PURE__ */
|
|
1218
|
-
/* @__PURE__ */
|
|
1259
|
+
/* @__PURE__ */ jsx14("div", { style: { flex: 1, fontSize: 14, color: "#333" }, children }),
|
|
1260
|
+
/* @__PURE__ */ jsx14("div", { style: { color: "#888", flexShrink: 0 }, children: icon })
|
|
1219
1261
|
]
|
|
1220
1262
|
}
|
|
1221
1263
|
);
|
|
1222
1264
|
}
|
|
1223
1265
|
|
|
1224
1266
|
// src/components/InstallGate/variants/DesktopVariant.tsx
|
|
1225
|
-
import { jsx as
|
|
1267
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1226
1268
|
function DesktopVariant({
|
|
1227
1269
|
state,
|
|
1228
1270
|
actions
|
|
@@ -1231,21 +1273,21 @@ function DesktopVariant({
|
|
|
1231
1273
|
const copy = INSTALL_COPY.desktop;
|
|
1232
1274
|
const iconUrl = theme.icon_url || theme.logo_url || null;
|
|
1233
1275
|
if (!state.isInstallable) return null;
|
|
1234
|
-
return /* @__PURE__ */
|
|
1276
|
+
return /* @__PURE__ */ jsxs9(
|
|
1235
1277
|
"div",
|
|
1236
1278
|
{
|
|
1237
1279
|
role: "complementary",
|
|
1238
1280
|
"aria-label": copy.title,
|
|
1239
1281
|
style: bannerStyle,
|
|
1240
1282
|
children: [
|
|
1241
|
-
iconUrl ? /* @__PURE__ */
|
|
1283
|
+
iconUrl ? /* @__PURE__ */ jsx15(
|
|
1242
1284
|
"img",
|
|
1243
1285
|
{
|
|
1244
1286
|
src: iconUrl,
|
|
1245
1287
|
alt: "",
|
|
1246
1288
|
style: { width: 40, height: 40, borderRadius: 10, objectFit: "cover", flexShrink: 0 }
|
|
1247
1289
|
}
|
|
1248
|
-
) : /* @__PURE__ */
|
|
1290
|
+
) : /* @__PURE__ */ jsx15(
|
|
1249
1291
|
"div",
|
|
1250
1292
|
{
|
|
1251
1293
|
style: {
|
|
@@ -1264,11 +1306,11 @@ function DesktopVariant({
|
|
|
1264
1306
|
children: name.charAt(0).toUpperCase()
|
|
1265
1307
|
}
|
|
1266
1308
|
),
|
|
1267
|
-
/* @__PURE__ */
|
|
1268
|
-
/* @__PURE__ */
|
|
1269
|
-
/* @__PURE__ */
|
|
1309
|
+
/* @__PURE__ */ jsxs9("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
1310
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 14, fontWeight: 600, color: "#111" }, children: copy.title }),
|
|
1311
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 12, color: "#666" }, children: copy.subtitle })
|
|
1270
1312
|
] }),
|
|
1271
|
-
/* @__PURE__ */
|
|
1313
|
+
/* @__PURE__ */ jsxs9(
|
|
1272
1314
|
"button",
|
|
1273
1315
|
{
|
|
1274
1316
|
"data-testid": "install-prompt-cta-desktop",
|
|
@@ -1289,12 +1331,12 @@ function DesktopVariant({
|
|
|
1289
1331
|
flexShrink: 0
|
|
1290
1332
|
},
|
|
1291
1333
|
children: [
|
|
1292
|
-
/* @__PURE__ */
|
|
1334
|
+
/* @__PURE__ */ jsx15(DownloadIcon, { size: 14 }),
|
|
1293
1335
|
copy.cta
|
|
1294
1336
|
]
|
|
1295
1337
|
}
|
|
1296
1338
|
),
|
|
1297
|
-
/* @__PURE__ */
|
|
1339
|
+
/* @__PURE__ */ jsx15(
|
|
1298
1340
|
"button",
|
|
1299
1341
|
{
|
|
1300
1342
|
"data-testid": "install-prompt-desktop-close",
|
|
@@ -1309,7 +1351,7 @@ function DesktopVariant({
|
|
|
1309
1351
|
padding: 4,
|
|
1310
1352
|
flexShrink: 0
|
|
1311
1353
|
},
|
|
1312
|
-
children: /* @__PURE__ */
|
|
1354
|
+
children: /* @__PURE__ */ jsx15(XIcon, { size: 16 })
|
|
1313
1355
|
}
|
|
1314
1356
|
)
|
|
1315
1357
|
]
|
|
@@ -1333,7 +1375,7 @@ var bannerStyle = {
|
|
|
1333
1375
|
};
|
|
1334
1376
|
|
|
1335
1377
|
// src/components/InstallGate/InstallGate.tsx
|
|
1336
|
-
import { Fragment as Fragment4, jsx as
|
|
1378
|
+
import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1337
1379
|
function InstallGate({ children }) {
|
|
1338
1380
|
const { slug, features_enabled } = useTemplateConfig();
|
|
1339
1381
|
const enabled = features_enabled.includes("install_prompt");
|
|
@@ -1354,35 +1396,35 @@ function InstallGate({ children }) {
|
|
|
1354
1396
|
variant: installState.variant
|
|
1355
1397
|
});
|
|
1356
1398
|
}, [shouldBlock, slug, installState.variant, installState.platform, installState.iosBrowser, installState.androidBrowser, installState.inAppApp]);
|
|
1357
|
-
if (!enabled) return /* @__PURE__ */
|
|
1358
|
-
if (installState.isInstalled) return /* @__PURE__ */
|
|
1399
|
+
if (!enabled) return /* @__PURE__ */ jsx16(Fragment4, { children });
|
|
1400
|
+
if (installState.isInstalled) return /* @__PURE__ */ jsx16(Fragment4, { children });
|
|
1359
1401
|
if (installState.variant === "desktop") {
|
|
1360
|
-
return /* @__PURE__ */
|
|
1402
|
+
return /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
1361
1403
|
children,
|
|
1362
|
-
/* @__PURE__ */
|
|
1404
|
+
/* @__PURE__ */ jsx16(DesktopVariant, { state: installState, actions: installState })
|
|
1363
1405
|
] });
|
|
1364
1406
|
}
|
|
1365
|
-
if (!shouldBlock) return /* @__PURE__ */
|
|
1407
|
+
if (!shouldBlock) return /* @__PURE__ */ jsx16(Fragment4, { children });
|
|
1366
1408
|
switch (installState.variant) {
|
|
1367
1409
|
case "android-native":
|
|
1368
|
-
return /* @__PURE__ */
|
|
1410
|
+
return /* @__PURE__ */ jsx16(AndroidNativeVariant, { state: installState, actions: installState });
|
|
1369
1411
|
case "android-manual":
|
|
1370
|
-
return /* @__PURE__ */
|
|
1412
|
+
return /* @__PURE__ */ jsx16(AndroidManualVariant, { state: installState, actions: installState });
|
|
1371
1413
|
case "ios-safari":
|
|
1372
|
-
return /* @__PURE__ */
|
|
1414
|
+
return /* @__PURE__ */ jsx16(IOSafariVariant, { state: installState, actions: installState });
|
|
1373
1415
|
case "ios-other":
|
|
1374
|
-
return /* @__PURE__ */
|
|
1416
|
+
return /* @__PURE__ */ jsx16(IOSOtherVariant, { state: installState, actions: installState });
|
|
1375
1417
|
case "in-app":
|
|
1376
|
-
return /* @__PURE__ */
|
|
1418
|
+
return /* @__PURE__ */ jsx16(InAppBrowserVariant, { state: installState, actions: installState });
|
|
1377
1419
|
case "none":
|
|
1378
1420
|
default:
|
|
1379
|
-
return /* @__PURE__ */
|
|
1421
|
+
return /* @__PURE__ */ jsx16(Fragment4, { children });
|
|
1380
1422
|
}
|
|
1381
1423
|
}
|
|
1382
1424
|
|
|
1383
1425
|
// src/defaults/ErrorBoundary.tsx
|
|
1384
1426
|
import { Component } from "react";
|
|
1385
|
-
import { Fragment as Fragment5, jsx as
|
|
1427
|
+
import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1386
1428
|
var ErrorBoundary = class extends Component {
|
|
1387
1429
|
state = { error: null };
|
|
1388
1430
|
static getDerivedStateFromError(error) {
|
|
@@ -1393,17 +1435,17 @@ var ErrorBoundary = class extends Component {
|
|
|
1393
1435
|
}
|
|
1394
1436
|
render() {
|
|
1395
1437
|
if (this.state.error) {
|
|
1396
|
-
return this.props.fallback ?? /* @__PURE__ */
|
|
1397
|
-
/* @__PURE__ */
|
|
1398
|
-
/* @__PURE__ */
|
|
1438
|
+
return this.props.fallback ?? /* @__PURE__ */ jsxs11("div", { role: "alert", style: { padding: 24, textAlign: "center" }, children: [
|
|
1439
|
+
/* @__PURE__ */ jsx17("h2", { children: "Algo deu errado" }),
|
|
1440
|
+
/* @__PURE__ */ jsx17("p", { style: { opacity: 0.7 }, children: "Recarregue a p\xE1gina pra tentar de novo." })
|
|
1399
1441
|
] });
|
|
1400
1442
|
}
|
|
1401
|
-
return /* @__PURE__ */
|
|
1443
|
+
return /* @__PURE__ */ jsx17(Fragment5, { children: this.props.children });
|
|
1402
1444
|
}
|
|
1403
1445
|
};
|
|
1404
1446
|
|
|
1405
1447
|
// src/hooks/useLoginForm.ts
|
|
1406
|
-
import { useCallback as useCallback3, useMemo as useMemo2, useState as
|
|
1448
|
+
import { useCallback as useCallback3, useMemo as useMemo2, useState as useState5 } from "react";
|
|
1407
1449
|
import { useHook as useHook4 } from "@hook-sdk/sdk";
|
|
1408
1450
|
|
|
1409
1451
|
// src/errors.ts
|
|
@@ -1440,10 +1482,10 @@ var EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
|
1440
1482
|
var MIN_PASSWORD = 8;
|
|
1441
1483
|
function useLoginForm() {
|
|
1442
1484
|
const { auth } = useHook4();
|
|
1443
|
-
const [email, setEmail] =
|
|
1444
|
-
const [password, setPassword] =
|
|
1445
|
-
const [submitting, setSubmitting] =
|
|
1446
|
-
const [error, setError] =
|
|
1485
|
+
const [email, setEmail] = useState5("");
|
|
1486
|
+
const [password, setPassword] = useState5("");
|
|
1487
|
+
const [submitting, setSubmitting] = useState5(false);
|
|
1488
|
+
const [error, setError] = useState5(null);
|
|
1447
1489
|
const emailError = useMemo2(() => {
|
|
1448
1490
|
if (email.length === 0) return null;
|
|
1449
1491
|
if (!EMAIL_RE.test(email)) return "Formato de e-mail inv\xE1lido.";
|
|
@@ -1485,13 +1527,13 @@ function useLoginForm() {
|
|
|
1485
1527
|
}
|
|
1486
1528
|
|
|
1487
1529
|
// src/internal/GoogleSignInButton.tsx
|
|
1488
|
-
import { jsx as
|
|
1530
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1489
1531
|
function GoogleSignInButton({
|
|
1490
1532
|
onClick,
|
|
1491
1533
|
testId = "oauth-google",
|
|
1492
1534
|
label = "Continuar com Google"
|
|
1493
1535
|
}) {
|
|
1494
|
-
return /* @__PURE__ */
|
|
1536
|
+
return /* @__PURE__ */ jsxs12(
|
|
1495
1537
|
"button",
|
|
1496
1538
|
{
|
|
1497
1539
|
"data-testid": testId,
|
|
@@ -1514,36 +1556,36 @@ function GoogleSignInButton({
|
|
|
1514
1556
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
1515
1557
|
},
|
|
1516
1558
|
children: [
|
|
1517
|
-
/* @__PURE__ */
|
|
1559
|
+
/* @__PURE__ */ jsx18(GoogleGlyph, {}),
|
|
1518
1560
|
label
|
|
1519
1561
|
]
|
|
1520
1562
|
}
|
|
1521
1563
|
);
|
|
1522
1564
|
}
|
|
1523
1565
|
function GoogleGlyph() {
|
|
1524
|
-
return /* @__PURE__ */
|
|
1525
|
-
/* @__PURE__ */
|
|
1566
|
+
return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "18", viewBox: "0 0 18 18", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
|
|
1567
|
+
/* @__PURE__ */ jsx18(
|
|
1526
1568
|
"path",
|
|
1527
1569
|
{
|
|
1528
1570
|
d: "M17.64 9.2c0-.637-.057-1.251-.164-1.84H9v3.481h4.844a4.14 4.14 0 0 1-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.874 2.684-6.615z",
|
|
1529
1571
|
fill: "#4285F4"
|
|
1530
1572
|
}
|
|
1531
1573
|
),
|
|
1532
|
-
/* @__PURE__ */
|
|
1574
|
+
/* @__PURE__ */ jsx18(
|
|
1533
1575
|
"path",
|
|
1534
1576
|
{
|
|
1535
1577
|
d: "M9 18c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H.957v2.332A8.997 8.997 0 0 0 9 18z",
|
|
1536
1578
|
fill: "#34A853"
|
|
1537
1579
|
}
|
|
1538
1580
|
),
|
|
1539
|
-
/* @__PURE__ */
|
|
1581
|
+
/* @__PURE__ */ jsx18(
|
|
1540
1582
|
"path",
|
|
1541
1583
|
{
|
|
1542
1584
|
d: "M3.964 10.71A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.996 8.996 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.332z",
|
|
1543
1585
|
fill: "#FBBC05"
|
|
1544
1586
|
}
|
|
1545
1587
|
),
|
|
1546
|
-
/* @__PURE__ */
|
|
1588
|
+
/* @__PURE__ */ jsx18(
|
|
1547
1589
|
"path",
|
|
1548
1590
|
{
|
|
1549
1591
|
d: "M9 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.463.891 11.426 0 9 0A8.997 8.997 0 0 0 .957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58z",
|
|
@@ -1554,8 +1596,8 @@ function GoogleGlyph() {
|
|
|
1554
1596
|
}
|
|
1555
1597
|
|
|
1556
1598
|
// src/internal/OAuthErrorBanner.tsx
|
|
1557
|
-
import { useEffect as useEffect5, useState as
|
|
1558
|
-
import { jsx as
|
|
1599
|
+
import { useEffect as useEffect5, useState as useState6 } from "react";
|
|
1600
|
+
import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1559
1601
|
var ERROR_MESSAGES = {
|
|
1560
1602
|
invalid_state: "Sess\xE3o expirou, tente de novo.",
|
|
1561
1603
|
access_denied: "Voc\xEA cancelou o login com Google.",
|
|
@@ -1575,13 +1617,13 @@ function stripErrorFromUrl() {
|
|
|
1575
1617
|
window.history.replaceState({}, "", url.toString());
|
|
1576
1618
|
}
|
|
1577
1619
|
function OAuthErrorBanner() {
|
|
1578
|
-
const [code, setCode] =
|
|
1620
|
+
const [code, setCode] = useState6(() => readErrorCode());
|
|
1579
1621
|
useEffect5(() => {
|
|
1580
1622
|
if (code !== null) stripErrorFromUrl();
|
|
1581
1623
|
}, [code]);
|
|
1582
1624
|
if (!code) return null;
|
|
1583
1625
|
const message = ERROR_MESSAGES[code] ?? "N\xE3o conseguimos conectar ao Google. Tente de novo.";
|
|
1584
|
-
return /* @__PURE__ */
|
|
1626
|
+
return /* @__PURE__ */ jsxs13(
|
|
1585
1627
|
"div",
|
|
1586
1628
|
{
|
|
1587
1629
|
role: "alert",
|
|
@@ -1596,7 +1638,7 @@ function OAuthErrorBanner() {
|
|
|
1596
1638
|
},
|
|
1597
1639
|
children: [
|
|
1598
1640
|
message,
|
|
1599
|
-
/* @__PURE__ */
|
|
1641
|
+
/* @__PURE__ */ jsx19(
|
|
1600
1642
|
"button",
|
|
1601
1643
|
{
|
|
1602
1644
|
type: "button",
|
|
@@ -1621,16 +1663,16 @@ function OAuthErrorBanner() {
|
|
|
1621
1663
|
}
|
|
1622
1664
|
|
|
1623
1665
|
// src/defaults/DefaultLoginScreen.tsx
|
|
1624
|
-
import { jsx as
|
|
1666
|
+
import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1625
1667
|
function DefaultLoginScreen({ onNavigate }) {
|
|
1626
1668
|
const { name } = useTemplateConfig();
|
|
1627
1669
|
const f = useLoginForm();
|
|
1628
|
-
return /* @__PURE__ */
|
|
1629
|
-
/* @__PURE__ */
|
|
1630
|
-
/* @__PURE__ */
|
|
1631
|
-
/* @__PURE__ */
|
|
1632
|
-
/* @__PURE__ */
|
|
1633
|
-
/* @__PURE__ */
|
|
1670
|
+
return /* @__PURE__ */ jsxs14("main", { style: { padding: 24, maxWidth: 360, margin: "0 auto" }, children: [
|
|
1671
|
+
/* @__PURE__ */ jsx20("h1", { style: { marginBottom: 8 }, children: name }),
|
|
1672
|
+
/* @__PURE__ */ jsx20("p", { style: { opacity: 0.7, marginBottom: 24 }, children: "Entre na sua conta" }),
|
|
1673
|
+
/* @__PURE__ */ jsx20(OAuthErrorBanner, {}),
|
|
1674
|
+
/* @__PURE__ */ jsx20(GoogleSignInButton, { onClick: f.loginWithGoogle, testId: "login-oauth-google" }),
|
|
1675
|
+
/* @__PURE__ */ jsxs14(
|
|
1634
1676
|
"div",
|
|
1635
1677
|
{
|
|
1636
1678
|
"aria-hidden": "true",
|
|
@@ -1643,19 +1685,19 @@ function DefaultLoginScreen({ onNavigate }) {
|
|
|
1643
1685
|
fontSize: 12
|
|
1644
1686
|
},
|
|
1645
1687
|
children: [
|
|
1646
|
-
/* @__PURE__ */
|
|
1688
|
+
/* @__PURE__ */ jsx20("span", { style: { flex: 1, height: 1, background: "rgba(0,0,0,0.1)" } }),
|
|
1647
1689
|
"ou",
|
|
1648
|
-
/* @__PURE__ */
|
|
1690
|
+
/* @__PURE__ */ jsx20("span", { style: { flex: 1, height: 1, background: "rgba(0,0,0,0.1)" } })
|
|
1649
1691
|
]
|
|
1650
1692
|
}
|
|
1651
1693
|
),
|
|
1652
|
-
/* @__PURE__ */
|
|
1694
|
+
/* @__PURE__ */ jsxs14("form", { onSubmit: (e) => {
|
|
1653
1695
|
e.preventDefault();
|
|
1654
1696
|
void f.submit();
|
|
1655
1697
|
}, children: [
|
|
1656
|
-
/* @__PURE__ */
|
|
1698
|
+
/* @__PURE__ */ jsxs14("label", { style: { display: "block", marginBottom: 12 }, children: [
|
|
1657
1699
|
"E-mail",
|
|
1658
|
-
/* @__PURE__ */
|
|
1700
|
+
/* @__PURE__ */ jsx20(
|
|
1659
1701
|
"input",
|
|
1660
1702
|
{
|
|
1661
1703
|
"data-testid": "login-email",
|
|
@@ -1665,11 +1707,11 @@ function DefaultLoginScreen({ onNavigate }) {
|
|
|
1665
1707
|
style: { display: "block", width: "100%" }
|
|
1666
1708
|
}
|
|
1667
1709
|
),
|
|
1668
|
-
f.emailError && /* @__PURE__ */
|
|
1710
|
+
f.emailError && /* @__PURE__ */ jsx20("small", { style: { color: "#c00" }, children: f.emailError })
|
|
1669
1711
|
] }),
|
|
1670
|
-
/* @__PURE__ */
|
|
1712
|
+
/* @__PURE__ */ jsxs14("label", { style: { display: "block", marginBottom: 12 }, children: [
|
|
1671
1713
|
"Senha",
|
|
1672
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ jsx20(
|
|
1673
1715
|
"input",
|
|
1674
1716
|
{
|
|
1675
1717
|
"data-testid": "login-password",
|
|
@@ -1679,10 +1721,10 @@ function DefaultLoginScreen({ onNavigate }) {
|
|
|
1679
1721
|
style: { display: "block", width: "100%" }
|
|
1680
1722
|
}
|
|
1681
1723
|
),
|
|
1682
|
-
f.passwordError && /* @__PURE__ */
|
|
1724
|
+
f.passwordError && /* @__PURE__ */ jsx20("small", { style: { color: "#c00" }, children: f.passwordError })
|
|
1683
1725
|
] }),
|
|
1684
|
-
f.error && /* @__PURE__ */
|
|
1685
|
-
/* @__PURE__ */
|
|
1726
|
+
f.error && /* @__PURE__ */ jsx20("div", { role: "alert", style: { color: "#c00", marginBottom: 12 }, children: f.error.message }),
|
|
1727
|
+
/* @__PURE__ */ jsx20(
|
|
1686
1728
|
"button",
|
|
1687
1729
|
{
|
|
1688
1730
|
"data-testid": "login-submit",
|
|
@@ -1701,25 +1743,25 @@ function DefaultLoginScreen({ onNavigate }) {
|
|
|
1701
1743
|
}
|
|
1702
1744
|
)
|
|
1703
1745
|
] }),
|
|
1704
|
-
/* @__PURE__ */
|
|
1705
|
-
/* @__PURE__ */
|
|
1706
|
-
/* @__PURE__ */
|
|
1746
|
+
/* @__PURE__ */ jsxs14("div", { style: { marginTop: 16, display: "flex", justifyContent: "space-between" }, children: [
|
|
1747
|
+
/* @__PURE__ */ jsx20("button", { "data-testid": "login-goto-signup", type: "button", onClick: () => onNavigate("signup"), style: { background: "none", border: "none", cursor: "pointer" }, children: "Criar conta" }),
|
|
1748
|
+
/* @__PURE__ */ jsx20("button", { "data-testid": "login-goto-forgot", type: "button", onClick: () => onNavigate("forgot"), style: { background: "none", border: "none", cursor: "pointer" }, children: "Esqueci senha" })
|
|
1707
1749
|
] })
|
|
1708
1750
|
] });
|
|
1709
1751
|
}
|
|
1710
1752
|
|
|
1711
1753
|
// src/hooks/useSignupForm.ts
|
|
1712
|
-
import { useCallback as useCallback4, useMemo as useMemo3, useState as
|
|
1754
|
+
import { useCallback as useCallback4, useMemo as useMemo3, useState as useState7 } from "react";
|
|
1713
1755
|
import { useHook as useHook5 } from "@hook-sdk/sdk";
|
|
1714
1756
|
var EMAIL_RE2 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
1715
1757
|
var MIN_PASSWORD2 = 8;
|
|
1716
1758
|
function useSignupForm() {
|
|
1717
1759
|
const { auth } = useHook5();
|
|
1718
|
-
const [name, setName] =
|
|
1719
|
-
const [email, setEmail] =
|
|
1720
|
-
const [password, setPassword] =
|
|
1721
|
-
const [submitting, setSubmitting] =
|
|
1722
|
-
const [error, setError] =
|
|
1760
|
+
const [name, setName] = useState7("");
|
|
1761
|
+
const [email, setEmail] = useState7("");
|
|
1762
|
+
const [password, setPassword] = useState7("");
|
|
1763
|
+
const [submitting, setSubmitting] = useState7(false);
|
|
1764
|
+
const [error, setError] = useState7(null);
|
|
1723
1765
|
const nameError = useMemo3(() => {
|
|
1724
1766
|
if (name.length === 0) return null;
|
|
1725
1767
|
if (name.trim().length < 2) return "Nome muito curto.";
|
|
@@ -1769,16 +1811,16 @@ function useSignupForm() {
|
|
|
1769
1811
|
}
|
|
1770
1812
|
|
|
1771
1813
|
// src/defaults/DefaultSignupScreen.tsx
|
|
1772
|
-
import { jsx as
|
|
1814
|
+
import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1773
1815
|
function DefaultSignupScreen({ onNavigate }) {
|
|
1774
1816
|
const { name } = useTemplateConfig();
|
|
1775
1817
|
const f = useSignupForm();
|
|
1776
|
-
return /* @__PURE__ */
|
|
1777
|
-
/* @__PURE__ */
|
|
1778
|
-
/* @__PURE__ */
|
|
1779
|
-
/* @__PURE__ */
|
|
1780
|
-
/* @__PURE__ */
|
|
1781
|
-
/* @__PURE__ */
|
|
1818
|
+
return /* @__PURE__ */ jsxs15("main", { style: { padding: 24, maxWidth: 360, margin: "0 auto" }, children: [
|
|
1819
|
+
/* @__PURE__ */ jsx21("h1", { style: { marginBottom: 8 }, children: name }),
|
|
1820
|
+
/* @__PURE__ */ jsx21("p", { style: { opacity: 0.7, marginBottom: 24 }, children: "Criar sua conta" }),
|
|
1821
|
+
/* @__PURE__ */ jsx21(OAuthErrorBanner, {}),
|
|
1822
|
+
/* @__PURE__ */ jsx21(GoogleSignInButton, { onClick: f.loginWithGoogle, testId: "signup-oauth-google" }),
|
|
1823
|
+
/* @__PURE__ */ jsxs15(
|
|
1782
1824
|
"div",
|
|
1783
1825
|
{
|
|
1784
1826
|
"aria-hidden": "true",
|
|
@@ -1791,48 +1833,48 @@ function DefaultSignupScreen({ onNavigate }) {
|
|
|
1791
1833
|
fontSize: 12
|
|
1792
1834
|
},
|
|
1793
1835
|
children: [
|
|
1794
|
-
/* @__PURE__ */
|
|
1836
|
+
/* @__PURE__ */ jsx21("span", { style: { flex: 1, height: 1, background: "rgba(0,0,0,0.1)" } }),
|
|
1795
1837
|
"ou",
|
|
1796
|
-
/* @__PURE__ */
|
|
1838
|
+
/* @__PURE__ */ jsx21("span", { style: { flex: 1, height: 1, background: "rgba(0,0,0,0.1)" } })
|
|
1797
1839
|
]
|
|
1798
1840
|
}
|
|
1799
1841
|
),
|
|
1800
|
-
/* @__PURE__ */
|
|
1842
|
+
/* @__PURE__ */ jsxs15("form", { onSubmit: (e) => {
|
|
1801
1843
|
e.preventDefault();
|
|
1802
1844
|
void f.submit();
|
|
1803
1845
|
}, children: [
|
|
1804
|
-
/* @__PURE__ */
|
|
1846
|
+
/* @__PURE__ */ jsxs15("label", { style: { display: "block", marginBottom: 12 }, children: [
|
|
1805
1847
|
"Nome",
|
|
1806
|
-
/* @__PURE__ */
|
|
1807
|
-
f.nameError && /* @__PURE__ */
|
|
1848
|
+
/* @__PURE__ */ jsx21("input", { "data-testid": "signup-name", value: f.name, onChange: (e) => f.setName(e.target.value), style: { display: "block", width: "100%" } }),
|
|
1849
|
+
f.nameError && /* @__PURE__ */ jsx21("small", { style: { color: "#c00" }, children: f.nameError })
|
|
1808
1850
|
] }),
|
|
1809
|
-
/* @__PURE__ */
|
|
1851
|
+
/* @__PURE__ */ jsxs15("label", { style: { display: "block", marginBottom: 12 }, children: [
|
|
1810
1852
|
"E-mail",
|
|
1811
|
-
/* @__PURE__ */
|
|
1812
|
-
f.emailError && /* @__PURE__ */
|
|
1853
|
+
/* @__PURE__ */ jsx21("input", { "data-testid": "signup-email", type: "email", value: f.email, onChange: (e) => f.setEmail(e.target.value), style: { display: "block", width: "100%" } }),
|
|
1854
|
+
f.emailError && /* @__PURE__ */ jsx21("small", { style: { color: "#c00" }, children: f.emailError })
|
|
1813
1855
|
] }),
|
|
1814
|
-
/* @__PURE__ */
|
|
1856
|
+
/* @__PURE__ */ jsxs15("label", { style: { display: "block", marginBottom: 12 }, children: [
|
|
1815
1857
|
"Senha",
|
|
1816
|
-
/* @__PURE__ */
|
|
1817
|
-
f.passwordError && /* @__PURE__ */
|
|
1858
|
+
/* @__PURE__ */ jsx21("input", { "data-testid": "signup-password", type: "password", value: f.password, onChange: (e) => f.setPassword(e.target.value), style: { display: "block", width: "100%" } }),
|
|
1859
|
+
f.passwordError && /* @__PURE__ */ jsx21("small", { style: { color: "#c00" }, children: f.passwordError })
|
|
1818
1860
|
] }),
|
|
1819
|
-
f.error && /* @__PURE__ */
|
|
1820
|
-
/* @__PURE__ */
|
|
1861
|
+
f.error && /* @__PURE__ */ jsx21("div", { role: "alert", style: { color: "#c00", marginBottom: 12 }, children: f.error.message }),
|
|
1862
|
+
/* @__PURE__ */ jsx21("button", { "data-testid": "signup-submit", type: "submit", disabled: !f.canSubmit, style: { width: "100%", padding: 12, background: "var(--hook-color-primary)", color: "#fff", border: "none", borderRadius: 8, opacity: f.canSubmit ? 1 : 0.5 }, children: f.submitting ? "Criando..." : "Criar conta" })
|
|
1821
1863
|
] }),
|
|
1822
|
-
/* @__PURE__ */
|
|
1864
|
+
/* @__PURE__ */ jsx21("div", { style: { marginTop: 16 }, children: /* @__PURE__ */ jsx21("button", { "data-testid": "signup-goto-login", type: "button", onClick: () => onNavigate("login"), style: { background: "none", border: "none", cursor: "pointer" }, children: "J\xE1 tem conta? Entre" }) })
|
|
1823
1865
|
] });
|
|
1824
1866
|
}
|
|
1825
1867
|
|
|
1826
1868
|
// src/hooks/useForgotForm.ts
|
|
1827
|
-
import { useCallback as useCallback5, useMemo as useMemo4, useState as
|
|
1869
|
+
import { useCallback as useCallback5, useMemo as useMemo4, useState as useState8 } from "react";
|
|
1828
1870
|
import { useHook as useHook6 } from "@hook-sdk/sdk";
|
|
1829
1871
|
var EMAIL_RE3 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
1830
1872
|
function useForgotForm() {
|
|
1831
1873
|
const { auth } = useHook6();
|
|
1832
|
-
const [email, setEmail] =
|
|
1833
|
-
const [submitting, setSubmitting] =
|
|
1834
|
-
const [sent, setSent] =
|
|
1835
|
-
const [error, setError] =
|
|
1874
|
+
const [email, setEmail] = useState8("");
|
|
1875
|
+
const [submitting, setSubmitting] = useState8(false);
|
|
1876
|
+
const [sent, setSent] = useState8(false);
|
|
1877
|
+
const [error, setError] = useState8(null);
|
|
1836
1878
|
const emailError = useMemo4(() => {
|
|
1837
1879
|
if (email.length === 0) return null;
|
|
1838
1880
|
if (!EMAIL_RE3.test(email)) return "Formato de e-mail inv\xE1lido.";
|
|
@@ -1867,48 +1909,48 @@ function useForgotForm() {
|
|
|
1867
1909
|
}
|
|
1868
1910
|
|
|
1869
1911
|
// src/defaults/DefaultForgotScreen.tsx
|
|
1870
|
-
import { jsx as
|
|
1912
|
+
import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1871
1913
|
function DefaultForgotScreen({ onNavigate }) {
|
|
1872
1914
|
const { name } = useTemplateConfig();
|
|
1873
1915
|
const f = useForgotForm();
|
|
1874
1916
|
if (f.sent) {
|
|
1875
|
-
return /* @__PURE__ */
|
|
1876
|
-
/* @__PURE__ */
|
|
1877
|
-
/* @__PURE__ */
|
|
1878
|
-
/* @__PURE__ */
|
|
1917
|
+
return /* @__PURE__ */ jsxs16("main", { style: { padding: 24, maxWidth: 360, margin: "0 auto", textAlign: "center" }, children: [
|
|
1918
|
+
/* @__PURE__ */ jsx22("h1", { children: "Verifique seu e-mail" }),
|
|
1919
|
+
/* @__PURE__ */ jsx22("p", { style: { opacity: 0.7 }, children: "Enviamos um link pra redefinir sua senha." }),
|
|
1920
|
+
/* @__PURE__ */ jsx22("button", { "data-testid": "forgot-back-login", type: "button", onClick: () => onNavigate("login"), children: "Voltar pro login" })
|
|
1879
1921
|
] });
|
|
1880
1922
|
}
|
|
1881
|
-
return /* @__PURE__ */
|
|
1882
|
-
/* @__PURE__ */
|
|
1883
|
-
/* @__PURE__ */
|
|
1884
|
-
/* @__PURE__ */
|
|
1923
|
+
return /* @__PURE__ */ jsxs16("main", { style: { padding: 24, maxWidth: 360, margin: "0 auto" }, children: [
|
|
1924
|
+
/* @__PURE__ */ jsx22("h1", { style: { marginBottom: 8 }, children: name }),
|
|
1925
|
+
/* @__PURE__ */ jsx22("p", { style: { opacity: 0.7, marginBottom: 24 }, children: "Redefinir senha" }),
|
|
1926
|
+
/* @__PURE__ */ jsxs16("form", { onSubmit: (e) => {
|
|
1885
1927
|
e.preventDefault();
|
|
1886
1928
|
void f.submit();
|
|
1887
1929
|
}, children: [
|
|
1888
|
-
/* @__PURE__ */
|
|
1930
|
+
/* @__PURE__ */ jsxs16("label", { style: { display: "block", marginBottom: 12 }, children: [
|
|
1889
1931
|
"E-mail",
|
|
1890
|
-
/* @__PURE__ */
|
|
1891
|
-
f.emailError && /* @__PURE__ */
|
|
1932
|
+
/* @__PURE__ */ jsx22("input", { "data-testid": "forgot-email", type: "email", value: f.email, onChange: (e) => f.setEmail(e.target.value), style: { display: "block", width: "100%" } }),
|
|
1933
|
+
f.emailError && /* @__PURE__ */ jsx22("small", { style: { color: "#c00" }, children: f.emailError })
|
|
1892
1934
|
] }),
|
|
1893
|
-
f.error && /* @__PURE__ */
|
|
1894
|
-
/* @__PURE__ */
|
|
1935
|
+
f.error && /* @__PURE__ */ jsx22("div", { role: "alert", style: { color: "#c00", marginBottom: 12 }, children: f.error.message }),
|
|
1936
|
+
/* @__PURE__ */ jsx22("button", { "data-testid": "forgot-submit", type: "submit", disabled: !f.canSubmit, style: { width: "100%", padding: 12, background: "var(--hook-color-primary)", color: "#fff", border: "none", borderRadius: 8, opacity: f.canSubmit ? 1 : 0.5 }, children: f.submitting ? "Enviando..." : "Enviar link" })
|
|
1895
1937
|
] }),
|
|
1896
|
-
/* @__PURE__ */
|
|
1938
|
+
/* @__PURE__ */ jsx22("div", { style: { marginTop: 16 }, children: /* @__PURE__ */ jsx22("button", { "data-testid": "forgot-goto-login", type: "button", onClick: () => onNavigate("login"), style: { background: "none", border: "none", cursor: "pointer" }, children: "Voltar pro login" }) })
|
|
1897
1939
|
] });
|
|
1898
1940
|
}
|
|
1899
1941
|
|
|
1900
1942
|
// src/hooks/useResetForm.ts
|
|
1901
|
-
import { useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo5, useState as
|
|
1943
|
+
import { useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo5, useState as useState9 } from "react";
|
|
1902
1944
|
import { useHook as useHook7 } from "@hook-sdk/sdk";
|
|
1903
1945
|
var MIN_PASSWORD3 = 12;
|
|
1904
1946
|
function useResetForm() {
|
|
1905
1947
|
const { auth } = useHook7();
|
|
1906
|
-
const [token, setToken] =
|
|
1907
|
-
const [password, setPassword] =
|
|
1908
|
-
const [confirm, setConfirm] =
|
|
1909
|
-
const [submitting, setSubmitting] =
|
|
1910
|
-
const [done, setDone] =
|
|
1911
|
-
const [error, setError] =
|
|
1948
|
+
const [token, setToken] = useState9(null);
|
|
1949
|
+
const [password, setPassword] = useState9("");
|
|
1950
|
+
const [confirm, setConfirm] = useState9("");
|
|
1951
|
+
const [submitting, setSubmitting] = useState9(false);
|
|
1952
|
+
const [done, setDone] = useState9(false);
|
|
1953
|
+
const [error, setError] = useState9(null);
|
|
1912
1954
|
useEffect6(() => {
|
|
1913
1955
|
if (typeof window === "undefined") return;
|
|
1914
1956
|
const params = new URLSearchParams(window.location.search);
|
|
@@ -1962,67 +2004,67 @@ function useResetForm() {
|
|
|
1962
2004
|
}
|
|
1963
2005
|
|
|
1964
2006
|
// src/defaults/DefaultResetScreen.tsx
|
|
1965
|
-
import { jsx as
|
|
2007
|
+
import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1966
2008
|
function DefaultResetScreen({ onNavigate }) {
|
|
1967
2009
|
const { name } = useTemplateConfig();
|
|
1968
2010
|
const f = useResetForm();
|
|
1969
2011
|
if (f.done) {
|
|
1970
|
-
return /* @__PURE__ */
|
|
1971
|
-
/* @__PURE__ */
|
|
1972
|
-
/* @__PURE__ */
|
|
1973
|
-
/* @__PURE__ */
|
|
2012
|
+
return /* @__PURE__ */ jsxs17("main", { style: { padding: 24, maxWidth: 360, margin: "0 auto", textAlign: "center" }, children: [
|
|
2013
|
+
/* @__PURE__ */ jsx23("h1", { children: "Senha alterada" }),
|
|
2014
|
+
/* @__PURE__ */ jsx23("p", { style: { opacity: 0.7 }, children: "Agora \xE9 s\xF3 fazer login com a nova senha." }),
|
|
2015
|
+
/* @__PURE__ */ jsx23("button", { "data-testid": "reset-back-login", type: "button", onClick: () => onNavigate("login"), children: "Ir pro login" })
|
|
1974
2016
|
] });
|
|
1975
2017
|
}
|
|
1976
2018
|
if (f.token === null) {
|
|
1977
|
-
return /* @__PURE__ */
|
|
1978
|
-
/* @__PURE__ */
|
|
1979
|
-
/* @__PURE__ */
|
|
1980
|
-
/* @__PURE__ */
|
|
2019
|
+
return /* @__PURE__ */ jsxs17("main", { style: { padding: 24, maxWidth: 360, margin: "0 auto", textAlign: "center" }, children: [
|
|
2020
|
+
/* @__PURE__ */ jsx23("h1", { children: "Link inv\xE1lido" }),
|
|
2021
|
+
/* @__PURE__ */ jsx23("p", { style: { opacity: 0.7 }, children: "Pe\xE7a um novo link de reset." }),
|
|
2022
|
+
/* @__PURE__ */ jsx23("button", { "data-testid": "reset-goto-forgot", type: "button", onClick: () => onNavigate("forgot"), children: "Pedir novo link" })
|
|
1981
2023
|
] });
|
|
1982
2024
|
}
|
|
1983
|
-
return /* @__PURE__ */
|
|
1984
|
-
/* @__PURE__ */
|
|
1985
|
-
/* @__PURE__ */
|
|
1986
|
-
/* @__PURE__ */
|
|
2025
|
+
return /* @__PURE__ */ jsxs17("main", { style: { padding: 24, maxWidth: 360, margin: "0 auto" }, children: [
|
|
2026
|
+
/* @__PURE__ */ jsx23("h1", { style: { marginBottom: 8 }, children: name }),
|
|
2027
|
+
/* @__PURE__ */ jsx23("p", { style: { opacity: 0.7, marginBottom: 24 }, children: "Escolha uma nova senha" }),
|
|
2028
|
+
/* @__PURE__ */ jsxs17("form", { onSubmit: (e) => {
|
|
1987
2029
|
e.preventDefault();
|
|
1988
2030
|
void f.submit();
|
|
1989
2031
|
}, children: [
|
|
1990
|
-
/* @__PURE__ */
|
|
2032
|
+
/* @__PURE__ */ jsxs17("label", { style: { display: "block", marginBottom: 12 }, children: [
|
|
1991
2033
|
"Nova senha",
|
|
1992
|
-
/* @__PURE__ */
|
|
1993
|
-
f.passwordError && /* @__PURE__ */
|
|
2034
|
+
/* @__PURE__ */ jsx23("input", { "data-testid": "reset-password", type: "password", value: f.password, onChange: (e) => f.setPassword(e.target.value), style: { display: "block", width: "100%" }, autoComplete: "new-password" }),
|
|
2035
|
+
f.passwordError && /* @__PURE__ */ jsx23("small", { style: { color: "#c00" }, children: f.passwordError })
|
|
1994
2036
|
] }),
|
|
1995
|
-
/* @__PURE__ */
|
|
2037
|
+
/* @__PURE__ */ jsxs17("label", { style: { display: "block", marginBottom: 12 }, children: [
|
|
1996
2038
|
"Confirmar senha",
|
|
1997
|
-
/* @__PURE__ */
|
|
1998
|
-
f.confirmError && /* @__PURE__ */
|
|
2039
|
+
/* @__PURE__ */ jsx23("input", { "data-testid": "reset-confirm", type: "password", value: f.confirm, onChange: (e) => f.setConfirm(e.target.value), style: { display: "block", width: "100%" }, autoComplete: "new-password" }),
|
|
2040
|
+
f.confirmError && /* @__PURE__ */ jsx23("small", { style: { color: "#c00" }, children: f.confirmError })
|
|
1999
2041
|
] }),
|
|
2000
|
-
f.error && /* @__PURE__ */
|
|
2001
|
-
/* @__PURE__ */
|
|
2042
|
+
f.error && /* @__PURE__ */ jsx23("div", { role: "alert", style: { color: "#c00", marginBottom: 12 }, children: f.error.message }),
|
|
2043
|
+
/* @__PURE__ */ jsx23("button", { "data-testid": "reset-submit", type: "submit", disabled: !f.canSubmit, style: { width: "100%", padding: 12, background: "var(--hook-color-primary)", color: "#fff", border: "none", borderRadius: 8, opacity: f.canSubmit ? 1 : 0.5 }, children: f.submitting ? "Alterando..." : "Alterar senha" })
|
|
2002
2044
|
] })
|
|
2003
2045
|
] });
|
|
2004
2046
|
}
|
|
2005
2047
|
|
|
2006
2048
|
// src/defaults/DefaultPaywall.tsx
|
|
2007
|
-
import { useState as
|
|
2008
|
-
import { jsx as
|
|
2049
|
+
import { useState as useState10 } from "react";
|
|
2050
|
+
import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2009
2051
|
function DefaultPaywall() {
|
|
2010
2052
|
const config = useTemplateConfig();
|
|
2011
2053
|
const { checkout, opening, error } = usePaywallState();
|
|
2012
2054
|
const p = config.subscription.paywall_config;
|
|
2013
|
-
const [cpf, setCpf] =
|
|
2055
|
+
const [cpf, setCpf] = useState10("");
|
|
2014
2056
|
const cpfDigits = cpf.replace(/\D/g, "");
|
|
2015
2057
|
const canCheckout = cpfDigits.length === 11 && !opening;
|
|
2016
|
-
return /* @__PURE__ */
|
|
2017
|
-
/* @__PURE__ */
|
|
2018
|
-
p.subtitle && /* @__PURE__ */
|
|
2019
|
-
/* @__PURE__ */
|
|
2020
|
-
/* @__PURE__ */
|
|
2021
|
-
/* @__PURE__ */
|
|
2058
|
+
return /* @__PURE__ */ jsxs18("main", { style: { padding: 24, maxWidth: 440, margin: "0 auto", textAlign: "center" }, children: [
|
|
2059
|
+
/* @__PURE__ */ jsx24("h1", { style: { marginBottom: 8 }, children: p.title }),
|
|
2060
|
+
p.subtitle && /* @__PURE__ */ jsx24("p", { style: { opacity: 0.7, marginBottom: 24 }, children: p.subtitle }),
|
|
2061
|
+
/* @__PURE__ */ jsx24("ul", { style: { listStyle: "none", padding: 0, textAlign: "left", marginBottom: 24 }, children: p.benefits.map((b) => /* @__PURE__ */ jsxs18("li", { style: { padding: "8px 0", display: "flex", alignItems: "center" }, children: [
|
|
2062
|
+
/* @__PURE__ */ jsx24("span", { "aria-hidden": true, style: { marginRight: 8 }, children: "\u2713" }),
|
|
2063
|
+
/* @__PURE__ */ jsx24("span", { children: b })
|
|
2022
2064
|
] }, b)) }),
|
|
2023
|
-
/* @__PURE__ */
|
|
2024
|
-
/* @__PURE__ */
|
|
2025
|
-
/* @__PURE__ */
|
|
2065
|
+
/* @__PURE__ */ jsxs18("div", { style: { textAlign: "left", marginBottom: 16 }, children: [
|
|
2066
|
+
/* @__PURE__ */ jsx24("label", { style: { display: "block", fontSize: 14, opacity: 0.7, marginBottom: 4 }, children: "Seu CPF (pra emiss\xE3o de recibo)" }),
|
|
2067
|
+
/* @__PURE__ */ jsx24(
|
|
2026
2068
|
"input",
|
|
2027
2069
|
{
|
|
2028
2070
|
"data-testid": "paywall-cpf",
|
|
@@ -2035,8 +2077,8 @@ function DefaultPaywall() {
|
|
|
2035
2077
|
}
|
|
2036
2078
|
)
|
|
2037
2079
|
] }),
|
|
2038
|
-
error && /* @__PURE__ */
|
|
2039
|
-
/* @__PURE__ */
|
|
2080
|
+
error && /* @__PURE__ */ jsx24("div", { role: "alert", style: { color: "#c00", marginBottom: 12 }, children: error.message }),
|
|
2081
|
+
/* @__PURE__ */ jsx24(
|
|
2040
2082
|
"button",
|
|
2041
2083
|
{
|
|
2042
2084
|
"data-testid": "paywall-cta",
|
|
@@ -2057,20 +2099,20 @@ function DefaultPaywall() {
|
|
|
2057
2099
|
children: opening ? "Abrindo..." : p.cta
|
|
2058
2100
|
}
|
|
2059
2101
|
),
|
|
2060
|
-
p.priceHint && /* @__PURE__ */
|
|
2061
|
-
p.footerNote && /* @__PURE__ */
|
|
2102
|
+
p.priceHint && /* @__PURE__ */ jsx24("p", { style: { opacity: 0.6, marginTop: 12 }, children: p.priceHint }),
|
|
2103
|
+
p.footerNote && /* @__PURE__ */ jsx24("p", { style: { opacity: 0.5, marginTop: 16, fontSize: 12 }, children: p.footerNote })
|
|
2062
2104
|
] });
|
|
2063
2105
|
}
|
|
2064
2106
|
|
|
2065
2107
|
// src/AppRoot.tsx
|
|
2066
|
-
import { Fragment as Fragment6, jsx as
|
|
2108
|
+
import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2067
2109
|
var BACKOFF_MS = [2e3, 5e3, 1e4, 2e4, 4e4];
|
|
2068
2110
|
function PaymentReturnHandler({ children }) {
|
|
2069
2111
|
const { subscription } = useHook8();
|
|
2070
2112
|
const subRef = useRef2(subscription);
|
|
2071
2113
|
subRef.current = subscription;
|
|
2072
2114
|
const runIdRef = useRef2(0);
|
|
2073
|
-
const [state, setState] =
|
|
2115
|
+
const [state, setState] = useState11("idle");
|
|
2074
2116
|
const runPoll = useCallback7(() => {
|
|
2075
2117
|
const runId = ++runIdRef.current;
|
|
2076
2118
|
setState("confirming");
|
|
@@ -2110,7 +2152,7 @@ function PaymentReturnHandler({ children }) {
|
|
|
2110
2152
|
};
|
|
2111
2153
|
}, [runPoll]);
|
|
2112
2154
|
if (state === "confirming") {
|
|
2113
|
-
return /* @__PURE__ */
|
|
2155
|
+
return /* @__PURE__ */ jsx25(
|
|
2114
2156
|
"div",
|
|
2115
2157
|
{
|
|
2116
2158
|
role: "status",
|
|
@@ -2121,9 +2163,9 @@ function PaymentReturnHandler({ children }) {
|
|
|
2121
2163
|
);
|
|
2122
2164
|
}
|
|
2123
2165
|
if (state === "waiting") {
|
|
2124
|
-
return /* @__PURE__ */
|
|
2125
|
-
/* @__PURE__ */
|
|
2126
|
-
/* @__PURE__ */
|
|
2166
|
+
return /* @__PURE__ */ jsx25("div", { role: "status", "aria-live": "polite", style: overlayStyle2, children: /* @__PURE__ */ jsxs19("div", { style: { maxWidth: 320, textAlign: "center", lineHeight: 1.5 }, children: [
|
|
2167
|
+
/* @__PURE__ */ jsx25("div", { style: { marginBottom: 16 }, children: "Pagamento aceito. Estamos confirmando com o banco \u2014 pode levar alguns minutos." }),
|
|
2168
|
+
/* @__PURE__ */ jsx25(
|
|
2127
2169
|
"button",
|
|
2128
2170
|
{
|
|
2129
2171
|
type: "button",
|
|
@@ -2134,7 +2176,7 @@ function PaymentReturnHandler({ children }) {
|
|
|
2134
2176
|
)
|
|
2135
2177
|
] }) });
|
|
2136
2178
|
}
|
|
2137
|
-
return /* @__PURE__ */
|
|
2179
|
+
return /* @__PURE__ */ jsx25(Fragment6, { children });
|
|
2138
2180
|
}
|
|
2139
2181
|
var overlayStyle2 = {
|
|
2140
2182
|
position: "fixed",
|
|
@@ -2167,14 +2209,14 @@ function AppRoot({
|
|
|
2167
2209
|
Reset = DefaultResetScreen,
|
|
2168
2210
|
Paywall = DefaultPaywall
|
|
2169
2211
|
}) {
|
|
2170
|
-
return /* @__PURE__ */
|
|
2212
|
+
return /* @__PURE__ */ jsx25(PaymentReturnHandler, { children: /* @__PURE__ */ jsx25(TemplateConfigProvider, { config, children: /* @__PURE__ */ jsx25(ErrorBoundary, { children: /* @__PURE__ */ jsx25(ThemeProvider, { children: /* @__PURE__ */ jsx25(InstallGate, { children: /* @__PURE__ */ jsx25(AuthGate, { Login, Signup, Forgot, Reset, children: /* @__PURE__ */ jsx25(PersistedKeysPrefetch, { children: /* @__PURE__ */ jsxs19(SubscriptionGate, { Paywall, children: [
|
|
2171
2213
|
children,
|
|
2172
|
-
/* @__PURE__ */
|
|
2214
|
+
/* @__PURE__ */ jsx25(PushPrompt, {})
|
|
2173
2215
|
] }) }) }) }) }) }) }) });
|
|
2174
2216
|
}
|
|
2175
2217
|
|
|
2176
2218
|
// src/hooks/usePush.ts
|
|
2177
|
-
import { useCallback as useCallback8, useEffect as useEffect8, useState as
|
|
2219
|
+
import { useCallback as useCallback8, useEffect as useEffect8, useState as useState12 } from "react";
|
|
2178
2220
|
import { useHook as useHook9 } from "@hook-sdk/sdk";
|
|
2179
2221
|
function detectIosNeedsInstall() {
|
|
2180
2222
|
if (typeof navigator === "undefined" || typeof window === "undefined") return false;
|
|
@@ -2202,7 +2244,7 @@ function deriveState(push) {
|
|
|
2202
2244
|
}
|
|
2203
2245
|
function usePush() {
|
|
2204
2246
|
const { push } = useHook9();
|
|
2205
|
-
const [state, setState] =
|
|
2247
|
+
const [state, setState] = useState12(() => deriveState(push));
|
|
2206
2248
|
useEffect8(() => {
|
|
2207
2249
|
setState(deriveState(push));
|
|
2208
2250
|
}, [push]);
|
|
@@ -2231,31 +2273,31 @@ function usePush() {
|
|
|
2231
2273
|
}
|
|
2232
2274
|
|
|
2233
2275
|
// src/components/PushPrompt.tsx
|
|
2234
|
-
import { jsx as
|
|
2276
|
+
import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2235
2277
|
function PushPrompt2({ texts, onSubscribed, onDeclined, onInstallRequested, className }) {
|
|
2236
2278
|
const { state, subscribe } = usePush();
|
|
2237
2279
|
if (state.kind === "subscribed") return null;
|
|
2238
2280
|
if (state.kind === "ios_needs_install") {
|
|
2239
|
-
return /* @__PURE__ */
|
|
2240
|
-
/* @__PURE__ */
|
|
2241
|
-
/* @__PURE__ */
|
|
2242
|
-
onInstallRequested && texts.iosInstallCta && /* @__PURE__ */
|
|
2281
|
+
return /* @__PURE__ */ jsxs20("div", { className, role: "region", "aria-label": texts.iosInstallTitle, children: [
|
|
2282
|
+
/* @__PURE__ */ jsx26("h3", { children: texts.iosInstallTitle }),
|
|
2283
|
+
/* @__PURE__ */ jsx26("p", { children: texts.iosInstallBody }),
|
|
2284
|
+
onInstallRequested && texts.iosInstallCta && /* @__PURE__ */ jsx26("button", { onClick: onInstallRequested, children: texts.iosInstallCta })
|
|
2243
2285
|
] });
|
|
2244
2286
|
}
|
|
2245
2287
|
if (state.kind === "denied") {
|
|
2246
|
-
return /* @__PURE__ */
|
|
2247
|
-
/* @__PURE__ */
|
|
2248
|
-
/* @__PURE__ */
|
|
2288
|
+
return /* @__PURE__ */ jsxs20("div", { className, role: "region", "aria-label": texts.deniedTitle, children: [
|
|
2289
|
+
/* @__PURE__ */ jsx26("h3", { children: texts.deniedTitle }),
|
|
2290
|
+
/* @__PURE__ */ jsx26("p", { children: texts.deniedBody })
|
|
2249
2291
|
] });
|
|
2250
2292
|
}
|
|
2251
2293
|
if (state.kind === "unsupported") {
|
|
2252
|
-
return /* @__PURE__ */
|
|
2294
|
+
return /* @__PURE__ */ jsx26("div", { className, role: "region", children: /* @__PURE__ */ jsx26("p", { children: texts.unsupportedBody }) });
|
|
2253
2295
|
}
|
|
2254
2296
|
if (state.kind === "error") {
|
|
2255
|
-
return /* @__PURE__ */
|
|
2297
|
+
return /* @__PURE__ */ jsx26("div", { className, role: "region", "aria-label": "error", children: /* @__PURE__ */ jsx26("p", { children: state.message }) });
|
|
2256
2298
|
}
|
|
2257
|
-
return /* @__PURE__ */
|
|
2258
|
-
/* @__PURE__ */
|
|
2299
|
+
return /* @__PURE__ */ jsxs20("div", { className, role: "region", children: [
|
|
2300
|
+
/* @__PURE__ */ jsx26(
|
|
2259
2301
|
"button",
|
|
2260
2302
|
{
|
|
2261
2303
|
type: "button",
|
|
@@ -2269,17 +2311,17 @@ function PushPrompt2({ texts, onSubscribed, onDeclined, onInstallRequested, clas
|
|
|
2269
2311
|
children: texts.cta
|
|
2270
2312
|
}
|
|
2271
2313
|
),
|
|
2272
|
-
onDeclined && /* @__PURE__ */
|
|
2314
|
+
onDeclined && /* @__PURE__ */ jsx26("button", { type: "button", onClick: onDeclined, children: texts.declineCta })
|
|
2273
2315
|
] });
|
|
2274
2316
|
}
|
|
2275
2317
|
|
|
2276
2318
|
// src/defaults/EmptyState.tsx
|
|
2277
|
-
import { jsx as
|
|
2319
|
+
import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2278
2320
|
function EmptyState({ title, description, action }) {
|
|
2279
|
-
return /* @__PURE__ */
|
|
2280
|
-
/* @__PURE__ */
|
|
2281
|
-
description && /* @__PURE__ */
|
|
2282
|
-
action && /* @__PURE__ */
|
|
2321
|
+
return /* @__PURE__ */ jsxs21("div", { role: "status", style: { padding: 32, textAlign: "center" }, children: [
|
|
2322
|
+
/* @__PURE__ */ jsx27("h2", { style: { marginBottom: 8 }, children: title }),
|
|
2323
|
+
description && /* @__PURE__ */ jsx27("p", { style: { opacity: 0.7 }, children: description }),
|
|
2324
|
+
action && /* @__PURE__ */ jsx27("div", { style: { marginTop: 16 }, children: action })
|
|
2283
2325
|
] });
|
|
2284
2326
|
}
|
|
2285
2327
|
|
|
@@ -2320,13 +2362,13 @@ function useSubscription() {
|
|
|
2320
2362
|
}
|
|
2321
2363
|
|
|
2322
2364
|
// src/hooks/useReminders.ts
|
|
2323
|
-
import { useCallback as useCallback9, useEffect as useEffect10, useState as
|
|
2365
|
+
import { useCallback as useCallback9, useEffect as useEffect10, useState as useState13 } from "react";
|
|
2324
2366
|
import { useHook as useHook12 } from "@hook-sdk/sdk";
|
|
2325
2367
|
function useReminders() {
|
|
2326
2368
|
const { push } = useHook12();
|
|
2327
2369
|
const r = push.reminders;
|
|
2328
|
-
const [reminders, setReminders] =
|
|
2329
|
-
const [loading, setLoading] =
|
|
2370
|
+
const [reminders, setReminders] = useState13([]);
|
|
2371
|
+
const [loading, setLoading] = useState13(true);
|
|
2330
2372
|
const reload = useCallback9(async () => {
|
|
2331
2373
|
setLoading(true);
|
|
2332
2374
|
try {
|
|
@@ -2357,9 +2399,9 @@ function useReminders() {
|
|
|
2357
2399
|
}
|
|
2358
2400
|
|
|
2359
2401
|
// src/hooks/useToast.ts
|
|
2360
|
-
import { useCallback as useCallback10, useState as
|
|
2402
|
+
import { useCallback as useCallback10, useState as useState14 } from "react";
|
|
2361
2403
|
function useToast() {
|
|
2362
|
-
const [items, setItems] =
|
|
2404
|
+
const [items, setItems] = useState14([]);
|
|
2363
2405
|
const show = useCallback10((message, kind = "info") => {
|
|
2364
2406
|
const id = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
2365
2407
|
setItems((prev) => [...prev, { id, message, kind }]);
|