rapida-partner 8.11.0 → 8.12.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/interfaces/project-backend.interface.ts +3 -0
- package/src/interfaces/store-collection.interface.ts +18 -0
- package/src/interfaces/store-settings.interface.ts +2 -1
- package/src/schemas/backend.ref.json +1 -0
- package/src/schemas/project-store.ref.json +1 -1
- package/src/schemas/store-settings.ref.json +1 -0
- package/src/utils/store-collection.ts +3 -0
- package/src/utils/store-references.test.ts +12 -0
- package/src/utils/store-references.ts +1 -0
package/package.json
CHANGED
|
@@ -118,6 +118,9 @@ interface IMarketplace {
|
|
|
118
118
|
// os selos em badgeIds da configuração de venda, por isso exige também
|
|
119
119
|
// productSellingSettingsEndpoint.
|
|
120
120
|
badgesEndpoint?: string;
|
|
121
|
+
// Coleções da home (módulo de rapida-projects getStoreCollectionsModule,
|
|
122
|
+
// funcionalidade "collections"): o cadastro IStoreCollection.
|
|
123
|
+
collectionsEndpoint?: string;
|
|
121
124
|
}
|
|
122
125
|
|
|
123
126
|
export interface IMarketplaceProductFieldMap {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coleção da home da loja (funcionalidade "collections"), como "Lançamentos"
|
|
3
|
+
* ou "Para o fim de semana": um título e os produtos, na ordem escolhida.
|
|
4
|
+
* Cadastrada no Backoffice do vendedor pelo módulo de rapida-projects
|
|
5
|
+
* getStoreCollectionsModule e lida pela loja por IMarketplace.collectionsEndpoint.
|
|
6
|
+
* É um cadastro próprio, e não uma lista na configuração da loja, porque os
|
|
7
|
+
* forms não guardam lista dentro de lista. Os campos são os nomes do form.
|
|
8
|
+
*/
|
|
9
|
+
export interface IStoreCollection {
|
|
10
|
+
title: string;
|
|
11
|
+
subtitle?: string;
|
|
12
|
+
// Ids dos produtos do vendedor, na ordem em que aparecem.
|
|
13
|
+
productIds: string[];
|
|
14
|
+
// Ordem entre as coleções da home (menor primeiro).
|
|
15
|
+
displayOrder?: number;
|
|
16
|
+
// Desligada, a coleção sai da home.
|
|
17
|
+
isActive: boolean;
|
|
18
|
+
}
|
|
@@ -161,6 +161,7 @@
|
|
|
161
161
|
"optionGroupsEndpoint": { "type": "string" },
|
|
162
162
|
"optionsEndpoint": { "type": "string" },
|
|
163
163
|
"badgesEndpoint": { "type": "string" },
|
|
164
|
+
"collectionsEndpoint": { "type": "string" },
|
|
164
165
|
"productFieldMap": {
|
|
165
166
|
"type": "object",
|
|
166
167
|
"properties": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"type": "array",
|
|
12
12
|
"items": {
|
|
13
13
|
"type": "string",
|
|
14
|
-
"enum": ["whatsappButton", "stockAvailability", "cashDiscount", "installments", "favorites", "blog", "shipping", "coupons", "reviews", "returns", "openingHours", "pickup", "districtDelivery", "payOnDelivery", "itemNotes", "productOptions", "productVariants", "stockReservation", "attendees", "tickets", "productBadges", "couponShowcase"]
|
|
14
|
+
"enum": ["whatsappButton", "stockAvailability", "cashDiscount", "installments", "favorites", "blog", "shipping", "coupons", "reviews", "returns", "openingHours", "pickup", "districtDelivery", "payOnDelivery", "itemNotes", "productOptions", "productVariants", "stockReservation", "attendees", "tickets", "productBadges", "couponShowcase", "collections"]
|
|
15
15
|
},
|
|
16
16
|
"uniqueItems": true
|
|
17
17
|
},
|
|
@@ -137,6 +137,7 @@
|
|
|
137
137
|
"ticketsEnabled": { "type": "boolean" },
|
|
138
138
|
"productBadgesEnabled": { "type": "boolean" },
|
|
139
139
|
"couponShowcaseEnabled": { "type": "boolean" },
|
|
140
|
+
"collectionsEnabled": { "type": "boolean" },
|
|
140
141
|
"returnsEnabled": { "type": "boolean" }
|
|
141
142
|
},
|
|
142
143
|
"additionalProperties": false
|
|
@@ -67,3 +67,15 @@ describe("vitrine de cupons", () => {
|
|
|
67
67
|
]);
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
|
+
|
|
71
|
+
describe("coleções da home", () => {
|
|
72
|
+
const store = (marketplace: Record<string, string>): IProject =>
|
|
73
|
+
({ id: "p", title: "p", skeleton: "marketplace", store: { features: ["collections"] }, backend: [{ marketplace }] }) as unknown as IProject;
|
|
74
|
+
|
|
75
|
+
test("com collectionsEndpoint não avisa; sem ele avisa", () => {
|
|
76
|
+
expect(checkStoreReferences(store({ collectionsEndpoint: "/store-collections" }))).toEqual([]);
|
|
77
|
+
expect(checkStoreReferences(store({}))).toEqual([
|
|
78
|
+
"store.features \"collections\" precisa de backend.marketplace.collectionsEndpoint; sem ele a funcionalidade não é gerada",
|
|
79
|
+
]);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -14,6 +14,7 @@ type TMarketplaceEndpoint = keyof {
|
|
|
14
14
|
const FEATURE_ENDPOINTS: Partial<Record<TStoreFeature, TMarketplaceEndpoint[]>> = {
|
|
15
15
|
productBadges: ["badgesEndpoint", "productSellingSettingsEndpoint"],
|
|
16
16
|
couponShowcase: ["couponsEndpoint"],
|
|
17
|
+
collections: ["collectionsEndpoint"],
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
/** Funcionalidades que só existem junto com outra. */
|