Skip to content

Commit

Permalink
Add init flag to config (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikola-Milekic authored Oct 12, 2023
1 parent de5c08f commit a8f239c
Show file tree
Hide file tree
Showing 30 changed files with 59 additions and 36 deletions.
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
SDK_URI: https://cdn.optable.co/web-sdk/latest/sdk.js
SANDBOX_HOST: sandbox.optable.co
SANDBOX_INSECURE: "false"
SANDBOX_INIT: "true"
UID2_BASE_URL: https://prod.uidapi.com
steps:
- checkout
Expand All @@ -55,6 +56,7 @@ jobs:
export SDK_URI="https://cdn.optable.co/web-sdk/${CIRCLE_TAG}/sdk.js"
export SANDBOX_HOST="sandbox.optable.co"
export SANDBOX_INSECURE="false"
export SANDBOX_INIT="true"
export UID2_BASE_URL="https://prod.uidapi.com"
make -j --output-sync
- persist_to_workspace:
Expand Down
35 changes: 18 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ deps:
export SDK_URI ?= https://localhost:8181/sdk.js
export SANDBOX_HOST ?= sandbox.optable.co
export SANDBOX_INSECURE ?= false
export SANDBOX_INIT ?= true
export ADS_HOST ?= ads.optable.co
export UID2_BASE_URL ?= https://operator-integ.uidapi.com

Expand All @@ -30,24 +31,24 @@ demos: demo-html demo-react demo-npm

.PHONY: demo-html
demo-html:
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE}' < demos/vanilla/identify.html.tpl > demos/vanilla/identify.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE}' < demos/vanilla/witness.html.tpl > demos/vanilla/witness.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE}' < demos/vanilla/profile.html.tpl > demos/vanilla/profile.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE}' < demos/vanilla/targeting/gam360.html.tpl > demos/vanilla/targeting/gam360.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE}' < demos/vanilla/targeting/gam360-cached.html.tpl > demos/vanilla/targeting/gam360-cached.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE}' < demos/vanilla/targeting/prebid.html.tpl > demos/vanilla/targeting/prebid.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE}' < demos/vanilla/nocookies/identify.html.tpl > demos/vanilla/nocookies/identify.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE}' < demos/vanilla/nocookies/witness.html.tpl > demos/vanilla/nocookies/witness.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE}' < demos/vanilla/nocookies/profile.html.tpl > demos/vanilla/nocookies/profile.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE}' < demos/vanilla/nocookies/targeting/gam360.html.tpl > demos/vanilla/nocookies/targeting/gam360.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE}' < demos/vanilla/nocookies/targeting/gam360-cached.html.tpl > demos/vanilla/nocookies/targeting/gam360-cached.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE}' < demos/vanilla/nocookies/targeting/prebid.html.tpl > demos/vanilla/nocookies/targeting/prebid.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE}' < demos/integration/lmpid-prebid-gpt.html.tpl > demos/integration/lmpid-prebid-gpt.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE}' < demos/integration/lmpid-signal-gpt.html.tpl > demos/integration/lmpid-signal-gpt.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE}' < demos/ads/protected-audience/advertiser.html.tpl > demos/ads/protected-audience/advertiser.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT}' < demos/vanilla/identify.html.tpl > demos/vanilla/identify.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT}' < demos/vanilla/witness.html.tpl > demos/vanilla/witness.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT}' < demos/vanilla/profile.html.tpl > demos/vanilla/profile.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT}' < demos/vanilla/targeting/gam360.html.tpl > demos/vanilla/targeting/gam360.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT}' < demos/vanilla/targeting/gam360-cached.html.tpl > demos/vanilla/targeting/gam360-cached.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT}' < demos/vanilla/targeting/prebid.html.tpl > demos/vanilla/targeting/prebid.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT}' < demos/vanilla/nocookies/identify.html.tpl > demos/vanilla/nocookies/identify.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT}' < demos/vanilla/nocookies/witness.html.tpl > demos/vanilla/nocookies/witness.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT}' < demos/vanilla/nocookies/profile.html.tpl > demos/vanilla/nocookies/profile.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT}' < demos/vanilla/nocookies/targeting/gam360.html.tpl > demos/vanilla/nocookies/targeting/gam360.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT}' < demos/vanilla/nocookies/targeting/gam360-cached.html.tpl > demos/vanilla/nocookies/targeting/gam360-cached.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT}' < demos/vanilla/nocookies/targeting/prebid.html.tpl > demos/vanilla/nocookies/targeting/prebid.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT}' < demos/integration/lmpid-prebid-gpt.html.tpl > demos/integration/lmpid-prebid-gpt.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT}' < demos/integration/lmpid-signal-gpt.html.tpl > demos/integration/lmpid-signal-gpt.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT}' < demos/ads/protected-audience/advertiser.html.tpl > demos/ads/protected-audience/advertiser.html
envsubst '$${ADS_HOST}' < demos/ads/protected-audience/publisher.html.tpl > demos/ads/protected-audience/publisher.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${UID2_BASE_URL}' < demos/vanilla/uid2_token/login.html.tpl > demos/vanilla/uid2_token/login.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${UID2_BASE_URL}' < demos/vanilla/uid2_token/index.html.tpl > demos/vanilla/uid2_token/index.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT} $${UID2_BASE_URL}' < demos/vanilla/uid2_token/login.html.tpl > demos/vanilla/uid2_token/login.html
envsubst '$${SDK_URI} $${SANDBOX_HOST} $${SANDBOX_INSECURE} $${SANDBOX_INIT} $${UID2_BASE_URL}' < demos/vanilla/uid2_token/index.html.tpl > demos/vanilla/uid2_token/index.html

.PHONY: demo-react
demo-react: build-lib
Expand Down
2 changes: 2 additions & 0 deletions demos/ads/protected-audience/advertiser.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ window.optable = window.optable || { cmd: [] };
optable.cmd.push(() => {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: ${SANDBOX_INSECURE},
cookies: cookiesTransport,
Expand All @@ -52,6 +53,7 @@ optable.cmd.push(() => {
optable.cmd.push(() => {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
cookies: cookiesTransport,
Expand Down
1 change: 1 addition & 0 deletions demos/integration/lmpid-prebid-gpt.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ [email protected]</code></pre>
optable.cmd.push(function () {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
cookies: cookiesTransport,
Expand Down
1 change: 1 addition & 0 deletions demos/integration/lmpid-signal-gpt.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ [email protected]</code></pre>
optable.cmd.push(function () {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
cookies: (new URLSearchParams(window.location.search)).get("cookies") === "yes",
Expand Down
1 change: 1 addition & 0 deletions demos/react/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = {
new webpack.DefinePlugin({
SANDBOX_CONFIG: JSON.stringify({
host: process.env.SANDBOX_HOST,
initPassport: process.env.SANDBOX_INIT === "true",
site: "web-sdk-demo",
insecure: process.env.SANDBOX_INSECURE === "true",
}),
Expand Down
1 change: 1 addition & 0 deletions demos/vanilla/identify.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
optable.cmd.push(function () {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
});
Expand Down
1 change: 1 addition & 0 deletions demos/vanilla/nocookies/identify.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
optable.cmd.push(function () {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
cookies: false,
Expand Down
1 change: 1 addition & 0 deletions demos/vanilla/nocookies/profile.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
optable.cmd.push(function () {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
cookies: false,
Expand Down
1 change: 1 addition & 0 deletions demos/vanilla/nocookies/targeting/gam360-cached.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
optable.cmd.push(function () {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
cookies: false,
Expand Down
1 change: 1 addition & 0 deletions demos/vanilla/nocookies/targeting/gam360.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
optable.cmd.push(function () {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
cookies: false,
Expand Down
1 change: 1 addition & 0 deletions demos/vanilla/nocookies/targeting/prebid.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
optable.cmd.push(function () {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
cookies: false,
Expand Down
1 change: 1 addition & 0 deletions demos/vanilla/nocookies/witness.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
optable.cmd.push(function () {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
cookies: false,
Expand Down
1 change: 1 addition & 0 deletions demos/vanilla/profile.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
optable.cmd.push(function () {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
});
Expand Down
1 change: 1 addition & 0 deletions demos/vanilla/targeting/gam360-cached.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
optable.cmd.push(function () {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
});
Expand Down
1 change: 1 addition & 0 deletions demos/vanilla/targeting/gam360.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
optable.cmd.push(function () {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
});
Expand Down
1 change: 1 addition & 0 deletions demos/vanilla/targeting/prebid.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
optable.cmd.push(function () {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
});
Expand Down
1 change: 1 addition & 0 deletions demos/vanilla/uid2_token/login.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
optable.cmd.push(function () {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
});
Expand Down
1 change: 1 addition & 0 deletions demos/vanilla/witness.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
optable.cmd.push(function () {
optable.instance = new optable.SDK({
host: "${SANDBOX_HOST}",
initPassport: JSON.parse("${SANDBOX_INIT}"),
site: "web-sdk-demo",
insecure: JSON.parse("${SANDBOX_INSECURE}"),
});
Expand Down
2 changes: 1 addition & 1 deletion lib/addons/try-identify.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe("tryIdentifyFromParams", () => {

beforeEach(() => {
delete window.location;
SDK = new OptableSDK({ host: "localhost", site: "test" }, false);
SDK = new OptableSDK({ host: "localhost", site: "test" });
SDK.identify = jest.fn();
});

Expand Down
2 changes: 2 additions & 0 deletions lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ type OptableConfig = {
site: string;
insecure?: boolean;
cookies?: boolean;
initPassport?: boolean;
};

const SANDBOX_DEFAULTS = {
insecure: false,
cookies: true,
initPassport: true,
};

function getConfig(config: OptableConfig): Required<OptableConfig> {
Expand Down
7 changes: 3 additions & 4 deletions lib/core/network.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { OptableConfig } from "../config";
import { getConfig } from "../config";
import { default as buildInfo } from "../build.json";
import { LocalStorage } from "./storage";

function buildRequest(path: string, config: OptableConfig, init?: RequestInit): Request {
const { site, host, insecure, cookies } = getConfig(config);
function buildRequest(path: string, config: Required<OptableConfig>, init?: RequestInit): Request {
const { site, host, insecure, cookies } = config;

const proto = insecure ? "http" : "https";
const url = new URL(`${site}${path}`, `${proto}://${host}`);
Expand Down Expand Up @@ -32,7 +31,7 @@ function buildRequest(path: string, config: OptableConfig, init?: RequestInit):
return request;
}

async function fetch<T>(path: string, config: OptableConfig, init?: RequestInit): Promise<T> {
async function fetch<T>(path: string, config: Required<OptableConfig>, init?: RequestInit): Promise<T> {
const response = await window.fetch(buildRequest(path, config, init));

const contentType = response.headers.get("Content-Type");
Expand Down
2 changes: 1 addition & 1 deletion lib/edge/identify.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { OptableConfig } from "../config";
import { fetch } from "../core/network";

function Identify(config: OptableConfig, ids: string[]): Promise<void> {
function Identify(config: Required<OptableConfig>, ids: string[]): Promise<void> {
return fetch("/identify", config, {
method: "POST",
headers: {
Expand Down
2 changes: 1 addition & 1 deletion lib/edge/init.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { OptableConfig } from "../config";
import { fetch } from "../core/network";

function Init(config: OptableConfig): Promise<void> {
function Init(config: Required<OptableConfig>): Promise<void> {
return fetch("/init", config, {
method: "POST",
headers: {
Expand Down
2 changes: 1 addition & 1 deletion lib/edge/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type ProfileTraits = {
[key: string]: string | number | boolean;
};

function Profile(config: OptableConfig, traits: ProfileTraits): Promise<void> {
function Profile(config: Required<OptableConfig>, traits: ProfileTraits): Promise<void> {
const profile = {
traits: traits,
};
Expand Down
2 changes: 1 addition & 1 deletion lib/edge/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type SiteResponse = {
interestGroupPixel: string;
};

async function Site(config: OptableConfig): Promise<SiteResponse> {
async function Site(config: Required<OptableConfig>): Promise<SiteResponse> {
return await fetch("/config", config, {
method: "GET",
headers: { "Content-Type": "application/json" },
Expand Down
8 changes: 4 additions & 4 deletions lib/edge/targeting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type TargetingResponse = {

const lmpidProvider = "loblawmedia.ca"

async function Targeting(config: OptableConfig): Promise<TargetingResponse> {
async function Targeting(config: Required<OptableConfig>): Promise<TargetingResponse> {
const response: TargetingResponse = await fetch("/v2/targeting", config, {
method: "GET",
headers: {
Expand All @@ -42,17 +42,17 @@ async function Targeting(config: OptableConfig): Promise<TargetingResponse> {
return response;
}

function LmpidFromCache(config: OptableConfig): string | null {
function LmpidFromCache(config: Required<OptableConfig>): string | null {
const ls = new LocalStorage(config);
return ls.getLmpid();
}

function TargetingFromCache(config: OptableConfig): TargetingResponse | null {
function TargetingFromCache(config: Required<OptableConfig>): TargetingResponse | null {
const ls = new LocalStorage(config);
return ls.getTargeting();
}

function TargetingClearCache(config: OptableConfig) {
function TargetingClearCache(config: Required<OptableConfig>) {
const ls = new LocalStorage(config);
ls.clearTargeting();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/edge/uid2_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Uid2TokenResponse = {
RefreshResponseKey: string;
};

function Uid2Token(config: OptableConfig, id: string): Promise<Uid2TokenResponse> {
function Uid2Token(config: Required<OptableConfig>, id: string): Promise<Uid2TokenResponse> {
return fetch("/uid2/token", config, {
method: "POST",
headers: {
Expand Down
2 changes: 1 addition & 1 deletion lib/edge/witness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type WitnessProperties = {
[key: string]: string | number | boolean;
};

function Witness(config: OptableConfig, event: string, properties: WitnessProperties): Promise<void> {
function Witness(config: Required<OptableConfig>, event: string, properties: WitnessProperties): Promise<void> {
const evt = {
event: event,
properties: properties,
Expand Down
9 changes: 5 additions & 4 deletions lib/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { OptableConfig } from "./config";
import { getConfig } from "./config";
import type { WitnessProperties } from "./edge/witness";
import type { ProfileTraits } from "./edge/profile";
import { Identify } from "./edge/identify";
Expand All @@ -19,12 +20,12 @@ import { Profile } from "./edge/profile";
import { sha256 } from "js-sha256";

class OptableSDK {
public sandbox: OptableConfig; // legacy
public dcn: Required<OptableConfig>;
private init: any

constructor(public dcn: OptableConfig, writePassport: boolean = true) {
this.sandbox = dcn; // legacy
this.init = writePassport ? Init(dcn).catch(()=>{}) : Promise.resolve();
constructor(dcn: OptableConfig) {
this.dcn = getConfig(dcn);
this.init = this.dcn.initPassport ? Init(this.dcn).catch(()=>{}) : Promise.resolve();
}

async identify(...ids: string[]) {
Expand Down

0 comments on commit a8f239c

Please sign in to comment.