@sprucelabs/spruce-appointment-utils 6.2.1 → 7.1.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.
- package/build/esm/stores/RemoteRoleCapabilityStore.d.ts +11 -5
- package/build/esm/viewControllers/AbstractCapabilityCardViewController.js +2 -3
- package/build/esm/viewControllers/RolesCard.vc.js +0 -39
- package/build/stores/RemoteRoleCapabilityStore.d.ts +11 -5
- package/build/viewControllers/AbstractCapabilityCardViewController.js +2 -3
- package/build/viewControllers/RolesCard.vc.js +0 -39
- package/package.json +1 -1
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import { MercuryClient } from '@sprucelabs/mercury-client';
|
|
2
|
+
declare type RemoteRoleCapabilityOptions = {
|
|
3
|
+
client: MercuryClient;
|
|
4
|
+
organizationId: string;
|
|
5
|
+
};
|
|
1
6
|
export default class RemoteRoleCapabilityStore {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
constructor(options:
|
|
7
|
+
protected client: MercuryClient;
|
|
8
|
+
protected organizationId: string;
|
|
9
|
+
protected queuedCapabilities: Record<string, any>;
|
|
10
|
+
constructor(options: RemoteRoleCapabilityOptions);
|
|
6
11
|
queue(value: any): Promise<any>;
|
|
7
12
|
persist(): Promise<import("@sprucelabs/schema").SchemaStaticValues<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.UpdateRoleCapabilitySchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.UpdateRoleCapabilitySchema>, import("@sprucelabs/schema").StaticSchemaAllValues<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.UpdateRoleCapabilitySchema, false>>[]>;
|
|
8
|
-
|
|
13
|
+
protected createCapability(roleId: any, serviceId: any, values: any): Promise<import("@sprucelabs/schema").SchemaStaticValues<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.CreateRoleCapabilitySchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.CreateRoleCapabilitySchema>, import("@sprucelabs/schema").StaticSchemaAllValues<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.CreateRoleCapabilitySchema, false>>>;
|
|
9
14
|
protected updateCapability(id: any, values: any): Promise<import("@sprucelabs/schema").SchemaStaticValues<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.UpdateRoleCapabilitySchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.UpdateRoleCapabilitySchema>, import("@sprucelabs/schema").StaticSchemaAllValues<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.UpdateRoleCapabilitySchema, false>>>;
|
|
10
15
|
}
|
|
16
|
+
export {};
|
|
@@ -24,7 +24,6 @@ export default class AbstractCapabilityCardViewController extends AbstractViewCo
|
|
|
24
24
|
},
|
|
25
25
|
eventName: 'appointments.list-services::v2021_06_23',
|
|
26
26
|
responseKey: 'services',
|
|
27
|
-
footer: {},
|
|
28
27
|
rowTransformer: this.buildRow.bind(this),
|
|
29
28
|
}));
|
|
30
29
|
}
|
|
@@ -37,12 +36,12 @@ export default class AbstractCapabilityCardViewController extends AbstractViewCo
|
|
|
37
36
|
onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
38
37
|
yield this.handleEdit(service, serviceCapability);
|
|
39
38
|
}),
|
|
40
|
-
isEnabled: (_b = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.isEnabled) !== null && _b !== void 0 ? _b :
|
|
39
|
+
isEnabled: (_b = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.isEnabled) !== null && _b !== void 0 ? _b : false,
|
|
41
40
|
cells: [
|
|
42
41
|
{
|
|
43
42
|
checkboxInput: {
|
|
44
43
|
name: 'isEnabled',
|
|
45
|
-
value: (_c = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.isEnabled) !== null && _c !== void 0 ? _c :
|
|
44
|
+
value: (_c = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.isEnabled) !== null && _c !== void 0 ? _c : false,
|
|
46
45
|
onChange: (value) => {
|
|
47
46
|
this.getListVc().getRowVc(service.id).setIsEnabled(value);
|
|
48
47
|
},
|
|
@@ -42,45 +42,6 @@ export default class RolesCardViewController extends AbstractCapabilityCardViewC
|
|
|
42
42
|
insertOrUpdateCapability(serviceId, values, serviceCapability) {
|
|
43
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
44
|
return yield this.onInsertOrUpdateCapability(Object.assign(Object.assign({}, values), { serviceId, id: serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.id }));
|
|
45
|
-
// else {
|
|
46
|
-
// try {
|
|
47
|
-
// if (serviceCapability) {
|
|
48
|
-
// const [{ capability }] = await client.emitAndFlattenResponses(
|
|
49
|
-
// 'appointments.update-role-capability::v2021_06_23',
|
|
50
|
-
// {
|
|
51
|
-
// target: {
|
|
52
|
-
// organizationId: this.organizationId ?? 'org id',
|
|
53
|
-
// capabilityId: serviceCapability.id,
|
|
54
|
-
// },
|
|
55
|
-
// payload: {
|
|
56
|
-
// ...values,
|
|
57
|
-
// },
|
|
58
|
-
// }
|
|
59
|
-
// )
|
|
60
|
-
// return capability
|
|
61
|
-
// } else {
|
|
62
|
-
// const [{ capability }] = await client.emitAndFlattenResponses(
|
|
63
|
-
// 'appointments.create-role-capability::v2021_06_23',
|
|
64
|
-
// {
|
|
65
|
-
// target: {
|
|
66
|
-
// organizationId: this.organizationId ?? 'org id',
|
|
67
|
-
// roleId: this.role.id,
|
|
68
|
-
// },
|
|
69
|
-
// payload: {
|
|
70
|
-
// serviceId,
|
|
71
|
-
// doesOffer: true,
|
|
72
|
-
// isEnabled: true,
|
|
73
|
-
// ...values,
|
|
74
|
-
// },
|
|
75
|
-
// }
|
|
76
|
-
// )
|
|
77
|
-
// return capability
|
|
78
|
-
// }
|
|
79
|
-
// } catch (err: any) {
|
|
80
|
-
// await this.alert({ message: err.message })
|
|
81
|
-
// }
|
|
82
|
-
// }
|
|
83
|
-
//return
|
|
84
45
|
});
|
|
85
46
|
}
|
|
86
47
|
getCapabilities() {
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import { MercuryClient } from '@sprucelabs/mercury-client';
|
|
2
|
+
declare type RemoteRoleCapabilityOptions = {
|
|
3
|
+
client: MercuryClient;
|
|
4
|
+
organizationId: string;
|
|
5
|
+
};
|
|
1
6
|
export default class RemoteRoleCapabilityStore {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
constructor(options:
|
|
7
|
+
protected client: MercuryClient;
|
|
8
|
+
protected organizationId: string;
|
|
9
|
+
protected queuedCapabilities: Record<string, any>;
|
|
10
|
+
constructor(options: RemoteRoleCapabilityOptions);
|
|
6
11
|
queue(value: any): Promise<any>;
|
|
7
12
|
persist(): Promise<import("@sprucelabs/schema").SchemaStaticValues<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.UpdateRoleCapabilitySchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.UpdateRoleCapabilitySchema>, import("@sprucelabs/schema").StaticSchemaAllValues<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.UpdateRoleCapabilitySchema, false>>[]>;
|
|
8
|
-
|
|
13
|
+
protected createCapability(roleId: any, serviceId: any, values: any): Promise<import("@sprucelabs/schema").SchemaStaticValues<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.CreateRoleCapabilitySchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.CreateRoleCapabilitySchema>, import("@sprucelabs/schema").StaticSchemaAllValues<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.CreateRoleCapabilitySchema, false>>>;
|
|
9
14
|
protected updateCapability(id: any, values: any): Promise<import("@sprucelabs/schema").SchemaStaticValues<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.UpdateRoleCapabilitySchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.UpdateRoleCapabilitySchema>, import("@sprucelabs/schema").StaticSchemaAllValues<import("@sprucelabs/mercury-types").SpruceSchemas.Appointments.v2021_06_23.UpdateRoleCapabilitySchema, false>>>;
|
|
10
15
|
}
|
|
16
|
+
export {};
|
|
@@ -17,7 +17,6 @@ class AbstractCapabilityCardViewController extends heartwood_view_controllers_1.
|
|
|
17
17
|
},
|
|
18
18
|
eventName: 'appointments.list-services::v2021_06_23',
|
|
19
19
|
responseKey: 'services',
|
|
20
|
-
footer: {},
|
|
21
20
|
rowTransformer: this.buildRow.bind(this),
|
|
22
21
|
}));
|
|
23
22
|
}
|
|
@@ -30,12 +29,12 @@ class AbstractCapabilityCardViewController extends heartwood_view_controllers_1.
|
|
|
30
29
|
onClick: async () => {
|
|
31
30
|
await this.handleEdit(service, serviceCapability);
|
|
32
31
|
},
|
|
33
|
-
isEnabled: (_b = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.isEnabled) !== null && _b !== void 0 ? _b :
|
|
32
|
+
isEnabled: (_b = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.isEnabled) !== null && _b !== void 0 ? _b : false,
|
|
34
33
|
cells: [
|
|
35
34
|
{
|
|
36
35
|
checkboxInput: {
|
|
37
36
|
name: 'isEnabled',
|
|
38
|
-
value: (_c = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.isEnabled) !== null && _c !== void 0 ? _c :
|
|
37
|
+
value: (_c = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.isEnabled) !== null && _c !== void 0 ? _c : false,
|
|
39
38
|
onChange: (value) => {
|
|
40
39
|
this.getListVc().getRowVc(service.id).setIsEnabled(value);
|
|
41
40
|
},
|
|
@@ -33,45 +33,6 @@ class RolesCardViewController extends AbstractCapabilityCardViewController_1.def
|
|
|
33
33
|
}
|
|
34
34
|
async insertOrUpdateCapability(serviceId, values, serviceCapability) {
|
|
35
35
|
return await this.onInsertOrUpdateCapability(Object.assign(Object.assign({}, values), { serviceId, id: serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.id }));
|
|
36
|
-
// else {
|
|
37
|
-
// try {
|
|
38
|
-
// if (serviceCapability) {
|
|
39
|
-
// const [{ capability }] = await client.emitAndFlattenResponses(
|
|
40
|
-
// 'appointments.update-role-capability::v2021_06_23',
|
|
41
|
-
// {
|
|
42
|
-
// target: {
|
|
43
|
-
// organizationId: this.organizationId ?? 'org id',
|
|
44
|
-
// capabilityId: serviceCapability.id,
|
|
45
|
-
// },
|
|
46
|
-
// payload: {
|
|
47
|
-
// ...values,
|
|
48
|
-
// },
|
|
49
|
-
// }
|
|
50
|
-
// )
|
|
51
|
-
// return capability
|
|
52
|
-
// } else {
|
|
53
|
-
// const [{ capability }] = await client.emitAndFlattenResponses(
|
|
54
|
-
// 'appointments.create-role-capability::v2021_06_23',
|
|
55
|
-
// {
|
|
56
|
-
// target: {
|
|
57
|
-
// organizationId: this.organizationId ?? 'org id',
|
|
58
|
-
// roleId: this.role.id,
|
|
59
|
-
// },
|
|
60
|
-
// payload: {
|
|
61
|
-
// serviceId,
|
|
62
|
-
// doesOffer: true,
|
|
63
|
-
// isEnabled: true,
|
|
64
|
-
// ...values,
|
|
65
|
-
// },
|
|
66
|
-
// }
|
|
67
|
-
// )
|
|
68
|
-
// return capability
|
|
69
|
-
// }
|
|
70
|
-
// } catch (err: any) {
|
|
71
|
-
// await this.alert({ message: err.message })
|
|
72
|
-
// }
|
|
73
|
-
// }
|
|
74
|
-
//return
|
|
75
36
|
}
|
|
76
37
|
getCapabilities() {
|
|
77
38
|
return this.capabilities;
|