@fayz-ai/storefront 0.56.0 → 0.57.2

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.
@@ -1051,7 +1051,10 @@ var ptBR = {
1051
1051
  "cart.missingForFree": "Faltam {{amount}} para frete gr\xE1tis",
1052
1052
  "cart.wonFree": "Voc\xEA ganhou frete gr\xE1tis!",
1053
1053
  "cart.minimumOrder": "Pedido m\xEDnimo para entrega: {{amount}}. Faltam {{missing}}.",
1054
- "delivery.eta": "Entrega em ~{{minutes}} min",
1054
+ "delivery.eta": "Entrega em ~{{duration}}",
1055
+ "delivery.etaUpTo": "Entrega em at\xE9 {{duration}}",
1056
+ "delivery.paused": "Delivery fechado no momento",
1057
+ "cart.deliveryPaused": "O delivery est\xE1 fechado no momento. Volte mais tarde para finalizar.",
1055
1058
  // Deliver to
1056
1059
  "country.deliverTo": "Enviar para",
1057
1060
  "country.change": "Trocar pa\xEDs",
@@ -1180,7 +1183,10 @@ var en = {
1180
1183
  "cart.missingForFree": "{{amount}} away from free shipping",
1181
1184
  "cart.wonFree": "You got free shipping!",
1182
1185
  "cart.minimumOrder": "Minimum order for delivery: {{amount}}. {{missing}} to go.",
1183
- "delivery.eta": "Delivery in ~{{minutes}} min",
1186
+ "delivery.eta": "Delivery in ~{{duration}}",
1187
+ "delivery.etaUpTo": "Delivery within {{duration}}",
1188
+ "delivery.paused": "Delivery closed right now",
1189
+ "cart.deliveryPaused": "Delivery is closed right now. Come back later to check out.",
1184
1190
  "country.deliverTo": "Deliver to",
1185
1191
  "country.change": "Change country",
1186
1192
  "country.label": "Delivery country"
@@ -6806,7 +6812,8 @@ function applyDeliveryPolicy(config, policy) {
6806
6812
  delivery: {
6807
6813
  ...config.delivery,
6808
6814
  ...policy.etaMinutes ? { etaMinutes: policy.etaMinutes } : {},
6809
- ...policy.minOrderTotal ? { minOrderTotal: policy.minOrderTotal } : {}
6815
+ ...policy.minOrderTotal ? { minOrderTotal: policy.minOrderTotal } : {},
6816
+ ...policy.paused ? { paused: true } : {}
6810
6817
  }
6811
6818
  };
6812
6819
  }
@@ -7905,6 +7912,7 @@ function CartDrawer() {
7905
7912
  const missingForFree = freeAbove != null && subtotal < freeAbove ? freeAbove - subtotal : 0;
7906
7913
  const minOrder = config.delivery?.minOrderTotal ?? 0;
7907
7914
  const belowMinimum = minOrder > 0 && subtotal < minOrder;
7915
+ const paused = Boolean(config.delivery?.paused);
7908
7916
  const progress = freeAbove != null ? Math.min(100, subtotal / freeAbove * 100) : 0;
7909
7917
  return /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50", children: [
7910
7918
  /* @__PURE__ */ jsx(
@@ -8122,13 +8130,14 @@ function CartDrawer() {
8122
8130
  /* @__PURE__ */ jsx("dd", { "data-testid": TID.cartTotal, "data-price": total.toFixed(2), children: money(total) })
8123
8131
  ] })
8124
8132
  ] }),
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) }) }),
8133
+ paused && /* @__PURE__ */ jsx("p", { "data-testid": "cart-delivery-paused", className: "mb-2 text-sm text-amber-700", children: t("cart.deliveryPaused") }),
8134
+ !paused && 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) }) }),
8126
8135
  /* @__PURE__ */ jsx(
8127
8136
  "button",
8128
8137
  {
8129
8138
  type: "button",
8130
8139
  "data-testid": TID.goCheckout,
8131
- disabled: belowMinimum,
8140
+ disabled: belowMinimum || paused,
8132
8141
  onClick: () => {
8133
8142
  cart.closeDrawer();
8134
8143
  navigateTo("/checkout");
@@ -10461,6 +10470,19 @@ function storeTime(iso, timeZone, options = {}) {
10461
10470
  timeZone
10462
10471
  }).format(new Date(iso));
10463
10472
  }
10473
+
10474
+ // src/lib/eta.ts
10475
+ function etaParts(minutes) {
10476
+ if (!Number.isFinite(minutes) || minutes <= 0) return null;
10477
+ const m = Math.round(minutes);
10478
+ if (m < 60) return { approx: true, text: `${m} min` };
10479
+ if (m < 1440) {
10480
+ const h = Math.floor(m / 60);
10481
+ const rest = m % 60;
10482
+ return { approx: true, text: rest ? `${h} h ${rest} min` : `${h} h` };
10483
+ }
10484
+ return { approx: false, text: `${Math.ceil(m / 60)} h` };
10485
+ }
10464
10486
  function StoreCover({ onShowHours }) {
10465
10487
  const config = useStorefrontConfig();
10466
10488
  const t = useT();
@@ -10501,7 +10523,13 @@ function StoreCover({ onShowHours }) {
10501
10523
  /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
10502
10524
  /* @__PURE__ */ jsx("h1", { className: "truncate text-xl font-bold leading-tight", children: config.name }),
10503
10525
  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 }) }),
10526
+ config.delivery?.paused ? /* @__PURE__ */ jsxs("p", { "data-testid": "store-delivery-paused", className: "mt-0.5 inline-flex items-center gap-1.5 truncate text-sm font-semibold text-amber-300", children: [
10527
+ /* @__PURE__ */ jsx("span", { className: "h-2 w-2 shrink-0 rounded-full bg-amber-400", "aria-hidden": true }),
10528
+ t("delivery.paused")
10529
+ ] }) : (() => {
10530
+ const eta = type !== "pickup" && config.delivery?.etaMinutes ? etaParts(config.delivery.etaMinutes) : null;
10531
+ return eta ? /* @__PURE__ */ jsx("p", { "data-testid": "store-eta", className: "truncate text-sm text-white/80", children: t(eta.approx ? "delivery.eta" : "delivery.etaUpTo", { duration: eta.text }) }) : null;
10532
+ })(),
10505
10533
  showsHours && service.service && // O estado é o botão que abre a placa da porta. Um selo que diz
10506
10534
  // "Fechado" e não leva a lugar nenhum deixa a pessoa sem a única
10507
10535
  // pergunta seguinte que ela tem: então quando abre?
@@ -10575,7 +10603,7 @@ function AddressStrip({
10575
10603
  const option = delivery.options.find((o) => o.zoneId === delivery.selectedZoneId) ?? delivery.options[0];
10576
10604
  const chosen = delivery.savedAddresses.find((a) => a.id === delivery.selectedAddressId);
10577
10605
  const pickup = config.delivery?.pickupAddress;
10578
- const feeLine = isPickup ? "Sem taxa de entrega" : option ? option.free ? "Entrega gr\xE1tis" : money(option.rate) : `A partir de ${money(config.shipping.flatRate)}`;
10606
+ const feeLine = isPickup ? "Sem taxa de entrega" : option ? option.free ? "Entrega gr\xE1tis" : money(option.rate) : config.shipping.flatRate > 0 ? `A partir de ${money(config.shipping.flatRate)}` : "Taxa conforme o endere\xE7o";
10579
10607
  const etaLine = option?.etaMaxDays != null ? ` \u2022 at\xE9 ${option.etaMaxDays} dia(s)` : "";
10580
10608
  return /* @__PURE__ */ jsxs("div", { "data-testid": TID.addressStrip, className: "border-b border-border bg-background", children: [
10581
10609
  /* @__PURE__ */ jsxs(
@@ -11170,7 +11198,8 @@ function ServiceHoursModal({ onClose }) {
11170
11198
  }
11171
11199
  function ClosedStoreDialog({
11172
11200
  onClose,
11173
- onShowHours
11201
+ onShowHours,
11202
+ paused = false
11174
11203
  }) {
11175
11204
  const state = useServiceStore();
11176
11205
  const tz = state.service?.timezone ?? "America/Sao_Paulo";
@@ -11183,9 +11212,9 @@ function ClosedStoreDialog({
11183
11212
  "data-testid": TID.serviceClosedGate,
11184
11213
  className: "fixed inset-0 z-[60] grid place-items-center bg-black/50 p-4",
11185
11214
  children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-sm rounded-2xl bg-background p-6 text-center", children: [
11186
- /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: "Nossa loja est\xE1 fechada no momento" }),
11187
- /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: next ? `Abrimos ${storeTime(next, tz, { weekday: true })}. Enquanto isso, fique \xE0 vontade para olhar o card\xE1pio.` : "Enquanto isso, fique \xE0 vontade para olhar o card\xE1pio." }),
11188
- /* @__PURE__ */ jsx(
11215
+ /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: paused ? "Nosso delivery est\xE1 fechado no momento" : "Nossa loja est\xE1 fechada no momento" }),
11216
+ /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: paused ? "Voltamos em breve. Enquanto isso, fique \xE0 vontade para olhar o card\xE1pio." : next ? `Abrimos ${storeTime(next, tz, { weekday: true })}. Enquanto isso, fique \xE0 vontade para olhar o card\xE1pio.` : "Enquanto isso, fique \xE0 vontade para olhar o card\xE1pio." }),
11217
+ !paused && /* @__PURE__ */ jsx(
11189
11218
  "button",
11190
11219
  {
11191
11220
  type: "button",
@@ -11194,7 +11223,7 @@ function ClosedStoreDialog({
11194
11223
  children: "Ver hor\xE1rios de funcionamento"
11195
11224
  }
11196
11225
  ),
11197
- /* @__PURE__ */ jsx("button", { type: "button", onClick: onClose, className: "mt-3 w-full py-2 text-sm font-medium", children: "OK, entendi" })
11226
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: onClose, className: `${paused ? "mt-5" : "mt-3"} w-full py-2 text-sm font-medium`, children: "OK, entendi" })
11198
11227
  ] })
11199
11228
  }
11200
11229
  );
@@ -11492,7 +11521,8 @@ function MenuPage() {
11492
11521
  const [query, setQuery] = React38.useState("");
11493
11522
  const serviceState = useServiceStore();
11494
11523
  const refreshService = useServiceStore((s2) => s2.refresh);
11495
- const isOpen = selectIsOpen(serviceState);
11524
+ const paused = Boolean(config.delivery?.paused);
11525
+ const isOpen = selectIsOpen(serviceState) && !paused;
11496
11526
  React38.useEffect(() => {
11497
11527
  void refreshService();
11498
11528
  }, [refreshService]);
@@ -11656,7 +11686,7 @@ function MenuPage() {
11656
11686
  product: openProduct,
11657
11687
  onClose: () => setOpenProduct(null),
11658
11688
  disabled: !isOpen,
11659
- disabledReason: !isOpen ? "A loja est\xE1 fechada no momento." : void 0,
11689
+ disabledReason: !isOpen ? paused ? "O delivery est\xE1 fechado no momento." : "A loja est\xE1 fechada no momento." : void 0,
11660
11690
  onAdd: ({ quantity, options, notes }) => {
11661
11691
  guarded(() => {
11662
11692
  addToCart(openProduct, quantity, options, notes);
@@ -11692,6 +11722,7 @@ function MenuPage() {
11692
11722
  showClosed && /* @__PURE__ */ jsx(
11693
11723
  ClosedStoreDialog,
11694
11724
  {
11725
+ paused,
11695
11726
  onClose: () => setShowClosed(false),
11696
11727
  onShowHours: () => {
11697
11728
  setShowClosed(false);
@@ -14163,5 +14194,5 @@ ${formatErrors(report.errors)}`;
14163
14194
  }
14164
14195
 
14165
14196
  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
14197
+ //# sourceMappingURL=chunk-SYEYTE4D.js.map
14198
+ //# sourceMappingURL=chunk-SYEYTE4D.js.map