@justeattakeaway/pie-cookie-banner 0.3.1 → 0.4.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/dist/index.d.ts CHANGED
@@ -72,6 +72,14 @@ export declare class PieCookieBanner extends LitElement implements CookieBannerP
72
72
  * @param {any} detail
73
73
  */
74
74
  private _dispatchCookieBannerCustomEvent;
75
+ /**
76
+ * Hides the cookie banner and emits the necessary only event
77
+ */
78
+ private _onNecessaryOnly;
79
+ /**
80
+ * Hides the cookie banner and emits the accept all event
81
+ */
82
+ private _onAcceptAll;
75
83
  /**
76
84
  * Opens the manage preferences modal and emits an event letting users know
77
85
  */
package/dist/index.js CHANGED
@@ -46,6 +46,10 @@ class s extends g {
46
46
  detail: t
47
47
  });
48
48
  this.dispatchEvent(n);
49
+ }, this._onNecessaryOnly = () => {
50
+ this._dispatchCookieBannerCustomEvent(u), this._isCookieBannerHidden = !0;
51
+ }, this._onAcceptAll = () => {
52
+ this._dispatchCookieBannerCustomEvent(v), this._isCookieBannerHidden = !0;
49
53
  }, this._openManagePreferencesModal = () => {
50
54
  this._isCookieBannerHidden = !0, this._dispatchCookieBannerCustomEvent(m), this._isModalOpen = !0;
51
55
  }, this._handleToggleStates = (e) => {
@@ -147,34 +151,30 @@ class s extends g {
147
151
  <p>We use our own and third party cookies and other tech to enhance and personalise your user experience,
148
152
  optimize analytics, and show ads with third parties
149
153
  (read our <pie-link variant="inverse">Statement</pie-link>).
150
- Necessary cookies are always set. Click <pie-link variant="inverse">Necessary only</pie-link>
151
- to continue without accepting more. Click <pie-link variant="inverse">Manage preferences</pie-link>
152
- to share your preferences or <pie-link variant="inverse">Accept all</pie-link>.</p>
154
+ Necessary cookies are always set. Click <pie-link data-test-id="body-necessary-only" tag="button" variant="inverse" @click="${this._onNecessaryOnly}">Necessary only</pie-link>
155
+ to continue without accepting more. Click <pie-link data-test-id="body-manage-prefs" tag="button" variant="inverse" @click="${this._openManagePreferencesModal}">Manage preferences</pie-link>
156
+ to share your preferences or <pie-link data-test-id="body-accept-all" tag="button" variant="inverse" @click="${this._onAcceptAll}">Accept all</pie-link>.</p>
153
157
  </div>
154
158
 
155
159
  <div class="c-cookieBanner-actions">
156
160
  <pie-button
157
- data-test-id="accept-all"
158
- @click="${() => {
159
- this._dispatchCookieBannerCustomEvent(v), this._isCookieBannerHidden = !0;
160
- }}"
161
+ data-test-id="actions-accept-all"
162
+ @click="${this._onAcceptAll}"
161
163
  variant="primary"
162
164
  isFullWidth
163
165
  size="small-expressive">
164
166
  Accept all
165
167
  </pie-button>
166
168
  <pie-button
167
- data-test-id="necessary-only"
168
- @click="${() => {
169
- this._dispatchCookieBannerCustomEvent(u), this._isCookieBannerHidden = !0;
170
- }}"
169
+ data-test-id="actions-necessary-only"
170
+ @click="${this._onNecessaryOnly}"
171
171
  variant="outline-inverse"
172
172
  isFullWidth
173
173
  size="small-expressive">
174
174
  Necessary only
175
175
  </pie-button>
176
176
  <pie-link
177
- data-test-id="manage-prefs"
177
+ data-test-id="actions-manage-prefs"
178
178
  @click="${this._openManagePreferencesModal}"
179
179
  tag="button"
180
180
  variant="inverse"
package/dist/react.d.ts CHANGED
@@ -81,6 +81,14 @@ declare class PieCookieBanner_2 extends LitElement implements CookieBannerProps
81
81
  * @param {any} detail
82
82
  */
83
83
  private _dispatchCookieBannerCustomEvent;
84
+ /**
85
+ * Hides the cookie banner and emits the necessary only event
86
+ */
87
+ private _onNecessaryOnly;
88
+ /**
89
+ * Hides the cookie banner and emits the accept all event
90
+ */
91
+ private _onAcceptAll;
84
92
  /**
85
93
  * Opens the manage preferences modal and emits an event letting users know
86
94
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-cookie-banner",
3
3
  "description": "PIE Design System Cookie Banner built using Web Components",
4
- "version": "0.3.1",
4
+ "version": "0.4.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "@justeattakeaway/pie-icon-button": "0.14.1",
35
35
  "@justeattakeaway/pie-link": "0.3.0",
36
36
  "@justeattakeaway/pie-modal": "0.19.1",
37
- "@justeattakeaway/pie-toggle-switch": "0.7.0"
37
+ "@justeattakeaway/pie-toggle-switch": "0.8.0"
38
38
  },
39
39
  "dependencies": {
40
40
  "@justeattakeaway/pie-webc-core": "0.8.0"
package/src/index.ts CHANGED
@@ -91,6 +91,22 @@ export class PieCookieBanner extends LitElement implements CookieBannerProps {
91
91
  this.dispatchEvent(event);
92
92
  };
93
93
 
94
+ /**
95
+ * Hides the cookie banner and emits the necessary only event
96
+ */
97
+ private _onNecessaryOnly = () : void => {
98
+ this._dispatchCookieBannerCustomEvent(ON_COOKIE_BANNER_NECESSARY_ONLY);
99
+ this._isCookieBannerHidden = true;
100
+ };
101
+
102
+ /**
103
+ * Hides the cookie banner and emits the accept all event
104
+ */
105
+ private _onAcceptAll = () : void => {
106
+ this._dispatchCookieBannerCustomEvent(ON_COOKIE_BANNER_ACCEPT_ALL);
107
+ this._isCookieBannerHidden = true;
108
+ };
109
+
94
110
  /**
95
111
  * Opens the manage preferences modal and emits an event letting users know
96
112
  */
@@ -188,30 +204,30 @@ export class PieCookieBanner extends LitElement implements CookieBannerProps {
188
204
  <p>We use our own and third party cookies and other tech to enhance and personalise your user experience,
189
205
  optimize analytics, and show ads with third parties
190
206
  (read our <pie-link variant="inverse">Statement</pie-link>).
191
- Necessary cookies are always set. Click <pie-link variant="inverse">Necessary only</pie-link>
192
- to continue without accepting more. Click <pie-link variant="inverse">Manage preferences</pie-link>
193
- to share your preferences or <pie-link variant="inverse">Accept all</pie-link>.</p>
207
+ Necessary cookies are always set. Click <pie-link data-test-id="body-necessary-only" tag="button" variant="inverse" @click="${this._onNecessaryOnly}">Necessary only</pie-link>
208
+ to continue without accepting more. Click <pie-link data-test-id="body-manage-prefs" tag="button" variant="inverse" @click="${this._openManagePreferencesModal}">Manage preferences</pie-link>
209
+ to share your preferences or <pie-link data-test-id="body-accept-all" tag="button" variant="inverse" @click="${this._onAcceptAll}">Accept all</pie-link>.</p>
194
210
  </div>
195
211
 
196
212
  <div class="c-cookieBanner-actions">
197
213
  <pie-button
198
- data-test-id="accept-all"
199
- @click="${() => { this._dispatchCookieBannerCustomEvent(ON_COOKIE_BANNER_ACCEPT_ALL); this._isCookieBannerHidden = true; }}"
214
+ data-test-id="actions-accept-all"
215
+ @click="${this._onAcceptAll}"
200
216
  variant="primary"
201
217
  isFullWidth
202
218
  size="small-expressive">
203
219
  Accept all
204
220
  </pie-button>
205
221
  <pie-button
206
- data-test-id="necessary-only"
207
- @click="${() => { this._dispatchCookieBannerCustomEvent(ON_COOKIE_BANNER_NECESSARY_ONLY); this._isCookieBannerHidden = true; }}"
222
+ data-test-id="actions-necessary-only"
223
+ @click="${this._onNecessaryOnly}"
208
224
  variant="outline-inverse"
209
225
  isFullWidth
210
226
  size="small-expressive">
211
227
  Necessary only
212
228
  </pie-button>
213
229
  <pie-link
214
- data-test-id="manage-prefs"
230
+ data-test-id="actions-manage-prefs"
215
231
  @click="${this._openManagePreferencesModal}"
216
232
  tag="button"
217
233
  variant="inverse"