@ai-stack/payloadcms 3.0.0-beta.95.0 → 3.0.0-beta.95.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.
@@ -1,4 +1,3 @@
1
- export { DescriptionFieldComponent } from '../fields/DescriptionField/DescriptionFieldComponent.js';
2
1
  export { LexicalEditorFeatureClient } from '../fields/LexicalEditor/feature.client.js';
3
2
  export { InstructionsProvider } from '../providers/InstructionsProvider/InstructionsProvider.js';
4
3
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yDAAyD,CAAA;AACnG,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAA;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2DAA2D,CAAA"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAA;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2DAA2D,CAAA"}
@@ -1,4 +1,3 @@
1
- export { DescriptionFieldComponent } from '../fields/DescriptionField/DescriptionFieldComponent.js';
2
1
  export { LexicalEditorFeatureClient } from '../fields/LexicalEditor/feature.client.js';
3
2
  export { InstructionsProvider } from '../providers/InstructionsProvider/InstructionsProvider.js';
4
3
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["export { DescriptionFieldComponent } from '../fields/DescriptionField/DescriptionFieldComponent.js'\nexport { LexicalEditorFeatureClient } from '../fields/LexicalEditor/feature.client.js'\nexport { InstructionsProvider } from '../providers/InstructionsProvider/InstructionsProvider.js'\n"],"names":["DescriptionFieldComponent","LexicalEditorFeatureClient","InstructionsProvider"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ,0DAAyD;AACnG,SAASC,0BAA0B,QAAQ,4CAA2C;AACtF,SAASC,oBAAoB,QAAQ,4DAA2D"}
1
+ {"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["export { LexicalEditorFeatureClient } from '../fields/LexicalEditor/feature.client.js'\nexport { InstructionsProvider } from '../providers/InstructionsProvider/InstructionsProvider.js'\n"],"names":["LexicalEditorFeatureClient","InstructionsProvider"],"mappings":"AAAA,SAASA,0BAA0B,QAAQ,4CAA2C;AACtF,SAASC,oBAAoB,QAAQ,4DAA2D"}
@@ -1,4 +1,4 @@
1
- export { PayloadAiPluginLexicalEditorFeature } from '../fields/LexicalEditor/feature.server.js';
2
1
  export { PromptEditorField } from '../fields/PromptEditorField/PromptEditorField.js';
3
2
  export { SelectField } from '../fields/SelectField/SelectField.js';
3
+ export { DescriptionField } from '../fields/DescriptionField/DescriptionField.js';
4
4
  //# sourceMappingURL=fields.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../src/exports/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,2CAA2C,CAAA;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAA;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA"}
1
+ {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../src/exports/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAA;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAA"}
@@ -1,5 +1,5 @@
1
- export { PayloadAiPluginLexicalEditorFeature } from '../fields/LexicalEditor/feature.server.js';
2
1
  export { PromptEditorField } from '../fields/PromptEditorField/PromptEditorField.js';
3
2
  export { SelectField } from '../fields/SelectField/SelectField.js';
3
+ export { DescriptionField } from '../fields/DescriptionField/DescriptionField.js';
4
4
 
5
5
  //# sourceMappingURL=fields.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/exports/fields.ts"],"sourcesContent":["export { PayloadAiPluginLexicalEditorFeature } from '../fields/LexicalEditor/feature.server.js'\nexport { PromptEditorField } from '../fields/PromptEditorField/PromptEditorField.js'\nexport { SelectField } from '../fields/SelectField/SelectField.js'\n"],"names":["PayloadAiPluginLexicalEditorFeature","PromptEditorField","SelectField"],"mappings":"AAAA,SAASA,mCAAmC,QAAQ,4CAA2C;AAC/F,SAASC,iBAAiB,QAAQ,mDAAkD;AACpF,SAASC,WAAW,QAAQ,uCAAsC"}
1
+ {"version":3,"sources":["../../src/exports/fields.ts"],"sourcesContent":["export { PromptEditorField } from '../fields/PromptEditorField/PromptEditorField.js'\nexport { SelectField } from '../fields/SelectField/SelectField.js'\nexport { DescriptionField } from '../fields/DescriptionField/DescriptionField.js'\n"],"names":["PromptEditorField","SelectField","DescriptionField"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,mDAAkD;AACpF,SAASC,WAAW,QAAQ,uCAAsC;AAClE,SAASC,gBAAgB,QAAQ,iDAAgD"}
@@ -1,2 +1,4 @@
1
- export declare const DescriptionField: (options: any) => import("react").FC<{}>;
1
+ import React from 'react';
2
+ import { FieldDescriptionClientProps } from 'payload';
3
+ export declare const DescriptionField: React.FC<FieldDescriptionClientProps>;
2
4
  //# sourceMappingURL=DescriptionField.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DescriptionField.d.ts","sourceRoot":"","sources":["../../../src/fields/DescriptionField/DescriptionField.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB,YAAa,GAAG,2BAW5C,CAAA"}
1
+ {"version":3,"file":"DescriptionField.d.ts","sourceRoot":"","sources":["../../../src/fields/DescriptionField/DescriptionField.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAErD,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAOlE,CAAA"}
@@ -1,16 +1,18 @@
1
- import { withMergedProps } from '@payloadcms/ui/shared';
2
- import { DescriptionFieldComponent } from './DescriptionFieldComponent.js';
3
- // import { DescriptionComponent } from 'payload'
4
- //DescriptionField: DescriptionComponent
5
- export const DescriptionField = (options)=>{
6
- const mergedPropsFunc = withMergedProps({
7
- Component: DescriptionFieldComponent,
8
- sanitizeServerOnlyProps: true,
9
- toMergeIntoProps: options
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useFieldProps } from '@payloadcms/ui';
4
+ import React from 'react';
5
+ import { useInstructions } from '../../providers/InstructionsProvider/useInstructions.js';
6
+ import { Actions } from '../../ui/Actions/Actions.js';
7
+ export const DescriptionField = (props)=>{
8
+ const { schemaPath } = useFieldProps();
9
+ const { id: instructionId } = useInstructions({
10
+ path: schemaPath
11
+ });
12
+ return /*#__PURE__*/ _jsx(Actions, {
13
+ descriptionProps: props,
14
+ instructionId: instructionId
10
15
  });
11
- // TODO: Might use this in order to add field entry for Instructions on plugin Init
12
- mergedPropsFunc.displayName = 'DescriptionField';
13
- return mergedPropsFunc;
14
16
  };
15
17
 
16
18
  //# sourceMappingURL=DescriptionField.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/DescriptionField/DescriptionField.tsx"],"sourcesContent":["import { withMergedProps } from '@payloadcms/ui/shared'\n\nimport { DescriptionFieldComponent } from './DescriptionFieldComponent.js'\n// import { DescriptionComponent } from 'payload'\n\n//DescriptionField: DescriptionComponent\n\nexport const DescriptionField = (options: any) => {\n const mergedPropsFunc = withMergedProps({\n Component: DescriptionFieldComponent,\n sanitizeServerOnlyProps: true,\n toMergeIntoProps: options,\n })\n\n // TODO: Might use this in order to add field entry for Instructions on plugin Init\n mergedPropsFunc.displayName = 'DescriptionField'\n\n return mergedPropsFunc\n}\n"],"names":["withMergedProps","DescriptionFieldComponent","DescriptionField","options","mergedPropsFunc","Component","sanitizeServerOnlyProps","toMergeIntoProps","displayName"],"mappings":"AAAA,SAASA,eAAe,QAAQ,wBAAuB;AAEvD,SAASC,yBAAyB,QAAQ,iCAAgC;AAC1E,iDAAiD;AAEjD,wCAAwC;AAExC,OAAO,MAAMC,mBAAmB,CAACC;IAC/B,MAAMC,kBAAkBJ,gBAAgB;QACtCK,WAAWJ;QACXK,yBAAyB;QACzBC,kBAAkBJ;IACpB;IAEA,mFAAmF;IACnFC,gBAAgBI,WAAW,GAAG;IAE9B,OAAOJ;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/fields/DescriptionField/DescriptionField.tsx"],"sourcesContent":["'use client'\n\nimport { useFieldProps } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { useInstructions } from '../../providers/InstructionsProvider/useInstructions.js'\nimport { Actions } from '../../ui/Actions/Actions.js'\nimport { FieldDescriptionClientProps } from 'payload'\n\nexport const DescriptionField: React.FC<FieldDescriptionClientProps> = (props) => {\n const { schemaPath } = useFieldProps()\n const { id: instructionId } = useInstructions({\n path: schemaPath,\n })\n\n return <Actions descriptionProps={props} instructionId={instructionId} />\n}\n"],"names":["useFieldProps","React","useInstructions","Actions","DescriptionField","props","schemaPath","id","instructionId","path","descriptionProps"],"mappings":"AAAA;;AAEA,SAASA,aAAa,QAAQ,iBAAgB;AAC9C,OAAOC,WAAW,QAAO;AAEzB,SAASC,eAAe,QAAQ,0DAAyD;AACzF,SAASC,OAAO,QAAQ,8BAA6B;AAGrD,OAAO,MAAMC,mBAA0D,CAACC;IACtE,MAAM,EAAEC,UAAU,EAAE,GAAGN;IACvB,MAAM,EAAEO,IAAIC,aAAa,EAAE,GAAGN,gBAAgB;QAC5CO,MAAMH;IACR;IAEA,qBAAO,KAACH;QAAQO,kBAAkBL;QAAOG,eAAeA;;AAC1D,EAAC"}
@@ -1,8 +1,2 @@
1
- export declare const PayloadAiPluginLexicalEditorFeature: import("@payloadcms/richtext-lexical").FeatureProviderProviderServer<undefined, {
2
- applyToFocusedEditor: any;
3
- disableIfParentHasFixedToolbar: any;
4
- }, {
5
- applyToFocusedEditor: any;
6
- disableIfParentHasFixedToolbar: any;
7
- }>;
1
+ export declare const PayloadAiPluginLexicalEditorFeature: import("@payloadcms/richtext-lexical").FeatureProviderProviderServer<undefined, undefined, undefined>;
8
2
  //# sourceMappingURL=feature.server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../src/fields/LexicalEditor/feature.server.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mCAAmC;;;;;;EAiB9C,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../src/fields/LexicalEditor/feature.server.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,mCAAmC,uGAK9C,CAAA"}
@@ -3,16 +3,8 @@ import { PLUGIN_LEXICAL_EDITOR_FEATURE } from '../../defaults.js';
3
3
  import { isPluginActivated } from '../../utilities/isPluginActivated.js';
4
4
  const isActivated = isPluginActivated();
5
5
  export const PayloadAiPluginLexicalEditorFeature = createServerFeature({
6
- feature: ({ props })=>{
7
- const sanitizedProps = {
8
- applyToFocusedEditor: props?.applyToFocusedEditor === undefined ? false : props.applyToFocusedEditor,
9
- disableIfParentHasFixedToolbar: props?.disableIfParentHasFixedToolbar === undefined ? false : props.disableIfParentHasFixedToolbar
10
- };
11
- return {
12
- ClientFeature: isActivated ? '@ai-stack/payloadcms/client#LexicalEditorFeatureClient' : null,
13
- clientFeatureProps: sanitizedProps,
14
- sanitizedServerFeatureProps: sanitizedProps
15
- };
6
+ feature: {
7
+ ClientFeature: isActivated ? '@ai-stack/payloadcms/client#LexicalEditorFeatureClient' : null
16
8
  },
17
9
  key: PLUGIN_LEXICAL_EDITOR_FEATURE
18
10
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/LexicalEditor/feature.server.ts"],"sourcesContent":["import { createServerFeature } from '@payloadcms/richtext-lexical'\n\nimport { PLUGIN_LEXICAL_EDITOR_FEATURE } from '../../defaults.js'\nimport { isPluginActivated } from '../../utilities/isPluginActivated.js'\n\nconst isActivated = isPluginActivated()\n\nexport const PayloadAiPluginLexicalEditorFeature = createServerFeature({\n feature: ({ props }: Record<any, any>) => {\n const sanitizedProps = {\n applyToFocusedEditor:\n props?.applyToFocusedEditor === undefined ? false : props.applyToFocusedEditor,\n disableIfParentHasFixedToolbar:\n props?.disableIfParentHasFixedToolbar === undefined\n ? false\n : props.disableIfParentHasFixedToolbar,\n }\n return {\n ClientFeature: isActivated ? '@ai-stack/payloadcms/client#LexicalEditorFeatureClient' : null,\n clientFeatureProps: sanitizedProps,\n sanitizedServerFeatureProps: sanitizedProps,\n }\n },\n key: PLUGIN_LEXICAL_EDITOR_FEATURE,\n})\n"],"names":["createServerFeature","PLUGIN_LEXICAL_EDITOR_FEATURE","isPluginActivated","isActivated","PayloadAiPluginLexicalEditorFeature","feature","props","sanitizedProps","applyToFocusedEditor","undefined","disableIfParentHasFixedToolbar","ClientFeature","clientFeatureProps","sanitizedServerFeatureProps","key"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,+BAA8B;AAElE,SAASC,6BAA6B,QAAQ,oBAAmB;AACjE,SAASC,iBAAiB,QAAQ,uCAAsC;AAExE,MAAMC,cAAcD;AAEpB,OAAO,MAAME,sCAAsCJ,oBAAoB;IACrEK,SAAS,CAAC,EAAEC,KAAK,EAAoB;QACnC,MAAMC,iBAAiB;YACrBC,sBACEF,OAAOE,yBAAyBC,YAAY,QAAQH,MAAME,oBAAoB;YAChFE,gCACEJ,OAAOI,mCAAmCD,YACtC,QACAH,MAAMI,8BAA8B;QAC5C;QACA,OAAO;YACLC,eAAeR,cAAc,2DAA2D;YACxFS,oBAAoBL;YACpBM,6BAA6BN;QAC/B;IACF;IACAO,KAAKb;AACP,GAAE"}
1
+ {"version":3,"sources":["../../../src/fields/LexicalEditor/feature.server.ts"],"sourcesContent":["import { createServerFeature } from '@payloadcms/richtext-lexical'\n\nimport { PLUGIN_LEXICAL_EDITOR_FEATURE } from '../../defaults.js'\nimport { isPluginActivated } from '../../utilities/isPluginActivated.js'\n\nconst isActivated = isPluginActivated()\n\nexport const PayloadAiPluginLexicalEditorFeature = createServerFeature({\n feature: {\n ClientFeature: isActivated ? '@ai-stack/payloadcms/client#LexicalEditorFeatureClient' : null,\n },\n key: PLUGIN_LEXICAL_EDITOR_FEATURE,\n})\n"],"names":["createServerFeature","PLUGIN_LEXICAL_EDITOR_FEATURE","isPluginActivated","isActivated","PayloadAiPluginLexicalEditorFeature","feature","ClientFeature","key"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,+BAA8B;AAElE,SAASC,6BAA6B,QAAQ,oBAAmB;AACjE,SAASC,iBAAiB,QAAQ,uCAAsC;AAExE,MAAMC,cAAcD;AAEpB,OAAO,MAAME,sCAAsCJ,oBAAoB;IACrEK,SAAS;QACPC,eAAeH,cAAc,2DAA2D;IAC1F;IACAI,KAAKN;AACP,GAAE"}
@@ -35,7 +35,7 @@ export const updateFieldsConfig = (collectionConfig)=>{
35
35
  ...field.admin,
36
36
  components: {
37
37
  ...field.admin?.components || {},
38
- Description: '@ai-stack/payloadcms/client#DescriptionFieldComponent'
38
+ Description: '@ai-stack/payloadcms/fields#DescriptionField'
39
39
  }
40
40
  }
41
41
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/updateFieldsConfig.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\ninterface UpdateFieldsConfig {\n schemaPathMap: Record<string, string>\n updatedCollectionConfig: CollectionConfig\n}\n\nexport const updateFieldsConfig = (collectionConfig: CollectionConfig): UpdateFieldsConfig => {\n let schemaPathMap = {}\n function updateField(field: any, parentPath = ''): any {\n const currentPath = parentPath ? `${parentPath}.${field.name}` : field.name\n const currentSchemaPath = `${collectionConfig.slug}.${currentPath}`\n\n if (field.admin?.disabled || field.admin?.readOnly || field.admin?.hidden) {\n return field\n }\n\n // Map field path for global fieldInstructionsMap to load related instructions\n // This is done due to save extra API call to get instructions when Field components are loaded in admin\n // Doing is will only call instructions data when user clicks on settings\n if (['richText', 'text', 'textarea', 'upload'].includes(field.type)) {\n schemaPathMap = {\n ...schemaPathMap,\n [currentSchemaPath]: {\n type: field.type,\n label: field.label || field.name,\n },\n }\n }\n\n // Inject AI actions, richText is not included here as it has to be explicitly defined by user\n if (['text', 'textarea', 'upload'].includes(field.type)) {\n return {\n ...field,\n admin: {\n ...field.admin,\n components: {\n ...(field.admin?.components || {}),\n Description: '@ai-stack/payloadcms/client#DescriptionFieldComponent',\n // Description: DescriptionField({\n // Description: field.admin?.components?.Description,\n // }),\n },\n },\n }\n }\n\n if (field.fields) {\n return {\n ...field,\n fields: field.fields.map((subField: any) => updateField(subField, currentPath)),\n }\n }\n\n if (field.tabs) {\n return {\n ...field,\n tabs: field.tabs.map((tab: any) => ({\n ...tab,\n fields: tab.fields.map((subField: any) => updateField(subField, currentPath)),\n })),\n }\n }\n\n if (field.blocks) {\n return {\n ...field,\n blocks: field.blocks.map((block: any) => ({\n ...block,\n fields: block.fields.map((subField: any) =>\n updateField(subField, `${currentPath}.${block.slug}`),\n ),\n })),\n }\n }\n\n return field\n }\n\n const updatedCollectionConfig = {\n ...collectionConfig,\n fields: collectionConfig.fields.map((field) => updateField(field)),\n }\n\n return {\n schemaPathMap,\n updatedCollectionConfig,\n }\n}\n"],"names":["updateFieldsConfig","collectionConfig","schemaPathMap","updateField","field","parentPath","currentPath","name","currentSchemaPath","slug","admin","disabled","readOnly","hidden","includes","type","label","components","Description","fields","map","subField","tabs","tab","blocks","block","updatedCollectionConfig"],"mappings":"AAOA,OAAO,MAAMA,qBAAqB,CAACC;IACjC,IAAIC,gBAAgB,CAAC;IACrB,SAASC,YAAYC,KAAU,EAAEC,aAAa,EAAE;QAC9C,MAAMC,cAAcD,aAAa,CAAC,EAAEA,WAAW,CAAC,EAAED,MAAMG,IAAI,CA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gBACL,GAAGpB,KAAK;gBACRoB,QAAQpB,MAAMoB,MAAM,CAACJ,GAAG,CAAC,CAACK,QAAgB,CAAA;wBACxC,GAAGA,KAAK;wBACRN,QAAQM,MAAMN,MAAM,CAACC,GAAG,CAAC,CAACC,WACxBlB,YAAYkB,UAAU,CAAC,EAAEf,YAAY,CAAC,EAAEmB,MAAMhB,IAAI,CAAC,CAAC;oBAExD,CAAA;YACF;QACF;QAEA,OAAOL;IACT;IAEA,MAAMsB,0BAA0B;QAC9B,GAAGzB,gBAAgB;QACnBkB,QAAQlB,iBAAiBkB,MAAM,CAACC,GAAG,CAAC,CAAChB,QAAUD,YAAYC;IAC7D;IAEA,OAAO;QACLF;QACAwB;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../src/utilities/updateFieldsConfig.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\ninterface UpdateFieldsConfig {\n schemaPathMap: Record<string, string>\n updatedCollectionConfig: CollectionConfig\n}\n\nexport const updateFieldsConfig = (collectionConfig: CollectionConfig): UpdateFieldsConfig => {\n let schemaPathMap = {}\n function updateField(field: any, parentPath = ''): any {\n const currentPath = parentPath ? `${parentPath}.${field.name}` : field.name\n const currentSchemaPath = `${collectionConfig.slug}.${currentPath}`\n\n if (field.admin?.disabled || field.admin?.readOnly || field.admin?.hidden) {\n return field\n }\n\n // Map field path for global fieldInstructionsMap to load related instructions\n // This is done due to save extra API call to get instructions when Field components are loaded in admin\n // Doing is will only call instructions data when user clicks on settings\n if (['richText', 'text', 'textarea', 'upload'].includes(field.type)) {\n schemaPathMap = {\n ...schemaPathMap,\n [currentSchemaPath]: {\n type: field.type,\n label: field.label || field.name,\n },\n }\n }\n\n // Inject AI actions, richText is not included here as it has to be explicitly defined by user\n if (['text', 'textarea', 'upload'].includes(field.type)) {\n return {\n ...field,\n admin: {\n ...field.admin,\n components: {\n ...(field.admin?.components || {}),\n Description: '@ai-stack/payloadcms/fields#DescriptionField',\n // Description: DescriptionField({\n // Description: field.admin?.components?.Description,\n // }),\n },\n },\n }\n }\n\n if (field.fields) {\n return {\n ...field,\n fields: field.fields.map((subField: any) => updateField(subField, currentPath)),\n }\n }\n\n if (field.tabs) {\n return {\n ...field,\n tabs: field.tabs.map((tab: any) => ({\n ...tab,\n fields: tab.fields.map((subField: any) => updateField(subField, currentPath)),\n })),\n }\n }\n\n if (field.blocks) {\n return {\n ...field,\n blocks: field.blocks.map((block: any) => ({\n ...block,\n fields: block.fields.map((subField: any) =>\n updateField(subField, `${currentPath}.${block.slug}`),\n ),\n })),\n }\n }\n\n return field\n }\n\n const updatedCollectionConfig = {\n ...collectionConfig,\n fields: collectionConfig.fields.map((field) => updateField(field)),\n }\n\n return {\n schemaPathMap,\n updatedCollectionConfig,\n }\n}\n"],"names":["updateFieldsConfig","collectionConfig","schemaPathMap","updateField","field","parentPath","currentPath","name","currentSchemaPath","slug","admin","disabled","readOnly","hidden","includes","type","label","components","Description","fields","map","subField","tabs","tab","blocks","block","updatedCollectionConfig"],"mappings":"AAOA,OAAO,MAAMA,qBAAqB,CAACC;IACjC,IAAIC,gBAAgB,CAAC;IACrB,SAASC,YAAYC,KAAU,EAAEC,aAAa,EAAE;QAC9C,MAAMC,cAAcD,aAAa,CAAC,EAAEA,WAAW,CAAC,EAAED,MAAMG,IAAI,CAAC,CAAC,GAAGH,MAAMG,IAAI;QAC3E,MAAMC,oBAAoB,CAAC,EAAEP,iBAAiBQ,IAAI,CAAC,CAAC,EAAEH,YAAY,CAAC;QAEnE,IAAIF,MAAMM,KAAK,EAAEC,YAAYP,MAAMM,KAAK,EAAEE,YAAYR,MAAMM,KAAK,EAAEG,QAAQ;YACzE,OAAOT;QACT;QAEA,8EAA8E;QAC9E,wGAAwG;QACxG,yEAAyE;QACzE,IAAI;YAAC;YAAY;YAAQ;YAAY;SAAS,CAACU,QAAQ,CAACV,MAAMW,IAAI,GAAG;YACnEb,gBAAgB;gBACd,GAAGA,aAAa;gBAChB,CAACM,kBAAkB,EAAE;oBACnBO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QACLF;QACAwB;IACF;AACF,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-stack/payloadcms",
3
- "version": "3.0.0-beta.95.0",
3
+ "version": "3.0.0-beta.95.2",
4
4
  "private": false,
5
5
  "bugs": "https://github.com/ashbuilds/payload-ai/issues",
6
6
  "repository": "https://github.com/ashbuilds/payload-ai",
@@ -121,6 +121,28 @@
121
121
  "types": "./dist/index.d.ts",
122
122
  "@ai-stack:registry": "https://registry.npmjs.org",
123
123
  "access": "public",
124
- "provenance": true
124
+ "provenance": true,
125
+ "exports": {
126
+ ".": {
127
+ "import": "./dist/index.js",
128
+ "types": "./dist/index.d.ts",
129
+ "default": "./dist/index.js"
130
+ },
131
+ "./types": {
132
+ "import": "./dist/exports/types.js",
133
+ "types": "./dist/exports/types.d.ts",
134
+ "default": "./dist/exports/types.js"
135
+ },
136
+ "./fields": {
137
+ "import": "./dist/exports/fields.js",
138
+ "types": "./dist/exports/fields.d.ts",
139
+ "default": "./dist/exports/fields.js"
140
+ },
141
+ "./client": {
142
+ "import": "./dist/exports/client.js",
143
+ "types": "./dist/exports/client.d.ts",
144
+ "default": "./dist/exports/client.js"
145
+ }
146
+ }
125
147
  }
126
148
  }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const DescriptionFieldComponent: React.FC;
3
- //# sourceMappingURL=DescriptionFieldComponent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DescriptionFieldComponent.d.ts","sourceRoot":"","sources":["../../../src/fields/DescriptionField/DescriptionFieldComponent.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAO7C,CAAA"}
@@ -1,19 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- // import type { FieldDescriptionProps } from 'payload'
4
- import { useFieldProps } from '@payloadcms/ui';
5
- import React from 'react';
6
- import { useInstructions } from '../../providers/InstructionsProvider/useInstructions.js';
7
- import { Actions } from '../../ui/Actions/Actions.js';
8
- export const DescriptionFieldComponent = (props)=>{
9
- const { schemaPath } = useFieldProps();
10
- const { id: instructionId } = useInstructions({
11
- path: schemaPath
12
- });
13
- return /*#__PURE__*/ _jsx(Actions, {
14
- descriptionProps: props,
15
- instructionId: instructionId
16
- });
17
- };
18
-
19
- //# sourceMappingURL=DescriptionFieldComponent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/fields/DescriptionField/DescriptionFieldComponent.tsx"],"sourcesContent":["'use client'\n\n// import type { FieldDescriptionProps } from 'payload'\n\nimport { useFieldProps } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { useInstructions } from '../../providers/InstructionsProvider/useInstructions.js'\nimport { Actions } from '../../ui/Actions/Actions.js'\n\nexport const DescriptionFieldComponent: React.FC = (props) => {\n const { schemaPath } = useFieldProps()\n const { id: instructionId } = useInstructions({\n path: schemaPath,\n })\n\n return <Actions descriptionProps={props} instructionId={instructionId} />\n}\n"],"names":["useFieldProps","React","useInstructions","Actions","DescriptionFieldComponent","props","schemaPath","id","instructionId","path","descriptionProps"],"mappings":"AAAA;;AAEA,uDAAuD;AAEvD,SAASA,aAAa,QAAQ,iBAAgB;AAC9C,OAAOC,WAAW,QAAO;AAEzB,SAASC,eAAe,QAAQ,0DAAyD;AACzF,SAASC,OAAO,QAAQ,8BAA6B;AAErD,OAAO,MAAMC,4BAAsC,CAACC;IAClD,MAAM,EAAEC,UAAU,EAAE,GAAGN;IACvB,MAAM,EAAEO,IAAIC,aAAa,EAAE,GAAGN,gBAAgB;QAC5CO,MAAMH;IACR;IAEA,qBAAO,KAACH;QAAQO,kBAAkBL;QAAOG,eAAeA;;AAC1D,EAAC"}