@newskit-render/core 2.3.2 → 2.5.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/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.5.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@2.5.0-alpha.0...@newskit-render/core@2.5.0) (2022-10-12)
7
+
8
+ **Note:** Version bump only for package @newskit-render/core
9
+
10
+
11
+
12
+
13
+
14
+ # [2.4.0](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@2.4.0-alpha.0...@newskit-render/core@2.4.0) (2022-10-11)
15
+
16
+ **Note:** Version bump only for package @newskit-render/core
17
+
18
+
19
+
20
+
21
+
6
22
  ## [2.3.2](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@2.3.2-alpha.0...@newskit-render/core@2.3.2) (2022-10-07)
7
23
 
8
24
  **Note:** Version bump only for package @newskit-render/core
@@ -1,17 +1,30 @@
1
1
  //Note: Check periodically if these consent cookie values exprire
2
2
  import _ from 'lodash'
3
- const nuktSPConsentValue = 'JABCDEFGHI'
4
- const consentUUIDValue = 'ff8ac797-02c4-4fb4-81f2-22f8ba2e8723_8'
3
+ import {
4
+ nuktSPConsentValue,
5
+ consentUUIDValue,
6
+ _sp_local_state,
7
+ _sp_user_consent_7377,
8
+ _sp_non_keyed_local_state,
9
+ } from './consentValues'
10
+
11
+ const setConentLocalStorage = () => {
12
+ localStorage.setItem('_sp_local_state', JSON.stringify(_sp_local_state))
13
+ localStorage.setItem('_sp_user_consent_7377', JSON.stringify(_sp_user_consent_7377))
14
+ localStorage.setItem('_sp_non_keyed_local_state', JSON.stringify(_sp_non_keyed_local_state))
15
+ }
5
16
 
6
17
  Cypress.Commands.add('mockConsentAndVisit', (url) => {
7
18
  cy.setCookie('nukt_sp_consent', nuktSPConsentValue)
8
19
  cy.setCookie('consentUUID', consentUUIDValue)
20
+ setConentLocalStorage()
9
21
  cy.visit(url)
10
22
  })
11
23
 
12
24
  Cypress.Commands.add('mockConsent', () => {
13
25
  cy.setCookie('nukt_sp_consent', nuktSPConsentValue)
14
26
  cy.setCookie('consentUUID', consentUUIDValue)
27
+ setConentLocalStorage()
15
28
  })
16
29
 
17
30
  const userMap = {
@@ -0,0 +1,392 @@
1
+ export const nuktSPConsentValue = 'JABCDEFGHI'
2
+
3
+ export const consentUUIDValue = 'f5e9a5b9-3468-4d4e-8380-138fc864f19a_12'
4
+
5
+ export const _sp_local_state = {
6
+ "gdpr": {
7
+ "mmsCookies": [
8
+ "_sp_v1_ss=1:H4sIAAAAAAAAAItWqo5RKimOUbKKBjLyQAyD2lidGKVUEDOvNCcHyC4BK6iurVWKBQAW54XRMAAAAA%3D%3D"
9
+ ],
10
+ "propertyId": 7377,
11
+ "messageId": 565369
12
+ }
13
+ }
14
+
15
+ export const _sp_user_consent_7377 = {
16
+ "actions": [
17
+ {
18
+ "_id": "61fa905112228108ab6be61f",
19
+ "type": "inline",
20
+ "url": "",
21
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'J';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
22
+ "tagManager": null
23
+ },
24
+ {
25
+ "_id": "61fa905112228108ab6be627",
26
+ "type": "inline",
27
+ "url": "",
28
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'A';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
29
+ "tagManager": null
30
+ },
31
+ {
32
+ "_id": "61fa905112228108ab6be62f",
33
+ "type": "inline",
34
+ "url": "",
35
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'B';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
36
+ "tagManager": null
37
+ },
38
+ {
39
+ "_id": "61fa905112228108ab6be637",
40
+ "type": "inline",
41
+ "url": "",
42
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'C';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
43
+ "tagManager": null
44
+ },
45
+ {
46
+ "_id": "61fa905112228108ab6be63f",
47
+ "type": "inline",
48
+ "url": "",
49
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'D';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
50
+ "tagManager": null
51
+ },
52
+ {
53
+ "_id": "61fa905112228108ab6be647",
54
+ "type": "inline",
55
+ "url": "",
56
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'E';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
57
+ "tagManager": null
58
+ },
59
+ {
60
+ "_id": "61fa905112228108ab6be64f",
61
+ "type": "inline",
62
+ "url": "",
63
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'F';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
64
+ "tagManager": null
65
+ },
66
+ {
67
+ "_id": "61fa905112228108ab6be657",
68
+ "type": "inline",
69
+ "url": "",
70
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'G';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
71
+ "tagManager": null
72
+ },
73
+ {
74
+ "_id": "61fa905112228108ab6be65f",
75
+ "type": "inline",
76
+ "url": "",
77
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'H';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
78
+ "tagManager": null
79
+ },
80
+ {
81
+ "_id": "61fa905112228108ab6be667",
82
+ "type": "inline",
83
+ "url": "",
84
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'I';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}\r\n\r\n// manage the cookie for Tealium\r\n// update the cookie and set the expiry date for it to THREE YEARS\r\nlet now = new Date();\r\nlet time = now.getTime();\r\ntime += 94608000000; // three years later\r\nnow.setTime(time);\r\n// drop the cookie\r\ndocument.cookie = 'nukt_sp_consent=' + encodeURIComponent( window.nonIabPurposeConsents ) + ';expires='+now.toGMTString()+';path=/';\r\n// update Tealium data layer, if existing\r\nif( typeof utag_data !== 'undefined' ) { utag_data['cp.nukt_sp_consent'] = window.nonIabPurposeConsents; }\r\nif( ( typeof utag !== 'undefined' ) && ( typeof utag.data !== 'undefined' ) ) { utag.data['cp.nukt_sp_consent'] = window.nonIabPurposeConsents; }\r\n\r\n// clear the queue of Tealium calls, if needed\r\nif( ( typeof window.nukt_cmp !== 'undefined' ) && ( typeof window.nukt_cmp.flushQueue !== 'undefined' ) ) {\r\n window.nukt_cmp.flushQueue();\r\n}\r\n\r\n\r\n\r\n// code to handle the cookie V2 for new Tealium integration\r\nif( ( typeof _sp_ !== 'undefined' ) && ( typeof _sp_.getCustomVendorConsents === 'function' ) ) {\r\n\r\n _sp_.getCustomVendorConsents( function( v, success ) {\r\n if( success ) {\r\n // consent information is available\r\n\t // read the data structure and set the flags\r\n\t var f = '';\r\n\t if( typeof v.consentedPurposes !== 'undefined' &&\r\n\t v.consentedPurposes.constructor === Array &&\r\n\t\t v.consentedPurposes.length > 0 ) {\r\n\t for( var i = 0; i < v.consentedPurposes.length; i++ ) {\r\n\r\n switch( v.consentedPurposes[i]._id.toLowerCase() ) {\r\n\t\t case '5ff72d5ebdf037283e40a4c2': f += 'A'; break; \r\n\t\t case '5ff72d5ebdf037283e40a4c7': f += 'B'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38c1': f += 'C'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38c6': f += 'D'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38cb': f += 'E'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38d0': f += 'F'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38d5': f += 'G'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38da': f += 'H'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38df': f += 'I'; break;\r\n\t\t\tcase '5ff72d5ebdf037283e40a4bd': f += 'J'; break;\r\n\t\t }\r\n\r\n\t\t}\r\n\t }\r\n\t f = f + '|';\r\n\t if( typeof v.legIntPurposes !== 'undefined' &&\r\n\t v.legIntPurposes.constructor === Array &&\r\n\t\t v.legIntPurposes.length > 0 ) {\r\n\t for(var j = 0; j < v.legIntPurposes.length; j++ ) {\r\n\t\t\t\r\n switch( v.legIntPurposes[j]._id.toLowerCase() ) {\r\n\t\t case '5ff72d5ebdf037283e40a4c2': f += 'N'; break; \r\n\t\t case '5ff72d5ebdf037283e40a4c7': f += 'O'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38c1': f += 'P'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38c6': f += 'Q'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38cb': f += 'R'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38d0': f += 'S'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38d5': f += 'T'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38da': f += 'U'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38df': f += 'V'; break;\r\n\t\t }\r\n\t\t\t\r\n\t\t}\r\n }\r\n\t \r\n\t // update the cookie V2 with the overall consent information\r\n now = new Date();\r\n time = now.getTime();\r\n time += 94608000000; // three years later\r\n now.setTime(time);\r\n // drop the cookie\r\n document.cookie = 'nukt_sp_consent_v2=' + encodeURIComponent(f) + ';expires=' + now.toGMTString() + ';path=/';\r\n\t \r\n\t // update Tealium data layer, if existing\r\n if( typeof utag_data !== 'undefined' ) {\r\n utag_data['cp.nukt_sp_consent_v2'] = f;\r\n }\r\n if( typeof utag !== 'undefined' && typeof utag.data !== 'undefined' ) {\r\n utag.data['cp.nukt_sp_consent_v2'] = f;\r\n }\r\n \r\n\t // clear the queue of Tealium calls, if needed\r\n if( ( typeof window.nukt_cmp !== 'undefined' ) && ( typeof window.nukt_cmp.flushQueueV2 !== 'undefined' ) ) {\r\n window.nukt_cmp.flushQueueV2();\r\n }\r\n }\r\n });\r\n}\r\n\r\n\r\n",
85
+ "tagManager": null
86
+ }
87
+ ],
88
+ "addtlConsent": "1~",
89
+ "consentStatus": {
90
+ "rejectedAny": false,
91
+ "rejectedLI": false,
92
+ "consentedAll": true,
93
+ "granularStatus": {
94
+ "vendorConsent": "ALL",
95
+ "vendorLegInt": "EMPTY_VL",
96
+ "purposeConsent": "ALL",
97
+ "purposeLegInt": "EMPTY_VL",
98
+ "previousOptInAll": false,
99
+ "defaultConsent": false
100
+ },
101
+ "hasConsentData": true,
102
+ "consentedToAny": true
103
+ },
104
+ "consentUUID": "f5e9a5b9-3468-4d4e-8380-138fc864f19a_12",
105
+ "customVendorsResponse": {
106
+ "consentedVendors": [
107
+ {
108
+ "_id": "5e7f6927b8e05c1c467daa5d",
109
+ "name": "Branch Metrics, Inc.",
110
+ "vendorType": "CUSTOM"
111
+ },
112
+ {
113
+ "_id": "5f745ab96f3aae0163740409",
114
+ "name": "Ipsos MORI",
115
+ "vendorType": "CUSTOM"
116
+ }
117
+ ],
118
+ "consentedPurposes": [
119
+ {
120
+ "_id": "5ff72d5ebdf037283e40a4bd",
121
+ "name": "Store and/or access information on a device"
122
+ },
123
+ {
124
+ "_id": "5ff72d5ebdf037283e40a4c2",
125
+ "name": "Select personalised content"
126
+ },
127
+ {
128
+ "_id": "5ff72d5ebdf037283e40a4c7",
129
+ "name": "Select personalised ads"
130
+ },
131
+ {
132
+ "_id": "6014443f87b0803b0f3e38c1",
133
+ "name": "Select basic ads"
134
+ },
135
+ {
136
+ "_id": "6014443f87b0803b0f3e38c6",
137
+ "name": "Create a personalised ads profile"
138
+ },
139
+ {
140
+ "_id": "6014443f87b0803b0f3e38cb",
141
+ "name": "Create a personalised content profile"
142
+ },
143
+ {
144
+ "_id": "6014443f87b0803b0f3e38d0",
145
+ "name": "Measure ad performance"
146
+ },
147
+ {
148
+ "_id": "6014443f87b0803b0f3e38d5",
149
+ "name": "Measure content performance"
150
+ },
151
+ {
152
+ "_id": "6014443f87b0803b0f3e38da",
153
+ "name": "Apply market research to generate audience insights"
154
+ },
155
+ {
156
+ "_id": "6014443f87b0803b0f3e38df",
157
+ "name": "Develop and improve products"
158
+ }
159
+ ],
160
+ "legIntPurposes": []
161
+ },
162
+ "dateCreated": "2022-10-06T11:16:35.371Z",
163
+ "euconsent": "CPgbQkAPgbQkAAGABCENCjCsAAAAAAAAACgAAAAAAAAA.YAAAAAAAAAAA",
164
+ "gdprApplies": true,
165
+ "grants": {
166
+ "5e7f6927b8e05c1c467daa5d": {
167
+ "vendorGrant": true,
168
+ "purposeGrants": {
169
+ "5ff72d5ebdf037283e40a4bd": true,
170
+ "5ff72d5ebdf037283e40a4c2": true,
171
+ "5ff72d5ebdf037283e40a4c7": true,
172
+ "6014443f87b0803b0f3e38c1": true,
173
+ "6014443f87b0803b0f3e38c6": true,
174
+ "6014443f87b0803b0f3e38cb": true,
175
+ "6014443f87b0803b0f3e38d0": true,
176
+ "6014443f87b0803b0f3e38d5": true,
177
+ "6014443f87b0803b0f3e38da": true,
178
+ "6014443f87b0803b0f3e38df": true
179
+ }
180
+ },
181
+ "5f745ab96f3aae0163740409": {
182
+ "vendorGrant": true,
183
+ "purposeGrants": {
184
+ "5ff72d5ebdf037283e40a4bd": true,
185
+ "5ff72d5ebdf037283e40a4c2": true,
186
+ "5ff72d5ebdf037283e40a4c7": true,
187
+ "6014443f87b0803b0f3e38c1": true,
188
+ "6014443f87b0803b0f3e38c6": true,
189
+ "6014443f87b0803b0f3e38cb": true,
190
+ "6014443f87b0803b0f3e38d0": true,
191
+ "6014443f87b0803b0f3e38d5": true,
192
+ "6014443f87b0803b0f3e38da": true,
193
+ "6014443f87b0803b0f3e38df": true
194
+ }
195
+ }
196
+ },
197
+ "vendorListId": "5ff72d5fa22863a7f72b9b95",
198
+ "gdpr": {
199
+ "authId": null,
200
+ "uuid": "f5e9a5b9-3468-4d4e-8380-138fc864f19a_12",
201
+ "getMessageAlways": false,
202
+ "applies": true,
203
+ "customVendorsResponse": {
204
+ "consentedVendors": [
205
+ {
206
+ "_id": "5e7f6927b8e05c1c467daa5d",
207
+ "name": "Branch Metrics, Inc.",
208
+ "vendorType": "CUSTOM"
209
+ },
210
+ {
211
+ "_id": "5f745ab96f3aae0163740409",
212
+ "name": "Ipsos MORI",
213
+ "vendorType": "CUSTOM"
214
+ }
215
+ ],
216
+ "consentedPurposes": [
217
+ {
218
+ "_id": "5ff72d5ebdf037283e40a4bd",
219
+ "name": "Store and/or access information on a device"
220
+ },
221
+ {
222
+ "_id": "5ff72d5ebdf037283e40a4c2",
223
+ "name": "Select personalised content"
224
+ },
225
+ {
226
+ "_id": "5ff72d5ebdf037283e40a4c7",
227
+ "name": "Select personalised ads"
228
+ },
229
+ {
230
+ "_id": "6014443f87b0803b0f3e38c1",
231
+ "name": "Select basic ads"
232
+ },
233
+ {
234
+ "_id": "6014443f87b0803b0f3e38c6",
235
+ "name": "Create a personalised ads profile"
236
+ },
237
+ {
238
+ "_id": "6014443f87b0803b0f3e38cb",
239
+ "name": "Create a personalised content profile"
240
+ },
241
+ {
242
+ "_id": "6014443f87b0803b0f3e38d0",
243
+ "name": "Measure ad performance"
244
+ },
245
+ {
246
+ "_id": "6014443f87b0803b0f3e38d5",
247
+ "name": "Measure content performance"
248
+ },
249
+ {
250
+ "_id": "6014443f87b0803b0f3e38da",
251
+ "name": "Apply market research to generate audience insights"
252
+ },
253
+ {
254
+ "_id": "6014443f87b0803b0f3e38df",
255
+ "name": "Develop and improve products"
256
+ }
257
+ ],
258
+ "legIntPurposes": []
259
+ },
260
+ "addtlConsent": "1~",
261
+ "grants": {
262
+ "5e7f6927b8e05c1c467daa5d": {
263
+ "vendorGrant": true,
264
+ "purposeGrants": {
265
+ "5ff72d5ebdf037283e40a4bd": true,
266
+ "5ff72d5ebdf037283e40a4c2": true,
267
+ "5ff72d5ebdf037283e40a4c7": true,
268
+ "6014443f87b0803b0f3e38c1": true,
269
+ "6014443f87b0803b0f3e38c6": true,
270
+ "6014443f87b0803b0f3e38cb": true,
271
+ "6014443f87b0803b0f3e38d0": true,
272
+ "6014443f87b0803b0f3e38d5": true,
273
+ "6014443f87b0803b0f3e38da": true,
274
+ "6014443f87b0803b0f3e38df": true
275
+ }
276
+ },
277
+ "5f745ab96f3aae0163740409": {
278
+ "vendorGrant": true,
279
+ "purposeGrants": {
280
+ "5ff72d5ebdf037283e40a4bd": true,
281
+ "5ff72d5ebdf037283e40a4c2": true,
282
+ "5ff72d5ebdf037283e40a4c7": true,
283
+ "6014443f87b0803b0f3e38c1": true,
284
+ "6014443f87b0803b0f3e38c6": true,
285
+ "6014443f87b0803b0f3e38cb": true,
286
+ "6014443f87b0803b0f3e38d0": true,
287
+ "6014443f87b0803b0f3e38d5": true,
288
+ "6014443f87b0803b0f3e38da": true,
289
+ "6014443f87b0803b0f3e38df": true
290
+ }
291
+ }
292
+ },
293
+ "euconsent": "CPgbQkAPgbQkAAGABCENCjCsAAAAAAAAACgAAAAAAAAA.YAAAAAAAAAAA",
294
+ "consentStatus": {
295
+ "rejectedAny": false,
296
+ "rejectedLI": false,
297
+ "consentedAll": true,
298
+ "granularStatus": {
299
+ "vendorConsent": "ALL",
300
+ "vendorLegInt": "EMPTY_VL",
301
+ "purposeConsent": "ALL",
302
+ "purposeLegInt": "EMPTY_VL",
303
+ "previousOptInAll": false,
304
+ "defaultConsent": false
305
+ },
306
+ "hasConsentData": true,
307
+ "consentedToAny": true
308
+ },
309
+ "actions": [
310
+ {
311
+ "_id": "61fa905112228108ab6be61f",
312
+ "type": "inline",
313
+ "url": "",
314
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'J';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
315
+ "tagManager": null
316
+ },
317
+ {
318
+ "_id": "61fa905112228108ab6be627",
319
+ "type": "inline",
320
+ "url": "",
321
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'A';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
322
+ "tagManager": null
323
+ },
324
+ {
325
+ "_id": "61fa905112228108ab6be62f",
326
+ "type": "inline",
327
+ "url": "",
328
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'B';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
329
+ "tagManager": null
330
+ },
331
+ {
332
+ "_id": "61fa905112228108ab6be637",
333
+ "type": "inline",
334
+ "url": "",
335
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'C';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
336
+ "tagManager": null
337
+ },
338
+ {
339
+ "_id": "61fa905112228108ab6be63f",
340
+ "type": "inline",
341
+ "url": "",
342
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'D';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
343
+ "tagManager": null
344
+ },
345
+ {
346
+ "_id": "61fa905112228108ab6be647",
347
+ "type": "inline",
348
+ "url": "",
349
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'E';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
350
+ "tagManager": null
351
+ },
352
+ {
353
+ "_id": "61fa905112228108ab6be64f",
354
+ "type": "inline",
355
+ "url": "",
356
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'F';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
357
+ "tagManager": null
358
+ },
359
+ {
360
+ "_id": "61fa905112228108ab6be657",
361
+ "type": "inline",
362
+ "url": "",
363
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'G';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
364
+ "tagManager": null
365
+ },
366
+ {
367
+ "_id": "61fa905112228108ab6be65f",
368
+ "type": "inline",
369
+ "url": "",
370
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'H';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}",
371
+ "tagManager": null
372
+ },
373
+ {
374
+ "_id": "61fa905112228108ab6be667",
375
+ "type": "inline",
376
+ "url": "",
377
+ "js": "/*\r\nAIT consent management code.\r\nPlease do not modify.\r\n*/\r\nlet lbl = 'I';\r\nif( typeof window.nonIabPurposeConsents === 'undefined' ) {\r\n // create the list, if not existing\r\n window.nonIabPurposeConsents = lbl;\r\n}\r\nelse {\r\n // add the consent to the list, if not already present\r\n if( window.nonIabPurposeConsents.indexOf(lbl) === -1 ) {\r\n window.nonIabPurposeConsents += lbl;\r\n }\r\n}\r\n\r\n// manage the cookie for Tealium\r\n// update the cookie and set the expiry date for it to THREE YEARS\r\nlet now = new Date();\r\nlet time = now.getTime();\r\ntime += 94608000000; // three years later\r\nnow.setTime(time);\r\n// drop the cookie\r\ndocument.cookie = 'nukt_sp_consent=' + encodeURIComponent( window.nonIabPurposeConsents ) + ';expires='+now.toGMTString()+';path=/';\r\n// update Tealium data layer, if existing\r\nif( typeof utag_data !== 'undefined' ) { utag_data['cp.nukt_sp_consent'] = window.nonIabPurposeConsents; }\r\nif( ( typeof utag !== 'undefined' ) && ( typeof utag.data !== 'undefined' ) ) { utag.data['cp.nukt_sp_consent'] = window.nonIabPurposeConsents; }\r\n\r\n// clear the queue of Tealium calls, if needed\r\nif( ( typeof window.nukt_cmp !== 'undefined' ) && ( typeof window.nukt_cmp.flushQueue !== 'undefined' ) ) {\r\n window.nukt_cmp.flushQueue();\r\n}\r\n\r\n\r\n\r\n// code to handle the cookie V2 for new Tealium integration\r\nif( ( typeof _sp_ !== 'undefined' ) && ( typeof _sp_.getCustomVendorConsents === 'function' ) ) {\r\n\r\n _sp_.getCustomVendorConsents( function( v, success ) {\r\n if( success ) {\r\n // consent information is available\r\n\t // read the data structure and set the flags\r\n\t var f = '';\r\n\t if( typeof v.consentedPurposes !== 'undefined' &&\r\n\t v.consentedPurposes.constructor === Array &&\r\n\t\t v.consentedPurposes.length > 0 ) {\r\n\t for( var i = 0; i < v.consentedPurposes.length; i++ ) {\r\n\r\n switch( v.consentedPurposes[i]._id.toLowerCase() ) {\r\n\t\t case '5ff72d5ebdf037283e40a4c2': f += 'A'; break; \r\n\t\t case '5ff72d5ebdf037283e40a4c7': f += 'B'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38c1': f += 'C'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38c6': f += 'D'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38cb': f += 'E'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38d0': f += 'F'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38d5': f += 'G'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38da': f += 'H'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38df': f += 'I'; break;\r\n\t\t\tcase '5ff72d5ebdf037283e40a4bd': f += 'J'; break;\r\n\t\t }\r\n\r\n\t\t}\r\n\t }\r\n\t f = f + '|';\r\n\t if( typeof v.legIntPurposes !== 'undefined' &&\r\n\t v.legIntPurposes.constructor === Array &&\r\n\t\t v.legIntPurposes.length > 0 ) {\r\n\t for(var j = 0; j < v.legIntPurposes.length; j++ ) {\r\n\t\t\t\r\n switch( v.legIntPurposes[j]._id.toLowerCase() ) {\r\n\t\t case '5ff72d5ebdf037283e40a4c2': f += 'N'; break; \r\n\t\t case '5ff72d5ebdf037283e40a4c7': f += 'O'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38c1': f += 'P'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38c6': f += 'Q'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38cb': f += 'R'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38d0': f += 'S'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38d5': f += 'T'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38da': f += 'U'; break;\r\n\t\t\tcase '6014443f87b0803b0f3e38df': f += 'V'; break;\r\n\t\t }\r\n\t\t\t\r\n\t\t}\r\n }\r\n\t \r\n\t // update the cookie V2 with the overall consent information\r\n now = new Date();\r\n time = now.getTime();\r\n time += 94608000000; // three years later\r\n now.setTime(time);\r\n // drop the cookie\r\n document.cookie = 'nukt_sp_consent_v2=' + encodeURIComponent(f) + ';expires=' + now.toGMTString() + ';path=/';\r\n\t \r\n\t // update Tealium data layer, if existing\r\n if( typeof utag_data !== 'undefined' ) {\r\n utag_data['cp.nukt_sp_consent_v2'] = f;\r\n }\r\n if( typeof utag !== 'undefined' && typeof utag.data !== 'undefined' ) {\r\n utag.data['cp.nukt_sp_consent_v2'] = f;\r\n }\r\n \r\n\t // clear the queue of Tealium calls, if needed\r\n if( ( typeof window.nukt_cmp !== 'undefined' ) && ( typeof window.nukt_cmp.flushQueueV2 !== 'undefined' ) ) {\r\n window.nukt_cmp.flushQueueV2();\r\n }\r\n }\r\n });\r\n}\r\n\r\n\r\n",
378
+ "tagManager": null
379
+ }
380
+ ],
381
+ "dateCreated": "2022-10-06T11:16:35.371Z",
382
+ "vendorListId": "5ff72d5fa22863a7f72b9b95"
383
+ },
384
+ "version": 1
385
+ }
386
+
387
+ export const _sp_non_keyed_local_state = {
388
+ "gdpr": {
389
+ "_sp_v1_uid": "1:117:d10f2b55-a2d1-484f-847e-9d0f18a7c6e3",
390
+ "_sp_v1_data": "2:405889:1652176805:0:8:0:8:0:0:_:-1"
391
+ }
392
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newskit-render/core",
3
- "version": "2.3.2",
3
+ "version": "2.5.0",
4
4
  "description": "Newskit Render - Core package",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",
@@ -40,12 +40,12 @@
40
40
  "@emotion/styled": "11.10.4",
41
41
  "@newskit-render/api": "^1.1.0",
42
42
  "@newskit-render/auth": "^1.0.1",
43
- "@newskit-render/checkout": "^1.0.5",
43
+ "@newskit-render/checkout": "^1.0.6",
44
44
  "@newskit-render/feature-flags": "^1.0.0",
45
45
  "@newskit-render/feed": "^1.0.1",
46
- "@newskit-render/my-account": "^3.4.0",
47
- "@newskit-render/shared-components": "^1.2.1",
48
- "@newskit-render/standalone-components": "^1.2.1",
46
+ "@newskit-render/my-account": "^3.4.1",
47
+ "@newskit-render/shared-components": "^1.3.0",
48
+ "@newskit-render/standalone-components": "^1.3.0",
49
49
  "@newskit-render/validation": "^1.1.0",
50
50
  "cross-fetch": "3.1.5",
51
51
  "graphql": "15.6.0",
package/pages/_app.tsx CHANGED
@@ -1,9 +1,7 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  import React from 'react'
3
2
  import { AppContext as AppContextType, AppProps } from 'next/app'
4
3
  import Head from 'next/head'
5
4
  import { ThemeProvider, Global, styled } from 'newskit'
6
- import { SessionProvider } from '@newskit-render/auth'
7
5
  import {
8
6
  getFeatureFlags,
9
7
  FeatureFlagsContextProvider,
@@ -59,18 +57,16 @@ function MyApp({ Component, pageProps, featureFlags, tenant }: MyAppProps) {
59
57
  </Head>
60
58
  <InstrumentationContextProvider>
61
59
  <FeatureFlagsContextProvider context={featureFlags}>
62
- <SessionProvider pageProps={(pageProps as unknown) as any}>
63
- <AppContext.Consumer>
64
- {({ theme }) => (
65
- <ThemeProvider theme={theme}>
66
- <Global styles={GlobalStyling} />
67
- <PageContainer>
68
- <Component {...pageProps} />
69
- </PageContainer>
70
- </ThemeProvider>
71
- )}
72
- </AppContext.Consumer>
73
- </SessionProvider>
60
+ <AppContext.Consumer>
61
+ {({ theme }) => (
62
+ <ThemeProvider theme={theme}>
63
+ <Global styles={GlobalStyling} />
64
+ <PageContainer>
65
+ <Component {...pageProps} />
66
+ </PageContainer>
67
+ </ThemeProvider>
68
+ )}
69
+ </AppContext.Consumer>
74
70
  </FeatureFlagsContextProvider>
75
71
  </InstrumentationContextProvider>
76
72
  </>
@@ -82,10 +82,12 @@ export default class MyDocument extends Document {
82
82
  {helmet.script.toComponent()}
83
83
  {sourcepointAccountId && (
84
84
  <Consent
85
- sourcePointConfigTCFV2={{
85
+ sourcePointConfigUnified={{
86
86
  accountId: Number(sourcepointAccountId),
87
87
  propertyHref: sourcepointPropertyHref,
88
+ gdpr: {},
88
89
  }}
90
+ reactHelmet={Helmet}
89
91
  />
90
92
  )}
91
93
  <meta name="robots" content="noindex" />
@@ -1,4 +1,5 @@
1
1
  import React from 'react'
2
+ import useSWR from 'swr'
2
3
  import {
3
4
  Block,
4
5
  IndeterminateProgressIndicator,
@@ -8,26 +9,31 @@ import {
8
9
  toNewsKitIcon,
9
10
  } from 'newskit'
10
11
  import {
12
+ SessionProvider,
11
13
  PageWithAuth,
12
14
  getSession,
13
15
  signIn,
14
16
  signOut,
15
17
  CookieView,
16
18
  } from '@newskit-render/auth'
17
- import { createApolloClient, ClientTypes } from '@newskit-render/api'
19
+ import {
20
+ createApolloClient,
21
+ ClientTypes,
22
+ getAcsCookie,
23
+ } from '@newskit-render/api'
24
+ import { Article } from '@newskit-render/standalone-components'
18
25
  import { getHost } from '@newskit-render/shared-components'
19
26
  import { Info } from '@emotion-icons/material/Info'
20
27
  import { GET_UNIVERSAL_ARTICLE } from '../../../../../queries'
21
28
  import ArticlePage from '../../../../../components/article'
22
- import {
23
- highlights,
24
- relatedArticles,
25
- } from '../../../../../helpers/mocks/articleMock'
29
+ import { fetchUser } from '../../../../../helpers/getUser'
30
+ import { getAccountQueryUrl } from '../../../../../constants'
26
31
  import { addCacheHeaders } from '../../../../../helpers/addCacheHeaders'
27
32
  import {
28
33
  twitterUsername as configTwitterUsername,
29
34
  gscId as configGscId,
30
35
  } from '../../../../../config'
36
+ import { fetcher } from '../../../../../helpers/getRecommendations'
31
37
 
32
38
  const IconFilledInfo = toNewsKitIcon(Info)
33
39
 
@@ -38,7 +44,26 @@ const PreviewArticle = ({
38
44
  twitterUsername,
39
45
  siteHost,
40
46
  gscId,
47
+ user,
48
+ articleId,
49
+ ...props
41
50
  }) => {
51
+ let userId
52
+ if (typeof window !== 'undefined') {
53
+ userId = window?.utag?.data['cp.utag_main_v_id']
54
+ }
55
+ const highlitedArticles = []
56
+ const relatedArticles = []
57
+ const { data: recommendations } = useSWR<Article[]>(
58
+ `/api/recommendations/${articleId}/${userId}`,
59
+ fetcher
60
+ )
61
+
62
+ if (Array.isArray(recommendations)) {
63
+ highlitedArticles.push(...recommendations.slice(0, 4))
64
+ relatedArticles.push(...recommendations.slice(4, 12))
65
+ }
66
+
42
67
  const accessDeniedPage = (
43
68
  <Banner
44
69
  overrides={{ stylePreset: 'bannerNotice' }}
@@ -68,31 +93,38 @@ const PreviewArticle = ({
68
93
  )
69
94
 
70
95
  return (
71
- <PageWithAuth onDenied={accessDeniedPage} isLoading={showOnLoading}>
72
- <>
73
- <CookieView>
74
- <Button size="medium" onClick={() => signOut()}>
75
- sign out
76
- </Button>
77
- </CookieView>
78
- <ArticlePage
79
- section={section}
80
- articleURL={articleURL}
81
- {...universalArticle}
82
- siteHost={siteHost}
83
- gscId={gscId}
84
- twitterUsername={twitterUsername}
85
- highlights={highlights}
86
- relatedArticles={relatedArticles}
87
- />
88
- </>
89
- </PageWithAuth>
96
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
97
+ <SessionProvider pageProps={(props as unknown) as any}>
98
+ <PageWithAuth onDenied={accessDeniedPage} isLoading={showOnLoading}>
99
+ <>
100
+ <CookieView>
101
+ <Button size="medium" onClick={() => signOut()}>
102
+ sign out
103
+ </Button>
104
+ </CookieView>
105
+ <ArticlePage
106
+ section={section}
107
+ articleURL={articleURL}
108
+ {...universalArticle}
109
+ siteHost={siteHost}
110
+ gscId={gscId}
111
+ twitterUsername={twitterUsername}
112
+ highlights={highlitedArticles}
113
+ relatedArticles={relatedArticles}
114
+ user={user}
115
+ />
116
+ </>
117
+ </PageWithAuth>
118
+ </SessionProvider>
90
119
  )
91
120
  }
92
121
 
93
122
  export async function getServerSideProps(context) {
94
123
  const apolloClient = await createApolloClient(ClientTypes.nkapi)
95
124
  const session = await getSession(context)
125
+ const acsCookie = context.req.headers.cookie
126
+ ? getAcsCookie(ClientTypes.main, context.req.headers.cookie)
127
+ : ''
96
128
  const siteHost = getHost(context.req)
97
129
  if (!session) {
98
130
  return {
@@ -103,10 +135,17 @@ export async function getServerSideProps(context) {
103
135
  params: { articleId, versionId },
104
136
  } = context
105
137
 
106
- const { data } = await apolloClient.query({
107
- query: GET_UNIVERSAL_ARTICLE,
108
- variables: { publisher: 'DEMO', id: articleId, version: versionId },
109
- })
138
+ const [{ data }, user] = await Promise.all([
139
+ apolloClient.query({
140
+ query: GET_UNIVERSAL_ARTICLE,
141
+ variables: {
142
+ publisher: 'DEMO',
143
+ id: articleId,
144
+ version: versionId,
145
+ },
146
+ }),
147
+ await fetchUser(acsCookie, getAccountQueryUrl(siteHost)),
148
+ ])
110
149
 
111
150
  addCacheHeaders(context.res)
112
151
  return {
@@ -117,6 +156,9 @@ export async function getServerSideProps(context) {
117
156
  twitterUsername: configTwitterUsername || '',
118
157
  siteHost,
119
158
  gscId: configGscId || '',
159
+ showAds: true,
160
+ user,
161
+ articleId,
120
162
  },
121
163
  }
122
164
  }
package/temp/_app.tsx CHANGED
@@ -3,7 +3,6 @@ import React from 'react'
3
3
  import Head from 'next/head'
4
4
  import { ThemeProvider, Global, css, styled } from 'newskit'
5
5
  <% MODULE >
6
- import { SessionProvider } from '@newskit-render/auth'
7
6
 
8
7
 
9
8