@salla.sa/twilight-components 2.9.33 → 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 +19 -4
- package/dist/collection/components/salla-user-menu/salla-user-menu.js +20 -5
- package/dist/components/salla-user-menu.js +19 -4
- package/dist/esm/salla-button_32.entry.js +19 -4
- package/dist/esm-es5/salla-button_32.entry.js +1 -1
- package/dist/twilight/{p-3a9f8d7b.entry.js → p-3f1abcb8.entry.js} +1 -1
- package/dist/twilight/p-b8f9d154.system.js +1 -1
- package/dist/twilight/{p-80fd7408.system.entry.js → p-e8274fba.system.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/package.json +3 -3
|
@@ -27976,7 +27976,7 @@ const SallaUserMenu = class {
|
|
|
27976
27976
|
this.last_name = salla.storage.get('user.last_name') || '';
|
|
27977
27977
|
this.avatar = salla.storage.get('user.avatar') || salla.url.cdn('images/avatar.png');
|
|
27978
27978
|
this.badges = {
|
|
27979
|
-
notifications: salla.helpers.number(salla.storage.get('user.notifications') ||
|
|
27979
|
+
notifications: salla.helpers.number(salla.storage.get('user.notifications') || 0),
|
|
27980
27980
|
pending_orders: salla.helpers.number(salla.storage.get('user.pending_orders') || 0)
|
|
27981
27981
|
};
|
|
27982
27982
|
/**
|
|
@@ -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
|
}
|
|
@@ -28041,7 +28053,10 @@ const SallaUserMenu = class {
|
|
|
28041
28053
|
}
|
|
28042
28054
|
getMenuItem(item, i) {
|
|
28043
28055
|
//todo:: enhancement support slot here
|
|
28044
|
-
return index$1.h("li", { class: {
|
|
28056
|
+
return index$1.h("li", { class: {
|
|
28057
|
+
's-user-menu-dropdown-item': true,
|
|
28058
|
+
's-user-menu-dropdown-item-logout': i + 1 == Object.entries(this.items).length
|
|
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]])
|
|
28045
28060
|
? index$1.h("span", { class: "s-user-menu-dropdown-item-badge" }, this.badges[item[0]])
|
|
28046
28061
|
: ""));
|
|
28047
28062
|
}
|
|
@@ -38,7 +38,7 @@ export class SallaUserMenu {
|
|
|
38
38
|
this.last_name = salla.storage.get('user.last_name') || '';
|
|
39
39
|
this.avatar = salla.storage.get('user.avatar') || salla.url.cdn('images/avatar.png');
|
|
40
40
|
this.badges = {
|
|
41
|
-
notifications: salla.helpers.number(salla.storage.get('user.notifications') ||
|
|
41
|
+
notifications: salla.helpers.number(salla.storage.get('user.notifications') || 0),
|
|
42
42
|
pending_orders: salla.helpers.number(salla.storage.get('user.pending_orders') || 0)
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
@@ -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
|
}
|
|
@@ -103,11 +115,14 @@ export class SallaUserMenu {
|
|
|
103
115
|
}
|
|
104
116
|
getMenuItem(item, i) {
|
|
105
117
|
//todo:: enhancement support slot here
|
|
106
|
-
return h("li", { class: {
|
|
118
|
+
return h("li", { class: {
|
|
119
|
+
's-user-menu-dropdown-item': true,
|
|
120
|
+
's-user-menu-dropdown-item-logout': i + 1 == Object.entries(this.items).length
|
|
121
|
+
} },
|
|
107
122
|
h("a", { href: salla.url.get(item[0]) },
|
|
108
123
|
h("i", { innerHTML: item[1] }, " "),
|
|
109
124
|
h("span", { class: "s-user-menu-dropdown-item-title" }, this[item[0]]),
|
|
110
|
-
this.badges[item[0]]
|
|
125
|
+
!['٠', '0', undefined].includes(this.badges[item[0]])
|
|
111
126
|
? h("span", { class: "s-user-menu-dropdown-item-badge" }, this.badges[item[0]])
|
|
112
127
|
: ""));
|
|
113
128
|
}
|
|
@@ -63,7 +63,7 @@ const SallaUserMenu$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
63
63
|
this.last_name = salla.storage.get('user.last_name') || '';
|
|
64
64
|
this.avatar = salla.storage.get('user.avatar') || salla.url.cdn('images/avatar.png');
|
|
65
65
|
this.badges = {
|
|
66
|
-
notifications: salla.helpers.number(salla.storage.get('user.notifications') ||
|
|
66
|
+
notifications: salla.helpers.number(salla.storage.get('user.notifications') || 0),
|
|
67
67
|
pending_orders: salla.helpers.number(salla.storage.get('user.pending_orders') || 0)
|
|
68
68
|
};
|
|
69
69
|
/**
|
|
@@ -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
|
}
|
|
@@ -128,7 +140,10 @@ const SallaUserMenu$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
128
140
|
}
|
|
129
141
|
getMenuItem(item, i) {
|
|
130
142
|
//todo:: enhancement support slot here
|
|
131
|
-
return h("li", { class: {
|
|
143
|
+
return h("li", { class: {
|
|
144
|
+
's-user-menu-dropdown-item': true,
|
|
145
|
+
's-user-menu-dropdown-item-logout': i + 1 == Object.entries(this.items).length
|
|
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]])
|
|
132
147
|
? h("span", { class: "s-user-menu-dropdown-item-badge" }, this.badges[item[0]])
|
|
133
148
|
: ""));
|
|
134
149
|
}
|
|
@@ -27972,7 +27972,7 @@ const SallaUserMenu = class {
|
|
|
27972
27972
|
this.last_name = salla.storage.get('user.last_name') || '';
|
|
27973
27973
|
this.avatar = salla.storage.get('user.avatar') || salla.url.cdn('images/avatar.png');
|
|
27974
27974
|
this.badges = {
|
|
27975
|
-
notifications: salla.helpers.number(salla.storage.get('user.notifications') ||
|
|
27975
|
+
notifications: salla.helpers.number(salla.storage.get('user.notifications') || 0),
|
|
27976
27976
|
pending_orders: salla.helpers.number(salla.storage.get('user.pending_orders') || 0)
|
|
27977
27977
|
};
|
|
27978
27978
|
/**
|
|
@@ -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
|
}
|
|
@@ -28037,7 +28049,10 @@ const SallaUserMenu = class {
|
|
|
28037
28049
|
}
|
|
28038
28050
|
getMenuItem(item, i) {
|
|
28039
28051
|
//todo:: enhancement support slot here
|
|
28040
|
-
return h("li", { class: {
|
|
28052
|
+
return h("li", { class: {
|
|
28053
|
+
's-user-menu-dropdown-item': true,
|
|
28054
|
+
's-user-menu-dropdown-item-logout': i + 1 == Object.entries(this.items).length
|
|
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]])
|
|
28041
28056
|
? h("span", { class: "s-user-menu-dropdown-item-badge" }, this.badges[item[0]])
|
|
28042
28057
|
: ""));
|
|
28043
28058
|
}
|