Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
6923838f
Unverified
Commit
6923838f
authored
1 year ago
by
Aleksander Nicacio da Silva
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: livechat url triggers only fire when using the widget (#29673)
parent
baaa38f7
Branches
gsoc-livechat-2FA-feature-brach
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/livechat/src/lib/triggers.js
+9
-6
9 additions, 6 deletions
packages/livechat/src/lib/triggers.js
with
9 additions
and
6 deletions
packages/livechat/src/lib/triggers.js
+
9
−
6
View file @
6923838f
...
...
@@ -57,6 +57,8 @@ const getAgent = (triggerAction) => {
return
agentPromise
;
};
const
isInIframe
=
()
=>
window
.
self
!==
window
.
top
;
class
Triggers
{
constructor
()
{
if
(
!
Triggers
.
instance
)
{
...
...
@@ -172,9 +174,8 @@ class Triggers {
trigger
.
conditions
.
forEach
((
condition
)
=>
{
switch
(
condition
.
name
)
{
case
'
page-url
'
:
const
{
parentUrl
}
=
store
.
state
;
const
hrefRegExp
=
new
RegExp
(
condition
.
value
,
'
g
'
);
if
(
parentUrl
&&
hrefRegExp
.
test
(
parentUrl
))
{
if
(
this
.
parentUrl
&&
hrefRegExp
.
test
(
this
.
parentUrl
))
{
this
.
fire
(
trigger
);
}
break
;
...
...
@@ -197,9 +198,7 @@ class Triggers {
}
processPageUrlTriggers
()
{
const
{
parentUrl
}
=
store
.
state
;
if
(
!
parentUrl
)
return
;
if
(
!
this
.
parentUrl
)
return
;
this
.
_triggers
.
forEach
((
trigger
)
=>
{
if
(
trigger
.
skip
)
return
;
...
...
@@ -208,7 +207,7 @@ class Triggers {
if
(
condition
.
name
!==
'
page-url
'
)
return
;
const
hrefRegExp
=
new
RegExp
(
condition
.
value
,
'
g
'
);
if
(
hrefRegExp
.
test
(
parentUrl
))
{
if
(
hrefRegExp
.
test
(
this
.
parentUrl
))
{
this
.
fire
(
trigger
);
}
});
...
...
@@ -222,6 +221,10 @@ class Triggers {
set
enabled
(
value
)
{
this
.
_enabled
=
value
;
}
get
parentUrl
()
{
return
isInIframe
()
?
store
.
state
.
parentUrl
:
window
.
location
.
href
;
}
}
const
instance
=
new
Triggers
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment