@notabene/javascript-sdk
Advanced tools
Comparing version 2.0.0-next.2 to 2.0.0-next.3
@@ -399,4 +399,4 @@ /** | ||
declare class Notabene { | ||
private nodeUrl; | ||
private authToken; | ||
private nodeUrl?; | ||
private authToken?; | ||
private uxUrl; | ||
@@ -422,4 +422,4 @@ private theme?; | ||
export declare interface NotabeneConfig { | ||
nodeUrl: string; | ||
authToken: string; | ||
nodeUrl?: string; | ||
authToken?: string; | ||
uxUrl?: string; | ||
@@ -426,0 +426,0 @@ theme?: Theme; |
@@ -5,3 +5,3 @@ var l = Object.defineProperty; | ||
var h = /* @__PURE__ */ ((s) => (s.COMPLETE = "complete", s.RESIZE = "resize", s.RESULT = "result", s.READY = "ready", s.INVALID = "invalid", s.MODAL = "openModal", s.ERROR = "error", s.CLOSE = "closeModal", s.CANCEL = "cancel", s))(h || {}), c = /* @__PURE__ */ ((s) => (s.UPDATE = "update", s.REQUEST_RESPONSE = "requestResponse", s))(c || {}); | ||
class m { | ||
class f { | ||
constructor() { | ||
@@ -37,3 +37,3 @@ o(this, "listeners", /* @__PURE__ */ new Map()); | ||
} | ||
class f { | ||
class m { | ||
constructor(e, t) { | ||
@@ -46,3 +46,3 @@ o(this, "_url"); | ||
o(this, "ready", !1); | ||
this._url = e, this._value = t, this.eventManager = new m(), this.on(h.INVALID, (r) => { | ||
this._url = e, this._value = t, this.eventManager = new f(), this.on(h.INVALID, (r) => { | ||
r.type === h.INVALID && (this._errors = r.errors, this._value = r.value); | ||
@@ -113,3 +113,3 @@ }), this.on(h.RESIZE, (r) => { | ||
o(this, "dictionary"); | ||
this.uxUrl = e.uxUrl || "https://ux.notabene.id", this.nodeUrl = e.nodeUrl, this.authToken = e.authToken, this.theme = e.theme, this.dictionary = e.dictionary; | ||
this.uxUrl = e.uxUrl || "https://connect.notabene.id", this.nodeUrl = e.nodeUrl, this.authToken = e.authToken, this.theme = e.theme, this.dictionary = e.dictionary; | ||
} | ||
@@ -124,6 +124,6 @@ componentUrl(e, t, r, i) { | ||
}); | ||
return n.hash = a, n.searchParams.set("nodeUrl", this.nodeUrl), this.theme && n.searchParams.set("theme", JSON.stringify(this.theme)), this.dictionary && n.searchParams.set("dictionary", JSON.stringify(this.dictionary)), i && (i.callback && n.searchParams.set("callback_url", i.callback), i.redirectUri && n.searchParams.set("redirect_uri", i.redirectUri)), n.toString(); | ||
return n.hash = a, this.nodeUrl && n.searchParams.set("nodeUrl", this.nodeUrl), this.theme && n.searchParams.set("theme", JSON.stringify(this.theme)), this.dictionary && n.searchParams.set("dictionary", JSON.stringify(this.dictionary)), i && (i.callback && n.searchParams.set("callback_url", i.callback), i.redirectUri && n.searchParams.set("redirect_uri", i.redirectUri)), n.toString(); | ||
} | ||
createComponent(e, t, r, i) { | ||
return new f( | ||
return new m( | ||
this.componentUrl(e, t, r, i), | ||
@@ -130,0 +130,0 @@ t |
@@ -186,3 +186,3 @@ ## API Report File for "@notabene/javascript-sdk" | ||
// (undocumented) | ||
authToken: string; | ||
authToken?: string; | ||
// (undocumented) | ||
@@ -193,3 +193,3 @@ dictionary?: { | ||
// (undocumented) | ||
nodeUrl: string; | ||
nodeUrl?: string; | ||
// (undocumented) | ||
@@ -196,0 +196,0 @@ theme?: Theme; |
@@ -12,3 +12,3 @@ { | ||
"license": "MIT", | ||
"version": "2.0.0-next.2", | ||
"version": "2.0.0-next.3", | ||
"source": "src/notabene.ts", | ||
@@ -28,3 +28,4 @@ "main": "dist/notabene.js", | ||
"test": "vitest", | ||
"release": "semantic-release" | ||
"release": "semantic-release", | ||
"publish": "yarn build && yarn semantic-release && npm publish --tag next" | ||
}, | ||
@@ -31,0 +32,0 @@ "devDependencies": { |
@@ -31,2 +31,17 @@ import { fc, test } from '@fast-check/vitest'; | ||
describe('minimal', () => { | ||
test.prop([arbitraryComponent(), fc.object()])( | ||
'Should set the correct values', | ||
(component, value) => { | ||
const notabene = new Notabene({}); | ||
const url = new URL(notabene.componentUrl(component, value)); | ||
return ( | ||
url.hash === `#value=${encodeURIComponent(JSON.stringify(value))}` && | ||
url.hostname === 'connect.notabene.id' && | ||
url.pathname === `/${component}` | ||
); | ||
}, | ||
); | ||
}); | ||
describe('with uxUrl', () => { | ||
@@ -33,0 +48,0 @@ test.prop([ |
@@ -65,4 +65,4 @@ import EmbeddedComponent from './components/EmbeddedComponent'; | ||
export interface NotabeneConfig { | ||
nodeUrl: string; | ||
authToken: string; | ||
nodeUrl?: string; | ||
authToken?: string; | ||
uxUrl?: string; | ||
@@ -80,4 +80,4 @@ theme?: Theme; | ||
export default class Notabene { | ||
private nodeUrl: string; | ||
private authToken: string; | ||
private nodeUrl?: string; | ||
private authToken?: string; | ||
private uxUrl: string; | ||
@@ -88,3 +88,3 @@ private theme?: Theme; | ||
constructor(config: NotabeneConfig) { | ||
this.uxUrl = config.uxUrl || 'https://ux.notabene.id'; | ||
this.uxUrl = config.uxUrl || 'https://connect.notabene.id'; | ||
this.nodeUrl = config.nodeUrl; | ||
@@ -111,3 +111,3 @@ this.authToken = config.authToken; | ||
url.hash = hash; | ||
url.searchParams.set('nodeUrl', this.nodeUrl); | ||
if (this.nodeUrl) url.searchParams.set('nodeUrl', this.nodeUrl); | ||
@@ -114,0 +114,0 @@ if (this.theme) { |
@@ -186,3 +186,3 @@ ## API Report File for "@notabene/javascript-sdk" | ||
// (undocumented) | ||
authToken: string; | ||
authToken?: string; | ||
// (undocumented) | ||
@@ -193,3 +193,3 @@ dictionary?: { | ||
// (undocumented) | ||
nodeUrl: string; | ||
nodeUrl?: string; | ||
// (undocumented) | ||
@@ -196,0 +196,0 @@ theme?: Theme; |
@@ -24,2 +24,11 @@ import { fc, test } from '@fast-check/vitest'; | ||
}); | ||
describe('minimal', () => { | ||
test.prop([arbitraryComponent(), fc.object()])('Should set the correct values', (component, value) => { | ||
const notabene = new Notabene({}); | ||
const url = new URL(notabene.componentUrl(component, value)); | ||
return (url.hash === `#value=${encodeURIComponent(JSON.stringify(value))}` && | ||
url.hostname === 'connect.notabene.id' && | ||
url.pathname === `/${component}`); | ||
}); | ||
}); | ||
describe('with uxUrl', () => { | ||
@@ -26,0 +35,0 @@ test.prop([ |
@@ -11,4 +11,4 @@ import EmbeddedComponent from './components/EmbeddedComponent'; | ||
export interface NotabeneConfig { | ||
nodeUrl: string; | ||
authToken: string; | ||
nodeUrl?: string; | ||
authToken?: string; | ||
uxUrl?: string; | ||
@@ -26,4 +26,4 @@ theme?: Theme; | ||
export default class Notabene { | ||
private nodeUrl; | ||
private authToken; | ||
private nodeUrl?; | ||
private authToken?; | ||
private uxUrl; | ||
@@ -30,0 +30,0 @@ private theme?; |
@@ -15,3 +15,3 @@ import EmbeddedComponent from './components/EmbeddedComponent'; | ||
constructor(config) { | ||
this.uxUrl = config.uxUrl || 'https://ux.notabene.id'; | ||
this.uxUrl = config.uxUrl || 'https://connect.notabene.id'; | ||
this.nodeUrl = config.nodeUrl; | ||
@@ -31,3 +31,4 @@ this.authToken = config.authToken; | ||
url.hash = hash; | ||
url.searchParams.set('nodeUrl', this.nodeUrl); | ||
if (this.nodeUrl) | ||
url.searchParams.set('nodeUrl', this.nodeUrl); | ||
if (this.theme) { | ||
@@ -34,0 +35,0 @@ url.searchParams.set('theme', JSON.stringify(this.theme)); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
3139706
18611
0