@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.js CHANGED
@@ -2859,7 +2859,8 @@ function useCheckoutForm(args) {
2859
2859
  const emailConfirmError = touchedEmailConfirm || formSubmitAttempted ? validateEmailConfirm : null;
2860
2860
  const phoneError = touchedPhone || formSubmitAttempted ? validatePhone : null;
2861
2861
  const cpfError = touchedCpf || formSubmitAttempted ? validateCpf : null;
2862
- 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);
2862
+ const phoneOk = method === "pix-auto" ? phone === "" || PHONE_RE.test(phone) : PHONE_RE.test(phone);
2863
+ 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);
2863
2864
  const submit = useCallback6(async () => {
2864
2865
  setFormSubmitAttempted(true);
2865
2866
  setError(null);
@@ -3187,7 +3188,26 @@ function CheckoutPageDefault() {
3187
3188
  error: form.cpfError,
3188
3189
  valid: !!form.cpf && !form.cpfError
3189
3190
  }
3190
- )
3191
+ ),
3192
+ form.method === "card" ? /* @__PURE__ */ jsxs18(Fragment7, { children: [
3193
+ /* @__PURE__ */ jsx27("div", { className: "h-3" }),
3194
+ /* @__PURE__ */ jsx27(FieldLabel, { children: "Telefone" }),
3195
+ /* @__PURE__ */ jsx27(
3196
+ FieldInput,
3197
+ {
3198
+ type: "tel",
3199
+ inputMode: "tel",
3200
+ autoComplete: "tel",
3201
+ placeholder: "(11) 99999-9999",
3202
+ value: form.phone,
3203
+ onChange: form.setPhone,
3204
+ onBlur: form.markPhoneTouched,
3205
+ error: form.phoneError,
3206
+ valid: !!form.phone && !form.phoneError
3207
+ }
3208
+ ),
3209
+ !form.phoneError && /* @__PURE__ */ jsx27(FieldHint, { children: "Usado pra confirmar pagamento e tratar disputas." })
3210
+ ] }) : null
3191
3211
  ] }),
3192
3212
  /* @__PURE__ */ jsxs18("section", { className: "px-5 pt-5", children: [
3193
3213
  /* @__PURE__ */ jsx27(FieldLabel, { children: "Forma de pagamento" }),