@fayz-ai/storefront 0.52.0 → 0.56.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.
@@ -1050,6 +1050,8 @@ var ptBR = {
1050
1050
  "cart.checkout": "Finalizar compra",
1051
1051
  "cart.missingForFree": "Faltam {{amount}} para frete gr\xE1tis",
1052
1052
  "cart.wonFree": "Voc\xEA ganhou frete gr\xE1tis!",
1053
+ "cart.minimumOrder": "Pedido m\xEDnimo para entrega: {{amount}}. Faltam {{missing}}.",
1054
+ "delivery.eta": "Entrega em ~{{minutes}} min",
1053
1055
  // Deliver to
1054
1056
  "country.deliverTo": "Enviar para",
1055
1057
  "country.change": "Trocar pa\xEDs",
@@ -1177,6 +1179,8 @@ var en = {
1177
1179
  "cart.checkout": "Checkout",
1178
1180
  "cart.missingForFree": "{{amount}} away from free shipping",
1179
1181
  "cart.wonFree": "You got free shipping!",
1182
+ "cart.minimumOrder": "Minimum order for delivery: {{amount}}. {{missing}} to go.",
1183
+ "delivery.eta": "Delivery in ~{{minutes}} min",
1180
1184
  "country.deliverTo": "Deliver to",
1181
1185
  "country.change": "Change country",
1182
1186
  "country.label": "Delivery country"
@@ -1303,6 +1307,8 @@ var es = {
1303
1307
  "cart.checkout": "Finalizar compra",
1304
1308
  "cart.missingForFree": "Te faltan {{amount}} para el env\xEDo gratis",
1305
1309
  "cart.wonFree": "\xA1Tienes env\xEDo gratis!",
1310
+ "cart.minimumOrder": "Pedido m\xEDnimo para entrega: {{amount}}. Te faltan {{missing}}.",
1311
+ "delivery.eta": "Entrega en ~{{minutes}} min",
1306
1312
  "country.deliverTo": "Enviar a",
1307
1313
  "country.change": "Cambiar pa\xEDs",
1308
1314
  "country.label": "Pa\xEDs de env\xEDo"
@@ -6793,6 +6799,17 @@ function applyShippingSettings(config, shipping) {
6793
6799
  if (!shipping) return config;
6794
6800
  return { ...config, shipping: { flatRate: shipping.flatRate, freeAbove: shipping.freeAbove ?? void 0 } };
6795
6801
  }
6802
+ function applyDeliveryPolicy(config, policy) {
6803
+ if (!policy || !config.delivery) return config;
6804
+ return {
6805
+ ...config,
6806
+ delivery: {
6807
+ ...config.delivery,
6808
+ ...policy.etaMinutes ? { etaMinutes: policy.etaMinutes } : {},
6809
+ ...policy.minOrderTotal ? { minOrderTotal: policy.minOrderTotal } : {}
6810
+ }
6811
+ };
6812
+ }
6796
6813
  function applyBuyer(config, buyer) {
6797
6814
  if (!buyer) return config;
6798
6815
  const language = normalizeLanguage(buyer.language) ?? config.language;
@@ -6808,6 +6825,7 @@ function StorefrontConfigHost({
6808
6825
  }) {
6809
6826
  const [policy, setPolicy] = React38.useState(null);
6810
6827
  const [shipping, setShipping] = React38.useState(null);
6828
+ const [delivery, setDelivery] = React38.useState(null);
6811
6829
  React38.useEffect(() => {
6812
6830
  let cancelled = false;
6813
6831
  let provider;
@@ -6822,6 +6840,12 @@ function StorefrontConfigHost({
6822
6840
  }).catch(() => {
6823
6841
  });
6824
6842
  }
6843
+ if (config.delivery && typeof provider.getPublicDeliveryPolicy === "function") {
6844
+ void provider.getPublicDeliveryPolicy().then((saved) => {
6845
+ if (!cancelled) setDelivery(saved);
6846
+ }).catch(() => {
6847
+ });
6848
+ }
6825
6849
  if (typeof provider.getPublicStoreSettings !== "function") return;
6826
6850
  void provider.getPublicStoreSettings().then((settings) => {
6827
6851
  if (cancelled) return;
@@ -6840,8 +6864,8 @@ function StorefrontConfigHost({
6840
6864
  };
6841
6865
  }, [config]);
6842
6866
  const resolved = React38.useMemo(
6843
- () => applyBuyer(applyShippingSettings(applyStoreSettings(config, policy), shipping), buyer),
6844
- [config, policy, shipping, buyer?.language, buyer?.country]
6867
+ () => applyBuyer(applyDeliveryPolicy(applyShippingSettings(applyStoreSettings(config, policy), shipping), delivery), buyer),
6868
+ [config, policy, shipping, delivery, buyer?.language, buyer?.country]
6845
6869
  );
6846
6870
  return /* @__PURE__ */ jsx(StorefrontConfigProvider, { value: resolved, children: /* @__PURE__ */ jsx(MarketScope, { children }) });
6847
6871
  }
@@ -7879,6 +7903,8 @@ function CartDrawer() {
7879
7903
  if (!cart.isOpen) return null;
7880
7904
  const freeAbove = config.shipping.freeAbove;
7881
7905
  const missingForFree = freeAbove != null && subtotal < freeAbove ? freeAbove - subtotal : 0;
7906
+ const minOrder = config.delivery?.minOrderTotal ?? 0;
7907
+ const belowMinimum = minOrder > 0 && subtotal < minOrder;
7882
7908
  const progress = freeAbove != null ? Math.min(100, subtotal / freeAbove * 100) : 0;
7883
7909
  return /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50", children: [
7884
7910
  /* @__PURE__ */ jsx(
@@ -8096,16 +8122,18 @@ function CartDrawer() {
8096
8122
  /* @__PURE__ */ jsx("dd", { "data-testid": TID.cartTotal, "data-price": total.toFixed(2), children: money(total) })
8097
8123
  ] })
8098
8124
  ] }),
8125
+ belowMinimum && /* @__PURE__ */ jsx("p", { "data-testid": "cart-minimum-order", className: "mb-2 text-sm text-amber-700", children: t("cart.minimumOrder", { amount: money(minOrder), missing: money(minOrder - subtotal) }) }),
8099
8126
  /* @__PURE__ */ jsx(
8100
8127
  "button",
8101
8128
  {
8102
8129
  type: "button",
8103
8130
  "data-testid": TID.goCheckout,
8131
+ disabled: belowMinimum,
8104
8132
  onClick: () => {
8105
8133
  cart.closeDrawer();
8106
8134
  navigateTo("/checkout");
8107
8135
  },
8108
- className: "sf-cta w-full bg-primary py-3.5 font-semibold text-primary-foreground shadow-md transition-all hover:-translate-y-0.5 hover:shadow-lg",
8136
+ className: "sf-cta w-full bg-primary py-3.5 font-semibold text-primary-foreground shadow-md transition-all hover:-translate-y-0.5 hover:shadow-lg disabled:pointer-events-none disabled:opacity-50",
8109
8137
  style: { borderRadius: "var(--sf-radius-button)" },
8110
8138
  children: t("cart.checkout")
8111
8139
  }
@@ -10435,6 +10463,7 @@ function storeTime(iso, timeZone, options = {}) {
10435
10463
  }
10436
10464
  function StoreCover({ onShowHours }) {
10437
10465
  const config = useStorefrontConfig();
10466
+ const t = useT();
10438
10467
  const cover = config.delivery?.coverImage;
10439
10468
  const logo = config.delivery?.logoImage;
10440
10469
  const locality = config.delivery?.locality;
@@ -10472,6 +10501,7 @@ function StoreCover({ onShowHours }) {
10472
10501
  /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
10473
10502
  /* @__PURE__ */ jsx("h1", { className: "truncate text-xl font-bold leading-tight", children: config.name }),
10474
10503
  locality && /* @__PURE__ */ jsx("p", { className: "truncate text-sm text-white/70", children: locality }),
10504
+ config.delivery?.etaMinutes && type !== "pickup" && /* @__PURE__ */ jsx("p", { "data-testid": "store-eta", className: "truncate text-sm text-white/80", children: t("delivery.eta", { minutes: config.delivery.etaMinutes }) }),
10475
10505
  showsHours && service.service && // O estado é o botão que abre a placa da porta. Um selo que diz
10476
10506
  // "Fechado" e não leva a lugar nenhum deixa a pessoa sem a única
10477
10507
  // pergunta seguinte que ela tem: então quando abre?
@@ -14132,6 +14162,6 @@ ${formatErrors(report.errors)}`;
14132
14162
  return config;
14133
14163
  }
14134
14164
 
14135
- export { AddressForm, AddressSheet, AddressStrip, BEFORE_PLACE_ORDER_VALVE, BLOCK_STRUCTURAL_KEYS, BUYER_COUNTRY_COOKIE, BenefitsRow, BlockDataError, CART_LINE_ANNOTATION_POINT, CATALOG_BODY_BLOCK, CHECKOUT_FIELD_POINT, CartDrawer, CatalogPage, CategoryShowcase, CheckoutPage, ClosedStoreDialog, CollectionCta, CollectionHero, ContentPage, CountdownBand, CountrySelect, DeliverToPicker, EmailConfirmationRequiredError, EntityListBlock, FaqSection, FiltersPanel, FormBlock, HeroSection, ImageTiles, ItemSheet, Link, MESSAGES, ManifestoBlock, MediaCarousel, MenuItemRow, MenuPage, MenuToolbar, MotifStrip, MyPurchasesPage, NewsletterBand, ORDER_METADATA_POINT, OrderConfirmationPage, OrderTrackingTimeline, PAGE_DATA_SCRIPT_ID, PLACEHOLDER_ASPECTS, PRODUCT_BODY_BLOCK, PRODUCT_CARD_BADGE_POINT, PageDataScope, PaymentTerms, Price, ProductCard, ProductDetailPage, ProductEnquiryForm, ProductGallery, ProductGrid, ProductOptionSelector, ProductRail, ProductReviews, ProductSlider, ProductSpecs, ProductSpotlight, PromoBanner, QuantityInput, Reveal, STOREFRONT_COMPONENT_KEYS, STOREFRONT_PAGE_KINDS, STOREFRONT_SLOTS, STORE_BACKEND_PROVIDERS, STORE_COMMERCE_MODES, STORE_DOCUMENT_KIND, STORE_PAYMENT_METHOD_KINDS, STORE_PAYMENT_MODES, STORE_ROUTE_CHROMES, STORE_ROUTE_KINDS, STORE_SECTIONS, STORE_SECTION_NAMES, ScheduleSheet, SealsBand, SearchOverlay, ServiceHoursModal, Slot, SmoothImage, StepsSection, StoreCover, StorefrontConfigHost, StorefrontConfigProvider, StorefrontFooter, StorefrontHeader, StorefrontPage, StorefrontRouterProvider, StorefrontShell, StorefrontThemeStyle, StoryQuote, THEME_SCALE_FIELDS, THEME_SCALE_VAR_PREFIX, TID, Testimonials, TierCards, applyStoreSettings, bannerPlaceholder, blockInstanceId, buildEnquiryFromForm, checkPageBlocks, collectDataNeeds, collectOrderMetadata, contentPagePath, createStorefront, createStorefrontApp, currentStaticRenderPass, defaultPageBlocks, entityListBlockMeta, establishCustomerSession, exportStore, formatMoney, formatProductOptionSelection, getCartLineAnnotations, getCheckoutFieldContributions, getCustomerAuthAdapter, getProductCardBadges, getProductOptionGroups, hydrateStoreDocument, hydratedEntriesFor, initStorefrontRuntime, isJsonValue, isKnownPath, isNestedBlockRef, isPublicPath, isRecord, listSlots, marketForCountry, marketUnitPrice, matchContentPage, matchPath, matchesFacets, mergeCollectionFacet, mergePageTheme, navigateTo, nextMilestone, normalizeLanguage, normalizeProductOptionSelection, orderGalleryImages, overrideComponent, overrideProps, pageSeo, pageThemeSelector, pickProductCardImage, placeStorefrontOrder, prefersReducedMotion, primaryImageUrl, productCardComponentContract, productJsonLd, productOptionSelectionKey, productPlaceholder, productSeo, readHydratedPageData, registerStorefrontBlocks, registerStorefrontEntities, registerStorefrontExtensionPoints, registerStorefrontLoaders, resetPageDiagnostics, resetProductOptionsDeprecationWarnings, resetStorefrontExtensionPoints, resolveAuthAdapter, resolveConfig, resolveDataParams, resolveOverride, resolvePageData, resolvePageDataNeed, resolvePaymentTerms, resolveStorefrontProvider, resolveStorefrontRoute, resolveVariantForSelection, roundCents, routePathParams, runBeforePlaceOrderValve, sectionToJsonSchema, sectionsToBlocks, selectCount, selectDiscountTotal, selectIsOpen, selectRequiresShipping, selectShipping, selectShowsHours, selectSubtotal, selectTotal, selectionPrice, serializePageData, shellRouterAdapter, signInByEmail, signOutCustomer, signUpCustomer, slugifyStoreName, storefrontComponentContracts, storefrontPaths, themeToCss, toBlockNodes, toFacetMap, translate, useBlockData, useBuyerCountry, useBuyerStore, useCartStore, useCatalogStore, useCategories, useDeliveryStore, useDiscountValidator, useEnquiry, useHashPath, useInView, useLoader, useMarketProduct, useMarketStore, useMyOrders, useNavigate, usePopOnChange, useProduct, useProducts, useRoutePath, useRouterAdapter, useScrollToTopOnNavigate, useScrolled, useServiceStore, useSessionStore, useSlotContext, useStorefrontActions, useStorefrontConfig, useStorefrontConfigOptional, useStorefrontHead, useStorefrontPage, useStorefrontPageOptional, useT, usedSlots, validateStore, withFacet, withMarketPrice, withStaticRenderPass };
14136
- //# sourceMappingURL=chunk-PU7DSP2T.js.map
14137
- //# sourceMappingURL=chunk-PU7DSP2T.js.map
14165
+ export { AddressForm, AddressSheet, AddressStrip, BEFORE_PLACE_ORDER_VALVE, BLOCK_STRUCTURAL_KEYS, BUYER_COUNTRY_COOKIE, BenefitsRow, BlockDataError, CART_LINE_ANNOTATION_POINT, CATALOG_BODY_BLOCK, CHECKOUT_FIELD_POINT, CartDrawer, CatalogPage, CategoryShowcase, CheckoutPage, ClosedStoreDialog, CollectionCta, CollectionHero, ContentPage, CountdownBand, CountrySelect, DeliverToPicker, EmailConfirmationRequiredError, EntityListBlock, FaqSection, FiltersPanel, FormBlock, HeroSection, ImageTiles, ItemSheet, Link, MESSAGES, ManifestoBlock, MediaCarousel, MenuItemRow, MenuPage, MenuToolbar, MotifStrip, MyPurchasesPage, NewsletterBand, ORDER_METADATA_POINT, OrderConfirmationPage, OrderTrackingTimeline, PAGE_DATA_SCRIPT_ID, PLACEHOLDER_ASPECTS, PRODUCT_BODY_BLOCK, PRODUCT_CARD_BADGE_POINT, PageDataScope, PaymentTerms, Price, ProductCard, ProductDetailPage, ProductEnquiryForm, ProductGallery, ProductGrid, ProductOptionSelector, ProductRail, ProductReviews, ProductSlider, ProductSpecs, ProductSpotlight, PromoBanner, QuantityInput, Reveal, STOREFRONT_COMPONENT_KEYS, STOREFRONT_PAGE_KINDS, STOREFRONT_SLOTS, STORE_BACKEND_PROVIDERS, STORE_COMMERCE_MODES, STORE_DOCUMENT_KIND, STORE_PAYMENT_METHOD_KINDS, STORE_PAYMENT_MODES, STORE_ROUTE_CHROMES, STORE_ROUTE_KINDS, STORE_SECTIONS, STORE_SECTION_NAMES, ScheduleSheet, SealsBand, SearchOverlay, ServiceHoursModal, Slot, SmoothImage, StepsSection, StoreCover, StorefrontConfigHost, StorefrontConfigProvider, StorefrontFooter, StorefrontHeader, StorefrontPage, StorefrontRouterProvider, StorefrontShell, StorefrontThemeStyle, StoryQuote, THEME_SCALE_FIELDS, THEME_SCALE_VAR_PREFIX, TID, Testimonials, TierCards, applyDeliveryPolicy, applyStoreSettings, bannerPlaceholder, blockInstanceId, buildEnquiryFromForm, checkPageBlocks, collectDataNeeds, collectOrderMetadata, contentPagePath, createStorefront, createStorefrontApp, currentStaticRenderPass, defaultPageBlocks, entityListBlockMeta, establishCustomerSession, exportStore, formatMoney, formatProductOptionSelection, getCartLineAnnotations, getCheckoutFieldContributions, getCustomerAuthAdapter, getProductCardBadges, getProductOptionGroups, hydrateStoreDocument, hydratedEntriesFor, initStorefrontRuntime, isJsonValue, isKnownPath, isNestedBlockRef, isPublicPath, isRecord, listSlots, marketForCountry, marketUnitPrice, matchContentPage, matchPath, matchesFacets, mergeCollectionFacet, mergePageTheme, navigateTo, nextMilestone, normalizeLanguage, normalizeProductOptionSelection, orderGalleryImages, overrideComponent, overrideProps, pageSeo, pageThemeSelector, pickProductCardImage, placeStorefrontOrder, prefersReducedMotion, primaryImageUrl, productCardComponentContract, productJsonLd, productOptionSelectionKey, productPlaceholder, productSeo, readHydratedPageData, registerStorefrontBlocks, registerStorefrontEntities, registerStorefrontExtensionPoints, registerStorefrontLoaders, resetPageDiagnostics, resetProductOptionsDeprecationWarnings, resetStorefrontExtensionPoints, resolveAuthAdapter, resolveConfig, resolveDataParams, resolveOverride, resolvePageData, resolvePageDataNeed, resolvePaymentTerms, resolveStorefrontProvider, resolveStorefrontRoute, resolveVariantForSelection, roundCents, routePathParams, runBeforePlaceOrderValve, sectionToJsonSchema, sectionsToBlocks, selectCount, selectDiscountTotal, selectIsOpen, selectRequiresShipping, selectShipping, selectShowsHours, selectSubtotal, selectTotal, selectionPrice, serializePageData, shellRouterAdapter, signInByEmail, signOutCustomer, signUpCustomer, slugifyStoreName, storefrontComponentContracts, storefrontPaths, themeToCss, toBlockNodes, toFacetMap, translate, useBlockData, useBuyerCountry, useBuyerStore, useCartStore, useCatalogStore, useCategories, useDeliveryStore, useDiscountValidator, useEnquiry, useHashPath, useInView, useLoader, useMarketProduct, useMarketStore, useMyOrders, useNavigate, usePopOnChange, useProduct, useProducts, useRoutePath, useRouterAdapter, useScrollToTopOnNavigate, useScrolled, useServiceStore, useSessionStore, useSlotContext, useStorefrontActions, useStorefrontConfig, useStorefrontConfigOptional, useStorefrontHead, useStorefrontPage, useStorefrontPageOptional, useT, usedSlots, validateStore, withFacet, withMarketPrice, withStaticRenderPass };
14166
+ //# sourceMappingURL=chunk-PJQVLRF7.js.map
14167
+ //# sourceMappingURL=chunk-PJQVLRF7.js.map