mitre-form-component 2.2.4 → 2.2.5

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
@@ -1818,12 +1818,20 @@ var MitreFormComponent = import_react8.default.forwardRef(({
1818
1818
  }, REDIRECT_DELAY_MS);
1819
1819
  }
1820
1820
  } else if (channel === "chat") {
1821
- const { channel: _channelInBody, ...requestBodyNoChannel } = requestBody;
1821
+ const { channel: _channelInBody, name: _nameInBody, phone: _phoneInBody, ...requestBodyMinimal } = requestBody;
1822
+ const dialCode = phone.dialCode;
1823
+ const nationalDigits = dialCode && phoneDigitsOnly.startsWith(dialCode) ? phoneDigitsOnly.slice(dialCode.length) : phoneDigitsOnly;
1824
+ const foneDdd = nationalDigits.slice(0, 2);
1825
+ const foneNumber = nationalDigits.slice(2);
1822
1826
  const effectiveIdEmpreendimento = idEmpreendimento ?? selectedProduct.id.toString();
1823
1827
  const effectiveIdProdutoTerceiro = idProdutoTerceiro ?? "0";
1824
1828
  const virtualObj = {
1825
- ...requestBodyNoChannel,
1829
+ ...requestBodyMinimal,
1826
1830
  canal: channel,
1831
+ nome: name,
1832
+ ddi: dialCode,
1833
+ ddd: foneDdd,
1834
+ fone: foneNumber,
1827
1835
  externalOriginId: leadId,
1828
1836
  idEmpreendimento: effectiveIdEmpreendimento,
1829
1837
  id_produto: effectiveIdEmpreendimento,