@payloadcms/plugin-multi-tenant 3.62.0-canary.3 → 3.62.0-canary.4
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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/WatchTenantCollection/index.tsx"],"sourcesContent":["'use client'\n\nimport type { ClientCollectionConfig } from 'payload'\n\nimport {\n useConfig,\n useDocumentInfo,\n useDocumentTitle,\n useEffectEvent,\n useFormFields,\n useFormSubmitted,\n useOperation,\n} from '@payloadcms/ui'\nimport React from 'react'\n\nimport { useTenantSelection } from '../../providers/TenantSelectionProvider/index.client.js'\n\nexport const WatchTenantCollection = () => {\n const { id, collectionSlug } = useDocumentInfo()\n const operation = useOperation()\n const submitted = useFormSubmitted()\n const { title } = useDocumentTitle()\n\n const { getEntityConfig } = useConfig()\n const [useAsTitleName] = React.useState(\n () => (getEntityConfig({ collectionSlug }) as ClientCollectionConfig).admin.useAsTitle,\n )\n const titleField = useFormFields(([fields]) => (useAsTitleName ? fields[useAsTitleName] : {}))\n\n const { syncTenants, updateTenants } = useTenantSelection()\n\n const syncTenantTitle = useEffectEvent(() => {\n if (id) {\n updateTenants({ id, label: title })\n }\n })\n\n React.useEffect(() => {\n // only update the tenant selector when the document saves\n // → aka when initial value changes\n if (id && titleField?.initialValue) {\n void syncTenantTitle()\n }\n }, [id, titleField?.initialValue
|
|
1
|
+
{"version":3,"sources":["../../../src/components/WatchTenantCollection/index.tsx"],"sourcesContent":["'use client'\n\nimport type { ClientCollectionConfig } from 'payload'\n\nimport {\n useConfig,\n useDocumentInfo,\n useDocumentTitle,\n useEffectEvent,\n useFormFields,\n useFormSubmitted,\n useOperation,\n} from '@payloadcms/ui'\nimport React from 'react'\n\nimport { useTenantSelection } from '../../providers/TenantSelectionProvider/index.client.js'\n\nexport const WatchTenantCollection = () => {\n const { id, collectionSlug } = useDocumentInfo()\n const operation = useOperation()\n const submitted = useFormSubmitted()\n const { title } = useDocumentTitle()\n\n const { getEntityConfig } = useConfig()\n const [useAsTitleName] = React.useState(\n () => (getEntityConfig({ collectionSlug }) as ClientCollectionConfig).admin.useAsTitle,\n )\n const titleField = useFormFields(([fields]) => (useAsTitleName ? fields[useAsTitleName] : {}))\n\n const { syncTenants, updateTenants } = useTenantSelection()\n\n const syncTenantTitle = useEffectEvent(() => {\n if (id) {\n updateTenants({ id, label: title })\n }\n })\n\n React.useEffect(() => {\n // only update the tenant selector when the document saves\n // → aka when initial value changes\n if (id && titleField?.initialValue) {\n void syncTenantTitle()\n }\n }, [id, titleField?.initialValue])\n\n React.useEffect(() => {\n if (operation === 'create' && submitted) {\n void syncTenants()\n }\n }, [operation, submitted, syncTenants, id])\n\n return null\n}\n"],"names":["useConfig","useDocumentInfo","useDocumentTitle","useEffectEvent","useFormFields","useFormSubmitted","useOperation","React","useTenantSelection","WatchTenantCollection","id","collectionSlug","operation","submitted","title","getEntityConfig","useAsTitleName","useState","admin","useAsTitle","titleField","fields","syncTenants","updateTenants","syncTenantTitle","label","useEffect","initialValue"],"mappings":"AAAA;AAIA,SACEA,SAAS,EACTC,eAAe,EACfC,gBAAgB,EAChBC,cAAc,EACdC,aAAa,EACbC,gBAAgB,EAChBC,YAAY,QACP,iBAAgB;AACvB,OAAOC,WAAW,QAAO;AAEzB,SAASC,kBAAkB,QAAQ,0DAAyD;AAE5F,OAAO,MAAMC,wBAAwB;IACnC,MAAM,EAAEC,EAAE,EAAEC,cAAc,EAAE,GAAGV;IAC/B,MAAMW,YAAYN;IAClB,MAAMO,YAAYR;IAClB,MAAM,EAAES,KAAK,EAAE,GAAGZ;IAElB,MAAM,EAAEa,eAAe,EAAE,GAAGf;IAC5B,MAAM,CAACgB,eAAe,GAAGT,MAAMU,QAAQ,CACrC,IAAM,AAACF,gBAAgB;YAAEJ;QAAe,GAA8BO,KAAK,CAACC,UAAU;IAExF,MAAMC,aAAahB,cAAc,CAAC,CAACiB,OAAO,GAAML,iBAAiBK,MAAM,CAACL,eAAe,GAAG,CAAC;IAE3F,MAAM,EAAEM,WAAW,EAAEC,aAAa,EAAE,GAAGf;IAEvC,MAAMgB,kBAAkBrB,eAAe;QACrC,IAAIO,IAAI;YACNa,cAAc;gBAAEb;gBAAIe,OAAOX;YAAM;QACnC;IACF;IAEAP,MAAMmB,SAAS,CAAC;QACd,0DAA0D;QAC1D,mCAAmC;QACnC,IAAIhB,MAAMU,YAAYO,cAAc;YAClC,KAAKH;QACP;IACF,GAAG;QAACd;QAAIU,YAAYO;KAAa;IAEjCpB,MAAMmB,SAAS,CAAC;QACd,IAAId,cAAc,YAAYC,WAAW;YACvC,KAAKS;QACP;IACF,GAAG;QAACV;QAAWC;QAAWS;QAAaZ;KAAG;IAE1C,OAAO;AACT,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/plugin-multi-tenant",
|
|
3
|
-
"version": "3.62.0-canary.
|
|
3
|
+
"version": "3.62.0-canary.4",
|
|
4
4
|
"description": "Multi Tenant plugin for Payload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -81,14 +81,14 @@
|
|
|
81
81
|
],
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@payloadcms/eslint-config": "3.28.0",
|
|
84
|
-
"@payloadcms/
|
|
85
|
-
"
|
|
86
|
-
"
|
|
84
|
+
"@payloadcms/translations": "3.62.0-canary.4",
|
|
85
|
+
"payload": "3.62.0-canary.4",
|
|
86
|
+
"@payloadcms/ui": "3.62.0-canary.4"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"next": "^15.2.3",
|
|
90
|
-
"
|
|
91
|
-
"
|
|
90
|
+
"@payloadcms/ui": "3.62.0-canary.4",
|
|
91
|
+
"payload": "3.62.0-canary.4"
|
|
92
92
|
},
|
|
93
93
|
"homepage:": "https://payloadcms.com",
|
|
94
94
|
"scripts": {
|