New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

demoway-sdk

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

demoway-sdk - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0-beta.0

dist/lib/demo-dialog.d.ts

6

dist/index.d.ts

@@ -0,1 +1,2 @@

import type { ISDKService } from './lib/service-host';
export * from './lib/demo-dialog';

@@ -5,2 +6,5 @@ export interface ISDKInitializeOptions {

}
export declare function initialize({ accessToken }: ISDKInitializeOptions): void;
export declare const SERVICE_ENDPOINT: string;
export declare const openDemoDialog: (demoId: string, options?: import("./lib/demo-dialog").IDemoDialogOptions | undefined) => Promise<import("./lib/demo-dialog").IDemoDialog>;
export declare const enableRecord: () => Promise<void>;
export declare function initialize({ accessToken }: ISDKInitializeOptions): Promise<ISDKService>;

413

dist/sdk.js

@@ -1,381 +0,54 @@

(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".demo-dialog-overlay.svelte-170r52r{position:fixed;width:100vw;height:100vh;display:flex;align-items:center;justify-content:center;top:0;left:0;background-color:#ffffffb3}.demo-dialog-container.svelte-170r52r{width:80%;height:80%;overflow:visible;position:relative}.demo-dialog-content.svelte-170r52r{border:none}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
var B = Object.defineProperty;
var F = (e, t, n) => t in e ? B(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var C = (e, t, n) => (F(e, typeof t != "symbol" ? t + "" : t, n), n);
let z = null;
function M(e) {
z = e;
}
function U() {
if (!z)
throw new Error("sdk is not initialized");
return z;
}
function g() {
}
function q(e) {
return e();
}
function O() {
return /* @__PURE__ */ Object.create(null);
}
function $(e) {
e.forEach(q);
}
function S(e) {
return typeof e == "function";
}
function G(e, t) {
return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
}
let x;
function A(e, t) {
return x || (x = document.createElement("a")), x.href = t, e === x.href;
}
function H(e) {
return Object.keys(e).length === 0;
}
function J(e) {
return e && S(e.destroy) ? e.destroy : g;
}
function P(e, t) {
e.appendChild(t);
}
function K(e, t, n) {
e.insertBefore(t, n || null);
}
function L(e) {
e.parentNode && e.parentNode.removeChild(e);
}
function E(e) {
return document.createElement(e);
}
function Q(e, t, n, o) {
return e.addEventListener(t, n, o), () => e.removeEventListener(t, n, o);
}
function a(e, t, n) {
n == null ? e.removeAttribute(t) : e.getAttribute(t) !== n && e.setAttribute(t, n);
}
function V(e) {
return Array.from(e.childNodes);
}
function j(e, t, n, o) {
n === null ? e.style.removeProperty(t) : e.style.setProperty(t, n, o ? "important" : "");
}
function W(e, t, { bubbles: n = !1, cancelable: o = !1 } = {}) {
const r = document.createEvent("CustomEvent");
return r.initCustomEvent(e, n, o, t), r;
}
let k;
function p(e) {
k = e;
}
function X() {
if (!k)
throw new Error("Function called outside component initialization");
return k;
}
function Y() {
const e = X();
return (t, n, { cancelable: o = !1 } = {}) => {
const r = e.$$.callbacks[t];
if (r) {
const l = W(t, n, { cancelable: o });
return r.slice().forEach((u) => {
u.call(e, l);
}), !l.defaultPrevented;
}
return !0;
const a = (e) => {
const o = /* @__PURE__ */ new Set();
do
for (const t of Reflect.ownKeys(e))
o.add([e, t]);
while ((e = Reflect.getPrototypeOf(e)) && e !== Object.prototype);
return o;
};
function d(e, { include: o, exclude: t } = {}) {
const c = (i) => {
const r = (n) => typeof n == "string" ? i === n : n.test(i);
return o ? o.some(r) : t ? !t.some(r) : !0;
};
}
const m = [], N = [];
let _ = [];
const R = [], Z = /* @__PURE__ */ Promise.resolve();
let T = !1;
function ee() {
T || (T = !0, Z.then(b));
}
function D(e) {
_.push(e);
}
const I = /* @__PURE__ */ new Set();
let h = 0;
function b() {
if (h !== 0)
return;
const e = k;
do {
try {
for (; h < m.length; ) {
const t = m[h];
h++, p(t), te(t.$$);
}
} catch (t) {
throw m.length = 0, h = 0, t;
}
for (p(null), m.length = 0, h = 0; N.length; )
N.pop()();
for (let t = 0; t < _.length; t += 1) {
const n = _[t];
I.has(n) || (I.add(n), n());
}
_.length = 0;
} while (m.length);
for (; R.length; )
R.pop()();
T = !1, I.clear(), p(e);
}
function te(e) {
if (e.fragment !== null) {
e.update(), $(e.before_update);
const t = e.dirty;
e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(D);
for (const [i, r] of a(e.constructor.prototype)) {
if (r === "constructor" || !c(r))
continue;
const n = Reflect.getOwnPropertyDescriptor(i, r);
n && typeof n.value == "function" && (e[r] = e[r].bind(e));
}
return e;
}
function ne(e) {
const t = [], n = [];
_.forEach((o) => e.indexOf(o) === -1 ? t.push(o) : n.push(o)), n.forEach((o) => o()), _ = t;
}
const oe = /* @__PURE__ */ new Set();
function re(e, t) {
e && e.i && (oe.delete(e), e.i(t));
}
function se(e, t, n, o) {
const { fragment: r, after_update: l } = e.$$;
r && r.m(t, n), o || D(() => {
const u = e.$$.on_mount.map(q).filter(S);
e.$$.on_destroy ? e.$$.on_destroy.push(...u) : $(u), e.$$.on_mount = [];
}), l.forEach(D);
}
function ce(e, t) {
const n = e.$$;
n.fragment !== null && (ne(n.after_update), $(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []);
}
function ie(e, t) {
e.$$.dirty[0] === -1 && (m.push(e), ee(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
}
function le(e, t, n, o, r, l, u, c = [-1]) {
const i = k;
p(e);
const s = e.$$ = {
fragment: null,
ctx: [],
// state
props: l,
update: g,
not_equal: r,
bound: O(),
// lifecycle
on_mount: [],
on_destroy: [],
on_disconnect: [],
before_update: [],
after_update: [],
context: new Map(t.context || (i ? i.$$.context : [])),
// everything else
callbacks: O(),
dirty: c,
skip_bound: !1,
root: t.target || i.$$.root
};
u && u(s.root);
let y = !1;
if (s.ctx = n ? n(e, t.props || {}, (d, w, ...v) => {
const f = v.length ? v[0] : w;
return s.ctx && r(s.ctx[d], s.ctx[d] = f) && (!s.skip_bound && s.bound[d] && s.bound[d](f), y && ie(e, d)), w;
}) : [], s.update(), y = !0, $(s.before_update), s.fragment = o ? o(s.ctx) : !1, t.target) {
if (t.hydrate) {
const d = V(t.target);
s.fragment && s.fragment.l(d), d.forEach(L);
} else
s.fragment && s.fragment.c();
t.intro && re(e.$$.fragment), se(e, t.target, t.anchor, t.customElement), b();
class p {
constructor(o) {
this.delegate = o, d(this);
}
p(i);
}
class ue {
$destroy() {
ce(this, 1), this.$destroy = g;
enableRecord() {
return this.delegate.then((o) => o.enableRecord());
}
$on(t, n) {
if (!S(n))
return g;
const o = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
return o.push(n), () => {
const r = o.indexOf(n);
r !== -1 && o.splice(r, 1);
};
openDemoDialog(o, t) {
return this.delegate.then((c) => c.openDemoDialog(o, t));
}
$set(t) {
this.$$set && !H(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
}
}
const fe = (e, t) => {
const n = new ResizeObserver(() => {
const o = e.getBoundingClientRect();
t == null || t(o);
});
return n.observe(e), {
destroy() {
n.disconnect();
}
};
}, ae = "https://demoway.co";
function de(e) {
let t, n, o, r, l, u;
return {
c() {
t = E("div"), n = E("div"), o = E("iframe"), a(o, "class", "demo-dialog-content svelte-170r52r"), a(
o,
"width",
/*width*/
e[2]
), a(
o,
"height",
/*height*/
e[3]
), a(o, "title", "demo"), A(o.src, r = /*src*/
e[1]) || a(o, "src", r), o.allowFullscreen = !0, a(o, "allowtransparency", "true"), a(n, "class", "demo-dialog-container svelte-170r52r"), a(t, "class", "demo-dialog-overlay svelte-170r52r"), a(t, "role", "button"), j(
t,
"z-index",
/*zIndex*/
e[0]
);
},
m(c, i) {
K(c, t, i), P(t, n), P(n, o), l || (u = [
J(fe.call(
null,
n,
/*onResize*/
e[4]
)),
Q(
t,
"click",
/*onClose*/
e[5]
)
], l = !0);
},
p(c, [i]) {
i & /*width*/
4 && a(
o,
"width",
/*width*/
c[2]
), i & /*height*/
8 && a(
o,
"height",
/*height*/
c[3]
), i & /*src*/
2 && !A(o.src, r = /*src*/
c[1]) && a(o, "src", r), i & /*zIndex*/
1 && j(
t,
"z-index",
/*zIndex*/
c[0]
);
},
i: g,
o: g,
d(c) {
c && L(t), l = !1, $(u);
}
};
const u = "MIAOLU_SERVICE_ENDPOINT", f = localStorage.getItem(u) || "//s.demoway.co/sdk/sdk-service/service.js";
function l() {
throw new Error("sdk is not initialized");
}
function he(e, t, n) {
const o = Y();
let { demoId: r = "" } = t, { accessToken: l = "" } = t, { zIndex: u } = t;
const c = new URLSearchParams();
c.set("browser", String(!0)), c.set("scale", String(100));
let i = "", s = "", y = 0, d = 0;
function w(f) {
n(2, y = f.width), n(3, d = f.height);
}
function v() {
o("close", void 0);
}
return e.$$set = (f) => {
"demoId" in f && n(6, r = f.demoId), "accessToken" in f && n(7, l = f.accessToken), "zIndex" in f && n(0, u = f.zIndex);
}, e.$$.update = () => {
e.$$.dirty & /*accessToken*/
128 && (c.set("access_token", l), n(8, i = c.toString())), e.$$.dirty & /*demoId, queryString*/
320 && n(1, s = `${ae}/demo/${r}?${i}`);
}, [
u,
s,
y,
d,
w,
v,
r,
l,
i
];
const s = new p(
Promise.resolve({
openDemoDialog: l,
enableRecord: l
})
), g = s.openDemoDialog, D = s.enableRecord;
function m({ accessToken: e }) {
if (!e)
throw new Error("Invalid token");
const o = import(f).then((t) => t.initialize(e));
return s.delegate = o, o.then(() => s);
}
class me extends ue {
constructor(t) {
super(), le(this, t, he, de, G, { demoId: 6, accessToken: 7, zIndex: 0 });
}
get demoId() {
return this.$$.ctx[6];
}
set demoId(t) {
this.$$set({ demoId: t }), b();
}
get accessToken() {
return this.$$.ctx[7];
}
set accessToken(t) {
this.$$set({ accessToken: t }), b();
}
get zIndex() {
return this.$$.ctx[0];
}
set zIndex(t) {
this.$$set({ zIndex: t }), b();
}
}
class _e {
constructor(t, { zIndex: n = 10100 }) {
C(this, "component");
this.component = new me({
target: document.body,
props: {
demoId: t,
accessToken: U(),
zIndex: n
}
}), this.component.$on("close", () => {
this.close();
});
}
get demoId() {
return this.component.demoId;
}
set demoId(t) {
this.component.$set({
demoId: t
});
}
close() {
var t;
(t = this.component) == null || t.$destroy();
}
}
function ye(e, t = {}) {
return new _e(e, t);
}
function pe({ accessToken: e }) {
M(e);
}
export {
pe as initialize,
ye as openDemoDialog
f as SERVICE_ENDPOINT,
D as enableRecord,
m as initialize,
g as openDemoDialog
};
{
"name": "demoway-sdk",
"version": "0.1.1",
"version": "0.2.0-beta.0",
"type": "module",

@@ -21,3 +21,3 @@ "files": [

"scripts": {
"dev": "vite",
"dev": "storybook dev -p 6006",
"build": "vite build",

@@ -31,12 +31,13 @@ "preview": "vite preview",

"devDependencies": {
"@storybook/addon-essentials": "^7.0.23",
"@storybook/addon-interactions": "^7.0.23",
"@storybook/addon-links": "^7.0.23",
"@storybook/blocks": "^7.0.23",
"@storybook/svelte": "^7.0.23",
"@storybook/svelte-vite": "^7.0.23",
"@storybook/testing-library": "^0.0.14-next.2",
"@sveltejs/vite-plugin-svelte": "^2.0.4",
"@storybook/addon-essentials": "^7.1.1",
"@storybook/addon-interactions": "^7.1.1",
"@storybook/addon-links": "^7.1.1",
"@storybook/blocks": "^7.1.1",
"@storybook/svelte": "^7.1.1",
"@storybook/svelte-vite": "^7.1.1",
"@storybook/testing-library": "0.0.14-next.2",
"@sveltejs/vite-plugin-svelte": "^2.4.3",
"@tsconfig/svelte": "^4.0.1",
"@types/node": "^18.0.0",
"@types/node": "^18.17.1",
"auto-bind": "^5.0.1",
"prettier": "^2.8.8",

@@ -46,12 +47,13 @@ "prettier-plugin-svelte": "^2.10.1",

"react-dom": "^18.2.0",
"sass": "^1.63.6",
"storybook": "^7.0.23",
"svelte": "^3.58.0",
"svelte-check": "^3.3.1",
"tslib": "^2.5.0",
"typescript": "^5.0.2",
"vite": "^4.3.9",
"vite-plugin-css-injected-by-js": "^3.1.1",
"vite-plugin-dts": "^2.3.0"
"rxjs": "^7.8.1",
"sass": "^1.64.1",
"storybook": "^7.1.1",
"svelte": "^4.1.1",
"svelte-check": "^3.4.6",
"tslib": "^2.6.1",
"typescript": "^5.1.6",
"vite": "^4.4.7",
"vite-plugin-css-injected-by-js": "^3.2.1",
"vite-plugin-dts": "^3.4.0"
}
}

@@ -16,4 +16,3 @@ {

"allowJs": true,
"checkJs": true,
"isolatedModules": true
"checkJs": true
},

@@ -20,0 +19,0 @@ "include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc