@salla.sa/twilight-components 2.9.32 → 2.9.34
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/{index-cac2fd59.js → index-1d2b3370.js} +7 -2
- package/dist/cjs/{index-377e4d52.js → index-fcc9f90f.js} +1 -1
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/salla-add-product-button.cjs.entry.js +1 -1
- package/dist/cjs/{salla-button_30.cjs.entry.js → salla-button_32.cjs.entry.js} +224 -8
- package/dist/cjs/salla-conditional-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-select.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/salla-sheet/salla-sheet.css +24 -0
- package/dist/collection/components/salla-sheet/salla-sheet.js +210 -0
- package/dist/collection/components/salla-user-menu/interfaces.js +4 -0
- package/dist/collection/components/salla-user-menu/salla-user-menu.css +0 -0
- package/dist/collection/components/salla-user-menu/salla-user-menu.js +239 -0
- package/dist/collection/global/app-dev.js +31 -28
- package/dist/components/bell-ring.js +11 -0
- package/dist/components/cart.js +11 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +3 -1
- package/dist/components/salla-cart-summary.js +2 -8
- package/dist/components/salla-product-availability2.js +3 -9
- package/dist/components/salla-rating-modal.js +2 -8
- package/dist/components/salla-sheet.d.ts +11 -0
- package/dist/components/salla-sheet.js +111 -0
- package/dist/components/salla-user-menu.d.ts +11 -0
- package/dist/components/salla-user-menu.js +189 -0
- package/dist/components/star.js +11 -0
- package/dist/esm/{index-a277bafe.js → index-9c5cff9d.js} +1 -1
- package/dist/esm/{index-0ce70ad2.js → index-f1d446ac.js} +7 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-add-product-button.entry.js +1 -1
- package/dist/esm/{salla-button_30.entry.js → salla-button_32.entry.js} +223 -9
- package/dist/esm/salla-conditional-fields.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-select.entry.js +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/esm-es5/{index-a277bafe.js → index-9c5cff9d.js} +1 -1
- package/dist/esm-es5/{index-0ce70ad2.js → index-f1d446ac.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/salla-add-product-button.entry.js +1 -1
- package/dist/esm-es5/{salla-button_30.entry.js → salla-button_32.entry.js} +4 -4
- package/dist/esm-es5/salla-conditional-fields.entry.js +1 -1
- package/dist/esm-es5/salla-installment.entry.js +1 -1
- package/dist/esm-es5/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm-es5/salla-scopes.entry.js +1 -1
- package/dist/esm-es5/salla-select.entry.js +1 -1
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/twilight/{p-10ac9c79.entry.js → p-03695034.entry.js} +1 -1
- package/dist/twilight/{p-521b6fde.entry.js → p-0bb00f36.entry.js} +1 -1
- package/dist/twilight/{p-0df01b70.system.entry.js → p-1b53ebda.system.entry.js} +1 -1
- package/dist/twilight/{p-26a23097.system.entry.js → p-217e1d1c.system.entry.js} +1 -1
- package/dist/twilight/{p-767eb598.system.entry.js → p-21aa165d.system.entry.js} +1 -1
- package/dist/twilight/{p-85816035.system.entry.js → p-3ae8b640.system.entry.js} +2 -2
- package/dist/twilight/{p-91d5fcc1.system.entry.js → p-486ce499.system.entry.js} +1 -1
- package/dist/twilight/{p-93a1a61e.entry.js → p-6d34d337.entry.js} +1 -1
- package/dist/twilight/{p-13e697f7.entry.js → p-6f41faf8.entry.js} +1 -1
- package/dist/twilight/{p-ca68752d.js → p-7dc66c07.js} +1 -1
- package/dist/twilight/{p-27e01463.entry.js → p-82931e46.entry.js} +1 -1
- package/dist/twilight/{p-9e4d198f.system.entry.js → p-9c0c939c.system.entry.js} +1 -1
- package/dist/twilight/{p-34e3a9bf.system.js → p-a761441b.system.js} +1 -1
- package/dist/twilight/{p-af4aa9f9.entry.js → p-a7bd281c.entry.js} +1 -1
- package/dist/twilight/{p-6224b033.entry.js → p-aede29a8.entry.js} +4 -4
- package/dist/twilight/p-b8f9d154.system.js +4 -0
- package/dist/twilight/{p-db0ba553.system.js → p-d9130020.system.js} +2 -2
- package/dist/twilight/{p-cfdc464c.js → p-da7b5ff6.js} +2 -2
- package/dist/twilight/{p-dd9b3c90.system.entry.js → p-fbaa17e1.system.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.js +1 -1
- package/dist/types/components/salla-sheet/salla-sheet.d.ts +35 -0
- package/dist/types/components/salla-user-menu/interfaces.d.ts +27 -0
- package/dist/types/components/salla-user-menu/salla-user-menu.d.ts +46 -0
- package/dist/types/components.d.ts +76 -0
- package/package.json +4 -4
- package/dist/twilight/p-59dd7db3.system.js +0 -4
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import { Component, Host, h, State, Prop, Method } from '@stencil/core';
|
|
5
|
+
export class SallaSheet {
|
|
6
|
+
constructor() {
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
this.position = 'bottom';
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
this.width = 600;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
this.height = 300;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
this.sheetColor = "#ffffff";
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
this.persistent = false;
|
|
27
|
+
this.flag = false;
|
|
28
|
+
}
|
|
29
|
+
// private showHideSheet() {
|
|
30
|
+
// this.flag = !this.flag;
|
|
31
|
+
// }
|
|
32
|
+
getMainClass() {
|
|
33
|
+
return {
|
|
34
|
+
"s-sheet-overlay": true,
|
|
35
|
+
"active": this.flag,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
// private getOverlayStyle() {
|
|
39
|
+
// return {
|
|
40
|
+
// "align-items": this.position == "top" ? "flex-start" : "flex-end",
|
|
41
|
+
// "justify-content": this.position == "left" ? "flex-start" : "flex-end"
|
|
42
|
+
// }
|
|
43
|
+
// }
|
|
44
|
+
//
|
|
45
|
+
// private getContainerStyle() {
|
|
46
|
+
// return {
|
|
47
|
+
// "width": `${this.width}px`,
|
|
48
|
+
// "min-height": `${this.height}px`,
|
|
49
|
+
// "background-color": this.sheetColor,
|
|
50
|
+
// // "transform": 'translateY(100%)',
|
|
51
|
+
// // "transition": "transform 0.4s ease-in-out"
|
|
52
|
+
// }
|
|
53
|
+
// }
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
open() {
|
|
59
|
+
this.flag = true;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
close() {
|
|
66
|
+
this.flag = false;
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
return (h(Host, null,
|
|
70
|
+
h("slot", { name: 'widget' },
|
|
71
|
+
h("salla-button", { fill: 'outline', width: "wide", onClick: () => this.open() }, "Show/Hide")),
|
|
72
|
+
h("div", { class: this.getMainClass(), onClick: () => this.persistent ? null : this.close() },
|
|
73
|
+
h("div", { class: "s-sheet-container" },
|
|
74
|
+
h("slot", null)))));
|
|
75
|
+
}
|
|
76
|
+
static get is() { return "salla-sheet"; }
|
|
77
|
+
static get originalStyleUrls() { return {
|
|
78
|
+
"$": ["salla-sheet.scss"]
|
|
79
|
+
}; }
|
|
80
|
+
static get styleUrls() { return {
|
|
81
|
+
"$": ["salla-sheet.css"]
|
|
82
|
+
}; }
|
|
83
|
+
static get properties() { return {
|
|
84
|
+
"position": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"mutable": false,
|
|
87
|
+
"complexType": {
|
|
88
|
+
"original": "'top' | 'bottom' | 'left' | 'right'",
|
|
89
|
+
"resolved": "\"bottom\" | \"left\" | \"right\" | \"top\"",
|
|
90
|
+
"references": {}
|
|
91
|
+
},
|
|
92
|
+
"required": false,
|
|
93
|
+
"optional": false,
|
|
94
|
+
"docs": {
|
|
95
|
+
"tags": [],
|
|
96
|
+
"text": ""
|
|
97
|
+
},
|
|
98
|
+
"attribute": "position",
|
|
99
|
+
"reflect": false,
|
|
100
|
+
"defaultValue": "'bottom'"
|
|
101
|
+
},
|
|
102
|
+
"width": {
|
|
103
|
+
"type": "number",
|
|
104
|
+
"mutable": false,
|
|
105
|
+
"complexType": {
|
|
106
|
+
"original": "number",
|
|
107
|
+
"resolved": "number",
|
|
108
|
+
"references": {}
|
|
109
|
+
},
|
|
110
|
+
"required": false,
|
|
111
|
+
"optional": false,
|
|
112
|
+
"docs": {
|
|
113
|
+
"tags": [],
|
|
114
|
+
"text": ""
|
|
115
|
+
},
|
|
116
|
+
"attribute": "width",
|
|
117
|
+
"reflect": false,
|
|
118
|
+
"defaultValue": "600"
|
|
119
|
+
},
|
|
120
|
+
"height": {
|
|
121
|
+
"type": "number",
|
|
122
|
+
"mutable": false,
|
|
123
|
+
"complexType": {
|
|
124
|
+
"original": "number",
|
|
125
|
+
"resolved": "number",
|
|
126
|
+
"references": {}
|
|
127
|
+
},
|
|
128
|
+
"required": false,
|
|
129
|
+
"optional": false,
|
|
130
|
+
"docs": {
|
|
131
|
+
"tags": [],
|
|
132
|
+
"text": ""
|
|
133
|
+
},
|
|
134
|
+
"attribute": "height",
|
|
135
|
+
"reflect": false,
|
|
136
|
+
"defaultValue": "300"
|
|
137
|
+
},
|
|
138
|
+
"sheetColor": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"mutable": false,
|
|
141
|
+
"complexType": {
|
|
142
|
+
"original": "string",
|
|
143
|
+
"resolved": "string",
|
|
144
|
+
"references": {}
|
|
145
|
+
},
|
|
146
|
+
"required": false,
|
|
147
|
+
"optional": false,
|
|
148
|
+
"docs": {
|
|
149
|
+
"tags": [],
|
|
150
|
+
"text": ""
|
|
151
|
+
},
|
|
152
|
+
"attribute": "sheet-color",
|
|
153
|
+
"reflect": false,
|
|
154
|
+
"defaultValue": "\"#ffffff\""
|
|
155
|
+
},
|
|
156
|
+
"persistent": {
|
|
157
|
+
"type": "boolean",
|
|
158
|
+
"mutable": false,
|
|
159
|
+
"complexType": {
|
|
160
|
+
"original": "boolean",
|
|
161
|
+
"resolved": "boolean",
|
|
162
|
+
"references": {}
|
|
163
|
+
},
|
|
164
|
+
"required": false,
|
|
165
|
+
"optional": false,
|
|
166
|
+
"docs": {
|
|
167
|
+
"tags": [],
|
|
168
|
+
"text": ""
|
|
169
|
+
},
|
|
170
|
+
"attribute": "persistent",
|
|
171
|
+
"reflect": false,
|
|
172
|
+
"defaultValue": "false"
|
|
173
|
+
}
|
|
174
|
+
}; }
|
|
175
|
+
static get states() { return {
|
|
176
|
+
"flag": {}
|
|
177
|
+
}; }
|
|
178
|
+
static get methods() { return {
|
|
179
|
+
"open": {
|
|
180
|
+
"complexType": {
|
|
181
|
+
"signature": "() => Promise<void>",
|
|
182
|
+
"parameters": [],
|
|
183
|
+
"references": {},
|
|
184
|
+
"return": "Promise<void>"
|
|
185
|
+
},
|
|
186
|
+
"docs": {
|
|
187
|
+
"text": "",
|
|
188
|
+
"tags": [{
|
|
189
|
+
"name": "returns",
|
|
190
|
+
"text": undefined
|
|
191
|
+
}]
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"close": {
|
|
195
|
+
"complexType": {
|
|
196
|
+
"signature": "() => Promise<void>",
|
|
197
|
+
"parameters": [],
|
|
198
|
+
"references": {},
|
|
199
|
+
"return": "Promise<void>"
|
|
200
|
+
},
|
|
201
|
+
"docs": {
|
|
202
|
+
"text": "",
|
|
203
|
+
"tags": [{
|
|
204
|
+
"name": "returns",
|
|
205
|
+
"text": undefined
|
|
206
|
+
}]
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}; }
|
|
210
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import { Component, Host, h, State, Element, Prop } from '@stencil/core';
|
|
5
|
+
// Icons
|
|
6
|
+
import ArrowDown from "../../assets/svg/keyboard_arrow_down.svg";
|
|
7
|
+
import BellRing from "../../assets/svg/bell-ring.svg";
|
|
8
|
+
import OrderIcon from "../../assets/svg/box-bankers.svg";
|
|
9
|
+
import PendingOrdersIcon from "../../assets/svg/cart.svg";
|
|
10
|
+
import WishListIcon from "../../assets/svg/star.svg";
|
|
11
|
+
import ProfileIcon from "../../assets/svg/user-circle.svg";
|
|
12
|
+
import LogoutIcon from "../../assets/svg/send-out.svg";
|
|
13
|
+
import Cancel from "../../assets/svg/cancel.svg";
|
|
14
|
+
/**
|
|
15
|
+
* @slot trigger - Replaces trigger widget, has replaceable props `{avatar}`, `{hello}`, `{first_name}`, `{last_name}`, `{icon}`.
|
|
16
|
+
*/
|
|
17
|
+
export class SallaUserMenu {
|
|
18
|
+
constructor() {
|
|
19
|
+
var _a;
|
|
20
|
+
this.items = {
|
|
21
|
+
notifications: BellRing,
|
|
22
|
+
orders: OrderIcon,
|
|
23
|
+
pending_orders: PendingOrdersIcon,
|
|
24
|
+
wishlist: WishListIcon,
|
|
25
|
+
profile: ProfileIcon,
|
|
26
|
+
logout: LogoutIcon,
|
|
27
|
+
};
|
|
28
|
+
this.accountLoading = false;
|
|
29
|
+
this.opened = false;
|
|
30
|
+
this.notifications = salla.lang.get("common.titles.notifications");
|
|
31
|
+
this.orders = salla.lang.get("common.titles.orders");
|
|
32
|
+
this.pending_orders = salla.lang.get("common.titles.pending_orders");
|
|
33
|
+
this.wishlist = salla.lang.get("common.titles.wishlist");
|
|
34
|
+
this.profile = salla.lang.get("common.titles.profile");
|
|
35
|
+
this.logout = salla.lang.get("blocks.header.logout");
|
|
36
|
+
this.hello = salla.lang.get("pages.checkout.hello");
|
|
37
|
+
this.first_name = salla.storage.get('user.first_name') || '';
|
|
38
|
+
this.last_name = salla.storage.get('user.last_name') || '';
|
|
39
|
+
this.avatar = salla.storage.get('user.avatar') || salla.url.cdn('images/avatar.png');
|
|
40
|
+
this.badges = {
|
|
41
|
+
notifications: salla.helpers.number(salla.storage.get('user.notifications') || 0),
|
|
42
|
+
pending_orders: salla.helpers.number(salla.storage.get('user.pending_orders') || 0)
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* To display only the list without the dropdown functionality
|
|
46
|
+
*/
|
|
47
|
+
this.inline = false;
|
|
48
|
+
/**
|
|
49
|
+
* To display the trigger as an avatar only
|
|
50
|
+
*/
|
|
51
|
+
this.avatarOnly = false;
|
|
52
|
+
/**
|
|
53
|
+
* To display the dropdown header in mobile sheet
|
|
54
|
+
*/
|
|
55
|
+
this.showHeader = false;
|
|
56
|
+
/**
|
|
57
|
+
* To Make the dropdown menu relative to parent element or not
|
|
58
|
+
*/
|
|
59
|
+
this.relativeDropdown = false;
|
|
60
|
+
this.onClickOutside = () => {
|
|
61
|
+
this.opened = false;
|
|
62
|
+
};
|
|
63
|
+
this.OrderUpdate = 0;
|
|
64
|
+
salla.lang.onLoaded(() => {
|
|
65
|
+
this.notifications = salla.lang.get("common.titles.notifications");
|
|
66
|
+
this.orders = salla.lang.get("common.titles.orders");
|
|
67
|
+
this.pending_orders = salla.lang.get("common.titles.pending_orders");
|
|
68
|
+
this.wishlist = salla.lang.get("common.titles.wishlist");
|
|
69
|
+
this.profile = salla.lang.get("common.titles.profile");
|
|
70
|
+
this.hello = salla.lang.get("pages.checkout.hello");
|
|
71
|
+
this.logout = salla.lang.get("blocks.header.logout");
|
|
72
|
+
});
|
|
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
|
+
//if user info fetched before one hour get fresh data
|
|
75
|
+
if (salla.config.isUser() && ((Date.now() - (salla.storage.get('user.fetched_at') || 0)) / 1000 / 60) > 30) {
|
|
76
|
+
this.fetchFreshProfile();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
fetchFreshProfile() {
|
|
80
|
+
salla.profile.api.info()
|
|
81
|
+
.then((res) => {
|
|
82
|
+
this.badges.pending_orders = salla.helpers.number(res.data.pending_orders || 0);
|
|
83
|
+
this.badges.notifications = salla.helpers.number(res.data.notifications || 0);
|
|
84
|
+
this.first_name = res.data.first_name;
|
|
85
|
+
this.last_name = res.data.last_name;
|
|
86
|
+
this.avatar = res.data.avatar || salla.url.cdn('images/avatar.png');
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
async open(e) {
|
|
90
|
+
this.opened = !this.opened;
|
|
91
|
+
e.stopPropagation();
|
|
92
|
+
if (this.opened) {
|
|
93
|
+
window.addEventListener('click', this.onClickOutside);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
getTheHeader() {
|
|
97
|
+
return h("div", { class: { 's-user-menu-trigger-slot': true, 's-user-menu-trigger-avatar-only': this.avatarOnly }, id: 'trigger-slot', onClick: (e) => this.open(e), innerHTML: this.triggerSlot
|
|
98
|
+
.replace(/\{hello\}/g, this.hello)
|
|
99
|
+
.replace(/\{first_name\}/g, this.first_name)
|
|
100
|
+
.replace(/\{last_name\}/g, this.last_name)
|
|
101
|
+
.replace(/\{avatar\}/g, this.avatar)
|
|
102
|
+
.replace(/\{icon\}/g, ArrowDown) });
|
|
103
|
+
}
|
|
104
|
+
getMenuItem(item, i) {
|
|
105
|
+
//todo:: enhancement support slot here
|
|
106
|
+
return h("li", { class: {
|
|
107
|
+
's-user-menu-dropdown-item': true,
|
|
108
|
+
's-user-menu-dropdown-item-logout': i + 1 == Object.entries(this.items).length
|
|
109
|
+
} },
|
|
110
|
+
h("a", { href: salla.url.get(item[0]) },
|
|
111
|
+
h("i", { innerHTML: item[1] }, " "),
|
|
112
|
+
h("span", { class: "s-user-menu-dropdown-item-title" }, this[item[0]]),
|
|
113
|
+
(this.badges[item[0]] && this.badges[item[0]] != '٠')
|
|
114
|
+
? h("span", { class: "s-user-menu-dropdown-item-badge" }, this.badges[item[0]])
|
|
115
|
+
: ""));
|
|
116
|
+
}
|
|
117
|
+
render() {
|
|
118
|
+
//todo:: reduce class names, they are too long
|
|
119
|
+
return (h(Host, null, this.inline ?
|
|
120
|
+
h("ul", { class: "s-user-menu-inline" }, Object.entries(this.items).map((item, i) => this.getMenuItem(item, i)))
|
|
121
|
+
: h("div", { class: { 's-user-menu-wrapper': true, 's-user-menu-relative-dropdown': this.relativeDropdown } },
|
|
122
|
+
this.getTheHeader(),
|
|
123
|
+
h("div", { class: { 's-user-menu-toggler': true, 'opened': this.opened } },
|
|
124
|
+
h("div", { class: "s-user-menu-dropdown", onClick: (e) => e.stopPropagation() },
|
|
125
|
+
this.showHeader ? h("div", { class: "s-user-menu-dropdown-header" },
|
|
126
|
+
h("img", { src: this.avatar, alt: `${this.first_name} ${this.last_name}` }),
|
|
127
|
+
h("div", { class: "s-user-menu-dropdown-header-content" },
|
|
128
|
+
h("span", null, this.hello),
|
|
129
|
+
h("p", null,
|
|
130
|
+
this.first_name,
|
|
131
|
+
" ",
|
|
132
|
+
this.last_name)),
|
|
133
|
+
h("button", { class: "s-user-menu-dropdown-header-close", innerHTML: Cancel, onClick: () => this.opened = false })) : '',
|
|
134
|
+
h("ul", { class: "s-user-menu-dropdown-list" }, Object.entries(this.items).map((item, i) => this.getMenuItem(item, i))))))));
|
|
135
|
+
}
|
|
136
|
+
componentShouldUpdate() {
|
|
137
|
+
if (!this.opened) {
|
|
138
|
+
window.removeEventListener('click', this.onClickOutside);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
static get is() { return "salla-user-menu"; }
|
|
142
|
+
static get originalStyleUrls() { return {
|
|
143
|
+
"$": ["salla-user-menu.scss"]
|
|
144
|
+
}; }
|
|
145
|
+
static get styleUrls() { return {
|
|
146
|
+
"$": ["salla-user-menu.css"]
|
|
147
|
+
}; }
|
|
148
|
+
static get properties() { return {
|
|
149
|
+
"inline": {
|
|
150
|
+
"type": "boolean",
|
|
151
|
+
"mutable": false,
|
|
152
|
+
"complexType": {
|
|
153
|
+
"original": "boolean",
|
|
154
|
+
"resolved": "boolean",
|
|
155
|
+
"references": {}
|
|
156
|
+
},
|
|
157
|
+
"required": false,
|
|
158
|
+
"optional": false,
|
|
159
|
+
"docs": {
|
|
160
|
+
"tags": [],
|
|
161
|
+
"text": "To display only the list without the dropdown functionality"
|
|
162
|
+
},
|
|
163
|
+
"attribute": "inline",
|
|
164
|
+
"reflect": true,
|
|
165
|
+
"defaultValue": "false"
|
|
166
|
+
},
|
|
167
|
+
"avatarOnly": {
|
|
168
|
+
"type": "boolean",
|
|
169
|
+
"mutable": false,
|
|
170
|
+
"complexType": {
|
|
171
|
+
"original": "boolean",
|
|
172
|
+
"resolved": "boolean",
|
|
173
|
+
"references": {}
|
|
174
|
+
},
|
|
175
|
+
"required": false,
|
|
176
|
+
"optional": false,
|
|
177
|
+
"docs": {
|
|
178
|
+
"tags": [],
|
|
179
|
+
"text": "To display the trigger as an avatar only"
|
|
180
|
+
},
|
|
181
|
+
"attribute": "avatar-only",
|
|
182
|
+
"reflect": true,
|
|
183
|
+
"defaultValue": "false"
|
|
184
|
+
},
|
|
185
|
+
"showHeader": {
|
|
186
|
+
"type": "boolean",
|
|
187
|
+
"mutable": false,
|
|
188
|
+
"complexType": {
|
|
189
|
+
"original": "boolean",
|
|
190
|
+
"resolved": "boolean",
|
|
191
|
+
"references": {}
|
|
192
|
+
},
|
|
193
|
+
"required": false,
|
|
194
|
+
"optional": false,
|
|
195
|
+
"docs": {
|
|
196
|
+
"tags": [],
|
|
197
|
+
"text": "To display the dropdown header in mobile sheet"
|
|
198
|
+
},
|
|
199
|
+
"attribute": "show-header",
|
|
200
|
+
"reflect": true,
|
|
201
|
+
"defaultValue": "false"
|
|
202
|
+
},
|
|
203
|
+
"relativeDropdown": {
|
|
204
|
+
"type": "boolean",
|
|
205
|
+
"mutable": false,
|
|
206
|
+
"complexType": {
|
|
207
|
+
"original": "boolean",
|
|
208
|
+
"resolved": "boolean",
|
|
209
|
+
"references": {}
|
|
210
|
+
},
|
|
211
|
+
"required": false,
|
|
212
|
+
"optional": false,
|
|
213
|
+
"docs": {
|
|
214
|
+
"tags": [],
|
|
215
|
+
"text": "To Make the dropdown menu relative to parent element or not"
|
|
216
|
+
},
|
|
217
|
+
"attribute": "relative-dropdown",
|
|
218
|
+
"reflect": true,
|
|
219
|
+
"defaultValue": "false"
|
|
220
|
+
}
|
|
221
|
+
}; }
|
|
222
|
+
static get states() { return {
|
|
223
|
+
"accountLoading": {},
|
|
224
|
+
"opened": {},
|
|
225
|
+
"notifications": {},
|
|
226
|
+
"orders": {},
|
|
227
|
+
"pending_orders": {},
|
|
228
|
+
"wishlist": {},
|
|
229
|
+
"profile": {},
|
|
230
|
+
"logout": {},
|
|
231
|
+
"hello": {},
|
|
232
|
+
"first_name": {},
|
|
233
|
+
"last_name": {},
|
|
234
|
+
"avatar": {},
|
|
235
|
+
"badges": {},
|
|
236
|
+
"OrderUpdate": {}
|
|
237
|
+
}; }
|
|
238
|
+
static get elementRef() { return "host"; }
|
|
239
|
+
}
|
|
@@ -4,32 +4,35 @@
|
|
|
4
4
|
import './app';
|
|
5
5
|
salla.event.setMaxListeners(100);
|
|
6
6
|
export default function () {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
7
|
+
salla.init({
|
|
8
|
+
debug: true,
|
|
9
|
+
store: {
|
|
10
|
+
url: process.env.URL,
|
|
11
|
+
api: process.env.API,
|
|
12
|
+
id: process.env.STORE_ID,
|
|
13
|
+
logo: "https://salla-dev.s3.eu-central-1.amazonaws.com/logo/logo-fashion.jpg",
|
|
14
|
+
},
|
|
15
|
+
user: {
|
|
16
|
+
// todo :: read the user data from storage
|
|
17
|
+
avatar: "https://cdn.salla.sa/customer_profiles/9itOm11DeKS87n8kNkMjIarFZa8bSBMqW02IKq58.png",
|
|
18
|
+
birthday: "1986-02-11",
|
|
19
|
+
currency: "SAR",
|
|
20
|
+
email: "demo@demo.com",
|
|
21
|
+
first_name: "DEEmo",
|
|
22
|
+
gender: "male",
|
|
23
|
+
id: 1938424344,
|
|
24
|
+
language: "ar",
|
|
25
|
+
last_name: "Account",
|
|
26
|
+
phone: { code: "+966", number: 555555555, country: "SA" }
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
// this is required to bypass cloudflare in stage
|
|
30
|
+
if (salla.api.axios) {
|
|
31
|
+
salla.api.axios.defaults.headers.common['CF-Access-Client-Id'] = process.env.CF_ACCESS_ID;
|
|
32
|
+
salla.api.axios.defaults.headers.common['CF-Access-Client-Secret'] = process.env.CF_ACCESS_SECRET;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
salla.api.defaults.headers.common['CF-Access-Client-Id'] = process.env.CF_ACCESS_ID;
|
|
36
|
+
salla.api.defaults.headers.common['CF-Access-Client-Secret'] = process.env.CF_ACCESS_SECRET;
|
|
37
|
+
}
|
|
35
38
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
const BellRing = `<!-- Generated by IcoMoon.io -->
|
|
5
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
6
|
+
<title>bell-ring</title>
|
|
7
|
+
<path d="M2.667 13.333v-4c0-2.592 0.748-5.107 2.161-7.271 0.404-0.616 0.231-1.443-0.387-1.845-0.616-0.401-1.443-0.228-1.845 0.388-1.699 2.599-2.596 5.617-2.596 8.728v4c0 0.736 0.596 1.333 1.333 1.333s1.333-0.596 1.333-1.333zM25.333 15.647v-6.313c0-5.147-4.188-9.333-9.333-9.333s-9.333 4.187-9.333 9.333v6.312l-5.157 9.027c-0.236 0.413-0.235 0.92 0.004 1.331 0.239 0.412 0.679 0.664 1.153 0.664h8c0 2.941 2.392 5.333 5.333 5.333s5.333-2.392 5.333-5.333h8c0.475 0 0.915-0.252 1.153-0.664 0.239-0.411 0.24-0.917 0.004-1.331zM16 29.333c-1.471 0-2.667-1.196-2.667-2.667h5.333c0 1.472-1.196 2.667-2.667 2.667zM4.965 24l4.193-7.339c0.113-0.2 0.175-0.429 0.175-0.661v-6.667c0-3.676 2.991-6.667 6.667-6.667s6.667 2.991 6.667 6.667v6.667c0 0.232 0.061 0.46 0.176 0.661l4.192 7.339zM29.403 0.603c-0.403-0.616-1.232-0.789-1.845-0.387-0.617 0.403-0.791 1.229-0.387 1.845 1.415 2.165 2.163 4.68 2.163 7.272v4c0 0.736 0.596 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-4c0-3.112-0.899-6.132-2.597-8.731z"></path>
|
|
8
|
+
</svg>
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
export { BellRing as B };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
const PendingOrdersIcon = `<!-- Generated by IcoMoon.io -->
|
|
5
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="30" height="32" viewBox="0 0 30 32">
|
|
6
|
+
<title>cart</title>
|
|
7
|
+
<path d="M15.426 28.084c0-1.412-0.85-2.684-2.156-3.226-1.305-0.54-2.807-0.241-3.805 0.758-0.999 0.998-1.298 2.5-0.758 3.805 0.54 1.303 1.815 2.155 3.226 2.155 1.928-0.003 3.49-1.564 3.492-3.492h0.001zM10.597 28.084h0.001c0-0.54 0.326-1.027 0.825-1.235 0.498-0.206 1.074-0.091 1.455 0.29 0.383 0.382 0.497 0.957 0.29 1.456-0.208 0.5-0.695 0.825-1.235 0.825-0.355 0-0.695-0.142-0.944-0.391-0.251-0.251-0.392-0.591-0.392-0.946h-0.001l0.001 0.001zM28.23 28.084c0-1.412-0.85-2.684-2.155-3.226-1.305-0.54-2.807-0.241-3.806 0.758s-1.297 2.5-0.756 3.805c0.54 1.303 1.813 2.155 3.226 2.155 1.927-0.003 3.49-1.564 3.491-3.492zM23.401 28.084c0-0.54 0.326-1.027 0.825-1.235 0.5-0.206 1.075-0.091 1.457 0.29s0.497 0.957 0.289 1.456c-0.206 0.5-0.693 0.825-1.233 0.825-0.738 0-1.337-0.599-1.337-1.337l-0.001 0.001zM1.953 0.234l-0.342-0.059c-0.29-0.064-0.594-0.004-0.839 0.166-0.247 0.169-0.414 0.436-0.463 0.734-0.050 0.3 0.023 0.607 0.201 0.85s0.444 0.402 0.738 0.44l0.341 0.059c1.825 0.324 3.248 1.794 3.548 3.662l1.981 12.369h-0.001c0.218 1.387 0.913 2.651 1.96 3.563s2.379 1.412 3.754 1.41h14.242c0.601 0 1.088-0.498 1.088-1.112s-0.487-1.112-1.088-1.112h-14.242c-1.679-0.001-3.139-1.183-3.525-2.854h11.463c1.614 0.004 3.188-0.518 4.493-1.49 1.305-0.973 2.271-2.346 2.762-3.918l1.298-4.136c0.145-0.455 0.065-0.953-0.213-1.336-0.278-0.385-0.72-0.608-1.187-0.602h-20.467l-0.181-1.141c-0.218-1.367-0.849-2.631-1.802-3.615-0.954-0.983-2.184-1.64-3.518-1.878h-0.001zM26.946 9.096l-0.993 3.169v-0.001c-0.353 1.122-1.044 2.101-1.975 2.796s-2.056 1.067-3.208 1.067h-11.833l-1.125-7.042 19.134 0.011z"></path>
|
|
8
|
+
</svg>
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
export { PendingOrdersIcon as P };
|
|
@@ -26,6 +26,7 @@ export { SallaRatingStars as SallaRatingStars } from '../types/components/salla-
|
|
|
26
26
|
export { SallaScopees as SallaScopes } from '../types/components/salla-scopes/salla-scopes';
|
|
27
27
|
export { SallaSearch as SallaSearch } from '../types/components/salla-search/salla-search';
|
|
28
28
|
export { SallaSelect as SallaSelect } from '../types/components/salla-select/salla-select';
|
|
29
|
+
export { SallaSheet as SallaSheet } from '../types/components/salla-sheet/salla-sheet';
|
|
29
30
|
export { SallaSkeleton as SallaSkeleton } from '../types/components/salla-skeleton/salla-skeleton';
|
|
30
31
|
export { SallaSocialShare as SallaSocialShare } from '../types/components/salla-social-share/salla-social-share';
|
|
31
32
|
export { SallaSwiper as SallaSwiper } from '../types/components/salla-swiper/salla-swiper';
|
|
@@ -33,6 +34,7 @@ export { SallaTabContent as SallaTabContent } from '../types/components/salla-ta
|
|
|
33
34
|
export { SallaTabHeader as SallaTabHeader } from '../types/components/salla-tabs/salla-tab-header';
|
|
34
35
|
export { SallaTabs as SallaTabs } from '../types/components/salla-tabs/salla-tabs';
|
|
35
36
|
export { SallaTelInput as SallaTelInput } from '../types/components/salla-tel-input/salla-tel-input';
|
|
37
|
+
export { SallaUserMenu as SallaUserMenu } from '../types/components/salla-user-menu/salla-user-menu';
|
|
36
38
|
export { SallaUserSettings as SallaUserSettings } from '../types/components/salla-user-settings/salla-user-settings';
|
|
37
39
|
export { SallaVerify as SallaVerify } from '../types/components/salla-verify/salla-verify';
|
|
38
40
|
|