File tree Expand file tree Collapse file tree 3 files changed +13
-11
lines changed
packages/react/src/analytics
integrations/shared/GoogleConsentMode Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 1- // We use a require here to avoid typescript complaining of `package.json` is not
2- // under rootDir that we would get if we used an import. Typescript apparently ignores
3- // requires.
4- // eslint-disable-next-line @typescript-eslint/no-var-requires
5- const { name, version } = require ( '../../package.json' ) ;
1+ import { name , version } from '../../package.json' ;
62
73export const PACKAGE_VERSION = version ;
84export const PACKAGE_NAME = name ;
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ export class GoogleConsentMode {
6363 this . write ( consentCommand , command , consent ) ;
6464 } ) ;
6565 }
66- } catch {
66+ } catch ( _ ) {
6767 // Do nothing...
6868 }
6969 }
@@ -187,8 +187,7 @@ export class GoogleConsentMode {
187187 /**
188188 * Handles consent by updating the data layer with consent information.
189189 *
190- * @param {string } consent - The consent command "consent".
191- * @param consentCommand
190+ * @param {string } consentCommand - The consent command "consent".
192191 * @param {string } command - The command "default" or "update".
193192 * @param {object } consentParams - The consent arguments.
194193 */
Original file line number Diff line number Diff line change @@ -3,7 +3,9 @@ import { PACKAGE_NAME } from '../../../constants';
33export const GCM_SHARED_COOKIE_NAME = `${ PACKAGE_NAME } __gcm_shared_consent_mode` ;
44
55/**
6+ * Gets the parent domain from the window location.
67 *
8+ * @returns {string } The domain calculated from the window location.
79 */
810function getDomain ( ) {
911 const fullDomain = window . location . hostname ;
@@ -22,9 +24,14 @@ function getDomain() {
2224}
2325
2426/**
25- * @param name - Cookie name.
26- * @param value - Cookie value.
27- * @param domain - Domain to set. If not passed, will use the parent domain from the hostname.
27+ * Sets a cookie with the passed name
28+ * and value and domain. If domain is not
29+ * passed, it will be calculated from the
30+ * window.location to be a parent a domain.
31+ *
32+ * @param {string } name - Cookie name.
33+ * @param {string } value - Cookie value.
34+ * @param {string } [domain=getDomain()] - Domain to set. If not passed, will use the parent domain from the hostname.
2835 */
2936export function setCookie ( name , value , domain = getDomain ( ) ) {
3037 document . cookie = name + '=' + ( value || '' ) + '; path=/ ; domain=' + domain ;
You can’t perform that action at this time.
0 commit comments