@twintag/twintag-core 0.2.281 → 0.2.282-feat-twin-ai-sdk-87fe288c8c85192aaeae15965cb2a27e6dfd6242
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-ocr-scanner.cjs.entry.js +13 -12
- 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-ocr-scanner.js +13 -12
- 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-ocr-scanner.entry.js +13 -12
- 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-45c05048.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/project.d.ts +9 -0
- 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/project.js +28 -0
- 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
|
|
|
@@ -1005,7 +1005,13 @@ var OEM = {
|
|
|
1005
1005
|
DEFAULT: 3,
|
|
1006
1006
|
};
|
|
1007
1007
|
|
|
1008
|
-
const
|
|
1008
|
+
const _args = [
|
|
1009
|
+
[
|
|
1010
|
+
"tesseract.js@5.1.0",
|
|
1011
|
+
"/drone/src"
|
|
1012
|
+
]
|
|
1013
|
+
];
|
|
1014
|
+
const _from = "tesseract.js@5.1.0";
|
|
1009
1015
|
const _id = "tesseract.js@5.1.0";
|
|
1010
1016
|
const _inBundle = false;
|
|
1011
1017
|
const _integrity = "sha512-2fH9pqWdS2C6ue/3OoGg91Wtv7Rt/1atYu/g0Q1SGFrowEW/kIBkG361hLienHsWe4KWEjxOJBrCQYpIBWG6WA==";
|
|
@@ -1013,21 +1019,20 @@ const _location = "/tesseract.js";
|
|
|
1013
1019
|
const _phantomChildren = {
|
|
1014
1020
|
};
|
|
1015
1021
|
const _requested = {
|
|
1016
|
-
type: "
|
|
1022
|
+
type: "version",
|
|
1017
1023
|
registry: true,
|
|
1018
|
-
raw: "tesseract.js
|
|
1024
|
+
raw: "tesseract.js@5.1.0",
|
|
1019
1025
|
name: "tesseract.js",
|
|
1020
1026
|
escapedName: "tesseract.js",
|
|
1021
|
-
rawSpec: "
|
|
1027
|
+
rawSpec: "5.1.0",
|
|
1022
1028
|
saveSpec: null,
|
|
1023
|
-
fetchSpec: "
|
|
1029
|
+
fetchSpec: "5.1.0"
|
|
1024
1030
|
};
|
|
1025
1031
|
const _requiredBy = [
|
|
1026
1032
|
"/"
|
|
1027
1033
|
];
|
|
1028
1034
|
const _resolved = "https://registry.npmjs.org/tesseract.js/-/tesseract.js-5.1.0.tgz";
|
|
1029
|
-
const
|
|
1030
|
-
const _spec = "tesseract.js@^5.1.0";
|
|
1035
|
+
const _spec = "5.1.0";
|
|
1031
1036
|
const _where = "/drone/src";
|
|
1032
1037
|
const author = "";
|
|
1033
1038
|
const browser$1 = {
|
|
@@ -1036,7 +1041,6 @@ const browser$1 = {
|
|
|
1036
1041
|
const bugs = {
|
|
1037
1042
|
url: "https://github.com/naptha/tesseract.js/issues"
|
|
1038
1043
|
};
|
|
1039
|
-
const bundleDependencies = false;
|
|
1040
1044
|
const collective = {
|
|
1041
1045
|
type: "opencollective",
|
|
1042
1046
|
url: "https://opencollective.com/tesseractjs"
|
|
@@ -1058,7 +1062,6 @@ const dependencies = {
|
|
|
1058
1062
|
"wasm-feature-detect": "^1.2.11",
|
|
1059
1063
|
zlibjs: "^0.3.1"
|
|
1060
1064
|
};
|
|
1061
|
-
const deprecated = false;
|
|
1062
1065
|
const description = "Pure Javascript Multilingual OCR";
|
|
1063
1066
|
const devDependencies = {
|
|
1064
1067
|
"@babel/core": "^7.21.4",
|
|
@@ -1123,6 +1126,7 @@ const types = "src/index.d.ts";
|
|
|
1123
1126
|
const unpkg = "dist/tesseract.min.js";
|
|
1124
1127
|
const version$1 = "5.1.0";
|
|
1125
1128
|
const require$$0 = {
|
|
1129
|
+
_args: _args,
|
|
1126
1130
|
_from: _from,
|
|
1127
1131
|
_id: _id,
|
|
1128
1132
|
_inBundle: _inBundle,
|
|
@@ -1132,17 +1136,14 @@ const require$$0 = {
|
|
|
1132
1136
|
_requested: _requested,
|
|
1133
1137
|
_requiredBy: _requiredBy,
|
|
1134
1138
|
_resolved: _resolved,
|
|
1135
|
-
_shasum: _shasum,
|
|
1136
1139
|
_spec: _spec,
|
|
1137
1140
|
_where: _where,
|
|
1138
1141
|
author: author,
|
|
1139
1142
|
browser: browser$1,
|
|
1140
1143
|
bugs: bugs,
|
|
1141
|
-
bundleDependencies: bundleDependencies,
|
|
1142
1144
|
collective: collective,
|
|
1143
1145
|
contributors: contributors,
|
|
1144
1146
|
dependencies: dependencies,
|
|
1145
|
-
deprecated: deprecated,
|
|
1146
1147
|
description: description,
|
|
1147
1148
|
devDependencies: devDependencies,
|
|
1148
1149
|
homepage: homepage,
|
|
@@ -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-feat-twin-ai-sdk-87fe288c8c85192aaeae15965cb2a27e6dfd6242';
|
|
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 };
|
|
@@ -1001,7 +1001,13 @@ var OEM = {
|
|
|
1001
1001
|
DEFAULT: 3,
|
|
1002
1002
|
};
|
|
1003
1003
|
|
|
1004
|
-
const
|
|
1004
|
+
const _args = [
|
|
1005
|
+
[
|
|
1006
|
+
"tesseract.js@5.1.0",
|
|
1007
|
+
"/drone/src"
|
|
1008
|
+
]
|
|
1009
|
+
];
|
|
1010
|
+
const _from = "tesseract.js@5.1.0";
|
|
1005
1011
|
const _id = "tesseract.js@5.1.0";
|
|
1006
1012
|
const _inBundle = false;
|
|
1007
1013
|
const _integrity = "sha512-2fH9pqWdS2C6ue/3OoGg91Wtv7Rt/1atYu/g0Q1SGFrowEW/kIBkG361hLienHsWe4KWEjxOJBrCQYpIBWG6WA==";
|
|
@@ -1009,21 +1015,20 @@ const _location = "/tesseract.js";
|
|
|
1009
1015
|
const _phantomChildren = {
|
|
1010
1016
|
};
|
|
1011
1017
|
const _requested = {
|
|
1012
|
-
type: "
|
|
1018
|
+
type: "version",
|
|
1013
1019
|
registry: true,
|
|
1014
|
-
raw: "tesseract.js
|
|
1020
|
+
raw: "tesseract.js@5.1.0",
|
|
1015
1021
|
name: "tesseract.js",
|
|
1016
1022
|
escapedName: "tesseract.js",
|
|
1017
|
-
rawSpec: "
|
|
1023
|
+
rawSpec: "5.1.0",
|
|
1018
1024
|
saveSpec: null,
|
|
1019
|
-
fetchSpec: "
|
|
1025
|
+
fetchSpec: "5.1.0"
|
|
1020
1026
|
};
|
|
1021
1027
|
const _requiredBy = [
|
|
1022
1028
|
"/"
|
|
1023
1029
|
];
|
|
1024
1030
|
const _resolved = "https://registry.npmjs.org/tesseract.js/-/tesseract.js-5.1.0.tgz";
|
|
1025
|
-
const
|
|
1026
|
-
const _spec = "tesseract.js@^5.1.0";
|
|
1031
|
+
const _spec = "5.1.0";
|
|
1027
1032
|
const _where = "/drone/src";
|
|
1028
1033
|
const author = "";
|
|
1029
1034
|
const browser$1 = {
|
|
@@ -1032,7 +1037,6 @@ const browser$1 = {
|
|
|
1032
1037
|
const bugs = {
|
|
1033
1038
|
url: "https://github.com/naptha/tesseract.js/issues"
|
|
1034
1039
|
};
|
|
1035
|
-
const bundleDependencies = false;
|
|
1036
1040
|
const collective = {
|
|
1037
1041
|
type: "opencollective",
|
|
1038
1042
|
url: "https://opencollective.com/tesseractjs"
|
|
@@ -1054,7 +1058,6 @@ const dependencies = {
|
|
|
1054
1058
|
"wasm-feature-detect": "^1.2.11",
|
|
1055
1059
|
zlibjs: "^0.3.1"
|
|
1056
1060
|
};
|
|
1057
|
-
const deprecated = false;
|
|
1058
1061
|
const description = "Pure Javascript Multilingual OCR";
|
|
1059
1062
|
const devDependencies = {
|
|
1060
1063
|
"@babel/core": "^7.21.4",
|
|
@@ -1119,6 +1122,7 @@ const types = "src/index.d.ts";
|
|
|
1119
1122
|
const unpkg = "dist/tesseract.min.js";
|
|
1120
1123
|
const version$1 = "5.1.0";
|
|
1121
1124
|
const require$$0 = {
|
|
1125
|
+
_args: _args,
|
|
1122
1126
|
_from: _from,
|
|
1123
1127
|
_id: _id,
|
|
1124
1128
|
_inBundle: _inBundle,
|
|
@@ -1128,17 +1132,14 @@ const require$$0 = {
|
|
|
1128
1132
|
_requested: _requested,
|
|
1129
1133
|
_requiredBy: _requiredBy,
|
|
1130
1134
|
_resolved: _resolved,
|
|
1131
|
-
_shasum: _shasum,
|
|
1132
1135
|
_spec: _spec,
|
|
1133
1136
|
_where: _where,
|
|
1134
1137
|
author: author,
|
|
1135
1138
|
browser: browser$1,
|
|
1136
1139
|
bugs: bugs,
|
|
1137
|
-
bundleDependencies: bundleDependencies,
|
|
1138
1140
|
collective: collective,
|
|
1139
1141
|
contributors: contributors,
|
|
1140
1142
|
dependencies: dependencies,
|
|
1141
|
-
deprecated: deprecated,
|
|
1142
1143
|
description: description,
|
|
1143
1144
|
devDependencies: devDependencies,
|
|
1144
1145
|
homepage: homepage,
|
|
@@ -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-feat-twin-ai-sdk-87fe288c8c85192aaeae15965cb2a27e6dfd6242';
|
|
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 };
|