@trillboards/ads-sdk 2.3.0 → 2.4.0

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.
package/dist/index.mjs CHANGED
@@ -318,10 +318,17 @@ var ApiClient = class {
318
318
  }
319
319
  const data = await response.json();
320
320
  const newEtag = response.headers.get("ETag");
321
+ const hbs = data.data?.header_bidding_settings;
321
322
  const result = {
322
323
  ads: data.data?.ads ?? [],
323
324
  settings: data.data?.settings ?? {},
324
- programmatic: data.data?.header_bidding_settings ?? null,
325
+ programmatic: hbs ? {
326
+ ...hbs,
327
+ sources: (hbs.vast_waterfall?.sources ?? []).map((s) => ({
328
+ ...s,
329
+ enabled: s.enabled !== false
330
+ }))
331
+ } : null,
325
332
  screenId: data.data?.screen_id ?? null,
326
333
  screenOrientation: data.data?.screen_orientation ?? null,
327
334
  screenDimensions: data.data?.screen_dimensions ?? null,
@@ -919,7 +926,7 @@ var WaterfallEngine = class {
919
926
  */
920
927
  getNextSource(sources) {
921
928
  if (!sources || sources.length === 0) return null;
922
- const sorted = [...sources].filter((s) => s.enabled).sort((a, b) => a.priority - b.priority || Math.random() - 0.5);
929
+ const sorted = [...sources].filter((s) => s.enabled !== false).sort((a, b) => a.priority - b.priority || Math.random() - 0.5);
923
930
  for (const source of sorted) {
924
931
  if (this.circuitBreaker.isAvailable(source.name)) {
925
932
  return { source, vastUrl: source.vast_url };
@@ -934,7 +941,7 @@ var WaterfallEngine = class {
934
941
  */
935
942
  getAvailableSources(sources) {
936
943
  if (!sources || sources.length === 0) return [];
937
- return sources.filter((s) => s.enabled && this.circuitBreaker.isAvailable(s.name)).sort((a, b) => a.priority - b.priority || Math.random() - 0.5).map((source) => ({ source, vastUrl: source.vast_url }));
944
+ return sources.filter((s) => s.enabled !== false && this.circuitBreaker.isAvailable(s.name)).sort((a, b) => a.priority - b.priority || Math.random() - 0.5).map((source) => ({ source, vastUrl: source.vast_url }));
938
945
  }
939
946
  /** Record a successful ad fill for a source. */
940
947
  recordSuccess(sourceName) {