@aikaara/chat-sdk 0.6.1 → 0.7.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/dist/AikaaraLinkButton-C1S7MfVT.mjs +98 -0
- package/dist/AikaaraLinkButton-VDNx7RfC.cjs +25 -0
- package/dist/MountTenant-DKwdw13-.cjs +965 -0
- package/dist/{MountTenant-CLlH4Zh6.mjs → MountTenant-DSvgeBzE.mjs} +4476 -3848
- package/dist/cdn/aikaara-chat.iife.js +989 -0
- package/dist/headless.cjs +1 -1
- package/dist/headless.d.ts +110 -0
- package/dist/headless.mjs +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +120 -0
- package/dist/index.mjs +2 -2
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +151 -0
- package/dist/ui.mjs +14 -12
- package/package.json +1 -1
- package/dist/MountTenant-HkluWr4X.cjs +0 -794
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
class u extends HTMLElement {
|
|
2
|
+
shadow;
|
|
3
|
+
payload = null;
|
|
4
|
+
constructor() {
|
|
5
|
+
super(), this.shadow = this.attachShadow({ mode: "open" });
|
|
6
|
+
}
|
|
7
|
+
connectedCallback() {
|
|
8
|
+
this.render();
|
|
9
|
+
}
|
|
10
|
+
setPayload(e) {
|
|
11
|
+
this.payload = e, this.render();
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
const e = this.payload;
|
|
15
|
+
this.shadow.innerHTML = `
|
|
16
|
+
<style>
|
|
17
|
+
:host { display: block; margin-top: 8px; }
|
|
18
|
+
button {
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: 6px;
|
|
22
|
+
padding: 10px 16px;
|
|
23
|
+
background: var(--aikaara-primary, #0f2e5c);
|
|
24
|
+
color: var(--aikaara-primary-contrast, #fff);
|
|
25
|
+
border: none;
|
|
26
|
+
border-radius: var(--aikaara-button-radius, 8px);
|
|
27
|
+
font-family: var(--aikaara-font, system-ui);
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
font-weight: 600;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
button:hover { background: var(--aikaara-primary-hover, #0a2347); }
|
|
33
|
+
button[disabled] { opacity: 0.5; cursor: not-allowed; }
|
|
34
|
+
</style>
|
|
35
|
+
<button type="button" ${e ? "" : "disabled"}>
|
|
36
|
+
${c(e?.name ?? "Open")}
|
|
37
|
+
<span aria-hidden="true">↗</span>
|
|
38
|
+
</button>
|
|
39
|
+
`, this.shadow.querySelector("button")?.addEventListener("click", () => this.handleClick());
|
|
40
|
+
}
|
|
41
|
+
handleClick() {
|
|
42
|
+
if (!this.payload) return;
|
|
43
|
+
const { url: e, name: a, openLinkInNewTab: o, orderId: r, extra: i, messageId: n } = this.payload, s = o ? "tab" : "modal", d = new CustomEvent("aikaara-link-action", {
|
|
44
|
+
detail: { url: e, name: a, orderId: r, openedIn: s, extra: i, messageId: n },
|
|
45
|
+
bubbles: !0,
|
|
46
|
+
composed: !0,
|
|
47
|
+
cancelable: !0
|
|
48
|
+
});
|
|
49
|
+
if (this.dispatchEvent(d))
|
|
50
|
+
if (o)
|
|
51
|
+
window.open(e, "_blank", "noopener,noreferrer");
|
|
52
|
+
else {
|
|
53
|
+
const l = p();
|
|
54
|
+
requestAnimationFrame(() => l?.show?.(e, a));
|
|
55
|
+
}
|
|
56
|
+
this.dispatchEvent(
|
|
57
|
+
new CustomEvent("template-action", {
|
|
58
|
+
detail: {
|
|
59
|
+
text: a,
|
|
60
|
+
attributes: {
|
|
61
|
+
action: {
|
|
62
|
+
type: "link",
|
|
63
|
+
url: e,
|
|
64
|
+
orderId: r,
|
|
65
|
+
openedIn: s,
|
|
66
|
+
...i ?? {}
|
|
67
|
+
},
|
|
68
|
+
...n ? { message_id: n } : {}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
bubbles: !0,
|
|
72
|
+
composed: !0
|
|
73
|
+
})
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function c(t) {
|
|
78
|
+
return t.replace(
|
|
79
|
+
/[&<>"']/g,
|
|
80
|
+
(e) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[e]
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
function p() {
|
|
84
|
+
if (typeof document > "u") return null;
|
|
85
|
+
let t = document.querySelector("aikaara-link-modal");
|
|
86
|
+
if (!t) {
|
|
87
|
+
const e = document.createElement("aikaara-link-modal");
|
|
88
|
+
document.body.appendChild(e), t = e;
|
|
89
|
+
}
|
|
90
|
+
return t;
|
|
91
|
+
}
|
|
92
|
+
function b() {
|
|
93
|
+
typeof customElements > "u" || customElements.get("aikaara-link-button") || customElements.define("aikaara-link-button", u);
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
u as AikaaraLinkButton,
|
|
97
|
+
b as registerAikaaraLinkButton
|
|
98
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class d extends HTMLElement{shadow;payload=null;constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.render()}setPayload(e){this.payload=e,this.render()}render(){const e=this.payload;this.shadow.innerHTML=`
|
|
2
|
+
<style>
|
|
3
|
+
:host { display: block; margin-top: 8px; }
|
|
4
|
+
button {
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: 6px;
|
|
8
|
+
padding: 10px 16px;
|
|
9
|
+
background: var(--aikaara-primary, #0f2e5c);
|
|
10
|
+
color: var(--aikaara-primary-contrast, #fff);
|
|
11
|
+
border: none;
|
|
12
|
+
border-radius: var(--aikaara-button-radius, 8px);
|
|
13
|
+
font-family: var(--aikaara-font, system-ui);
|
|
14
|
+
font-size: 14px;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
}
|
|
18
|
+
button:hover { background: var(--aikaara-primary-hover, #0a2347); }
|
|
19
|
+
button[disabled] { opacity: 0.5; cursor: not-allowed; }
|
|
20
|
+
</style>
|
|
21
|
+
<button type="button" ${e?"":"disabled"}>
|
|
22
|
+
${c(e?.name??"Open")}
|
|
23
|
+
<span aria-hidden="true">↗</span>
|
|
24
|
+
</button>
|
|
25
|
+
`,this.shadow.querySelector("button")?.addEventListener("click",()=>this.handleClick())}handleClick(){if(!this.payload)return;const{url:e,name:a,openLinkInNewTab:o,orderId:r,extra:i,messageId:n}=this.payload,s=o?"tab":"modal",l=new CustomEvent("aikaara-link-action",{detail:{url:e,name:a,orderId:r,openedIn:s,extra:i,messageId:n},bubbles:!0,composed:!0,cancelable:!0});if(this.dispatchEvent(l))if(o)window.open(e,"_blank","noopener,noreferrer");else{const u=p();requestAnimationFrame(()=>u?.show?.(e,a))}this.dispatchEvent(new CustomEvent("template-action",{detail:{text:a,attributes:{action:{type:"link",url:e,orderId:r,openedIn:s,...i??{}},...n?{message_id:n}:{}}},bubbles:!0,composed:!0}))}}function c(t){return t.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function p(){if(typeof document>"u")return null;let t=document.querySelector("aikaara-link-modal");if(!t){const e=document.createElement("aikaara-link-modal");document.body.appendChild(e),t=e}return t}function m(){typeof customElements>"u"||customElements.get("aikaara-link-button")||customElements.define("aikaara-link-button",d)}exports.AikaaraLinkButton=d;exports.registerAikaaraLinkButton=m;
|