rapida-partner 3.2.0 → 3.5.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/package.json +1 -1
- package/src/enums/form.enum.ts +2 -0
- package/src/interfaces/form.interface.ts +6 -0
- package/src/interfaces/project-backend.interface.ts +10 -0
- package/src/interfaces/project.interface.ts +32 -1
- package/src/interfaces/referral-curation.interface.ts +95 -0
- package/src/interfaces/referral-source.interface.ts +81 -0
- package/src/interfaces/scheduled-job.interface.ts +19 -0
- package/src/interfaces/store-settings.interface.ts +83 -0
- package/src/modules/store-settings/contact-legal.elements.ts +57 -0
- package/src/modules/store-settings/features.elements.ts +49 -0
- package/src/modules/store-settings/identity-visual.elements.ts +101 -0
- package/src/modules/store-settings/store-settings.module.ts +75 -0
- package/src/modules/store-settings/translations.ts +7 -0
- package/src/schemas/backend.ref.json +9 -0
- package/src/schemas/form-input.ref.json +1 -0
- package/src/schemas/form.ref.json +3 -0
- package/src/schemas/module.ref.json +7 -0
- package/src/schemas/project-store.ref.json +17 -0
- package/src/schemas/project.schema.json +40 -1
- package/src/schemas/referral-curation.ref.json +257 -0
- package/src/schemas/referral-source-integration.ref.json +143 -0
- package/src/schemas/scheduled-job.ref.json +12 -0
- package/src/schemas/store-settings.ref.json +39 -0
package/package.json
CHANGED
package/src/enums/form.enum.ts
CHANGED
|
@@ -25,6 +25,12 @@ export interface IForm {
|
|
|
25
25
|
subtitle?: TTranslatable;
|
|
26
26
|
icon?: string;
|
|
27
27
|
guards?: "isAuthenticated" | "isAuthorized";
|
|
28
|
+
// Cadastro de registro único por workspace (ex.: configuração da loja): o
|
|
29
|
+
// gerador cria só a tela de edição direta, na rota da entidade, sem listagem
|
|
30
|
+
// nem "novo". A tela lê o registro pelo "get" (a lista do workspace tem no
|
|
31
|
+
// máximo um item), cria no primeiro salvamento ("create") e atualiza depois
|
|
32
|
+
// ("update"); o contrato precisa dessas três ações.
|
|
33
|
+
isSingleRecord?: boolean;
|
|
28
34
|
businessRules?: IBusinessRule[];
|
|
29
35
|
userStory?: string;
|
|
30
36
|
contracts: IContract[];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { IFormAutocomplete } from "./form-autocomplete.interface";
|
|
2
2
|
import type { IList } from "./list.interface";
|
|
3
3
|
import type { ITrustedCaller } from "./trusted-caller.interface";
|
|
4
|
+
import type { IReferralSourceIntegration } from "./referral-source.interface";
|
|
5
|
+
import type { IScheduledJob } from "./scheduled-job.interface";
|
|
4
6
|
|
|
5
7
|
interface IDatabase {
|
|
6
8
|
provider:
|
|
@@ -60,6 +62,10 @@ interface IMarketplace {
|
|
|
60
62
|
// produtos (productId, price, isActive). Quando presente, o preço de venda
|
|
61
63
|
// vem daqui e o backend calcula o valor do pedido; sem ele, usa product.price.
|
|
62
64
|
productSellingSettingsEndpoint?: string;
|
|
65
|
+
// Endpoint, na mesma base de productBaseUrl, da configuração da loja
|
|
66
|
+
// (IStoreSettings) salva no Backoffice do vendedor pelo módulo
|
|
67
|
+
// getStoreSettingsModule. Sem ele, a loja usa só IProject.store.defaults.
|
|
68
|
+
storeSettingsEndpoint?: string;
|
|
63
69
|
// Workspace do vendedor (dono dos dados). A loja só lê produtos, preços e
|
|
64
70
|
// estoque desse workspace e grava nele as movimentações de estoque.
|
|
65
71
|
sellerWorkspaceId?: string;
|
|
@@ -107,6 +113,10 @@ export interface IBackend {
|
|
|
107
113
|
email?: IEmail;
|
|
108
114
|
marketplace?: IMarketplace;
|
|
109
115
|
service?: IService;
|
|
116
|
+
// Só para skeleton "referralCommerce": uma entrada por fonte de afiliado.
|
|
117
|
+
referralSources?: IReferralSourceIntegration[];
|
|
118
|
+
// Frequência dos jobs agendados que o skeleton/funcionalidade gera.
|
|
119
|
+
scheduledJobs?: IScheduledJob[];
|
|
110
120
|
mercadoPagoIntegration?: {
|
|
111
121
|
publicKey?: string;
|
|
112
122
|
accessToken?: string;
|
|
@@ -16,6 +16,8 @@ import type { IBackend } from "./project-backend.interface";
|
|
|
16
16
|
import type { IProjectRepositories } from "./project-repositories.interface";
|
|
17
17
|
import type { IStyle } from "./project-style.interface";
|
|
18
18
|
import type { TTranslatable } from "./translatable.interface";
|
|
19
|
+
import type { IProjectStore } from "./store-settings.interface";
|
|
20
|
+
import type { IReferralCuration } from "./referral-curation.interface";
|
|
19
21
|
|
|
20
22
|
export interface IProject {
|
|
21
23
|
id: string;
|
|
@@ -26,7 +28,18 @@ export interface IProject {
|
|
|
26
28
|
// "ecommerce": loja de um único vendedor (o dono dos dados da instância).
|
|
27
29
|
// "marketplace": vários vendedores; enquanto a camada multivendedor não existe,
|
|
28
30
|
// o rapida-code-generator gera para os dois o mesmo núcleo de loja.
|
|
29
|
-
|
|
31
|
+
// "referralCommerce": vitrine sem venda própria; cada produto leva por link de
|
|
32
|
+
// afiliado para o anúncio na fonte de origem (IBackend.referralSources), com
|
|
33
|
+
// a curadoria de IProject.referralCuration. Requer suporte no gerador.
|
|
34
|
+
skeleton:
|
|
35
|
+
| "backoffice"
|
|
36
|
+
| "ecommerce"
|
|
37
|
+
| "marketplace"
|
|
38
|
+
| "referralCommerce"
|
|
39
|
+
| "landingPage"
|
|
40
|
+
| "socialNetwork"
|
|
41
|
+
| "service"
|
|
42
|
+
| "aiAgent";
|
|
30
43
|
// Idiomas em que os textos TTranslatable (label, placeholder, tooltip, title)
|
|
31
44
|
// são declarados. Sem languages, o projeto é monolíngue em defaultLanguage.
|
|
32
45
|
languages?: TLanguage[];
|
|
@@ -67,12 +80,23 @@ export interface IProject {
|
|
|
67
80
|
}[];
|
|
68
81
|
e2e?: IE2e;
|
|
69
82
|
modules?: IModule[];
|
|
83
|
+
// Grupos do menu lateral para as telas que não vêm de módulos. Use o mesmo
|
|
84
|
+
// texto de um IModule.menuGroup para juntá-las a esse grupo.
|
|
85
|
+
menu?: {
|
|
86
|
+
homeGroup?: TTranslatable; // grupo do Painel (/); sem ele, fica solto no topo
|
|
87
|
+
flowsGroup?: TTranslatable; // membros, papéis, convites e notificações, como links soltos no grupo
|
|
88
|
+
};
|
|
70
89
|
styles?: IStyle[];
|
|
71
90
|
flowChart?: IFlowChart;
|
|
72
91
|
dashboard?: IComponent[];
|
|
73
92
|
aiAgentConfig?: IAiAgentConfig;
|
|
74
93
|
notifications?: INotification[];
|
|
75
94
|
repositories?: IProjectRepositories;
|
|
95
|
+
// Só para skeleton "ecommerce"/"marketplace": funcionalidades opcionais
|
|
96
|
+
// geradas e valores iniciais da configuração da loja.
|
|
97
|
+
store?: IProjectStore;
|
|
98
|
+
// Só para skeleton "referralCommerce": filtros e desempate dos produtos exibidos.
|
|
99
|
+
referralCuration?: IReferralCuration;
|
|
76
100
|
}
|
|
77
101
|
|
|
78
102
|
export interface IFrontend {
|
|
@@ -199,6 +223,13 @@ export interface IModule {
|
|
|
199
223
|
id: string;
|
|
200
224
|
title: TTranslatable;
|
|
201
225
|
icon: string;
|
|
226
|
+
// Grupo do menu lateral: módulos com o mesmo menuGroup aparecem juntos sob
|
|
227
|
+
// esse cabeçalho, na posição do primeiro deles. Sem menuGroup, o módulo fica
|
|
228
|
+
// fora de grupo, como sempre foi (link solto com 1 tela, seção com várias).
|
|
229
|
+
menuGroup?: TTranslatable;
|
|
230
|
+
// "section" (padrão): com várias telas, o módulo vira um item recolhível.
|
|
231
|
+
// "flat": cada tela do módulo vira um link solto no menu (ou no menuGroup).
|
|
232
|
+
menuDisplay?: "section" | "flat";
|
|
202
233
|
components: IComponent[];
|
|
203
234
|
businessRules?: IBusinessRule[];
|
|
204
235
|
todo?: ITodo[];
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { TReferralSource } from "./referral-source.interface";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Critério de desempate quando o mesmo produto (mesmo GTIN/EAN) passa pelos
|
|
5
|
+
* filtros em mais de uma fonte. Aplicados na ordem da lista; uma fonte sem o
|
|
6
|
+
* dado do critério (prazo ou comissão) perde aquele desempate.
|
|
7
|
+
*
|
|
8
|
+
* Hoje nenhuma API de afiliado informa prazo de entrega por item: "fastestDelivery"
|
|
9
|
+
* só decide quando a fonte declara `IReferralSourceIntegration.defaultDeliveryDays`.
|
|
10
|
+
*/
|
|
11
|
+
export type TReferralTieBreaker = "fastestDelivery" | "highestCommission" | "lowestPrice";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Filtros de `IReferralCuration` cujo dado nem toda fonte informa:
|
|
15
|
+
* - "ratingCount": `minRatingCount`;
|
|
16
|
+
* - "rating": `minNormalizedRating`;
|
|
17
|
+
* - "freeShipping": `freeShippingOnly`.
|
|
18
|
+
* O desconto sobre o preço médio fica fora: sem histórico não há o que comparar.
|
|
19
|
+
*/
|
|
20
|
+
export type TReferralCriterion = "ratingCount" | "rating" | "freeShipping";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* O que fazer com um anúncio quando a fonte não informa o dado de um critério:
|
|
24
|
+
* - "reject": reprova o anúncio (padrão);
|
|
25
|
+
* - "skip": ignora só esse critério para o anúncio, que a vitrine marca como
|
|
26
|
+
* não verificado nesse ponto.
|
|
27
|
+
*/
|
|
28
|
+
export type TReferralMissingDataPolicy = "reject" | "skip";
|
|
29
|
+
|
|
30
|
+
export type TReferralMissingDataRules = Partial<Record<TReferralCriterion, TReferralMissingDataPolicy>>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Exceção de uma fonte às regras de dado ausente. Vale só para os critérios
|
|
34
|
+
* listados; os demais seguem `IReferralCuration.missingData`.
|
|
35
|
+
*/
|
|
36
|
+
export interface IReferralSourceCurationOverride {
|
|
37
|
+
missingData?: TReferralMissingDataRules;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* O que buscar nas fontes. O job de captura pesquisa cada termo em cada fonte
|
|
42
|
+
* configurada, restrito às categorias da fonte quando declaradas.
|
|
43
|
+
*/
|
|
44
|
+
export interface IReferralSearch {
|
|
45
|
+
// Termos de busca (ex.: "blu-ray", "box dvd"). Ao menos um.
|
|
46
|
+
keywords: string[];
|
|
47
|
+
// Ids nativos de categoria de cada fonte, para restringir a busca.
|
|
48
|
+
categories?: Partial<Record<TReferralSource, string[]>>;
|
|
49
|
+
// Máximo de anúncios lidos por termo em cada fonte. Padrão do gerador se omitido.
|
|
50
|
+
maxListingsPerQuery?: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Base do "preço médio" com que o preço atual é comparado.
|
|
55
|
+
*
|
|
56
|
+
* "sourceHistory": média dos preços do próprio anúncio, na mesma fonte, nos
|
|
57
|
+
* últimos `windowDays` dias, com um preço por dia (o último capturado no dia).
|
|
58
|
+
* O dia corrente fica fora da média, para o preço de hoje não puxar a base.
|
|
59
|
+
* Os preços vêm do job de captura (`IBackend.scheduledJobs`, id
|
|
60
|
+
* "referralPriceSnapshot"). Enquanto o anúncio tiver menos de `minSnapshots`
|
|
61
|
+
* dias com captura na janela, ele não é exibido.
|
|
62
|
+
*/
|
|
63
|
+
export interface IReferralPriceBaseline {
|
|
64
|
+
kind: "sourceHistory";
|
|
65
|
+
windowDays: number;
|
|
66
|
+
// Mínimo de dias distintos com captura na janela (não de capturas).
|
|
67
|
+
minSnapshots?: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Regras de curadoria dos produtos exibidos no skeleton "referralCommerce"
|
|
72
|
+
* (`IProject.referralCuration`). São regras do produto, iguais em todo ambiente;
|
|
73
|
+
* credenciais das fontes ficam em `IBackend.referralSources`.
|
|
74
|
+
*
|
|
75
|
+
* Identidade de produto entre fontes: só GTIN/EAN normalizado (forma GTIN-14,
|
|
76
|
+
* dígito verificador válido). Anúncio sem GTIN válido não é descartado: concorre
|
|
77
|
+
* sozinho, sem entrar no desempate com as outras fontes.
|
|
78
|
+
*/
|
|
79
|
+
export interface IReferralCuration {
|
|
80
|
+
// Mínimo de avaliações, inclusivo (">200 avaliações" = 201).
|
|
81
|
+
minRatingCount: number;
|
|
82
|
+
// Nota mínima normalizada em 0..1, inclusiva: 0.9 = 4.5/5 = 9/10.
|
|
83
|
+
minNormalizedRating: number;
|
|
84
|
+
// Desconto mínimo (0..1) do preço atual em relação a `priceBaseline`: 0.1 = 10% abaixo.
|
|
85
|
+
minDiscountFromBaseline: number;
|
|
86
|
+
priceBaseline: IReferralPriceBaseline;
|
|
87
|
+
// Só exibe anúncios com frete grátis.
|
|
88
|
+
freeShippingOnly: boolean;
|
|
89
|
+
tieBreakers: TReferralTieBreaker[];
|
|
90
|
+
search: IReferralSearch;
|
|
91
|
+
// Política para dado ausente, por critério. Critério omitido = "reject".
|
|
92
|
+
missingData?: TReferralMissingDataRules;
|
|
93
|
+
// Exceções por fonte, que prevalecem sobre `missingData` nos critérios listados.
|
|
94
|
+
sourceOverrides?: Partial<Record<TReferralSource, IReferralSourceCurationOverride>>;
|
|
95
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fontes de produto do skeleton "referralCommerce": a loja não vende, só leva
|
|
3
|
+
* o comprador por link de afiliado para o anúncio na fonte de origem.
|
|
4
|
+
*
|
|
5
|
+
* "mercadoLivre" é o catálogo/programa de afiliados do Mercado Livre — não
|
|
6
|
+
* confundir com "mercadoPago" de `IPaymentGateway`, que é gateway de pagamento.
|
|
7
|
+
*/
|
|
8
|
+
export type TReferralSource = "shopee" | "amazon" | "mercadoLivre";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Campos comuns da integração com o programa de afiliados de uma fonte.
|
|
12
|
+
*/
|
|
13
|
+
interface IReferralSourceIntegrationBase {
|
|
14
|
+
// Comissão (0..1) assumida quando a API não informa a comissão por item
|
|
15
|
+
// (ex.: tabela por categoria). Usada pelo desempate "highestCommission";
|
|
16
|
+
// sem ela e sem dado por item, a fonte perde esse desempate.
|
|
17
|
+
defaultCommissionRate?: number;
|
|
18
|
+
// Prazo de entrega (dias) assumido para os anúncios da fonte. Nenhuma API de
|
|
19
|
+
// afiliado informa prazo por item hoje; sem este valor, a fonte perde o
|
|
20
|
+
// desempate "fastestDelivery". Prazo real por CEP está fora do escopo.
|
|
21
|
+
defaultDeliveryDays?: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Shopee Afiliados (Open API). AppID e Secret ficam na página Open API do painel
|
|
26
|
+
* de afiliado. A API devolve o link de oferta já atribuído à conta dona do AppID,
|
|
27
|
+
* por isso `affiliateTag` é opcional e hoje não é usado pelo gerador. O uso como
|
|
28
|
+
* sub-id do link depende de confirmar a API com conta real.
|
|
29
|
+
*/
|
|
30
|
+
export interface IShopeeReferralIntegration extends IReferralSourceIntegrationBase {
|
|
31
|
+
source: "shopee";
|
|
32
|
+
credentials: {
|
|
33
|
+
appId: string;
|
|
34
|
+
secret: string;
|
|
35
|
+
};
|
|
36
|
+
affiliateTag?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Amazon Associates (Creators API). Credenciais do Associates Central; a API só
|
|
41
|
+
* é liberada depois de vendas qualificadas no marketplace.
|
|
42
|
+
*/
|
|
43
|
+
export interface IAmazonReferralIntegration extends IReferralSourceIntegrationBase {
|
|
44
|
+
source: "amazon";
|
|
45
|
+
credentials: {
|
|
46
|
+
credentialId: string;
|
|
47
|
+
credentialSecret: string;
|
|
48
|
+
// Versão da credencial; define o endereço de emissão do token. Padrão do gerador se omitida.
|
|
49
|
+
version?: string;
|
|
50
|
+
// Marketplace alvo (ex.: "www.amazon.com.br"). Padrão do gerador se omitido.
|
|
51
|
+
marketplace?: string;
|
|
52
|
+
};
|
|
53
|
+
// Tag de associado (partnerTag) anexada a todo link.
|
|
54
|
+
affiliateTag: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Mercado Livre: aplicação no portal de desenvolvedores (clientId/clientSecret)
|
|
59
|
+
* para o catálogo e programa de afiliados para a comissão do link.
|
|
60
|
+
*/
|
|
61
|
+
export interface IMercadoLivreReferralIntegration extends IReferralSourceIntegrationBase {
|
|
62
|
+
source: "mercadoLivre";
|
|
63
|
+
credentials: {
|
|
64
|
+
clientId: string;
|
|
65
|
+
clientSecret: string;
|
|
66
|
+
// Ferramenta de afiliado (parâmetro matt_tool do link).
|
|
67
|
+
mattTool?: string;
|
|
68
|
+
};
|
|
69
|
+
// Identificador de afiliado (parâmetro matt_word do link).
|
|
70
|
+
affiliateTag: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Integração com o programa de afiliados de uma fonte, por ambiente
|
|
75
|
+
* (`IBackend.referralSources`). Uma entrada por fonte; as chaves de
|
|
76
|
+
* `credentials` são as que cada programa usa.
|
|
77
|
+
*/
|
|
78
|
+
export type IReferralSourceIntegration =
|
|
79
|
+
| IShopeeReferralIntegration
|
|
80
|
+
| IAmazonReferralIntegration
|
|
81
|
+
| IMercadoLivreReferralIntegration;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ids dos jobs que o próprio skeleton/funcionalidade gera:
|
|
3
|
+
* - "referralPriceSnapshot": captura de preços dos anúncios do skeleton
|
|
4
|
+
* "referralCommerce" (base de `IReferralPriceBaseline`). Respeite o limite
|
|
5
|
+
* de requisições das APIs de afiliado ao escolher a frequência.
|
|
6
|
+
*/
|
|
7
|
+
export type TScheduledJobId = "referralPriceSnapshot";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Job agendado do backend gerado (`IBackend.scheduledJobs`), por ambiente.
|
|
11
|
+
* O projeto só ajusta a frequência de um job que o gerador já cria.
|
|
12
|
+
*/
|
|
13
|
+
export interface IScheduledJob {
|
|
14
|
+
id: TScheduledJobId;
|
|
15
|
+
// Expressão cron de 5 campos (ex.: "0 */6 * * *").
|
|
16
|
+
cron: string;
|
|
17
|
+
// Fuso IANA do agendador (ex.: "America/Sao_Paulo"); padrão do servidor se omitido.
|
|
18
|
+
timezone?: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Funcionalidades opcionais da loja (`skeleton` "ecommerce" ou "marketplace").
|
|
3
|
+
* Cada uma tem duas camadas: `IProjectStore.features` decide se o código dela é
|
|
4
|
+
* gerado, e o liga e desliga `<feature>Enabled` de `IStoreSettings` decide, com
|
|
5
|
+
* a loja no ar, se ela aparece.
|
|
6
|
+
*/
|
|
7
|
+
export type TStoreFeature =
|
|
8
|
+
| "whatsappButton"
|
|
9
|
+
| "stockAvailability"
|
|
10
|
+
| "cashDiscount"
|
|
11
|
+
| "installments"
|
|
12
|
+
| "favorites"
|
|
13
|
+
| "blog";
|
|
14
|
+
|
|
15
|
+
export type TStoreFeatureToggle = `${TStoreFeature}Enabled`;
|
|
16
|
+
|
|
17
|
+
/** Fontes oferecidas na configuração da loja (todas do Google Fonts). */
|
|
18
|
+
export type TStoreFont = "inter" | "poppins" | "nunito" | "montserrat" | "roboto" | "lato";
|
|
19
|
+
|
|
20
|
+
/** Arredondamento de cartões, botões e campos: reto, suave ou arredondado. */
|
|
21
|
+
export type TStoreRadius = "none" | "soft" | "rounded";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Configuração da loja: identidade, visual, contato, dados legais, redes,
|
|
25
|
+
* comercial e liga e desliga. É o registro único editado no Backoffice do
|
|
26
|
+
* vendedor pelo módulo pronto `getStoreSettingsModule` (os nomes dos campos do
|
|
27
|
+
* form são estas mesmas chaves) e também o formato dos valores iniciais em
|
|
28
|
+
* `IProjectStore.defaults`.
|
|
29
|
+
*
|
|
30
|
+
* Logo e favicon não entram aqui: no Backoffice são uploads (`logo` e
|
|
31
|
+
* `favicon` no form) e os valores iniciais continuam vindo de
|
|
32
|
+
* `IFrontend.logoPath`/`IFrontend.faviconPath`.
|
|
33
|
+
*
|
|
34
|
+
* Cores sempre em hexadecimal de 6 dígitos ("#RRGGBB"); o gerador deriva as
|
|
35
|
+
* tonalidades e as cores de contraste a partir delas.
|
|
36
|
+
*/
|
|
37
|
+
export interface IStoreSettings extends Partial<Record<TStoreFeatureToggle, boolean>> {
|
|
38
|
+
name?: string;
|
|
39
|
+
tagline?: string;
|
|
40
|
+
|
|
41
|
+
primaryColor?: string;
|
|
42
|
+
secondaryColor?: string;
|
|
43
|
+
// Cor escura de cabeçalho, rodapé e botões principais.
|
|
44
|
+
inkColor?: string;
|
|
45
|
+
font?: TStoreFont;
|
|
46
|
+
radius?: TStoreRadius;
|
|
47
|
+
pageSize?: number;
|
|
48
|
+
|
|
49
|
+
// Somente dígitos, com DDI (ex.: "5582999999999").
|
|
50
|
+
whatsappNumber?: string;
|
|
51
|
+
phone?: string;
|
|
52
|
+
email?: string;
|
|
53
|
+
weekdayHours?: string;
|
|
54
|
+
saturdayHours?: string;
|
|
55
|
+
|
|
56
|
+
companyName?: string;
|
|
57
|
+
cnpj?: string;
|
|
58
|
+
address?: string;
|
|
59
|
+
|
|
60
|
+
instagramUrl?: string;
|
|
61
|
+
facebookUrl?: string;
|
|
62
|
+
tiktokUrl?: string;
|
|
63
|
+
youtubeUrl?: string;
|
|
64
|
+
|
|
65
|
+
// Só têm efeito com as funcionalidades "cashDiscount" e "installments".
|
|
66
|
+
cashDiscountPercent?: number;
|
|
67
|
+
maxInstallments?: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Configuração da loja no projeto da própria loja (`IProject.store`).
|
|
72
|
+
*
|
|
73
|
+
* A loja lê a configuração salva no Backoffice do vendedor em
|
|
74
|
+
* `IMarketplace.storeSettingsEndpoint`; `defaults` vale até a primeira
|
|
75
|
+
* gravação e como reserva se a leitura falhar.
|
|
76
|
+
*/
|
|
77
|
+
export interface IProjectStore {
|
|
78
|
+
// Funcionalidades opcionais geradas. Sem a lista, nenhuma é gerada. Passe a
|
|
79
|
+
// mesma lista para getStoreSettingsModule no Backoffice do vendedor, para o
|
|
80
|
+
// form só mostrar o liga e desliga do que a loja tem.
|
|
81
|
+
features?: TStoreFeature[];
|
|
82
|
+
defaults?: IStoreSettings;
|
|
83
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { EDataType } from "../../enums/form.enum";
|
|
2
|
+
import type { IFormElement } from "../../interfaces/form.interface";
|
|
3
|
+
import { tr } from "./translations";
|
|
4
|
+
|
|
5
|
+
const textInput = (name: string, label: ReturnType<typeof tr>): IFormElement => ({
|
|
6
|
+
type: "input",
|
|
7
|
+
name,
|
|
8
|
+
dataType: EDataType.TEXT,
|
|
9
|
+
label,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const contactElements: IFormElement[] = [
|
|
13
|
+
{
|
|
14
|
+
type: "input",
|
|
15
|
+
name: "whatsappNumber",
|
|
16
|
+
dataType: EDataType.TEXT,
|
|
17
|
+
label: tr("WhatsApp de vendas", "Sales WhatsApp", "WhatsApp de ventas"),
|
|
18
|
+
tooltip: tr("Somente dígitos, com DDI (ex.: 5582999999999)", "Digits only, with country code (e.g. 5582999999999)", "Solo dígitos, con código de país (ej.: 5582999999999)"),
|
|
19
|
+
validators: ["onlyNumbers"],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: "input",
|
|
23
|
+
name: "phone",
|
|
24
|
+
dataType: EDataType.TEXT,
|
|
25
|
+
label: tr("Telefone", "Phone", "Teléfono"),
|
|
26
|
+
validators: ["phone"],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: "input",
|
|
30
|
+
name: "email",
|
|
31
|
+
dataType: EDataType.EMAIL,
|
|
32
|
+
label: tr("E-mail de contato", "Contact e-mail", "Correo de contacto"),
|
|
33
|
+
validators: ["email"],
|
|
34
|
+
},
|
|
35
|
+
textInput("weekdayHours", tr("Horário em dias úteis", "Weekday hours", "Horario entre semana")),
|
|
36
|
+
textInput("saturdayHours", tr("Horário no sábado", "Saturday hours", "Horario del sábado")),
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
export const legalElements: IFormElement[] = [
|
|
40
|
+
textInput("companyName", tr("Razão social", "Legal name", "Razón social")),
|
|
41
|
+
{
|
|
42
|
+
type: "input",
|
|
43
|
+
name: "cnpj",
|
|
44
|
+
dataType: EDataType.TEXT,
|
|
45
|
+
label: tr("CNPJ", "CNPJ", "CNPJ"),
|
|
46
|
+
mask: "00.000.000/0000-00",
|
|
47
|
+
validators: ["cnpj"],
|
|
48
|
+
},
|
|
49
|
+
textInput("address", tr("Endereço", "Address", "Dirección")),
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
export const socialElements: IFormElement[] = [
|
|
53
|
+
textInput("instagramUrl", tr("Instagram (link)", "Instagram (link)", "Instagram (enlace)")),
|
|
54
|
+
textInput("facebookUrl", tr("Facebook (link)", "Facebook (link)", "Facebook (enlace)")),
|
|
55
|
+
textInput("tiktokUrl", tr("TikTok (link)", "TikTok (link)", "TikTok (enlace)")),
|
|
56
|
+
textInput("youtubeUrl", tr("YouTube (link)", "YouTube (link)", "YouTube (enlace)")),
|
|
57
|
+
];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { EDataType } from "../../enums/form.enum";
|
|
2
|
+
import type { IFormElement } from "../../interfaces/form.interface";
|
|
3
|
+
import type { TStoreFeature } from "../../interfaces/store-settings.interface";
|
|
4
|
+
import { tr } from "./translations";
|
|
5
|
+
|
|
6
|
+
const FEATURE_LABELS: Record<TStoreFeature, ReturnType<typeof tr>> = {
|
|
7
|
+
whatsappButton: tr("Mostrar botão de WhatsApp", "Show WhatsApp button", "Mostrar botón de WhatsApp"),
|
|
8
|
+
stockAvailability: tr("Mostrar \"esgotado\" e filtro \"só em estoque\"", "Show \"sold out\" and \"in stock only\" filter", "Mostrar \"agotado\" y filtro \"solo en stock\""),
|
|
9
|
+
cashDiscount: tr("Anunciar desconto à vista", "Show cash discount", "Anunciar descuento al contado"),
|
|
10
|
+
installments: tr("Anunciar parcelas sem juros", "Show interest-free installments", "Anunciar cuotas sin interés"),
|
|
11
|
+
favorites: tr("Favoritos", "Favorites", "Favoritos"),
|
|
12
|
+
blog: tr("Blog", "Blog", "Blog"),
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const featureDetails = (feature: TStoreFeature): IFormElement[] => {
|
|
16
|
+
if (feature === "cashDiscount") {
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
type: "input",
|
|
20
|
+
name: "cashDiscountPercent",
|
|
21
|
+
dataType: EDataType.NUMBER,
|
|
22
|
+
label: tr("Desconto à vista (%)", "Cash discount (%)", "Descuento al contado (%)"),
|
|
23
|
+
suffix: "%",
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
if (feature === "installments") {
|
|
28
|
+
return [
|
|
29
|
+
{
|
|
30
|
+
type: "input",
|
|
31
|
+
name: "maxInstallments",
|
|
32
|
+
dataType: EDataType.INTEGER,
|
|
33
|
+
label: tr("Parcelas sem juros (máximo)", "Interest-free installments (max)", "Cuotas sin interés (máximo)"),
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
return [];
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** Liga e desliga só das funcionalidades que a loja gera, cada um seguido dos seus campos. */
|
|
41
|
+
export const getFeatureElements = (features: TStoreFeature[]): IFormElement[] =>
|
|
42
|
+
features.flatMap((feature: TStoreFeature): IFormElement[] => [
|
|
43
|
+
{
|
|
44
|
+
type: "switch",
|
|
45
|
+
name: `${feature}Enabled`,
|
|
46
|
+
label: FEATURE_LABELS[feature],
|
|
47
|
+
},
|
|
48
|
+
...featureDetails(feature),
|
|
49
|
+
]);
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { EDataType } from "../../enums/form.enum";
|
|
2
|
+
import type { IFormElement } from "../../interfaces/form.interface";
|
|
3
|
+
import type { IStorageConfig } from "../../interfaces/form-file.interface";
|
|
4
|
+
import type { TStoreFont, TStoreRadius } from "../../interfaces/store-settings.interface";
|
|
5
|
+
import { tr } from "./translations";
|
|
6
|
+
|
|
7
|
+
const storageConfig: IStorageConfig = {
|
|
8
|
+
path: "store-settings",
|
|
9
|
+
fileNameStrategy: "uuid",
|
|
10
|
+
visibility: "public",
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const FONTS: { value: TStoreFont; label: string }[] = [
|
|
14
|
+
{ value: "inter", label: "Inter" },
|
|
15
|
+
{ value: "poppins", label: "Poppins" },
|
|
16
|
+
{ value: "nunito", label: "Nunito" },
|
|
17
|
+
{ value: "montserrat", label: "Montserrat" },
|
|
18
|
+
{ value: "roboto", label: "Roboto" },
|
|
19
|
+
{ value: "lato", label: "Lato" },
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const RADII: { value: TStoreRadius; label: ReturnType<typeof tr> }[] = [
|
|
23
|
+
{ value: "none", label: tr("Reto", "Square", "Recto") },
|
|
24
|
+
{ value: "soft", label: tr("Suave", "Soft", "Suave") },
|
|
25
|
+
{ value: "rounded", label: tr("Arredondado", "Rounded", "Redondeado") },
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
export const identityElements: IFormElement[] = [
|
|
29
|
+
{
|
|
30
|
+
type: "input",
|
|
31
|
+
name: "name",
|
|
32
|
+
dataType: EDataType.TEXT,
|
|
33
|
+
label: tr("Nome da loja", "Store name", "Nombre de la tienda"),
|
|
34
|
+
isRequired: true,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: "input",
|
|
38
|
+
name: "tagline",
|
|
39
|
+
dataType: EDataType.TEXT,
|
|
40
|
+
label: tr("Slogan", "Tagline", "Eslogan"),
|
|
41
|
+
maxLength: 120,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: "file",
|
|
45
|
+
name: "logo",
|
|
46
|
+
dataType: EDataType.FILE,
|
|
47
|
+
label: tr("Logo", "Logo", "Logotipo"),
|
|
48
|
+
validators: ["onlyImages"],
|
|
49
|
+
storageConfig,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: "file",
|
|
53
|
+
name: "favicon",
|
|
54
|
+
dataType: EDataType.FILE,
|
|
55
|
+
label: tr("Ícone da aba (favicon)", "Tab icon (favicon)", "Icono de la pestaña (favicon)"),
|
|
56
|
+
validators: ["onlyImages"],
|
|
57
|
+
storageConfig,
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
export const visualElements: IFormElement[] = [
|
|
62
|
+
{
|
|
63
|
+
type: "input",
|
|
64
|
+
name: "primaryColor",
|
|
65
|
+
dataType: EDataType.COLOR,
|
|
66
|
+
label: tr("Cor primária", "Primary color", "Color primario"),
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: "input",
|
|
70
|
+
name: "secondaryColor",
|
|
71
|
+
dataType: EDataType.COLOR,
|
|
72
|
+
label: tr("Cor secundária", "Secondary color", "Color secundario"),
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: "input",
|
|
76
|
+
name: "inkColor",
|
|
77
|
+
dataType: EDataType.COLOR,
|
|
78
|
+
label: tr("Cor escura (cabeçalho, rodapé e botões)", "Dark color (header, footer and buttons)", "Color oscuro (encabezado, pie y botones)"),
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: "select",
|
|
82
|
+
name: "font",
|
|
83
|
+
dataType: EDataType.TEXT,
|
|
84
|
+
label: tr("Fonte", "Font", "Fuente"),
|
|
85
|
+
options: FONTS.map((font) => ({ label: font.label, value: font.value, isSelected: font.value === "inter" })),
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: "select",
|
|
89
|
+
name: "radius",
|
|
90
|
+
dataType: EDataType.TEXT,
|
|
91
|
+
label: tr("Arredondamento", "Corner style", "Redondeo"),
|
|
92
|
+
options: RADII.map((radius) => ({ label: radius.label, value: radius.value, isSelected: radius.value === "soft" })),
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: "input",
|
|
96
|
+
name: "pageSize",
|
|
97
|
+
dataType: EDataType.INTEGER,
|
|
98
|
+
label: tr("Produtos por página", "Products per page", "Productos por página"),
|
|
99
|
+
defaultValue: 12,
|
|
100
|
+
},
|
|
101
|
+
];
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { IPublicContract } from "../../interfaces/form-contract.interface";
|
|
2
|
+
import type { IForm } from "../../interfaces/form.interface";
|
|
3
|
+
import type { IFormTab } from "../../interfaces/form-tab.interface";
|
|
4
|
+
import type { IModule } from "../../interfaces/project.interface";
|
|
5
|
+
import type { TStoreFeature } from "../../interfaces/store-settings.interface";
|
|
6
|
+
import { contactElements, legalElements, socialElements } from "./contact-legal.elements";
|
|
7
|
+
import { getFeatureElements } from "./features.elements";
|
|
8
|
+
import { identityElements, visualElements } from "./identity-visual.elements";
|
|
9
|
+
import { tr } from "./translations";
|
|
10
|
+
|
|
11
|
+
export const STORE_SETTINGS_ENDPOINT = "/store-settings";
|
|
12
|
+
|
|
13
|
+
export interface IStoreSettingsModuleOptions {
|
|
14
|
+
// A mesma lista de IProjectStore.features da loja que lê esta configuração.
|
|
15
|
+
features?: TStoreFeature[];
|
|
16
|
+
// Quem lê a configuração sem login. "trustedCallers" (padrão): só o backend
|
|
17
|
+
// da loja, com o token de serviço de IMarketplace.sellerServiceAuth.
|
|
18
|
+
publicAccess?: IPublicContract["access"];
|
|
19
|
+
allowedOrigins?: string[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const buildTabs = (features: TStoreFeature[]): IFormTab => ({
|
|
23
|
+
type: "tab",
|
|
24
|
+
id: "storeSettingsTabs",
|
|
25
|
+
tabs: [
|
|
26
|
+
{ id: "identity", title: tr("Identidade", "Identity", "Identidad"), elements: identityElements },
|
|
27
|
+
{ id: "visual", title: tr("Visual", "Look and feel", "Apariencia"), elements: visualElements },
|
|
28
|
+
{ id: "contact", title: tr("Contato", "Contact", "Contacto"), elements: contactElements },
|
|
29
|
+
{ id: "legal", title: tr("Dados legais", "Legal data", "Datos legales"), elements: legalElements },
|
|
30
|
+
{ id: "social", title: tr("Redes sociais", "Social media", "Redes sociales"), elements: socialElements },
|
|
31
|
+
...(features.length
|
|
32
|
+
? [{ id: "features", title: tr("Funcionalidades", "Features", "Funcionalidades"), elements: getFeatureElements(features) }]
|
|
33
|
+
: []),
|
|
34
|
+
],
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const getStoreSettingsForm = (options: IStoreSettingsModuleOptions = {}): IForm => ({
|
|
38
|
+
componentType: "form",
|
|
39
|
+
id: "storeSettingsForm",
|
|
40
|
+
title: tr("Configuração da loja", "Store settings", "Configuración de la tienda"),
|
|
41
|
+
icon: "palette",
|
|
42
|
+
guards: "isAuthorized",
|
|
43
|
+
isSingleRecord: true,
|
|
44
|
+
elements: [buildTabs(options.features ?? [])],
|
|
45
|
+
contracts: [
|
|
46
|
+
{
|
|
47
|
+
id: "storeSettings",
|
|
48
|
+
endpoint: STORE_SETTINGS_ENDPOINT,
|
|
49
|
+
actions: ["create", "get", "update"],
|
|
50
|
+
request: { entity: "storeSettings", fields: [] },
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
publicContracts: [
|
|
54
|
+
{
|
|
55
|
+
id: "storeSettings",
|
|
56
|
+
endpoint: STORE_SETTINGS_ENDPOINT,
|
|
57
|
+
actions: ["get"],
|
|
58
|
+
access: options.publicAccess ?? "trustedCallers",
|
|
59
|
+
...(options.allowedOrigins ? { allowedOrigins: options.allowedOrigins } : {}),
|
|
60
|
+
request: { entity: "storeSettings", fields: [] },
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Módulo pronto "Configuração da loja", para o Backoffice do vendedor. A loja
|
|
67
|
+
* lê o registro salvo aqui por IMarketplace.storeSettingsEndpoint
|
|
68
|
+
* (STORE_SETTINGS_ENDPOINT).
|
|
69
|
+
*/
|
|
70
|
+
export const getStoreSettingsModule = (options: IStoreSettingsModuleOptions = {}): IModule => ({
|
|
71
|
+
id: "storeSettingsModule",
|
|
72
|
+
title: tr("Configuração da loja", "Store settings", "Configuración de la tienda"),
|
|
73
|
+
icon: "palette",
|
|
74
|
+
components: [getStoreSettingsForm(options)],
|
|
75
|
+
});
|
|
@@ -44,6 +44,14 @@
|
|
|
44
44
|
"type": "array",
|
|
45
45
|
"items": { "$ref": "trusted-caller.ref.json" }
|
|
46
46
|
},
|
|
47
|
+
"referralSources": {
|
|
48
|
+
"type": "array",
|
|
49
|
+
"items": { "$ref": "referral-source-integration.ref.json" }
|
|
50
|
+
},
|
|
51
|
+
"scheduledJobs": {
|
|
52
|
+
"type": "array",
|
|
53
|
+
"items": { "$ref": "scheduled-job.ref.json" }
|
|
54
|
+
},
|
|
47
55
|
"storage": {
|
|
48
56
|
"type": "object",
|
|
49
57
|
"properties": {
|
|
@@ -106,6 +114,7 @@
|
|
|
106
114
|
"stockOutEndpoint": { "type": "string" },
|
|
107
115
|
"productBaseUrl": { "type": "string" },
|
|
108
116
|
"productSellingSettingsEndpoint": { "type": "string" },
|
|
117
|
+
"storeSettingsEndpoint": { "type": "string" },
|
|
109
118
|
"sellerWorkspaceId": { "type": "string" },
|
|
110
119
|
"sellerServiceAuth": {
|
|
111
120
|
"type": "object",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "project-store.ref.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"features": {
|
|
7
|
+
"type": "array",
|
|
8
|
+
"items": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"enum": ["whatsappButton", "stockAvailability", "cashDiscount", "installments", "favorites", "blog"]
|
|
11
|
+
},
|
|
12
|
+
"uniqueItems": true
|
|
13
|
+
},
|
|
14
|
+
"defaults": { "$ref": "store-settings.ref.json" }
|
|
15
|
+
},
|
|
16
|
+
"additionalProperties": false
|
|
17
|
+
}
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"backoffice",
|
|
19
19
|
"ecommerce",
|
|
20
20
|
"marketplace",
|
|
21
|
+
"referralCommerce",
|
|
21
22
|
"landingPage",
|
|
22
23
|
"socialNetwork",
|
|
23
24
|
"service",
|
|
@@ -161,6 +162,18 @@
|
|
|
161
162
|
"modules": {
|
|
162
163
|
"$ref": "module.ref.json"
|
|
163
164
|
},
|
|
165
|
+
"menu": {
|
|
166
|
+
"type": "object",
|
|
167
|
+
"properties": {
|
|
168
|
+
"homeGroup": {
|
|
169
|
+
"$ref": "translatable.ref.json"
|
|
170
|
+
},
|
|
171
|
+
"flowsGroup": {
|
|
172
|
+
"$ref": "translatable.ref.json"
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
"additionalProperties": false
|
|
176
|
+
},
|
|
164
177
|
"flowChart": {
|
|
165
178
|
"$ref": "form-flowchart.ref.json"
|
|
166
179
|
},
|
|
@@ -187,7 +200,33 @@
|
|
|
187
200
|
},
|
|
188
201
|
"repositories": {
|
|
189
202
|
"$ref": "project-repositories.ref.json"
|
|
203
|
+
},
|
|
204
|
+
"store": {
|
|
205
|
+
"$ref": "project-store.ref.json"
|
|
206
|
+
},
|
|
207
|
+
"referralCuration": {
|
|
208
|
+
"$ref": "referral-curation.ref.json"
|
|
190
209
|
}
|
|
191
210
|
},
|
|
192
|
-
"required": ["id", "title", "description", "skeleton"]
|
|
211
|
+
"required": ["id", "title", "description", "skeleton"],
|
|
212
|
+
"if": {
|
|
213
|
+
"properties": { "skeleton": { "const": "referralCommerce" } },
|
|
214
|
+
"required": ["skeleton"]
|
|
215
|
+
},
|
|
216
|
+
"then": {
|
|
217
|
+
"required": ["referralCuration", "backend"],
|
|
218
|
+
"properties": {
|
|
219
|
+
"backend": {
|
|
220
|
+
"type": "array",
|
|
221
|
+
"minItems": 1,
|
|
222
|
+
"items": {
|
|
223
|
+
"type": "object",
|
|
224
|
+
"required": ["referralSources"],
|
|
225
|
+
"properties": {
|
|
226
|
+
"referralSources": { "type": "array", "minItems": 1 }
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
193
232
|
}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "referral-curation.ref.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"minRatingCount": {
|
|
7
|
+
"type": "integer",
|
|
8
|
+
"minimum": 0
|
|
9
|
+
},
|
|
10
|
+
"minNormalizedRating": {
|
|
11
|
+
"type": "number",
|
|
12
|
+
"minimum": 0,
|
|
13
|
+
"maximum": 1
|
|
14
|
+
},
|
|
15
|
+
"minDiscountFromBaseline": {
|
|
16
|
+
"type": "number",
|
|
17
|
+
"minimum": 0,
|
|
18
|
+
"maximum": 1
|
|
19
|
+
},
|
|
20
|
+
"priceBaseline": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"kind": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"enum": [
|
|
26
|
+
"sourceHistory"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"windowDays": {
|
|
30
|
+
"type": "integer",
|
|
31
|
+
"minimum": 1
|
|
32
|
+
},
|
|
33
|
+
"minSnapshots": {
|
|
34
|
+
"type": "integer",
|
|
35
|
+
"minimum": 1
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"required": [
|
|
39
|
+
"kind",
|
|
40
|
+
"windowDays"
|
|
41
|
+
],
|
|
42
|
+
"additionalProperties": false
|
|
43
|
+
},
|
|
44
|
+
"freeShippingOnly": {
|
|
45
|
+
"type": "boolean"
|
|
46
|
+
},
|
|
47
|
+
"tieBreakers": {
|
|
48
|
+
"type": "array",
|
|
49
|
+
"items": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"enum": [
|
|
52
|
+
"fastestDelivery",
|
|
53
|
+
"highestCommission",
|
|
54
|
+
"lowestPrice"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"uniqueItems": true
|
|
58
|
+
},
|
|
59
|
+
"search": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"properties": {
|
|
62
|
+
"keywords": {
|
|
63
|
+
"type": "array",
|
|
64
|
+
"items": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"minLength": 1
|
|
67
|
+
},
|
|
68
|
+
"minItems": 1,
|
|
69
|
+
"uniqueItems": true
|
|
70
|
+
},
|
|
71
|
+
"categories": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"properties": {
|
|
74
|
+
"shopee": {
|
|
75
|
+
"type": "array",
|
|
76
|
+
"items": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"minLength": 1
|
|
79
|
+
},
|
|
80
|
+
"minItems": 1,
|
|
81
|
+
"uniqueItems": true
|
|
82
|
+
},
|
|
83
|
+
"amazon": {
|
|
84
|
+
"type": "array",
|
|
85
|
+
"items": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"minLength": 1
|
|
88
|
+
},
|
|
89
|
+
"minItems": 1,
|
|
90
|
+
"uniqueItems": true
|
|
91
|
+
},
|
|
92
|
+
"mercadoLivre": {
|
|
93
|
+
"type": "array",
|
|
94
|
+
"items": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"minLength": 1
|
|
97
|
+
},
|
|
98
|
+
"minItems": 1,
|
|
99
|
+
"uniqueItems": true
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"additionalProperties": false
|
|
103
|
+
},
|
|
104
|
+
"maxListingsPerQuery": {
|
|
105
|
+
"type": "integer",
|
|
106
|
+
"minimum": 1
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"required": [
|
|
110
|
+
"keywords"
|
|
111
|
+
],
|
|
112
|
+
"additionalProperties": false
|
|
113
|
+
},
|
|
114
|
+
"missingData": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"properties": {
|
|
117
|
+
"ratingCount": {
|
|
118
|
+
"type": "string",
|
|
119
|
+
"enum": [
|
|
120
|
+
"reject",
|
|
121
|
+
"skip"
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
"rating": {
|
|
125
|
+
"type": "string",
|
|
126
|
+
"enum": [
|
|
127
|
+
"reject",
|
|
128
|
+
"skip"
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
"freeShipping": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"enum": [
|
|
134
|
+
"reject",
|
|
135
|
+
"skip"
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"additionalProperties": false
|
|
140
|
+
},
|
|
141
|
+
"sourceOverrides": {
|
|
142
|
+
"type": "object",
|
|
143
|
+
"properties": {
|
|
144
|
+
"shopee": {
|
|
145
|
+
"type": "object",
|
|
146
|
+
"properties": {
|
|
147
|
+
"missingData": {
|
|
148
|
+
"type": "object",
|
|
149
|
+
"properties": {
|
|
150
|
+
"ratingCount": {
|
|
151
|
+
"type": "string",
|
|
152
|
+
"enum": [
|
|
153
|
+
"reject",
|
|
154
|
+
"skip"
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
"rating": {
|
|
158
|
+
"type": "string",
|
|
159
|
+
"enum": [
|
|
160
|
+
"reject",
|
|
161
|
+
"skip"
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
"freeShipping": {
|
|
165
|
+
"type": "string",
|
|
166
|
+
"enum": [
|
|
167
|
+
"reject",
|
|
168
|
+
"skip"
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"additionalProperties": false
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
"additionalProperties": false
|
|
176
|
+
},
|
|
177
|
+
"amazon": {
|
|
178
|
+
"type": "object",
|
|
179
|
+
"properties": {
|
|
180
|
+
"missingData": {
|
|
181
|
+
"type": "object",
|
|
182
|
+
"properties": {
|
|
183
|
+
"ratingCount": {
|
|
184
|
+
"type": "string",
|
|
185
|
+
"enum": [
|
|
186
|
+
"reject",
|
|
187
|
+
"skip"
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
"rating": {
|
|
191
|
+
"type": "string",
|
|
192
|
+
"enum": [
|
|
193
|
+
"reject",
|
|
194
|
+
"skip"
|
|
195
|
+
]
|
|
196
|
+
},
|
|
197
|
+
"freeShipping": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"enum": [
|
|
200
|
+
"reject",
|
|
201
|
+
"skip"
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
"additionalProperties": false
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"additionalProperties": false
|
|
209
|
+
},
|
|
210
|
+
"mercadoLivre": {
|
|
211
|
+
"type": "object",
|
|
212
|
+
"properties": {
|
|
213
|
+
"missingData": {
|
|
214
|
+
"type": "object",
|
|
215
|
+
"properties": {
|
|
216
|
+
"ratingCount": {
|
|
217
|
+
"type": "string",
|
|
218
|
+
"enum": [
|
|
219
|
+
"reject",
|
|
220
|
+
"skip"
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
"rating": {
|
|
224
|
+
"type": "string",
|
|
225
|
+
"enum": [
|
|
226
|
+
"reject",
|
|
227
|
+
"skip"
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
"freeShipping": {
|
|
231
|
+
"type": "string",
|
|
232
|
+
"enum": [
|
|
233
|
+
"reject",
|
|
234
|
+
"skip"
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
"additionalProperties": false
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
"additionalProperties": false
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"additionalProperties": false
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
"required": [
|
|
248
|
+
"minRatingCount",
|
|
249
|
+
"minNormalizedRating",
|
|
250
|
+
"minDiscountFromBaseline",
|
|
251
|
+
"priceBaseline",
|
|
252
|
+
"freeShippingOnly",
|
|
253
|
+
"tieBreakers",
|
|
254
|
+
"search"
|
|
255
|
+
],
|
|
256
|
+
"additionalProperties": false
|
|
257
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "referral-source-integration.ref.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"oneOf": [
|
|
5
|
+
{
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"source": {
|
|
9
|
+
"const": "shopee"
|
|
10
|
+
},
|
|
11
|
+
"credentials": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"appId": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"secret": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"required": [
|
|
22
|
+
"appId",
|
|
23
|
+
"secret"
|
|
24
|
+
],
|
|
25
|
+
"additionalProperties": false
|
|
26
|
+
},
|
|
27
|
+
"affiliateTag": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"minLength": 1
|
|
30
|
+
},
|
|
31
|
+
"defaultCommissionRate": {
|
|
32
|
+
"type": "number",
|
|
33
|
+
"minimum": 0,
|
|
34
|
+
"maximum": 1
|
|
35
|
+
},
|
|
36
|
+
"defaultDeliveryDays": {
|
|
37
|
+
"type": "integer",
|
|
38
|
+
"minimum": 0
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"required": [
|
|
42
|
+
"source",
|
|
43
|
+
"credentials"
|
|
44
|
+
],
|
|
45
|
+
"additionalProperties": false
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"type": "object",
|
|
49
|
+
"properties": {
|
|
50
|
+
"source": {
|
|
51
|
+
"const": "amazon"
|
|
52
|
+
},
|
|
53
|
+
"credentials": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"credentialId": {
|
|
57
|
+
"type": "string"
|
|
58
|
+
},
|
|
59
|
+
"credentialSecret": {
|
|
60
|
+
"type": "string"
|
|
61
|
+
},
|
|
62
|
+
"version": {
|
|
63
|
+
"type": "string"
|
|
64
|
+
},
|
|
65
|
+
"marketplace": {
|
|
66
|
+
"type": "string"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"required": [
|
|
70
|
+
"credentialId",
|
|
71
|
+
"credentialSecret"
|
|
72
|
+
],
|
|
73
|
+
"additionalProperties": false
|
|
74
|
+
},
|
|
75
|
+
"affiliateTag": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"minLength": 1
|
|
78
|
+
},
|
|
79
|
+
"defaultCommissionRate": {
|
|
80
|
+
"type": "number",
|
|
81
|
+
"minimum": 0,
|
|
82
|
+
"maximum": 1
|
|
83
|
+
},
|
|
84
|
+
"defaultDeliveryDays": {
|
|
85
|
+
"type": "integer",
|
|
86
|
+
"minimum": 0
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"required": [
|
|
90
|
+
"source",
|
|
91
|
+
"credentials",
|
|
92
|
+
"affiliateTag"
|
|
93
|
+
],
|
|
94
|
+
"additionalProperties": false
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"type": "object",
|
|
98
|
+
"properties": {
|
|
99
|
+
"source": {
|
|
100
|
+
"const": "mercadoLivre"
|
|
101
|
+
},
|
|
102
|
+
"credentials": {
|
|
103
|
+
"type": "object",
|
|
104
|
+
"properties": {
|
|
105
|
+
"clientId": {
|
|
106
|
+
"type": "string"
|
|
107
|
+
},
|
|
108
|
+
"clientSecret": {
|
|
109
|
+
"type": "string"
|
|
110
|
+
},
|
|
111
|
+
"mattTool": {
|
|
112
|
+
"type": "string"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"required": [
|
|
116
|
+
"clientId",
|
|
117
|
+
"clientSecret"
|
|
118
|
+
],
|
|
119
|
+
"additionalProperties": false
|
|
120
|
+
},
|
|
121
|
+
"affiliateTag": {
|
|
122
|
+
"type": "string",
|
|
123
|
+
"minLength": 1
|
|
124
|
+
},
|
|
125
|
+
"defaultCommissionRate": {
|
|
126
|
+
"type": "number",
|
|
127
|
+
"minimum": 0,
|
|
128
|
+
"maximum": 1
|
|
129
|
+
},
|
|
130
|
+
"defaultDeliveryDays": {
|
|
131
|
+
"type": "integer",
|
|
132
|
+
"minimum": 0
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"required": [
|
|
136
|
+
"source",
|
|
137
|
+
"credentials",
|
|
138
|
+
"affiliateTag"
|
|
139
|
+
],
|
|
140
|
+
"additionalProperties": false
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "scheduled-job.ref.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"id": { "type": "string", "enum": ["referralPriceSnapshot"] },
|
|
7
|
+
"cron": { "type": "string", "minLength": 1 },
|
|
8
|
+
"timezone": { "type": "string" }
|
|
9
|
+
},
|
|
10
|
+
"required": ["id", "cron"],
|
|
11
|
+
"additionalProperties": false
|
|
12
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "store-settings.ref.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"name": { "type": "string" },
|
|
7
|
+
"tagline": { "type": "string" },
|
|
8
|
+
"primaryColor": { "type": "string", "pattern": "^#[0-9A-Fa-f]{6}$" },
|
|
9
|
+
"secondaryColor": { "type": "string", "pattern": "^#[0-9A-Fa-f]{6}$" },
|
|
10
|
+
"inkColor": { "type": "string", "pattern": "^#[0-9A-Fa-f]{6}$" },
|
|
11
|
+
"font": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"enum": ["inter", "poppins", "nunito", "montserrat", "roboto", "lato"]
|
|
14
|
+
},
|
|
15
|
+
"radius": { "type": "string", "enum": ["none", "soft", "rounded"] },
|
|
16
|
+
"pageSize": { "type": "integer", "minimum": 1 },
|
|
17
|
+
"whatsappNumber": { "type": "string", "pattern": "^[0-9]{10,15}$" },
|
|
18
|
+
"phone": { "type": "string" },
|
|
19
|
+
"email": { "type": "string" },
|
|
20
|
+
"weekdayHours": { "type": "string" },
|
|
21
|
+
"saturdayHours": { "type": "string" },
|
|
22
|
+
"companyName": { "type": "string" },
|
|
23
|
+
"cnpj": { "type": "string" },
|
|
24
|
+
"address": { "type": "string" },
|
|
25
|
+
"instagramUrl": { "type": "string" },
|
|
26
|
+
"facebookUrl": { "type": "string" },
|
|
27
|
+
"tiktokUrl": { "type": "string" },
|
|
28
|
+
"youtubeUrl": { "type": "string" },
|
|
29
|
+
"cashDiscountPercent": { "type": "number", "minimum": 0, "maximum": 100 },
|
|
30
|
+
"maxInstallments": { "type": "integer", "minimum": 0 },
|
|
31
|
+
"whatsappButtonEnabled": { "type": "boolean" },
|
|
32
|
+
"stockAvailabilityEnabled": { "type": "boolean" },
|
|
33
|
+
"cashDiscountEnabled": { "type": "boolean" },
|
|
34
|
+
"installmentsEnabled": { "type": "boolean" },
|
|
35
|
+
"favoritesEnabled": { "type": "boolean" },
|
|
36
|
+
"blogEnabled": { "type": "boolean" }
|
|
37
|
+
},
|
|
38
|
+
"additionalProperties": false
|
|
39
|
+
}
|