@surfside/ads 3.6.5-d8ef3a1a.0 → 3.7.0-3e4b8bb0.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.
Files changed (56) hide show
  1. package/lib/cjs/BuildInfo.js +2 -2
  2. package/lib/cjs/Init.js +15 -8
  3. package/lib/cjs/Init.js.map +1 -1
  4. package/lib/cjs/components/Banner.js +27 -12
  5. package/lib/cjs/components/Banner.js.map +1 -1
  6. package/lib/cjs/components/Card.js +8 -0
  7. package/lib/cjs/components/Card.js.map +1 -1
  8. package/lib/cjs/components/Carousel.js +27 -2
  9. package/lib/cjs/components/Carousel.js.map +1 -1
  10. package/lib/cjs/components/Creative.js +96 -7
  11. package/lib/cjs/components/Creative.js.map +1 -1
  12. package/lib/cjs/components/Debug.js +20 -0
  13. package/lib/cjs/components/Debug.js.map +1 -0
  14. package/lib/cjs/components/Dynamic.js +21 -8
  15. package/lib/cjs/components/Dynamic.js.map +1 -1
  16. package/lib/cjs/components/SimpleCreative.js +8 -2
  17. package/lib/cjs/components/SimpleCreative.js.map +1 -1
  18. package/lib/cjs/components/Video.js +18 -8
  19. package/lib/cjs/components/Video.js.map +1 -1
  20. package/lib/cjs/index.module.js +11 -5
  21. package/lib/cjs/index.module.js.map +1 -1
  22. package/lib/cjs/index.script.js +2 -1
  23. package/lib/cjs/index.script.js.map +1 -1
  24. package/lib/esm/BuildInfo.js +2 -2
  25. package/lib/esm/Init.js +15 -8
  26. package/lib/esm/Init.js.map +1 -1
  27. package/lib/esm/components/Banner.js +28 -13
  28. package/lib/esm/components/Banner.js.map +1 -1
  29. package/lib/esm/components/Card.js +8 -0
  30. package/lib/esm/components/Card.js.map +1 -1
  31. package/lib/esm/components/Carousel.js +27 -2
  32. package/lib/esm/components/Carousel.js.map +1 -1
  33. package/lib/esm/components/Creative.js +94 -6
  34. package/lib/esm/components/Creative.js.map +1 -1
  35. package/lib/esm/components/Debug.js +16 -0
  36. package/lib/esm/components/Debug.js.map +1 -0
  37. package/lib/esm/components/Dynamic.js +22 -9
  38. package/lib/esm/components/Dynamic.js.map +1 -1
  39. package/lib/esm/components/SimpleCreative.js +8 -2
  40. package/lib/esm/components/SimpleCreative.js.map +1 -1
  41. package/lib/esm/components/Video.js +20 -10
  42. package/lib/esm/components/Video.js.map +1 -1
  43. package/lib/esm/index.module.js +11 -5
  44. package/lib/esm/index.module.js.map +1 -1
  45. package/lib/esm/index.script.js +2 -1
  46. package/lib/esm/index.script.js.map +1 -1
  47. package/lib/types/Init.d.ts +1 -0
  48. package/lib/types/components/Banner.d.ts +6 -7
  49. package/lib/types/components/Card.d.ts +1 -0
  50. package/lib/types/components/Carousel.d.ts +6 -4
  51. package/lib/types/components/Creative.d.ts +32 -4
  52. package/lib/types/components/Debug.d.ts +2 -0
  53. package/lib/types/components/Dynamic.d.ts +1 -0
  54. package/lib/types/components/SimpleCreative.d.ts +6 -4
  55. package/lib/types/components/Video.d.ts +7 -6
  56. package/package.json +4 -4
@@ -1,18 +1,17 @@
1
- import { type ILogger } from '@surfside/ads-core';
2
- import { SimpleCreativeComponent, type CompletedSimpleCreativeAttributes } from './SimpleCreative';
3
- import { type InitApi } from './Creative';
4
- import { type GetUserIdFn } from '@surfside/ads-core-web';
1
+ import { type BidRequestReason } from '@surfside/ads-core';
2
+ import { type ISimpleCreativeComponentDependencies, SimpleCreativeComponent, type CompletedSimpleCreativeAttributes } from './SimpleCreative';
3
+ export interface ISurfsideBannerComponentDependencies extends ISimpleCreativeComponentDependencies {
4
+ }
5
5
  export declare class SurfsideBanner extends SimpleCreativeComponent {
6
6
  private _cancellationToken;
7
- private _nextRender;
8
7
  private _bounce;
9
8
  static get observedAttributes(): string[];
10
- constructor(initApi: InitApi, getUserId: GetUserIdFn, logger?: ILogger);
9
+ constructor(dependencies: ISurfsideBannerComponentDependencies);
11
10
  protected getComponentName(): string;
12
11
  attributeChangedCallback(this: this, name: string, oldValue: string | null, newValue: string | null): Promise<void>;
13
12
  connectedCallback(): Promise<void>;
14
13
  adoptedCallback(): void;
15
14
  disconnectedCallback(): void;
16
15
  connectedMoveCallback(): void;
17
- render(this: this & CompletedSimpleCreativeAttributes): Promise<void>;
16
+ render(this: this & CompletedSimpleCreativeAttributes, reason?: BidRequestReason): Promise<void>;
18
17
  }
@@ -13,5 +13,6 @@ export declare class SurfsideProductCard extends CreativeComponent {
13
13
  protected getComponentName(): string;
14
14
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): Promise<void>;
15
15
  connectedCallback(): Promise<void>;
16
+ disconnectedCallback(): void;
16
17
  render(this: this & CompletedCardAttributes): Promise<void>;
17
18
  }
@@ -1,6 +1,5 @@
1
- import { type ILogger, type RecommenderType } from '@surfside/ads-core';
2
- import { type CompletedBaseAttributes, CreativeComponent, type InitApi } from './Creative';
3
- import { type GetUserIdFn } from '@surfside/ads-core-web';
1
+ import { type RecommenderType } from '@surfside/ads-core';
2
+ import { type CompletedBaseAttributes, CreativeComponent, type ICreativeComponentDependencies } from './Creative';
4
3
  export declare const NextType: {
5
4
  readonly Product: "product";
6
5
  readonly Page: "page";
@@ -13,6 +12,8 @@ export type CompletedCarouselAttributes = CompletedBaseAttributes & {
13
12
  recommend: string;
14
13
  nextType: string;
15
14
  };
15
+ export interface ISurfsideCarouselComponentDependencies extends ICreativeComponentDependencies {
16
+ }
16
17
  export declare class SurfsideCarousel extends CreativeComponent {
17
18
  private _cancellationToken;
18
19
  private _renderDebounce?;
@@ -23,9 +24,10 @@ export declare class SurfsideCarousel extends CreativeComponent {
23
24
  protected recommend: RecommenderType;
24
25
  protected nextType: 'page' | 'product';
25
26
  static get observedAttributes(): string[];
26
- constructor(initApi: InitApi, getUserId: GetUserIdFn, logger?: ILogger);
27
+ constructor(dependencies: ISurfsideCarouselComponentDependencies);
27
28
  protected getComponentName(): string;
28
29
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): Promise<void>;
29
30
  connectedCallback(): Promise<void>;
31
+ disconnectedCallback(): void;
30
32
  render(this: this & CompletedCarouselAttributes): Promise<void>;
31
33
  }
@@ -1,4 +1,4 @@
1
- import { type AsyncResult, type ILogger, type IContextLogger } from '@surfside/ads-core';
1
+ import { type AsyncResult, type ILogger, type IContextLogger, type BidRequestReason, type IBidRequest } from '@surfside/ads-core';
2
2
  import { type GetUserIdFn, type ISurfsideWebApi } from '@surfside/ads-core-web';
3
3
  export type CompletedBaseAttributes = {
4
4
  accountId: string;
@@ -24,9 +24,15 @@ export declare const RecommenderTypeInputs: {
24
24
  };
25
25
  export declare const AttributeValOrThrow: (element: Element, attribute: string, value: string | null) => string;
26
26
  export declare const DEBOUNCE_THRESHOLD = 10;
27
+ export type ReauctionReason = Exclude<BidRequestReason, 'initial'>;
28
+ export declare const WithBidRequestReason: (request: IBidRequest, reason: BidRequestReason) => IBidRequest;
29
+ export interface ICreativeComponentDependencies {
30
+ initApi: InitApi;
31
+ getUserId: GetUserIdFn;
32
+ logger?: ILogger;
33
+ isDebug: boolean;
34
+ }
27
35
  export declare abstract class CreativeComponent extends HTMLElement {
28
- private _initApi;
29
- private _getUserId;
30
36
  protected accountId: string | undefined;
31
37
  protected siteId: string | undefined;
32
38
  protected locationId: string | undefined;
@@ -43,7 +49,17 @@ export declare abstract class CreativeComponent extends HTMLElement {
43
49
  private _instanceId;
44
50
  protected get instanceId(): string;
45
51
  private readonly _monkeyHistoryReplaceCallback;
46
- constructor(_initApi: InitApi, _getUserId: GetUserIdFn, logger?: ILogger);
52
+ private _reauctionTimer;
53
+ private _reauctionCallback;
54
+ private _reauctionRemainingMs;
55
+ private _reauctionStartedAt;
56
+ private _reauctionWasPaused;
57
+ private _initApi;
58
+ private _getUserId;
59
+ logger?: ILogger;
60
+ protected readonly isDebug: boolean;
61
+ private readonly _visibilityChangeCallback;
62
+ constructor({ initApi, getUserId, logger, isDebug }: ICreativeComponentDependencies);
47
63
  connectedCallback(): void;
48
64
  protected abstract getComponentName(): string;
49
65
  protected static get observedBaseAttributes(): string[];
@@ -60,6 +76,18 @@ export declare abstract class CreativeComponent extends HTMLElement {
60
76
  protected lazyLoadApi(): Promise<void>;
61
77
  protected baseAttributeChangedCallback(key: BaseAttributeNames, oldValue: string | null, newValue: string | null, logger?: IContextLogger): Promise<void>;
62
78
  disconnectedCallback(): void;
79
+ private reauctionPaused;
80
+ /**
81
+ * Schedules `callback` to run after `intervalMs`, replacing any pending re-auction.
82
+ * The countdown is paused while the document is hidden and resumes with the remaining time
83
+ * once it is visible again. `callback` receives 'resume' if the countdown was paused at any
84
+ * point, otherwise 'refresh', so it can be passed through to the bid request's `ext.reason`.
85
+ */
86
+ protected scheduleReauction(callback: (reason: ReauctionReason) => void, intervalMs: number): void;
87
+ protected clearReauction(): void;
88
+ private startReauctionTimer;
89
+ private pauseReauction;
90
+ private resumeReauction;
63
91
  protected initApi(): Promise<void>;
64
92
  protected readBaseAttributes(): asserts this is this & CompletedBaseAttributes;
65
93
  }
@@ -0,0 +1,2 @@
1
+ export type CreativeTypes = 'banners' | 'videos' | 'carousels' | 'dynamic';
2
+ export declare const CreateDebugButton: (type: CreativeTypes, args: Record<string, string>) => HTMLAnchorElement;
@@ -18,6 +18,7 @@ export declare class SurfsideDynamicZone extends CreativeComponent {
18
18
  protected getComponentName(): string;
19
19
  static get observedAttributes(): string[];
20
20
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): Promise<void>;
21
+ disconnectedCallback(): void;
21
22
  render(this: this & CompletedDynamicAttributes): Promise<void>;
22
23
  requestAndRender(this: this & CompletedDynamicAttributes, dynamicZoneRequest: IDynamicZoneRequest): Promise<void>;
23
24
  }
@@ -1,6 +1,5 @@
1
- import { type BaseAttributeNames, CreativeComponent, type InitApi, type CompletedBaseAttributes } from './Creative';
2
- import type { GetUserIdFn } from '@surfside/ads-core-web';
3
- import { type IContextLogger, type ILogger } from '@surfside/ads-core';
1
+ import { type BaseAttributeNames, CreativeComponent, type CompletedBaseAttributes, type ICreativeComponentDependencies } from './Creative';
2
+ import { type IContextLogger } from '@surfside/ads-core';
4
3
  export type CompletedSimpleCreativeAttributes = CompletedBaseAttributes & {
5
4
  width: number;
6
5
  height: number;
@@ -8,12 +7,15 @@ export type CompletedSimpleCreativeAttributes = CompletedBaseAttributes & {
8
7
  export type SimpleCreativeAttributeNames = BaseAttributeNames | 'width' | 'height';
9
8
  export declare const IntValOrThrow: (element: Element, attribute: string, value: string | null) => number;
10
9
  export declare const IntValOr: <T>(element: Element, attribute: string, value: string | null, or: T) => number | T;
10
+ export interface ISimpleCreativeComponentDependencies extends ICreativeComponentDependencies {
11
+ }
11
12
  export declare abstract class SimpleCreativeComponent extends CreativeComponent {
12
13
  protected width?: number | null;
13
14
  protected height?: number | null;
14
- constructor(initApi: InitApi, getUserId: GetUserIdFn, logger?: ILogger);
15
+ constructor(dependencies: ISimpleCreativeComponentDependencies);
15
16
  protected attributesLoaded(): boolean;
16
17
  protected static get observedSimpleAttributes(): string[];
18
+ protected handleSimpleAttributeChange(name: string, oldValue: string | null, newValue: string | null, logger?: IContextLogger): Promise<void>;
17
19
  simpleAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null, logger?: IContextLogger): Promise<void>;
18
20
  readSimpleAttributes(): asserts this is this & CompletedSimpleCreativeAttributes;
19
21
  }
@@ -1,22 +1,23 @@
1
- import { type ILogger } from '@surfside/ads-core';
2
- import { SimpleCreativeComponent, type CompletedSimpleCreativeAttributes } from './SimpleCreative';
3
- import { type InitApi } from './Creative';
4
- import { type GetUserIdFn } from '@surfside/ads-core-web';
1
+ import { type BidRequestReason } from '@surfside/ads-core';
2
+ import { type ISimpleCreativeComponentDependencies, SimpleCreativeComponent, type CompletedSimpleCreativeAttributes } from './SimpleCreative';
5
3
  export type CompletedVideoAttributes = CompletedSimpleCreativeAttributes & {
6
4
  minDuration: number;
7
5
  maxDuration: number;
8
6
  };
7
+ export interface ISurfsideVideoComponentDependencies extends ISimpleCreativeComponentDependencies {
8
+ }
9
9
  export declare class SurfsideVideo extends SimpleCreativeComponent {
10
10
  private _cancellationToken;
11
11
  protected minDuration?: number | null;
12
12
  protected maxDuration?: number | null;
13
13
  private _bounce;
14
14
  static get observedAttributes(): string[];
15
- constructor(initApi: InitApi, getUserId: GetUserIdFn, logger?: ILogger);
15
+ constructor(dependencies: ISurfsideVideoComponentDependencies);
16
16
  protected getComponentName(): string;
17
17
  protected attributesLoaded(): boolean;
18
18
  attributeChangedCallback(this: this, name: string, oldValue: string | null, newValue: string | null): Promise<void>;
19
19
  protected readVideoAttributes(): asserts this is this & CompletedVideoAttributes;
20
20
  connectedCallback(): Promise<void>;
21
- render(this: this & CompletedVideoAttributes): Promise<void>;
21
+ disconnectedCallback(): void;
22
+ render(this: this & CompletedVideoAttributes, reason?: BidRequestReason): Promise<void>;
22
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surfside/ads",
3
- "version": "3.6.5-d8ef3a1a.0",
3
+ "version": "3.7.0-3e4b8bb0.0",
4
4
  "module": "./lib/esm/index.module.js",
5
5
  "main": "./lib/cjs/index.module.js",
6
6
  "types": "./lib/types/index.module.d.ts",
@@ -35,8 +35,8 @@
35
35
  "typescript": "^5"
36
36
  },
37
37
  "dependencies": {
38
- "@surfside/ads-core": "2.5.0-d8ef3a1a.0",
39
- "@surfside/ads-core-mock": "0.5.0-d8ef3a1a.0",
40
- "@surfside/ads-core-web": "0.5.0-d8ef3a1a.0"
38
+ "@surfside/ads-core": "2.7.0-3e4b8bb0.0",
39
+ "@surfside/ads-core-mock": "0.7.0-3e4b8bb0.0",
40
+ "@surfside/ads-core-web": "0.7.0-3e4b8bb0.0"
41
41
  }
42
42
  }