@antelopejs/dms-saas 0.12.4-next.305.g9cd0617 → 0.12.4-next.312.gefc2ef8
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.
- package/README.md +2 -1
- package/dist/crons/hard-delete-cancelled.js +1 -0
- package/dist/crons/hard-delete-cancelled.js.map +1 -1
- package/dist/pages/tenant/general.js +9 -2
- package/dist/pages/tenant/general.js.map +1 -1
- package/dist/routes/tenant/workspaces.d.ts +7 -3
- package/dist/routes/tenant/workspaces.js +33 -10
- package/dist/routes/tenant/workspaces.js.map +1 -1
- package/dist/workspaces/db/workspace-branding.model.d.ts +28 -0
- package/dist/workspaces/db/workspace-branding.model.js +17 -0
- package/dist/workspaces/db/workspace-branding.model.js.map +1 -0
- package/dist/workspaces/db/workspace-branding.table.d.ts +8 -0
- package/dist/workspaces/db/workspace-branding.table.js +35 -0
- package/dist/workspaces/db/workspace-branding.table.js.map +1 -0
- package/dist/workspaces/index.d.ts +1 -0
- package/dist/workspaces/index.js +1 -0
- package/dist/workspaces/index.js.map +1 -1
- package/dist/workspaces/my-workspaces.d.ts +1 -0
- package/dist/workspaces/my-workspaces.js +9 -4
- package/dist/workspaces/my-workspaces.js.map +1 -1
- package/dist/workspaces/workspace-logo.d.ts +20 -0
- package/dist/workspaces/workspace-logo.js +73 -0
- package/dist/workspaces/workspace-logo.js.map +1 -0
- package/frontend-vue/app/build/WorkspaceMark.vue +41 -0
- package/frontend-vue/app/build/WorkspaceSwitcherRow.vue +6 -9
- package/frontend-vue/app/components/WorkspaceSwitcherWidget.vue +14 -9
- package/frontend-vue/app/composables/useMyWorkspaces.ts +2 -0
- package/frontend-vue/i18n/locales/saas-tenant-workspace-en-GB.json +4 -2
- package/frontend-vue/i18n/locales/saas-tenant-workspace-fr-FR.json +4 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -76,7 +76,8 @@ Then point a Stripe webhook at `https://<api>/api/saas/webhooks/stripe`, and pub
|
|
|
76
76
|
| `@antelopejs/interface-database-decorators` | `>=0.5.2 <0.6.0` | `0.5.2` |
|
|
77
77
|
| `@antelopejs/interface-dms` | `>=0.14.0 <0.15.0` | `0.14.4` |
|
|
78
78
|
| `@antelopejs/interface-dms-automation` | `>=0.7.0 <0.8.0` | `0.7.0` |
|
|
79
|
-
| `@antelopejs/interface-dms-saas` | `workspace:^` | `0.10.
|
|
79
|
+
| `@antelopejs/interface-dms-saas` | `workspace:^` | `0.10.2` |
|
|
80
|
+
| `@antelopejs/interface-file-storage` | `>=0.1.8 <0.2.0` | `0.1.8` |
|
|
80
81
|
|
|
81
82
|
<!-- antelopejs-docs-compat:end -->
|
|
82
83
|
|
|
@@ -28,6 +28,7 @@ async function deleteAdmittedTenant(sub, cutoff) {
|
|
|
28
28
|
await (0, hooks_1.ExecuteHooks)(hooks_1.Hook.TENANT_DELETED, tenantId, { operationId });
|
|
29
29
|
await (0, interface_database_decorators_1.GetModel)(db_1.TenantModel).delete(tenantId);
|
|
30
30
|
await (0, interface_database_decorators_1.GetModel)(db_2.TenantBillingInfoModel, tenantId).deleteAll();
|
|
31
|
+
await (0, workspaces_1.deleteWorkspaceLogo)(tenantId);
|
|
31
32
|
await model.finishDeletion(admitted);
|
|
32
33
|
}
|
|
33
34
|
async function run() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hard-delete-cancelled.js","sourceRoot":"","sources":["../../src/crons/hard-delete-cancelled.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"hard-delete-cancelled.js","sourceRoot":"","sources":["../../src/crons/hard-delete-cancelled.ts"],"names":[],"mappings":";;;;;AA2EA,kEAMC;AAjFD,gEAA6D;AAC7D,uEAAgE;AAChE,6FAAqE;AACrE,qDAA2D;AAC3D,iFAA2F;AAC3F,2DAAqE;AACrE,0DAAqD;AACrD,8BAIe;AACf,oCAA0C;AAC1C,wCAA2C;AAC3C,8CAIuB;AAEvB,MAAM,SAAS,GAAG,uBAAuB,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MAAM,CAAC,CAAC;IAEnE,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,IAAA,sBAAc,EAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC;YACH,MAAM,oBAAoB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC1C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,iBAAO,CAAC,KAAK,CACX,kBAAkB,SAAS,6BAA6B,QAAQ,EAAE,EAClE,KAAK,CACN,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAgB,2BAA2B;IACzC,OAAO,mBAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QACvC,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YAClC,iBAAO,CAAC,KAAK,CAAC,kBAAkB,SAAS,UAAU,EAAE,KAAK,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -12,6 +12,7 @@ const base_1 = require("@antelopejs/interface-dms/base");
|
|
|
12
12
|
const custom_1 = require("@antelopejs/interface-dms/base/custom");
|
|
13
13
|
const default_types_1 = require("@antelopejs/interface-dms/base/data-types/default-types");
|
|
14
14
|
const http_1 = require("@antelopejs/interface-dms/base/types/http");
|
|
15
|
+
const workspace_logo_1 = require("../../workspaces/workspace-logo");
|
|
15
16
|
const workspace_name_1 = require("../../workspaces/workspace-name");
|
|
16
17
|
const workspace_owner_1 = require("../../workspaces/workspace-owner");
|
|
17
18
|
const CURRENT_WORKSPACE_ENDPOINT = "/api/saas/workspaces/current";
|
|
@@ -40,6 +41,12 @@ function readonlyForNonOwners(options, isOwner) {
|
|
|
40
41
|
}
|
|
41
42
|
exports.identityForm = (0, base_1.Form)({
|
|
42
43
|
fields: [
|
|
44
|
+
{
|
|
45
|
+
id: "logo",
|
|
46
|
+
label: `${KEYS}.logo`,
|
|
47
|
+
description: `${KEYS}.logo_hint`,
|
|
48
|
+
type: workspace_logo_1.workspaceLogoType,
|
|
49
|
+
},
|
|
43
50
|
{
|
|
44
51
|
id: "name",
|
|
45
52
|
label: `${KEYS}.name`,
|
|
@@ -62,8 +69,8 @@ exports.identityForm = (0, base_1.Form)({
|
|
|
62
69
|
submitUrl: CURRENT_WORKSPACE_ENDPOINT,
|
|
63
70
|
submitUrlMethod: http_1.HttpMethod.put,
|
|
64
71
|
saveMode: "bar",
|
|
65
|
-
successMessage: `${KEYS}.
|
|
66
|
-
errorMessage: `${KEYS}.error.
|
|
72
|
+
successMessage: `${KEYS}.saved`,
|
|
73
|
+
errorMessage: `${KEYS}.error.save`,
|
|
67
74
|
})
|
|
68
75
|
.watch(base_1.FormEvents.SUBMIT_SUCCESS, base_1.BlockFunctions.REFRESH_PAGE)
|
|
69
76
|
.meta({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.js","sourceRoot":"","sources":["../../../src/pages/tenant/general.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yDAIwC;AACxC,yDAQwC;AACxC,kEAAwE;AACxE,2FAA2F;AAC3F,oEAAuE;AACvE,oEAA4E;AAC5E,sEAA2E;
|
|
1
|
+
{"version":3,"file":"general.js","sourceRoot":"","sources":["../../../src/pages/tenant/general.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yDAIwC;AACxC,yDAQwC;AACxC,kEAAwE;AACxE,2FAA2F;AAC3F,oEAAuE;AACvE,oEAAoE;AACpE,oEAA4E;AAC5E,sEAA2E;AAE3E,MAAM,0BAA0B,GAAG,8BAA8B,CAAC;AAClE,MAAM,eAAe,GAAG,GAAG,0BAA0B,SAAS,CAAC;AAC/D,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB,MAAM,IAAI,GAAG,yBAAyB,CAAC;AACvC,MAAM,WAAW,GAAG,6BAA6B,CAAC;AAElD,MAAM,gBAAgB,GAAG;IACvB,KAAK,EAAE,GAAG,IAA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K,EAAE,GAAG,IAAI,eAAe;KAC9B,CAAC,CAAC,IAAI,CAAC;QACN,IAAI,EAAE,GAAG,WAAW,SAAS;QAC7B,WAAW,EAAE,GAAG,WAAW,qBAAqB;QAChD,IAAI,EAAE,iBAAiB;KACxB,CAAC,CACH,CAAC;IAOF,MAAM,CAAC,UAAU,GAAG,IAAA,cAAO,EAAC;QAC1B,KAAK,EAAE,GAAG,IAAI,oBAAoB;QAClC,MAAM,EAAE,IAAI;KACb,CAAC,CAAC,KAAK,CACN,SAAS,EACT,IAAA,wBAAe,EAAC,4BAA4B,CAAC,CAAC,IAAI,CAAC;QACjD,IAAI,EAAE,GAAG,WAAW,cAAc;QAClC,WAAW,EAAE,GAAG,WAAW,0BAA0B;QACrD,IAAI,EAAE,sBAAsB;KAC7B,CAAC,CACH,CAAC;;AA9CS,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,mBAAY,GAAE;GACF,2BAA2B,CA+CvC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type RequestContext } from "@antelopejs/interface-api";
|
|
2
|
+
import type { DefaultDataTypes } from "@antelopejs/interface-dms/base/data-types/default-types";
|
|
2
3
|
import { TenantModel } from "@antelopejs/interface-dms/db";
|
|
3
4
|
import { type User } from "@antelopejs/interface-dms/auth/db";
|
|
4
5
|
import type { StatGroupItem } from "@antelopejs/interface-dms/base";
|
|
@@ -16,17 +17,20 @@ interface CreatedWorkspace {
|
|
|
16
17
|
interface CurrentWorkspace {
|
|
17
18
|
_id: string;
|
|
18
19
|
name: string;
|
|
20
|
+
logo: DefaultDataTypes.ImageValue | null;
|
|
19
21
|
retentionDays: number;
|
|
20
22
|
}
|
|
21
23
|
interface WorkspaceGlance {
|
|
22
24
|
items: StatGroupItem[];
|
|
23
25
|
}
|
|
24
|
-
interface
|
|
26
|
+
interface WorkspaceIdentityBody {
|
|
25
27
|
name?: string;
|
|
28
|
+
logo?: unknown;
|
|
26
29
|
}
|
|
27
|
-
interface
|
|
30
|
+
interface WorkspaceIdentity {
|
|
28
31
|
_id: string;
|
|
29
32
|
name: string;
|
|
33
|
+
logo: DefaultDataTypes.ImageValue | null;
|
|
30
34
|
}
|
|
31
35
|
interface WorkspaceDeleteBody {
|
|
32
36
|
confirmName?: string;
|
|
@@ -41,7 +45,7 @@ export declare class SaasWorkspacesController extends SaasWorkspacesController_b
|
|
|
41
45
|
getCurrent(_user: User, ctx: RequestContext): Promise<CurrentWorkspace>;
|
|
42
46
|
getCurrentGlance(user: User, ctx: RequestContext): Promise<WorkspaceGlance>;
|
|
43
47
|
getCurrentOverview(user: User, ctx: RequestContext): Promise<WorkspaceOverview>;
|
|
44
|
-
|
|
48
|
+
saveCurrentIdentity(_user: User, ctx: RequestContext, body: WorkspaceIdentityBody): Promise<WorkspaceIdentity>;
|
|
45
49
|
deleteCurrent(user: User, ctx: RequestContext, body: WorkspaceDeleteBody): Promise<WorkspaceDeletionResult>;
|
|
46
50
|
}
|
|
47
51
|
export {};
|
|
@@ -16,13 +16,17 @@ exports.SaasWorkspacesController = void 0;
|
|
|
16
16
|
const interface_api_1 = require("@antelopejs/interface-api");
|
|
17
17
|
const interface_api_util_1 = require("@antelopejs/interface-api-util");
|
|
18
18
|
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
19
|
+
const attachments_1 = require("@antelopejs/interface-dms/attachments");
|
|
19
20
|
const db_1 = require("@antelopejs/interface-dms/db");
|
|
20
21
|
const guards_1 = require("@antelopejs/interface-dms/guards");
|
|
22
|
+
const page_1 = require("@antelopejs/interface-dms/page");
|
|
21
23
|
const request_tenant_1 = require("@antelopejs/interface-dms/request-tenant");
|
|
22
24
|
const auth_1 = require("@antelopejs/interface-dms/auth");
|
|
23
25
|
const stripe_1 = require("../../stripe");
|
|
24
26
|
const config_1 = require("../../config");
|
|
25
27
|
const content_language_1 = require("../../utils/content-language");
|
|
28
|
+
const general_1 = require("../../pages/tenant/general");
|
|
29
|
+
const workspace_branding_model_1 = require("../../workspaces/db/workspace-branding.model");
|
|
26
30
|
const workspaces_1 = require("../../workspaces");
|
|
27
31
|
const HTTP_NOT_FOUND = 404;
|
|
28
32
|
const HTTP_BAD_REQUEST = 400;
|
|
@@ -96,11 +100,11 @@ class SaasWorkspacesController extends (0, interface_api_1.Controller)("/api/saa
|
|
|
96
100
|
const tenantId = (0, request_tenant_1.getRequestTenantId)(ctx);
|
|
97
101
|
const tenant = await this.tenantModel.get(tenantId);
|
|
98
102
|
(0, interface_api_util_1.assert)(tenant, HTTP_NOT_FOUND, "saas.errors.workspace.not_found");
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
};
|
|
103
|
+
const [logo, retentionDays] = await Promise.all([
|
|
104
|
+
(0, interface_database_decorators_1.GetModel)(workspace_branding_model_1.WorkspaceBrandingModel, tenantId).getLogo(tenantId),
|
|
105
|
+
(0, workspaces_1.resolveDataRetentionDays)(),
|
|
106
|
+
]);
|
|
107
|
+
return { _id: tenant._id, name: tenant.name, logo, retentionDays };
|
|
104
108
|
}
|
|
105
109
|
async getCurrentGlance(user, ctx) {
|
|
106
110
|
const view = await (0, workspaces_1.buildWorkspaceOverview)((0, request_tenant_1.getRequestTenantId)(ctx), user._id);
|
|
@@ -109,11 +113,30 @@ class SaasWorkspacesController extends (0, interface_api_1.Controller)("/api/saa
|
|
|
109
113
|
async getCurrentOverview(user, ctx) {
|
|
110
114
|
return (0, workspaces_1.buildWorkspaceOverview)((0, request_tenant_1.getRequestTenantId)(ctx), user._id);
|
|
111
115
|
}
|
|
112
|
-
async
|
|
116
|
+
async saveCurrentIdentity(_user, ctx, body) {
|
|
113
117
|
const tenantId = (0, request_tenant_1.getRequestTenantId)(ctx);
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
const tenant = await this.tenantModel.get(tenantId);
|
|
119
|
+
(0, interface_api_util_1.assert)(tenant, HTTP_NOT_FOUND, "saas.errors.workspace.not_found");
|
|
120
|
+
const name = "name" in body ? (0, workspaces_1.normalizeWorkspaceName)(body.name) : tenant.name;
|
|
121
|
+
const branding = (0, interface_database_decorators_1.GetModel)(workspace_branding_model_1.WorkspaceBrandingModel, tenantId);
|
|
122
|
+
const storedLogo = await branding.getLogo(tenantId);
|
|
123
|
+
const logo = "logo" in body
|
|
124
|
+
? await (0, attachments_1.SaveComponentFiles)({
|
|
125
|
+
context: ctx,
|
|
126
|
+
componentIds: (0, page_1.GetComponentPermissionIds)(general_1.identityForm),
|
|
127
|
+
fields: workspaces_1.workspaceLogoAttachmentFields,
|
|
128
|
+
submitted: { logo: body.logo },
|
|
129
|
+
before: { logo: storedLogo },
|
|
130
|
+
}, async (promoted) => {
|
|
131
|
+
const saved = (0, interface_api_util_1.assertValidation)(promoted.logo, (value) => workspaces_1.workspaceLogoInput.parse(value));
|
|
132
|
+
await branding.setLogo(tenantId, saved);
|
|
133
|
+
return { document: { logo: saved }, result: saved };
|
|
134
|
+
})
|
|
135
|
+
: storedLogo;
|
|
136
|
+
if (name !== tenant.name) {
|
|
137
|
+
await this.tenantModel.update(tenantId, { name, updatedAt: new Date() });
|
|
138
|
+
}
|
|
139
|
+
return { _id: tenantId, name, logo };
|
|
117
140
|
}
|
|
118
141
|
async deleteCurrent(user, ctx, body) {
|
|
119
142
|
const tenantId = (0, request_tenant_1.getRequestTenantId)(ctx);
|
|
@@ -193,7 +216,7 @@ __decorate([
|
|
|
193
216
|
__metadata("design:type", Function),
|
|
194
217
|
__metadata("design:paramtypes", [Function, Object, Object]),
|
|
195
218
|
__metadata("design:returntype", Promise)
|
|
196
|
-
], SaasWorkspacesController.prototype, "
|
|
219
|
+
], SaasWorkspacesController.prototype, "saveCurrentIdentity", null);
|
|
197
220
|
__decorate([
|
|
198
221
|
(0, interface_api_1.Post)("/current/delete"),
|
|
199
222
|
__param(0, (0, guards_1.AuthTenantOwner)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspaces.js","sourceRoot":"","sources":["../../../src/routes/tenant/workspaces.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DASmC;AACnC,
|
|
1
|
+
{"version":3,"file":"workspaces.js","sourceRoot":"","sources":["../../../src/routes/tenant/workspaces.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DASmC;AACnC,uEAA0E;AAC1E,6FAA4E;AAC5E,uEAA2E;AAE3E,qDAA2D;AAC3D,6DAG0C;AAC1C,yDAA2E;AAC3E,6EAA8E;AAC9E,yDAA6D;AAG7D,yCAKsB;AACtB,yCAAmD;AACnD,mEAIsC;AACtC,wDAA0D;AAC1D,2FAAsF;AAWtF,iDAmB0B;AAE1B,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAkD7B,KAAK,UAAU,wBAAwB,CACrC,IAAU,EACV,GAAmB,EACnB,IAAyB,EACzB,IAAiB;IAEjB,MAAM,aAAa,GAAG,IAAA,mCAAsB,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAC,cAAc,EAAE,qBAAqB,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAChE,IAAA,iDAAoC,EAClC,IAAI,CAAC,GAAG,EACR,IAAI,EACJ,IAAA,mCAAkB,EAAC,GAAG,CAAC,CACxB;QACD,IAAA,yCAA4B,GAAE;KAC/B,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,IAAA,6CAAgC,EACjD,IAAI,CAAC,MAAM,EACX,cAAc,CAAC,YAAY,CAC5B,CAAC;IACF,MAAM,OAAO,GAAG,MAAM,IAAA,oCAAuB,EAAC;QAC5C,WAAW,EAAE,IAAA,8BAAiB,EAAC,IAAI,EAAE,qBAAqB,CAAC;QAC3D,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,IAAI;QACJ,cAAc;QACd,qBAAqB;KACtB,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,CAAC,MAA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WAAA,IAAA,uBAAO,GAAE,CAAA;;;;gEAOX;AAIK;IADL,IAAA,mBAAG,EAAC,mBAAmB,CAAC;IAEtB,WAAA,IAAA,wBAAe,GAAE,CAAA;IACjB,WAAA,IAAA,uBAAO,GAAE,CAAA;;;;kEAGX;AAQK;IADL,IAAA,mBAAG,EAAC,UAAU,CAAC;IAEb,WAAA,IAAA,wBAAe,GAAE,CAAA;IACjB,WAAA,IAAA,uBAAO,GAAE,CAAA;IACT,WAAA,IAAA,wBAAQ,GAAE,CAAA;;;;mEAgCZ;AAOK;IADL,IAAA,oBAAI,EAAC,iBAAiB,CAAC;IAErB,WAAA,IAAA,wBAAe,GAAE,CAAA;IACjB,WAAA,IAAA,uBAAO,GAAE,CAAA;IACT,WAAA,IAAA,wBAAQ,GAAE,CAAA;;;;6DAWZ"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { DefaultDataTypes } from "@antelopejs/interface-dms/base/data-types/default-types";
|
|
2
|
+
import { WorkspaceBranding } from "./workspace-branding.table";
|
|
3
|
+
declare const WorkspaceBrandingModel_base: {
|
|
4
|
+
new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
|
|
5
|
+
readonly table: import("@antelopejs/interface-database").Table<WorkspaceBranding>;
|
|
6
|
+
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
7
|
+
get(id: string): Promise<WorkspaceBranding | undefined>;
|
|
8
|
+
getBy(index: keyof WorkspaceBranding, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): Promise<WorkspaceBranding[]>;
|
|
9
|
+
getAll(): Promise<WorkspaceBranding[]>;
|
|
10
|
+
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<WorkspaceBranding> | import("@antelopejs/interface-database-decorators").DeepPartial<WorkspaceBranding>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
11
|
+
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<WorkspaceBranding>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<WorkspaceBranding> & {
|
|
13
|
+
_id: string;
|
|
14
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
15
|
+
delete(id: string): Promise<number>;
|
|
16
|
+
};
|
|
17
|
+
readonly schemaName: string | undefined;
|
|
18
|
+
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<WorkspaceBranding>;
|
|
19
|
+
fromPlainData(obj: WorkspaceBranding | import("@antelopejs/interface-database-decorators").PlainData<WorkspaceBranding>): WorkspaceBranding;
|
|
20
|
+
fromDatabase(obj: any): WorkspaceBranding | undefined;
|
|
21
|
+
toDatabase(obj: WorkspaceBranding | import("@antelopejs/interface-database-decorators").PlainData<WorkspaceBranding>): import("@antelopejs/interface-database-decorators").StoredRow<WorkspaceBranding>;
|
|
22
|
+
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
23
|
+
};
|
|
24
|
+
export declare class WorkspaceBrandingModel extends WorkspaceBrandingModel_base {
|
|
25
|
+
getLogo(tenantId: string): Promise<DefaultDataTypes.ImageValue | null>;
|
|
26
|
+
setLogo(tenantId: string, logo: DefaultDataTypes.ImageValue | null): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkspaceBrandingModel = void 0;
|
|
4
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
5
|
+
const workspace_branding_table_1 = require("./workspace-branding.table");
|
|
6
|
+
class WorkspaceBrandingModel extends (0, interface_database_decorators_1.BasicDataModel)(workspace_branding_table_1.WorkspaceBranding, workspace_branding_table_1.workspaceBrandingTableName) {
|
|
7
|
+
async getLogo(tenantId) {
|
|
8
|
+
return (await this.get(tenantId))?.logo ?? null;
|
|
9
|
+
}
|
|
10
|
+
async setLogo(tenantId, logo) {
|
|
11
|
+
await this.table
|
|
12
|
+
.insert({ _id: tenantId, logo, updatedAt: new Date() }, { conflict: "update" })
|
|
13
|
+
.run();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.WorkspaceBrandingModel = WorkspaceBrandingModel;
|
|
17
|
+
//# sourceMappingURL=workspace-branding.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-branding.model.js","sourceRoot":"","sources":["../../../src/workspaces/db/workspace-branding.model.ts"],"names":[],"mappings":";;;AAAA,6FAA2E;AAE3E,yEAGoC;AAGpC,MAAa,sBAAuB,SAAQ,IAAA,8CAAc,EACxD,4CAAiB,EACjB,qDAA0B,CAC3B;IACC,KAAK,CAAC,OAAO,CAAC,QAAgB;QAC5B,OAAO,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,OAAO,CACX,QAAgB,EAChB,IAAwC;QAExC,MAAM,IAAI,CAAC,KAAK;aACb,MAAM,CACL,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,EAC9C,EAAE,QAAQ,EAAE,QAAQ,EAAE,CACvB;aACA,GAAG,EAAE,CAAC;IACX,CAAC;CACF;AAnBD,wDAmBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Table } from "@antelopejs/interface-database-decorators";
|
|
2
|
+
import type { DefaultDataTypes } from "@antelopejs/interface-dms/base/data-types/default-types";
|
|
3
|
+
export declare const workspaceBrandingTableName = "saas_workspace_branding";
|
|
4
|
+
export declare class WorkspaceBranding extends Table {
|
|
5
|
+
_id: string;
|
|
6
|
+
logo: DefaultDataTypes.ImageValue | null;
|
|
7
|
+
updatedAt: Date;
|
|
8
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.WorkspaceBranding = exports.workspaceBrandingTableName = void 0;
|
|
13
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
14
|
+
const constants_1 = require("@antelopejs/interface-dms/constants");
|
|
15
|
+
exports.workspaceBrandingTableName = "saas_workspace_branding";
|
|
16
|
+
let WorkspaceBranding = class WorkspaceBranding extends interface_database_decorators_1.Table {
|
|
17
|
+
};
|
|
18
|
+
exports.WorkspaceBranding = WorkspaceBranding;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], WorkspaceBranding.prototype, "_id", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, interface_database_decorators_1.Field)("any"),
|
|
25
|
+
__metadata("design:type", Object)
|
|
26
|
+
], WorkspaceBranding.prototype, "logo", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, interface_database_decorators_1.UpdateTime)(),
|
|
29
|
+
(0, interface_database_decorators_1.Field)("date"),
|
|
30
|
+
__metadata("design:type", Date)
|
|
31
|
+
], WorkspaceBranding.prototype, "updatedAt", void 0);
|
|
32
|
+
exports.WorkspaceBranding = WorkspaceBranding = __decorate([
|
|
33
|
+
(0, interface_database_decorators_1.RegisterTable)(exports.workspaceBrandingTableName, constants_1.TENANT_SCHEMA_NAME)
|
|
34
|
+
], WorkspaceBranding);
|
|
35
|
+
//# sourceMappingURL=workspace-branding.table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-branding.table.js","sourceRoot":"","sources":["../../../src/workspaces/db/workspace-branding.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6FAKmD;AAEnD,mEAAyE;AAE5D,QAAA,0BAA0B,GAAG,yBAAyB,CAAC;AAI7D,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,qCAAK;CAY3C,CAAA;AAZY,8CAAiB;AAGpB;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;8CACI;AAIZ;IADP,IAAA,qCAAK,EAAC,KAAK,CAAC;;+CACoC;AAIzC;IAFP,IAAA,0CAAU,GAAE;IACZ,IAAA,qCAAK,EAAC,MAAM,CAAC;8BACK,IAAI;oDAAC;4BAXb,iBAAiB;IAD7B,IAAA,6CAAa,EAAC,kCAA0B,EAAE,8BAAkB,CAAC;GACjD,iBAAiB,CAY7B"}
|
|
@@ -10,6 +10,7 @@ export * from "./provisioning";
|
|
|
10
10
|
export * from "./registration-extras";
|
|
11
11
|
export * from "./self-serve-creation";
|
|
12
12
|
export * from "./suspension";
|
|
13
|
+
export * from "./workspace-logo";
|
|
13
14
|
export * from "./workspace-name";
|
|
14
15
|
export * from "./workspace-glance";
|
|
15
16
|
export * from "./workspace-overview";
|
package/dist/workspaces/index.js
CHANGED
|
@@ -26,6 +26,7 @@ __exportStar(require("./provisioning"), exports);
|
|
|
26
26
|
__exportStar(require("./registration-extras"), exports);
|
|
27
27
|
__exportStar(require("./self-serve-creation"), exports);
|
|
28
28
|
__exportStar(require("./suspension"), exports);
|
|
29
|
+
__exportStar(require("./workspace-logo"), exports);
|
|
29
30
|
__exportStar(require("./workspace-name"), exports);
|
|
30
31
|
__exportStar(require("./workspace-glance"), exports);
|
|
31
32
|
__exportStar(require("./workspace-overview"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workspaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,wDAAsC;AACtC,iDAA+B;AAC/B,6CAA2B;AAC3B,8CAA4B;AAC5B,6DAA2C;AAC3C,gDAA8B;AAC9B,kDAAgC;AAChC,iDAA+B;AAC/B,wDAAsC;AACtC,wDAAsC;AACtC,+CAA6B;AAC7B,mDAAiC;AACjC,qDAAmC;AACnC,uDAAqC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workspaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,wDAAsC;AACtC,iDAA+B;AAC/B,6CAA2B;AAC3B,8CAA4B;AAC5B,6DAA2C;AAC3C,gDAA8B;AAC9B,kDAAgC;AAChC,iDAA+B;AAC/B,wDAAsC;AACtC,wDAAsC;AACtC,+CAA6B;AAC7B,mDAAiC;AACjC,mDAAiC;AACjC,qDAAmC;AACnC,uDAAqC"}
|
|
@@ -7,15 +7,18 @@ const db_1 = require("@antelopejs/interface-dms/db");
|
|
|
7
7
|
const db_2 = require("@antelopejs/interface-dms/auth/db");
|
|
8
8
|
const billing_state_1 = require("../billing-state");
|
|
9
9
|
const db_3 = require("../db");
|
|
10
|
+
const workspace_branding_model_1 = require("./db/workspace-branding.model");
|
|
11
|
+
const workspace_logo_1 = require("./workspace-logo");
|
|
10
12
|
const CANCELLED_STATUS = "cancelled";
|
|
11
13
|
async function loadFacts(tenant) {
|
|
12
14
|
const memberModel = (0, interface_database_decorators_1.GetModel)(db_1.TenantMemberModel, tenant._id);
|
|
13
|
-
const [subscription, owners, membersCount] = await Promise.all([
|
|
15
|
+
const [subscription, owners, membersCount, logo] = await Promise.all([
|
|
14
16
|
(0, interface_database_decorators_1.GetModel)(db_3.TenantSubscriptionModel, tenant._id).findOne(),
|
|
15
17
|
memberModel.listOwners(),
|
|
16
18
|
memberModel.table.count().run(),
|
|
19
|
+
(0, interface_database_decorators_1.GetModel)(workspace_branding_model_1.WorkspaceBrandingModel, tenant._id).getLogo(tenant._id),
|
|
17
20
|
]);
|
|
18
|
-
return { tenant, subscription, owners, membersCount };
|
|
21
|
+
return { tenant, subscription, owners, membersCount, logo };
|
|
19
22
|
}
|
|
20
23
|
async function resolvePlanName(subscription) {
|
|
21
24
|
if (!subscription?.planId)
|
|
@@ -31,14 +34,16 @@ async function resolveOwnerName(owners) {
|
|
|
31
34
|
return user?.name || user?.email || null;
|
|
32
35
|
}
|
|
33
36
|
async function toRow(facts, userId, currentTenantId) {
|
|
34
|
-
const { tenant, subscription, owners, membersCount } = facts;
|
|
35
|
-
const [planName, ownerName] = await Promise.all([
|
|
37
|
+
const { tenant, subscription, owners, membersCount, logo } = facts;
|
|
38
|
+
const [planName, ownerName, logoUrl] = await Promise.all([
|
|
36
39
|
resolvePlanName(subscription),
|
|
37
40
|
resolveOwnerName(owners),
|
|
41
|
+
(0, workspace_logo_1.workspaceLogoUrl)(logo),
|
|
38
42
|
]);
|
|
39
43
|
return {
|
|
40
44
|
_id: tenant._id,
|
|
41
45
|
name: tenant.name,
|
|
46
|
+
logoUrl,
|
|
42
47
|
planName,
|
|
43
48
|
status: (0, billing_state_1.deriveBillingState)(subscription),
|
|
44
49
|
isComplimentary: !!subscription?.isComplimentary,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"my-workspaces.js","sourceRoot":"","sources":["../../src/workspaces/my-workspaces.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"my-workspaces.js","sourceRoot":"","sources":["../../src/workspaces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C,CAAC;AACtC,CAAC;AAQD,SAAS,QAAQ,CAAC,IAAoB,EAAE,eAAuB;IAC7D,OAAO,CACL,IAAI,CAAC,YAAY,EAAE,MAAM,KAAK,gBAAgB;QAC9C,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,eAAe,CACpC,CAAC;AACJ,CAAC;AAGM,KAAK,UAAU,gBAAgB,CACpC,MAAc,EACd,eAAuB;IAEvB,MAAM,WAAW,GAAG,MAAM,IAAA,wCAAQ,EAChC,sBAAiB,EACjB,mCAAc,CACf,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACxC,MAAM,OAAO,GAAG,MAAM,IAAA,wCAAQ,EAAC,gBAAW,CAAC,CAAC,OAAO,CACjD,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CACrD,CAAC;IACF,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC;IACrE,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,CAC5B,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC,CACzD,CAAC;IACF,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AttachmentField } from "@antelopejs/interface-dms/attachments";
|
|
2
|
+
import { DefaultDataTypes } from "@antelopejs/interface-dms/base/data-types/default-types";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
export declare const workspaceLogoType: DefaultDataTypes.ImageType;
|
|
5
|
+
export declare const workspaceLogoAttachmentFields: AttachmentField[];
|
|
6
|
+
export declare const workspaceLogoInput: z.ZodNullable<z.ZodObject<{
|
|
7
|
+
key: z.ZodString;
|
|
8
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
9
|
+
principal: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
key: string;
|
|
12
|
+
alt?: string | undefined;
|
|
13
|
+
principal?: boolean | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
key: string;
|
|
16
|
+
alt?: string | undefined;
|
|
17
|
+
principal?: boolean | undefined;
|
|
18
|
+
}>>;
|
|
19
|
+
export declare function workspaceLogoUrl(logo: DefaultDataTypes.ImageValue | null): Promise<string | null>;
|
|
20
|
+
export declare function deleteWorkspaceLogo(tenantId: string): Promise<void>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.workspaceLogoInput = exports.workspaceLogoAttachmentFields = exports.workspaceLogoType = void 0;
|
|
4
|
+
exports.workspaceLogoUrl = workspaceLogoUrl;
|
|
5
|
+
exports.deleteWorkspaceLogo = deleteWorkspaceLogo;
|
|
6
|
+
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
7
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
8
|
+
const default_types_1 = require("@antelopejs/interface-dms/base/data-types/default-types");
|
|
9
|
+
const interface_file_storage_1 = require("@antelopejs/interface-file-storage");
|
|
10
|
+
const zod_1 = require("zod");
|
|
11
|
+
const workspace_branding_model_1 = require("./db/workspace-branding.model");
|
|
12
|
+
const LOGO_ATTACHMENT_FIELD = "saas-workspace-identity#logo";
|
|
13
|
+
const LOGO_STORAGE_PATH = "workspace-logos";
|
|
14
|
+
const LOGO_MIMETYPES = ["image/png", "image/jpeg", "image/webp"];
|
|
15
|
+
const LOGO_MAX_UPLOAD_BYTES = 512 * 1024;
|
|
16
|
+
const LOGO_DIMENSION_PX = 128;
|
|
17
|
+
const LOGO_VISIBILITY = "public";
|
|
18
|
+
exports.workspaceLogoType = new default_types_1.DefaultDataTypes.ImageType({
|
|
19
|
+
path: LOGO_STORAGE_PATH,
|
|
20
|
+
attachmentField: LOGO_ATTACHMENT_FIELD,
|
|
21
|
+
visibility: LOGO_VISIBILITY,
|
|
22
|
+
constraints: {
|
|
23
|
+
allowedMimetypes: LOGO_MIMETYPES,
|
|
24
|
+
maxSize: LOGO_MAX_UPLOAD_BYTES,
|
|
25
|
+
},
|
|
26
|
+
resize: {
|
|
27
|
+
maxWidth: LOGO_DIMENSION_PX,
|
|
28
|
+
maxHeight: LOGO_DIMENSION_PX,
|
|
29
|
+
fit: "contain",
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
exports.workspaceLogoAttachmentFields = [
|
|
33
|
+
{
|
|
34
|
+
id: LOGO_ATTACHMENT_FIELD,
|
|
35
|
+
key: "logo",
|
|
36
|
+
kind: "image",
|
|
37
|
+
visibility: LOGO_VISIBILITY,
|
|
38
|
+
constraints: {
|
|
39
|
+
allowedMimetypes: LOGO_MIMETYPES,
|
|
40
|
+
maxSize: LOGO_MAX_UPLOAD_BYTES,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
exports.workspaceLogoInput = zod_1.z
|
|
45
|
+
.object({
|
|
46
|
+
key: zod_1.z.string().min(1),
|
|
47
|
+
alt: zod_1.z.string().optional(),
|
|
48
|
+
principal: zod_1.z.boolean().optional(),
|
|
49
|
+
})
|
|
50
|
+
.nullable();
|
|
51
|
+
async function workspaceLogoUrl(logo) {
|
|
52
|
+
if (!logo)
|
|
53
|
+
return null;
|
|
54
|
+
try {
|
|
55
|
+
return (await (0, interface_file_storage_1.CreateReadUrl)(logo.key)).url;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
logging_1.Logging.Error(`[dms-saas:workspace-logo] no read URL for ${logo.key}`, error);
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async function deleteWorkspaceLogo(tenantId) {
|
|
63
|
+
const branding = (0, interface_database_decorators_1.GetModel)(workspace_branding_model_1.WorkspaceBrandingModel, tenantId);
|
|
64
|
+
const logo = await branding.getLogo(tenantId);
|
|
65
|
+
if (logo) {
|
|
66
|
+
await (0, interface_file_storage_1.DeleteFile)(logo.key).catch((error) => {
|
|
67
|
+
if (!(error instanceof interface_file_storage_1.FileNotFoundError))
|
|
68
|
+
throw error;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
await branding.delete(tenantId);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=workspace-logo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-logo.js","sourceRoot":"","sources":["../../src/workspaces/workspace-logo.ts"],"names":[],"mappings":";;;AA+DA,4CAaC;AAOD,kDASC;AA5FD,gEAA6D;AAC7D,6FAAqE;AAErE,2FAA2F;AAC3F,+EAI4C;AAC5C,6BAAwB;AACxB,4EAAuE;AAEvE,MAAM,qBAAqB,GAAG,8BAA8B,CAAC;AAC7D,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAC5C,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;AACjE,MAAM,qBAAqB,GAAG,GAAG,GAAG,IAAI,CAAC;AACzC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,MAAM,eAAe,GAAG,QAAQ,CAAC;AAGpB,QAAA,iBAAiB,GAAG,IAAI,gCAAgB,CAAC,SAAS,CAAC;IAC9D,IAAI,EAAE,iBAAiB;IACvB,eAAe,EAAE,qBAAqB;IACtC,UAAU,EAAE,eAAe;IAC3B,WAAW,EAAE;QACX,gBAAgB,EAAE,cAAc;QAChC,OAAO,EAAE,q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QACT,MAAM,IAAA,mCAAU,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YAClD,IAAI,CAAC,CAAC,KAAK,YAAY,0CAAiB,CAAC;gBAAE,MAAM,KAAK,CAAC;QACzD,CAAC,CAAC,CAAC;IACL,CAAC;IACD,MAAM,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, watch } from 'vue'
|
|
3
|
+
|
|
4
|
+
/** A workspace's tile: its logo, or its initial when it has none or it fails to load. */
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
name: string
|
|
7
|
+
logoUrl: string | null
|
|
8
|
+
}>()
|
|
9
|
+
|
|
10
|
+
const hasFailed = ref(false)
|
|
11
|
+
watch(
|
|
12
|
+
() => props.logoUrl,
|
|
13
|
+
() => {
|
|
14
|
+
hasFailed.value = false
|
|
15
|
+
},
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
function initialOf(name: string): string {
|
|
19
|
+
return (name.trim()[0] ?? '?').toUpperCase()
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<span
|
|
25
|
+
v-if="logoUrl && !hasFailed"
|
|
26
|
+
class="ring-default inline-flex shrink-0 items-center justify-center overflow-hidden bg-white ring-1"
|
|
27
|
+
>
|
|
28
|
+
<img
|
|
29
|
+
:src="logoUrl"
|
|
30
|
+
alt=""
|
|
31
|
+
class="size-full object-contain"
|
|
32
|
+
@error="hasFailed = true"
|
|
33
|
+
/>
|
|
34
|
+
</span>
|
|
35
|
+
<span
|
|
36
|
+
v-else
|
|
37
|
+
class="from-primary-500 to-primary-600 bg-linear-to-br inline-flex shrink-0 items-center justify-center font-bold text-white"
|
|
38
|
+
>
|
|
39
|
+
{{ initialOf(name) }}
|
|
40
|
+
</span>
|
|
41
|
+
</template>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import { highlightParts } from './highlight'
|
|
4
|
+
import WorkspaceMark from './WorkspaceMark.vue'
|
|
4
5
|
|
|
5
6
|
const props = defineProps<{
|
|
6
7
|
workspace: MyWorkspace
|
|
@@ -51,10 +52,6 @@ const status = computed(() =>
|
|
|
51
52
|
? null
|
|
52
53
|
: statusView('workspace', props.workspace.status),
|
|
53
54
|
)
|
|
54
|
-
|
|
55
|
-
function initialOf(name: string): string {
|
|
56
|
-
return (name.trim()[0] ?? '?').toUpperCase()
|
|
57
|
-
}
|
|
58
55
|
</script>
|
|
59
56
|
|
|
60
57
|
<template>
|
|
@@ -70,12 +67,12 @@ function initialOf(name: string): string {
|
|
|
70
67
|
:disabled="isDisabled && !isSwitching"
|
|
71
68
|
@click="emit('select', workspace)"
|
|
72
69
|
>
|
|
73
|
-
<
|
|
74
|
-
|
|
70
|
+
<WorkspaceMark
|
|
71
|
+
:name="workspace.name"
|
|
72
|
+
:logo-url="workspace.logoUrl"
|
|
73
|
+
class="size-[22px] rounded-[5px] text-[11px]"
|
|
75
74
|
aria-hidden="true"
|
|
76
|
-
|
|
77
|
-
{{ initialOf(workspace.name) }}
|
|
78
|
-
</span>
|
|
75
|
+
/>
|
|
79
76
|
<span class="flex min-w-0 flex-1 flex-col">
|
|
80
77
|
<span class="text-highlighted truncate font-medium">
|
|
81
78
|
<!-- v-text keeps prettier's line breaks out of the highlighted runs -->
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref, watch } from 'vue'
|
|
3
3
|
import { HOME_PATH, workspaceSwitchLandingPath } from '../build/workspace-paths'
|
|
4
|
+
import WorkspaceMark from '../build/WorkspaceMark.vue'
|
|
4
5
|
import WorkspaceSwitcherRow from '../build/WorkspaceSwitcherRow.vue'
|
|
5
6
|
|
|
6
7
|
// Drawn as two roots: attributes have no single element to land on.
|
|
@@ -78,10 +79,6 @@ watch(isOpen, (open) => {
|
|
|
78
79
|
if (!open && !switchingId.value) searchQuery.value = ''
|
|
79
80
|
})
|
|
80
81
|
|
|
81
|
-
function initialOf(name: string): string {
|
|
82
|
-
return (name.trim()[0] ?? '?').toUpperCase()
|
|
83
|
-
}
|
|
84
|
-
|
|
85
82
|
function reportSwitchFailure(
|
|
86
83
|
error: unknown,
|
|
87
84
|
target: MyWorkspace | string,
|
|
@@ -160,11 +157,19 @@ async function onWorkspaceCreated(
|
|
|
160
157
|
"
|
|
161
158
|
:aria-label="$t(`${KEYS}.title`)"
|
|
162
159
|
>
|
|
163
|
-
<span
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
160
|
+
<span class="relative inline-flex shrink-0">
|
|
161
|
+
<WorkspaceMark
|
|
162
|
+
v-if="current"
|
|
163
|
+
:name="current.name"
|
|
164
|
+
:logo-url="current.logoUrl"
|
|
165
|
+
class="size-[26px] rounded-md text-[13px]"
|
|
166
|
+
/>
|
|
167
|
+
<span
|
|
168
|
+
v-else
|
|
169
|
+
class="from-primary-500 to-primary-600 bg-linear-to-br inline-flex size-[26px] items-center justify-center rounded-md text-white"
|
|
170
|
+
>
|
|
171
|
+
<UIcon name="i-ph-buildings" class="size-4" />
|
|
172
|
+
</span>
|
|
168
173
|
<span
|
|
169
174
|
v-if="isPastDue"
|
|
170
175
|
class="bg-error ring-default absolute -right-1 -top-1 size-2.5 rounded-full ring-2"
|
|
@@ -4,6 +4,8 @@ import { computed, type ComputedRef } from 'vue'
|
|
|
4
4
|
export interface MyWorkspace {
|
|
5
5
|
_id: string
|
|
6
6
|
name: string
|
|
7
|
+
/** Where the logo reads from; null shows the workspace's initial. */
|
|
8
|
+
logoUrl: string | null
|
|
7
9
|
planName: string | null
|
|
8
10
|
/** Billing state (`active`, `trialing`, `free`, `past_due`…). */
|
|
9
11
|
status: string
|
|
@@ -31,12 +31,14 @@
|
|
|
31
31
|
"identity_intro": "Your workspace identity, visible to every member and on invoices.",
|
|
32
32
|
"name": "Workspace name",
|
|
33
33
|
"name_hint": "Visible to every member, in the switcher and on invoices.",
|
|
34
|
+
"logo": "Logo",
|
|
35
|
+
"logo_hint": "Shown in the workspace switcher. PNG, JPEG or WebP, up to 512 KB.",
|
|
34
36
|
"workspace_id": "Workspace ID",
|
|
35
37
|
"workspace_id_hint": "Set when the workspace was created. Give it to support when you contact them.",
|
|
36
38
|
"owner_only": "Owners only",
|
|
37
|
-
"
|
|
39
|
+
"saved": "Workspace saved.",
|
|
38
40
|
"error": {
|
|
39
|
-
"
|
|
41
|
+
"save": "Couldn't save the workspace. Your change is kept: save again to retry.",
|
|
40
42
|
"delete": "Couldn't delete the workspace. Nothing was deleted."
|
|
41
43
|
},
|
|
42
44
|
"glance": {
|
|
@@ -31,12 +31,14 @@
|
|
|
31
31
|
"identity_intro": "L'identité de votre espace, visible par tous les membres et sur les factures.",
|
|
32
32
|
"name": "Nom de l'espace",
|
|
33
33
|
"name_hint": "Visible par tous les membres, dans le sélecteur et sur les factures.",
|
|
34
|
+
"logo": "Logo",
|
|
35
|
+
"logo_hint": "Affiché dans le sélecteur d'espaces. PNG, JPEG ou WebP, 512 Ko au plus.",
|
|
34
36
|
"workspace_id": "Identifiant de l'espace",
|
|
35
37
|
"workspace_id_hint": "Fixé à la création de l'espace. Communiquez-le au support quand vous le contactez.",
|
|
36
38
|
"owner_only": "Réservé aux propriétaires",
|
|
37
|
-
"
|
|
39
|
+
"saved": "Espace enregistré.",
|
|
38
40
|
"error": {
|
|
39
|
-
"
|
|
41
|
+
"save": "Impossible d'enregistrer l'espace. Votre modification est conservée : enregistrez à nouveau pour réessayer.",
|
|
40
42
|
"delete": "Impossible de supprimer l'espace. Rien n'a été supprimé."
|
|
41
43
|
},
|
|
42
44
|
"glance": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/dms-saas",
|
|
3
|
-
"version": "0.12.4-next.
|
|
3
|
+
"version": "0.12.4-next.312.gefc2ef8",
|
|
4
4
|
"description": "SaaS module for the AntelopeJS DMS: self-service sign-up and pricing, plans that gate features, Stripe billing, workspace settings and a back office.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"@antelopejs/interface-database-decorators": ">=0.5.2 <0.6.0",
|
|
54
54
|
"@antelopejs/interface-dms": ">=0.14.0 <0.15.0",
|
|
55
55
|
"@antelopejs/interface-dms-saas": "0.10.2-next.305.g9cd0617",
|
|
56
|
+
"@antelopejs/interface-file-storage": ">=0.1.8 <0.2.0",
|
|
56
57
|
"node-cron": "^4.2.1",
|
|
57
58
|
"stripe": "^22.6.2",
|
|
58
59
|
"zod": "^3.24.4"
|
|
@@ -61,7 +62,6 @@
|
|
|
61
62
|
"@antelopejs/core": "~1.24.0",
|
|
62
63
|
"@antelopejs/dms": ">=0.21.0 <0.22.0",
|
|
63
64
|
"@antelopejs/dms-frontend": ">=0.11.4 <0.12.0",
|
|
64
|
-
"@antelopejs/interface-file-storage": ">=0.1.8 <0.2.0",
|
|
65
65
|
"@antelopejs/interface-mongodb": ">=0.0.8 <0.1.0",
|
|
66
66
|
"@antelopejs/mongodb": ">=1.8.10 <1.9.0",
|
|
67
67
|
"@total-typescript/shoehorn": "^0.1.2",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
]
|
|
95
95
|
},
|
|
96
96
|
"dmsFrontend": "dist/frontend-module.js",
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "efc2ef81dc611983e14cc30b1d2f6c99a5bc4798",
|
|
98
98
|
"scripts": {
|
|
99
99
|
"build": "pnpm --filter @antelopejs/interface-dms-saas build && rimraf dist && tsc",
|
|
100
100
|
"test:frontend": "ajs dms verify-source --layer node_modules/@antelopejs/dms/frontend-vue --module frontend-vue",
|