@kompasid/lit-web-components 0.4.4 → 0.5.0

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 (53) hide show
  1. package/assets/font-awesome.ts +7 -4
  2. package/demo/index.html +147 -118
  3. package/dist/assets/font-awesome.d.ts +1 -1
  4. package/dist/assets/font-awesome.js +7 -4
  5. package/dist/assets/font-awesome.js.map +1 -1
  6. package/dist/src/components/kompasid-freewall/KompasFreewall.d.ts +91 -0
  7. package/dist/src/components/kompasid-freewall/KompasFreewall.js +256 -0
  8. package/dist/src/components/kompasid-freewall/KompasFreewall.js.map +1 -0
  9. package/dist/src/components/kompasid-freewall/types.d.ts +10 -0
  10. package/dist/src/components/kompasid-freewall/types.js +2 -0
  11. package/dist/src/components/kompasid-freewall/types.js.map +1 -0
  12. package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.d.ts +33 -0
  13. package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.js +223 -0
  14. package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.js.map +1 -0
  15. package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.d.ts +37 -0
  16. package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.js +122 -0
  17. package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.js.map +1 -0
  18. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.d.ts +0 -1
  19. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +3 -8
  20. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
  21. package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.d.ts +12 -13
  22. package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.js +30 -49
  23. package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.js.map +1 -1
  24. package/dist/src/index.d.ts +1 -0
  25. package/dist/src/index.js +1 -0
  26. package/dist/src/index.js.map +1 -1
  27. package/dist/src/utils/cta.d.ts +6 -0
  28. package/dist/src/utils/cta.js +18 -0
  29. package/dist/src/utils/cta.js.map +1 -0
  30. package/dist/src/utils/generateCopyDuration.d.ts +1 -0
  31. package/dist/src/utils/generateCopyDuration.js +15 -0
  32. package/dist/src/utils/generateCopyDuration.js.map +1 -0
  33. package/dist/src/utils/googleFont.js +1 -0
  34. package/dist/src/utils/googleFont.js.map +1 -1
  35. package/dist/tailwind/tailwind.js +215 -0
  36. package/dist/tailwind/tailwind.js.map +1 -1
  37. package/dist/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +1 -1
  39. package/src/components/kompasid-freewall/KompasFreewall.ts +205 -0
  40. package/src/components/kompasid-freewall/readme.md +31 -0
  41. package/src/components/kompasid-freewall/types.ts +10 -0
  42. package/src/components/kompasid-freewall-body/KompasFreewallBody.ts +219 -0
  43. package/src/components/kompasid-freewall-body/readme.md +13 -0
  44. package/src/components/kompasid-freewall-head/KompasFreewallHead.ts +102 -0
  45. package/src/components/kompasid-freewall-head/readme.md +17 -0
  46. package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +3 -9
  47. package/src/components/kompasid-paywall-video/KompasPaywallVideo.ts +36 -51
  48. package/src/index.ts +1 -0
  49. package/src/utils/cta.ts +25 -0
  50. package/src/utils/generateCopyDuration.ts +14 -0
  51. package/src/utils/googleFont.ts +2 -0
  52. package/tailwind/tailwind.css +215 -0
  53. package/tailwind/tailwind.ts +215 -0
@@ -0,0 +1,256 @@
1
+ import { __decorate } from "tslib";
2
+ import { html, css, LitElement, nothing } from 'lit';
3
+ import { property, customElement, state } from 'lit/decorators.js';
4
+ import { TWStyles } from '../../../tailwind/tailwind.js';
5
+ import { redirectToCheckout } from '../../utils/cta.js';
6
+ import '../kompasid-freewall-head/KompasFreewallHead.js';
7
+ import '../kompasid-freewall-body/KompasFreewallBody.js';
8
+ let KompasFreewall = class KompasFreewall extends LitElement {
9
+ constructor() {
10
+ super(...arguments);
11
+ /**
12
+ * Props
13
+ */
14
+ /**
15
+ * property isLogin untuk menghandle apakah user sudah login atau belum
16
+ * property type untuk menghandle tipe freewall
17
+ * property head_copy_expand to update copy header when expand
18
+ * property head_copy_collapse to update copy header when collapse
19
+ * property expand to handle expand/collapse
20
+ * property paywall_location is the location where user encounter the paywall
21
+ * property paywall_subscription_package is the name of the subscription package viewed by user
22
+ * property paywall_subscription_id is the ID of the subscription package viewed by user
23
+ * property paywall_subscription_price is the price of the subscription package viewed by user
24
+ * property paywall_position is the position of the subscription package viewed by user
25
+ * property tracker_page_type is the type of the page
26
+ * property tracker_page_title is the title of the page
27
+ * property tracker_content_id is the ID of article (slug)
28
+ * property content_title is the title of article
29
+ * property tracker_content_categories is the category of the content
30
+ * property tracker_content_type is to decide whether it's free article or paid article
31
+ * property tracker_user_type is the type of user based on their subscription
32
+ * property tracker_subscription_status is the status of their subscription
33
+ * property tracker_page_domain is the page domain
34
+ * property tracker_metered_wall_type is the type of metered wall
35
+ * property tracker_metered_wall_balance is the balance of their metered wall
36
+ */
37
+ this.isLogin = false;
38
+ this.type = 'article';
39
+ this.head_copy_expand = '';
40
+ this.head_copy_collapse = '';
41
+ this.expand = true;
42
+ this.paywall_location = '';
43
+ this.paywall_subscription_package = '';
44
+ this.paywall_subscription_id = 0;
45
+ this.paywall_subscription_price = 0;
46
+ this.paywall_position = 1;
47
+ this.tracker_page_type = '';
48
+ this.tracker_page_title = '';
49
+ this.tracker_content_id = '';
50
+ this.tracker_content_title = '';
51
+ this.tracker_content_categories = '';
52
+ this.tracker_content_type = '';
53
+ this.tracker_user_type = '';
54
+ this.tracker_subscription_status = '';
55
+ this.tracker_page_domain = '';
56
+ this.tracker_metered_wall_type = '';
57
+ this.tracker_metered_wall_balance = 0;
58
+ this.showPackage = {
59
+ duration: 1,
60
+ durationType: 3,
61
+ id: '9802035',
62
+ link: 'kdp?productId=9802035&referrer=',
63
+ price: 50000,
64
+ position: 1,
65
+ title: 'Kompas Digital Premium 1 Bulan',
66
+ referrer: '',
67
+ };
68
+ /**
69
+ * State
70
+ */
71
+ this.isExpand = true;
72
+ this.packageData = {};
73
+ }
74
+ /**
75
+ * Getter
76
+ */
77
+ get isArticle() {
78
+ return this.type === 'article';
79
+ }
80
+ /**
81
+ * Data Layer
82
+ */
83
+ sendDataLayer(event) {
84
+ const baseData = {
85
+ event,
86
+ paywall_location: this.paywall_location,
87
+ paywall_subscription_package: this.paywall_subscription_package || this.packageData.title,
88
+ paywall_subscription_id: this.paywall_subscription_id || this.packageData.id,
89
+ paywall_subscription_price: this.paywall_subscription_price || this.packageData.price,
90
+ paywall_position: this.paywall_position || this.packageData.position,
91
+ user_type: this.tracker_user_type,
92
+ subscription_status: this.tracker_subscription_status,
93
+ page_domain: this.tracker_page_domain || 'Kompas.id',
94
+ page_type: this.tracker_page_type,
95
+ metered_wall_type: this.tracker_metered_wall_type || 'FP',
96
+ metered_wall_balance: this.tracker_metered_wall_balance,
97
+ };
98
+ const data = this.isArticle
99
+ ? {
100
+ ...baseData,
101
+ content_id: this.tracker_content_id,
102
+ content_title: this.tracker_content_title,
103
+ content_categories: this.tracker_content_categories,
104
+ content_type: this.tracker_content_type,
105
+ }
106
+ : {
107
+ ...baseData,
108
+ page_title: this.tracker_page_title,
109
+ };
110
+ window.dataLayer.push(data);
111
+ }
112
+ sendDataLayerPaywallViewed() {
113
+ if (this.isExpand)
114
+ this.sendDataLayer('paywall_viewed');
115
+ }
116
+ sendDataLayerSubscribeButtonClicked() {
117
+ this.sendDataLayer('subscribe_button_clicked');
118
+ }
119
+ /**
120
+ * Logic Function
121
+ */
122
+ toggleExpand() {
123
+ this.isExpand = !this.isExpand;
124
+ this.sendDataLayerPaywallViewed();
125
+ }
126
+ onSubscriptionClick() {
127
+ this.sendDataLayerSubscribeButtonClicked();
128
+ redirectToCheckout({
129
+ link: `${this.packageData.link}${this.packageData.referrer}`,
130
+ source: this.type,
131
+ });
132
+ }
133
+ /**
134
+ * Lifecycle
135
+ */
136
+ async connectedCallback() {
137
+ super.connectedCallback();
138
+ await this.updateComplete;
139
+ this.isExpand = this.expand;
140
+ const originHost = encodeURIComponent(window.location.href);
141
+ this.packageData = { ...this.showPackage, referrer: originHost };
142
+ this.sendDataLayerPaywallViewed();
143
+ }
144
+ /**
145
+ * Render Statement
146
+ */
147
+ render() {
148
+ return html `
149
+ <div class="sticky bottom-0 w-full h-full z-20">
150
+ <div
151
+ class="flex flex-col w-full bg-blue-100 py-4 justify-center md:px-12 lg:px-24"
152
+ >
153
+ <kompasid-freewall-head
154
+ .expand=${this.isExpand}
155
+ .type=${this.type}
156
+ .head_copy_expand=${this.head_copy_expand}
157
+ .head_copy_collapse=${this.head_copy_collapse}
158
+ .toggleExpand=${() => this.toggleExpand()}
159
+ .onSubscriptionClick=${() => this.onSubscriptionClick()}
160
+ .packageData=${this.packageData}
161
+ ></kompasid-freewall-head>
162
+ ${this.isExpand
163
+ ? html `<kompasid-freewall-body
164
+ .type=${this.type}
165
+ .onSubscriptionClick=${() => this.onSubscriptionClick()}
166
+ .packageData=${this.packageData}
167
+ ?isLogin=${this.isLogin}
168
+ ></kompasid-freewall-body>`
169
+ : nothing}
170
+ </div>
171
+ </div>
172
+ `;
173
+ }
174
+ };
175
+ KompasFreewall.styles = [
176
+ css `
177
+ :host {
178
+ font-family: 'PT Sans', sans-serif;
179
+ }
180
+ `,
181
+ TWStyles,
182
+ ];
183
+ __decorate([
184
+ property({ type: Boolean })
185
+ ], KompasFreewall.prototype, "isLogin", void 0);
186
+ __decorate([
187
+ property({ type: String })
188
+ ], KompasFreewall.prototype, "type", void 0);
189
+ __decorate([
190
+ property({ type: String })
191
+ ], KompasFreewall.prototype, "head_copy_expand", void 0);
192
+ __decorate([
193
+ property({ type: String })
194
+ ], KompasFreewall.prototype, "head_copy_collapse", void 0);
195
+ __decorate([
196
+ property({ type: Boolean })
197
+ ], KompasFreewall.prototype, "expand", void 0);
198
+ __decorate([
199
+ property({ type: String })
200
+ ], KompasFreewall.prototype, "paywall_location", void 0);
201
+ __decorate([
202
+ property({ type: String })
203
+ ], KompasFreewall.prototype, "paywall_subscription_package", void 0);
204
+ __decorate([
205
+ property({ type: Number })
206
+ ], KompasFreewall.prototype, "paywall_subscription_id", void 0);
207
+ __decorate([
208
+ property({ type: Number })
209
+ ], KompasFreewall.prototype, "paywall_subscription_price", void 0);
210
+ __decorate([
211
+ property({ type: Number })
212
+ ], KompasFreewall.prototype, "paywall_position", void 0);
213
+ __decorate([
214
+ property({ type: String })
215
+ ], KompasFreewall.prototype, "tracker_page_type", void 0);
216
+ __decorate([
217
+ property({ type: String })
218
+ ], KompasFreewall.prototype, "tracker_page_title", void 0);
219
+ __decorate([
220
+ property({ type: String })
221
+ ], KompasFreewall.prototype, "tracker_content_id", void 0);
222
+ __decorate([
223
+ property({ type: String })
224
+ ], KompasFreewall.prototype, "tracker_content_title", void 0);
225
+ __decorate([
226
+ property({ type: String })
227
+ ], KompasFreewall.prototype, "tracker_content_categories", void 0);
228
+ __decorate([
229
+ property({ type: String })
230
+ ], KompasFreewall.prototype, "tracker_content_type", void 0);
231
+ __decorate([
232
+ property({ type: String })
233
+ ], KompasFreewall.prototype, "tracker_user_type", void 0);
234
+ __decorate([
235
+ property({ type: String })
236
+ ], KompasFreewall.prototype, "tracker_subscription_status", void 0);
237
+ __decorate([
238
+ property({ type: String })
239
+ ], KompasFreewall.prototype, "tracker_page_domain", void 0);
240
+ __decorate([
241
+ property({ type: String })
242
+ ], KompasFreewall.prototype, "tracker_metered_wall_type", void 0);
243
+ __decorate([
244
+ property({ type: Number })
245
+ ], KompasFreewall.prototype, "tracker_metered_wall_balance", void 0);
246
+ __decorate([
247
+ state()
248
+ ], KompasFreewall.prototype, "isExpand", void 0);
249
+ __decorate([
250
+ state()
251
+ ], KompasFreewall.prototype, "packageData", void 0);
252
+ KompasFreewall = __decorate([
253
+ customElement('kompasid-freewall')
254
+ ], KompasFreewall);
255
+ export { KompasFreewall };
256
+ //# sourceMappingURL=KompasFreewall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KompasFreewall.js","sourceRoot":"","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AM,EAAE,CAAC;wDAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kEAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oEAAiC;AAiBnD;IAAR,KAAK,EAAE;gDAAiC;AAChC;IAAR,KAAK,EAAE;mDAAqD;AA3ElD,cAAc;IAD1B,aAAa,CAAC,mBAAmB,CAAC;GACtB,cAAc,CAmM1B;SAnMY,cAAc","sourcesContent":["import { html, css, LitElement, nothing } from 'lit'\nimport { property, customElement, state } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { PackageData } from './types.js'\nimport { redirectToCheckout } from '../../utils/cta.js'\nimport '../kompasid-freewall-head/KompasFreewallHead.js'\nimport '../kompasid-freewall-body/KompasFreewallBody.js'\n\n@customElement('kompasid-freewall')\nexport class KompasFreewall extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n /**\n * property isLogin untuk menghandle apakah user sudah login atau belum\n * property type untuk menghandle tipe freewall\n * property head_copy_expand to update copy header when expand\n * property head_copy_collapse to update copy header when collapse\n * property expand to handle expand/collapse\n * property paywall_location is the location where user encounter the paywall\n * property paywall_subscription_package is the name of the subscription package viewed by user\n * property paywall_subscription_id is the ID of the subscription package viewed by user\n * property paywall_subscription_price is the price of the subscription package viewed by user\n * property paywall_position is the position of the subscription package viewed by user\n * property tracker_page_type is the type of the page\n * property tracker_page_title is the title of the page\n * property tracker_content_id is the ID of article (slug)\n * property content_title is the title of article\n * property tracker_content_categories is the category of the content\n * property tracker_content_type is to decide whether it's free article or paid article\n * property tracker_user_type is the type of user based on their subscription\n * property tracker_subscription_status is the status of their subscription\n * property tracker_page_domain is the page domain\n * property tracker_metered_wall_type is the type of metered wall\n * property tracker_metered_wall_balance is the balance of their metered wall\n */\n\n @property({ type: Boolean }) isLogin = false\n @property({ type: String }) type: 'article' | 'landing_page' = 'article'\n @property({ type: String }) head_copy_expand = ''\n @property({ type: String }) head_copy_collapse = ''\n @property({ type: Boolean }) expand = true\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 = 1\n @property({ type: String }) tracker_page_type = ''\n @property({ type: String }) tracker_page_title = ''\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 showPackage = {\n duration: 1,\n durationType: 3,\n id: '9802035',\n link: 'kdp?productId=9802035&referrer=',\n price: 50000,\n position: 1,\n title: 'Kompas Digital Premium 1 Bulan',\n referrer: '',\n }\n\n /**\n * State\n */\n\n @state() private isExpand: boolean = true\n @state() private packageData: PackageData = {} as PackageData\n\n /**\n * Getter\n */\n\n get isArticle() {\n return this.type === 'article'\n }\n\n /**\n * Data Layer\n */\n\n private sendDataLayer(event: string): void {\n const baseData = {\n event,\n paywall_location: this.paywall_location,\n paywall_subscription_package:\n this.paywall_subscription_package || this.packageData.title,\n paywall_subscription_id:\n this.paywall_subscription_id || this.packageData.id,\n paywall_subscription_price:\n this.paywall_subscription_price || this.packageData.price,\n paywall_position: this.paywall_position || this.packageData.position,\n user_type: this.tracker_user_type,\n subscription_status: this.tracker_subscription_status,\n page_domain: this.tracker_page_domain || 'Kompas.id',\n page_type: this.tracker_page_type,\n metered_wall_type: this.tracker_metered_wall_type || 'FP',\n metered_wall_balance: this.tracker_metered_wall_balance,\n }\n\n const data = this.isArticle\n ? {\n ...baseData,\n content_id: this.tracker_content_id,\n content_title: this.tracker_content_title,\n content_categories: this.tracker_content_categories,\n content_type: this.tracker_content_type,\n }\n : {\n ...baseData,\n page_title: this.tracker_page_title,\n }\n\n window.dataLayer.push(data)\n }\n\n private sendDataLayerPaywallViewed(): void {\n if (this.isExpand) this.sendDataLayer('paywall_viewed')\n }\n\n private sendDataLayerSubscribeButtonClicked(): void {\n this.sendDataLayer('subscribe_button_clicked')\n }\n\n /**\n * Logic Function\n */\n\n private toggleExpand() {\n this.isExpand = !this.isExpand\n this.sendDataLayerPaywallViewed()\n }\n\n private onSubscriptionClick() {\n this.sendDataLayerSubscribeButtonClicked()\n redirectToCheckout({\n link: `${this.packageData.link}${this.packageData.referrer}`,\n source: this.type,\n })\n }\n\n /**\n * Lifecycle\n */\n\n override async connectedCallback() {\n super.connectedCallback()\n await this.updateComplete\n this.isExpand = this.expand\n\n const originHost: string = encodeURIComponent(window.location.href)\n this.packageData = { ...this.showPackage, referrer: originHost }\n\n this.sendDataLayerPaywallViewed()\n }\n\n /**\n * Render Statement\n */\n\n render() {\n return html`\n <div class=\"sticky bottom-0 w-full h-full z-20\">\n <div\n class=\"flex flex-col w-full bg-blue-100 py-4 justify-center md:px-12 lg:px-24\"\n >\n <kompasid-freewall-head\n .expand=${this.isExpand}\n .type=${this.type}\n .head_copy_expand=${this.head_copy_expand}\n .head_copy_collapse=${this.head_copy_collapse}\n .toggleExpand=${() => this.toggleExpand()}\n .onSubscriptionClick=${() => this.onSubscriptionClick()}\n .packageData=${this.packageData}\n ></kompasid-freewall-head>\n ${this.isExpand\n ? html`<kompasid-freewall-body\n .type=${this.type}\n .onSubscriptionClick=${() => this.onSubscriptionClick()}\n .packageData=${this.packageData}\n ?isLogin=${this.isLogin}\n ></kompasid-freewall-body>`\n : nothing}\n </div>\n </div>\n `\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ export interface PackageData {
2
+ duration: number;
3
+ durationType: number;
4
+ id: string;
5
+ link: string;
6
+ price: number;
7
+ position: number;
8
+ title: string;
9
+ referrer: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/kompasid-freewall/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface PackageData {\n duration: number\n durationType: number\n id: string\n link: string\n price: number\n position: number\n title: string\n referrer: string\n}\n"]}
@@ -0,0 +1,33 @@
1
+ import { LitElement } from 'lit';
2
+ import { PackageData } from '../kompasid-freewall/types.js';
3
+ export declare class KompasFreewallBody extends LitElement {
4
+ static styles: import("lit").CSSResult[];
5
+ /**
6
+ * Props
7
+ */
8
+ /**
9
+ * property isLogin untuk menghandle apakah user sudah login atau belum
10
+ * property type untuk menghandle tipe freewall
11
+ * property onSubscriptionClick to handle cta when subscription button is clicked
12
+ * packageData sebagai data package yang diambil dari kompasid-freewall
13
+ */
14
+ isLogin: boolean;
15
+ type: 'article' | 'landing_page';
16
+ onSubscriptionClick: () => void;
17
+ packageData: PackageData;
18
+ description: string[];
19
+ /**
20
+ * Lifecycle
21
+ */
22
+ connectedCallback(): Promise<void>;
23
+ /**
24
+ * Component
25
+ */
26
+ private subscriptionCardComponent;
27
+ private registerCardComponent;
28
+ private descriptionSection;
29
+ /**
30
+ * Render Statement
31
+ */
32
+ render(): import("lit").TemplateResult<1>;
33
+ }
@@ -0,0 +1,223 @@
1
+ import { __decorate } from "tslib";
2
+ import { html, css, LitElement, nothing } from 'lit';
3
+ import { property, customElement } from 'lit/decorators.js';
4
+ import { TWStyles } from '../../../tailwind/tailwind.js';
5
+ import { addGoogleFonts } from '../../utils/googleFont.js';
6
+ import { formatRupiah } from '../../utils/formatRupiah.js';
7
+ import { generateCopyDuration } from '../../utils/generateCopyDuration.js';
8
+ import { faCheck } from '../../../assets/font-awesome.js';
9
+ import { redirectToRegister } from '../../utils/cta.js';
10
+ let KompasFreewallBody = class KompasFreewallBody extends LitElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ /**
14
+ * Props
15
+ */
16
+ /**
17
+ * property isLogin untuk menghandle apakah user sudah login atau belum
18
+ * property type untuk menghandle tipe freewall
19
+ * property onSubscriptionClick to handle cta when subscription button is clicked
20
+ * packageData sebagai data package yang diambil dari kompasid-freewall
21
+ */
22
+ this.isLogin = false;
23
+ this.type = 'article';
24
+ this.onSubscriptionClick = () => { };
25
+ this.packageData = {};
26
+ this.description = [
27
+ 'Akses seluruh konten Kompas.id di web & aplikasi',
28
+ 'ePaper hingga 30 edisi terakhir',
29
+ 'Buku digital tiap bulannya di aplikasi ',
30
+ ];
31
+ }
32
+ /**
33
+ * Lifecycle
34
+ */
35
+ async connectedCallback() {
36
+ super.connectedCallback();
37
+ await this.updateComplete;
38
+ addGoogleFonts(['pt-sans', 'lora', 'roboto-condensed']);
39
+ }
40
+ /**
41
+ * Component
42
+ */
43
+ subscriptionCardComponent() {
44
+ return html `
45
+ <div class="relative">
46
+ <div
47
+ id="subscription-card"
48
+ class="flex justify-between items-center relative z-10 flex-col w-[328px] ${this
49
+ .isLogin
50
+ ? 'h-[277px] md:w-[580px] md:h-[240px]'
51
+ : 'h-[223px] md:w-[350px] lg:w-[410px] md:h-[210px]'} py-3 px-[10px] md:p-5 md:pt-3 rounded-[10px] border-2 border-yellow-400 bg-white"
52
+ >
53
+ <div
54
+ class="flex w-full flex-col ${this.isLogin
55
+ ? 'items-center md:w-[374px] text-center'
56
+ : 'items-start text-start'}"
57
+ >
58
+ <h5
59
+ class="font-lora text-lg md:text-xl font-bold leading-[30px] ${this
60
+ .isLogin && 'w-60 md:w-full'} text-grey-600"
61
+ >
62
+ ${this.isLogin
63
+ ? 'Dukung Jurnalisme Mencerahkan dengan Berlangganan'
64
+ : 'Mulai Berlangganan'}
65
+ </h5>
66
+ ${this.descriptionSection()}
67
+ </div>
68
+ <button
69
+ @click=${this.onSubscriptionClick}
70
+ class="bg-green-500 whitespace-nowrap w-full rounded ${this
71
+ .isLogin &&
72
+ 'md:w-[370px]'} md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]"
73
+ >
74
+ Langganan ${formatRupiah(this.packageData.price)}
75
+ /${generateCopyDuration(this.packageData.durationType)}
76
+ </button>
77
+ </div>
78
+ <div id="ribbon-container">
79
+ <div
80
+ class="text-[11px] font-medium font-roboto-condensed flex justify-center items-center"
81
+ >
82
+ <span class="-ml-2">Penawaran Terbaik</span>
83
+ </div>
84
+ </div>
85
+ </div>
86
+ `;
87
+ }
88
+ registerCardComponent() {
89
+ return html `
90
+ <div
91
+ class="flex flex-col justify-between w-[328px] h-[159px] md:w-[350px] lg:w-[410px] md:h-[210px] py-3 px-[10px] md:p-5 md:pt-3 rounded-[10px] bg-white"
92
+ >
93
+ <div>
94
+ <h5
95
+ class="font-lora text-lg md:text-xl font-bold leading-[30px] text-grey-600"
96
+ >
97
+ Daftar Akun Gratis
98
+ </h5>
99
+ <div class="flex items-start lg:items-center mt-1 md:mt-3">
100
+ <div class="mt-1 lg:mt-0">${faCheck()}</div>
101
+ <h6 class="text-base text-grey-600 ml-1">
102
+ Akses ke 3 artikel berbayar gratis tiap bulan
103
+ </h6>
104
+ </div>
105
+ </div>
106
+ <button
107
+ @click=${() => redirectToRegister('freewall')}
108
+ class="bg-white border border-blue-600 whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-blue-600 font-bold leading-[18px]"
109
+ >
110
+ Daftar Gratis
111
+ </button>
112
+ </div>
113
+ `;
114
+ }
115
+ descriptionSection() {
116
+ return html `<div class="flex flex-col space-y-1 mt-1 lg:mt-3">
117
+ ${this.description.map(item => html `
118
+ <div class="flex items-start lg:items-center">
119
+ <div class="mt-1 lg:mt-0">${faCheck()}</div>
120
+ <h6 class="text-base text-grey-600 ml-1 text-start">${item}</h6>
121
+ </div>
122
+ `)}
123
+ </div>`;
124
+ }
125
+ /**
126
+ * Render Statement
127
+ */
128
+ render() {
129
+ return html `
130
+ <div
131
+ class="w-full h-full flex flex-col md:flex-row pt-6 md:pt-3 relative px-4 md:px-0 py-3 space-y-4 md:space-x-5 md:space-y-0 justify-center items-center"
132
+ >
133
+ ${this.subscriptionCardComponent()}
134
+ ${!this.isLogin ? this.registerCardComponent() : nothing}
135
+ </div>
136
+ `;
137
+ }
138
+ };
139
+ KompasFreewallBody.styles = [
140
+ css `
141
+ .font-lora {
142
+ font-family: 'Lora', 'Georgia', 'serif';
143
+ }
144
+
145
+ .font-roboto-condensed {
146
+ font-family: 'Roboto Condensed', sans-serif;
147
+ }
148
+
149
+ /* ----- Ribbon Container ---------------------------------------*/
150
+ #ribbon-container {
151
+ background: transparent;
152
+ height: 130px;
153
+ width: 200px;
154
+ position: absolute;
155
+ top: -5px;
156
+ right: -5px;
157
+ overflow: hidden;
158
+ }
159
+
160
+ /* ----- Top Curl ---------------------------------------*/
161
+ #ribbon-container:before {
162
+ content: '';
163
+ display: block;
164
+ -webkit-border-radius: 10px 10px 0px 0px;
165
+ border-radius: 10px 10px 0px 0px;
166
+ width: 35px;
167
+ height: 10px;
168
+ position: absolute;
169
+ right: 60px;
170
+ background: #b78b00;
171
+ z-index: 1;
172
+ }
173
+
174
+ /* ----- Right Curl ---------------------------------------*/
175
+ #ribbon-container:after {
176
+ content: '';
177
+ display: block;
178
+ -webkit-border-radius: 0px 10px 10px 0px;
179
+ border-radius: 0px 10px 10px 0px;
180
+ width: 10px;
181
+ height: 35px;
182
+ position: absolute;
183
+ right: 0px;
184
+ top: 60px;
185
+ background: #b78b00;
186
+ }
187
+
188
+ /* ----- Ribbon ---------------------------------------*/
189
+ #ribbon-container > div {
190
+ width: 140px;
191
+ height: 28px;
192
+ position: relative;
193
+ top: 24px;
194
+ right: -100px;
195
+ z-index: 11;
196
+ overflow: hidden;
197
+ transform: rotate(45deg);
198
+ -ms-transform: rotate(45deg); /* IE 9 */
199
+ -moz-transform: rotate(45deg); /* Firefox */
200
+ -webkit-transform: rotate(45deg); /* Safari and Chrome */
201
+ -o-transform: rotate(45deg); /* Opera */
202
+ background: #ffcc00;
203
+ }
204
+ `,
205
+ TWStyles,
206
+ ];
207
+ __decorate([
208
+ property({ type: Boolean })
209
+ ], KompasFreewallBody.prototype, "isLogin", void 0);
210
+ __decorate([
211
+ property({ type: String })
212
+ ], KompasFreewallBody.prototype, "type", void 0);
213
+ __decorate([
214
+ property()
215
+ ], KompasFreewallBody.prototype, "onSubscriptionClick", void 0);
216
+ __decorate([
217
+ property({ type: Object })
218
+ ], KompasFreewallBody.prototype, "packageData", void 0);
219
+ KompasFreewallBody = __decorate([
220
+ customElement('kompasid-freewall-body')
221
+ ], KompasFreewallBody);
222
+ export { KompasFreewallBody };
223
+ //# sourceMappingURL=KompasFreewallBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KompasFreewallBody.js","sourceRoot":"","sources":["../../../../src/components/kompasid-freewall-body/KompasFreewallBody.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,OAA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AAC;uDAA6C;AAnF7D,kBAAkB;IAD9B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,kBAAkB,CA+M9B;SA/MY,kBAAkB","sourcesContent":["import { html, css, LitElement, nothing } from 'lit'\nimport { property, customElement } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { addGoogleFonts } from '../../utils/googleFont.js'\nimport { formatRupiah } from '../../utils/formatRupiah.js'\nimport { generateCopyDuration } from '../../utils/generateCopyDuration.js'\nimport { PackageData } from '../kompasid-freewall/types.js'\nimport { faCheck } from '../../../assets/font-awesome.js'\nimport { redirectToRegister } from '../../utils/cta.js'\n\n@customElement('kompasid-freewall-body')\nexport class KompasFreewallBody extends LitElement {\n static styles = [\n css`\n .font-lora {\n font-family: 'Lora', 'Georgia', 'serif';\n }\n\n .font-roboto-condensed {\n font-family: 'Roboto Condensed', sans-serif;\n }\n\n /* ----- Ribbon Container ---------------------------------------*/\n #ribbon-container {\n background: transparent;\n height: 130px;\n width: 200px;\n position: absolute;\n top: -5px;\n right: -5px;\n overflow: hidden;\n }\n\n /* ----- Top Curl ---------------------------------------*/\n #ribbon-container:before {\n content: '';\n display: block;\n -webkit-border-radius: 10px 10px 0px 0px;\n border-radius: 10px 10px 0px 0px;\n width: 35px;\n height: 10px;\n position: absolute;\n right: 60px;\n background: #b78b00;\n z-index: 1;\n }\n\n /* ----- Right Curl ---------------------------------------*/\n #ribbon-container:after {\n content: '';\n display: block;\n -webkit-border-radius: 0px 10px 10px 0px;\n border-radius: 0px 10px 10px 0px;\n width: 10px;\n height: 35px;\n position: absolute;\n right: 0px;\n top: 60px;\n background: #b78b00;\n }\n\n /* ----- Ribbon ---------------------------------------*/\n #ribbon-container > div {\n width: 140px;\n height: 28px;\n position: relative;\n top: 24px;\n right: -100px;\n z-index: 11;\n overflow: hidden;\n transform: rotate(45deg);\n -ms-transform: rotate(45deg); /* IE 9 */\n -moz-transform: rotate(45deg); /* Firefox */\n -webkit-transform: rotate(45deg); /* Safari and Chrome */\n -o-transform: rotate(45deg); /* Opera */\n background: #ffcc00;\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n /**\n * property isLogin untuk menghandle apakah user sudah login atau belum\n * property type untuk menghandle tipe freewall\n * property onSubscriptionClick to handle cta when subscription button is clicked\n * packageData sebagai data package yang diambil dari kompasid-freewall\n */\n\n @property({ type: Boolean }) isLogin = false\n @property({ type: String }) type: 'article' | 'landing_page' = 'article'\n @property() onSubscriptionClick = () => {}\n @property({ type: Object }) packageData: PackageData = {} as PackageData\n\n description = [\n 'Akses seluruh konten Kompas.id di web & aplikasi',\n 'ePaper hingga 30 edisi terakhir',\n 'Buku digital tiap bulannya di aplikasi ',\n ]\n\n /**\n * Lifecycle\n */\n\n override async connectedCallback() {\n super.connectedCallback()\n await this.updateComplete\n addGoogleFonts(['pt-sans', 'lora', 'roboto-condensed'])\n }\n\n /**\n * Component\n */\n\n private subscriptionCardComponent() {\n return html`\n <div class=\"relative\">\n <div\n id=\"subscription-card\"\n class=\"flex justify-between items-center relative z-10 flex-col w-[328px] ${this\n .isLogin\n ? 'h-[277px] md:w-[580px] md:h-[240px]'\n : 'h-[223px] md:w-[350px] lg:w-[410px] md:h-[210px]'} py-3 px-[10px] md:p-5 md:pt-3 rounded-[10px] border-2 border-yellow-400 bg-white\"\n >\n <div\n class=\"flex w-full flex-col ${this.isLogin\n ? 'items-center md:w-[374px] text-center'\n : 'items-start text-start'}\"\n >\n <h5\n class=\"font-lora text-lg md:text-xl font-bold leading-[30px] ${this\n .isLogin && 'w-60 md:w-full'} text-grey-600\"\n >\n ${this.isLogin\n ? 'Dukung Jurnalisme Mencerahkan dengan Berlangganan'\n : 'Mulai Berlangganan'}\n </h5>\n ${this.descriptionSection()}\n </div>\n <button\n @click=${this.onSubscriptionClick}\n class=\"bg-green-500 whitespace-nowrap w-full rounded ${this\n .isLogin &&\n 'md:w-[370px]'} md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]\"\n >\n Langganan ${formatRupiah(this.packageData.price)}\n /${generateCopyDuration(this.packageData.durationType)}\n </button>\n </div>\n <div id=\"ribbon-container\">\n <div\n class=\"text-[11px] font-medium font-roboto-condensed flex justify-center items-center\"\n >\n <span class=\"-ml-2\">Penawaran Terbaik</span>\n </div>\n </div>\n </div>\n `\n }\n\n private registerCardComponent() {\n return html`\n <div\n class=\"flex flex-col justify-between w-[328px] h-[159px] md:w-[350px] lg:w-[410px] md:h-[210px] py-3 px-[10px] md:p-5 md:pt-3 rounded-[10px] bg-white\"\n >\n <div>\n <h5\n class=\"font-lora text-lg md:text-xl font-bold leading-[30px] text-grey-600\"\n >\n Daftar Akun Gratis\n </h5>\n <div class=\"flex items-start lg:items-center mt-1 md:mt-3\">\n <div class=\"mt-1 lg:mt-0\">${faCheck()}</div>\n <h6 class=\"text-base text-grey-600 ml-1\">\n Akses ke 3 artikel berbayar gratis tiap bulan\n </h6>\n </div>\n </div>\n <button\n @click=${() => redirectToRegister('freewall')}\n class=\"bg-white border border-blue-600 whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-blue-600 font-bold leading-[18px]\"\n >\n Daftar Gratis\n </button>\n </div>\n `\n }\n\n private descriptionSection() {\n return html`<div class=\"flex flex-col space-y-1 mt-1 lg:mt-3\">\n ${this.description.map(\n item =>\n html`\n <div class=\"flex items-start lg:items-center\">\n <div class=\"mt-1 lg:mt-0\">${faCheck()}</div>\n <h6 class=\"text-base text-grey-600 ml-1 text-start\">${item}</h6>\n </div>\n `\n )}\n </div>`\n }\n\n /**\n * Render Statement\n */\n\n render() {\n return html`\n <div\n class=\"w-full h-full flex flex-col md:flex-row pt-6 md:pt-3 relative px-4 md:px-0 py-3 space-y-4 md:space-x-5 md:space-y-0 justify-center items-center\"\n >\n ${this.subscriptionCardComponent()}\n ${!this.isLogin ? this.registerCardComponent() : nothing}\n </div>\n `\n }\n}\n"]}
@@ -0,0 +1,37 @@
1
+ import { LitElement } from 'lit';
2
+ import { PackageData } from '../kompasid-freewall/types.js';
3
+ export declare class KompasFreewallHead extends LitElement {
4
+ static styles: import("lit").CSSResult[];
5
+ /**
6
+ * Props
7
+ */
8
+ /**
9
+ * property isLogin untuk menghandle apakah user sudah login atau belum
10
+ * property type untuk menghandle tipe freewall
11
+ * property head_copy_expand to update copy header when expand
12
+ * property head_copy_collapse to update copy header when collapse
13
+ * property expand to handle expand/collapse
14
+ * property toggleExpand to handle toggle expand/collapse
15
+ * property onSubscriptionClick to handle cta when subscription button is clicked
16
+ */
17
+ isLogin: boolean;
18
+ type: 'article' | 'landing_page';
19
+ head_copy_expand: string;
20
+ head_copy_collapse: string;
21
+ expand: boolean;
22
+ toggleExpand: () => void;
23
+ onSubscriptionClick: () => void;
24
+ packageData: PackageData;
25
+ /**
26
+ * Getter
27
+ */
28
+ get headCopy(): string;
29
+ /**
30
+ * Lifecycle
31
+ */
32
+ connectedCallback(): Promise<void>;
33
+ /**
34
+ * Render Statement
35
+ */
36
+ render(): import("lit").TemplateResult<1>;
37
+ }