@proveanything/smartlinks-utils-ui 0.3.1 → 0.3.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.
- package/dist/chunk-4LHF5JB7.js +54 -0
- package/dist/chunk-4LHF5JB7.js.map +1 -0
- package/dist/{chunk-L7NSCOC7.js → chunk-7UBXTFZQ.js} +16 -62
- package/dist/chunk-7UBXTFZQ.js.map +1 -0
- package/dist/{chunk-S6KH3YV4.js → chunk-JQPS5XPJ.js} +2 -2
- package/dist/{chunk-S6KH3YV4.js.map → chunk-JQPS5XPJ.js.map} +1 -1
- package/dist/chunk-MZ6JSCXO.js +247 -0
- package/dist/chunk-MZ6JSCXO.js.map +1 -0
- package/dist/{chunk-4Z46C4MJ.js → chunk-OTJV62XV.js} +2 -2
- package/dist/{chunk-4Z46C4MJ.js.map → chunk-OTJV62XV.js.map} +1 -1
- package/dist/{chunk-YVZKCCYQ.js → chunk-UDYVH7QF.js} +2 -2
- package/dist/{chunk-YVZKCCYQ.js.map → chunk-UDYVH7QF.js.map} +1 -1
- package/dist/chunk-WFNEZQCD.js +28 -0
- package/dist/chunk-WFNEZQCD.js.map +1 -0
- package/dist/components/AssetPicker/index.js +2 -1
- package/dist/components/ConditionsEditor/index.d.ts +5 -130
- package/dist/components/ConditionsEditor/index.js +3 -1
- package/dist/components/FacetRuleEditor/index.d.ts +42 -0
- package/dist/components/FacetRuleEditor/index.js +5 -0
- package/dist/components/FacetRuleEditor/index.js.map +1 -0
- package/dist/components/FontPicker/index.js +2 -1
- package/dist/components/IconPicker/index.js +2 -1
- package/dist/components/RecordsAdmin/index.d.ts +115 -20
- package/dist/components/RecordsAdmin/index.js +217 -60
- package/dist/components/RecordsAdmin/index.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +7 -4
- package/dist/types-a2DdgZ2H.d.ts +128 -0
- package/package.json +11 -4
- package/dist/chunk-L7NSCOC7.js.map +0 -1
- package/dist/components/RecordsAdmin/index.css +0 -674
- package/dist/components/RecordsAdmin/index.css.map +0 -1
- package/dist/index.css +0 -1248
- package/dist/index.css.map +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
+
import * as _proveanything_smartlinks_dist_types_appObjects from '@proveanything/smartlinks/dist/types/appObjects';
|
|
4
|
+
import { MatchedAt, FacetRule, RecordScope, AppRecord, RecordTarget, MatchResult, MatchEntry } from '@proveanything/smartlinks/dist/types/appObjects';
|
|
3
5
|
import { LucideIcon } from 'lucide-react';
|
|
4
6
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
5
|
-
import { RecordScope, AppRecord, RecordTarget, MatchResult } from '@proveanything/smartlinks/dist/types/appObjects';
|
|
6
7
|
|
|
7
8
|
type ScopeKind = 'product' | 'facet' | 'variant' | 'batch';
|
|
8
9
|
/** Parsed `ref` string — see `data/refs.ts`. Format: `kind:id` or chain. */
|
|
@@ -60,6 +61,14 @@ interface ResolvedRecord<TData = unknown> {
|
|
|
60
61
|
sourceRef?: string;
|
|
61
62
|
/** The parent value that would be inherited if this scope cleared its override. */
|
|
62
63
|
parentValue?: TData | null;
|
|
64
|
+
/**
|
|
65
|
+
* Which resolution tier the SDK reported caused the match.
|
|
66
|
+
* Use this for badges like "Inherited from product" / "Matched by rule".
|
|
67
|
+
* Present when the resolver ran via SDK 1.10 `match()`/`resolveAll()`.
|
|
68
|
+
*/
|
|
69
|
+
matchedAt?: MatchedAt;
|
|
70
|
+
/** The rule that fired. Present only when `matchedAt === 'rule'`. */
|
|
71
|
+
matchedRule?: FacetRule;
|
|
63
72
|
}
|
|
64
73
|
|
|
65
74
|
interface EditorContext<TData = unknown> {
|
|
@@ -124,42 +133,42 @@ type CollectedSort = {
|
|
|
124
133
|
|
|
125
134
|
type TelemetryEvent = {
|
|
126
135
|
type: 'record.save';
|
|
127
|
-
recordType
|
|
136
|
+
recordType?: string;
|
|
128
137
|
ref: string;
|
|
129
138
|
isCreate: boolean;
|
|
130
139
|
} | {
|
|
131
140
|
type: 'record.delete';
|
|
132
|
-
recordType
|
|
141
|
+
recordType?: string;
|
|
133
142
|
ref: string;
|
|
134
143
|
} | {
|
|
135
144
|
type: 'scope.change';
|
|
136
|
-
recordType
|
|
145
|
+
recordType?: string;
|
|
137
146
|
from: ScopeKind;
|
|
138
147
|
to: ScopeKind;
|
|
139
148
|
} | {
|
|
140
149
|
type: 'intro.dismiss';
|
|
141
|
-
recordType
|
|
150
|
+
recordType?: string;
|
|
142
151
|
} | {
|
|
143
152
|
type: 'csv.import';
|
|
144
|
-
recordType
|
|
153
|
+
recordType?: string;
|
|
145
154
|
rows: number;
|
|
146
155
|
errors: number;
|
|
147
156
|
} | {
|
|
148
157
|
type: 'csv.export';
|
|
149
|
-
recordType
|
|
158
|
+
recordType?: string;
|
|
150
159
|
rows: number;
|
|
151
160
|
} | {
|
|
152
161
|
type: 'bulk.apply';
|
|
153
|
-
recordType
|
|
162
|
+
recordType?: string;
|
|
154
163
|
targetCount: number;
|
|
155
164
|
} | {
|
|
156
165
|
type: 'presentation.change';
|
|
157
|
-
recordType
|
|
166
|
+
recordType?: string;
|
|
158
167
|
from: RecordPresentation;
|
|
159
168
|
to: RecordPresentation;
|
|
160
169
|
} | {
|
|
161
170
|
type: 'item.create';
|
|
162
|
-
recordType
|
|
171
|
+
recordType?: string;
|
|
163
172
|
scopeRef: string;
|
|
164
173
|
};
|
|
165
174
|
|
|
@@ -257,7 +266,7 @@ declare const DEFAULT_ICONS: RecordsAdminIcons;
|
|
|
257
266
|
declare function mergeIcons(override?: Partial<RecordsAdminIcons>): RecordsAdminIcons;
|
|
258
267
|
/** Look up the right header icon based on prop precedence:
|
|
259
268
|
* explicit `headerIcon` > `icons.header.byRecordType[type]` > `icons.header.default`. */
|
|
260
|
-
declare function pickHeaderIcon(icons: RecordsAdminIcons, recordType
|
|
269
|
+
declare function pickHeaderIcon(icons: RecordsAdminIcons, recordType?: string): LucideIcon;
|
|
261
270
|
|
|
262
271
|
/** Minimal SDK shape consumed by the shell. */
|
|
263
272
|
type SmartLinksSDK = any;
|
|
@@ -271,7 +280,10 @@ interface RecordsAdminShellProps<TData = unknown> {
|
|
|
271
280
|
SL: SmartLinksSDK;
|
|
272
281
|
appId: string;
|
|
273
282
|
collectionId: string;
|
|
274
|
-
|
|
283
|
+
/** Logical record type for this app. Optional — when omitted, records are
|
|
284
|
+
* saved against the app id alone (no type qualifier). Set this only when an
|
|
285
|
+
* app stores multiple distinct record types and needs to query by type. */
|
|
286
|
+
recordType?: string;
|
|
275
287
|
label: string;
|
|
276
288
|
scopes: ScopeKind[];
|
|
277
289
|
defaultScope?: ScopeKind;
|
|
@@ -388,8 +400,19 @@ interface RecordsAdminShellProps<TData = unknown> {
|
|
|
388
400
|
headerIcon?: ReactNode;
|
|
389
401
|
/** Right-aligned header content — typically a primary "+ New" button + secondary controls. */
|
|
390
402
|
headerActions?: ReactNode;
|
|
391
|
-
/** Show
|
|
403
|
+
/** Show a counts strip in the header (e.g. Shared · Products). Off by default —
|
|
404
|
+
* most apps don't need it. When `true`, the shell renders built-in counts unless
|
|
405
|
+
* `statsItems` is also provided. */
|
|
392
406
|
showStats?: boolean;
|
|
407
|
+
/** Show the contextual icon to the left of the header title. Default true.
|
|
408
|
+
* Set to `false` if the recordType icon (database, etc.) feels off-brand. */
|
|
409
|
+
showHeaderIcon?: boolean;
|
|
410
|
+
/** Fully custom stats strip content. When provided, replaces the built-in
|
|
411
|
+
* Shared/Products counts. Each item renders as a value + uppercase label. */
|
|
412
|
+
statsItems?: Array<{
|
|
413
|
+
label: string;
|
|
414
|
+
value: string | number;
|
|
415
|
+
}>;
|
|
393
416
|
/** Override the default Lucide icons used by the shell (scope tabs, statuses,
|
|
394
417
|
* empty states, action menus, etc.). Deep-merged onto `DEFAULT_ICONS`. */
|
|
395
418
|
icons?: Partial<RecordsAdminIcons>;
|
|
@@ -713,7 +736,10 @@ interface RecordsCtx {
|
|
|
713
736
|
SL: SmartLinksSDK;
|
|
714
737
|
collectionId: string;
|
|
715
738
|
appId: string;
|
|
716
|
-
|
|
739
|
+
/** Optional — when omitted, records are stored against the app id alone
|
|
740
|
+
* (no type qualifier). Set this only when an app uses multiple record types
|
|
741
|
+
* and needs to query/scope by type. */
|
|
742
|
+
recordType?: string;
|
|
717
743
|
}
|
|
718
744
|
/** Shape of a single record write — uses the SDK's structured `scope`. */
|
|
719
745
|
interface RecordWrite<T = unknown> {
|
|
@@ -856,7 +882,8 @@ declare function useRecordEditor<T>(args: UseRecordEditorArgs<T>): EditorContext
|
|
|
856
882
|
interface UseResolvedRecordArgs {
|
|
857
883
|
SL: SmartLinksSDK;
|
|
858
884
|
appId: string;
|
|
859
|
-
recordType
|
|
885
|
+
/** Optional — see `RecordsAdminShellProps.recordType`. */
|
|
886
|
+
recordType?: string;
|
|
860
887
|
collectionId: string;
|
|
861
888
|
productId?: string;
|
|
862
889
|
variantId?: string;
|
|
@@ -875,8 +902,76 @@ declare function useResolvedRecord<T = unknown>(args: UseResolvedRecordArgs): {
|
|
|
875
902
|
source: RecordSource;
|
|
876
903
|
sourceRef?: string;
|
|
877
904
|
parentValue?: T | null | undefined;
|
|
905
|
+
matchedAt?: _proveanything_smartlinks_dist_types_appObjects.MatchedAt;
|
|
906
|
+
matchedRule?: _proveanything_smartlinks_dist_types_appObjects.FacetRule;
|
|
878
907
|
};
|
|
879
908
|
|
|
909
|
+
interface UseResolveAllRecordsArgs {
|
|
910
|
+
SL: SmartLinksSDK;
|
|
911
|
+
collectionId: string;
|
|
912
|
+
appId: string;
|
|
913
|
+
/** Limit to a single record type. Omit to return every type. */
|
|
914
|
+
recordType?: string;
|
|
915
|
+
/** Product context — at minimum a productId in most apps. */
|
|
916
|
+
context: {
|
|
917
|
+
productId?: string;
|
|
918
|
+
variantId?: string;
|
|
919
|
+
batchId?: string;
|
|
920
|
+
proofId?: string;
|
|
921
|
+
/**
|
|
922
|
+
* Facet assignments for the product. Used for both legacy facet refs
|
|
923
|
+
* and `facetRule` evaluation server-side.
|
|
924
|
+
* e.g. `{ brand: 'samsung', type: ['tv', 'laptop'] }`
|
|
925
|
+
*/
|
|
926
|
+
facets?: Record<string, string | string[]>;
|
|
927
|
+
};
|
|
928
|
+
/** Restrict to specific tiers (e.g. only `['rule', 'product']`). */
|
|
929
|
+
tiers?: MatchedAt[];
|
|
930
|
+
/** Safety cap. Default 500, max 5000. */
|
|
931
|
+
limit?: number;
|
|
932
|
+
/** Point-in-time evaluation for scheduled records. ISO 8601. */
|
|
933
|
+
at?: string;
|
|
934
|
+
includeScheduled?: boolean;
|
|
935
|
+
includeExpired?: boolean;
|
|
936
|
+
/**
|
|
937
|
+
* `false` to use the public (visibility-filtered) endpoint.
|
|
938
|
+
* Defaults to `false` so this hook is safe to call from public surfaces.
|
|
939
|
+
*/
|
|
940
|
+
admin?: boolean;
|
|
941
|
+
enabled?: boolean;
|
|
942
|
+
staleTime?: number;
|
|
943
|
+
}
|
|
944
|
+
interface UseResolveAllResult {
|
|
945
|
+
/** All matching records, sorted most-specific first. Each appears once. */
|
|
946
|
+
records: MatchEntry[];
|
|
947
|
+
/** True when the result hit the `limit` safety cap. */
|
|
948
|
+
truncated: boolean;
|
|
949
|
+
isLoading: boolean;
|
|
950
|
+
error: Error | null;
|
|
951
|
+
refetch: () => void;
|
|
952
|
+
}
|
|
953
|
+
declare function useResolveAllRecords(args: UseResolveAllRecordsArgs): UseResolveAllResult;
|
|
954
|
+
|
|
955
|
+
interface UseRulePreviewArgs {
|
|
956
|
+
SL: SmartLinksSDK;
|
|
957
|
+
collectionId: string;
|
|
958
|
+
appId: string;
|
|
959
|
+
rule: FacetRule | null;
|
|
960
|
+
/** Sample size. Default 20, max 200. */
|
|
961
|
+
limit?: number;
|
|
962
|
+
/** Debounce window in ms while the admin types. Default 350ms. */
|
|
963
|
+
debounceMs?: number;
|
|
964
|
+
enabled?: boolean;
|
|
965
|
+
}
|
|
966
|
+
interface UseRulePreviewResult {
|
|
967
|
+
totalMatches: number | null;
|
|
968
|
+
sampleProductIds: string[];
|
|
969
|
+
isLoading: boolean;
|
|
970
|
+
isStale: boolean;
|
|
971
|
+
error: Error | null;
|
|
972
|
+
}
|
|
973
|
+
declare function useRulePreview(args: UseRulePreviewArgs): UseRulePreviewResult;
|
|
974
|
+
|
|
880
975
|
interface UseScopeProbeArgs {
|
|
881
976
|
SL: SmartLinksSDK;
|
|
882
977
|
collectionId: string;
|
|
@@ -898,7 +993,7 @@ declare const useScopeProbe: ({ SL, collectionId, admin, enabled }: UseScopeProb
|
|
|
898
993
|
error: Error | null;
|
|
899
994
|
};
|
|
900
995
|
|
|
901
|
-
declare const useIntroDismissed: (SL: SmartLinksSDK, collectionId: string, appId: string, recordType
|
|
996
|
+
declare const useIntroDismissed: (SL: SmartLinksSDK, collectionId: string, appId: string, recordType?: string) => {
|
|
902
997
|
dismissed: boolean;
|
|
903
998
|
dismiss: () => Promise<void>;
|
|
904
999
|
undismiss: () => void;
|
|
@@ -959,7 +1054,7 @@ interface CollectedRecord<T = unknown> {
|
|
|
959
1054
|
interface UseCollectedRecordsArgs {
|
|
960
1055
|
SL: SmartLinksSDK;
|
|
961
1056
|
appId: string;
|
|
962
|
-
recordType
|
|
1057
|
+
recordType?: string;
|
|
963
1058
|
collectionId: string;
|
|
964
1059
|
productId?: string;
|
|
965
1060
|
variantId?: string;
|
|
@@ -1000,7 +1095,7 @@ interface MergedRecord<T = unknown> {
|
|
|
1000
1095
|
interface UseMergedRecordArgs<T> {
|
|
1001
1096
|
SL: SmartLinksSDK;
|
|
1002
1097
|
appId: string;
|
|
1003
|
-
recordType
|
|
1098
|
+
recordType?: string;
|
|
1004
1099
|
collectionId: string;
|
|
1005
1100
|
productId?: string;
|
|
1006
1101
|
variantId?: string;
|
|
@@ -1097,7 +1192,7 @@ declare const useDirtyNavigation: ({ strategy, isDirty, save, reset, confirm, i1
|
|
|
1097
1192
|
|
|
1098
1193
|
declare function usePresentationPref(args: {
|
|
1099
1194
|
appId: string;
|
|
1100
|
-
recordType
|
|
1195
|
+
recordType?: string;
|
|
1101
1196
|
options: RecordPresentation[];
|
|
1102
1197
|
defaultValue: RecordPresentation;
|
|
1103
1198
|
}): [RecordPresentation, (next: RecordPresentation) => void];
|
|
@@ -1175,4 +1270,4 @@ declare const exportCsv: <T>(records: RecordSummary<T>[], schema: CsvSchema<T>)
|
|
|
1175
1270
|
declare const importCsv: <T>(file: File, schema: CsvSchema<T>, ctx: RecordsCtx) => Promise<ImportReport>;
|
|
1176
1271
|
declare const downloadBlob: (blob: Blob, filename: string) => void;
|
|
1177
1272
|
|
|
1178
|
-
export { ALL_PRESENTATIONS, BatchList, BulkActionsMenu, type CollectedRecord, type CollectedSort, type CsvSchema, type CsvSchemaColumn, DEFAULT_I18N, DEFAULT_ICONS, DefaultRecordCard, DefaultRecordRow, DeleteButton, type DirtyStrategy, DrawerPreview, type EditorContext, EmptyState, ErrorState, FacetList, InheritanceMarker, InheritanceProvider, InlinePreview, IntroCard, LoadingState, type MergeStrategy, type MergedRecord, type NavConfirmI18n, type ParsedRef, PresentationSwitcher, type PreviewMode, PreviewScopePicker, PreviewToggleButton, type ProductBrowseItem, type ProductChildItem, ProductDrillDown, ProductList, type RecordBadge, RecordBrowser, type RecordCardinality, RecordEditor, RecordList, type RecordPresentation, type RecordSlotContext, type RecordSource, type RecordStatus, type RecordSummary, type RecordsAdminI18n, type RecordsAdminIcons, RecordsAdminShell, type RecordsAdminShellProps, ResolvedPreview, type ResolvedRecord, ScopeBreadcrumb, type ScopeKind, ScopeTabs, SidePreview, type SmartLinksSDK, StatusDot, StatusFilterPills, TabbedPreview, type TelemetryEvent, UtilityRow, VariantList, buildRef, bulkDelete, bulkUpsert, deleteRecord, downloadBlob, exportCsv, getRecordByRef, importCsv, listRecords, matchRecords, mergeIcons, parseRef, parsedRefToScope, parsedRefToTarget, pickHeaderIcon, resolutionChain, resolveRecord, restoreRecord, scopesEqual, upsertRecord, useCollectedRecords, useDirtyNavigation, useIntroDismissed, useMergedRecord, usePresentationPref, useProductBrowse, useProductChildren, useRecordEditor, useRecordList, useResolvedRecord, useScopeProbe, useUnsavedGuard };
|
|
1273
|
+
export { ALL_PRESENTATIONS, BatchList, BulkActionsMenu, type CollectedRecord, type CollectedSort, type CsvSchema, type CsvSchemaColumn, DEFAULT_I18N, DEFAULT_ICONS, DefaultRecordCard, DefaultRecordRow, DeleteButton, type DirtyStrategy, DrawerPreview, type EditorContext, EmptyState, ErrorState, FacetList, InheritanceMarker, InheritanceProvider, InlinePreview, IntroCard, LoadingState, type MergeStrategy, type MergedRecord, type NavConfirmI18n, type ParsedRef, PresentationSwitcher, type PreviewMode, PreviewScopePicker, PreviewToggleButton, type ProductBrowseItem, type ProductChildItem, ProductDrillDown, ProductList, type RecordBadge, RecordBrowser, type RecordCardinality, RecordEditor, RecordList, type RecordPresentation, type RecordSlotContext, type RecordSource, type RecordStatus, type RecordSummary, type RecordsAdminI18n, type RecordsAdminIcons, RecordsAdminShell, type RecordsAdminShellProps, ResolvedPreview, type ResolvedRecord, ScopeBreadcrumb, type ScopeKind, ScopeTabs, SidePreview, type SmartLinksSDK, StatusDot, StatusFilterPills, TabbedPreview, type TelemetryEvent, type UseResolveAllRecordsArgs, type UseResolveAllResult, type UseRulePreviewArgs, type UseRulePreviewResult, UtilityRow, VariantList, buildRef, bulkDelete, bulkUpsert, deleteRecord, downloadBlob, exportCsv, getRecordByRef, importCsv, listRecords, matchRecords, mergeIcons, parseRef, parsedRefToScope, parsedRefToTarget, pickHeaderIcon, resolutionChain, resolveRecord, restoreRecord, scopesEqual, upsertRecord, useCollectedRecords, useDirtyNavigation, useIntroDismissed, useMergedRecord, usePresentationPref, useProductBrowse, useProductChildren, useRecordEditor, useRecordList, useResolveAllRecords, useResolvedRecord, useRulePreview, useScopeProbe, useUnsavedGuard };
|