Skip to content

Commit

Permalink
Merge pull request #183 from pt-kompas-media-nusantara/feat/improve-g…
Browse files Browse the repository at this point in the history
…race-period

101315 - IMP -  Update CTA link
  • Loading branch information
billsur authored May 20, 2024
2 parents 72c2674 + d00da57 commit 3a487d4
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kompasid/web-components",
"version": "v1.8.6",
"version": "v1.8.7",
"description": "Kompas.id reusable web components",
"main": "dist/index.cjs.js",
"module": "dist/custom-elements/index.js",
Expand Down
8 changes: 8 additions & 0 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ export namespace Components {
* prop isShowButton untuk nampilin button perbarui langganan
*/
"isShowButton": boolean;
/**
* prop subscriptionId untuk renewal subs.
*/
"subscriptionId": string;
/**
* prop totalGracePeriod untuk menghitung berapa hari grace period user.
*/
Expand Down Expand Up @@ -657,6 +661,10 @@ declare namespace LocalJSX {
* prop isShowButton untuk nampilin button perbarui langganan
*/
"isShowButton"?: boolean;
/**
* prop subscriptionId untuk renewal subs.
*/
"subscriptionId"?: string;
/**
* prop totalGracePeriod untuk menghitung berapa hari grace period user.
*/
Expand Down
20 changes: 12 additions & 8 deletions src/components/kompas-grace-period/kompas-grace-period.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,27 @@ export class KompasGracePeriod {
/**
* state updateSubscription untuk memberikan link user akan dialihkan ke halaman berlangganan.
*/
@State() updateSubscription: string = 'https://www.kompas.id/berlangganan';
@State() updateSubscription: string = 'https://checkoutv2.kompas.id';
/**
* Props
*/
/**
* prop totalGracePeriod untuk menghitung berapa hari grace period user.
*/
@Prop() totalGracePeriod: number = 0;
/**
/**
* prop isColoumn untuk merubah flex-column pada header account profile
*/
@Prop() isColoumn: boolean = false;
/**
/**
* prop isShowButton untuk nampilin button perbarui langganan
*/
@Prop() isShowButton: boolean = false;

/**
* prop subscriptionId untuk renewal subs.
*/
@Prop() subscriptionId: string;

/**
* TEMPLATING
*/
Expand Down Expand Up @@ -66,7 +70,7 @@ export class KompasGracePeriod {

private redirectToBerlangganan = (): void => {
this.dataLayeronPerbaruiLanggananButton();
window.location.href = this.updateSubscription;
window.location.href = this.updateSubscription + `/kdp?productId=${this.subscriptionId}`;
};

private dataLayeronPerbaruiLanggananButton = (): void => {
Expand All @@ -88,11 +92,11 @@ export class KompasGracePeriod {
};

private gracePeriodTemplate = (): void => (
<div class={`${this.isColoumn ? 'rounded-lg' : 'md:flex-row lg:px-20'} flex flex-col w-full bg-orange-100 justify-end py-4 md:space-x-4 px-4 bottom-0`}>
<div class={`${this.isColoumn ? 'rounded-lg' : 'md:flex-row lg:px-8'} flex flex-col w-full justify-end py-4 md:space-x-4 px-4 bottom-0 max-w-7xl mx-auto`}>
<div class="text-grey-600 text-sm md:text-base self-center text-left">{this.getCountdownGracePeriod()}</div>
{!this.isShowButton ? (
<div class="flex self-center w-full md:w-1/2 justify-end pt-4 md:pt-0">
<button onClick={this.redirectToBerlangganan} class="bg-green-500 p-2 px-5 rounded-md font-bold text-grey-100 text-sm md:text-base w-full">
<button onClick={this.redirectToBerlangganan} class="bg-green-500 p-2 px-5 rounded-md font-bold text-grey-100 text-sm md:text-base w-full md:w-auto ">
Perbarui Langganan
</button>
</div>
Expand All @@ -105,6 +109,6 @@ export class KompasGracePeriod {
}

render() {
return <div class="sticky bottom-0 w-full h-full">{this.totalGracePeriod > 0 ? this.gracePeriodTemplate() : ''}</div>;
return <div class="sticky bottom-0 w-full h-full bg-orange-100">{this.totalGracePeriod > 0 ? this.gracePeriodTemplate() : ''}</div>;
}
}
11 changes: 6 additions & 5 deletions src/components/kompas-grace-period/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@

## Properties

| Property | Attribute | Description | Type | Default |
| ------------------ | -------------------- | --------------------------------------------------------------------- | --------- | ------- |
| `isColoumn` | `is-coloumn` | prop isColoumn untuk merubah flex-column pada header account profile | `boolean` | `false` |
| `isShowButton` | `is-show-button` | prop isShowButton untuk nampilin button perbarui langganan | `boolean` | `false` |
| `totalGracePeriod` | `total-grace-period` | prop totalGracePeriod untuk menghitung berapa hari grace period user. | `number` | `0` |
| Property | Attribute | Description | Type | Default |
| ----------------------------- | -------------------- | --------------------------------------------------------------------- | --------- | ----------- |
| `isColoumn` | `is-coloumn` | prop isColoumn untuk merubah flex-column pada header account profile | `boolean` | `false` |
| `isShowButton` | `is-show-button` | prop isShowButton untuk nampilin button perbarui langganan | `boolean` | `false` |
| `subscriptionId` _(required)_ | `subscription-id` | prop subscriptionId untuk renewal subs. | `any` | `undefined` |
| `totalGracePeriod` | `total-grace-period` | prop totalGracePeriod untuk menghitung berapa hari grace period user. | `number` | `0` |


## Dependencies
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ <h2>Lipsum Dei</h2>
metered_wall_type="metered_wall_type"
epaper_edition="epaper_edition"
></kid-metered-paywall> -->
<!-- <kompas-grace-period total-grace-period=5></kompas-grace-period> -->
<kompas-grace-period total-grace-period="7" subscription-id="9802032"></kompas-grace-period>
<!-- <kompas-metered-register
countdown-article="2"
tracker_page_title="Example Page Title"
Expand Down

0 comments on commit 3a487d4

Please sign in to comment.