starti.app 1.3.15 → 1.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,16 +16,11 @@ Add the package to your project in one of two ways:
16
16
 
17
17
  1) Add the package using npm:
18
18
  ```
19
- npm install starti.app
19
+ npm install --save-dev starti.app
20
20
  ```
21
21
 
22
- 2) Add the following to your HTML file:
22
+ 2) This only includes the types for the package. The package itself is loaded from a CDN. Contact starti.app, to get your package loaded on the CDN. Then you can add the following script tag to your head tag:
23
23
 
24
24
  ```
25
- <script
26
- crossorigin
27
- src="https://unpkg.com/starti.app@1.0.12/umd/main.js">
28
- </script>
25
+ <script src="https://cdn.starti.app/c/${YOUR_BRAND}/main.js"></script>
29
26
  ```
30
-
31
- Remember to update the version number (set to 1.0.12 above) to the latest version.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "starti.app",
3
- "version": "1.3.15",
3
+ "version": "1.3.17",
4
4
  "description": "Use this package for easy communication with the starti.app API.",
5
- "main": "",
5
+ "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
8
  "/dist",
@@ -26,14 +26,14 @@
26
26
  "webpack-dev-server": "^4.15.1"
27
27
  },
28
28
  "scripts": {
29
- "build": "tsc && webpack --mode=production --node-env=production",
29
+ "build": "tsc --emitDeclarationOnly true",
30
30
  "dev": "webpack-dev-server --config webpack.config.js",
31
31
  "build:dev": "webpack --mode=development",
32
32
  "build:prod": "webpack --mode=production --node-env=production",
33
33
  "watch": "webpack --watch",
34
34
  "prerelease": "npm version prerelease --preid=alpha",
35
35
  "test": "jest",
36
- "publish:cdn": "npm run build && node ./ci/publish_to_cdn.js"
36
+ "publish:cdn": "tsc && webpack --mode=production --node-env=production && node ./ci/publish_to_cdn.js"
37
37
  },
38
38
  "dependencies": {
39
39
  "mustache": "^4.2.0",
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EventTargetWithType = void 0;
4
- class EventTargetWithType extends EventTarget {
5
- addEventListener(type, callback, options) {
6
- super.addEventListener(type, callback, options);
7
- }
8
- removeEventListener(type, callback, options) {
9
- super.removeEventListener(type, callback, options);
10
- }
11
- }
12
- exports.EventTargetWithType = EventTargetWithType;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/dist/app.js DELETED
@@ -1,222 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.App = void 0;
4
- const EventHandlerWithTypes_1 = require("./@types/EventHandlerWithTypes");
5
- const getIntegration_1 = require("./getIntegration");
6
- class AppClass extends EventHandlerWithTypes_1.EventTargetWithType {
7
- constructor() {
8
- super(...arguments);
9
- this.startiappIsLoaded = false;
10
- }
11
- get appIntegration() {
12
- return (0, getIntegration_1.getIntegration)("AppIntegration");
13
- }
14
- get alternateIconsIntegration() {
15
- return (0, getIntegration_1.getIntegration)("AlternateIconsIntegration");
16
- }
17
- setStartiappIsLoaded() {
18
- this.startiappIsLoaded = true;
19
- }
20
- isStartiappLoaded() {
21
- return this.startiappIsLoaded;
22
- }
23
- setAppUrl(url) {
24
- this.appIntegration.setAppUrl(url);
25
- }
26
- resetAppUrl() {
27
- this.appIntegration.resetAppUrl();
28
- }
29
- openExternalBrowser(url) {
30
- this.appIntegration.openBrowser(url);
31
- }
32
- brandId() {
33
- return new Promise((resolve, reject) => {
34
- this.resolveBrandId = resolve;
35
- this.appIntegration.brandId();
36
- });
37
- }
38
- requestReview() {
39
- this.appIntegration.requestReview();
40
- }
41
- deviceId() {
42
- return new Promise((resolve, reject) => {
43
- this.resolveDeviceId = resolve;
44
- this.appIntegration.deviceId();
45
- });
46
- }
47
- version() {
48
- return new Promise((resolve, reject) => {
49
- this.resolveVersion = resolve;
50
- this.appIntegration.version();
51
- });
52
- }
53
- getInternalDomains() {
54
- return new Promise((resolve, reject) => {
55
- this.resolveGetInternalDomains = resolve;
56
- this.appIntegration.getInternalDomains();
57
- });
58
- }
59
- addInternalDomain(domain) {
60
- this.appIntegration.addInternalDomain(domain);
61
- }
62
- removeInternalDomain(domain) {
63
- this.appIntegration.removeInternalDomain(domain);
64
- }
65
- setAppIcon(iconName) {
66
- this.alternateIconsIntegration.setAppIcon(iconName);
67
- }
68
- getCurrentIcon() {
69
- return new Promise((resolve, reject) => {
70
- this.resolveCurrentIcon = resolve;
71
- this.alternateIconsIntegration.getCurrentAppIconName();
72
- });
73
- }
74
- getCurrentAppIconNameResult(result) {
75
- this.resolveCurrentIcon(result);
76
- this.resolveCurrentIcon = null;
77
- }
78
- getAvailableIcons() {
79
- return new Promise((resolve, reject) => {
80
- this.resolveAvailableIcons = resolve;
81
- this.alternateIconsIntegration.getAvailableAppIconNames();
82
- });
83
- }
84
- getAvailableAppIconNamesResult(result) {
85
- this.resolveAvailableIcons(result);
86
- this.resolveAvailableIcons = null;
87
- }
88
- showStatusBar() {
89
- if (this.appIntegration.showStatusBar === undefined)
90
- return console.warn("showStatusBar not implemented, please update your app to the latest version");
91
- this.appIntegration.showStatusBar();
92
- }
93
- hideStatusBar() {
94
- if (this.appIntegration.hideStatusBar === undefined)
95
- return console.warn("hideStatusBar not implemented, please update your app to the latest version");
96
- this.appIntegration.hideStatusBar();
97
- }
98
- setStatusBar(options) {
99
- if (this.appIntegration.setStatusBar === undefined)
100
- return console.warn("setStatusBar not implemented, please update your app to the latest version");
101
- this.appIntegration.setStatusBar(options);
102
- }
103
- setSpinner(options) {
104
- if (this.appIntegration.setNavigationSpinner === undefined)
105
- return console.warn("setNavigationSpinner not implemented, please update your app to the latest version");
106
- this.appIntegration.setNavigationSpinner({
107
- color: options.color,
108
- delay: options.afterMilliseconds,
109
- show: options.show,
110
- excludedDomains: options.excludedDomains,
111
- });
112
- }
113
- hideSpinner() {
114
- if (!this.appIntegration.hideNavigationSpinner)
115
- return console.warn("hideNavigationSpinner not implemented, please update your app to the latest version");
116
- this.appIntegration.hideNavigationSpinner();
117
- }
118
- showSpinner(options) {
119
- if (!this.appIntegration.showNavigationSpinner)
120
- return console.warn("showNavigationSpinner not implemented, please update your app to the latest version");
121
- this.appIntegration.showNavigationSpinner({
122
- color: options === null || options === void 0 ? void 0 : options.color,
123
- delay: options === null || options === void 0 ? void 0 : options.afterMilliseconds,
124
- show: options === null || options === void 0 ? void 0 : options.show,
125
- excludedDomains: options === null || options === void 0 ? void 0 : options.excludedDomains,
126
- });
127
- }
128
- setCommonScript(script) {
129
- this.appIntegration.setCommonScript(script);
130
- }
131
- setSafeAreaBackgroundColor(color) {
132
- return new Promise((resolve, reject) => {
133
- this.resolveSetSafeAreaBackgroundColor = resolve;
134
- this.appIntegration.setSafeAreaBackgroundColor(color);
135
- });
136
- }
137
- disableScreenRotation() {
138
- this.appIntegration.disableScreenRotation();
139
- }
140
- enableScreenRotation() {
141
- this.appIntegration.enableScreenRotation();
142
- }
143
- disableSwipeNavigation() {
144
- if (!this.appIntegration.disableSwipeNavigation)
145
- return console.warn("disableSwipeNavigation not implemented, please update your app to the latest version");
146
- this.appIntegration.disableSwipeNavigation();
147
- }
148
- enableSwipeNavigation() {
149
- if (!this.appIntegration.enableSwipeNavigation)
150
- return console.warn("enableSwipeNavigation not implemented, please update your app to the latest version");
151
- this.appIntegration.enableSwipeNavigation();
152
- }
153
- addExternalDomains(...domains) {
154
- let domainObjects = domains.map((m) => ({
155
- pattern: m.source,
156
- flags: m.flags,
157
- }));
158
- this.appIntegration.addExternalDomains(domainObjects);
159
- }
160
- removeExternalDomains(...domains) {
161
- let domainObjects = domains.map((domain) => ({
162
- pattern: domain.source,
163
- flags: domain.flags,
164
- }));
165
- this.appIntegration.removeExternalDomains(domainObjects);
166
- }
167
- getExternalDomains() {
168
- return new Promise((resolve, reject) => {
169
- this.resolveExternalDomains = resolve;
170
- this.appIntegration.getExternalDomains();
171
- });
172
- }
173
- getExternalDomainsResult(result) {
174
- this.resolveExternalDomains(result);
175
- this.resolveExternalDomains = null;
176
- }
177
- appInForegroundEventRecievedEvent() {
178
- this.dispatchEvent(new CustomEvent("appInForeground"));
179
- }
180
- brandIdResult(result) {
181
- this.resolveBrandId(result);
182
- this.resolveBrandId = null;
183
- }
184
- versionResult(result) {
185
- this.resolveVersion(result);
186
- this.resolveVersion = null;
187
- }
188
- deviceIdResult(result) {
189
- this.resolveDeviceId(result);
190
- this.resolveDeviceId = null;
191
- }
192
- setSafeAreaBackgroundColorResult(result) {
193
- this.resolveSetSafeAreaBackgroundColor(result);
194
- this.resolveSetSafeAreaBackgroundColor = null;
195
- }
196
- navigatingPageEvent(result) {
197
- this.dispatchEvent(new CustomEvent("navigatingPage", { detail: result }));
198
- }
199
- getInternalDomainsResult(result) {
200
- this.resolveGetInternalDomains(result);
201
- this.resolveGetInternalDomains = null;
202
- }
203
- addDomainToHistoryExclusion(domain) {
204
- this.appIntegration.addExcludedFromHistoryDomain(domain);
205
- }
206
- removeDomainFromHistoryExclusion(domain) {
207
- this.appIntegration.removeExcludedFromHistoryDomain(domain);
208
- }
209
- addPatternToHistoryExclusion(pattern) {
210
- this.appIntegration.addExcludedFromHistoryPattern({
211
- pattern: pattern.source,
212
- flags: pattern.flags,
213
- });
214
- }
215
- removePatternFromHistoryExclusion(pattern) {
216
- this.appIntegration.removeExcludedFromHistoryPattern({
217
- pattern: pattern.source,
218
- flags: pattern.flags,
219
- });
220
- }
221
- }
222
- exports.App = new AppClass();
@@ -1,106 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ClientUser = void 0;
13
- const EventHandlerWithTypes_1 = require("./@types/EventHandlerWithTypes");
14
- const config_1 = require("./config");
15
- const index_1 = require("./index");
16
- class ClientUserClass extends EventHandlerWithTypes_1.EventTargetWithType {
17
- get userId() {
18
- return (this._userId ||
19
- localStorage.getItem("startiapp-clientUserId") ||
20
- null);
21
- }
22
- set userId(userId) {
23
- this._userId = userId;
24
- localStorage.setItem("startiapp-clientUserId", userId);
25
- }
26
- deleteUser(options) {
27
- return __awaiter(this, void 0, void 0, function* () {
28
- const userId = this.userId;
29
- if (!userId)
30
- throw new Error("No user ID");
31
- const promptText = (options === null || options === void 0 ? void 0 : options.prompt) ||
32
- "Er du sikker på, at du vil slette slette din bruger i appen?";
33
- const confirmationText = (options === null || options === void 0 ? void 0 : options.confirmation) ||
34
- "Vi har registreret dit ønske og vender tilbage med en bekræftelse.";
35
- if (!confirm(promptText))
36
- return;
37
- const brandId = yield index_1.default.App.brandId();
38
- const params = {
39
- brandId: brandId,
40
- userId: userId,
41
- };
42
- const response = yield fetch(config_1.baseUrl + "/App-requestAccountDeletion", {
43
- body: JSON.stringify(params),
44
- headers: { "Content-Type": "application/json" },
45
- method: "POST",
46
- });
47
- if (!response.ok) {
48
- console.warn("Failed to request user deletion", params);
49
- throw new Error(`Failed to request user deletion: Firebase returned statuscode ${response.status}`);
50
- }
51
- alert(confirmationText);
52
- });
53
- }
54
- registerId(userId) {
55
- return __awaiter(this, void 0, void 0, function* () {
56
- this.userId = userId;
57
- const [brandId, deviceId, fcmToken] = yield Promise.all([
58
- index_1.default.App.brandId(),
59
- index_1.default.App.deviceId(),
60
- index_1.default.PushNotification.getToken(),
61
- ]);
62
- if (!fcmToken || fcmToken.length === 0) {
63
- console.warn("Failed to register logged in client user", userId, "No FCM token");
64
- throw new Error(`Failed to register logged in client user ${userId}: No FCM token`);
65
- }
66
- const params = {
67
- brandId: brandId,
68
- clientUserId: userId,
69
- deviceId: deviceId,
70
- fcmToken: fcmToken,
71
- };
72
- const response = yield fetch(config_1.baseUrl + "/ClientUser-registerId", {
73
- body: JSON.stringify(params),
74
- headers: { "Content-Type": "application/json" },
75
- method: "POST",
76
- });
77
- if (!response.ok) {
78
- console.warn("Failed to register logged in client user", userId, params);
79
- throw new Error(`Failed to register logged in client user ${userId}: Firebase returned statuscode ${response.status}`);
80
- }
81
- });
82
- }
83
- unregisterId() {
84
- return __awaiter(this, void 0, void 0, function* () {
85
- this.userId = "";
86
- const [brandId, deviceId] = yield Promise.all([
87
- index_1.default.App.brandId(),
88
- index_1.default.App.deviceId(),
89
- ]);
90
- const params = {
91
- brandId: brandId,
92
- deviceId: deviceId,
93
- };
94
- const response = yield fetch(config_1.baseUrl + "/ClientUser-unregisterId", {
95
- body: JSON.stringify(params),
96
- headers: { "Content-Type": "application/json" },
97
- method: "POST",
98
- });
99
- if (!response.ok) {
100
- console.warn("Failed to unregister logged in client user", params);
101
- throw new Error(`Failed to unregister logged in client user: Firebase returned statuscode ${response.status}`);
102
- }
103
- });
104
- }
105
- }
106
- exports.ClientUser = new ClientUserClass();
package/dist/config.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.googleStorageBucket = exports.styleTagId = exports.baseUrl = void 0;
4
- exports.baseUrl = 'https://europe-west3-startiapp-admin-1fac2.cloudfunctions.net';
5
- exports.styleTagId = 'startiapp-styling';
6
- exports.googleStorageBucket = 'startiapp-admin-1fac2.appspot.com';
@@ -1,22 +0,0 @@
1
- "use strict";
2
- // Attept to get integration from window or window.parent to a max depth of X
3
- // This is needed because the integrations are not injected into iframes
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.getIntegration = void 0;
6
- let integrationCache = {};
7
- function getIntegration(integration) {
8
- if (integrationCache[integration])
9
- return integrationCache[integration];
10
- const MAX_DEPTH = 5;
11
- let integrationObject = window[integration];
12
- let depth = 0;
13
- while (!integrationObject && depth < MAX_DEPTH) {
14
- integrationObject = window.parent[integration];
15
- depth++;
16
- }
17
- if (!integrationObject)
18
- throw new Error(`Could not find integration ${integration}`);
19
- integrationCache[integration] = integrationObject;
20
- return integrationObject;
21
- }
22
- exports.getIntegration = getIntegration;
package/dist/index.js DELETED
@@ -1,194 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const developer_1 = require("./integrations/developer");
13
- const app_1 = require("./app");
14
- const clientUser_1 = require("./clientUser");
15
- const getIntegration_1 = require("./getIntegration");
16
- const CheckIfVersionIsClosed_1 = require("./initalization-steps/CheckIfVersionIsClosed");
17
- const biometrics_1 = require("./integrations/biometrics");
18
- const device_1 = require("./integrations/device");
19
- const iap_1 = require("./integrations/iap");
20
- const network_1 = require("./integrations/network");
21
- const storage_1 = require("./integrations/storage");
22
- const nfc_1 = require("./integrations/nfc");
23
- const pushnotification_1 = require("./integrations/pushnotification");
24
- const qrscanner_1 = require("./integrations/qrscanner");
25
- const share_1 = require("./integrations/share");
26
- const trigger_1 = require("./integrations/trigger");
27
- const SmartBanner_1 = require("./lib/SmartBanner");
28
- const TaskStepper_1 = require("./lib/TaskStepper");
29
- const ViewportMetatag_1 = require("./lib/ViewportMetatag");
30
- const flowLink_service_1 = require("./services/flowLink-service");
31
- const ui_service_1 = require("./services/ui-service");
32
- const utils_1 = require("./utils");
33
- const startiappModuleEvents = ["app-integrations-are-ready"];
34
- class StartiappClass extends EventTarget {
35
- constructor() {
36
- super(...arguments);
37
- /** Basic calls to the app. */
38
- this.App = app_1.App;
39
- /** Access to device functionality. */
40
- this.Device = device_1.Device;
41
- /** The biometric functionality. */
42
- this.Biometrics = biometrics_1.Biometrics;
43
- /** Access to client user functionality. */
44
- this.User = clientUser_1.ClientUser;
45
- /** The NFC scanning functionality. */
46
- this.NfcScanner = nfc_1.NFC;
47
- /** Access to push notifications using Firebase. */
48
- this.PushNotification = pushnotification_1.PushNotification;
49
- /** The QR- and barcode scanning functionality. */
50
- this.QrScanner = qrscanner_1.QrScanner;
51
- /** The share functionality. */
52
- this.Share = share_1.Share;
53
- /** The network functionality. */
54
- this.Network = network_1.Network;
55
- /** The storage functionality. */
56
- this.Storage = storage_1.Storage;
57
- /** Trigger functionality */
58
- this.Trigger = trigger_1.Trigger;
59
- /** The In App Purchases functionality */
60
- this.Iap = iap_1.Iap;
61
- this.Developer = (0, utils_1.isDevelopment)() ? developer_1.Developer : undefined;
62
- }
63
- get appIntegration() {
64
- return (0, getIntegration_1.getIntegration)("AppIntegration");
65
- }
66
- /** Call this method to initialize the starti.app API integration. This method should be called AFTER all integrations are ready (see onIntegrationsAreReady). */
67
- initialize(options) {
68
- if (!this.isRunningInApp())
69
- return;
70
- if (typeof gtag === "function")
71
- gtag("set", "user_properties", { startiapp: "true" });
72
- ui_service_1.AppUI.setOptionsAsync(options).then(() => {
73
- this.appIntegration.webAppIsReady();
74
- });
75
- }
76
- /** Call this method to check if the app is running in the starti.app app. */
77
- isRunningInApp() {
78
- return (0, utils_1.isRunningInApp)();
79
- }
80
- addEventListener(type, callback, options) {
81
- if (type == "ready" && app_1.App.isStartiappLoaded()) {
82
- const event = new CustomEvent("ready");
83
- if ("handleEvent" in callback)
84
- callback.handleEvent(event);
85
- else
86
- callback(event);
87
- }
88
- super.addEventListener(type, callback, options);
89
- }
90
- removeEventListener(type, callback, options) {
91
- super.removeEventListener(type, callback, options);
92
- }
93
- }
94
- let startiapp = new StartiappClass();
95
- if (typeof window === "undefined") {
96
- console.error("starti.app is only available client-side");
97
- }
98
- else {
99
- const completedModuleInitialization = [];
100
- for (const event of startiappModuleEvents) {
101
- startiapp.addEventListener(event, () => {
102
- if (completedModuleInitialization.includes(event))
103
- return;
104
- completedModuleInitialization.push(event);
105
- if (completedModuleInitialization.length === startiappModuleEvents.length) {
106
- app_1.App.setStartiappIsLoaded();
107
- startiapp.dispatchEvent(new CustomEvent("ready"));
108
- }
109
- });
110
- }
111
- window.appIntegrationsAreReady = () => {
112
- const setAppReady = () => {
113
- startiapp.dispatchEvent(new CustomEvent("app-integrations-are-ready"));
114
- };
115
- (0, flowLink_service_1.handleFlowLink)().then((result) => {
116
- if (result == "redirected") // If the user has been redirected, we don't want to initialize the app yet, as the app will be reloaded and then run this statement again
117
- return;
118
- setAppReady();
119
- }).catch((_) => {
120
- console.error("Failed to handle flow link");
121
- setAppReady();
122
- });
123
- };
124
- window.startiappDeveloper = (0, utils_1.isDevelopment)() ? developer_1.Developer : undefined;
125
- window.startiappDevice = device_1.Device;
126
- window.startiappApp = app_1.App;
127
- window.startiappUser = clientUser_1.ClientUser;
128
- window.startiappQrScanner = qrscanner_1.QrScanner;
129
- window.startiappPushNotification = pushnotification_1.PushNotification;
130
- window.startiappNFC = nfc_1.NFC;
131
- window.startiappShare = share_1.Share;
132
- window.startiappNetwork = network_1.Network;
133
- window.startiappIap = iap_1.Iap;
134
- window.startiappBiometric = biometrics_1.Biometrics;
135
- window.startiappTrigger = trigger_1.Trigger;
136
- window.startiappAlternateIcons = app_1.App;
137
- window.appErrorEvent = (data) => {
138
- startiapp.dispatchEvent(new CustomEvent("error", { detail: data }));
139
- };
140
- if (document.body)
141
- documentBodyExists();
142
- else {
143
- const observer = new MutationObserver(() => documentBodyExists(observer));
144
- observer.observe(document.documentElement, { childList: true });
145
- }
146
- function documentBodyExists(observer) {
147
- if (!document.body)
148
- return;
149
- const smartBanner = new SmartBanner_1.SmartBanner();
150
- smartBanner.initialize();
151
- if (startiapp.isRunningInApp()) {
152
- document.body.setAttribute("startiapp", "");
153
- }
154
- else {
155
- document.body.removeAttribute("startiapp");
156
- }
157
- if (!document.head)
158
- return;
159
- // Append the utility styles to the document head
160
- const style = document.createElement("style");
161
- style.innerHTML = `body:not([startiapp]) .startiapp-hide-in-browser,body:not([startiapp]) .startiapp-show-in-app,body[startiapp] .startiapp-hide-in-app,body[startiapp] .startiapp-show-in-browser{display:none!important}`;
162
- document.head.appendChild(style);
163
- // Update the viewport meta tag to use viewport fit cover and device width if the app is running in the starti.app app
164
- if (startiapp.isRunningInApp()) {
165
- const startiappViewportContent = {
166
- "width": "device-width",
167
- "viewport-fit": "cover",
168
- };
169
- const existingViewport = document.querySelector("meta[name=viewport]");
170
- if (existingViewport) {
171
- const content = (0, ViewportMetatag_1.parseViewportMeta)(existingViewport.content);
172
- existingViewport.content = (0, ViewportMetatag_1.serializeViewportMeta)(Object.assign(Object.assign({}, content), startiappViewportContent));
173
- }
174
- else {
175
- const meta = document.createElement("meta");
176
- meta.name = "viewport";
177
- meta.content = (0, ViewportMetatag_1.serializeViewportMeta)(startiappViewportContent);
178
- document.head.appendChild(meta);
179
- }
180
- }
181
- if (observer)
182
- observer.disconnect();
183
- }
184
- window.startiapp = startiapp;
185
- const initalizationStepper = new TaskStepper_1.TaskStepper();
186
- initalizationStepper.addTask(CheckIfVersionIsClosed_1.checkIfAppVersionIsClosed);
187
- startiapp.addEventListener("ready", () => __awaiter(void 0, void 0, void 0, function* () {
188
- yield initalizationStepper.start();
189
- }));
190
- // If appIntegrationsAreReady has already been attempted to be called by maui, we should call it now
191
- if (window.__startiapp_appIntegrationsAreReady)
192
- window.appIntegrationsAreReady();
193
- }
194
- exports.default = startiapp;