Skip to content

Commit 863efa9

Browse files
committed
[sc-12339] fix importing cookie library, expose cookie related methods
1 parent 5ce2758 commit 863efa9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/cookie.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import cookie from 'cookie';
1+
import * as cookie from 'cookie';
22

33
const setCookie = (cookieName: string, cookieValue: string, expireDays: number): void => {
44
if (typeof document === 'undefined') {

src/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,14 @@ class AddSearchClient {
520520
}
521521
}
522522

523+
setCookie(cookieName: string, cookieValue: string, expireDays: number): void {
524+
cookie.setCookie(cookieName, cookieValue, expireDays);
525+
}
526+
527+
getCookie(cookieName: string): string | undefined {
528+
return cookie.getCookie(cookieName);
529+
}
530+
523531
searchResultClicked(documentId: string, position: number): void {
524532
this.sendStatsEvent('click', this.settings.getSettings().keyword || '', {
525533
documentId,

0 commit comments

Comments
 (0)