rapida-partner 8.12.0 → 8.13.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/store-cross-sell.interface.ts +21 -0
- package/src/interfaces/store-settings.interface.ts +2 -1
- package/src/schemas/project-store.ref.json +1 -1
- package/src/schemas/store-settings.ref.json +1 -0
- package/src/utils/store-cross-sell.ts +2 -0
- package/src/utils/store-references.test.ts +11 -0
- package/src/utils/store-references.ts +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Oferta ao adicionar (funcionalidade "crossSell"): outro produto com preço
|
|
3
|
+
* especial levando este, como "Batata frita por R$ 5,00 levando este lanche".
|
|
4
|
+
* Fica no campo crossSellOffers da configuração de venda do produto de origem
|
|
5
|
+
* (form productSellingSettingForm de rapida-projects, que recebe a lista por
|
|
6
|
+
* withCrossSellInSellingSettings). Ao adicionar o produto de origem, a loja
|
|
7
|
+
* mostra as ofertas; a oferta aceita é outra linha do carrinho.
|
|
8
|
+
*
|
|
9
|
+
* O servidor só aplica offerPrice até a quantidade do produto de origem no
|
|
10
|
+
* mesmo pedido; o que passar sai pelo preço normal. O produto ofertado é
|
|
11
|
+
* simples (sem variações nem adicionais); com variação, aponte o filho.
|
|
12
|
+
*/
|
|
13
|
+
export interface IProductCrossSellOffer {
|
|
14
|
+
offerProductId: string;
|
|
15
|
+
// Preço especial por unidade; só vale se for menor que o preço normal.
|
|
16
|
+
offerPrice: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface IProductCrossSellLinks {
|
|
20
|
+
crossSellOffers?: IProductCrossSellOffer[];
|
|
21
|
+
}
|
|
@@ -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", "collections"]
|
|
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", "crossSell"]
|
|
15
15
|
},
|
|
16
16
|
"uniqueItems": true
|
|
17
17
|
},
|
|
@@ -138,6 +138,7 @@
|
|
|
138
138
|
"productBadgesEnabled": { "type": "boolean" },
|
|
139
139
|
"couponShowcaseEnabled": { "type": "boolean" },
|
|
140
140
|
"collectionsEnabled": { "type": "boolean" },
|
|
141
|
+
"crossSellEnabled": { "type": "boolean" },
|
|
141
142
|
"returnsEnabled": { "type": "boolean" }
|
|
142
143
|
},
|
|
143
144
|
"additionalProperties": false
|
|
@@ -79,3 +79,14 @@ describe("coleções da home", () => {
|
|
|
79
79
|
]);
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
|
+
|
|
83
|
+
describe("oferta ao adicionar", () => {
|
|
84
|
+
test("crossSell sem productSellingSettingsEndpoint avisa", () => {
|
|
85
|
+
const store = (marketplace: Record<string, string>): IProject =>
|
|
86
|
+
({ id: "p", title: "p", skeleton: "ecommerce", store: { segment: "food", features: ["crossSell"] }, backend: [{ marketplace }] }) as unknown as IProject;
|
|
87
|
+
expect(checkStoreReferences(store({ productSellingSettingsEndpoint: "/product-selling-settings" }))).toEqual([]);
|
|
88
|
+
expect(checkStoreReferences(store({}))).toEqual([
|
|
89
|
+
"store.features \"crossSell\" precisa de backend.marketplace.productSellingSettingsEndpoint; sem ele a funcionalidade não é gerada",
|
|
90
|
+
]);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -15,6 +15,7 @@ const FEATURE_ENDPOINTS: Partial<Record<TStoreFeature, TMarketplaceEndpoint[]>>
|
|
|
15
15
|
productBadges: ["badgesEndpoint", "productSellingSettingsEndpoint"],
|
|
16
16
|
couponShowcase: ["couponsEndpoint"],
|
|
17
17
|
collections: ["collectionsEndpoint"],
|
|
18
|
+
crossSell: ["productSellingSettingsEndpoint"],
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
/** Funcionalidades que só existem junto com outra. */
|