@hook-sdk/template 0.28.1 → 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 CHANGED
@@ -2967,7 +2967,8 @@ function useCheckoutForm(args) {
2967
2967
  const emailConfirmError = touchedEmailConfirm || formSubmitAttempted ? validateEmailConfirm : null;
2968
2968
  const phoneError = touchedPhone || formSubmitAttempted ? validatePhone : null;
2969
2969
  const cpfError = touchedCpf || formSubmitAttempted ? validateCpf : null;
2970
- const canSubmit = name.trim().length >= 2 && EMAIL_RE.test(email) && (emailConfirm === "" || emailConfirm === email) && (phone === "" || PHONE_RE.test(phone)) && 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);
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);
2971
2972
  const submit = (0, import_react17.useCallback)(async () => {
2972
2973
  setFormSubmitAttempted(true);
2973
2974
  setError(null);
@@ -3295,7 +3296,26 @@ function CheckoutPageDefault() {
3295
3296
  error: form.cpfError,
3296
3297
  valid: !!form.cpf && !form.cpfError
3297
3298
  }
3298
- )
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
3299
3319
  ] }),
3300
3320
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("section", { className: "px-5 pt-5", children: [
3301
3321
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FieldLabel, { children: "Forma de pagamento" }),