UNPKG

@68publishers/amp-client

Version:

JS Client for 68publishers/amp

33 lines (29 loc) 984 B
export class Fingerprint { constructor(value, { bannerId, bannerName, positionId, positionCode, positionName, campaignId, campaignCode, campaignName, closedExpiration = null }) { this.value = value; this.bannerId = bannerId; this.bannerName = bannerName; this.positionId = positionId; this.positionCode = positionCode; this.positionName = positionName; this.campaignId = campaignId; this.campaignCode = campaignCode; this.campaignName = campaignName; this.closedExpiration = closedExpiration; } static createFromProperties(properties) { return new Fingerprint( btoa(encodeURIComponent(JSON.stringify(properties))), properties, ); } static createFromValue(value) { return new Fingerprint( value, JSON.parse(decodeURIComponent(atob(value))), ); } toString() { return this.value; } }