@surfside/ads-core 1.0.6 → 2.0.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.
Files changed (293) hide show
  1. package/README.md +15 -64
  2. package/lib/cjs/Api.js +195 -0
  3. package/lib/cjs/Api.js.map +1 -0
  4. package/lib/cjs/helpers/Generator.js +50 -0
  5. package/lib/cjs/helpers/Generator.js.map +1 -0
  6. package/lib/cjs/helpers/Handlebars.js +270 -0
  7. package/lib/cjs/helpers/Handlebars.js.map +1 -0
  8. package/lib/cjs/helpers/NativeRequestBuilder.js +174 -0
  9. package/lib/cjs/helpers/NativeRequestBuilder.js.map +1 -0
  10. package/lib/cjs/helpers/RequestBuilder.js +160 -0
  11. package/lib/cjs/helpers/RequestBuilder.js.map +1 -0
  12. package/lib/cjs/helpers/TryGet.js +14 -0
  13. package/lib/cjs/helpers/TryGet.js.map +1 -0
  14. package/lib/cjs/helpers/Window.js +24 -0
  15. package/lib/cjs/helpers/Window.js.map +1 -0
  16. package/lib/cjs/helpers/index.js +24 -0
  17. package/lib/cjs/helpers/index.js.map +1 -0
  18. package/lib/cjs/helpers/response/Banner.js +4 -0
  19. package/lib/cjs/helpers/response/Banner.js.map +1 -0
  20. package/lib/cjs/helpers/response/BuiltResponse.js +27 -0
  21. package/lib/cjs/helpers/response/BuiltResponse.js.map +1 -0
  22. package/lib/cjs/helpers/response/Carousel.js +282 -0
  23. package/lib/cjs/helpers/response/Carousel.js.map +1 -0
  24. package/lib/cjs/helpers/response/Clickthrough.js +24 -0
  25. package/lib/cjs/helpers/response/Clickthrough.js.map +1 -0
  26. package/lib/cjs/helpers/response/ProductCard.js +198 -0
  27. package/lib/cjs/helpers/response/ProductCard.js.map +1 -0
  28. package/lib/cjs/helpers/response/Video.js +4 -0
  29. package/lib/cjs/helpers/response/Video.js.map +1 -0
  30. package/lib/cjs/helpers/response/index.js +23 -0
  31. package/lib/cjs/helpers/response/index.js.map +1 -0
  32. package/lib/cjs/index.js +21 -0
  33. package/lib/cjs/index.js.map +1 -0
  34. package/lib/cjs/models/dynamic/DynamicZone.js +12 -0
  35. package/lib/cjs/models/dynamic/DynamicZone.js.map +1 -0
  36. package/lib/cjs/models/dynamic/index.js +18 -0
  37. package/lib/cjs/models/dynamic/index.js.map +1 -0
  38. package/lib/cjs/models/index.js +22 -0
  39. package/lib/cjs/models/index.js.map +1 -0
  40. package/lib/cjs/models/retail/Configuration.js +10 -0
  41. package/lib/cjs/models/retail/Configuration.js.map +1 -0
  42. package/lib/cjs/models/retail/Product.js +4 -0
  43. package/lib/cjs/models/retail/Product.js.map +1 -0
  44. package/lib/cjs/models/retail/Recommended.js +3 -0
  45. package/lib/cjs/models/retail/Recommended.js.map +1 -0
  46. package/lib/cjs/models/retail/index.js +20 -0
  47. package/lib/cjs/models/retail/index.js.map +1 -0
  48. package/lib/cjs/models/rtb/BidRequest.js +20 -0
  49. package/lib/cjs/models/rtb/BidRequest.js.map +1 -0
  50. package/lib/cjs/models/rtb/BidResponse.js +3 -0
  51. package/lib/cjs/models/rtb/BidResponse.js.map +1 -0
  52. package/lib/cjs/models/rtb/NativeRequest.js +122 -0
  53. package/lib/cjs/models/rtb/NativeRequest.js.map +1 -0
  54. package/lib/cjs/models/rtb/NativeResponse.js +26 -0
  55. package/lib/cjs/models/rtb/NativeResponse.js.map +1 -0
  56. package/lib/cjs/models/rtb/index.js +21 -0
  57. package/lib/cjs/models/rtb/index.js.map +1 -0
  58. package/lib/cjs/models/tracking/Geo.js +3 -0
  59. package/lib/cjs/models/tracking/Geo.js.map +1 -0
  60. package/lib/cjs/models/tracking/index.js +18 -0
  61. package/lib/cjs/models/tracking/index.js.map +1 -0
  62. package/lib/cjs/models/vast/Vast.js +4 -0
  63. package/lib/cjs/models/vast/Vast.js.map +1 -0
  64. package/lib/cjs/models/vast/index.js +18 -0
  65. package/lib/cjs/models/vast/index.js.map +1 -0
  66. package/lib/cjs/services/Bidder.js +128 -0
  67. package/lib/cjs/services/Bidder.js.map +1 -0
  68. package/lib/cjs/services/Configuration.js +93 -0
  69. package/lib/cjs/services/Configuration.js.map +1 -0
  70. package/lib/cjs/services/Device.js +236 -0
  71. package/lib/cjs/services/Device.js.map +1 -0
  72. package/lib/cjs/services/Dynamic.js +129 -0
  73. package/lib/cjs/services/Dynamic.js.map +1 -0
  74. package/lib/cjs/services/Geo.js +35 -0
  75. package/lib/cjs/services/Geo.js.map +1 -0
  76. package/lib/cjs/services/Logger.js +57 -0
  77. package/lib/cjs/services/Logger.js.map +1 -0
  78. package/lib/cjs/services/Memoization.js +17 -0
  79. package/lib/cjs/services/Memoization.js.map +1 -0
  80. package/lib/cjs/services/Product.js +127 -0
  81. package/lib/cjs/services/Product.js.map +1 -0
  82. package/lib/cjs/services/Recommender.js +83 -0
  83. package/lib/cjs/services/Recommender.js.map +1 -0
  84. package/lib/cjs/services/Result.js +220 -0
  85. package/lib/cjs/services/Result.js.map +1 -0
  86. package/lib/cjs/services/Template.js +43 -0
  87. package/lib/cjs/services/Template.js.map +1 -0
  88. package/lib/cjs/services/index.js +28 -0
  89. package/lib/cjs/services/index.js.map +1 -0
  90. package/lib/cjs/services/mock/Bidder.js +3 -0
  91. package/lib/cjs/services/mock/Bidder.js.map +1 -0
  92. package/lib/cjs/services/mock/index.js +18 -0
  93. package/lib/cjs/services/mock/index.js.map +1 -0
  94. package/lib/esm/Api.js +183 -0
  95. package/lib/esm/Api.js.map +1 -0
  96. package/lib/esm/helpers/Generator.js +42 -0
  97. package/lib/esm/helpers/Generator.js.map +1 -0
  98. package/lib/esm/helpers/Handlebars.js +251 -0
  99. package/lib/esm/helpers/Handlebars.js.map +1 -0
  100. package/lib/esm/helpers/NativeRequestBuilder.js +169 -0
  101. package/lib/esm/helpers/NativeRequestBuilder.js.map +1 -0
  102. package/lib/esm/helpers/RequestBuilder.js +157 -0
  103. package/lib/esm/helpers/RequestBuilder.js.map +1 -0
  104. package/lib/esm/helpers/TryGet.js +10 -0
  105. package/lib/esm/helpers/TryGet.js.map +1 -0
  106. package/lib/esm/helpers/Window.js +20 -0
  107. package/lib/esm/helpers/Window.js.map +1 -0
  108. package/lib/esm/helpers/index.js +8 -0
  109. package/lib/esm/helpers/index.js.map +1 -0
  110. package/lib/esm/helpers/response/Banner.js +3 -0
  111. package/lib/esm/helpers/response/Banner.js.map +1 -0
  112. package/lib/esm/helpers/response/BuiltResponse.js +22 -0
  113. package/lib/esm/helpers/response/BuiltResponse.js.map +1 -0
  114. package/lib/esm/helpers/response/Carousel.js +273 -0
  115. package/lib/esm/helpers/response/Carousel.js.map +1 -0
  116. package/lib/esm/helpers/response/Clickthrough.js +20 -0
  117. package/lib/esm/helpers/response/Clickthrough.js.map +1 -0
  118. package/lib/esm/helpers/response/ProductCard.js +189 -0
  119. package/lib/esm/helpers/response/ProductCard.js.map +1 -0
  120. package/lib/esm/helpers/response/Video.js +3 -0
  121. package/lib/esm/helpers/response/Video.js.map +1 -0
  122. package/lib/esm/helpers/response/index.js +7 -0
  123. package/lib/esm/helpers/response/index.js.map +1 -0
  124. package/lib/esm/index.js +5 -0
  125. package/lib/esm/index.js.map +1 -0
  126. package/lib/esm/models/dynamic/DynamicZone.js +11 -0
  127. package/lib/esm/models/dynamic/DynamicZone.js.map +1 -0
  128. package/lib/esm/models/dynamic/index.js +2 -0
  129. package/lib/esm/models/dynamic/index.js.map +1 -0
  130. package/lib/esm/models/index.js +6 -0
  131. package/lib/esm/models/index.js.map +1 -0
  132. package/lib/esm/models/retail/Configuration.js +9 -0
  133. package/lib/esm/models/retail/Configuration.js.map +1 -0
  134. package/lib/esm/models/retail/Product.js +3 -0
  135. package/lib/esm/models/retail/Product.js.map +1 -0
  136. package/lib/esm/models/retail/Recommended.js +2 -0
  137. package/lib/esm/models/retail/Recommended.js.map +1 -0
  138. package/lib/esm/models/retail/index.js +4 -0
  139. package/lib/esm/models/retail/index.js.map +1 -0
  140. package/lib/esm/models/rtb/BidRequest.js +17 -0
  141. package/lib/esm/models/rtb/BidRequest.js.map +1 -0
  142. package/lib/esm/models/rtb/BidResponse.js +2 -0
  143. package/lib/esm/models/rtb/BidResponse.js.map +1 -0
  144. package/lib/esm/models/rtb/NativeRequest.js +119 -0
  145. package/lib/esm/models/rtb/NativeRequest.js.map +1 -0
  146. package/lib/esm/models/rtb/NativeResponse.js +23 -0
  147. package/lib/esm/models/rtb/NativeResponse.js.map +1 -0
  148. package/lib/esm/models/rtb/index.js +5 -0
  149. package/lib/esm/models/rtb/index.js.map +1 -0
  150. package/lib/esm/models/tracking/Geo.js +2 -0
  151. package/lib/esm/models/tracking/Geo.js.map +1 -0
  152. package/lib/esm/models/tracking/index.js +2 -0
  153. package/lib/esm/models/tracking/index.js.map +1 -0
  154. package/lib/esm/models/vast/Vast.js +3 -0
  155. package/lib/esm/models/vast/Vast.js.map +1 -0
  156. package/lib/esm/models/vast/index.js +2 -0
  157. package/lib/esm/models/vast/index.js.map +1 -0
  158. package/lib/esm/services/Bidder.js +119 -0
  159. package/lib/esm/services/Bidder.js.map +1 -0
  160. package/lib/esm/services/Configuration.js +56 -0
  161. package/lib/esm/services/Configuration.js.map +1 -0
  162. package/lib/esm/services/Device.js +232 -0
  163. package/lib/esm/services/Device.js.map +1 -0
  164. package/lib/esm/services/Dynamic.js +120 -0
  165. package/lib/esm/services/Dynamic.js.map +1 -0
  166. package/lib/esm/services/Geo.js +30 -0
  167. package/lib/esm/services/Geo.js.map +1 -0
  168. package/lib/esm/services/Logger.js +52 -0
  169. package/lib/esm/services/Logger.js.map +1 -0
  170. package/lib/esm/services/Memoization.js +13 -0
  171. package/lib/esm/services/Memoization.js.map +1 -0
  172. package/lib/esm/services/Product.js +120 -0
  173. package/lib/esm/services/Product.js.map +1 -0
  174. package/lib/esm/services/Recommender.js +78 -0
  175. package/lib/esm/services/Recommender.js.map +1 -0
  176. package/lib/esm/services/Result.js +199 -0
  177. package/lib/esm/services/Result.js.map +1 -0
  178. package/lib/esm/services/Template.js +38 -0
  179. package/lib/esm/services/Template.js.map +1 -0
  180. package/lib/esm/services/index.js +12 -0
  181. package/lib/esm/services/index.js.map +1 -0
  182. package/lib/esm/services/mock/Bidder.js +2 -0
  183. package/lib/esm/services/mock/Bidder.js.map +1 -0
  184. package/lib/esm/services/mock/index.js +2 -0
  185. package/lib/esm/services/mock/index.js.map +1 -0
  186. package/lib/types/Api.d.ts +169 -0
  187. package/lib/types/helpers/Generator.d.ts +5 -0
  188. package/lib/types/helpers/{handlebars/index.d.ts → Handlebars.d.ts} +10 -5
  189. package/lib/types/helpers/NativeRequestBuilder.d.ts +29 -0
  190. package/lib/types/helpers/RequestBuilder.d.ts +16 -0
  191. package/lib/types/helpers/TryGet.d.ts +2 -0
  192. package/lib/types/helpers/Window.d.ts +3 -0
  193. package/lib/types/helpers/index.d.ts +7 -4
  194. package/lib/types/helpers/response/Banner.d.ts +22 -0
  195. package/lib/types/helpers/response/BuiltResponse.d.ts +31 -0
  196. package/lib/types/helpers/response/Carousel.d.ts +51 -0
  197. package/lib/types/helpers/response/Clickthrough.d.ts +3 -0
  198. package/lib/types/helpers/response/ProductCard.d.ts +49 -0
  199. package/lib/types/helpers/response/Video.d.ts +17 -0
  200. package/lib/types/helpers/response/index.d.ts +6 -0
  201. package/lib/types/index.d.ts +2 -17
  202. package/lib/types/models/dynamic/DynamicZone.d.ts +37 -0
  203. package/lib/types/models/dynamic/index.d.ts +1 -0
  204. package/lib/types/models/index.d.ts +2 -1
  205. package/lib/types/models/retail/{IPublisherConfiguration.d.ts → Configuration.d.ts} +11 -9
  206. package/lib/types/models/retail/Product.d.ts +19 -0
  207. package/lib/types/models/retail/index.d.ts +3 -3
  208. package/lib/types/models/rtb/{IBidRequest.d.ts → BidRequest.d.ts} +28 -18
  209. package/lib/types/models/rtb/NativeRequest.d.ts +170 -0
  210. package/lib/types/models/rtb/{native/INativeResponse.d.ts → NativeResponse.d.ts} +5 -5
  211. package/lib/types/models/rtb/index.d.ts +4 -3
  212. package/lib/types/models/tracking/index.d.ts +1 -3
  213. package/lib/types/models/vast/Vast.d.ts +6 -9
  214. package/lib/types/services/Bidder.d.ts +31 -0
  215. package/lib/types/services/Configuration.d.ts +6 -0
  216. package/lib/types/services/Device.d.ts +12 -0
  217. package/lib/types/services/Dynamic.d.ts +26 -0
  218. package/lib/types/services/Geo.d.ts +6 -0
  219. package/lib/types/services/Logger.d.ts +14 -0
  220. package/lib/types/services/Memoization.d.ts +1 -0
  221. package/lib/types/services/Product.d.ts +13 -0
  222. package/lib/types/services/Recommender.d.ts +8 -0
  223. package/lib/types/services/Result.d.ts +57 -0
  224. package/lib/types/services/Template.d.ts +7 -0
  225. package/lib/types/services/index.d.ts +11 -5
  226. package/lib/types/services/mock/Bidder.d.ts +1 -0
  227. package/lib/types/services/mock/index.d.ts +1 -0
  228. package/package.json +42 -47
  229. package/lib/index.js +0 -1
  230. package/lib/types/constant-values/index.d.ts +0 -46
  231. package/lib/types/errors/index.d.ts +0 -3
  232. package/lib/types/helpers/generators/CollectN.d.ts +0 -2
  233. package/lib/types/helpers/generators/index.d.ts +0 -1
  234. package/lib/types/helpers/requests/RequestBuilder.d.ts +0 -124
  235. package/lib/types/helpers/requests/SimpleBannerRequest.d.ts +0 -26
  236. package/lib/types/helpers/requests/index.d.ts +0 -2
  237. package/lib/types/helpers/responses/BuildBannerResponse.d.ts +0 -10
  238. package/lib/types/helpers/responses/BuildNativeResponse.d.ts +0 -21
  239. package/lib/types/helpers/responses/BuildVideoResponse.d.ts +0 -0
  240. package/lib/types/helpers/responses/ClickthroughHelpers.d.ts +0 -2
  241. package/lib/types/helpers/responses/VastHelpers.d.ts +0 -4
  242. package/lib/types/helpers/responses/index.d.ts +0 -4
  243. package/lib/types/middleware/DeviceMiddleware.d.ts +0 -3
  244. package/lib/types/middleware/GeoMiddleware.d.ts +0 -3
  245. package/lib/types/middleware/IdentityMiddleware.d.ts +0 -4
  246. package/lib/types/middleware/index.d.ts +0 -3
  247. package/lib/types/models/retail/IProductInformation.d.ts +0 -37
  248. package/lib/types/models/rtb/native/Constants.d.ts +0 -60
  249. package/lib/types/models/rtb/native/INativeRequest.d.ts +0 -54
  250. package/lib/types/models/rtb/native/NativeConstants.d.ts +0 -120
  251. package/lib/types/models/rtb/native/NativeRequestBuilder.d.ts +0 -158
  252. package/lib/types/models/rtb/native/index.d.ts +0 -4
  253. package/lib/types/models/tracking/IEvents.d.ts +0 -82
  254. package/lib/types/models/tracking/IUserID.d.ts +0 -1
  255. package/lib/types/services/OverrideService.d.ts +0 -10
  256. package/lib/types/services/logger/ILoggerService.d.ts +0 -39
  257. package/lib/types/services/logger/LocalLoggerService.d.ts +0 -19
  258. package/lib/types/services/logger/index.d.ts +0 -2
  259. package/lib/types/services/product-feed/IProductFeedService.d.ts +0 -5
  260. package/lib/types/services/product-feed/SurfsideProductFeedService.d.ts +0 -11
  261. package/lib/types/services/product-feed/index.d.ts +0 -2
  262. package/lib/types/services/recommender/IRecommenderService.d.ts +0 -47
  263. package/lib/types/services/recommender/SurfsideRecommenderService.d.ts +0 -31
  264. package/lib/types/services/recommender/index.d.ts +0 -2
  265. package/lib/types/services/rtb/bidder/IBidderService.d.ts +0 -12
  266. package/lib/types/services/rtb/bidder/SurfsideBidderService.d.ts +0 -28
  267. package/lib/types/services/rtb/bidder/index.d.ts +0 -2
  268. package/lib/types/services/rtb/configuration/IConfigurationService.d.ts +0 -14
  269. package/lib/types/services/rtb/configuration/SurfsideConfigurationService.d.ts +0 -29
  270. package/lib/types/services/rtb/configuration/index.d.ts +0 -2
  271. package/lib/types/services/rtb/index.d.ts +0 -2
  272. package/lib/types/services/tracking/device/DeviceOverrideService.d.ts +0 -8
  273. package/lib/types/services/tracking/device/IDeviceService.d.ts +0 -4
  274. package/lib/types/services/tracking/device/SurfsideDeviceService.d.ts +0 -16
  275. package/lib/types/services/tracking/device/index.d.ts +0 -3
  276. package/lib/types/services/tracking/events/IEventService.d.ts +0 -5
  277. package/lib/types/services/tracking/events/SurfsideEventService.d.ts +0 -42
  278. package/lib/types/services/tracking/events/index.d.ts +0 -2
  279. package/lib/types/services/tracking/geo/GeoOverrideService.d.ts +0 -8
  280. package/lib/types/services/tracking/geo/IGeoService.d.ts +0 -12
  281. package/lib/types/services/tracking/geo/SurfsideGeoService.d.ts +0 -7
  282. package/lib/types/services/tracking/geo/index.d.ts +0 -3
  283. package/lib/types/services/tracking/index.d.ts +0 -4
  284. package/lib/types/services/tracking/user/IUserIDService.d.ts +0 -4
  285. package/lib/types/services/tracking/user/SurfsideUserIDService.d.ts +0 -7
  286. package/lib/types/services/tracking/user/UserOverrideService.d.ts +0 -8
  287. package/lib/types/services/tracking/user/index.d.ts +0 -3
  288. package/lib/types/utils/Protocol.d.ts +0 -1
  289. package/lib/types/utils/Rendering.d.ts +0 -44
  290. package/lib/types/utils/index.d.ts +0 -2
  291. /package/lib/types/models/retail/{IRecommenderResponse.d.ts → Recommended.d.ts} +0 -0
  292. /package/lib/types/models/rtb/{IBidResponse.d.ts → BidResponse.d.ts} +0 -0
  293. /package/lib/types/models/tracking/{IGeoContext.d.ts → Geo.d.ts} +0 -0
@@ -4,18 +4,15 @@ export interface IVast {
4
4
  ads: IAd[];
5
5
  }
6
6
  export interface IAd {
7
- id: string | null;
7
+ id?: string;
8
8
  inline: IInline;
9
9
  }
10
- export interface IVastProductData extends IProductInformation {
11
- productId?: string;
12
- }
13
10
  export interface IInline {
14
11
  impression: IImpression;
15
12
  adSystem: string;
16
13
  adTitle: string;
17
- creatives: ICreative[];
18
- product?: IVastProductData;
14
+ creatives: ILinear[];
15
+ product?: IProductInformation;
19
16
  }
20
17
  export interface IImpression {
21
18
  id: string;
@@ -36,15 +33,15 @@ export interface ITrackingEvent {
36
33
  url: string;
37
34
  }
38
35
  export interface IMediaFile {
39
- id: string | null;
36
+ id?: string;
40
37
  delivery: string;
41
38
  type: string;
42
39
  width: number;
43
40
  height: number;
44
- bitrate: string | null;
41
+ bitrate?: string;
45
42
  url: string;
46
43
  }
47
44
  export interface IVideoClick {
48
- id: string | null;
45
+ id?: string;
49
46
  url: string;
50
47
  }
@@ -0,0 +1,31 @@
1
+ import type { IBidRequest, IBidResponse } from '../models';
2
+ import { type ILogger } from './Logger';
3
+ import { type AsyncResult } from './Result';
4
+ export type RequestBidsFn = (request: IBidRequest) => AsyncResult<IBidResponse>;
5
+ export declare const RequestBids: (logger: ILogger | undefined, url: string, accountId: string, siteId: string, locationId: string, channelId: string, bidRequest: IBidRequest) => AsyncResult<IBidResponse>;
6
+ export declare class NoBidsError extends Error {
7
+ readonly request: IBidRequest;
8
+ readonly response?: Response | undefined;
9
+ constructor(request: IBidRequest, response?: Response | undefined);
10
+ }
11
+ export declare class InternalServerError extends Error {
12
+ readonly request: IBidRequest;
13
+ readonly response: Response;
14
+ constructor(request: IBidRequest, response: Response);
15
+ }
16
+ export declare class BidderStartingUpError extends Error {
17
+ readonly request: IBidRequest;
18
+ readonly response: Response;
19
+ constructor(request: IBidRequest, response: Response);
20
+ }
21
+ export declare class UnknownBidderError extends Error {
22
+ readonly request: IBidRequest;
23
+ readonly response: Response;
24
+ constructor(request: IBidRequest, response: Response);
25
+ }
26
+ export declare class MalformedBidResponseError extends Error {
27
+ readonly request: IBidRequest;
28
+ readonly response: Response;
29
+ readonly bidResponse: unknown;
30
+ constructor(request: IBidRequest, response: Response, bidResponse: unknown);
31
+ }
@@ -0,0 +1,6 @@
1
+ import type Handlebars from 'handlebars/runtime';
2
+ import type { ICompiledPublisherConfiguration } from '../models';
3
+ import { type AsyncResult, type ILogger } from '.';
4
+ import { type HandlebarsHelpers } from '../helpers';
5
+ export type GetConfigurationFn = () => AsyncResult<ICompiledPublisherConfiguration>;
6
+ export declare const GetConfiguration: (logger: ILogger | undefined, url: string, handlebars: typeof Handlebars, helpers: HandlebarsHelpers, accountId: string, siteId: string) => AsyncResult<ICompiledPublisherConfiguration>;
@@ -0,0 +1,12 @@
1
+ import { type IDevice } from '../models';
2
+ import { type ILogger, type Result } from '.';
3
+ export type GetDeviceFn = (screen: IScreen, navigator: INavigator, mobile: boolean) => Result<IDevice>;
4
+ export interface IScreen {
5
+ width: number;
6
+ height: number;
7
+ }
8
+ export interface INavigator {
9
+ userAgent: string;
10
+ language: string;
11
+ }
12
+ export declare const GetDevice: (logger: ILogger | undefined, screen: IScreen, navigator: INavigator, mobile: boolean) => Result<IDevice>;
@@ -0,0 +1,26 @@
1
+ import type { NativeRequestBuilderFn, RequestBuilder, RequestBuilderFn } from '../helpers';
2
+ import type { IBidRequest, ICompiledPublisherConfiguration } from '../models';
3
+ import { type DynamicCreative, type IDynamicZone, type IScreenSize } from '../models/dynamic/DynamicZone';
4
+ import type { IScreen } from './Device';
5
+ import { type ILogger } from './Logger';
6
+ import { type AsyncResult, type Result } from './Result';
7
+ export interface IDynamicZoneRequest {
8
+ request: IBidRequest;
9
+ requestIds: Record<string, DynamicCreative>;
10
+ }
11
+ export type BuildDynamicZoneRequestFn = (zoneId: string, dynamicZone: IDynamicZone) => Result<IDynamicZoneRequest>;
12
+ export type GetDynamicZoneFn = (zoneId: string) => AsyncResult<IDynamicZone>;
13
+ export declare const GetDynamicZone: (logger: ILogger | undefined, config: ICompiledPublisherConfiguration, zoneId: string) => Promise<import("./Result").ErrResult<MissingDynamicZoneError> | import("./Result").OkResult<IDynamicZone>>;
14
+ export declare const BuildDynamicZoneRequest: (logger: ILogger | undefined, startRequest: RequestBuilderFn, nativeRequest: NativeRequestBuilderFn, screenInfo: IScreen, zoneId: string, dynamicZone: IDynamicZone) => Result<IDynamicZoneRequest>;
15
+ export declare class NoDynamicScreenSizeMatchError extends Error {
16
+ readonly dynamicZone: IDynamicZone;
17
+ readonly screenInfo: IScreen;
18
+ readonly selectedStringSize: string;
19
+ constructor(dynamicZone: IDynamicZone, screenInfo: IScreen, selectedStringSize: string);
20
+ }
21
+ export declare const buildDynamicBidRequestFromSelectedScreenSize: (logger: ILogger | undefined, startRequest: RequestBuilderFn, nativeRequest: NativeRequestBuilderFn, zoneId: string, screenSize: IScreenSize) => Result<IDynamicZoneRequest>;
22
+ export declare const buildDynamicBidRequestRecursive: (logger: ILogger | undefined, nativeRequest: NativeRequestBuilderFn, builder: RequestBuilder, requestIds: Record<string, DynamicCreative>, [head, ...tail]: DynamicCreative[]) => Result<[builder: RequestBuilder, requestIds: Record<string, DynamicCreative>]>;
23
+ export declare class MissingDynamicZoneError extends Error {
24
+ readonly zoneId: string;
25
+ constructor(zoneId: string);
26
+ }
@@ -0,0 +1,6 @@
1
+ import type { IGeo, IGeoContext } from '../models';
2
+ import { type ILogger } from './Logger';
3
+ import { type AsyncResult } from './Result';
4
+ export type GetGeoFn = (ip?: string, geoProviderToken?: string) => AsyncResult<IGeoContext>;
5
+ export declare const GetGeo: (logger?: ILogger) => AsyncResult<IGeoContext>;
6
+ export declare const GeoContextToORTB: (logger: ILogger | undefined, geoContext: IGeoContext) => IGeo;
@@ -0,0 +1,14 @@
1
+ export type LoggerFn = (...args: any[]) => void;
2
+ export type ContextFn = (...prefix: (string | undefined)[]) => IContextLogger;
3
+ export interface ILogger {
4
+ info: LoggerFn;
5
+ debug: LoggerFn;
6
+ warn: LoggerFn;
7
+ error: LoggerFn;
8
+ table: (data: any, properties?: string[]) => void;
9
+ }
10
+ export interface IContextLogger extends ILogger {
11
+ with: ContextFn;
12
+ }
13
+ export declare const InitLogger: () => IContextLogger;
14
+ export declare const Ctx: (logger: ILogger | undefined) => IContextLogger | undefined;
@@ -0,0 +1 @@
1
+ export declare const Memo: <T extends any[], R>(fn: (...args: T) => R) => (...args: T) => R;
@@ -0,0 +1,13 @@
1
+ import type { IProductInformation } from '../models';
2
+ import { type ILogger } from './Logger';
3
+ import { type Result, type AsyncResult } from './Result';
4
+ export type GetSponsoredProductFromNativeIdFn = (nativeId: string) => AsyncGenerator<IProductInformation>;
5
+ export type GetAllSponsoredProductFromNativeIdFn = (nativeId: string) => Promise<Result<IProductInformation[]>>;
6
+ export type GetRecommendedProductFromProductIdFn = (productId: string) => AsyncResult<IProductInformation>;
7
+ export declare function GetSponsoredProduct(logger: ILogger | undefined, url: string, accountId: string, locationId: string, nativeId: string): AsyncGenerator<IProductInformation>;
8
+ export declare const GetAllSponsoredProducts: (logger: ILogger | undefined, url: string, accountId: string, locationId: string, nativeId: string) => Promise<Result<IProductInformation[]>>;
9
+ export declare const GetRecommendedProduct: (logger: ILogger | undefined, url: string, accountId: string, locationId: string, productId: string) => AsyncResult<IProductInformation>;
10
+ export declare class NoNativeError extends Error {
11
+ nativeId: string;
12
+ constructor(nativeId: string);
13
+ }
@@ -0,0 +1,8 @@
1
+ import type { IProductInformation } from '../models';
2
+ import { type ILogger } from './Logger';
3
+ import type { GetRecommendedProductFromProductIdFn } from './Product';
4
+ export type NonPersonalRecommenderFn = () => AsyncGenerator<IProductInformation>;
5
+ export type PersonalRecommenderFn = (userId: string) => AsyncGenerator<IProductInformation>;
6
+ export declare function GenerateTopProducts(logger: ILogger | undefined, productFeed: GetRecommendedProductFromProductIdFn, url: string, accountId: string, siteId: string, locationId: string): AsyncGenerator<IProductInformation>;
7
+ export declare function GenerateForYou(logger: ILogger | undefined, productFeed: GetRecommendedProductFromProductIdFn, url: string, accountId: string, siteId: string, locationId: string, userId: string): AsyncGenerator<IProductInformation>;
8
+ export declare function GeneratePreviousPurchases(logger: ILogger | undefined, productFeed: GetRecommendedProductFromProductIdFn, url: string, accountId: string, siteId: string, locationId: string, userId: string): AsyncGenerator<IProductInformation>;
@@ -0,0 +1,57 @@
1
+ export type OkResult<T> = {
2
+ ok: true;
3
+ value: T;
4
+ };
5
+ export type ErrResult<E = Error> = {
6
+ ok: false;
7
+ error: E;
8
+ };
9
+ export type Result<T, E = Error> = OkResult<T> | ErrResult<E>;
10
+ export type AsyncResult<T, E = Error> = Promise<Result<T, E>>;
11
+ export declare const Ok: <T>(t: T) => OkResult<T>;
12
+ export declare const Err: <E = Error>(e: E) => ErrResult<E>;
13
+ export declare const TryDo: <T, E = Error>(fn: () => T) => Result<T, E>;
14
+ export declare const TryDoFlat: <T, E = Error>(fn: () => Result<T, E>) => Result<T, E>;
15
+ export declare const TryDoAsync: <T, E = Error>(fn: () => Promise<T>) => AsyncResult<T, E>;
16
+ export declare const GetValue: <T, E = Error>(result: Result<T, E> | undefined) => T | undefined;
17
+ export declare const ValueOr: <T, E = Error, U = T>(result: Result<T, E> | undefined, or: U) => T | U;
18
+ export declare const GetValueOrThrow: <T>(result: Result<T, Error>) => T;
19
+ export declare const WrapValue: <T>(value: T | undefined | null) => Result<T>;
20
+ export declare const AssertValue: <T>(result: Result<T, Error>) => T;
21
+ export declare const AllOrNone: <T>(results: Result<T, Error>[]) => Result<T[]>;
22
+ export declare const Some: <T>(results: Result<T, Error>[]) => OkResult<T[]>;
23
+ export declare const Filter: <T>(...results: Result<T, Error>[]) => [OkResult<T>[], ErrResult[]];
24
+ export declare const AnyFailed: (...results: Result<any, Error>[]) => [true, Error[]] | [false];
25
+ export declare class MultipleErrorsError extends Error {
26
+ readonly errors: Error[];
27
+ constructor(errors: Error[]);
28
+ }
29
+ export interface IResultPipe<T, E = Error> {
30
+ then: <U>(fn: (t: T) => U) => IResultPipe<U, E>;
31
+ result: () => Result<T, E>;
32
+ value: () => T | undefined;
33
+ valueOr: <U>(or: U) => T | U;
34
+ valueOrThrow: () => T;
35
+ }
36
+ export declare const Pipe: <T, E = Error>(result: Result<T, E>) => IResultPipe<T, E>;
37
+ export interface IAsyncResultPipe<T, E = Error> {
38
+ then: <U>(fn: (t: T) => AsyncResult<U> | Result<U>) => IAsyncResultPipe<U, E>;
39
+ result: () => AsyncResult<T, E>;
40
+ value: () => Promise<T | undefined>;
41
+ valueOr: <U>(or: U) => Promise<T | U>;
42
+ valueOrThrow: () => Promise<T>;
43
+ }
44
+ export declare const AsyncPipe: <T, E>(result: AsyncResult<T, E>) => IAsyncResultPipe<T, E>;
45
+ export type IResultStream<T, E = Error> = {
46
+ map: <U>(fn: (t: T) => U) => IResultStream<U, E>;
47
+ filter: (fn: (t: T) => boolean) => IResultStream<T, E>;
48
+ results: () => Result<T[], E>;
49
+ value: () => T[] | undefined;
50
+ valueOr: <U>(u: U) => T[] | U;
51
+ valueOrThrow: () => T[];
52
+ };
53
+ export declare const ResultStream: <T, E = Error>(results: Result<T[], E>) => IResultStream<T, E>;
54
+ export declare class NoValueError extends Error {
55
+ readonly value: undefined | null;
56
+ constructor(value: undefined | null);
57
+ }
@@ -0,0 +1,7 @@
1
+ import type { ICompiledPublisherConfiguration, INativeTemplateDelegateWindow, IProductInformation } from '../models';
2
+ import { type ILogger } from './Logger';
3
+ import { type Result } from './Result';
4
+ export type EvaluateProductCardTemplateFn = (product: IProductInformation, clickthrough?: string) => Result<string>;
5
+ export type EvaluateClickthroughTemplateFn = (product: IProductInformation) => Result<string>;
6
+ export declare const EvaluateHandlebarsProductCardTemplate: (logger: ILogger | undefined, windowInfo: INativeTemplateDelegateWindow, publisher: ICompiledPublisherConfiguration, product: IProductInformation, clickthrough?: string) => Result<string>;
7
+ export declare const EvaluateHandlebarsClickthroughTemplate: (logger: ILogger | undefined, windowInfo: INativeTemplateDelegateWindow, publisher: ICompiledPublisherConfiguration, product: IProductInformation) => Result<string>;
@@ -1,5 +1,11 @@
1
- export * from './logger';
2
- export * from './rtb';
3
- export * from './recommender';
4
- export * from './product-feed';
5
- export * from './tracking';
1
+ export * from './Geo';
2
+ export * from './Logger';
3
+ export * from './Result';
4
+ export * from './Device';
5
+ export * from './Configuration';
6
+ export * from './Bidder';
7
+ export * from './Product';
8
+ export * from './Recommender';
9
+ export * from './mock';
10
+ export * from './Template';
11
+ export * from './Dynamic';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './Bidder';
package/package.json CHANGED
@@ -1,47 +1,42 @@
1
- {
2
- "name": "@surfside/ads-core",
3
- "version": "1.0.6",
4
- "description": "My webpack project",
5
- "main": "lib/index.js",
6
- "types": "lib/types/index.d.ts",
7
- "author": "Collin Oswalt, Ranveer Dhaliwal",
8
- "license": "UNLICENSED",
9
- "files": [
10
- "lib",
11
- "README.md"
12
- ],
13
- "peerdependencies": {
14
- "handlebars": "^4.7.8"
15
- },
16
- "devDependencies": {
17
- "@stylistic/eslint-plugin-ts": "^1.5.4",
18
- "@types/handlebars": "^4.1.0",
19
- "@typescript-eslint/eslint-plugin": "^6.20.0",
20
- "@webpack-cli/generators": "^3.0.7",
21
- "eslint": "^8.56.0",
22
- "eslint-config-standard-with-typescript": "^43.0.1",
23
- "eslint-plugin-import": "^2.29.1",
24
- "eslint-plugin-n": "^16.6.2",
25
- "eslint-plugin-promise": "^6.1.1",
26
- "prettier": "^3.3.3",
27
- "ts-loader": "^9.5.1",
28
- "typescript": "^5.6.2",
29
- "webpack": "^5.95.0",
30
- "webpack-bundle-analyzer": "^4.10.2",
31
- "webpack-cli": "^6.0.1"
32
- },
33
- "scripts": {
34
- "lint": "npx eslint -c ./.eslintrc.json src/**/*.ts",
35
- "build:mock": "npx webpack --mode=development --node-env=development",
36
- "build:local": "npx webpack --mode=development --node-env=development",
37
- "build:staging": "npx webpack --mode=production --node-env=development",
38
- "build:prod": "npx webpack --mode=production --node-env=production",
39
- "watch": "npx webpack --watch",
40
- "serve": ";",
41
- "serve:mock": ";",
42
- "serve:local": ";",
43
- "serve:staging": ";",
44
- "serve:prod": ";",
45
- "test": "echo test"
46
- }
47
- }
1
+ {
2
+ "name": "@surfside/ads-core",
3
+ "version": "2.0.2",
4
+ "module": "./lib/esm/index.js",
5
+ "main": "./lib/cjs/index.js",
6
+ "types": "./lib/types/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./lib/esm/index.js",
10
+ "require": "./lib/cjs/index.js",
11
+ "types": "./lib/types/index.d.ts"
12
+ }
13
+ },
14
+ "license": "UNLICENSED",
15
+ "type": "module",
16
+ "files": [
17
+ "lib/",
18
+ "README.md"
19
+ ],
20
+ "devDependencies": {
21
+ "@eslint/js": "^9.25.1",
22
+ "@types/bun": "latest",
23
+ "@types/handlebars": "^4.1.0",
24
+ "@types/jest": "^29.5.14",
25
+ "eslint": "^9.25.1",
26
+ "jest": "^29.7.0",
27
+ "ts-jest": "^29.3.2",
28
+ "typedoc": "^0.28.5",
29
+ "typescript-eslint": "^8.31.0"
30
+ },
31
+ "peerDependencies": {
32
+ "typescript": "^5.8.3"
33
+ },
34
+ "dependencies": {
35
+ "handlebars": "^4.7.8"
36
+ },
37
+ "scripts": {
38
+ "clean": "rm -rf ./lib",
39
+ "build": "tsc -p ./tsconfig.types.json && tsc -p ./tsconfig.esm.json && tsc -p tsconfig.cjs.json",
40
+ "lint": "npx eslint"
41
+ }
42
+ }
package/lib/index.js DELETED
@@ -1 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SurfAdsCore=t():e.SurfAdsCore=t()}(self,(()=>(()=>{var e={261:(e,t,i)=>{"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}t.__esModule=!0;var n=o(i(2871)),l=r(i(9613)),s=r(i(3769)),u=o(i(2849)),a=o(i(7624)),d=r(i(1148));function c(){var e=new n.HandlebarsEnvironment;return u.extend(e,n),e.SafeString=l.default,e.Exception=s.default,e.Utils=u,e.escapeExpression=u.escapeExpression,e.VM=a,e.template=function(t){return a.template(t,e)},e}var v=c();v.create=c,d.default(v),v.default=v,t.default=v,e.exports=t.default},2871:(e,t,i)=>{"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.HandlebarsEnvironment=c;var o=i(2849),n=r(i(3769)),l=i(2277),s=i(5940),u=r(i(566)),a=i(3865);t.VERSION="4.7.8";t.COMPILER_REVISION=8;t.LAST_COMPATIBLE_COMPILER_REVISION=7;t.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};var d="[object Object]";function c(e,t,i){this.helpers=e||{},this.partials=t||{},this.decorators=i||{},l.registerDefaultHelpers(this),s.registerDefaultDecorators(this)}c.prototype={constructor:c,logger:u.default,log:u.default.log,registerHelper:function(e,t){if(o.toString.call(e)===d){if(t)throw new n.default("Arg not supported with multiple helpers");o.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if(o.toString.call(e)===d)o.extend(this.partials,e);else{if(void 0===t)throw new n.default('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,t){if(o.toString.call(e)===d){if(t)throw new n.default("Arg not supported with multiple decorators");o.extend(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]},resetLoggedPropertyAccesses:function(){a.resetLoggedProperties()}};var v=u.default.log;t.log=v,t.createFrame=o.createFrame,t.logger=u.default},5940:(e,t,i)=>{"use strict";t.__esModule=!0,t.registerDefaultDecorators=function(e){n.default(e)};var r,o=i(7430),n=(r=o)&&r.__esModule?r:{default:r}},7430:(e,t,i)=>{"use strict";t.__esModule=!0;var r=i(2849);t.default=function(e){e.registerDecorator("inline",(function(e,t,i,o){var n=e;return t.partials||(t.partials={},n=function(o,n){var l=i.partials;i.partials=r.extend({},l,t.partials);var s=e(o,n);return i.partials=l,s}),t.partials[o.args[0]]=o.fn,n}))},e.exports=t.default},3769:(e,t)=>{"use strict";t.__esModule=!0;var i=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function r(e,t){var o=t&&t.loc,n=void 0,l=void 0,s=void 0,u=void 0;o&&(n=o.start.line,l=o.end.line,s=o.start.column,u=o.end.column,e+=" - "+n+":"+s);for(var a=Error.prototype.constructor.call(this,e),d=0;d<i.length;d++)this[i[d]]=a[i[d]];Error.captureStackTrace&&Error.captureStackTrace(this,r);try{o&&(this.lineNumber=n,this.endLineNumber=l,Object.defineProperty?(Object.defineProperty(this,"column",{value:s,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:u,enumerable:!0})):(this.column=s,this.endColumn=u))}catch(e){}}r.prototype=new Error,t.default=r,e.exports=t.default},2277:(e,t,i)=>{"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.registerDefaultHelpers=function(e){o.default(e),n.default(e),l.default(e),s.default(e),u.default(e),a.default(e),d.default(e)},t.moveHelperToHooks=function(e,t,i){e.helpers[t]&&(e.hooks[t]=e.helpers[t],i||delete e.helpers[t])};var o=r(i(6097)),n=r(i(6785)),l=r(i(4353)),s=r(i(2355)),u=r(i(5300)),a=r(i(7466)),d=r(i(908))},6097:(e,t,i)=>{"use strict";t.__esModule=!0;var r=i(2849);t.default=function(e){e.registerHelper("blockHelperMissing",(function(t,i){var o=i.inverse,n=i.fn;if(!0===t)return n(this);if(!1===t||null==t)return o(this);if(r.isArray(t))return t.length>0?(i.ids&&(i.ids=[i.name]),e.helpers.each(t,i)):o(this);if(i.data&&i.ids){var l=r.createFrame(i.data);l.contextPath=r.appendContextPath(i.data.contextPath,i.name),i={data:l}}return n(t,i)}))},e.exports=t.default},6785:(e,t,i)=>{"use strict";t.__esModule=!0;var r,o=i(2849),n=i(3769),l=(r=n)&&r.__esModule?r:{default:r};t.default=function(e){e.registerHelper("each",(function(e,t){if(!t)throw new l.default("Must pass iterator to #each");var i,r=t.fn,n=t.inverse,s=0,u="",a=void 0,d=void 0;function c(t,i,n){a&&(a.key=t,a.index=i,a.first=0===i,a.last=!!n,d&&(a.contextPath=d+t)),u+=r(e[t],{data:a,blockParams:o.blockParams([e[t],t],[d+t,null])})}if(t.data&&t.ids&&(d=o.appendContextPath(t.data.contextPath,t.ids[0])+"."),o.isFunction(e)&&(e=e.call(this)),t.data&&(a=o.createFrame(t.data)),e&&"object"==typeof e)if(o.isArray(e))for(var v=e.length;s<v;s++)s in e&&c(s,s,s===e.length-1);else if("function"==typeof Symbol&&e[Symbol.iterator]){for(var h=[],f=e[Symbol.iterator](),p=f.next();!p.done;p=f.next())h.push(p.value);for(v=(e=h).length;s<v;s++)c(s,s,s===e.length-1)}else i=void 0,Object.keys(e).forEach((function(e){void 0!==i&&c(i,s-1),i=e,s++})),void 0!==i&&c(i,s-1,!0);return 0===s&&(u=n(this)),u}))},e.exports=t.default},4353:(e,t,i)=>{"use strict";t.__esModule=!0;var r,o=i(3769),n=(r=o)&&r.__esModule?r:{default:r};t.default=function(e){e.registerHelper("helperMissing",(function(){if(1!==arguments.length)throw new n.default('Missing helper: "'+arguments[arguments.length-1].name+'"')}))},e.exports=t.default},2355:(e,t,i)=>{"use strict";t.__esModule=!0;var r,o=i(2849),n=i(3769),l=(r=n)&&r.__esModule?r:{default:r};t.default=function(e){e.registerHelper("if",(function(e,t){if(2!=arguments.length)throw new l.default("#if requires exactly one argument");return o.isFunction(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||o.isEmpty(e)?t.inverse(this):t.fn(this)})),e.registerHelper("unless",(function(t,i){if(2!=arguments.length)throw new l.default("#unless requires exactly one argument");return e.helpers.if.call(this,t,{fn:i.inverse,inverse:i.fn,hash:i.hash})}))},e.exports=t.default},5300:(e,t)=>{"use strict";t.__esModule=!0,t.default=function(e){e.registerHelper("log",(function(){for(var t=[void 0],i=arguments[arguments.length-1],r=0;r<arguments.length-1;r++)t.push(arguments[r]);var o=1;null!=i.hash.level?o=i.hash.level:i.data&&null!=i.data.level&&(o=i.data.level),t[0]=o,e.log.apply(e,t)}))},e.exports=t.default},7466:(e,t)=>{"use strict";t.__esModule=!0,t.default=function(e){e.registerHelper("lookup",(function(e,t,i){return e?i.lookupProperty(e,t):e}))},e.exports=t.default},908:(e,t,i)=>{"use strict";t.__esModule=!0;var r,o=i(2849),n=i(3769),l=(r=n)&&r.__esModule?r:{default:r};t.default=function(e){e.registerHelper("with",(function(e,t){if(2!=arguments.length)throw new l.default("#with requires exactly one argument");o.isFunction(e)&&(e=e.call(this));var i=t.fn;if(o.isEmpty(e))return t.inverse(this);var r=t.data;return t.data&&t.ids&&((r=o.createFrame(t.data)).contextPath=o.appendContextPath(t.data.contextPath,t.ids[0])),i(e,{data:r,blockParams:o.blockParams([e],[r&&r.contextPath])})}))},e.exports=t.default},9726:(e,t,i)=>{"use strict";t.__esModule=!0,t.createNewLookupObject=function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return r.extend.apply(void 0,[Object.create(null)].concat(t))};var r=i(2849)},3865:(e,t,i)=>{"use strict";t.__esModule=!0,t.createProtoAccessControl=function(e){var t=Object.create(null);t.constructor=!1,t.__defineGetter__=!1,t.__defineSetter__=!1,t.__lookupGetter__=!1;var i=Object.create(null);return i.__proto__=!1,{properties:{whitelist:o.createNewLookupObject(i,e.allowedProtoProperties),defaultValue:e.allowProtoPropertiesByDefault},methods:{whitelist:o.createNewLookupObject(t,e.allowedProtoMethods),defaultValue:e.allowProtoMethodsByDefault}}},t.resultIsAllowed=function(e,t,i){return u("function"==typeof e?t.methods:t.properties,i)},t.resetLoggedProperties=function(){Object.keys(s).forEach((function(e){delete s[e]}))};var r,o=i(9726),n=i(566),l=(r=n)&&r.__esModule?r:{default:r},s=Object.create(null);function u(e,t){return void 0!==e.whitelist[t]?!0===e.whitelist[t]:void 0!==e.defaultValue?e.defaultValue:(function(e){!0!==s[e]&&(s[e]=!0,l.default.log("error",'Handlebars: Access has been denied to resolve the property "'+e+'" because it is not an "own property" of its parent.\nYou can add a runtime option to disable the check or this warning:\nSee https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details'))}(t),!1)}},2614:(e,t)=>{"use strict";t.__esModule=!0,t.wrapHelper=function(e,t){if("function"!=typeof e)return e;return function(){return arguments[arguments.length-1]=t(arguments[arguments.length-1]),e.apply(this,arguments)}}},566:(e,t,i)=>{"use strict";t.__esModule=!0;var r=i(2849),o={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(e){if("string"==typeof e){var t=r.indexOf(o.methodMap,e.toLowerCase());e=t>=0?t:parseInt(e,10)}return e},log:function(e){if(e=o.lookupLevel(e),"undefined"!=typeof console&&o.lookupLevel(o.level)<=e){var t=o.methodMap[e];console[t]||(t="log");for(var i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];console[t].apply(console,r)}}};t.default=o,e.exports=t.default},1148:(e,t)=>{"use strict";t.__esModule=!0,t.default=function(e){"object"!=typeof globalThis&&(Object.prototype.__defineGetter__("__magic__",(function(){return this})),__magic__.globalThis=__magic__,delete Object.prototype.__magic__);var t=globalThis.Handlebars;e.noConflict=function(){return globalThis.Handlebars===e&&(globalThis.Handlebars=t),e}},e.exports=t.default},7624:(e,t,i)=>{"use strict";t.__esModule=!0,t.checkRevision=function(e){var t=e&&e[0]||1,i=s.COMPILER_REVISION;if(t>=s.LAST_COMPATIBLE_COMPILER_REVISION&&t<=s.COMPILER_REVISION)return;if(t<s.LAST_COMPATIBLE_COMPILER_REVISION){var r=s.REVISION_CHANGES[i],o=s.REVISION_CHANGES[t];throw new l.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+r+") or downgrade your runtime to an older version ("+o+").")}throw new l.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+e[1]+").")},t.template=function(e,t){if(!t)throw new l.default("No environment passed to template");if(!e||!e.main)throw new l.default("Unknown template object: "+typeof e);e.main.decorator=e.main_d,t.VM.checkRevision(e.compiler);var i=e.compiler&&7===e.compiler[0];var r={strict:function(e,t,i){if(!e||!(t in e))throw new l.default('"'+t+'" not defined in '+e,{loc:i});return r.lookupProperty(e,t)},lookupProperty:function(e,t){var i=e[t];return null==i||Object.prototype.hasOwnProperty.call(e,t)||d.resultIsAllowed(i,r.protoAccessControl,t)?i:void 0},lookup:function(e,t){for(var i=e.length,o=0;o<i;o++){if(null!=(e[o]&&r.lookupProperty(e[o],t)))return e[o][t]}},lambda:function(e,t){return"function"==typeof e?e.call(t):e},escapeExpression:o.escapeExpression,invokePartial:function(i,r,n){n.hash&&(r=o.extend({},r,n.hash),n.ids&&(n.ids[0]=!0)),i=t.VM.resolvePartial.call(this,i,r,n);var s=o.extend({},n,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),u=t.VM.invokePartial.call(this,i,r,s);if(null==u&&t.compile&&(n.partials[n.name]=t.compile(i,e.compilerOptions,t),u=n.partials[n.name](r,s)),null!=u){if(n.indent){for(var a=u.split("\n"),d=0,c=a.length;d<c&&(a[d]||d+1!==c);d++)a[d]=n.indent+a[d];u=a.join("\n")}return u}throw new l.default("The partial "+n.name+" could not be compiled when running in runtime-only mode")},fn:function(t){var i=e[t];return i.decorator=e[t+"_d"],i},programs:[],program:function(e,t,i,r,o){var n=this.programs[e],l=this.fn(e);return t||o||r||i?n=c(this,e,l,t,i,r,o):n||(n=this.programs[e]=c(this,e,l)),n},data:function(e,t){for(;e&&t--;)e=e._parent;return e},mergeIfNeeded:function(e,t){var i=e||t;return e&&t&&e!==t&&(i=o.extend({},t,e)),i},nullContext:Object.seal({}),noop:t.VM.noop,compilerInfo:e.compiler};function n(t){var i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=i.data;n._setup(i),!i.partial&&e.useData&&(o=function(e,t){t&&"root"in t||((t=t?s.createFrame(t):{}).root=e);return t}(t,o));var l=void 0,u=e.useBlockParams?[]:void 0;function a(t){return""+e.main(r,t,r.helpers,r.partials,o,u,l)}return e.useDepths&&(l=i.depths?t!=i.depths[0]?[t].concat(i.depths):i.depths:[t]),(a=h(e.main,a,r,i.depths||[],o,u))(t,i)}return n.isTop=!0,n._setup=function(n){if(n.partial)r.protoAccessControl=n.protoAccessControl,r.helpers=n.helpers,r.partials=n.partials,r.decorators=n.decorators,r.hooks=n.hooks;else{var l=o.extend({},t.helpers,n.helpers);!function(e,t){Object.keys(e).forEach((function(i){var r=e[i];e[i]=function(e,t){var i=t.lookupProperty;return a.wrapHelper(e,(function(e){return o.extend({lookupProperty:i},e)}))}(r,t)}))}(l,r),r.helpers=l,e.usePartial&&(r.partials=r.mergeIfNeeded(n.partials,t.partials)),(e.usePartial||e.useDecorators)&&(r.decorators=o.extend({},t.decorators,n.decorators)),r.hooks={},r.protoAccessControl=d.createProtoAccessControl(n);var s=n.allowCallsToHelperMissing||i;u.moveHelperToHooks(r,"helperMissing",s),u.moveHelperToHooks(r,"blockHelperMissing",s)}},n._child=function(t,i,o,n){if(e.useBlockParams&&!o)throw new l.default("must pass block params");if(e.useDepths&&!n)throw new l.default("must pass parent depths");return c(r,t,e[t],i,0,o,n)},n},t.wrapProgram=c,t.resolvePartial=function(e,t,i){e?e.call||i.name||(i.name=e,e=i.partials[e]):e="@partial-block"===i.name?i.data["partial-block"]:i.partials[i.name];return e},t.invokePartial=function(e,t,i){var r=i.data&&i.data["partial-block"];i.partial=!0,i.ids&&(i.data.contextPath=i.ids[0]||i.data.contextPath);var n=void 0;i.fn&&i.fn!==v&&function(){i.data=s.createFrame(i.data);var e=i.fn;n=i.data["partial-block"]=function(t){var i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return i.data=s.createFrame(i.data),i.data["partial-block"]=r,e(t,i)},e.partials&&(i.partials=o.extend({},i.partials,e.partials))}();void 0===e&&n&&(e=n);if(void 0===e)throw new l.default("The partial "+i.name+" could not be found");if(e instanceof Function)return e(t,i)},t.noop=v;var r,o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(i(2849)),n=i(3769),l=(r=n)&&r.__esModule?r:{default:r},s=i(2871),u=i(2277),a=i(2614),d=i(3865);function c(e,t,i,r,o,n,l){function s(t){var o=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],s=l;return!l||t==l[0]||t===e.nullContext&&null===l[0]||(s=[t].concat(l)),i(e,t,e.helpers,e.partials,o.data||r,n&&[o.blockParams].concat(n),s)}return(s=h(i,s,e,l,r,n)).program=t,s.depth=l?l.length:0,s.blockParams=o||0,s}function v(){return""}function h(e,t,i,r,n,l){if(e.decorator){var s={};t=e.decorator(t,s,i,r&&r[0],n,l,r),o.extend(t,s)}return t}},9613:(e,t)=>{"use strict";function i(e){this.string=e}t.__esModule=!0,i.prototype.toString=i.prototype.toHTML=function(){return""+this.string},t.default=i,e.exports=t.default},2849:(e,t)=>{"use strict";t.__esModule=!0,t.extend=l,t.indexOf=function(e,t){for(var i=0,r=e.length;i<r;i++)if(e[i]===t)return i;return-1},t.escapeExpression=function(e){if("string"!=typeof e){if(e&&e.toHTML)return e.toHTML();if(null==e)return"";if(!e)return e+"";e=""+e}if(!o.test(e))return e;return e.replace(r,n)},t.isEmpty=function(e){return!e&&0!==e||!(!a(e)||0!==e.length)},t.createFrame=function(e){var t=l({},e);return t._parent=e,t},t.blockParams=function(e,t){return e.path=t,e},t.appendContextPath=function(e,t){return(e?e+".":"")+t};var i={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","=":"&#x3D;"},r=/[&<>"'`=]/g,o=/[&<>"'`=]/;function n(e){return i[e]}function l(e){for(var t=1;t<arguments.length;t++)for(var i in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],i)&&(e[i]=arguments[t][i]);return e}var s=Object.prototype.toString;t.toString=s;var u=function(e){return"function"==typeof e};u(/x/)&&(t.isFunction=u=function(e){return"function"==typeof e&&"[object Function]"===s.call(e)}),t.isFunction=u;var a=Array.isArray||function(e){return!(!e||"object"!=typeof e)&&"[object Array]"===s.call(e)};t.isArray=a},3633:(e,t,i)=>{e.exports=i(261).default},8658:(e,t,i)=>{"use strict";var r,o,n,l,s,u;i.d(t,{$J:()=>n,DH:()=>o,Ev:()=>l,OH:()=>u,iF:()=>s,t3:()=>r}),function(e){e[e.OK=200]="OK",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.FORBIDDEN=403]="FORBIDDEN"}(r||(r={})),function(e){e[e.SUCCESS=2]="SUCCESS",e[e.CLIENT_ERROR=4]="CLIENT_ERROR",e[e.SERVER_ERROR=5]="SERVER_ERROR"}(o||(o={})),function(e){e.INDIGO="#331c7a",e.ULTRAMARINE="#1f69ff",e.AQUAMARINE="#4ceaaa",e.ELECTRIC_LIME="#c5f700",e.CRAYOLA="#f7a800",e.ORANGE="#f66d18",e.RED="#e72024",e.LAVENDER="#c0abff",e.ULTRA_RED="#f97585",e.SOFT_GOLD="#f4bd5d",e.MAGIC_MINT="#baf7db",e.SKY_BLUE="#7eceeb",e.CARIBBEAN_GREN="#0dcc91",e.LAVENDER_GRAY="#d3d3e0"}(n||(n={})),function(e){e[e.IP2LOCATION=1]="IP2LOCATION",e[e.NEUSTAR=2]="NEUSTAR",e[e.MAXMIND=3]="MAXMIND",e[e.NETACUITY=4]="NETACUITY"}(l||(l={})),function(e){e[e.GPS=1]="GPS",e[e.IP=2]="IP",e[e.USER=3]="USER"}(s||(s={})),function(e){e.PROD="PROD",e.STAGING="STAGING",e.LOCAL="LOCAL",e.MOCK="MOCK"}(u||(u={}))},110:(e,t,i)=>{"use strict";i.d(t,{e:()=>r});class r extends Error{constructor(e){super(`No bid response. Got "${e}"`),this.name="NoBidResponseError"}}},4041:(e,t,i)=>{"use strict";function r(e,t){const i=[];for(let r=0;r<t;r++){const t=e.next();if(!0===t.done)break;i.push(t.value)}return i}async function o(e,t){const i=[];for(let r=0;r<t;r++){const t=await e.next();if(!0===t.done)break;i.push(t.value)}return i}i.d(t,{D:()=>r,J:()=>o})},545:(e,t,i)=>{"use strict";i.d(t,{D:()=>r.D,J:()=>r.J});var r=i(4041)},4051:(e,t,i)=>{"use strict";i.d(t,{$P:()=>d,Ae:()=>l,Hr:()=>h,S1:()=>m,Sf:()=>s,Uo:()=>g,YO:()=>_,Yc:()=>c,eq:()=>f,fj:()=>v,hl:()=>u,ib:()=>n,or:()=>p,yR:()=>o});const r=5;function o(e,t){var i;if(null==e||"string"!=typeof e)return"";const o=void 0!==t.hash.hyphenate?new RegExp(t.hash.hyphenate,"ig"):/[\s_\-,]/gi,n=void 0!==t.hash.drop?new RegExp(t.hash.drop,"ig"):/[^A-Za-z0-9-]/gi,l=null!==(i=t.hash.length)&&void 0!==i?i:r;return e.replace(o,"-").replace(n,"").toLowerCase().split("-").slice(0,l).join("-")}function n(e){return null==e||"string"!=typeof e?"":e.toLowerCase()}function l(e){if(0===e||null==e)return"";const t=window.location.pathname.split("/");return t.length<=e?"":t[e]}function s(){let e=window;const t=[...arguments];for(;t.length>0&&void 0!==e;){const i=t.shift();if(void 0===i||"string"!=typeof i)break;e=e[i]}return e}function u(e,t,i){return e.replace(new RegExp(t),((...e)=>{const t=e.slice(1,-2);let r=i;return r=r.replace(/\\(\d+)/g,((e,i)=>{var r;return null!==(r=t[i-1])&&void 0!==r?r:""})),r=r.replace(/\\U(\d+)/g,((e,i)=>{var r;return(null!==(r=t[i-1])&&void 0!==r?r:"").toUpperCase()})),r=a(r,"U",t,(e=>e.toUpperCase())),r=a(r,"L",t,(e=>e.toLowerCase())),r=a(r,"I",t,(e=>e[0])),r}))}function a(e,t,i,r){return e.replace(new RegExp(`\\\\${t}(\\d+)`,"g"),((e,t)=>{var o;return r(null!==(o=i[t-1])&&void 0!==o?o:"")}))}function d(e){var t;if(void 0===(null==e?void 0:e.length)||0===e.length)return"";const i=window.location.search;if(0===i.length)return"";return null!==(t=new URLSearchParams(i).get(e))&&void 0!==t?t:""}function c(){for(let e=0;e<arguments.length-1;e++){const t=arguments[e];if(null!=t&&""!==t&&!1!==t)return t}return""}function v(){var e;const t=[...arguments].slice(0,arguments.length-1),i=null!==(e=arguments[arguments.length-1].hash.separator)&&void 0!==e?e:"/";return t.filter((e=>null!=e&&""!==e)).join(i)}function h(e){if(void 0===(null==e?void 0:e.length)||0===e.length)return"";return encodeURIComponent(e).replaceAll("'","%27")}function f(e,t){return e===t}function p(e,t){return Boolean(e)||Boolean(t)}function g(e,t){return Boolean(e)&&Boolean(t)}function m(e,t){return void 0!==(null==t?void 0:t.length)&&0!==t.length&&t.includes(e)}function _(){return Array.from(arguments).slice(0,-1)}},9730:(e,t,i)=>{"use strict";i.r(t),i.d(t,{BuildBanner:()=>o.Vq,BuildBannerFromBid:()=>o.kH,BuildClickThroughUrl:()=>o.He,BuildNativeResponse:()=>o.l7,BuildProductInfoFromElement:()=>o.Od,CollectN:()=>l.D,CollectNAsync:()=>l.J,DeserializeVast:()=>o.Kr,DeserializeVideo:()=>o.rS,RequestBuilder:()=>r.t,SimpleBannerRequest:()=>r.Y,and:()=>n.Uo,array:()=>n.YO,coalesce:()=>n.Yc,eq:()=>n.eq,global:()=>n.Sf,isIn:()=>n.S1,join:()=>n.fj,lower:()=>n.ib,or:()=>n.or,path:()=>n.Ae,search:()=>n.$P,sed:()=>n.hl,slug:()=>n.yR,uri:()=>n.Hr});var r=i(3569),o=i(5509),n=i(4051),l=i(545)},3641:(e,t,i)=>{"use strict";var r;i.d(t,{t:()=>o}),function(e){e[e.BANNER=0]="BANNER",e[e.VIDEO=1]="VIDEO",e[e.NATIVE=2]="NATIVE"}(r||(r={}));class o{constructor(e){this._builderState=void 0,this._request={id:null!=e?e:this._generateId(),imp:[]}}build(){this._appendBuilderState();for(const e of this._request.imp)e.ext=this._request.ext;return this._request.app={name:window.location.hostname,domain:window.location.hostname,id:window.location.hostname},this._request.site={name:window.location.hostname,domain:window.location.hostname,id:window.location.hostname},this._request}withSurfContext(e,t,i,r,o,n){return this._request.ext={accountId:e,siteId:t,channelId:o,zoneId:r,locationId:i,storeId:i,keywords:n},this}withBanner(e,t,i){return this._appendBuilderState(),this._builderState={type:r.BANNER,imp:{id:this._generateId()},currentCreative:{w:e,h:t,...i}},this}withVideo(e,t,i,o,n=["video/mp4","video/webm"],l){return this._appendBuilderState(),this._builderState={type:r.VIDEO,imp:{id:this._generateId()},currentCreative:{w:e,h:t,minduration:i,maxduration:o,mimes:n,...l}},this}withNative(e,t){return this._appendBuilderState(),this._builderState={type:r.NATIVE,imp:{id:this._generateId()},currentCreative:{request:e,ver:"1.2",...t}},this}withBidFloor(e,t="USD"){if(void 0===this._builderState)throw new Error("Invalid state");return this._builderState.imp.bidfloor=e,this._builderState.imp.bidfloorcur=t,this}withImpExt(e){if(void 0===this._builderState)throw new Error("Invalid state");return this._builderState.imp.ext=e,this}withSite(e){return this._request.site=null!=e?e:{name:window.location.hostname,domain:window.location.hostname},this}withApp(e){return this._request.app=null!=e?e:{name:window.location.hostname,domain:window.location.hostname},this}withDevice(e){return this._request.device=e,this}withUser(e){return this._request.user=e,this}withRegulations(e){return this._request.regs=e,this}_appendBuilderState(){if(void 0!==this._builderState){switch(this._builderState.type){case r.BANNER:this._builderState.imp.banner=this._builderState.currentCreative;break;case r.NATIVE:this._builderState.imp.native=this._builderState.currentCreative;break;case r.VIDEO:this._builderState.imp.video=this._builderState.currentCreative}this._appendImpression()}}_appendImpression(){var e;void 0!==this._builderState&&(this._request.imp=null!==(e=this._request.imp)&&void 0!==e?e:[],this._request.imp.push(this._builderState.imp))}_generateId(){return crypto.randomUUID()}}},1892:(e,t,i)=>{"use strict";i.d(t,{Y:()=>r});class r{constructor(e,t,i){const r=crypto.randomUUID();this.id=e,this.imp=[{id:r,banner:{w:t,h:i}}]}}},3569:(e,t,i)=>{"use strict";i.d(t,{Y:()=>r.Y,t:()=>o.t});var r=i(1892),o=i(3641)},8624:(e,t,i)=>{"use strict";i.d(t,{Od:()=>l,Vq:()=>o,kH:()=>n});var r=i(1191);function o(e,t){var i,o,s;if(null===e)return{element:null,product:null,clickThrough:null};const u=null===(s=null===(o=null===(i=null==e?void 0:e.seatbid)||void 0===i?void 0:i[0])||void 0===o?void 0:o.bid)||void 0===s?void 0:s[0];if(void 0===u)return{element:null,product:null,clickThrough:null};const a=n(u);if(null===a)return{element:null,product:null,clickThrough:null};if(void 0===t)return{element:a,product:null,clickThrough:null};const d=l(a);let c=null;if(null!==d&&(c=(0,r.H)(t,d,{image:null,price:null,salePrice:null,thc:null,strain:null,cbd:null,name:null,brand_name:null,brandName:null,productType:null,details:null,cta:null,clickthroughUrl:null,winUrl:null,pixelUrl:null}),null!==c)){const e=a.querySelectorAll("a[href*=\\{SURF_COMMERCE_URL\\}]"),t=c;e.forEach((e=>{const i=e.getAttribute("href");if(null===i)return;const r=i.replace("{SURF_COMMERCE_URL}",t);e.setAttribute("href",r)}))}return{element:a,product:l(a),clickThrough:c}}function n(e){if(void 0===e.adm)return null;const t=document.createElement("div");if(t.innerHTML=e.adm,void 0!==e.nurl){const i=new Image(1,1);i.src=e.nurl,i.style.display="none",t.appendChild(i)}return t}function l(e){var t,i,r,o,n,l,s,u,a,d,c,v,h,f,p;const g=e.querySelector("#surf-product-info");if(null===g)return null;const m=g.dataset;return{image:null!==(t=m.image)&&void 0!==t?t:null,price:null!==(i=m.price)&&void 0!==i?i:null,salePrice:null!==(r=m.saleprice)&&void 0!==r?r:null,thc:null!==(o=m.thc)&&void 0!==o?o:null,strain:null!==(n=m.strain)&&void 0!==n?n:null,cbd:null!==(l=m.cbd)&&void 0!==l?l:null,name:null!==(s=m.name)&&void 0!==s?s:null,brand_name:null!==(u=m.brandname)&&void 0!==u?u:null,brandName:null!==(a=m.brandname)&&void 0!==a?a:null,productType:null!==(d=m.producttype)&&void 0!==d?d:null,details:null!==(c=m.details)&&void 0!==c?c:null,cta:null!==(v=m.cta)&&void 0!==v?v:null,clickthroughUrl:null!==(h=m.clickthroughurl)&&void 0!==h?h:null,winUrl:null!==(f=m.winurl)&&void 0!==f?f:null,pixelUrl:null!==(p=m.pixelurl)&&void 0!==p?p:null,ext:m}}},6577:(e,t,i)=>{"use strict";i.d(t,{l:()=>l});var r=i(6131),o=i(1191),n=i(4842);async function l(e,t,i){var l,s,u,a,d,c,v,h,f,p;const g=null===(s=null===(l=null==e?void 0:e.seatbid)||void 0===l?void 0:l[0])||void 0===s?void 0:s.bid;if(void 0===g||0===g.length)return null==i||i.error("BuildNativeResponse No bids"),[];const m=[];for(const e of g){const l=e.adm;if(void 0===l||0===l.length){null==i||i.warn("BuildNativeResponse no adm in bid");continue}let s;try{s=JSON.parse(decodeURIComponent(null!=l?l:"").replaceAll(/\\"/gi,'"'))}catch(e){try{s=JSON.parse(l)}catch(e){null==i||i.warn("BuildNativeResponse failed to deserialized adm data");continue}}const g=e.nurl;if(void 0===g){null==i||i.warn("BuildNativeResponse failed to load winUrl");continue}const _=[],S=[];for(const e of null!==(u=s.native.eventtrackers)&&void 0!==u?u:[])e.event===r.wf.IMP&&void 0!==e.url&&(e.method===r.i_.IMG?_.push(e.url):e.method===r.i_.JS&&S.push(e.url));let w,E=s.native.link.url,b=null;if(void 0!==t){const e=(0,r.LO)(s),l=null===(c=null===(d=null===(a=s.native.assets)||void 0===a?void 0:a.find((e=>e.id===r.vU.SURF_META_PRODUCT)))||void 0===d?void 0:d.data)||void 0===c?void 0:c.value;let u;if(void 0===l)u={image:null,price:null,salePrice:null,thc:null,strain:null,cbd:null,name:null,brand_name:null,brandName:null,productType:null,details:null,cta:null,clickthroughUrl:null,winUrl:null,pixelUrl:null};else{if(b=await t.productService.getNativeProduct(t.accountId,t.siteId,t.locationId,l),null===b){console.warn("catalog response is null");continue}u=b}E.includes("{SURF_COMMERCE_URL}")&&(E=E.replace("{SURF_COMMERCE_URL}",(0,o.H)(t.config,e,u,b)));const m=(0,n.N7)(t.config.templates.productCardTemplate,e,t.config,E,u);if(w=document.createElement("div"),w.attachShadow({mode:"open"}),null===w.shadowRoot){null==i||i.warn("BuildNativeResponse failed to load shadow room of built element");continue}const _=document.createElement("style");_.innerHTML=t.config.templates.productCardStylesheet,w.shadowRoot.appendChild(_),w.shadowRoot.appendChild(m);const S=null!==(h=null===(v=s.native.eventtrackers)||void 0===v?void 0:v.filter((e=>e.method===r.i_.IMG&&e.event===r.wf.IMP&&void 0!==e.url)).map((e=>`${e.url}`)))&&void 0!==h?h:[];S.push(g);const I=null!==(p=null===(f=s.native.eventtrackers)||void 0===f?void 0:f.filter((e=>e.method===r.i_.JS&&e.event===r.wf.IMP&&void 0!==e.url)).map((e=>`<script type="text/javascript" src="${e.url}"><\/script>`)))&&void 0!==p?p:[];for(const e of S){const t=document.createElement("img");t.width=1,t.height=1,t.src=e,w.shadowRoot.appendChild(t)}for(const e of I)w.shadowRoot.innerHTML+=e}m.push({data:s,clickThrough:E,winUrl:g,trackers:{pixels:_,js:S},element:w})}return m}},1191:(e,t,i)=>{"use strict";i.d(t,{H:()=>o});var r=i(9730);function o(e,t,i,o){return e.templates.clickThroughUrlTemplate({product:t,catalog:i,window:{origin:window.location.origin,port:window.location.port,path:window.location.pathname,host:window.location.host,host_name:window.location.hostname,search:window.location.search,hash:window.location.hash,protocol:window.location.protocol},publisher:e,ext:o},{helpers:r})}},5306:(e,t,i)=>{"use strict";function r(e,t,i){null==e||e.debug("getOrThrow name",i);const r=t.querySelector(i);if(null===r)throw new Error(`No ${i} tag found`);return null==e||e.debug("getOrThrow child "+i,r),r}function o(e,t,i){null==e||e.debug("getAttributeOrThrow name",i);const r=t.getAttribute(i);if(null===r)throw new Error(`No ${i} attribute found`);return null==e||e.debug("getAttributeOrThrow attribute "+i,r),r}function n(e,t,i){const r=o(e,t,i),n=Number(r);if(isNaN(n))throw new Error(`${i} is not a number`);return n}function l(e,t){var i,r;const o=null===(r=null===(i=e.seatbid)||void 0===i?void 0:i[0].bid)||void 0===r?void 0:r[0].adm;return void 0===o?null:s(t,o)}function s(e,t){null==e||e.debug("DeserializeVast adm",t);const i=(new DOMParser).parseFromString(t,"text/xml");null==e||e.debug("DeserializeVast doc",i);const r=i.querySelector("VAST");if(null===r)throw new Error("No VAST tag found");null==e||e.debug("DeserializeVast root",r);const n=o(e,r,"version"),l=Array.from(r.querySelectorAll("Ad")).map(u.bind(null,e));return null==e||e.debug("DeserializeVast ads",l),{version:n,ads:l}}function u(e,t){null==e||e.debug("deserializeAd element",t);const i=t.getAttribute("id"),n=function(e,t){var i,n,l,s,u,d,c,v,h,f,p,g,m,_,S,w,E,b,I,R,T,O,C,y;null==e||e.debug("deserializeInline element",t);const N=null===(i=t.querySelector("AdSystem"))||void 0===i?void 0:i.textContent;if(null==N)throw new Error("No AdSystem tag found in InLine");null==e||e.debug("deserializeInline adSystem",N);const D=null===(n=t.querySelector("AdTitle"))||void 0===n?void 0:n.textContent;if(null==D)throw new Error("No AdTitle tag found in InLine");null==e||e.debug("deserializeInline adTitle",D);const A=r(e,t,"Impression"),P=function(e,t){null==e||e.debug("deserializeImpression element",t);const i=o(e,t,"id"),r=t.textContent;if(null===r)throw new Error("No value found on Impression");return null==e||e.debug("deserializeImpression value",r),{id:i,value:r}}(e,A),U=Array.from(t.querySelectorAll("Linear")).map(a.bind(null,e)),x=Array.from(t.querySelectorAll("Extensions Extension"));let M;if(x.length>0){const e=x[0],t=null!==(s=null===(l=e.querySelector("Image"))||void 0===l?void 0:l.textContent)&&void 0!==s?s:null,i=null!==(d=null===(u=e.querySelector("Price"))||void 0===u?void 0:u.textContent)&&void 0!==d?d:null,r=null!==(v=null===(c=e.querySelector("SalePrice"))||void 0===c?void 0:c.textContent)&&void 0!==v?v:null,o=null!==(f=null===(h=e.querySelector("THC"))||void 0===h?void 0:h.textContent)&&void 0!==f?f:null,n=null!==(g=null===(p=e.querySelector("Strain"))||void 0===p?void 0:p.textContent)&&void 0!==g?g:null,a=null!==(_=null===(m=e.querySelector("CBD"))||void 0===m?void 0:m.textContent)&&void 0!==_?_:null,N=null!==(w=null===(S=e.querySelector("Name"))||void 0===S?void 0:S.textContent)&&void 0!==w?w:null,D=null!==(b=null===(E=e.querySelector("BrandName"))||void 0===E?void 0:E.textContent)&&void 0!==b?b:null;M={image:t,price:i,salePrice:r,thc:o,strain:n,cbd:a,name:N,brandName:D,brand_name:D,productType:null!==(R=null===(I=e.querySelector("ProductType"))||void 0===I?void 0:I.textContent)&&void 0!==R?R:null,details:null!==(O=null===(T=e.querySelector("Details"))||void 0===T?void 0:T.textContent)&&void 0!==O?O:null,cta:null!==(y=null===(C=e.querySelector("CTA"))||void 0===C?void 0:C.textContent)&&void 0!==y?y:null,clickthroughUrl:null,winUrl:null,pixelUrl:null}}return{impression:P,adSystem:N,adTitle:D,creatives:U,product:M}}(e,r(e,t,"InLine"));return{id:i,inline:n}}function a(e,t){var i;null==e||e.debug("deserializeLinear element",t);const r=null===(i=t.querySelector("Duration"))||void 0===i?void 0:i.textContent;if(null==r)throw new Error("No Duration tag found in Linear");null==e||e.debug("deserializeLinear duration",r);const o=Array.from(t.querySelectorAll("TrackingEvents Tracking")).map(d.bind(null,e));null==e||e.debug("deserializeLinear trackingEvents",o);const n=Array.from(t.querySelectorAll("MediaFiles MediaFile")).map(c.bind(null,e));null==e||e.debug("deserializeLinear mediaFiles",n);const l=Array.from(t.querySelectorAll("VideoClicks ClickThrough")).map(v.bind(null,e));return null==e||e.debug("deserializeLinear videoClicks",l),{duration:r,trackingEvents:o,mediaFiles:n,videoClicks:l}}function d(e,t){null==e||e.debug("deserializeTrackingEvent element",t);const i=o(e,t,"event"),r=t.textContent;if(null===r)throw new Error("No url found on Tracking");return null==e||e.debug("deserializeTrackingEvent url",r),{event:i,url:r}}function c(e,t){null==e||e.debug("deserializeMediaFile element",t);const i=t.getAttribute("id");null==e||e.debug("deserializeMediaFile id",i);const r=o(e,t,"delivery"),l=o(e,t,"type"),s=n(e,t,"width"),u=n(e,t,"height"),a=function(e,t,i){null==e||e.debug("getAttribute name",i);const r=t.getAttribute(i);return null==e||e.debug("getAttribute attribute "+i,r),r}(e,t,"bitrate"),d=t.textContent;if(null===d)throw new Error("No url found on MediaFile");return null==e||e.debug("deserializeMediaFile url",d),{id:i,delivery:r,type:l,width:s,height:u,bitrate:a,url:d}}function v(e,t){null==e||e.debug("deserializeVideoClick element",t);const i=t.getAttribute("id");null==e||e.debug("deserializeVideoClick id",i);const r=t.textContent;if(null===r)throw new Error("No url found on Clickthrough");return null==e||e.debug("deserializeVideoClick url",r),{id:i,url:r}}i.d(t,{K:()=>s,r:()=>l})},5509:(e,t,i)=>{"use strict";i.d(t,{He:()=>n.H,Kr:()=>l.K,Od:()=>r.Od,Vq:()=>r.Vq,kH:()=>r.kH,l7:()=>o.l,rS:()=>l.r});var r=i(8624),o=i(6577),n=i(1191),l=i(5306)},8971:(e,t,i)=>{"use strict";async function r(e,t,i){null==e||e.info("DeviceMiddleware.intercept",i);const r=await(null==t?void 0:t.getDeviceInfo());return i.device={...i.device,...r},i}i.d(t,{t:()=>r})},7308:(e,t,i)=>{"use strict";i.d(t,{F:()=>o});var r=i(8658);async function o(e,t,i,o,n){const l=await e.getGeo();return null!==l?(null==t||t.debug("GeoMiddleware.intercept found geocontext",l),void 0===i.device&&(i.device={}),o&&(i.device.geo={lat:l.coords.latitude,lon:l.coords.longitude,city:l.city,region:l.region,country:l.country,zip:l.zip,type:r.iF.IP,accuracy:l.coords.accuracy,utcoffset:l.utcoffset,ipservice:r.Ev.MAXMIND}),n&&(i.device.ip=l.ip)):null==t||t.warn("GeoMiddleware.intercept did not find geocontext"),null==t||t.debug("GeoMiddleware.intercept returning",i),i}},4723:(e,t,i)=>{"use strict";i.d(t,{N:()=>n,T:()=>o});var r=i(6131);async function o(e,t,i){null==t||t.info("IdentityMiddleware.intercept",i);const o=await e.getUserId();if(null==t||t.debug("IdentityMiddleware.intercept userId",o),null!==o){const e={source:"surf-domain-id",uids:[{id:o,atype:r.ZV.SESSION}]};void 0!==i.user?i.user.eids=[e]:i.user={eids:[e]}}return null==t||t.debug("IdentityMiddleware.intercept returning",i),i}const n=(e,t)=>async i=>await o(e,t,i)},3957:(e,t,i)=>{"use strict";i.d(t,{Fp:()=>r.F,NW:()=>n.N,Tw:()=>n.T,tX:()=>o.t});var r=i(7308),o=i(8971),n=i(4723)},6131:(e,t,i)=>{"use strict";i.d(t,{Bz:()=>r.Bz,Im:()=>r.Im,JQ:()=>r.JQ,JY:()=>r.JY,LO:()=>r.LO,Lp:()=>r.Lp,Ph:()=>r.Ph,V5:()=>r.V5,ZV:()=>r.ZV,bU:()=>r.bU,i_:()=>r.i_,qU:()=>r.qU,vU:()=>r.vU,wf:()=>r.wf});var r=i(2160)},4231:(e,t,i)=>{"use strict";var r,o;i.d(t,{V:()=>o,Z:()=>r}),function(e){e[e.SESSION=1]="SESSION",e[e.DEVICE=2]="DEVICE",e[e.USER=3]="USER"}(r||(r={})),function(e){e[e.MOBILE=1]="MOBILE",e[e.PC=2]="PC",e[e.CTV=3]="CTV",e[e.PHONE=4]="PHONE",e[e.TABLET=5]="TABLET",e[e.CONNECTED=6]="CONNECTED",e[e.SET_TOP=7]="SET_TOP",e[e.OOH=8]="OOH"}(o||(o={}))},2160:(e,t,i)=>{"use strict";i.d(t,{Bz:()=>o.Bz,Im:()=>o.Im,JQ:()=>o.JQ,JY:()=>o.JY,LO:()=>o.LO,Lp:()=>o.Lp,Ph:()=>o.Ph,V5:()=>r.V,ZV:()=>r.Z,bU:()=>o.bU,i_:()=>o.i_,qU:()=>o.qU,vU:()=>o.vU,wf:()=>o.wf});var r=i(4231),o=i(8906)},7973:(e,t,i)=>{"use strict";i.d(t,{L:()=>n});var r=i(6131);function o(e,t){var i,r,o;return null!==(o=null===(r=null===(i=null==e?void 0:e.find((e=>e.id===t)))||void 0===i?void 0:i.data)||void 0===r?void 0:r.value)&&void 0!==o?o:null}function n(e){var t,i,n,l,s,u,a,d,c,v,h,f,p,g,m,_;const S=o(e.native.assets,r.vU.SPONSORED);return{image:null!==(l=null===(n=null===(i=null===(t=e.native.assets)||void 0===t?void 0:t.find((e=>{var t;return(null===(t=e.img)||void 0===t?void 0:t.type)===r.qU.MAIN})))||void 0===i?void 0:i.img)||void 0===n?void 0:n.url)&&void 0!==l?l:null,name:null!==(d=null===(a=null===(u=null===(s=e.native.assets)||void 0===s?void 0:s.find((e=>void 0!==e.title)))||void 0===u?void 0:u.title)||void 0===a?void 0:a.text)&&void 0!==d?d:null,price:o(e.native.assets,r.vU.PRICE),salePrice:o(e.native.assets,r.vU.SALEPRICE),thc:o(e.native.assets,r.vU.SURF_THC),cbd:o(e.native.assets,r.vU.SURF_CBD),strain:o(e.native.assets,r.vU.SURF_STRAIN),brand_name:S,brandName:S,productType:o(e.native.assets,r.vU.SURF_CATEGORY),details:o(e.native.assets,r.vU.DESC),cta:o(e.native.assets,r.vU.CTATEXT),clickthroughUrl:null!==(v=null===(c=e.native.link)||void 0===c?void 0:c.url)&&void 0!==v?v:null,winUrl:null!==(p=null===(f=null===(h=e.native.eventtrackers)||void 0===h?void 0:h.find((e=>e.event===r.wf.SURF_WIN)))||void 0===f?void 0:f.url)&&void 0!==p?p:null,pixelUrl:null!==(_=null===(m=null===(g=e.native.eventtrackers)||void 0===g?void 0:g.find((e=>e.event===r.wf.IMP)))||void 0===m?void 0:m.url)&&void 0!==_?_:null}}},9946:(e,t,i)=>{"use strict";var r,o,n,l,s,u,a,d,c,v;i.d(t,{Bz:()=>n,JQ:()=>r,JY:()=>c,Lp:()=>u,Ph:()=>d,bU:()=>a,i_:()=>v,qU:()=>o,vU:()=>l,wf:()=>s}),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.ABOVE_THE_FOLD=1]="ABOVE_THE_FOLD",e[e.BELOW_THE_FOLD=3]="BELOW_THE_FOLD",e[e.HEADER=4]="HEADER",e[e.FOOTER=5]="FOOTER",e[e.SIDEBAR=6]="SIDEBAR",e[e.FULL_SCREN=7]="FULL_SCREN"}(r||(r={})),function(e){e[e.ICON=1]="ICON",e[e.MAIN=3]="MAIN"}(o||(o={})),function(e){e[e.SPONSORED=1]="SPONSORED",e[e.DESC=2]="DESC",e[e.RATING=3]="RATING",e[e.LIKES=4]="LIKES",e[e.DOWNLOADS=5]="DOWNLOADS",e[e.PRICE=6]="PRICE",e[e.SALEPRICE=7]="SALEPRICE",e[e.PHONE=8]="PHONE",e[e.ADDRESS=9]="ADDRESS",e[e.DESC2=10]="DESC2",e[e.DISPLAYURL=11]="DISPLAYURL",e[e.CTATEXT=12]="CTATEXT",e[e.SURF_STRAIN=500]="SURF_STRAIN",e[e.SURF_THC=501]="SURF_THC",e[e.SURF_CBD=502]="SURF_CBD",e[e.SURF_CATEGORY=503]="SURF_CATEGORY",e[e.SURF_META_PRODUCT=599]="SURF_META_PRODUCT"}(n||(n={})),function(e){e[e.TITLE=0]="TITLE",e[e.IMAGE=1]="IMAGE",e[e.SPONSORED=2]="SPONSORED",e[e.DESC=3]="DESC",e[e.RATING=4]="RATING",e[e.PRICE=5]="PRICE",e[e.SALEPRICE=6]="SALEPRICE",e[e.DISPLAYURL=7]="DISPLAYURL",e[e.CTATEXT=8]="CTATEXT",e[e.SURF_STRAIN=500]="SURF_STRAIN",e[e.SURF_THC=501]="SURF_THC",e[e.SURF_CBD=502]="SURF_CBD",e[e.SURF_CATEGORY=503]="SURF_CATEGORY",e[e.SURF_META_PRODUCT=599]="SURF_META_PRODUCT"}(l||(l={})),function(e){e[e.IMP=1]="IMP",e[e.VIEWABLE_MRC50=2]="VIEWABLE_MRC50",e[e.VIEWABLE_MRC100=3]="VIEWABLE_MRC100",e[e.VIEWABLE_VIDEO50=4]="VIEWABLE_VIDEO50",e[e.SURF_WIN=500]="SURF_WIN",e[e.SURF_CLICK=501]="SURF_CLICK"}(s||(s={})),function(e){e[e.CONTENT=1]="CONTENT",e[e.SOCIAL=2]="SOCIAL",e[e.PRODUCT=3]="PRODUCT"}(u||(u={})),function(e){e[e.GENERAL=10]="GENERAL",e[e.ARTICLE=11]="ARTICLE",e[e.VIDEO=12]="VIDEO",e[e.AUDIO=13]="AUDIO",e[e.IMAGE=14]="IMAGE",e[e.USER_GENERATED=15]="USER_GENERATED",e[e.GENERAL_SOCIAL=20]="GENERAL_SOCIAL",e[e.EMAIL=21]="EMAIL",e[e.CHAT=22]="CHAT",e[e.PRODUCT=30]="PRODUCT",e[e.APPLICATION=31]="APPLICATION",e[e.PRODUCT_REVIEWS=32]="PRODUCT_REVIEWS"}(a||(a={})),function(e){e[e.IN_FEED=1]="IN_FEED",e[e.ATOMIC=2]="ATOMIC",e[e.OUTSIDE_CORE=3]="OUTSIDE_CORE",e[e.RECOMMENDATION=4]="RECOMMENDATION"}(d||(d={})),function(e){e.MP4="video/mp4",e.WEBM="video/webm"}(c||(c={})),function(e){e[e.IMG=1]="IMG",e[e.JS=2]="JS"}(v||(v={}))},3839:(e,t,i)=>{"use strict";i.d(t,{I:()=>o});var r=i(6131);class o{constructor(){this._request={ver:"1.2",context:r.Lp.PRODUCT,contextsubtype:r.bU.PRODUCT,plcmttype:r.Ph.RECOMMENDATION,assets:[],eventtrackers:[{event:r.wf.IMP,methods:[r.i_.IMG]},{event:r.wf.SURF_CLICK,methods:[r.i_.IMG]},{event:r.wf.IMP,methods:[r.i_.JS]}]}}withVer(e){return this._request.ver=e,this}withContext(e){return this._request.context=e,this}withTitle(e=80,t=!0){return void 0===this._request.assets&&(this._request.assets=[]),this._request.assets.push({id:0,required:t?1:0,title:{len:e}}),this}withImage(e,t,i,r,o=!0){return void 0===this._request.assets&&(this._request.assets=[]),this._request.assets.push({id:0,required:o?1:0,img:{w:e,wmin:i,h:t,hmin:r}}),this}withVideo(e,t,i,r=!0){return void 0===this._request.assets&&(this._request.assets=[]),this._request.assets.push({id:0,required:r?1:0,video:{mimes:e,minduration:t,maxduration:i,protocols:[3]}}),this}withData(e,t,i=80,r=!0){return void 0===this._request.assets&&(this._request.assets=[]),this._request.assets.push({id:t,required:r?1:0,data:{type:e,len:i}}),this}withSponsored(e=80,t=!0){return this.withData(r.Bz.SPONSORED,r.vU.SPONSORED,e,t)}withDescription(e=80,t=!0){return this.withData(r.Bz.DESC,r.vU.DESC,e,t)}withRating(e=80,t=!0){return this.withData(r.Bz.RATING,r.vU.RATING,e,t)}withPrice(e=80,t=!0){return this.withData(r.Bz.PRICE,r.vU.PRICE,e,t)}withSalePrice(e=80,t=!0){return this.withData(r.Bz.SALEPRICE,r.vU.SALEPRICE,e,t)}withDisplayUrl(e=80,t=!0){return this.withData(r.Bz.DISPLAYURL,r.vU.DISPLAYURL,e,t)}withCtaText(e=80,t=!0){return this.withData(r.Bz.CTATEXT,r.vU.CTATEXT,e,t)}withCategory(e=80,t=!0){return this.withData(r.Bz.SURF_CATEGORY,r.vU.SURF_CATEGORY,e,t)}withTHC(e=80,t=!0){return this.withData(r.Bz.SURF_THC,r.vU.SURF_THC,e,t)}withCBD(e=80,t=!0){return this.withData(r.Bz.SURF_CBD,r.vU.SURF_CBD,e,t)}withStrain(e=80,t=!0){return this.withData(r.Bz.SURF_STRAIN,r.vU.SURF_STRAIN,e,t)}withMetaProduct(e=80,t=!0){return this.withData(r.Bz.SURF_META_PRODUCT,r.vU.SURF_META_PRODUCT,e,t)}withEventTracker(e,t){return void 0===this._request.eventtrackers&&(this._request.eventtrackers=[]),this._request.eventtrackers.push({event:e,methods:t}),this}build(){return this._request}}},8906:(e,t,i)=>{"use strict";i.d(t,{Bz:()=>n.Bz,Im:()=>o.I,JQ:()=>n.JQ,JY:()=>n.JY,LO:()=>r.L,Lp:()=>n.Lp,Ph:()=>n.Ph,bU:()=>n.bU,i_:()=>n.i_,qU:()=>n.qU,vU:()=>n.vU,wf:()=>n.wf});var r=i(7973),o=i(3839),n=i(9946)},102:(e,t,i)=>{"use strict";i.d(t,{S:()=>r});class r{constructor(e,t){var i;this._selector=e,this.logger=t,null===(i=this.logger)||void 0===i||i.info("OverrideService.constructor"),this.overrideNode=this.getOverrideNode(),null!==this.overrideNode?this.overrideData=this.mapDataSetToData(this.overrideNode.dataset):this.overrideData=null}getOverrideNode(){return document.querySelector(this._selector)}}},4545:(e,t,i)=>{"use strict";i.d(t,{$9:()=>s.$9,$b:()=>r.$,Dj:()=>s.Dj,EJ:()=>s.EJ,I:()=>s.I,L8:()=>r.L,MM:()=>s.MM,N8:()=>s.N8,RT:()=>s.RT,Vh:()=>o.V,WX:()=>n.W,j8:()=>o.j,td:()=>s.td,wh:()=>l.w});var r=i(3642),o=i(6458),n=i(7327),l=i(220),s=i(9955)},386:(e,t,i)=>{"use strict";var r;i.d(t,{$:()=>r}),function(e){e[e.NONE=0]="NONE",e[e.ERRORS=1]="ERRORS",e[e.INFO=2]="INFO",e[e.DEBUG=3]="DEBUG"}(r||(r={}))},8382:(e,t,i)=>{"use strict";i.d(t,{L:()=>n});var r=i(8658),o=i(4545);class n{constructor(e){this._logLevel=e,this.debug("Logging enabled")}debug(...e){this._logLevel>=o.$b.DEBUG&&this._log(console.log,e,r.$J.MAGIC_MINT)}info(...e){this._logLevel>=o.$b.INFO&&this._log(console.log,e,r.$J.LAVENDER)}warn(...e){this._logLevel>=o.$b.INFO&&this._log(console.warn,e,r.$J.SOFT_GOLD)}error(...e){this._logLevel>=o.$b.ERRORS&&this._log(console.error,e,r.$J.ULTRA_RED)}_log(e,t,i){t.unshift(`border-radius: 3px; margin-left: 10px; background: ${i}; font-size: 12px; font-weight: bold;`),t.unshift("%c [SURF] "),e.apply(console,t)}}},3642:(e,t,i)=>{"use strict";i.d(t,{$:()=>r.$,L:()=>o.L});var r=i(386),o=i(8382)},4227:(e,t,i)=>{"use strict";i.d(t,{w:()=>n});var r=i(9266),o=i(8658);class n{constructor(e,t){var i;this._logger=t,null===(i=this._logger)||void 0===i||i.info("SurfsideProductFeedService.constructor initialized",this),this._url=(0,r.r)(e)}async getProduct(e,t,i,r){var n,l,s,u,a;try{null===(n=this._logger)||void 0===n||n.info("SurfsideProductFeedService.getProduct request",e,t,i,r);const a=await fetch(`${this._url}product/${e}/${i}/${r}.json`);if(a.status!==o.t3.OK)return null;const d=await a.json();if(void 0!==d.quantity&&0===d.quantity)return null===(l=this._logger)||void 0===l||l.warn("SurfsideProductFeedService.getProduct quantity is 0; skipping.",d),null;null===(s=this._logger)||void 0===s||s.debug("SurfsideProductFeedService.getProduct response",d);const c=this._mapResponseToProductInformation(d);return null===(u=this._logger)||void 0===u||u.debug("SurfsideProductFeedService.getProduct mapped",c),c}catch(e){return null===(a=this._logger)||void 0===a||a.warn("SurfsideProductFeedService.getProduct Failed to get product! got",e),null}}async getNativeProduct(e,t,i,r){var n,l,s,u;null===(n=this._logger)||void 0===n||n.info("SurfsideProductFeedService.getProduct request",e,t,i,r);try{const t=await fetch(`${this._url}native/${e}/${i}/${r}.json`);if(t.status!==o.t3.OK)return null;const n=await t.json();null===(l=this._logger)||void 0===l||l.debug("SurfsideProductFeedService.getProduct response",n);const u=this._mapResponseToProductInformation(n);return null===(s=this._logger)||void 0===s||s.debug("SurfsideProductFeedService.getProduct mapped",u),u}catch(e){return null===(u=this._logger)||void 0===u||u.warn("SurfsideProductFeedService.getNativeProduct Failed to get product! got",e),null}}_mapResponseToProductInformation(e){return{image:this._getFieldOrNull(e,"image_link"),price:this._getFieldOrNull(e,"price"),salePrice:this._getFieldOrNull(e,"sale_price"),thc:this._getFieldOrNull(e,"thc"),cbd:this._getFieldOrNull(e,"cbd"),strain:this._getFieldOrNull(e,"strain"),name:this._getFieldOrNull(e,"name"),brand_name:this._getFieldOrNull(e,"brand"),brandName:this._getFieldOrNull(e,"brand"),productType:this._getFieldOrNull(e,"productType"),details:this._getFieldOrNull(e,"details"),cta:this._getFieldOrNull(e,"cta"),clickthroughUrl:this._getFieldOrNull(e,"clickthroughUrl"),winUrl:this._getFieldOrNull(e,"winUrl"),pixelUrl:this._getFieldOrNull(e,"pixelUrl"),ext:e}}_getFieldOrNull(e,t){return t in e?String(e[t]):null}}},220:(e,t,i)=>{"use strict";i.d(t,{w:()=>r.w});var r=i(4227)},3e3:(e,t,i)=>{"use strict";i.d(t,{W:()=>n});var r,o=i(9266);!function(e){e.TOP_ALL="top-products",e.FOR_YOU="for-you",e.PAST_PURCHASE="buy-again"}(r||(r={}));class n{constructor(e,t,i){var r;this._productFeedService=t,this._logger=i,this._cache=new Map,null===(r=this._logger)||void 0===r||r.info("SurfsideRecommenderService.constructor initialized",this),this._url=(0,o.r)(e)}async getTopProducts(e,t,i,o){var n;return null===(n=this._logger)||void 0===n||n.info("SurfsideRecommenderService.getTopProducts request",e,t,i),await this._fetchRecommendations(e,t,i,null,r.TOP_ALL,o)}async*generateTopProduct(e,t,i){var o;null===(o=this._logger)||void 0===o||o.info("SurfsideRecommenderService.generateTopProduct request",e,t,i),yield*this._generateProductRecommendation(e,t,i,null,r.TOP_ALL)}async getForYou(e,t,i,o,n){var l;return null===(l=this._logger)||void 0===l||l.info("SurfsideRecommenderService.getForYou request",e,t,i,o),await this._fetchRecommendations(e,t,i,o,r.FOR_YOU,n)}async*generateForYou(e,t,i,o){var n;null===(n=this._logger)||void 0===n||n.info("SurfsideRecommenderService.generateForYou request",e,t,i,o),yield*this._generateProductRecommendation(e,t,i,o,r.FOR_YOU)}async getPreviousPurchases(e,t,i,o,n){var l;return null===(l=this._logger)||void 0===l||l.info("SurfsideRecommenderService.getPreviousPurchases request",e,t,i,o),await this._fetchRecommendations(e,t,i,o,r.PAST_PURCHASE,n)}async*generatePreviousPurchase(e,t,i,o){var n;null===(n=this._logger)||void 0===n||n.info("SurfsideRecommenderService.generatePreviousPurchase request",e,t,i,o),yield*this._generateProductRecommendation(e,t,i,o,r.PAST_PURCHASE)}async*_generateProductRecommendation(e,t,i,r,o){var n,l,s;null===(n=this._logger)||void 0===n||n.info("SurfsideRecommenderService._generateProductRecommendation request",e,t,i,r,o);const u=await this._fetchRecommendationList(e,t,i,r,o);null!==u?(yield*this._generateProduct(e,t,i,u),null===(s=this._logger)||void 0===s||s.debug("SurfsideRecommenderService._generateProductRecommendation No more products, exiting",e,t,i,r,o)):null===(l=this._logger)||void 0===l||l.warn("SurfsideRecommenderService._generateProductRecommendation No recommendations available",e,t,i,r,o)}async _fetchRecommendations(e,t,i,r,o,n){var l,s;null===(l=this._logger)||void 0===l||l.debug("SurfsideRecommenderService._fetchRecommendations request",e,t,i,r,o);const u=`accountId=${e}&siteId=${t}&locationId=${i}&userId=${null!=r?r:"null"}&type=${o}`,a=this._cache.get(u);if(void 0!==a){const[e,t]=a,i=[];let r=t;for(r=t;r<t+n;r++)i.push(e[r%e.length]);return r%=e.length,this._cache.set(u,[e,r]),i}const d=await(await fetch(`${this._url.toString()}r/${o}/?accountId=${e}&siteId=${t}&locationId=${i}&user=${r}&limit=100`+(null===r?"":`&userId=${r}`))).json();if(void 0!==d.error)return null===(s=this._logger)||void 0===s||s.warn("SurfsideRecommenderService._fetchRecommendations no results",d),null;{const e=d;return this._cache.set(u,[e,n]),e.splice(0,n)}}async _fetchRecommendationList(e,t,i,r,o){var n,l,s;null===(n=this._logger)||void 0===n||n.debug("SurfsideRecommenderService._fetchRecommendations request",e,t,i,r,o);try{const n=await(await fetch(`${this._url.toString()}r/${o}/?accountId=${e}&siteId=${t}&locationId=${i}&user=${r}&limit=100`+(null===r?"":`&userId=${r}`))).json();return void 0!==n.error?(null===(l=this._logger)||void 0===l||l.warn("SurfsideRecommenderService._fetchRecommendations no results",n),null):n}catch(e){return null===(s=this._logger)||void 0===s||s.error(e),null}}async*_generateProduct(e,t,i,r){var o,n,l,s,u,a,d;null===(o=this._logger)||void 0===o||o.info("SurfsideRecommenderService._generateProduct entering generation request",e,t,i,r);for(const o of r){const r=o.item_id;try{null===(n=this._logger)||void 0===n||n.debug("SurfsideRecommenderService._generateProduct itemId",r,e,t,i);const o=await this._productFeedService.getProduct(e,t,i,r);if(null===(l=this._logger)||void 0===l||l.debug("SurfsideRecommenderService._generateProduct product",o,e,t,i),null===o){null===(u=this._logger)||void 0===u||u.warn("SurfsideRecommenderService._generateProduct product is null",e,t,i);continue}null===(s=this._logger)||void 0===s||s.debug("SurfsideRecommenderService._generateProduct product is not null",e,t,i),yield o}catch(e){null===(a=this._logger)||void 0===a||a.warn("SurfsideRecommenderService._generateProduct Missing product from recommender: ",r);continue}}null===(d=this._logger)||void 0===d||d.debug("SurfsideRecommenderService._generateProduct no more products, exiting",e,t,i)}}},7327:(e,t,i)=>{"use strict";i.d(t,{W:()=>r.W});var r=i(3e3)},2961:(e,t,i)=>{"use strict";i.d(t,{j:()=>a});var r=i(8658),o=i(110),n=i(9266),l=i(3957);const s=/(?:\$|%24)?(?:\{|%7b)auction_price(?:\}|%7d)/gi,u=/(?:\$|%24)?(?:\{|%7b)location_id(?:\}|%7d)/gi;class a{constructor(e,t,i,r,o,l){var s;this._configService=t,this._geoService=i,this._deviceService=r,this._userService=o,this._logger=l,null===(s=this._logger)||void 0===s||s.info("SurfsideBidderService.constructor initialized",this),this._url=(0,n.r)(e)}async requestBids(e){var t,i,n,a,d,c,v,h,f,p,g,m,_,S,w,E;null===(t=this._logger)||void 0===t||t.info("SurfsideBidderService.bid request",e);const b=null===(i=e.ext)||void 0===i?void 0:i.accountId,I=null===(n=e.ext)||void 0===n?void 0:n.siteId;if(void 0!==b&&void 0!==I){const t=await this._configService.getConfiguration(b,I);null!==t&&(e=await(0,l.Fp)(this._geoService,this._logger,e,t.settings.geoTargetingEnabled,t.settings.ipTargetingEnabled),e=await(0,l.tX)(this._logger,this._deviceService,e),e=await(0,l.Tw)(this._userService,this._logger,e))}const R=await fetch(this._url,{method:"POST",body:JSON.stringify(e)});if(null===(a=this._logger)||void 0===a||a.debug("SurfsideBidderService.bid response",R),null===(d=this._logger)||void 0===d||d.debug("SurfsideBidderService.bid response status",R.status),R.status!==r.t3.OK){const e=null!==(c=R.status===r.t3.NO_CONTENT?R.headers.get("X-REASON"):await R.text())&&void 0!==c?c:`${R.status} - ${R.statusText}`;throw null===(v=this._logger)||void 0===v||v.debug("SurfsideBidderService.bid response no-bid reason:",e),new o.e(e)}const T=await R.json();for(let t=0;t<(null!==(f=null===(h=T.seatbid)||void 0===h?void 0:h.length)&&void 0!==f?f:0);t++){const i=null===(p=T.seatbid)||void 0===p?void 0:p[t];for(let t=0;t<(null!==(g=null==i?void 0:i.bid.length)&&void 0!==g?g:0);t++){const r=null==i?void 0:i.bid[t];if(void 0!==r)try{r.adm=decodeURIComponent(null!==(m=null==r?void 0:r.adm)&&void 0!==m?m:"").replaceAll(/\\"/gi,'"'),r.nurl=null===(_=r.nurl)||void 0===_?void 0:_.replace(s,r.price.toString()),r.adm=r.adm.replaceAll(s,r.price.toString());const t=e.ext.locationId;void 0===t?null===(S=this._logger)||void 0===S||S.warn("Location ID missing from bid request"):(r.adm=r.adm.replaceAll(u,t),r.nurl=null===(w=r.nurl)||void 0===w?void 0:w.replace(u,t))}catch(e){continue}}}return null===(E=this._logger)||void 0===E||E.debug("SurfsideBidderService.bid bidResponse",T),T}}},785:(e,t,i)=>{"use strict";i.d(t,{j:()=>r.j});var r=i(2961)},7797:(e,t,i)=>{"use strict";i.d(t,{V:()=>o});var r=i(9266);class o{constructor(e,t,i){var o;this._handlebars=t,this._logger=i,null===(o=this._logger)||void 0===o||o.info("SurfsideConfigurationService.constructor initialized",this),this._url=(0,r.r)(e)}async getConfiguration(e,t){var i,r,o,n;null===(i=this._logger)||void 0===i||i.info("SurfsideConfigurationService.getConfiguration request",e,t);const l=await fetch(this._url+`${e}/${t}/config.json`);if(!l.ok)return null===(r=this._logger)||void 0===r||r.error("SurfsideConfigurationService.getConfiguration failed to fetch",l),null;const s=await l.json();return void 0===s.settings||void 0===s.templates?(null===(o=this._logger)||void 0===o||o.debug("SurfsideConfigurationService.getConfiguration response was invalid format!",s),null):(null===(n=this._logger)||void 0===n||n.debug("SurfsideConfigurationService.getConfiguration response",s),await this._mapConfig(s))}async _mapConfig(e){var t,i,r,o,n,l,s,u,a;return null===(t=this._logger)||void 0===t||t.debug("IConfigurationService.mapConfig mapping:",e),{settings:e.settings,templates:{clickThroughUrlTemplate:this._handlebars.template((await this._importModule(`export default ${null!==(r=null===(i=e.templates)||void 0===i?void 0:i.clickThroughUrlTemplate)&&void 0!==r?r:""}`)).default),productCardTemplate:this._handlebars.template((await this._importModule(`export default ${null!==(n=null===(o=e.templates)||void 0===o?void 0:o.productCardTemplate)&&void 0!==n?n:""}`)).default),javascriptCallbacks:await this._importModule(null!==(s=null===(l=e.templates)||void 0===l?void 0:l.javascriptCallbacks)&&void 0!==s?s:""),productCardStylesheet:null===(u=e.templates)||void 0===u?void 0:u.productCardStylesheet,carouselStylesheet:null===(a=e.templates)||void 0===a?void 0:a.carouselStylesheet}}}async _importModule(e){var t,i,r;null===(t=this._logger)||void 0===t||t.debug("IConfigurationService.importDynamicModule importing:",e);const o=new Blob([e],{type:"text/javascript"}),n=URL.createObjectURL(o);null===(i=this._logger)||void 0===i||i.debug("IConfigurationService.importDynamicModule moduleUrl",n);const l=await import(/* webpackIgnore: true */n);return null===(r=this._logger)||void 0===r||r.debug("IConfigurationService.importDynamicModule module:",l),l}}},2551:(e,t,i)=>{"use strict";i.d(t,{V:()=>r.V});var r=i(7797)},6458:(e,t,i)=>{"use strict";i.d(t,{V:()=>o.V,j:()=>r.j});var r=i(785),o=i(2551)},4423:(e,t,i)=>{"use strict";i.d(t,{M:()=>o});var r=i(102);class o extends r.S{constructor(e){var t;super("div#surf-device-override",e),null===(t=this.logger)||void 0===t||t.info("DeviceOverrideService.constructor")}async getDeviceInfo(){const e=this.getOverrideNode();return void 0===(null==e?void 0:e.dataset)||(this.overrideData=this.mapDataSetToData(e.dataset)),this.overrideData}mapDataSetToData(e){var t,i,r,o,l;const{ua:s,dnt:u,ip:a,ipv6:d,devicetype:c,make:v,model:h,os:f,osv:p,h:g,w:m,language:_}=e,S={ua:s,dnt:"true"===(null==u?void 0:u.toLowerCase())?1:0,ip:a,ipv6:d,devicetype:n(c),make:v,model:h,os:f,osv:p,h:n(g),w:n(m),language:_},w=null!==(i=null===(t=this.overrideNode)||void 0===t?void 0:t.querySelector("div#surf-device-sua-override"))&&void 0!==i?i:null;if(null===w)return S;const{mobile:E,architecture:b,bitness:I,useragentmodel:R,source:T}=w.dataset,O="true"===(null==E?void 0:E.toLowerCase())?1:0,C="true"===(null==T?void 0:T.toLowerCase())?1:0;let y;const N=[...w.querySelectorAll("div.surf-device-sua-browser-override")];if(N.length>0){y=[];for(const e of N){const{brand:t,version:i}=e.dataset;void 0!==t?y.push({brand:t,version:null==i?void 0:i.split(",")}):null===(r=this.logger)||void 0===r||r.warn("DeviceOverrideService.mapDataSetToData Browser brandInfo is missing brand field. Skipping browser override")}}let D;const A=null!==(o=w.querySelector("div#surf-device-sua-platform-override"))&&void 0!==o?o:null;if(null!==A){const{brand:e,version:t}=A.dataset;void 0===e?null===(l=this.logger)||void 0===l||l.warn("DeviceOverrideService.mapDataSetToData Platform brandinfo is missing brand field. Skipping platform override"):D={brand:e,version:null==t?void 0:t.split(",")}}const P={mobile:O,architecture:b,bitness:I,model:R,source:C,browsers:y,platform:D};return S.sua=P,S}}function n(e){if(void 0===e)return;const t=Number(e);return isNaN(t)?void 0:t}},5550:(e,t,i)=>{"use strict";i.d(t,{E:()=>a,t:()=>n});var r=i(4423),o=i(6131);class n extends r.M{constructor(e){super(e),null==e||e.info("SurfsideDeviceService.constructor")}async getDeviceInfo(){var e,t;const i=await super.getDeviceInfo();if(null!==i)return i;const r=l()?1:0,o=a();null!==o&&(null===(e=this.logger)||void 0===e||e.warn("SurfsideDeviceService.getDeviceInfo failure; TryGetDeviceInfo() returned null"));const n={model:null==o?void 0:o.model,mobile:r,browsers:void 0!==(null==o?void 0:o.browser)?[o.browser]:void 0,platform:void 0!==(null==o?void 0:o.os)?{brand:null==o?void 0:o.os,version:null===(t=null==o?void 0:o.osv)||void 0===t?void 0:t.split(".")}:void 0,architecture:u(navigator.userAgent),source:3};return{make:null==o?void 0:o.make,model:null==o?void 0:o.model,w:screen.width,h:screen.height,language:navigator.language,ua:navigator.userAgent,devicetype:s(),os:null==o?void 0:o.os,osv:null==o?void 0:o.osv,sua:n}}}function l(){return void 0!==window.ontouchstart}function s(){const e=l();if(!e)return o.V5.PC;const t=window.screen.width,i=window.screen.height,[r,n]=[t,i].sort(((e,t)=>e-t));return e&&r>=600&&n>=960?o.V5.TABLET:o.V5.MOBILE}function u(e){return/Win64|x64|x86_64|WOW64/.test(e)?"x64":/Win32|x86/.test(e)?"x86":/aarch64|arm64/.test(e)?"ARM64":/armv\d+/.test(e)||l()?"ARM":void 0}function a(){var e,t,i,r,o,n;const l=navigator.userAgent,s=l.toLowerCase();let u={};return s.includes("android")?u={...d(l)}:s.includes("iphone")||s.includes("ipad")?u={...c(l)}:s.includes("windows nt")?u={make:"Microsoft",model:"Windows",os:"Windows",osv:null===(t=null===(e=/Windows NT (?<osv>[0-9.]+)/gi.exec(l))||void 0===e?void 0:e.groups)||void 0===t?void 0:t.osv}:s.includes("macintosh")&&(u={make:"Apple",model:"Macintosh",os:"MacOS",osv:null===(o=null===(r=null===(i=/Mac OS X (?<osv>[0-9_]+)/gi.exec(l))||void 0===i?void 0:i.groups)||void 0===r?void 0:r.osv)||void 0===o?void 0:o.replaceAll("_",".")}),u.browser=null!==(n=function(e){var t,i,r;try{let o,n;if(e.includes("Firefox/"))o=e.split("Firefox/")[1],n="Firefox";else if(e.includes("Chrome/"))o=null===(t=e.split("Chrome/")[1])||void 0===t?void 0:t.split(" ")[0],n="Chrome";else if(e.includes("CriOS"))o=null===(i=e.split("CriOS/")[1])||void 0===i?void 0:i.split(" ")[0],n="Chrome";else if(e.includes("Safari/")&&!e.includes("Chrome"))o=null===(r=e.split("Version/")[1])||void 0===r?void 0:r.split(" ")[0],n="Safari";else{if(!e.includes("Edg/"))return null;o=e.split("Edg/")[1],n="Edge"}return{brand:n,version:o.split(".")}}catch(e){return null}}(navigator.userAgent))&&void 0!==n?n:void 0,u}function d(e){var t,i;const r=/^[^\s]+\s\((?<Linux>.*);\s*(?<osv>[^)]+);\s*(?<Model>[^)]+)\)/gi.exec(e),o=null===(t=null==r?void 0:r.groups)||void 0===t?void 0:t.osv,n=null===(i=null==r?void 0:r.groups)||void 0===i?void 0:i.Model;let l;return void 0!==n&&(l=n.includes("Pixel")?"Google":n.includes("SM-")?"Samsung":n.startsWith("LG-")?"LG":n.startsWith("moto")?"Motorola":n.startsWith("Redmi")?"Xiaomi":"Android"),{os:"Android",osv:o,model:n,make:l}}function c(e){var t,i,r,o;const n=/^[^\s]+\s*\((?<Device>[^;]+);\s(?<Model>[^;)]+[;)])\s(?<ModelExt>[^;)]+[;)])?/gi.exec(e),l=null===(t=null==n?void 0:n.groups)||void 0===t?void 0:t.Device;let s;void 0!==l&&(s=l.toLowerCase().includes("ipad")?"iPad":"iPhone");let u,a=null===(i=null==n?void 0:n.groups)||void 0===i?void 0:i.Model;if("U"===a&&(a=null===(r=null==n?void 0:n.groups)||void 0===r?void 0:r.ModelExt),void 0!==a){const e=/OS (?<ver>[0-9_]+)/gi.exec(a);u=null===(o=null==e?void 0:e.groups)||void 0===o?void 0:o.ver}return{make:"Apple",model:s,os:"iOS",osv:u}}},9442:(e,t,i)=>{"use strict";i.d(t,{EJ:()=>o.E,MM:()=>r.M,td:()=>o.t});var r=i(4423),o=i(5550)},9225:(e,t,i)=>{"use strict";i.d(t,{N:()=>s});var r,o=i(9266);!function(e){e.NEW_TRACKER="newTracker",e.BID_REQUESTED="bidRequested",e.BIDDER_DONE="bidderDone"}(r||(r={}));const n="ads",l="surf";class s{constructor(e={lazyLoad:!1,appId:n},t){var i,s,u,a,d,c,v,h;if(this._logger=t,null===(i=this._logger)||void 0===i||i.info("SurfsideEventService.constructor"),this._appId=null!==(s=e.appId)&&void 0!==s?s:n,this._collectorUrl=(0,o.r)(null!==(u=e.collectorUrl)&&void 0!==u?u:"//col.surfside.io"),e.lazyLoad&&void 0===window.surf){this._src=(0,o.r)(e.src),window.surfContext=null!==(a=window.surfContext)&&void 0!==a?a:[],window.surfContext.push("surf"),window.surf=function(){var e;void 0!==window.surf&&(window.surf.q=null!==(e=window.surf.q)&&void 0!==e?e:[]).push(arguments)},this._surf=window.surf,window.surf.q=null!==(d=window.surf.q)&&void 0!==d?d:[];const t=document.createElement("script");t.src=this._src,t.async=!0,t.onload=()=>{var t,i,o,s;null===(t=this._logger)||void 0===t||t.info("SurfsideEventService script loaded"),this._surf=window.surf,this._surf(`${r.NEW_TRACKER}:${this._appId}`,null!==(i=e.appId)&&void 0!==i?i:n,this._collectorUrl,{appId:null!==(o=e.appId)&&void 0!==o?o:n,cookieName:null!==(s=e.cookieName)&&void 0!==s?s:l,discoverRootDomain:!0,cookieSameSite:"Lax"})},document.head.appendChild(t)}else this._surf=window.surf,this._surf(`${r.NEW_TRACKER}:${this._appId}`,null!==(c=e.appId)&&void 0!==c?c:n,this._collectorUrl,{appId:null!==(v=e.appId)&&void 0!==v?v:n,cookieName:null!==(h=e.cookieName)&&void 0!==h?h:l,discoverRootDomain:!0,cookieSameSite:"Lax"})}async raiseBidRequested(e){var t,i,o,n,l;null===(t=this._logger)||void 0===t||t.info("SurfsideEventService.raiseBidRequested"),null===(i=this._logger)||void 0===i||i.debug("SurfsideEventService.raiseBidRequested",e);const s=e.id;null===(o=this._logger)||void 0===o||o.info("SurfsideEventService.raiseBidRequested requestId",s);const u={auctionId:s,bidderRequestId:s,bids:null===(n=e.imp)||void 0===n?void 0:n.map((t=>{var i,r,o,n,l,s,u,a,d,c,v,h,f,p,g,m,_,S,w,E,b,I;return{params:{accountId:null!==(r=null===(i=e.ext)||void 0===i?void 0:i.accountId)&&void 0!==r?r:null,channelId:null!==(n=null===(o=e.ext)||void 0===o?void 0:o.channelId)&&void 0!==n?n:null,siteId:null!==(s=null===(l=e.ext)||void 0===l?void 0:l.siteId)&&void 0!==s?s:null,placementId:null!==(a=null===(u=e.ext)||void 0===u?void 0:u.zoneId)&&void 0!==a?a:null,zone:null!==(c=null===(d=e.ext)||void 0===d?void 0:d.zone)&&void 0!==c?c:null,type:null!==(h=null===(v=e.ext)||void 0===v?void 0:v.type)&&void 0!==h?h:null,storeId:null!==(p=null===(f=e.ext)||void 0===f?void 0:f.storeId)&&void 0!==p?p:null},user:void 0!==(null===(g=null==e?void 0:e.user)||void 0===g?void 0:g.geo)?{geo:e.user.geo}:void 0,ortb2Imp:{ext:{tid:void 0!==(null===(m=null==e?void 0:e.source)||void 0===m?void 0:m.tid)?e.source.tid:""}},mediaTypes:{banner:void 0!==(null===(_=null==t?void 0:t.banner)||void 0===_?void 0:_.w)&&void 0!==(null===(S=null==t?void 0:t.banner)||void 0===S?void 0:S.h)?{sizes:[[t.banner.w,t.banner.h]]}:void 0},transactionId:null!==(E=null===(w=null==e?void 0:e.source)||void 0===w?void 0:w.tid)&&void 0!==E?E:"",sizes:void 0!==(null===(b=null==t?void 0:t.banner)||void 0===b?void 0:b.w)&&void 0!==(null===(I=null==t?void 0:t.banner)||void 0===I?void 0:I.h)?[[t.banner.w,t.banner.h]]:[[0,0]],bidId:t.id,ortb2:{site:{domain:window.location.hostname,page:window.location.pathname},device:{w:window.screen.width,h:window.screen.height,dnt:0,ua:window.navigator.userAgent,language:window.navigator.language}}}})),auctionStart:Date.now(),timeout:0,refererInfo:{stack:[document.referrer],location:window.location.href,page:window.location.href,domain:window.location.hostname},start:Date.now()};null===(l=this._logger)||void 0===l||l.debug("SurfsideEventService.raiseBidRequested snowplowBidRequestPayload",u),this._surf(`${r.BID_REQUESTED}:${this._appId}`,u)}async raiseBidResponded(e,t){var i,o,n,l;null===(i=this._logger)||void 0===i||i.info("SurfsideEventService.raiseBidderDone"),null===(o=this._logger)||void 0===o||o.debug("SurfsideEventService.raiseBidderDone",e);const s=void 0!==(null==e?void 0:e.seatbid)?null===(n=e.seatbid[0])||void 0===n?void 0:n.bid:[],u={auctionId:t.id,bidderRequestId:t.id,bids:s.map((i=>{var r,o,n,l,s,u,a,d,c,v,h,f,p,g,m,_,S,w,E,b,I,R,T,O,C,y,N,D;return{params:{accountId:null!==(l=null!==(o=null===(r=e.ext)||void 0===r?void 0:r.accountId)&&void 0!==o?o:null===(n=t.ext)||void 0===n?void 0:n.accountId)&&void 0!==l?l:null,channelId:null!==(d=null!==(u=null===(s=e.ext)||void 0===s?void 0:s.channelId)&&void 0!==u?u:null===(a=t.ext)||void 0===a?void 0:a.channelId)&&void 0!==d?d:null,siteId:null!==(f=null!==(v=null===(c=e.ext)||void 0===c?void 0:c.siteId)&&void 0!==v?v:null===(h=t.ext)||void 0===h?void 0:h.siteId)&&void 0!==f?f:null,placementId:null!==(_=null!==(g=null===(p=e.ext)||void 0===p?void 0:p.zoneId)&&void 0!==g?g:null===(m=t.ext)||void 0===m?void 0:m.zoneId)&&void 0!==_?_:null,zone:null!==(b=null!==(w=null===(S=e.ext)||void 0===S?void 0:S.zone)&&void 0!==w?w:null===(E=t.ext)||void 0===E?void 0:E.zone)&&void 0!==b?b:null,type:null!==(O=null!==(R=null===(I=e.ext)||void 0===I?void 0:I.type)&&void 0!==R?R:null===(T=t.ext)||void 0===T?void 0:T.type)&&void 0!==O?O:null,storeId:null!==(D=null!==(y=null===(C=e.ext)||void 0===C?void 0:C.storeId)&&void 0!==y?y:null===(N=t.ext)||void 0===N?void 0:N.storeId)&&void 0!==D?D:null},bidId:i.id,transactionId:i.impid,ortb2:{site:{domain:window.location.hostname,page:window.location.pathname},device:{w:window.screen.width,h:window.screen.height,dnt:0,ua:window.navigator.userAgent,language:window.navigator.language}},ortb2Imp:{},sizes:void 0!==i.w&&void 0!==i.h?[[i.w,i.h]]:[[0,0]],mediaTypes:void 0!==i.w&&void 0!==i.h?{banner:{sizes:[[i.w,i.h]]}}:{}}})),auctionStart:0,refererInfo:{stack:[document.referrer],location:window.location.href,page:window.location.href,domain:window.location.hostname},timeout:0,start:Date.now()};null===(l=this._logger)||void 0===l||l.debug("SurfsideEventService.raiseBidderDone snowplowBidderDoneEvent",u),this._surf(`${r.BIDDER_DONE}:${this._appId}`,u)}}},4305:(e,t,i)=>{"use strict";i.d(t,{N:()=>r.N});var r=i(9225)},2781:(e,t,i)=>{"use strict";i.d(t,{D:()=>o});var r=i(102);class o extends r.S{constructor(e){super("div#surf-geo-override",e)}mapDataSetToData(e){var t,i,r,o,n;null===(t=this.logger)||void 0===t||t.info("GeoOverrideService.mapDataSetToData");const{country:l,region:s,city:u,zip:a,coords:d,utcoffset:c,ip:v}=e;if(void 0===c||void 0===l||void 0===d||void 0===s||void 0===u||void 0===a||void 0===v)return null===(i=this.logger)||void 0===i||i.warn("GeoOverrideService.mapDataSetToData missing a value in geo override, returning null"),null;const h=Number(c);if(isNaN(h))return null===(r=this.logger)||void 0===r||r.warn("GeoOverrideService.mapDataSetToData utcOffset is not a number, returning null"),null;const[f,p,g]=d.split(",").map((e=>Number(e)));if(void 0===f||isNaN(f)||void 0===p||isNaN(p)||void 0===g||isNaN(g))return null===(o=this.logger)||void 0===o||o.warn("GeoOverrideService.mapDataSetToData coords string is malformed, returning null"),null;const m={country:l,region:s,city:u,zip:a,coords:{latitude:f,longitude:p,accuracy:g},utcoffset:h,ip:v};return null===(n=this.logger)||void 0===n||n.warn("GeoOverrideService.mapDataSetToData override success",m),m}async getGeo(){const e=this.getOverrideNode();return void 0===(null==e?void 0:e.dataset)||(this.overrideData=this.mapDataSetToData(e.dataset)),this.overrideData}}},9058:(e,t,i)=>{"use strict";i.d(t,{I:()=>o});var r=i(2781);class o extends r.D{constructor(e){var t;super(e),null===(t=this.logger)||void 0===t||t.info("SurfsideGeoService.constructor initialized",this)}async getGeo(){var e,t,i;null===(e=this.logger)||void 0===e||e.info("SurfsideGeoService.getGeo");const r=await super.getGeo();if(null!==r)return r;try{const e=await fetch("https://g.surfside.io/enrich");return null===(t=this.logger)||void 0===t||t.debug("SurfsideGeoService.getGeo response",e),await e.json()}catch(e){return null===(i=this.logger)||void 0===i||i.error("Failed to get geolocation information",e),null}}}},6181:(e,t,i)=>{"use strict";i.d(t,{D:()=>o.D,I:()=>r.I});var r=i(9058),o=i(2781)},9955:(e,t,i)=>{"use strict";i.d(t,{$9:()=>o.$,Dj:()=>r.D,EJ:()=>l.EJ,I:()=>r.I,MM:()=>l.MM,N8:()=>n.N,RT:()=>o.R,td:()=>l.td});var r=i(6181),o=i(4831),n=i(4305),l=i(9442)},8831:(e,t,i)=>{"use strict";i.d(t,{R:()=>n});var r=i(1133);const o=/surfid.(?<site_hash>[a-z0-9]+)=(?<domain_userid>[^.]+).*/gi;class n extends r.${constructor(e){var t;super(e),null===(t=this.logger)||void 0===t||t.info("SurfsideUserIDService.constructor initialized")}async getUserId(){var e,t,i,r,n,l,s,u;null===(e=this.logger)||void 0===e||e.info("SurfsideUserIDService.getUserId");const a=null!==(s=null!==(t=await super.getUserId())&&void 0!==t?t:null===(l=null===(n=null===(r=null===(i=document.cookie.split(";").map((e=>e.trim())).filter((e=>e.startsWith("surfid."))).map((e=>e.matchAll(o))).map((e=>[...e])))||void 0===i?void 0:i[0])||void 0===r?void 0:r[0])||void 0===n?void 0:n.groups)||void 0===l?void 0:l.domain_userid)&&void 0!==s?s:null;return null===(u=this.logger)||void 0===u||u.debug("SurfsideUserIDService.getUserId userId",a),a}}},1133:(e,t,i)=>{"use strict";i.d(t,{$:()=>o});var r=i(102);class o extends r.S{constructor(e){var t;super("div#surf-user-override",e),null===(t=this.logger)||void 0===t||t.info("UserOverrideService.constructor initialized UserOverrideService")}async getUserId(){const e=this.getOverrideNode();return void 0===(null==e?void 0:e.dataset)||(this.overrideData=this.mapDataSetToData(e.dataset)),this.overrideData}mapDataSetToData(e){var t,i;return void 0===e.userid?(null===(t=this.logger)||void 0===t||t.warn("UserOverrideService.getUserId found userId Div block, but no userId was set.Hint: it needs dataset - userid"),null):(null===(i=this.logger)||void 0===i||i.debug(`UserOverrideService.getUserId found userId: ${e.userid}`),e.userid)}}},4831:(e,t,i)=>{"use strict";i.d(t,{$:()=>o.$,R:()=>r.R});var r=i(8831),o=i(1133)},7836:(e,t,i)=>{"use strict";function r(e){if(e.includes("://"))return e;const t=e.startsWith("//")?"":"//";let i=window.location.protocol;return i.startsWith("http")||(i="https:"),`${i}${t}${e}`}i.d(t,{r:()=>r})},4842:(e,t,i)=>{"use strict";i.d(t,{N7:()=>s,TT:()=>l,V0:()=>a,fc:()=>o});var r=i(9730);function o(e,t){null==t||t.info("InitHandlebars initializing"),n("slug",e,r.slug,t),n("lower",e,r.lower,t),n("path",e,r.path,t),n("search",e,r.search,t),n("coalesce",e,r.coalesce,t),n("sed",e,r.sed,t),n("join",e,r.join,t),n("uri",e,r.uri,t),n("eq",e,r.eq,t),n("or",e,r.or,t),n("and",e,r.and,t),n("in",e,r.isIn,t),n("array",e,r.array,t),n("global",e,r.global,t)}function n(e,t,i,r){null==r||r.debug(`Registering Handlebars Helper ${e}`),t.registerHelper(e,i)}function l(){const e=window.location;return{origin:e.origin,port:e.port,path:e.pathname,host:e.host,host_name:e.hostname,search:e.search,hash:e.hash,protocol:e.protocol}}function s(e,t,i,r,o={image:null,price:null,salePrice:null,thc:null,cbd:null,strain:null,name:null,brand_name:null,brandName:null,productType:null,details:null,cta:null,clickthroughUrl:null,winUrl:null,pixelUrl:null,ext:null}){return a(e,{product:null!=t?t:{},window:l(),catalog:o,publisher:i,ext:null==t?void 0:t.ext,clickthrough:r})}function u(e,t,i){const r=Array.from(e.querySelectorAll(`[_${i}_]`));for(const e of r){const r=t[e.getAttribute(`_${i}_`)];e.addEventListener(i,r)}}function a(e,t){const i=e(t,{helpers:{slug:r.slug,lower:r.lower,path:r.path,search:r.search,coalesce:r.coalesce,join:r.join,uri:r.uri,sed:r.sed,eq:r.eq,or:r.or,and:r.and,isIn:r.isIn,array:r.array}}),o=document.createElement("div");return o.innerHTML=i,u(o,t,"click"),u(o,t,"mousedown"),u(o,t,"loadeddata"),u(o,t,"error"),u(o,t,"touchend"),u(o,t,"touchstart"),u(o,t,"touchmove"),o}},9266:(e,t,i)=>{"use strict";i.d(t,{N7:()=>o.N7,TT:()=>o.TT,V0:()=>o.V0,fc:()=>o.fc,r:()=>r.r});var r=i(7836),o=i(4842)}},t={};function i(r){var o=t[r];if(void 0!==o)return o.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,i),n.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";i.r(r),i.d(r,{AdCom10DeviceTypes:()=>n.V5,AgentTypes:()=>n.ZV,BuildBanner:()=>u.BuildBanner,BuildBannerFromBid:()=>u.BuildBannerFromBid,BuildClickThroughUrl:()=>u.BuildClickThroughUrl,BuildNativeResponse:()=>u.BuildNativeResponse,BuildProductInfoFromElement:()=>u.BuildProductInfoFromElement,CollectN:()=>u.CollectN,CollectNAsync:()=>u.CollectNAsync,ContextSubTypes:()=>n.bU,ContextTypes:()=>n.Lp,DeserializeVast:()=>u.DeserializeVast,DeserializeVideo:()=>u.DeserializeVideo,DeviceMiddleware:()=>d.tX,DeviceOverrideService:()=>e.MM,Environment:()=>s.OH,EventTrackingMethods:()=>n.i_,EventTypes:()=>n.wf,GeoMiddlewareImmediate:()=>d.Fp,GeoOverrideService:()=>e.Dj,GetSafeUrl:()=>a.r,HttpStatus:()=>s.t3,HttpStatusClass:()=>s.DH,IPServices:()=>s.Ev,IdentityMiddleware:()=>d.Tw,LocalLoggerService:()=>e.L8,LocationType:()=>s.iF,LogLevel:()=>e.$b,NativeAssetId:()=>n.vU,NativeDataTypes:()=>n.Bz,NativeImageTypes:()=>n.qU,NativePosition:()=>n.JQ,NativeRequestBuilder:()=>n.Im,NativeResponseToProductInformation:()=>n.LO,NoBidResponseError:()=>l.e,PlacementTypes:()=>n.Ph,RenderAndBind:()=>a.V0,RenderTemplate:()=>a.N7,RequestBuilder:()=>u.RequestBuilder,SimpleBannerRequest:()=>u.SimpleBannerRequest,SurfColors:()=>s.$J,SurfsideBidderService:()=>e.j8,SurfsideConfigurationService:()=>e.Vh,SurfsideDeviceService:()=>e.td,SurfsideEventService:()=>e.N8,SurfsideGeoService:()=>e.I,SurfsideProductFeedService:()=>e.wh,SurfsideRecommenderService:()=>e.WX,SurfsideUserIDService:()=>e.RT,TryGetDeviceInfo:()=>e.EJ,UserOverrideService:()=>e.$9,VideoMimes:()=>n.JY,and:()=>u.and,array:()=>u.array,buildIdentityMiddleware:()=>d.NW,coalesce:()=>u.coalesce,eq:()=>u.eq,getNativeTemplateDelegateWindow:()=>a.TT,global:()=>u.global,initHandlebars:()=>a.fc,initSurfsideCore:()=>c,isIn:()=>u.isIn,join:()=>u.join,lower:()=>u.lower,or:()=>u.or,path:()=>u.path,search:()=>u.search,sed:()=>u.sed,slug:()=>u.slug,uri:()=>u.uri});var e=i(4545),t=i(3633),o=i.n(t),n=i(6131),l=i(110),s=i(8658),u=i(9730),a=i(9266),d=i(3957);function c(){const t=o().create(),i="true"===(r="surf_debug",null===(n=window.location.search.replace("?","").split("&").map((e=>e.split("="))).filter((e=>e[0]===r)).map((e=>e.length>1?e[1]:"true")))||void 0===n?void 0:n[0])?new e.L8(e.$b.DEBUG):void 0;var r,n;const l=new e.Vh("//r.surfside.io/",t,i),s=new e.I(i),u=new e.td(i),a=new e.RT(i),d=new e.j8("//bid.surfside.io/rtb/bids/surfside",l,s,u,a,i),c=new e.wh("//creative.surfside.io/",i);return{bidder:d,config:l,geo:s,productFeed:c,userId:a,recommender:new e.WX("//t.surfside.io/",c,i),events:new e.N8({lazyLoad:!0,src:"//cdn.surfside.io/sdk/1.0.0/edge.js"},i),device:u}}})(),r})()));
@@ -1,46 +0,0 @@
1
- export declare enum HttpStatus {
2
- OK = 200,
3
- NO_CONTENT = 204,
4
- BAD_REQUEST = 400,
5
- NOT_FOUND = 404,
6
- UNAUTHORIZED = 401,
7
- FORBIDDEN = 403
8
- }
9
- export declare enum HttpStatusClass {
10
- SUCCESS = 2,
11
- CLIENT_ERROR = 4,
12
- SERVER_ERROR = 5
13
- }
14
- export declare enum SurfColors {
15
- INDIGO = "#331c7a",
16
- ULTRAMARINE = "#1f69ff",
17
- AQUAMARINE = "#4ceaaa",
18
- ELECTRIC_LIME = "#c5f700",
19
- CRAYOLA = "#f7a800",
20
- ORANGE = "#f66d18",
21
- RED = "#e72024",
22
- LAVENDER = "#c0abff",
23
- ULTRA_RED = "#f97585",
24
- SOFT_GOLD = "#f4bd5d",
25
- MAGIC_MINT = "#baf7db",
26
- SKY_BLUE = "#7eceeb",
27
- CARIBBEAN_GREN = "#0dcc91",
28
- LAVENDER_GRAY = "#d3d3e0"
29
- }
30
- export declare enum IPServices {
31
- IP2LOCATION = 1,
32
- NEUSTAR = 2,
33
- MAXMIND = 3,
34
- NETACUITY = 4
35
- }
36
- export declare enum LocationType {
37
- GPS = 1,
38
- IP = 2,
39
- USER = 3
40
- }
41
- export declare enum Environment {
42
- PROD = "PROD",
43
- STAGING = "STAGING",
44
- LOCAL = "LOCAL",
45
- MOCK = "MOCK"
46
- }
@@ -1,3 +0,0 @@
1
- export declare class NoBidResponseError extends Error {
2
- constructor(message: string);
3
- }
@@ -1,2 +0,0 @@
1
- export declare function CollectN<T>(generator: Generator<T>, n: number): T[];
2
- export declare function CollectNAsync<T>(generator: AsyncGenerator<T>, n: number): Promise<T[]>;
@@ -1 +0,0 @@
1
- export * from './CollectN';