@temple-wallet/extension-ads 2.0.2 → 3.0.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.d.ts +14 -6
- package/dist/index.js +13 -12
- package/package.json +2 -1
- package/src/ads-actions/helpers.ts +39 -27
- package/src/ads-actions/index.ts +9 -33
- package/src/ads-actions/process-permanent-rule.ts +27 -17
- package/src/ads-actions/process-providers-ads.ts +140 -0
- package/src/ads-actions/process-rule.ts +17 -7
- package/src/ads-configuration.ts +27 -11
- package/src/ads-meta.ts +14 -14
- package/src/constants.ts +5 -0
- package/src/execute-ads-actions/ads-views/make-hypelab-ad.ts +2 -13
- package/src/execute-ads-actions/ads-views/make-persona-ad.ts +3 -16
- package/src/execute-ads-actions/ads-views/make-tkey-ad.ts +1 -8
- package/src/execute-ads-actions/index.ts +1 -1
- package/src/execute-ads-actions/observing.ts +37 -16
- package/src/execute-ads-actions/process-insert-ad-action.ts +44 -47
- package/src/index.ts +2 -0
- package/src/render-ads-stack.ts +101 -0
- package/src/types/ad-view.ts +0 -1
- package/src/types/ads-actions.ts +13 -9
package/src/types/ads-actions.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StringRecord } from 'src/utils';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { AdMetadata } from './ads-meta';
|
|
4
4
|
import type { AdStylesOverrides } from './temple-wallet-api';
|
|
5
5
|
|
|
6
6
|
export enum AdActionType {
|
|
@@ -11,17 +11,21 @@ export enum AdActionType {
|
|
|
11
11
|
HideElement = 'hide-element'
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export enum AdType {
|
|
15
|
+
Permanent = 'permanent',
|
|
16
|
+
SlotReplacement = 'slot-replacement',
|
|
17
|
+
ProviderReplacement = 'provider-replacement'
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
interface AdActionBase {
|
|
15
21
|
type: AdActionType;
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
interface InsertAdActionProps {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/** @deprecated // Always wrapping now
|
|
22
|
-
* TODO: Clean-up usage
|
|
25
|
+
/** A value of 'number' type stands for the value with respective index in `BANNER_ADS_META`. It is done to shorten
|
|
26
|
+
* ads stack Iframe URL search parameters.
|
|
23
27
|
*/
|
|
24
|
-
|
|
28
|
+
adsMetadata: (number | AdMetadata)[];
|
|
25
29
|
divWrapperStyle?: StringRecord<string>;
|
|
26
30
|
elementStyle?: StringRecord<string>;
|
|
27
31
|
stylesOverrides?: AdStylesOverrides[];
|
|
@@ -41,6 +45,7 @@ export interface SimpleInsertAdAction extends AdActionBase, InsertAdActionProps
|
|
|
41
45
|
type: AdActionType.SimpleInsertAd;
|
|
42
46
|
parent: HTMLElement;
|
|
43
47
|
insertionIndex: number;
|
|
48
|
+
isSiblingReplacement: boolean;
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
export interface RemoveElementAction extends AdActionBase {
|
|
@@ -55,7 +60,7 @@ export interface HideElementAction extends AdActionBase {
|
|
|
55
60
|
|
|
56
61
|
export type InsertAdAction = ReplaceAllChildrenWithAdAction | ReplaceElementWithAdAction | SimpleInsertAdAction;
|
|
57
62
|
|
|
58
|
-
export type OmitAdInAction<T extends InsertAdActionProps> = Omit<T, '
|
|
63
|
+
export type OmitAdInAction<T extends InsertAdActionProps> = Omit<T, 'adsMetadata'>;
|
|
59
64
|
|
|
60
65
|
export type InsertAdActionWithoutMeta =
|
|
61
66
|
| OmitAdInAction<ReplaceAllChildrenWithAdAction>
|
|
@@ -66,8 +71,7 @@ export type AdAction = InsertAdAction | RemoveElementAction | HideElementAction;
|
|
|
66
71
|
|
|
67
72
|
export type AddActionsIfAdResolutionAvailable = (
|
|
68
73
|
elementToMeasure: Element,
|
|
69
|
-
|
|
70
|
-
minContainerWidthIsBannerWidth: boolean,
|
|
74
|
+
adType: AdType,
|
|
71
75
|
adIsNative: boolean,
|
|
72
76
|
...actionsBases: (InsertAdActionWithoutMeta | HideElementAction | RemoveElementAction)[]
|
|
73
77
|
) => boolean;
|