Skip to content

Commit 426a2c7

Browse files
authored
Merge pull request #7412 from Countly/survey-path
[star-rating] Prepend countly path to all assets
2 parents 0904e49 + cc32485 commit 426a2c7

File tree

5 files changed

+97
-81
lines changed

5 files changed

+97
-81
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## Version 25.03.X
2+
Fixes:
3+
- [star-rating] Fixed widget asset path with subdirectory
4+
5+
Enterprise Fixes:
6+
- [surveys] Fixed widget asset path with subdirectory
7+
18
## Version 25.03.40
29
Fixes:
310
- [hooks] Implement domain/ip address validation for hooks with http effect

plugins/star-rating/frontend/app.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ var path = require('path');
1111
* @param {*} res - Express response object
1212
*/
1313
function renderPopup(req, res) {
14+
let countlyPath = countlyConfig.path || '';
15+
16+
if (countlyPath.length > 0 && !countlyPath.startsWith('/')) {
17+
countlyPath = `/${countlyPath}`;
18+
}
19+
1420
res.removeHeader('X-Frame-Options');
15-
res.render('../../../plugins/star-rating/frontend/public/templates/feedback-popup', {});
21+
res.render('../../../plugins/star-rating/frontend/public/templates/feedback-popup', { countlyPath });
1622
}
1723

1824
app.get(countlyConfig.path + '/feedback/rating', renderPopup);
@@ -71,4 +77,4 @@ var path = require('path');
7177
};
7278
}(exported));
7379

74-
module.exports = exported;
80+
module.exports = exported;

plugins/star-rating/frontend/public/stylesheets/ratings-iframe.scss

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -95,70 +95,6 @@
9595
background-repeat: no-repeat;
9696
}
9797

98-
.rating-emotion-emojis {
99-
background-image: url('/star-rating/images/star-rating/emoji.svg');
100-
}
101-
102-
.rating-emotion-emojis1 {
103-
background-image: url('/star-rating/images/star-rating/emoji_1.svg');
104-
}
105-
106-
.rating-emotion-emojis2 {
107-
background-image: url('/star-rating/images/star-rating/emoji_2.svg');
108-
}
109-
110-
.rating-emotion-emojis3 {
111-
background-image: url('/star-rating/images/star-rating/emoji_3.svg');
112-
}
113-
114-
.rating-emotion-emojis4 {
115-
background-image: url('/star-rating/images/star-rating/emoji_4.svg');
116-
}
117-
118-
.rating-emotion-emojis5 {
119-
background-image: url('/star-rating/images/star-rating/emoji_5.svg');
120-
}
121-
122-
.rating-emotion-emojis-fill {
123-
background-image: url('/star-rating/images/star-rating/emoji_filled.svg');
124-
}
125-
126-
.rating-emotion-emojis1-fill {
127-
background-image: url('/star-rating/images/star-rating/emoji_filled_1.svg');
128-
}
129-
130-
.rating-emotion-emojis2-fill {
131-
background-image: url('/star-rating/images/star-rating/emoji_filled_2.svg');
132-
}
133-
134-
.rating-emotion-emojis3-fill {
135-
background-image: url('/star-rating/images/star-rating/emoji_filled_3.svg');
136-
}
137-
138-
.rating-emotion-emojis4-fill {
139-
background-image: url('/star-rating/images/star-rating/emoji_filled_4.svg');
140-
}
141-
142-
.rating-emotion-emojis5-fill {
143-
background-image: url('/star-rating/images/star-rating/emoji_filled_5.svg');
144-
}
145-
146-
.rating-emotion-thumbs {
147-
background-image: url('/star-rating/images/star-rating/thumbs.svg');
148-
}
149-
150-
.rating-emotion-thumbs-fill {
151-
background-image: url('/star-rating/images/star-rating/thumbs_filled.svg');
152-
}
153-
154-
.rating-emotion-stars {
155-
background-image: url('/star-rating/images/star-rating/stars.svg');
156-
}
157-
158-
.rating-emotion-stars-fill {
159-
background-image: url('/star-rating/images/star-rating/stars_filled.svg');
160-
}
161-
16298
.ratings-popup .success-emotions-area {
16399
font-size: 20px;
164100
text-align: center;

plugins/star-rating/frontend/public/templates/drawer.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
</div>
6464
<div class="ratings-drawer__rp-footer" data-test-id="ratings-drawer-ratingspopup-poweredby-label">
6565
<img v-if="imageSrc && drawerScope.editedObject.logoType === 'custom'" class="ratings-drawer__image" :src="imageSrc">
66-
<img v-if="drawerScope.editedObject.logoType === 'default'" src="/star-rating/images/star-rating/powered-by-countly.svg">
66+
<img v-if="drawerScope.editedObject.logoType === 'default'" src="star-rating/images/star-rating/powered-by-countly.svg">
6767
</div>
6868
</div>
6969
<div class="bu-is-size-7 ratings-drawer__stage-label" v-if="drawerScope.currentStepId !== 'step3'" data-test-id="ratings-drawer-thankyoupopup-label">
@@ -76,7 +76,7 @@
7676
<div class="bu-has-text-weight-medium ratings-drawer__tp-thanks-message bu-is-size-4" data-test-id="ratings-drawer-thankyoupopup-message-text">{{ drawerScope.editedObject.popup_thanks_message }}</div>
7777
<div class="ratings-drawer__tp-footer" data-test-id="ratings-drawer-thankyoupopup-poweredby-label">
7878
<img v-if="imageSrc && drawerScope.editedObject.logoType === 'custom'" class="ratings-drawer__image" :src="imageSrc">
79-
<img v-if="drawerScope.editedObject.logoType === 'default'" src="/star-rating/images/star-rating/powered-by-countly.svg">
79+
<img v-if="drawerScope.editedObject.logoType === 'default'" src="star-rating/images/star-rating/powered-by-countly.svg">
8080
</div>
8181
</div>
8282
</div>

plugins/star-rating/frontend/public/templates/feedback-popup.html

Lines changed: 80 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,87 @@
22
<html>
33
<head>
44
<title>Countly Feedback Popup</title>
5-
<link href="../../star-rating/stylesheets/ratings-iframe.css" rel="stylesheet"/>
6-
<link href="../../stylesheets/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
7-
<link href="../stylesheets/ionicons/css/ionicons.min.css" rel="stylesheet"/>
5+
<link href="<%= `${countlyPath}/star-rating/stylesheets/ratings-iframe.css` %>" rel="stylesheet"/>
6+
<link href="<%= `${countlyPath}/stylesheets/font-awesome/css/font-awesome.min.css` %>" rel="stylesheet"/>
7+
<link href="<%= `${countlyPath}/stylesheets/ionicons/css/ionicons.min.css` %>" rel="stylesheet"/>
88
<!-- TODO: check where are this themeFiles -->
99
<% if (themeFiles && themeFiles.css) { %>
1010
<% for(var i=0, l=themeFiles.css.length; i < l; i++) {%>
1111
<link href='<%= themeFiles.css[i]%>' rel='stylesheet' type='text/css'>
1212
<% } %>
1313
<% } %>
1414
<meta content="width=device-width, initial-scale=1" name="viewport">
15+
<style>
16+
.rating-emotion-emojis {
17+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/emoji.svg` %>');
18+
}
19+
20+
.rating-emotion-emojis1 {
21+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/emoji_1.svg` %>');
22+
}
23+
24+
.rating-emotion-emojis2 {
25+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/emoji_2.svg` %>');
26+
}
27+
28+
.rating-emotion-emojis3 {
29+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/emoji_3.svg` %>');
30+
}
31+
32+
.rating-emotion-emojis4 {
33+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/emoji_4.svg` %>');
34+
}
35+
36+
.rating-emotion-emojis5 {
37+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/emoji_5.svg` %>');
38+
}
39+
40+
.rating-emotion-emojis-fill {
41+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/emoji_filled.svg` %>');
42+
}
43+
44+
.rating-emotion-emojis1-fill {
45+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/emoji_filled_1.svg` %>');
46+
}
47+
48+
.rating-emotion-emojis2-fill {
49+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/emoji_filled_2.svg` %>');
50+
}
51+
52+
.rating-emotion-emojis3-fill {
53+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/emoji_filled_3.svg` %>');
54+
}
55+
56+
.rating-emotion-emojis4-fill {
57+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/emoji_filled_4.svg` %>');
58+
}
59+
60+
.rating-emotion-emojis5-fill {
61+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/emoji_filled_5.svg` %>');
62+
}
63+
64+
.rating-emotion-thumbs {
65+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/thumbs.svg` %>');
66+
}
67+
68+
.rating-emotion-thumbs-fill {
69+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/thumbs_filled.svg` %>');
70+
}
71+
72+
.rating-emotion-stars {
73+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/stars.svg` %>');
74+
}
75+
76+
.rating-emotion-stars-fill {
77+
background-image: url('<%= `${countlyPath}/star-rating/images/star-rating/stars_filled.svg` %>');
78+
}
79+
</style>
1580
</head>
16-
<body class="ratings-popup cly-vue-ratings-preview">
81+
<body class="ratings-popup cly-vue-ratings-preview" data-countly-path="<%= countlyPath %>">
1782
<div class="rating-loader-wrapper">
1883
<img
1984
class="rating-loader"
20-
src="../../star-rating/images/star-rating/loader.svg"
85+
src="<%= `${countlyPath}/star-rating/images/star-rating/loader.svg` %>"
2186
/>
2287
</div>
2388
<div
@@ -156,7 +221,7 @@
156221
>
157222
<img
158223
id="powered-by-countly"
159-
src="../../star-rating/images/star-rating/powered-by-countly.svg"
224+
src="<%= `${countlyPath}/star-rating/images/star-rating/powered-by-countly.svg` %>"
160225
>
161226
</a>
162227
</div>
@@ -186,13 +251,13 @@
186251
>
187252
<img
188253
id="powered-by-countly"
189-
src="../../star-rating/images/star-rating/powered-by-countly.svg"
254+
src="<%= `${countlyPath}/star-rating/images/star-rating/powered-by-countly.svg` %>"
190255
>
191256
</a>
192257
</div>
193258
</div>
194-
<script src="../../star-rating/javascripts/tippy.all.min.js"></script>
195-
<script src="../../javascripts/dom/jquery/jquery.js"></script>
259+
<script src="<%= `${countlyPath}/star-rating/javascripts/tippy.all.min.js` %>"></script>
260+
<script src="<%= `${countlyPath}/javascripts/dom/jquery/jquery.js` %>"></script>
196261
<script>
197262
var CLOSE_BUTTON_ID = '#close-btn';
198263
var WIDGET_BODY_FULLSCREEN_CLASS = 'modal-content--fullscreen';
@@ -291,6 +356,8 @@
291356
var widget_id = getParameterByName('widget_id');
292357
let widgetVersion = null;
293358

359+
var countlyPath = $('body').data().countlyPath || '';
360+
294361
if (!platform || (platform === "undefined") || (platform === "null")) {
295362
platform = DEFAULT_PLATFORM;
296363
}
@@ -401,10 +468,10 @@
401468
}
402469

403470
if (response.globalLogo) {
404-
$('#powered-by-countly').attr('src', url + response.logo);
471+
$('#powered-by-countly').attr('src', url + countlyPath + '/' + response.logo);
405472
}
406473
else {
407-
$('#powered-by-countly').attr('src', url + '/star-rating/images/' + response.logo);
474+
$('#powered-by-countly').attr('src', url + countlyPath + '/star-rating/images/' + response.logo);
408475
}
409476

410477
$('#powered-by-countly').parent().attr('href', 'void(0)');
@@ -437,7 +504,7 @@
437504
});
438505
},
439506
type: "GET",
440-
url: url + "/o/feedback/widget"
507+
url: url + countlyPath + '/o/feedback/widget'
441508
});
442509

443510
var eventObject = {
@@ -630,7 +697,7 @@
630697
}, 5000);
631698
},
632699
type: "GET",
633-
url: url + '/i/feedback/input?events=' + encodeURIComponent(JSON.stringify([eventObject])) + '&app_key=' + app_key + '&device_id=' + device_id + '&sdk_name=' + sdk_name + (sdk_version ? '&sdk_version=' + sdk_version : '') + '&timestamp=' + Date.now() + '&hour=' + h + '&dow=' + dow + '&app_version=' + app_version
700+
url: url + countlyPath + '/i/feedback/input?events=' + encodeURIComponent(JSON.stringify([eventObject])) + '&app_key=' + app_key + '&device_id=' + device_id + '&sdk_name=' + sdk_name + (sdk_version ? '&sdk_version=' + sdk_version : '') + '&timestamp=' + Date.now() + '&hour=' + h + '&dow=' + dow + '&app_version=' + app_version
634701
});
635702
}
636703

0 commit comments

Comments
 (0)