@sprucelabs/spruce-appointment-utils 6.1.2 → 7.0.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.
- package/build/esm/index-module.d.ts +1 -0
- package/build/esm/index-module.js +1 -0
- package/build/esm/stores/RemoteRoleCapabilityStore.d.ts +16 -0
- package/build/esm/stores/RemoteRoleCapabilityStore.js +82 -0
- package/build/esm/viewControllers/AbstractCapabilityCardViewController.js +2 -3
- package/build/esm/viewControllers/RolesCard.vc.js +0 -39
- package/build/index-module.d.ts +1 -0
- package/build/index-module.js +3 -1
- package/build/stores/RemoteRoleCapabilityStore.d.ts +16 -0
- package/build/stores/RemoteRoleCapabilityStore.js +68 -0
- package/build/viewControllers/AbstractCapabilityCardViewController.js +2 -3
- package/build/viewControllers/RolesCard.vc.js +0 -39
- package/package.json +6 -1
|
@@ -5,4 +5,5 @@ export { default as EditOverrideDetailsCardViewController } from './viewControll
|
|
|
5
5
|
export { default as EditTimeBlockTitleCardViewController } from './viewControllers/EditTimeBlockTitleCard.vc';
|
|
6
6
|
export { default as RolesCardViewController } from './viewControllers/RolesCard.vc';
|
|
7
7
|
export { RolesCardViewControllerOptions } from './viewControllers/RolesCard.vc';
|
|
8
|
+
export { default as RemoteRoleCapabilityStore } from './stores/RemoteRoleCapabilityStore';
|
|
8
9
|
export * from './types-module';
|
|
@@ -4,4 +4,5 @@ export { default as DurationListViewController } from './viewControllers/Duratio
|
|
|
4
4
|
export { default as EditOverrideDetailsCardViewController } from './viewControllers/EditOverrideDetailsCard.vc.js';
|
|
5
5
|
export { default as EditTimeBlockTitleCardViewController } from './viewControllers/EditTimeBlockTitleCard.vc.js';
|
|
6
6
|
export { default as RolesCardViewController } from './viewControllers/RolesCard.vc.js';
|
|
7
|
+
export { default as RemoteRoleCapabilityStore } from './stores/RemoteRoleCapabilityStore.js';
|
|
7
8
|
export * from './types-module.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MercuryClient } from '@sprucelabs/mercury-client';
|
|
2
|
+
declare type RemoteRoleCapabilityOptions = {
|
|
3
|
+
client: MercuryClient;
|
|
4
|
+
organizationId: string;
|
|
5
|
+
};
|
|
6
|
+
export default class RemoteRoleCapabilityStore {
|
|
7
|
+
protected client: MercuryClient;
|
|
8
|
+
protected organizationId: string;
|
|
9
|
+
protected queuedCapabilities: Record<string, any>;
|
|
10
|
+
constructor(options: RemoteRoleCapabilityOptions);
|
|
11
|
+
queue(value: any): Promise<any>;
|
|
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>>[]>;
|
|
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>>>;
|
|
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>>>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
import { assertOptions } from '@sprucelabs/schema';
|
|
22
|
+
export default class RemoteRoleCapabilityStore {
|
|
23
|
+
constructor(options) {
|
|
24
|
+
this.queuedCapabilities = [];
|
|
25
|
+
assertOptions(options, ['client', 'organizationId']);
|
|
26
|
+
this.client = options.client;
|
|
27
|
+
this.organizationId = options.organizationId;
|
|
28
|
+
}
|
|
29
|
+
queue(value) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
assertOptions(value, ['serviceId', 'roleId']);
|
|
32
|
+
const id = `${this.organizationId}-${value.serviceId}-${value.roleId}`;
|
|
33
|
+
this.queuedCapabilities[id] = Object.assign(Object.assign({}, this.queuedCapabilities[id]), value);
|
|
34
|
+
if (!value.id) {
|
|
35
|
+
return Object.assign(Object.assign({}, value), { id });
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
persist() {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
let response = [];
|
|
43
|
+
for (let key in this.queuedCapabilities) {
|
|
44
|
+
const _a = this.queuedCapabilities[key], { id, roleId, serviceId } = _a, values = __rest(_a, ["id", "roleId", "serviceId"]);
|
|
45
|
+
if (id) {
|
|
46
|
+
const capability = yield this.updateCapability(id, values);
|
|
47
|
+
response.push(capability);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const capability = yield this.createCapability(roleId, serviceId, values);
|
|
51
|
+
response.push(capability);
|
|
52
|
+
}
|
|
53
|
+
delete this.queuedCapabilities[key];
|
|
54
|
+
}
|
|
55
|
+
return response;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
createCapability(roleId, serviceId, values) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const [{ capability }] = yield this.client.emitAndFlattenResponses('appointments.create-role-capability::v2021_06_23', {
|
|
61
|
+
target: {
|
|
62
|
+
organizationId: this.organizationId,
|
|
63
|
+
roleId,
|
|
64
|
+
},
|
|
65
|
+
payload: Object.assign({ serviceId, isEnabled: true, doesOffer: true }, values),
|
|
66
|
+
});
|
|
67
|
+
return capability;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
updateCapability(id, values) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const [{ capability }] = yield this.client.emitAndFlattenResponses('appointments.update-role-capability::v2021_06_23', {
|
|
73
|
+
target: {
|
|
74
|
+
organizationId: this.organizationId,
|
|
75
|
+
capabilityId: id,
|
|
76
|
+
},
|
|
77
|
+
payload: Object.assign({}, values),
|
|
78
|
+
});
|
|
79
|
+
return capability;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -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() {
|
package/build/index-module.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export { default as EditOverrideDetailsCardViewController } from './viewControll
|
|
|
5
5
|
export { default as EditTimeBlockTitleCardViewController } from './viewControllers/EditTimeBlockTitleCard.vc';
|
|
6
6
|
export { default as RolesCardViewController } from './viewControllers/RolesCard.vc';
|
|
7
7
|
export { RolesCardViewControllerOptions } from './viewControllers/RolesCard.vc';
|
|
8
|
+
export { default as RemoteRoleCapabilityStore } from './stores/RemoteRoleCapabilityStore';
|
|
8
9
|
export * from './types-module';
|
package/build/index-module.js
CHANGED
|
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.RolesCardViewController = exports.EditTimeBlockTitleCardViewController = exports.EditOverrideDetailsCardViewController = exports.DurationListViewController = exports.DurationCardViewController = exports.AbstractCapabilityCardViewController = void 0;
|
|
16
|
+
exports.RemoteRoleCapabilityStore = exports.RolesCardViewController = exports.EditTimeBlockTitleCardViewController = exports.EditOverrideDetailsCardViewController = exports.DurationListViewController = exports.DurationCardViewController = exports.AbstractCapabilityCardViewController = void 0;
|
|
17
17
|
var AbstractCapabilityCardViewController_1 = require("./viewControllers/AbstractCapabilityCardViewController");
|
|
18
18
|
Object.defineProperty(exports, "AbstractCapabilityCardViewController", { enumerable: true, get: function () { return __importDefault(AbstractCapabilityCardViewController_1).default; } });
|
|
19
19
|
var DurationCard_vc_1 = require("./viewControllers/DurationCard.vc");
|
|
@@ -26,4 +26,6 @@ var EditTimeBlockTitleCard_vc_1 = require("./viewControllers/EditTimeBlockTitleC
|
|
|
26
26
|
Object.defineProperty(exports, "EditTimeBlockTitleCardViewController", { enumerable: true, get: function () { return __importDefault(EditTimeBlockTitleCard_vc_1).default; } });
|
|
27
27
|
var RolesCard_vc_1 = require("./viewControllers/RolesCard.vc");
|
|
28
28
|
Object.defineProperty(exports, "RolesCardViewController", { enumerable: true, get: function () { return __importDefault(RolesCard_vc_1).default; } });
|
|
29
|
+
var RemoteRoleCapabilityStore_1 = require("./stores/RemoteRoleCapabilityStore");
|
|
30
|
+
Object.defineProperty(exports, "RemoteRoleCapabilityStore", { enumerable: true, get: function () { return __importDefault(RemoteRoleCapabilityStore_1).default; } });
|
|
29
31
|
__exportStar(require("./types-module"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MercuryClient } from '@sprucelabs/mercury-client';
|
|
2
|
+
declare type RemoteRoleCapabilityOptions = {
|
|
3
|
+
client: MercuryClient;
|
|
4
|
+
organizationId: string;
|
|
5
|
+
};
|
|
6
|
+
export default class RemoteRoleCapabilityStore {
|
|
7
|
+
protected client: MercuryClient;
|
|
8
|
+
protected organizationId: string;
|
|
9
|
+
protected queuedCapabilities: Record<string, any>;
|
|
10
|
+
constructor(options: RemoteRoleCapabilityOptions);
|
|
11
|
+
queue(value: any): Promise<any>;
|
|
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>>[]>;
|
|
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>>>;
|
|
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>>>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const schema_1 = require("@sprucelabs/schema");
|
|
15
|
+
class RemoteRoleCapabilityStore {
|
|
16
|
+
constructor(options) {
|
|
17
|
+
this.queuedCapabilities = [];
|
|
18
|
+
(0, schema_1.assertOptions)(options, ['client', 'organizationId']);
|
|
19
|
+
this.client = options.client;
|
|
20
|
+
this.organizationId = options.organizationId;
|
|
21
|
+
}
|
|
22
|
+
async queue(value) {
|
|
23
|
+
(0, schema_1.assertOptions)(value, ['serviceId', 'roleId']);
|
|
24
|
+
const id = `${this.organizationId}-${value.serviceId}-${value.roleId}`;
|
|
25
|
+
this.queuedCapabilities[id] = Object.assign(Object.assign({}, this.queuedCapabilities[id]), value);
|
|
26
|
+
if (!value.id) {
|
|
27
|
+
return Object.assign(Object.assign({}, value), { id });
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
async persist() {
|
|
32
|
+
let response = [];
|
|
33
|
+
for (let key in this.queuedCapabilities) {
|
|
34
|
+
const _a = this.queuedCapabilities[key], { id, roleId, serviceId } = _a, values = __rest(_a, ["id", "roleId", "serviceId"]);
|
|
35
|
+
if (id) {
|
|
36
|
+
const capability = await this.updateCapability(id, values);
|
|
37
|
+
response.push(capability);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const capability = await this.createCapability(roleId, serviceId, values);
|
|
41
|
+
response.push(capability);
|
|
42
|
+
}
|
|
43
|
+
delete this.queuedCapabilities[key];
|
|
44
|
+
}
|
|
45
|
+
return response;
|
|
46
|
+
}
|
|
47
|
+
async createCapability(roleId, serviceId, values) {
|
|
48
|
+
const [{ capability }] = await this.client.emitAndFlattenResponses('appointments.create-role-capability::v2021_06_23', {
|
|
49
|
+
target: {
|
|
50
|
+
organizationId: this.organizationId,
|
|
51
|
+
roleId,
|
|
52
|
+
},
|
|
53
|
+
payload: Object.assign({ serviceId, isEnabled: true, doesOffer: true }, values),
|
|
54
|
+
});
|
|
55
|
+
return capability;
|
|
56
|
+
}
|
|
57
|
+
async updateCapability(id, values) {
|
|
58
|
+
const [{ capability }] = await this.client.emitAndFlattenResponses('appointments.update-role-capability::v2021_06_23', {
|
|
59
|
+
target: {
|
|
60
|
+
organizationId: this.organizationId,
|
|
61
|
+
capabilityId: id,
|
|
62
|
+
},
|
|
63
|
+
payload: Object.assign({}, values),
|
|
64
|
+
});
|
|
65
|
+
return capability;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.default = RemoteRoleCapabilityStore;
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sprucelabs/spruce-appointment-utils",
|
|
3
3
|
"description": "Utils for working with appointments and Sprucebot.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "7.0.0",
|
|
5
5
|
"skill": {
|
|
6
6
|
"namespace": "appointments"
|
|
7
7
|
},
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"build/index-module.d.ts",
|
|
19
19
|
"build/types-module.js",
|
|
20
20
|
"build/types-module.d.ts",
|
|
21
|
+
"build/stores/RemoteRoleCapabilityStore.d.ts",
|
|
22
|
+
"build/stores/RemoteRoleCapabilityStore.js",
|
|
21
23
|
"build/viewControllers/AbstractCapabilityCardViewController.js",
|
|
22
24
|
"build/viewControllers/AbstractCapabilityCardViewController.d.ts",
|
|
23
25
|
"build/viewControllers/DurationCard.vc.js",
|
|
@@ -34,6 +36,8 @@
|
|
|
34
36
|
"build/esm/index-module.d.ts",
|
|
35
37
|
"build/esm/types-module.js",
|
|
36
38
|
"build/esm/types-module.d.ts",
|
|
39
|
+
"build/esm/stores/RemoteRoleCapabilityStore.d.ts",
|
|
40
|
+
"build/esm/stores/RemoteRoleCapabilityStore.js",
|
|
37
41
|
"build/esm/viewControllers/AbstractCapabilityCardViewController.js",
|
|
38
42
|
"build/esm/viewControllers/AbstractCapabilityCardViewController.d.ts",
|
|
39
43
|
"build/esm/viewControllers/DurationCard.vc.js",
|
|
@@ -54,6 +58,7 @@
|
|
|
54
58
|
"dependencies": {
|
|
55
59
|
"@sprucelabs/calendar-utils": "latest",
|
|
56
60
|
"@sprucelabs/heartwood-view-controllers": "latest",
|
|
61
|
+
"@sprucelabs/mercury-client": "latest",
|
|
57
62
|
"@sprucelabs/schema": "latest",
|
|
58
63
|
"@sprucelabs/spruce-event-utils": "latest"
|
|
59
64
|
},
|