@twintag/twintag-core 0.2.281 → 0.2.282
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/cjs/{auth-b8eb975c.js → auth-2b2f17e8.js} +17 -5
- package/dist/cjs/index.cjs.js +31 -9
- package/dist/cjs/twintag-auth-callback.cjs.entry.js +1 -2
- package/dist/cjs/twintag-offline-support.cjs.entry.js +6 -27
- package/dist/collection/components/twintag-offline-support/LocalArrowData.service.js +0 -4
- package/dist/collection/components/twintag-offline-support/local-data.service.js +6 -13
- package/dist/collection/components/twintag-offline-support/twintag-offline-support.js +1 -14
- package/dist/collection/version.js +1 -1
- package/dist/components/index.js +30 -1
- package/dist/components/twintag-auth-callback.js +14 -2
- package/dist/components/twintag-offline-support.js +7 -53
- package/dist/esm/{auth-c2a87e33.js → auth-1c631a9d.js} +14 -3
- package/dist/esm/index.js +30 -3
- package/dist/esm/twintag-auth-callback.entry.js +1 -2
- package/dist/esm/twintag-offline-support.entry.js +6 -27
- package/dist/stencil-web-components/index.esm.js +1 -1
- package/dist/stencil-web-components/p-08e1ea24.js +1 -0
- package/dist/stencil-web-components/p-5b0e960d.entry.js +1 -0
- package/dist/stencil-web-components/p-821ba724.entry.js +1 -0
- package/dist/stencil-web-components/stencil-web-components.esm.js +1 -1
- package/dist/types/components/twintag-offline-support/local-data.service.d.ts +0 -2
- package/dist/types/components/twintag-offline-support/model.d.ts +24 -24
- package/dist/types/components/twintag-offline-support/twintag-offline-support.d.ts +0 -1
- package/dist/types/drone/src/libs/stencil-web-components/.stencil/libs/model/src/lib/offline-support.d.ts +4 -4
- package/dist/types/drone/src/libs/stencil-web-components/.stencil/libs/twintag-sdk/src/lib/version.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/twintag-sdk/src/lib/version.js +1 -1
- package/dist/cjs/utils-c573638e.js +0 -16
- package/dist/cjs/view-b991bc58.js +0 -31
- package/dist/components/utils.js +0 -14
- package/dist/esm/utils-c73229be.js +0 -14
- package/dist/esm/view-a251c1a9.js +0 -29
- package/dist/stencil-web-components/p-2c603989.js +0 -1
- package/dist/stencil-web-components/p-2e4c78ca.js +0 -1
- package/dist/stencil-web-components/p-5699b3bb.entry.js +0 -1
- package/dist/stencil-web-components/p-6d5b977c.js +0 -1
- package/dist/stencil-web-components/p-87632f07.entry.js +0 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const utils = require('./utils-c573638e.js');
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* An implementation of rfc6749#section-4.1 and rfc7636.
|
|
7
5
|
*/
|
|
@@ -121,6 +119,19 @@ const LinkedIn = {
|
|
|
121
119
|
};
|
|
122
120
|
const LinkedInUserInfoDomain = "https://api.linkedin.com";
|
|
123
121
|
|
|
122
|
+
/**
|
|
123
|
+
* If opened in iframe, then redirect from parent's window as some IDPs block iframes eg linkedin
|
|
124
|
+
* @returns boolean
|
|
125
|
+
*/
|
|
126
|
+
function inIframe() {
|
|
127
|
+
try {
|
|
128
|
+
return window.self !== window.top;
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
124
135
|
class baseAuthService {
|
|
125
136
|
constructor() {
|
|
126
137
|
}
|
|
@@ -467,7 +478,7 @@ class WebAuthService {
|
|
|
467
478
|
`state=${this.state.stateQueryParam}&` +
|
|
468
479
|
`code_challenge=${encodeURIComponent(codeChallenge)}&` +
|
|
469
480
|
`code_challenge_method=S256`;
|
|
470
|
-
if (
|
|
481
|
+
if (inIframe()) {
|
|
471
482
|
window.parent.location.replace(url);
|
|
472
483
|
}
|
|
473
484
|
else {
|
|
@@ -577,7 +588,7 @@ class BackendAuthService {
|
|
|
577
588
|
url += `&${key}=${value}`;
|
|
578
589
|
});
|
|
579
590
|
}
|
|
580
|
-
if (
|
|
591
|
+
if (inIframe()) {
|
|
581
592
|
window.parent.location.replace(url);
|
|
582
593
|
}
|
|
583
594
|
else {
|
|
@@ -631,7 +642,7 @@ class BackendAuthService {
|
|
|
631
642
|
const stateQueryParam = JSON.parse(this.state.stateQueryParam ? atob(this.state.stateQueryParam) : '{}');
|
|
632
643
|
let url = `${this.host}/${viewId}/auth/${stateQueryParam.secretId}/logout?id-token=${this.state.idToken}`;
|
|
633
644
|
localStorage.removeItem(btoa(this.host) + LOCALSTORAGE_STATE);
|
|
634
|
-
if (
|
|
645
|
+
if (inIframe()) {
|
|
635
646
|
window.parent.location.replace(url);
|
|
636
647
|
}
|
|
637
648
|
else {
|
|
@@ -812,3 +823,4 @@ class Auth {
|
|
|
812
823
|
}
|
|
813
824
|
|
|
814
825
|
exports.Auth = Auth;
|
|
826
|
+
exports.inIframe = inIframe;
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -2,17 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const auth = require('./auth-
|
|
6
|
-
const view = require('./view-b991bc58.js');
|
|
7
|
-
require('./utils-c573638e.js');
|
|
8
|
-
|
|
5
|
+
const auth = require('./auth-2b2f17e8.js');
|
|
9
6
|
|
|
7
|
+
/**
|
|
8
|
+
* The view object represents the current active view.
|
|
9
|
+
* A common use is to figure out the QID of the active view, E.g:
|
|
10
|
+
* ```js
|
|
11
|
+
* let viewId = View.getId()
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
class View {
|
|
15
|
+
/**
|
|
16
|
+
* Get view id for current twintag
|
|
17
|
+
* @returns string view id
|
|
18
|
+
*/
|
|
19
|
+
static getId() {
|
|
20
|
+
const url = new URL(window.location.href);
|
|
21
|
+
const path_segments = url.pathname.split('/').filter((x) => x.length > 0);
|
|
22
|
+
const views_segment_idx = path_segments.indexOf('views');
|
|
23
|
+
return path_segments.length > 0
|
|
24
|
+
? auth.inIframe() && views_segment_idx > -1
|
|
25
|
+
? path_segments[views_segment_idx + 1]
|
|
26
|
+
// Assuming the `id` is the first segment and there could be
|
|
27
|
+
// additional segments available. Example: `<base_url>/<view_id>/onboard`
|
|
28
|
+
: path_segments[0]
|
|
29
|
+
: '';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
10
32
|
|
|
11
33
|
exports.Auth = auth.Auth;
|
|
12
34
|
Object.defineProperty(exports, 'AuthConfigTemplate', {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return auth.AuthConfigTemplate;
|
|
38
|
+
}
|
|
17
39
|
});
|
|
18
|
-
exports.View =
|
|
40
|
+
exports.View = View;
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2c25b2e9.js');
|
|
6
|
-
const auth = require('./auth-
|
|
7
|
-
require('./utils-c573638e.js');
|
|
6
|
+
const auth = require('./auth-2b2f17e8.js');
|
|
8
7
|
|
|
9
8
|
const twintagAuthCallbackCss = ":host{display:block}";
|
|
10
9
|
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2c25b2e9.js');
|
|
6
|
-
const view = require('./view-b991bc58.js');
|
|
7
6
|
const _commonjsHelpers = require('./_commonjsHelpers-206db00d.js');
|
|
8
|
-
require('./utils-c573638e.js');
|
|
9
7
|
|
|
10
8
|
try{self["workbox:window:5.1.4"]&&_();}catch(n){}function n(n,t){return new Promise((function(r){var e=new MessageChannel;e.port1.onmessage=function(n){r(n.data);},n.postMessage(t,[e.port2]);}))}function t(n,t){for(var r=0;r<t.length;r++){var e=t[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e);}}function r(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,e=new Array(t);r<t;r++)e[r]=n[r];return e}function e(n,t){var e;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(e=function(n,t){if(n){if("string"==typeof n)return r(n,t);var e=Object.prototype.toString.call(n).slice(8,-1);return "Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(n):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?r(n,t):void 0}}(n))||t&&n&&"number"==typeof n.length){e&&(n=e);var i=0;return function(){return i>=n.length?{done:!0}:{done:!1,value:n[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return (e=n[Symbol.iterator]()).next.bind(e)}try{self["workbox:core:5.1.4"]&&_();}catch(n){}var i$1=function(){var n=this;this.promise=new Promise((function(t,r){n.resolve=t,n.reject=r;}));};function o(n,t){var r=location.href;return new URL(n,r).href===new URL(t,r).href}var u=function(n,t){this.type=n,Object.assign(this,t);};function a(n,t,r){return r?t?t(n):n:(n&&n.then||(n=Promise.resolve(n)),t?n.then(t):n)}function c(){}var f=function(r){var e,c;function f(n,t){var e,c;return void 0===t&&(t={}),(e=r.call(this)||this).t={},e.i=0,e.o=new i$1,e.u=new i$1,e.s=new i$1,e.v=0,e.h=new Set,e.l=function(){var n=e.m,t=n.installing;e.i>0||!o(t.scriptURL,e.g)||performance.now()>e.v+6e4?(e.p=t,n.removeEventListener("updatefound",e.l)):(e.P=t,e.h.add(t),e.o.resolve(t)),++e.i,t.addEventListener("statechange",e.S);},e.S=function(n){var t=e.m,r=n.target,i=r.state,o=r===e.p,a=o?"external":"",c={sw:r,originalEvent:n};!o&&e.j&&(c.isUpdate=!0),e.dispatchEvent(new u(a+i,c)),"installed"===i?e.A=self.setTimeout((function(){"installed"===i&&t.waiting===r&&e.dispatchEvent(new u(a+"waiting",c));}),200):"activating"===i&&(clearTimeout(e.A),o||e.u.resolve(r));},e.O=function(n){var t=e.P;t===navigator.serviceWorker.controller&&(e.dispatchEvent(new u("controlling",{sw:t,originalEvent:n,isUpdate:e.j})),e.s.resolve(t));},e.U=(c=function(n){var t=n.data,r=n.source;return a(e.getSW(),(function(){e.h.has(r)&&e.dispatchEvent(new u("message",{data:t,sw:r,originalEvent:n}));}))},function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];try{return Promise.resolve(c.apply(this,n))}catch(n){return Promise.reject(n)}}),e.g=n,e.t=t,navigator.serviceWorker.addEventListener("message",e.U),e}c=r,(e=f).prototype=Object.create(c.prototype),e.prototype.constructor=e,e.__proto__=c;var v,h,m=f.prototype;return m.register=function(n){var t=(void 0===n?{}:n).immediate,r=void 0!==t&&t;try{var e=this;return function(n,t){var r=n();if(r&&r.then)return r.then(t);return t(r)}((function(){if(!r&&"complete"!==document.readyState)return s(new Promise((function(n){return window.addEventListener("load",n)})))}),(function(){return e.j=Boolean(navigator.serviceWorker.controller),e.I=e.M(),a(e.R(),(function(n){e.m=n,e.I&&(e.P=e.I,e.u.resolve(e.I),e.s.resolve(e.I),e.I.addEventListener("statechange",e.S,{once:!0}));var t=e.m.waiting;return t&&o(t.scriptURL,e.g)&&(e.P=t,Promise.resolve().then((function(){e.dispatchEvent(new u("waiting",{sw:t,wasWaitingBeforeRegister:!0}));})).then((function(){}))),e.P&&(e.o.resolve(e.P),e.h.add(e.P)),e.m.addEventListener("updatefound",e.l),navigator.serviceWorker.addEventListener("controllerchange",e.O,{once:!0}),e.m}))}))}catch(n){return Promise.reject(n)}},m.update=function(){try{return this.m?s(this.m.update()):void 0}catch(n){return Promise.reject(n)}},m.getSW=function(){try{return void 0!==this.P?this.P:this.o.promise}catch(n){return Promise.reject(n)}},m.messageSW=function(t){try{return a(this.getSW(),(function(r){return n(r,t)}))}catch(n){return Promise.reject(n)}},m.M=function(){var n=navigator.serviceWorker.controller;return n&&o(n.scriptURL,this.g)?n:void 0},m.R=function(){try{var n=this;return function(n,t){try{var r=n();}catch(n){return t(n)}if(r&&r.then)return r.then(void 0,t);return r}((function(){return a(navigator.serviceWorker.register(n.g,n.t),(function(t){return n.v=performance.now(),t}))}),(function(n){throw n}))}catch(n){return Promise.reject(n)}},v=f,(h=[{key:"active",get:function(){return this.u.promise}},{key:"controlling",get:function(){return this.s.promise}}])&&t(v.prototype,h),f}(function(){function n(){this.k=new Map;}var t=n.prototype;return t.addEventListener=function(n,t){this.B(n).add(t);},t.removeEventListener=function(n,t){this.B(n).delete(t);},t.dispatchEvent=function(n){n.target=this;for(var t,r=e(this.B(n.type));!(t=r()).done;){(0, t.value)(n);}},t.B=function(n){return this.k.has(n)||this.k.set(n,new Set),this.k.get(n)},n}());function s(n,t){if(!t)return n&&n.then?n.then(c):Promise.resolve()}
|
|
11
9
|
|
|
@@ -206,7 +204,7 @@ class IndexedDbService {
|
|
|
206
204
|
/**
|
|
207
205
|
* The SDK version.
|
|
208
206
|
*/
|
|
209
|
-
const VERSION = '0.
|
|
207
|
+
const VERSION = '0.2.282';
|
|
210
208
|
|
|
211
209
|
class TwintagErrorValue {
|
|
212
210
|
}
|
|
@@ -18480,25 +18478,19 @@ class OfflineDataService {
|
|
|
18480
18478
|
async cacheSDObjects(offlineObjects) {
|
|
18481
18479
|
let objData;
|
|
18482
18480
|
let objectsToCache;
|
|
18483
|
-
if (!this.view) {
|
|
18484
|
-
this.view = new View(this.config.viewId);
|
|
18485
|
-
}
|
|
18486
|
-
const viewId = view.View.getId();
|
|
18487
|
-
const epsilonFileName = this.config.epsilonFileName;
|
|
18488
|
-
const epsilon = new Epsilon(viewId);
|
|
18489
18481
|
if (offlineObjects && offlineObjects !== '*') {
|
|
18490
18482
|
objectsToCache = this.config.offlineObjects.filter((offObj) => offlineObjects.includes(offObj.objectName));
|
|
18491
18483
|
}
|
|
18492
18484
|
else {
|
|
18493
18485
|
objectsToCache = [...this.config.offlineObjects];
|
|
18494
18486
|
}
|
|
18487
|
+
const ep = this.config.epsilonExecutor ? this.config.epsilonExecutor : new Epsilon(this.config.viewId);
|
|
18495
18488
|
for (const obj of objectsToCache) {
|
|
18496
|
-
const requestOptions = {
|
|
18497
|
-
action: 'getSDObject',
|
|
18498
|
-
params: obj,
|
|
18499
|
-
};
|
|
18500
18489
|
try {
|
|
18501
|
-
objData = await
|
|
18490
|
+
objData = await ep.execute(this.config.epsilonFileName, {
|
|
18491
|
+
action: 'getSDObject',
|
|
18492
|
+
input: obj,
|
|
18493
|
+
});
|
|
18502
18494
|
}
|
|
18503
18495
|
catch (e) {
|
|
18504
18496
|
console.log(e);
|
|
@@ -18617,16 +18609,6 @@ const TwintagOfflineSupport = class {
|
|
|
18617
18609
|
this.setState(navigator.onLine);
|
|
18618
18610
|
}
|
|
18619
18611
|
}
|
|
18620
|
-
async connectedCallback() {
|
|
18621
|
-
// this.dataService = new OfflineDataService(this.config);
|
|
18622
|
-
// (window as any).twintagOfflineSupport = this;
|
|
18623
|
-
// window.addEventListener('offline', this.setOffline);
|
|
18624
|
-
// window.addEventListener('online', this.setOnline);
|
|
18625
|
-
// this.pendingRequests = await DbService.getAll(this.storeName);
|
|
18626
|
-
// this.emitChanges('initialized', null);
|
|
18627
|
-
// this.setState(navigator.onLine);
|
|
18628
|
-
// console.log(this.onLine);
|
|
18629
|
-
}
|
|
18630
18612
|
async componentWillLoad() {
|
|
18631
18613
|
this.dataService = new OfflineDataService(this.config);
|
|
18632
18614
|
window.twintagOfflineSupport = this;
|
|
@@ -18635,11 +18617,8 @@ const TwintagOfflineSupport = class {
|
|
|
18635
18617
|
this.setState(navigator.onLine);
|
|
18636
18618
|
this.pendingRequests = await IndexedDbService.getAll(OFFLINEREQUESTSTORE);
|
|
18637
18619
|
this.emitChanges('initialized', null);
|
|
18638
|
-
// console.log(this.onLine);
|
|
18639
|
-
// this.loadServiceWorker();
|
|
18640
18620
|
}
|
|
18641
18621
|
componentDidLoad() {
|
|
18642
|
-
// console.log(this.config);
|
|
18643
18622
|
if (this.config &&
|
|
18644
18623
|
this.config.offlineObjects &&
|
|
18645
18624
|
this.config.offlineObjects.length > 0) {
|
|
@@ -75,10 +75,6 @@ export class LocalArrowDataService {
|
|
|
75
75
|
this.log('LocalArrowDataService::handleDelete', { request, requestArgs });
|
|
76
76
|
let response;
|
|
77
77
|
let error;
|
|
78
|
-
let offlineObject = {
|
|
79
|
-
type: requestArgs.type,
|
|
80
|
-
objectName: requestArgs.objectApiName
|
|
81
|
-
};
|
|
82
78
|
let dataRow = JSON.parse(request.args.body);
|
|
83
79
|
const arrowTable = await this.getTableFromLocalCache(requestArgs);
|
|
84
80
|
if (arrowTable) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { View as viewContext } from '../../services/view/view';
|
|
1
|
+
import { Epsilon } from '@twintag/twintag-sdk';
|
|
3
2
|
import { LocalArrowDataService } from './LocalArrowData.service';
|
|
4
3
|
export class OfflineDataService {
|
|
5
4
|
constructor(config) {
|
|
@@ -16,25 +15,19 @@ export class OfflineDataService {
|
|
|
16
15
|
async cacheSDObjects(offlineObjects) {
|
|
17
16
|
let objData;
|
|
18
17
|
let objectsToCache;
|
|
19
|
-
if (!this.view) {
|
|
20
|
-
this.view = new View(this.config.viewId);
|
|
21
|
-
}
|
|
22
|
-
const viewId = viewContext.getId();
|
|
23
|
-
const epsilonFileName = this.config.epsilonFileName;
|
|
24
|
-
const epsilon = new Epsilon(viewId);
|
|
25
18
|
if (offlineObjects && offlineObjects !== '*') {
|
|
26
19
|
objectsToCache = this.config.offlineObjects.filter((offObj) => offlineObjects.includes(offObj.objectName));
|
|
27
20
|
}
|
|
28
21
|
else {
|
|
29
22
|
objectsToCache = [...this.config.offlineObjects];
|
|
30
23
|
}
|
|
24
|
+
const ep = this.config.epsilonExecutor ? this.config.epsilonExecutor : new Epsilon(this.config.viewId);
|
|
31
25
|
for (const obj of objectsToCache) {
|
|
32
|
-
const requestOptions = {
|
|
33
|
-
action: 'getSDObject',
|
|
34
|
-
params: obj,
|
|
35
|
-
};
|
|
36
26
|
try {
|
|
37
|
-
objData = await
|
|
27
|
+
objData = await ep.execute(this.config.epsilonFileName, {
|
|
28
|
+
action: 'getSDObject',
|
|
29
|
+
input: obj,
|
|
30
|
+
});
|
|
38
31
|
}
|
|
39
32
|
catch (e) {
|
|
40
33
|
console.log(e);
|
|
@@ -30,16 +30,6 @@ export class TwintagOfflineSupport {
|
|
|
30
30
|
this.setState(navigator.onLine);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
async connectedCallback() {
|
|
34
|
-
// this.dataService = new OfflineDataService(this.config);
|
|
35
|
-
// (window as any).twintagOfflineSupport = this;
|
|
36
|
-
// window.addEventListener('offline', this.setOffline);
|
|
37
|
-
// window.addEventListener('online', this.setOnline);
|
|
38
|
-
// this.pendingRequests = await DbService.getAll(this.storeName);
|
|
39
|
-
// this.emitChanges('initialized', null);
|
|
40
|
-
// this.setState(navigator.onLine);
|
|
41
|
-
// console.log(this.onLine);
|
|
42
|
-
}
|
|
43
33
|
async componentWillLoad() {
|
|
44
34
|
this.dataService = new OfflineDataService(this.config);
|
|
45
35
|
window.twintagOfflineSupport = this;
|
|
@@ -48,11 +38,8 @@ export class TwintagOfflineSupport {
|
|
|
48
38
|
this.setState(navigator.onLine);
|
|
49
39
|
this.pendingRequests = await IndexedDbService.getAll(OFFLINEREQUESTSTORE);
|
|
50
40
|
this.emitChanges('initialized', null);
|
|
51
|
-
// console.log(this.onLine);
|
|
52
|
-
// this.loadServiceWorker();
|
|
53
41
|
}
|
|
54
42
|
componentDidLoad() {
|
|
55
|
-
// console.log(this.config);
|
|
56
43
|
if (this.config &&
|
|
57
44
|
this.config.offlineObjects &&
|
|
58
45
|
this.config.offlineObjects.length > 0) {
|
|
@@ -373,7 +360,7 @@ export class TwintagOfflineSupport {
|
|
|
373
360
|
"mutable": false,
|
|
374
361
|
"complexType": {
|
|
375
362
|
"original": "OfflineConfig",
|
|
376
|
-
"resolved": "OfflineConfig",
|
|
363
|
+
"resolved": "OfflineConfig<OfflineCapableEpsilonClass>",
|
|
377
364
|
"references": {
|
|
378
365
|
"OfflineConfig": {
|
|
379
366
|
"location": "import",
|
package/dist/components/index.js
CHANGED
|
@@ -1,13 +1,42 @@
|
|
|
1
1
|
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
|
+
import { i as inIframe } from './twintag-auth-callback.js';
|
|
2
3
|
export { A as Auth, a as AuthConfigTemplate, TwintagAuthCallback, defineCustomElement as defineCustomElementTwintagAuthCallback } from './twintag-auth-callback.js';
|
|
3
|
-
export { TwintagOfflineSupport, V as View, defineCustomElement as defineCustomElementTwintagOfflineSupport } from './twintag-offline-support.js';
|
|
4
4
|
export { TwintagAuthLogout, defineCustomElement as defineCustomElementTwintagAuthLogout } from './twintag-auth-logout.js';
|
|
5
5
|
export { TwintagMedia, defineCustomElement as defineCustomElementTwintagMedia } from './twintag-media.js';
|
|
6
6
|
export { TwintagOcrScanner, defineCustomElement as defineCustomElementTwintagOcrScanner } from './twintag-ocr-scanner.js';
|
|
7
7
|
export { TwintagOfflineActions, defineCustomElement as defineCustomElementTwintagOfflineActions } from './twintag-offline-actions.js';
|
|
8
8
|
export { TwintagOfflineState, defineCustomElement as defineCustomElementTwintagOfflineState } from './twintag-offline-state.js';
|
|
9
|
+
export { TwintagOfflineSupport, defineCustomElement as defineCustomElementTwintagOfflineSupport } from './twintag-offline-support.js';
|
|
9
10
|
export { TwintagPdfViewer, defineCustomElement as defineCustomElementTwintagPdfViewer } from './twintag-pdf-viewer.js';
|
|
10
11
|
export { TwintagPreview, defineCustomElement as defineCustomElementTwintagPreview } from './twintag-preview.js';
|
|
11
12
|
export { TwintagQrScanner, defineCustomElement as defineCustomElementTwintagQrScanner } from './twintag-qr-scanner.js';
|
|
12
13
|
export { TwintagShare, defineCustomElement as defineCustomElementTwintagShare } from './twintag-share.js';
|
|
13
14
|
export { TwintagSpinner, defineCustomElement as defineCustomElementTwintagSpinner } from './twintag-spinner.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The view object represents the current active view.
|
|
18
|
+
* A common use is to figure out the QID of the active view, E.g:
|
|
19
|
+
* ```js
|
|
20
|
+
* let viewId = View.getId()
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
class View {
|
|
24
|
+
/**
|
|
25
|
+
* Get view id for current twintag
|
|
26
|
+
* @returns string view id
|
|
27
|
+
*/
|
|
28
|
+
static getId() {
|
|
29
|
+
const url = new URL(window.location.href);
|
|
30
|
+
const path_segments = url.pathname.split('/').filter((x) => x.length > 0);
|
|
31
|
+
const views_segment_idx = path_segments.indexOf('views');
|
|
32
|
+
return path_segments.length > 0
|
|
33
|
+
? inIframe() && views_segment_idx > -1
|
|
34
|
+
? path_segments[views_segment_idx + 1]
|
|
35
|
+
// Assuming the `id` is the first segment and there could be
|
|
36
|
+
// additional segments available. Example: `<base_url>/<view_id>/onboard`
|
|
37
|
+
: path_segments[0]
|
|
38
|
+
: '';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { View };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement } from '@stencil/core/internal/client';
|
|
2
|
-
import { i as inIframe } from './utils.js';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* An implementation of rfc6749#section-4.1 and rfc7636.
|
|
@@ -120,6 +119,19 @@ const LinkedIn = {
|
|
|
120
119
|
};
|
|
121
120
|
const LinkedInUserInfoDomain = "https://api.linkedin.com";
|
|
122
121
|
|
|
122
|
+
/**
|
|
123
|
+
* If opened in iframe, then redirect from parent's window as some IDPs block iframes eg linkedin
|
|
124
|
+
* @returns boolean
|
|
125
|
+
*/
|
|
126
|
+
function inIframe() {
|
|
127
|
+
try {
|
|
128
|
+
return window.self !== window.top;
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
123
135
|
class baseAuthService {
|
|
124
136
|
constructor() {
|
|
125
137
|
}
|
|
@@ -850,4 +862,4 @@ function defineCustomElement$1() {
|
|
|
850
862
|
const TwintagAuthCallback = TwintagAuthCallback$1;
|
|
851
863
|
const defineCustomElement = defineCustomElement$1;
|
|
852
864
|
|
|
853
|
-
export { Auth as A, TwintagAuthCallback, AuthConfigTemplate as a, defineCustomElement };
|
|
865
|
+
export { Auth as A, TwintagAuthCallback, AuthConfigTemplate as a, defineCustomElement, inIframe as i };
|
|
@@ -1,33 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent } from '@stencil/core/internal/client';
|
|
2
|
-
import { i as inIframe } from './utils.js';
|
|
3
2
|
import { c as createCommonjsModule, g as getAugmentedNamespace } from './_commonjsHelpers.js';
|
|
4
3
|
|
|
5
|
-
/**
|
|
6
|
-
* The view object represents the current active view.
|
|
7
|
-
* A common use is to figure out the QID of the active view, E.g:
|
|
8
|
-
* ```js
|
|
9
|
-
* let viewId = View.getId()
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
class View$1 {
|
|
13
|
-
/**
|
|
14
|
-
* Get view id for current twintag
|
|
15
|
-
* @returns string view id
|
|
16
|
-
*/
|
|
17
|
-
static getId() {
|
|
18
|
-
const url = new URL(window.location.href);
|
|
19
|
-
const path_segments = url.pathname.split('/').filter((x) => x.length > 0);
|
|
20
|
-
const views_segment_idx = path_segments.indexOf('views');
|
|
21
|
-
return path_segments.length > 0
|
|
22
|
-
? inIframe() && views_segment_idx > -1
|
|
23
|
-
? path_segments[views_segment_idx + 1]
|
|
24
|
-
// Assuming the `id` is the first segment and there could be
|
|
25
|
-
// additional segments available. Example: `<base_url>/<view_id>/onboard`
|
|
26
|
-
: path_segments[0]
|
|
27
|
-
: '';
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
4
|
try{self["workbox:window:5.1.4"]&&_();}catch(n){}function n(n,t){return new Promise((function(r){var e=new MessageChannel;e.port1.onmessage=function(n){r(n.data);},n.postMessage(t,[e.port2]);}))}function t(n,t){for(var r=0;r<t.length;r++){var e=t[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e);}}function r(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,e=new Array(t);r<t;r++)e[r]=n[r];return e}function e(n,t){var e;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(e=function(n,t){if(n){if("string"==typeof n)return r(n,t);var e=Object.prototype.toString.call(n).slice(8,-1);return "Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(n):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?r(n,t):void 0}}(n))||t&&n&&"number"==typeof n.length){e&&(n=e);var i=0;return function(){return i>=n.length?{done:!0}:{done:!1,value:n[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return (e=n[Symbol.iterator]()).next.bind(e)}try{self["workbox:core:5.1.4"]&&_();}catch(n){}var i$1=function(){var n=this;this.promise=new Promise((function(t,r){n.resolve=t,n.reject=r;}));};function o(n,t){var r=location.href;return new URL(n,r).href===new URL(t,r).href}var u=function(n,t){this.type=n,Object.assign(this,t);};function a(n,t,r){return r?t?t(n):n:(n&&n.then||(n=Promise.resolve(n)),t?n.then(t):n)}function c(){}var f=function(r){var e,c;function f(n,t){var e,c;return void 0===t&&(t={}),(e=r.call(this)||this).t={},e.i=0,e.o=new i$1,e.u=new i$1,e.s=new i$1,e.v=0,e.h=new Set,e.l=function(){var n=e.m,t=n.installing;e.i>0||!o(t.scriptURL,e.g)||performance.now()>e.v+6e4?(e.p=t,n.removeEventListener("updatefound",e.l)):(e.P=t,e.h.add(t),e.o.resolve(t)),++e.i,t.addEventListener("statechange",e.S);},e.S=function(n){var t=e.m,r=n.target,i=r.state,o=r===e.p,a=o?"external":"",c={sw:r,originalEvent:n};!o&&e.j&&(c.isUpdate=!0),e.dispatchEvent(new u(a+i,c)),"installed"===i?e.A=self.setTimeout((function(){"installed"===i&&t.waiting===r&&e.dispatchEvent(new u(a+"waiting",c));}),200):"activating"===i&&(clearTimeout(e.A),o||e.u.resolve(r));},e.O=function(n){var t=e.P;t===navigator.serviceWorker.controller&&(e.dispatchEvent(new u("controlling",{sw:t,originalEvent:n,isUpdate:e.j})),e.s.resolve(t));},e.U=(c=function(n){var t=n.data,r=n.source;return a(e.getSW(),(function(){e.h.has(r)&&e.dispatchEvent(new u("message",{data:t,sw:r,originalEvent:n}));}))},function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];try{return Promise.resolve(c.apply(this,n))}catch(n){return Promise.reject(n)}}),e.g=n,e.t=t,navigator.serviceWorker.addEventListener("message",e.U),e}c=r,(e=f).prototype=Object.create(c.prototype),e.prototype.constructor=e,e.__proto__=c;var v,h,m=f.prototype;return m.register=function(n){var t=(void 0===n?{}:n).immediate,r=void 0!==t&&t;try{var e=this;return function(n,t){var r=n();if(r&&r.then)return r.then(t);return t(r)}((function(){if(!r&&"complete"!==document.readyState)return s(new Promise((function(n){return window.addEventListener("load",n)})))}),(function(){return e.j=Boolean(navigator.serviceWorker.controller),e.I=e.M(),a(e.R(),(function(n){e.m=n,e.I&&(e.P=e.I,e.u.resolve(e.I),e.s.resolve(e.I),e.I.addEventListener("statechange",e.S,{once:!0}));var t=e.m.waiting;return t&&o(t.scriptURL,e.g)&&(e.P=t,Promise.resolve().then((function(){e.dispatchEvent(new u("waiting",{sw:t,wasWaitingBeforeRegister:!0}));})).then((function(){}))),e.P&&(e.o.resolve(e.P),e.h.add(e.P)),e.m.addEventListener("updatefound",e.l),navigator.serviceWorker.addEventListener("controllerchange",e.O,{once:!0}),e.m}))}))}catch(n){return Promise.reject(n)}},m.update=function(){try{return this.m?s(this.m.update()):void 0}catch(n){return Promise.reject(n)}},m.getSW=function(){try{return void 0!==this.P?this.P:this.o.promise}catch(n){return Promise.reject(n)}},m.messageSW=function(t){try{return a(this.getSW(),(function(r){return n(r,t)}))}catch(n){return Promise.reject(n)}},m.M=function(){var n=navigator.serviceWorker.controller;return n&&o(n.scriptURL,this.g)?n:void 0},m.R=function(){try{var n=this;return function(n,t){try{var r=n();}catch(n){return t(n)}if(r&&r.then)return r.then(void 0,t);return r}((function(){return a(navigator.serviceWorker.register(n.g,n.t),(function(t){return n.v=performance.now(),t}))}),(function(n){throw n}))}catch(n){return Promise.reject(n)}},v=f,(h=[{key:"active",get:function(){return this.u.promise}},{key:"controlling",get:function(){return this.s.promise}}])&&t(v.prototype,h),f}(function(){function n(){this.k=new Map;}var t=n.prototype;return t.addEventListener=function(n,t){this.B(n).add(t);},t.removeEventListener=function(n,t){this.B(n).delete(t);},t.dispatchEvent=function(n){n.target=this;for(var t,r=e(this.B(n.type));!(t=r()).done;){(0, t.value)(n);}},t.B=function(n){return this.k.has(n)||this.k.set(n,new Set),this.k.get(n)},n}());function s(n,t){if(!t)return n&&n.then?n.then(c):Promise.resolve()}
|
|
32
5
|
|
|
33
6
|
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
@@ -227,7 +200,7 @@ class IndexedDbService {
|
|
|
227
200
|
/**
|
|
228
201
|
* The SDK version.
|
|
229
202
|
*/
|
|
230
|
-
const VERSION = '0.
|
|
203
|
+
const VERSION = '0.2.282';
|
|
231
204
|
|
|
232
205
|
class TwintagErrorValue {
|
|
233
206
|
}
|
|
@@ -18501,25 +18474,19 @@ class OfflineDataService {
|
|
|
18501
18474
|
async cacheSDObjects(offlineObjects) {
|
|
18502
18475
|
let objData;
|
|
18503
18476
|
let objectsToCache;
|
|
18504
|
-
if (!this.view) {
|
|
18505
|
-
this.view = new View(this.config.viewId);
|
|
18506
|
-
}
|
|
18507
|
-
const viewId = View$1.getId();
|
|
18508
|
-
const epsilonFileName = this.config.epsilonFileName;
|
|
18509
|
-
const epsilon = new Epsilon(viewId);
|
|
18510
18477
|
if (offlineObjects && offlineObjects !== '*') {
|
|
18511
18478
|
objectsToCache = this.config.offlineObjects.filter((offObj) => offlineObjects.includes(offObj.objectName));
|
|
18512
18479
|
}
|
|
18513
18480
|
else {
|
|
18514
18481
|
objectsToCache = [...this.config.offlineObjects];
|
|
18515
18482
|
}
|
|
18483
|
+
const ep = this.config.epsilonExecutor ? this.config.epsilonExecutor : new Epsilon(this.config.viewId);
|
|
18516
18484
|
for (const obj of objectsToCache) {
|
|
18517
|
-
const requestOptions = {
|
|
18518
|
-
action: 'getSDObject',
|
|
18519
|
-
params: obj,
|
|
18520
|
-
};
|
|
18521
18485
|
try {
|
|
18522
|
-
objData = await
|
|
18486
|
+
objData = await ep.execute(this.config.epsilonFileName, {
|
|
18487
|
+
action: 'getSDObject',
|
|
18488
|
+
input: obj,
|
|
18489
|
+
});
|
|
18523
18490
|
}
|
|
18524
18491
|
catch (e) {
|
|
18525
18492
|
console.log(e);
|
|
@@ -18640,16 +18607,6 @@ const TwintagOfflineSupport$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
|
18640
18607
|
this.setState(navigator.onLine);
|
|
18641
18608
|
}
|
|
18642
18609
|
}
|
|
18643
|
-
async connectedCallback() {
|
|
18644
|
-
// this.dataService = new OfflineDataService(this.config);
|
|
18645
|
-
// (window as any).twintagOfflineSupport = this;
|
|
18646
|
-
// window.addEventListener('offline', this.setOffline);
|
|
18647
|
-
// window.addEventListener('online', this.setOnline);
|
|
18648
|
-
// this.pendingRequests = await DbService.getAll(this.storeName);
|
|
18649
|
-
// this.emitChanges('initialized', null);
|
|
18650
|
-
// this.setState(navigator.onLine);
|
|
18651
|
-
// console.log(this.onLine);
|
|
18652
|
-
}
|
|
18653
18610
|
async componentWillLoad() {
|
|
18654
18611
|
this.dataService = new OfflineDataService(this.config);
|
|
18655
18612
|
window.twintagOfflineSupport = this;
|
|
@@ -18658,11 +18615,8 @@ const TwintagOfflineSupport$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
|
18658
18615
|
this.setState(navigator.onLine);
|
|
18659
18616
|
this.pendingRequests = await IndexedDbService.getAll(OFFLINEREQUESTSTORE);
|
|
18660
18617
|
this.emitChanges('initialized', null);
|
|
18661
|
-
// console.log(this.onLine);
|
|
18662
|
-
// this.loadServiceWorker();
|
|
18663
18618
|
}
|
|
18664
18619
|
componentDidLoad() {
|
|
18665
|
-
// console.log(this.config);
|
|
18666
18620
|
if (this.config &&
|
|
18667
18621
|
this.config.offlineObjects &&
|
|
18668
18622
|
this.config.offlineObjects.length > 0) {
|
|
@@ -18956,4 +18910,4 @@ function defineCustomElement$1() {
|
|
|
18956
18910
|
const TwintagOfflineSupport = TwintagOfflineSupport$1;
|
|
18957
18911
|
const defineCustomElement = defineCustomElement$1;
|
|
18958
18912
|
|
|
18959
|
-
export { TwintagOfflineSupport,
|
|
18913
|
+
export { TwintagOfflineSupport, defineCustomElement };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { i as inIframe } from './utils-c73229be.js';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* An implementation of rfc6749#section-4.1 and rfc7636.
|
|
5
3
|
*/
|
|
@@ -119,6 +117,19 @@ const LinkedIn = {
|
|
|
119
117
|
};
|
|
120
118
|
const LinkedInUserInfoDomain = "https://api.linkedin.com";
|
|
121
119
|
|
|
120
|
+
/**
|
|
121
|
+
* If opened in iframe, then redirect from parent's window as some IDPs block iframes eg linkedin
|
|
122
|
+
* @returns boolean
|
|
123
|
+
*/
|
|
124
|
+
function inIframe() {
|
|
125
|
+
try {
|
|
126
|
+
return window.self !== window.top;
|
|
127
|
+
}
|
|
128
|
+
catch (e) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
122
133
|
class baseAuthService {
|
|
123
134
|
constructor() {
|
|
124
135
|
}
|
|
@@ -809,4 +820,4 @@ class Auth {
|
|
|
809
820
|
}
|
|
810
821
|
}
|
|
811
822
|
|
|
812
|
-
export { Auth as A, AuthConfigTemplate as a };
|
|
823
|
+
export { Auth as A, AuthConfigTemplate as a, inIframe as i };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
1
|
+
import { i as inIframe } from './auth-1c631a9d.js';
|
|
2
|
+
export { A as Auth, a as AuthConfigTemplate } from './auth-1c631a9d.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The view object represents the current active view.
|
|
6
|
+
* A common use is to figure out the QID of the active view, E.g:
|
|
7
|
+
* ```js
|
|
8
|
+
* let viewId = View.getId()
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
class View {
|
|
12
|
+
/**
|
|
13
|
+
* Get view id for current twintag
|
|
14
|
+
* @returns string view id
|
|
15
|
+
*/
|
|
16
|
+
static getId() {
|
|
17
|
+
const url = new URL(window.location.href);
|
|
18
|
+
const path_segments = url.pathname.split('/').filter((x) => x.length > 0);
|
|
19
|
+
const views_segment_idx = path_segments.indexOf('views');
|
|
20
|
+
return path_segments.length > 0
|
|
21
|
+
? inIframe() && views_segment_idx > -1
|
|
22
|
+
? path_segments[views_segment_idx + 1]
|
|
23
|
+
// Assuming the `id` is the first segment and there could be
|
|
24
|
+
// additional segments available. Example: `<base_url>/<view_id>/onboard`
|
|
25
|
+
: path_segments[0]
|
|
26
|
+
: '';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { View };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent } from './index-174285a2.js';
|
|
2
|
-
import { V as View$1 } from './view-a251c1a9.js';
|
|
3
2
|
import { c as createCommonjsModule, g as getAugmentedNamespace } from './_commonjsHelpers-27f122dd.js';
|
|
4
|
-
import './utils-c73229be.js';
|
|
5
3
|
|
|
6
4
|
try{self["workbox:window:5.1.4"]&&_();}catch(n){}function n(n,t){return new Promise((function(r){var e=new MessageChannel;e.port1.onmessage=function(n){r(n.data);},n.postMessage(t,[e.port2]);}))}function t(n,t){for(var r=0;r<t.length;r++){var e=t[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e);}}function r(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,e=new Array(t);r<t;r++)e[r]=n[r];return e}function e(n,t){var e;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(e=function(n,t){if(n){if("string"==typeof n)return r(n,t);var e=Object.prototype.toString.call(n).slice(8,-1);return "Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(n):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?r(n,t):void 0}}(n))||t&&n&&"number"==typeof n.length){e&&(n=e);var i=0;return function(){return i>=n.length?{done:!0}:{done:!1,value:n[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return (e=n[Symbol.iterator]()).next.bind(e)}try{self["workbox:core:5.1.4"]&&_();}catch(n){}var i$1=function(){var n=this;this.promise=new Promise((function(t,r){n.resolve=t,n.reject=r;}));};function o(n,t){var r=location.href;return new URL(n,r).href===new URL(t,r).href}var u=function(n,t){this.type=n,Object.assign(this,t);};function a(n,t,r){return r?t?t(n):n:(n&&n.then||(n=Promise.resolve(n)),t?n.then(t):n)}function c(){}var f=function(r){var e,c;function f(n,t){var e,c;return void 0===t&&(t={}),(e=r.call(this)||this).t={},e.i=0,e.o=new i$1,e.u=new i$1,e.s=new i$1,e.v=0,e.h=new Set,e.l=function(){var n=e.m,t=n.installing;e.i>0||!o(t.scriptURL,e.g)||performance.now()>e.v+6e4?(e.p=t,n.removeEventListener("updatefound",e.l)):(e.P=t,e.h.add(t),e.o.resolve(t)),++e.i,t.addEventListener("statechange",e.S);},e.S=function(n){var t=e.m,r=n.target,i=r.state,o=r===e.p,a=o?"external":"",c={sw:r,originalEvent:n};!o&&e.j&&(c.isUpdate=!0),e.dispatchEvent(new u(a+i,c)),"installed"===i?e.A=self.setTimeout((function(){"installed"===i&&t.waiting===r&&e.dispatchEvent(new u(a+"waiting",c));}),200):"activating"===i&&(clearTimeout(e.A),o||e.u.resolve(r));},e.O=function(n){var t=e.P;t===navigator.serviceWorker.controller&&(e.dispatchEvent(new u("controlling",{sw:t,originalEvent:n,isUpdate:e.j})),e.s.resolve(t));},e.U=(c=function(n){var t=n.data,r=n.source;return a(e.getSW(),(function(){e.h.has(r)&&e.dispatchEvent(new u("message",{data:t,sw:r,originalEvent:n}));}))},function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];try{return Promise.resolve(c.apply(this,n))}catch(n){return Promise.reject(n)}}),e.g=n,e.t=t,navigator.serviceWorker.addEventListener("message",e.U),e}c=r,(e=f).prototype=Object.create(c.prototype),e.prototype.constructor=e,e.__proto__=c;var v,h,m=f.prototype;return m.register=function(n){var t=(void 0===n?{}:n).immediate,r=void 0!==t&&t;try{var e=this;return function(n,t){var r=n();if(r&&r.then)return r.then(t);return t(r)}((function(){if(!r&&"complete"!==document.readyState)return s(new Promise((function(n){return window.addEventListener("load",n)})))}),(function(){return e.j=Boolean(navigator.serviceWorker.controller),e.I=e.M(),a(e.R(),(function(n){e.m=n,e.I&&(e.P=e.I,e.u.resolve(e.I),e.s.resolve(e.I),e.I.addEventListener("statechange",e.S,{once:!0}));var t=e.m.waiting;return t&&o(t.scriptURL,e.g)&&(e.P=t,Promise.resolve().then((function(){e.dispatchEvent(new u("waiting",{sw:t,wasWaitingBeforeRegister:!0}));})).then((function(){}))),e.P&&(e.o.resolve(e.P),e.h.add(e.P)),e.m.addEventListener("updatefound",e.l),navigator.serviceWorker.addEventListener("controllerchange",e.O,{once:!0}),e.m}))}))}catch(n){return Promise.reject(n)}},m.update=function(){try{return this.m?s(this.m.update()):void 0}catch(n){return Promise.reject(n)}},m.getSW=function(){try{return void 0!==this.P?this.P:this.o.promise}catch(n){return Promise.reject(n)}},m.messageSW=function(t){try{return a(this.getSW(),(function(r){return n(r,t)}))}catch(n){return Promise.reject(n)}},m.M=function(){var n=navigator.serviceWorker.controller;return n&&o(n.scriptURL,this.g)?n:void 0},m.R=function(){try{var n=this;return function(n,t){try{var r=n();}catch(n){return t(n)}if(r&&r.then)return r.then(void 0,t);return r}((function(){return a(navigator.serviceWorker.register(n.g,n.t),(function(t){return n.v=performance.now(),t}))}),(function(n){throw n}))}catch(n){return Promise.reject(n)}},v=f,(h=[{key:"active",get:function(){return this.u.promise}},{key:"controlling",get:function(){return this.s.promise}}])&&t(v.prototype,h),f}(function(){function n(){this.k=new Map;}var t=n.prototype;return t.addEventListener=function(n,t){this.B(n).add(t);},t.removeEventListener=function(n,t){this.B(n).delete(t);},t.dispatchEvent=function(n){n.target=this;for(var t,r=e(this.B(n.type));!(t=r()).done;){(0, t.value)(n);}},t.B=function(n){return this.k.has(n)||this.k.set(n,new Set),this.k.get(n)},n}());function s(n,t){if(!t)return n&&n.then?n.then(c):Promise.resolve()}
|
|
7
5
|
|
|
@@ -202,7 +200,7 @@ class IndexedDbService {
|
|
|
202
200
|
/**
|
|
203
201
|
* The SDK version.
|
|
204
202
|
*/
|
|
205
|
-
const VERSION = '0.
|
|
203
|
+
const VERSION = '0.2.282';
|
|
206
204
|
|
|
207
205
|
class TwintagErrorValue {
|
|
208
206
|
}
|
|
@@ -18476,25 +18474,19 @@ class OfflineDataService {
|
|
|
18476
18474
|
async cacheSDObjects(offlineObjects) {
|
|
18477
18475
|
let objData;
|
|
18478
18476
|
let objectsToCache;
|
|
18479
|
-
if (!this.view) {
|
|
18480
|
-
this.view = new View(this.config.viewId);
|
|
18481
|
-
}
|
|
18482
|
-
const viewId = View$1.getId();
|
|
18483
|
-
const epsilonFileName = this.config.epsilonFileName;
|
|
18484
|
-
const epsilon = new Epsilon(viewId);
|
|
18485
18477
|
if (offlineObjects && offlineObjects !== '*') {
|
|
18486
18478
|
objectsToCache = this.config.offlineObjects.filter((offObj) => offlineObjects.includes(offObj.objectName));
|
|
18487
18479
|
}
|
|
18488
18480
|
else {
|
|
18489
18481
|
objectsToCache = [...this.config.offlineObjects];
|
|
18490
18482
|
}
|
|
18483
|
+
const ep = this.config.epsilonExecutor ? this.config.epsilonExecutor : new Epsilon(this.config.viewId);
|
|
18491
18484
|
for (const obj of objectsToCache) {
|
|
18492
|
-
const requestOptions = {
|
|
18493
|
-
action: 'getSDObject',
|
|
18494
|
-
params: obj,
|
|
18495
|
-
};
|
|
18496
18485
|
try {
|
|
18497
|
-
objData = await
|
|
18486
|
+
objData = await ep.execute(this.config.epsilonFileName, {
|
|
18487
|
+
action: 'getSDObject',
|
|
18488
|
+
input: obj,
|
|
18489
|
+
});
|
|
18498
18490
|
}
|
|
18499
18491
|
catch (e) {
|
|
18500
18492
|
console.log(e);
|
|
@@ -18613,16 +18605,6 @@ const TwintagOfflineSupport = class {
|
|
|
18613
18605
|
this.setState(navigator.onLine);
|
|
18614
18606
|
}
|
|
18615
18607
|
}
|
|
18616
|
-
async connectedCallback() {
|
|
18617
|
-
// this.dataService = new OfflineDataService(this.config);
|
|
18618
|
-
// (window as any).twintagOfflineSupport = this;
|
|
18619
|
-
// window.addEventListener('offline', this.setOffline);
|
|
18620
|
-
// window.addEventListener('online', this.setOnline);
|
|
18621
|
-
// this.pendingRequests = await DbService.getAll(this.storeName);
|
|
18622
|
-
// this.emitChanges('initialized', null);
|
|
18623
|
-
// this.setState(navigator.onLine);
|
|
18624
|
-
// console.log(this.onLine);
|
|
18625
|
-
}
|
|
18626
18608
|
async componentWillLoad() {
|
|
18627
18609
|
this.dataService = new OfflineDataService(this.config);
|
|
18628
18610
|
window.twintagOfflineSupport = this;
|
|
@@ -18631,11 +18613,8 @@ const TwintagOfflineSupport = class {
|
|
|
18631
18613
|
this.setState(navigator.onLine);
|
|
18632
18614
|
this.pendingRequests = await IndexedDbService.getAll(OFFLINEREQUESTSTORE);
|
|
18633
18615
|
this.emitChanges('initialized', null);
|
|
18634
|
-
// console.log(this.onLine);
|
|
18635
|
-
// this.loadServiceWorker();
|
|
18636
18616
|
}
|
|
18637
18617
|
componentDidLoad() {
|
|
18638
|
-
// console.log(this.config);
|
|
18639
18618
|
if (this.config &&
|
|
18640
18619
|
this.config.offlineObjects &&
|
|
18641
18620
|
this.config.offlineObjects.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{i as e}from"./p-08e1ea24.js";export{A as Auth,a as AuthConfigTemplate}from"./p-08e1ea24.js";class t{static getId(){const t=new URL(window.location.href).pathname.split("/").filter((e=>e.length>0)),s=t.indexOf("views");return t.length>0?e()&&s>-1?t[s+1]:t[0]:""}}export{t as View}
|