From bebcd6663b786a8522ad27f0dca0d6c0c031cda7 Mon Sep 17 00:00:00 2001
From: Robbie Coomber <robbie.coomber@gmail.com>
Date: Mon, 13 Jan 2025 19:42:02 +0000
Subject: [PATCH] Rename cklsh constants to cookieless

---
 src/__tests__/cookieless.test.ts | 18 +++++++++---------
 src/constants.ts                 |  4 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/__tests__/cookieless.test.ts b/src/__tests__/cookieless.test.ts
index da1f55ba2..bb6f489b8 100644
--- a/src/__tests__/cookieless.test.ts
+++ b/src/__tests__/cookieless.test.ts
@@ -24,12 +24,12 @@ describe('cookieless', () => {
         posthog.capture(eventName, eventProperties)
         expect(beforeSendMock).toBeCalledTimes(1)
         let event = beforeSendMock.mock.calls[0][0]
-        expect(event.properties.distinct_id).toBe('$posthog_cklsh')
+        expect(event.properties.distinct_id).toBe('$posthog_cookieless')
         expect(event.properties.$anon_distinct_id).toBe(undefined)
         expect(event.properties.$device_id).toBe(null)
         expect(event.properties.$session_id).toBe(undefined)
         expect(event.properties.$window_id).toBe(undefined)
-        expect(event.properties.$cklsh_mode).toEqual(true)
+        expect(event.properties.$cookieless_mode).toEqual(true)
         expect(document.cookie).toBe('')
 
         // simulate user giving cookie consent
@@ -39,12 +39,12 @@ describe('cookieless', () => {
         posthog.capture(eventName, eventProperties)
         expect(beforeSendMock).toBeCalledTimes(2)
         event = beforeSendMock.mock.calls[1][0]
-        expect(event.properties.distinct_id).toBe('$posthog_cklsh')
+        expect(event.properties.distinct_id).toBe('$posthog_cookieless')
         expect(event.properties.$anon_distinct_id).toBe(undefined)
         expect(event.properties.$device_id).toBe(null)
         expect(event.properties.$session_id).toBe(undefined)
         expect(event.properties.$window_id).toBe(undefined)
-        expect(event.properties.$cklsh_mode).toEqual(true)
+        expect(event.properties.$cookieless_mode).toEqual(true)
         expect(document.cookie).not.toBe('')
 
         // a user identifying
@@ -52,11 +52,11 @@ describe('cookieless', () => {
         expect(beforeSendMock).toBeCalledTimes(3)
         event = beforeSendMock.mock.calls[2][0]
         expect(event.properties.distinct_id).toBe(identifiedDistinctId)
-        expect(event.properties.$anon_distinct_id).toBe('$posthog_cklsh')
+        expect(event.properties.$anon_distinct_id).toBe('$posthog_cookieless')
         expect(event.properties.$device_id).toBe(null)
         expect(event.properties.$session_id).toBe(undefined)
         expect(event.properties.$window_id).toBe(undefined)
-        expect(event.properties.$cklsh_mode).toEqual(true)
+        expect(event.properties.$cookieless_mode).toEqual(true)
 
         // an event after identifying
         posthog.capture(eventName, eventProperties)
@@ -67,7 +67,7 @@ describe('cookieless', () => {
         expect(event.properties.$device_id).toBe(null)
         expect(event.properties.$session_id).toBe(undefined)
         expect(event.properties.$window_id).toBe(undefined)
-        expect(event.properties.$cklsh_mode).toEqual(true)
+        expect(event.properties.$cookieless_mode).toEqual(true)
 
         // reset
         posthog.reset()
@@ -77,12 +77,12 @@ describe('cookieless', () => {
         posthog.capture(eventName, eventProperties)
         expect(beforeSendMock).toBeCalledTimes(5)
         event = beforeSendMock.mock.calls[4][0]
-        expect(event.properties.distinct_id).toBe('$posthog_cklsh')
+        expect(event.properties.distinct_id).toBe('$posthog_cookieless')
         expect(event.properties.$anon_distinct_id).toBe(undefined)
         expect(event.properties.$device_id).toBe(null)
         expect(event.properties.$session_id).toBe(undefined)
         expect(event.properties.$window_id).toBe(undefined)
-        expect(event.properties.$cklsh_mode).toEqual(true)
+        expect(event.properties.$cookieless_mode).toEqual(true)
         expect(document.cookie).toBe('')
     })
 })
diff --git a/src/constants.ts b/src/constants.ts
index 34b7a8bad..3f5d01bf3 100644
--- a/src/constants.ts
+++ b/src/constants.ts
@@ -53,8 +53,8 @@ export const TOOLBAR_CONTAINER_CLASS = 'toolbar-global-fade-container'
  * PREVIEW - MAY CHANGE WITHOUT WARNING - DO NOT USE IN PRODUCTION
  * Sentinel value for distinct id, device id, session id. Signals that the server should generate the value
  * */
-export const COOKIELESS_SENTINEL_VALUE = '$posthog_cklsh'
-export const COOKIELESS_MODE_FLAG_PROPERTY = '$cklsh_mode'
+export const COOKIELESS_SENTINEL_VALUE = '$posthog_cookieless'
+export const COOKIELESS_MODE_FLAG_PROPERTY = '$cookieless_mode'
 
 export const WEB_EXPERIMENTS = '$web_experiments'