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