@salla.sa/twilight-components 2.9.34 → 2.9.35
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/cjs/salla-button_32.cjs.entry.js +15 -3
- package/dist/collection/components/salla-user-menu/salla-user-menu.js +15 -3
- package/dist/components/salla-user-menu.js +15 -3
- package/dist/esm/salla-button_32.entry.js +15 -3
- package/dist/esm-es5/salla-button_32.entry.js +1 -1
- package/dist/twilight/{p-aede29a8.entry.js → p-3f1abcb8.entry.js} +1 -1
- package/dist/twilight/p-b8f9d154.system.js +1 -1
- package/dist/twilight/{p-3ae8b640.system.entry.js → p-e8274fba.system.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/package.json +3 -3
|
@@ -28009,8 +28009,20 @@ const SallaUserMenu = class {
|
|
|
28009
28009
|
this.logout = salla.lang.get("blocks.header.logout");
|
|
28010
28010
|
});
|
|
28011
28011
|
this.triggerSlot = ((_a = this.host.querySelector('[slot="trigger"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<div class="s-user-menu-trigger"><img class="s-user-menu-trigger-avatar" src="{avatar}" alt="{first_name}{last_name}" /><div class="s-user-menu-trigger-content"><span class="s-user-menu-trigger-hello">{hello}</span><p class="s-user-menu-trigger-name">{first_name} {last_name}</p></div> <i class="s-user-menu-trigger-icon">{icon}</i></div>';
|
|
28012
|
-
|
|
28013
|
-
|
|
28012
|
+
if (salla.config.isGuest()) {
|
|
28013
|
+
return;
|
|
28014
|
+
}
|
|
28015
|
+
/**
|
|
28016
|
+
* Get Fresh Notifications In These Cases:
|
|
28017
|
+
* - is notification page, if user already changed the status of his orders
|
|
28018
|
+
* - is pending orders page, if user already changed the status of his orders
|
|
28019
|
+
* - is profile page, if user changed his name or avatar, we need to update it
|
|
28020
|
+
* - half hour is passed than last user data fetched
|
|
28021
|
+
*/
|
|
28022
|
+
if (salla.url.is_page('customer.notifications')
|
|
28023
|
+
|| salla.url.is_page('customer.orders.index.pending')
|
|
28024
|
+
|| salla.url.is_page('customer.profile')
|
|
28025
|
+
|| ((Date.now() - (salla.storage.get('user.fetched_at') || 0)) / 1000 / 60) > 30) {
|
|
28014
28026
|
this.fetchFreshProfile();
|
|
28015
28027
|
}
|
|
28016
28028
|
}
|
|
@@ -28044,7 +28056,7 @@ const SallaUserMenu = class {
|
|
|
28044
28056
|
return index$1.h("li", { class: {
|
|
28045
28057
|
's-user-menu-dropdown-item': true,
|
|
28046
28058
|
's-user-menu-dropdown-item-logout': i + 1 == Object.entries(this.items).length
|
|
28047
|
-
} }, index$1.h("a", { href: salla.url.get(item[0]) }, index$1.h("i", { innerHTML: item[1] }, " "), index$1.h("span", { class: "s-user-menu-dropdown-item-title" }, this[item[0]]),
|
|
28059
|
+
} }, index$1.h("a", { href: salla.url.get(item[0]) }, index$1.h("i", { innerHTML: item[1] }, " "), index$1.h("span", { class: "s-user-menu-dropdown-item-title" }, this[item[0]]), !['٠', '0', undefined].includes(this.badges[item[0]])
|
|
28048
28060
|
? index$1.h("span", { class: "s-user-menu-dropdown-item-badge" }, this.badges[item[0]])
|
|
28049
28061
|
: ""));
|
|
28050
28062
|
}
|
|
@@ -71,8 +71,20 @@ export class SallaUserMenu {
|
|
|
71
71
|
this.logout = salla.lang.get("blocks.header.logout");
|
|
72
72
|
});
|
|
73
73
|
this.triggerSlot = ((_a = this.host.querySelector('[slot="trigger"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<div class="s-user-menu-trigger"><img class="s-user-menu-trigger-avatar" src="{avatar}" alt="{first_name}{last_name}" /><div class="s-user-menu-trigger-content"><span class="s-user-menu-trigger-hello">{hello}</span><p class="s-user-menu-trigger-name">{first_name} {last_name}</p></div> <i class="s-user-menu-trigger-icon">{icon}</i></div>';
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
if (salla.config.isGuest()) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get Fresh Notifications In These Cases:
|
|
79
|
+
* - is notification page, if user already changed the status of his orders
|
|
80
|
+
* - is pending orders page, if user already changed the status of his orders
|
|
81
|
+
* - is profile page, if user changed his name or avatar, we need to update it
|
|
82
|
+
* - half hour is passed than last user data fetched
|
|
83
|
+
*/
|
|
84
|
+
if (salla.url.is_page('customer.notifications')
|
|
85
|
+
|| salla.url.is_page('customer.orders.index.pending')
|
|
86
|
+
|| salla.url.is_page('customer.profile')
|
|
87
|
+
|| ((Date.now() - (salla.storage.get('user.fetched_at') || 0)) / 1000 / 60) > 30) {
|
|
76
88
|
this.fetchFreshProfile();
|
|
77
89
|
}
|
|
78
90
|
}
|
|
@@ -110,7 +122,7 @@ export class SallaUserMenu {
|
|
|
110
122
|
h("a", { href: salla.url.get(item[0]) },
|
|
111
123
|
h("i", { innerHTML: item[1] }, " "),
|
|
112
124
|
h("span", { class: "s-user-menu-dropdown-item-title" }, this[item[0]]),
|
|
113
|
-
|
|
125
|
+
!['٠', '0', undefined].includes(this.badges[item[0]])
|
|
114
126
|
? h("span", { class: "s-user-menu-dropdown-item-badge" }, this.badges[item[0]])
|
|
115
127
|
: ""));
|
|
116
128
|
}
|
|
@@ -96,8 +96,20 @@ const SallaUserMenu$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
96
96
|
this.logout = salla.lang.get("blocks.header.logout");
|
|
97
97
|
});
|
|
98
98
|
this.triggerSlot = ((_a = this.host.querySelector('[slot="trigger"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<div class="s-user-menu-trigger"><img class="s-user-menu-trigger-avatar" src="{avatar}" alt="{first_name}{last_name}" /><div class="s-user-menu-trigger-content"><span class="s-user-menu-trigger-hello">{hello}</span><p class="s-user-menu-trigger-name">{first_name} {last_name}</p></div> <i class="s-user-menu-trigger-icon">{icon}</i></div>';
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
if (salla.config.isGuest()) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get Fresh Notifications In These Cases:
|
|
104
|
+
* - is notification page, if user already changed the status of his orders
|
|
105
|
+
* - is pending orders page, if user already changed the status of his orders
|
|
106
|
+
* - is profile page, if user changed his name or avatar, we need to update it
|
|
107
|
+
* - half hour is passed than last user data fetched
|
|
108
|
+
*/
|
|
109
|
+
if (salla.url.is_page('customer.notifications')
|
|
110
|
+
|| salla.url.is_page('customer.orders.index.pending')
|
|
111
|
+
|| salla.url.is_page('customer.profile')
|
|
112
|
+
|| ((Date.now() - (salla.storage.get('user.fetched_at') || 0)) / 1000 / 60) > 30) {
|
|
101
113
|
this.fetchFreshProfile();
|
|
102
114
|
}
|
|
103
115
|
}
|
|
@@ -131,7 +143,7 @@ const SallaUserMenu$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
131
143
|
return h("li", { class: {
|
|
132
144
|
's-user-menu-dropdown-item': true,
|
|
133
145
|
's-user-menu-dropdown-item-logout': i + 1 == Object.entries(this.items).length
|
|
134
|
-
} }, h("a", { href: salla.url.get(item[0]) }, h("i", { innerHTML: item[1] }, " "), h("span", { class: "s-user-menu-dropdown-item-title" }, this[item[0]]),
|
|
146
|
+
} }, h("a", { href: salla.url.get(item[0]) }, h("i", { innerHTML: item[1] }, " "), h("span", { class: "s-user-menu-dropdown-item-title" }, this[item[0]]), !['٠', '0', undefined].includes(this.badges[item[0]])
|
|
135
147
|
? h("span", { class: "s-user-menu-dropdown-item-badge" }, this.badges[item[0]])
|
|
136
148
|
: ""));
|
|
137
149
|
}
|
|
@@ -28005,8 +28005,20 @@ const SallaUserMenu = class {
|
|
|
28005
28005
|
this.logout = salla.lang.get("blocks.header.logout");
|
|
28006
28006
|
});
|
|
28007
28007
|
this.triggerSlot = ((_a = this.host.querySelector('[slot="trigger"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<div class="s-user-menu-trigger"><img class="s-user-menu-trigger-avatar" src="{avatar}" alt="{first_name}{last_name}" /><div class="s-user-menu-trigger-content"><span class="s-user-menu-trigger-hello">{hello}</span><p class="s-user-menu-trigger-name">{first_name} {last_name}</p></div> <i class="s-user-menu-trigger-icon">{icon}</i></div>';
|
|
28008
|
-
|
|
28009
|
-
|
|
28008
|
+
if (salla.config.isGuest()) {
|
|
28009
|
+
return;
|
|
28010
|
+
}
|
|
28011
|
+
/**
|
|
28012
|
+
* Get Fresh Notifications In These Cases:
|
|
28013
|
+
* - is notification page, if user already changed the status of his orders
|
|
28014
|
+
* - is pending orders page, if user already changed the status of his orders
|
|
28015
|
+
* - is profile page, if user changed his name or avatar, we need to update it
|
|
28016
|
+
* - half hour is passed than last user data fetched
|
|
28017
|
+
*/
|
|
28018
|
+
if (salla.url.is_page('customer.notifications')
|
|
28019
|
+
|| salla.url.is_page('customer.orders.index.pending')
|
|
28020
|
+
|| salla.url.is_page('customer.profile')
|
|
28021
|
+
|| ((Date.now() - (salla.storage.get('user.fetched_at') || 0)) / 1000 / 60) > 30) {
|
|
28010
28022
|
this.fetchFreshProfile();
|
|
28011
28023
|
}
|
|
28012
28024
|
}
|
|
@@ -28040,7 +28052,7 @@ const SallaUserMenu = class {
|
|
|
28040
28052
|
return h("li", { class: {
|
|
28041
28053
|
's-user-menu-dropdown-item': true,
|
|
28042
28054
|
's-user-menu-dropdown-item-logout': i + 1 == Object.entries(this.items).length
|
|
28043
|
-
} }, h("a", { href: salla.url.get(item[0]) }, h("i", { innerHTML: item[1] }, " "), h("span", { class: "s-user-menu-dropdown-item-title" }, this[item[0]]),
|
|
28055
|
+
} }, h("a", { href: salla.url.get(item[0]) }, h("i", { innerHTML: item[1] }, " "), h("span", { class: "s-user-menu-dropdown-item-title" }, this[item[0]]), !['٠', '0', undefined].includes(this.badges[item[0]])
|
|
28044
28056
|
? h("span", { class: "s-user-menu-dropdown-item-badge" }, this.badges[item[0]])
|
|
28045
28057
|
: ""));
|
|
28046
28058
|
}
|