rapida-partner 7.1.0 → 8.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 +6 -0
- package/index.ts +5 -0
- package/package.json +1 -1
- package/src/interfaces/dashboard-widget.interface.ts +58 -0
- package/src/interfaces/data-chart.interface.ts +23 -1
- package/src/interfaces/data-stat.interface.ts +115 -0
- package/src/interfaces/list.interface.ts +19 -0
- package/src/interfaces/project-backend.interface.ts +6 -6
- package/src/interfaces/project.interface.ts +19 -1
- package/src/interfaces/store-blog-post.interface.ts +1 -1
- package/src/interfaces/store-coupon.interface.ts +2 -2
- package/src/interfaces/store-order.interface.ts +2 -2
- package/src/interfaces/store-return.interface.ts +1 -1
- package/src/interfaces/store-review.interface.ts +1 -1
- package/src/interfaces/store-settings.interface.ts +1 -1
- package/src/interfaces/tone.interface.ts +2 -0
- package/src/schemas/component-one-of.ref.json +5 -2
- package/src/schemas/dashboard-budget-monitor.ref.json +16 -0
- package/src/schemas/dashboard-empty-state.ref.json +37 -0
- package/src/schemas/dashboard-item-one-of.ref.json +16 -0
- package/src/schemas/dashboard-link-action.ref.json +15 -0
- package/src/schemas/dashboard-quick-create.ref.json +19 -0
- package/src/schemas/data-chart.ref.json +36 -2
- package/src/schemas/data-stat.ref.json +146 -0
- package/src/schemas/list.ref.json +57 -0
- package/src/schemas/module.ref.json +5 -2
- package/src/schemas/project.schema.json +7 -1
- package/src/schemas/quick-create-item.ref.json +19 -0
- package/src/schemas/tone.ref.json +6 -0
- package/src/utils/list-references.ts +51 -0
- package/src/modules/store-blog/store-blog.module.ts +0 -108
- package/src/modules/store-coupons/store-coupons.module.ts +0 -127
- package/src/modules/store-orders/store-order.elements.ts +0 -82
- package/src/modules/store-orders/store-orders.module.ts +0 -108
- package/src/modules/store-returns/store-return.elements.ts +0 -70
- package/src/modules/store-returns/store-returns.module.ts +0 -101
- package/src/modules/store-reviews/store-reviews.module.ts +0 -132
- package/src/modules/store-settings/contact-legal.elements.ts +0 -57
- package/src/modules/store-settings/features.elements.ts +0 -93
- package/src/modules/store-settings/identity-visual.elements.ts +0 -101
- package/src/modules/store-settings/pages-showcase.elements.ts +0 -100
- package/src/modules/store-settings/store-settings.module.ts +0 -80
- package/src/modules/store-settings/translations.ts +0 -7
|
@@ -1,101 +0,0 @@
|
|
|
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
|
-
];
|
|
@@ -1,100 +0,0 @@
|
|
|
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 { tr } from "./translations";
|
|
5
|
-
|
|
6
|
-
const storageConfig: IStorageConfig = {
|
|
7
|
-
path: "store-settings",
|
|
8
|
-
fileNameStrategy: "uuid",
|
|
9
|
-
visibility: "public",
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const richText = (name: string, label: ReturnType<typeof tr>): IFormElement => ({
|
|
13
|
-
type: "input",
|
|
14
|
-
name,
|
|
15
|
-
dataType: EDataType.WYSIWYG,
|
|
16
|
-
label,
|
|
17
|
-
storageConfig,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
/** Páginas institucionais e legais (L20): cada uma só é publicada quando tem texto. */
|
|
21
|
-
export const pagesElements: IFormElement[] = [
|
|
22
|
-
richText("aboutText", tr("Sobre a loja", "About the store", "Sobre la tienda")),
|
|
23
|
-
richText("privacyPolicyText", tr("Política de privacidade", "Privacy policy", "Política de privacidad")),
|
|
24
|
-
richText("termsText", tr("Termos de uso", "Terms of use", "Términos de uso")),
|
|
25
|
-
richText("returnsPolicyText", tr("Trocas e devoluções", "Returns and exchanges", "Cambios y devoluciones")),
|
|
26
|
-
{
|
|
27
|
-
type: "input",
|
|
28
|
-
name: "cookieNoticeText",
|
|
29
|
-
dataType: EDataType.TEXT,
|
|
30
|
-
label: tr("Aviso de cookies", "Cookie notice", "Aviso de cookies"),
|
|
31
|
-
tooltip: tr("Sem texto, o aviso não aparece.", "Without text, the notice is not shown.", "Sin texto, el aviso no aparece."),
|
|
32
|
-
},
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
export interface IFeaturedProductsApi {
|
|
36
|
-
// Endpoint dos produtos do vendedor (padrão "/products").
|
|
37
|
-
endpoint?: string;
|
|
38
|
-
// Campos mostrados na escolha (padrão ["name"]).
|
|
39
|
-
labelField?: string[];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** Home da vitrine (L25): banners, benefícios e produtos em destaque. */
|
|
43
|
-
export const getShowcaseElements = (productsApi: IFeaturedProductsApi = {}): IFormElement[] => [
|
|
44
|
-
{
|
|
45
|
-
type: "array",
|
|
46
|
-
name: "banners",
|
|
47
|
-
label: tr("Banners", "Banners", "Banners"),
|
|
48
|
-
elements: [
|
|
49
|
-
{
|
|
50
|
-
type: "file",
|
|
51
|
-
name: "image",
|
|
52
|
-
dataType: EDataType.TEXT,
|
|
53
|
-
label: tr("Imagem", "Image", "Imagen"),
|
|
54
|
-
validators: ["onlyImages"],
|
|
55
|
-
storageConfig,
|
|
56
|
-
},
|
|
57
|
-
{ type: "input", name: "title", dataType: EDataType.TEXT, label: tr("Título", "Title", "Título"), isRequired: true },
|
|
58
|
-
{ type: "input", name: "subtitle", dataType: EDataType.TEXT, label: tr("Subtítulo", "Subtitle", "Subtítulo") },
|
|
59
|
-
{
|
|
60
|
-
type: "input",
|
|
61
|
-
name: "linkUrl",
|
|
62
|
-
dataType: EDataType.TEXT,
|
|
63
|
-
label: tr("Link do botão", "Button link", "Enlace del botón"),
|
|
64
|
-
tooltip: tr("Caminho da loja (ex.: /busca?categoria=blu-ray) ou URL", "Store path (e.g. /busca?categoria=blu-ray) or URL", "Ruta de la tienda (ej.: /busca?categoria=blu-ray) o URL"),
|
|
65
|
-
},
|
|
66
|
-
{ type: "input", name: "linkLabel", dataType: EDataType.TEXT, label: tr("Texto do botão", "Button text", "Texto del botón") },
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
type: "array",
|
|
71
|
-
name: "benefits",
|
|
72
|
-
label: tr("Benefícios", "Benefits", "Beneficios"),
|
|
73
|
-
elements: [
|
|
74
|
-
{
|
|
75
|
-
type: "input",
|
|
76
|
-
name: "icon",
|
|
77
|
-
dataType: EDataType.TEXT,
|
|
78
|
-
label: tr("Ícone", "Icon", "Ícono"),
|
|
79
|
-
tooltip: tr("Nome de um ícone Lucide (ex.: truck, shield-check)", "Lucide icon name (e.g. truck, shield-check)", "Nombre de un ícono Lucide (ej.: truck, shield-check)"),
|
|
80
|
-
},
|
|
81
|
-
{ type: "input", name: "title", dataType: EDataType.TEXT, label: tr("Título", "Title", "Título"), isRequired: true },
|
|
82
|
-
{ type: "input", name: "text", dataType: EDataType.TEXT, label: tr("Texto", "Text", "Texto") },
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
type: "autocomplete",
|
|
87
|
-
name: "featuredProductIds",
|
|
88
|
-
dataType: EDataType.UNIQUEIDENTIFIER,
|
|
89
|
-
label: tr("Produtos em destaque", "Featured products", "Productos destacados"),
|
|
90
|
-
isMultiple: true,
|
|
91
|
-
optionsApi: {
|
|
92
|
-
endpoint: productsApi.endpoint ?? "/products",
|
|
93
|
-
relatedEntity: "products",
|
|
94
|
-
labelField: productsApi.labelField ?? ["name"],
|
|
95
|
-
valueField: "_id",
|
|
96
|
-
paramsToFilter: productsApi.labelField ?? ["name"],
|
|
97
|
-
paramType: "query",
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
];
|
|
@@ -1,80 +0,0 @@
|
|
|
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 { getShowcaseElements, pagesElements, type IFeaturedProductsApi } from "./pages-showcase.elements";
|
|
10
|
-
import { tr } from "./translations";
|
|
11
|
-
|
|
12
|
-
export const STORE_SETTINGS_ENDPOINT = "/store-settings";
|
|
13
|
-
|
|
14
|
-
export interface IStoreSettingsModuleOptions {
|
|
15
|
-
// A mesma lista de IProjectStore.features da loja que lê esta configuração.
|
|
16
|
-
features?: TStoreFeature[];
|
|
17
|
-
// Quem lê a configuração sem login. "trustedCallers" (padrão): só o backend
|
|
18
|
-
// da loja, com o token de serviço de IMarketplace.sellerServiceAuth.
|
|
19
|
-
publicAccess?: IPublicContract["access"];
|
|
20
|
-
allowedOrigins?: string[];
|
|
21
|
-
// Produtos do vendedor oferecidos em "Produtos em destaque" (aba Vitrine).
|
|
22
|
-
featuredProductsApi?: IFeaturedProductsApi;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const buildTabs = (features: TStoreFeature[], productsApi?: IFeaturedProductsApi): IFormTab => ({
|
|
26
|
-
type: "tab",
|
|
27
|
-
id: "storeSettingsTabs",
|
|
28
|
-
tabs: [
|
|
29
|
-
{ id: "identity", title: tr("Identidade", "Identity", "Identidad"), elements: identityElements },
|
|
30
|
-
{ id: "visual", title: tr("Visual", "Look and feel", "Apariencia"), elements: visualElements },
|
|
31
|
-
{ id: "contact", title: tr("Contato", "Contact", "Contacto"), elements: contactElements },
|
|
32
|
-
{ id: "legal", title: tr("Dados legais", "Legal data", "Datos legales"), elements: legalElements },
|
|
33
|
-
{ id: "social", title: tr("Redes sociais", "Social media", "Redes sociales"), elements: socialElements },
|
|
34
|
-
{ id: "showcase", title: tr("Vitrine", "Storefront", "Escaparate"), elements: getShowcaseElements(productsApi) },
|
|
35
|
-
{ id: "pages", title: tr("Páginas", "Pages", "Páginas"), elements: pagesElements },
|
|
36
|
-
...(features.length
|
|
37
|
-
? [{ id: "features", title: tr("Funcionalidades", "Features", "Funcionalidades"), elements: getFeatureElements(features) }]
|
|
38
|
-
: []),
|
|
39
|
-
],
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export const getStoreSettingsForm = (options: IStoreSettingsModuleOptions = {}): IForm => ({
|
|
43
|
-
componentType: "form",
|
|
44
|
-
id: "storeSettingsForm",
|
|
45
|
-
title: tr("Configuração da loja", "Store settings", "Configuración de la tienda"),
|
|
46
|
-
icon: "palette",
|
|
47
|
-
guards: "isAuthorized",
|
|
48
|
-
isSingleRecord: true,
|
|
49
|
-
elements: [buildTabs(options.features ?? [], options.featuredProductsApi)],
|
|
50
|
-
contracts: [
|
|
51
|
-
{
|
|
52
|
-
id: "storeSettings",
|
|
53
|
-
endpoint: STORE_SETTINGS_ENDPOINT,
|
|
54
|
-
actions: ["create", "get", "update"],
|
|
55
|
-
request: { entity: "storeSettings", fields: [] },
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
publicContracts: [
|
|
59
|
-
{
|
|
60
|
-
id: "storeSettings",
|
|
61
|
-
endpoint: STORE_SETTINGS_ENDPOINT,
|
|
62
|
-
actions: ["get"],
|
|
63
|
-
access: options.publicAccess ?? "trustedCallers",
|
|
64
|
-
...(options.allowedOrigins ? { allowedOrigins: options.allowedOrigins } : {}),
|
|
65
|
-
request: { entity: "storeSettings", fields: [] },
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Módulo pronto "Configuração da loja", para o Backoffice do vendedor. A loja
|
|
72
|
-
* lê o registro salvo aqui por IMarketplace.storeSettingsEndpoint
|
|
73
|
-
* (STORE_SETTINGS_ENDPOINT).
|
|
74
|
-
*/
|
|
75
|
-
export const getStoreSettingsModule = (options: IStoreSettingsModuleOptions = {}): IModule => ({
|
|
76
|
-
id: "storeSettingsModule",
|
|
77
|
-
title: tr("Configuração da loja", "Store settings", "Configuración de la tienda"),
|
|
78
|
-
icon: "palette",
|
|
79
|
-
components: [getStoreSettingsForm(options)],
|
|
80
|
-
});
|