@temple-wallet/extension-ads 8.1.0-dev.4 → 8.1.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/ads-actions/helpers.d.ts +17 -0
- package/dist/ads-actions/helpers.js +96 -0
- package/dist/ads-actions/helpers.js.map +1 -0
- package/dist/ads-actions/index.d.ts +3 -0
- package/dist/ads-actions/index.js +63 -0
- package/dist/ads-actions/index.js.map +1 -0
- package/dist/ads-actions/process-elements-to-hide-or-remove-rule.d.ts +3 -0
- package/dist/ads-actions/process-elements-to-hide-or-remove-rule.js +19 -0
- package/dist/ads-actions/process-elements-to-hide-or-remove-rule.js.map +1 -0
- package/dist/ads-actions/process-permanent-rule.d.ts +3 -0
- package/dist/ads-actions/process-permanent-rule.js +143 -0
- package/dist/ads-actions/process-permanent-rule.js.map +1 -0
- package/dist/ads-actions/process-providers-ads.d.ts +3 -0
- package/dist/ads-actions/process-providers-ads.js +137 -0
- package/dist/ads-actions/process-providers-ads.js.map +1 -0
- package/dist/ads-actions/process-rule.d.ts +3 -0
- package/dist/ads-actions/process-rule.js +98 -0
- package/dist/ads-actions/process-rule.js.map +1 -0
- package/dist/ads-configuration.d.ts +31 -0
- package/dist/ads-configuration.js +30 -0
- package/dist/ads-configuration.js.map +1 -0
- package/dist/constants.d.ts +11 -0
- package/dist/constants.js +12 -0
- package/dist/constants.js.map +1 -0
- package/dist/execute-ads-actions/ads-views/index.d.ts +3 -0
- package/dist/execute-ads-actions/ads-views/index.js +4 -0
- package/dist/execute-ads-actions/ads-views/index.js.map +1 -0
- package/dist/execute-ads-actions/ads-views/make-ads-tw-view.d.ts +3 -0
- package/dist/execute-ads-actions/ads-views/make-ads-tw-view.js +40 -0
- package/dist/execute-ads-actions/ads-views/make-ads-tw-view.js.map +1 -0
- package/dist/execute-ads-actions/ads-views/make-extension-iframe-view.d.ts +3 -0
- package/dist/execute-ads-actions/ads-views/make-extension-iframe-view.js +22 -0
- package/dist/execute-ads-actions/ads-views/make-extension-iframe-view.js.map +1 -0
- package/dist/execute-ads-actions/ads-views/make-tkey-ad.d.ts +3 -0
- package/dist/execute-ads-actions/ads-views/make-tkey-ad.js +38 -0
- package/dist/execute-ads-actions/ads-views/make-tkey-ad.js.map +1 -0
- package/dist/execute-ads-actions/index.d.ts +2 -0
- package/dist/execute-ads-actions/index.js +23 -0
- package/dist/execute-ads-actions/index.js.map +1 -0
- package/dist/execute-ads-actions/observing.d.ts +1 -0
- package/dist/execute-ads-actions/observing.js +129 -0
- package/dist/execute-ads-actions/observing.js.map +1 -0
- package/dist/execute-ads-actions/override-element-styles.d.ts +2 -0
- package/dist/execute-ads-actions/override-element-styles.js +6 -0
- package/dist/execute-ads-actions/override-element-styles.js.map +1 -0
- package/dist/execute-ads-actions/process-insert-ad-action.d.ts +2 -0
- package/dist/execute-ads-actions/process-insert-ad-action.js +153 -0
- package/dist/execute-ads-actions/process-insert-ad-action.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +14 -12
- package/dist/index.js.map +1 -0
- package/dist/render-ads-stack.d.ts +7 -0
- package/dist/render-ads-stack.js +156 -0
- package/dist/render-ads-stack.js.map +1 -0
- package/dist/temple-wallet-api.d.ts +23 -0
- package/dist/temple-wallet-api.js +67 -0
- package/dist/temple-wallet-api.js.map +1 -0
- package/dist/transform-raw-rules.d.ts +3 -0
- package/dist/transform-raw-rules.js +137 -0
- package/dist/transform-raw-rules.js.map +1 -0
- package/dist/types/ad-view.d.ts +7 -0
- package/dist/types/ad-view.js +2 -0
- package/dist/types/ad-view.js.map +1 -0
- package/dist/types/ads-actions.d.ts +56 -0
- package/dist/types/ads-actions.js +15 -0
- package/dist/types/ads-actions.js.map +1 -0
- package/dist/types/ads-meta.d.ts +19 -0
- package/dist/types/ads-meta.js +2 -0
- package/dist/types/ads-meta.js.map +1 -0
- package/dist/types/ads-provider.d.ts +8 -0
- package/dist/types/ads-provider.js +9 -0
- package/dist/types/ads-provider.js.map +1 -0
- package/dist/types/ads-rules.d.ts +26 -0
- package/dist/types/ads-rules.js +2 -0
- package/dist/types/ads-rules.js.map +1 -0
- package/dist/types/temple-wallet-api.d.ts +78 -0
- package/dist/types/temple-wallet-api.js +2 -0
- package/dist/types/temple-wallet-api.js.map +1 -0
- package/dist/utils.d.ts +6 -0
- package/dist/utils.js +4 -0
- package/dist/utils.js.map +1 -0
- package/package.json +3 -2
- package/src/ads-actions/helpers.ts +2 -36
- package/src/ads-actions/process-permanent-rule.ts +3 -5
- package/src/ads-actions/process-providers-ads.ts +2 -28
- package/src/execute-ads-actions/observing.ts +1 -3
- package/src/execute-ads-actions/process-insert-ad-action.ts +4 -24
- package/src/render-ads-stack.ts +2 -10
- package/src/temple-wallet-api.ts +2 -1
- package/src/types/ads-actions.ts +0 -1
|
@@ -33,15 +33,7 @@ const processInsertAdActionOnce = async (
|
|
|
33
33
|
insertionPoint: HTMLDivElement | HTMLTableCellElement,
|
|
34
34
|
onAdsStackError: (error: Error) => void
|
|
35
35
|
) => {
|
|
36
|
-
const {
|
|
37
|
-
elementStyle = {},
|
|
38
|
-
stylesOverrides = [],
|
|
39
|
-
adsMetadata,
|
|
40
|
-
wrapperType,
|
|
41
|
-
originalHeight,
|
|
42
|
-
originalWidth,
|
|
43
|
-
shouldUseBlurredBackground
|
|
44
|
-
} = action;
|
|
36
|
+
const { elementStyle = {}, stylesOverrides = [], adsMetadata, wrapperType, originalHeight, originalWidth } = action;
|
|
45
37
|
|
|
46
38
|
stylesOverrides.sort((a, b) => a.parentDepth - b.parentDepth);
|
|
47
39
|
|
|
@@ -57,8 +49,8 @@ const processInsertAdActionOnce = async (
|
|
|
57
49
|
const { dimensions: minDimensions } =
|
|
58
50
|
typeof firstAdMetadataOrId === 'number' ? AdsConfiguration.bannerAdsMeta[firstAdMetadataOrId] : firstAdMetadataOrId;
|
|
59
51
|
const dimensions = {
|
|
60
|
-
width:
|
|
61
|
-
height:
|
|
52
|
+
width: Math.max(originalWidth, minDimensions.width),
|
|
53
|
+
height: Math.max(originalHeight, minDimensions.height)
|
|
62
54
|
};
|
|
63
55
|
adElement.style.width = wrapperType === 'tbody' ? '100%' : `${dimensions.width}px`;
|
|
64
56
|
adElement.style.height = `${dimensions.height}px`;
|
|
@@ -82,23 +74,11 @@ const processInsertAdActionOnce = async (
|
|
|
82
74
|
action.element.replaceWith(wrapperElement);
|
|
83
75
|
break;
|
|
84
76
|
default:
|
|
85
|
-
const nextSibling = action.parent.children[action.insertionIndex];
|
|
86
77
|
if (action.isSiblingReplacement) {
|
|
87
78
|
wrapperElement.setAttribute(SIBLING_REPLACEMENT_ATTRIBUTE_NAME, 'true');
|
|
88
|
-
const observer = new MutationObserver(mutations => {
|
|
89
|
-
const hasRemoveSiblingMutation = mutations.some(mutation =>
|
|
90
|
-
Array.from(mutation.removedNodes).includes(nextSibling)
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
if (hasRemoveSiblingMutation) {
|
|
94
|
-
wrapperElement.remove();
|
|
95
|
-
observer.disconnect();
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
observer.observe(action.parent, { childList: true });
|
|
99
79
|
}
|
|
100
80
|
stylesOverridesCurrentElement = action.parent;
|
|
101
|
-
action.parent.insertBefore(wrapperElement,
|
|
81
|
+
action.parent.insertBefore(wrapperElement, action.parent.children[action.insertionIndex]);
|
|
102
82
|
break;
|
|
103
83
|
}
|
|
104
84
|
|
package/src/render-ads-stack.ts
CHANGED
|
@@ -58,17 +58,9 @@ export const renderAdsStack = async (
|
|
|
58
58
|
else templeLabelElement.removeAttribute('active');
|
|
59
59
|
|
|
60
60
|
const updateBackground = (creativeSet: CreativeSet = {}) => {
|
|
61
|
-
const prevBackgroundElement = document.getElementById(BACKGROUND_ELEMENT_ID);
|
|
62
|
-
if (source.native && prevBackgroundElement) {
|
|
63
|
-
rootElement.removeChild(prevBackgroundElement);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (source.native) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
61
|
try {
|
|
71
62
|
const { image, video } = creativeSet;
|
|
63
|
+
const prevBackgroundElement = document.getElementById(BACKGROUND_ELEMENT_ID);
|
|
72
64
|
let backgroundElement: HTMLImageElement | HTMLVideoElement | undefined;
|
|
73
65
|
if (image) {
|
|
74
66
|
backgroundElement = document.createElement('img');
|
|
@@ -106,7 +98,7 @@ export const renderAdsStack = async (
|
|
|
106
98
|
if (prevBackgroundElement) {
|
|
107
99
|
rootElement.replaceChild(backgroundElement, prevBackgroundElement);
|
|
108
100
|
} else {
|
|
109
|
-
rootElement.
|
|
101
|
+
rootElement.appendChild(backgroundElement);
|
|
110
102
|
}
|
|
111
103
|
} catch (e) {
|
|
112
104
|
console.error(e);
|
package/src/temple-wallet-api.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import axiosFetchAdapter from '@vespaiach/axios-fetch-adapter';
|
|
1
2
|
import axios, { AxiosInstance, AxiosResponse } from 'axios';
|
|
2
3
|
|
|
3
4
|
import {
|
|
@@ -24,7 +25,7 @@ export class TempleWalletApi {
|
|
|
24
25
|
constructor(baseUrl: string) {
|
|
25
26
|
this.api = axios.create({
|
|
26
27
|
baseURL: new URL('/api', baseUrl).href,
|
|
27
|
-
adapter:
|
|
28
|
+
adapter: axiosFetchAdapter
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
31
|
|
package/src/types/ads-actions.ts
CHANGED
|
@@ -31,7 +31,6 @@ interface InsertAdActionProps
|
|
|
31
31
|
stylesOverrides?: AdStylesOverrides[];
|
|
32
32
|
originalWidth: number;
|
|
33
33
|
originalHeight: number;
|
|
34
|
-
shouldUseBlurredBackground?: boolean;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
export interface ReplaceAllChildrenWithAdAction extends AdActionBase, InsertAdActionProps {
|