@payloadcms/plugin-multi-tenant 0.0.1 → 3.18.0

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.
Files changed (104) hide show
  1. package/README.md +130 -95
  2. package/dist/components/GlobalViewRedirect/index.d.ts +3 -2
  3. package/dist/components/GlobalViewRedirect/index.d.ts.map +1 -1
  4. package/dist/components/GlobalViewRedirect/index.js +1 -0
  5. package/dist/components/GlobalViewRedirect/index.js.map +1 -1
  6. package/dist/components/TenantField/index.client.d.ts +3 -3
  7. package/dist/components/TenantField/index.client.d.ts.map +1 -1
  8. package/dist/components/TenantField/index.client.js +55 -17
  9. package/dist/components/TenantField/index.client.js.map +1 -1
  10. package/dist/components/TenantField/index.scss +14 -0
  11. package/dist/components/TenantSelector/index.d.ts +5 -8
  12. package/dist/components/TenantSelector/index.d.ts.map +1 -1
  13. package/dist/components/TenantSelector/index.js +35 -24
  14. package/dist/components/TenantSelector/index.js.map +1 -1
  15. package/dist/constants.d.ts +2 -0
  16. package/dist/constants.d.ts.map +1 -0
  17. package/dist/constants.js +4 -0
  18. package/dist/constants.js.map +1 -0
  19. package/dist/exports/client.d.ts +3 -0
  20. package/dist/exports/client.d.ts.map +1 -0
  21. package/dist/exports/client.js +4 -0
  22. package/dist/exports/client.js.map +1 -0
  23. package/dist/exports/fields.d.ts +3 -0
  24. package/dist/exports/fields.d.ts.map +1 -0
  25. package/dist/exports/fields.js +4 -0
  26. package/dist/exports/fields.js.map +1 -0
  27. package/dist/exports/rsc.d.ts +1 -2
  28. package/dist/exports/rsc.d.ts.map +1 -1
  29. package/dist/exports/rsc.js +1 -2
  30. package/dist/exports/rsc.js.map +1 -1
  31. package/dist/fields/tenantField/index.d.ts +2 -3
  32. package/dist/fields/tenantField/index.d.ts.map +1 -1
  33. package/dist/fields/tenantField/index.js +8 -4
  34. package/dist/fields/tenantField/index.js.map +1 -1
  35. package/dist/fields/tenantsArrayField/index.d.ts +7 -0
  36. package/dist/fields/tenantsArrayField/index.d.ts.map +1 -0
  37. package/dist/fields/{userTenantsArrayField → tenantsArrayField}/index.js +3 -3
  38. package/dist/fields/tenantsArrayField/index.js.map +1 -0
  39. package/dist/hooks/afterTenantDelete.d.ts +16 -0
  40. package/dist/hooks/afterTenantDelete.d.ts.map +1 -0
  41. package/dist/hooks/afterTenantDelete.js +71 -0
  42. package/dist/hooks/afterTenantDelete.js.map +1 -0
  43. package/dist/index.d.ts +1 -1
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +112 -49
  46. package/dist/index.js.map +1 -1
  47. package/dist/providers/TenantSelectionProvider/index.client.d.ts +19 -0
  48. package/dist/providers/TenantSelectionProvider/index.client.d.ts.map +1 -0
  49. package/dist/providers/TenantSelectionProvider/index.client.js +69 -0
  50. package/dist/providers/TenantSelectionProvider/index.client.js.map +1 -0
  51. package/dist/providers/TenantSelectionProvider/index.d.ts +11 -0
  52. package/dist/providers/TenantSelectionProvider/index.d.ts.map +1 -0
  53. package/dist/providers/TenantSelectionProvider/index.js +31 -0
  54. package/dist/providers/TenantSelectionProvider/index.js.map +1 -0
  55. package/dist/types.d.ts +54 -17
  56. package/dist/types.d.ts.map +1 -1
  57. package/dist/types.js.map +1 -1
  58. package/dist/utilities/addCollectionAccess.d.ts +13 -0
  59. package/dist/utilities/addCollectionAccess.d.ts.map +1 -0
  60. package/dist/utilities/addCollectionAccess.js +29 -0
  61. package/dist/utilities/addCollectionAccess.js.map +1 -0
  62. package/dist/utilities/addFilterOptionsToFields.d.ts +9 -0
  63. package/dist/utilities/addFilterOptionsToFields.d.ts.map +1 -0
  64. package/dist/utilities/addFilterOptionsToFields.js +107 -0
  65. package/dist/utilities/addFilterOptionsToFields.js.map +1 -0
  66. package/dist/utilities/combineWhereConstraints.js +2 -2
  67. package/dist/utilities/combineWhereConstraints.js.map +1 -1
  68. package/dist/utilities/getGlobalViewRedirect.d.ts +4 -3
  69. package/dist/utilities/getGlobalViewRedirect.d.ts.map +1 -1
  70. package/dist/utilities/getGlobalViewRedirect.js +6 -5
  71. package/dist/utilities/getGlobalViewRedirect.js.map +1 -1
  72. package/dist/utilities/getTenantAccess.d.ts +7 -3
  73. package/dist/utilities/getTenantAccess.d.ts.map +1 -1
  74. package/dist/utilities/getTenantAccess.js +6 -9
  75. package/dist/utilities/getTenantAccess.js.map +1 -1
  76. package/dist/utilities/getTenantFromCookie.d.ts +8 -1
  77. package/dist/utilities/getTenantFromCookie.d.ts.map +1 -1
  78. package/dist/utilities/getTenantFromCookie.js +7 -1
  79. package/dist/utilities/getTenantFromCookie.js.map +1 -1
  80. package/dist/utilities/getTenantListFilter.d.ts.map +1 -1
  81. package/dist/utilities/getTenantListFilter.js +8 -8
  82. package/dist/utilities/getTenantListFilter.js.map +1 -1
  83. package/dist/utilities/getUserTenantIDs.d.ts +1 -2
  84. package/dist/utilities/getUserTenantIDs.d.ts.map +1 -1
  85. package/dist/utilities/getUserTenantIDs.js +2 -6
  86. package/dist/utilities/getUserTenantIDs.js.map +1 -1
  87. package/dist/utilities/withTenantAccess.d.ts +4 -3
  88. package/dist/utilities/withTenantAccess.d.ts.map +1 -1
  89. package/dist/utilities/withTenantAccess.js +12 -16
  90. package/dist/utilities/withTenantAccess.js.map +1 -1
  91. package/dist/utilities/withTenantListFilter.js +1 -1
  92. package/dist/utilities/withTenantListFilter.js.map +1 -1
  93. package/package.json +20 -10
  94. package/dist/components/TenantField/index.d.ts +0 -3
  95. package/dist/components/TenantField/index.d.ts.map +0 -1
  96. package/dist/components/TenantField/index.js +0 -33
  97. package/dist/components/TenantField/index.js.map +0 -1
  98. package/dist/components/TenantSelector/index.client.d.ts +0 -11
  99. package/dist/components/TenantSelector/index.client.d.ts.map +0 -1
  100. package/dist/components/TenantSelector/index.client.js +0 -61
  101. package/dist/components/TenantSelector/index.client.js.map +0 -1
  102. package/dist/fields/userTenantsArrayField/index.d.ts +0 -4
  103. package/dist/fields/userTenantsArrayField/index.d.ts.map +0 -1
  104. package/dist/fields/userTenantsArrayField/index.js.map +0 -1
package/README.md CHANGED
@@ -3,122 +3,126 @@
3
3
  A plugin for [Payload](https://github.com/payloadcms/payload) to easily manage multiple tenants from within your admin panel.
4
4
 
5
5
  - [Source code](https://github.com/payloadcms/payload/tree/main/packages/plugin-multi-tenant)
6
- <!-- - [Documentation](https://payloadcms.com/docs/plugins/multi-tenant)
7
- - [Documentation source](https://github.com/payloadcms/payload/tree/main/docs/plugins/multi-tenant.mdx) -->
6
+ - [Documentation](https://payloadcms.com/docs/plugins/multi-tenant)
7
+ - [Documentation source](https://github.com/payloadcms/payload/tree/main/docs/plugins/multi-tenant.mdx)
8
8
 
9
- ## Plugin config example
9
+ ## Installation
10
+
11
+ ```bash
12
+ pnpm add @payloadcms/plugin-multi-tenant@beta
13
+ ```
14
+
15
+ ## Plugin Types
10
16
 
11
17
  ```ts
12
- multiTenantPlugin({
13
- /**
14
- * Enable debugging:
15
- * - shows the relationship field on enabled collection documents
16
- *
17
- * optional - @default false
18
- */
19
- debug: false,
20
- /**
21
- * Enables/Disables the plugin
22
- *
23
- * optional - @default true
24
- */
25
- enabled: true,
18
+ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
26
19
  /**
27
- * The slug of the tenants collection you added to your config
20
+ * After a tenant is deleted, the plugin will attempt to clean up related documents
21
+ * - removing documents with the tenant ID
22
+ * - removing the tenant from users
28
23
  *
29
- * optional - @default 'tenants'
24
+ * @default true
30
25
  */
31
- tenantsSlug: 'tenants',
26
+ cleanupAfterTenantDelete?: boolean
32
27
  /**
33
- * Define what collections you would like multi-tenancy to apply to
34
- *
35
- * Keyed on the slug of the collection
28
+ * Automatically
36
29
  */
37
30
  collections: {
38
- pages: {
31
+ [key in CollectionSlug]?: {
39
32
  /**
40
- * Used to opt out of using the provided baseListFilter
41
- *
42
- * You can use the exported utility "getTenantFilter" within your own list filter
33
+ * Set to `true` if you want the collection to behave as a global
43
34
  *
44
- * optional - @default true
35
+ * @default false
45
36
  */
46
- useBaseListFilter: true
37
+ isGlobal?: boolean
47
38
  /**
48
- * Used to opt out of the merged access control provided
39
+ * Set to `false` if you want to manually apply the baseListFilter
49
40
  *
50
- * You can use the exported utility "getTenantAccess" within your access control functions
51
- *
52
- * optional - @default true
41
+ * @default true
53
42
  */
54
- useTenantAccess: true
55
- /**
56
- * Used to make a collection feel like a global. When navigating to the list view, they will be redirected to the document view.
57
- *
58
- * optional - @default false
59
- */
60
- isGlobal: false
61
- },
62
- /**
63
- * Custom configuration for the tenant field placed on every enabled collection
64
- */
65
- documentTenantField: {
66
- // optional - provide access control on the injected tenant field
67
- access: {
68
- create,
69
- read,
70
- update,
71
- },
43
+ useBaseListFilter?: boolean
72
44
  /**
73
- * Name of the field
45
+ * Set to `false` if you want to handle collection access manually without the multi-tenant constraints applied
74
46
  *
75
- * optional - @default true
47
+ * @default true
76
48
  */
77
- name: 'tenant',
78
- },
79
- /**
80
- * Function that allows you to determine if certain users should have access to all tenants
81
- *
82
- * optional - @default () => false
83
- */
84
- userHasAccessToAllTenants: (user) => user.isSuperAdmin === true
49
+ useTenantAccess?: boolean
50
+ }
51
+ }
52
+ /**
53
+ * Enables debug mode
54
+ * - Makes the tenant field visible in the admin UI within applicable collections
55
+ *
56
+ * @default false
57
+ */
58
+ debug?: boolean
59
+ /**
60
+ * Enables the multi-tenant plugin
61
+ *
62
+ * @default true
63
+ */
64
+ enabled?: boolean
65
+ /**
66
+ * Field configuration for the field added to all tenant enabled collections
67
+ */
68
+ tenantField?: {
69
+ access?: RelationshipField['access']
85
70
  /**
86
- * Options for the array field that gets added to the users collection.
71
+ * The name of the field added to all tenant enabled collections
87
72
  *
88
- * The field is an array of rows, by default each row has a relationship to a tenant
89
- *
90
- * optional - @default undefined
73
+ * @default 'tenant'
91
74
  */
92
- userTenantsField: {
93
- /**
94
- * Allows you to set access control on the array field
95
- *
96
- * optional - @default undefined
97
- */
98
- access: {
99
- create, // optional
100
- read, // optional
101
- update, // optional
102
- },
103
- /**
104
- * If you want to add additional fields to the tenant rows, you can specify them under rowFields
105
- *
106
- * optional - @default undefined
107
- */
108
- rowFields: [
109
- // Example adding a field onto the array row
110
- {
111
- name: 'roles',
112
- type: 'select',
113
- options: [
114
- { label: 'Admin', value: 'admin' },
115
- { label: 'User', value: 'user' },
116
- ],
117
- },
118
- ],
119
- }
120
- },
121
- })
75
+ name?: string
76
+ }
77
+ /**
78
+ * Field configuration for the field added to the users collection
79
+ *
80
+ * If `includeDefaultField` is `false`, you must include the field on your users collection manually
81
+ * This is useful if you want to customize the field or place the field in a specific location
82
+ */
83
+ tenantsArrayField?:
84
+ | {
85
+ /**
86
+ * Access configuration for the array field
87
+ */
88
+ arrayFieldAccess?: ArrayField['access']
89
+ /**
90
+ * When `includeDefaultField` is `true`, the field will be added to the users collection automatically
91
+ */
92
+ includeDefaultField?: true
93
+ /**
94
+ * Additional fields to include on the tenants array field
95
+ */
96
+ rowFields?: Field[]
97
+ /**
98
+ * Access configuration for the tenant field
99
+ */
100
+ tenantFieldAccess?: RelationshipField['access']
101
+ }
102
+ | {
103
+ arrayFieldAccess?: never
104
+ /**
105
+ * When `includeDefaultField` is `false`, you must include the field on your users collection manually
106
+ */
107
+ includeDefaultField?: false
108
+ rowFields?: never
109
+ tenantFieldAccess?: never
110
+ }
111
+ /**
112
+ * The slug for the tenant collection
113
+ *
114
+ * @default 'tenants'
115
+ */
116
+ tenantsSlug?: string
117
+ /**
118
+ * Function that determines if a user has access to _all_ tenants
119
+ *
120
+ * Useful for super-admin type users
121
+ */
122
+ userHasAccessToAllTenants?: (
123
+ user: ConfigTypes extends { user } ? ConfigTypes['user'] : User,
124
+ ) => boolean
125
+ }
122
126
  ```
123
127
 
124
128
  ### How to configure Collections as Globals for multi-tenant
@@ -202,3 +206,34 @@ export default buildConfig({
202
206
  ],
203
207
  })
204
208
  ```
209
+
210
+ ### Placing the tenants array field
211
+
212
+ In your users collection you may want to place the field in a tab or in the sidebar, or customize some of the properties on it.
213
+
214
+ You can use the `tenantsArrayField.includeDefaultField: false` setting in the plugin config. You will then need to manually add a `tenants` array field in your users collection.
215
+
216
+ This field cannot be nested inside a named field, ie a group, named-tab or array. It _can_ be nested inside a row, unnamed-tab, collapsible.
217
+
218
+ To make it easier, this plugin exports the field for you to import and merge in your own properties.
219
+
220
+ ```ts
221
+ import type { CollectionConfig } from 'payload'
222
+ import { tenantsArrayField } from '@payloadcms/plugin-multi-tenant/fields'
223
+
224
+ const customTenantsArrayField = tenantsArrayField({
225
+ arrayFieldAccess: {}, // access control for the array field
226
+ tenantFieldAccess: {}, // access control for the tenants field on the array row
227
+ rowFields: [], // additional row fields
228
+ })
229
+
230
+ export const UsersCollection: CollectionConfig = {
231
+ slug: 'users',
232
+ fields: [
233
+ {
234
+ ...customTenantsArrayField,
235
+ label: 'Associated Tenants',
236
+ },
237
+ ],
238
+ }
239
+ ```
@@ -1,9 +1,10 @@
1
- import type { CollectionSlug, ServerProps } from 'payload';
1
+ import type { CollectionSlug, ServerProps, ViewTypes } from 'payload';
2
2
  type Args = {
3
3
  collectionSlug: CollectionSlug;
4
4
  docID?: number | string;
5
5
  globalSlugs: string[];
6
- viewType: 'edit' | 'list';
6
+ tenantFieldName: string;
7
+ viewType: ViewTypes;
7
8
  } & ServerProps;
8
9
  export declare const GlobalViewRedirect: (args: Args) => Promise<void>;
9
10
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/GlobalViewRedirect/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAM1D,KAAK,IAAI,GAAG;IACV,cAAc,EAAE,cAAc,CAAA;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;CAC1B,GAAG,WAAW,CAAA;AAEf,eAAO,MAAM,kBAAkB,SAAgB,IAAI,kBAelD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/GlobalViewRedirect/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAMrE,KAAK,IAAI,GAAG;IACV,cAAc,EAAE,cAAc,CAAA;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,eAAe,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,SAAS,CAAA;CACpB,GAAG,WAAW,CAAA;AAEf,eAAO,MAAM,kBAAkB,SAAgB,IAAI,kBAgBlD,CAAA"}
@@ -7,6 +7,7 @@ export const GlobalViewRedirect = async (args)=>{
7
7
  slug: collectionSlug,
8
8
  docID: args.docID,
9
9
  payload: args.payload,
10
+ tenantFieldName: args.tenantFieldName,
10
11
  view: args.viewType
11
12
  });
12
13
  if (redirectRoute) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/GlobalViewRedirect/index.ts"],"sourcesContent":["import type { CollectionSlug, ServerProps } from 'payload'\n\nimport { redirect } from 'next/navigation.js'\n\nimport { getGlobalViewRedirect } from '../../utilities/getGlobalViewRedirect.js'\n\ntype Args = {\n collectionSlug: CollectionSlug\n docID?: number | string\n globalSlugs: string[]\n viewType: 'edit' | 'list'\n} & ServerProps\n\nexport const GlobalViewRedirect = async (args: Args) => {\n const collectionSlug = args?.collectionSlug\n\n if (collectionSlug && args.globalSlugs?.includes(collectionSlug)) {\n const redirectRoute = await getGlobalViewRedirect({\n slug: collectionSlug,\n docID: args.docID,\n payload: args.payload,\n view: args.viewType,\n })\n\n if (redirectRoute) {\n redirect(redirectRoute)\n }\n }\n}\n"],"names":["redirect","getGlobalViewRedirect","GlobalViewRedirect","args","collectionSlug","globalSlugs","includes","redirectRoute","slug","docID","payload","view","viewType"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,qBAAoB;AAE7C,SAASC,qBAAqB,QAAQ,2CAA0C;AAShF,OAAO,MAAMC,qBAAqB,OAAOC;IACvC,MAAMC,iBAAiBD,MAAMC;IAE7B,IAAIA,kBAAkBD,KAAKE,WAAW,EAAEC,SAASF,iBAAiB;QAChE,MAAMG,gBAAgB,MAAMN,sBAAsB;YAChDO,MAAMJ;YACNK,OAAON,KAAKM,KAAK;YACjBC,SAASP,KAAKO,OAAO;YACrBC,MAAMR,KAAKS,QAAQ;QACrB;QAEA,IAAIL,eAAe;YACjBP,SAASO;QACX;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/components/GlobalViewRedirect/index.ts"],"sourcesContent":["import type { CollectionSlug, ServerProps, ViewTypes } from 'payload'\n\nimport { redirect } from 'next/navigation.js'\n\nimport { getGlobalViewRedirect } from '../../utilities/getGlobalViewRedirect.js'\n\ntype Args = {\n collectionSlug: CollectionSlug\n docID?: number | string\n globalSlugs: string[]\n tenantFieldName: string\n viewType: ViewTypes\n} & ServerProps\n\nexport const GlobalViewRedirect = async (args: Args) => {\n const collectionSlug = args?.collectionSlug\n\n if (collectionSlug && args.globalSlugs?.includes(collectionSlug)) {\n const redirectRoute = await getGlobalViewRedirect({\n slug: collectionSlug,\n docID: args.docID,\n payload: args.payload,\n tenantFieldName: args.tenantFieldName,\n view: args.viewType,\n })\n\n if (redirectRoute) {\n redirect(redirectRoute)\n }\n }\n}\n"],"names":["redirect","getGlobalViewRedirect","GlobalViewRedirect","args","collectionSlug","globalSlugs","includes","redirectRoute","slug","docID","payload","tenantFieldName","view","viewType"],"mappings":"AAEA,SAASA,QAAQ,QAAQ,qBAAoB;AAE7C,SAASC,qBAAqB,QAAQ,2CAA0C;AAUhF,OAAO,MAAMC,qBAAqB,OAAOC;IACvC,MAAMC,iBAAiBD,MAAMC;IAE7B,IAAIA,kBAAkBD,KAAKE,WAAW,EAAEC,SAASF,iBAAiB;QAChE,MAAMG,gBAAgB,MAAMN,sBAAsB;YAChDO,MAAMJ;YACNK,OAAON,KAAKM,KAAK;YACjBC,SAASP,KAAKO,OAAO;YACrBC,iBAAiBR,KAAKQ,eAAe;YACrCC,MAAMT,KAAKU,QAAQ;QACrB;QAEA,IAAIN,eAAe;YACjBP,SAASO;QACX;IACF;AACF,EAAC"}
@@ -1,10 +1,10 @@
1
1
  import type { RelationshipFieldClientProps } from 'payload';
2
2
  import React from 'react';
3
+ import './index.scss';
3
4
  type Props = {
4
5
  debug?: boolean;
5
- serverValue?: number | string;
6
- tenantsCollectionSlug: string;
6
+ unique?: boolean;
7
7
  } & RelationshipFieldClientProps;
8
- export declare const TenantFieldClient: (args: Props) => React.JSX.Element;
8
+ export declare const TenantField: (args: Props) => React.JSX.Element | null;
9
9
  export {};
10
10
  //# sourceMappingURL=index.client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/components/TenantField/index.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAA;AAG3D,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,KAAK,KAAK,GAAG;IACX,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC7B,qBAAqB,EAAE,MAAM,CAAA;CAC9B,GAAG,4BAA4B,CAAA;AAEhC,eAAO,MAAM,iBAAiB,SAAU,KAAK,sBA2B5C,CAAA"}
1
+ {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/components/TenantField/index.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAA;AAG3D,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,cAAc,CAAA;AAIrB,KAAK,KAAK,GAAG;IACX,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,GAAG,4BAA4B,CAAA;AAEhC,eAAO,MAAM,WAAW,SAAU,KAAK,6BA0CtC,CAAA"}
@@ -1,31 +1,69 @@
1
1
  'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { RelationshipField, useField } from '@payloadcms/ui';
4
4
  import React from 'react';
5
- export const TenantFieldClient = (args)=>{
6
- const { path, serverValue } = args;
5
+ import { SELECT_ALL } from '../../constants.js';
6
+ import { useTenantSelection } from '../../providers/TenantSelectionProvider/index.client.js';
7
+ import './index.scss';
8
+ const baseClass = 'tenantField';
9
+ export const TenantField = (args)=>{
10
+ const { debug, path, unique } = args;
7
11
  const { setValue, value } = useField({
8
12
  path
9
13
  });
14
+ const { options, selectedTenantID, setPreventRefreshOnChange, setTenant } = useTenantSelection();
15
+ const hasSetValueRef = React.useRef(false);
10
16
  React.useEffect(()=>{
11
- if (serverValue && value !== serverValue) {
12
- setValue(serverValue);
17
+ if (!hasSetValueRef.current && value) {
18
+ // set value on load
19
+ setTenant({
20
+ id: value,
21
+ refresh: unique
22
+ });
23
+ hasSetValueRef.current = true;
24
+ } else if (selectedTenantID && selectedTenantID === SELECT_ALL && options?.[0]?.value) {
25
+ // in the document view, the tenant field should always have a value
26
+ setTenant({
27
+ id: options[0].value,
28
+ refresh: unique
29
+ });
30
+ } else if ((!value || value !== selectedTenantID) && selectedTenantID) {
31
+ // Update the field value when the tenant is changed
32
+ setValue(selectedTenantID);
13
33
  }
14
34
  }, [
15
- serverValue,
35
+ value,
36
+ selectedTenantID,
37
+ setTenant,
16
38
  setValue,
17
- value
39
+ options,
40
+ unique
18
41
  ]);
19
- if (args.debug) {
20
- return /*#__PURE__*/ _jsx(RelationshipField, {
21
- field: {
22
- name: path,
23
- type: 'relationship',
24
- label: 'Tenant',
25
- relationTo: args.tenantsCollectionSlug,
26
- required: true
27
- },
28
- path: path
42
+ React.useEffect(()=>{
43
+ if (!unique) {
44
+ setPreventRefreshOnChange(true);
45
+ }
46
+ return ()=>{
47
+ setPreventRefreshOnChange(false);
48
+ };
49
+ }, [
50
+ unique,
51
+ setPreventRefreshOnChange
52
+ ]);
53
+ if (debug) {
54
+ return /*#__PURE__*/ _jsxs("div", {
55
+ className: baseClass,
56
+ children: [
57
+ /*#__PURE__*/ _jsx("div", {
58
+ className: `${baseClass}__wrapper`,
59
+ children: /*#__PURE__*/ _jsx(RelationshipField, {
60
+ ...args
61
+ })
62
+ }),
63
+ /*#__PURE__*/ _jsx("div", {
64
+ className: `${baseClass}__hr`
65
+ })
66
+ ]
29
67
  });
30
68
  }
31
69
  return null;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/TenantField/index.client.tsx"],"sourcesContent":["'use client'\n\nimport type { RelationshipFieldClientProps } from 'payload'\n\nimport { RelationshipField, useField } from '@payloadcms/ui'\nimport React from 'react'\n\ntype Props = {\n debug?: boolean\n serverValue?: number | string\n tenantsCollectionSlug: string\n} & RelationshipFieldClientProps\n\nexport const TenantFieldClient = (args: Props) => {\n const { path, serverValue } = args\n\n const { setValue, value } = useField({ path })\n\n React.useEffect(() => {\n if (serverValue && value !== serverValue) {\n setValue(serverValue)\n }\n }, [serverValue, setValue, value])\n\n if (args.debug) {\n return (\n <RelationshipField\n field={{\n name: path,\n type: 'relationship',\n label: 'Tenant',\n relationTo: args.tenantsCollectionSlug,\n required: true,\n }}\n path={path}\n />\n )\n }\n\n return null\n}\n"],"names":["RelationshipField","useField","React","TenantFieldClient","args","path","serverValue","setValue","value","useEffect","debug","field","name","type","label","relationTo","tenantsCollectionSlug","required"],"mappings":"AAAA;;AAIA,SAASA,iBAAiB,EAAEC,QAAQ,QAAQ,iBAAgB;AAC5D,OAAOC,WAAW,QAAO;AAQzB,OAAO,MAAMC,oBAAoB,CAACC;IAChC,MAAM,EAAEC,IAAI,EAAEC,WAAW,EAAE,GAAGF;IAE9B,MAAM,EAAEG,QAAQ,EAAEC,KAAK,EAAE,GAAGP,SAAS;QAAEI;IAAK;IAE5CH,MAAMO,SAAS,CAAC;QACd,IAAIH,eAAeE,UAAUF,aAAa;YACxCC,SAASD;QACX;IACF,GAAG;QAACA;QAAaC;QAAUC;KAAM;IAEjC,IAAIJ,KAAKM,KAAK,EAAE;QACd,qBACE,KAACV;YACCW,OAAO;gBACLC,MAAMP;gBACNQ,MAAM;gBACNC,OAAO;gBACPC,YAAYX,KAAKY,qBAAqB;gBACtCC,UAAU;YACZ;YACAZ,MAAMA;;IAGZ;IAEA,OAAO;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../src/components/TenantField/index.client.tsx"],"sourcesContent":["'use client'\n\nimport type { RelationshipFieldClientProps } from 'payload'\n\nimport { RelationshipField, useField } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { SELECT_ALL } from '../../constants.js'\nimport { useTenantSelection } from '../../providers/TenantSelectionProvider/index.client.js'\nimport './index.scss'\n\nconst baseClass = 'tenantField'\n\ntype Props = {\n debug?: boolean\n unique?: boolean\n} & RelationshipFieldClientProps\n\nexport const TenantField = (args: Props) => {\n const { debug, path, unique } = args\n const { setValue, value } = useField<number | string>({ path })\n const { options, selectedTenantID, setPreventRefreshOnChange, setTenant } = useTenantSelection()\n\n const hasSetValueRef = React.useRef(false)\n\n React.useEffect(() => {\n if (!hasSetValueRef.current && value) {\n // set value on load\n setTenant({ id: value, refresh: unique })\n hasSetValueRef.current = true\n } else if (selectedTenantID && selectedTenantID === SELECT_ALL && options?.[0]?.value) {\n // in the document view, the tenant field should always have a value\n setTenant({ id: options[0].value, refresh: unique })\n } else if ((!value || value !== selectedTenantID) && selectedTenantID) {\n // Update the field value when the tenant is changed\n setValue(selectedTenantID)\n }\n }, [value, selectedTenantID, setTenant, setValue, options, unique])\n\n React.useEffect(() => {\n if (!unique) {\n setPreventRefreshOnChange(true)\n }\n return () => {\n setPreventRefreshOnChange(false)\n }\n }, [unique, setPreventRefreshOnChange])\n\n if (debug) {\n return (\n <div className={baseClass}>\n <div className={`${baseClass}__wrapper`}>\n <RelationshipField {...args} />\n </div>\n <div className={`${baseClass}__hr`} />\n </div>\n )\n }\n\n return null\n}\n"],"names":["RelationshipField","useField","React","SELECT_ALL","useTenantSelection","baseClass","TenantField","args","debug","path","unique","setValue","value","options","selectedTenantID","setPreventRefreshOnChange","setTenant","hasSetValueRef","useRef","useEffect","current","id","refresh","div","className"],"mappings":"AAAA;;AAIA,SAASA,iBAAiB,EAAEC,QAAQ,QAAQ,iBAAgB;AAC5D,OAAOC,WAAW,QAAO;AAEzB,SAASC,UAAU,QAAQ,qBAAoB;AAC/C,SAASC,kBAAkB,QAAQ,0DAAyD;AAC5F,OAAO,eAAc;AAErB,MAAMC,YAAY;AAOlB,OAAO,MAAMC,cAAc,CAACC;IAC1B,MAAM,EAAEC,KAAK,EAAEC,IAAI,EAAEC,MAAM,EAAE,GAAGH;IAChC,MAAM,EAAEI,QAAQ,EAAEC,KAAK,EAAE,GAAGX,SAA0B;QAAEQ;IAAK;IAC7D,MAAM,EAAEI,OAAO,EAAEC,gBAAgB,EAAEC,yBAAyB,EAAEC,SAAS,EAAE,GAAGZ;IAE5E,MAAMa,iBAAiBf,MAAMgB,MAAM,CAAC;IAEpChB,MAAMiB,SAAS,CAAC;QACd,IAAI,CAACF,eAAeG,OAAO,IAAIR,OAAO;YACpC,oBAAoB;YACpBI,UAAU;gBAAEK,IAAIT;gBAAOU,SAASZ;YAAO;YACvCO,eAAeG,OAAO,GAAG;QAC3B,OAAO,IAAIN,oBAAoBA,qBAAqBX,cAAcU,SAAS,CAAC,EAAE,EAAED,OAAO;YACrF,oEAAoE;YACpEI,UAAU;gBAAEK,IAAIR,OAAO,CAAC,EAAE,CAACD,KAAK;gBAAEU,SAASZ;YAAO;QACpD,OAAO,IAAI,AAAC,CAAA,CAACE,SAASA,UAAUE,gBAAe,KAAMA,kBAAkB;YACrE,oDAAoD;YACpDH,SAASG;QACX;IACF,GAAG;QAACF;QAAOE;QAAkBE;QAAWL;QAAUE;QAASH;KAAO;IAElER,MAAMiB,SAAS,CAAC;QACd,IAAI,CAACT,QAAQ;YACXK,0BAA0B;QAC5B;QACA,OAAO;YACLA,0BAA0B;QAC5B;IACF,GAAG;QAACL;QAAQK;KAA0B;IAEtC,IAAIP,OAAO;QACT,qBACE,MAACe;YAAIC,WAAWnB;;8BACd,KAACkB;oBAAIC,WAAW,GAAGnB,UAAU,SAAS,CAAC;8BACrC,cAAA,KAACL;wBAAmB,GAAGO,IAAI;;;8BAE7B,KAACgB;oBAAIC,WAAW,GAAGnB,UAAU,IAAI,CAAC;;;;IAGxC;IAEA,OAAO;AACT,EAAC"}
@@ -0,0 +1,14 @@
1
+ .tenantField {
2
+ &__wrapper {
3
+ margin-top: calc(-.75 * var(--spacing-field));
4
+ margin-bottom: var(--spacing-field);
5
+ width: 25%;
6
+ }
7
+ &__hr {
8
+ width: calc(100% + 2 * var(--gutter-h));
9
+ margin-left: calc(-1 * var(--gutter-h));
10
+ background-color: var(--theme-elevation-100);
11
+ height: 1px;
12
+ margin-bottom: var(--spacing-field);
13
+ }
14
+ }
@@ -1,10 +1,7 @@
1
- import type { ServerProps } from 'payload';
1
+ import type { ViewTypes } from 'payload';
2
+ import './index.scss';
2
3
  import React from 'react';
3
- import type { MultiTenantPluginConfig, UserWithTenantsField } from '../../types.js';
4
- type Args = {
5
- tenantsCollectionSlug: MultiTenantPluginConfig['tenantsSlug'];
6
- user?: UserWithTenantsField;
7
- } & ServerProps;
8
- export declare const TenantSelector: ({ payload, tenantsCollectionSlug, user }: Args) => Promise<React.JSX.Element>;
9
- export {};
4
+ export declare const TenantSelector: ({ viewType }: {
5
+ viewType?: ViewTypes;
6
+ }) => React.JSX.Element | null;
10
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TenantSelector/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAG1C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,uBAAuB,EAAU,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAI3F,KAAK,IAAI,GAAG;IACV,qBAAqB,EAAE,uBAAuB,CAAC,aAAa,CAAC,CAAA;IAC7D,IAAI,CAAC,EAAE,oBAAoB,CAAA;CAC5B,GAAG,WAAW,CAAA;AAEf,eAAO,MAAM,cAAc,6CAAoD,IAAI,+BAgClF,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TenantSelector/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAIxC,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,cAAc,iBAAkB;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,6BAqCpE,CAAA"}
@@ -1,30 +1,41 @@
1
+ 'use client';
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cookies as getCookies } from 'next/headers.js';
3
+ import { SelectInput } from '@payloadcms/ui';
4
+ import './index.scss';
3
5
  import React from 'react';
4
- import { TenantSelectorClient } from './index.client.js';
5
- export const TenantSelector = async ({ payload, tenantsCollectionSlug, user })=>{
6
- const { docs: userTenants } = await payload.find({
7
- collection: tenantsCollectionSlug,
8
- depth: 0,
9
- limit: 1000,
10
- overrideAccess: false,
11
- sort: 'name',
12
- user
13
- });
14
- const tenantOptions = userTenants.map((doc)=>({
15
- label: doc.name,
16
- value: String(doc.id)
17
- }));
18
- let cookieToSet;
19
- const cookies = await getCookies();
20
- const selectedTenant = tenantOptions.find((tenant)=>tenant.value === cookies.get('payload-tenant')?.value)?.value;
21
- if (!selectedTenant && userTenants.length > 0) {
22
- cookieToSet = String(userTenants[0].id);
6
+ import { SELECT_ALL } from '../../constants.js';
7
+ import { useTenantSelection } from '../../providers/TenantSelectionProvider/index.client.js';
8
+ export const TenantSelector = ({ viewType })=>{
9
+ const { options, selectedTenantID, setTenant } = useTenantSelection();
10
+ const handleChange = React.useCallback((option)=>{
11
+ if (option && 'value' in option) {
12
+ setTenant({
13
+ id: option.value,
14
+ refresh: true
15
+ });
16
+ } else {
17
+ setTenant({
18
+ id: undefined,
19
+ refresh: true
20
+ });
21
+ }
22
+ }, [
23
+ setTenant
24
+ ]);
25
+ if (options.length <= 1) {
26
+ return null;
23
27
  }
24
- return /*#__PURE__*/ _jsx(TenantSelectorClient, {
25
- cookieToSet: cookieToSet,
26
- initialValue: selectedTenant,
27
- options: tenantOptions
28
+ return /*#__PURE__*/ _jsx("div", {
29
+ className: "tenant-selector",
30
+ children: /*#__PURE__*/ _jsx(SelectInput, {
31
+ isClearable: viewType === 'list',
32
+ label: "Tenant",
33
+ name: "setTenant",
34
+ onChange: handleChange,
35
+ options: options,
36
+ path: "setTenant",
37
+ value: selectedTenantID ? selectedTenantID === SELECT_ALL ? undefined : String(selectedTenantID) : undefined
38
+ })
28
39
  });
29
40
  };
30
41
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/TenantSelector/index.tsx"],"sourcesContent":["import type { ServerProps } from 'payload'\n\nimport { cookies as getCookies } from 'next/headers.js'\nimport React from 'react'\n\nimport type { MultiTenantPluginConfig, Tenant, UserWithTenantsField } from '../../types.js'\n\nimport { TenantSelectorClient } from './index.client.js'\n\ntype Args = {\n tenantsCollectionSlug: MultiTenantPluginConfig['tenantsSlug']\n user?: UserWithTenantsField\n} & ServerProps\n\nexport const TenantSelector = async ({ payload, tenantsCollectionSlug, user }: Args) => {\n const { docs: userTenants } = await payload.find({\n collection: tenantsCollectionSlug,\n depth: 0,\n limit: 1000,\n overrideAccess: false,\n sort: 'name',\n user,\n })\n\n const tenantOptions = userTenants.map((doc: Tenant) => ({\n label: doc.name,\n value: String(doc.id),\n }))\n\n let cookieToSet: string | undefined\n const cookies = await getCookies()\n const selectedTenant = tenantOptions.find(\n (tenant) => tenant.value === cookies.get('payload-tenant')?.value,\n )?.value\n\n if (!selectedTenant && userTenants.length > 0) {\n cookieToSet = String(userTenants[0].id)\n }\n\n return (\n <TenantSelectorClient\n cookieToSet={cookieToSet}\n initialValue={selectedTenant}\n options={tenantOptions}\n />\n )\n}\n"],"names":["cookies","getCookies","React","TenantSelectorClient","TenantSelector","payload","tenantsCollectionSlug","user","docs","userTenants","find","collection","depth","limit","overrideAccess","sort","tenantOptions","map","doc","label","name","value","String","id","cookieToSet","selectedTenant","tenant","get","length","initialValue","options"],"mappings":";AAEA,SAASA,WAAWC,UAAU,QAAQ,kBAAiB;AACvD,OAAOC,WAAW,QAAO;AAIzB,SAASC,oBAAoB,QAAQ,oBAAmB;AAOxD,OAAO,MAAMC,iBAAiB,OAAO,EAAEC,OAAO,EAAEC,qBAAqB,EAAEC,IAAI,EAAQ;IACjF,MAAM,EAAEC,MAAMC,WAAW,EAAE,GAAG,MAAMJ,QAAQK,IAAI,CAAC;QAC/CC,YAAYL;QACZM,OAAO;QACPC,OAAO;QACPC,gBAAgB;QAChBC,MAAM;QACNR;IACF;IAEA,MAAMS,gBAAgBP,YAAYQ,GAAG,CAAC,CAACC,MAAiB,CAAA;YACtDC,OAAOD,IAAIE,IAAI;YACfC,OAAOC,OAAOJ,IAAIK,EAAE;QACtB,CAAA;IAEA,IAAIC;IACJ,MAAMxB,UAAU,MAAMC;IACtB,MAAMwB,iBAAiBT,cAAcN,IAAI,CACvC,CAACgB,SAAWA,OAAOL,KAAK,KAAKrB,QAAQ2B,GAAG,CAAC,mBAAmBN,QAC3DA;IAEH,IAAI,CAACI,kBAAkBhB,YAAYmB,MAAM,GAAG,GAAG;QAC7CJ,cAAcF,OAAOb,WAAW,CAAC,EAAE,CAACc,EAAE;IACxC;IAEA,qBACE,KAACpB;QACCqB,aAAaA;QACbK,cAAcJ;QACdK,SAASd;;AAGf,EAAC"}
1
+ {"version":3,"sources":["../../../src/components/TenantSelector/index.tsx"],"sourcesContent":["'use client'\nimport type { ReactSelectOption } from '@payloadcms/ui'\nimport type { ViewTypes } from 'payload'\n\nimport { SelectInput } from '@payloadcms/ui'\n\nimport './index.scss'\n\nimport React from 'react'\n\nimport { SELECT_ALL } from '../../constants.js'\nimport { useTenantSelection } from '../../providers/TenantSelectionProvider/index.client.js'\n\nexport const TenantSelector = ({ viewType }: { viewType?: ViewTypes }) => {\n const { options, selectedTenantID, setTenant } = useTenantSelection()\n\n const handleChange = React.useCallback(\n (option: ReactSelectOption | ReactSelectOption[]) => {\n if (option && 'value' in option) {\n setTenant({ id: option.value as string, refresh: true })\n } else {\n setTenant({ id: undefined, refresh: true })\n }\n },\n [setTenant],\n )\n\n if (options.length <= 1) {\n return null\n }\n\n return (\n <div className=\"tenant-selector\">\n <SelectInput\n isClearable={viewType === 'list'}\n label=\"Tenant\"\n name=\"setTenant\"\n onChange={handleChange}\n options={options}\n path=\"setTenant\"\n value={\n selectedTenantID\n ? selectedTenantID === SELECT_ALL\n ? undefined\n : String(selectedTenantID)\n : undefined\n }\n />\n </div>\n )\n}\n"],"names":["SelectInput","React","SELECT_ALL","useTenantSelection","TenantSelector","viewType","options","selectedTenantID","setTenant","handleChange","useCallback","option","id","value","refresh","undefined","length","div","className","isClearable","label","name","onChange","path","String"],"mappings":"AAAA;;AAIA,SAASA,WAAW,QAAQ,iBAAgB;AAE5C,OAAO,eAAc;AAErB,OAAOC,WAAW,QAAO;AAEzB,SAASC,UAAU,QAAQ,qBAAoB;AAC/C,SAASC,kBAAkB,QAAQ,0DAAyD;AAE5F,OAAO,MAAMC,iBAAiB,CAAC,EAAEC,QAAQ,EAA4B;IACnE,MAAM,EAAEC,OAAO,EAAEC,gBAAgB,EAAEC,SAAS,EAAE,GAAGL;IAEjD,MAAMM,eAAeR,MAAMS,WAAW,CACpC,CAACC;QACC,IAAIA,UAAU,WAAWA,QAAQ;YAC/BH,UAAU;gBAAEI,IAAID,OAAOE,KAAK;gBAAYC,SAAS;YAAK;QACxD,OAAO;YACLN,UAAU;gBAAEI,IAAIG;gBAAWD,SAAS;YAAK;QAC3C;IACF,GACA;QAACN;KAAU;IAGb,IAAIF,QAAQU,MAAM,IAAI,GAAG;QACvB,OAAO;IACT;IAEA,qBACE,KAACC;QAAIC,WAAU;kBACb,cAAA,KAAClB;YACCmB,aAAad,aAAa;YAC1Be,OAAM;YACNC,MAAK;YACLC,UAAUb;YACVH,SAASA;YACTiB,MAAK;YACLV,OACEN,mBACIA,qBAAqBL,aACnBa,YACAS,OAAOjB,oBACTQ;;;AAKd,EAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const SELECT_ALL = "_ALL_";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU,UAAU,CAAA"}
@@ -0,0 +1,4 @@
1
+ // The tenant cookie can be set to _ALL_ to allow users to see all results for tenants they are a member of.
2
+ export const SELECT_ALL = '_ALL_';
3
+
4
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["// The tenant cookie can be set to _ALL_ to allow users to see all results for tenants they are a member of.\nexport const SELECT_ALL = '_ALL_'\n"],"names":["SELECT_ALL"],"mappings":"AAAA,4GAA4G;AAC5G,OAAO,MAAMA,aAAa,QAAO"}
@@ -0,0 +1,3 @@
1
+ export { TenantField } from '../components/TenantField/index.client.js';
2
+ export { TenantSelector } from '../components/TenantSelector/index.js';
3
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/exports/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { TenantField } from '../components/TenantField/index.client.js';
2
+ export { TenantSelector } from '../components/TenantSelector/index.js';
3
+
4
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["export { TenantField } from '../components/TenantField/index.client.js'\nexport { TenantSelector } from '../components/TenantSelector/index.js'\n"],"names":["TenantField","TenantSelector"],"mappings":"AAAA,SAASA,WAAW,QAAQ,4CAA2C;AACvE,SAASC,cAAc,QAAQ,wCAAuC"}
@@ -0,0 +1,3 @@
1
+ export { tenantField } from '../fields/tenantField/index.js';
2
+ export { tenantsArrayField } from '../fields/tenantsArrayField/index.js';
3
+ //# sourceMappingURL=fields.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../src/exports/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { tenantField } from '../fields/tenantField/index.js';
2
+ export { tenantsArrayField } from '../fields/tenantsArrayField/index.js';
3
+
4
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/exports/fields.ts"],"sourcesContent":["export { tenantField } from '../fields/tenantField/index.js'\nexport { tenantsArrayField } from '../fields/tenantsArrayField/index.js'\n"],"names":["tenantField","tenantsArrayField"],"mappings":"AAAA,SAASA,WAAW,QAAQ,iCAAgC;AAC5D,SAASC,iBAAiB,QAAQ,uCAAsC"}
@@ -1,4 +1,3 @@
1
1
  export { GlobalViewRedirect } from '../components/GlobalViewRedirect/index.js';
2
- export { TenantField } from '../components/TenantField/index.js';
3
- export { TenantSelector } from '../components/TenantSelector/index.js';
2
+ export { TenantSelectionProvider } from '../providers/TenantSelectionProvider/index.js';
4
3
  //# sourceMappingURL=rsc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../src/exports/rsc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA"}
1
+ {"version":3,"file":"rsc.d.ts","sourceRoot":"","sources":["../../src/exports/rsc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAA"}
@@ -1,5 +1,4 @@
1
1
  export { GlobalViewRedirect } from '../components/GlobalViewRedirect/index.js';
2
- export { TenantField } from '../components/TenantField/index.js';
3
- export { TenantSelector } from '../components/TenantSelector/index.js';
2
+ export { TenantSelectionProvider } from '../providers/TenantSelectionProvider/index.js';
4
3
 
5
4
  //# sourceMappingURL=rsc.js.map