Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: v3 #23

Merged
merged 22 commits into from
Jan 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9b85dd9
feat!: remove page reload
dargmuesli Jan 13, 2023
cf27598
chore(release): 3.0.0-beta.1 [skip ci]
semantic-release-bot Jan 13, 2023
2d85581
feat(plugin)!: do not initialize cookies
dargmuesli Jan 14, 2023
f7bce65
fix(locale): correct decline string
dargmuesli Jan 14, 2023
bd7b234
fix(module): remove unused Nuxt 2 code
dargmuesli Jan 14, 2023
7631391
feat!: rework control persistence
dargmuesli Jan 14, 2023
4495c54
Merge branch 'master' into beta
dargmuesli Jan 14, 2023
4bca5f4
chore(release): 3.0.0-beta.2 [skip ci]
semantic-release-bot Jan 14, 2023
189e937
fix(playground): correct locale type
dargmuesli Jan 14, 2023
393d59f
fix(cookie-control): correct local cloned state configuration usage
dargmuesli Jan 14, 2023
5634046
chore(release): 3.0.0-beta.3 [skip ci]
semantic-release-bot Jan 14, 2023
4264052
feat: add module option to switch target id visibility
dargmuesli Jan 14, 2023
8a253eb
fix(cookie-control): update local configuration on global change
dargmuesli Jan 14, 2023
9962060
chore(release): 3.0.0-beta.4 [skip ci]
semantic-release-bot Jan 14, 2023
ebb396e
fix(cookie-control): properly save partial cookie configurations
dargmuesli Jan 14, 2023
d4a3f7d
chore(release): 3.0.0-beta.5 [skip ci]
semantic-release-bot Jan 14, 2023
9b689d9
fix: use js-cookie outside component
dargmuesli Jan 14, 2023
5d155ac
chore(release): 3.0.0-beta.6 [skip ci]
semantic-release-bot Jan 14, 2023
0ab00f7
fix(cookie): set same-site to strict
dargmuesli Jan 14, 2023
5da85fa
docs(readme): mention migration instructions
dargmuesli Jan 14, 2023
c82093d
chore(release): 3.0.0-beta.7 [skip ci]
semantic-release-bot Jan 14, 2023
ed4f794
chore(deps): update dependency prettier to v2.8.3
renovate[bot] Jan 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,84 @@
# [3.0.0-beta.7](https://github.com/dargmuesli/nuxt-cookie-control/compare/3.0.0-beta.6...3.0.0-beta.7) (2023-01-14)


### Bug Fixes

* **cookie:** set same-site to strict ([0ab00f7](https://github.com/dargmuesli/nuxt-cookie-control/commit/0ab00f7fca5c304e9cc4d747cb0b908c74e7172d))

# [3.0.0-beta.6](https://github.com/dargmuesli/nuxt-cookie-control/compare/3.0.0-beta.5...3.0.0-beta.6) (2023-01-14)


### Bug Fixes

* use js-cookie outside component ([9b689d9](https://github.com/dargmuesli/nuxt-cookie-control/commit/9b689d9ef7742f4ffcc4bdd334b23fa8d751ab14))

# [3.0.0-beta.5](https://github.com/dargmuesli/nuxt-cookie-control/compare/3.0.0-beta.4...3.0.0-beta.5) (2023-01-14)


### Bug Fixes

* **cookie-control:** properly save partial cookie configurations ([ebb396e](https://github.com/dargmuesli/nuxt-cookie-control/commit/ebb396ee715ea7dc942ddb001bd4bed39579c9e9))

# [3.0.0-beta.4](https://github.com/dargmuesli/nuxt-cookie-control/compare/3.0.0-beta.3...3.0.0-beta.4) (2023-01-14)


### Bug Fixes

* **cookie-control:** update local configuration on global change ([8a253eb](https://github.com/dargmuesli/nuxt-cookie-control/commit/8a253ebc8ca9eb39e68f1b164c5d7a2edfef825b))


### Features

* add module option to switch target id visibility ([4264052](https://github.com/dargmuesli/nuxt-cookie-control/commit/42640529820b6e43a2cffcaf8880090db384d44c))

# [3.0.0-beta.3](https://github.com/dargmuesli/nuxt-cookie-control/compare/3.0.0-beta.2...3.0.0-beta.3) (2023-01-14)


### Bug Fixes

* **cookie-control:** correct local cloned state configuration usage ([393d59f](https://github.com/dargmuesli/nuxt-cookie-control/commit/393d59f0d077ff5674738336c9046f2c59174c36))
* **playground:** correct locale type ([189e937](https://github.com/dargmuesli/nuxt-cookie-control/commit/189e9378a60df1eebb302fe6c295028f1866b507))

# [3.0.0-beta.2](https://github.com/dargmuesli/nuxt-cookie-control/compare/3.0.0-beta.1...3.0.0-beta.2) (2023-01-14)


### Bug Fixes

* **locale:** correct decline string ([f7bce65](https://github.com/dargmuesli/nuxt-cookie-control/commit/f7bce65d90faf7df73cd332843a30dc6459131a1))
* **module:** remove unused Nuxt 2 code ([bd7b234](https://github.com/dargmuesli/nuxt-cookie-control/commit/bd7b234e28037b5f02293074a45b6d53434f9125))


* feat!: rework control persistence ([7631391](https://github.com/dargmuesli/nuxt-cookie-control/commit/7631391b8c06dc7bff897aa76814a02a27d5d74f))
* feat(plugin)!: do not initialize cookies ([2d85581](https://github.com/dargmuesli/nuxt-cookie-control/commit/2d85581b3ad4b22ab52257872e046cf9d606a6ef))


### BREAKING CHANGES

* control persistence is reworked completely, see changes below
- change own cookie names from `(cookie_control_consent, cookie_control_enabled_cookies)` to `(cookie_control_is_consent_given, cookie_control_cookies_enabled_ids)`
- remove methods `useAcceptNecessary`, `acceptNecessary`, `useSetConsent`, `getCookieControlConsent`, `clearCookies`, `setHead`, `setConsent`, `setCookies`
- state properties `cookiesEnabled`, `cookiesEnabledIds` and `isConsentGiven` can be undefined
- include required cookies in enabled cookie list

feat:
- add ability to customize module's own cookie names and expiry
- add method `getCookieIds`

fix:
- correct display of unsaved changes hint
- properly initialize state by reading from cookies
* no cookie is being saved until a user allows cookies to be saved. You now need to check for existence of cookie control's own cookies.

# [3.0.0-beta.1](https://github.com/dargmuesli/nuxt-cookie-control/compare/2.2.4...3.0.0-beta.1) (2023-01-13)


* feat!: remove page reload ([9b85dd9](https://github.com/dargmuesli/nuxt-cookie-control/commit/9b85dd985ef6117847e68ee109b237739682b85a))


### BREAKING CHANGES

* decide if you need a page reload on cookie configuration change yourself instead! Simply `watch` enabled cookies for changes you wish a page reload for and execute it in your client's code instead of having page reloads forced upon you.

## [2.2.4](https://github.com/dargmuesli/nuxt-cookie-control/compare/2.2.3...2.2.4) (2023-01-06)


Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

Continuing Dario Ferderber's work on [gitlab.com/broj42/nuxt-cookie-control](https://gitlab.com/broj42/nuxt-cookie-control).

🚩 **Make sure to read the Migration instructions for all major version updates like [v2.0.0](https://github.com/dargmuesli/nuxt-cookie-control/releases/tag/2.0.0), [v3.0.0](https://github.com/dargmuesli/nuxt-cookie-control/releases/tag/3.0.0) and following!**

Try it out here:
[Nuxt.js Cookie Control](https://codesandbox.io/s/vkwqmm577)

Expand Down Expand Up @@ -141,12 +143,22 @@ cookies: {
optional: [],
}

// The milliseconds from now until expiry of the cookies that are being set by this module.
cookieExpiryOffsetMs: 1000 * 60 * 60 * 24 * 365, // one year

// Names for the cookies that are being set by this module.
cookieNameIsConsentGiven: 'cookie_control_is_consent_given',
cookieNameCookiesEnabledIds: 'cookie_control_cookies_enabled_ids',

// Switch to toggle the "accept necessary" button.
isAcceptNecessaryButtonEnabled: true

// Switch to toggle the button that opens the configuration modal.
isControlButtonEnabled: true,

// Switch to toggle the concatenation of target cookie ids to the cookie description.
isCookieIdVisible: false,

// Switch to toggle the inclusion of this module's css.
// If css is set to false, you will still be able to access your color variables.
isCssEnabled: true,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dargmuesli/nuxt-cookie-control",
"version": "2.2.4",
"version": "3.0.0-beta.7",
"description": "Nuxt Cookies Control Module",
"author": "Dario Ferderber <dario.ferderber@broj42.com>",
"maintainers": [
Expand Down Expand Up @@ -52,7 +52,7 @@
"husky": "8.0.3",
"lint-staged": "13.1.0",
"nuxt": "3.0.0",
"prettier": "2.8.2",
"prettier": "2.8.3",
"typescript": "4.9.4",
"vue": "3.2.45",
"vue-tsc": "1.0.24",
Expand Down
6 changes: 3 additions & 3 deletions playground/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<fieldset>
<div>
<label for="input-en">English</label>
<input id="input-en" v-model="locale" type="radio" :value="Locale.EN" />
<input id="input-en" v-model="locale" type="radio" value="en" />
</div>
<div>
<label for="input-de">German</label>
<input id="input-de" v-model="locale" type="radio" :value="Locale.DE" />
<input id="input-de" v-model="locale" type="radio" value="de" />
</div>
</fieldset>
</div>
</template>

<script setup lang="ts">
import { Locale } from '../src/runtime/types'
import type { Locale } from '../src/runtime/types'

const locale = ref<Locale>('en')
</script>
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 0 additions & 29 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { resolve } from 'node:path'

import {
defineNuxtModule,
isNuxt2,
addPlugin,
extendWebpackConfig,
addTemplate,
Expand Down Expand Up @@ -59,34 +58,6 @@ export default defineNuxtModule<ModuleOptions>({
2
)} as ModuleOptions`,
})

if (isNuxt2()) {
// Nuxt-purgecss fix
try {
if (require.resolve('nuxt-purgecss').length > 0) {
// @ts-ignore
if (nuxt.options.purgeCSS) {
// @ts-ignore
if (nuxt.options.purgeCSS.whitelistPatternsChildren) {
// @ts-ignore
nuxt.options.purgeCSS.whitelistPatternsChildren.push(
/cookieControl/
)
} else {
// @ts-ignore
nuxt.options.purgeCSS.whitelistPatternsChildren = [
/cookieControl/,
]
}
} else {
// @ts-ignore
nuxt.options.purgeCSS = {
whitelistPatternsChildren: [/cookieControl/],
}
}
}
} catch (e) {}
}
},
})

Expand Down
Loading