@hook-sdk/template 0.28.0 → 0.28.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 +30 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +35 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2292,6 +2292,13 @@ function DevSkipOnboardingFab({ defaults }) {
|
|
|
2292
2292
|
const [state, setState] = (0, import_react13.useState)("idle");
|
|
2293
2293
|
const [errorMsg, setErrorMsg] = (0, import_react13.useState)(null);
|
|
2294
2294
|
const timerRef = (0, import_react13.useRef)(null);
|
|
2295
|
+
const isAuthed = hook.authStatus === "authenticated";
|
|
2296
|
+
const [onboarding] = (0, import_sdk6.usePersistedState)(
|
|
2297
|
+
"onboarding_data",
|
|
2298
|
+
null,
|
|
2299
|
+
{ enabled: isAuthed }
|
|
2300
|
+
);
|
|
2301
|
+
const onboardingCompleted = isAuthed && onboarding?.onboarding_completed === true;
|
|
2295
2302
|
const clearTimer = (0, import_react13.useCallback)(() => {
|
|
2296
2303
|
if (timerRef.current) {
|
|
2297
2304
|
clearTimeout(timerRef.current);
|
|
@@ -2322,6 +2329,7 @@ function DevSkipOnboardingFab({ defaults }) {
|
|
|
2322
2329
|
if (state === "error") return `failed \u2014 tap to retry`;
|
|
2323
2330
|
return hook.authStatus === "authenticated" ? "\u26A1 skip onboarding" : "\u26A1 skip + signup";
|
|
2324
2331
|
})();
|
|
2332
|
+
if (onboardingCompleted) return null;
|
|
2325
2333
|
const style = {
|
|
2326
2334
|
...STYLES.base,
|
|
2327
2335
|
...state === "confirm" || state === "error" ? STYLES.confirm : {},
|
|
@@ -2959,7 +2967,8 @@ function useCheckoutForm(args) {
|
|
|
2959
2967
|
const emailConfirmError = touchedEmailConfirm || formSubmitAttempted ? validateEmailConfirm : null;
|
|
2960
2968
|
const phoneError = touchedPhone || formSubmitAttempted ? validatePhone : null;
|
|
2961
2969
|
const cpfError = touchedCpf || formSubmitAttempted ? validateCpf : null;
|
|
2962
|
-
const
|
|
2970
|
+
const phoneOk = method === "pix-auto" ? phone === "" || PHONE_RE.test(phone) : PHONE_RE.test(phone);
|
|
2971
|
+
const canSubmit = name.trim().length >= 2 && EMAIL_RE.test(email) && (emailConfirm === "" || emailConfirm === email) && phoneOk && validateCpf === null && cpf.replace(/\D/g, "").length === 11 && emailStatus !== "exists" && !submitting && (method !== "card" || card.number.length >= 12 && card.ccv.length >= 3 && card.expiryMonth.length >= 1 && card.expiryYear.length >= 2 && card.holderName.length >= 1);
|
|
2963
2972
|
const submit = (0, import_react17.useCallback)(async () => {
|
|
2964
2973
|
setFormSubmitAttempted(true);
|
|
2965
2974
|
setError(null);
|
|
@@ -3287,7 +3296,26 @@ function CheckoutPageDefault() {
|
|
|
3287
3296
|
error: form.cpfError,
|
|
3288
3297
|
valid: !!form.cpf && !form.cpfError
|
|
3289
3298
|
}
|
|
3290
|
-
)
|
|
3299
|
+
),
|
|
3300
|
+
form.method === "card" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
3301
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-3" }),
|
|
3302
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FieldLabel, { children: "Telefone" }),
|
|
3303
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3304
|
+
FieldInput,
|
|
3305
|
+
{
|
|
3306
|
+
type: "tel",
|
|
3307
|
+
inputMode: "tel",
|
|
3308
|
+
autoComplete: "tel",
|
|
3309
|
+
placeholder: "(11) 99999-9999",
|
|
3310
|
+
value: form.phone,
|
|
3311
|
+
onChange: form.setPhone,
|
|
3312
|
+
onBlur: form.markPhoneTouched,
|
|
3313
|
+
error: form.phoneError,
|
|
3314
|
+
valid: !!form.phone && !form.phoneError
|
|
3315
|
+
}
|
|
3316
|
+
),
|
|
3317
|
+
!form.phoneError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FieldHint, { children: "Usado pra confirmar pagamento e tratar disputas." })
|
|
3318
|
+
] }) : null
|
|
3291
3319
|
] }),
|
|
3292
3320
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("section", { className: "px-5 pt-5", children: [
|
|
3293
3321
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FieldLabel, { children: "Forma de pagamento" }),
|