@sprucelabs/spruce-appointment-utils 9.4.60 → 9.4.62

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.
@@ -16,6 +16,7 @@ export default abstract class AbstractCapabilityCardViewController extends Abstr
16
16
  protected abstract loadCapabilities(): Promise<any>;
17
17
  ActiveRecordCard(row: any): ActiveRecordCardViewController;
18
18
  protected renderRow(service: Service): any;
19
+ private renderPrice;
19
20
  private getCapabilityForService;
20
21
  private handleClickCheckbox;
21
22
  private handleClickRow;
@@ -28,7 +28,7 @@ export default class AbstractCapabilityCardViewController extends AbstractViewCo
28
28
  }));
29
29
  }
30
30
  renderRow(service) {
31
- var _a, _b, _c, _d, _e;
31
+ var _a, _b, _c;
32
32
  const serviceCapability = this.getCapabilityForService(service.id);
33
33
  const rowId = service.id;
34
34
  return {
@@ -52,13 +52,13 @@ export default class AbstractCapabilityCardViewController extends AbstractViewCo
52
52
  content: service.name,
53
53
  },
54
54
  subText: {
55
- content: `$${(_c = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.price) !== null && _c !== void 0 ? _c : service.price} - ${this.calculateDuration((_d = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.timeBlocks) !== null && _d !== void 0 ? _d : service.timeBlocks)}`,
55
+ content: this.renderPrice(service, serviceCapability),
56
56
  },
57
57
  },
58
58
  {
59
59
  toggleInput: {
60
60
  name: 'doesOffer',
61
- value: (_e = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.doesOffer) !== null && _e !== void 0 ? _e : false,
61
+ value: (_c = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.doesOffer) !== null && _c !== void 0 ? _c : false,
62
62
  onChange: (value) => __awaiter(this, void 0, void 0, function* () {
63
63
  yield this.handleToggleDoesOffer(service, value);
64
64
  }),
@@ -67,6 +67,14 @@ export default class AbstractCapabilityCardViewController extends AbstractViewCo
67
67
  ].filter((c) => !!c),
68
68
  };
69
69
  }
70
+ renderPrice(service, capability) {
71
+ var _a, _b;
72
+ let price = '';
73
+ if (service.price || !(capability === null || capability === void 0 ? void 0 : capability.price)) {
74
+ price = `$${(_a = capability === null || capability === void 0 ? void 0 : capability.price) !== null && _a !== void 0 ? _a : service.price} - `;
75
+ }
76
+ return `${price}${this.calculateDuration((_b = capability === null || capability === void 0 ? void 0 : capability.timeBlocks) !== null && _b !== void 0 ? _b : service.timeBlocks)}`;
77
+ }
70
78
  getCapabilityForService(id) {
71
79
  var _a;
72
80
  return (_a = this.capabilities) === null || _a === void 0 ? void 0 : _a.find((r) => r.serviceId === id);
@@ -16,6 +16,7 @@ export default abstract class AbstractCapabilityCardViewController extends Abstr
16
16
  protected abstract loadCapabilities(): Promise<any>;
17
17
  ActiveRecordCard(row: any): ActiveRecordCardViewController;
18
18
  protected renderRow(service: Service): any;
19
+ private renderPrice;
19
20
  private getCapabilityForService;
20
21
  private handleClickCheckbox;
21
22
  private handleClickRow;
@@ -21,7 +21,7 @@ class AbstractCapabilityCardViewController extends heartwood_view_controllers_1.
21
21
  }));
22
22
  }
23
23
  renderRow(service) {
24
- var _a, _b, _c, _d, _e;
24
+ var _a, _b, _c;
25
25
  const serviceCapability = this.getCapabilityForService(service.id);
26
26
  const rowId = service.id;
27
27
  return {
@@ -45,13 +45,13 @@ class AbstractCapabilityCardViewController extends heartwood_view_controllers_1.
45
45
  content: service.name,
46
46
  },
47
47
  subText: {
48
- content: `$${(_c = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.price) !== null && _c !== void 0 ? _c : service.price} - ${this.calculateDuration((_d = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.timeBlocks) !== null && _d !== void 0 ? _d : service.timeBlocks)}`,
48
+ content: this.renderPrice(service, serviceCapability),
49
49
  },
50
50
  },
51
51
  {
52
52
  toggleInput: {
53
53
  name: 'doesOffer',
54
- value: (_e = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.doesOffer) !== null && _e !== void 0 ? _e : false,
54
+ value: (_c = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.doesOffer) !== null && _c !== void 0 ? _c : false,
55
55
  onChange: async (value) => {
56
56
  await this.handleToggleDoesOffer(service, value);
57
57
  },
@@ -60,6 +60,14 @@ class AbstractCapabilityCardViewController extends heartwood_view_controllers_1.
60
60
  ].filter((c) => !!c),
61
61
  };
62
62
  }
63
+ renderPrice(service, capability) {
64
+ var _a, _b;
65
+ let price = '';
66
+ if (service.price || !(capability === null || capability === void 0 ? void 0 : capability.price)) {
67
+ price = `$${(_a = capability === null || capability === void 0 ? void 0 : capability.price) !== null && _a !== void 0 ? _a : service.price} - `;
68
+ }
69
+ return `${price}${this.calculateDuration((_b = capability === null || capability === void 0 ? void 0 : capability.timeBlocks) !== null && _b !== void 0 ? _b : service.timeBlocks)}`;
70
+ }
63
71
  getCapabilityForService(id) {
64
72
  var _a;
65
73
  return (_a = this.capabilities) === null || _a === void 0 ? void 0 : _a.find((r) => r.serviceId === id);
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": "9.4.60",
4
+ "version": "9.4.62",
5
5
  "skill": {
6
6
  "namespace": "appointments"
7
7
  },