@giphy/js-util
Advanced tools
Comparing version 5.0.0 to 5.1.0-beta.0
@@ -26,2 +26,23 @@ import { IRendition, IGif, IImage, IImages } from '@giphy/js-types'; | ||
type MoatData = { | ||
moatClientLevel1: string; | ||
moatClientLevel2: string; | ||
moatClientLevel3: string; | ||
moatClientLevel4: string; | ||
moatClientSlicer1: string; | ||
moatClientSlicer2: string; | ||
zMoatPosition: string; | ||
zMoatSession?: string; | ||
}; | ||
type Tracker = { | ||
vendor: string; | ||
verificationParameters: any; | ||
}; | ||
type TData = { | ||
web?: Tracker[]; | ||
}; | ||
declare const constructMoatData: ({ tdata }: { | ||
tdata: TData; | ||
}) => MoatData | undefined; | ||
/** | ||
@@ -78,4 +99,6 @@ * @param el HTMLElement | ||
declare const injectTrackingPixel: (tags?: string[]) => void; | ||
declare const checkIfWebP: Promise<unknown>; | ||
export { LogLevel, Logger, appendGiphySDKRequestHeader, appendGiphySDKRequestParam, bestfit, checkIfWebP, forEach, getAltText, getBestRendition, getBestRenditionUrl, getBestVideo, getClientRect, getGifHeight, getGifWidth, getGiphySDKRequestHeaders, getPingbackId, getSpecificRendition, mapValues, pick, setRenditionScaleUpMaxPixels, take, without }; | ||
export { LogLevel, Logger, appendGiphySDKRequestHeader, appendGiphySDKRequestParam, bestfit, checkIfWebP, constructMoatData, forEach, getAltText, getBestRendition, getBestRenditionUrl, getBestVideo, getClientRect, getGifHeight, getGifWidth, getGiphySDKRequestHeaders, getPingbackId, getSpecificRendition, injectTrackingPixel, mapValues, pick, setRenditionScaleUpMaxPixels, take, without }; |
@@ -125,2 +125,28 @@ var __defProp = Object.defineProperty; | ||
// src/construct-moat-data.ts | ||
var constructMoatData = ({ tdata }) => { | ||
var _a; | ||
const [moatTrackerData] = ((_a = tdata == null ? void 0 : tdata.web) == null ? void 0 : _a.filter((tracker) => tracker.vendor === "Moat")) || []; | ||
if (moatTrackerData == null ? void 0 : moatTrackerData.verificationParameters) { | ||
const { | ||
moatClientLevel1 = "_ADVERTISER_", | ||
moatClientLevel2 = "_CAMPAIGN_", | ||
moatClientLevel3 = "_LINE_ITEM_", | ||
moatClientLevel4 = "_CREATIVE_", | ||
moatClientSlicer1 = "_SITE_", | ||
moatClientSlicer2 = "_PLACEMENT_", | ||
zMoatPosition = "_POSITION_" | ||
} = moatTrackerData.verificationParameters; | ||
return { | ||
moatClientLevel1, | ||
moatClientLevel2, | ||
moatClientLevel3, | ||
moatClientLevel4, | ||
moatClientSlicer1, | ||
moatClientSlicer2, | ||
zMoatPosition | ||
}; | ||
} | ||
}; | ||
// src/get-client-rect-from-el.ts | ||
@@ -298,2 +324,18 @@ var getClientRect = (el) => { | ||
}; | ||
// src/tracking-pixel.ts | ||
import DOMPurify from "dompurify"; | ||
var injectTrackingPixel = (tags = []) => { | ||
tags.forEach((tag) => { | ||
var _a; | ||
const el = document.createElement("html"); | ||
tag = tag.replace("%%CACHEBUSTER%%", Date.now().toString()); | ||
el.innerHTML = DOMPurify.sanitize(tag); | ||
const pixel = el.querySelector("img"); | ||
if (pixel) { | ||
(_a = document == null ? void 0 : document.querySelector("head")) == null ? void 0 : _a.appendChild(pixel); | ||
} | ||
}); | ||
}; | ||
var tracking_pixel_default = injectTrackingPixel; | ||
export { | ||
@@ -306,2 +348,3 @@ LogLevel, | ||
checkIfWebP, | ||
constructMoatData, | ||
forEach, | ||
@@ -318,2 +361,3 @@ getAltText, | ||
getSpecificRendition, | ||
tracking_pixel_default as injectTrackingPixel, | ||
mapValues, | ||
@@ -320,0 +364,0 @@ pick, |
@@ -12,3 +12,3 @@ { | ||
"name": "@giphy/js-util", | ||
"version": "5.0.0", | ||
"version": "5.1.0-beta.0", | ||
"description": "Shared giphy js utils", | ||
@@ -38,4 +38,4 @@ "homepage": "https://github.com/Giphy/giphy-js/tree/master/packages/util", | ||
"dependencies": { | ||
"@giphy/js-types": "*", | ||
"dompurify": "^2.2.2", | ||
"@giphy/js-types": "5.1.0-beta.0", | ||
"dompurify": "3.1.0", | ||
"uuid": "^9.0.0" | ||
@@ -42,0 +42,0 @@ }, |
export { default as bestfit, setRenditionScaleUpMaxPixels } from './bestfit' | ||
export * from './collections' | ||
export * from './construct-moat-data' | ||
export { default as getClientRect } from './get-client-rect-from-el' | ||
@@ -16,2 +17,3 @@ export { default as getPingbackId } from './get-pingback-id' | ||
export * from './sdk-headers' | ||
export { default as injectTrackingPixel } from './tracking-pixel' | ||
export { checkIfWebP } from './webp-check' |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
102268
45
2214
0
0
1
+ Added@giphy/js-types@5.1.0-beta.0(transitive)
+ Addeddompurify@3.1.0(transitive)
- Removed@giphy/js-types@5.1.0(transitive)
- Removeddompurify@2.5.8(transitive)
Updated@giphy/js-types@5.1.0-beta.0
Updateddompurify@3.1.0