@surfside/ads-core 2.0.1 → 2.0.3

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 (274) hide show
  1. package/README.md +15 -15
  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 +313 -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 -3488
  33. package/lib/cjs/index.js.map +1 -54
  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 +294 -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 -3460
  125. package/lib/esm/index.js.map +1 -54
  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 +5 -5
  187. package/lib/types/helpers/Handlebars.d.ts +58 -15
  188. package/lib/types/helpers/NativeRequestBuilder.d.ts +1 -1
  189. package/lib/types/helpers/RequestBuilder.d.ts +1 -1
  190. package/lib/types/helpers/TryGet.d.ts +1 -1
  191. package/lib/types/helpers/Window.d.ts +2 -2
  192. package/lib/types/helpers/response/Banner.d.ts +1 -1
  193. package/lib/types/helpers/response/BuiltResponse.d.ts +1 -1
  194. package/lib/types/helpers/response/Carousel.d.ts +1 -1
  195. package/lib/types/helpers/response/Clickthrough.d.ts +1 -1
  196. package/lib/types/helpers/response/ProductCard.d.ts +3 -3
  197. package/lib/types/helpers/response/Video.d.ts +2 -2
  198. package/lib/types/services/Bidder.d.ts +3 -3
  199. package/lib/types/services/Configuration.d.ts +1 -1
  200. package/lib/types/services/Dynamic.d.ts +6 -6
  201. package/lib/types/services/Geo.d.ts +1 -1
  202. package/lib/types/services/Product.d.ts +1 -1
  203. package/lib/types/services/Template.d.ts +3 -3
  204. package/package.json +41 -33
  205. package/lib/index.js +0 -1
  206. package/lib/index.js.map +0 -1
  207. package/lib/types/constant-values/index.d.ts +0 -46
  208. package/lib/types/errors/index.d.ts +0 -3
  209. package/lib/types/helpers/generators/CollectN.d.ts +0 -2
  210. package/lib/types/helpers/generators/index.d.ts +0 -1
  211. package/lib/types/helpers/handlebars/index.d.ts +0 -119
  212. package/lib/types/helpers/requests/RequestBuilder.d.ts +0 -124
  213. package/lib/types/helpers/requests/SimpleBannerRequest.d.ts +0 -26
  214. package/lib/types/helpers/requests/index.d.ts +0 -2
  215. package/lib/types/helpers/responses/BuildBannerResponse.d.ts +0 -10
  216. package/lib/types/helpers/responses/BuildNativeResponse.d.ts +0 -21
  217. package/lib/types/helpers/responses/BuildVideoResponse.d.ts +0 -0
  218. package/lib/types/helpers/responses/ClickthroughHelpers.d.ts +0 -2
  219. package/lib/types/helpers/responses/VastHelpers.d.ts +0 -4
  220. package/lib/types/helpers/responses/index.d.ts +0 -4
  221. package/lib/types/middleware/DeviceMiddleware.d.ts +0 -3
  222. package/lib/types/middleware/GeoMiddleware.d.ts +0 -3
  223. package/lib/types/middleware/IdentityMiddleware.d.ts +0 -4
  224. package/lib/types/middleware/index.d.ts +0 -3
  225. package/lib/types/models/retail/IProductInformation.d.ts +0 -37
  226. package/lib/types/models/retail/IPublisherConfiguration.d.ts +0 -64
  227. package/lib/types/models/retail/IRecommenderResponse.d.ts +0 -10
  228. package/lib/types/models/rtb/IBidRequest.d.ts +0 -399
  229. package/lib/types/models/rtb/IBidResponse.d.ts +0 -47
  230. package/lib/types/models/rtb/native/Constants.d.ts +0 -60
  231. package/lib/types/models/rtb/native/INativeRequest.d.ts +0 -54
  232. package/lib/types/models/rtb/native/INativeResponse.d.ts +0 -60
  233. package/lib/types/models/rtb/native/NativeConstants.d.ts +0 -120
  234. package/lib/types/models/rtb/native/NativeRequestBuilder.d.ts +0 -158
  235. package/lib/types/models/rtb/native/index.d.ts +0 -4
  236. package/lib/types/models/tracking/IEvents.d.ts +0 -82
  237. package/lib/types/models/tracking/IGeoContext.d.ts +0 -14
  238. package/lib/types/models/tracking/IUserID.d.ts +0 -1
  239. package/lib/types/services/OverrideService.d.ts +0 -10
  240. package/lib/types/services/logger/ILoggerService.d.ts +0 -39
  241. package/lib/types/services/logger/LocalLoggerService.d.ts +0 -19
  242. package/lib/types/services/logger/index.d.ts +0 -2
  243. package/lib/types/services/product-feed/IProductFeedService.d.ts +0 -5
  244. package/lib/types/services/product-feed/SurfsideProductFeedService.d.ts +0 -11
  245. package/lib/types/services/product-feed/index.d.ts +0 -2
  246. package/lib/types/services/recommender/IRecommenderService.d.ts +0 -47
  247. package/lib/types/services/recommender/SurfsideRecommenderService.d.ts +0 -31
  248. package/lib/types/services/recommender/index.d.ts +0 -2
  249. package/lib/types/services/rtb/bidder/IBidderService.d.ts +0 -12
  250. package/lib/types/services/rtb/bidder/SurfsideBidderService.d.ts +0 -28
  251. package/lib/types/services/rtb/bidder/index.d.ts +0 -2
  252. package/lib/types/services/rtb/configuration/IConfigurationService.d.ts +0 -14
  253. package/lib/types/services/rtb/configuration/SurfsideConfigurationService.d.ts +0 -29
  254. package/lib/types/services/rtb/configuration/index.d.ts +0 -2
  255. package/lib/types/services/rtb/index.d.ts +0 -2
  256. package/lib/types/services/tracking/device/DeviceOverrideService.d.ts +0 -8
  257. package/lib/types/services/tracking/device/IDeviceService.d.ts +0 -4
  258. package/lib/types/services/tracking/device/SurfsideDeviceService.d.ts +0 -16
  259. package/lib/types/services/tracking/device/index.d.ts +0 -3
  260. package/lib/types/services/tracking/events/IEventService.d.ts +0 -5
  261. package/lib/types/services/tracking/events/SurfsideEventService.d.ts +0 -42
  262. package/lib/types/services/tracking/events/index.d.ts +0 -2
  263. package/lib/types/services/tracking/geo/GeoOverrideService.d.ts +0 -8
  264. package/lib/types/services/tracking/geo/IGeoService.d.ts +0 -12
  265. package/lib/types/services/tracking/geo/SurfsideGeoService.d.ts +0 -7
  266. package/lib/types/services/tracking/geo/index.d.ts +0 -3
  267. package/lib/types/services/tracking/index.d.ts +0 -4
  268. package/lib/types/services/tracking/user/IUserIDService.d.ts +0 -4
  269. package/lib/types/services/tracking/user/SurfsideUserIDService.d.ts +0 -7
  270. package/lib/types/services/tracking/user/UserOverrideService.d.ts +0 -8
  271. package/lib/types/services/tracking/user/index.d.ts +0 -3
  272. package/lib/types/utils/Protocol.d.ts +0 -1
  273. package/lib/types/utils/Rendering.d.ts +0 -44
  274. package/lib/types/utils/index.d.ts +0 -2
@@ -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';
@@ -1,82 +0,0 @@
1
- import type { ISite } from '../rtb';
2
- export interface IBidRequestedEvent {
3
- auctionId: string;
4
- bidderRequestId: string;
5
- bids: IEventBid[];
6
- auctionStart: number;
7
- timeout: number;
8
- refererInfo: IEventRefererInfo;
9
- start: number;
10
- }
11
- export interface IBidderDoneEvent {
12
- auctionId: string;
13
- bidderRequestId: string;
14
- bids?: IEventBid[];
15
- auctionStart: number;
16
- timeout: number;
17
- refererInfo: IEventRefererInfo;
18
- start: number;
19
- }
20
- export interface IEventBid {
21
- params: IEventBidParams;
22
- user?: IEventUser;
23
- ortb2Imp: IEventOrtb2Imp;
24
- mediaTypes: IEventMediaTypes;
25
- transactionId: string;
26
- sizes: number[][];
27
- bidId: string;
28
- ortb2: IEventOrtb2;
29
- }
30
- export interface IEventBidParams {
31
- accountId: string;
32
- channelId: string;
33
- siteId: string;
34
- placementId: string;
35
- zone: string;
36
- type: number | string;
37
- storeId?: string;
38
- }
39
- export interface IEventUser {
40
- geo?: IEventGeo;
41
- }
42
- export interface IEventGeo {
43
- coords?: IEventCoords;
44
- country?: string | null;
45
- region?: string | null;
46
- city?: string | null;
47
- zip?: string | null;
48
- utcOffset?: number;
49
- timezone?: string;
50
- ip?: string;
51
- }
52
- export interface IEventCoords {
53
- lat: number;
54
- lon: number;
55
- accurary?: number | null;
56
- }
57
- export interface IEventOrtb2Imp {
58
- ext?: {
59
- tid?: string;
60
- };
61
- }
62
- export interface IEventMediaTypes {
63
- banner?: {
64
- sizes: number[][];
65
- };
66
- }
67
- export interface IEventOrtb2 {
68
- site?: ISite;
69
- device?: {
70
- w?: number;
71
- h?: number;
72
- dnt?: number;
73
- ua?: string;
74
- language?: string;
75
- };
76
- }
77
- export interface IEventRefererInfo {
78
- stack: string[];
79
- location: string;
80
- page: string;
81
- domain: string;
82
- }
@@ -1,14 +0,0 @@
1
- export interface ICoordinates {
2
- latitude: number;
3
- longitude: number;
4
- accuracy: number;
5
- }
6
- export interface IGeoContext {
7
- country: string;
8
- region: string;
9
- city: string;
10
- zip: string;
11
- coords: ICoordinates;
12
- utcoffset: number;
13
- ip: string;
14
- }
@@ -1 +0,0 @@
1
- export type IUserID = string;
@@ -1,10 +0,0 @@
1
- import type { ILoggerService } from './logger';
2
- export declare abstract class OverrideService<T> {
3
- private readonly _selector;
4
- protected readonly logger?: ILoggerService | undefined;
5
- protected overrideData: T | null;
6
- protected overrideNode: HTMLElement | null;
7
- constructor(_selector: string, logger?: ILoggerService | undefined);
8
- protected getOverrideNode(): HTMLElement | null;
9
- abstract mapDataSetToData(dataset: DOMStringMap): T | null;
10
- }
@@ -1,39 +0,0 @@
1
- export declare enum LogLevel {
2
- NONE = 0,
3
- ERRORS = 1,
4
- INFO = 2,
5
- DEBUG = 3
6
- }
7
- /**
8
- * Interface for a logger service
9
- */
10
- export interface ILoggerService {
11
- /**
12
- * Prints info. This is useful for tracking the lifecycle of a bid request
13
- *
14
- * @param args The arguments to print
15
- */
16
- info: (...args: any[]) => void;
17
- /**
18
- * Prints a warning. This is useful for tracking potential issues, but not critical errors. Warnings should not
19
- * prevent the bidding process from continuing, but may disable certain features such as commerce media or certain
20
- * types of targeting
21
- *
22
- * @param args
23
- */
24
- warn: (...args: any[]) => void;
25
- /**
26
- * Prints an error. This is useful for tracking critical errors. Printing an error should indicate that the bidding
27
- * process can go no further.
28
- *
29
- * @param args The arguments to print
30
- */
31
- error: (...args: any[]) => void;
32
- /**
33
- * Spammy messages. This is useful for tracking the lifecycle of a bid request and debugging issues with special
34
- * flags enabled. When there is an issue on the client side, enabling debug logs will help the developer understand
35
- * where the issue is in the code and potentially what the issue is. These should be added to every function.
36
- * @param args The arguments to print
37
- */
38
- debug: (...args: any[]) => void;
39
- }
@@ -1,19 +0,0 @@
1
- import { type ILoggerService, LogLevel } from '../../services';
2
- /**
3
- * Logger service which adds some color to the console logs
4
- */
5
- export declare class LocalLoggerService implements ILoggerService {
6
- private readonly _logLevel;
7
- constructor(_logLevel: LogLevel);
8
- debug(...args: any[]): void;
9
- info(...args: any[]): void;
10
- warn(...args: any[]): void;
11
- error(...args: any[]): void;
12
- /**
13
- * Shows a log message with [SURF] prepended and colored
14
- * @param log The console log function to use (e.g: console.log, console.error, etc.)
15
- * @param args The actual log message
16
- * @param color The color to use for the log message
17
- */
18
- private _log;
19
- }
@@ -1,2 +0,0 @@
1
- export * from './ILoggerService';
2
- export * from './LocalLoggerService';
@@ -1,5 +0,0 @@
1
- import type { IProductInformation } from '../../models';
2
- export interface IProductFeedService {
3
- getProduct: (accountId: string, siteId: string, locationId: string, productId: string) => Promise<IProductInformation | null>;
4
- getNativeProduct: (accountId: string, siteId: string, locationId: string, productId: string) => Promise<IProductInformation | null>;
5
- }
@@ -1,11 +0,0 @@
1
- import type { IProductInformation } from '../../models';
2
- import type { ILoggerService, IProductFeedService } from '../../services';
3
- export declare class SurfsideProductFeedService implements IProductFeedService {
4
- private readonly _logger?;
5
- private readonly _url;
6
- constructor(url: string, _logger?: ILoggerService | undefined);
7
- getProduct(accountId: string, siteId: string, locationId: string, productId: string): Promise<IProductInformation | null>;
8
- getNativeProduct(accountId: string, siteId: string | undefined, locationId: string, productId: string): Promise<IProductInformation | null>;
9
- private _mapResponseToProductInformation;
10
- private _getFieldOrNull;
11
- }
@@ -1,2 +0,0 @@
1
- export * from './IProductFeedService';
2
- export * from './SurfsideProductFeedService';
@@ -1,47 +0,0 @@
1
- import type { IProductInformation, IRecommendedProduct } from '../../models';
2
- /**
3
- * Recommender service, provides methods to get recommendations for products.
4
- */
5
- export interface IRecommenderService {
6
- /**
7
- * @deprecated Use `generateTopProduct` instead
8
- */
9
- getTopProducts: (accountId: string, siteId: string, locationId: string, count: number) => Promise<IRecommendedProduct[] | null>;
10
- /**
11
- * Generator function for the next existing top recommended product.
12
- * Returns when out of existing products.
13
- * @param accountId The account id of the client.
14
- * @param siteId The site id of the client.
15
- * @param locationId The location id on the site.
16
- * @returns A recommended product.
17
- */
18
- generateTopProduct: (accountId: string, siteId: string, locationId: string) => AsyncGenerator<IProductInformation>;
19
- /**
20
- * @deprecated Use `generateForYou` instead
21
- */
22
- getForYou: (accountId: string, siteId: string, locationId: string, userId: string, count: number) => Promise<IRecommendedProduct[] | null>;
23
- /**
24
- * Generator function for the next existing product recommended for the given user.
25
- * Returns when out of existing products.
26
- * @param accountId The account id of the client.
27
- * @param siteId The site id of the client.
28
- * @param locationId The location id on the site.
29
- * @param userId The user id.
30
- * @returns A recommended product.
31
- */
32
- generateForYou: (accountId: string, siteId: string, locationId: string, userId: string) => AsyncGenerator<IProductInformation>;
33
- /**
34
- * @deprecated Use `generatePreviousPurchase` instead
35
- */
36
- getPreviousPurchases: (accountId: string, siteId: string, locationId: string, userId: string, count: number) => Promise<IRecommendedProduct[] | null>;
37
- /**
38
- * Generator function for the next existing product recommended based on the user's
39
- * previous purchases. Returns when out of existing products.
40
- * @param accountId The account id of the client.
41
- * @param siteId The site id of the client.
42
- * @param locationId The location id on the site.
43
- * @param userId The user id.
44
- * @returns A recommended product.
45
- */
46
- generatePreviousPurchase: (accountId: string, siteId: string, locationId: string, userId: string) => AsyncGenerator<IProductInformation>;
47
- }
@@ -1,31 +0,0 @@
1
- import type { IProductInformation, IRecommendedProduct } from '../../models';
2
- import type { ILoggerService, IProductFeedService, IRecommenderService } from '../../services';
3
- export declare class SurfsideRecommenderService implements IRecommenderService {
4
- private readonly _productFeedService;
5
- private readonly _logger?;
6
- private readonly _cache;
7
- private readonly _url;
8
- constructor(url: string, _productFeedService: IProductFeedService, _logger?: ILoggerService | undefined);
9
- /**
10
- * @deprecated Use `generateTopProduct` instead
11
- */
12
- getTopProducts(accountId: string, siteId: string, locationId: string, count: number): Promise<IRecommendedProduct[] | null>;
13
- generateTopProduct(accountId: string, siteId: string, locationId: string): AsyncGenerator<IProductInformation>;
14
- /**
15
- * @deprecated Use `generateForYou` instead.
16
- */
17
- getForYou(accountId: string, siteId: string, locationId: string, userId: string, count: number): Promise<IRecommendedProduct[] | null>;
18
- generateForYou(accountId: string, siteId: string, locationId: string, userId: string): AsyncGenerator<IProductInformation>;
19
- /**
20
- * @deprecated Use `generatePreviousPurchase` instead.
21
- */
22
- getPreviousPurchases(accountId: string, siteId: string, locationId: string, userId: string, count: number): Promise<IRecommendedProduct[] | null>;
23
- generatePreviousPurchase(accountId: string, siteId: string, locationId: string, userId: string): AsyncGenerator<IProductInformation>;
24
- private _generateProductRecommendation;
25
- private _fetchRecommendations;
26
- /**
27
- * Used for the generator methods; just returns a simple list of products instead of managing a cache
28
- */
29
- private _fetchRecommendationList;
30
- private _generateProduct;
31
- }
@@ -1,2 +0,0 @@
1
- export * from './IRecommenderService';
2
- export * from './SurfsideRecommenderService';
@@ -1,12 +0,0 @@
1
- import type { IBidRequest, IBidResponse } from '../../../models';
2
- /**
3
- * The core service for sending bid requests and receiving bid responses.
4
- */
5
- export interface IBidderService {
6
- /**
7
- * Sends a bid request to the bidder
8
- * @param request an OpenRTB 2.6 bid request
9
- * @returns a promise that resolves with the OpenRTB 2.6 bid response
10
- */
11
- requestBids: (request: IBidRequest) => Promise<IBidResponse>;
12
- }
@@ -1,28 +0,0 @@
1
- import type { IBidRequest, IBidResponse } from '../../../models';
2
- import type { IBidderService } from './IBidderService';
3
- import type { IConfigurationService, IDeviceService, IGeoService, ILoggerService, IUserIDService } from '../../../services';
4
- /**
5
- * The surfside implementation of the IBidderService interface. Sends all request to
6
- * the surfside bidder.
7
- */
8
- export declare class SurfsideBidderService implements IBidderService {
9
- private readonly _configService;
10
- private readonly _geoService;
11
- private readonly _deviceService;
12
- private readonly _userService;
13
- private readonly _logger?;
14
- private readonly _url;
15
- /**
16
- * Creates a new instance of the SurfsideBidderService, sending requests to the specified URL
17
- * @param _url The URL of the bidder API
18
- * @param _logger An optional logger service, for debugging purposes
19
- */
20
- constructor(url: string, _configService: IConfigurationService, _geoService: IGeoService, _deviceService: IDeviceService, _userService: IUserIDService, _logger?: ILoggerService | undefined);
21
- /**
22
- * Sends a bid request to the bidder. If the bidder returns a status code other than 200,
23
- * a NoBidResponseError is thrown with the status code and status text as the message.
24
- * @param request The OpenRTB 2.6 bid request
25
- * @returns A promise that resolves with the OpenRTB 2.6 bid response
26
- */
27
- requestBids(request: IBidRequest): Promise<IBidResponse>;
28
- }
@@ -1,2 +0,0 @@
1
- export * from './IBidderService';
2
- export * from './SurfsideBidderService';
@@ -1,14 +0,0 @@
1
- import type { ICompiledPublisherConfiguration } from '../../../models';
2
- /**
3
- * The configuration service interface. account and site IDs come from the creative component attributes.
4
- * Publisher configurations have flags for features on the site, and templates for rendering commerce media creatives.
5
- */
6
- export interface IConfigurationService {
7
- /**
8
- * Gets the configuration for the given account and site IDs
9
- * @param accountId The account ID of the component making the request
10
- * @param siteId The site ID of the component making the request
11
- * @returns The configuration for the account and site IDs, or null if no configuration is found
12
- */
13
- getConfiguration: (accountId: string, siteId: string) => Promise<ICompiledPublisherConfiguration | null>;
14
- }
@@ -1,29 +0,0 @@
1
- import type { ICompiledPublisherConfiguration } from '../../../models';
2
- import type { ILoggerService } from '../../../services';
3
- import type { IConfigurationService } from './IConfigurationService';
4
- /**
5
- * The Surfside Configuration Service fetches the configuration for a given account and site.
6
- */
7
- export declare class SurfsideConfigurationService implements IConfigurationService {
8
- private readonly _handlebars;
9
- private readonly _logger?;
10
- private readonly _url;
11
- /**
12
- * Creates a new instance of the Surfside Configuration Service with the specified URL and Handlebars instance.
13
- * Handlebars is used to parse the clickthrough URL templates and product card templates for the configuration.
14
- * It is a peer dependency, so you will need to add handlebars to your project.
15
- * @param _url The URL of the configuration service
16
- * @param _handlebars The Handlebars instance to use for parsing templates. Created with `Handlebars.create()`
17
- * @param _logger An optional logger service, for debugging purposes
18
- */
19
- constructor(url: string, _handlebars: typeof Handlebars, _logger?: ILoggerService | undefined);
20
- /**
21
- * Fetches the configuration for the specified account and site.
22
- * @param accountId The account ID of the client
23
- * @param siteId The site ID of the client
24
- * @returns A promise that resolves with the compiled configuration, or null if the fetch fails
25
- */
26
- getConfiguration(accountId: string, siteId: string): Promise<ICompiledPublisherConfiguration | null>;
27
- private _mapConfig;
28
- private _importModule;
29
- }
@@ -1,2 +0,0 @@
1
- export * from './IConfigurationService';
2
- export * from './SurfsideConfigurationService';
@@ -1,2 +0,0 @@
1
- export * from './bidder';
2
- export * from './configuration';