godeep-types 1.0.0
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/README.md +84 -0
- package/dist/module.d.mts +8 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +16 -0
- package/dist/runtime/plugin.d.ts +2 -0
- package/dist/runtime/plugin.js +4 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/translate/avaliacoes.d.ts +4 -0
- package/dist/runtime/translate/avaliacoes.js +26 -0
- package/dist/runtime/translate/banner.d.ts +6 -0
- package/dist/runtime/translate/banner.js +69 -0
- package/dist/runtime/translate/basket.d.ts +5 -0
- package/dist/runtime/translate/basket.js +40 -0
- package/dist/runtime/translate/busca.d.ts +8 -0
- package/dist/runtime/translate/busca.js +18 -0
- package/dist/runtime/translate/campos-cadastro.d.ts +4 -0
- package/dist/runtime/translate/campos-cadastro.js +95 -0
- package/dist/runtime/translate/carrinho.d.ts +6 -0
- package/dist/runtime/translate/carrinho.js +141 -0
- package/dist/runtime/translate/categoria.d.ts +4 -0
- package/dist/runtime/translate/categoria.js +75 -0
- package/dist/runtime/translate/cliente.d.ts +4 -0
- package/dist/runtime/translate/cliente.js +82 -0
- package/dist/runtime/translate/configuracoes.d.ts +3 -0
- package/dist/runtime/translate/configuracoes.js +46 -0
- package/dist/runtime/translate/esqueceu-senha.d.ts +4 -0
- package/dist/runtime/translate/esqueceu-senha.js +14 -0
- package/dist/runtime/translate/favoritos.d.ts +4 -0
- package/dist/runtime/translate/favoritos.js +13 -0
- package/dist/runtime/translate/frete.d.ts +3 -0
- package/dist/runtime/translate/frete.js +31 -0
- package/dist/runtime/translate/home.d.ts +4 -0
- package/dist/runtime/translate/home.js +26 -0
- package/dist/runtime/translate/index.d.ts +24 -0
- package/dist/runtime/translate/index.js +24 -0
- package/dist/runtime/translate/menu.d.ts +4 -0
- package/dist/runtime/translate/menu.js +124 -0
- package/dist/runtime/translate/newsletter.d.ts +3 -0
- package/dist/runtime/translate/newsletter.js +5 -0
- package/dist/runtime/translate/pagamento.d.ts +4 -0
- package/dist/runtime/translate/pagamento.js +66 -0
- package/dist/runtime/translate/pagina.d.ts +4 -0
- package/dist/runtime/translate/pagina.js +12 -0
- package/dist/runtime/translate/parametros.d.ts +7 -0
- package/dist/runtime/translate/parametros.js +115 -0
- package/dist/runtime/translate/pedidos.d.ts +3 -0
- package/dist/runtime/translate/pedidos.js +82 -0
- package/dist/runtime/translate/produto.d.ts +12 -0
- package/dist/runtime/translate/produto.js +510 -0
- package/dist/runtime/translate/redefinir-senha.d.ts +4 -0
- package/dist/runtime/translate/redefinir-senha.js +10 -0
- package/dist/runtime/translate/redes-sociais.d.ts +3 -0
- package/dist/runtime/translate/redes-sociais.js +40 -0
- package/dist/runtime/translate/usuario.d.ts +10 -0
- package/dist/runtime/translate/usuario.js +102 -0
- package/dist/runtime/translate/vitrine-listagem.d.ts +4 -0
- package/dist/runtime/translate/vitrine-listagem.js +81 -0
- package/dist/runtime/translate/vitrine.d.ts +6 -0
- package/dist/runtime/translate/vitrine.js +37 -0
- package/dist/runtime/types/godeep.d.ts +1449 -0
- package/dist/runtime/types/godeep.js +0 -0
- package/dist/runtime/types/index.d.ts +3 -0
- package/dist/runtime/types/index.js +3 -0
- package/dist/runtime/types/shims-vue.d.ts +10 -0
- package/dist/runtime/types/storefront.d.ts +1005 -0
- package/dist/runtime/types/storefront.js +0 -0
- package/dist/runtime/types/utils.d.ts +67 -0
- package/dist/runtime/types/utils.js +20 -0
- package/dist/runtime/utils/gerais.d.ts +2 -0
- package/dist/runtime/utils/gerais.js +13 -0
- package/dist/runtime/utils/index.d.ts +1 -0
- package/dist/runtime/utils/index.js +1 -0
- package/dist/types.d.mts +3 -0
- package/package.json +75 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export function traduzirUsuario(dado) {
|
|
2
|
+
return {
|
|
3
|
+
id: dado.id,
|
|
4
|
+
nome: dado.nome,
|
|
5
|
+
email: dado.email,
|
|
6
|
+
tipoCliente: dado.tipo_cli,
|
|
7
|
+
token: dado.token,
|
|
8
|
+
cliente: dado.cliente ? {
|
|
9
|
+
sexo: dado.cliente.sexo,
|
|
10
|
+
tipo: dado.cliente.tipo,
|
|
11
|
+
validacaoCadastro: dado.cliente.validacao_cadastro
|
|
12
|
+
} : void 0
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function traduzirLoginResponse(dado) {
|
|
16
|
+
if (!dado.dados) return null;
|
|
17
|
+
return traduzirUsuario(dado.dados);
|
|
18
|
+
}
|
|
19
|
+
export function reverterUsuario(storefront) {
|
|
20
|
+
return {
|
|
21
|
+
id: storefront.id,
|
|
22
|
+
nome: storefront.nome,
|
|
23
|
+
email: storefront.email,
|
|
24
|
+
tipo_cli: storefront.tipoCliente,
|
|
25
|
+
token: storefront.token,
|
|
26
|
+
cliente: storefront.cliente ? {
|
|
27
|
+
sexo: storefront.cliente.sexo,
|
|
28
|
+
tipo: storefront.cliente.tipo,
|
|
29
|
+
validacao_cadastro: storefront.cliente.validacaoCadastro
|
|
30
|
+
} : void 0
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export function reverterLoginResponse(storefront) {
|
|
34
|
+
return storefront ? { dados: reverterUsuario(storefront) } : {};
|
|
35
|
+
}
|
|
36
|
+
export function reverterCadastroPF(cadastro) {
|
|
37
|
+
const telefoneObj = cadastro.telefone;
|
|
38
|
+
const telefone = telefoneObj?.residencial || cadastro.telefone || "";
|
|
39
|
+
return {
|
|
40
|
+
email: cadastro.email || "",
|
|
41
|
+
telefone,
|
|
42
|
+
whatsapp: telefoneObj?.whatsapp,
|
|
43
|
+
comercial: telefoneObj?.comercial,
|
|
44
|
+
celular: telefoneObj?.celular || cadastro.celular,
|
|
45
|
+
senha: cadastro.senha || "",
|
|
46
|
+
endereco: cadastro.endereco || cadastro.endereco || {},
|
|
47
|
+
newsletters: cadastro.newsletters ?? cadastro.newsletters ?? false,
|
|
48
|
+
nome: cadastro.nome || cadastro.nome || "",
|
|
49
|
+
cpf: cadastro.cpf || cadastro.cpf || "",
|
|
50
|
+
sexo: cadastro.sexo || cadastro.sexo
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export function reverterCadastroPJ(cadastro) {
|
|
54
|
+
const telefoneObj = cadastro.telefone;
|
|
55
|
+
const telefone = telefoneObj?.residencial || cadastro.telefone || "";
|
|
56
|
+
return {
|
|
57
|
+
email: cadastro.email || "",
|
|
58
|
+
telefone,
|
|
59
|
+
whatsapp: telefoneObj?.whatsapp,
|
|
60
|
+
comercial: telefoneObj?.comercial,
|
|
61
|
+
celular: telefoneObj?.celular || cadastro.celular || cadastro.celular,
|
|
62
|
+
senha: cadastro.senha || "",
|
|
63
|
+
endereco: cadastro.endereco || cadastro.endereco || {},
|
|
64
|
+
nomeFantasia: cadastro.nomeFantasia || cadastro.nomeFantasia || "",
|
|
65
|
+
razaoSocial: cadastro.razaoSocial || cadastro.razaoSocial || "",
|
|
66
|
+
cnpj: cadastro.cnpj || cadastro.cnpj || "",
|
|
67
|
+
responsavel: cadastro.responsavel || cadastro.responsavel || "",
|
|
68
|
+
inscricaoEstadual: cadastro.inscricaoEstadual || cadastro.inscricaoEstadual || ""
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export function traduzirEnderecosCliente(resposta) {
|
|
72
|
+
const lista = resposta?.dados;
|
|
73
|
+
if (!lista || !Array.isArray(lista)) return [];
|
|
74
|
+
return lista.map((endereco) => ({
|
|
75
|
+
id: endereco.id,
|
|
76
|
+
destinatario: endereco.destinatario ?? "",
|
|
77
|
+
cep: endereco.cep ?? "",
|
|
78
|
+
endereco: endereco.endereco ?? "",
|
|
79
|
+
numero: endereco.numero ?? "",
|
|
80
|
+
complemento: endereco.complemento ?? "",
|
|
81
|
+
bairro: endereco.bairro ?? "",
|
|
82
|
+
estado: endereco.estado ?? "",
|
|
83
|
+
cidade: endereco.cidade ?? "",
|
|
84
|
+
nomeEndereco: endereco.nomeEndereco ?? "",
|
|
85
|
+
tipo: endereco.tipo ?? ""
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
export function traduzirEnderecoCliente(resposta) {
|
|
89
|
+
return {
|
|
90
|
+
id: resposta.id,
|
|
91
|
+
destinatario: resposta.destinatario ?? "",
|
|
92
|
+
cep: resposta.cep ?? "",
|
|
93
|
+
endereco: resposta.endereco ?? "",
|
|
94
|
+
numero: resposta.numero ?? "",
|
|
95
|
+
complemento: resposta.complemento ?? "",
|
|
96
|
+
bairro: resposta.bairro ?? "",
|
|
97
|
+
estado: resposta.estado ?? "",
|
|
98
|
+
cidade: resposta.cidade ?? "",
|
|
99
|
+
nomeEndereco: resposta.nomeEndereco ?? "",
|
|
100
|
+
tipo: resposta.tipo ?? ""
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GodeepVitrineListagem } from '../types/godeep.js';
|
|
2
|
+
import type { StorefrontVitrineListagem } from '../types/storefront.js';
|
|
3
|
+
export declare function traduzirVitrineListagem(dado: GodeepVitrineListagem): StorefrontVitrineListagem;
|
|
4
|
+
export declare function reverterVitrineListagem(storefront: StorefrontVitrineListagem): GodeepVitrineListagem;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { traduzirProdutoParaCard, reverterProdutoCard } from "./produto.js";
|
|
2
|
+
export function traduzirVitrineListagem(dado) {
|
|
3
|
+
const produtos = dado.dados?.produtos ?? dado.dados?.lista?.produtos ?? [];
|
|
4
|
+
return {
|
|
5
|
+
nome: dado.dados?.nome,
|
|
6
|
+
descricao: dado.dados?.descricao,
|
|
7
|
+
imagem: dado.dados?.imagem,
|
|
8
|
+
imagem2: dado.dados?.imagem2,
|
|
9
|
+
apelido: dado.dados?.apelido,
|
|
10
|
+
resumo: dado.dados?.resumo,
|
|
11
|
+
slug: dado.dados?.slug,
|
|
12
|
+
subtitulo: dado.dados?.subtitulo,
|
|
13
|
+
categoryTree: dado.dados?.category_tree,
|
|
14
|
+
exibirMenuTodasCategorias: dado.dados?.exibir_menu_todas_categorias === 1,
|
|
15
|
+
exibeFiltros: dado.dados?.exibe_filtros === 1,
|
|
16
|
+
produtosDestaque: dado.dados?.produtos_destaque === 1,
|
|
17
|
+
hrefLink: dado.links?.href,
|
|
18
|
+
textoLink: dado.links?.self,
|
|
19
|
+
seo: dado.dados?.seo ? {
|
|
20
|
+
metaDescription: dado.dados.seo.metaDescription,
|
|
21
|
+
metaTitlePagina: dado.dados.seo.metaTitlePagina,
|
|
22
|
+
metaKeyword: dado.dados.seo.metaKeyword ?? void 0,
|
|
23
|
+
metaCanonical: dado.dados.seo.metaCanonical ?? void 0,
|
|
24
|
+
metaRedirect: dado.dados.seo.metaRedirect ?? void 0
|
|
25
|
+
} : void 0,
|
|
26
|
+
produtos: produtos.filter((produto) => produto != null).map((produto) => traduzirProdutoParaCard(produto)),
|
|
27
|
+
opcoesOrdenacao: dado.dados?.order,
|
|
28
|
+
paginador: dado.paginador ? {
|
|
29
|
+
primeiraPagina: dado.paginador.primeiraPagina,
|
|
30
|
+
proximaPagina: dado.paginador.proximaPagina,
|
|
31
|
+
paginaAtual: dado.paginador.paginaAtual,
|
|
32
|
+
porPagina: typeof dado.paginador.porPagina === "string" ? Number.parseInt(dado.paginador.porPagina) : dado.paginador.porPagina,
|
|
33
|
+
total: dado.paginador.total,
|
|
34
|
+
ultimaPagina: dado.paginador.ultimaPagina
|
|
35
|
+
} : void 0
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export function reverterVitrineListagem(storefront) {
|
|
39
|
+
return {
|
|
40
|
+
dados: {
|
|
41
|
+
nome: storefront.nome,
|
|
42
|
+
descricao: storefront.descricao,
|
|
43
|
+
imagem: storefront.imagem,
|
|
44
|
+
imagem2: storefront.imagem2,
|
|
45
|
+
apelido: storefront.apelido,
|
|
46
|
+
resumo: storefront.resumo,
|
|
47
|
+
slug: storefront.slug,
|
|
48
|
+
subtitulo: storefront.subtitulo,
|
|
49
|
+
category_tree: storefront.categoryTree,
|
|
50
|
+
exibir_menu_todas_categorias: storefront.exibirMenuTodasCategorias ? 1 : 0,
|
|
51
|
+
exibe_filtros: storefront.exibeFiltros ? 1 : 0,
|
|
52
|
+
produtos_destaque: storefront.produtosDestaque ? 1 : 0,
|
|
53
|
+
seo: storefront.seo ? {
|
|
54
|
+
metaDescription: storefront.seo.metaDescription,
|
|
55
|
+
metaTitlePagina: storefront.seo.metaTitlePagina,
|
|
56
|
+
metaKeyword: storefront.seo.metaKeyword,
|
|
57
|
+
metaCanonical: storefront.seo.metaCanonical,
|
|
58
|
+
metaRedirect: storefront.seo.metaRedirect
|
|
59
|
+
} : void 0,
|
|
60
|
+
produtos: storefront.produtos?.map(
|
|
61
|
+
(produto) => reverterProdutoCard(produto)
|
|
62
|
+
),
|
|
63
|
+
lista: storefront.produtos ? { produtos: storefront.produtos.map(reverterProdutoCard) } : void 0,
|
|
64
|
+
order: storefront.opcoesOrdenacao?.map(
|
|
65
|
+
(o) => ({ label: o.label, value: o.value })
|
|
66
|
+
)
|
|
67
|
+
},
|
|
68
|
+
paginador: storefront.paginador ? {
|
|
69
|
+
primeiraPagina: storefront.paginador.primeiraPagina,
|
|
70
|
+
proximaPagina: storefront.paginador.proximaPagina,
|
|
71
|
+
paginaAtual: storefront.paginador.paginaAtual,
|
|
72
|
+
porPagina: storefront.paginador.porPagina,
|
|
73
|
+
total: storefront.paginador.total,
|
|
74
|
+
ultimaPagina: storefront.paginador.ultimaPagina
|
|
75
|
+
} : void 0,
|
|
76
|
+
links: {
|
|
77
|
+
self: storefront.textoLink ?? void 0,
|
|
78
|
+
href: storefront.hrefLink ?? void 0
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GodeepVitrineDado, GodeepProdutoDetalheDado } from '../types/godeep.js';
|
|
2
|
+
import type { StorefrontVitrine, StorefrontCardItem } from '../types/storefront.js';
|
|
3
|
+
export declare function traduzirVitrine(dado: GodeepVitrineDado): StorefrontVitrine;
|
|
4
|
+
export declare function traduzirProdutos(produtos: GodeepProdutoDetalheDado[]): StorefrontCardItem[];
|
|
5
|
+
export declare function reverterVitrine(storefront: StorefrontVitrine): GodeepVitrineDado;
|
|
6
|
+
export declare function reverterProdutos(produtos: StorefrontCardItem[] | undefined): GodeepProdutoDetalheDado[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
traduzirProdutoParaCard,
|
|
3
|
+
reverterProdutosDeCard,
|
|
4
|
+
reverterProdutoCard
|
|
5
|
+
} from "./produto.js";
|
|
6
|
+
export function traduzirVitrine(dado) {
|
|
7
|
+
return {
|
|
8
|
+
id: dado.id,
|
|
9
|
+
nome: dado.nome,
|
|
10
|
+
slug: dado.link,
|
|
11
|
+
descricao: dado.descricao,
|
|
12
|
+
produtos: dado.lista?.produtos?.filter(
|
|
13
|
+
(produto) => produto != null
|
|
14
|
+
).map(
|
|
15
|
+
(produto) => traduzirProdutoParaCard(produto)
|
|
16
|
+
) ?? []
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function traduzirProdutos(produtos) {
|
|
20
|
+
return produtos.filter((produto) => produto != null).map(
|
|
21
|
+
(produto) => traduzirProdutoParaCard(produto)
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
export function reverterVitrine(storefront) {
|
|
25
|
+
return {
|
|
26
|
+
id: storefront.id,
|
|
27
|
+
nome: storefront.nome,
|
|
28
|
+
link: storefront.slug,
|
|
29
|
+
descricao: storefront.descricao,
|
|
30
|
+
lista: {
|
|
31
|
+
produtos: storefront.produtos?.map((produto) => reverterProdutoCard(produto)) ?? []
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function reverterProdutos(produtos) {
|
|
36
|
+
return reverterProdutosDeCard(produtos);
|
|
37
|
+
}
|