@cimplify/sdk 0.48.2 → 0.49.1
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/react.d.mts +79 -1
- package/dist/react.d.ts +79 -1
- package/dist/react.js +288 -2
- package/dist/react.mjs +286 -3
- package/dist/server.d.mts +74 -10
- package/dist/server.d.ts +74 -10
- package/dist/server.js +262 -17
- package/dist/server.mjs +235 -18
- package/package.json +1 -1
- package/registry/index.json +24 -0
- package/registry/media-gallery.json +16 -0
- package/registry/product-model-3d.json +13 -0
- package/registry/store-video.json +13 -0
package/dist/react.mjs
CHANGED
|
@@ -6975,6 +6975,289 @@ function ProductImageGallery({
|
|
|
6975
6975
|
)
|
|
6976
6976
|
] });
|
|
6977
6977
|
}
|
|
6978
|
+
var ASPECT_STYLES2 = {
|
|
6979
|
+
square: { aspectRatio: "1/1" },
|
|
6980
|
+
"4/3": { aspectRatio: "4/3" },
|
|
6981
|
+
"16/9": { aspectRatio: "16/9" },
|
|
6982
|
+
"16/10": { aspectRatio: "16/10" },
|
|
6983
|
+
"3/4": { aspectRatio: "3/4" }
|
|
6984
|
+
};
|
|
6985
|
+
function StoreVideo({
|
|
6986
|
+
src,
|
|
6987
|
+
poster,
|
|
6988
|
+
alt,
|
|
6989
|
+
aspectRatio = "16/9",
|
|
6990
|
+
controls = false,
|
|
6991
|
+
autoplay = true,
|
|
6992
|
+
loop = true,
|
|
6993
|
+
muted = true,
|
|
6994
|
+
lazy = true,
|
|
6995
|
+
className
|
|
6996
|
+
}) {
|
|
6997
|
+
const ref = useRef(null);
|
|
6998
|
+
const [inView, setInView] = useState(!lazy);
|
|
6999
|
+
useEffect(() => {
|
|
7000
|
+
if (!lazy || inView) return;
|
|
7001
|
+
const node = ref.current;
|
|
7002
|
+
if (!node || typeof IntersectionObserver === "undefined") {
|
|
7003
|
+
setInView(true);
|
|
7004
|
+
return;
|
|
7005
|
+
}
|
|
7006
|
+
const observer = new IntersectionObserver(
|
|
7007
|
+
(entries) => {
|
|
7008
|
+
if (entries.some((e) => e.isIntersecting)) {
|
|
7009
|
+
setInView(true);
|
|
7010
|
+
observer.disconnect();
|
|
7011
|
+
}
|
|
7012
|
+
},
|
|
7013
|
+
{ rootMargin: "200px" }
|
|
7014
|
+
);
|
|
7015
|
+
observer.observe(node);
|
|
7016
|
+
return () => observer.disconnect();
|
|
7017
|
+
}, [lazy, inView]);
|
|
7018
|
+
return /* @__PURE__ */ jsx(
|
|
7019
|
+
"div",
|
|
7020
|
+
{
|
|
7021
|
+
"data-cimplify-store-video": true,
|
|
7022
|
+
className,
|
|
7023
|
+
style: { position: "relative", overflow: "hidden", ...ASPECT_STYLES2[aspectRatio] },
|
|
7024
|
+
children: /* @__PURE__ */ jsx(
|
|
7025
|
+
"video",
|
|
7026
|
+
{
|
|
7027
|
+
ref,
|
|
7028
|
+
src: inView ? src : void 0,
|
|
7029
|
+
poster,
|
|
7030
|
+
autoPlay: autoplay,
|
|
7031
|
+
loop,
|
|
7032
|
+
muted,
|
|
7033
|
+
playsInline: true,
|
|
7034
|
+
controls,
|
|
7035
|
+
preload: lazy ? "metadata" : "auto",
|
|
7036
|
+
"aria-label": alt,
|
|
7037
|
+
style: { width: "100%", height: "100%", objectFit: "cover", display: "block" },
|
|
7038
|
+
children: poster ? /* @__PURE__ */ jsx(
|
|
7039
|
+
"img",
|
|
7040
|
+
{
|
|
7041
|
+
src: poster,
|
|
7042
|
+
alt: alt ?? "",
|
|
7043
|
+
style: { width: "100%", height: "100%", objectFit: "cover" }
|
|
7044
|
+
}
|
|
7045
|
+
) : null
|
|
7046
|
+
}
|
|
7047
|
+
)
|
|
7048
|
+
}
|
|
7049
|
+
);
|
|
7050
|
+
}
|
|
7051
|
+
var ASPECT_STYLES3 = {
|
|
7052
|
+
square: { aspectRatio: "1/1" },
|
|
7053
|
+
"4/3": { aspectRatio: "4/3" },
|
|
7054
|
+
"16/9": { aspectRatio: "16/9" },
|
|
7055
|
+
"3/4": { aspectRatio: "3/4" }
|
|
7056
|
+
};
|
|
7057
|
+
var MODEL_VIEWER_CDN = "https://unpkg.com/@google/model-viewer@4.0.0/dist/model-viewer.min.js";
|
|
7058
|
+
var modelViewerLoadPromise = null;
|
|
7059
|
+
function ensureModelViewer() {
|
|
7060
|
+
if (typeof window === "undefined") return Promise.resolve();
|
|
7061
|
+
if (modelViewerLoadPromise) return modelViewerLoadPromise;
|
|
7062
|
+
if (window.customElements?.get("model-viewer")) {
|
|
7063
|
+
modelViewerLoadPromise = Promise.resolve();
|
|
7064
|
+
return modelViewerLoadPromise;
|
|
7065
|
+
}
|
|
7066
|
+
modelViewerLoadPromise = new Promise((resolve, reject) => {
|
|
7067
|
+
const script = document.createElement("script");
|
|
7068
|
+
script.type = "module";
|
|
7069
|
+
script.src = MODEL_VIEWER_CDN;
|
|
7070
|
+
script.onload = () => resolve();
|
|
7071
|
+
script.onerror = () => reject(new Error("Failed to load model-viewer"));
|
|
7072
|
+
document.head.appendChild(script);
|
|
7073
|
+
});
|
|
7074
|
+
return modelViewerLoadPromise;
|
|
7075
|
+
}
|
|
7076
|
+
function ProductModel3D({
|
|
7077
|
+
src,
|
|
7078
|
+
iosSrc,
|
|
7079
|
+
poster,
|
|
7080
|
+
alt,
|
|
7081
|
+
aspectRatio = "square",
|
|
7082
|
+
ar = true,
|
|
7083
|
+
autoRotate = true,
|
|
7084
|
+
cameraControls = true,
|
|
7085
|
+
className
|
|
7086
|
+
}) {
|
|
7087
|
+
const [ready, setReady] = useState(false);
|
|
7088
|
+
useEffect(() => {
|
|
7089
|
+
let cancelled = false;
|
|
7090
|
+
ensureModelViewer().then(
|
|
7091
|
+
() => {
|
|
7092
|
+
if (!cancelled) setReady(true);
|
|
7093
|
+
},
|
|
7094
|
+
() => {
|
|
7095
|
+
}
|
|
7096
|
+
);
|
|
7097
|
+
return () => {
|
|
7098
|
+
cancelled = true;
|
|
7099
|
+
};
|
|
7100
|
+
}, []);
|
|
7101
|
+
return /* @__PURE__ */ jsx(
|
|
7102
|
+
"div",
|
|
7103
|
+
{
|
|
7104
|
+
"data-cimplify-product-model-3d": true,
|
|
7105
|
+
className,
|
|
7106
|
+
style: { position: "relative", overflow: "hidden", ...ASPECT_STYLES3[aspectRatio] },
|
|
7107
|
+
children: ready ? React10.createElement("model-viewer", {
|
|
7108
|
+
src,
|
|
7109
|
+
"ios-src": iosSrc,
|
|
7110
|
+
alt,
|
|
7111
|
+
poster,
|
|
7112
|
+
ar: ar || void 0,
|
|
7113
|
+
"ar-modes": ar ? "webxr scene-viewer quick-look" : void 0,
|
|
7114
|
+
"camera-controls": cameraControls || void 0,
|
|
7115
|
+
"auto-rotate": autoRotate || void 0,
|
|
7116
|
+
"shadow-intensity": "1",
|
|
7117
|
+
style: { width: "100%", height: "100%", backgroundColor: "transparent" }
|
|
7118
|
+
}) : poster ? React10.createElement("img", {
|
|
7119
|
+
src: poster,
|
|
7120
|
+
alt: alt ?? "",
|
|
7121
|
+
"data-cimplify-product-model-3d-loading": true,
|
|
7122
|
+
style: { width: "100%", height: "100%", objectFit: "cover" }
|
|
7123
|
+
}) : React10.createElement("div", {
|
|
7124
|
+
"data-cimplify-product-model-3d-loading": true,
|
|
7125
|
+
style: { width: "100%", height: "100%", backgroundColor: "var(--muted, #f3f4f6)" }
|
|
7126
|
+
})
|
|
7127
|
+
}
|
|
7128
|
+
);
|
|
7129
|
+
}
|
|
7130
|
+
var ASPECT_STYLES4 = {
|
|
7131
|
+
square: { aspectRatio: "1/1" },
|
|
7132
|
+
"4/3": { aspectRatio: "4/3" },
|
|
7133
|
+
"16/10": { aspectRatio: "16/10" },
|
|
7134
|
+
"3/4": { aspectRatio: "3/4" }
|
|
7135
|
+
};
|
|
7136
|
+
function thumbnailFor(item) {
|
|
7137
|
+
if (item.type === "image") return item.src;
|
|
7138
|
+
return item.poster ?? null;
|
|
7139
|
+
}
|
|
7140
|
+
function thumbIcon(item) {
|
|
7141
|
+
if (item.type === "video") return "\u25B6";
|
|
7142
|
+
if (item.type === "model") return "\u25C6";
|
|
7143
|
+
return null;
|
|
7144
|
+
}
|
|
7145
|
+
function MediaGallery({
|
|
7146
|
+
items,
|
|
7147
|
+
productName,
|
|
7148
|
+
aspectRatio = "4/3",
|
|
7149
|
+
className
|
|
7150
|
+
}) {
|
|
7151
|
+
const validItems = useMemo(
|
|
7152
|
+
() => items.filter((i) => typeof i.src === "string" && i.src.trim().length > 0),
|
|
7153
|
+
[items]
|
|
7154
|
+
);
|
|
7155
|
+
const [selected, setSelected] = useState(0);
|
|
7156
|
+
useEffect(() => {
|
|
7157
|
+
setSelected(0);
|
|
7158
|
+
}, [validItems.length, productName]);
|
|
7159
|
+
if (validItems.length === 0) return null;
|
|
7160
|
+
const active = validItems[selected] ?? validItems[0];
|
|
7161
|
+
return /* @__PURE__ */ jsxs("div", { "data-cimplify-media-gallery": true, className, children: [
|
|
7162
|
+
/* @__PURE__ */ jsx(
|
|
7163
|
+
"div",
|
|
7164
|
+
{
|
|
7165
|
+
"data-cimplify-media-gallery-main": true,
|
|
7166
|
+
style: { position: "relative", overflow: "hidden", ...ASPECT_STYLES4[aspectRatio] },
|
|
7167
|
+
children: active.type === "image" ? /* @__PURE__ */ jsx(
|
|
7168
|
+
"img",
|
|
7169
|
+
{
|
|
7170
|
+
src: active.src,
|
|
7171
|
+
alt: active.alt ?? productName,
|
|
7172
|
+
style: { width: "100%", height: "100%", objectFit: "cover" },
|
|
7173
|
+
"data-cimplify-media-gallery-active": true
|
|
7174
|
+
}
|
|
7175
|
+
) : active.type === "video" ? /* @__PURE__ */ jsx(
|
|
7176
|
+
StoreVideo,
|
|
7177
|
+
{
|
|
7178
|
+
src: active.src,
|
|
7179
|
+
poster: active.poster,
|
|
7180
|
+
alt: active.alt ?? productName,
|
|
7181
|
+
aspectRatio: "square",
|
|
7182
|
+
lazy: false
|
|
7183
|
+
}
|
|
7184
|
+
) : /* @__PURE__ */ jsx(
|
|
7185
|
+
ProductModel3D,
|
|
7186
|
+
{
|
|
7187
|
+
src: active.src,
|
|
7188
|
+
iosSrc: active.iosSrc,
|
|
7189
|
+
poster: active.poster,
|
|
7190
|
+
alt: active.alt ?? productName,
|
|
7191
|
+
aspectRatio: "square"
|
|
7192
|
+
}
|
|
7193
|
+
)
|
|
7194
|
+
}
|
|
7195
|
+
),
|
|
7196
|
+
validItems.length > 1 && /* @__PURE__ */ jsx(
|
|
7197
|
+
RadioGroup,
|
|
7198
|
+
{
|
|
7199
|
+
"aria-label": `${productName} media thumbnails`,
|
|
7200
|
+
value: String(selected),
|
|
7201
|
+
onValueChange: (v) => setSelected(Number(v)),
|
|
7202
|
+
"data-cimplify-media-gallery-thumbnails": true,
|
|
7203
|
+
style: { display: "flex", gap: "0.5rem", marginTop: "0.75rem" },
|
|
7204
|
+
children: validItems.map((item, index) => {
|
|
7205
|
+
const thumb = thumbnailFor(item);
|
|
7206
|
+
const icon = thumbIcon(item);
|
|
7207
|
+
const isSelected = selected === index;
|
|
7208
|
+
return /* @__PURE__ */ jsxs(
|
|
7209
|
+
Radio.Root,
|
|
7210
|
+
{
|
|
7211
|
+
value: String(index),
|
|
7212
|
+
"data-cimplify-media-gallery-thumb": true,
|
|
7213
|
+
"data-selected": isSelected || void 0,
|
|
7214
|
+
"data-type": item.type,
|
|
7215
|
+
style: {
|
|
7216
|
+
position: "relative",
|
|
7217
|
+
width: "4rem",
|
|
7218
|
+
height: "4rem",
|
|
7219
|
+
overflow: "hidden",
|
|
7220
|
+
padding: 0,
|
|
7221
|
+
border: "none",
|
|
7222
|
+
cursor: "pointer",
|
|
7223
|
+
backgroundColor: "var(--muted, #f3f4f6)"
|
|
7224
|
+
},
|
|
7225
|
+
children: [
|
|
7226
|
+
thumb ? /* @__PURE__ */ jsx(
|
|
7227
|
+
"img",
|
|
7228
|
+
{
|
|
7229
|
+
src: thumb,
|
|
7230
|
+
alt: "",
|
|
7231
|
+
style: { width: "100%", height: "100%", objectFit: "cover" }
|
|
7232
|
+
}
|
|
7233
|
+
) : null,
|
|
7234
|
+
icon ? /* @__PURE__ */ jsx(
|
|
7235
|
+
"span",
|
|
7236
|
+
{
|
|
7237
|
+
"aria-hidden": true,
|
|
7238
|
+
style: {
|
|
7239
|
+
position: "absolute",
|
|
7240
|
+
inset: 0,
|
|
7241
|
+
display: "flex",
|
|
7242
|
+
alignItems: "center",
|
|
7243
|
+
justifyContent: "center",
|
|
7244
|
+
color: "white",
|
|
7245
|
+
fontSize: "0.875rem",
|
|
7246
|
+
textShadow: "0 1px 2px rgba(0,0,0,0.6)",
|
|
7247
|
+
pointerEvents: "none"
|
|
7248
|
+
},
|
|
7249
|
+
children: icon
|
|
7250
|
+
}
|
|
7251
|
+
) : null
|
|
7252
|
+
]
|
|
7253
|
+
},
|
|
7254
|
+
`${item.src}-${index}`
|
|
7255
|
+
);
|
|
7256
|
+
})
|
|
7257
|
+
}
|
|
7258
|
+
)
|
|
7259
|
+
] });
|
|
7260
|
+
}
|
|
6978
7261
|
function CartLineItemRow({
|
|
6979
7262
|
item,
|
|
6980
7263
|
onRemove,
|
|
@@ -8381,7 +8664,7 @@ var CardVariant = /* @__PURE__ */ ((CardVariant2) => {
|
|
|
8381
8664
|
CardVariant2["Subscription"] = "subscription";
|
|
8382
8665
|
return CardVariant2;
|
|
8383
8666
|
})(CardVariant || {});
|
|
8384
|
-
var
|
|
8667
|
+
var ASPECT_STYLES5 = {
|
|
8385
8668
|
square: { aspectRatio: "1/1" },
|
|
8386
8669
|
"4/3": { aspectRatio: "4/3" },
|
|
8387
8670
|
"16/10": { aspectRatio: "16/10" },
|
|
@@ -8490,7 +8773,7 @@ function ProductCard({
|
|
|
8490
8773
|
{
|
|
8491
8774
|
"data-cimplify-product-card-image-container": true,
|
|
8492
8775
|
className: cn("overflow-hidden rounded-t-xl", classNames?.imageContainer),
|
|
8493
|
-
style:
|
|
8776
|
+
style: ASPECT_STYLES5[aspectRatio],
|
|
8494
8777
|
children: renderImage ? renderImage({ src: imageUrl, alt: product.name, className: classNames?.image }) : /* @__PURE__ */ jsx(
|
|
8495
8778
|
"img",
|
|
8496
8779
|
{
|
|
@@ -13615,4 +13898,4 @@ function SparkleIcon({ className }) {
|
|
|
13615
13898
|
);
|
|
13616
13899
|
}
|
|
13617
13900
|
|
|
13618
|
-
export { AccommodationCard, Ad, AdProvider, AddOnSelector, AddressElement, AuthElement, AvailabilityBadge, BillingPlanSelector, BookingCard, BookingList, BookingPage, BookingsPage, BundleProductCard, BundleProductLayout, BundleSelector, CardImage, CardShell, CardVariant, CartDrawer, CartDrawerProvider, CartPage, CartSummary, CartTemplate, CatalogueCollectionLayout, CataloguePage, CatalogueTemplate, CategoryFilter, CategoryGrid, ChatWidget, CheckoutPage, CimplifyAccount, CimplifyCheckout, CimplifyProvider, CollectionPage, CollectionTemplate, CompactCartLayout, CompactCatalogueLayout, CompactSearchLayout, CompactServiceCard, CompositeProductCard, CompositeProductLayout, CompositeSelector, CurrencySelector, CustomAttributesTable, CustomerInputFields, DatePicker, DateSlotPicker, DealBanner, DealsPage, DefaultCartLayout, DefaultCatalogueLayout, DefaultCollectionLayout, DefaultProductLayout, DefaultSearchLayout, DeliveryEstimate, DigitalProductCard, DigitalProductLayout, DiscountInput, ElementsProvider, FeaturedCollectionLayout, FoodProductCard, FoodProductLayout, InventoryBadge, LeaseServiceCard, LocationPicker, MetadataStringList, OrderDetailPage, OrderHistory, OrderHistoryPage, OrderSummary, PaymentElement, Price, PriceRange, ProductCard, ProductCustomizer, ProductGrid, ProductImageGallery, ProductPage, ProductSheet, ProductTemplate, PropertiesTable, QuantitySelector, QuickAddButton, RecentlyViewed, RecommendationCarousel, RelatedProductsSection, RentalServiceCard, ResourcePicker, RetailProductCard, SaleBadge, ScheduleServiceCard, SearchInput, SearchPage, SearchTemplate, ServiceProductLayout, SessionMessageBanner, SlotPicker, SoldOutOverlay, StaffPicker, StandardServiceCard, StoreNav, SubscriptionCard, TagPills, TimePicker, TwoColumnGrid, VariantSelector, VolumePricing, WholesaleProductCard, WholesaleProductLayout, WishlistButton, cn, roomToResource, useActivityState, useAds, useAttributeDefinitions, useAvailableSlots, useBillingPlans, useBookings, useBootstrap, useBundles, useCart, useCartDrawer, useCategories, useChat, useCheckout, useCimplify, useCimplifyClient, useCollection, useCollections, useDeals, useDeliveryFee, useElements, useElementsReady, useFxRate, useLocations, useOptionalCimplify, useOrder, useOrders, useProduct, useProductAvailability, useProductDeals, useProductPrice, useProductSchedules, useProducts, useProductsOnSale, usePropertyFacets, useQuote, useRecommendations, useSearch, useServiceAvailability, useServices, useSubscription, useSubscriptions, useTaxonomies, useTaxonomy, useTaxonomyPath, useValidateDiscount, useVariantSelector };
|
|
13901
|
+
export { AccommodationCard, Ad, AdProvider, AddOnSelector, AddressElement, AuthElement, AvailabilityBadge, BillingPlanSelector, BookingCard, BookingList, BookingPage, BookingsPage, BundleProductCard, BundleProductLayout, BundleSelector, CardImage, CardShell, CardVariant, CartDrawer, CartDrawerProvider, CartPage, CartSummary, CartTemplate, CatalogueCollectionLayout, CataloguePage, CatalogueTemplate, CategoryFilter, CategoryGrid, ChatWidget, CheckoutPage, CimplifyAccount, CimplifyCheckout, CimplifyProvider, CollectionPage, CollectionTemplate, CompactCartLayout, CompactCatalogueLayout, CompactSearchLayout, CompactServiceCard, CompositeProductCard, CompositeProductLayout, CompositeSelector, CurrencySelector, CustomAttributesTable, CustomerInputFields, DatePicker, DateSlotPicker, DealBanner, DealsPage, DefaultCartLayout, DefaultCatalogueLayout, DefaultCollectionLayout, DefaultProductLayout, DefaultSearchLayout, DeliveryEstimate, DigitalProductCard, DigitalProductLayout, DiscountInput, ElementsProvider, FeaturedCollectionLayout, FoodProductCard, FoodProductLayout, InventoryBadge, LeaseServiceCard, LocationPicker, MediaGallery, MetadataStringList, OrderDetailPage, OrderHistory, OrderHistoryPage, OrderSummary, PaymentElement, Price, PriceRange, ProductCard, ProductCustomizer, ProductGrid, ProductImageGallery, ProductModel3D, ProductPage, ProductSheet, ProductTemplate, PropertiesTable, QuantitySelector, QuickAddButton, RecentlyViewed, RecommendationCarousel, RelatedProductsSection, RentalServiceCard, ResourcePicker, RetailProductCard, SaleBadge, ScheduleServiceCard, SearchInput, SearchPage, SearchTemplate, ServiceProductLayout, SessionMessageBanner, SlotPicker, SoldOutOverlay, StaffPicker, StandardServiceCard, StoreNav, StoreVideo, SubscriptionCard, TagPills, TimePicker, TwoColumnGrid, VariantSelector, VolumePricing, WholesaleProductCard, WholesaleProductLayout, WishlistButton, cn, roomToResource, useActivityState, useAds, useAttributeDefinitions, useAvailableSlots, useBillingPlans, useBookings, useBootstrap, useBundles, useCart, useCartDrawer, useCategories, useChat, useCheckout, useCimplify, useCimplifyClient, useCollection, useCollections, useDeals, useDeliveryFee, useElements, useElementsReady, useFxRate, useLocations, useOptionalCimplify, useOrder, useOrders, useProduct, useProductAvailability, useProductDeals, useProductPrice, useProductSchedules, useProducts, useProductsOnSale, usePropertyFacets, useQuote, useRecommendations, useSearch, useServiceAvailability, useServices, useSubscription, useSubscriptions, useTaxonomies, useTaxonomy, useTaxonomyPath, useValidateDiscount, useVariantSelector };
|
package/dist/server.d.mts
CHANGED
|
@@ -68,31 +68,95 @@ declare const tags: {
|
|
|
68
68
|
readonly collection: (id: string) => string;
|
|
69
69
|
readonly collectionProducts: (id: string) => string;
|
|
70
70
|
readonly business: () => string;
|
|
71
|
+
readonly brand: () => string;
|
|
71
72
|
readonly locations: () => string;
|
|
73
|
+
readonly location: (id: string) => string;
|
|
74
|
+
readonly locale: () => string;
|
|
75
|
+
readonly pricing: () => string;
|
|
76
|
+
readonly tag: (name: string) => string;
|
|
77
|
+
readonly addons: () => string;
|
|
78
|
+
readonly addon: (id: string) => string;
|
|
79
|
+
readonly subscriptions: () => string;
|
|
80
|
+
readonly subscription: (id: string) => string;
|
|
81
|
+
readonly stock: () => string;
|
|
82
|
+
readonly stockFor: (productId: string) => string;
|
|
72
83
|
readonly orders: (customerId: string) => string;
|
|
73
84
|
readonly order: (id: string) => string;
|
|
74
85
|
};
|
|
75
86
|
|
|
87
|
+
/** Next 16 `revalidateTag` profile arg — built-in name (`'max'`/`'hours'`/…) or `{expire: secs}`. */
|
|
88
|
+
type RevalidateProfile$1 = string | {
|
|
89
|
+
expire: number;
|
|
90
|
+
};
|
|
76
91
|
/**
|
|
77
92
|
* Invalidate every cache entry tagged with the products list. Call after a
|
|
78
|
-
* Server Action that creates / deletes / reorders products.
|
|
93
|
+
* Server Action that creates / deletes / reorders products. The optional
|
|
94
|
+
* `profile` is the Next 16 cacheLife profile (defaults to `'max'` SWR).
|
|
79
95
|
*/
|
|
80
|
-
declare function revalidateProducts(): Promise<void>;
|
|
96
|
+
declare function revalidateProducts(profile?: RevalidateProfile$1): Promise<void>;
|
|
81
97
|
/**
|
|
82
98
|
* Invalidate the cached detail of a single product (and the products list,
|
|
83
99
|
* since list-shaped caches typically embed each product's denormalized
|
|
84
100
|
* fields). Call after a Server Action that edits a product.
|
|
85
101
|
*/
|
|
86
|
-
declare function revalidateProduct(id: string): Promise<void>;
|
|
87
|
-
declare function revalidateCategories(): Promise<void>;
|
|
88
|
-
declare function revalidateCategory(id: string): Promise<void>;
|
|
89
|
-
declare function revalidateCollections(): Promise<void>;
|
|
90
|
-
declare function revalidateCollection(id: string): Promise<void>;
|
|
91
|
-
declare function revalidateBusiness(): Promise<void>;
|
|
102
|
+
declare function revalidateProduct(id: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
103
|
+
declare function revalidateCategories(profile?: RevalidateProfile$1): Promise<void>;
|
|
104
|
+
declare function revalidateCategory(id: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
105
|
+
declare function revalidateCollections(profile?: RevalidateProfile$1): Promise<void>;
|
|
106
|
+
declare function revalidateCollection(id: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
107
|
+
declare function revalidateBusiness(profile?: RevalidateProfile$1): Promise<void>;
|
|
108
|
+
declare function revalidateBrand(profile?: RevalidateProfile$1): Promise<void>;
|
|
109
|
+
declare function revalidateLocations(profile?: RevalidateProfile$1): Promise<void>;
|
|
110
|
+
declare function revalidateLocation(id: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
111
|
+
declare function revalidatePricing(profile?: RevalidateProfile$1): Promise<void>;
|
|
112
|
+
declare function revalidateAddOns(profile?: RevalidateProfile$1): Promise<void>;
|
|
113
|
+
declare function revalidateAddOn(id: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
114
|
+
declare function revalidateSubscriptions(profile?: RevalidateProfile$1): Promise<void>;
|
|
115
|
+
declare function revalidateSubscription(id: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
116
|
+
declare function revalidateStock(productId?: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
92
117
|
/**
|
|
93
118
|
* Escape hatch: invalidate by raw tag string. Prefer the typed helpers
|
|
94
119
|
* above where possible — they keep the tag scheme in one place.
|
|
95
120
|
*/
|
|
96
|
-
declare function revalidateByTag(tag: string): Promise<void>;
|
|
121
|
+
declare function revalidateByTag(tag: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
122
|
+
|
|
123
|
+
/** Expire the products list with read-your-writes. Call from a Server Action that creates / deletes / reorders. */
|
|
124
|
+
declare function updateProducts(): Promise<void>;
|
|
125
|
+
/** Expire a single product + the products list with read-your-writes. */
|
|
126
|
+
declare function updateProduct(id: string): Promise<void>;
|
|
127
|
+
declare function updateCategories(): Promise<void>;
|
|
128
|
+
declare function updateCategory(id: string): Promise<void>;
|
|
129
|
+
declare function updateCollections(): Promise<void>;
|
|
130
|
+
declare function updateCollection(id: string): Promise<void>;
|
|
131
|
+
declare function updateBusiness(): Promise<void>;
|
|
132
|
+
declare function updateBrand(): Promise<void>;
|
|
133
|
+
declare function updateLocations(): Promise<void>;
|
|
134
|
+
declare function updateLocation(id: string): Promise<void>;
|
|
135
|
+
declare function updatePricing(): Promise<void>;
|
|
136
|
+
declare function updateAddOns(): Promise<void>;
|
|
137
|
+
declare function updateAddOn(id: string): Promise<void>;
|
|
138
|
+
declare function updateSubscriptions(): Promise<void>;
|
|
139
|
+
declare function updateSubscription(id: string): Promise<void>;
|
|
140
|
+
declare function updateStock(productId?: string): Promise<void>;
|
|
141
|
+
/** Escape hatch: expire a raw tag with read-your-writes. Prefer the typed helpers above. */
|
|
142
|
+
declare function updateByTag(tag: string): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Refresh uncached data on the current page (notification counts, live
|
|
145
|
+
* metrics, status indicators). Server-Action-only. Complements
|
|
146
|
+
* `router.refresh()` on the client.
|
|
147
|
+
*/
|
|
148
|
+
declare function refreshPage(): Promise<void>;
|
|
149
|
+
|
|
150
|
+
/** Next 16 `revalidateTag` profile arg — built-in name (`'max'`/`'hours'`/…) or inline `{expire: secs}`. */
|
|
151
|
+
type RevalidateProfile = string | {
|
|
152
|
+
expire: number;
|
|
153
|
+
};
|
|
154
|
+
interface RevalidateRouteOptions {
|
|
155
|
+
secret?: string;
|
|
156
|
+
revalidateTag?: (tag: string, profile: RevalidateProfile) => void;
|
|
157
|
+
now?: () => number;
|
|
158
|
+
defaultProfile?: RevalidateProfile;
|
|
159
|
+
}
|
|
160
|
+
declare function revalidateRouteHandler(req: Request, options?: RevalidateRouteOptions): Promise<Response>;
|
|
97
161
|
|
|
98
|
-
export { CimplifyClient, type ServerClientOptions, getServerClient, revalidateBusiness, revalidateByTag, revalidateCategories, revalidateCategory, revalidateCollection, revalidateCollections, revalidateProduct, revalidateProducts, tags };
|
|
162
|
+
export { CimplifyClient, type RevalidateProfile$1 as RevalidateProfile, type RevalidateRouteOptions, type RevalidateProfile as RevalidateRouteProfile, type ServerClientOptions, getServerClient, refreshPage, revalidateAddOn, revalidateAddOns, revalidateBrand, revalidateBusiness, revalidateByTag, revalidateCategories, revalidateCategory, revalidateCollection, revalidateCollections, revalidateLocation, revalidateLocations, revalidatePricing, revalidateProduct, revalidateProducts, revalidateRouteHandler, revalidateStock, revalidateSubscription, revalidateSubscriptions, tags, updateAddOn, updateAddOns, updateBrand, updateBusiness, updateByTag, updateCategories, updateCategory, updateCollection, updateCollections, updateLocation, updateLocations, updatePricing, updateProduct, updateProducts, updateStock, updateSubscription, updateSubscriptions };
|
package/dist/server.d.ts
CHANGED
|
@@ -68,31 +68,95 @@ declare const tags: {
|
|
|
68
68
|
readonly collection: (id: string) => string;
|
|
69
69
|
readonly collectionProducts: (id: string) => string;
|
|
70
70
|
readonly business: () => string;
|
|
71
|
+
readonly brand: () => string;
|
|
71
72
|
readonly locations: () => string;
|
|
73
|
+
readonly location: (id: string) => string;
|
|
74
|
+
readonly locale: () => string;
|
|
75
|
+
readonly pricing: () => string;
|
|
76
|
+
readonly tag: (name: string) => string;
|
|
77
|
+
readonly addons: () => string;
|
|
78
|
+
readonly addon: (id: string) => string;
|
|
79
|
+
readonly subscriptions: () => string;
|
|
80
|
+
readonly subscription: (id: string) => string;
|
|
81
|
+
readonly stock: () => string;
|
|
82
|
+
readonly stockFor: (productId: string) => string;
|
|
72
83
|
readonly orders: (customerId: string) => string;
|
|
73
84
|
readonly order: (id: string) => string;
|
|
74
85
|
};
|
|
75
86
|
|
|
87
|
+
/** Next 16 `revalidateTag` profile arg — built-in name (`'max'`/`'hours'`/…) or `{expire: secs}`. */
|
|
88
|
+
type RevalidateProfile$1 = string | {
|
|
89
|
+
expire: number;
|
|
90
|
+
};
|
|
76
91
|
/**
|
|
77
92
|
* Invalidate every cache entry tagged with the products list. Call after a
|
|
78
|
-
* Server Action that creates / deletes / reorders products.
|
|
93
|
+
* Server Action that creates / deletes / reorders products. The optional
|
|
94
|
+
* `profile` is the Next 16 cacheLife profile (defaults to `'max'` SWR).
|
|
79
95
|
*/
|
|
80
|
-
declare function revalidateProducts(): Promise<void>;
|
|
96
|
+
declare function revalidateProducts(profile?: RevalidateProfile$1): Promise<void>;
|
|
81
97
|
/**
|
|
82
98
|
* Invalidate the cached detail of a single product (and the products list,
|
|
83
99
|
* since list-shaped caches typically embed each product's denormalized
|
|
84
100
|
* fields). Call after a Server Action that edits a product.
|
|
85
101
|
*/
|
|
86
|
-
declare function revalidateProduct(id: string): Promise<void>;
|
|
87
|
-
declare function revalidateCategories(): Promise<void>;
|
|
88
|
-
declare function revalidateCategory(id: string): Promise<void>;
|
|
89
|
-
declare function revalidateCollections(): Promise<void>;
|
|
90
|
-
declare function revalidateCollection(id: string): Promise<void>;
|
|
91
|
-
declare function revalidateBusiness(): Promise<void>;
|
|
102
|
+
declare function revalidateProduct(id: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
103
|
+
declare function revalidateCategories(profile?: RevalidateProfile$1): Promise<void>;
|
|
104
|
+
declare function revalidateCategory(id: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
105
|
+
declare function revalidateCollections(profile?: RevalidateProfile$1): Promise<void>;
|
|
106
|
+
declare function revalidateCollection(id: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
107
|
+
declare function revalidateBusiness(profile?: RevalidateProfile$1): Promise<void>;
|
|
108
|
+
declare function revalidateBrand(profile?: RevalidateProfile$1): Promise<void>;
|
|
109
|
+
declare function revalidateLocations(profile?: RevalidateProfile$1): Promise<void>;
|
|
110
|
+
declare function revalidateLocation(id: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
111
|
+
declare function revalidatePricing(profile?: RevalidateProfile$1): Promise<void>;
|
|
112
|
+
declare function revalidateAddOns(profile?: RevalidateProfile$1): Promise<void>;
|
|
113
|
+
declare function revalidateAddOn(id: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
114
|
+
declare function revalidateSubscriptions(profile?: RevalidateProfile$1): Promise<void>;
|
|
115
|
+
declare function revalidateSubscription(id: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
116
|
+
declare function revalidateStock(productId?: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
92
117
|
/**
|
|
93
118
|
* Escape hatch: invalidate by raw tag string. Prefer the typed helpers
|
|
94
119
|
* above where possible — they keep the tag scheme in one place.
|
|
95
120
|
*/
|
|
96
|
-
declare function revalidateByTag(tag: string): Promise<void>;
|
|
121
|
+
declare function revalidateByTag(tag: string, profile?: RevalidateProfile$1): Promise<void>;
|
|
122
|
+
|
|
123
|
+
/** Expire the products list with read-your-writes. Call from a Server Action that creates / deletes / reorders. */
|
|
124
|
+
declare function updateProducts(): Promise<void>;
|
|
125
|
+
/** Expire a single product + the products list with read-your-writes. */
|
|
126
|
+
declare function updateProduct(id: string): Promise<void>;
|
|
127
|
+
declare function updateCategories(): Promise<void>;
|
|
128
|
+
declare function updateCategory(id: string): Promise<void>;
|
|
129
|
+
declare function updateCollections(): Promise<void>;
|
|
130
|
+
declare function updateCollection(id: string): Promise<void>;
|
|
131
|
+
declare function updateBusiness(): Promise<void>;
|
|
132
|
+
declare function updateBrand(): Promise<void>;
|
|
133
|
+
declare function updateLocations(): Promise<void>;
|
|
134
|
+
declare function updateLocation(id: string): Promise<void>;
|
|
135
|
+
declare function updatePricing(): Promise<void>;
|
|
136
|
+
declare function updateAddOns(): Promise<void>;
|
|
137
|
+
declare function updateAddOn(id: string): Promise<void>;
|
|
138
|
+
declare function updateSubscriptions(): Promise<void>;
|
|
139
|
+
declare function updateSubscription(id: string): Promise<void>;
|
|
140
|
+
declare function updateStock(productId?: string): Promise<void>;
|
|
141
|
+
/** Escape hatch: expire a raw tag with read-your-writes. Prefer the typed helpers above. */
|
|
142
|
+
declare function updateByTag(tag: string): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Refresh uncached data on the current page (notification counts, live
|
|
145
|
+
* metrics, status indicators). Server-Action-only. Complements
|
|
146
|
+
* `router.refresh()` on the client.
|
|
147
|
+
*/
|
|
148
|
+
declare function refreshPage(): Promise<void>;
|
|
149
|
+
|
|
150
|
+
/** Next 16 `revalidateTag` profile arg — built-in name (`'max'`/`'hours'`/…) or inline `{expire: secs}`. */
|
|
151
|
+
type RevalidateProfile = string | {
|
|
152
|
+
expire: number;
|
|
153
|
+
};
|
|
154
|
+
interface RevalidateRouteOptions {
|
|
155
|
+
secret?: string;
|
|
156
|
+
revalidateTag?: (tag: string, profile: RevalidateProfile) => void;
|
|
157
|
+
now?: () => number;
|
|
158
|
+
defaultProfile?: RevalidateProfile;
|
|
159
|
+
}
|
|
160
|
+
declare function revalidateRouteHandler(req: Request, options?: RevalidateRouteOptions): Promise<Response>;
|
|
97
161
|
|
|
98
|
-
export { CimplifyClient, type ServerClientOptions, getServerClient, revalidateBusiness, revalidateByTag, revalidateCategories, revalidateCategory, revalidateCollection, revalidateCollections, revalidateProduct, revalidateProducts, tags };
|
|
162
|
+
export { CimplifyClient, type RevalidateProfile$1 as RevalidateProfile, type RevalidateRouteOptions, type RevalidateProfile as RevalidateRouteProfile, type ServerClientOptions, getServerClient, refreshPage, revalidateAddOn, revalidateAddOns, revalidateBrand, revalidateBusiness, revalidateByTag, revalidateCategories, revalidateCategory, revalidateCollection, revalidateCollections, revalidateLocation, revalidateLocations, revalidatePricing, revalidateProduct, revalidateProducts, revalidateRouteHandler, revalidateStock, revalidateSubscription, revalidateSubscriptions, tags, updateAddOn, updateAddOns, updateBrand, updateBusiness, updateByTag, updateCategories, updateCategory, updateCollection, updateCollections, updateLocation, updateLocations, updatePricing, updateProduct, updateProducts, updateStock, updateSubscription, updateSubscriptions };
|