@fayz-ai/plugin-shop 0.22.0 → 0.23.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/index.d.ts.map +1 -1
- package/dist/index.js +120 -16
- package/dist/index.js.map +1 -1
- package/dist/settings/DeliveryStoreSettings.d.ts +6 -0
- package/dist/settings/DeliveryStoreSettings.d.ts.map +1 -0
- package/dist/settings/ShippingSettings.d.ts +8 -1
- package/dist/settings/ShippingSettings.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAkC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAkC5E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AA2B5D,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,CAAA;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,wEAAwE;IACxE,aAAa,CAAC,EAAE,OAAO,CAAC,MAAM,CAC1B,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,UAAU,GAC9D,aAAa,GAAG,YAAY,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,GAC3E,gBAAgB,GAAG,kBAAkB,GAAG,OAAO,EAAE,MAAM,CAAC,CAAC,CAA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MAAM,kBAAkB,CAAA;IAClC,iDAAiD;IACjD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,SAAS,CAQZ;AAGD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAE7D;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,QAAQ,EAAE,MAAM,kBAAkB,CAAA;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,SAAS,CAQZ;AAED,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAG3D,YAAY,EACV,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAChD,kBAAkB,EAAE,kBAAkB,EAAE,mBAAmB,EAC3D,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,GACtD,MAAM,eAAe,CAAA;AAItB,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,MAAM,0CAA0C,CAAA;AAC7I,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAA;AACtH,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAA;AACtI,OAAO,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,gCAAgC,EAAE,MAAM,4CAA4C,CAAA;AACrJ,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAA;AAClH,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { errorMessage, shopCustomerLookup, resolve, invalidateProductLists, listProductsDetailed, applyQuery,
|
|
1
|
+
import { errorMessage, shopCustomerLookup, resolve, invalidateProductLists, listProductsDetailed, applyQuery, buildShopRegistries, locationSummary, LOCATIONS_REGISTRY, SHIPPING_ZONES_REGISTRY, listProductsCached, resolveTerm, candidateMeta, SHIPPING_PROFILES_REGISTRY, packageMeasureLabel, packagesRegistry, PACKAGES_REGISTRY, marketsRegistry } from './chunk-XV3KZRQX.js';
|
|
2
2
|
import * as React14 from 'react';
|
|
3
3
|
import React14__default, { useState, useEffect, useMemo, useRef, useCallback } from 'react';
|
|
4
4
|
import { createConnectionStore, connectionSettings, connectionStatus, settingsStatus, connectionRuns, tl, getActiveTenantId, getSupabaseClientOptional, registerMessageDefaults, registerComponent, formatCurrency, connectorRuntimeToken, CONNECTOR_RUNTIME_TOKEN_HEADER, countByTenant, describeError, errorMessage as errorMessage$1, emitDataChanged, resolveDataProvider } from '@fayz-ai/core';
|
|
5
5
|
import { getShopTenantId, setShopTenantResolver, buildShopMessageDefaults, registerShippingLabelProvider, getShopProvider, buildShopDomainEvents, axesFromOptions, planVariantMatrix, validateVariantAxes, hasOnlyDefaultVariant, MAX_VARIANT_AXES, leavesNothingSellable, productImageToMediaFile, formatVariantCombination, applyVariantMatrix } from '@fayz-ai/shop';
|
|
6
|
-
import { fayzConnectorOAuth, describeConnectorAccount, useOrganizationStore, registerEntityPath, registerPersonLookup, createCrudPage, registerCrudNavTabs, adminNavigateTo, DetailTabHeader, AskAIButton, PageActions, useAgentSurface, askAI,
|
|
7
|
-
import { Package, Eye, FileEdit, PackageX, Users, UsersRound, Filter, UserX, Tag, TicketCheck, Layers, CreditCard, CircleDollarSign, Plus, UploadCloud, Upload, ImageOff, Loader2, WandSparkles, ChevronLeft, ChevronRight, Download, RefreshCw, Trash2,
|
|
8
|
-
import { Skeleton, Badge, CurrencyInput, Button, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, PageTabs, PageHeaderActions, Card, Modal, ModalContent, ModalHeader, ModalTitle, ModalDescription, Input, ModalFooter, Thumbnail, PageHeader, toast, ConfirmDialog, Checkbox, Hint,
|
|
6
|
+
import { fayzConnectorOAuth, describeConnectorAccount, useOrganizationStore, registerEntityPath, registerPersonLookup, createCrudPage, registerCrudNavTabs, adminNavigateTo, DetailTabHeader, AskAIButton, PageActions, SettingsGroup, ToggleRow, useAgentSurface, askAI, TextRow, useConnectors, useConnectorsPanelAvailable, openConnectorsPanel, RegistryCrudView, ConnectorRow, ConnectorDetail, CrudFormPage, SelectRow, MultiSelectRow, AddConnectorButton, AddConnectorPanel, ConnectorMark, StateChip } from '@fayz-ai/admin';
|
|
7
|
+
import { Package, Eye, FileEdit, PackageX, Users, UsersRound, Filter, UserX, Tag, TicketCheck, Layers, CreditCard, CircleDollarSign, Plus, UploadCloud, Upload, ImageOff, Loader2, WandSparkles, ChevronLeft, ChevronRight, Download, RefreshCw, Trash2, ArrowRight, AlertTriangle, Warehouse, MapPin, Car, Truck, X, ExternalLink, Box, ChevronDown, Film, FileText, Sparkles, Ban, ListChecks, Check, Search, Building2, Info } from 'lucide-react';
|
|
8
|
+
import { Skeleton, Badge, CurrencyInput, Button, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, PageTabs, PageHeaderActions, Card, Modal, ModalContent, ModalHeader, ModalTitle, ModalDescription, Input, ModalFooter, Thumbnail, PageHeader, toast, ConfirmDialog, Checkbox, Hint, DataTable, ModalBody } from '@fayz-ai/ui';
|
|
9
9
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
import { listStockReasonCodes, resolveStockStore, createSupabaseStockStore } from '@fayz-ai/shop/inventory';
|
|
11
11
|
import { normalizeMovementType } from '@fayz-ai/inventory/domain/movement';
|
|
@@ -4616,8 +4616,8 @@ function AreaSearch({ provider, outcome, placeholder, onlyCityCodes, emptyHint }
|
|
|
4616
4616
|
const [unavailable, setUnavailable] = React14__default.useState(false);
|
|
4617
4617
|
const [justAdded, setJustAdded] = React14__default.useState(null);
|
|
4618
4618
|
React14__default.useEffect(() => {
|
|
4619
|
-
const
|
|
4620
|
-
if (
|
|
4619
|
+
const text4 = query.trim();
|
|
4620
|
+
if (text4.length < MIN_QUERY) {
|
|
4621
4621
|
setResults(null);
|
|
4622
4622
|
return void 0;
|
|
4623
4623
|
}
|
|
@@ -4632,7 +4632,7 @@ function AreaSearch({ provider, outcome, placeholder, onlyCityCodes, emptyHint }
|
|
|
4632
4632
|
}
|
|
4633
4633
|
return;
|
|
4634
4634
|
}
|
|
4635
|
-
void shop.findAreas(
|
|
4635
|
+
void shop.findAreas(text4, 10).then((list) => {
|
|
4636
4636
|
if (!cancelled) {
|
|
4637
4637
|
setResults(list);
|
|
4638
4638
|
setUnavailable(false);
|
|
@@ -5084,7 +5084,8 @@ var FREIGHT_SOURCE = [
|
|
|
5084
5084
|
Icon: Truck
|
|
5085
5085
|
}
|
|
5086
5086
|
];
|
|
5087
|
-
function ShippingSettings({ provider }) {
|
|
5087
|
+
function ShippingSettings({ provider, variant = "full" }) {
|
|
5088
|
+
const embedded = variant === "delivery";
|
|
5088
5089
|
const [registryId, setRegistryId] = React14__default.useState(shippingRegistryIdFromHash);
|
|
5089
5090
|
React14__default.useEffect(() => {
|
|
5090
5091
|
const handler = () => setRegistryId(shippingRegistryIdFromHash());
|
|
@@ -5207,6 +5208,16 @@ function ShippingSettings({ provider }) {
|
|
|
5207
5208
|
}
|
|
5208
5209
|
);
|
|
5209
5210
|
}
|
|
5211
|
+
if (!embedded && storeSettings.value.deliveryFlow) {
|
|
5212
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-card p-5 text-sm shadow-sm", "data-testid": "shipping-is-delivery", children: [
|
|
5213
|
+
/* @__PURE__ */ jsx("p", { className: "font-medium", children: "Esta loja \xE9 um delivery" }),
|
|
5214
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-muted-foreground", children: "Taxa de entrega, frete gr\xE1tis, regi\xF5es, pedido m\xEDnimo e tempo estimado ficam em Configura\xE7\xF5es \u203A Delivery. Esta tela \xE9 das lojas que despacham por transportadora." }),
|
|
5215
|
+
/* @__PURE__ */ jsxs(Button, { className: "mt-3", size: "sm", onClick: () => adminNavigateTo("/settings/orders-delivery"), children: [
|
|
5216
|
+
"Abrir Delivery ",
|
|
5217
|
+
/* @__PURE__ */ jsx(ArrowRight, { className: "ml-1 h-3.5 w-3.5" })
|
|
5218
|
+
] })
|
|
5219
|
+
] });
|
|
5220
|
+
}
|
|
5210
5221
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
5211
5222
|
loadError && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-destructive/30 bg-destructive/5 p-3 text-sm", children: [
|
|
5212
5223
|
/* @__PURE__ */ jsxs("p", { className: "flex items-center gap-2 font-medium text-destructive", children: [
|
|
@@ -5229,13 +5240,13 @@ function ShippingSettings({ provider }) {
|
|
|
5229
5240
|
] }) : /* @__PURE__ */ jsxs(
|
|
5230
5241
|
SettingsGroup,
|
|
5231
5242
|
{
|
|
5232
|
-
title: "Pre\xE7o base",
|
|
5233
|
-
description: "O que a loja cobra quando nenhuma zona cobre o endere\xE7o. Uma zona que cobre o CEP sempre ganha deste n\xFAmero.",
|
|
5243
|
+
title: embedded ? "Quanto custa a entrega" : "Pre\xE7o base",
|
|
5244
|
+
description: embedded ? "O que o site cobra para entregar quando nenhuma regi\xE3o abaixo tem pre\xE7o pr\xF3prio." : "O que a loja cobra quando nenhuma zona cobre o endere\xE7o. Uma zona que cobre o CEP sempre ganha deste n\xFAmero.",
|
|
5234
5245
|
children: [
|
|
5235
5246
|
/* @__PURE__ */ jsx(
|
|
5236
5247
|
TextRow,
|
|
5237
5248
|
{
|
|
5238
|
-
label: "Frete padr\xE3o",
|
|
5249
|
+
label: embedded ? "Taxa de entrega" : "Frete padr\xE3o",
|
|
5239
5250
|
description: "Em reais. Deixe 0 para entrega gr\xE1tis.",
|
|
5240
5251
|
value: flatDraft,
|
|
5241
5252
|
onChange: setFlatDraft,
|
|
@@ -5263,7 +5274,7 @@ function ShippingSettings({ provider }) {
|
|
|
5263
5274
|
]
|
|
5264
5275
|
}
|
|
5265
5276
|
),
|
|
5266
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
5277
|
+
!embedded && /* @__PURE__ */ jsxs("div", { children: [
|
|
5267
5278
|
/* @__PURE__ */ jsxs("div", { className: "px-1 pb-1 pt-4", children: [
|
|
5268
5279
|
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: "De onde voc\xEA despacha" }),
|
|
5269
5280
|
/* @__PURE__ */ jsx("p", { className: "mt-0.5 text-[10px] text-muted-foreground", children: "Os locais que guardam estoque e despacham pedidos. O CEP do local padr\xE3o \xE9 a origem que a transportadora usa para cotar o frete \u2014 \xE9 aqui que ele se cadastra, uma vez. Cada local pode ter o seu pr\xF3prio despachante ou seguir a decis\xE3o da loja." })
|
|
@@ -5342,8 +5353,8 @@ function ShippingSettings({ provider }) {
|
|
|
5342
5353
|
}
|
|
5343
5354
|
) })
|
|
5344
5355
|
] }),
|
|
5345
|
-
/* @__PURE__ */ jsx(PackagesSettings, {}),
|
|
5346
|
-
storeSettings.supported && /* @__PURE__ */ jsxs("div", { children: [
|
|
5356
|
+
!embedded && /* @__PURE__ */ jsx(PackagesSettings, {}),
|
|
5357
|
+
!embedded && storeSettings.supported && /* @__PURE__ */ jsxs("div", { children: [
|
|
5347
5358
|
/* @__PURE__ */ jsxs("div", { className: "px-1 pb-1 pt-4", children: [
|
|
5348
5359
|
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: "Quem calcula o frete" }),
|
|
5349
5360
|
/* @__PURE__ */ jsx("p", { className: "mt-0.5 text-[10px] text-muted-foreground", children: "O Melhor Envio n\xE3o \xE9 uma transportadora: \xE9 um gateway, uma conex\xE3o s\xF3 que traz Correios, Jadlog, Loggi e outras. Ent\xE3o a escolha aqui n\xE3o \xE9 qual transportadora \u2014 \xE9 se a loja calcula pelas pr\xF3prias faixas ou se pergunta o pre\xE7o a um gateway." })
|
|
@@ -5363,7 +5374,7 @@ function ShippingSettings({ provider }) {
|
|
|
5363
5374
|
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "H\xE1 um gateway ainda conectado abaixo. Para garantir que nenhum pre\xE7o de transportadora apare\xE7a no checkout, desconecte-o \u2014 a escolha acima vale para a vitrine, a conex\xE3o continua existindo." })
|
|
5364
5375
|
] })
|
|
5365
5376
|
] }),
|
|
5366
|
-
carriers.length > 0 && /* @__PURE__ */ jsxs("div", { className: usesGateway ? void 0 : "opacity-60", children: [
|
|
5377
|
+
!embedded && carriers.length > 0 && /* @__PURE__ */ jsxs("div", { className: usesGateway ? void 0 : "opacity-60", children: [
|
|
5367
5378
|
/* @__PURE__ */ jsxs("div", { className: "px-1 pb-1 pt-4", children: [
|
|
5368
5379
|
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: "Gateway de frete" }),
|
|
5369
5380
|
/* @__PURE__ */ jsx("p", { className: "mt-0.5 text-[10px] text-muted-foreground", children: "Conectado, ele cota o frete para o CEP do comprador em vez de a loja adivinhar. O pre\xE7o cotado \xE9 gravado no servidor e \xE9 ele que o pedido cobra \u2014 o navegador escolhe entre op\xE7\xF5es, nunca informa um valor. Quais transportadoras aparecem vem da conta do gateway, n\xE3o desta lista." }),
|
|
@@ -5371,7 +5382,7 @@ function ShippingSettings({ provider }) {
|
|
|
5371
5382
|
] }),
|
|
5372
5383
|
/* @__PURE__ */ jsx("div", { className: "rounded-card border bg-card shadow-sm", children: /* @__PURE__ */ jsx("ul", { className: "divide-y", children: carriers.map((connector) => /* @__PURE__ */ jsx(ConnectorRow, { connector, onOpen: openJourney }, connector.id)) }) })
|
|
5373
5384
|
] }),
|
|
5374
|
-
/* @__PURE__ */ jsx(HandlingSettings, { settings: storeSettings, provider }),
|
|
5385
|
+
!embedded && /* @__PURE__ */ jsx(HandlingSettings, { settings: storeSettings, provider }),
|
|
5375
5386
|
/* @__PURE__ */ jsx("div", { className: "flex min-h-5 items-center gap-1.5 px-1 text-xs text-muted-foreground", children: error ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-destructive", children: [
|
|
5376
5387
|
/* @__PURE__ */ jsx(AlertTriangle, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
5377
5388
|
"N\xE3o foi poss\xEDvel salvar: ",
|
|
@@ -5392,6 +5403,96 @@ function ShippingSettings({ provider }) {
|
|
|
5392
5403
|
)
|
|
5393
5404
|
] });
|
|
5394
5405
|
}
|
|
5406
|
+
function parseNumber2(raw) {
|
|
5407
|
+
const clean = raw.replace(/[^\d,.-]/g, "").replace(",", ".");
|
|
5408
|
+
if (!clean.trim()) return null;
|
|
5409
|
+
const n = Number(clean);
|
|
5410
|
+
return Number.isFinite(n) && n >= 0 ? n : NaN;
|
|
5411
|
+
}
|
|
5412
|
+
var text3 = (v) => v == null ? "" : String(v).replace(".", ",");
|
|
5413
|
+
function NumberRow({ label, description, hint, value, onCommit, placeholder, integer }) {
|
|
5414
|
+
const [draft2, setDraft] = React14__default.useState(() => text3(value));
|
|
5415
|
+
const [invalid, setInvalid] = React14__default.useState(false);
|
|
5416
|
+
React14__default.useEffect(() => {
|
|
5417
|
+
setDraft(text3(value));
|
|
5418
|
+
}, [value]);
|
|
5419
|
+
return /* @__PURE__ */ jsx(
|
|
5420
|
+
TextRow,
|
|
5421
|
+
{
|
|
5422
|
+
label,
|
|
5423
|
+
description,
|
|
5424
|
+
value: draft2,
|
|
5425
|
+
onChange: (next) => {
|
|
5426
|
+
setDraft(next);
|
|
5427
|
+
setInvalid(false);
|
|
5428
|
+
},
|
|
5429
|
+
onBlurCommit: () => {
|
|
5430
|
+
const parsed = parseNumber2(draft2);
|
|
5431
|
+
if (Number.isNaN(parsed)) {
|
|
5432
|
+
setInvalid(true);
|
|
5433
|
+
return;
|
|
5434
|
+
}
|
|
5435
|
+
setInvalid(false);
|
|
5436
|
+
onCommit(parsed == null ? null : integer ? Math.round(parsed) : Math.round(parsed * 100) / 100);
|
|
5437
|
+
},
|
|
5438
|
+
invalid,
|
|
5439
|
+
hint: invalid ? "Use um n\xFAmero, como 9,90." : hint,
|
|
5440
|
+
placeholder
|
|
5441
|
+
}
|
|
5442
|
+
);
|
|
5443
|
+
}
|
|
5444
|
+
function DeliveryStoreSettings({ provider }) {
|
|
5445
|
+
const settings = useStoreSettings(provider);
|
|
5446
|
+
const { value, set } = settings;
|
|
5447
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", "data-testid": "delivery-store-settings", children: [
|
|
5448
|
+
/* @__PURE__ */ jsxs(
|
|
5449
|
+
SettingsGroup,
|
|
5450
|
+
{
|
|
5451
|
+
title: "Pedidos do site",
|
|
5452
|
+
description: "Como o delivery do site funciona: a opera\xE7\xE3o aceita cada pedido, despacha e avisa o cliente a cada passo.",
|
|
5453
|
+
children: [
|
|
5454
|
+
/* @__PURE__ */ jsx(
|
|
5455
|
+
ToggleRow,
|
|
5456
|
+
{
|
|
5457
|
+
label: "A loja entrega pelo site",
|
|
5458
|
+
description: "Ligado, cada pedido do site entra no quadro de Delivery como Novo, e o cliente recebe os avisos por WhatsApp e e-mail.",
|
|
5459
|
+
checked: value.deliveryFlow === true,
|
|
5460
|
+
onChange: (checked) => set({ deliveryFlow: checked }),
|
|
5461
|
+
disabled: settings.loading || !settings.supported
|
|
5462
|
+
}
|
|
5463
|
+
),
|
|
5464
|
+
/* @__PURE__ */ jsx(
|
|
5465
|
+
NumberRow,
|
|
5466
|
+
{
|
|
5467
|
+
label: "Pedido m\xEDnimo",
|
|
5468
|
+
description: "Valor dos itens abaixo do qual o site n\xE3o fecha o pedido.",
|
|
5469
|
+
hint: "Vazio ou zero = sem m\xEDnimo.",
|
|
5470
|
+
value: value.minOrderTotal,
|
|
5471
|
+
placeholder: "Sem m\xEDnimo",
|
|
5472
|
+
onCommit: (next) => set({ minOrderTotal: next ?? null })
|
|
5473
|
+
}
|
|
5474
|
+
),
|
|
5475
|
+
/* @__PURE__ */ jsx(
|
|
5476
|
+
NumberRow,
|
|
5477
|
+
{
|
|
5478
|
+
label: "Tempo estimado (min)",
|
|
5479
|
+
description: "Da confirma\xE7\xE3o at\xE9 a porta. Aparece no topo do card\xE1pio e no aviso de pedido aceito.",
|
|
5480
|
+
value: value.deliveryEtaMinutes,
|
|
5481
|
+
placeholder: "N\xE3o informar",
|
|
5482
|
+
integer: true,
|
|
5483
|
+
onCommit: (next) => set({ deliveryEtaMinutes: next ?? null })
|
|
5484
|
+
}
|
|
5485
|
+
)
|
|
5486
|
+
]
|
|
5487
|
+
}
|
|
5488
|
+
),
|
|
5489
|
+
settings.error && /* @__PURE__ */ jsxs("p", { className: "px-1 text-xs text-destructive", children: [
|
|
5490
|
+
"N\xE3o foi poss\xEDvel salvar: ",
|
|
5491
|
+
settings.error
|
|
5492
|
+
] }),
|
|
5493
|
+
/* @__PURE__ */ jsx(ShippingSettings, { provider, variant: "delivery" })
|
|
5494
|
+
] });
|
|
5495
|
+
}
|
|
5395
5496
|
var POLICIES = [
|
|
5396
5497
|
{
|
|
5397
5498
|
value: "on_payment",
|
|
@@ -9500,6 +9601,9 @@ function createShopPlugin(options) {
|
|
|
9500
9601
|
{ path: "/orders/:id/edit", component: pageFor("orders") }
|
|
9501
9602
|
];
|
|
9502
9603
|
registerComponent("orders.detail", ShopOrderDetail(options?.provider));
|
|
9604
|
+
const DeliveryStore = () => React14__default.createElement(DeliveryStoreSettings, { provider: options?.provider });
|
|
9605
|
+
DeliveryStore.displayName = "ShopDeliveryStoreSettings";
|
|
9606
|
+
registerComponent("shop.delivery-settings", DeliveryStore);
|
|
9503
9607
|
const ACTIVE_LEGACY = withProducts ? LEGACY_ROUTES : LEGACY_ROUTES.map((r) => r.path === "/shop" || r.path === "/shop/products" ? { path: r.path, component: redirectTo("/orders") } : r);
|
|
9504
9608
|
const READ = { feature: "shop", action: "read" };
|
|
9505
9609
|
return {
|