@fayz-ai/plugin-shop 0.15.4 → 0.15.6
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 +15 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/lib/onboarding.d.ts +1 -1
- package/dist/lib/onboarding.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,21 @@ export interface ShopPluginOptions {
|
|
|
6
6
|
navLabel?: string;
|
|
7
7
|
/** Override the nav labels of the store's groups and their children. */
|
|
8
8
|
sectionLabels?: Partial<Record<'products' | 'orders' | 'customers' | 'discounts' | 'shipping' | 'collections' | 'categories' | 'giftCards' | 'content' | 'store' | 'emails' | 'customerGroups' | 'customerSegments' | 'stock', string>>;
|
|
9
|
+
/**
|
|
10
|
+
* As partes da loja que este app publica. Só `products` é destacável hoje —
|
|
11
|
+
* é a única que tem um concorrente legítimo em outro plugin.
|
|
12
|
+
*/
|
|
13
|
+
modules?: {
|
|
14
|
+
/**
|
|
15
|
+
* O catálogo da vitrine (Produtos · Coleções · Categorias), sobre
|
|
16
|
+
* `plg_shop_products`. Ligado por padrão. DESLIGUE quando o app já registra
|
|
17
|
+
* produto em outro lugar: o Estoque mantém o cadastro-mestre em
|
|
18
|
+
* `public.products`, e dois "Produtos" no mesmo rail, sobre duas tabelas,
|
|
19
|
+
* é como o mesmo produto acaba cadastrado duas vezes, diferente.
|
|
20
|
+
* Pedidos, clientes, conteúdo e descontos continuam de pé.
|
|
21
|
+
*/
|
|
22
|
+
products?: boolean;
|
|
23
|
+
};
|
|
9
24
|
scope?: PluginScope;
|
|
10
25
|
verticalId?: VerticalId;
|
|
11
26
|
currency?: {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":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,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,4 +1,4 @@
|
|
|
1
|
-
import { shopCustomerLookup, buildShopCustomerEntity, resolve, invalidateProductLists, listProductsDetailed, applyQuery, errorMessage, listProductsCached, resolveTerm, candidateMeta, packageMeasureLabel, PACKAGES_REGISTRY, packagesRegistry,
|
|
1
|
+
import { shopCustomerLookup, buildShopCustomerEntity, resolve, invalidateProductLists, listProductsDetailed, applyQuery, errorMessage, listProductsCached, resolveTerm, candidateMeta, SHIPPING_PROFILES_REGISTRY, packageMeasureLabel, PACKAGES_REGISTRY, packagesRegistry, SHIPPING_ZONES_REGISTRY, buildShopRegistries, locationSummary, LOCATIONS_REGISTRY } from './chunk-RPBKGW24.js';
|
|
2
2
|
import * as React13 from 'react';
|
|
3
3
|
import React13__default, { useState, useEffect, useRef, useCallback, useMemo } from 'react';
|
|
4
4
|
import { createConnectionStore, connectionSettings, connectionStatus, settingsStatus, connectionRuns, tl, getActiveTenantId, getSupabaseClientOptional, registerMessageDefaults, connectorRuntimeToken, CONNECTOR_RUNTIME_TOKEN_HEADER, countByTenant, errorMessage as errorMessage$1, emitDataChanged, resolveDataProvider } from '@fayz-ai/core';
|
|
@@ -11,7 +11,7 @@ import { listStockReasonCodes, resolveStockStore, createSupabaseStockStore } fro
|
|
|
11
11
|
import { normalizeMovementType } from '@fayz-ai/plugin-inventory';
|
|
12
12
|
import { advanceWindow, createRateLimiter, sliceWindow, paginate, reconcileMirror, serializeCursor } from '@fayz-ai/core/connector-runtime';
|
|
13
13
|
|
|
14
|
-
function buildShopOnboarding(siteRoute = "/site") {
|
|
14
|
+
function buildShopOnboarding(siteRoute = "/site", withProducts = true) {
|
|
15
15
|
return {
|
|
16
16
|
id: "shop",
|
|
17
17
|
title: "Sua loja no ar",
|
|
@@ -188,7 +188,7 @@ function buildShopOnboarding(siteRoute = "/site") {
|
|
|
188
188
|
]
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
]
|
|
191
|
+
].filter((s) => withProducts || s.key !== "catalog")
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
194
|
|
|
@@ -8935,6 +8935,10 @@ function createShopPlugin(options) {
|
|
|
8935
8935
|
{ path: "/emails", component: redirectTo("/automations") },
|
|
8936
8936
|
{ path: "/emails/:event", component: redirectTo("/automations") }
|
|
8937
8937
|
];
|
|
8938
|
+
const withProducts = options?.modules?.products !== false;
|
|
8939
|
+
const isProductRoute = (route) => route === "/products" || route.startsWith("/products/");
|
|
8940
|
+
const ACTIVE_NAV = withProducts ? NAV : NAV.filter((entry) => !isProductRoute(entry.route));
|
|
8941
|
+
const ACTIVE_LEGACY = withProducts ? LEGACY_ROUTES : LEGACY_ROUTES.map((r) => r.path === "/shop" || r.path === "/shop/products" ? { path: r.path, component: redirectTo("/orders") } : r);
|
|
8938
8942
|
const READ = { feature: "shop", action: "read" };
|
|
8939
8943
|
return {
|
|
8940
8944
|
id: "shop",
|
|
@@ -8942,7 +8946,7 @@ function createShopPlugin(options) {
|
|
|
8942
8946
|
// O que a loja pede de um tenant novo, na ordem em que faz diferença.
|
|
8943
8947
|
// Vira linha de tarefa, aparece no checklist da trilha e é o roteiro que o
|
|
8944
8948
|
// assistente segue — ver ./lib/onboarding.ts.
|
|
8945
|
-
onboarding: { program: buildShopOnboarding(siteRoute) },
|
|
8949
|
+
onboarding: { program: buildShopOnboarding(siteRoute, withProducts) },
|
|
8946
8950
|
name: options?.navLabel ?? "Shop",
|
|
8947
8951
|
icon: "ShoppingBag",
|
|
8948
8952
|
version: "1.0.0",
|
|
@@ -8953,7 +8957,7 @@ function createShopPlugin(options) {
|
|
|
8953
8957
|
scaffolds: ["ecommerce"],
|
|
8954
8958
|
defaultEnabled: true,
|
|
8955
8959
|
dependencies: [],
|
|
8956
|
-
navigation:
|
|
8960
|
+
navigation: ACTIVE_NAV.map((entry) => ({
|
|
8957
8961
|
section: navSection,
|
|
8958
8962
|
position: entry.position,
|
|
8959
8963
|
label: entry.label,
|
|
@@ -8963,9 +8967,9 @@ function createShopPlugin(options) {
|
|
|
8963
8967
|
...entry.indexChild === false ? { indexChild: false } : {}
|
|
8964
8968
|
})),
|
|
8965
8969
|
routes: [
|
|
8966
|
-
...
|
|
8970
|
+
...ACTIVE_NAV.map((entry) => ({ path: entry.route, component: entry.component, permission: READ })),
|
|
8967
8971
|
...HIDDEN_ROUTES.map((r) => ({ ...r, permission: READ })),
|
|
8968
|
-
...
|
|
8972
|
+
...ACTIVE_LEGACY.map((r) => ({ ...r, permission: READ }))
|
|
8969
8973
|
],
|
|
8970
8974
|
widgets: [],
|
|
8971
8975
|
// Os ~28 cards de varejo. Ficam AQUI porque quem é dono do dado é dono do
|