@@ -54,8 +54,15 @@ The plugin accepts an object with the following properties:
54
54
``` ts
55
55
type MultiTenantPluginConfig <ConfigTypes = unknown > = {
56
56
/**
57
- * After a tenant is deleted, the plugin will attempt
58
- * to clean up related documents
57
+ * Base path for your application
58
+ *
59
+ * https://nextjs.org/docs/app/api-reference/config/next-config-js/basePath
60
+ *
61
+ * @default undefined
62
+ */
63
+ basePath? : string
64
+ /**
65
+ * After a tenant is deleted, the plugin will attempt to clean up related documents
59
66
* - removing documents with the tenant ID
60
67
* - removing the tenant from users
61
68
*
@@ -68,15 +75,18 @@ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
68
75
collections: {
69
76
[key in CollectionSlug ]? : {
70
77
/**
71
- * Set to `true` if you want the collection to
72
- * behave as a global
78
+ * Set to `true` if you want the collection to behave as a global
73
79
*
74
80
* @default false
75
81
*/
76
82
isGlobal? : boolean
77
83
/**
78
- * Set to `false` if you want to manually apply
79
- * the baseFilter
84
+ * Overrides for the tenant field, will override the entire tenantField configuration
85
+ */
86
+ tenantFieldOverrides? : CollectionTenantFieldConfigOverrides
87
+ /**
88
+ * Set to `false` if you want to manually apply the baseListFilter
89
+ * Set to `false` if you want to manually apply the baseFilter
80
90
*
81
91
* @default true
82
92
*/
@@ -94,8 +104,7 @@ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
94
104
*/
95
105
useBaseListFilter? : boolean
96
106
/**
97
- * Set to `false` if you want to handle collection access
98
- * manually without the multi-tenant constraints applied
107
+ * Set to `false` if you want to handle collection access manually without the multi-tenant constraints applied
99
108
*
100
109
* @default true
101
110
*/
@@ -104,8 +113,7 @@ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
104
113
}
105
114
/**
106
115
* Enables debug mode
107
- * - Makes the tenant field visible in the
108
- * admin UI within applicable collections
116
+ * - Makes the tenant field visible in the admin UI within applicable collections
109
117
*
110
118
* @default false
111
119
*/
@@ -117,27 +125,41 @@ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
117
125
*/
118
126
enabled? : boolean
119
127
/**
120
- * Field configuration for the field added
121
- * to all tenant enabled collections
128
+ * Localization for the plugin
122
129
*/
123
- tenantField? : {
124
- access? : RelationshipField [' access' ]
125
- /**
126
- * The name of the field added to all tenant
127
- * enabled collections
128
- *
129
- * @default ' tenant'
130
- */
131
- name? : string
130
+ i18n? : {
131
+ translations: {
132
+ [key in AcceptedLanguages ]? : {
133
+ /**
134
+ * @default ' You are about to change ownership from <0>{{fromTenant}}</0> to <0>{{toTenant}}</0>'
135
+ */
136
+ ' confirm-modal-tenant-switch--body' ? : string
137
+ /**
138
+ * `tenantLabel` defaults to the value of the `nav-tenantSelector-label` translation
139
+ *
140
+ * @default ' Confirm {{tenantLabel}} change'
141
+ */
142
+ ' confirm-modal-tenant-switch--heading' ? : string
143
+ /**
144
+ * @default ' Assigned Tenant'
145
+ */
146
+ ' field-assignedTenant-label' ? : string
147
+ /**
148
+ * @default ' Tenant'
149
+ */
150
+ ' nav-tenantSelector-label' ? : string
151
+ }
152
+ }
132
153
}
133
154
/**
134
- * Field configuration for the field added
135
- * to the users collection
155
+ * Field configuration for the field added to all tenant enabled collections
156
+ */
157
+ tenantField? : RootTenantFieldConfigOverrides
158
+ /**
159
+ * Field configuration for the field added to the users collection
136
160
*
137
- * If `includeDefaultField` is `false`, you must
138
- * include the field on your users collection manually
139
- * This is useful if you want to customize the field
140
- * or place the field in a specific location
161
+ * If `includeDefaultField` is `false`, you must include the field on your users collection manually
162
+ * This is useful if you want to customize the field or place the field in a specific location
141
163
*/
142
164
tenantsArrayField? :
143
165
| {
@@ -158,8 +180,7 @@ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
158
180
*/
159
181
arrayTenantFieldName? : string
160
182
/**
161
- * When `includeDefaultField` is `true`, the field will
162
- * be added to the users collection automatically
183
+ * When `includeDefaultField` is `true`, the field will be added to the users collection automatically
163
184
*/
164
185
includeDefaultField? : true
165
186
/**
@@ -176,8 +197,7 @@ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
176
197
arrayFieldName? : string
177
198
arrayTenantFieldName? : string
178
199
/**
179
- * When `includeDefaultField` is `false`, you must
180
- * include the field on your users collection manually
200
+ * When `includeDefaultField` is `false`, you must include the field on your users collection manually
181
201
*/
182
202
includeDefaultField? : false
183
203
rowFields? : never
@@ -186,8 +206,9 @@ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
186
206
/**
187
207
* Customize tenant selector label
188
208
*
189
- * Either a string or an object where the keys are i18n
190
- * codes and the values are the string labels
209
+ * Either a string or an object where the keys are i18n codes and the values are the string labels
210
+ *
211
+ * @deprecated Use `i18n.translations` instead.
191
212
*/
192
213
tenantSelectorLabel ?:
193
214
| Partial <{
@@ -201,27 +222,25 @@ type MultiTenantPluginConfig<ConfigTypes = unknown> = {
201
222
*/
202
223
tenantsSlug ?: string
203
224
/**
204
- * Function that determines if a user has access
205
- * to _all_ tenants
225
+ * Function that determines if a user has access to _all_ tenants
206
226
*
207
227
* Useful for super-admin type users
208
228
*/
209
229
userHasAccessToAllTenants ?: (
210
- user : ConfigTypes extends { user: unknown } ? ConfigTypes [' user' ] : User ,
230
+ user : ConfigTypes extends { user: unknown }
231
+ ? ConfigTypes [' user' ]
232
+ : TypedUser ,
211
233
) => boolean
212
234
/**
213
- * Opt out of adding access constraints to
214
- * the tenants collection
235
+ * Opt out of adding access constraints to the tenants collection
215
236
*/
216
237
useTenantsCollectionAccess ?: boolean
217
238
/**
218
- * Opt out including the baseFilter to filter
219
- * tenants by selected tenant
239
+ * Opt out including the baseListFilter to filter tenants by selected tenant
220
240
*/
221
241
useTenantsListFilter ?: boolean
222
242
/**
223
- * Opt out including the baseFilter to filter
224
- * users by selected tenant
243
+ * Opt out including the baseListFilter to filter users by selected tenant
225
244
*/
226
245
useUsersTenantFilter ?: boolean
227
246
}
0 commit comments