@octostar/platform-api 0.5.15 → 0.5.17
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.
package/dist/factory.js
CHANGED
package/dist/factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAMxC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,SAAS,GAAG,CAAC,MAAc,EAAW,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC;AAExE,SAAS,iBAAiB,CACxB,SAAiB,EACjB,gBAAwB,MAAM,EAC9B,KAAK,GAAG,CAAC;IAET,0CAA0C;IAC1C,IAAI,OAAsC,CAAC;IAC3C,IAAI,CAAC;QACH,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC9D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,+BAA+B;QAC/B,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAC1B,IACE,MAAM,CAAC,YAAY,CAAC,sBAAsB,CAAC,KAAK,MAAM;YACtD,MAAM,CAAC,YAAY,CAAC,8BAA8B,CAAC,KAAK,SAAS,EACjE,CAAC;YACD,OAAO,aAAa,CAAC;QACvB,CAAC;IACH,CAAC;I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AAC,MAAM,0BAA0B,GAAG,CAAI,KAAiB,EAAK,EAAE,CACpE,IAAI,KAAK,CACP,EAAE,EACF;IACE,GAAG,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CACpB,IAAI,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,EAAE;QAClB,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;KACrE,CAAC;CACL,CACG,CAAC"}
|
package/dist/lib/ContextAPI.d.ts
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import { Context, ContextAPISetParams,
|
|
2
|
-
export type ContextAPIConstructorParams<ContextData extends Record<string, any>> =
|
|
1
|
+
import { Context, ContextAPISetParams, ContextListener } from '@octostar/platform-types';
|
|
2
|
+
export type ContextAPIConstructorParams<ContextData extends Record<string, any>> = {
|
|
3
|
+
contextData?: ContextData;
|
|
3
4
|
targetWindow?: Window;
|
|
4
5
|
channelId?: string;
|
|
5
6
|
};
|
|
6
7
|
export declare class ContextAPI<ContextData extends Record<string, any>> implements Context<ContextData> {
|
|
7
|
-
private contextData
|
|
8
|
-
|
|
8
|
+
private contextData?;
|
|
9
|
+
private internalTargetWindow;
|
|
9
10
|
readonly id: string;
|
|
10
11
|
private listeners;
|
|
11
12
|
private postRobotListener;
|
|
12
13
|
private internalChannelId;
|
|
13
14
|
private postRobotEventId;
|
|
14
15
|
constructor({ targetWindow, contextData, channelId, }: ContextAPIConstructorParams<ContextData>);
|
|
16
|
+
get targetWindow(): Window | undefined;
|
|
17
|
+
set targetWindow(targetWindow: Window | undefined);
|
|
15
18
|
get channelId(): string | undefined;
|
|
16
19
|
set channelId(channelId: string | undefined);
|
|
17
20
|
listenToPostRobot(): void;
|
|
18
|
-
get context(): ContextData;
|
|
19
|
-
set context(context: ContextData);
|
|
20
|
-
getContext(): ContextData;
|
|
21
|
+
get context(): ContextData | undefined;
|
|
22
|
+
set context(context: ContextData | undefined);
|
|
23
|
+
getContext(): ContextData | undefined;
|
|
21
24
|
setContext(context: ContextAPISetParams<ContextData>): void;
|
|
22
25
|
notifyListeners(): void;
|
|
23
|
-
syncContextToChannel(): Promise<void>;
|
|
26
|
+
syncContextToChannel(type?: 'update-context' | 'get-context'): Promise<void>;
|
|
24
27
|
subscribeToChanges(contextListener: ContextListener<ContextData>): string;
|
|
25
28
|
subscribeToChanges(id: string, contextListener: ContextListener<ContextData>): string;
|
|
26
29
|
unsubscribeFromChanges(id: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextAPI.d.ts","sourceRoot":"","sources":["../../src/lib/ContextAPI.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"ContextAPI.d.ts","sourceRoot":"","sources":["../../src/lib/ContextAPI.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAIlC,MAAM,MAAM,2BAA2B,CACrC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IACnC;IACJ,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,qBAAa,UAAU,CAAC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAC7D,YAAW,OAAO,CAAC,WAAW,CAAC;IAE/B,OAAO,CAAC,WAAW,CAAC,CAAc;IAElC,OAAO,CAAC,oBAAoB,CAAqB;IAEjD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,OAAO,CAAC,SAAS,CAA+C;IAEhE,OAAO,CAAC,iBAAiB,CAA8C;IAEvE,OAAO,CAAC,iBAAiB,CAAqB;IAE9C,OAAO,CAAC,gBAAgB,CAAqB;gBAEjC,EACV,YAAY,EACZ,WAAW,EACX,SAAS,GACV,EAAE,2BAA2B,CAAC,WAAW,CAAC;IAQ3C,IAAI,YAAY,IAIe,MAAM,GAAG,SAAS,CAFhD;IAED,IAAI,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,EAGhD;IAED,IAAI,SAAS,IAIY,MAAM,GAAG,SAAS,CAF1C;IAED,IAAI,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAO1C;IAED,iBAAiB;IAiBjB,IAAI,OAAO,IAIU,WAAW,GAAG,SAAS,CAF3C;IAED,IAAI,OAAO,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,EAK3C;IAED,UAAU;IAIV,UAAU,CAAC,OAAO,EAAE,mBAAmB,CAAC,WAAW,CAAC;IAKpD,eAAe;IAIT,oBAAoB,CACxB,IAAI,GAAE,gBAAgB,GAAG,aAAgC;IAgB3D,kBAAkB,CAAC,eAAe,EAAE,eAAe,CAAC,WAAW,CAAC,GAAG,MAAM;IAEzE,kBAAkB,CAChB,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,eAAe,CAAC,WAAW,CAAC,GAC5C,MAAM;IAqBT,sBAAsB,CAAC,EAAE,EAAE,MAAM;IAIjC,OAAO;CAGR"}
|
package/dist/lib/ContextAPI.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
-
import postRobot from 'post-robot';
|
|
2
|
+
import * as postRobot from 'post-robot';
|
|
3
3
|
export class ContextAPI {
|
|
4
4
|
constructor({ targetWindow, contextData, channelId, }) {
|
|
5
5
|
this.contextData = contextData;
|
|
@@ -8,6 +8,13 @@ export class ContextAPI {
|
|
|
8
8
|
this.targetWindow = targetWindow;
|
|
9
9
|
this.channelId = channelId;
|
|
10
10
|
}
|
|
11
|
+
get targetWindow() {
|
|
12
|
+
return this.internalTargetWindow;
|
|
13
|
+
}
|
|
14
|
+
set targetWindow(targetWindow) {
|
|
15
|
+
this.internalTargetWindow = targetWindow;
|
|
16
|
+
this.syncContextToChannel('get-context');
|
|
17
|
+
}
|
|
11
18
|
get channelId() {
|
|
12
19
|
return this.internalChannelId;
|
|
13
20
|
}
|
|
@@ -16,6 +23,7 @@ export class ContextAPI {
|
|
|
16
23
|
if (channelId) {
|
|
17
24
|
this.postRobotEventId = `context-api-update::${channelId}`;
|
|
18
25
|
this.listenToPostRobot();
|
|
26
|
+
this.syncContextToChannel('get-context');
|
|
19
27
|
}
|
|
20
28
|
}
|
|
21
29
|
listenToPostRobot() {
|
|
@@ -28,6 +36,7 @@ export class ContextAPI {
|
|
|
28
36
|
this.postRobotListener = postRobot.on(this.postRobotEventId, event => {
|
|
29
37
|
if (event.data.from !== this.id) {
|
|
30
38
|
this.contextData = { ...this.contextData, ...event.data.contextData };
|
|
39
|
+
this.notifyListeners();
|
|
31
40
|
}
|
|
32
41
|
return Promise.resolve();
|
|
33
42
|
});
|
|
@@ -50,7 +59,7 @@ export class ContextAPI {
|
|
|
50
59
|
notifyListeners() {
|
|
51
60
|
Object.values(this.listeners).forEach(listener => listener(this.context));
|
|
52
61
|
}
|
|
53
|
-
async syncContextToChannel() {
|
|
62
|
+
async syncContextToChannel(type = 'update-context') {
|
|
54
63
|
if (!this.targetWindow || !this.postRobotEventId) {
|
|
55
64
|
return;
|
|
56
65
|
}
|
|
@@ -58,6 +67,7 @@ export class ContextAPI {
|
|
|
58
67
|
// const context = classInstanceToObject(this.context);
|
|
59
68
|
await postRobot.send(this.targetWindow, this.postRobotEventId, {
|
|
60
69
|
from: this.id,
|
|
70
|
+
type,
|
|
61
71
|
context: this.context,
|
|
62
72
|
});
|
|
63
73
|
}
|
|
@@ -76,7 +86,7 @@ export class ContextAPI {
|
|
|
76
86
|
delete this.listeners[id];
|
|
77
87
|
}
|
|
78
88
|
destroy() {
|
|
79
|
-
this.postRobotListener
|
|
89
|
+
this.postRobotListener?.cancel();
|
|
80
90
|
}
|
|
81
91
|
}
|
|
82
92
|
//# sourceMappingURL=ContextAPI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextAPI.js","sourceRoot":"","sources":["../../src/lib/ContextAPI.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContextAPI.js","sourceRoot":"","sources":["../../src/lib/ContextAPI.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAUxC,MAAM,OAAO,UAAU;IAiBrB,YAAY,EACV,YAAY,EACZ,WAAW,EACX,SAAS,GACgC;QACzC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAED,IAAI,YAAY,CAAC,YAAgC;QAC/C,IAAI,CAAC,oBAAoB,GAAG,YAAY,CAAC;QACzC,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAED,IAAI,SAAS,CAAC,SAA6B;QACzC,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;QACnC,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,gBAAgB,GAAG,uBAAuB,SAAS,EAAE,CAAC;YAC3D,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACzB,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;QA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CAAC,CAAC,CAAC;IAC5E,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,OAAyC,gBAAgB;QAEzD,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACjD,OAAO;QACT,CAAC;QAED,8CAA8C;QAC9C,uDAAuD;QAEvD,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,EAAE;YAC7D,IAAI,EAAE,IAAI,CAAC,EAAE;YACb,IAAI;YACJ,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAC;IACL,CAAC;IASD,kBAAkB,CAChB,mBAA0D,EAC1D,wBAAuD;QAEvD,MAAM,EAAE,GACN,OAAO,mBAAmB,KAAK,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC3E,MAAM,eAAe,GACnB,OAAO,mBAAmB,KAAK,UAAU;YACvC,CAAC,CAAC,mBAAmB;YACrB,CAAC,CAAC,wBAAwB,CAAC;QAE/B,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC;QACrC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,sBAAsB,CAAC,EAAU;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO;QACL,IAAI,CAAC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -6480,10 +6480,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6480
6480
|
value: true
|
|
6481
6481
|
});
|
|
6482
6482
|
exports.forwardCallsToFutureObject = exports.createRemoteApiHandle = void 0;
|
|
6483
|
-
var
|
|
6483
|
+
var postRobot = _interopRequireWildcard(require("post-robot"));
|
|
6484
6484
|
var _utils = require("./utils");
|
|
6485
6485
|
var _constants = require("./constants");
|
|
6486
|
-
function
|
|
6486
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
6487
6487
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
|
|
6488
6488
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
6489
6489
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
@@ -6643,7 +6643,7 @@ var createRemoteApiHandle = exports.createRemoteApiHandle = /*#__PURE__*/functio
|
|
|
6643
6643
|
_context.prev = 5;
|
|
6644
6644
|
_context.next = 8;
|
|
6645
6645
|
return (0, _utils.retry)(function () {
|
|
6646
|
-
return
|
|
6646
|
+
return postRobot.send(octostarWindow, topic, params);
|
|
6647
6647
|
}, {
|
|
6648
6648
|
maxAttempts: 5,
|
|
6649
6649
|
retryInterval: 2000
|
|
@@ -7078,8 +7078,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7078
7078
|
});
|
|
7079
7079
|
exports.ContextAPI = void 0;
|
|
7080
7080
|
var _uuid = require("uuid");
|
|
7081
|
-
var
|
|
7082
|
-
function
|
|
7081
|
+
var postRobot = _interopRequireWildcard(require("post-robot"));
|
|
7082
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
7083
7083
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
7084
7084
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
|
|
7085
7085
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
@@ -7105,6 +7105,15 @@ var ContextAPI = exports.ContextAPI = /*#__PURE__*/function () {
|
|
|
7105
7105
|
this.channelId = channelId;
|
|
7106
7106
|
}
|
|
7107
7107
|
return _createClass(ContextAPI, [{
|
|
7108
|
+
key: "targetWindow",
|
|
7109
|
+
get: function get() {
|
|
7110
|
+
return this.internalTargetWindow;
|
|
7111
|
+
},
|
|
7112
|
+
set: function set(targetWindow) {
|
|
7113
|
+
this.internalTargetWindow = targetWindow;
|
|
7114
|
+
this.syncContextToChannel('get-context');
|
|
7115
|
+
}
|
|
7116
|
+
}, {
|
|
7108
7117
|
key: "channelId",
|
|
7109
7118
|
get: function get() {
|
|
7110
7119
|
return this.internalChannelId;
|
|
@@ -7114,6 +7123,7 @@ var ContextAPI = exports.ContextAPI = /*#__PURE__*/function () {
|
|
|
7114
7123
|
if (channelId) {
|
|
7115
7124
|
this.postRobotEventId = "context-api-update::".concat(channelId);
|
|
7116
7125
|
this.listenToPostRobot();
|
|
7126
|
+
this.syncContextToChannel('get-context');
|
|
7117
7127
|
}
|
|
7118
7128
|
}
|
|
7119
7129
|
}, {
|
|
@@ -7126,9 +7136,10 @@ var ContextAPI = exports.ContextAPI = /*#__PURE__*/function () {
|
|
|
7126
7136
|
if (this.postRobotListener) {
|
|
7127
7137
|
this.postRobotListener.cancel();
|
|
7128
7138
|
}
|
|
7129
|
-
this.postRobotListener =
|
|
7139
|
+
this.postRobotListener = postRobot.on(this.postRobotEventId, function (event) {
|
|
7130
7140
|
if (event.data.from !== _this.id) {
|
|
7131
7141
|
_this.contextData = _objectSpread(_objectSpread({}, _this.contextData), event.data.contextData);
|
|
7142
|
+
_this.notifyListeners();
|
|
7132
7143
|
}
|
|
7133
7144
|
return Promise.resolve();
|
|
7134
7145
|
});
|
|
@@ -7165,21 +7176,25 @@ var ContextAPI = exports.ContextAPI = /*#__PURE__*/function () {
|
|
|
7165
7176
|
key: "syncContextToChannel",
|
|
7166
7177
|
value: function () {
|
|
7167
7178
|
var _syncContextToChannel = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
7179
|
+
var type,
|
|
7180
|
+
_args = arguments;
|
|
7168
7181
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7169
7182
|
while (1) switch (_context.prev = _context.next) {
|
|
7170
7183
|
case 0:
|
|
7184
|
+
type = _args.length > 0 && _args[0] !== undefined ? _args[0] : 'update-context';
|
|
7171
7185
|
if (!(!this.targetWindow || !this.postRobotEventId)) {
|
|
7172
|
-
_context.next =
|
|
7186
|
+
_context.next = 3;
|
|
7173
7187
|
break;
|
|
7174
7188
|
}
|
|
7175
7189
|
return _context.abrupt("return");
|
|
7176
|
-
case
|
|
7177
|
-
_context.next =
|
|
7178
|
-
return
|
|
7190
|
+
case 3:
|
|
7191
|
+
_context.next = 5;
|
|
7192
|
+
return postRobot.send(this.targetWindow, this.postRobotEventId, {
|
|
7179
7193
|
from: this.id,
|
|
7194
|
+
type: type,
|
|
7180
7195
|
context: this.context
|
|
7181
7196
|
});
|
|
7182
|
-
case
|
|
7197
|
+
case 5:
|
|
7183
7198
|
case "end":
|
|
7184
7199
|
return _context.stop();
|
|
7185
7200
|
}
|
|
@@ -7209,7 +7224,8 @@ var ContextAPI = exports.ContextAPI = /*#__PURE__*/function () {
|
|
|
7209
7224
|
}, {
|
|
7210
7225
|
key: "destroy",
|
|
7211
7226
|
value: function destroy() {
|
|
7212
|
-
|
|
7227
|
+
var _this$postRobotListen;
|
|
7228
|
+
(_this$postRobotListen = this.postRobotListener) === null || _this$postRobotListen === void 0 || _this$postRobotListen.cancel();
|
|
7213
7229
|
}
|
|
7214
7230
|
}]);
|
|
7215
7231
|
}();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octostar/platform-api",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.17",
|
|
4
4
|
"description": "Provides access to the API exposed by Octostar platform to an application run in an iframe",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"octostar",
|
|
@@ -33,15 +33,16 @@
|
|
|
33
33
|
"uuid": "^9.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
+
"@types/post-robot": "^10.0.6",
|
|
36
37
|
"babelify": "^10.0.0",
|
|
37
38
|
"browserify": "^17.0.0",
|
|
38
39
|
"rimraf": "^5.0.5",
|
|
39
40
|
"tsup": "^8.4.0",
|
|
40
41
|
"typescript": "^5.8.2",
|
|
41
|
-
"@octostar/platform-types": "0.5.
|
|
42
|
+
"@octostar/platform-types": "0.5.20"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
|
-
"@octostar/platform-types": "^0.5.
|
|
45
|
+
"@octostar/platform-types": "^0.5.20"
|
|
45
46
|
},
|
|
46
47
|
"publishConfig": {
|
|
47
48
|
"access": "public"
|