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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rapida-partner",
3
- "version": "8.11.0",
3
+ "version": "8.12.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "index.ts",
6
6
  "files": [
@@ -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
+ }
@@ -26,7 +26,8 @@ export type TStoreFeature =
26
26
  | "attendees"
27
27
  | "tickets"
28
28
  | "productBadges"
29
- | "couponShowcase";
29
+ | "couponShowcase"
30
+ | "collections";
30
31
 
31
32
  export type TStoreFeatureToggle = `${TStoreFeature}Enabled`;
32
33
 
@@ -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
@@ -0,0 +1,3 @@
1
+ /** Coleções da home (funcionalidade "collections"): quantas coleções a home mostra e quantos produtos cada uma. */
2
+ export const STORE_HOME_COLLECTIONS_LIMIT = 6;
3
+ export const STORE_COLLECTION_PRODUCTS_LIMIT = 8;
@@ -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. */