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