@etsoo/appscript 1.5.34 → 1.5.36
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/lib/cjs/app/CoreApp.d.ts +11 -0
- package/lib/cjs/app/CoreApp.js +32 -0
- package/lib/cjs/app/IApp.d.ts +10 -1
- package/lib/cjs/app/IApp.js +2 -1
- package/lib/mjs/app/CoreApp.d.ts +11 -0
- package/lib/mjs/app/CoreApp.js +32 -0
- package/lib/mjs/app/IApp.d.ts +10 -1
- package/lib/mjs/app/IApp.js +2 -1
- package/package.json +1 -1
- package/src/app/CoreApp.ts +36 -0
- package/src/app/IApp.ts +13 -1
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -129,6 +129,11 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
129
129
|
*/
|
|
130
130
|
get cachedUrl(): string | undefined | null;
|
|
131
131
|
set cachedUrl(value: string | undefined | null);
|
|
132
|
+
private _embedded;
|
|
133
|
+
/**
|
|
134
|
+
* Is embedded
|
|
135
|
+
*/
|
|
136
|
+
get embedded(): boolean;
|
|
132
137
|
private _isTryingLogin;
|
|
133
138
|
/**
|
|
134
139
|
* Last called with token refresh
|
|
@@ -635,6 +640,12 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
635
640
|
* @param showLoading Show loading bar or not during call
|
|
636
641
|
*/
|
|
637
642
|
tryLogin(_showLoading?: boolean): Promise<boolean>;
|
|
643
|
+
/**
|
|
644
|
+
* Update embedded status
|
|
645
|
+
* @param embedded New embedded status
|
|
646
|
+
* @param isWeb Is web or not
|
|
647
|
+
*/
|
|
648
|
+
updateEmbedded(embedded: boolean | undefined | null, isWeb?: boolean): void;
|
|
638
649
|
/**
|
|
639
650
|
* User login
|
|
640
651
|
* @param user User data
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -96,6 +96,12 @@ class CoreApp {
|
|
|
96
96
|
set cachedUrl(value) {
|
|
97
97
|
this.storage.setData(this.fields.cachedUrl, value);
|
|
98
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Is embedded
|
|
101
|
+
*/
|
|
102
|
+
get embedded() {
|
|
103
|
+
return this._embedded;
|
|
104
|
+
}
|
|
99
105
|
/**
|
|
100
106
|
* Get persisted fields
|
|
101
107
|
*/
|
|
@@ -123,6 +129,7 @@ class CoreApp {
|
|
|
123
129
|
this.pendings = [];
|
|
124
130
|
this._authorized = false;
|
|
125
131
|
this._isReady = false;
|
|
132
|
+
this._embedded = false;
|
|
126
133
|
this._isTryingLogin = false;
|
|
127
134
|
/**
|
|
128
135
|
* Last called with token refresh
|
|
@@ -1589,6 +1596,31 @@ class CoreApp {
|
|
|
1589
1596
|
this._isTryingLogin = true;
|
|
1590
1597
|
return true;
|
|
1591
1598
|
}
|
|
1599
|
+
/**
|
|
1600
|
+
* Update embedded status
|
|
1601
|
+
* @param embedded New embedded status
|
|
1602
|
+
* @param isWeb Is web or not
|
|
1603
|
+
*/
|
|
1604
|
+
updateEmbedded(embedded, isWeb) {
|
|
1605
|
+
// Check current session when it's undefined
|
|
1606
|
+
if (embedded == null) {
|
|
1607
|
+
embedded = this.storage.getData(this.fields.embedded);
|
|
1608
|
+
if (embedded == null)
|
|
1609
|
+
return;
|
|
1610
|
+
}
|
|
1611
|
+
// Is web way?
|
|
1612
|
+
// Pass the true embedded status from parent to child (Both conditions are true)
|
|
1613
|
+
if (isWeb && embedded && globalThis.self !== globalThis.parent) {
|
|
1614
|
+
embedded = false;
|
|
1615
|
+
}
|
|
1616
|
+
// Ignore the same value
|
|
1617
|
+
if (embedded === this._embedded)
|
|
1618
|
+
return;
|
|
1619
|
+
// Save the embedded status
|
|
1620
|
+
this.storage.setData(this.fields.embedded, embedded);
|
|
1621
|
+
// Update the embedded status
|
|
1622
|
+
this._embedded = embedded;
|
|
1623
|
+
}
|
|
1592
1624
|
/**
|
|
1593
1625
|
* User login
|
|
1594
1626
|
* @param user User data
|
package/lib/cjs/app/IApp.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export interface RefreshTokenProps {
|
|
|
56
56
|
/**
|
|
57
57
|
* App fields
|
|
58
58
|
*/
|
|
59
|
-
export declare const appFields: readonly ["headerToken", "serversideDeviceId", "deviceId", "devices", "devicePassphrase", "cachedUrl"];
|
|
59
|
+
export declare const appFields: readonly ["headerToken", "serversideDeviceId", "deviceId", "devices", "devicePassphrase", "cachedUrl", "embedded"];
|
|
60
60
|
/**
|
|
61
61
|
* Basic type template
|
|
62
62
|
*/
|
|
@@ -131,6 +131,10 @@ export interface IApp {
|
|
|
131
131
|
* Is debug mode
|
|
132
132
|
*/
|
|
133
133
|
readonly debug: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Is embedded mode
|
|
136
|
+
*/
|
|
137
|
+
readonly embedded: boolean;
|
|
134
138
|
/**
|
|
135
139
|
* Cached URL
|
|
136
140
|
*/
|
|
@@ -547,6 +551,11 @@ export interface IApp {
|
|
|
547
551
|
* @param seconds Access token expires in seconds
|
|
548
552
|
*/
|
|
549
553
|
updateApi(name: string, token: string | undefined, seconds: number): void;
|
|
554
|
+
/**
|
|
555
|
+
* Update embedded status
|
|
556
|
+
* @param embedded New embedded status
|
|
557
|
+
*/
|
|
558
|
+
updateEmbedded(embedded?: boolean): void;
|
|
550
559
|
/**
|
|
551
560
|
* User login
|
|
552
561
|
* @param user User data
|
package/lib/cjs/app/IApp.js
CHANGED
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -129,6 +129,11 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
129
129
|
*/
|
|
130
130
|
get cachedUrl(): string | undefined | null;
|
|
131
131
|
set cachedUrl(value: string | undefined | null);
|
|
132
|
+
private _embedded;
|
|
133
|
+
/**
|
|
134
|
+
* Is embedded
|
|
135
|
+
*/
|
|
136
|
+
get embedded(): boolean;
|
|
132
137
|
private _isTryingLogin;
|
|
133
138
|
/**
|
|
134
139
|
* Last called with token refresh
|
|
@@ -635,6 +640,12 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
635
640
|
* @param showLoading Show loading bar or not during call
|
|
636
641
|
*/
|
|
637
642
|
tryLogin(_showLoading?: boolean): Promise<boolean>;
|
|
643
|
+
/**
|
|
644
|
+
* Update embedded status
|
|
645
|
+
* @param embedded New embedded status
|
|
646
|
+
* @param isWeb Is web or not
|
|
647
|
+
*/
|
|
648
|
+
updateEmbedded(embedded: boolean | undefined | null, isWeb?: boolean): void;
|
|
638
649
|
/**
|
|
639
650
|
* User login
|
|
640
651
|
* @param user User data
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -93,6 +93,12 @@ export class CoreApp {
|
|
|
93
93
|
set cachedUrl(value) {
|
|
94
94
|
this.storage.setData(this.fields.cachedUrl, value);
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Is embedded
|
|
98
|
+
*/
|
|
99
|
+
get embedded() {
|
|
100
|
+
return this._embedded;
|
|
101
|
+
}
|
|
96
102
|
/**
|
|
97
103
|
* Get persisted fields
|
|
98
104
|
*/
|
|
@@ -120,6 +126,7 @@ export class CoreApp {
|
|
|
120
126
|
this.pendings = [];
|
|
121
127
|
this._authorized = false;
|
|
122
128
|
this._isReady = false;
|
|
129
|
+
this._embedded = false;
|
|
123
130
|
this._isTryingLogin = false;
|
|
124
131
|
/**
|
|
125
132
|
* Last called with token refresh
|
|
@@ -1586,6 +1593,31 @@ export class CoreApp {
|
|
|
1586
1593
|
this._isTryingLogin = true;
|
|
1587
1594
|
return true;
|
|
1588
1595
|
}
|
|
1596
|
+
/**
|
|
1597
|
+
* Update embedded status
|
|
1598
|
+
* @param embedded New embedded status
|
|
1599
|
+
* @param isWeb Is web or not
|
|
1600
|
+
*/
|
|
1601
|
+
updateEmbedded(embedded, isWeb) {
|
|
1602
|
+
// Check current session when it's undefined
|
|
1603
|
+
if (embedded == null) {
|
|
1604
|
+
embedded = this.storage.getData(this.fields.embedded);
|
|
1605
|
+
if (embedded == null)
|
|
1606
|
+
return;
|
|
1607
|
+
}
|
|
1608
|
+
// Is web way?
|
|
1609
|
+
// Pass the true embedded status from parent to child (Both conditions are true)
|
|
1610
|
+
if (isWeb && embedded && globalThis.self !== globalThis.parent) {
|
|
1611
|
+
embedded = false;
|
|
1612
|
+
}
|
|
1613
|
+
// Ignore the same value
|
|
1614
|
+
if (embedded === this._embedded)
|
|
1615
|
+
return;
|
|
1616
|
+
// Save the embedded status
|
|
1617
|
+
this.storage.setData(this.fields.embedded, embedded);
|
|
1618
|
+
// Update the embedded status
|
|
1619
|
+
this._embedded = embedded;
|
|
1620
|
+
}
|
|
1589
1621
|
/**
|
|
1590
1622
|
* User login
|
|
1591
1623
|
* @param user User data
|
package/lib/mjs/app/IApp.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export interface RefreshTokenProps {
|
|
|
56
56
|
/**
|
|
57
57
|
* App fields
|
|
58
58
|
*/
|
|
59
|
-
export declare const appFields: readonly ["headerToken", "serversideDeviceId", "deviceId", "devices", "devicePassphrase", "cachedUrl"];
|
|
59
|
+
export declare const appFields: readonly ["headerToken", "serversideDeviceId", "deviceId", "devices", "devicePassphrase", "cachedUrl", "embedded"];
|
|
60
60
|
/**
|
|
61
61
|
* Basic type template
|
|
62
62
|
*/
|
|
@@ -131,6 +131,10 @@ export interface IApp {
|
|
|
131
131
|
* Is debug mode
|
|
132
132
|
*/
|
|
133
133
|
readonly debug: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Is embedded mode
|
|
136
|
+
*/
|
|
137
|
+
readonly embedded: boolean;
|
|
134
138
|
/**
|
|
135
139
|
* Cached URL
|
|
136
140
|
*/
|
|
@@ -547,6 +551,11 @@ export interface IApp {
|
|
|
547
551
|
* @param seconds Access token expires in seconds
|
|
548
552
|
*/
|
|
549
553
|
updateApi(name: string, token: string | undefined, seconds: number): void;
|
|
554
|
+
/**
|
|
555
|
+
* Update embedded status
|
|
556
|
+
* @param embedded New embedded status
|
|
557
|
+
*/
|
|
558
|
+
updateEmbedded(embedded?: boolean): void;
|
|
550
559
|
/**
|
|
551
560
|
* User login
|
|
552
561
|
* @param user User data
|
package/lib/mjs/app/IApp.js
CHANGED
package/package.json
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -248,6 +248,14 @@ export abstract class CoreApp<
|
|
|
248
248
|
this.storage.setData(this.fields.cachedUrl, value);
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
private _embedded: boolean = false;
|
|
252
|
+
/**
|
|
253
|
+
* Is embedded
|
|
254
|
+
*/
|
|
255
|
+
get embedded() {
|
|
256
|
+
return this._embedded;
|
|
257
|
+
}
|
|
258
|
+
|
|
251
259
|
private _isTryingLogin = false;
|
|
252
260
|
|
|
253
261
|
/**
|
|
@@ -2176,6 +2184,34 @@ export abstract class CoreApp<
|
|
|
2176
2184
|
return true;
|
|
2177
2185
|
}
|
|
2178
2186
|
|
|
2187
|
+
/**
|
|
2188
|
+
* Update embedded status
|
|
2189
|
+
* @param embedded New embedded status
|
|
2190
|
+
* @param isWeb Is web or not
|
|
2191
|
+
*/
|
|
2192
|
+
updateEmbedded(embedded: boolean | undefined | null, isWeb?: boolean) {
|
|
2193
|
+
// Check current session when it's undefined
|
|
2194
|
+
if (embedded == null) {
|
|
2195
|
+
embedded = this.storage.getData<boolean>(this.fields.embedded);
|
|
2196
|
+
if (embedded == null) return;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
// Is web way?
|
|
2200
|
+
// Pass the true embedded status from parent to child (Both conditions are true)
|
|
2201
|
+
if (isWeb && embedded && globalThis.self !== globalThis.parent) {
|
|
2202
|
+
embedded = false;
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
// Ignore the same value
|
|
2206
|
+
if (embedded === this._embedded) return;
|
|
2207
|
+
|
|
2208
|
+
// Save the embedded status
|
|
2209
|
+
this.storage.setData(this.fields.embedded, embedded);
|
|
2210
|
+
|
|
2211
|
+
// Update the embedded status
|
|
2212
|
+
this._embedded = embedded;
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2179
2215
|
/**
|
|
2180
2216
|
* User login
|
|
2181
2217
|
* @param user User data
|
package/src/app/IApp.ts
CHANGED
|
@@ -91,7 +91,8 @@ export const appFields = [
|
|
|
91
91
|
'deviceId',
|
|
92
92
|
'devices',
|
|
93
93
|
'devicePassphrase',
|
|
94
|
-
'cachedUrl'
|
|
94
|
+
'cachedUrl',
|
|
95
|
+
'embedded'
|
|
95
96
|
] as const;
|
|
96
97
|
|
|
97
98
|
/**
|
|
@@ -183,6 +184,11 @@ export interface IApp {
|
|
|
183
184
|
*/
|
|
184
185
|
readonly debug: boolean;
|
|
185
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Is embedded mode
|
|
189
|
+
*/
|
|
190
|
+
readonly embedded: boolean;
|
|
191
|
+
|
|
186
192
|
/**
|
|
187
193
|
* Cached URL
|
|
188
194
|
*/
|
|
@@ -745,6 +751,12 @@ export interface IApp {
|
|
|
745
751
|
*/
|
|
746
752
|
updateApi(name: string, token: string | undefined, seconds: number): void;
|
|
747
753
|
|
|
754
|
+
/**
|
|
755
|
+
* Update embedded status
|
|
756
|
+
* @param embedded New embedded status
|
|
757
|
+
*/
|
|
758
|
+
updateEmbedded(embedded?: boolean): void;
|
|
759
|
+
|
|
748
760
|
/**
|
|
749
761
|
* User login
|
|
750
762
|
* @param user User data
|