@kompasid/lit-web-components 0.6.3 → 0.6.6
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/assets/kompas-free-trial.png +0 -0
- package/assets/qr-code.png +0 -0
- package/demo/index.html +33 -2
- package/dist/src/components/kompasid-header-account/KompasHeaderAccount.d.ts +27 -0
- package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js +233 -0
- package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js.map +1 -0
- package/dist/src/components/kompasid-header-account/types.d.ts +8 -0
- package/dist/src/components/kompasid-header-account/types.js +2 -0
- package/dist/src/components/kompasid-header-account/types.js.map +1 -0
- package/dist/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.d.ts +13 -0
- package/dist/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.js +172 -0
- package/dist/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.js.map +1 -0
- package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.d.ts +37 -0
- package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.js +185 -0
- package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.js.map +1 -0
- package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.d.ts +12 -0
- package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js +172 -0
- package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js.map +1 -0
- package/dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.js +8 -8
- package/dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.js.map +1 -1
- package/dist/src/components/kompasid-paywall/KompasPaywall.js +7 -20
- package/dist/src/components/kompasid-paywall/KompasPaywall.js.map +1 -1
- package/dist/src/components/kompasid-paywall/types.d.ts +5 -0
- package/dist/src/components/kompasid-paywall/types.js.map +1 -1
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.d.ts +4 -0
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +178 -28
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/utils/text.d.ts +2 -0
- package/dist/src/utils/text.js +9 -0
- package/dist/src/utils/text.js.map +1 -0
- package/dist/tailwind/tailwind.js +391 -5
- package/dist/tailwind/tailwind.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/kompasid-header-account/KompasHeaderAccount.ts +197 -0
- package/src/components/kompasid-header-account/types.ts +8 -0
- package/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.ts +177 -0
- package/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.ts +172 -0
- package/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.ts +161 -0
- package/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.ts +8 -8
- package/src/components/kompasid-paywall/KompasPaywall.ts +7 -20
- package/src/components/kompasid-paywall/types.ts +5 -0
- package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +189 -36
- package/src/index.ts +1 -0
- package/src/utils/text.ts +9 -0
- package/tailwind/tailwind.css +382 -5
- package/tailwind/tailwind.ts +391 -5
|
Binary file
|
|
Binary file
|
package/demo/index.html
CHANGED
|
@@ -51,8 +51,9 @@
|
|
|
51
51
|
import '../dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.js'
|
|
52
52
|
import '../dist/src/components/kompasid-freewall/KompasFreewall.js'
|
|
53
53
|
import '../dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.js'
|
|
54
|
+
import '../dist/src/components/kompasid-header-account/KompasHeaderAccount.js'
|
|
54
55
|
|
|
55
|
-
const type = '
|
|
56
|
+
const type = 'reguler'
|
|
56
57
|
const theme = ''
|
|
57
58
|
const paywallLocation = 'paywall_location'
|
|
58
59
|
const paywallSubscriptionId = 'testId'
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
const textHeader = 'this is message for header information'
|
|
78
79
|
const userGuid = '111000'
|
|
79
80
|
const trackerSubscriptionStatus = 'register'
|
|
80
|
-
const swgEnable =
|
|
81
|
+
const swgEnable = false
|
|
81
82
|
const videoPaywallType = 'homepage'
|
|
82
83
|
const freewallType = 'landing_page'
|
|
83
84
|
const headCopyExpand = ''
|
|
@@ -88,9 +89,39 @@
|
|
|
88
89
|
const trackerContentEditors = 'Editor 1|Editor 2'
|
|
89
90
|
const trackerContentTags = 'Tag1|Tag2|Tag3'
|
|
90
91
|
const trackerContentPublishedDate = '2023-10-12'
|
|
92
|
+
const cartUrl="/cart"
|
|
93
|
+
const logoutUrl="/logout"
|
|
94
|
+
const manageAccountUrl="/manage-count"
|
|
95
|
+
const notificationUrl="/notif"
|
|
96
|
+
const notificationTotal="10"
|
|
97
|
+
const ordersUrl="/orders"
|
|
98
|
+
const subscriptionUrl=""
|
|
99
|
+
const readLaterUrl="/baca-nanti"
|
|
100
|
+
const totalGracePeriod="5"
|
|
101
|
+
|
|
102
|
+
const userData = {
|
|
103
|
+
userName: 'User Fullname',
|
|
104
|
+
expired: 'Berakhir: 6 hari lagi',
|
|
105
|
+
isNearExpired: false,
|
|
106
|
+
activeInfo: 'Kompas Digital Premium 1 Bulan - Auto Renewal Example Text',
|
|
107
|
+
isMembership: true,
|
|
108
|
+
updateMembership: 'Perbarui Langganan',
|
|
109
|
+
}
|
|
91
110
|
|
|
92
111
|
render(
|
|
93
112
|
html`
|
|
113
|
+
<kompasid-header-account
|
|
114
|
+
.userData=${userData}
|
|
115
|
+
.cart_url=${cartUrl}
|
|
116
|
+
.logout_url=${logoutUrl}
|
|
117
|
+
.manage_account_url=${manageAccountUrl}
|
|
118
|
+
.notification_url=${notificationUrl}
|
|
119
|
+
.notification_total=${notificationTotal}
|
|
120
|
+
.orders_url=${ordersUrl}
|
|
121
|
+
.subscription_url=${subscriptionUrl}
|
|
122
|
+
.read_later_url=${readLaterUrl}
|
|
123
|
+
.total_grace_period=${totalGracePeriod}
|
|
124
|
+
></kompasid-header-account>
|
|
94
125
|
<kompasid-paywall
|
|
95
126
|
.type=${type}
|
|
96
127
|
.theme=${theme}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { User } from './types.js';
|
|
3
|
+
import '../kompasid-header-account-profile/KompasHeaderAccountProfile.js';
|
|
4
|
+
import '../kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.js';
|
|
5
|
+
import '../kompasid-header-account-menu/KompasHeaderAccountMenu.js';
|
|
6
|
+
export declare class KompasHeaderAccount extends LitElement {
|
|
7
|
+
static styles: import("lit").CSSResult[];
|
|
8
|
+
isShowSidebar: boolean;
|
|
9
|
+
formattedUserData: User;
|
|
10
|
+
cartUrl: string;
|
|
11
|
+
logoutUrl: string;
|
|
12
|
+
manageAccountUrl: string;
|
|
13
|
+
notificationTotal: number;
|
|
14
|
+
notificationUrl: string;
|
|
15
|
+
ordersUrl: string;
|
|
16
|
+
readLaterUrl: string;
|
|
17
|
+
userData: {};
|
|
18
|
+
sidebarTopSpacing: number;
|
|
19
|
+
subscriptionUrl: string;
|
|
20
|
+
totalGracePeriod: number;
|
|
21
|
+
private toggleSidebar;
|
|
22
|
+
private getInitialUserName;
|
|
23
|
+
private account;
|
|
24
|
+
private accountSidebar;
|
|
25
|
+
connectedCallback(): Promise<void>;
|
|
26
|
+
render(): import("lit").TemplateResult<1>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { LitElement, html, css } from 'lit';
|
|
3
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
4
|
+
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
5
|
+
import { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js';
|
|
6
|
+
import { TWStyles } from '../../../tailwind/tailwind.js';
|
|
7
|
+
import '../kompasid-header-account-profile/KompasHeaderAccountProfile.js';
|
|
8
|
+
import '../kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.js';
|
|
9
|
+
import '../kompasid-header-account-menu/KompasHeaderAccountMenu.js';
|
|
10
|
+
let KompasHeaderAccount = class KompasHeaderAccount extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.isShowSidebar = false;
|
|
14
|
+
this.formattedUserData = {};
|
|
15
|
+
this.cartUrl = '';
|
|
16
|
+
this.logoutUrl = '';
|
|
17
|
+
this.manageAccountUrl = '';
|
|
18
|
+
this.notificationTotal = 0;
|
|
19
|
+
this.notificationUrl = '';
|
|
20
|
+
this.ordersUrl = '';
|
|
21
|
+
this.readLaterUrl = '';
|
|
22
|
+
this.userData = {};
|
|
23
|
+
this.sidebarTopSpacing = 0;
|
|
24
|
+
this.subscriptionUrl = '';
|
|
25
|
+
this.totalGracePeriod = 0;
|
|
26
|
+
}
|
|
27
|
+
toggleSidebar() {
|
|
28
|
+
this.isShowSidebar = !this.isShowSidebar;
|
|
29
|
+
}
|
|
30
|
+
getInitialUserName() {
|
|
31
|
+
var _a;
|
|
32
|
+
return ((_a = this.formattedUserData) === null || _a === void 0 ? void 0 : _a.userName)
|
|
33
|
+
? this.formattedUserData.userName.charAt(0)
|
|
34
|
+
: '';
|
|
35
|
+
}
|
|
36
|
+
account() {
|
|
37
|
+
const notificationIndicator = () => {
|
|
38
|
+
if (!this.notificationTotal)
|
|
39
|
+
return html ``;
|
|
40
|
+
return html `<div class="header-account--notification-indicator"></div>`;
|
|
41
|
+
};
|
|
42
|
+
const membershipIcon = () => {
|
|
43
|
+
var _a;
|
|
44
|
+
if (!((_a = this.formattedUserData) === null || _a === void 0 ? void 0 : _a.isMembership))
|
|
45
|
+
return html ``;
|
|
46
|
+
return html `
|
|
47
|
+
<div>
|
|
48
|
+
<img
|
|
49
|
+
class="header-account--membership-icon h-2.5 w-2.5"
|
|
50
|
+
src="https://d3w4qaq4xm1ncv.cloudfront.net/global-header/crown-royal-blue-60.svg"
|
|
51
|
+
alt="membership-crown-icon"
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
`;
|
|
55
|
+
};
|
|
56
|
+
return html `
|
|
57
|
+
<button @click=${this.toggleSidebar} class="cursor-pointer p-3">
|
|
58
|
+
<div class="flex flex-row items-center self-center">
|
|
59
|
+
${!this.getInitialUserName()
|
|
60
|
+
? html `<div
|
|
61
|
+
class="bg-grey-300 rounded-full h-6 w-6 animate-pulse"
|
|
62
|
+
></div>`
|
|
63
|
+
: html `
|
|
64
|
+
<div
|
|
65
|
+
class="flex bg-grey-100 rounded-full h-6 w-6 items-center justify-center relative"
|
|
66
|
+
>
|
|
67
|
+
<span class="capitalize text-xxs text-blue-600 font-bold"
|
|
68
|
+
>${this.getInitialUserName()}</span
|
|
69
|
+
>
|
|
70
|
+
${notificationIndicator()} ${membershipIcon()}
|
|
71
|
+
</div>
|
|
72
|
+
`}
|
|
73
|
+
<div
|
|
74
|
+
class="ml-3 icon-xs text-white chevron-icon ${this.isShowSidebar
|
|
75
|
+
? 'chevron-down'
|
|
76
|
+
: 'rotate-180'}"
|
|
77
|
+
>
|
|
78
|
+
${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-up'))}
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</button>
|
|
82
|
+
`;
|
|
83
|
+
}
|
|
84
|
+
accountSidebar() {
|
|
85
|
+
return html `
|
|
86
|
+
<nav @keyup="${this.onkeyup}" @click=${this.toggleSidebar}>
|
|
87
|
+
<div
|
|
88
|
+
@keyup="${this.onkeyup}"
|
|
89
|
+
class="bg-grey-100 pb-20 pt-0 shadow-lg w-76 z-99 ml-auto"
|
|
90
|
+
style=${`margin-top: ${this.sidebarTopSpacing}px`}
|
|
91
|
+
@click=${(ev) => ev.stopPropagation()}
|
|
92
|
+
>
|
|
93
|
+
<kompasid-header-account-profile
|
|
94
|
+
.userInitialName=${this.getInitialUserName()}
|
|
95
|
+
.userData=${this.formattedUserData}
|
|
96
|
+
.subscriptionUrl=${this.subscriptionUrl}
|
|
97
|
+
.totalGracePeriod=${this.totalGracePeriod}
|
|
98
|
+
></kompasid-header-account-profile>
|
|
99
|
+
<div class="pl-4 pr-3 py-4 text-left">
|
|
100
|
+
<kompasid-header-account-menu
|
|
101
|
+
.cart-url=${this.cartUrl}
|
|
102
|
+
.manage-account-url=${this.manageAccountUrl}
|
|
103
|
+
.logout-url=${this.logoutUrl}
|
|
104
|
+
.notification-url=${this.notificationUrl}
|
|
105
|
+
.notification-total=${this.notificationTotal}
|
|
106
|
+
.orders-url=${this.ordersUrl}
|
|
107
|
+
.read-later-url=${this.readLaterUrl}
|
|
108
|
+
></kompasid-header-account-menu>
|
|
109
|
+
<kompasid-header-account-help-center></kompasid-header-account-help-center>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</nav>
|
|
113
|
+
`;
|
|
114
|
+
}
|
|
115
|
+
async connectedCallback() {
|
|
116
|
+
super.connectedCallback();
|
|
117
|
+
this.isShowSidebar = false;
|
|
118
|
+
if (typeof this.userData === 'string') {
|
|
119
|
+
this.formattedUserData = JSON.parse(this.userData);
|
|
120
|
+
}
|
|
121
|
+
else if (typeof this.userData === 'object' && this.userData !== null) {
|
|
122
|
+
// If userData is already an object, you might not need to parse it.
|
|
123
|
+
// You can assign it directly to formattedUserData:
|
|
124
|
+
this.formattedUserData = this.userData;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
render() {
|
|
128
|
+
return html `
|
|
129
|
+
<header class="header flex flex-row justify-end h-[49px] relative z-50">
|
|
130
|
+
<div class="text-end">
|
|
131
|
+
${this.account()} ${this.isShowSidebar ? this.accountSidebar() : ''}
|
|
132
|
+
</div>
|
|
133
|
+
</header>
|
|
134
|
+
`;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
KompasHeaderAccount.styles = [
|
|
138
|
+
css `
|
|
139
|
+
:host {
|
|
140
|
+
font-family: 'PT Sans', sans-serif;
|
|
141
|
+
}
|
|
142
|
+
.header {
|
|
143
|
+
background-color: #0356a8;
|
|
144
|
+
}
|
|
145
|
+
.account-profile {
|
|
146
|
+
overflow-y: auto;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.header-account-help-center--item {
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: row;
|
|
152
|
+
align-items: center;
|
|
153
|
+
padding: 0.75rem;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.header-account-help-center--content {
|
|
157
|
+
display: flex;
|
|
158
|
+
flex-direction: column;
|
|
159
|
+
flex-grow: 1;
|
|
160
|
+
margin-left: 1rem;
|
|
161
|
+
line-height: 1.5rem;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.header-account--membership-icon {
|
|
165
|
+
position: absolute;
|
|
166
|
+
bottom: -2px;
|
|
167
|
+
right: -2px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.header-account--notification-indicator {
|
|
171
|
+
position: absolute;
|
|
172
|
+
top: 0;
|
|
173
|
+
height: 0.5rem;
|
|
174
|
+
width: 0.5rem;
|
|
175
|
+
background-color: #f6ad55;
|
|
176
|
+
border-radius: 50%;
|
|
177
|
+
right: -0.563rem;
|
|
178
|
+
top: -0.281rem;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.header-account-sidebar {
|
|
182
|
+
width: 19rem;
|
|
183
|
+
background-color: #edf2f7;
|
|
184
|
+
box-shadow: 0px 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
|
|
185
|
+
display: flex;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
font-family: 'PT Sans', sans-serif;
|
|
188
|
+
font-size: 0.875rem;
|
|
189
|
+
}
|
|
190
|
+
`,
|
|
191
|
+
TWStyles,
|
|
192
|
+
];
|
|
193
|
+
__decorate([
|
|
194
|
+
state()
|
|
195
|
+
], KompasHeaderAccount.prototype, "isShowSidebar", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
property({ type: String })
|
|
198
|
+
], KompasHeaderAccount.prototype, "cartUrl", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
property({ type: String })
|
|
201
|
+
], KompasHeaderAccount.prototype, "logoutUrl", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
property({ type: String })
|
|
204
|
+
], KompasHeaderAccount.prototype, "manageAccountUrl", void 0);
|
|
205
|
+
__decorate([
|
|
206
|
+
property({ type: Number })
|
|
207
|
+
], KompasHeaderAccount.prototype, "notificationTotal", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
property({ type: String })
|
|
210
|
+
], KompasHeaderAccount.prototype, "notificationUrl", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
property({ type: String })
|
|
213
|
+
], KompasHeaderAccount.prototype, "ordersUrl", void 0);
|
|
214
|
+
__decorate([
|
|
215
|
+
property({ type: String })
|
|
216
|
+
], KompasHeaderAccount.prototype, "readLaterUrl", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
property({ type: Object })
|
|
219
|
+
], KompasHeaderAccount.prototype, "userData", void 0);
|
|
220
|
+
__decorate([
|
|
221
|
+
property({ type: Number })
|
|
222
|
+
], KompasHeaderAccount.prototype, "sidebarTopSpacing", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
property({ type: String })
|
|
225
|
+
], KompasHeaderAccount.prototype, "subscriptionUrl", void 0);
|
|
226
|
+
__decorate([
|
|
227
|
+
property({ type: Number })
|
|
228
|
+
], KompasHeaderAccount.prototype, "totalGracePeriod", void 0);
|
|
229
|
+
KompasHeaderAccount = __decorate([
|
|
230
|
+
customElement('kompasid-header-account')
|
|
231
|
+
], KompasHeaderAccount);
|
|
232
|
+
export { KompasHeaderAccount };
|
|
233
|
+
//# sourceMappingURL=KompasHeaderAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KompasHeaderAccount.js","sourceRoot":"","sources":["../../../../src/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AC;4DAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAAqB;AAxErC,mBAAmB;IAD/B,aAAa,CAAC,yBAAyB,CAAC;GAC5B,mBAAmB,CAyL/B;SAzLY,mBAAmB","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'\nimport { User } from './types.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport '../kompasid-header-account-profile/KompasHeaderAccountProfile.js'\nimport '../kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.js'\nimport '../kompasid-header-account-menu/KompasHeaderAccountMenu.js'\n\n@customElement('kompasid-header-account')\nexport class KompasHeaderAccount extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n .header {\n background-color: #0356a8;\n }\n .account-profile {\n overflow-y: auto;\n }\n\n .header-account-help-center--item {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0.75rem;\n }\n\n .header-account-help-center--content {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n margin-left: 1rem;\n line-height: 1.5rem;\n }\n\n .header-account--membership-icon {\n position: absolute;\n bottom: -2px;\n right: -2px;\n }\n\n .header-account--notification-indicator {\n position: absolute;\n top: 0;\n height: 0.5rem;\n width: 0.5rem;\n background-color: #f6ad55;\n border-radius: 50%;\n right: -0.563rem;\n top: -0.281rem;\n }\n\n .header-account-sidebar {\n width: 19rem;\n background-color: #edf2f7;\n box-shadow: 0px 0.125rem 0.25rem rgba(0, 0, 0, 0.1);\n display: flex;\n flex-direction: column;\n font-family: 'PT Sans', sans-serif;\n font-size: 0.875rem;\n }\n `,\n TWStyles,\n ]\n\n @state() isShowSidebar: boolean = false\n\n formattedUserData: User = {} as User\n\n @property({ type: String }) cartUrl = ''\n @property({ type: String }) logoutUrl = ''\n @property({ type: String }) manageAccountUrl = ''\n @property({ type: Number }) notificationTotal = 0\n @property({ type: String }) notificationUrl = ''\n @property({ type: String }) ordersUrl = ''\n @property({ type: String }) readLaterUrl = ''\n @property({ type: Object }) userData = {}\n @property({ type: Number }) sidebarTopSpacing = 0\n @property({ type: String }) subscriptionUrl = ''\n @property({ type: Number }) totalGracePeriod = 0\n\n private toggleSidebar() {\n this.isShowSidebar = !this.isShowSidebar\n }\n\n private getInitialUserName() {\n return this.formattedUserData?.userName\n ? this.formattedUserData.userName.charAt(0)\n : ''\n }\n\n private account() {\n const notificationIndicator = () => {\n if (!this.notificationTotal) return html``\n return html`<div class=\"header-account--notification-indicator\"></div>`\n }\n\n const membershipIcon = () => {\n if (!this.formattedUserData?.isMembership) return html``\n return html`\n <div>\n <img\n class=\"header-account--membership-icon h-2.5 w-2.5\"\n src=\"https://d3w4qaq4xm1ncv.cloudfront.net/global-header/crown-royal-blue-60.svg\"\n alt=\"membership-crown-icon\"\n />\n </div>\n `\n }\n\n return html`\n <button @click=${this.toggleSidebar} class=\"cursor-pointer p-3\">\n <div class=\"flex flex-row items-center self-center\">\n ${!this.getInitialUserName()\n ? html`<div\n class=\"bg-grey-300 rounded-full h-6 w-6 animate-pulse\"\n ></div>`\n : html`\n <div\n class=\"flex bg-grey-100 rounded-full h-6 w-6 items-center justify-center relative\"\n >\n <span class=\"capitalize text-xxs text-blue-600 font-bold\"\n >${this.getInitialUserName()}</span\n >\n ${notificationIndicator()} ${membershipIcon()}\n </div>\n `}\n <div\n class=\"ml-3 icon-xs text-white chevron-icon ${this.isShowSidebar\n ? 'chevron-down'\n : 'rotate-180'}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-up'))}\n </div>\n </div>\n </button>\n `\n }\n\n private accountSidebar() {\n return html`\n <nav @keyup=\"${this.onkeyup}\" @click=${this.toggleSidebar}>\n <div\n @keyup=\"${this.onkeyup}\"\n class=\"bg-grey-100 pb-20 pt-0 shadow-lg w-76 z-99 ml-auto\"\n style=${`margin-top: ${this.sidebarTopSpacing}px`}\n @click=${(ev: any) => ev.stopPropagation()}\n >\n <kompasid-header-account-profile\n .userInitialName=${this.getInitialUserName()}\n .userData=${this.formattedUserData}\n .subscriptionUrl=${this.subscriptionUrl}\n .totalGracePeriod=${this.totalGracePeriod}\n ></kompasid-header-account-profile>\n <div class=\"pl-4 pr-3 py-4 text-left\">\n <kompasid-header-account-menu\n .cart-url=${this.cartUrl}\n .manage-account-url=${this.manageAccountUrl}\n .logout-url=${this.logoutUrl}\n .notification-url=${this.notificationUrl}\n .notification-total=${this.notificationTotal}\n .orders-url=${this.ordersUrl}\n .read-later-url=${this.readLaterUrl}\n ></kompasid-header-account-menu>\n <kompasid-header-account-help-center></kompasid-header-account-help-center>\n </div>\n </div>\n </nav>\n `\n }\n\n override async connectedCallback() {\n super.connectedCallback()\n this.isShowSidebar = false\n if (typeof this.userData === 'string') {\n this.formattedUserData = JSON.parse(this.userData)\n } else if (typeof this.userData === 'object' && this.userData !== null) {\n // If userData is already an object, you might not need to parse it.\n // You can assign it directly to formattedUserData:\n this.formattedUserData = this.userData as User\n }\n }\n\n render() {\n return html`\n <header class=\"header flex flex-row justify-end h-[49px] relative z-50\">\n <div class=\"text-end\">\n ${this.account()} ${this.isShowSidebar ? this.accountSidebar() : ''}\n </div>\n </header>\n `\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/kompasid-header-account/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface User {\n userName: string\n expired: string\n isNearExpired: boolean\n activeInfo: string\n isMembership: boolean\n updateMembership: string\n}\n"]}
|
package/dist/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class KompasHeaderAccountHelpCenter extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult[];
|
|
4
|
+
kompasKring?: HTMLInputElement;
|
|
5
|
+
clipboardClicked: boolean;
|
|
6
|
+
private qna;
|
|
7
|
+
private telephone;
|
|
8
|
+
private whatsapp;
|
|
9
|
+
private email;
|
|
10
|
+
private workingHour;
|
|
11
|
+
connectedCallback(): Promise<void>;
|
|
12
|
+
render(): import("lit").TemplateResult<1>;
|
|
13
|
+
}
|
package/dist/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.js
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { LitElement, html, css } from 'lit';
|
|
3
|
+
import { customElement, state } from 'lit/decorators.js';
|
|
4
|
+
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
5
|
+
import { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js';
|
|
6
|
+
import { TWStyles } from '../../../tailwind/tailwind.js';
|
|
7
|
+
let KompasHeaderAccountHelpCenter = class KompasHeaderAccountHelpCenter extends LitElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.clipboardClicked = false;
|
|
11
|
+
// Q & A
|
|
12
|
+
this.qna = () => html ` <div class="header-account-help-center--item">
|
|
13
|
+
<div class="icon">
|
|
14
|
+
${unsafeSVG(getFontAwesomeIcon('fas', 'comments'))}
|
|
15
|
+
</div>
|
|
16
|
+
<div
|
|
17
|
+
class="header-account-help-center--content mx-4 leading-4 gap-y-2 text-base"
|
|
18
|
+
>
|
|
19
|
+
<p>Tanya Jawab</p>
|
|
20
|
+
<a href="http://kb.kompas.id/" class="font-bold hover:underline"
|
|
21
|
+
>http://kb.kompas.id/</a
|
|
22
|
+
>
|
|
23
|
+
</div>
|
|
24
|
+
</div>`;
|
|
25
|
+
// Telephone
|
|
26
|
+
this.telephone = () => {
|
|
27
|
+
// Clipboard Action
|
|
28
|
+
const clipboardAction = async () => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
const phoneNumberCopy = (_b = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('kompasKring')) === null || _b === void 0 ? void 0 : _b.innerHTML;
|
|
31
|
+
if (phoneNumberCopy) {
|
|
32
|
+
try {
|
|
33
|
+
await navigator.clipboard.writeText(phoneNumberCopy);
|
|
34
|
+
this.clipboardClicked = true;
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
this.clipboardClicked = false;
|
|
37
|
+
}, 2000);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
// Handle clipboard write error
|
|
41
|
+
console.error('Failed to copy to clipboard:', error);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
// Keyboard event handler
|
|
46
|
+
const handleKeyDown = (event) => {
|
|
47
|
+
if (event.key === 'Enter') {
|
|
48
|
+
clipboardAction();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
return html `<div class="header-account-help-center--item">
|
|
52
|
+
<div class="icon">${unsafeSVG(getFontAwesomeIcon('fas', 'phone'))}</div>
|
|
53
|
+
<div
|
|
54
|
+
class="relative header-account-help-center--content mx-4 leading-4 gap-y-2 text-base"
|
|
55
|
+
>
|
|
56
|
+
${this.clipboardClicked
|
|
57
|
+
? html `<p
|
|
58
|
+
class="absolute bg-grey-200 rounded-md h-full top-0 w-full flex items-center justify-center"
|
|
59
|
+
>
|
|
60
|
+
Berhasil menyalin!
|
|
61
|
+
</p>`
|
|
62
|
+
: html ``}
|
|
63
|
+
<p>Kompas Kring</p>
|
|
64
|
+
<p id="kompasKring" class="font-bold">+6221 2567 6000</p>
|
|
65
|
+
</div>
|
|
66
|
+
<div
|
|
67
|
+
class="bg-grey-200 px-3 py-2 rounded cursor-pointer"
|
|
68
|
+
@click=${clipboardAction}
|
|
69
|
+
@keydown=${handleKeyDown}
|
|
70
|
+
tabindex="0"
|
|
71
|
+
>
|
|
72
|
+
<div class="icon-sm icon-grey-600">
|
|
73
|
+
${unsafeSVG(getFontAwesomeIcon('fas', 'copy'))}
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</div>`;
|
|
77
|
+
};
|
|
78
|
+
// Whatsapp
|
|
79
|
+
this.whatsapp = () => html `<a
|
|
80
|
+
href="https://api.whatsapp.com/send?phone=6281290050800"
|
|
81
|
+
class="header-account-help-center--item"
|
|
82
|
+
>
|
|
83
|
+
<div class="icon">
|
|
84
|
+
${unsafeSVG(getFontAwesomeIcon('fab', 'whatsapp'))}
|
|
85
|
+
</div>
|
|
86
|
+
<div
|
|
87
|
+
class="header-account-help-center--content mx-4 leading-4 gap-y-2 text-base"
|
|
88
|
+
>
|
|
89
|
+
<p>Whatsapp</p>
|
|
90
|
+
<p class="font-bold hover:underline">+62812 900 50 800</p>
|
|
91
|
+
</div>
|
|
92
|
+
</a>`;
|
|
93
|
+
// Email
|
|
94
|
+
this.email = () => html `<a
|
|
95
|
+
href="mailto:hotline@kompas.id"
|
|
96
|
+
class="header-account-help-center--item"
|
|
97
|
+
>
|
|
98
|
+
<div class="icon-md text-brand-1">
|
|
99
|
+
${unsafeSVG(getFontAwesomeIcon('fas', 'envelope'))}
|
|
100
|
+
</div>
|
|
101
|
+
<div
|
|
102
|
+
class="header-account-help-center--content mx-4 leading-4 gap-y-2 text-base"
|
|
103
|
+
>
|
|
104
|
+
<p>Email</p>
|
|
105
|
+
<p class="font-bold hover:underline">hotline@kompas.id</p>
|
|
106
|
+
</div>
|
|
107
|
+
</a>`;
|
|
108
|
+
// Working Hour
|
|
109
|
+
this.workingHour = () => html `<div class="header-account-help-center--item">
|
|
110
|
+
<div class="icon-md text-brand-1">
|
|
111
|
+
${unsafeSVG(getFontAwesomeIcon('fas', 'clock'))}
|
|
112
|
+
</div>
|
|
113
|
+
<div class="flex flex-col mx-4 leading-4 gap-y-2 text-base">
|
|
114
|
+
<p>Jam Kerja</p>
|
|
115
|
+
<p class="font-bold">06.00 - 16.00 WIB</p>
|
|
116
|
+
</div>
|
|
117
|
+
</div>`;
|
|
118
|
+
}
|
|
119
|
+
async connectedCallback() {
|
|
120
|
+
super.connectedCallback();
|
|
121
|
+
}
|
|
122
|
+
render() {
|
|
123
|
+
return html `
|
|
124
|
+
<div
|
|
125
|
+
class="account-help-center-container text-left leading-none mt-4 text-grey-600"
|
|
126
|
+
>
|
|
127
|
+
<p class="text-base mx-1">Pusat Bantuan</p>
|
|
128
|
+
<div class="flex flex-col text-sm gap-y-4 my-4">
|
|
129
|
+
${this.qna()} ${this.telephone()} ${this.whatsapp()} ${this.email()}
|
|
130
|
+
${this.workingHour()}
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
`;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
KompasHeaderAccountHelpCenter.styles = [
|
|
137
|
+
css `
|
|
138
|
+
:host {
|
|
139
|
+
font-family: 'PT Sans', sans-serif;
|
|
140
|
+
}
|
|
141
|
+
.header-account-help-center--item {
|
|
142
|
+
display: flex;
|
|
143
|
+
flex-direction: row;
|
|
144
|
+
align-items: center;
|
|
145
|
+
padding: 0.75rem;
|
|
146
|
+
transition: background-color 0.3s ease-in-out;
|
|
147
|
+
border-radius: 0.25rem;
|
|
148
|
+
}
|
|
149
|
+
.header-account-help-center--item:hover {
|
|
150
|
+
background-color: #e5e7eb;
|
|
151
|
+
}
|
|
152
|
+
.header-help-center--content {
|
|
153
|
+
text-align: left;
|
|
154
|
+
}
|
|
155
|
+
.icon {
|
|
156
|
+
width: 20px;
|
|
157
|
+
height: 20px;
|
|
158
|
+
margin-top: auto;
|
|
159
|
+
margin-bottom: auto;
|
|
160
|
+
color: rgb(0 85 154);
|
|
161
|
+
}
|
|
162
|
+
`,
|
|
163
|
+
TWStyles,
|
|
164
|
+
];
|
|
165
|
+
__decorate([
|
|
166
|
+
state()
|
|
167
|
+
], KompasHeaderAccountHelpCenter.prototype, "clipboardClicked", void 0);
|
|
168
|
+
KompasHeaderAccountHelpCenter = __decorate([
|
|
169
|
+
customElement('kompasid-header-account-help-center')
|
|
170
|
+
], KompasHeaderAccountHelpCenter);
|
|
171
|
+
export { KompasHeaderAccountHelpCenter };
|
|
172
|
+
//# sourceMappingURL=KompasHeaderAccountHelpCenter.js.map
|
package/dist/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KompasHeaderAccountHelpCenter.js","sourceRoot":"","sources":["../../../../src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAGjD,IAAM,6BAA6B,GAAnC,MAAM,6BAA8B,SAAQ,UAAU;IAAtD;;QAiCI,qBAAgB,GAAY,KAAK,CAAA;QAE1C,QAAQ;QACA,QAAG,GAAG,GAAG,EAAE,CACjB,IAAI,CAAA;;UAEE,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;;;;;;;;;;WAU/C,CAAA;QAET,YAAY;QACJ,cA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EP,QAAQ;QACA,UAAK,GAAG,GAAG,EAAE,CACnB,IAAI,CAAA;;;;;UAKE,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;;;;;;;;SAQjD,CAAA;QAEP,eAAe;QACP,gBAAW,GAAG,GAAG,EAAE,CACzB,IAAI,CAAA;;UAEE,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;;;;;;WAM5C,CAAA;IAmBX,CAAC;IAjBU,KAAK,CAAC,iBAAiB;QAC9B,KAAK,CAAC,iBAAiB,EAAE,CAAA;IAC3B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;YAMH,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,SAAS,EAAE,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,KAAK,EAAE;YACjE,IAAI,CAAC,WAAW,EAAE;;;KAGzB,CAAA;IACH,CAAC;;AAvKM,oCAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;KAyBF;IACD,QAAQ;CACT,CAAA;AAIQ;IAAR,KAAK,EAAE;uEAAkC;AAjC/B,6BAA6B;IADzC,aAAa,CAAC,qCAAqC,CAAC;GACxC,6BAA6B,CAyKzC;SAzKY,6BAA6B","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\n\n@customElement('kompasid-header-account-help-center')\nexport class KompasHeaderAccountHelpCenter extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n .header-account-help-center--item {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0.75rem;\n transition: background-color 0.3s ease-in-out;\n border-radius: 0.25rem;\n }\n .header-account-help-center--item:hover {\n background-color: #e5e7eb;\n }\n .header-help-center--content {\n text-align: left;\n }\n .icon {\n width: 20px;\n height: 20px;\n margin-top: auto;\n margin-bottom: auto;\n color: rgb(0 85 154);\n }\n `,\n TWStyles,\n ]\n\n kompasKring?: HTMLInputElement\n\n @state() clipboardClicked: boolean = false\n\n // Q & A\n private qna = () =>\n html` <div class=\"header-account-help-center--item\">\n <div class=\"icon\">\n ${unsafeSVG(getFontAwesomeIcon('fas', 'comments'))}\n </div>\n <div\n class=\"header-account-help-center--content mx-4 leading-4 gap-y-2 text-base\"\n >\n <p>Tanya Jawab</p>\n <a href=\"http://kb.kompas.id/\" class=\"font-bold hover:underline\"\n >http://kb.kompas.id/</a\n >\n </div>\n </div>`\n\n // Telephone\n private telephone = () => {\n // Clipboard Action\n const clipboardAction = async () => {\n const phoneNumberCopy =\n this.shadowRoot?.getElementById('kompasKring')?.innerHTML\n if (phoneNumberCopy) {\n try {\n await navigator.clipboard.writeText(phoneNumberCopy)\n this.clipboardClicked = true\n setTimeout(() => {\n this.clipboardClicked = false\n }, 2000)\n } catch (error) {\n // Handle clipboard write error\n console.error('Failed to copy to clipboard:', error)\n }\n }\n }\n\n // Keyboard event handler\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n clipboardAction()\n }\n }\n\n return html`<div class=\"header-account-help-center--item\">\n <div class=\"icon\">${unsafeSVG(getFontAwesomeIcon('fas', 'phone'))}</div>\n <div\n class=\"relative header-account-help-center--content mx-4 leading-4 gap-y-2 text-base\"\n >\n ${this.clipboardClicked\n ? html`<p\n class=\"absolute bg-grey-200 rounded-md h-full top-0 w-full flex items-center justify-center\"\n >\n Berhasil menyalin!\n </p>`\n : html``}\n <p>Kompas Kring</p>\n <p id=\"kompasKring\" class=\"font-bold\">+6221 2567 6000</p>\n </div>\n <div\n class=\"bg-grey-200 px-3 py-2 rounded cursor-pointer\"\n @click=${clipboardAction}\n @keydown=${handleKeyDown}\n tabindex=\"0\"\n >\n <div class=\"icon-sm icon-grey-600\">\n ${unsafeSVG(getFontAwesomeIcon('fas', 'copy'))}\n </div>\n </div>\n </div>`\n }\n\n // Whatsapp\n private whatsapp = () =>\n html`<a\n href=\"https://api.whatsapp.com/send?phone=6281290050800\"\n class=\"header-account-help-center--item\"\n >\n <div class=\"icon\">\n ${unsafeSVG(getFontAwesomeIcon('fab', 'whatsapp'))}\n </div>\n <div\n class=\"header-account-help-center--content mx-4 leading-4 gap-y-2 text-base\"\n >\n <p>Whatsapp</p>\n <p class=\"font-bold hover:underline\">+62812 900 50 800</p>\n </div>\n </a>`\n\n // Email\n private email = () =>\n html`<a\n href=\"mailto:hotline@kompas.id\"\n class=\"header-account-help-center--item\"\n >\n <div class=\"icon-md text-brand-1\">\n ${unsafeSVG(getFontAwesomeIcon('fas', 'envelope'))}\n </div>\n <div\n class=\"header-account-help-center--content mx-4 leading-4 gap-y-2 text-base\"\n >\n <p>Email</p>\n <p class=\"font-bold hover:underline\">hotline@kompas.id</p>\n </div>\n </a>`\n\n // Working Hour\n private workingHour = () =>\n html`<div class=\"header-account-help-center--item\">\n <div class=\"icon-md text-brand-1\">\n ${unsafeSVG(getFontAwesomeIcon('fas', 'clock'))}\n </div>\n <div class=\"flex flex-col mx-4 leading-4 gap-y-2 text-base\">\n <p>Jam Kerja</p>\n <p class=\"font-bold\">06.00 - 16.00 WIB</p>\n </div>\n </div>`\n\n override async connectedCallback() {\n super.connectedCallback()\n }\n\n render() {\n return html`\n <div\n class=\"account-help-center-container text-left leading-none mt-4 text-grey-600\"\n >\n <p class=\"text-base mx-1\">Pusat Bantuan</p>\n <div class=\"flex flex-col text-sm gap-y-4 my-4\">\n ${this.qna()} ${this.telephone()} ${this.whatsapp()} ${this.email()}\n ${this.workingHour()}\n </div>\n </div>\n `\n }\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class KompasHeaderAccountMenu extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult[];
|
|
4
|
+
kompasKring?: HTMLInputElement;
|
|
5
|
+
clipboardClicked: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Cart Url
|
|
8
|
+
*/
|
|
9
|
+
cartUrl: string;
|
|
10
|
+
/**
|
|
11
|
+
* Logout Url
|
|
12
|
+
*/
|
|
13
|
+
logoutUrl: string;
|
|
14
|
+
/**
|
|
15
|
+
* Manage Account Url
|
|
16
|
+
*/
|
|
17
|
+
manageAccountUrl: string;
|
|
18
|
+
/**
|
|
19
|
+
* Notification Url
|
|
20
|
+
*/
|
|
21
|
+
notificationUrl: string;
|
|
22
|
+
/**
|
|
23
|
+
* Orders Url
|
|
24
|
+
*/
|
|
25
|
+
ordersUrl: string;
|
|
26
|
+
/**
|
|
27
|
+
* Read Later Url
|
|
28
|
+
*/
|
|
29
|
+
readLaterUrl: string;
|
|
30
|
+
/**
|
|
31
|
+
* Total Notification Count
|
|
32
|
+
*/
|
|
33
|
+
notificationTotal: number;
|
|
34
|
+
private renderTotalBubble;
|
|
35
|
+
connectedCallback(): Promise<void>;
|
|
36
|
+
render(): import("lit").TemplateResult<1>;
|
|
37
|
+
}
|