Skip to content

Commit

Permalink
Merge pull request #25 from porscheofficial/22-add-expirationdate-as-…
Browse files Browse the repository at this point in the history
…property

✨ feat: implement URL encoding and new cookieAttributes prop
  • Loading branch information
switchnollie authored Sep 25, 2023
2 parents 1142146 + f7dfdca commit a68cd66
Show file tree
Hide file tree
Showing 10 changed files with 337 additions and 44 deletions.
30 changes: 15 additions & 15 deletions packages/cookie-consent-banner-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ npm i @porscheofficial/cookie-consent-banner-react --S

### Properties

| Property (React) | Default | Type | Description |
| :------------------------------------------ | :------------------------------ | :--------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| `availableCategories` | `[]` | `CategoryItem[]` | Provide the available Categories. See Real World example |
| `cookieDomain` | `document.location.hostname` | `string` | |
| `cookieName` | `"cookies_accepted_categories"` | `string` | |
| `disableResetSiteCookiesOnConsentWithdrawn` | `false` | `boolean` | Prevent cookies from being deleted automatically if consent of the user changed. |
| `disableSlideInAnimation` | `false` | `boolean` | Disable slide-in animation of banner (See #7) |
| `headline` | `undefined` | `string` | |
| `btnLabelAcceptAndContinue` | `undefined` | `string` | |
| `btnLabelAllAndContinue` | `undefined` | `string` | |
| `btnLabelOnlyEssentialAndContinue` | `undefined` | `string` | |
| `btnLabelPersistSelectionAndContinue` | `undefined` | `string` | |
| `contentSettingsDescription` | `undefined` | `string` | |
| `handlePreferencesRestored` | `undefined` | `({ acceptedCategories, }: { acceptedCategories: string[]; }) => void` |
| `handlePreferencesUpdated` | `undefined` | `({ acceptedCategories, }: { acceptedCategories: string[]; }) => void` | |
| Property (React) | Default | Type | Description |
| :------------------------------------------ | :---------------------------------------------------------- | :--------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `availableCategories` | `[]` | `CategoryItem[]` | Provide the available Categories. See Real World example |
| `cookieAttributes` | `{path: "/",expires: 7,domain: document.location.hostname}` | [`CookieAttributes`](./src/components/cookie-consent-banner/types.ts) | Customization of the cookie attributes for the consent cookie (`expires` can either be a number of days or a `Date` object). |
| `cookieName` | `"cookies_accepted_categories"` | `string` | |
| `disableResetSiteCookiesOnConsentWithdrawn` | `false` | `boolean` | Prevent cookies from being deleted automatically if consent of the user changed. |
| `disableSlideInAnimation` | `false` | `boolean` | Disable slide-in animation of banner (See #7) |
| `headline` | `undefined` | `string` | |
| `btnLabelAcceptAndContinue` | `undefined` | `string` | |
| `btnLabelAllAndContinue` | `undefined` | `string` | |
| `btnLabelOnlyEssentialAndContinue` | `undefined` | `string` | |
| `btnLabelPersistSelectionAndContinue` | `undefined` | `string` | |
| `contentSettingsDescription` | `undefined` | `string` | |
| `handlePreferencesRestored` | `undefined` | `({ acceptedCategories, }: { acceptedCategories: string[]; }) => void` |
| `handlePreferencesUpdated` | `undefined` | `({ acceptedCategories, }: { acceptedCategories: string[]; }) => void` | |

### Events Dispatched by the Component

Expand Down
8 changes: 7 additions & 1 deletion packages/cookie-consent-banner/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
},
"rules": {
"react/react-in-jsx-scope": "off",
"react/no-unknown-property": "off"
"react/no-unknown-property": "off",
"n/no-unpublished-import": [
"error",
{
"ignoreTypeImport": true
}
]
},
"plugins": ["eslint-plugin-html"]
}
26 changes: 13 additions & 13 deletions packages/cookie-consent-banner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ npm i @porscheofficial/cookie-consent-banner --S

### Attributes

| Attribute (Web Component) | Default | Type | Description |
| :------------------------------------------------ | :------------------------------ | :--------------- | :------------------------------------------------------------------------------- |
| `available-categories` | `[]` | `CategoryItem[]` | Provide the available Categories. See Real World example |
| `cookie-domain` | `document.location.hostname` | `string` | |
| `cookie-name` | `"cookies_accepted_categories"` | `string` | |
| `disable-reset-site-cookies-on-consent-withdrawn` | `false` | `boolean` | Prevent cookies from being deleted automatically if consent of the user changed. |
| `disable-slide-in-animation` | `false` | `boolean` | Disable slide-in animation of banner (See #7) |
| `headline` | `undefined` | `string` | |
| `btn-label-accept-and-continue` | `undefined` | `string` | |
| `btn-label-select-all-and-continue` | `undefined` | `string` | |
| `btn-label-only-essential-and-continue` | `undefined` | `string` | |
| `btn-label-persist-selection-and-continue` | `undefined` | `string` |
| `content-settings-description` | `undefined` | `string` | |
| Attribute (Web Component) | Default | Type | Description |
| :------------------------------------------------ | :---------------------------------------------------------- | :-------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------- |
| `available-categories` | `[]` | `CategoryItem[]` | Provide the available Categories. See Real World example |
| `cookie-attributes` | `{path: "/",expires: 7,domain: document.location.hostname}` | [`CookieAttributes`](./src/components/cookie-consent-banner/types.ts) | Customization of the cookie attributes for the consent cookie (`expires` can either be a number of days or a `Date` object). |
| `cookie-name` | `"cookies_accepted_categories"` | `string` | |
| `disable-reset-site-cookies-on-consent-withdrawn` | `false` | `boolean` | Prevent cookies from being deleted automatically if consent of the user changed. |
| `disable-slide-in-animation` | `false` | `boolean` | Disable slide-in animation of banner (See #7) |
| `headline` | `undefined` | `string` | |
| `btn-label-accept-and-continue` | `undefined` | `string` | |
| `btn-label-select-all-and-continue` | `undefined` | `string` | |
| `btn-label-only-essential-and-continue` | `undefined` | `string` | |
| `btn-label-persist-selection-and-continue` | `undefined` | `string` |
| `content-settings-description` | `undefined` | `string` | |

### Events Dispatched by the Component

Expand Down
Loading

0 comments on commit a68cd66

Please sign in to comment.