starti.app 1.0.31 → 1.0.32
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 +12 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -0
- package/package.json +1 -1
- package/umd/main.js +1 -1
package/README.md
CHANGED
|
@@ -11,8 +11,17 @@ This package allows you to talk to the app using an easy API.
|
|
|
11
11
|
Add the package to your project in one of two ways:
|
|
12
12
|
|
|
13
13
|
1) Add the package using npm:
|
|
14
|
-
|
|
14
|
+
```
|
|
15
|
+
npm install starti.app
|
|
16
|
+
```
|
|
15
17
|
|
|
16
|
-
2) Add the following
|
|
17
|
-
`<script crossorigin src="https://unpkg.com/starti.app@1.0.12/umd/main.js"></script>`
|
|
18
|
+
2) Add the following to your HTML file:
|
|
18
19
|
|
|
20
|
+
```
|
|
21
|
+
<script
|
|
22
|
+
crossorigin
|
|
23
|
+
src="https://unpkg.com/starti.app@1.0.12/umd/main.js">
|
|
24
|
+
</script>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Remember to update the version number (set to 1.0.12 above) to the latest version.
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ declare const startiapp: {
|
|
|
13
13
|
QrScanner: import("./qrscanner").IQrScanner;
|
|
14
14
|
/** Call this method to initialize the starti.app API integration. This method should be called AFTER all integrations are ready (see onIntegrationsAreReady). */
|
|
15
15
|
initialize(): void;
|
|
16
|
+
/** Call this method to check if the app is running in the starti.app app. */
|
|
17
|
+
isRunningInApp(): boolean;
|
|
16
18
|
addEventListener(type: StartiappEvents, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
17
19
|
removeEventListener(type: StartiappEvents, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
18
20
|
dispatchEvent(event: Event): boolean;
|
package/dist/index.js
CHANGED
|
@@ -43,6 +43,13 @@ const startiapp = new class extends EventTarget {
|
|
|
43
43
|
if (app_1.App.isStartiappLoaded())
|
|
44
44
|
AppIntegration.webAppIsReady();
|
|
45
45
|
}
|
|
46
|
+
/** Call this method to check if the app is running in the starti.app app. */
|
|
47
|
+
isRunningInApp() {
|
|
48
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
49
|
+
if (userAgent.indexOf('starti.app') > -1)
|
|
50
|
+
return true;
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
46
53
|
addEventListener(type, callback, options) {
|
|
47
54
|
super.addEventListener(type, callback, options);
|
|
48
55
|
}
|
package/package.json
CHANGED
package/umd/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var i in n)("object"==typeof exports?exports:e)[i]=n[i]}}(self,(()=>(()=>{"use strict";var e={752:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0,t.App=new class extends EventTarget{constructor(){super(...arguments),this.startiappIsLoaded=!1}setStartiappIsLoaded(){this.startiappIsLoaded=!0}isStartiappLoaded(){return this.startiappIsLoaded}setAppUrl(e){AppIntegration.setAppUrl(e)}resetAppUrl(){AppIntegration.resetAppUrl()}appInForegroundEventRecievedEvent(){this.dispatchEvent(new CustomEvent("appInForeground"))}openExternalBrowser(e){AppIntegration.openBrowser(e)}downloadFile(e,t){AppIntegration.download(e,t)}brandId(){return new Promise(((e,t)=>{this.resolveBrandId=e,AppIntegration.brandId()}))}requestReview(){AppIntegration.requestReview()}deviceId(){return new Promise(((e,t)=>{this.resolveDeviceId=e,AppIntegration.deviceId()}))}version(){return new Promise(((e,t)=>{this.resolveVersion=e,AppIntegration.version()}))}showStatusBar(){AppIntegration.showStatusBar()}hideStatusBar(){AppIntegration.hideStatusBar()}disableScreenRotation(){AppIntegration.disableScreenRotation()}enableScreenRotation(){AppIntegration.enableScreenRotation()}brandIdResult(e){this.resolveBrandId(e)}versionResult(e){this.resolveVersion(e)}deviceIdResult(e){this.resolveDeviceId(e)}navigatingPageEvent(e){this.dispatchEvent(new CustomEvent("navigatingPage",{detail:e}))}}},1:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0,t.Biometrics=new class extends EventTarget{constructor(){super(...arguments),this.defaultScanTitle="Prove you have fingers!",this.defaultScanReason="Can't let you in if you don't."}scan(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,i)=>{this.resolveScan=n;try{if(!BiometricsIntegration)return void i("Biometrics virker kun i starti.app");BiometricsIntegration.startScanning(e,t)}catch(e){i(e)}}))}startScanningResult(e){this.resolveScan(e)}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e;try{if(!BiometricsIntegration)return void t("Biometrics virker kun i starti.app");BiometricsIntegration.getAuthenticationType()}catch(e){t(e)}}))}getAuthenticationTypeResult(e){this.resolveAuthType(e)}setSecuredContent(e){if(!BiometricsIntegration)throw new Error("Biometrics virker kun i starti.app");BiometricsIntegration.setSecuredContent(JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,i)=>{this.resolveGetContent=n;try{if(!BiometricsIntegration)return void i("Biometrics virker kun i starti.app");BiometricsIntegration.getSecuredContent(e,t)}catch(e){i(e)}}))}getSecuredContentResult(e){this.resolveGetContent(JSON.parse(e))}hasSecureContent(){return new Promise(((e,t)=>{this.resolveHasSecureContent=e;try{if(!BiometricsIntegration)return void t("Biometrics virker kun i starti.app");BiometricsIntegration.hasSecuredContent()}catch(e){t(e)}}))}hasSecureContentResult(e){this.resolveHasSecureContent(e)}removeSecuredContent(){if(!BiometricsIntegration)throw new Error("Biometrics virker kun i starti.app");BiometricsIntegration.removeSecuredContent()}}},495:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientUser=void 0;const r=n(913),s=n(607);t.ClientUser=new class extends EventTarget{registerId(e){return i(this,void 0,void 0,(function*(){const t=yield s.default.App.brandId(),n=yield s.default.App.deviceId(),i=yield s.default.PushNotification.getToken();if(!i||0===i.length)return void console.warn("Failed to register logged in client user",e,"No FCM token");const o={brandId:t,clientUserId:e,deviceId:n,fcmToken:i};(yield fetch(r.baseUrl+"/ClientUser-registerId",{body:JSON.stringify(o),headers:{"Content-Type":"application/json"},method:"POST"})).ok||console.warn("Failed to register logged in client user",e,o)}))}}},913:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.baseUrl=void 0,t.baseUrl="https://europe-west3-startiapp-admin-test-e56ab.cloudfunctions.net"},607:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const i=n(752),r=n(1),s=n(495),o=n(983),a=n(681),c=n(952),
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var i in n)("object"==typeof exports?exports:e)[i]=n[i]}}(self,(()=>(()=>{"use strict";var e={752:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0,t.App=new class extends EventTarget{constructor(){super(...arguments),this.startiappIsLoaded=!1}setStartiappIsLoaded(){this.startiappIsLoaded=!0}isStartiappLoaded(){return this.startiappIsLoaded}setAppUrl(e){AppIntegration.setAppUrl(e)}resetAppUrl(){AppIntegration.resetAppUrl()}appInForegroundEventRecievedEvent(){this.dispatchEvent(new CustomEvent("appInForeground"))}openExternalBrowser(e){AppIntegration.openBrowser(e)}downloadFile(e,t){AppIntegration.download(e,t)}brandId(){return new Promise(((e,t)=>{this.resolveBrandId=e,AppIntegration.brandId()}))}requestReview(){AppIntegration.requestReview()}deviceId(){return new Promise(((e,t)=>{this.resolveDeviceId=e,AppIntegration.deviceId()}))}version(){return new Promise(((e,t)=>{this.resolveVersion=e,AppIntegration.version()}))}showStatusBar(){AppIntegration.showStatusBar()}hideStatusBar(){AppIntegration.hideStatusBar()}disableScreenRotation(){AppIntegration.disableScreenRotation()}enableScreenRotation(){AppIntegration.enableScreenRotation()}brandIdResult(e){this.resolveBrandId(e)}versionResult(e){this.resolveVersion(e)}deviceIdResult(e){this.resolveDeviceId(e)}navigatingPageEvent(e){this.dispatchEvent(new CustomEvent("navigatingPage",{detail:e}))}}},1:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Biometrics=void 0,t.Biometrics=new class extends EventTarget{constructor(){super(...arguments),this.defaultScanTitle="Prove you have fingers!",this.defaultScanReason="Can't let you in if you don't."}scan(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,i)=>{this.resolveScan=n;try{if(!BiometricsIntegration)return void i("Biometrics virker kun i starti.app");BiometricsIntegration.startScanning(e,t)}catch(e){i(e)}}))}startScanningResult(e){this.resolveScan(e)}getAuthenticationType(){return new Promise(((e,t)=>{this.resolveAuthType=e;try{if(!BiometricsIntegration)return void t("Biometrics virker kun i starti.app");BiometricsIntegration.getAuthenticationType()}catch(e){t(e)}}))}getAuthenticationTypeResult(e){this.resolveAuthType(e)}setSecuredContent(e){if(!BiometricsIntegration)throw new Error("Biometrics virker kun i starti.app");BiometricsIntegration.setSecuredContent(JSON.stringify(e))}getSecuredContent(e=this.defaultScanTitle,t=this.defaultScanReason){return new Promise(((n,i)=>{this.resolveGetContent=n;try{if(!BiometricsIntegration)return void i("Biometrics virker kun i starti.app");BiometricsIntegration.getSecuredContent(e,t)}catch(e){i(e)}}))}getSecuredContentResult(e){this.resolveGetContent(JSON.parse(e))}hasSecureContent(){return new Promise(((e,t)=>{this.resolveHasSecureContent=e;try{if(!BiometricsIntegration)return void t("Biometrics virker kun i starti.app");BiometricsIntegration.hasSecuredContent()}catch(e){t(e)}}))}hasSecureContentResult(e){this.resolveHasSecureContent(e)}removeSecuredContent(){if(!BiometricsIntegration)throw new Error("Biometrics virker kun i starti.app");BiometricsIntegration.removeSecuredContent()}}},495:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ClientUser=void 0;const r=n(913),s=n(607);t.ClientUser=new class extends EventTarget{registerId(e){return i(this,void 0,void 0,(function*(){const t=yield s.default.App.brandId(),n=yield s.default.App.deviceId(),i=yield s.default.PushNotification.getToken();if(!i||0===i.length)return void console.warn("Failed to register logged in client user",e,"No FCM token");const o={brandId:t,clientUserId:e,deviceId:n,fcmToken:i};(yield fetch(r.baseUrl+"/ClientUser-registerId",{body:JSON.stringify(o),headers:{"Content-Type":"application/json"},method:"POST"})).ok||console.warn("Failed to register logged in client user",e,o)}))}}},913:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.baseUrl=void 0,t.baseUrl="https://europe-west3-startiapp-admin-test-e56ab.cloudfunctions.net"},607:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const i=n(752),r=n(1),s=n(495),o=n(983),a=n(681),c=n(952),u=window;u.appIntegrationsAreReady=()=>{i.App.setStartiappIsLoaded(),d.dispatchEvent(new CustomEvent("ready"))},u.startiappApp=i.App,u.startiappUser=s.ClientUser,u.startiappQrScanner=c.QrScanner,u.startiappPushNotification=a.PushNotification,u.startiappNFC=o.NFC,u.startiappBiometrics=r.Biometrics,u.appErrorEvent=e=>{d.dispatchEvent(new CustomEvent("error",{detail:e}))};const d=new class extends EventTarget{constructor(){super(...arguments),this.App=i.App,this.Biometrics=r.Biometrics,this.User=s.ClientUser,this.NfcScanner=o.NFC,this.PushNotification=a.PushNotification,this.QrScanner=c.QrScanner}initialize(){if(void 0===AppIntegration)throw new Error("The starti.app API integration is not available.");i.App.isStartiappLoaded()&&AppIntegration.webAppIsReady()}isRunningInApp(){return navigator.userAgent.toLowerCase().indexOf("starti.app")>-1}addEventListener(e,t,n){super.addEventListener(e,t,n)}removeEventListener(e,t,n){super.removeEventListener(e,t,n)}};t.default=d,u.startiapp=d},983:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NFC=void 0,t.NFC=new class extends EventTarget{isNFCSupported(){return new Promise(((e,t)=>{this.resolveNFCSupported=e;try{if(!NFCIntegration)return void t("NFC virker kun i starti.app");NFCIntegration.isNFCSupported()}catch(e){t(e)}}))}isNFCSupportedResult(e){this.resolveNFCSupported(e)}startNFCReader(){return new Promise(((e,t)=>{this.resolveStartNFCReader=e;try{if(!NFCIntegration)return void t("NFC virker kun i starti.app");NFCIntegration.initNFC()}catch(e){t(e)}}))}startNFCReaderResult(e){this.resolveStartNFCReader(e)}stopNFCReader(){return new Promise(((e,t)=>{this.resolveStopNFCReader=e;try{if(!NFCIntegration)return void t("NFC virker kun i starti.app");NFCIntegration.stopListening()}catch(e){t(e)}}))}stopListeningResult(e){this.resolveStopNFCReader(e)}nfcTagResultRecievedEvent(e){const t=new CustomEvent("nfcTagScanned",{detail:e});this.dispatchEvent(t)}}},681:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.PushNotification=void 0;const r=n(913),s=n(607);t.PushNotification=new class extends EventTarget{requestAccess(){return i(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.resolveRequestAccess=e,PushNotificationIntegration.requestAccess()}))}))}requestAccessResult(e){this.resolveRequestAccess(e)}getToken(){return new Promise(((e,t)=>{this.resolveFCMToken=e,PushNotificationIntegration.getFCMToken()}))}getFCMTokenResult(e){this.resolveFCMToken(e)}tokenReceivedEvent(e){this.dispatchEvent(new CustomEvent("tokenRefreshed",{detail:e}))}notificationReceivedEvent(e){this.dispatchEvent(new CustomEvent("notificationReceived",{detail:e}))}subscribeToTopics(e){return i(this,void 0,void 0,(function*(){PushNotificationIntegration.firebasePushNotificationSubscribeToTopics(e);const t=yield this.getToken(),n=yield s.default.App.brandId(),i=yield s.default.App.deviceId(),o=[];e.forEach((e=>{const s={brand:n,topic:e,token:t,deviceId:i},a=fetch(r.baseUrl+"/PushNotification-subscribeToTopic",{body:JSON.stringify(s)});o.push(a)})),(yield Promise.all(o)).forEach(((t,n)=>{t.ok||console.warn("Failed to sign up to topic",n,e[n])}))}))}unsubscribeFromTopics(e){return i(this,void 0,void 0,(function*(){PushNotificationIntegration.firebasePushNotificationTopicsUnsubscribe(e);const t=yield this.getToken(),n=yield s.default.App.brandId(),i=yield s.default.App.deviceId(),o=[];e.forEach((e=>{const s={brand:n,topic:e,token:t,deviceId:i},a=fetch(r.baseUrl+"/PushNotification-unSubscribeFromTopic",{body:JSON.stringify(s)});o.push(a)})),(yield Promise.all(o)).forEach(((t,n)=>{t.ok||console.warn("Failed to unsubscribe from topic",n,e[n])}))}))}firebasePushNotificationTopicsUnsubscribeResult(e){}firebasePushNotificationSubscribeToTopicsResult(e){}}},952:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.QrScanner=void 0,t.QrScanner=new class extends EventTarget{scan(){return new Promise(((e,t)=>{QrScannerIntegration?(this.resolveScan=e,QrScannerIntegration.startQrCodeScanner()):t("QrScanner integration is not available")}))}qrResultRecievedEvent(e){this.resolveScan(e)}isCameraAccessGranted(){return new Promise(((e,t)=>{if(!QrScannerIntegration)return t("Scanner virker kun i starti.app");this.resolveCameraAccessGranted=e,QrScannerIntegration.isCameraAccessGranted()}))}isCameraAccessGrantedResult(e){this.resolveCameraAccessGranted(e)}requestCameraAccess(){return new Promise(((e,t)=>{if(!QrScannerIntegration)return t("Scanner virker kun i starti.app");this.resolveRequestCameraAccess=e,QrScannerIntegration.requestCameraAccess()}))}requestCameraAccessResult(e){this.resolveRequestCameraAccess(e)}}}},t={};return function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={exports:{}};return e[i].call(s.exports,s,s.exports,n),s.exports}(607)})()));
|