@kompasid/lit-web-components 0.1.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.
- package/.editorconfig +29 -0
- package/.github/workflows/npm-publish.yml +35 -0
- package/LICENSE +21 -0
- package/README.md +62 -0
- package/assets/font-awesome.ts +21 -0
- package/components.d.ts +4 -0
- package/demo/index.html +137 -0
- package/dist/assets/font-awesome.d.ts +2 -0
- package/dist/assets/font-awesome.js +20 -0
- package/dist/assets/font-awesome.js.map +1 -0
- package/dist/src/components/kompas-footer/KompasFooter.d.ts +13 -0
- package/dist/src/components/kompas-footer/KompasFooter.js +304 -0
- package/dist/src/components/kompas-footer/KompasFooter.js.map +1 -0
- package/dist/src/components/kompas-footer/types.d.ts +47 -0
- package/dist/src/components/kompas-footer/types.js +2 -0
- package/dist/src/components/kompas-footer/types.js.map +1 -0
- package/dist/src/components/kompas-metered-paywall/KompasMeteredPaywall.d.ts +50 -0
- package/dist/src/components/kompas-metered-paywall/KompasMeteredPaywall.js +225 -0
- package/dist/src/components/kompas-metered-paywall/KompasMeteredPaywall.js.map +1 -0
- package/dist/src/components/kompas-paywall/KompasPaywall.d.ts +73 -0
- package/dist/src/components/kompas-paywall/KompasPaywall.js +470 -0
- package/dist/src/components/kompas-paywall/KompasPaywall.js.map +1 -0
- package/dist/src/components/kompas-paywall/types.d.ts +53 -0
- package/dist/src/components/kompas-paywall/types.js +2 -0
- package/dist/src/components/kompas-paywall/types.js.map +1 -0
- package/dist/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.d.ts +11 -0
- package/dist/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.js +100 -0
- package/dist/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.js.map +1 -0
- package/dist/src/components/kompas-paywall-body/KompasPaywallBody.d.ts +107 -0
- package/dist/src/components/kompas-paywall-body/KompasPaywallBody.js +843 -0
- package/dist/src/components/kompas-paywall-body/KompasPaywallBody.js.map +1 -0
- package/dist/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.d.ts +8 -0
- package/dist/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.js +39 -0
- package/dist/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.js.map +1 -0
- package/dist/src/components/kompas-paywall-video/KompasPaywallVideo.d.ts +53 -0
- package/dist/src/components/kompas-paywall-video/KompasPaywallVideo.js +245 -0
- package/dist/src/components/kompas-paywall-video/KompasPaywallVideo.js.map +1 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/utils/deviceType.d.ts +2 -0
- package/dist/src/utils/deviceType.js +11 -0
- package/dist/src/utils/deviceType.js.map +1 -0
- package/dist/src/utils/fontawesome-setup.d.ts +1 -0
- package/dist/src/utils/fontawesome-setup.js +25 -0
- package/dist/src/utils/fontawesome-setup.js.map +1 -0
- package/dist/tailwind/tailwind.d.ts +1 -0
- package/dist/tailwind/tailwind.js +1654 -0
- package/dist/tailwind/tailwind.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +94 -0
- package/src/components/kompas-footer/KompasFooter.ts +331 -0
- package/src/components/kompas-footer/types.ts +54 -0
- package/src/components/kompas-metered-paywall/KompasMeteredPaywall.ts +174 -0
- package/src/components/kompas-metered-paywall/readme.md +32 -0
- package/src/components/kompas-paywall/KompasPaywall.ts +398 -0
- package/src/components/kompas-paywall/readme.md +166 -0
- package/src/components/kompas-paywall/types.ts +53 -0
- package/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.ts +92 -0
- package/src/components/kompas-paywall-banner-registration/readme.md +31 -0
- package/src/components/kompas-paywall-body/KompasPaywallBody.ts +844 -0
- package/src/components/kompas-paywall-body/readme.md +54 -0
- package/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.ts +29 -0
- package/src/components/kompas-paywall-information-header/readme.md +30 -0
- package/src/components/kompas-paywall-video/KompasPaywallVideo.ts +194 -0
- package/src/components/kompas-paywall-video/readme.md +46 -0
- package/src/index.ts +11 -0
- package/src/utils/deviceType.ts +11 -0
- package/src/utils/fontawesome-setup.ts +40 -0
- package/tailwind/tailwind.css +1635 -0
- package/tailwind/tailwind.ts +1654 -0
- package/tailwind/tailwindlib.css +3 -0
- package/tailwind.config.js +96 -0
- package/tsconfig.json +21 -0
- package/web-dev-server.config.mjs +27 -0
- package/web-test-runner.config.mjs +41 -0
package/dist/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, css, LitElement } from 'lit';
|
|
3
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
4
|
+
import { TWStyles } from '../../../tailwind/tailwind.js';
|
|
5
|
+
import { deviceType } from '../../utils/deviceType.js';
|
|
6
|
+
let KompasPaywallBannerRegistration = class KompasPaywallBannerRegistration extends LitElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.theme = '';
|
|
10
|
+
this.bannerData = undefined;
|
|
11
|
+
}
|
|
12
|
+
get isDark() {
|
|
13
|
+
return this.theme === 'dark';
|
|
14
|
+
}
|
|
15
|
+
redirectToRegister() {
|
|
16
|
+
this.sendDataLayer('registrationOfferClick');
|
|
17
|
+
const loginHost = 'https://account.kompas.id/login';
|
|
18
|
+
const nextParams = encodeURIComponent(window.location.href);
|
|
19
|
+
const directUrlRegister = `${loginHost}?next=${nextParams}`;
|
|
20
|
+
window.location.href = directUrlRegister;
|
|
21
|
+
}
|
|
22
|
+
sendDataLayer(value) {
|
|
23
|
+
window.dataLayer.push({
|
|
24
|
+
event: value,
|
|
25
|
+
interface: deviceType(),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
var _a, _b, _c, _d, _e;
|
|
30
|
+
this.sendDataLayer('registrationOfferimppression');
|
|
31
|
+
return html `
|
|
32
|
+
<div class="flex flex-col items-center my-5">
|
|
33
|
+
<div
|
|
34
|
+
class="flex flex-col md:flex-row justify-between items-center w-full"
|
|
35
|
+
>
|
|
36
|
+
<div class="flex flex-col md:flex-row items-center w-full">
|
|
37
|
+
<img
|
|
38
|
+
class="object-cover w-20 h-20"
|
|
39
|
+
src=${(_b = (_a = this.bannerData) === null || _a === void 0 ? void 0 : _a.img) !== null && _b !== void 0 ? _b : ''}
|
|
40
|
+
alt="information-register-img"
|
|
41
|
+
/>
|
|
42
|
+
<div
|
|
43
|
+
class="flex flex-col justify-start ${this.isDark &&
|
|
44
|
+
'text-white'} md:ml-6 my-4"
|
|
45
|
+
>
|
|
46
|
+
<h5
|
|
47
|
+
class="text-center md:text-left text-base md:text-xl font-serif font-bold"
|
|
48
|
+
>
|
|
49
|
+
${(_c = this.bannerData) === null || _c === void 0 ? void 0 : _c.title}
|
|
50
|
+
</h5>
|
|
51
|
+
<h6 class="text-center md:text-left">
|
|
52
|
+
${(_d = this.bannerData) === null || _d === void 0 ? void 0 : _d.subtitle}
|
|
53
|
+
</h6>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
<button
|
|
57
|
+
@click=${() => this.redirectToRegister()}
|
|
58
|
+
class="w-40 md:w-52 h-auto ${this.isDark
|
|
59
|
+
? 'bg-green-300'
|
|
60
|
+
: 'bg-brand-1'} rounded"
|
|
61
|
+
>
|
|
62
|
+
<h6
|
|
63
|
+
class="text-base ${this.isDark
|
|
64
|
+
? 'text-black'
|
|
65
|
+
: 'text-white'} font-bold py-2 px-4"
|
|
66
|
+
>
|
|
67
|
+
${(_e = this.bannerData) === null || _e === void 0 ? void 0 : _e.label}
|
|
68
|
+
</h6>
|
|
69
|
+
</button>
|
|
70
|
+
</div>
|
|
71
|
+
<div class="border-b-2 border-grey-200 w-32 md:w-40 my-6"></div>
|
|
72
|
+
<div>
|
|
73
|
+
<h6 class="${this.isDark && 'text-white'}">
|
|
74
|
+
Sudah punya akun?
|
|
75
|
+
<button
|
|
76
|
+
@click=${() => this.redirectToRegister()}
|
|
77
|
+
class="font-bold ${this.isDark
|
|
78
|
+
? 'text-blue-300'
|
|
79
|
+
: 'text-blue-600'} underline"
|
|
80
|
+
>
|
|
81
|
+
Silakan Masuk
|
|
82
|
+
</button>
|
|
83
|
+
</h6>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
`;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
KompasPaywallBannerRegistration.styles = [css ``, TWStyles];
|
|
90
|
+
__decorate([
|
|
91
|
+
property({ type: String })
|
|
92
|
+
], KompasPaywallBannerRegistration.prototype, "theme", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
property({ type: Object })
|
|
95
|
+
], KompasPaywallBannerRegistration.prototype, "bannerData", void 0);
|
|
96
|
+
KompasPaywallBannerRegistration = __decorate([
|
|
97
|
+
customElement('kompas-paywall-banner-registration')
|
|
98
|
+
], KompasPaywallBannerRegistration);
|
|
99
|
+
export { KompasPaywallBannerRegistration };
|
|
100
|
+
//# sourceMappingURL=KompasPaywallBannerRegistration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KompasPaywallBannerRegistration.js","sourceRoot":"","sources":["../../../../src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAG/C,IAAM,+BAA+B,GAArC,MAAM,+BAAgC,SAAQ,UAAU;IAAxD;;QAGuB,UAAK,GAAG,EAAE,CAAA;QACV,eAAU,GAA6B,SAAS,CAAA;IAgF9E,CAAC;IA9EC,IAAI,MAAM;QAC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B,CAAC,CAAC,eAAe;;;;;;;KAO5B,CAAA;IACH,CAAC;;AAlFM,sCAAM,GAAG,CAAC,GAAG,CAAA,EAAE,EAAE,QAAQ,CAAC,AAApB,CAAoB;AAEL;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAAiD;AAJjE,+BAA+B;IAD3C,aAAa,CAAC,oCAAoC,CAAC;GACvC,+BAA+B,CAoF3C","sourcesContent":["import { html, css, LitElement } from 'lit'\nimport { property, customElement } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { Registration } from '../kompas-paywall/types.js'\nimport { deviceType } from '../../utils/deviceType.js'\n\n@customElement('kompas-paywall-banner-registration')\nexport class KompasPaywallBannerRegistration extends LitElement {\n static styles = [css``, TWStyles]\n\n @property({ type: String }) theme = ''\n @property({ type: Object }) bannerData: Registration | undefined = undefined\n\n get isDark() {\n return this.theme === 'dark'\n }\n\n private redirectToRegister(): void {\n this.sendDataLayer('registrationOfferClick')\n const loginHost: string = 'https://account.kompas.id/login'\n const nextParams: string = encodeURIComponent(window.location.href)\n const directUrlRegister: string = `${loginHost}?next=${nextParams}`\n window.location.href = directUrlRegister\n }\n\n private sendDataLayer(value: string): void {\n window.dataLayer.push({\n event: value,\n interface: deviceType(),\n })\n }\n\n render() {\n this.sendDataLayer('registrationOfferimppression')\n return html`\n <div class=\"flex flex-col items-center my-5\">\n <div\n class=\"flex flex-col md:flex-row justify-between items-center w-full\"\n >\n <div class=\"flex flex-col md:flex-row items-center w-full\">\n <img\n class=\"object-cover w-20 h-20\"\n src=${this.bannerData?.img ?? ''}\n alt=\"information-register-img\"\n />\n <div\n class=\"flex flex-col justify-start ${this.isDark &&\n 'text-white'} md:ml-6 my-4\"\n >\n <h5\n class=\"text-center md:text-left text-base md:text-xl font-serif font-bold\"\n >\n ${this.bannerData?.title}\n </h5>\n <h6 class=\"text-center md:text-left\">\n ${this.bannerData?.subtitle}\n </h6>\n </div>\n </div>\n <button\n @click=${() => this.redirectToRegister()}\n class=\"w-40 md:w-52 h-auto ${this.isDark\n ? 'bg-green-300'\n : 'bg-brand-1'} rounded\"\n >\n <h6\n class=\"text-base ${this.isDark\n ? 'text-black'\n : 'text-white'} font-bold py-2 px-4\"\n >\n ${this.bannerData?.label}\n </h6>\n </button>\n </div>\n <div class=\"border-b-2 border-grey-200 w-32 md:w-40 my-6\"></div>\n <div>\n <h6 class=\"${this.isDark && 'text-white'}\">\n Sudah punya akun?\n <button\n @click=${() => this.redirectToRegister()}\n class=\"font-bold ${this.isDark\n ? 'text-blue-300'\n : 'text-blue-600'} underline\"\n >\n Silakan Masuk\n </button>\n </h6>\n </div>\n </div>\n `\n }\n}\n"]}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { PaywallProduct } from '../kompas-paywall/types.js';
|
|
3
|
+
export declare class KompasPaywallBody extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
/**
|
|
6
|
+
* Props
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* prop slug untuk menghandle slug
|
|
10
|
+
* prop isLogin untuk menghandle apakah user sudah login atau belum
|
|
11
|
+
* prop type untuk menghandle tipe epaper
|
|
12
|
+
* prop paywallData untuk menghandle data paywall
|
|
13
|
+
* prop userGuid untuk menghandle user Guid
|
|
14
|
+
* prop subscriptionStatus untuk menghandle status subscription user
|
|
15
|
+
* prop countdownArticle untuk menghandle count artikel
|
|
16
|
+
* prop swgEnable untuk menghandle swg apakah di aktifkan atau tidak
|
|
17
|
+
* prop paywall_location = The location where user encounter the paywall
|
|
18
|
+
* prop paywall_subscription_package = The name of the subscription package viewed by user
|
|
19
|
+
* prop paywall_subscription_id = The ID of the subscription package viewed by user
|
|
20
|
+
* prop paywall_subscription_price = The price of the subscriprtion package viewed by user
|
|
21
|
+
* prop paywall_position = The position of the subscription package viewed by user
|
|
22
|
+
* prop tracker_page_type = Type of the page
|
|
23
|
+
* prop tracker_content_id = ID of article (slug)
|
|
24
|
+
* prop tracker_content_type = Whether it's free article or paid article
|
|
25
|
+
* prop tracker_content_title = The title of article
|
|
26
|
+
* prop tracker_content_categories = The category of the content
|
|
27
|
+
* prop tracker_user_type = Type of user based on their subscription
|
|
28
|
+
* prop tracker_subscription_status = Status of their subscription
|
|
29
|
+
* prop tracker_page_domain = Page Domain
|
|
30
|
+
* prop tracker_metered_wall_type = The type of Metered Wall
|
|
31
|
+
* prop tracker_metered_wall_balance = The balance of their metered wall
|
|
32
|
+
* prop tracker_metered_wall_balance = The edition of epaper viewed by user
|
|
33
|
+
* prop theme = The theme of the paywall component
|
|
34
|
+
*/
|
|
35
|
+
slug: string;
|
|
36
|
+
udin: number;
|
|
37
|
+
isLogin: boolean;
|
|
38
|
+
type: 'epaper' | 'reguler';
|
|
39
|
+
paywallData: PaywallProduct | undefined;
|
|
40
|
+
userGuid: string;
|
|
41
|
+
subscriptionStatus: string;
|
|
42
|
+
countdownArticle: number;
|
|
43
|
+
swgEnable: boolean;
|
|
44
|
+
paywall_location: string;
|
|
45
|
+
paywall_subscription_package: string;
|
|
46
|
+
paywall_subscription_id: number;
|
|
47
|
+
paywall_subscription_price: number;
|
|
48
|
+
paywall_position: number;
|
|
49
|
+
tracker_page_type: string;
|
|
50
|
+
tracker_content_id: string;
|
|
51
|
+
tracker_content_title: string;
|
|
52
|
+
tracker_content_categories: string;
|
|
53
|
+
tracker_content_type: string;
|
|
54
|
+
tracker_user_type: string;
|
|
55
|
+
tracker_subscription_status: string;
|
|
56
|
+
tracker_page_domain: string;
|
|
57
|
+
tracker_metered_wall_type: string;
|
|
58
|
+
tracker_metered_wall_balance: number;
|
|
59
|
+
tracker_epaper_edition: string;
|
|
60
|
+
theme: string;
|
|
61
|
+
private isExtensionsOpened;
|
|
62
|
+
private kompasAkunHost;
|
|
63
|
+
private kompasApigenHost;
|
|
64
|
+
private kompasApiWcmHost;
|
|
65
|
+
private kompasLoginHost;
|
|
66
|
+
private selfHost;
|
|
67
|
+
private swgPublisherName;
|
|
68
|
+
private swgPublisherId;
|
|
69
|
+
private swgProductId;
|
|
70
|
+
private errorFlag;
|
|
71
|
+
buttonElement: HTMLButtonElement;
|
|
72
|
+
private getRupiahFormat;
|
|
73
|
+
private redirectToCheckout;
|
|
74
|
+
private redirectToPrevUrl;
|
|
75
|
+
private redirectToSubscriber;
|
|
76
|
+
private redirectToRegister;
|
|
77
|
+
private redirectToHelpdesk;
|
|
78
|
+
private paymentExtensionHandler;
|
|
79
|
+
get isDark(): boolean;
|
|
80
|
+
get redirectToLogin(): string;
|
|
81
|
+
private getRegisterToken;
|
|
82
|
+
private getUserToken;
|
|
83
|
+
private getSubscriptionToken;
|
|
84
|
+
private createSwG;
|
|
85
|
+
private subscribeWithGoogleButton;
|
|
86
|
+
private jsonScript;
|
|
87
|
+
connectedCallback(): void;
|
|
88
|
+
private sendDataLayer;
|
|
89
|
+
private sendDataLayeronHelpDesk;
|
|
90
|
+
private sendDataLayeronButtonBuyPackage;
|
|
91
|
+
private sendDataLayeronPaywallBody;
|
|
92
|
+
private headerSection;
|
|
93
|
+
private descriptionSection;
|
|
94
|
+
private informationPackages;
|
|
95
|
+
private separatorLine;
|
|
96
|
+
private paymentDesktopSection;
|
|
97
|
+
private paymentMobileSection;
|
|
98
|
+
private paymentMobileExtension;
|
|
99
|
+
private primaryPackages;
|
|
100
|
+
private secondaryPackages;
|
|
101
|
+
private packagesSection;
|
|
102
|
+
private topNavigator;
|
|
103
|
+
private helpDesk;
|
|
104
|
+
private authRegister;
|
|
105
|
+
private userAction;
|
|
106
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
107
|
+
}
|