@lystech/core 3.0.142 → 3.0.143
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/dist/index.d.ts +132 -1
- package/dist/lystech-core-provider.es.js +14618 -14477
- package/dist/lystech-core-provider.umd.js +171 -171
- package/dist/lystech-core-styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,28 @@ import { RefetchOptions } from '@tanstack/react-query';
|
|
|
12
12
|
import { RefetchQueryFilters } from '@tanstack/react-query';
|
|
13
13
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
14
14
|
|
|
15
|
+
export declare type ActivePromotion = {
|
|
16
|
+
campaignUID: string;
|
|
17
|
+
name: string;
|
|
18
|
+
description: string | null;
|
|
19
|
+
discountLabel: string;
|
|
20
|
+
startsAt: string | null;
|
|
21
|
+
endsAt: string | null;
|
|
22
|
+
banner: boolean;
|
|
23
|
+
bannerText: string | null;
|
|
24
|
+
countdown: boolean;
|
|
25
|
+
badge: string | null;
|
|
26
|
+
scope: "all" | "selection";
|
|
27
|
+
collections: string[];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export declare type ActivePromotions = {
|
|
31
|
+
now: string;
|
|
32
|
+
campaigns: ActivePromotion[];
|
|
33
|
+
/** Par UID de produit : le prix promotionnel décidé par le serveur. */
|
|
34
|
+
products: Record<string, ProductPromotion>;
|
|
35
|
+
};
|
|
36
|
+
|
|
15
37
|
export declare type AppliedPromoCodeType = {
|
|
16
38
|
promoCodeObject: PromoCodeType;
|
|
17
39
|
finalTotalPrice: number;
|
|
@@ -197,6 +219,9 @@ declare type AuthUserProfileProps = {
|
|
|
197
219
|
|
|
198
220
|
export declare const axiosInstance: AxiosInstance;
|
|
199
221
|
|
|
222
|
+
/** Les campagnes à annoncer en bannière, pour cette collection (ou toute la boutique). */
|
|
223
|
+
export declare function bannersFor(data: ActivePromotions | null | undefined, collectionUID?: string | null): ActivePromotion[];
|
|
224
|
+
|
|
200
225
|
export declare function BecomeMember({ title, intro, successUrl, cancelUrl, renderAction, onChoosePlan, onLoginRequired, }: BecomeMemberProps): JSX.Element | null;
|
|
201
226
|
|
|
202
227
|
export declare type BecomeMemberProps = {
|
|
@@ -549,6 +574,8 @@ declare interface GenericCardProps {
|
|
|
549
574
|
pending?: boolean;
|
|
550
575
|
}
|
|
551
576
|
|
|
577
|
+
export declare function getActivePromotions(): Promise<ActivePromotions>;
|
|
578
|
+
|
|
552
579
|
export declare function getFeaturedImages(): Promise<ImageType[]>;
|
|
553
580
|
|
|
554
581
|
export declare function getLoyaltyRewards(): Promise<LoyaltyRewards>;
|
|
@@ -844,10 +871,31 @@ declare type OrderBreakdown = {
|
|
|
844
871
|
name: string;
|
|
845
872
|
productType: string;
|
|
846
873
|
quantity: number;
|
|
874
|
+
/** Prix unitaire PAYÉ (promotionnel quand une campagne est retenue). */
|
|
847
875
|
itemPrice: number;
|
|
848
876
|
stackPrice: number;
|
|
877
|
+
/** Présents quand une campagne de promotion baisse le prix de la ligne. */
|
|
878
|
+
regularPrice?: number;
|
|
879
|
+
campaignUID?: string;
|
|
880
|
+
campaignName?: string;
|
|
881
|
+
campaignStacking?: "exclusive" | "stack";
|
|
849
882
|
}[];
|
|
850
883
|
totalPrice: number;
|
|
884
|
+
/** Campagnes de promotion retenues (déjà déduites du sous-total). */
|
|
885
|
+
appliedCampaigns?: {
|
|
886
|
+
campaignUID: string;
|
|
887
|
+
name: string;
|
|
888
|
+
savings: number;
|
|
889
|
+
stacking: "exclusive" | "stack";
|
|
890
|
+
}[];
|
|
891
|
+
campaignSavings?: number;
|
|
892
|
+
/** Un code ou un avantage plus avantageux a écarté la promotion (un seul rabais par commande). */
|
|
893
|
+
campaignNotApplied?: string;
|
|
894
|
+
/** Codes valides mais écartés, avec la raison. */
|
|
895
|
+
promoNotApplied?: {
|
|
896
|
+
code: string;
|
|
897
|
+
reason: string;
|
|
898
|
+
}[];
|
|
851
899
|
totalItems: number;
|
|
852
900
|
finalPriceWithoutShipping?: number;
|
|
853
901
|
finalPriceIncludingShippingAndFees?: number;
|
|
@@ -1056,6 +1104,17 @@ export declare type PostType = {
|
|
|
1056
1104
|
fk_createdByAuthKey?: string;
|
|
1057
1105
|
};
|
|
1058
1106
|
|
|
1107
|
+
declare type Priced = {
|
|
1108
|
+
UID?: any;
|
|
1109
|
+
itemPrice?: number;
|
|
1110
|
+
itemRealCost?: number;
|
|
1111
|
+
promo?: PromoInfo;
|
|
1112
|
+
/** Prix d'origine gardé pour défaire la promotion (idempotence). */
|
|
1113
|
+
promoBasePrice?: number;
|
|
1114
|
+
promoBaseRealCost?: number;
|
|
1115
|
+
[key: string]: any;
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1059
1118
|
declare interface ProductPopupProps {
|
|
1060
1119
|
product: CartProduct & {
|
|
1061
1120
|
variants?: any[];
|
|
@@ -1071,6 +1130,19 @@ declare interface ProductPopupProps {
|
|
|
1071
1130
|
onClose: () => void;
|
|
1072
1131
|
}
|
|
1073
1132
|
|
|
1133
|
+
export declare type ProductPromotion = {
|
|
1134
|
+
regularPrice: number;
|
|
1135
|
+
promoPrice: number;
|
|
1136
|
+
campaignUID: string;
|
|
1137
|
+
campaignName: string;
|
|
1138
|
+
/** Pastille (« -20 % ») ; null : la boutique n'en veut pas. */
|
|
1139
|
+
badge: string | null;
|
|
1140
|
+
/** Montrer le prix courant barré à côté du prix promotionnel. */
|
|
1141
|
+
strikethrough: boolean;
|
|
1142
|
+
endsAt: string | null;
|
|
1143
|
+
stacking: "exclusive" | "stack";
|
|
1144
|
+
};
|
|
1145
|
+
|
|
1074
1146
|
declare type ProductProp = {
|
|
1075
1147
|
prop_UID: string;
|
|
1076
1148
|
prop_value_UID: string;
|
|
@@ -1098,6 +1170,29 @@ declare type ProgressiveWebAppContextType = {
|
|
|
1098
1170
|
installProgressiveWebApp: () => Promise<void>;
|
|
1099
1171
|
};
|
|
1100
1172
|
|
|
1173
|
+
/** La pastille d'un produit en promotion (« -20 % »). */
|
|
1174
|
+
export declare function PromoBadge({ label, className }: {
|
|
1175
|
+
label?: string | null;
|
|
1176
|
+
className?: string;
|
|
1177
|
+
}): JSX.Element | null;
|
|
1178
|
+
|
|
1179
|
+
export declare function PromoBanner({ promotion, onElapsed, className }: PromoBannerProps): JSX.Element | null;
|
|
1180
|
+
|
|
1181
|
+
export declare interface PromoBannerProps {
|
|
1182
|
+
promotion: Pick<ActivePromotion, "campaignUID" | "name" | "bannerText" | "discountLabel" | "endsAt" | "countdown">;
|
|
1183
|
+
onElapsed?: () => void;
|
|
1184
|
+
className?: string;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
/**
|
|
1188
|
+
* Les bannières des campagnes actives (celles que la boutique a choisi
|
|
1189
|
+
* d'annoncer), pour une collection ou toute la boutique. Rien sans campagne.
|
|
1190
|
+
*/
|
|
1191
|
+
export declare function PromoBanners({ collectionUID, className }: {
|
|
1192
|
+
collectionUID?: string | null;
|
|
1193
|
+
className?: string;
|
|
1194
|
+
}): JSX.Element | null;
|
|
1195
|
+
|
|
1101
1196
|
export declare function PromoCodeTag({ promoCode, showExpireInfo, onClick, isApplied, onRemove, }: Props_14): JSX.Element;
|
|
1102
1197
|
|
|
1103
1198
|
export declare type PromoCodeType = {
|
|
@@ -1114,6 +1209,18 @@ export declare type PromoCodeType = {
|
|
|
1114
1209
|
target: string;
|
|
1115
1210
|
};
|
|
1116
1211
|
|
|
1212
|
+
export declare type PromoInfo = {
|
|
1213
|
+
campaignUID: string;
|
|
1214
|
+
campaignName: string;
|
|
1215
|
+
badge: string | null;
|
|
1216
|
+
endsAt: string | null;
|
|
1217
|
+
regularPrice: number;
|
|
1218
|
+
};
|
|
1219
|
+
|
|
1220
|
+
export declare const promotionKeys: {
|
|
1221
|
+
active: (org: string, user: string) => readonly ["promotions-active", string, string];
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1117
1224
|
declare type Props = {
|
|
1118
1225
|
children: default_2.ReactNode;
|
|
1119
1226
|
organization?: string;
|
|
@@ -1404,7 +1511,7 @@ export declare interface ShopCatalogCollection {
|
|
|
1404
1511
|
[key: string]: any;
|
|
1405
1512
|
}
|
|
1406
1513
|
|
|
1407
|
-
export declare function ShopCatalogPage({ collections, selectedCollection, soldoutProductUIDs, renderProductCard, renderBanner, primaryColor, secondaryColor, itemsPerPage, defaultShowFilters, onCollectionClick, filtersText, allText, }: ShopCatalogPageProps): JSX.Element;
|
|
1514
|
+
export declare function ShopCatalogPage({ collections, selectedCollection, soldoutProductUIDs, renderProductCard, renderBanner, primaryColor, secondaryColor, itemsPerPage, defaultShowFilters, onCollectionClick, filtersText, allText, promotions, }: ShopCatalogPageProps): JSX.Element;
|
|
1408
1515
|
|
|
1409
1516
|
export declare interface ShopCatalogPageProps {
|
|
1410
1517
|
collections: ShopCatalogCollection[];
|
|
@@ -1419,6 +1526,14 @@ export declare interface ShopCatalogPageProps {
|
|
|
1419
1526
|
onCollectionClick?: (collection: ShopCatalogCollection) => void;
|
|
1420
1527
|
filtersText?: string;
|
|
1421
1528
|
allText?: string;
|
|
1529
|
+
/**
|
|
1530
|
+
* Campagnes de promotion (défaut : oui). Chaque produit passé à
|
|
1531
|
+
* `renderProductCard` porte alors le prix décidé par le serveur
|
|
1532
|
+
* (`itemPrice` = prix promotionnel, `itemRealCost` = prix barré,
|
|
1533
|
+
* `promo.badge` = pastille), et les bannières s'affichent au-dessus.
|
|
1534
|
+
* Sans campagne active : rien ne change.
|
|
1535
|
+
*/
|
|
1536
|
+
promotions?: boolean;
|
|
1422
1537
|
}
|
|
1423
1538
|
|
|
1424
1539
|
export declare interface ShopCatalogProduct {
|
|
@@ -1472,6 +1587,8 @@ declare type ShopProductCardProps = {
|
|
|
1472
1587
|
keyUID: string;
|
|
1473
1588
|
name: string;
|
|
1474
1589
|
}[];
|
|
1590
|
+
/** Posé par withPromotion : campagne en cours (prix décidé par le serveur). */
|
|
1591
|
+
promo?: PromoInfo;
|
|
1475
1592
|
};
|
|
1476
1593
|
onClick?: () => void;
|
|
1477
1594
|
};
|
|
@@ -1844,6 +1961,13 @@ export declare const usePopup: () => ProviderType;
|
|
|
1844
1961
|
|
|
1845
1962
|
export declare const useProgressiveWebApp: () => ProgressiveWebAppContextType;
|
|
1846
1963
|
|
|
1964
|
+
export declare function usePromotions(enabled?: boolean): {
|
|
1965
|
+
data: ActivePromotions | undefined;
|
|
1966
|
+
loading: boolean;
|
|
1967
|
+
error: unknown;
|
|
1968
|
+
refetch: () => void;
|
|
1969
|
+
};
|
|
1970
|
+
|
|
1847
1971
|
export declare const usePushNotifications: () => PushNotificationContextType;
|
|
1848
1972
|
|
|
1849
1973
|
/**
|
|
@@ -1896,6 +2020,13 @@ export declare const useUserRoleDetails: (authKey: string, organizationSubdomain
|
|
|
1896
2020
|
|
|
1897
2021
|
export declare function validatePromoCode(code: string, products: any[]): Promise<AppliedPromoCodeType>;
|
|
1898
2022
|
|
|
2023
|
+
export declare function withPromotion<T extends Priced>(product: T, promos?: Record<string, ProductPromotion> | null): T;
|
|
2024
|
+
|
|
2025
|
+
/** Une collection (et les variantes de ses produits) aux prix de la promotion. */
|
|
2026
|
+
export declare function withPromotionsInCollection<C extends {
|
|
2027
|
+
products?: any[];
|
|
2028
|
+
} | undefined | null>(collection: C, data?: ActivePromotions | null): C;
|
|
2029
|
+
|
|
1899
2030
|
|
|
1900
2031
|
export * from "@lystech/sections";
|
|
1901
2032
|
|