@kompasid/lit-web-components 0.9.47 → 0.9.49
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/demo/header.html +21 -5
- package/demo/paywall.html +3 -2
- package/dist/src/components/kompasid-header-account/KompasHeaderAccount.d.ts +1 -0
- package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js +8 -0
- package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js.map +1 -1
- package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.d.ts +1 -0
- package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.js +23 -6
- package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.js.map +1 -1
- package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.d.ts +3 -0
- package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js +83 -6
- package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js.map +1 -1
- package/dist/src/components/kompasid-paywall/KompasPaywall.js +0 -3
- package/dist/src/components/kompasid-paywall/KompasPaywall.js.map +1 -1
- package/dist/src/components/kompasid-paywall/types.d.ts +1 -0
- package/dist/src/components/kompasid-paywall/types.js.map +1 -1
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.d.ts +1 -0
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +22 -1
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
- package/dist/src/components/kompasid-paywall-modal-register/KompasPaywallModalRegister.d.ts +36 -0
- package/dist/src/components/kompasid-paywall-modal-register/KompasPaywallModalRegister.js +589 -0
- package/dist/src/components/kompasid-paywall-modal-register/KompasPaywallModalRegister.js.map +1 -0
- package/dist/src/components/kompasid-paywall-modal-register/types.d.ts +33 -0
- package/dist/src/components/kompasid-paywall-modal-register/types.js +2 -0
- package/dist/src/components/kompasid-paywall-modal-register/types.js.map +1 -0
- 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/tailwind/tailwind.js +160 -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 +5 -0
- package/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.ts +25 -8
- package/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.ts +78 -6
- package/src/components/kompasid-paywall/KompasPaywall.ts +0 -4
- package/src/components/kompasid-paywall/types.ts +1 -0
- package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +22 -1
- package/src/components/kompasid-paywall-modal-register/KompasPaywallModalRegister.ts +613 -0
- package/src/components/kompasid-paywall-modal-register/types.ts +39 -0
- package/src/index.ts +1 -0
- package/tailwind/tailwind.css +160 -5
- package/tailwind/tailwind.ts +160 -5
package/demo/header.html
CHANGED
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
import { format, addDays } from 'date-fns'
|
|
47
47
|
import { id } from 'date-fns/locale/id'
|
|
48
48
|
import '../dist/src/components/kompasid-header-account/KompasHeaderAccount.js'
|
|
49
|
+
import "../dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js"
|
|
49
50
|
import '../dist/src/components/kompasid-header-notification/KompasHeaderNotification.js'
|
|
50
51
|
|
|
51
52
|
const urlParams = new URLSearchParams(window.location.search);
|
|
@@ -102,14 +103,15 @@
|
|
|
102
103
|
let renderKey = 0
|
|
103
104
|
|
|
104
105
|
const cartUrl = '/cart'
|
|
105
|
-
const logoutUrl = '
|
|
106
|
-
const manageAccountUrl = '
|
|
106
|
+
const logoutUrl = ''
|
|
107
|
+
const manageAccountUrl = ''
|
|
107
108
|
const notificationUrl = '/notif'
|
|
108
109
|
const notificationTotal = '10'
|
|
109
110
|
const ordersUrl = '/orders'
|
|
111
|
+
const companyName = 'PT Toyota Motor Manufacturing Indonesia'
|
|
110
112
|
const subscriptionUrl = 'https://www.kompas.id/berlangganan/v2'
|
|
111
113
|
// const subscriptionUrl = 'https://www.kompas.cloud/berlangganan/v2'
|
|
112
|
-
const readLaterUrl = '
|
|
114
|
+
const readLaterUrl = ''
|
|
113
115
|
const totalGracePeriod = '5'
|
|
114
116
|
const paywallLocation = 'paywall'
|
|
115
117
|
const paywallSubscriptionPackage = 'kompasid'
|
|
@@ -156,6 +158,7 @@
|
|
|
156
158
|
.logout_url=${logoutUrl}
|
|
157
159
|
.read_later_url=${readLaterUrl}
|
|
158
160
|
.manage_account_url=${manageAccountUrl}
|
|
161
|
+
.company_name=${companyName}
|
|
159
162
|
sidebarTopSpacing="49"
|
|
160
163
|
.notification_url=${notificationUrl}
|
|
161
164
|
.notification_total=${notificationTotal}
|
|
@@ -188,7 +191,11 @@
|
|
|
188
191
|
)
|
|
189
192
|
}
|
|
190
193
|
|
|
191
|
-
|
|
194
|
+
function getInitialUserName(name) {
|
|
195
|
+
return name
|
|
196
|
+
? name.charAt(0)
|
|
197
|
+
: ''
|
|
198
|
+
}
|
|
192
199
|
|
|
193
200
|
function handleInput(e) {
|
|
194
201
|
try {
|
|
@@ -214,7 +221,16 @@
|
|
|
214
221
|
<button @click=${() => handleTemplateClick('tidakBerlangganan')}>Tidak berlangganan</button>
|
|
215
222
|
</div>
|
|
216
223
|
<textarea @input=${handleInput} .value=${JSON.stringify(userData, null, 2)} style="width: 100%; height: 200px; font-family: monospace;"></textarea>
|
|
217
|
-
|
|
224
|
+
<div style="max-width: 300px;">
|
|
225
|
+
<kompasid-header-account-profile
|
|
226
|
+
.userInitialName=${getInitialUserName(userData?.userName)}
|
|
227
|
+
.userData=${userData}
|
|
228
|
+
.theme=${headerTheme}
|
|
229
|
+
.company_name=${companyName}
|
|
230
|
+
.manage_account_url=${manageAccountUrl}
|
|
231
|
+
></kompasid-header-account-profile>
|
|
232
|
+
</div>
|
|
233
|
+
`,
|
|
218
234
|
document.getElementById('controller-container')
|
|
219
235
|
)
|
|
220
236
|
}
|
package/demo/paywall.html
CHANGED
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
import { html, render } from 'lit'
|
|
39
39
|
import '../dist/src/components/kompasid-paywall/KompasPaywall.js'
|
|
40
40
|
import '../dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.js'
|
|
41
|
+
import '../dist/src/components/kompasid-paywall-modal-register/KompasPaywallModalRegister.js'
|
|
41
42
|
|
|
42
|
-
const type = '
|
|
43
|
+
const type = 'proMiningArticle'
|
|
43
44
|
const theme = ''
|
|
44
45
|
const paywallLocation = 'paywall_location'
|
|
45
46
|
const paywallSubscriptionId = 'testId'
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
const trackerContentTitle = 'content_title'
|
|
52
53
|
const trackerContentCategories = 'content_categories'
|
|
53
54
|
const trackerUserType = 'user_type'
|
|
54
|
-
const trackerContentTags = '
|
|
55
|
+
const trackerContentTags = 'english|bonjour'
|
|
55
56
|
const trackerContentPublishedDate = '2026-02-27 08:00:12'
|
|
56
57
|
const trackerContentVariant = 'testa'
|
|
57
58
|
const trackerContentPublisher = 'publisher'
|
|
@@ -4,6 +4,7 @@ import { customElement, property, state } from 'lit/decorators.js';
|
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
5
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
6
6
|
import { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js';
|
|
7
|
+
import { addGoogleFonts } from '../../utils/googleFont.js';
|
|
7
8
|
import { TWStyles } from '../../../tailwind/tailwind.js';
|
|
8
9
|
import { getHeaderTheme } from '../../utils/api/getHeaderTheme.js';
|
|
9
10
|
import '../kompasid-header-account-profile/KompasHeaderAccountProfile.js';
|
|
@@ -21,6 +22,7 @@ let KompasHeaderAccount = class KompasHeaderAccount extends LitElement {
|
|
|
21
22
|
this.logout_url = '';
|
|
22
23
|
this.manage_account_url = '';
|
|
23
24
|
this.read_later_url = '';
|
|
25
|
+
this.company_name = '';
|
|
24
26
|
this.userData = {};
|
|
25
27
|
this.sidebarTopSpacing = 0;
|
|
26
28
|
this.subscriptionUrl = '';
|
|
@@ -123,6 +125,8 @@ let KompasHeaderAccount = class KompasHeaderAccount extends LitElement {
|
|
|
123
125
|
.userInitialName=${this.getInitialUserName()}
|
|
124
126
|
.userData=${this.formattedUserData}
|
|
125
127
|
.subscriptionUrl=${this.subscriptionUrl}
|
|
128
|
+
.company_name=${this.company_name}
|
|
129
|
+
.manage_account_url=${this.manage_account_url}
|
|
126
130
|
paywall_location=${this.paywall_location}
|
|
127
131
|
paywall_subscription_package=${this.paywall_subscription_package}
|
|
128
132
|
paywall_subscription_id=${this.paywall_subscription_id}
|
|
@@ -155,6 +159,7 @@ let KompasHeaderAccount = class KompasHeaderAccount extends LitElement {
|
|
|
155
159
|
super.connectedCallback();
|
|
156
160
|
this.isShowSidebar = false;
|
|
157
161
|
this.themeList = await getHeaderTheme();
|
|
162
|
+
addGoogleFonts(['pt-sans']);
|
|
158
163
|
if (typeof this.userData === 'string') {
|
|
159
164
|
this.formattedUserData = JSON.parse(this.userData);
|
|
160
165
|
}
|
|
@@ -271,6 +276,9 @@ __decorate([
|
|
|
271
276
|
__decorate([
|
|
272
277
|
property({ type: String })
|
|
273
278
|
], KompasHeaderAccount.prototype, "read_later_url", void 0);
|
|
279
|
+
__decorate([
|
|
280
|
+
property({ type: String })
|
|
281
|
+
], KompasHeaderAccount.prototype, "company_name", void 0);
|
|
274
282
|
__decorate([
|
|
275
283
|
property({ type: Object })
|
|
276
284
|
], KompasHeaderAccount.prototype, "userData", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KompasHeaderAccount.js","sourceRoot":"","sources":["../../../../src/components/kompasid-header-account/KompasHeaderAccount.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAA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CAAC;yEAAiC;AAxHjD,mBAAmB;IAD/B,aAAa,CAAC,yBAAyB,CAAC;GAC5B,mBAAmB,CA6P/B;SA7PY,mBAAmB","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { cva } from 'class-variance-authority'\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 { getHeaderTheme } from '../../utils/api/getHeaderTheme.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: -2.5px;\n right: -2.5px;\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 .icon-xs svg {\n width: 11px;\n height: 12px;\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 .z-index-max {\n z-index: 99999;\n }\n\n /* Custom Scrollbar for header */\n /* width */\n ::-webkit-scrollbar {\n width: 4px;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: transparent;\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background: #0356a8;\n border-radius: 100px;\n }\n\n /* Handle on hover */\n ::-webkit-scrollbar-thumb:hover {\n background: #0356a8;\n }\n `,\n TWStyles,\n ]\n\n @state() isShowSidebar: boolean = false\n @state() themeList: any = null\n\n formattedUserData: User = {} as User\n\n /**\n * Props default\n */\n @property({ type: String }) logout_url = ''\n @property({ type: String }) manage_account_url = ''\n @property({ type: String }) read_later_url = ''\n @property({ type: Object }) userData = {}\n @property({ type: Number }) sidebarTopSpacing = 0\n @property({ type: String }) subscriptionUrl = ''\n @property({ type: String }) theme: 'default' | 'primary' = 'default'\n /**\n * Props For Grace Period and Tracker\n */\n @property({ type: String }) paywall_location = '' // belum tau terpakai dimana\n @property({ type: String }) paywall_subscription_package = '' // belum tau terpakai dimana\n @property({ type: Number }) paywall_subscription_id = 0\n @property({ type: Number }) paywall_subscription_price = 0 // belum tau terpakai dimana\n @property({ type: Number }) paywall_position = 0 // belum tau terpakai dimana\n @property({ type: String }) tracker_page_type = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_content_id = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_content_title = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_content_categories = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_content_type = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_user_type = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_subscription_status = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_page_domain = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_metered_wall_type = '' // belum tau terpakai dimana\n @property({ type: Number }) tracker_metered_wall_balance = 0 // belum tau terpakai dimana\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 setTheme(param: any): String {\n if (!this.themeList) return 'text-grey-100'\n const cvaFn = cva('', { variants: this.themeList })\n\n return cvaFn(param)\n }\n\n private account() {\n const membershipIcon = () => {\n if (!this.formattedUserData?.isMembership) return html``\n return html`\n <div>\n <img\n class=\"header-account--membership-icon h-3 w-3\"\n src=\"https://cdn-www.kompas.id/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 \">\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 rounded-full h-6 w-6 items-center justify-center relative ${this.setTheme(\n { background: this.theme }\n )}\"\n >\n <span\n class=\"capitalize text-xxs font-bold ${this.setTheme({\n text: this.theme,\n })}\"\n >\n ${this.getInitialUserName()}\n </span>\n ${membershipIcon()}\n </div>\n `}\n <div\n class=\"ml-1 icon-xs ${this.isShowSidebar\n ? 'chevron-down'\n : 'rotate-180'} ${this.setTheme({ icon: this.theme })}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-up'))}\n </div>\n </div>\n </button>\n `\n }\n\n private accountSidebar() {\n return html`\n <nav\n class=\"w-screen fixed right-0 top-0 bottom-0\"\n @keyup=\"${this.onkeyup}\"\n @click=${this.toggleSidebar}\n >\n <div\n class=\"bg-grey-100 pb-20 pt-0 shadow-lg w-76 z-index-max ml-auto\"\n style=${`margin-top: ${this.sidebarTopSpacing}px;height:100vh;overflow-y:auto`}\n @keyup=\"${this.onkeyup}\"\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 paywall_location=${this.paywall_location}\n paywall_subscription_package=${this.paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_content_type=${this.tracker_content_type}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_metered_wall_balance=${this.tracker_metered_wall_balance}\n ></kompasid-header-account-profile>\n <div class=\"pl-4 pr-3 py-4 text-left\">\n <kompasid-header-account-menu\n .manage_account_url=${this.manage_account_url}\n .logout_url=${this.logout_url}\n .read_later_url=${this.read_later_url}\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 this.themeList = await getHeaderTheme()\n\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 ${this.account()} ${this.isShowSidebar ? this.accountSidebar() : ''}\n `\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"KompasHeaderAccount.js","sourceRoot":"","sources":["../../../../src/components/kompasid-header-account/KompasHeaderAccount.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;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,IAAI,EAAE,MAAM,EAAE,CAAC;sEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yEAAiC;AAzHjD,mBAAmB;IAD/B,aAAa,CAAC,yBAAyB,CAAC;GAC5B,mBAAmB,CAiQ/B;SAjQY,mBAAmB","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { cva } from 'class-variance-authority'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'\nimport { addGoogleFonts } from '../../utils/googleFont.js'\nimport { User } from './types.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { getHeaderTheme } from '../../utils/api/getHeaderTheme.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: -2.5px;\n right: -2.5px;\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 .icon-xs svg {\n width: 11px;\n height: 12px;\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 .z-index-max {\n z-index: 99999;\n }\n\n /* Custom Scrollbar for header */\n /* width */\n ::-webkit-scrollbar {\n width: 4px;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: transparent;\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background: #0356a8;\n border-radius: 100px;\n }\n\n /* Handle on hover */\n ::-webkit-scrollbar-thumb:hover {\n background: #0356a8;\n }\n `,\n TWStyles,\n ]\n\n @state() isShowSidebar: boolean = false\n @state() themeList: any = null\n\n formattedUserData: User = {} as User\n\n /**\n * Props default\n */\n @property({ type: String }) logout_url = ''\n @property({ type: String }) manage_account_url = ''\n @property({ type: String }) read_later_url = ''\n @property({ type: String }) company_name = ''\n @property({ type: Object }) userData = {}\n @property({ type: Number }) sidebarTopSpacing = 0\n @property({ type: String }) subscriptionUrl = ''\n @property({ type: String }) theme: 'default' | 'primary' = 'default'\n /**\n * Props For Grace Period and Tracker\n */\n @property({ type: String }) paywall_location = '' // belum tau terpakai dimana\n @property({ type: String }) paywall_subscription_package = '' // belum tau terpakai dimana\n @property({ type: Number }) paywall_subscription_id = 0\n @property({ type: Number }) paywall_subscription_price = 0 // belum tau terpakai dimana\n @property({ type: Number }) paywall_position = 0 // belum tau terpakai dimana\n @property({ type: String }) tracker_page_type = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_content_id = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_content_title = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_content_categories = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_content_type = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_user_type = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_subscription_status = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_page_domain = '' // belum tau terpakai dimana\n @property({ type: String }) tracker_metered_wall_type = '' // belum tau terpakai dimana\n @property({ type: Number }) tracker_metered_wall_balance = 0 // belum tau terpakai dimana\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 setTheme(param: any): String {\n if (!this.themeList) return 'text-grey-100'\n const cvaFn = cva('', { variants: this.themeList })\n\n return cvaFn(param)\n }\n\n private account() {\n const membershipIcon = () => {\n if (!this.formattedUserData?.isMembership) return html``\n return html`\n <div>\n <img\n class=\"header-account--membership-icon h-3 w-3\"\n src=\"https://cdn-www.kompas.id/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 \">\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 rounded-full h-6 w-6 items-center justify-center relative ${this.setTheme(\n { background: this.theme }\n )}\"\n >\n <span\n class=\"capitalize text-xxs font-bold ${this.setTheme({\n text: this.theme,\n })}\"\n >\n ${this.getInitialUserName()}\n </span>\n ${membershipIcon()}\n </div>\n `}\n <div\n class=\"ml-1 icon-xs ${this.isShowSidebar\n ? 'chevron-down'\n : 'rotate-180'} ${this.setTheme({ icon: this.theme })}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-up'))}\n </div>\n </div>\n </button>\n `\n }\n\n private accountSidebar() {\n return html`\n <nav\n class=\"w-screen fixed right-0 top-0 bottom-0\"\n @keyup=\"${this.onkeyup}\"\n @click=${this.toggleSidebar}\n >\n <div\n class=\"bg-grey-100 pb-20 pt-0 shadow-lg w-76 z-index-max ml-auto\"\n style=${`margin-top: ${this.sidebarTopSpacing}px;height:100vh;overflow-y:auto`}\n @keyup=\"${this.onkeyup}\"\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 .company_name=${this.company_name}\n .manage_account_url=${this.manage_account_url}\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this.paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_content_type=${this.tracker_content_type}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_metered_wall_balance=${this.tracker_metered_wall_balance}\n ></kompasid-header-account-profile>\n <div class=\"pl-4 pr-3 py-4 text-left\">\n <kompasid-header-account-menu\n .manage_account_url=${this.manage_account_url}\n .logout_url=${this.logout_url}\n .read_later_url=${this.read_later_url}\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 this.themeList = await getHeaderTheme()\n addGoogleFonts(['pt-sans'])\n\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 ${this.account()} ${this.isShowSidebar ? this.accountSidebar() : ''}\n `\n }\n}\n"]}
|
|
@@ -11,15 +11,15 @@ let KompasHeaderAccountMenu = class KompasHeaderAccountMenu extends LitElement {
|
|
|
11
11
|
/**
|
|
12
12
|
* Logout Url
|
|
13
13
|
*/
|
|
14
|
-
this.logout_url = '
|
|
14
|
+
this.logout_url = '';
|
|
15
15
|
/**
|
|
16
16
|
* Manage Account Url
|
|
17
17
|
*/
|
|
18
|
-
this.manage_account_url = '
|
|
18
|
+
this.manage_account_url = '';
|
|
19
19
|
/**
|
|
20
20
|
* Read Later Url
|
|
21
21
|
*/
|
|
22
|
-
this.read_later_url = '
|
|
22
|
+
this.read_later_url = '';
|
|
23
23
|
// Render Total Bubble
|
|
24
24
|
this.renderTotalBubble = (total) => {
|
|
25
25
|
if (!total) {
|
|
@@ -39,6 +39,14 @@ let KompasHeaderAccountMenu = class KompasHeaderAccountMenu extends LitElement {
|
|
|
39
39
|
`;
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
+
komputasiUrl() {
|
|
43
|
+
return {
|
|
44
|
+
read_later_url: this.read_later_url || 'https://www.kompas.id/baca-nanti',
|
|
45
|
+
manage_account_url: this.manage_account_url ||
|
|
46
|
+
'https://manage-account.kompas.id/manage-account/my-account',
|
|
47
|
+
logout_url: this.logout_url || 'https://auth.kompas.id/logout',
|
|
48
|
+
};
|
|
49
|
+
}
|
|
42
50
|
async connectedCallback() {
|
|
43
51
|
super.connectedCallback();
|
|
44
52
|
}
|
|
@@ -54,7 +62,10 @@ let KompasHeaderAccountMenu = class KompasHeaderAccountMenu extends LitElement {
|
|
|
54
62
|
<p class="header-account-menu--title">Keranjang</p>
|
|
55
63
|
</a> -->
|
|
56
64
|
<!-- Manage Account -->
|
|
57
|
-
<a
|
|
65
|
+
<a
|
|
66
|
+
href=${this.komputasiUrl().manage_account_url}
|
|
67
|
+
class="header-account-menu--item"
|
|
68
|
+
>
|
|
58
69
|
<div class="icon icon-md icon-blue-600">
|
|
59
70
|
${unsafeSVG(getFontAwesomeIcon('fas', 'user-gear'))}
|
|
60
71
|
</div>
|
|
@@ -66,14 +77,20 @@ let KompasHeaderAccountMenu = class KompasHeaderAccountMenu extends LitElement {
|
|
|
66
77
|
<p class="header-account-menu--title">Transaksi</p>
|
|
67
78
|
</a> -->
|
|
68
79
|
<!-- Read Later -->
|
|
69
|
-
<a
|
|
80
|
+
<a
|
|
81
|
+
href=${this.komputasiUrl().read_later_url}
|
|
82
|
+
class="header-account-menu--item"
|
|
83
|
+
>
|
|
70
84
|
<div class="icon icon-md icon-blue-600">
|
|
71
85
|
${unsafeSVG(getFontAwesomeIcon('fas', 'bookmark'))}
|
|
72
86
|
</div>
|
|
73
87
|
<p class="header-account-menu--title">Baca Nanti</p>
|
|
74
88
|
</a>
|
|
75
89
|
<!-- Logout -->
|
|
76
|
-
<a
|
|
90
|
+
<a
|
|
91
|
+
href=${this.komputasiUrl().logout_url}
|
|
92
|
+
class="header-account-menu--item"
|
|
93
|
+
>
|
|
77
94
|
<div class="icon icon-md icon-blue-600">
|
|
78
95
|
${unsafeSVG(getFontAwesomeIcon('fas', 'right-from-bracket'))}
|
|
79
96
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KompasHeaderAccountMenu.js","sourceRoot":"","sources":["../../../../src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAClE,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,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,UAAU;IAAhD;;QAkDI,qBAAgB,GAAY,KAAK,CAAA;QAE1C;;WAEG;QACyB,eAAU,GAAG
|
|
1
|
+
{"version":3,"file":"KompasHeaderAccountMenu.js","sourceRoot":"","sources":["../../../../src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MA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A;IAC3B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;;;;;;mBAYI,IAAI,CAAC,YAAY,EAAE,CAAC,kBAAkB;;;;gBAIzC,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;;;;;;;;;;;mBAW9C,IAAI,CAAC,YAAY,EAAE,CAAC,cAAc;;;;gBAIrC,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;;;;;;mBAM7C,IAAI,CAAC,YAAY,EAAE,CAAC,UAAU;;;;gBAIjC,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC;;;;;;KAMrE,CAAA;IACH,CAAC;;AAtJM,8BAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0CF;IACD,QAAQ;CACT,CAAA;AAIQ;IAAR,KAAK,EAAE;iEAAkC;AAKd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAAgB;AAKf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAAwB;AAKvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+DAAoB;AAjEpC,uBAAuB;IADnC,aAAa,CAAC,8BAA8B,CAAC;GACjC,uBAAuB,CAwJnC;SAxJY,uBAAuB","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, state, property } 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-menu')\nexport class KompasHeaderAccountMenu extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n .header-account-menu--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-menu--item:hover {\n background-color: #e5e7eb; /* Assuming grey-200 */\n }\n .header-account-menu--title {\n flex-grow: 1;\n font-size: 1rem;\n font-weight: bold;\n margin-left: 1rem;\n }\n .header-account-menu--notification-info {\n font-size: 0.875rem;\n border-radius: 1.5rem;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: rgb(255, 122, 0);\n color: #f7fafc;\n height: 1.75rem;\n width: 1.75rem;\n }\n .icon {\n margin-top: auto;\n margin-bottom: auto;\n color: rgb(0 85 154);\n }\n .icon svg {\n width: 20px;\n height: 20px;\n }\n .\n `,\n TWStyles,\n ]\n\n kompasKring?: HTMLInputElement\n\n @state() clipboardClicked: boolean = false\n\n /**\n * Logout Url\n */\n @property({ type: String }) logout_url = ''\n\n /**\n * Manage Account Url\n */\n @property({ type: String }) manage_account_url = ''\n\n /**\n * Read Later Url\n */\n @property({ type: String }) read_later_url = ''\n\n // Render Total Bubble\n private renderTotalBubble = (total: number) => {\n if (!total) {\n return html``\n }\n\n const isOneDigitNotification = total > 0 && total <= 9\n const additionalStyling = isOneDigitNotification ? '' : 'pl-0.5'\n\n return html`\n <div\n class=${`header-account-menu--notification-info ${additionalStyling}`}\n >\n <!-- Limit Display to use \"9+\"\" if total notification exceed 9 -->\n ${isOneDigitNotification\n ? total\n : html`<span>9<span class=\"pl-px\">+</span></span>`}\n </div>\n `\n }\n\n private komputasiUrl() {\n return {\n read_later_url: this.read_later_url || 'https://www.kompas.id/baca-nanti',\n manage_account_url:\n this.manage_account_url ||\n 'https://manage-account.kompas.id/manage-account/my-account',\n logout_url: this.logout_url || 'https://auth.kompas.id/logout',\n }\n }\n\n override async connectedCallback() {\n super.connectedCallback()\n }\n\n render() {\n return html`\n <div class=\"border-b border-grey-300 text-grey-600\">\n <li\n class=\"font-bold flex flex-shrink-0 flex-col text-left text-sm mb-4\"\n >\n <!-- Cart -->\n <!--<a href={this.cartUrl} class=\"header-account-menu--item\">\n <div class=\"icon icon-md icon-blue-600\">{unsafeSVG(getFontAwesomeIcon('fas', 'cart-shopping'))}</div>\n <p class=\"header-account-menu--title\">Keranjang</p>\n </a> -->\n <!-- Manage Account -->\n <a\n href=${this.komputasiUrl().manage_account_url}\n class=\"header-account-menu--item\"\n >\n <div class=\"icon icon-md icon-blue-600\">\n ${unsafeSVG(getFontAwesomeIcon('fas', 'user-gear'))}\n </div>\n <p class=\"header-account-menu--title\">Kelola Akun</p>\n </a>\n <!-- Transaction -->\n <!-- <a href={this.ordersUrl} class=\"header-account-menu--item\">\n <div class=\"icon icon-md icon-blue-600\">{unsafeSVG(getFontAwesomeIcon('fas', 'arrow-right-arrow-left'))}</div>\n <p class=\"header-account-menu--title\">Transaksi</p>\n </a> -->\n <!-- Read Later -->\n <a\n href=${this.komputasiUrl().read_later_url}\n class=\"header-account-menu--item\"\n >\n <div class=\"icon icon-md icon-blue-600\">\n ${unsafeSVG(getFontAwesomeIcon('fas', 'bookmark'))}\n </div>\n <p class=\"header-account-menu--title\">Baca Nanti</p>\n </a>\n <!-- Logout -->\n <a\n href=${this.komputasiUrl().logout_url}\n class=\"header-account-menu--item\"\n >\n <div class=\"icon icon-md icon-blue-600\">\n ${unsafeSVG(getFontAwesomeIcon('fas', 'right-from-bracket'))}\n </div>\n <p class=\"header-account-menu--title\">Keluar</p>\n </a>\n </li>\n </div>\n `\n }\n}\n"]}
|
|
@@ -9,6 +9,8 @@ export declare class KompasHeaderAccountProfile extends LitElement {
|
|
|
9
9
|
userInitialName: string;
|
|
10
10
|
userData: User;
|
|
11
11
|
subscriptionUrl: string;
|
|
12
|
+
company_name: string;
|
|
13
|
+
manage_account_url: string;
|
|
12
14
|
openFrom: string;
|
|
13
15
|
/**
|
|
14
16
|
* Props For Grace Period Tracker
|
|
@@ -35,6 +37,7 @@ export declare class KompasHeaderAccountProfile extends LitElement {
|
|
|
35
37
|
formatDate(date: Date | string): string;
|
|
36
38
|
private renderSkeletonLoading;
|
|
37
39
|
private renderProfileContent;
|
|
40
|
+
clickToManageAccount(): void;
|
|
38
41
|
connectedCallback(): Promise<void>;
|
|
39
42
|
render(): import("lit-html").TemplateResult<1>;
|
|
40
43
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { LitElement, html, css, nothing } from 'lit';
|
|
3
3
|
import { format, addDays, differenceInDays } from 'date-fns';
|
|
4
4
|
import { id } from 'date-fns/locale/id';
|
|
5
5
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
6
|
+
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
6
7
|
import { TWStyles } from '../../../tailwind/tailwind.js';
|
|
8
|
+
import { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js';
|
|
7
9
|
import '../kompasid-grace-period/KompasGracePeriod.js';
|
|
8
10
|
let KompasHeaderAccountProfile = class KompasHeaderAccountProfile extends LitElement {
|
|
9
11
|
constructor() {
|
|
@@ -14,6 +16,8 @@ let KompasHeaderAccountProfile = class KompasHeaderAccountProfile extends LitEle
|
|
|
14
16
|
this.userInitialName = '';
|
|
15
17
|
this.userData = {};
|
|
16
18
|
this.subscriptionUrl = '';
|
|
19
|
+
this.company_name = '';
|
|
20
|
+
this.manage_account_url = '';
|
|
17
21
|
this.openFrom = '';
|
|
18
22
|
/**
|
|
19
23
|
* Props For Grace Period Tracker
|
|
@@ -158,13 +162,52 @@ let KompasHeaderAccountProfile = class KompasHeaderAccountProfile extends LitEle
|
|
|
158
162
|
${result}
|
|
159
163
|
</p>`;
|
|
160
164
|
};
|
|
165
|
+
/**
|
|
166
|
+
* Kompeni Element
|
|
167
|
+
*/
|
|
168
|
+
const kompeniTemplate = () => html ` <div
|
|
169
|
+
class="flex relative group bg-[#FFF8D6] text-yellow-700 gap-1 p-2 mt-2 rounded items-center justify-center text-xs max-w-[190px] font-sans leading-none"
|
|
170
|
+
>
|
|
171
|
+
<div class="w-5 h-5 flex items-center justify-center flex-shrink-0">
|
|
172
|
+
${unsafeSVG(getFontAwesomeIcon('fa', 'building-circle-check', 13, 10))}
|
|
173
|
+
</div>
|
|
174
|
+
<p class="truncate">${this.company_name}</p>
|
|
175
|
+
<div
|
|
176
|
+
class="absolute px-2 top-full -right-[5%] w-max max-w-[300px] mt-1 hidden group-hover:block"
|
|
177
|
+
>
|
|
178
|
+
<div
|
|
179
|
+
class="bg-grey-600 text-white text-sm font-sans p-4 rounded-lg relative leading-5"
|
|
180
|
+
>
|
|
181
|
+
${this.company_name}
|
|
182
|
+
<svg
|
|
183
|
+
width="16"
|
|
184
|
+
height="12"
|
|
185
|
+
viewBox="0 0 24 13"
|
|
186
|
+
class="text-grey-600 absolute left-[80%] -top-[11px]"
|
|
187
|
+
>
|
|
188
|
+
<polygon
|
|
189
|
+
points="3,15 12,3 21,15"
|
|
190
|
+
fill="currentColor"
|
|
191
|
+
stroke="currentColor"
|
|
192
|
+
stroke-width="4"
|
|
193
|
+
stroke-linejoin="round"
|
|
194
|
+
/>
|
|
195
|
+
</svg>
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
</div>`;
|
|
161
199
|
return html `
|
|
162
200
|
<div
|
|
163
201
|
class="active-info flex flex-col items-start leading-none text-left font-sans"
|
|
164
202
|
>
|
|
165
203
|
<div class="flex flex-row items-center gap-4">
|
|
166
204
|
<div
|
|
167
|
-
|
|
205
|
+
@click=${() => this.clickToManageAccount()}
|
|
206
|
+
@keydown=${() => this.clickToManageAccount()}
|
|
207
|
+
class="flex bg-brand-1 flex-shrink-0 p-5 rounded-full h-16 w-16 items-center justify-center relative select-none ${this
|
|
208
|
+
.manage_account_url
|
|
209
|
+
? 'cursor-pointer'
|
|
210
|
+
: ''}"
|
|
168
211
|
>
|
|
169
212
|
<span class="capitalize text-2xl text-grey-100 font-bold">
|
|
170
213
|
${this.userInitialName}
|
|
@@ -173,10 +216,21 @@ let KompasHeaderAccountProfile = class KompasHeaderAccountProfile extends LitEle
|
|
|
173
216
|
</div>
|
|
174
217
|
|
|
175
218
|
<div class="flex flex-col text-left">
|
|
176
|
-
<
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
219
|
+
<div
|
|
220
|
+
@click=${() => this.clickToManageAccount()}
|
|
221
|
+
@keydown=${() => this.clickToManageAccount()}
|
|
222
|
+
class="select-none"
|
|
223
|
+
>
|
|
224
|
+
<p
|
|
225
|
+
class="capitalize font-bold text-base ${this.manage_account_url
|
|
226
|
+
? 'text-blue-600 cursor-pointer'
|
|
227
|
+
: 'text-grey-600'}"
|
|
228
|
+
>
|
|
229
|
+
${this.userData.userName}
|
|
230
|
+
</p>
|
|
231
|
+
${activeInfoTemplate()}
|
|
232
|
+
</div>
|
|
233
|
+
${this.company_name ? kompeniTemplate() : nothing}
|
|
180
234
|
</div>
|
|
181
235
|
</div>
|
|
182
236
|
|
|
@@ -210,6 +264,11 @@ let KompasHeaderAccountProfile = class KompasHeaderAccountProfile extends LitEle
|
|
|
210
264
|
</div>
|
|
211
265
|
`;
|
|
212
266
|
}
|
|
267
|
+
clickToManageAccount() {
|
|
268
|
+
if (this.manage_account_url) {
|
|
269
|
+
window.location.href = this.manage_account_url;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
213
272
|
async connectedCallback() {
|
|
214
273
|
super.connectedCallback();
|
|
215
274
|
}
|
|
@@ -231,6 +290,18 @@ KompasHeaderAccountProfile.styles = [
|
|
|
231
290
|
bottom: -2px;
|
|
232
291
|
right: -2px;
|
|
233
292
|
}
|
|
293
|
+
|
|
294
|
+
.tooltip::after {
|
|
295
|
+
content: '';
|
|
296
|
+
position: absolute;
|
|
297
|
+
width: 24px;
|
|
298
|
+
height: 16px;
|
|
299
|
+
background-color: #333333;
|
|
300
|
+
/* Memotong kotak menjadi segitiga */
|
|
301
|
+
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
|
|
302
|
+
/* Menghaluskan sudut potongan */
|
|
303
|
+
border-radius: 4px;
|
|
304
|
+
}
|
|
234
305
|
`,
|
|
235
306
|
TWStyles,
|
|
236
307
|
];
|
|
@@ -243,6 +314,12 @@ __decorate([
|
|
|
243
314
|
__decorate([
|
|
244
315
|
property({ type: String })
|
|
245
316
|
], KompasHeaderAccountProfile.prototype, "subscriptionUrl", void 0);
|
|
317
|
+
__decorate([
|
|
318
|
+
property({ type: String })
|
|
319
|
+
], KompasHeaderAccountProfile.prototype, "company_name", void 0);
|
|
320
|
+
__decorate([
|
|
321
|
+
property({ type: String })
|
|
322
|
+
], KompasHeaderAccountProfile.prototype, "manage_account_url", void 0);
|
|
246
323
|
__decorate([
|
|
247
324
|
property({ type: String })
|
|
248
325
|
], KompasHeaderAccountProfile.prototype, "openFrom", void 0);
|
package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KompasHeaderAccountProfile.js","sourceRoot":"","sources":["../../../../src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAExD,OAAO,+CAA+C,CAAA;AAG/C,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,UAAU;IAAnD;;QAYL;;WAEG;QACyB,oBAAe,GAAG,EAAE,CAAA;QACpB,aAAQ,GAAG,EAAU,CAAA;QACrB,oBAAe,GAAG,EAAE,CAAA;QACpB,aAAQ,GAAG,EAAE,CAAA;QACzC;;W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IAAI,EAAE,MAAM,EAAE,CAAC;oEAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sEAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yEAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8EAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wEAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+EAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6EAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gFAAiC;AAKnD;IAAR,KAAK,EAAE;kEAA2B;AAzCxB,0BAA0B;IADtC,aAAa,CAAC,iCAAiC,CAAC;GACpC,0BAA0B,CAsPtC;SAtPY,0BAA0B","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { format, addDays, differenceInDays } from 'date-fns'\nimport { id } from 'date-fns/locale/id'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { User } from '../kompasid-header-account/types.js'\nimport '../kompasid-grace-period/KompasGracePeriod.js'\n\n@customElement('kompasid-header-account-profile')\nexport class KompasHeaderAccountProfile extends LitElement {\n static styles = [\n css`\n .header-account--membership-icon {\n position: absolute;\n bottom: -2px;\n right: -2px;\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n @property({ type: String }) userInitialName = ''\n @property({ type: Object }) userData = {} as User\n @property({ type: String }) subscriptionUrl = ''\n @property({ type: String }) openFrom = ''\n /**\n * Props For Grace Period Tracker\n */\n @property({ type: String }) paywall_location = ''\n @property({ type: String }) paywall_subscription_package = ''\n @property({ type: Number }) paywall_subscription_id = 0\n @property({ type: Number }) paywall_subscription_price = 0\n @property({ type: Number }) paywall_position = 0\n @property({ type: String }) tracker_page_type = ''\n @property({ type: String }) tracker_content_id = ''\n @property({ type: String }) tracker_content_title = ''\n @property({ type: String }) tracker_content_categories = ''\n @property({ type: String }) tracker_content_type = ''\n @property({ type: String }) tracker_user_type = ''\n @property({ type: String }) tracker_subscription_status = ''\n @property({ type: String }) tracker_page_domain = ''\n @property({ type: String }) tracker_metered_wall_type = ''\n @property({ type: Number }) tracker_metered_wall_balance = 0\n\n /**\n * State\n */\n @state() private maxGracePeriod = 7\n\n formatDate(date: Date | string) {\n return format(new Date(date), 'dd MMM yyyy', { locale: id })\n }\n\n private renderSkeletonLoading() {\n return html`\n <div>\n <div class=\"flex flex-row mb-5 items-center gap-4 leading-none\">\n <div\n class=\"bg-grey-300 py-5 rounded-full h-16 w-16 animate-pulse\"\n ></div>\n <div class=\"flex flex-col text-left w-40 gap-y-2\">\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n </div>\n </div>\n <div>\n <div class=\"h-6 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n </div>\n </div>\n `\n }\n\n private renderProfileContent() {\n /**\n * Subs Button Element\n */\n const subscribeButton = () => {\n if (this.userData.isMembership) {\n return html``\n }\n const handleSubscribe = () => {\n const openFromValue = this.openFrom || 'Sidebar_Menu'\n window.location.href = `${this.subscriptionUrl}?open_from=${openFromValue}`\n }\n\n return html`\n <div class=\"w-full\">\n <button\n @click=${handleSubscribe}\n class=\"w-full rounded-lg px-4 py-3 mt-4 h-10 flex justify-center items-center bg-brand-1 text-grey-100 font-bold text-base focus:outline-none\"\n >\n Berlangganan Sekarang\n </button>\n </div>\n `\n }\n /**\n * membership icon element, show if isMebership has truthy value\n */\n const membershipIcon = () => {\n if (!this.userData?.isMembership) {\n return html``\n }\n\n return html`\n <div>\n <img\n class=\"header-account--membership-icon h-6 w-6\"\n src=\"https://cdn-www.kompas.id/global-header/crown-royal-blue-60.svg\"\n alt=\"membership-crown-icon\"\n />\n </div>\n `\n }\n\n /**\n * Active Info Element\n */\n\n const activeInfoTemplate = () => {\n const { isGracePeriod, totalGracePeriod, expired } = this.userData\n\n let result = html`Tidak Berlangganan` // default\n let endGracePeriodDate = ''\n\n const nowDate = new Date()\n const isoDateString = expired.replace(' ', 'T')\n const expiredDate = new Date(isoDateString)\n const subsDaysLeft: number = differenceInDays(expiredDate, nowDate) + 1 // differenceInDays + 1 jika tanggal bertepatan di hari yang sama\n\n const gracePeriodCard = () => {\n if (isGracePeriod) {\n const totalGraceSubs =\n this.maxGracePeriod - Math.max(totalGracePeriod, 0)\n endGracePeriodDate = this.formatDate(\n addDays(\n new Date(),\n totalGracePeriod > this.maxGracePeriod ? 0 : totalGraceSubs\n )\n )\n }\n const label = 'Periode Masa Tenggang'\n return html`\n <div class=\"text-orange-500 gracePeriodCard\">\n <span>${label}</span>\n <p class=\"font-bold\">hingga ${endGracePeriodDate}</p>\n </div>\n `\n }\n\n const lessThan3daysCard = () => {\n const label = 'Aktif Berlangganan'\n return html`\n <div class=\"lessThan3daysCard\">\n <span> ${label} </span>\n <p class=\"font-bold\">Berakhir ${subsDaysLeft} hari lagi</p>\n </div>\n `\n }\n\n const moreThan3daysCard = () => {\n const formattedExpired = this.formatDate(expired)\n const label = 'Aktif Berlangganan'\n return html`\n <div class=\"moreThan3daysCard\">\n <span>${label}</span>\n <p class=\"font-bold\">hingga ${formattedExpired}</p>\n </div>\n `\n }\n\n if (isGracePeriod && totalGracePeriod > 0) {\n result = gracePeriodCard()\n } else if (subsDaysLeft >= 0 && subsDaysLeft <= 3) {\n result = lessThan3daysCard()\n } else if (subsDaysLeft > 3) {\n result = moreThan3daysCard()\n }\n\n return html`<p class=\"text-sm text-grey-600 ${subsDaysLeft}-days-left\">\n ${result}\n </p>`\n }\n\n return html`\n <div\n class=\"active-info flex flex-col items-start leading-none text-left font-sans\"\n >\n <div class=\"flex flex-row items-center gap-4\">\n <div\n class=\"flex bg-brand-1 flex-shrink-0 p-5 rounded-full h-16 w-16 items-center justify-center relative\"\n >\n <span class=\"capitalize text-2xl text-grey-100 font-bold\">\n ${this.userInitialName}\n </span>\n ${membershipIcon()}\n </div>\n\n <div class=\"flex flex-col text-left\">\n <p class=\"capitalize font-bold text-base text-blue-600\">\n ${this.userData.userName}\n </p>\n ${activeInfoTemplate()}\n </div>\n </div>\n\n ${this.userData?.isGracePeriod\n ? html` <div class=\"mt-4 kompasid-grace-period\">\n <kompasid-grace-period\n totalGracePeriod=${this.userData.totalGracePeriod}\n isColumn=\"true\"\n isShowButton=\"true\"\n isBackgroundOnContentOnly=\"true\"\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this\n .paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_content_type=${this.tracker_content_type}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_metered_wall_balance=${this\n .tracker_metered_wall_balance}\n ></kompasid-grace-period>\n </div>`\n : subscribeButton()}\n </div>\n `\n }\n\n override async connectedCallback() {\n super.connectedCallback()\n }\n\n render() {\n return html`\n <div class=\"flex flex-shrink-0 flex-col p-4\">\n ${!this.userData\n ? this.renderSkeletonLoading()\n : this.renderProfileContent()}\n </div>\n <hr class=\"border-grey-300 mx-4\" />\n `\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"KompasHeaderAccountProfile.js","sourceRoot":"","sources":["../../../../src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,+CAA+C,CAAA;AAG/C,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,UAAU;IAAnD;;QAwBL;;WAEG;QACyB,oBAAe,GAAG,EAAE,CAAA;QACpB,aAAQ,GAAG,EAAU,CAAA;QACrB,oBAAe,GAAG,EAAE,CAAA;QACpB,iBAAY,GAAG,EAAE,CAAA;QACjB,uBAAkB,GAAG,EAAE,CAAA;QACvB,aAAQ,GAAG,EAAE,CAAA;QACzC;;WAEG;QACyB,qBAAgB,GAAG,EAAE,CAAA;QACrB,iCAA4B,GAAG,EAAE,CAAA;QACjC,4BAAuB,GAAG,CAAC,CAAA;QAC3B,+BAA0B,GAAG,CAAC,CAAA;QAC9B,qBAAgB,GAAG,CAAC,CAAA;QACpB,sBAAiB,GAAG,EAAE,CAAA;QACtB,uBAAkB,GAAG,EAAE,CAAA;QACvB,0BAAqB,G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3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+EAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6EAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gFAAiC;AAKnD;IAAR,KAAK,EAAE;kEAA2B;AAvDxB,0BAA0B;IADtC,aAAa,CAAC,iCAAiC,CAAC;GACpC,0BAA0B,CA4TtC;SA5TY,0BAA0B","sourcesContent":["import { LitElement, html, css, nothing } from 'lit'\nimport { format, addDays, differenceInDays } from 'date-fns'\nimport { id } from 'date-fns/locale/id'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { User } from '../kompasid-header-account/types.js'\nimport { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'\nimport '../kompasid-grace-period/KompasGracePeriod.js'\n\n@customElement('kompasid-header-account-profile')\nexport class KompasHeaderAccountProfile extends LitElement {\n static styles = [\n css`\n .header-account--membership-icon {\n position: absolute;\n bottom: -2px;\n right: -2px;\n }\n\n .tooltip::after {\n content: '';\n position: absolute;\n width: 24px;\n height: 16px;\n background-color: #333333;\n /* Memotong kotak menjadi segitiga */\n clip-path: polygon(50% 0%, 0% 100%, 100% 100%);\n /* Menghaluskan sudut potongan */\n border-radius: 4px;\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n @property({ type: String }) userInitialName = ''\n @property({ type: Object }) userData = {} as User\n @property({ type: String }) subscriptionUrl = ''\n @property({ type: String }) company_name = ''\n @property({ type: String }) manage_account_url = ''\n @property({ type: String }) openFrom = ''\n /**\n * Props For Grace Period Tracker\n */\n @property({ type: String }) paywall_location = ''\n @property({ type: String }) paywall_subscription_package = ''\n @property({ type: Number }) paywall_subscription_id = 0\n @property({ type: Number }) paywall_subscription_price = 0\n @property({ type: Number }) paywall_position = 0\n @property({ type: String }) tracker_page_type = ''\n @property({ type: String }) tracker_content_id = ''\n @property({ type: String }) tracker_content_title = ''\n @property({ type: String }) tracker_content_categories = ''\n @property({ type: String }) tracker_content_type = ''\n @property({ type: String }) tracker_user_type = ''\n @property({ type: String }) tracker_subscription_status = ''\n @property({ type: String }) tracker_page_domain = ''\n @property({ type: String }) tracker_metered_wall_type = ''\n @property({ type: Number }) tracker_metered_wall_balance = 0\n\n /**\n * State\n */\n @state() private maxGracePeriod = 7\n\n formatDate(date: Date | string) {\n return format(new Date(date), 'dd MMM yyyy', { locale: id })\n }\n\n private renderSkeletonLoading() {\n return html`\n <div>\n <div class=\"flex flex-row mb-5 items-center gap-4 leading-none\">\n <div\n class=\"bg-grey-300 py-5 rounded-full h-16 w-16 animate-pulse\"\n ></div>\n <div class=\"flex flex-col text-left w-40 gap-y-2\">\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n </div>\n </div>\n <div>\n <div class=\"h-6 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n </div>\n </div>\n `\n }\n\n private renderProfileContent() {\n /**\n * Subs Button Element\n */\n const subscribeButton = () => {\n if (this.userData.isMembership) {\n return html``\n }\n const handleSubscribe = () => {\n const openFromValue = this.openFrom || 'Sidebar_Menu'\n window.location.href = `${this.subscriptionUrl}?open_from=${openFromValue}`\n }\n\n return html`\n <div class=\"w-full\">\n <button\n @click=${handleSubscribe}\n class=\"w-full rounded-lg px-4 py-3 mt-4 h-10 flex justify-center items-center bg-brand-1 text-grey-100 font-bold text-base focus:outline-none\"\n >\n Berlangganan Sekarang\n </button>\n </div>\n `\n }\n /**\n * membership icon element, show if isMebership has truthy value\n */\n const membershipIcon = () => {\n if (!this.userData?.isMembership) {\n return html``\n }\n\n return html`\n <div>\n <img\n class=\"header-account--membership-icon h-6 w-6\"\n src=\"https://cdn-www.kompas.id/global-header/crown-royal-blue-60.svg\"\n alt=\"membership-crown-icon\"\n />\n </div>\n `\n }\n\n /**\n * Active Info Element\n */\n\n const activeInfoTemplate = () => {\n const { isGracePeriod, totalGracePeriod, expired } = this.userData\n\n let result = html`Tidak Berlangganan` // default\n let endGracePeriodDate = ''\n\n const nowDate = new Date()\n const isoDateString = expired.replace(' ', 'T')\n const expiredDate = new Date(isoDateString)\n const subsDaysLeft: number = differenceInDays(expiredDate, nowDate) + 1 // differenceInDays + 1 jika tanggal bertepatan di hari yang sama\n\n const gracePeriodCard = () => {\n if (isGracePeriod) {\n const totalGraceSubs =\n this.maxGracePeriod - Math.max(totalGracePeriod, 0)\n endGracePeriodDate = this.formatDate(\n addDays(\n new Date(),\n totalGracePeriod > this.maxGracePeriod ? 0 : totalGraceSubs\n )\n )\n }\n const label = 'Periode Masa Tenggang'\n return html`\n <div class=\"text-orange-500 gracePeriodCard\">\n <span>${label}</span>\n <p class=\"font-bold\">hingga ${endGracePeriodDate}</p>\n </div>\n `\n }\n\n const lessThan3daysCard = () => {\n const label = 'Aktif Berlangganan'\n return html`\n <div class=\"lessThan3daysCard\">\n <span> ${label} </span>\n <p class=\"font-bold\">Berakhir ${subsDaysLeft} hari lagi</p>\n </div>\n `\n }\n\n const moreThan3daysCard = () => {\n const formattedExpired = this.formatDate(expired)\n const label = 'Aktif Berlangganan'\n return html`\n <div class=\"moreThan3daysCard\">\n <span>${label}</span>\n <p class=\"font-bold\">hingga ${formattedExpired}</p>\n </div>\n `\n }\n\n if (isGracePeriod && totalGracePeriod > 0) {\n result = gracePeriodCard()\n } else if (subsDaysLeft >= 0 && subsDaysLeft <= 3) {\n result = lessThan3daysCard()\n } else if (subsDaysLeft > 3) {\n result = moreThan3daysCard()\n }\n\n return html`<p class=\"text-sm text-grey-600 ${subsDaysLeft}-days-left\">\n ${result}\n </p>`\n }\n\n /**\n * Kompeni Element\n */\n const kompeniTemplate = () => html` <div\n class=\"flex relative group bg-[#FFF8D6] text-yellow-700 gap-1 p-2 mt-2 rounded items-center justify-center text-xs max-w-[190px] font-sans leading-none\"\n >\n <div class=\"w-5 h-5 flex items-center justify-center flex-shrink-0\">\n ${unsafeSVG(getFontAwesomeIcon('fa', 'building-circle-check', 13, 10))}\n </div>\n <p class=\"truncate\">${this.company_name}</p>\n <div\n class=\"absolute px-2 top-full -right-[5%] w-max max-w-[300px] mt-1 hidden group-hover:block\"\n >\n <div\n class=\"bg-grey-600 text-white text-sm font-sans p-4 rounded-lg relative leading-5\"\n >\n ${this.company_name}\n <svg\n width=\"16\"\n height=\"12\"\n viewBox=\"0 0 24 13\"\n class=\"text-grey-600 absolute left-[80%] -top-[11px]\"\n >\n <polygon\n points=\"3,15 12,3 21,15\"\n fill=\"currentColor\"\n stroke=\"currentColor\"\n stroke-width=\"4\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </div>\n </div>\n </div>`\n\n return html`\n <div\n class=\"active-info flex flex-col items-start leading-none text-left font-sans\"\n >\n <div class=\"flex flex-row items-center gap-4\">\n <div\n @click=${() => this.clickToManageAccount()}\n @keydown=${() => this.clickToManageAccount()}\n class=\"flex bg-brand-1 flex-shrink-0 p-5 rounded-full h-16 w-16 items-center justify-center relative select-none ${this\n .manage_account_url\n ? 'cursor-pointer'\n : ''}\"\n >\n <span class=\"capitalize text-2xl text-grey-100 font-bold\">\n ${this.userInitialName}\n </span>\n ${membershipIcon()}\n </div>\n\n <div class=\"flex flex-col text-left\">\n <div\n @click=${() => this.clickToManageAccount()}\n @keydown=${() => this.clickToManageAccount()}\n class=\"select-none\"\n >\n <p\n class=\"capitalize font-bold text-base ${this.manage_account_url\n ? 'text-blue-600 cursor-pointer'\n : 'text-grey-600'}\"\n >\n ${this.userData.userName}\n </p>\n ${activeInfoTemplate()}\n </div>\n ${this.company_name ? kompeniTemplate() : nothing}\n </div>\n </div>\n\n ${this.userData?.isGracePeriod\n ? html` <div class=\"mt-4 kompasid-grace-period\">\n <kompasid-grace-period\n totalGracePeriod=${this.userData.totalGracePeriod}\n isColumn=\"true\"\n isShowButton=\"true\"\n isBackgroundOnContentOnly=\"true\"\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this\n .paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_content_type=${this.tracker_content_type}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_metered_wall_balance=${this\n .tracker_metered_wall_balance}\n ></kompasid-grace-period>\n </div>`\n : subscribeButton()}\n </div>\n `\n }\n clickToManageAccount() {\n if (this.manage_account_url) {\n window.location.href = this.manage_account_url\n }\n }\n\n override async connectedCallback() {\n super.connectedCallback()\n }\n\n render() {\n return html`\n <div class=\"flex flex-shrink-0 flex-col p-4\">\n ${!this.userData\n ? this.renderSkeletonLoading()\n : this.renderProfileContent()}\n </div>\n <hr class=\"border-grey-300 mx-4\" />\n `\n }\n}\n"]}
|
|
@@ -343,9 +343,6 @@ let KompasPaywall = class KompasPaywall extends LitElement {
|
|
|
343
343
|
return false;
|
|
344
344
|
}
|
|
345
345
|
const { tracker_content_published_date: publishedDate, tracker_content_tags: trackerTags, tracker_content_variant: trackerVariant, } = this;
|
|
346
|
-
if (!publishedDate || !trackerVariant || !trackerTags) {
|
|
347
|
-
return false;
|
|
348
|
-
}
|
|
349
346
|
const nowDate = new Date();
|
|
350
347
|
const isoDateString = publishedDate.replace(' ', 'T');
|
|
351
348
|
const publishedDateObj = new Date(isoDateString);
|