qpp-style 9.45.6 → 9.45.7-beta.2

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.
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import cookie from "cookie";
2
+ import { parse } from "cookie";
3
3
  import { CloseIcon } from "../../lib/SvgComponents";
4
4
  import { TextButton } from "../Button";
5
5
  import {
@@ -24,7 +24,7 @@ const ImpersonatorBanner = () => {
24
24
  qpp_auth_token: token = null,
25
25
  qpp_impersonated_user: user = null,
26
26
  qpp_impersonated_type: viewType = null,
27
- } = cookie.parse(document.cookie);
27
+ } = parse(document.cookie);
28
28
 
29
29
  const className = [
30
30
  "qpp-u-display--flex",
@@ -1,12 +1,10 @@
1
1
  import React from "react";
2
- import cookie from "cookie";
2
+ import { parse } from "cookie";
3
3
  import { TextButton } from "../Button";
4
4
  import { CloseIcon } from "../../lib/SvgComponents";
5
5
 
6
6
  function PreviewBanner() {
7
- const { qpp_is_preview_mode: isPreviewMode = null } = cookie.parse(
8
- document.cookie,
9
- );
7
+ const { qpp_is_preview_mode: isPreviewMode = null } = parse(document.cookie);
10
8
  if (isPreviewMode === "true") {
11
9
  return (
12
10
  <div className="qpp-u-display--flex qpp-u-justify-content--between qpp-u-fill--gold-20 qpp-u-padding-x--40 qpp-u-padding-y--24 qpp-u-font-size--14 qpp-u-color--gray-80">
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from "react";
2
- import cookie from "cookie";
2
+ import { parse } from "cookie";
3
3
  import Modal from "../Modal";
4
4
  import { fetchTtl } from "../../session";
5
5
  import refreshSession from "../../session/refresh";
@@ -28,7 +28,7 @@ const Session = () => {
28
28
 
29
29
  useEffect(() => {
30
30
  let didCancel = false;
31
- const cookies = cookie.parse(document.cookie);
31
+ const cookies = parse(document.cookie);
32
32
  const hasAuthToken = !!cookies.qpp_auth_token;
33
33
 
34
34
  async function isSessionValid() {
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from "react";
2
2
  import PropTypes from "prop-types";
3
- import cookie from "cookie";
3
+ import { parse } from "cookie";
4
4
  import { jwtDecode } from "jwt-decode";
5
5
  import SanitizedContent from "../../SanitizedContent";
6
6
  import AnimationGroup from "../AnimationGroup/AnimationGroup";
@@ -12,7 +12,7 @@ const LevelOneContent = ({ isExpanded, levelOneContent }) => {
12
12
  qpp_auth_token,
13
13
  qpp_has_authorizations: hasAuthorizations,
14
14
  qpp_cms_internal_authorized: cmsInternalRoleValues,
15
- } = cookie.parse(document.cookie);
15
+ } = parse(document.cookie);
16
16
 
17
17
  const roleOptions = loadRoleOptions([
18
18
  hasAuthorizations,
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect } from "react";
2
2
  import PropTypes from "prop-types";
3
- import cookie from "cookie";
3
+ import { parse } from "cookie";
4
4
  import Dropdown from "../../../Dropdown";
5
5
  import {
6
6
  redirectPage,
@@ -10,8 +10,9 @@ import {
10
10
  } from "./utils";
11
11
 
12
12
  const SelectRole = ({ selectedRole, setSelectedRole, roleOptions }) => {
13
- const { qpp_impersonated_user: isHelpdeskRoleAndImpersonating } =
14
- cookie.parse(document.cookie);
13
+ const { qpp_impersonated_user: isHelpdeskRoleAndImpersonating } = parse(
14
+ document.cookie,
15
+ );
15
16
 
16
17
  const handleSelection = (e) => {
17
18
  e.preventDefault();
@@ -1,4 +1,4 @@
1
- import cookie from "cookie";
1
+ import { parse, serialize } from "cookie";
2
2
 
3
3
  const handleNavigation = (e, linkCallbackFunction, label) => {
4
4
  if (linkCallbackFunction) {
@@ -25,7 +25,7 @@ const handleNavigation = (e, linkCallbackFunction, label) => {
25
25
  */
26
26
  const setSideNavExpanded = (_document, value) => {
27
27
  const secure = _document.location.protocol === "https:";
28
- _document.cookie = cookie.serialize("qpp_side_nav_expanded", value, {
28
+ _document.cookie = serialize("qpp_side_nav_expanded", value, {
29
29
  path: "/",
30
30
  secure,
31
31
  });
@@ -37,7 +37,7 @@ const setSideNavExpanded = (_document, value) => {
37
37
  * @returns {boolean}
38
38
  */
39
39
  const isSideNavExpanded = (_document) => {
40
- const parsedCookies = cookie.parse(_document.cookie);
40
+ const parsedCookies = parse(_document.cookie);
41
41
  if (parsedCookies.qpp_side_nav_expanded === undefined) {
42
42
  setSideNavExpanded(_document, "true");
43
43
  return true;