@websolutespa/payload-plugin-bowl 1.7.5 → 1.7.7

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/CHANGELOG.md CHANGED
@@ -1,209 +1,225 @@
1
- # @websolutespa/payload-plugin-bowl
2
-
3
- ## 1.7.5
4
-
5
- ### Patch Changes
6
-
7
- - Modified: Label collection title -> text
8
-
9
- ## 1.7.4
10
-
11
- ### Patch Changes
12
-
13
- - Fixing: findRoute redirects
14
-
15
- ## 1.7.3
16
-
17
- ### Patch Changes
18
-
19
- - Added: WhereService, StaticService, localize decorator
20
- - Modified: withCollection, withStaticCollection, withAction, CollectionService, PageService
21
-
22
- ## 1.7.2
23
-
24
- ### Patch Changes
25
-
26
- - Fixing: setMixerContext
27
-
28
- ## 1.7.1
29
-
30
- ### Patch Changes
31
-
32
- - Fixing: MenuService & CategoryTree
33
-
34
- ## 1.7.0
35
-
36
- ### Minor Changes
37
-
38
- - 28e86bd: Modified: IPage, Store services & decorators
39
- - Updated dependencies [28e86bd]
40
- - @websolutespa/bom-core@1.7.0
41
-
42
- ## 1.6.0
43
-
44
- ### Minor Changes
45
-
46
- - 6707ca2: Upgrading Payload 2.11.2
47
-
48
- ### Patch Changes
49
-
50
- - f664993: Added: useLivePreview
51
- - Updated dependencies [6cbf4cb]
52
- - @websolutespa/bom-core@0.6.7
53
-
54
- ## 1.3.6
55
-
56
- ### Patch Changes
57
-
58
- - Fixing: afterPageReadHook
59
-
60
- ## 1.3.5
61
-
62
- ### Patch Changes
63
-
64
- - Added: afterPageReadHook, MixerContext, getGlobalItems
65
- - Modified: getCollectionItems, getCollectionItem
66
-
67
- ## 1.3.4
68
-
69
- ### Patch Changes
70
-
71
- - Added: user roles and user actions
72
- - Added: main menu sortByGroup
73
-
74
- ## 1.3.3
75
-
76
- ### Patch Changes
77
-
78
- - Fixing: PageService decorators
79
-
80
- ## 1.3.2
81
-
82
- ### Patch Changes
83
-
84
- - 8776e50b: Modified: PageService decorators
85
-
86
- ## 1.3.1
87
-
88
- ### Patch Changes
89
-
90
- - Added: configuration option plugins
91
-
92
- ## 1.3.0
93
-
94
- ### Minor Changes
95
-
96
- - c7a99a2b: Added tests
97
-
98
- ### Patch Changes
99
-
100
- - dad63747: Added defaultMarket, defaultLocale
101
- - 11b63e3b: Fixed test config
102
- - c7a99a2b: Fixed collection bulk patch handler
103
- - Updated dependencies [dad63747]
104
- - @websolutespa/bom-core@0.6.1
105
-
106
- ## 1.2.0
107
-
108
- ### Minor Changes
109
-
110
- - Added: MenuItem extra
111
-
112
- ## 1.1.0
113
-
114
- ### Minor Changes
115
-
116
- - Updating: dependencies
117
-
118
- ## 1.0.6
119
-
120
- ### Patch Changes
121
-
122
- - Fixing: validateHexColor import
123
-
124
- ## 1.0.5
125
-
126
- ### Patch Changes
127
-
128
- - Fixing: check redirects by pattern
129
-
130
- ## 1.0.4
131
-
132
- ### Patch Changes
133
-
134
- - Fixing: storeGet endpoint locale
135
-
136
- ## 1.0.3
137
-
138
- ### Patch Changes
139
-
140
- - Modified: withPage preview, getApiUrl
141
-
142
- ## 1.0.2
143
-
144
- ### Patch Changes
145
-
146
- - Added: duration to withStaticCollection
147
- - Fixing: eachField
148
-
149
- ## 1.0.1
150
-
151
- ### Minor Changes
152
-
153
- - Added: CategoryTree
154
- - Fixing: sass
155
-
156
- ## 0.5.0
157
-
158
- ### Minor Changes
159
-
160
- - Modified routes, added redirects
161
-
162
- ## 0.4.0
163
-
164
- ### Minor Changes
165
-
166
- - Removed: external dependency @websolutespa/payload-plugin-localization
167
-
168
- ## 0.3.2
169
-
170
- ### Patch Changes
171
-
172
- - Fixing: avoid categories circular reference
173
-
174
- ## 0.3.1
175
-
176
- ### Patch Changes
177
-
178
- - Modified: ILocalizable
179
-
180
- ## 0.3.0
181
-
182
- ### Minor Changes
183
-
184
- - Added: splat routes
185
-
186
- ## 0.2.0
187
-
188
- ### Minor Changes
189
-
190
- - Added: menu, @websolutespa/bom-core
191
-
192
- ## 0.1.1
193
-
194
- ### Patch Changes
195
-
196
- - Modified: route service
197
- - Added: white label
198
-
199
- ## 0.1.0
200
-
201
- ### Minor Changes
202
-
203
- - mock refactor
204
-
205
- ## 0.0.1
206
-
207
- ### Patch Changes
208
-
209
- - Added: first release
1
+ # @websolutespa/payload-plugin-bowl
2
+
3
+ ## 1.7.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Added: isomorphic-fetch
8
+ - Updating: dependencies
9
+ - Updated dependencies
10
+ - @websolutespa/bom-core@1.7.3
11
+
12
+ ## 1.7.6
13
+
14
+ ### Patch Changes
15
+
16
+ - Added: beforeDuplicateCollectionHook
17
+ - Fixing: decorateNav\_ link href issue
18
+
19
+ ## 1.7.5
20
+
21
+ ### Patch Changes
22
+
23
+ - Modified: Label collection title -> text
24
+
25
+ ## 1.7.4
26
+
27
+ ### Patch Changes
28
+
29
+ - Fixing: findRoute redirects
30
+
31
+ ## 1.7.3
32
+
33
+ ### Patch Changes
34
+
35
+ - Added: WhereService, StaticService, localize decorator
36
+ - Modified: withCollection, withStaticCollection, withAction, CollectionService, PageService
37
+
38
+ ## 1.7.2
39
+
40
+ ### Patch Changes
41
+
42
+ - Fixing: setMixerContext
43
+
44
+ ## 1.7.1
45
+
46
+ ### Patch Changes
47
+
48
+ - Fixing: MenuService & CategoryTree
49
+
50
+ ## 1.7.0
51
+
52
+ ### Minor Changes
53
+
54
+ - 28e86bd: Modified: IPage, Store services & decorators
55
+ - Updated dependencies [28e86bd]
56
+ - @websolutespa/bom-core@1.7.0
57
+
58
+ ## 1.6.0
59
+
60
+ ### Minor Changes
61
+
62
+ - 6707ca2: Upgrading Payload 2.11.2
63
+
64
+ ### Patch Changes
65
+
66
+ - f664993: Added: useLivePreview
67
+ - Updated dependencies [6cbf4cb]
68
+ - @websolutespa/bom-core@0.6.7
69
+
70
+ ## 1.3.6
71
+
72
+ ### Patch Changes
73
+
74
+ - Fixing: afterPageReadHook
75
+
76
+ ## 1.3.5
77
+
78
+ ### Patch Changes
79
+
80
+ - Added: afterPageReadHook, MixerContext, getGlobalItems
81
+ - Modified: getCollectionItems, getCollectionItem
82
+
83
+ ## 1.3.4
84
+
85
+ ### Patch Changes
86
+
87
+ - Added: user roles and user actions
88
+ - Added: main menu sortByGroup
89
+
90
+ ## 1.3.3
91
+
92
+ ### Patch Changes
93
+
94
+ - Fixing: PageService decorators
95
+
96
+ ## 1.3.2
97
+
98
+ ### Patch Changes
99
+
100
+ - 8776e50b: Modified: PageService decorators
101
+
102
+ ## 1.3.1
103
+
104
+ ### Patch Changes
105
+
106
+ - Added: configuration option plugins
107
+
108
+ ## 1.3.0
109
+
110
+ ### Minor Changes
111
+
112
+ - c7a99a2b: Added tests
113
+
114
+ ### Patch Changes
115
+
116
+ - dad63747: Added defaultMarket, defaultLocale
117
+ - 11b63e3b: Fixed test config
118
+ - c7a99a2b: Fixed collection bulk patch handler
119
+ - Updated dependencies [dad63747]
120
+ - @websolutespa/bom-core@0.6.1
121
+
122
+ ## 1.2.0
123
+
124
+ ### Minor Changes
125
+
126
+ - Added: MenuItem extra
127
+
128
+ ## 1.1.0
129
+
130
+ ### Minor Changes
131
+
132
+ - Updating: dependencies
133
+
134
+ ## 1.0.6
135
+
136
+ ### Patch Changes
137
+
138
+ - Fixing: validateHexColor import
139
+
140
+ ## 1.0.5
141
+
142
+ ### Patch Changes
143
+
144
+ - Fixing: check redirects by pattern
145
+
146
+ ## 1.0.4
147
+
148
+ ### Patch Changes
149
+
150
+ - Fixing: storeGet endpoint locale
151
+
152
+ ## 1.0.3
153
+
154
+ ### Patch Changes
155
+
156
+ - Modified: withPage preview, getApiUrl
157
+
158
+ ## 1.0.2
159
+
160
+ ### Patch Changes
161
+
162
+ - Added: duration to withStaticCollection
163
+ - Fixing: eachField
164
+
165
+ ## 1.0.1
166
+
167
+ ### Minor Changes
168
+
169
+ - Added: CategoryTree
170
+ - Fixing: sass
171
+
172
+ ## 0.5.0
173
+
174
+ ### Minor Changes
175
+
176
+ - Modified routes, added redirects
177
+
178
+ ## 0.4.0
179
+
180
+ ### Minor Changes
181
+
182
+ - Removed: external dependency @websolutespa/payload-plugin-localization
183
+
184
+ ## 0.3.2
185
+
186
+ ### Patch Changes
187
+
188
+ - Fixing: avoid categories circular reference
189
+
190
+ ## 0.3.1
191
+
192
+ ### Patch Changes
193
+
194
+ - Modified: ILocalizable
195
+
196
+ ## 0.3.0
197
+
198
+ ### Minor Changes
199
+
200
+ - Added: splat routes
201
+
202
+ ## 0.2.0
203
+
204
+ ### Minor Changes
205
+
206
+ - Added: menu, @websolutespa/bom-core
207
+
208
+ ## 0.1.1
209
+
210
+ ### Patch Changes
211
+
212
+ - Modified: route service
213
+ - Added: white label
214
+
215
+ ## 0.1.0
216
+
217
+ ### Minor Changes
218
+
219
+ - mock refactor
220
+
221
+ ## 0.0.1
222
+
223
+ ### Patch Changes
224
+
225
+ - Added: first release
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Resource } from 'i18next';
2
2
  import { Endpoint, AdminView, Locale as Locale$1, Config } from 'payload/config';
3
3
  import { Field, FieldBase, Tab, JSONField, Block as Block$1, FieldAffectingData, HookName, FieldHook as FieldHook$1, UIField as UIField$1 } from 'payload/dist/fields/config/types';
4
4
  import * as payload_types from 'payload/types';
5
- import { PayloadRequest, CollectionAfterChangeHook, CollectionAfterDeleteHook, TypeWithID, CollectionConfig, Block, GlobalConfig, RichTextField, RelationshipField, CheckboxField, BlockField, DateField, TextField, GroupField, Field as Field$1, UploadField, ArrayField, NumberField, FieldHook, SelectField, CollapsibleField, RowField, TabsField, UIField, EmailField, TextareaField, RadioField, CodeField, PointField, SanitizedCollectionConfig } from 'payload/types';
5
+ import { PayloadRequest, CollectionAfterChangeHook, CollectionAfterDeleteHook, TypeWithID, CollectionConfig, BeforeDuplicate, Block, GlobalConfig, RichTextField, RelationshipField, CheckboxField, BlockField, DateField, TextField, GroupField, Field as Field$1, UploadField, ArrayField, NumberField, FieldHook, SelectField, CollapsibleField, RowField, TabsField, UIField, EmailField, TextareaField, RadioField, CodeField, PointField, SanitizedCollectionConfig } from 'payload/types';
6
6
  import { IEntity, ILocale, ICategorized, IRoute, ICategory, IMarket, IMemoryStore, ILocalizable, IEquatable, IMedia, IPageRelation, ISchema, IMenuItem, IMenu } from '@websolutespa/bom-core';
7
7
  import * as payload_dist_admin_components_forms_FieldDescription_types from 'payload/dist/admin/components/forms/FieldDescription/types';
8
8
  import * as React from 'react';
@@ -111,6 +111,10 @@ declare const collectionImportPost: ((slug: string) => Endpoint);
111
111
  * Decorate record for with static collection data.
112
112
  */
113
113
  declare const afterCollectionReadHook: (collectionConfig: CollectionConfig) => CollectionConfig['hooks']['afterRead'][number];
114
+ /**
115
+ * Enforce unique field values during duplication.
116
+ */
117
+ declare const beforeDuplicateCollectionHook: BeforeDuplicate;
114
118
 
115
119
  declare function getLocale(req: PayloadRequest<any>): Promise<ILocale[]>;
116
120
  declare const localeGet: Endpoint;
@@ -273,6 +277,7 @@ type IUndecoratedMenuCustom = Record<string, unknown> & {
273
277
  blockType: string;
274
278
  };
275
279
  type IUndecoratedMenuItem = IUndecoratedMenuCategory | IUndecoratedMenuGroup | IUndecoratedMenuLink | IUndecoratedMenuPage | IUndecoratedMenuCustom;
280
+ type IUndecoratedNavItem = IUndecoratedMenuCategory | IUndecoratedMenuPage;
276
281
  type IUndecoratedMenu = {
277
282
  createdAt: Date;
278
283
  id: string;
@@ -432,12 +437,13 @@ declare function decorateMenuLink_(item: IUndecoratedMenuLink, categories: ICate
432
437
  declare function decorateMenuPage_(item: IUndecoratedMenuPage, categories: ICategory[], routes: IRoute[], market: string): IMenuItem;
433
438
  declare function decorateMenuRoute_(item: IRoute): IMenuItem;
434
439
  declare function decorateMenuItem_(item: IUndecoratedMenuItem, categories: ICategory[], routes: IRoute[], market: string, depth?: number): IMenuItem;
440
+ declare function decorateNavItem_(item: IUndecoratedNavItem, categories: ICategory[], routes: IRoute[], market: string, depth?: number): IMenuItem | IMenuItem[];
435
441
  declare function hasMarket(item: IUndecoratedMenuItem, market: string): boolean;
436
442
  declare function decorateMenu_(item: IUndecoratedMenu, context: MixerContext): Promise<IMenu>;
437
443
 
438
444
  declare function decorateNav_<T extends ISchema = ISchema>(item: T, slug: string, context: MixerContext): Promise<T>;
439
445
  declare function decorateNavs_<T extends ISchema = ISchema>(items: T[], slug: string, context: MixerContext): Promise<T[]>;
440
- declare function isUndecoratedMenuItem(item: unknown): item is IUndecoratedMenuItem;
446
+ declare function isUndecoratedNavItem(item: unknown): item is IUndecoratedNavItem;
441
447
  declare function isRelation(item: unknown): item is IRelation;
442
448
  type IRelation = {
443
449
  relationTo: string;
@@ -1122,4 +1128,4 @@ declare const Logo: React__default.FC;
1122
1128
 
1123
1129
  declare function webpack(sourceConfig: BowlConfig): (config: any) => any;
1124
1130
 
1125
- export { ActionDefault, BlockDefaults, BowlArrayField, BowlBlock, BowlBlockField, BowlCollapsibleField, BowlCollection, BowlConfig, BowlField, BowlGlobal, BowlGroup, BowlGroupField, BowlInitOptions, BowlOptions, BowlPlugin, BowlRole, BowlRowField, BowlSlug, BowlTab, BowlTabsField, CategoryDefaults, CategoryMenu, CategoryMenuProps, CategoryTree, CategoryTreeProps, CheckboxDefaults, CollectionDefault, CollectionHelper, CollectionHook, CollectionHookName, CollectionHooks, ColorCell, ColorConfig, ColorField, ComponentsDefaults, CustomEditModal, CustomEditModalProps, DataField, DataTree, DataTreeDragItem, DataTreeItem, DataTreeItemLi, DataTreeItemProps, DataTreeProps, DataTreeProvider, DataTreeRenameItem, DateDefaults, DebugField, DecoratedList, DecoratedListProps, GlobalDefault, GlobalHelper, GlobalHook, GlobalHookName, GlobalHooks, GroupKey, IBulkAction, IBulkRecord, ICache, IImportItem, IPage, IPageFull, IPagination, IRelation, IUndecoratedMenu, IUndecoratedMenuBase, IUndecoratedMenuCategory, IUndecoratedMenuCustom, IUndecoratedMenuGroup, IUndecoratedMenuItem, IUndecoratedMenuLink, IUndecoratedMenuPage, Icon, ImportExportList, ImportExportListProps, ImportExportRedirectList, ImportLogInvalidTypes, ImportLogType, ImportMode, InMemoryCache, InMemoryCacheOptions, KeyMapper, LeaveModal, LeaveWithoutSavingModal, LeaveWithoutSavingModalProps, LocalizedDescription, LocalizedDescriptionProps, Logo, MAX_INT, MarketDefaults, MediaDefaults, MediasDefaults, MenuItem, MixerContext, Option, OrderDefaults, PRESENTATION_FIELDS, PageDefault, PresentationField, PublicURL, Publish, RelatedDefaults, RichTextDefaults, Save, SaveDraft, SelectDefaults, StaticCollectionConfig, StaticCollectionDefault, TemplateDefaults, TextDefaults, TreeItems, UIStaticCell, UIStaticField, UserRolesDefaults, WithAbstract, WithAbstractProps, WithAction, WithActionProps, WithBlock, WithBlockProps, WithCategory, WithCategoryProps, WithCheckbox, WithCheckboxProps, WithCollection, WithCollectionProps, WithColor, WithColorProps, WithComponents, WithComponentsProps, WithDate, WithDateProps, WithDescription, WithDescriptionProps, WithGlobal, WithGlobalProps, WithId, WithIdProps, WithIsActive, WithIsActiveProps, WithIsDefault, WithIsDefaultProps, WithLink, WithLinkOptions, WithLinkProps, WithMarkets, WithMarketsProps, WithMedia, WithMediaProps, WithMedias, WithMediasProps, WithMenu, WithMenuProps, WithName, WithNameProps, WithOrder, WithOrderProps, WithPage, WithPageProps, WithRelated, WithRelatedProps, WithRichText, WithRichTextProps, WithRoles, WithRolesProps, WithSelect, WithSelectProps, WithSlug, WithSlugProps, WithStatic, WithStaticProps, WithTemplate, WithTemplateProps, WithText, WithTextProps, WithTitle, WithTitleProps, afterCategoryChangeHook, afterCategoryDeleteHook, afterCollectionReadHook, afterMenuReadHook, afterPageChangeHook, afterPageDeleteHook, afterPageReadHook, appearanceOptions, beforeValidate, bowl, collectionBulkPatch, collectionExportGet, collectionImportPost, collectionIndexGet, collectionUpdatePatch, debugField, decorateCategories_, decorateCategory_, decorateHref_, decorateHrefs_, decorateMenuCategory_, decorateMenuGroup_, decorateMenuItem_, decorateMenuLink_, decorateMenuPage_, decorateMenuRoute_, decorateMenu_, decorateNav_, decorateNavs_, decorateSchema_, decorateSchemas_, deepMerge, bowl as default, defaultGroup, defaultLocale, defaultLocales, defaultMarket, defaultSlug, eachDataField, eachField, encryptData, fetchCollection, fetchCollectionItems, fetchEndpoint, fetchGlobal, fetchGlobalItems, formatSlug, getApiUrl, getCollectionItem, getCollectionItems, getEachMarketLocale, getGlobalItems, getLivePreviewURL, getLocale, getNumericParam, getObjectParam, getPages, getPagination, getPreviewURL, getPublicURL, getRoute, getRouteByCategoryAndLocale, getRouteByItemAndLocale, getRoutes, getSearchUrl, getStaticLoader, getStore, getStringParam, getSubRequest, getTranslation, getTranslations, getTreeItemClassName, hasMarket, hasRole, importExportListWithParser, internalSlugs, isAdmin, isDataField, isObject, isPresentationField, isRelation, isRole, isUndecoratedMenuItem, keyWithRequest, localeGet, localizeCollection, localizeItem, log, logMissingTranslations, menuDetailGet, menuIndexGet, modalSlug, optinPost, options, pageDetailGet, pageIndexGet, parseDepth, populateStaticFields, redirectParser, richTextAfterReadHook, richTextSerialize, roles, routeGet, routePost, routePostHandler, setMixerContext, slugToLabel, slugToLabels, sortByGroup, sortCollection, staticCollectionLoaders, staticCollections, staticDetailGet, staticIndexGet, storeGet, textToSlug, toBlock, toCollection, toField, toGlobal, toTab, translateBlock, translateBlocks, translateCollection, translateField, translateFields, translateGlobal, translateTab, translateTabs, webpack, whereCollection, withAbstract, withAbstractRequired, withAction, withBlock, withCategory, withCategoryRequired, withCheckbox, withCheckboxRequired, withCollection, withCollectionHook, withColor, withColorRequired, withComponents, withDate, withDateRequired, withDescription, withDescriptionRequired, withFieldHook, withGlobal, withGlobalHook, withId, withIdRequired, withIsActive, withIsActiveRequired, withIsDefault, withIsDefaultRequired, withLink, withLocalizedDescription, withMarkets, withMarketsRequired, withMedia, withMediaRequired, withMedias, withMediasRequired, withMenu, withName, withNameRequired, withOrder, withOrderRequired, withPage, withRelated, withRichText, withRichTextRequired, withRoles, withSelect, withSelectRequired, withSlug, withSlugRequired, withStaticCollection, withTemplate, withTemplateRequired, withText, withTextRequired, withTitle, withTitleRequired, withUIStatic };
1131
+ export { ActionDefault, BlockDefaults, BowlArrayField, BowlBlock, BowlBlockField, BowlCollapsibleField, BowlCollection, BowlConfig, BowlField, BowlGlobal, BowlGroup, BowlGroupField, BowlInitOptions, BowlOptions, BowlPlugin, BowlRole, BowlRowField, BowlSlug, BowlTab, BowlTabsField, CategoryDefaults, CategoryMenu, CategoryMenuProps, CategoryTree, CategoryTreeProps, CheckboxDefaults, CollectionDefault, CollectionHelper, CollectionHook, CollectionHookName, CollectionHooks, ColorCell, ColorConfig, ColorField, ComponentsDefaults, CustomEditModal, CustomEditModalProps, DataField, DataTree, DataTreeDragItem, DataTreeItem, DataTreeItemLi, DataTreeItemProps, DataTreeProps, DataTreeProvider, DataTreeRenameItem, DateDefaults, DebugField, DecoratedList, DecoratedListProps, GlobalDefault, GlobalHelper, GlobalHook, GlobalHookName, GlobalHooks, GroupKey, IBulkAction, IBulkRecord, ICache, IImportItem, IPage, IPageFull, IPagination, IRelation, IUndecoratedMenu, IUndecoratedMenuBase, IUndecoratedMenuCategory, IUndecoratedMenuCustom, IUndecoratedMenuGroup, IUndecoratedMenuItem, IUndecoratedMenuLink, IUndecoratedMenuPage, IUndecoratedNavItem, Icon, ImportExportList, ImportExportListProps, ImportExportRedirectList, ImportLogInvalidTypes, ImportLogType, ImportMode, InMemoryCache, InMemoryCacheOptions, KeyMapper, LeaveModal, LeaveWithoutSavingModal, LeaveWithoutSavingModalProps, LocalizedDescription, LocalizedDescriptionProps, Logo, MAX_INT, MarketDefaults, MediaDefaults, MediasDefaults, MenuItem, MixerContext, Option, OrderDefaults, PRESENTATION_FIELDS, PageDefault, PresentationField, PublicURL, Publish, RelatedDefaults, RichTextDefaults, Save, SaveDraft, SelectDefaults, StaticCollectionConfig, StaticCollectionDefault, TemplateDefaults, TextDefaults, TreeItems, UIStaticCell, UIStaticField, UserRolesDefaults, WithAbstract, WithAbstractProps, WithAction, WithActionProps, WithBlock, WithBlockProps, WithCategory, WithCategoryProps, WithCheckbox, WithCheckboxProps, WithCollection, WithCollectionProps, WithColor, WithColorProps, WithComponents, WithComponentsProps, WithDate, WithDateProps, WithDescription, WithDescriptionProps, WithGlobal, WithGlobalProps, WithId, WithIdProps, WithIsActive, WithIsActiveProps, WithIsDefault, WithIsDefaultProps, WithLink, WithLinkOptions, WithLinkProps, WithMarkets, WithMarketsProps, WithMedia, WithMediaProps, WithMedias, WithMediasProps, WithMenu, WithMenuProps, WithName, WithNameProps, WithOrder, WithOrderProps, WithPage, WithPageProps, WithRelated, WithRelatedProps, WithRichText, WithRichTextProps, WithRoles, WithRolesProps, WithSelect, WithSelectProps, WithSlug, WithSlugProps, WithStatic, WithStaticProps, WithTemplate, WithTemplateProps, WithText, WithTextProps, WithTitle, WithTitleProps, afterCategoryChangeHook, afterCategoryDeleteHook, afterCollectionReadHook, afterMenuReadHook, afterPageChangeHook, afterPageDeleteHook, afterPageReadHook, appearanceOptions, beforeDuplicateCollectionHook, beforeValidate, bowl, collectionBulkPatch, collectionExportGet, collectionImportPost, collectionIndexGet, collectionUpdatePatch, debugField, decorateCategories_, decorateCategory_, decorateHref_, decorateHrefs_, decorateMenuCategory_, decorateMenuGroup_, decorateMenuItem_, decorateMenuLink_, decorateMenuPage_, decorateMenuRoute_, decorateMenu_, decorateNavItem_, decorateNav_, decorateNavs_, decorateSchema_, decorateSchemas_, deepMerge, bowl as default, defaultGroup, defaultLocale, defaultLocales, defaultMarket, defaultSlug, eachDataField, eachField, encryptData, fetchCollection, fetchCollectionItems, fetchEndpoint, fetchGlobal, fetchGlobalItems, formatSlug, getApiUrl, getCollectionItem, getCollectionItems, getEachMarketLocale, getGlobalItems, getLivePreviewURL, getLocale, getNumericParam, getObjectParam, getPages, getPagination, getPreviewURL, getPublicURL, getRoute, getRouteByCategoryAndLocale, getRouteByItemAndLocale, getRoutes, getSearchUrl, getStaticLoader, getStore, getStringParam, getSubRequest, getTranslation, getTranslations, getTreeItemClassName, hasMarket, hasRole, importExportListWithParser, internalSlugs, isAdmin, isDataField, isObject, isPresentationField, isRelation, isRole, isUndecoratedNavItem, keyWithRequest, localeGet, localizeCollection, localizeItem, log, logMissingTranslations, menuDetailGet, menuIndexGet, modalSlug, optinPost, options, pageDetailGet, pageIndexGet, parseDepth, populateStaticFields, redirectParser, richTextAfterReadHook, richTextSerialize, roles, routeGet, routePost, routePostHandler, setMixerContext, slugToLabel, slugToLabels, sortByGroup, sortCollection, staticCollectionLoaders, staticCollections, staticDetailGet, staticIndexGet, storeGet, textToSlug, toBlock, toCollection, toField, toGlobal, toTab, translateBlock, translateBlocks, translateCollection, translateField, translateFields, translateGlobal, translateTab, translateTabs, webpack, whereCollection, withAbstract, withAbstractRequired, withAction, withBlock, withCategory, withCategoryRequired, withCheckbox, withCheckboxRequired, withCollection, withCollectionHook, withColor, withColorRequired, withComponents, withDate, withDateRequired, withDescription, withDescriptionRequired, withFieldHook, withGlobal, withGlobalHook, withId, withIdRequired, withIsActive, withIsActiveRequired, withIsDefault, withIsDefaultRequired, withLink, withLocalizedDescription, withMarkets, withMarketsRequired, withMedia, withMediaRequired, withMedias, withMediasRequired, withMenu, withName, withNameRequired, withOrder, withOrderRequired, withPage, withRelated, withRichText, withRichTextRequired, withRoles, withSelect, withSelectRequired, withSlug, withSlugRequired, withStaticCollection, withTemplate, withTemplateRequired, withText, withTextRequired, withTitle, withTitleRequired, withUIStatic };
package/dist/index.js CHANGED
@@ -247,6 +247,7 @@ __export(src_exports, {
247
247
  afterPageDeleteHook: () => afterPageDeleteHook,
248
248
  afterPageReadHook: () => afterPageReadHook,
249
249
  appearanceOptions: () => appearanceOptions,
250
+ beforeDuplicateCollectionHook: () => beforeDuplicateCollectionHook,
250
251
  beforeValidate: () => beforeValidate,
251
252
  bowl: () => bowl,
252
253
  collectionBulkPatch: () => collectionBulkPatch,
@@ -266,6 +267,7 @@ __export(src_exports, {
266
267
  decorateMenuPage_: () => decorateMenuPage_,
267
268
  decorateMenuRoute_: () => decorateMenuRoute_,
268
269
  decorateMenu_: () => decorateMenu_,
270
+ decorateNavItem_: () => decorateNavItem_,
269
271
  decorateNav_: () => decorateNav_,
270
272
  decorateNavs_: () => decorateNavs_,
271
273
  decorateSchema_: () => decorateSchema_,
@@ -321,7 +323,7 @@ __export(src_exports, {
321
323
  isPresentationField: () => isPresentationField,
322
324
  isRelation: () => isRelation,
323
325
  isRole: () => isRole,
324
- isUndecoratedMenuItem: () => isUndecoratedMenuItem,
326
+ isUndecoratedNavItem: () => isUndecoratedNavItem,
325
327
  keyWithRequest: () => keyWithRequest,
326
328
  localeGet: () => localeGet,
327
329
  localizeCollection: () => localizeCollection,
@@ -672,6 +674,7 @@ var import_react_toastify2 = require("react-toastify");
672
674
 
673
675
  // src/core/api/collection.service.ts
674
676
  var Papa = __toESM(require("papaparse"));
677
+ var import_uuid = require("uuid");
675
678
 
676
679
  // src/translations.ts
677
680
  var translations = {
@@ -2122,6 +2125,20 @@ var afterCollectionReadHook = /* @__PURE__ */ __name((collectionConfig) => async
2122
2125
  }
2123
2126
  return doc;
2124
2127
  }, "afterCollectionReadHook");
2128
+ var beforeDuplicateCollectionHook = /* @__PURE__ */ __name(async ({
2129
+ data,
2130
+ collection
2131
+ }) => {
2132
+ data = {
2133
+ ...data
2134
+ };
2135
+ collection.fields.forEach((field) => {
2136
+ if (isDataField(field) && field.unique) {
2137
+ data[field.name] = `${data[field.name]}-${(0, import_uuid.v4)()}`;
2138
+ }
2139
+ });
2140
+ return data;
2141
+ }, "beforeDuplicateCollectionHook");
2125
2142
 
2126
2143
  // src/components/DataTree/DataTree.tsx
2127
2144
  var import_bom_core3 = require("@websolutespa/bom-core");
@@ -3724,13 +3741,10 @@ function decorateMenuLink_(item, categories, routes, market) {
3724
3741
  }
3725
3742
  __name(decorateMenuLink_, "decorateMenuLink_");
3726
3743
  function decorateMenuPage_(item, categories, routes, market) {
3727
- let href = item.href;
3728
- if (!href) {
3729
- const route = routes.find(
3730
- (x) => x.schema === item.page.relationTo && x.page === item.page.value.id
3731
- );
3732
- href = route?.id;
3733
- }
3744
+ const route = routes.find(
3745
+ (x) => x.schema === item.page.relationTo && x.page === item.page.value.id
3746
+ );
3747
+ const href = route?.id;
3734
3748
  const schema = item.schema || item.page.relationTo;
3735
3749
  const page = item.page.value;
3736
3750
  const decoratedItem = {
@@ -3781,6 +3795,26 @@ function decorateMenuItem_(item, categories, routes, market, depth = 0) {
3781
3795
  }
3782
3796
  }
3783
3797
  __name(decorateMenuItem_, "decorateMenuItem_");
3798
+ function decorateNavItem_(item, categories, routes, market, depth = 0) {
3799
+ switch (item.type) {
3800
+ case "category":
3801
+ return decorateMenuCategory_(item, categories, routes, market, depth);
3802
+ case "page":
3803
+ if (Array.isArray(item.page.value)) {
3804
+ return item.page.value.map((x) => {
3805
+ return decorateMenuPage_({
3806
+ ...item,
3807
+ page: {
3808
+ ...item.page,
3809
+ value: x
3810
+ }
3811
+ }, categories, routes, market);
3812
+ });
3813
+ }
3814
+ return decorateMenuPage_(item, categories, routes, market);
3815
+ }
3816
+ }
3817
+ __name(decorateNavItem_, "decorateNavItem_");
3784
3818
  function hasMarket(item, market) {
3785
3819
  return Array.isArray(item.markets) ? item.markets.includes(market) : true;
3786
3820
  }
@@ -3820,16 +3854,16 @@ function parseNavs_(item, context) {
3820
3854
  const { market, locale, routes, categories } = context;
3821
3855
  if ((0, import_bom_core6.isArray)(item)) {
3822
3856
  item.forEach((v, k) => {
3823
- if (isUndecoratedMenuItem(v)) {
3824
- item[k] = decorateMenuItem_(v, categories, routes, market);
3857
+ if (isUndecoratedNavItem(v)) {
3858
+ item[k] = decorateNavItem_(v, categories, routes, market);
3825
3859
  } else {
3826
3860
  parseNavs_(v, context);
3827
3861
  }
3828
3862
  });
3829
3863
  } else if ((0, import_bom_core6.isObject)(item)) {
3830
3864
  Object.entries(item).forEach(([k, v]) => {
3831
- if (isUndecoratedMenuItem(v)) {
3832
- item[k] = decorateMenuItem_(v, categories, routes, market);
3865
+ if (isUndecoratedNavItem(v)) {
3866
+ item[k] = decorateNavItem_(v, categories, routes, market);
3833
3867
  } else {
3834
3868
  parseNavs_(v, context);
3835
3869
  }
@@ -3837,10 +3871,10 @@ function parseNavs_(item, context) {
3837
3871
  }
3838
3872
  }
3839
3873
  __name(parseNavs_, "parseNavs_");
3840
- function isUndecoratedMenuItem(item) {
3874
+ function isUndecoratedNavItem(item) {
3841
3875
  return (0, import_bom_core6.isObject)(item) && (item.type === "category" && ((0, import_bom_core6.isEquatable)(item.category) || (0, import_bom_core6.isObject)(item.category)) || item.type === "page" && isRelation(item.page));
3842
3876
  }
3843
- __name(isUndecoratedMenuItem, "isUndecoratedMenuItem");
3877
+ __name(isUndecoratedNavItem, "isUndecoratedNavItem");
3844
3878
  function isRelation(item) {
3845
3879
  return (0, import_bom_core6.isObject)(item) && (0, import_bom_core6.isNotNullString)(item.relationTo) && ((0, import_bom_core6.isObject)(item.value) || (0, import_bom_core6.isArray)(item.value));
3846
3880
  }
@@ -5314,6 +5348,9 @@ var withAction = /* @__PURE__ */ __name((config) => {
5314
5348
  return data;
5315
5349
  });
5316
5350
  withCollectionHook(actionConfig, "afterRead", afterCollectionReadHook(actionConfig));
5351
+ actionConfig.admin.hooks = {
5352
+ beforeDuplicate: beforeDuplicateCollectionHook
5353
+ };
5317
5354
  translateCollection(actionConfig);
5318
5355
  encryptData(actionConfig);
5319
5356
  return actionConfig;
@@ -5353,6 +5390,9 @@ var withCollection = /* @__PURE__ */ __name((config) => {
5353
5390
  ];
5354
5391
  }
5355
5392
  withCollectionHook(collectionConfig, "afterRead", afterCollectionReadHook(collectionConfig));
5393
+ collectionConfig.admin.hooks = {
5394
+ beforeDuplicate: beforeDuplicateCollectionHook
5395
+ };
5356
5396
  translateCollection(collectionConfig);
5357
5397
  return collectionConfig;
5358
5398
  }, "withCollection");
@@ -6152,16 +6192,19 @@ var withPage = /* @__PURE__ */ __name((config) => {
6152
6192
  withCollectionHook(pageConfig, "afterChange", afterPageChangeHook);
6153
6193
  withCollectionHook(pageConfig, "afterDelete", afterPageDeleteHook);
6154
6194
  withCollectionHook(pageConfig, "afterRead", afterPageReadHook(config.slug));
6195
+ pageConfig.admin.hooks = {
6196
+ beforeDuplicate: beforeDuplicateCollectionHook
6197
+ };
6155
6198
  translateCollection(pageConfig);
6156
6199
  return pageConfig;
6157
6200
  }, "withPage");
6158
6201
 
6159
6202
  // src/core/collections/withStaticCollection.ts
6160
- var import_axios = __toESM(require("axios"));
6203
+ var import_isomorphic_fetch = require("isomorphic-fetch");
6161
6204
  var ID = 0;
6162
6205
  var CACHE_3 = {};
6163
6206
  async function getCollection(url) {
6164
- const response = await import_axios.default.get(url, {});
6207
+ const response = await fetch(url, { method: "GET" }).then((response2) => response2.json());
6165
6208
  const items = response.data.items;
6166
6209
  return items;
6167
6210
  }
@@ -6972,6 +7015,7 @@ var src_default = bowl;
6972
7015
  afterPageDeleteHook,
6973
7016
  afterPageReadHook,
6974
7017
  appearanceOptions,
7018
+ beforeDuplicateCollectionHook,
6975
7019
  beforeValidate,
6976
7020
  bowl,
6977
7021
  collectionBulkPatch,
@@ -6991,6 +7035,7 @@ var src_default = bowl;
6991
7035
  decorateMenuPage_,
6992
7036
  decorateMenuRoute_,
6993
7037
  decorateMenu_,
7038
+ decorateNavItem_,
6994
7039
  decorateNav_,
6995
7040
  decorateNavs_,
6996
7041
  decorateSchema_,
@@ -7045,7 +7090,7 @@ var src_default = bowl;
7045
7090
  isPresentationField,
7046
7091
  isRelation,
7047
7092
  isRole,
7048
- isUndecoratedMenuItem,
7093
+ isUndecoratedNavItem,
7049
7094
  keyWithRequest,
7050
7095
  localeGet,
7051
7096
  localizeCollection,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/payload-plugin-bowl",
3
- "version": "1.7.5",
3
+ "version": "1.7.7",
4
4
  "description": "Bowl PayloadCms plugin of the BOM Repository",
5
5
  "keywords": [
6
6
  "payload",
@@ -33,8 +33,8 @@
33
33
  "peerDependencies": {
34
34
  "@payloadcms/db-mongodb": ">= 1.2.0",
35
35
  "@websolutespa/bom-core": "*",
36
- "axios": "0.27.2",
37
- "i18next": ">= 22.4.9",
36
+ "i18next": ">= 22.5.1",
37
+ "isomorphic-fetch": ">= 3.0.0",
38
38
  "payload": ">= 2.11.2",
39
39
  "react": ">= 18.2.0",
40
40
  "uuid": ">= 9.0.1"
@@ -42,21 +42,22 @@
42
42
  "devDependencies": {
43
43
  "@types/escape-html": "^1.0.2",
44
44
  "@types/express": "^4.17.15",
45
+ "@types/isomorphic-fetch": "^0.0.39",
45
46
  "@types/papaparse": "^5.3.7",
46
47
  "@types/uuid": "^9.0.2",
47
48
  "@websolutespa/bom-cli": "*",
48
49
  "@websolutespa/test": "*",
49
50
  "@websolutespa/tsconfig": "*",
50
- "axios": "0.27.2",
51
51
  "esbuild-sass-plugin": "^2.10.0",
52
52
  "eslint-config-websolute": "*",
53
- "eslint": "^8.46.0",
54
- "i18next": "^22.4.9",
53
+ "eslint": "^9.0.0",
54
+ "i18next": "^22.5.1",
55
+ "isomorphic-fetch": "^3.0.0",
55
56
  "mongodb-memory-server": "^8.13.0",
56
57
  "react": "^18.2.0",
57
- "ts-node": "^10.9.1",
58
+ "ts-node": "^10.9.2",
58
59
  "tsup": "^6.7.0",
59
- "typescript": "^5.1.6",
60
+ "typescript": "^5.4.5",
60
61
  "uuid": "^9.0.1"
61
62
  },
62
63
  "publishConfig": {
package/scss/styles.scss CHANGED
@@ -127,3 +127,13 @@
127
127
  .tabs-field__tab-button {
128
128
  text-decoration: none;
129
129
  }
130
+
131
+ .card-menu {
132
+ display: flex;
133
+ align-items: center;
134
+ justify-content: space-between;
135
+
136
+ &>.card__actions {
137
+ margin: 0;
138
+ }
139
+ }