Skip to content
This repository was archived by the owner on Apr 23, 2026. It is now read-only.

Commit 19bbf48

Browse files
committed
add tier id
1 parent 7761f3e commit 19bbf48

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

reflex_ui/blocks/plain.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class PlainChat(rx.Component):
3131
# Optional built-in email verification
3232
require_authentication: rx.Var[bool] = rx.Var.create(False)
3333

34+
# Optional tier ID for thread details
35+
tier_id: rx.Var[str] = rx.Var.create("")
36+
3437
def add_imports(self) -> dict:
3538
"""Add React imports."""
3639
return {"react": ["useEffect"]}
@@ -73,11 +76,15 @@ def add_hooks(self) -> list[str | rx.Var]:
7376
customerDetails: customerDetails,
7477
}};
7578
76-
// Add threadDetails if externalId is provided
77-
if ({self.external_id!s}) {{
78-
initOptions.threadDetails = {{
79-
externalId: {self.external_id!s},
80-
}};
79+
// Add threadDetails if externalId or tierId is provided
80+
if ({self.external_id!s} || {self.tier_id!s}) {{
81+
initOptions.threadDetails = {{}};
82+
if ({self.external_id!s}) {{
83+
initOptions.threadDetails.externalId = {self.external_id!s};
84+
}}
85+
if ({self.tier_id!s}) {{
86+
initOptions.threadDetails.tierIdentifier = {{ tierId: {self.tier_id!s} }};
87+
}}
8188
}}
8289
8390
// Add requireAuthentication if true
@@ -102,7 +109,7 @@ def add_hooks(self) -> list[str | rx.Var]:
102109
script.src = 'https://chat.cdn-plain.com/index.js';
103110
script.onload = () => Plain.init(initOptions);
104111
document.head.appendChild(script);
105-
}}, [{self.full_name!s}, {self.short_name!s}, {self.chat_avatar_url!s}, {self.external_id!s}, {self.email!s}, {self.email_hash!s}])"""
112+
}}, [{self.full_name!s}, {self.short_name!s}, {self.chat_avatar_url!s}, {self.external_id!s}, {self.tier_id!s}, {self.email!s}, {self.email_hash!s}])"""
106113
)
107114
]
108115

0 commit comments

Comments
 (0)