This is an automated email from the ASF dual-hosted git repository.

tiagobento pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new 0e58dcceab4 NO-ISSUE: Stop reading Extended Services settings from 
cookies on KIE Sandbox (#2932)
0e58dcceab4 is described below

commit 0e58dcceab4e27ea0cf8c92ed8568cb11297b096
Author: Tiago Bento <[email protected]>
AuthorDate: Tue Feb 25 13:56:30 2025 -0500

    NO-ISSUE: Stop reading Extended Services settings from cookies on KIE 
Sandbox (#2932)
---
 packages/online-editor/src/cookies/index.ts        | 35 ----------------------
 .../online-editor/src/settings/SettingsContext.tsx |  8 ++---
 2 files changed, 2 insertions(+), 41 deletions(-)

diff --git a/packages/online-editor/src/cookies/index.ts 
b/packages/online-editor/src/cookies/index.ts
deleted file mode 100644
index e5ac26ba6a8..00000000000
--- a/packages/online-editor/src/cookies/index.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-export function getCookie(name: string) {
-  const value = "; " + document.cookie;
-  const parts = value.split("; " + name + "=");
-
-  if (parts.length === 2) {
-    return parts.pop()!.split(";").shift();
-  }
-}
-
-export function setCookie(name: string, value: string) {
-  const date = new Date();
-
-  date.setTime(date.getTime() + 10 * 365 * 24 * 60 * 60); // expires in 10 
years
-
-  document.cookie = name + "=" + value + "; expires=" + date.toUTCString() + 
"; path=/";
-}
diff --git a/packages/online-editor/src/settings/SettingsContext.tsx 
b/packages/online-editor/src/settings/SettingsContext.tsx
index d9b58c0658a..c265c11b89e 100644
--- a/packages/online-editor/src/settings/SettingsContext.tsx
+++ b/packages/online-editor/src/settings/SettingsContext.tsx
@@ -29,12 +29,8 @@ import { useEnv } from "../env/hooks/EnvContext";
 import { QueryParams } from "../navigation/Routes";
 import { useQueryParams } from "../queryParams/QueryParamsContext";
 import { SettingsTabs } from "./SettingsModalBody";
-import { getCookie } from "../cookies";
 import { useEditorEnvelopeLocator } from 
"../envelopeLocator/hooks/EditorEnvelopeLocatorContext";
 
-export const EXTENDED_SERVICES_HOST_COOKIE_NAME = 
"kie-tools-COOKIE__kie-sandbox-extended-services--host";
-export const EXTENDED_SERVICES_PORT_COOKIE_NAME = 
"kie-tools-COOKIE__kie-sandbox-extended-services--port";
-
 export type SettingsContextType = {
   settings: {
     version: number;
@@ -155,8 +151,8 @@ export function SettingsContextProvider(props: 
PropsWithChildren<{}>) {
                 url: env.KIE_SANDBOX_CORS_PROXY_URL,
               },
               extendedServices: {
-                host: getCookie(EXTENDED_SERVICES_HOST_COOKIE_NAME) ?? 
envExtendedServicesHost,
-                port: getCookie(EXTENDED_SERVICES_PORT_COOKIE_NAME) ?? 
envExtendedServicesPort,
+                host: envExtendedServicesHost,
+                port: envExtendedServicesPort,
               },
               editors: {
                 useLegacyDmnEditor: false,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to