@nectary/labs 2.12.25 → 2.13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/labs",
3
- "version": "2.12.25",
3
+ "version": "2.13.0",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
@@ -19,7 +19,7 @@
19
19
  "dev": "vite build --watch"
20
20
  },
21
21
  "dependencies": {
22
- "@nectary/components": "5.47.3"
22
+ "@nectary/components": "5.48.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "22.12.0",
@@ -25,6 +25,8 @@ export declare class PhonePreviewRcsChannel extends NectaryElement {
25
25
  set bannerColor(value: string);
26
26
  get logo(): string;
27
27
  set logo(value: string);
28
+ get actionsDisabled(): boolean;
29
+ set actionsDisabled(value: boolean);
28
30
  }
29
31
  type RcsChannelProps = {
30
32
  name?: string;
@@ -33,6 +35,7 @@ type RcsChannelProps = {
33
35
  banner?: string;
34
36
  bannerColor?: string;
35
37
  logo?: string;
38
+ actionsDisabled?: boolean;
36
39
  };
37
40
  type RcsChannelElementProps = Partial<{
38
41
  [K in keyof RcsChannelProps]: RcsChannelProps[K] | string;
@@ -54,7 +54,7 @@ class PhonePreviewRcsChannel extends NectaryElement {
54
54
  this.#controller = null;
55
55
  }
56
56
  static get observedAttributes() {
57
- return ["name", "description", "color", "banner", "bannercolor", "logo"];
57
+ return ["name", "description", "color", "banner", "bannercolor", "logo", "actionsdisabled"];
58
58
  }
59
59
  attributeChangedCallback(name, oldVal, newVal) {
60
60
  if (oldVal === newVal) {
@@ -67,6 +67,7 @@ class PhonePreviewRcsChannel extends NectaryElement {
67
67
  case "banner":
68
68
  case "bannercolor":
69
69
  case "logo":
70
+ case "actionsdisabled":
70
71
  this.#updateUI();
71
72
  break;
72
73
  }
@@ -107,6 +108,16 @@ class PhonePreviewRcsChannel extends NectaryElement {
107
108
  set logo(value) {
108
109
  this.setAttribute("logo", value);
109
110
  }
111
+ get actionsDisabled() {
112
+ return this.hasAttribute("actionsdisabled");
113
+ }
114
+ set actionsDisabled(value) {
115
+ if (value) {
116
+ this.setAttribute("actionsdisabled", "");
117
+ } else {
118
+ this.removeAttribute("actionsdisabled");
119
+ }
120
+ }
110
121
  #updateUI() {
111
122
  if (!this.isDomConnected) {
112
123
  return;
@@ -143,6 +154,7 @@ class PhonePreviewRcsChannel extends NectaryElement {
143
154
  this.#actions.setAttribute("phone", firstPhone);
144
155
  this.#actions.setAttribute("website", firstWebsite);
145
156
  this.#actions.setAttribute("email", firstEmail);
157
+ this.#actions.toggleAttribute("disabled", this.actionsDisabled);
146
158
  }
147
159
  #updateTabContent() {
148
160
  this.#updateTabVisibility();
@@ -13,11 +13,14 @@ export declare class PhonePreviewRcsChannelActions extends NectaryElement {
13
13
  set website(value: string);
14
14
  get email(): string;
15
15
  set email(value: string);
16
+ get disabled(): boolean;
17
+ set disabled(value: boolean);
16
18
  }
17
19
  type Props = {
18
20
  phone?: string;
19
21
  website?: string;
20
22
  email?: string;
23
+ disabled?: boolean;
21
24
  };
22
25
  type ElementProps = Partial<{
23
26
  [K in keyof Props]: Props[K] | string;
@@ -20,7 +20,7 @@ class PhonePreviewRcsChannelActions extends NectaryElement {
20
20
  this.#updateUI();
21
21
  }
22
22
  static get observedAttributes() {
23
- return ["phone", "website", "email"];
23
+ return ["phone", "website", "email", "disabled"];
24
24
  }
25
25
  attributeChangedCallback(name, oldVal, newVal) {
26
26
  if (oldVal === newVal) {
@@ -58,6 +58,16 @@ class PhonePreviewRcsChannelActions extends NectaryElement {
58
58
  this.removeAttribute("email");
59
59
  }
60
60
  }
61
+ get disabled() {
62
+ return this.hasAttribute("disabled");
63
+ }
64
+ set disabled(value) {
65
+ if (value) {
66
+ this.setAttribute("disabled", "");
67
+ } else {
68
+ this.removeAttribute("disabled");
69
+ }
70
+ }
61
71
  #updateUI() {
62
72
  if (!this.isDomConnected) {
63
73
  return;
@@ -65,21 +75,22 @@ class PhonePreviewRcsChannelActions extends NectaryElement {
65
75
  const phoneNumber = this.phone;
66
76
  const websiteUrl = this.website;
67
77
  const emailAddress = this.email;
68
- if (phoneNumber !== "") {
78
+ const disabled = this.disabled;
79
+ if (phoneNumber !== "" && !disabled) {
69
80
  this.#callAction.href = `tel:${phoneNumber}`;
70
81
  this.#callAction.removeAttribute("inert");
71
82
  } else {
72
83
  this.#callAction.href = "#";
73
84
  this.#callAction.setAttribute("inert", "");
74
85
  }
75
- if (websiteUrl !== "") {
86
+ if (websiteUrl !== "" && !disabled) {
76
87
  this.#websiteAction.href = websiteUrl;
77
88
  this.#websiteAction.removeAttribute("inert");
78
89
  } else {
79
90
  this.#websiteAction.href = "#";
80
91
  this.#websiteAction.setAttribute("inert", "");
81
92
  }
82
- if (emailAddress !== "") {
93
+ if (emailAddress !== "" && !disabled) {
83
94
  this.#emailAction.href = `mailto:${emailAddress}`;
84
95
  this.#emailAction.removeAttribute("inert");
85
96
  } else {