@payloadcms/plugin-multi-tenant 3.38.0 → 3.39.0-canary.1

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,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/WatchTenantCollection/index.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,qBAAqB,YAyBjC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/WatchTenantCollection/index.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,qBAAqB,YA2BjC,CAAA"}
@@ -1,9 +1,10 @@
1
1
  'use client';
2
- import { useConfig, useDocumentInfo, useEffectEvent, useFormFields } from '@payloadcms/ui';
2
+ import { useConfig, useDocumentInfo, useDocumentTitle, useEffectEvent, useFormFields } from '@payloadcms/ui';
3
3
  import React from 'react';
4
4
  import { useTenantSelection } from '../../providers/TenantSelectionProvider/index.client.js';
5
5
  export const WatchTenantCollection = ()=>{
6
- const { id, collectionSlug, title } = useDocumentInfo();
6
+ const { id, collectionSlug } = useDocumentInfo();
7
+ const { title } = useDocumentTitle();
7
8
  const { getEntityConfig } = useConfig();
8
9
  const [useAsTitleName] = React.useState(()=>getEntityConfig({
9
10
  collectionSlug
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/WatchTenantCollection/index.tsx"],"sourcesContent":["'use client'\n\nimport type { ClientCollectionConfig } from 'payload'\n\nimport { useConfig, useDocumentInfo, useEffectEvent, useFormFields } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { useTenantSelection } from '../../providers/TenantSelectionProvider/index.client.js'\n\nexport const WatchTenantCollection = () => {\n const { id, collectionSlug, title } = useDocumentInfo()\n const { getEntityConfig } = useConfig()\n const [useAsTitleName] = React.useState(\n () => (getEntityConfig({ collectionSlug }) as ClientCollectionConfig).admin.useAsTitle,\n )\n const titleField = useFormFields(([fields]) => fields[useAsTitleName])\n\n const { 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 syncTenantTitle()\n }\n }, [id, titleField?.initialValue])\n\n return null\n}\n"],"names":["useConfig","useDocumentInfo","useEffectEvent","useFormFields","React","useTenantSelection","WatchTenantCollection","id","collectionSlug","title","getEntityConfig","useAsTitleName","useState","admin","useAsTitle","titleField","fields","updateTenants","syncTenantTitle","label","useEffect","initialValue"],"mappings":"AAAA;AAIA,SAASA,SAAS,EAAEC,eAAe,EAAEC,cAAc,EAAEC,aAAa,QAAQ,iBAAgB;AAC1F,OAAOC,WAAW,QAAO;AAEzB,SAASC,kBAAkB,QAAQ,0DAAyD;AAE5F,OAAO,MAAMC,wBAAwB;IACnC,MAAM,EAAEC,EAAE,EAAEC,cAAc,EAAEC,KAAK,EAAE,GAAGR;IACtC,MAAM,EAAES,eAAe,EAAE,GAAGV;IAC5B,MAAM,CAACW,eAAe,GAAGP,MAAMQ,QAAQ,CACrC,IAAM,AAACF,gBAAgB;YAAEF;QAAe,GAA8BK,KAAK,CAACC,UAAU;IAExF,MAAMC,aAAaZ,cAAc,CAAC,CAACa,OAAO,GAAKA,MAAM,CAACL,eAAe;IAErE,MAAM,EAAEM,aAAa,EAAE,GAAGZ;IAE1B,MAAMa,kBAAkBhB,eAAe;QACrC,IAAIK,IAAI;YACNU,cAAc;gBAAEV;gBAAIY,OAAOV;YAAM;QACnC;IACF;IAEAL,MAAMgB,SAAS,CAAC;QACd,0DAA0D;QAC1D,mCAAmC;QACnC,IAAIb,MAAMQ,YAAYM,cAAc;YAClCH;QACF;IACF,GAAG;QAACX;QAAIQ,YAAYM;KAAa;IAEjC,OAAO;AACT,EAAC"}
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} 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 { 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]) => fields[useAsTitleName])\n\n const { 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 syncTenantTitle()\n }\n }, [id, titleField?.initialValue])\n\n return null\n}\n"],"names":["useConfig","useDocumentInfo","useDocumentTitle","useEffectEvent","useFormFields","React","useTenantSelection","WatchTenantCollection","id","collectionSlug","title","getEntityConfig","useAsTitleName","useState","admin","useAsTitle","titleField","fields","updateTenants","syncTenantTitle","label","useEffect","initialValue"],"mappings":"AAAA;AAIA,SACEA,SAAS,EACTC,eAAe,EACfC,gBAAgB,EAChBC,cAAc,EACdC,aAAa,QACR,iBAAgB;AACvB,OAAOC,WAAW,QAAO;AAEzB,SAASC,kBAAkB,QAAQ,0DAAyD;AAE5F,OAAO,MAAMC,wBAAwB;IACnC,MAAM,EAAEC,EAAE,EAAEC,cAAc,EAAE,GAAGR;IAC/B,MAAM,EAAES,KAAK,EAAE,GAAGR;IAElB,MAAM,EAAES,eAAe,EAAE,GAAGX;IAC5B,MAAM,CAACY,eAAe,GAAGP,MAAMQ,QAAQ,CACrC,IAAM,AAACF,gBAAgB;YAAEF;QAAe,GAA8BK,KAAK,CAACC,UAAU;IAExF,MAAMC,aAAaZ,cAAc,CAAC,CAACa,OAAO,GAAKA,MAAM,CAACL,eAAe;IAErE,MAAM,EAAEM,aAAa,EAAE,GAAGZ;IAE1B,MAAMa,kBAAkBhB,eAAe;QACrC,IAAIK,IAAI;YACNU,cAAc;gBAAEV;gBAAIY,OAAOV;YAAM;QACnC;IACF;IAEAL,MAAMgB,SAAS,CAAC;QACd,0DAA0D;QAC1D,mCAAmC;QACnC,IAAIb,MAAMQ,YAAYM,cAAc;YAClCH;QACF;IACF,GAAG;QAACX;QAAIQ,YAAYM;KAAa;IAEjC,OAAO;AACT,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/plugin-multi-tenant",
3
- "version": "3.38.0",
3
+ "version": "3.39.0-canary.1",
4
4
  "description": "Multi Tenant plugin for Payload",
5
5
  "keywords": [
6
6
  "payload",
@@ -77,14 +77,14 @@
77
77
  ],
78
78
  "devDependencies": {
79
79
  "@payloadcms/eslint-config": "3.28.0",
80
- "@payloadcms/translations": "3.38.0",
81
- "@payloadcms/ui": "3.38.0",
82
- "payload": "3.38.0"
80
+ "payload": "3.39.0-canary.1",
81
+ "@payloadcms/ui": "3.39.0-canary.1",
82
+ "@payloadcms/translations": "3.39.0-canary.1"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "next": "^15.2.3",
86
- "@payloadcms/ui": "3.38.0",
87
- "payload": "3.38.0"
86
+ "@payloadcms/ui": "3.39.0-canary.1",
87
+ "payload": "3.39.0-canary.1"
88
88
  },
89
89
  "homepage:": "https://payloadcms.com",
90
90
  "scripts": {