@salla.sa/twilight-components 2.12.8 → 2.12.10
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-add-product-button_40.cjs.entry.js +19 -8
- package/dist/cjs/salla-add-product-button_40.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-product-options.cjs.entry.js +2 -1
- package/dist/cjs/salla-product-options.cjs.entry.js.map +1 -1
- package/dist/collection/components/salla-product-options/salla-product-options.js +2 -1
- package/dist/collection/components/salla-product-options/salla-product-options.js.map +1 -1
- package/dist/collection/components/salla-user-menu/salla-user-menu.js +19 -8
- package/dist/collection/components/salla-user-menu/salla-user-menu.js.map +1 -1
- package/dist/components/salla-product-options.js +2 -1
- package/dist/components/salla-product-options.js.map +1 -1
- package/dist/components/salla-user-menu.js +19 -8
- package/dist/components/salla-user-menu.js.map +1 -1
- package/dist/esm/salla-add-product-button_40.entry.js +19 -8
- package/dist/esm/salla-add-product-button_40.entry.js.map +1 -1
- package/dist/esm/salla-product-options.entry.js +2 -1
- package/dist/esm/salla-product-options.entry.js.map +1 -1
- package/dist/esm-es5/salla-add-product-button_40.entry.js +1 -1
- package/dist/esm-es5/salla-add-product-button_40.entry.js.map +1 -1
- package/dist/esm-es5/salla-product-options.entry.js +1 -1
- package/dist/esm-es5/salla-product-options.entry.js.map +1 -1
- package/dist/twilight/p-03cfdef7.system.js +1 -1
- package/dist/twilight/{p-d511f5f7.entry.js → p-8ce4ca08.entry.js} +2 -2
- package/dist/twilight/p-8ce4ca08.entry.js.map +1 -0
- package/dist/twilight/{p-9a09ec73.system.entry.js → p-9d88d784.system.entry.js} +2 -2
- package/dist/twilight/p-9d88d784.system.entry.js.map +1 -0
- package/dist/twilight/{p-d5a1906c.entry.js → p-c50e7524.entry.js} +2 -2
- package/dist/twilight/p-c50e7524.entry.js.map +1 -0
- package/dist/twilight/{p-9c38bff9.system.entry.js → p-f8addbca.system.entry.js} +2 -2
- package/dist/twilight/p-f8addbca.system.entry.js.map +1 -0
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-user-menu/salla-user-menu.d.ts +1 -0
- package/package.json +2 -2
- package/dist/twilight/p-9a09ec73.system.entry.js.map +0 -1
- package/dist/twilight/p-9c38bff9.system.entry.js.map +0 -1
- package/dist/twilight/p-d511f5f7.entry.js.map +0 -1
- package/dist/twilight/p-d5a1906c.entry.js.map +0 -1
|
@@ -27994,12 +27994,18 @@ const SallaUserMenu = class {
|
|
|
27994
27994
|
* //todo:: cover two requests in customer pages
|
|
27995
27995
|
* //todo:: make sure to run this only after token is set
|
|
27996
27996
|
*/
|
|
27997
|
-
|
|
27997
|
+
const shouldFetchProfile = !this.inline && (salla.url.is_page('customer.notifications')
|
|
27998
27998
|
|| salla.url.is_page('customer.orders.index.pending')
|
|
27999
27999
|
|| salla.url.is_page('customer.profile')
|
|
28000
|
-
|| ((Date.now() - (salla.storage.get('user.fetched_at') || 0)) / 1000 / 60) > 30)
|
|
28000
|
+
|| ((Date.now() - (salla.storage.get('user.fetched_at') || 0)) / 1000 / 60) > 30);
|
|
28001
|
+
if (shouldFetchProfile) {
|
|
28001
28002
|
this.fetchFreshProfile();
|
|
28002
28003
|
}
|
|
28004
|
+
else {
|
|
28005
|
+
salla.event.on('profile::info.fetched', res => {
|
|
28006
|
+
this.updateProfileState(res);
|
|
28007
|
+
});
|
|
28008
|
+
}
|
|
28003
28009
|
});
|
|
28004
28010
|
}
|
|
28005
28011
|
fetchFreshProfile() {
|
|
@@ -28010,14 +28016,19 @@ const SallaUserMenu = class {
|
|
|
28010
28016
|
}
|
|
28011
28017
|
salla.profile.api.info()
|
|
28012
28018
|
.then((res) => {
|
|
28013
|
-
this.
|
|
28014
|
-
this.badges.notifications = salla.helpers.number(res.data.notifications || 0);
|
|
28015
|
-
this.hasBadges = Number(res.data.pending_orders) > 0 || Number(res.data.notifications) > 0;
|
|
28016
|
-
this.first_name = res.data.first_name;
|
|
28017
|
-
this.last_name = res.data.last_name;
|
|
28018
|
-
this.avatar = res.data.avatar || salla.url.cdn('images/avatar.png');
|
|
28019
|
+
this.updateProfileState(res);
|
|
28019
28020
|
});
|
|
28020
28021
|
}
|
|
28022
|
+
updateProfileState(res) {
|
|
28023
|
+
this.badges = {
|
|
28024
|
+
notifications: salla.helpers.number(res.data.notifications || 0),
|
|
28025
|
+
pending_orders: salla.helpers.number(res.data.pending_orders || 0)
|
|
28026
|
+
};
|
|
28027
|
+
this.hasBadges = Number(res.data.pending_orders) > 0 || Number(res.data.notifications) > 0;
|
|
28028
|
+
this.first_name = res.data.first_name;
|
|
28029
|
+
this.last_name = res.data.last_name;
|
|
28030
|
+
this.avatar = res.data.avatar || salla.url.cdn('images/avatar.png');
|
|
28031
|
+
}
|
|
28021
28032
|
async open(e) {
|
|
28022
28033
|
this.opened = !this.opened;
|
|
28023
28034
|
e.stopPropagation();
|