@manifoldco/manifold-init
Advanced tools
Comparing version 0.3.0 to 0.4.0-beta.0
@@ -6,3 +6,3 @@ 'use strict'; | ||
const core = require('./core-894a498f.js'); | ||
const core$1 = require('./core-0b8ce79c.js'); | ||
const core$1 = require('./core-9cd9484a.js'); | ||
@@ -44,3 +44,3 @@ const ConnectedButton = class { | ||
version: 0, | ||
componentVersion: '0.3.0', | ||
componentVersion: '0.4.0-beta.0', | ||
}); | ||
@@ -47,0 +47,0 @@ } |
@@ -5,3 +5,3 @@ 'use strict'; | ||
const core = require('./core-0b8ce79c.js'); | ||
const core = require('./core-9cd9484a.js'); | ||
@@ -8,0 +8,0 @@ |
@@ -0,8 +1,4 @@ | ||
import createAnalytics from './analytics'; | ||
import { createGraphqlFetch } from './graphqlFetch'; | ||
import { createGateway } from './gateway'; | ||
// TODO add real tracking | ||
const track = data => { | ||
// eslint-disable-next-line no-console | ||
console.log(data); | ||
}; | ||
const connection = (options) => { | ||
@@ -12,3 +8,12 @@ const { componentVersion, element, env, clientId } = options; | ||
gateway: createGateway({ | ||
baseUrl: () => env === 'stage' ? 'https://api.stage.manifold.co/v1' : 'https://api.manifold.co/v1', | ||
baseUrl: () => { | ||
switch (env) { | ||
case 'stage': | ||
return 'https://api.stage.manifold.co/v1'; | ||
case 'local': | ||
return 'https://api.arigato.tools/v1'; | ||
default: | ||
return 'https://api.manifold.co/v1'; | ||
} | ||
}, | ||
}), | ||
@@ -19,9 +24,16 @@ graphqlFetch: createGraphqlFetch({ | ||
clientId, | ||
endpoint: () => env === 'stage' | ||
? 'https://api.stage.manifold.co/graphql' | ||
: 'https://api.manifold.co/graphql', | ||
endpoint: () => { | ||
switch (env) { | ||
case 'stage': | ||
return 'https://api.stage.manifold.co/graphql'; | ||
case 'local': | ||
return 'https://api.arigato.tools/graphql'; | ||
default: | ||
return 'https://api.manifold.co/graphql'; | ||
} | ||
}, | ||
}), | ||
track, | ||
analytics: createAnalytics({ env, element, componentVersion }), | ||
}; | ||
}; | ||
export default connection; |
@@ -38,3 +38,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { r as registerInstance, h, g as getElement } from './core-14d8f2fa.js'; | ||
import { i as initialize } from './core-02105d7c.js'; | ||
import { i as initialize } from './core-e9d7832f.js'; | ||
var ConnectedButton = /** @class */ (function () { | ||
@@ -116,3 +116,3 @@ function class_1(hostRef) { | ||
version: 0, | ||
componentVersion: '0.3.0', | ||
componentVersion: '0.4.0-beta.0', | ||
})]; | ||
@@ -119,0 +119,0 @@ case 2: |
import { r as registerInstance, h, g as getElement } from './core-14d8f2fa.js'; | ||
import { i as initialize } from './core-02105d7c.js'; | ||
import { i as initialize } from './core-e9d7832f.js'; | ||
@@ -39,3 +39,3 @@ const ConnectedButton = class { | ||
version: 0, | ||
componentVersion: '0.3.0', | ||
componentVersion: '0.4.0-beta.0', | ||
}); | ||
@@ -42,0 +42,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export{i as initialize}from"./p-ce08fb20.js"; | ||
export{i as initialize}from"./p-31184bf4.js"; |
@@ -1,1 +0,1 @@ | ||
import{p as t,b as e}from"./p-211aed1b.js";t().then(t=>e([["p-uhlnu5qc",[[0,"connected-button",{success:[32],badRequest:[32],unauthenticated:[32],planCost:[32]}],[0,"manifold-init",{env:[1],authToken:[1,"auth-token"],authType:[1,"auth-type"],clientId:[1,"client-id"],initialize:[64]}]]]],t)); | ||
import{p as t,b as e}from"./p-211aed1b.js";t().then(t=>e([["p-ctg2lrlr",[[0,"connected-button",{success:[32],badRequest:[32],unauthenticated:[32],planCost:[32]}],[0,"manifold-init",{env:[1],authToken:[1,"auth-token"],authType:[1,"auth-type"],clientId:[1,"client-id"],initialize:[64]}]]]],t)); |
@@ -1,1 +0,1 @@ | ||
System.register(["./p-c90b3762.system.js"],(function(){"use strict";var t,e;return{setters:[function(n){t=n.p;e=n.b}],execute:function(){t().then((function(t){return e([["p-60s2gcu1.system",[[0,"connected-button",{success:[32],badRequest:[32],unauthenticated:[32],planCost:[32]}],[0,"manifold-init",{env:[1],authToken:[1,"auth-token"],authType:[1,"auth-type"],clientId:[1,"client-id"],initialize:[64]}]]]],t)}))}}})); | ||
System.register(["./p-c90b3762.system.js"],(function(){"use strict";var t,e;return{setters:[function(n){t=n.p;e=n.b}],execute:function(){t().then((function(t){return e([["p-ce33srgl.system",[[0,"connected-button",{success:[32],badRequest:[32],unauthenticated:[32],planCost:[32]}],[0,"manifold-init",{env:[1],authToken:[1,"auth-token"],authType:[1,"auth-type"],clientId:[1,"client-id"],initialize:[64]}]]]],t)}))}}})); |
@@ -0,1 +1,2 @@ | ||
import { AnalyticsEvent, ErrorDetail } from './analytics'; | ||
import { GraphqlFetch } from './graphqlFetch'; | ||
@@ -6,6 +7,9 @@ import { Gateway } from './gateway'; | ||
gateway: Gateway; | ||
track: (event: string) => void; | ||
analytics: { | ||
track: (e: AnalyticsEvent) => Promise<Response>; | ||
report: (detail: ErrorDetail) => void; | ||
}; | ||
} | ||
declare const connection: (options: { | ||
env: "stage" | "prod"; | ||
env: "local" | "prod" | "stage"; | ||
element: HTMLElement; | ||
@@ -12,0 +16,0 @@ componentVersion: string; |
@@ -18,3 +18,3 @@ { | ||
], | ||
"version": "0.3.0", | ||
"version": "0.4.0-beta.0", | ||
"description": "Manifold UI Initialization", | ||
@@ -21,0 +21,0 @@ "main": "dist/index.js", |
@@ -0,18 +1,16 @@ | ||
import createAnalytics, { AnalyticsEvent, ErrorDetail } from './analytics'; | ||
import { createGraphqlFetch, GraphqlFetch } from './graphqlFetch'; | ||
import { createGateway, Gateway } from './gateway'; | ||
// TODO add real tracking | ||
const track = data => { | ||
// eslint-disable-next-line no-console | ||
console.log(data); | ||
}; | ||
export interface Connection { | ||
graphqlFetch: GraphqlFetch; | ||
gateway: Gateway; | ||
track: (event: string) => void; | ||
analytics: { | ||
track: (e: AnalyticsEvent) => Promise<Response>; | ||
report: (detail: ErrorDetail) => void; | ||
}; | ||
} | ||
const connection = (options: { | ||
env: 'stage' | 'prod'; | ||
env: 'stage' | 'prod' | 'local'; | ||
element: HTMLElement; | ||
@@ -26,4 +24,12 @@ componentVersion: string; | ||
gateway: createGateway({ | ||
baseUrl: () => | ||
env === 'stage' ? 'https://api.stage.manifold.co/v1' : 'https://api.manifold.co/v1', | ||
baseUrl: () => { | ||
switch (env) { | ||
case 'stage': | ||
return 'https://api.stage.manifold.co/v1'; | ||
case 'local': | ||
return 'https://api.arigato.tools/v1'; | ||
default: | ||
return 'https://api.manifold.co/v1'; | ||
} | ||
}, | ||
}), | ||
@@ -34,8 +40,14 @@ graphqlFetch: createGraphqlFetch({ | ||
clientId, | ||
endpoint: () => | ||
env === 'stage' | ||
? 'https://api.stage.manifold.co/graphql' | ||
: 'https://api.manifold.co/graphql', | ||
endpoint: () => { | ||
switch (env) { | ||
case 'stage': | ||
return 'https://api.stage.manifold.co/graphql'; | ||
case 'local': | ||
return 'https://api.arigato.tools/graphql'; | ||
default: | ||
return 'https://api.manifold.co/graphql'; | ||
} | ||
}, | ||
}), | ||
track, | ||
analytics: createAnalytics({ env, element, componentVersion }), | ||
}; | ||
@@ -42,0 +54,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
776178
95
12675
28