rapida-partner 3.2.0 → 3.3.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 +4 -0
- package/src/interfaces/project.interface.ts +17 -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 +1 -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 +15 -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[];
|
|
@@ -60,6 +60,10 @@ interface IMarketplace {
|
|
|
60
60
|
// produtos (productId, price, isActive). Quando presente, o preço de venda
|
|
61
61
|
// vem daqui e o backend calcula o valor do pedido; sem ele, usa product.price.
|
|
62
62
|
productSellingSettingsEndpoint?: string;
|
|
63
|
+
// Endpoint, na mesma base de productBaseUrl, da configuração da loja
|
|
64
|
+
// (IStoreSettings) salva no Backoffice do vendedor pelo módulo
|
|
65
|
+
// getStoreSettingsModule. Sem ele, a loja usa só IProject.store.defaults.
|
|
66
|
+
storeSettingsEndpoint?: string;
|
|
63
67
|
// Workspace do vendedor (dono dos dados). A loja só lê produtos, preços e
|
|
64
68
|
// estoque desse workspace e grava nele as movimentações de estoque.
|
|
65
69
|
sellerWorkspaceId?: string;
|
|
@@ -16,6 +16,7 @@ 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";
|
|
19
20
|
|
|
20
21
|
export interface IProject {
|
|
21
22
|
id: string;
|
|
@@ -67,12 +68,21 @@ export interface IProject {
|
|
|
67
68
|
}[];
|
|
68
69
|
e2e?: IE2e;
|
|
69
70
|
modules?: IModule[];
|
|
71
|
+
// Grupos do menu lateral para as telas que não vêm de módulos. Use o mesmo
|
|
72
|
+
// texto de um IModule.menuGroup para juntá-las a esse grupo.
|
|
73
|
+
menu?: {
|
|
74
|
+
homeGroup?: TTranslatable; // grupo do Painel (/); sem ele, fica solto no topo
|
|
75
|
+
flowsGroup?: TTranslatable; // membros, papéis, convites e notificações, como links soltos no grupo
|
|
76
|
+
};
|
|
70
77
|
styles?: IStyle[];
|
|
71
78
|
flowChart?: IFlowChart;
|
|
72
79
|
dashboard?: IComponent[];
|
|
73
80
|
aiAgentConfig?: IAiAgentConfig;
|
|
74
81
|
notifications?: INotification[];
|
|
75
82
|
repositories?: IProjectRepositories;
|
|
83
|
+
// Só para skeleton "ecommerce"/"marketplace": funcionalidades opcionais
|
|
84
|
+
// geradas e valores iniciais da configuração da loja.
|
|
85
|
+
store?: IProjectStore;
|
|
76
86
|
}
|
|
77
87
|
|
|
78
88
|
export interface IFrontend {
|
|
@@ -199,6 +209,13 @@ export interface IModule {
|
|
|
199
209
|
id: string;
|
|
200
210
|
title: TTranslatable;
|
|
201
211
|
icon: string;
|
|
212
|
+
// Grupo do menu lateral: módulos com o mesmo menuGroup aparecem juntos sob
|
|
213
|
+
// esse cabeçalho, na posição do primeiro deles. Sem menuGroup, o módulo fica
|
|
214
|
+
// fora de grupo, como sempre foi (link solto com 1 tela, seção com várias).
|
|
215
|
+
menuGroup?: TTranslatable;
|
|
216
|
+
// "section" (padrão): com várias telas, o módulo vira um item recolhível.
|
|
217
|
+
// "flat": cada tela do módulo vira um link solto no menu (ou no menuGroup).
|
|
218
|
+
menuDisplay?: "section" | "flat";
|
|
202
219
|
components: IComponent[];
|
|
203
220
|
businessRules?: IBusinessRule[];
|
|
204
221
|
todo?: ITodo[];
|
|
@@ -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
|
+
});
|
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
"stockOutEndpoint": { "type": "string" },
|
|
107
107
|
"productBaseUrl": { "type": "string" },
|
|
108
108
|
"productSellingSettingsEndpoint": { "type": "string" },
|
|
109
|
+
"storeSettingsEndpoint": { "type": "string" },
|
|
109
110
|
"sellerWorkspaceId": { "type": "string" },
|
|
110
111
|
"sellerServiceAuth": {
|
|
111
112
|
"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
|
+
}
|
|
@@ -161,6 +161,18 @@
|
|
|
161
161
|
"modules": {
|
|
162
162
|
"$ref": "module.ref.json"
|
|
163
163
|
},
|
|
164
|
+
"menu": {
|
|
165
|
+
"type": "object",
|
|
166
|
+
"properties": {
|
|
167
|
+
"homeGroup": {
|
|
168
|
+
"$ref": "translatable.ref.json"
|
|
169
|
+
},
|
|
170
|
+
"flowsGroup": {
|
|
171
|
+
"$ref": "translatable.ref.json"
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"additionalProperties": false
|
|
175
|
+
},
|
|
164
176
|
"flowChart": {
|
|
165
177
|
"$ref": "form-flowchart.ref.json"
|
|
166
178
|
},
|
|
@@ -187,6 +199,9 @@
|
|
|
187
199
|
},
|
|
188
200
|
"repositories": {
|
|
189
201
|
"$ref": "project-repositories.ref.json"
|
|
202
|
+
},
|
|
203
|
+
"store": {
|
|
204
|
+
"$ref": "project-store.ref.json"
|
|
190
205
|
}
|
|
191
206
|
},
|
|
192
207
|
"required": ["id", "title", "description", "skeleton"]
|
|
@@ -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
|
+
}
|