@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.
Files changed (50) hide show
  1. package/assets/kompas-free-trial.png +0 -0
  2. package/assets/qr-code.png +0 -0
  3. package/demo/index.html +33 -2
  4. package/dist/src/components/kompasid-header-account/KompasHeaderAccount.d.ts +27 -0
  5. package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js +233 -0
  6. package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js.map +1 -0
  7. package/dist/src/components/kompasid-header-account/types.d.ts +8 -0
  8. package/dist/src/components/kompasid-header-account/types.js +2 -0
  9. package/dist/src/components/kompasid-header-account/types.js.map +1 -0
  10. package/dist/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.d.ts +13 -0
  11. package/dist/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.js +172 -0
  12. package/dist/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.js.map +1 -0
  13. package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.d.ts +37 -0
  14. package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.js +185 -0
  15. package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.js.map +1 -0
  16. package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.d.ts +12 -0
  17. package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js +172 -0
  18. package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js.map +1 -0
  19. package/dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.js +8 -8
  20. package/dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.js.map +1 -1
  21. package/dist/src/components/kompasid-paywall/KompasPaywall.js +7 -20
  22. package/dist/src/components/kompasid-paywall/KompasPaywall.js.map +1 -1
  23. package/dist/src/components/kompasid-paywall/types.d.ts +5 -0
  24. package/dist/src/components/kompasid-paywall/types.js.map +1 -1
  25. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.d.ts +4 -0
  26. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +178 -28
  27. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
  28. package/dist/src/index.d.ts +1 -0
  29. package/dist/src/index.js +1 -0
  30. package/dist/src/index.js.map +1 -1
  31. package/dist/src/utils/text.d.ts +2 -0
  32. package/dist/src/utils/text.js +9 -0
  33. package/dist/src/utils/text.js.map +1 -0
  34. package/dist/tailwind/tailwind.js +391 -5
  35. package/dist/tailwind/tailwind.js.map +1 -1
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/package.json +1 -1
  38. package/src/components/kompasid-header-account/KompasHeaderAccount.ts +197 -0
  39. package/src/components/kompasid-header-account/types.ts +8 -0
  40. package/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.ts +177 -0
  41. package/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.ts +172 -0
  42. package/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.ts +161 -0
  43. package/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.ts +8 -8
  44. package/src/components/kompasid-paywall/KompasPaywall.ts +7 -20
  45. package/src/components/kompasid-paywall/types.ts +5 -0
  46. package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +189 -36
  47. package/src/index.ts +1 -0
  48. package/src/utils/text.ts +9 -0
  49. package/tailwind/tailwind.css +382 -5
  50. package/tailwind/tailwind.ts +391 -5
@@ -0,0 +1,185 @@
1
+ import { __decorate } from "tslib";
2
+ import { LitElement, html, css } from 'lit';
3
+ import { customElement, state, property } 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 KompasHeaderAccountMenu = class KompasHeaderAccountMenu extends LitElement {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.clipboardClicked = false;
11
+ /**
12
+ * Cart Url
13
+ */
14
+ this.cartUrl = 'https://gerai.kompas.id/cart';
15
+ /**
16
+ * Logout Url
17
+ */
18
+ this.logoutUrl = 'https://account.kompas.id/logout';
19
+ /**
20
+ * Manage Account Url
21
+ */
22
+ this.manageAccountUrl = 'https://account.kompas.id/manage-account/my-account';
23
+ /**
24
+ * Notification Url
25
+ */
26
+ this.notificationUrl = 'https://account.kompas.id/manage-account/notification';
27
+ /**
28
+ * Orders Url
29
+ */
30
+ this.ordersUrl = 'https://gerai.kompas.id/my-account/orders';
31
+ /**
32
+ * Read Later Url
33
+ */
34
+ this.readLaterUrl = 'https://www.kompas.id/baca-nanti';
35
+ /**
36
+ * Total Notification Count
37
+ */
38
+ this.notificationTotal = 0;
39
+ // Render Total Bubble
40
+ this.renderTotalBubble = (total) => {
41
+ if (!total) {
42
+ return html ``;
43
+ }
44
+ const isOneDigitNotification = total > 0 && total <= 9;
45
+ const additionalStyling = isOneDigitNotification ? '' : 'pl-0.5';
46
+ return html `
47
+ <div
48
+ class=${`header-account-menu--notification-info ${additionalStyling}`}
49
+ >
50
+ <!-- Limit Display to use "9+"" if total notification exceed 9 -->
51
+ ${isOneDigitNotification
52
+ ? total
53
+ : html `<span>9<span class="pl-px">+</span></span>`}
54
+ </div>
55
+ `;
56
+ };
57
+ }
58
+ async connectedCallback() {
59
+ super.connectedCallback();
60
+ }
61
+ render() {
62
+ return html `
63
+ <div class="border-b border-grey-300 text-grey-600">
64
+ <li
65
+ class="font-bold flex flex-shrink-0 flex-col text-left text-sm mb-4"
66
+ >
67
+ <!-- Cart -->
68
+ <!--<a href={this.cartUrl} class="header-account-menu--item">
69
+ <div class="icon icon-md icon-blue-600">{unsafeSVG(getFontAwesomeIcon('fas', 'cart-shopping'))}</div>
70
+ <p class="header-account-menu--title">Keranjang</p>
71
+ </a> -->
72
+ <!-- Manage Account -->
73
+ <a href=${this.manageAccountUrl} class="header-account-menu--item">
74
+ <div class="icon icon-md icon-blue-600">
75
+ ${unsafeSVG(getFontAwesomeIcon('fas', 'user-gear'))}
76
+ </div>
77
+ <p class="header-account-menu--title">Kelola Akun</p>
78
+ </a>
79
+ <!-- Transaction -->
80
+ <!-- <a href={this.ordersUrl} class="header-account-menu--item">
81
+ <div class="icon icon-md icon-blue-600">{unsafeSVG(getFontAwesomeIcon('fas', 'arrow-right-arrow-left'))}</div>
82
+ <p class="header-account-menu--title">Transaksi</p>
83
+ </a> -->
84
+ <!-- Notifications -->
85
+ <a href=${this.notificationUrl} class="header-account-menu--item">
86
+ <div class="icon icon-md icon-blue-600">
87
+ ${unsafeSVG(getFontAwesomeIcon('fas', 'bell'))}
88
+ </div>
89
+ <p class="header-account-menu--title">Notifikasi</p>
90
+ <p class="flex-none">
91
+ <!-- Conditional rendering based on notification count -->
92
+ ${this.renderTotalBubble(this.notificationTotal)}
93
+ </p>
94
+ </a>
95
+ <!-- Read Later -->
96
+ <a href=${this.readLaterUrl} class="header-account-menu--item">
97
+ <div class="icon icon-md icon-blue-600">
98
+ ${unsafeSVG(getFontAwesomeIcon('fas', 'bookmark'))}
99
+ </div>
100
+ <p class="header-account-menu--title">Baca Nanti</p>
101
+ </a>
102
+ <!-- Logout -->
103
+ <a href=${this.logoutUrl} class="header-account-menu--item">
104
+ <div class="icon icon-md icon-blue-600">
105
+ ${unsafeSVG(getFontAwesomeIcon('fas', 'right-from-bracket'))}
106
+ </div>
107
+ <p class="header-account-menu--title">Keluar</p>
108
+ </a>
109
+ </li>
110
+ </div>
111
+ `;
112
+ }
113
+ };
114
+ KompasHeaderAccountMenu.styles = [
115
+ css `
116
+ :host {
117
+ font-family: 'PT Sans', sans-serif;
118
+ }
119
+ .header-account-menu--item {
120
+ display: flex;
121
+ flex-direction: row;
122
+ align-items: center;
123
+ padding: 0.75rem;
124
+ transition: background-color 0.3s ease-in-out;
125
+ border-radius: 0.25rem;
126
+ }
127
+ .header-account-menu--item:hover {
128
+ background-color: #e5e7eb; /* Assuming grey-200 */
129
+ }
130
+ .header-account-menu--title {
131
+ flex-grow: 1;
132
+ font-size: 1rem;
133
+ font-weight: bold;
134
+ margin-left: 1rem;
135
+ }
136
+ .header-account-menu--notification-info {
137
+ font-size: 0.875rem;
138
+ border-radius: 1.5rem;
139
+ display: flex;
140
+ align-items: center;
141
+ justify-content: center;
142
+ background-color: rgb(255, 122, 0);
143
+ color: #f7fafc;
144
+ height: 1.75rem;
145
+ width: 1.75rem;
146
+ }
147
+ .icon {
148
+ width: 20px;
149
+ height: 20px;
150
+ margin-top: auto;
151
+ margin-bottom: auto;
152
+ color: rgb(0 85 154);
153
+ }
154
+ `,
155
+ TWStyles,
156
+ ];
157
+ __decorate([
158
+ state()
159
+ ], KompasHeaderAccountMenu.prototype, "clipboardClicked", void 0);
160
+ __decorate([
161
+ property({ type: String })
162
+ ], KompasHeaderAccountMenu.prototype, "cartUrl", void 0);
163
+ __decorate([
164
+ property({ type: String })
165
+ ], KompasHeaderAccountMenu.prototype, "logoutUrl", void 0);
166
+ __decorate([
167
+ property({ type: String })
168
+ ], KompasHeaderAccountMenu.prototype, "manageAccountUrl", void 0);
169
+ __decorate([
170
+ property({ type: String })
171
+ ], KompasHeaderAccountMenu.prototype, "notificationUrl", void 0);
172
+ __decorate([
173
+ property({ type: String })
174
+ ], KompasHeaderAccountMenu.prototype, "ordersUrl", void 0);
175
+ __decorate([
176
+ property({ type: String })
177
+ ], KompasHeaderAccountMenu.prototype, "readLaterUrl", void 0);
178
+ __decorate([
179
+ property({ type: Number })
180
+ ], KompasHeaderAccountMenu.prototype, "notificationTotal", void 0);
181
+ KompasHeaderAccountMenu = __decorate([
182
+ customElement('kompasid-header-account-menu')
183
+ ], KompasHeaderAccountMenu);
184
+ export { KompasHeaderAccountMenu };
185
+ //# sourceMappingURL=KompasHeaderAccountMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KompasHeaderAccountMenu.js","sourceRoot":"","sources":["../../../../src/components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;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kEAA8B;AArF9C,uBAAuB;IADnC,aAAa,CAAC,8BAA8B,CAAC;GACjC,uBAAuB,CAoKnC;SApKY,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 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 /**\n * Cart Url\n */\n @property({ type: String }) cartUrl = 'https://gerai.kompas.id/cart'\n\n /**\n * Logout Url\n */\n @property({ type: String }) logoutUrl = 'https://account.kompas.id/logout'\n\n /**\n * Manage Account Url\n */\n @property({ type: String }) manageAccountUrl =\n 'https://account.kompas.id/manage-account/my-account'\n\n /**\n * Notification Url\n */\n @property({ type: String }) notificationUrl =\n 'https://account.kompas.id/manage-account/notification'\n\n /**\n * Orders Url\n */\n @property({ type: String }) ordersUrl =\n 'https://gerai.kompas.id/my-account/orders'\n\n /**\n * Read Later Url\n */\n @property({ type: String }) readLaterUrl = 'https://www.kompas.id/baca-nanti'\n\n /**\n * Total Notification Count\n */\n @property({ type: Number }) notificationTotal: number = 0\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 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 href=${this.manageAccountUrl} class=\"header-account-menu--item\">\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 <!-- Notifications -->\n <a href=${this.notificationUrl} class=\"header-account-menu--item\">\n <div class=\"icon icon-md icon-blue-600\">\n ${unsafeSVG(getFontAwesomeIcon('fas', 'bell'))}\n </div>\n <p class=\"header-account-menu--title\">Notifikasi</p>\n <p class=\"flex-none\">\n <!-- Conditional rendering based on notification count -->\n ${this.renderTotalBubble(this.notificationTotal)}\n </p>\n </a>\n <!-- Read Later -->\n <a href=${this.readLaterUrl} class=\"header-account-menu--item\">\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 href=${this.logoutUrl} class=\"header-account-menu--item\">\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"]}
@@ -0,0 +1,12 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class KompasHeaderAccountProfile extends LitElement {
3
+ static styles: import("lit").CSSResult[];
4
+ userInitialName: string;
5
+ userData: {};
6
+ subscriptionUrl: string;
7
+ totalGracePeriod: number;
8
+ private renderSkeletonLoading;
9
+ private renderProfileContent;
10
+ connectedCallback(): Promise<void>;
11
+ render(): import("lit").TemplateResult<1>;
12
+ }
@@ -0,0 +1,172 @@
1
+ import { __decorate } from "tslib";
2
+ import { LitElement, html, css } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import { TWStyles } from '../../../tailwind/tailwind.js';
5
+ import { truncate } from '../../utils/text.js';
6
+ let KompasHeaderAccountProfile = class KompasHeaderAccountProfile extends LitElement {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.userInitialName = '';
10
+ this.userData = {};
11
+ this.subscriptionUrl = '';
12
+ this.totalGracePeriod = 0;
13
+ }
14
+ renderSkeletonLoading() {
15
+ return html `
16
+ <div>
17
+ <div class="flex flex-row mb-5 items-center gap-4 leading-none">
18
+ <div
19
+ class="bg-grey-300 py-5 rounded-full h-16 w-16 animate-pulse"
20
+ ></div>
21
+ <div class="flex flex-col text-left w-40 gap-y-2">
22
+ <div class="h-3 rounded-sm w-full bg-grey-300 animate-pulse"></div>
23
+ <div class="h-3 rounded-sm w-full bg-grey-300 animate-pulse"></div>
24
+ <div class="h-3 rounded-sm w-full bg-grey-300 animate-pulse"></div>
25
+ </div>
26
+ </div>
27
+ <div>
28
+ <div class="h-6 rounded-sm w-full bg-grey-300 animate-pulse"></div>
29
+ </div>
30
+ </div>
31
+ `;
32
+ }
33
+ renderProfileContent() {
34
+ var _a;
35
+ /**
36
+ * Expired Button Element
37
+ */
38
+ const subscribeButton = () => {
39
+ var _a, _b;
40
+ if (!((_a = this.userData) === null || _a === void 0 ? void 0 : _a.updateMembership)) {
41
+ return html ``;
42
+ }
43
+ const handleSubscribe = () => {
44
+ window.location.href = this.subscriptionUrl;
45
+ };
46
+ return html `
47
+ <div class="w-full">
48
+ <button
49
+ onClick=${handleSubscribe}
50
+ class="w-full rounded-lg px-4 py-3 mt-4 h-10 flex justify-center items-center bg-green-500 text-grey-100 font-bold text-base focus:outline-none"
51
+ >
52
+ ${(_b = this.userData) === null || _b === void 0 ? void 0 : _b.updateMembership}
53
+ </button>
54
+ </div>
55
+ `;
56
+ };
57
+ /**
58
+ * expired Info Element
59
+ */
60
+ const expiredInfo = () => {
61
+ var _a, _b;
62
+ const isNearExpired = (_a = this.userData) === null || _a === void 0 ? void 0 : _a.isNearExpired;
63
+ const expiredTextColor = isNearExpired
64
+ ? `text-orange-400`
65
+ : `text-grey-600`;
66
+ return html `<p class="${expiredTextColor} font-bold">
67
+ ${(_b = this.userData) === null || _b === void 0 ? void 0 : _b.expired}
68
+ </p>`;
69
+ };
70
+ /**
71
+ * membership icon element, show if isMebership has truthy value
72
+ */
73
+ const membershipIcon = () => {
74
+ var _a;
75
+ if (!((_a = this.userData) === null || _a === void 0 ? void 0 : _a.isMembership)) {
76
+ return html ``;
77
+ }
78
+ return html `
79
+ <div>
80
+ <img
81
+ class="header-account--membership-icon"
82
+ src="https://d3w4qaq4xm1ncv.cloudfront.net/global-header/crown-blue-10.svg"
83
+ alt="membership-crown-icon"
84
+ />
85
+ </div>
86
+ `;
87
+ };
88
+ /**
89
+ * Active Info Element
90
+ */
91
+ const activeInfo = () => {
92
+ var _a, _b;
93
+ const isNearExpired = (_a = this.userData) === null || _a === void 0 ? void 0 : _a.isNearExpired;
94
+ const expiredTextColor = isNearExpired
95
+ ? `text-orange-400`
96
+ : `text-grey-600`;
97
+ return html `<p class="capitalize text-sm ${expiredTextColor}">
98
+ ${(_b = this.userData) === null || _b === void 0 ? void 0 : _b.activeInfo}
99
+ </p>`;
100
+ };
101
+ return html `<div
102
+ class="active-info flex flex-col items-start leading-none text-left"
103
+ >
104
+ <div class="flex flex-row items-center gap-4">
105
+ <div
106
+ class="flex bg-brand-1 flex-shrink-0 p-5 rounded-full h-16 w-16 items-center justify-center relative"
107
+ >
108
+ <span class="capitalize text-2xl text-grey-100 font-bold"
109
+ >${this.userInitialName}</span
110
+ >
111
+ ${membershipIcon()}
112
+ </div>
113
+
114
+ <div class="flex flex-col text-left">
115
+ <p class="capitalize font-bold text-base text-blue-600">
116
+ ${truncate((_a = this.userData) === null || _a === void 0 ? void 0 : _a.userName, 25)}
117
+ </p>
118
+ ${activeInfo()} ${expiredInfo()}
119
+ </div>
120
+ </div>
121
+
122
+ <div class="mt-4">
123
+ <!-- <kompas-grace-period
124
+ totalGracePeriod="{this.totalGracePeriod}"
125
+ isColoumn="{true}"
126
+ isShowButton="{true}"
127
+ /> -->
128
+ </div>
129
+
130
+ ${subscribeButton()}
131
+ </div>`;
132
+ }
133
+ async connectedCallback() {
134
+ super.connectedCallback();
135
+ }
136
+ render() {
137
+ return html `
138
+ <div class="flex flex-shrink-0 flex-col bg-blue-100 p-4">
139
+ ${!this.userData
140
+ ? this.renderSkeletonLoading()
141
+ : this.renderProfileContent()}
142
+ </div>
143
+ `;
144
+ }
145
+ };
146
+ KompasHeaderAccountProfile.styles = [
147
+ css `
148
+ .header-account--membership-icon {
149
+ position: absolute;
150
+ bottom: -2px;
151
+ right: -2px;
152
+ }
153
+ `,
154
+ TWStyles,
155
+ ];
156
+ __decorate([
157
+ property({ type: String })
158
+ ], KompasHeaderAccountProfile.prototype, "userInitialName", void 0);
159
+ __decorate([
160
+ property({ type: Object })
161
+ ], KompasHeaderAccountProfile.prototype, "userData", void 0);
162
+ __decorate([
163
+ property({ type: String })
164
+ ], KompasHeaderAccountProfile.prototype, "subscriptionUrl", void 0);
165
+ __decorate([
166
+ property({ type: Number })
167
+ ], KompasHeaderAccountProfile.prototype, "totalGracePeriod", void 0);
168
+ KompasHeaderAccountProfile = __decorate([
169
+ customElement('kompasid-header-account-profile')
170
+ ], KompasHeaderAccountProfile);
171
+ export { KompasHeaderAccountProfile };
172
+ //# sourceMappingURL=KompasHeaderAccountProfile.js.map
@@ -0,0 +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,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAGvC,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,UAAU;IAAnD;;QAYuB,oBAAe,GAAG,EAAE,CAAA;QACpB,aAAQ,GAAG,EAAE,CAAA;QACb,oBAAe,GAAG,EAAE,CAAA;QACpB,qBAAgB,GAAG,CAAC,CAAA;IA2IlD,CAAC;IAzIS,qBAAqB;QAC3B,OAAO,IAAI,CAAA;;;;;;;;;;;;;;;;KAgBV,CAAA;IACH,CAAC;IAEO,oBAAoB;;QAC1B;;WAEG;QACH,MAAM,eAAe,GAAG,GAAG,EAAE;;YAC3B,IAAI,CAAC,CAAA,MAAC,IAAI,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;;;;eAQA,IAAI,CAAC,eAAe;;YAEvB,cAAc,EAAE;;;;;cAKd,QAAQ,CAAC,MAAC,IAAI,CAAC,QAAgB,0CAAE,QAAQ,EAAE,EAAE,CAAC;;YAEhD,UAAU,EAAE,IAAI,WAAW,EAAE;;;;;;;;;;;;QAYjC,eAAe,EAAE;WACd,CAAA;IACT,CAAC;IAEQ,KAAK,CAAC,iBAAiB;QAC9B,KAAK,CAAC,iBAAiB,EAAE,CAAA;IAC3B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;UAEL,CAAC,IAAI,CAAC,QAAQ;YACd,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE;YAC9B,CAAC,CAAC,IAAI,CAAC,oBAAoB,EAAE;;KAElC,CAAA;IACH,CAAC;;AAxJM,iCAAM,GAAG;IACd,GAAG,CAAA;;;;;;KAMF;IACD,QAAQ;CACT,CAAA;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oEAAqB;AAfrC,0BAA0B;IADtC,aAAa,CAAC,iCAAiC,CAAC;GACpC,0BAA0B,CA0JtC;SA1JY,0BAA0B","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { truncate } from '../../utils/text.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 @property({ type: String }) userInitialName = ''\n @property({ type: Object }) userData = {}\n @property({ type: String }) subscriptionUrl = ''\n @property({ type: Number }) totalGracePeriod = 0\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 * Expired Button Element\n */\n const subscribeButton = () => {\n if (!(this.userData as any)?.updateMembership) {\n return html``\n }\n const handleSubscribe = () => {\n window.location.href = this.subscriptionUrl\n }\n\n return html`\n <div class=\"w-full\">\n <button\n onClick=${handleSubscribe}\n class=\"w-full rounded-lg px-4 py-3 mt-4 h-10 flex justify-center items-center bg-green-500 text-grey-100 font-bold text-base focus:outline-none\"\n >\n ${(this.userData as any)?.updateMembership}\n </button>\n </div>\n `\n }\n /**\n * expired Info Element\n */\n const expiredInfo = () => {\n const isNearExpired = (this.userData as any)?.isNearExpired\n const expiredTextColor = isNearExpired\n ? `text-orange-400`\n : `text-grey-600`\n\n return html`<p class=\"${expiredTextColor} font-bold\">\n ${(this.userData as any)?.expired}\n </p>`\n }\n\n /**\n * membership icon element, show if isMebership has truthy value\n */\n const membershipIcon = () => {\n if (!(this.userData as any)?.isMembership) {\n return html``\n }\n\n return html`\n <div>\n <img\n class=\"header-account--membership-icon\"\n src=\"https://d3w4qaq4xm1ncv.cloudfront.net/global-header/crown-blue-10.svg\"\n alt=\"membership-crown-icon\"\n />\n </div>\n `\n }\n\n /**\n * Active Info Element\n */\n\n const activeInfo = () => {\n const isNearExpired = (this.userData as any)?.isNearExpired\n const expiredTextColor = isNearExpired\n ? `text-orange-400`\n : `text-grey-600`\n\n return html`<p class=\"capitalize text-sm ${expiredTextColor}\">\n ${(this.userData as any)?.activeInfo}\n </p>`\n }\n\n return html`<div\n class=\"active-info flex flex-col items-start leading-none text-left\"\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}</span\n >\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 ${truncate((this.userData as any)?.userName, 25)}\n </p>\n ${activeInfo()} ${expiredInfo()}\n </div>\n </div>\n\n <div class=\"mt-4\">\n <!-- <kompas-grace-period\n totalGracePeriod=\"{this.totalGracePeriod}\"\n isColoumn=\"{true}\"\n isShowButton=\"{true}\"\n /> -->\n </div>\n\n ${subscribeButton()}\n </div>`\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 bg-blue-100 p-4\">\n ${!this.userData\n ? this.renderSkeletonLoading()\n : this.renderProfileContent()}\n </div>\n `\n }\n}\n"]}
@@ -123,12 +123,13 @@ let KompasMeteredWallRegister = class KompasMeteredWallRegister extends LitEleme
123
123
  <div>
124
124
  <div
125
125
  class="${this.isDesktop
126
- ? 'cont-banner-content justify-center'
127
- : null} flex flex-row justify-between"
126
+ ? 'cont-banner-content'
127
+ : 'justify-between'} flex flex-row"
128
128
  >
129
+ <div .hidden="${!this.isDesktop}" class="w-9 h-9"></div>
129
130
  <div class="banner-content flex flex-row">
130
131
  <div
131
- class="text-base md:text-lg font-lora mb-3 mt-1 md:mb-0 md:mt-0 pr-14 md:px-0"
132
+ class="text-base md:text-lg font-lora mb-3 mt-1 pt-[5px] md:mb-0 md:mt-0 pr-14 md:px-0"
132
133
  .innerHTML=${this.setTemplate('title')}
133
134
  ></div>
134
135
  <div .hidden="${!this.isDesktop}" class="md:self-center btn-regis">
@@ -175,7 +176,7 @@ let KompasMeteredWallRegister = class KompasMeteredWallRegister extends LitEleme
175
176
  class="text-sm md:text-base"
176
177
  .innerHTML=${this.setTemplate('description', 'expand')}
177
178
  ></p>
178
- <div class="${this.isDesktop ? null : 'expanded-btn'} md:self-start">
179
+ <div class="${this.isDesktop ? 'expanded-btn' : null} md:self-start">
179
180
  ${this.registerButtonTemplate()}
180
181
  </div>
181
182
  </div>
@@ -209,8 +210,8 @@ let KompasMeteredWallRegister = class KompasMeteredWallRegister extends LitEleme
209
210
  registerButtonTemplate() {
210
211
  return html `
211
212
  <button
212
- onClick=${this.redirectToRegister}
213
- class="bg-green-500 px-5 py-3 w-full rounded-md font-bold text-grey-100 text-sm md:text-base"
213
+ @click=${this.redirectToRegister}
214
+ class="bg-green-500 p-1.5 w-full rounded-md font-bold text-grey-100 text-sm md:text-base"
214
215
  >
215
216
  Daftar Akun
216
217
  </button>
@@ -306,11 +307,10 @@ KompasMeteredWallRegister.styles = [
306
307
 
307
308
  .banner-content {
308
309
  gap: 55px;
309
- justify-content: space-between;
310
310
  }
311
311
 
312
312
  .cont-banner-content {
313
- gap: 201px;
313
+ justify-content: space-evenly;
314
314
  }
315
315
 
316
316
  .expanded-btn {
@@ -1 +1 @@
1
- {"version":3,"file":"KompasMeteredWallRegister.js","sourceRoot":"","sources":["../../../../src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,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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EAAE,CAAC;oEAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wEAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0EAA6B;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0EAA6B;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iFAAoC;AACnC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6EAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oEAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8EAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4EAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+EAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sEAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DACqG;AAzGrH,yBAAyB;IADrC,aAAa,CAAC,gCAAgC,CAAC;GACnC,yBAAyB,CAoVrC;SApVY,yBAAyB","sourcesContent":["import { html, css, LitElement } 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'\nimport { meteredRegisterContent } from './types.js'\n\n@customElement('kompasid-metered-wall-register')\nexport class KompasMeteredWallRegister extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n\n .body {\n position: sticky;\n top: 0;\n height: 100%;\n width: 100%;\n }\n\n .btn-regis {\n margin-left: 16px;\n width: 127px;\n }\n\n .banner-content {\n gap: 55px;\n justify-content: space-between;\n }\n\n .cont-banner-content {\n gap: 201px;\n }\n\n .expanded-btn {\n width: 127px;\n }\n `,\n TWStyles,\n ]\n\n /**\n * state\n */\n /**\n * state registerUrl untuk memberikan link kemana user akan dialihkan.\n */\n @state() registerUrl: string =\n 'https://account.kompas.id/register?loc=metered_register_wall'\n /**\n * state isShowBanner untuk memunculkan component.\n */\n @state() isShowBanner: boolean = true\n /**\n * state isExpandBanner untuk menentukan apakah component sedang dalam mode expand.\n */\n @state() isExpandBanner: boolean = true\n /**\n * state textTemplate untuk menyimpan template yang di berikan.\n */\n @state() private textTemplate: meteredRegisterContent = {\n default: { title: '', lastArticle: { title: '' } },\n expand: {\n title: '',\n description: '',\n lastArticle: { title: '', description: '' },\n },\n }\n /**\n * Props\n */\n /**\n * prop countdownArticle untuk menghandle sudah berapa artikel gratis yang user baca.\n * prop defaultExpandBanner untuk menentukan keadaan awal komponen apakah dalam mode expand atau tidak.\n * prop tracker_page_title untuk title of the page\n * prop tracker_page_type untuk type of the page\n * prop tracker_content_type untuk whether it's a free article or paid article (will only be sent if the user views article detail page)\n * prop tracker_content_id untuk the ID for the article (will only be sent if the user views article detail page)\n * prop tracker_content_title untuk the title of the article (will only be sent if the user views article detail page)\n * prop tracker_content_authors untuk name of the authors (will only be sent if the user views article detail page)\n * prop tracker_content_editors untuk name of the editors (will only be sent if the user views article detail page)\n * prop tracker_content_tags untuk tags inside the article (will only be sent if the user views article detail page)\n * prop tracker_content_published_date untuk the published date (will only be sent if the user views article detail page)\n * prop tracker_content_categories untuk The main category the content belongs to\n * prop tracker_user_type untuk type of user based on their subscription\n * prop tracker_subscription_status untuk status of their subscription\n * prop tracker_metered_wall_type untuk the type of Metered Wall\n * prop tracker_metered_wall_balance untuk the balance of their metered wall\n * prop tracker_page_domain untuk Page Domain\n * prop next_param untuk page Domain\n */\n\n @property({ type: Number }) countdownArticle = 0\n @property({ type: Boolean }) defaultExpandBanner = false\n @property({ type: Boolean }) isDesktop = false\n @property({ type: String }) tracker_page_title = ''\n @property({ type: String }) tracker_page_type = ''\n @property({ type: String }) tracker_content_type = ''\n @property({ type: String }) tracker_content_id = ''\n @property({ type: String }) tracker_content_title = ''\n @property({ type: String }) tracker_content_authors = ''\n @property({ type: String }) tracker_content_editors = ''\n @property({ type: String }) tracker_content_tags = ''\n @property({ type: String }) tracker_content_published_date = ''\n @property({ type: String }) tracker_content_categories = ''\n @property({ type: String }) tracker_user_type = ''\n @property({ type: String }) tracker_subscription_status = ''\n @property({ type: String }) tracker_metered_wall_type = ''\n @property({ type: Number }) tracker_metered_wall_balance = 0\n @property({ type: String }) tracker_page_domain = ''\n @property({ type: String }) next_param =\n 'https://www.kompas.id/baca/opini/2023/12/05/masa-depan-wolbachia-sebagai-alternatif-pengendalian-dbd?open_from=Section_Opini'\n\n /**\n * menentukan template yang akan di render\n */\n private setTemplate(\n prop: string,\n mode: keyof meteredRegisterContent = 'default'\n ): string {\n let template = ''\n\n // dynamicMode dibuat agar typescript bisa akses data lastArticle\n const dynamicMode = this.textTemplate[mode]\n\n if ('lastArticle' in dynamicMode) {\n const lastArticleMode = dynamicMode as {\n lastArticle: { [key: string]: string }\n }\n template = lastArticleMode.lastArticle[prop] || ''\n } else {\n template = dynamicMode[prop] || ''\n }\n return template\n }\n\n private checkIsDesktop() {\n if (window.innerWidth >= 960) {\n this.isDesktop = true\n } else {\n this.isDesktop = false\n }\n }\n\n /**\n * Render Statement\n */\n\n private bannerTemplate() {\n return this.isExpandBanner\n ? this.expandedBannerContent()\n : this.defaultBannerContent()\n }\n\n private defaultBannerContent() {\n return html`\n <div>\n <div\n class=\"${this.isDesktop\n ? 'cont-banner-content justify-center'\n : null} flex flex-row justify-between\"\n >\n <div class=\"banner-content flex flex-row\">\n <div\n class=\"text-base md:text-lg font-lora mb-3 mt-1 md:mb-0 md:mt-0 pr-14 md:px-0\"\n .innerHTML=${this.setTemplate('title')}\n ></div>\n <div .hidden=\"${!this.isDesktop}\" class=\"md:self-center btn-regis\">\n ${this.isDesktop\n ? html`<div class=\"ml-4\"></div>\n ${this.registerButtonTemplate()}`\n : null}\n </div>\n </div>\n <div>\n <button\n @click=\"${this.triggerExpandBanner}\"\n class=\"h-9 w-9 flex ml-2 items-center justify-center text-blue-500 rounded bg-blue-200\"\n >\n <div\n class=\"icon icon-blue-600 ${this.isExpandBanner\n ? 'chevron-down'\n : 'rotate-180'}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}\n </div>\n </button>\n </div>\n </div>\n <div class=\"md:self-center mt-4\">\n ${!this.isDesktop ? html`${this.registerButtonTemplate()} ` : null}\n </div>\n </div>\n `\n }\n\n private expandedBannerContent() {\n return html`\n <div\n class=\"flex flex-col-reverse justify-evenly md:flex-row gap-4 md:gap-8\"\n >\n <div\n class=\"flex flex-col justify-evenly md:text-left md:w-5/12 gap-4 md:gap-2\"\n >\n <p\n class=\"text-lg md:text-2xl font-lora\"\n .innerHTML=${this.setTemplate('title', 'expand')}\n ></p>\n <p\n class=\"text-sm md:text-base\"\n .innerHTML=${this.setTemplate('description', 'expand')}\n ></p>\n <div class=\"${this.isDesktop ? null : 'expanded-btn'} md:self-start\">\n ${this.registerButtonTemplate()}\n </div>\n </div>\n <div class=\"flex justify-center\">\n <img\n alt=\"metered-wall-register\"\n src=\"https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/paywall_ilustrasi3-03_1.png\"\n class=\"h-40 w-40 md:w-full md:h-full\"\n />\n </div>\n <button\n @click=\"${this.triggerExpandBanner}\"\n class=\"h-9 w-9 ${this.isDesktop\n ? null\n : 'ml-auto'} flex items-center justify-center text-blue-500 rounded bg-blue-200\"\n >\n <div\n class=\"icon icon-blue-600 ${this.isExpandBanner\n ? 'chevron-down'\n : 'rotate-180'}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}\n </div>\n </button>\n </div>\n `\n }\n\n /**\n * template button register\n */\n private registerButtonTemplate() {\n return html`\n <button\n onClick=${this.redirectToRegister}\n class=\"bg-green-500 px-5 py-3 w-full rounded-md font-bold text-grey-100 text-sm md:text-base\"\n >\n Daftar Akun\n </button>\n `\n }\n\n /**\n * mengarahkan ke page register\n */\n private redirectToRegister = (): void => {\n this.pushToDataLayer('mrw_clicked')\n const newUrl = new URL(decodeURIComponent(this.registerUrl))\n if (this.next_param)\n newUrl.searchParams.append('next', decodeURIComponent(this.next_param))\n window.location.href = newUrl.toString()\n }\n\n /**\n * mengirim event ke datalayer\n */\n private pushToDataLayer(eventName: string) {\n window.dataLayer.push({\n event: eventName,\n page_title: this.tracker_page_title,\n page_type: this.tracker_page_type,\n content_type: this.tracker_content_type,\n content_id: this.tracker_content_id,\n content_title: this.tracker_content_title,\n content_authors: this.tracker_content_authors,\n content_editors: this.tracker_content_editors,\n content_tags: this.tracker_content_tags,\n content_published_date: this.tracker_content_published_date,\n content_categories: this.tracker_content_categories,\n user_type: this.tracker_user_type || 'G',\n subscription_status: this.tracker_subscription_status || '',\n metered_wall_type: this.tracker_metered_wall_type || 'MRW',\n metered_wall_balance: this.tracker_metered_wall_balance,\n page_domain: this.tracker_page_domain || 'Kompas.id',\n })\n }\n\n /**\n * toggle isExpandBanner flag\n */\n private triggerExpandBanner() {\n this.isExpandBanner = !this.isExpandBanner\n return !this.isExpandBanner && this.pushToDataLayer('mrw_closed')\n }\n\n /**\n * Lifecycle\n */\n\n override async connectedCallback() {\n super.connectedCallback()\n await this.updateComplete\n this.loadData()\n this.checkIsDesktop()\n }\n\n private async loadData() {\n const req = await fetch(\n `https://d3w4qaq4xm1ncv.cloudfront.net/assets/register_wall.json`\n )\n\n if (req.status !== 200) {\n throw new Error(`${req.status} Ada galat saat memproses permintaan.`)\n }\n\n this.textTemplate = await req.json()\n\n const getCountdown = this.countdownArticle\n\n if (!getCountdown) {\n this.isShowBanner = false\n } else {\n this.isExpandBanner = this.defaultExpandBanner\n }\n\n if (this.isShowBanner) {\n this.pushToDataLayer('mrw_viewed')\n }\n }\n\n render() {\n return this.isShowBanner\n ? html`\n <div class=\"sticky bottom-0 w-full h-full z-20\">\n <div class=\"w-full bg-blue-100 px-4 xl:px-0 bottom-0 py-4\">\n <div class=\"lg:max-w-7xl m-auto relative\">\n <div>${this.bannerTemplate()}</div>\n </div>\n </div>\n </div>\n `\n : null\n }\n}\n"]}
1
+ {"version":3,"file":"KompasMeteredWallRegister.js","sourceRoot":"","sources":["../../../../src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,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;AAIjD,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,UAAU;IAAlD;;QAkCL;;WAEG;QACH;;WAEG;QACM,gBAAW,GAClB,8DAA8D,CAAA;QAChE;;WAEG;QACM,iBAAY,GAAY,IAAI,CAAA;QACrC;;WAEG;QACM,mBAAc,GAAY,IAAI,CAAA;QACvC;;WAEG;QACc,iBAAY,GAA2B;YACtD,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YAClD,M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AQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0EAA6B;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iFAAoC;AACnC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6EAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oEAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8EAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4EAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+EAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sEAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DACqG;AAxGrH,yBAAyB;IADrC,aAAa,CAAC,gCAAgC,CAAC;GACnC,yBAAyB,CAoVrC;SApVY,yBAAyB","sourcesContent":["import { html, css, LitElement } 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'\nimport { meteredRegisterContent } from './types.js'\n\n@customElement('kompasid-metered-wall-register')\nexport class KompasMeteredWallRegister extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n\n .body {\n position: sticky;\n top: 0;\n height: 100%;\n width: 100%;\n }\n\n .btn-regis {\n margin-left: 16px;\n width: 127px;\n }\n\n .banner-content {\n gap: 55px;\n }\n\n .cont-banner-content {\n justify-content: space-evenly;\n }\n\n .expanded-btn {\n width: 127px;\n }\n `,\n TWStyles,\n ]\n\n /**\n * state\n */\n /**\n * state registerUrl untuk memberikan link kemana user akan dialihkan.\n */\n @state() registerUrl: string =\n 'https://account.kompas.id/register?loc=metered_register_wall'\n /**\n * state isShowBanner untuk memunculkan component.\n */\n @state() isShowBanner: boolean = true\n /**\n * state isExpandBanner untuk menentukan apakah component sedang dalam mode expand.\n */\n @state() isExpandBanner: boolean = true\n /**\n * state textTemplate untuk menyimpan template yang di berikan.\n */\n @state() private textTemplate: meteredRegisterContent = {\n default: { title: '', lastArticle: { title: '' } },\n expand: {\n title: '',\n description: '',\n lastArticle: { title: '', description: '' },\n },\n }\n /**\n * Props\n */\n /**\n * prop countdownArticle untuk menghandle sudah berapa artikel gratis yang user baca.\n * prop defaultExpandBanner untuk menentukan keadaan awal komponen apakah dalam mode expand atau tidak.\n * prop tracker_page_title untuk title of the page\n * prop tracker_page_type untuk type of the page\n * prop tracker_content_type untuk whether it's a free article or paid article (will only be sent if the user views article detail page)\n * prop tracker_content_id untuk the ID for the article (will only be sent if the user views article detail page)\n * prop tracker_content_title untuk the title of the article (will only be sent if the user views article detail page)\n * prop tracker_content_authors untuk name of the authors (will only be sent if the user views article detail page)\n * prop tracker_content_editors untuk name of the editors (will only be sent if the user views article detail page)\n * prop tracker_content_tags untuk tags inside the article (will only be sent if the user views article detail page)\n * prop tracker_content_published_date untuk the published date (will only be sent if the user views article detail page)\n * prop tracker_content_categories untuk The main category the content belongs to\n * prop tracker_user_type untuk type of user based on their subscription\n * prop tracker_subscription_status untuk status of their subscription\n * prop tracker_metered_wall_type untuk the type of Metered Wall\n * prop tracker_metered_wall_balance untuk the balance of their metered wall\n * prop tracker_page_domain untuk Page Domain\n * prop next_param untuk page Domain\n */\n\n @property({ type: Number }) countdownArticle = 0\n @property({ type: Boolean }) defaultExpandBanner = false\n @property({ type: Boolean }) isDesktop = false\n @property({ type: String }) tracker_page_title = ''\n @property({ type: String }) tracker_page_type = ''\n @property({ type: String }) tracker_content_type = ''\n @property({ type: String }) tracker_content_id = ''\n @property({ type: String }) tracker_content_title = ''\n @property({ type: String }) tracker_content_authors = ''\n @property({ type: String }) tracker_content_editors = ''\n @property({ type: String }) tracker_content_tags = ''\n @property({ type: String }) tracker_content_published_date = ''\n @property({ type: String }) tracker_content_categories = ''\n @property({ type: String }) tracker_user_type = ''\n @property({ type: String }) tracker_subscription_status = ''\n @property({ type: String }) tracker_metered_wall_type = ''\n @property({ type: Number }) tracker_metered_wall_balance = 0\n @property({ type: String }) tracker_page_domain = ''\n @property({ type: String }) next_param =\n 'https://www.kompas.id/baca/opini/2023/12/05/masa-depan-wolbachia-sebagai-alternatif-pengendalian-dbd?open_from=Section_Opini'\n\n /**\n * menentukan template yang akan di render\n */\n private setTemplate(\n prop: string,\n mode: keyof meteredRegisterContent = 'default'\n ): string {\n let template = ''\n\n // dynamicMode dibuat agar typescript bisa akses data lastArticle\n const dynamicMode = this.textTemplate[mode]\n\n if ('lastArticle' in dynamicMode) {\n const lastArticleMode = dynamicMode as {\n lastArticle: { [key: string]: string }\n }\n template = lastArticleMode.lastArticle[prop] || ''\n } else {\n template = dynamicMode[prop] || ''\n }\n return template\n }\n\n private checkIsDesktop() {\n if (window.innerWidth >= 960) {\n this.isDesktop = true\n } else {\n this.isDesktop = false\n }\n }\n\n /**\n * Render Statement\n */\n\n private bannerTemplate() {\n return this.isExpandBanner\n ? this.expandedBannerContent()\n : this.defaultBannerContent()\n }\n\n private defaultBannerContent() {\n return html`\n <div>\n <div\n class=\"${this.isDesktop\n ? 'cont-banner-content'\n : 'justify-between'} flex flex-row\"\n >\n <div .hidden=\"${!this.isDesktop}\" class=\"w-9 h-9\"></div>\n <div class=\"banner-content flex flex-row\">\n <div\n class=\"text-base md:text-lg font-lora mb-3 mt-1 pt-[5px] md:mb-0 md:mt-0 pr-14 md:px-0\"\n .innerHTML=${this.setTemplate('title')}\n ></div>\n <div .hidden=\"${!this.isDesktop}\" class=\"md:self-center btn-regis\">\n ${this.isDesktop\n ? html`<div class=\"ml-4\"></div>\n ${this.registerButtonTemplate()}`\n : null}\n </div>\n </div>\n <div>\n <button\n @click=\"${this.triggerExpandBanner}\"\n class=\"h-9 w-9 flex ml-2 items-center justify-center text-blue-500 rounded bg-blue-200\"\n >\n <div\n class=\"icon icon-blue-600 ${this.isExpandBanner\n ? 'chevron-down'\n : 'rotate-180'}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}\n </div>\n </button>\n </div>\n </div>\n <div class=\"md:self-center mt-4\">\n ${!this.isDesktop ? html`${this.registerButtonTemplate()} ` : null}\n </div>\n </div>\n `\n }\n\n private expandedBannerContent() {\n return html`\n <div\n class=\"flex flex-col-reverse justify-evenly md:flex-row gap-4 md:gap-8\"\n >\n <div\n class=\"flex flex-col justify-evenly md:text-left md:w-5/12 gap-4 md:gap-2\"\n >\n <p\n class=\"text-lg md:text-2xl font-lora\"\n .innerHTML=${this.setTemplate('title', 'expand')}\n ></p>\n <p\n class=\"text-sm md:text-base\"\n .innerHTML=${this.setTemplate('description', 'expand')}\n ></p>\n <div class=\"${this.isDesktop ? 'expanded-btn' : null} md:self-start\">\n ${this.registerButtonTemplate()}\n </div>\n </div>\n <div class=\"flex justify-center\">\n <img\n alt=\"metered-wall-register\"\n src=\"https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/paywall_ilustrasi3-03_1.png\"\n class=\"h-40 w-40 md:w-full md:h-full\"\n />\n </div>\n <button\n @click=\"${this.triggerExpandBanner}\"\n class=\"h-9 w-9 ${this.isDesktop\n ? null\n : 'ml-auto'} flex items-center justify-center text-blue-500 rounded bg-blue-200\"\n >\n <div\n class=\"icon icon-blue-600 ${this.isExpandBanner\n ? 'chevron-down'\n : 'rotate-180'}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}\n </div>\n </button>\n </div>\n `\n }\n\n /**\n * template button register\n */\n private registerButtonTemplate() {\n return html`\n <button\n @click=${this.redirectToRegister}\n class=\"bg-green-500 p-1.5 w-full rounded-md font-bold text-grey-100 text-sm md:text-base\"\n >\n Daftar Akun\n </button>\n `\n }\n\n /**\n * mengarahkan ke page register\n */\n private redirectToRegister = (): void => {\n this.pushToDataLayer('mrw_clicked')\n const newUrl = new URL(decodeURIComponent(this.registerUrl))\n if (this.next_param)\n newUrl.searchParams.append('next', decodeURIComponent(this.next_param))\n window.location.href = newUrl.toString()\n }\n\n /**\n * mengirim event ke datalayer\n */\n private pushToDataLayer(eventName: string) {\n window.dataLayer.push({\n event: eventName,\n page_title: this.tracker_page_title,\n page_type: this.tracker_page_type,\n content_type: this.tracker_content_type,\n content_id: this.tracker_content_id,\n content_title: this.tracker_content_title,\n content_authors: this.tracker_content_authors,\n content_editors: this.tracker_content_editors,\n content_tags: this.tracker_content_tags,\n content_published_date: this.tracker_content_published_date,\n content_categories: this.tracker_content_categories,\n user_type: this.tracker_user_type || 'G',\n subscription_status: this.tracker_subscription_status || '',\n metered_wall_type: this.tracker_metered_wall_type || 'MRW',\n metered_wall_balance: this.tracker_metered_wall_balance,\n page_domain: this.tracker_page_domain || 'Kompas.id',\n })\n }\n\n /**\n * toggle isExpandBanner flag\n */\n private triggerExpandBanner() {\n this.isExpandBanner = !this.isExpandBanner\n return !this.isExpandBanner && this.pushToDataLayer('mrw_closed')\n }\n\n /**\n * Lifecycle\n */\n\n override async connectedCallback() {\n super.connectedCallback()\n await this.updateComplete\n this.loadData()\n this.checkIsDesktop()\n }\n\n private async loadData() {\n const req = await fetch(\n `https://d3w4qaq4xm1ncv.cloudfront.net/assets/register_wall.json`\n )\n\n if (req.status !== 200) {\n throw new Error(`${req.status} Ada galat saat memproses permintaan.`)\n }\n\n this.textTemplate = await req.json()\n\n const getCountdown = this.countdownArticle\n\n if (!getCountdown) {\n this.isShowBanner = false\n } else {\n this.isExpandBanner = this.defaultExpandBanner\n }\n\n if (this.isShowBanner) {\n this.pushToDataLayer('mrw_viewed')\n }\n }\n\n render() {\n return this.isShowBanner\n ? html`\n <div class=\"sticky bottom-0 w-full h-full z-20\">\n <div class=\"w-full bg-blue-100 px-4 xl:px-0 bottom-0 py-4\">\n <div class=\"lg:max-w-7xl m-auto relative\">\n <div>${this.bannerTemplate()}</div>\n </div>\n </div>\n </div>\n `\n : null\n }\n}\n"]}
@@ -86,26 +86,8 @@ let KompasPaywall = class KompasPaywall extends LitElement {
86
86
  },
87
87
  packages: {
88
88
  title: 'Sekali bayar, tanpa perpanjang otomatis',
89
- memberships: [
90
- {
91
- title: 'Kompas Digital Premium 12 Bulan (Hemat 40%)',
92
- percentage: 40,
93
- price: 360000,
94
- discountPrice: 600000,
95
- periode: 'Tahun',
96
- isHighlight: true,
97
- url: 'https://checkoutv2.kompas.id/kdp?productId=9802032&referrer=',
98
- },
99
- {
100
- title: 'Kompas Digital Premium 1 Bulan',
101
- percentage: 0,
102
- discountPrice: 0,
103
- price: 50000,
104
- periode: 'Bulan',
105
- isHighlight: false,
106
- url: 'https://checkoutv2.kompas.id/kdp?productId=9802035&referrer=',
107
- },
108
- ],
89
+ memberships: [],
90
+ freeTrial: 'untuk 3 hari pertama',
109
91
  },
110
92
  payment: {
111
93
  desktop: [
@@ -251,6 +233,11 @@ let KompasPaywall = class KompasPaywall extends LitElement {
251
233
  title: json[this.type].head,
252
234
  description: json[this.type].content,
253
235
  },
236
+ packages: {
237
+ ...this.mockResult.packages,
238
+ memberships: json[this.type].memberships,
239
+ freeTrial: json[this.type].freeTrial,
240
+ },
254
241
  };
255
242
  }
256
243
  catch (error) {