@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
@@ -1,124 +0,0 @@
1
- import type { IApp, IBanner, IBidRequest, IDevice, IImp, INative, IRegs, ISite, IUser, IVideo } from '../../models';
2
- declare enum BuilderCreativeType {
3
- BANNER = 0,
4
- VIDEO = 1,
5
- NATIVE = 2
6
- }
7
- interface IBuilderState<T, U> {
8
- currentCreative: T;
9
- type: U;
10
- imp: IImp;
11
- }
12
- export interface IBannerBuilderState extends IBuilderState<IBanner, BuilderCreativeType.BANNER> {
13
- }
14
- export interface IVideoBuilderState extends IBuilderState<IVideo, BuilderCreativeType.VIDEO> {
15
- }
16
- export interface INativeBuilderState extends IBuilderState<INative, BuilderCreativeType.NATIVE> {
17
- }
18
- /** Builds an OpenRTB 2.6 bid request */
19
- export declare class RequestBuilder {
20
- private readonly _request;
21
- private _builderState;
22
- /**
23
- *
24
- * @param id The ID of the request. If not provided, a random ID will be generated.
25
- */
26
- constructor(id?: string);
27
- /**
28
- *
29
- * @returns The built bid request
30
- */
31
- build(): IBidRequest;
32
- /**
33
- * Adds surfside-specific information to the top level bid request and all subsequent impression objects
34
- * @param accountId The account ID of the current store
35
- * @param siteId The site ID of the current store
36
- * @param locationId The location ID of the current store (i.e: the ID of the specific brick and mortar store)
37
- * @param zoneId The ID for the zone on the advertisement
38
- * @param channelId The channel ID being advertised on
39
- * @param keywords A set of keywords describing the content of the page.
40
- * @returns The builder instance
41
- */
42
- withSurfContext(accountId: string, siteId: string, locationId: string, zoneId: string, channelId?: string, keywords?: string[]): this;
43
- /**
44
- * Adds a banner impression to the request. If a creative is already being built,
45
- * it will be appended to the request.
46
- * @param w The width of the banner being requested
47
- * @param h The height of the banner being requested
48
- * @param options Other OpenRTB fields to include in the banner object.
49
- * @returns The builder instance
50
- */
51
- withBanner(w: number, h: number, options?: Partial<IBanner>): this;
52
- /**
53
- * Adds a video impression to the request. If a create is already being built,
54
- * it will be appended to the request
55
- * @param w The width of the video being requested
56
- * @param h The height of the video being requested
57
- * @param minduration The minimum duration of the video, in seconds
58
- * @param maxduration The maximum duration of the video, in seconds
59
- * @param mimes A list of MIME types supported by the video. Defaults to ['video/mp4', 'video/webm']
60
- * @param options Other OpenRTB fields to include in the video object
61
- * @returns The builder instance
62
- */
63
- withVideo(w: number, h: number, minduration: number, maxduration: number, mimes?: string[], options?: Partial<IVideo>): this;
64
- /**
65
- * Adds a native impression to the request. If a creative is already being built,
66
- * it will be appended to the request. Native requests are stringified JSON objects
67
- * in the OpenRTB Native 1.2 format. Use the NativeRequestBuilder to build these objects.
68
- * @param request The native request object, as a stringified JSON object
69
- * @param options Other OpenRTB fields to include in the native object
70
- * @returns The builder instance
71
- */
72
- withNative(request: string, options?: Partial<INative>): this;
73
- /**
74
- * Sets the bid floor on the current impression. This operates on each impression,
75
- * so it needs to be called again for each impression if multiple are present.
76
- * @param bidfloor The bid floor to set
77
- * @param bidfloorcur The currency of the bid floor. Defaults to 'USD'
78
- * @returns The builder instance
79
- */
80
- withBidFloor(bidfloor: number, bidfloorcur?: string): this;
81
- /**
82
- * Adds an extension to the current impression. Extensions are dynamically typed dictionaries
83
- * with options that are specific to the bidder. This operates on each impression, so it needs
84
- * to be called again for each impression if multiple are present.
85
- * @param ext The extension to add
86
- * @returns The builder instance
87
- */
88
- withImpExt(ext: any): this;
89
- /**
90
- * The site that the ad appears on.
91
- * @param site The site object. If not provided, a default site object will be created using the current hostname.
92
- * @returns The builder instance
93
- */
94
- withSite(site?: ISite): this;
95
- /**
96
- * The app that the ad appears in.
97
- * @param app The app object. If not provided, a default app object will be created using the current hostname.
98
- * @returns The builder instance
99
- */
100
- withApp(app?: IApp): this;
101
- /**
102
- * Information about the current user's device, including useragent, IP, make and model as well as geo information.
103
- * @param device The device object
104
- * @returns The builder instance
105
- */
106
- withDevice(device: IDevice): this;
107
- /**
108
- * Information about the current user. Geo information can be included here, but is different
109
- * from the device's geo information; this is the user's home location.
110
- * @param user The user object
111
- * @returns The builder instance
112
- */
113
- withUser(user: IUser): this;
114
- /**
115
- * Used if any data privacy regulations are relevant to the request (i.e: COPPA, GDPR, etc.)
116
- * @param regs The regs object
117
- * @returns The builder instance
118
- */
119
- withRegulations(regs: IRegs): this;
120
- private _appendBuilderState;
121
- private _appendImpression;
122
- private _generateId;
123
- }
124
- export {};
@@ -1,26 +0,0 @@
1
- import type { IApp, IBidRequest, IDevice, IImp, IRegs, ISite, ISource, IUser } from '../../models';
2
- export declare class SimpleBannerRequest implements IBidRequest {
3
- id: string;
4
- imp: IImp[];
5
- site?: ISite | undefined;
6
- app?: IApp | undefined;
7
- device?: IDevice | undefined;
8
- user?: IUser | undefined;
9
- test?: number | undefined;
10
- at?: number | undefined;
11
- tmax?: number | undefined;
12
- wseat?: string[] | undefined;
13
- bseat?: string[] | undefined;
14
- allimps?: number | undefined;
15
- cur?: string[] | undefined;
16
- wlang?: string[] | undefined;
17
- wlangb?: string[] | undefined;
18
- bcat?: string[] | undefined;
19
- cattax?: number[] | undefined;
20
- badv?: string[] | undefined;
21
- bapp?: string[] | undefined;
22
- source?: ISource | undefined;
23
- regs?: IRegs | undefined;
24
- ext?: any;
25
- constructor(id: string, w: number, h: number);
26
- }
@@ -1,2 +0,0 @@
1
- export * from './SimpleBannerRequest';
2
- export * from './RequestBuilder';
@@ -1,10 +0,0 @@
1
- import type { IBid, IBidResponse, ICompiledPublisherConfiguration, IProductInformation } from '../../models';
2
- interface IBuiltBanner {
3
- element: HTMLDivElement | null;
4
- product: IProductInformation | null;
5
- clickThrough: string | null;
6
- }
7
- export declare function BuildBanner(response: IBidResponse | null, config?: ICompiledPublisherConfiguration): IBuiltBanner;
8
- export declare function BuildBannerFromBid(bid: IBid): HTMLDivElement | null;
9
- export declare function BuildProductInfoFromElement(element: HTMLDivElement): IProductInformation | null;
10
- export {};
@@ -1,21 +0,0 @@
1
- import { type IBidResponse, type ICompiledPublisherConfiguration, type INativeResponse } from '../../models';
2
- import { ILoggerService, type IProductFeedService } from '../../services';
3
- export interface ITrackers {
4
- pixels: string[];
5
- js: string[];
6
- }
7
- export interface IBuiltNative {
8
- data: INativeResponse;
9
- clickThrough: string;
10
- winUrl: string;
11
- trackers: ITrackers;
12
- element?: Element;
13
- }
14
- export interface IPublisherContext {
15
- config: ICompiledPublisherConfiguration;
16
- productService: IProductFeedService;
17
- accountId: string;
18
- siteId: string;
19
- locationId: string;
20
- }
21
- export declare function BuildNativeResponse(response: IBidResponse | null, context?: IPublisherContext, logger?: ILoggerService): Promise<IBuiltNative[]>;
@@ -1,2 +0,0 @@
1
- import type { ICompiledPublisherConfiguration, IProductInformation } from '../../models';
2
- export declare function BuildClickThroughUrl(configuration: ICompiledPublisherConfiguration, product: IProductInformation, catalog: IProductInformation, ext?: any): string;
@@ -1,4 +0,0 @@
1
- import type { IBidResponse, IVast } from '../../models';
2
- import type { ILoggerService } from '../../services';
3
- export declare function DeserializeVideo(response: IBidResponse, logger?: ILoggerService): IVast | null;
4
- export declare function DeserializeVast(logger: ILoggerService | undefined, adm: string): IVast;
@@ -1,4 +0,0 @@
1
- export * from './BuildBannerResponse';
2
- export * from './BuildNativeResponse';
3
- export * from './ClickthroughHelpers';
4
- export * from './VastHelpers';
@@ -1,3 +0,0 @@
1
- import type { IBidRequest } from '../models';
2
- import type { IDeviceService, ILoggerService } from '../services';
3
- export declare function DeviceMiddleware(logger: ILoggerService | undefined, deviceService: IDeviceService | undefined, request: IBidRequest): Promise<IBidRequest>;
@@ -1,3 +0,0 @@
1
- import type { IBidRequest } from '../models';
2
- import type { IGeoService, ILoggerService } from '../services';
3
- export declare function GeoMiddlewareImmediate(geoService: IGeoService, logger: ILoggerService | undefined, request: IBidRequest, geoTargetingEnabled: boolean, ipTargetingEnabled: boolean): Promise<IBidRequest>;
@@ -1,4 +0,0 @@
1
- import { type IBidRequest } from '../models';
2
- import type { ILoggerService, IUserIDService } from '../services';
3
- export declare function IdentityMiddleware(userIDService: IUserIDService, logger: ILoggerService | undefined, request: IBidRequest): Promise<IBidRequest>;
4
- export declare const buildIdentityMiddleware: (userIdService: IUserIDService, logger: ILoggerService | undefined) => (request: IBidRequest) => Promise<IBidRequest>;
@@ -1,3 +0,0 @@
1
- export * from './GeoMiddleware';
2
- export * from './DeviceMiddleware';
3
- export * from './IdentityMiddleware';
@@ -1,37 +0,0 @@
1
- export interface IProductInformation {
2
- image: string | null;
3
- price: string | null;
4
- salePrice: string | null;
5
- thc: string | null;
6
- strain: string | null;
7
- cbd: string | null;
8
- name: string | null;
9
- brand_name: string | null;
10
- brandName: string | null;
11
- productType: string | null;
12
- details: string | null;
13
- cta: string | null;
14
- clickthroughUrl: string | null;
15
- winUrl: string | null;
16
- pixelUrl: string | null;
17
- ext?: any;
18
- }
19
- export declare class DefaultProductInformation implements IProductInformation {
20
- image: string | null;
21
- price: string | null;
22
- salePrice: string | null;
23
- thc: string | null;
24
- strain: string | null;
25
- cbd: string | null;
26
- name: string | null;
27
- brand_name: string | null;
28
- brandName: string | null;
29
- productType: string | null;
30
- details: string | null;
31
- cta: string | null;
32
- clickthroughUrl: string | null;
33
- winUrl: string | null;
34
- pixelUrl: string | null;
35
- ext?: any;
36
- constructor();
37
- }
@@ -1,60 +0,0 @@
1
- export declare enum CreativeType {
2
- BANNER = 0,
3
- INLINE = 1,
4
- PRODUCT_CARD = 2,
5
- PRODUCT_CAROUSEL = 3,
6
- VIDEO = 4
7
- }
8
- export declare enum NativePosition {
9
- UNKNOWN = 0,
10
- ABOVE_THE_FOLD = 1,
11
- BELOW_THE_FOLD = 3,
12
- HEADER = 4,
13
- FOOTER = 5,
14
- SIDEBAR = 6,
15
- FULL_SCREN = 7
16
- }
17
- export declare enum NativeImageTypes {
18
- ICON = 1,
19
- MAIN = 3
20
- }
21
- export declare enum NativeDataTypes {
22
- SPONSORED = 1,
23
- DESC = 2,
24
- RATING = 3,
25
- LIKES = 4,
26
- DOWNLOADS = 5,
27
- PRICE = 6,
28
- SALEPRICE = 7,
29
- PHONE = 8,
30
- ADDRESS = 9,
31
- DESC2 = 10,
32
- DISPLAYURL = 11,
33
- CTATEXT = 12,
34
- SURF_STRAIN = 500,
35
- SURF_THC = 501,
36
- SURF_CBD = 502,
37
- SURF_CATEGORY = 503
38
- }
39
- export declare enum NativeAssetId {
40
- TITLE = 0,
41
- IMAGE = 1,
42
- SPONSORED = 2,
43
- DESC = 3,
44
- RATING = 4,
45
- PRICE = 5,
46
- SALEPRICE = 6,
47
- DISPLAYURL = 7,
48
- CTATEXT = 8,
49
- SURF_CATEGORY = 9,
50
- SURF_THC = 10,
51
- SURF_CBD = 11,
52
- SURF_STRAIN = 12
53
- }
54
- export interface INativeDataAsset {
55
- id: number;
56
- required: 0 | 1;
57
- data: {
58
- type: number;
59
- };
60
- }
@@ -1,54 +0,0 @@
1
- import type { ContextSubTypes, ContextTypes, EventTrackingMethods, EventTypes, NativeDataTypes, PlacementTypes, VideoMimes } from './NativeConstants';
2
- export interface INativeRequest {
3
- ver?: string;
4
- context?: ContextTypes;
5
- contextsubtype?: ContextSubTypes;
6
- plcmttype?: PlacementTypes;
7
- plcmtcnt?: number;
8
- seq?: number;
9
- assets: IAssetObject[];
10
- aurlsupport?: number;
11
- durlsupport?: number;
12
- eventtrackers?: IEventTrackerRequestObject[];
13
- privacy?: number;
14
- ext?: any;
15
- }
16
- export interface IAssetObject {
17
- id: number;
18
- required?: number;
19
- title?: ITitleRequestObject;
20
- img?: IImageRequestObject;
21
- video?: IVideoRequestObject;
22
- data?: IDataRequestObject;
23
- ext?: any;
24
- }
25
- export interface ITitleRequestObject {
26
- len: number;
27
- ext?: any;
28
- }
29
- export interface IImageRequestObject {
30
- type?: number;
31
- w?: number;
32
- wmin?: number;
33
- h?: number;
34
- hmin?: number;
35
- mimes?: string[];
36
- ext?: any;
37
- }
38
- export interface IVideoRequestObject {
39
- mimes: VideoMimes[] | string[];
40
- minduration: number;
41
- maxduration: number;
42
- protocols: number[];
43
- ext?: any;
44
- }
45
- export interface IDataRequestObject {
46
- type: NativeDataTypes;
47
- len?: number;
48
- ext?: any;
49
- }
50
- export interface IEventTrackerRequestObject {
51
- event: EventTypes;
52
- methods: EventTrackingMethods[];
53
- ext?: any;
54
- }
@@ -1,120 +0,0 @@
1
- /**
2
- * The position of the native ad, on the screen
3
- */
4
- export declare enum NativePosition {
5
- UNKNOWN = 0,
6
- ABOVE_THE_FOLD = 1,
7
- BELOW_THE_FOLD = 3,
8
- HEADER = 4,
9
- FOOTER = 5,
10
- SIDEBAR = 6,
11
- FULL_SCREN = 7
12
- }
13
- /**
14
- * The type of the image within native ad (icon vs main image)
15
- */
16
- export declare enum NativeImageTypes {
17
- ICON = 1,
18
- MAIN = 3
19
- }
20
- /**
21
- * The type ID for each native asset type. IDs above 500 are surfside-specific fields, all
22
- * others are OpenRTB Native Ad Spec 1.2 fields.
23
- */
24
- export declare enum NativeDataTypes {
25
- SPONSORED = 1,
26
- DESC = 2,
27
- RATING = 3,
28
- LIKES = 4,
29
- DOWNLOADS = 5,
30
- PRICE = 6,
31
- SALEPRICE = 7,
32
- PHONE = 8,
33
- ADDRESS = 9,
34
- DESC2 = 10,
35
- DISPLAYURL = 11,
36
- CTATEXT = 12,
37
- SURF_STRAIN = 500,
38
- SURF_THC = 501,
39
- SURF_CBD = 502,
40
- SURF_CATEGORY = 503,
41
- SURF_META_PRODUCT = 599
42
- }
43
- /**
44
- * The ID for each field within a surfside native ad request. The Asset ID matches the asset type, for simplicity.
45
- */
46
- export declare enum NativeAssetId {
47
- TITLE = 0,
48
- IMAGE = 1,
49
- SPONSORED = 2,
50
- DESC = 3,
51
- RATING = 4,
52
- PRICE = 5,
53
- SALEPRICE = 6,
54
- DISPLAYURL = 7,
55
- CTATEXT = 8,
56
- SURF_STRAIN = 500,
57
- SURF_THC = 501,
58
- SURF_CBD = 502,
59
- SURF_CATEGORY = 503,
60
- SURF_META_PRODUCT = 599
61
- }
62
- /**
63
- * Event types which can be tracked by the native ad unit
64
- */
65
- export declare enum EventTypes {
66
- IMP = 1,
67
- VIEWABLE_MRC50 = 2,
68
- VIEWABLE_MRC100 = 3,
69
- VIEWABLE_VIDEO50 = 4,
70
- SURF_WIN = 500,
71
- SURF_CLICK = 501
72
- }
73
- /**
74
- * The context of the page for the native ad unit, i.e what type of content is being displayed
75
- */
76
- export declare enum ContextTypes {
77
- CONTENT = 1,
78
- SOCIAL = 2,
79
- PRODUCT = 3
80
- }
81
- /**
82
- * The sub-type of the context
83
- */
84
- export declare enum ContextSubTypes {
85
- GENERAL = 10,
86
- ARTICLE = 11,
87
- VIDEO = 12,
88
- AUDIO = 13,
89
- IMAGE = 14,
90
- USER_GENERATED = 15,
91
- GENERAL_SOCIAL = 20,
92
- EMAIL = 21,
93
- CHAT = 22,
94
- PRODUCT = 30,
95
- APPLICATION = 31,
96
- PRODUCT_REVIEWS = 32
97
- }
98
- /**
99
- * The format of the ad unit, i.e: what type of ad is being displayed and where
100
- */
101
- export declare enum PlacementTypes {
102
- IN_FEED = 1,
103
- ATOMIC = 2,
104
- OUTSIDE_CORE = 3,
105
- RECOMMENDATION = 4
106
- }
107
- /**
108
- * Presets for default video MIME types
109
- */
110
- export declare enum VideoMimes {
111
- MP4 = "video/mp4",
112
- WEBM = "video/webm"
113
- }
114
- /**
115
- * The method used to track events, 1x1 pixel of Javascript tag
116
- */
117
- export declare enum EventTrackingMethods {
118
- IMG = 1,
119
- JS = 2
120
- }
@@ -1,158 +0,0 @@
1
- import { EventTrackingMethods, EventTypes, NativeAssetId, NativeDataTypes, type VideoMimes } from '../../../models';
2
- import type { INativeRequest } from './INativeRequest';
3
- /**
4
- * Builder for creating an OpenRTB Native 1.2 request object.
5
- */
6
- export declare class NativeRequestBuilder {
7
- private readonly _request;
8
- /**
9
- * Creates a new NativeRequestBuilder instance, using version 1.2 and product type context.
10
- */
11
- constructor();
12
- /**
13
- * Overrides the 1.2 version with the provided version.
14
- * @param ver The version to use
15
- * @returns The builder instance
16
- */
17
- withVer(ver: string): this;
18
- /**
19
- * Overrides the native request context type with the provided context.
20
- * @param context The context to use
21
- * @returns The builder instance
22
- */
23
- withContext(context: number): this;
24
- /**
25
- * Adds a title asset to the request.
26
- * @param length The lenght of the title, default is 80
27
- * @param required Whether the title is required, default is true
28
- * @returns The builder instance
29
- */
30
- withTitle(length?: number, required?: boolean): this;
31
- /**
32
- * Adds an image asset to the request.
33
- * @param width The full width of the image. If minWidth is not provided, this is the exact width.
34
- * Otherwise, it is the max width
35
- * @param height The full height of the image. If minHeight is not provided, this is the exact height.
36
- * Otherwise, it is the max height
37
- * @param minWidth The minimum width of the image. undefined by default
38
- * @param minHeight The minimum height of the image. undefined by default
39
- * @param required Whether the image is required, default is true
40
- * @returns
41
- */
42
- withImage(width: number, height: number, minWidth?: number, minHeight?: number, required?: boolean): this;
43
- /**
44
- * Adds a video asset to the request.
45
- * @param mimes The supported MIME types for the video
46
- * @param minDuration The minimum duration of the video
47
- * @param maxDuration The maximum duration of the video
48
- * @param required Whether the video is required, default is true
49
- * @returns The builder instance
50
- */
51
- withVideo(mimes: VideoMimes[] | string[], minDuration: number, maxDuration: number, required?: boolean): this;
52
- /**
53
- * Adds a data asset to the request.
54
- * @param type The type ID of the data asset
55
- * @param id The ID of the asset field; This number is used to address the asset
56
- * in the response so it must be unique
57
- * @param length The max length of the data asset's value, in characters
58
- * @param required Whether the data asset is required, default is true
59
- * @returns The builder instance
60
- */
61
- withData(type: NativeDataTypes, id: NativeAssetId, length?: number, required?: boolean): this;
62
- /**
63
- * Adds a sponsored field to the request.
64
- * @param length The max length of the sponsored field, in characters. Default is 80
65
- * @param required Whether the sponsored field is required. Default is true
66
- * @returns The builder instance
67
- */
68
- withSponsored(length?: number, required?: boolean): this;
69
- /**
70
- * Adds a description field to the request.
71
- * @param length The max length of the description field, in characters. Default is 80
72
- * @param required Whether the description field is required. Default is true
73
- * @returns The builder instance
74
- */
75
- withDescription(length?: number, required?: boolean): this;
76
- /**
77
- * Adds a rating field to the request.
78
- * @param length The max length of the rating field, in characters. Default is 80
79
- * @param required Whether the rating field is required. Default is true
80
- * @returns The builder instance
81
- */
82
- withRating(length?: number, required?: boolean): this;
83
- /**
84
- * Adds a price field to the request.
85
- * @param length The max length of the price field, in characters. Default is 80
86
- * @param required Whether the price field is required. Default is true
87
- * @returns The builder instance
88
- */
89
- withPrice(length?: number, required?: boolean): this;
90
- /**
91
- * Adds a sale price field to the request.
92
- * @param length The max length of the sale price field, in characters. Default is 80
93
- * @param required Whether the sale price field is required. Default is true
94
- * @returns The builder instance
95
- */
96
- withSalePrice(length?: number, required?: boolean): this;
97
- /**
98
- * Adds a display URL field to the request.
99
- * @param length The max length of the display URL field, in characters. Default is 80
100
- * @param required Whether the display URL field is required. Default is true
101
- * @returns The builder instance
102
- */
103
- withDisplayUrl(length?: number, required?: boolean): this;
104
- /**
105
- * Adds a CTA (call to action) text field to the request.
106
- * @param length The max length of the call to action text field, in characters. Default is 80
107
- * @param required Whether the call to action text field is required. Default is true
108
- * @returns The builder instance
109
- */
110
- withCtaText(length?: number, required?: boolean): this;
111
- /**
112
- * Adds a category field to the request.
113
- * @param length The max length of the category field, in characters. Default is 80
114
- * @param required Whether the category field is required. Default is true
115
- * @returns The builder instance
116
- */
117
- withCategory(length?: number, required?: boolean): this;
118
- /**
119
- * Adds a THC field to the request.
120
- * @param length The max length of the THC field, in characters. Default is 80
121
- * @param required Whether the THC field is required. Default is true
122
- * @returns The builder instance
123
- */
124
- withTHC(length?: number, required?: boolean): this;
125
- /**
126
- * Adds a CBD field to the request.
127
- * @param length The max length of the CBD field, in characters. Default is 80
128
- * @param required Whether the CBD field is required. Default is true
129
- * @returns The builder instance
130
- */
131
- withCBD(length?: number, required?: boolean): this;
132
- /**
133
- * Adds a strain field to the request.
134
- * @param length The max length of the strain field, in characters. Default is 80
135
- * @param required Whether the strain field is required. Default is true
136
- * @returns The builder instance
137
- */
138
- withStrain(length?: number, required?: boolean): this;
139
- /**
140
- * Adds a meta product field to the request.
141
- * @param length The max length of the meta product field, in characters. Default is 80
142
- * @param required Whether the meta product field is required. Default is true
143
- * @returns The builder instance
144
- */
145
- withMetaProduct(length?: number, required?: boolean): this;
146
- /**
147
- * Adds an event tracker to the request.
148
- * @param event The type of event to be tracked
149
- * @param methods Which methods are acceptable: either 1x1 image pixels or javascript tags, or both
150
- * @returns The builder instance
151
- */
152
- withEventTracker(event: EventTypes, methods: EventTrackingMethods[]): this;
153
- /**
154
- * Generate the native bid request object.
155
- * @returns The native request object
156
- */
157
- build(): INativeRequest;
158
- }
@@ -1,4 +0,0 @@
1
- export * from './INativeRequest';
2
- export * from './INativeResponse';
3
- export * from './NativeRequestBuilder';
4
- export * from './NativeConstants';