@optable/web-sdk 0.20.0 → 0.21.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.
@@ -1,68 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import OptableSDK from "../sdk";
11
- /*
12
- * getTopics injects an iframe into the page that obtains the browsingTopics observed by optable.
13
- */
14
- OptableSDK.prototype.getTopics = function () {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- const supported = "browsingTopics" in document;
17
- if (!supported) {
18
- throw "browsing-topics not supported";
19
- }
20
- const siteConfig = yield this.site();
21
- if (!siteConfig.getTopicsURL) {
22
- throw "origin not enabled for topics api";
23
- }
24
- const getTopicsURL = new URL(siteConfig.getTopicsURL);
25
- const topicsFrame = document.createElement("iframe");
26
- topicsFrame.src = getTopicsURL.toString();
27
- topicsFrame.allow = "browsing-topics " + getTopicsURL.origin;
28
- topicsFrame.style.display = "none";
29
- const topicsPromise = new Promise((resolve, reject) => {
30
- window.addEventListener("message", (event) => {
31
- if (event.source !== topicsFrame.contentWindow) {
32
- return;
33
- }
34
- if (event.data.error) {
35
- reject(new Error(event.data.error.toString()));
36
- return;
37
- }
38
- resolve(event.data.result);
39
- });
40
- });
41
- document.body.appendChild(topicsFrame);
42
- return topicsPromise;
43
- });
44
- };
45
- /*
46
- * ingestTopics invokes getTopics then makes a profile() call with the resulting topics, if any.
47
- */
48
- OptableSDK.prototype.ingestTopics = function () {
49
- this.getTopics()
50
- .then((topics) => {
51
- if (!topics.length) {
52
- return;
53
- }
54
- const traits = topics.reduce((acc, topic) => {
55
- const traitKey = `topics_v${topic.taxonomyVersion}`;
56
- if (acc[traitKey]) {
57
- acc[traitKey] += ",";
58
- }
59
- else {
60
- acc[traitKey] = "";
61
- }
62
- acc[traitKey] += String(topic.topic);
63
- return acc;
64
- }, {});
65
- this.profile(traits);
66
- })
67
- .catch(() => { });
68
- };
@@ -1,6 +0,0 @@
1
- declare module "../sdk" {
2
- interface OptableSDK {
3
- tryIdentifyFromParams: () => void;
4
- }
5
- }
6
- export {};
@@ -1,20 +0,0 @@
1
- import OptableSDK from "../sdk";
2
- const eidRegexp = /^[a-f0-9]{64}$/i;
3
- function maybeValidEID(eid) {
4
- return eidRegexp.test(eid);
5
- }
6
- OptableSDK.prototype.tryIdentifyFromParams = function (key, prefix) {
7
- const keyRegexp = new RegExp(`^${key || "oeid"}$`, "i");
8
- const searchParams = new URLSearchParams(window.location.search);
9
- let eid = "";
10
- for (const [key, value] of searchParams) {
11
- if (keyRegexp.test(key)) {
12
- eid = value;
13
- break;
14
- }
15
- }
16
- if (eid == "" || (!prefix && !maybeValidEID(eid))) {
17
- return;
18
- }
19
- this.identify((prefix || "e") + ":" + eid.toLowerCase());
20
- };
@@ -1,3 +0,0 @@
1
- {
2
- "version": "v0.20.0"
3
- }
@@ -1,11 +0,0 @@
1
- type OptableConfig = {
2
- host: string;
3
- site: string;
4
- insecure?: boolean;
5
- cookies?: boolean;
6
- initPassport?: boolean;
7
- identityHeaderName?: string;
8
- };
9
- declare function getConfig(config: OptableConfig): Required<OptableConfig>;
10
- export { OptableConfig, getConfig };
11
- export default OptableConfig;
@@ -1,10 +0,0 @@
1
- const DCN_DEFAULTS = {
2
- insecure: false,
3
- cookies: true,
4
- initPassport: true,
5
- identityHeaderName: "X-Optable-Visitor",
6
- };
7
- function getConfig(config) {
8
- return Object.assign(Object.assign({}, DCN_DEFAULTS), config);
9
- }
10
- export { getConfig };
@@ -1,5 +0,0 @@
1
- import type { OptableConfig } from "../config";
2
- declare function buildRequest(path: string, config: Required<OptableConfig>, init?: RequestInit): Request;
3
- declare function fetch<T>(path: string, config: Required<OptableConfig>, init?: RequestInit): Promise<T>;
4
- export { fetch, buildRequest };
5
- export default fetch;
@@ -1,47 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { default as buildInfo } from "../build.json";
11
- import { LocalStorage } from "./storage";
12
- function buildRequest(path, config, init) {
13
- const { site, host, insecure, cookies } = config;
14
- const proto = insecure ? "http" : "https";
15
- const url = new URL(`${site}${path}`, `${proto}://${host}`);
16
- url.searchParams.set("osdk", `web-${buildInfo.version}`);
17
- const requestInit = Object.assign({}, init);
18
- if (cookies) {
19
- requestInit.credentials = "include";
20
- url.searchParams.set("cookies", "yes");
21
- }
22
- else {
23
- const ls = new LocalStorage(config);
24
- const pass = ls.getPassport();
25
- url.searchParams.set("cookies", "no");
26
- requestInit.headers = new Headers();
27
- pass && requestInit.headers.set(config.identityHeaderName, pass);
28
- }
29
- return new Request(url.toString(), requestInit);
30
- }
31
- function fetch(path, config, init) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- const response = yield globalThis.fetch(buildRequest(path, config, init));
34
- const contentType = response.headers.get("Content-Type");
35
- const data = (contentType === null || contentType === void 0 ? void 0 : contentType.startsWith("application/json")) ? yield response.json() : yield response.text();
36
- if (!response.ok) {
37
- throw new Error(data.error);
38
- }
39
- if (response.headers.has(config.identityHeaderName)) {
40
- const ls = new LocalStorage(config);
41
- ls.setPassport(response.headers.get(config.identityHeaderName) || "");
42
- }
43
- return data;
44
- });
45
- }
46
- export { fetch, buildRequest };
47
- export default fetch;
@@ -1,32 +0,0 @@
1
- import { SiteResponse } from "../edge/site";
2
- import type { OptableConfig } from "../config";
3
- import type { TargetingResponse } from "../edge/targeting";
4
- import { lmpidProvider } from "../edge/targeting";
5
- declare global {
6
- interface Window {
7
- __lmpid?: string;
8
- }
9
- }
10
- declare class LocalStorage {
11
- private Config;
12
- private passportKey;
13
- private targetingV1Key;
14
- private targetingKey;
15
- private lmpidKey;
16
- private siteKey;
17
- constructor(Config: OptableConfig);
18
- getPassport(): string | null;
19
- getV1Targeting(): TargetingResponse | null;
20
- getTargeting(): TargetingResponse | null;
21
- setPassport(passport: string): void;
22
- setTargeting(targeting?: TargetingResponse | null): void;
23
- setSite(site?: SiteResponse | null): void;
24
- getSite(): SiteResponse | null;
25
- setLmpid(targeting: TargetingResponse): void;
26
- getLmpid(): string | null;
27
- clearPassport(): void;
28
- clearTargeting(): void;
29
- clearSite(): void;
30
- }
31
- export { LocalStorage, lmpidProvider };
32
- export default LocalStorage;
@@ -1,101 +0,0 @@
1
- import { lmpidProvider } from "../edge/targeting";
2
- function toBinary(str) {
3
- const codeUnits = new Uint16Array(str.length);
4
- for (let i = 0; i < codeUnits.length; i++) {
5
- codeUnits[i] = str.charCodeAt(i);
6
- }
7
- return String.fromCharCode(...new Uint8Array(codeUnits.buffer));
8
- }
9
- class LocalStorage {
10
- constructor(Config) {
11
- this.Config = Config;
12
- const sfx = btoa(toBinary(`${this.Config.host}/${this.Config.site}`));
13
- // Legacy targeting key
14
- this.targetingV1Key = "OPTABLE_TGT_" + sfx;
15
- this.passportKey = "OPTABLE_PASS_" + sfx;
16
- this.targetingKey = "OPTABLE_V2_TGT_" + sfx;
17
- this.lmpidKey = "__lmpid";
18
- this.siteKey = "OPTABLE_SITE_" + sfx;
19
- }
20
- getPassport() {
21
- return window.localStorage.getItem(this.passportKey);
22
- }
23
- getV1Targeting() {
24
- const raw = window.localStorage.getItem(this.targetingV1Key);
25
- const parsed = raw ? JSON.parse(raw) : null;
26
- if (!parsed) {
27
- return null;
28
- }
29
- const audiences = Object.entries(parsed).map(([keyspace, values]) => {
30
- return {
31
- provider: "optable.co",
32
- keyspace,
33
- // 5001 is Optable Private Member Defined Audiences
34
- // See: https://github.com/InteractiveAdvertisingBureau/openrtb/pull/81
35
- //
36
- // Starting v2 this is returned in the targeting payload directly
37
- rtb_segtax: 5001,
38
- ids: [].concat(...[values]).map((id) => ({ id: String(id) })),
39
- };
40
- });
41
- return {
42
- user: [],
43
- audience: audiences,
44
- };
45
- }
46
- getTargeting() {
47
- const raw = window.localStorage.getItem(this.targetingKey);
48
- const parsed = raw ? JSON.parse(raw) : null;
49
- return parsed ? parsed : this.getV1Targeting();
50
- }
51
- setPassport(passport) {
52
- if (passport && passport.length > 0) {
53
- window.localStorage.setItem(this.passportKey, passport);
54
- }
55
- }
56
- setTargeting(targeting) {
57
- if (!targeting) {
58
- return;
59
- }
60
- window.localStorage.setItem(this.targetingKey, JSON.stringify(targeting));
61
- this.setLmpid(targeting);
62
- }
63
- setSite(site) {
64
- if (!site) {
65
- return;
66
- }
67
- window.localStorage.setItem(this.siteKey, JSON.stringify(site));
68
- }
69
- getSite() {
70
- const raw = window.localStorage.getItem(this.siteKey);
71
- const parsed = raw ? JSON.parse(raw) : null;
72
- return parsed;
73
- }
74
- // setLmpid conditionally set the Lmpid in local storage
75
- // based on the provider being present in the targeting response
76
- setLmpid(targeting) {
77
- var _a, _b, _c, _d;
78
- const provider = (_a = targeting.user) === null || _a === void 0 ? void 0 : _a.find((userIds) => userIds.provider === lmpidProvider);
79
- // Don't touch local storage if the provider is not enabled
80
- if (!provider) {
81
- return;
82
- }
83
- const id = (_d = (_c = (_b = provider.ids) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : "";
84
- window.localStorage.setItem(this.lmpidKey, id);
85
- window.__lmpid = id;
86
- }
87
- getLmpid() {
88
- return window.__lmpid || window.localStorage.getItem(this.lmpidKey) || null;
89
- }
90
- clearPassport() {
91
- window.localStorage.removeItem(this.passportKey);
92
- }
93
- clearTargeting() {
94
- window.localStorage.removeItem(this.targetingKey);
95
- }
96
- clearSite() {
97
- window.localStorage.removeItem(this.siteKey);
98
- }
99
- }
100
- export { LocalStorage, lmpidProvider };
101
- export default LocalStorage;
@@ -1,4 +0,0 @@
1
- import type { OptableConfig } from "../config";
2
- declare function Identify(config: Required<OptableConfig>, ids: string[]): Promise<void>;
3
- export { Identify };
4
- export default Identify;
@@ -1,12 +0,0 @@
1
- import { fetch } from "../core/network";
2
- function Identify(config, ids) {
3
- return fetch("/identify", config, {
4
- method: "POST",
5
- headers: {
6
- "Content-Type": "application/json",
7
- },
8
- body: JSON.stringify(ids),
9
- });
10
- }
11
- export { Identify };
12
- export default Identify;
@@ -1,7 +0,0 @@
1
- import type { OptableConfig } from "../config";
2
- type ProfileTraits = {
3
- [key: string]: string | number | boolean;
4
- };
5
- declare function Profile(config: Required<OptableConfig>, traits: ProfileTraits): Promise<void>;
6
- export { Profile, ProfileTraits };
7
- export default Profile;
@@ -1,15 +0,0 @@
1
- import { fetch } from "../core/network";
2
- function Profile(config, traits) {
3
- const profile = {
4
- traits: traits,
5
- };
6
- return fetch("/profile", config, {
7
- method: "POST",
8
- headers: {
9
- "Content-Type": "application/json",
10
- },
11
- body: JSON.stringify(profile),
12
- });
13
- }
14
- export { Profile };
15
- export default Profile;
@@ -1,36 +0,0 @@
1
- type UserSegment = {
2
- id?: string;
3
- name?: string;
4
- value?: string;
5
- ext?: any;
6
- };
7
- type UserData = {
8
- id?: string;
9
- name?: string;
10
- segment?: UserSegment[];
11
- ext?: {
12
- segtax: number;
13
- };
14
- };
15
- type ExtendedIdentifierUID = {
16
- id: string;
17
- atype: UIDAgentType;
18
- ext?: any;
19
- };
20
- type ExtendedIdentifiers = {
21
- source: string;
22
- uids: ExtendedIdentifierUID[];
23
- };
24
- type UserExt = {
25
- eids?: ExtendedIdentifiers[];
26
- };
27
- type User = {
28
- data?: UserData[];
29
- ext?: UserExt;
30
- };
31
- declare enum UIDAgentType {
32
- DeviceID = 1,
33
- InAppImpression = 2,
34
- PersonID = 3
35
- }
36
- export { User, UIDAgentType };
@@ -1,7 +0,0 @@
1
- var UIDAgentType;
2
- (function (UIDAgentType) {
3
- UIDAgentType[UIDAgentType["DeviceID"] = 1] = "DeviceID";
4
- UIDAgentType[UIDAgentType["InAppImpression"] = 2] = "InAppImpression";
5
- UIDAgentType[UIDAgentType["PersonID"] = 3] = "PersonID";
6
- })(UIDAgentType || (UIDAgentType = {}));
7
- export { UIDAgentType };
@@ -1,22 +0,0 @@
1
- import type { OptableConfig } from "../config";
2
- type Size = {
3
- width: string;
4
- height: string;
5
- };
6
- type AuctionConfig = {
7
- seller: string;
8
- decisionLogicURL: string;
9
- requestedSize?: Size;
10
- interestGroupBuyers: string[];
11
- resolveToConfig?: boolean;
12
- auctionSignals?: any;
13
- };
14
- type SiteResponse = {
15
- interestGroupPixel: string;
16
- auctionConfig?: AuctionConfig | null;
17
- getTopicsURL: string;
18
- };
19
- declare function Site(config: Required<OptableConfig>): Promise<SiteResponse>;
20
- declare function SiteFromCache(config: Required<OptableConfig>): SiteResponse | null;
21
- export { Site, SiteResponse, SiteFromCache, Size, AuctionConfig };
22
- export default Site;
@@ -1,30 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { fetch } from "../core/network";
11
- import { LocalStorage } from "../core/storage";
12
- // Grab the site configuration from the server and store it in local storage
13
- function Site(config) {
14
- return __awaiter(this, void 0, void 0, function* () {
15
- const response = yield fetch("/config", config, {
16
- method: "GET",
17
- headers: { Accept: "application/json" },
18
- });
19
- const ls = new LocalStorage(config);
20
- ls.setSite(response);
21
- return response;
22
- });
23
- }
24
- // Obtain the site configuration from local storage
25
- function SiteFromCache(config) {
26
- const ls = new LocalStorage(config);
27
- return ls.getSite();
28
- }
29
- export { Site, SiteFromCache };
30
- export default Site;
@@ -1,34 +0,0 @@
1
- import type { OptableConfig } from "../config";
2
- import { User as RTB2User } from "./rtb2";
3
- type Identifier = {
4
- id: string;
5
- };
6
- type AudienceIdentifiers = {
7
- ids: Identifier[];
8
- provider: string;
9
- rtb_segtax: number;
10
- keyspace?: string;
11
- };
12
- type UserIdentifiers = {
13
- ids: Identifier[];
14
- provider: string;
15
- };
16
- type TargetingResponse = {
17
- audience?: AudienceIdentifiers[];
18
- user?: UserIdentifiers[];
19
- };
20
- declare const lmpidProvider = "loblawmedia.ca";
21
- declare function Targeting(config: Required<OptableConfig>, id: string): Promise<TargetingResponse>;
22
- declare function LmpidFromCache(config: Required<OptableConfig>): string | null;
23
- declare function TargetingFromCache(config: Required<OptableConfig>): TargetingResponse | null;
24
- declare function TargetingClearCache(config: Required<OptableConfig>): void;
25
- type PrebidORTB2 = {
26
- user?: RTB2User;
27
- };
28
- declare function PrebidORTB2(tdata: TargetingResponse | null): PrebidORTB2;
29
- type TargetingKeyValues = {
30
- [key: string]: string[];
31
- };
32
- declare function TargetingKeyValues(tdata: TargetingResponse | null): TargetingKeyValues;
33
- export { Targeting, TargetingFromCache, TargetingClearCache, TargetingResponse, PrebidORTB2, TargetingKeyValues, LmpidFromCache, lmpidProvider, };
34
- export default Targeting;
@@ -1,88 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { fetch } from "../core/network";
11
- import { LocalStorage } from "../core/storage";
12
- import { UIDAgentType } from "./rtb2";
13
- const lmpidProvider = "loblawmedia.ca";
14
- function Targeting(config, id) {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- const searchParams = new URLSearchParams({ id });
17
- const path = "/v2/targeting?" + searchParams.toString();
18
- const response = yield fetch(path, config, {
19
- method: "GET",
20
- headers: { Accept: "application/json" },
21
- });
22
- if (response) {
23
- const ls = new LocalStorage(config);
24
- ls.setTargeting(response);
25
- }
26
- return response;
27
- });
28
- }
29
- function LmpidFromCache(config) {
30
- const ls = new LocalStorage(config);
31
- return ls.getLmpid();
32
- }
33
- function TargetingFromCache(config) {
34
- const ls = new LocalStorage(config);
35
- return ls.getTargeting();
36
- }
37
- function TargetingClearCache(config) {
38
- const ls = new LocalStorage(config);
39
- ls.clearTargeting();
40
- }
41
- /*
42
- * Prebid.js supports passing seller-defined audiences to compatible
43
- * bidder adapters.
44
- *
45
- * We return the contents to be merged in ortb2 and passed to
46
- * bidder adapters via mergeConfig(ortb2)... the caller is free
47
- * to append additional objects before setting the final result.
48
- *
49
- * References:
50
- * https://docs.prebid.org/features/firstPartyData.html#segments-and-taxonomy
51
- * https://iabtechlab.com/wp-content/uploads/2021/03/IABTechLab_Taxonomy_and_Data_Transparency_Standards_to_Support_Seller-defined_Audience_and_Context_Signaling_2021-03.pdf
52
- */
53
- function PrebidORTB2(tdata) {
54
- var _a, _b;
55
- return {
56
- user: {
57
- data: ((_a = tdata === null || tdata === void 0 ? void 0 : tdata.audience) !== null && _a !== void 0 ? _a : []).map((identifiers) => ({
58
- name: identifiers.provider,
59
- segment: identifiers.ids,
60
- ext: { segtax: identifiers.rtb_segtax },
61
- })),
62
- ext: {
63
- eids: ((_b = tdata === null || tdata === void 0 ? void 0 : tdata.user) !== null && _b !== void 0 ? _b : []).map((identifiers) => ({
64
- source: identifiers.provider,
65
- uids: identifiers.ids.map(({ id }) => ({ id, atype: UIDAgentType.PersonID })),
66
- })),
67
- },
68
- },
69
- };
70
- }
71
- function TargetingKeyValues(tdata) {
72
- var _a;
73
- const result = {};
74
- if (!tdata) {
75
- return result;
76
- }
77
- for (const identifiers of (_a = tdata.audience) !== null && _a !== void 0 ? _a : []) {
78
- if (identifiers.keyspace) {
79
- if (!(identifiers.keyspace in result)) {
80
- result[identifiers.keyspace] = [];
81
- }
82
- result[identifiers.keyspace].push(...identifiers.ids.map((el) => el.id));
83
- }
84
- }
85
- return result;
86
- }
87
- export { Targeting, TargetingFromCache, TargetingClearCache, PrebidORTB2, TargetingKeyValues, LmpidFromCache, lmpidProvider, };
88
- export default Targeting;
@@ -1,11 +0,0 @@
1
- import type { OptableConfig } from "../config";
2
- import { User } from "./rtb2";
3
- type TokenizeResponse = {
4
- User: User;
5
- };
6
- type TokenizeRequest = {
7
- id: string;
8
- };
9
- declare function Tokenize(config: Required<OptableConfig>, id: string): Promise<TokenizeResponse>;
10
- export { Tokenize, TokenizeRequest, TokenizeResponse };
11
- export default Tokenize;
@@ -1,15 +0,0 @@
1
- import { fetch } from "../core/network";
2
- function Tokenize(config, id) {
3
- let request = {
4
- id: id,
5
- };
6
- return fetch("/v1/tokenize", config, {
7
- method: "POST",
8
- headers: {
9
- "Content-Type": "application/json",
10
- },
11
- body: JSON.stringify(request),
12
- });
13
- }
14
- export { Tokenize };
15
- export default Tokenize;
@@ -1,12 +0,0 @@
1
- import type { OptableConfig } from "../config";
2
- type Uid2TokenResponse = {
3
- advertising_token: string;
4
- RefreshToken: string;
5
- IdentityExpires: number;
6
- RefreshFrom: number;
7
- RefreshExpires: number;
8
- RefreshResponseKey: string;
9
- };
10
- declare function Uid2Token(config: Required<OptableConfig>, id: string): Promise<Uid2TokenResponse>;
11
- export { Uid2Token };
12
- export default Uid2Token;
@@ -1,12 +0,0 @@
1
- import { fetch } from "../core/network";
2
- function Uid2Token(config, id) {
3
- return fetch("/uid2/token", config, {
4
- method: "POST",
5
- headers: {
6
- "Content-Type": "application/json",
7
- },
8
- body: JSON.stringify(id),
9
- });
10
- }
11
- export { Uid2Token };
12
- export default Uid2Token;
@@ -1,7 +0,0 @@
1
- import type { OptableConfig } from "../config";
2
- type WitnessProperties = {
3
- [key: string]: string | number | boolean;
4
- };
5
- declare function Witness(config: Required<OptableConfig>, event: string, properties: WitnessProperties): Promise<void>;
6
- export { Witness, WitnessProperties };
7
- export default Witness;
@@ -1,16 +0,0 @@
1
- import { fetch } from "../core/network";
2
- function Witness(config, event, properties) {
3
- const evt = {
4
- event: event,
5
- properties: properties,
6
- };
7
- return fetch("/witness", config, {
8
- method: "POST",
9
- headers: {
10
- "Content-Type": "application/json",
11
- },
12
- body: JSON.stringify(evt),
13
- });
14
- }
15
- export { Witness };
16
- export default Witness;