@surfside/ads-core-web 0.1.9 → 0.1.11

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.
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetSurfUserIdCookie = void 0;
4
+ const ads_core_client_1 = require("@surfside/ads-core-client");
5
+ const COOKIE_PREFIX = 'surfid.';
6
+ const SURFID_REGEX = /surfid.(?<site_hash>[a-z0-9]+)=(?<domain_userid>[^.]+).*/ig;
7
+ const GetSurfUserIdCookie = async (logger) => {
8
+ const log = (0, ads_core_client_1.Ctx)(logger)?.with('GetSurfUserIdCookie');
9
+ log?.info('Getting ID from Surfside Cookie');
10
+ const userId = document.cookie /* Cookie OR */
11
+ .split(';')
12
+ .map(c => c.trim())
13
+ .filter(c => c.startsWith(COOKIE_PREFIX))
14
+ .map(c => c.matchAll(SURFID_REGEX))
15
+ .map(m => [...m])?.[0]?.[0]?.groups?.domain_userid;
16
+ log?.debug('SurfsideUserIDService.getUserId userId', userId);
17
+ return userId;
18
+ };
19
+ exports.GetSurfUserIdCookie = GetSurfUserIdCookie;
20
+ //# sourceMappingURL=UserId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserId.js","sourceRoot":"src/","sources":["helpers/UserId.ts"],"names":[],"mappings":";;;AAAA,+DAA8D;AAE9D,MAAM,aAAa,GAAG,SAAS,CAAC;AAChC,MAAM,YAAY,GAAG,4DAA4D,CAAC;AAI3E,MAAM,mBAAmB,GAAG,KAAK,EAAE,MAAgB,EAAE,EAAE;IAC1D,MAAM,GAAG,GAAG,IAAA,qBAAG,EAAC,MAAM,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACrD,GAAG,EAAE,IAAI,CAAC,iCAAiC,CAAC,CAAC;IAC7C,MAAM,MAAM,GACR,QAAQ,CAAC,MAAM,CAAC,eAAe;SAC1B,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SAClB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;SACxC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;SAClC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAChB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC;IAE1C,GAAG,EAAE,KAAK,CAAC,wCAAwC,EAAE,MAAM,CAAC,CAAC;IAC7D,OAAO,MAAM,CAAC;AAElB,CAAC,CAAC;AAfW,QAAA,mBAAmB,uBAe9B"}
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Dom"), exports);
18
18
  __exportStar(require("./Trackers"), exports);
19
+ __exportStar(require("./UserId"), exports);
19
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"src/","sources":["helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,6CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"src/","sources":["helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,6CAA2B;AAC3B,2CAAyB"}
@@ -326,7 +326,7 @@ const style = `.surf-carousel {
326
326
 
327
327
  &:before {
328
328
  content: "";
329
- background: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" fill="none"><path stroke="%23fff" stroke-opacity=".9" stroke-width="2" d="M24 10 14 20l10 10"/></svg>')
329
+ background: url('//cdn.surfside.io/icons/left-arrow.svg')
330
330
  no-repeat center;
331
331
  width: 40px;
332
332
  height: 40px;
@@ -338,7 +338,7 @@ const style = `.surf-carousel {
338
338
 
339
339
  &:before {
340
340
  content: "";
341
- background: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" fill="none"><path stroke="%23fff" stroke-opacity=".9" stroke-width="2" d="M16 30l10-10L16 10"/></svg>')
341
+ background: url('//cdn.surfside.io/icons/right-arrow.svg')
342
342
  no-repeat center;
343
343
  width: 40px;
344
344
  height: 40px;
@@ -215,8 +215,8 @@ const style = `@keyframes grow-arc {
215
215
 
216
216
 
217
217
  .surfside-video {
218
- --icon-muted: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M9.586 3.586C10.846 2.326 13 3.218 13 5v14c0 1.782-2.154 2.674-3.414 1.414L5.172 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1.172l4.414-4.414ZM11 5 6.293 9.707a1 1 0 0 1-.707.293H4v4h1.586a1 1 0 0 1 .707.293L11 19V5Zm5.293 4.293a1 1 0 0 1 1.414 0L19 10.586l1.293-1.293a1 1 0 1 1 1.414 1.414L20.414 12l1.293 1.293a1 1 0 0 1-1.414 1.414L19 13.414l-1.293 1.293a1 1 0 0 1-1.414-1.414L17.586 12l-1.293-1.293a1 1 0 0 1 0-1.414Z' clip-rule='evenodd'/%3E%3C/svg%3E");
219
- --icon-unmuted: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M9.586 3.586C10.846 2.326 13 3.218 13 5v14c0 1.782-2.154 2.674-3.414 1.414L5.172 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1.172l4.414-4.414ZM11 5 6.293 9.707a1 1 0 0 1-.707.293H4v4h1.586a1 1 0 0 1 .707.293L11 19V5Zm6.657-.071a1 1 0 0 1 1.414 0c3.905 3.905 3.905 10.237 0 14.142a1 1 0 0 1-1.414-1.414 8 8 0 0 0 0-11.314 1 1 0 0 1 0-1.414Zm-2.829 2.828a1 1 0 0 1 1.415 0 6 6 0 0 1 0 8.486 1 1 0 1 1-1.415-1.415 4 4 0 0 0 0-5.656 1 1 0 0 1 0-1.415Z' clip-rule='evenodd'/%3E%3C/svg%3E");
218
+ --icon-muted: url('//cdn.surfside.io/icons/muted.svg');
219
+ --icon-unmuted: url('//cdn.surfside.io/icons/unmuted.svg');
220
220
 
221
221
  position: relative;
222
222
  overflow: hidden;
@@ -0,0 +1,16 @@
1
+ import { Ctx } from '@surfside/ads-core-client';
2
+ const COOKIE_PREFIX = 'surfid.';
3
+ const SURFID_REGEX = /surfid.(?<site_hash>[a-z0-9]+)=(?<domain_userid>[^.]+).*/ig;
4
+ export const GetSurfUserIdCookie = async (logger) => {
5
+ const log = Ctx(logger)?.with('GetSurfUserIdCookie');
6
+ log?.info('Getting ID from Surfside Cookie');
7
+ const userId = document.cookie /* Cookie OR */
8
+ .split(';')
9
+ .map(c => c.trim())
10
+ .filter(c => c.startsWith(COOKIE_PREFIX))
11
+ .map(c => c.matchAll(SURFID_REGEX))
12
+ .map(m => [...m])?.[0]?.[0]?.groups?.domain_userid;
13
+ log?.debug('SurfsideUserIDService.getUserId userId', userId);
14
+ return userId;
15
+ };
16
+ //# sourceMappingURL=UserId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserId.js","sourceRoot":"src/","sources":["helpers/UserId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAgB,MAAM,2BAA2B,CAAC;AAE9D,MAAM,aAAa,GAAG,SAAS,CAAC;AAChC,MAAM,YAAY,GAAG,4DAA4D,CAAC;AAIlF,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EAAE,MAAgB,EAAE,EAAE;IAC1D,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACrD,GAAG,EAAE,IAAI,CAAC,iCAAiC,CAAC,CAAC;IAC7C,MAAM,MAAM,GACR,QAAQ,CAAC,MAAM,CAAC,eAAe;SAC1B,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SAClB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;SACxC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;SAClC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAChB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC;IAE1C,GAAG,EAAE,KAAK,CAAC,wCAAwC,EAAE,MAAM,CAAC,CAAC;IAC7D,OAAO,MAAM,CAAC;AAElB,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from './Dom';
2
2
  export * from './Trackers';
3
+ export * from './UserId';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"src/","sources":["helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"src/","sources":["helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
@@ -320,7 +320,7 @@ const style = `.surf-carousel {
320
320
 
321
321
  &:before {
322
322
  content: "";
323
- background: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" fill="none"><path stroke="%23fff" stroke-opacity=".9" stroke-width="2" d="M24 10 14 20l10 10"/></svg>')
323
+ background: url('//cdn.surfside.io/icons/left-arrow.svg')
324
324
  no-repeat center;
325
325
  width: 40px;
326
326
  height: 40px;
@@ -332,7 +332,7 @@ const style = `.surf-carousel {
332
332
 
333
333
  &:before {
334
334
  content: "";
335
- background: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" fill="none"><path stroke="%23fff" stroke-opacity=".9" stroke-width="2" d="M16 30l10-10L16 10"/></svg>')
335
+ background: url('//cdn.surfside.io/icons/right-arrow.svg')
336
336
  no-repeat center;
337
337
  width: 40px;
338
338
  height: 40px;
@@ -211,8 +211,8 @@ const style = `@keyframes grow-arc {
211
211
 
212
212
 
213
213
  .surfside-video {
214
- --icon-muted: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M9.586 3.586C10.846 2.326 13 3.218 13 5v14c0 1.782-2.154 2.674-3.414 1.414L5.172 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1.172l4.414-4.414ZM11 5 6.293 9.707a1 1 0 0 1-.707.293H4v4h1.586a1 1 0 0 1 .707.293L11 19V5Zm5.293 4.293a1 1 0 0 1 1.414 0L19 10.586l1.293-1.293a1 1 0 1 1 1.414 1.414L20.414 12l1.293 1.293a1 1 0 0 1-1.414 1.414L19 13.414l-1.293 1.293a1 1 0 0 1-1.414-1.414L17.586 12l-1.293-1.293a1 1 0 0 1 0-1.414Z' clip-rule='evenodd'/%3E%3C/svg%3E");
215
- --icon-unmuted: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M9.586 3.586C10.846 2.326 13 3.218 13 5v14c0 1.782-2.154 2.674-3.414 1.414L5.172 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1.172l4.414-4.414ZM11 5 6.293 9.707a1 1 0 0 1-.707.293H4v4h1.586a1 1 0 0 1 .707.293L11 19V5Zm6.657-.071a1 1 0 0 1 1.414 0c3.905 3.905 3.905 10.237 0 14.142a1 1 0 0 1-1.414-1.414 8 8 0 0 0 0-11.314 1 1 0 0 1 0-1.414Zm-2.829 2.828a1 1 0 0 1 1.415 0 6 6 0 0 1 0 8.486 1 1 0 1 1-1.415-1.415 4 4 0 0 0 0-5.656 1 1 0 0 1 0-1.415Z' clip-rule='evenodd'/%3E%3C/svg%3E");
214
+ --icon-muted: url('//cdn.surfside.io/icons/muted.svg');
215
+ --icon-unmuted: url('//cdn.surfside.io/icons/unmuted.svg');
216
216
 
217
217
  position: relative;
218
218
  overflow: hidden;
@@ -0,0 +1,3 @@
1
+ import { type ILogger } from '@surfside/ads-core-client';
2
+ export type GetUserIdFn = () => Promise<string | undefined>;
3
+ export declare const GetSurfUserIdCookie: (logger?: ILogger) => Promise<string | undefined>;
@@ -1,2 +1,3 @@
1
1
  export * from './Dom';
2
2
  export * from './Trackers';
3
+ export * from './UserId';
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "types": "./lib/types/index.d.ts"
11
11
  }
12
12
  },
13
- "version": "0.1.9",
13
+ "version": "0.1.11",
14
14
  "license": "UNLICENSED",
15
15
  "files": [
16
16
  "lib/",
@@ -23,14 +23,14 @@
23
23
  "lint": "npx eslint"
24
24
  },
25
25
  "dependencies": {
26
- "@surfside/ads-core-client": "^0.1.9"
26
+ "@surfside/ads-core-client": "^0.1.11"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@eslint/js": "^9.25.1",
30
30
  "@types/bun": "latest",
31
31
  "eslint": "^9.25.1",
32
32
  "handlebars": "^4.7.8",
33
- "typescript-eslint": "^8.31.0",
33
+ "typescript-eslint": "^8.41.0",
34
34
  "@surfside/ads-core-mock": "^0.1.6",
35
35
  "typescript": "^5.8.3"
36
36
  }