natively 2.27.1 → 2.28.0

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
@@ -18,12 +18,6 @@ function nativelyOnLoad() {
18
18
 
19
19
  You can specify an SDK version by replacing version number 2.14.0. The latest version number can be found in this repo. Debug mode which enables native alerts with errors. It's can be very useful while you developing a website.
20
20
 
21
- ### Flutter Web iframe mode
22
-
23
- When a website is embedded in Flutter Web as an iframe, the website page must load this SDK itself, for example from a CDN script tag or bundled application code. The outer Flutter Web app cannot inject `window.$agent` into a cross-origin iframe.
24
-
25
- The SDK supports both native WebView injection and Flutter Web iframe messaging. In native WebViews it calls `window.flutter_inappwebview.callHandler(...)`. When the SDK is running inside an iframe and that native handler is unavailable, it sends the same serialized trigger payload to the parent window with `postMessage`.
26
-
27
21
  ### Usage
28
22
 
29
23
 
@@ -40,122 +34,6 @@ notifications.getOneSignalId(playerId_callback);
40
34
  window.natively.shareText("Hello world!");
41
35
  ```
42
36
 
43
- ### Quick actions
44
-
45
- Quick actions are available as a module export and are not registered on `window`.
46
-
47
- ```javascript
48
- import { NativelyQuickActions } from 'natively';
49
-
50
- const quickActions = new NativelyQuickActions();
51
-
52
- quickActions.setActions(
53
- [
54
- {
55
- type: 'open_docs',
56
- title: 'Docs',
57
- subtitle: 'Open docs',
58
- url: 'https://example.com/docs',
59
- is_enabled: true,
60
- },
61
- ],
62
- (resp) => {
63
- console.log(resp.status);
64
- console.log(resp.actions);
65
- },
66
- );
67
-
68
- quickActions.clear((resp) => {
69
- console.log(resp.actions); // []
70
- });
71
- ```
72
-
73
- API:
74
-
75
- ```javascript
76
- const quickActions = new NativelyQuickActions();
77
-
78
- quickActions.setActions(actions, callback);
79
- quickActions.clear(callback);
80
- ```
81
-
82
- `setActions(actions, callback)`
83
-
84
- - Sends the `quick_actions` runtime event.
85
- - Replaces the full configured quick action set.
86
- - Accepts an array of actions.
87
- - Invokes `callback(response)` when native returns a result.
88
-
89
- `clear(callback)`
90
-
91
- - Sends the `clear_quick_actions` runtime event.
92
- - Removes all active quick actions.
93
- - Invokes `callback(response)` with an empty `actions` array on success.
94
-
95
- Action fields:
96
-
97
- - `type: string` is required.
98
- - `url: string` is required.
99
- - `title?: string` is optional. Native defaults it to `type` if omitted.
100
- - `subtitle?: string` is optional.
101
- - `is_enabled?: boolean` is optional.
102
- - `icon?: string` is optional.
103
- - `ios_icon?: string` is optional.
104
- - `android_icon?: string` is optional.
105
-
106
- Example payload sent by the SDK:
107
-
108
- ```json
109
- {
110
- "actions": [
111
- {
112
- "type": "open_docs",
113
- "title": "Docs",
114
- "subtitle": "Open docs",
115
- "url": "https://example.com/docs",
116
- "is_enabled": true
117
- }
118
- ]
119
- }
120
- ```
121
-
122
- Example response:
123
-
124
- ```json
125
- {
126
- "status": "SUCCESS",
127
- "actions": [
128
- {
129
- "type": "open_docs",
130
- "url": "https://example.com/docs",
131
- "title": "Docs",
132
- "subtitle": "Open docs",
133
- "is_enabled": true,
134
- "ios_icon": "natively_quick_action_2",
135
- "android_icon": "natively_quick_action_2"
136
- }
137
- ]
138
- }
139
- ```
140
-
141
- Runtime behavior:
142
-
143
- - `setActions()` replaces the full configured set. If you send only one action, the app keeps only that one action.
144
- - Native stores all configured actions, including disabled ones.
145
- - Only actions with `is_enabled: true` are initially registered with the OS.
146
- - If you update an existing action with the same `type`, native can reuse previously known icon assets even when the runtime payload omits icon fields.
147
- - Icon reuse is keyed by `type`. A different `type` does not reuse another action's icons.
148
- - The recommended contract is to define icon URLs in app config and usually omit runtime icon fields.
149
- - When a quick action is tapped, native matches it by `type` and opens its `url` through the app's existing navigation flow.
150
- - If the URL matches a configured tab URL, the app switches tabs. Otherwise it loads the URL in the main webview.
151
- - Cold-start quick action taps are queued until launch services are ready.
152
-
153
- Build-time config notes:
154
-
155
- - App config should use `ICON_URL`, `IOS_ICON_URL`, and `ANDROID_ICON_URL`.
156
- - Static native resource names such as `ICON`, `IOS_ICON`, and `ANDROID_ICON` are not the intended source-config contract.
157
- - iOS quick action icons are template-style assets, so simple glyph-style transparent icons work best for `IOS_ICON_URL`.
158
-
159
37
  ## 🛠 React/NextJS (min version 2.15.0)
160
38
 
161
39
  ### Installation:
@@ -2,7 +2,6 @@ export declare class Natively {
2
2
  isDebug: boolean;
3
3
  min_app_version: number;
4
4
  app_version: number;
5
- sdkVersion: string;
6
5
  injected: boolean;
7
6
  observers: Function[];
8
7
  onNativeError?: Function | null;
@@ -38,6 +37,15 @@ export declare class Natively {
38
37
  key: string;
39
38
  value: string;
40
39
  }): void;
40
+ analyticsSetCustomerUserId(data: {
41
+ user_id: string;
42
+ }): void;
43
+ analyticsSetCustomerIdAndLogSession(data: {
44
+ user_id: string;
45
+ }): void;
46
+ analyticsWaitForCustomerUserId(data: {
47
+ wait: boolean;
48
+ }): void;
41
49
  requestAppReview(): void;
42
50
  attShowPopup(callback: Function): void;
43
51
  attGetStatus(callback: Function): void;
@@ -2,14 +2,12 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
4
  import globalContext from "../utils/globalThis.js";
5
- import { SDK_VERSION } from "../sdkVersion.js";
6
5
  export class Natively {
7
6
  constructor() {
8
7
  var _globalContext$naviga, _globalContext$naviga2;
9
8
  _defineProperty(this, "isDebug", false);
10
9
  _defineProperty(this, "min_app_version", 0);
11
10
  _defineProperty(this, "app_version", 0);
12
- _defineProperty(this, "sdkVersion", SDK_VERSION);
13
11
  _defineProperty(this, "injected", false);
14
12
  _defineProperty(this, "observers", []);
15
13
  _defineProperty(this, "onNativeError", null);
@@ -73,16 +71,16 @@ export class Natively {
73
71
  fullMethodName = method + "_response";
74
72
  }
75
73
  if (globalContext) {
76
- globalContext[fullMethodName] = function (resp, err) {
74
+ globalContext[fullMethodName] = function (resp, meta) {
77
75
  globalContext === null || globalContext === void 0 || globalContext.$agent.response();
78
- if (err.message && isTestVersion) {
79
- alert("[ERROR] Error message: ".concat(err.message));
76
+ if (meta !== null && meta !== void 0 && meta.message && isTestVersion) {
77
+ alert("[ERROR] Error message: ".concat(meta.message));
80
78
  return;
81
79
  }
82
80
  if (isTestVersion) {
83
81
  console.log("[DEBUG] Callback method: ".concat(fullMethodName, ", body: ").concat(JSON.stringify(resp), ", respId: ").concat(respId));
84
82
  }
85
- callback(resp);
83
+ callback(resp, meta);
86
84
  };
87
85
  }
88
86
  if (body) {
@@ -193,9 +191,9 @@ export class Natively {
193
191
  }
194
192
  analyticsSetUserId(data) {
195
193
  var params = {
196
- id: data.id
194
+ user_id: data.id
197
195
  };
198
- globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 37, undefined, "analytics_set_user_id", params);
196
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 37, undefined, "analytics_set_customer_user_id", params);
199
197
  }
200
198
  analyticsSetUserProperty(data) {
201
199
  var params = {
@@ -204,6 +202,24 @@ export class Natively {
204
202
  };
205
203
  globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 37, undefined, "analytics_set_user_property", params);
206
204
  }
205
+ analyticsSetCustomerUserId(data) {
206
+ var params = {
207
+ user_id: data.user_id
208
+ };
209
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 37, undefined, "analytics_set_customer_user_id", params);
210
+ }
211
+ analyticsSetCustomerIdAndLogSession(data) {
212
+ var params = {
213
+ user_id: data.user_id
214
+ };
215
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 37, undefined, "analytics_set_customer_id_and_log_session", params);
216
+ }
217
+ analyticsWaitForCustomerUserId(data) {
218
+ var params = {
219
+ wait: data.wait
220
+ };
221
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 37, undefined, "analytics_wait_for_customer_user_id", params);
222
+ }
207
223
  requestAppReview() {
208
224
  globalContext === null || globalContext === void 0 || globalContext.natively.trigger(undefined, 0, undefined, "request_review");
209
225
  }
@@ -1,11 +1,88 @@
1
+ export type NativelyCallback<TResponse = unknown> = (response: TResponse, meta?: unknown) => void;
2
+ export type NativelyLiveUpdateTemplate = "progress" | "score" | "scoreboard" | "status" | "timer";
3
+ export interface NativelyLiveUpdateSegment {
4
+ length: number;
5
+ color?: string;
6
+ }
7
+ export interface NativelyLiveUpdatePoint {
8
+ position: number;
9
+ color?: string;
10
+ }
11
+ export interface NativelyLiveUpdatePayload {
12
+ id: string;
13
+ title: string;
14
+ template?: NativelyLiveUpdateTemplate;
15
+ subtitle?: string;
16
+ body?: string;
17
+ status_text?: string;
18
+ channel_id?: string;
19
+ channel_name?: string;
20
+ channel_description?: string;
21
+ progress?: number;
22
+ max_progress?: number;
23
+ indeterminate?: boolean;
24
+ ongoing?: boolean;
25
+ auto_cancel?: boolean;
26
+ only_alert_once?: boolean;
27
+ silent?: boolean;
28
+ show_when?: boolean;
29
+ when_epoch_ms?: number;
30
+ uses_chronometer?: boolean;
31
+ chronometer_count_down?: boolean;
32
+ short_critical_text?: string;
33
+ styled_by_progress?: boolean;
34
+ segments?: NativelyLiveUpdateSegment[];
35
+ points?: NativelyLiveUpdatePoint[];
36
+ url?: string;
37
+ activity_tag?: string;
38
+ ios_enable_remote_updates?: boolean;
39
+ stale_in_seconds?: number;
40
+ progress_label?: string;
41
+ home_label?: string;
42
+ away_label?: string;
43
+ home_score?: number;
44
+ away_score?: number;
45
+ period?: string;
46
+ clock?: string;
47
+ started_at_epoch_ms?: number;
48
+ home_logo_url?: string;
49
+ away_logo_url?: string;
50
+ teamAName?: string;
51
+ teamBName?: string;
52
+ teamAScore?: number;
53
+ teamBScore?: number;
54
+ teamAImageUrl?: string;
55
+ teamBImageUrl?: string;
56
+ color?: string;
57
+ disable_gradient?: boolean;
58
+ }
59
+ export interface NativelyLiveUpdateLifecycleResponse {
60
+ status: "SUCCESS" | "FAILED";
61
+ id?: string;
62
+ message?: string;
63
+ }
64
+ export interface NativelyLiveUpdatePermissionResponse {
65
+ status: "SUCCESS" | "PERMISSION_NOT_ALLOWED";
66
+ notifications_enabled: boolean;
67
+ promoted_supported: boolean;
68
+ promoted_enabled: boolean;
69
+ activities_supported: boolean;
70
+ activities_enabled: boolean;
71
+ opened_settings: boolean;
72
+ }
1
73
  export declare class NativelyNotifications {
2
74
  private readonly id;
3
- getOneSignalId(onesignal_playerid_callback: Function): void;
4
- requestPermission(fallbackToSettings: boolean, push_register_callback: Function): void;
5
- getPermissionStatus(push_permission_callback: Function): void;
6
- getExternalId(callback: Function): void;
75
+ getOneSignalId(onesignal_playerid_callback: NativelyCallback): void;
76
+ requestPermission(fallbackToSettings: boolean, push_register_callback: NativelyCallback): void;
77
+ getPermissionStatus(push_permission_callback: NativelyCallback): void;
78
+ getExternalId(callback: NativelyCallback): void;
7
79
  setExternalId(data: {
8
80
  externalId?: string;
9
- }, callback: Function): void;
10
- removeExternalId(callback: Function): void;
81
+ }, callback: NativelyCallback): void;
82
+ removeExternalId(callback: NativelyCallback): void;
83
+ requestLiveUpdatePermission(callback: NativelyCallback<NativelyLiveUpdatePermissionResponse>): void;
84
+ setupLiveUpdate(data: NativelyLiveUpdatePayload, callback: NativelyCallback<NativelyLiveUpdateLifecycleResponse>): void;
85
+ startLiveUpdate(data: NativelyLiveUpdatePayload, callback: NativelyCallback<NativelyLiveUpdateLifecycleResponse>): void;
86
+ updateLiveUpdate(data: NativelyLiveUpdatePayload, callback: NativelyCallback<NativelyLiveUpdateLifecycleResponse>): void;
87
+ endLiveUpdate(data: Pick<NativelyLiveUpdatePayload, "id" | "title"> & Partial<NativelyLiveUpdatePayload>, callback: NativelyCallback<NativelyLiveUpdateLifecycleResponse>): void;
11
88
  }
@@ -27,4 +27,19 @@ export class NativelyNotifications {
27
27
  removeExternalId(callback) {
28
28
  globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, callback, "onesignal_removeexternalid");
29
29
  }
30
+ requestLiveUpdatePermission(callback) {
31
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, callback, "live_update_permission");
32
+ }
33
+ setupLiveUpdate(data, callback) {
34
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, callback, "live_update_setup", data);
35
+ }
36
+ startLiveUpdate(data, callback) {
37
+ this.setupLiveUpdate(data, callback);
38
+ }
39
+ updateLiveUpdate(data, callback) {
40
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, callback, "live_update_update", data);
41
+ }
42
+ endLiveUpdate(data, callback) {
43
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 0, callback, "live_update_end", data);
44
+ }
30
45
  }
@@ -9,4 +9,5 @@ export declare class NativelyPurchases {
9
9
  purchasePackage(packageId: string, purchase_callback: Function, oldProductId?: string | null, prorationMode?: string | null): void;
10
10
  packagePrice(packageId: string, purchase_callback: Function): void;
11
11
  showCustomerCenter(show_customer_center_callback: Function): void;
12
+ getOfferings(get_offerings_callback: Function): void;
12
13
  }
@@ -53,4 +53,7 @@ export class NativelyPurchases {
53
53
  showCustomerCenter(show_customer_center_callback) {
54
54
  globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 42, show_customer_center_callback, "purchases_show_customer_center", {});
55
55
  }
56
+ getOfferings(get_offerings_callback) {
57
+ globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 44, get_offerings_callback, "purchases_get_offerings", {});
58
+ }
56
59
  }
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { NativelyAppleSignInService } from "./classes/NativelyAppleSignInService
3
3
  export { NativelyClipboard } from "./classes/NativelyClipboard";
4
4
  export { NativelyInfo } from "./classes/NativelyInfo";
5
5
  export { NativelyNotifications } from "./classes/NativelyNotifications";
6
+ export type { NativelyCallback, NativelyLiveUpdateLifecycleResponse, NativelyLiveUpdatePayload, NativelyLiveUpdatePermissionResponse, NativelyLiveUpdatePoint, NativelyLiveUpdateSegment, NativelyLiveUpdateTemplate, } from "./classes/NativelyNotifications";
6
7
  export { NativelyGeolocation } from "./classes/NativelyGeolocation";
7
8
  export { NativelyLocation } from "./classes/NativelyLocation";
8
9
  export { NativelyMessage } from "./classes/NativelyMessage";
@@ -23,10 +24,8 @@ export { NativelyNFCService } from "./classes/NativelyNFCService";
23
24
  export { NativelyFirebaseNotifications } from './classes/NativelyFirebaseNotifications';
24
25
  export { NativelyKlaviyoNotifications } from './classes/NativelyKlaviyoNotifications';
25
26
  export { NativelyCalendar } from "./classes/NativelyCalendar";
26
- export { NativelyLiveUpdates } from "./classes/NativelyLiveUpdates";
27
- export { NativelyQuickActions } from "./classes/NativelyQuickActions";
28
27
  export { useNatively } from './hooks/useNatively';
29
28
  export { generateID } from "./utils/generateID";
30
- import "./types.js";
31
- import "./inject.js";
32
- import "./events.js";
29
+ import "./types";
30
+ import "./inject";
31
+ import "./events";
package/dist/index.js CHANGED
@@ -24,8 +24,6 @@ export { NativelyNFCService } from "./classes/NativelyNFCService.js";
24
24
  export { NativelyFirebaseNotifications } from './classes/NativelyFirebaseNotifications.js';
25
25
  export { NativelyKlaviyoNotifications } from './classes/NativelyKlaviyoNotifications.js';
26
26
  export { NativelyCalendar } from "./classes/NativelyCalendar.js";
27
- export { NativelyLiveUpdates } from "./classes/NativelyLiveUpdates.js";
28
- export { NativelyQuickActions } from "./classes/NativelyQuickActions.js";
29
27
 
30
28
  // Hooks
31
29
  export { useNatively } from './hooks/useNatively.js';
@@ -34,6 +32,6 @@ export { useNatively } from './hooks/useNatively.js';
34
32
  export { generateID } from "./utils/generateID.js";
35
33
 
36
34
  // Global stuff
37
- import "./types.js";
38
- import "./inject.js";
39
- import "./events.js";
35
+ import "./types";
36
+ import "./inject";
37
+ import "./events";
package/dist/inject.js CHANGED
@@ -24,194 +24,10 @@ import { NativelyStorage } from "./classes/NativelyStorage.js";
24
24
  import { NativelyFirebaseNotifications } from "./classes/NativelyFirebaseNotifications.js";
25
25
  import { NativelyKlaviyoNotifications } from './classes/NativelyKlaviyoNotifications.js';
26
26
  import { NativelyCalendar } from "./classes/NativelyCalendar.js";
27
- import { NativelyLiveUpdates } from "./classes/NativelyLiveUpdates.js";
28
- import { SDK_VERSION } from "./sdkVersion.js";
29
- var HANDLER_NAME = "💙";
30
- var WEB_NAVIGATION_PROGRESS_EVENT = "web_navigation_progress";
31
- var WEB_SDK_VERSION_EVENT = "web_sdk_version";
32
- var isIframe = context => {
33
- try {
34
- return context.self !== context.top;
35
- } catch (_unused) {
36
- return true;
37
- }
38
- };
39
- var installAgent = context => {
40
- var _context$$agent, _context$flutter_inap;
41
- if (typeof ((_context$$agent = context.$agent) === null || _context$$agent === void 0 ? void 0 : _context$$agent.trigger) === "function") return true;
42
- var runningInIframe = isIframe(context);
43
- var hasNativeHandler = typeof ((_context$flutter_inap = context.flutter_inappwebview) === null || _context$flutter_inap === void 0 ? void 0 : _context$flutter_inap.callHandler) === "function";
44
- if (!runningInIframe && !hasNativeHandler) return false;
45
- var agent = {
46
- __nativelyAgent: true,
47
- trigger(eventName, eventData) {
48
- var _context$flutter_inap2, _context$parent;
49
- var serializedArgs = JSON.stringify({
50
- trigger: {
51
- name: eventName,
52
- data: eventData
53
- }
54
- });
55
- if (typeof ((_context$flutter_inap2 = context.flutter_inappwebview) === null || _context$flutter_inap2 === void 0 ? void 0 : _context$flutter_inap2.callHandler) === "function") {
56
- context.flutter_inappwebview.callHandler(HANDLER_NAME, serializedArgs);
57
- return;
58
- }
59
- if (runningInIframe && typeof ((_context$parent = context.parent) === null || _context$parent === void 0 ? void 0 : _context$parent.postMessage) === "function") {
60
- context.parent.postMessage({
61
- source: "natively-webview",
62
- handlerName: HANDLER_NAME,
63
- args: [serializedArgs]
64
- }, "*");
65
- }
66
- },
67
- response() {},
68
- natively_logger() {
69
- this.trigger("natively_logger");
70
- }
71
- };
72
- context.$agent = agent;
73
- context.natively = context.natively || agent;
74
- if (runningInIframe && typeof context.addEventListener === "function") {
75
- context.addEventListener("message", event => {
76
- var data = event.data || {};
77
- if (data.source !== "natively-flutter" || data.type !== "evaluate") return;
78
- if (typeof data.script === "string") {
79
- context.eval(data.script);
80
- }
81
- });
82
- }
83
- return true;
84
- };
85
- var installNavigationProgressTracking = context => {
86
- var _context$addEventList, _context$addEventList2, _context$document2, _context$document3;
87
- if (context.__nativelyNavigationProgressInstalled) return;
88
- context.__nativelyNavigationProgressInstalled = true;
89
- var completionTimer = null;
90
- var maxTimer = null;
91
- var observer = null;
92
- var didReportSdkVersion = false;
93
- var emit = (phase, reason) => {
94
- var _context$natively, _context$location;
95
- (_context$natively = context.natively) === null || _context$natively === void 0 || _context$natively.trigger(undefined, 0, undefined, WEB_NAVIGATION_PROGRESS_EVENT, {
96
- phase,
97
- reason,
98
- href: (_context$location = context.location) === null || _context$location === void 0 ? void 0 : _context$location.href
99
- });
100
- };
101
- var emitSdkVersion = reason => {
102
- var _context$natively2, _context$location2;
103
- if (didReportSdkVersion) return;
104
- didReportSdkVersion = true;
105
- (_context$natively2 = context.natively) === null || _context$natively2 === void 0 || _context$natively2.trigger(undefined, 0, undefined, WEB_SDK_VERSION_EVENT, {
106
- version: SDK_VERSION,
107
- reason,
108
- href: (_context$location2 = context.location) === null || _context$location2 === void 0 ? void 0 : _context$location2.href
109
- });
110
- };
111
- var cancelTimers = () => {
112
- if (completionTimer) {
113
- clearTimeout(completionTimer);
114
- completionTimer = null;
115
- }
116
- if (maxTimer) {
117
- clearTimeout(maxTimer);
118
- maxTimer = null;
119
- }
120
- };
121
- var disconnectObserver = () => {
122
- var _observer;
123
- (_observer = observer) === null || _observer === void 0 || _observer.disconnect();
124
- observer = null;
125
- };
126
- var finish = reason => {
127
- cancelTimers();
128
- disconnectObserver();
129
- emitSdkVersion(reason);
130
- emit("done", reason);
131
- };
132
- var scheduleSettle = () => {
133
- if (completionTimer) {
134
- clearTimeout(completionTimer);
135
- }
136
- completionTimer = setTimeout(() => finish("settled"), 250);
137
- };
138
- var observeDom = () => {
139
- var _context$document;
140
- disconnectObserver();
141
- var root = (_context$document = context.document) === null || _context$document === void 0 ? void 0 : _context$document.documentElement;
142
- if (!root || typeof context.MutationObserver !== "function") {
143
- scheduleSettle();
144
- return;
145
- }
146
- var mutationObserver = new context.MutationObserver(() => scheduleSettle());
147
- mutationObserver.observe(root, {
148
- subtree: true,
149
- childList: true,
150
- attributes: true,
151
- characterData: true
152
- });
153
- observer = mutationObserver;
154
- scheduleSettle();
155
- };
156
- var start = function start(reason) {
157
- var maxDuration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3000;
158
- cancelTimers();
159
- emit("start", reason);
160
- observeDom();
161
- maxTimer = setTimeout(() => finish("timeout"), maxDuration);
162
- };
163
- var wrapHistoryMethod = methodName => {
164
- var _context$history;
165
- var original = (_context$history = context.history) === null || _context$history === void 0 ? void 0 : _context$history[methodName];
166
- if (typeof original !== "function") return;
167
- context.history[methodName] = function () {
168
- start(methodName, 1500);
169
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
170
- args[_key] = arguments[_key];
171
- }
172
- return original.apply(this, args);
173
- };
174
- };
175
- wrapHistoryMethod("pushState");
176
- wrapHistoryMethod("replaceState");
177
- (_context$addEventList = context.addEventListener) === null || _context$addEventList === void 0 || _context$addEventList.call(context, "popstate", () => start("popstate", 1500));
178
- (_context$addEventList2 = context.addEventListener) === null || _context$addEventList2 === void 0 || _context$addEventList2.call(context, "hashchange", () => start("hashchange", 800));
179
- (_context$document2 = context.document) === null || _context$document2 === void 0 || _context$document2.addEventListener("click", event => {
180
- var target = event.target;
181
- if (!target || typeof target.closest !== "function") return;
182
- var anchor = target.closest("a[href]");
183
- if (!anchor) return;
184
- var href = anchor.getAttribute("href") || "";
185
- if (!href || href.startsWith("#") || href.startsWith("javascript:")) return;
186
- var targetAttr = anchor.getAttribute("target");
187
- if (targetAttr && targetAttr !== "_self") return;
188
- start("anchor", 4000);
189
- }, true);
190
- if (((_context$document3 = context.document) === null || _context$document3 === void 0 ? void 0 : _context$document3.readyState) === "complete") {
191
- finish("ready");
192
- } else {
193
- var _context$addEventList3;
194
- (_context$addEventList3 = context.addEventListener) === null || _context$addEventList3 === void 0 || _context$addEventList3.call(context, "load", () => finish("load"), {
195
- once: true
196
- });
197
- }
198
- };
199
27
 
200
28
  // Assign natively to the global object
201
29
  if (globalContext) {
202
- var agentInstalled = installAgent(globalContext);
203
- if (!globalContext.natively || globalContext.natively.__nativelyAgent) {
204
- globalContext.natively = new Natively();
205
- }
206
- globalContext.natively.injected = agentInstalled;
207
- if (agentInstalled && !globalContext.natively.app_version) {
208
- globalContext.natively.app_version = Number.MAX_SAFE_INTEGER;
209
- }
210
- globalContext.natively.sdkVersion = SDK_VERSION;
211
- if (agentInstalled) {
212
- installNavigationProgressTracking(globalContext);
213
- }
214
-
30
+ globalContext.natively = new Natively();
215
31
  // All other classes must be global to make a possibility to create any number of their instances
216
32
  globalContext.NativelyAdmobBanner = NativelyAdmobBanner;
217
33
  globalContext.NativelyAdmobInterstitial = NativelyAdmobInterstitial;
@@ -237,5 +53,4 @@ if (globalContext) {
237
53
  globalContext.NativelyCalendar = NativelyCalendar;
238
54
  globalContext.NativelyFirebaseNotifications = NativelyFirebaseNotifications;
239
55
  globalContext.NativelyKlaviyoNotifications = NativelyKlaviyoNotifications;
240
- globalContext.NativelyLiveUpdates = NativelyLiveUpdates;
241
56
  }
package/dist/types.d.ts CHANGED
@@ -23,7 +23,6 @@ import { NativelyScanner } from "./classes/NativelyScanner";
23
23
  import { NativelyStorage } from "./classes/NativelyStorage";
24
24
  import { NativelyFirebaseNotifications } from "./classes/NativelyFirebaseNotifications";
25
25
  import { NativelyKlaviyoNotifications } from "./classes/NativelyKlaviyoNotifications";
26
- import { NativelyLiveUpdates } from "./classes/NativelyLiveUpdates";
27
26
  interface NativelyProps {
28
27
  natively: Natively;
29
28
  NativelyAdmobBanner: NativelyAdmobBanner;
@@ -50,18 +49,11 @@ interface NativelyProps {
50
49
  NativelyStorage: NativelyStorage;
51
50
  NativelyFirebaseNotifications: NativelyFirebaseNotifications;
52
51
  NativelyKlaviyoNotifications: NativelyKlaviyoNotifications;
53
- NativelyLiveUpdates: NativelyLiveUpdates;
54
- $agent: NativelyAgent;
55
- }
56
- interface NativelyAgent {
57
- __nativelyAgent: boolean;
58
- trigger(eventName: string, eventData?: any): void;
59
- response(): void;
60
- natively_logger(): void;
52
+ $agent: never;
61
53
  }
62
54
  declare global {
63
55
  const natively: Natively;
64
- const $agent: NativelyAgent;
56
+ const $agent: never;
65
57
  interface Window extends NativelyProps {
66
58
  }
67
59
  }
@@ -1 +1 @@
1
- (()=>{"use strict";var e={d:(t,i)=>{for(var l in i)e.o(i,l)&&!e.o(t,l)&&Object.defineProperty(t,l,{enumerable:!0,get:i[l]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var t={};e.r(t),e.d(t,{Natively:()=>a,NativelyAdmobBanner:()=>k,NativelyAdmobInterstitial:()=>S,NativelyAppleSignInService:()=>r,NativelyAudioPlayer:()=>A,NativelyAudioRecorder:()=>N,NativelyBiometrics:()=>y,NativelyCalendar:()=>D,NativelyCamera:()=>h,NativelyClipboard:()=>s,NativelyContacts:()=>f,NativelyDatePicker:()=>p,NativelyFirebaseNotifications:()=>I,NativelyGeolocation:()=>u,NativelyHealth:()=>_,NativelyInfo:()=>o,NativelyKlaviyoNotifications:()=>P,NativelyLiveUpdates:()=>C,NativelyLocation:()=>v,NativelyMediaPicker:()=>w,NativelyMessage:()=>g,NativelyNFCService:()=>T,NativelyNotifications:()=>d,NativelyPurchases:()=>m,NativelyQuickActions:()=>M,NativelyScanner:()=>b,NativelyStorage:()=>c,generateID:()=>n,useNatively:()=>O});const i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e.g?e.g:null,l="2.26.5";class a{constructor(){var e,t,a,n;this.isDebug=!1,this.min_app_version=0,this.app_version=0,this.sdkVersion=l,this.injected=!1,this.observers=[],this.onNativeError=null,this.onTabChanged=null,this.isIOSApp=(null===(t=null===(e=null==i?void 0:i.navigator)||void 0===e?void 0:e.userAgent)||void 0===t?void 0:t.includes("Natively/iOS"))||!1,this.isAndroidApp=(null===(n=null===(a=null==i?void 0:i.navigator)||void 0===a?void 0:a.userAgent)||void 0===n?void 0:n.includes("Natively/Android"))||!1}setDebug(e){i&&(i.natively.isDebug=e)}notify(e,t){i&&(i.natively.injected=!0,e&&(i.natively.min_app_version=e),t&&(i.natively.app_version=t));const l=null==i?void 0:i.natively.observers;for((null==i?void 0:i.natively.isDebug)&&console.log("[INFO] Notify observers: ",l.length);l.length>0;){const e=l.shift();null==e||e()}}addObserver(e){(null==i?void 0:i.natively.injected)?e():((null==i?void 0:i.natively.isDebug)&&console.log(`[DEBUG] addObserver: ${e}`),null==i||i.natively.observers.push(e))}trigger(e,t,l,a,n){const r=null==i?void 0:i.natively.isDebug;if(null==i?void 0:i.natively.injected)if(t>(null==i?void 0:i.natively.app_version))r&&alert(`[ERROR] Please rebuild the app to use this functionality. App Version: ${null==i?void 0:i.natively.app_version}, feature version: ${t}`);else{if(l){let t;t=e?a+"_response_"+e:a+"_response",i&&(i[t]=function(a,n){null==i||i.$agent.response(),n.message&&r?alert(`[ERROR] Error message: ${n.message}`):(r&&console.log(`[DEBUG] Callback method: ${t}, body: ${JSON.stringify(a)}, respId: ${e}`),l(a))}),n?n.response_id=e:n={response_id:e}}r&&console.log(`[DEBUG] Trigger method: ${a}, body: ${JSON.stringify(n)}`),null==i||i.$agent.trigger(a,n)}else null==i||i.natively.addObserver((()=>{null==i||i.natively.trigger(e,t,l,a,n)}))}setTabChangedHandler(e){"function"==typeof e?this.onTabChanged=e:console.warn("[Natively] Tab changed handler must be a function")}removeTabChangedHandler(){this.onTabChanged=null}setErrorHandler(e){"function"==typeof e&&(this.onNativeError=e)}removeErrorHandler(){this.onNativeError=null}setErrorScreen(e){null==i||i.natively.trigger(void 0,0,void 0,"error_screen",{show_error:e})}openLogger(){null==i||i.$agent.natively_logger()}openConsole(){null==i||i.natively.trigger(void 0,22,void 0,"app_console")}closeApp(){null==i||i.natively.trigger(void 0,11,void 0,"app_close")}showProgress(e){null==i||i.natively.trigger(void 0,11,void 0,"app_show_progress",{toggle:e})}shareImage(e){null==i||i.natively.trigger(void 0,0,void 0,"share_image",{url:e})}shareText(e){null==i||i.natively.trigger(void 0,0,void 0,"share_text",{text:e})}shareTextAndImage(e,t){null==i||i.natively.trigger(void 0,0,void 0,"share_text_and_image",{url:t,text:e})}shareFile(e){null==i||i.natively.trigger(void 0,2,void 0,"share_file",{url:e})}openExternalURL(e,t){const l={url:void 0===e?"https://buildnatively.com":e,view:void 0!==t&&t?"external":"web"};null==i||i.natively.trigger(void 0,18,void 0,"open_link",l)}openExternalApp(e){null==i||i.natively.trigger(void 0,22,void 0,"open_app",{url:e})}showAppToast(e,t){null==i||i.natively.trigger(void 0,0,void 0,"show_toast",{text:t||"",type:e||"DEFAULT"})}showAppBanner(e,t,l){null==i||i.natively.trigger(void 0,0,void 0,"show_banner",{type:e||"INFO",title:t||"",description:l||""})}analyticsTrackEvent(e,t){const l={name:e};t&&(l.data=t),null==i||i.natively.trigger(void 0,37,void 0,"analytics_log_event",l)}analyticsSetUserId(e){const t={id:e.id};null==i||i.natively.trigger(void 0,37,void 0,"analytics_set_user_id",t)}analyticsSetUserProperty(e){const t={key:e.key,value:e.value};null==i||i.natively.trigger(void 0,37,void 0,"analytics_set_user_property",t)}requestAppReview(){null==i||i.natively.trigger(void 0,0,void 0,"request_review")}attShowPopup(e){null==i||i.natively.trigger(void 0,41,e,"att_show_popup")}attGetStatus(e){null==i||i.natively.trigger(void 0,41,e,"att_get_status")}getInsets(e){null==i||i.natively.trigger(void 0,36,e,"get_insets")}getLocales(e){null==i||i.natively.trigger(void 0,40,e,"get_locales")}setLocale(e,t){null==i||i.natively.trigger(void 0,40,t,"set_locale",{locale:e})}setAppBackgroundColor(e){null==i||i.natively.trigger(void 0,1,void 0,"app_background",{color:e})}setAppProgressColor(e){null==i||i.natively.trigger(void 0,1,void 0,"app_progress",{color:e})}setAppSwipeNavigation(e){null==i||i.natively.trigger(void 0,22,void 0,"app_navigation",{toggle:e})}setAppPullToRefresh(e){null==i||i.natively.trigger(void 0,1,void 0,"app_pull",{toggle:e})}setAppOrientation(e){null==i||i.natively.trigger(void 0,3,void 0,"app_orientation",{orientation:e})}setAppStatusBarStyle(e){null==i||i.natively.trigger(void 0,22,void 0,"status_bar_style",{style:e})}hideLoadingScreen(){null==i||i.natively.trigger(void 0,17,void 0,"loading_screen",{show_loader:!1,auto_hide:!0})}showLoadingScreen(e){null==i||i.natively.trigger(void 0,17,void 0,"loading_screen",{show_loader:!0,auto_hide:e||!1})}openAppSettings(){null==i||i.natively.trigger(void 0,0,void 0,"open_appsettings")}showTabBar(){null==i||i.natively.trigger(void 0,33,void 0,"show_tab_bar")}enableWakelock(){null==i||i.natively.trigger(void 0,34,void 0,"wakelock_enable")}disableWakelock(){null==i||i.natively.trigger(void 0,34,void 0,"wakelock_disable")}hideTabBar(){null==i||i.natively.trigger(void 0,33,void 0,"hide_tab_bar")}reloadWebview(){null==i||i.natively.trigger(void 0,35,void 0,"reset_webview")}getBatteryInfo(e){null==i||i.natively.trigger(void 0,43,e,"battery_info")}hapticPattern(e,t){null==i||i.natively.trigger(void 0,22,void 0,"haptic_pattern",{pattern:e,delay:t})}openPDF(e,t){const l={url:e.url||"",base64:e.base64||"",fileName:e.fileName||`pdf-${(new Date).getTime()}.pdf`,download:!0===e.download};null==i||i.natively.trigger(void 0,38,t,"open_pdf",l)}hapticImpact(e){null==i||i.natively.trigger(void 0,22,void 0,"haptic_impact",{type:e})}hapticNotification(e){null==i||i.natively.trigger(void 0,22,void 0,"haptic_notification",{type:e})}}const n=()=>Date.now().toString(36)+Math.random().toString(36).substring(2);class r{constructor(){this.id=n()}signin(e){null==i||i.natively.trigger(this.id,16,e,"apple_signin",{})}}class s{constructor(){this.id=n()}copy(e){null==i||i.natively.trigger(void 0,11,void 0,"clipboard_copy",{text:e})}paste(e){null==i||i.natively.trigger(this.id,11,e,"clipboard_paste")}}class o{constructor(){this.id=n()}browserInfo(){var e,t,l,a;return{isNativeApp:void 0!==(null==i?void 0:i.$agent),isIOSApp:(null===(t=null===(e=null==i?void 0:i.navigator)||void 0===e?void 0:e.userAgent)||void 0===t?void 0:t.includes("Natively/iOS"))||!1,isAndroidApp:(null===(a=null===(l=null==i?void 0:i.navigator)||void 0===l?void 0:l.userAgent)||void 0===a?void 0:a.includes("Natively/Android"))||!1}}getAppInfo(e){(null==i?void 0:i.natively)&&(null==i||i.natively.trigger(this.id,0,e,"app_info"))}connectivity(e){(null==i?void 0:i.natively)&&(null==i||i.natively.trigger(void 0,0,e,"connectivity"))}app_state(e){(null==i?void 0:i.natively)&&(null==i||i.natively.trigger(void 0,19,e,"app_state"))}keyboard_visibility(e){(null==i?void 0:i.natively)&&(null==i||i.natively.trigger(void 0,34,e,"keyboard_visibility"))}}class d{constructor(){this.id=n()}getOneSignalId(e){null==i||i.natively.trigger(this.id,0,e,"onesignal_playerid")}requestPermission(e,t){null==i||i.natively.trigger(this.id,0,t,"push_register",{fallbackToSettings:e})}getPermissionStatus(e){null==i||i.natively.trigger(this.id,0,e,"push_permission")}getExternalId(e){null==i||i.natively.trigger(this.id,0,e,"onesignal_externalid")}setExternalId(e,t){null==i||i.natively.trigger(this.id,0,t,"onesignal_setexternalid",e)}removeExternalId(e){null==i||i.natively.trigger(this.id,0,e,"onesignal_removeexternalid")}}class u{constructor(){this.id=n()}getUserGeolocation(e,t){null==i||i.natively.trigger(this.id,0,t,"geolocation",{distance:e})}requestPermission(e){null==i||i.natively.trigger(this.id,0,e,"geo_register")}getPermissionStatus(e){null==i||i.natively.trigger(this.id,0,e,"geo_permission")}}class v{constructor(){this.id=n()}current(e,t,l,a,n=!0){null==i||i.natively.trigger(this.id,12,a,"location_current",{minAccuracy:e,accuracyType:t,priority:l,fallbackToSettings:n})}permission(e){null==i||i.natively.trigger(this.id,6,e,"location_permission")}start(e,t,l,a,n,r=!0){null==i||i.natively.trigger(this.id,12,n,"location_start",{minAccuracy:t,accuracyType:l,priority:a,fallbackToSettings:r,interval:e})}stop(){null==i||i.natively.trigger(this.id,3,void 0,"location_stop",{})}startBackground(e,t,l,a,n,r,s=!0){const o={identifier:null!=n?n:"empty",interval:null!=e?e:6e4,minAccuracy:null!=t?t:50,accuracyType:null!=l?l:"Best",priority:null!=a?a:"BALANCED",fallbackToSettings:s};null==i||i.natively.trigger(this.id,12,r,"location_start_bg",o)}statusBackground(e){null==i||i.natively.trigger(this.id,20,e,"location_status_bg",{})}stopBackground(e){null==i||i.natively.trigger(this.id,4,e,"location_stop_bg",{})}}class g{constructor(){this.id=n()}sendSMS(e,t,l){const a={body:null!=e?e:"",recipient:null!=t?t:""};null==i||i.natively.trigger(this.id,0,l,"send_sms",a)}sendEmail(e,t,l,a){const n={subject:null!=e?e:"",body:null!=t?t:"",recipient:null!=l?l:""};null==i||i.natively.trigger(this.id,0,a,"send_email",n)}}class c{constructor(){this.id=n()}setStorageValue(e,t){null==i||i.natively.trigger(this.id,0,void 0,"set_storage_value",{key:e,value:t})}getStorageValue(e,t){null==i||i.natively.trigger(this.id,0,t,"get_storage_value",{key:e})}removeStorageValue(e){null==i||i.natively.trigger(this.id,0,void 0,"remove_storage_value",{key:e})}resetStorage(){null==i||i.natively.trigger(this.id,0,void 0,"reset_storage")}}class y{constructor(e){this.id=n(),this.allowPass=e}checkBiometricsSupport(e){null==i||i.natively.trigger(this.id,0,e,"biometrics_support",{allowPass:this.allowPass})}checkCredentials(e){null==i||i.natively.trigger(this.id,0,e,"biometrics_has_credentials")}verifyUserIdentify(e){null==i||i.natively.trigger(this.id,0,e,"biometrics_verify",{allowPass:this.allowPass})}getUserCredentials(e){null==i||i.natively.trigger(this.id,0,e,"biometrics_auth",{allowPass:this.allowPass})}removeUserCredentials(e){null==i||i.natively.trigger(this.id,0,e,"biometrics_remove_credentials")}saveUserCredentials(e,t,l){null==i||i.natively.trigger(this.id,0,l,"biometrics_auth",{allowPass:this.allowPass,login:e,password:t})}}class p{constructor(){this.id=n()}showDatePicker(e,t,l,a,n){const r={type:null!=l?l:"DATE",style:null!=a?a:"LIGHT",title:null!=e?e:"",description:null!=t?t:""};null==i||i.natively.trigger(this.id,0,n,"datepicker",r)}}class h{constructor(){this.id=n()}showCamera(e,t,l,a){const n={type:null!=e?e:"photo",quality:null!=t?t:"high",camera:null!=l?l:"BACK"};null==i||i.natively.trigger(this.id,2,a,"open_camera",n)}}class _{constructor(){this.id=n()}available(e){null==i||i.natively.trigger(this.id,10,e,"health_available",{})}requestAuthorization(e,t,l){null==i||i.natively.trigger(this.id,10,l,"health_register",{write_data_types:e,read_data_types:t})}permissionStatus(e,t){null==i||i.natively.trigger(this.id,10,t,"health_permission",{data_type:e})}getAllCharacteristics(e){null==i||i.natively.trigger(this.id,10,e,"health_get_all_characteristics",{})}getStatisticQuantity(e,t,l,a,n){const r={data_type:e,interval:t};l&&(r.start_date=l.getTime()),a&&(r.end_date=a.getTime()),null==i||i.natively.trigger(this.id,10,n,"health_get_statistic_quantity",r)}getDailySleepAnalysis(e,t,l,a){const n={limit:l||100};e&&(n.start_date=e.getTime()),t&&(n.end_date=t.getTime()),null==i||i.natively.trigger(this.id,10,a,"health_get_daily_sleep_analysis",n)}getWorkouts(e,t,l,a){const n={limit:l||100};e&&(n.start_date=e.getTime()),t&&(n.end_date=t.getTime()),null==i||i.natively.trigger(this.id,21,a,"health_get_workouts",n)}getHealthConnectStatus(e){null==i||i.natively.trigger(this.id,40,e,"health_connect_status",{})}installHealthConnect(e){null==i||i.natively.trigger(this.id,40,e,"health_connect_install",{})}writeWorkout(e,t){const l=Object.assign({},e);(null==e?void 0:e.start_date)instanceof Date&&(l.start_date=e.start_date.getTime()),(null==e?void 0:e.end_date)instanceof Date&&(l.end_date=e.end_date.getTime()),null==i||i.natively.trigger(this.id,39,t,"health_write_workout",l)}writeNutrition(e,t){const l=Object.assign({},e);(null==e?void 0:e.start_date)instanceof Date&&(l.start_date=e.start_date.getTime()),(null==e?void 0:e.end_date)instanceof Date&&(l.end_date=e.end_date.getTime()),Array.isArray(null==e?void 0:e.items)&&(l.items=e.items.map((e=>{const t=Object.assign({},e);return(null==e?void 0:e.start_date)instanceof Date&&(t.start_date=e.start_date.getTime()),(null==e?void 0:e.end_date)instanceof Date&&(t.end_date=e.end_date.getTime()),t}))),null==i||i.natively.trigger(this.id,39,t,"health_write_nutrition",l)}getActivitySummary(e,t,l){const a={};e&&(a.start_date=e.getTime()),t&&(a.end_date=t.getTime()),null==i||i.natively.trigger(this.id,10,l,"health_get_activity_summary",a)}}class b{constructor(){this.id=n()}showScanner(e){null==i||i.natively.trigger(this.id,2,e,"open_scanner",{})}showDocumentScanner(e,t,l,a,n,r,s,o,d,u,v,g,c){const y={};o&&(y.source=o),n&&(y.menuColor=n),u&&(y.pageMode=u),null==e||isNaN(e)||(y.jpegQuality=e),a&&(y.highlightColor=a),t&&(y.foregroundColor=t),l&&(y.backgroundColor=l),r&&(y.defaultFlashMode=r),s&&(y.defaultScanOrientation=s),v&&(y.defaultFilter=v),g&&(y.availableFilters=g),d&&(y.ocrConfiguration={languages:[d]}),null==i||i.natively.trigger(this.id,21,c,"open_document_scanner",y)}}class m{constructor(){this.id=n()}login(e,t,l){const a=null!=t?t:"";null==i||i.natively.trigger(this.id,3,l,"purchases_login",{login:e,email:a})}logout(e){null==i||i.natively.trigger(this.id,3,e,"purchases_logout",{})}customerId(e){null==i||i.natively.trigger(this.id,3,e,"purchases_customerid",{})}restore(e){null==i||i.natively.trigger(this.id,10,e,"purchases_restore",{})}showPaywall(e,t,l){const a={offeringId:t,shouldShowCloseButton:e};null==i||i.natively.trigger(this.id,38,l,"purchases_show_paywall",a)}showPaywallIfNeeded(e,t,l,a){const n={offeringName:l,entitlementId:e,shouldShowCloseButton:t};null==i||i.natively.trigger(this.id,38,a,"purchases_show_paywall_if_needed",n)}purchasePackage(e,t,l,a){null==i||i.natively.trigger(this.id,3,t,"purchases_package",{packageId:e,oldProductId:null!=l?l:null,prorationMode:null!=a?a:null})}packagePrice(e,t){null==i||i.natively.trigger(this.id,8,t,"purchases_price",{packageId:e})}showCustomerCenter(e){null==i||i.natively.trigger(this.id,42,e,"purchases_show_customer_center",{})}}class f{constructor(){this.id=n()}getAllContacts(e){null==i||i.natively.trigger(this.id,3,e,"contacts_all",{})}createContact(e,t,l,a,n){const r={firstName:e,lastName:null!=t?t:"",email:null!=l?l:"",phone:null!=a?a:""};null==i||i.natively.trigger(this.id,3,n,"contacts_save",r)}}class w{constructor(){this.id=n()}showMediaPicker(e){null==i||i.natively.trigger(this.id,8,e,"mediapicker",{})}}class N{constructor(){this.id=n()}showRecorder(e,t){const l={max_duration:null!=e?e:0};null==i||i.natively.trigger(this.id,13,t,"record_start",l)}}class A{constructor(){this.id=n()}buildMetadata(e){const t={};return e?(void 0!==e.id&&(t.id=e.id),void 0!==e.title&&(t.title=e.title),void 0!==e.artist&&(t.artist=e.artist),void 0!==e.album&&(t.album=e.album),void 0!==e.genre&&(t.genre=e.genre),void 0!==e.artwork&&(t.artwork=e.artwork),null!=e.duration&&(t.duration=e.duration),void 0!==e.extras&&(t.extras=e.extras),t):t}play(e,t,l){var a,n;const r=Object.assign({source:e,is_stream:null!==(a=null==t?void 0:t.is_stream)&&void 0!==a&&a,autoplay:null===(n=null==t?void 0:t.autoplay)||void 0===n||n},this.buildMetadata(t));void 0!==(null==t?void 0:t.headers)&&(r.headers=t.headers),null!=(null==t?void 0:t.start_position)&&(r.start_position=t.start_position),null!=(null==t?void 0:t.volume)&&(r.volume=t.volume),null!=(null==t?void 0:t.speed)&&(r.speed=t.speed),null==i||i.natively.trigger(this.id,39,l,"audio_play",r)}pause(e){null==i||i.natively.trigger(this.id,39,e,"audio_pause",{})}stop(e){null==i||i.natively.trigger(this.id,39,e,"audio_stop",{})}seek(e,t){null==i||i.natively.trigger(this.id,39,t,"audio_seek",{position:e})}queueAdd(e,t,l){var a,n;const r=Object.assign({source:e,play_now:null!==(a=null==t?void 0:t.play_now)&&void 0!==a&&a,is_stream:null!==(n=null==t?void 0:t.is_stream)&&void 0!==n&&n},this.buildMetadata(t));void 0!==(null==t?void 0:t.headers)&&(r.headers=t.headers),null==i||i.natively.trigger(this.id,39,l,"audio_queue_add",r)}queueGet(e){null==i||i.natively.trigger(this.id,39,e,"audio_queue_get",{})}queueRemove(e,t){null==i||i.natively.trigger(this.id,39,t,"audio_queue_remove",{index:e})}setMetadata(e,t){const l=this.buildMetadata(e);null==i||i.natively.trigger(this.id,39,t,"audio_set_metadata",l)}setVolume(e,t){null==i||i.natively.trigger(this.id,39,t,"audio_set_volume",{volume:e})}setSpeed(e,t){null==i||i.natively.trigger(this.id,39,t,"audio_set_speed",{speed:e})}}class k{constructor(e,t,l=!1,a,r=!1,s){var o,d,u,v,g,c;this.id=n();const y={};(null==i?void 0:i.natively.isAndroidApp)?y.unitId=null!==(o=e.androidUnitId)&&void 0!==o?o:"ca-app-pub-3940256099942544/6300978111":(null==i?void 0:i.natively.isIOSApp)&&(y.unitId=null!==(d=e.iOSUnitId)&&void 0!==d?d:"ca-app-pub-3940256099942544/2934735716"),y.position=null!==(u=e.position)&&void 0!==u?u:"BOTTOM",y.sizeType=null!==(v=e.sizeType)&&void 0!==v?v:"AUTO",y.width=null!==(g=e.custom_width)&&void 0!==g?g:320,y.height=null!==(c=e.custom_height)&&void 0!==c?c:50,null==i||i.natively.trigger(this.id,14,(e=>{null==t||t(e),l&&(null==i||i.natively.trigger(this.id,14,(e=>{null==a||a(e),r&&(null==i||i.natively.trigger(this.id,14,s,"bannerad_show",{}))}),"bannerad_load",{}))}),"bannerad_setup",y)}loadAd(e){null==i||i.natively.trigger(this.id,14,e,"bannerad_load",{})}showBanner(e){null==i||i.natively.trigger(this.id,14,e,"bannerad_show",{})}hideBanner(e){null==i||i.natively.trigger(this.id,14,e,"bannerad_hide",{})}bannerIsReady(e){null==i||i.natively.trigger(this.id,14,e,"bannerad_ready",{})}bannerIsVisible(e){null==i||i.natively.trigger(this.id,14,e,"bannerad_visible",{})}}class S{constructor(e="ca-app-pub-3940256099942544/4411468910",t="ca-app-pub-3940256099942544/1033173712",l,a=!1,r){this.id=n(),(null==i?void 0:i.natively.isAndroidApp)?this.unitId=t:(null==i?void 0:i.natively.isIOSApp)&&(this.unitId=e),this.auto_ad_reload=a,this.auto_ad_reload_callback=r,this.loadAd(l)}loadAd(e){var t;const l={unitId:null!==(t=this.unitId)&&void 0!==t?t:"ca-app-pub-3940256099942544/4411468910"};null==i||i.natively.trigger(this.id,14,e,"interstitialad_setup",l)}showInterstitialAd(e){null==i||i.natively.trigger(this.id,14,(t=>{e(t),"DID_DISMISS_AD"===t.event&&this.auto_ad_reload&&setTimeout((()=>{this.loadAd(this.auto_ad_reload_callback)}),500)}),"interstitialad_show",{})}interstitialIsReady(e){null==i||i.natively.trigger(this.id,14,e,"interstitialad_ready",{})}}class T{constructor(e,t,i,l){this.id=n(),this.readAlertMessage=e,this.writeAlertMessage=t,this.readDetectedMessage=i,this.writeDetectedMessage=l}read(e){var t,l;const a={alertMessage:null!==(t=this.readAlertMessage)&&void 0!==t?t:"please set readAlertMessage",detectedMessage:null!==(l=this.readDetectedMessage)&&void 0!==l?l:"readDetectedMessage"};null==i||i.natively.trigger(this.id,15,e,"nfc_read",a)}write(e,t,l,a){var n,r;const s={alertMessage:null!==(n=this.writeAlertMessage)&&void 0!==n?n:"please set writeAlertMessage",detectedMessage:null!==(r=this.writeDetectedMessage)&&void 0!==r?r:"please set writeDetectedMessage",recordData:null!=t?t:"please set recordData",recordId:null!=e?e:"please set recordId",recordDataType:null!=l?l:"please set recordDataType"};null==i||i.natively.trigger(this.id,15,a,"nfc_write",s)}available(e){null==i||i.natively.trigger(this.id,15,e,"nfc_available",{})}}class I{constructor(){this.id=n()}firebase_get_token(e){null==i||i.natively.trigger(this.id,31,e,"firebase_get_token")}firebase_get_apns_token(e){null==i||i.natively.trigger(this.id,31,e,"firebase_get_apns_token")}firebase_request_permission(e){null==i||i.natively.trigger(this.id,31,e,"firebase_request_permission")}firebase_has_permission(e){null==i||i.natively.trigger(this.id,31,e,"firebase_has_permission")}firebase_subscribe_to_topic(e,t){null==i||i.natively.trigger(this.id,31,t,"firebase_subscribe_to_topic",{topic:e})}firebase_unsubscribe_from_topic(e,t){null==i||i.natively.trigger(this.id,31,t,"firebase_unsubscribe_from_topic",{topic:e})}}class P{constructor(){this.id=n()}setProfile(e,t){null==i||i.natively.trigger(this.id,32,t,"klaviyo_set_profile",e)}getExternalId(e){null==i||i.natively.trigger(this.id,32,e,"klaviyo_external_id")}resetProfile(e){null==i||i.natively.trigger(this.id,32,e,"klaviyo_reset_profile")}registerToken(e,t){null==i||i.natively.trigger(this.id,32,e,"klaviyo_register_token",{token:t})}pushPermission(e){null==i||i.natively.trigger(this.id,32,e,"klaviyo_push_permission")}pushRegister(e){null==i||i.natively.trigger(this.id,32,e,"klaviyo_push_register")}}class D{constructor(){this.id=n()}createCalendarEvent(e,t,l,a,n,r,s){const o={title:e,timezone:a,calendarId:n,description:r,endDate:null==t?void 0:t.toISOString(),startDate:l.toISOString()};null==i||i.natively.trigger(void 0,37,s,"calendar_event",o)}retrieveCalendars(e){null==i||i.natively.trigger(void 0,37,e,"retrieve_calendars",{})}}class C{constructor(){this.id=n()}requestPermission(e){null==i||i.natively.trigger(this.id,45,e,"live_update_permission",{})}start(e,t){null==i||i.natively.trigger(this.id,45,t,"live_update_setup",e)}update(e,t){null==i||i.natively.trigger(this.id,45,t,"live_update_update",e)}end(e,t){null==i||i.natively.trigger(this.id,45,t,"live_update_end",e)}}class M{constructor(){this.id=n()}setActions(e,t){null==i||i.natively.trigger(this.id,46,t,"quick_actions",{actions:e.map((e=>this.normalizeAction(e)))})}clear(e){null==i||i.natively.trigger(this.id,46,e,"clear_quick_actions",{})}normalizeAction(e){const t={type:e.type,url:e.url};return void 0!==e.title&&(t.title=e.title),void 0!==e.subtitle&&(t.subtitle=e.subtitle),void 0!==e.is_enabled&&(t.is_enabled=e.is_enabled),void 0!==e.icon&&(t.icon=e.icon),void 0!==e.ios_icon&&(t.ios_icon=e.ios_icon),void 0!==e.android_icon&&(t.android_icon=e.android_icon),t}}const O=()=>null==i?void 0:i.natively,E=e=>{var t,i,a,n,r;if(e.__nativelyNavigationProgressInstalled)return;e.__nativelyNavigationProgressInstalled=!0;let s=null,o=null,d=null,u=!1;const v=(t,i)=>{var l,a;null===(l=e.natively)||void 0===l||l.trigger(void 0,0,void 0,"web_navigation_progress",{phase:t,reason:i,href:null===(a=e.location)||void 0===a?void 0:a.href})},g=()=>{s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null)},c=()=>{null==d||d.disconnect(),d=null},y=t=>{g(),c(),(t=>{var i,a;u||(u=!0,null===(i=e.natively)||void 0===i||i.trigger(void 0,0,void 0,"web_sdk_version",{version:l,reason:t,href:null===(a=e.location)||void 0===a?void 0:a.href}))})(t),v("done",t)},p=()=>{s&&clearTimeout(s),s=setTimeout((()=>y("settled")),250)},h=(t,i=3e3)=>{g(),v("start",t),(()=>{var t;c();const i=null===(t=e.document)||void 0===t?void 0:t.documentElement;if(!i||"function"!=typeof e.MutationObserver)return void p();const l=new e.MutationObserver((()=>p()));l.observe(i,{subtree:!0,childList:!0,attributes:!0,characterData:!0}),d=l,p()})(),o=setTimeout((()=>y("timeout")),i)},_=t=>{var i;const l=null===(i=e.history)||void 0===i?void 0:i[t];"function"==typeof l&&(e.history[t]=function(...e){return h(t,1500),l.apply(this,e)})};_("pushState"),_("replaceState"),null===(t=e.addEventListener)||void 0===t||t.call(e,"popstate",(()=>h("popstate",1500))),null===(i=e.addEventListener)||void 0===i||i.call(e,"hashchange",(()=>h("hashchange",800))),null===(a=e.document)||void 0===a||a.addEventListener("click",(e=>{const t=e.target;if(!t||"function"!=typeof t.closest)return;const i=t.closest("a[href]");if(!i)return;const l=i.getAttribute("href")||"";if(!l||l.startsWith("#")||l.startsWith("javascript:"))return;const a=i.getAttribute("target");a&&"_self"!==a||h("anchor",4e3)}),!0),"complete"===(null===(n=e.document)||void 0===n?void 0:n.readyState)?y("ready"):null===(r=e.addEventListener)||void 0===r||r.call(e,"load",(()=>y("load")),{once:!0})};if(i){const e=(e=>{var t,i;if("function"==typeof(null===(t=e.$agent)||void 0===t?void 0:t.trigger))return!0;const l=(e=>{try{return e.self!==e.top}catch(e){return!0}})(e),a="function"==typeof(null===(i=e.flutter_inappwebview)||void 0===i?void 0:i.callHandler);if(!l&&!a)return!1;const n={__nativelyAgent:!0,trigger(t,i){var a,n;const r=JSON.stringify({trigger:{name:t,data:i}});"function"!=typeof(null===(a=e.flutter_inappwebview)||void 0===a?void 0:a.callHandler)?l&&"function"==typeof(null===(n=e.parent)||void 0===n?void 0:n.postMessage)&&e.parent.postMessage({source:"natively-webview",handlerName:"💙",args:[r]},"*"):e.flutter_inappwebview.callHandler("💙",r)},response(){},natively_logger(){this.trigger("natively_logger")}};return e.$agent=n,e.natively=e.natively||n,l&&"function"==typeof e.addEventListener&&e.addEventListener("message",(t=>{const i=t.data||{};"natively-flutter"===i.source&&"evaluate"===i.type&&"string"==typeof i.script&&e.eval(i.script)})),!0})(i);i.natively&&!i.natively.__nativelyAgent||(i.natively=new a),i.natively.injected=e,e&&!i.natively.app_version&&(i.natively.app_version=Number.MAX_SAFE_INTEGER),i.natively.sdkVersion=l,e&&E(i),i.NativelyAdmobBanner=k,i.NativelyAdmobInterstitial=S,i.NativelyAppleSignInService=r,i.NativelyAudioRecorder=N,i.NativelyAudioPlayer=A,i.NativelyBiometrics=y,i.NativelyCamera=h,i.NativelyClipboard=s,i.NativelyContacts=f,i.NativelyDatePicker=p,i.NativelyGeolocation=u,i.NativelyHealth=_,i.NativelyInfo=o,i.NativelyLocation=v,i.NativelyMediaPicker=w,i.NativelyMessage=g,i.NativelyNFCService=T,i.NativelyNotifications=d,i.NativelyPurchases=m,i.NativelyScanner=b,i.NativelyStorage=c,i.NativelyCalendar=D,i.NativelyFirebaseNotifications=I,i.NativelyKlaviyoNotifications=P,i.NativelyLiveUpdates=C}null==i||i.natively.addObserver((()=>null==i?void 0:i.natively.trigger(void 0,0,(e=>{i&&(i.natively.min_app_version=e.minSDKVersion,i.natively.app_version=e.sdkVersion)}),"app_info",{})))})();
1
+ (()=>{"use strict";var e={d:(i,t)=>{for(var l in t)e.o(t,l)&&!e.o(i,l)&&Object.defineProperty(i,l,{enumerable:!0,get:t[l]})}};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),e.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),e.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};e.r(i),e.d(i,{Natively:()=>l,NativelyAdmobBanner:()=>A,NativelyAdmobInterstitial:()=>S,NativelyAppleSignInService:()=>n,NativelyAudioPlayer:()=>N,NativelyAudioRecorder:()=>w,NativelyBiometrics:()=>c,NativelyCalendar:()=>C,NativelyCamera:()=>_,NativelyClipboard:()=>r,NativelyContacts:()=>m,NativelyDatePicker:()=>y,NativelyFirebaseNotifications:()=>I,NativelyGeolocation:()=>d,NativelyHealth:()=>h,NativelyInfo:()=>s,NativelyKlaviyoNotifications:()=>T,NativelyLocation:()=>u,NativelyMediaPicker:()=>f,NativelyMessage:()=>g,NativelyNFCService:()=>k,NativelyNotifications:()=>o,NativelyPurchases:()=>b,NativelyScanner:()=>p,NativelyStorage:()=>v,generateID:()=>a,useNatively:()=>D});const t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e.g?e.g:null;class l{constructor(){var e,i,l,a;this.isDebug=!1,this.min_app_version=0,this.app_version=0,this.injected=!1,this.observers=[],this.onNativeError=null,this.onTabChanged=null,this.isIOSApp=(null===(i=null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.userAgent)||void 0===i?void 0:i.includes("Natively/iOS"))||!1,this.isAndroidApp=(null===(a=null===(l=null==t?void 0:t.navigator)||void 0===l?void 0:l.userAgent)||void 0===a?void 0:a.includes("Natively/Android"))||!1}setDebug(e){t&&(t.natively.isDebug=e)}notify(e,i){t&&(t.natively.injected=!0,e&&(t.natively.min_app_version=e),i&&(t.natively.app_version=i));const l=null==t?void 0:t.natively.observers;for((null==t?void 0:t.natively.isDebug)&&console.log("[INFO] Notify observers: ",l.length);l.length>0;){const e=l.shift();null==e||e()}}addObserver(e){(null==t?void 0:t.natively.injected)?e():((null==t?void 0:t.natively.isDebug)&&console.log(`[DEBUG] addObserver: ${e}`),null==t||t.natively.observers.push(e))}trigger(e,i,l,a,n){const r=null==t?void 0:t.natively.isDebug;if(null==t?void 0:t.natively.injected)if(i>(null==t?void 0:t.natively.app_version))r&&alert(`[ERROR] Please rebuild the app to use this functionality. App Version: ${null==t?void 0:t.natively.app_version}, feature version: ${i}`);else{if(l){let i;i=e?a+"_response_"+e:a+"_response",t&&(t[i]=function(a,n){null==t||t.$agent.response(),(null==n?void 0:n.message)&&r?alert(`[ERROR] Error message: ${n.message}`):(r&&console.log(`[DEBUG] Callback method: ${i}, body: ${JSON.stringify(a)}, respId: ${e}`),l(a,n))}),n?n.response_id=e:n={response_id:e}}r&&console.log(`[DEBUG] Trigger method: ${a}, body: ${JSON.stringify(n)}`),null==t||t.$agent.trigger(a,n)}else null==t||t.natively.addObserver((()=>{null==t||t.natively.trigger(e,i,l,a,n)}))}setTabChangedHandler(e){"function"==typeof e?this.onTabChanged=e:console.warn("[Natively] Tab changed handler must be a function")}removeTabChangedHandler(){this.onTabChanged=null}setErrorHandler(e){"function"==typeof e&&(this.onNativeError=e)}removeErrorHandler(){this.onNativeError=null}setErrorScreen(e){null==t||t.natively.trigger(void 0,0,void 0,"error_screen",{show_error:e})}openLogger(){null==t||t.$agent.natively_logger()}openConsole(){null==t||t.natively.trigger(void 0,22,void 0,"app_console")}closeApp(){null==t||t.natively.trigger(void 0,11,void 0,"app_close")}showProgress(e){null==t||t.natively.trigger(void 0,11,void 0,"app_show_progress",{toggle:e})}shareImage(e){null==t||t.natively.trigger(void 0,0,void 0,"share_image",{url:e})}shareText(e){null==t||t.natively.trigger(void 0,0,void 0,"share_text",{text:e})}shareTextAndImage(e,i){null==t||t.natively.trigger(void 0,0,void 0,"share_text_and_image",{url:i,text:e})}shareFile(e){null==t||t.natively.trigger(void 0,2,void 0,"share_file",{url:e})}openExternalURL(e,i){const l={url:void 0===e?"https://buildnatively.com":e,view:void 0!==i&&i?"external":"web"};null==t||t.natively.trigger(void 0,18,void 0,"open_link",l)}openExternalApp(e){null==t||t.natively.trigger(void 0,22,void 0,"open_app",{url:e})}showAppToast(e,i){null==t||t.natively.trigger(void 0,0,void 0,"show_toast",{text:i||"",type:e||"DEFAULT"})}showAppBanner(e,i,l){null==t||t.natively.trigger(void 0,0,void 0,"show_banner",{type:e||"INFO",title:i||"",description:l||""})}analyticsTrackEvent(e,i){const l={name:e};i&&(l.data=i),null==t||t.natively.trigger(void 0,37,void 0,"analytics_log_event",l)}analyticsSetUserId(e){const i={user_id:e.id};null==t||t.natively.trigger(void 0,37,void 0,"analytics_set_customer_user_id",i)}analyticsSetUserProperty(e){const i={key:e.key,value:e.value};null==t||t.natively.trigger(void 0,37,void 0,"analytics_set_user_property",i)}analyticsSetCustomerUserId(e){const i={user_id:e.user_id};null==t||t.natively.trigger(void 0,37,void 0,"analytics_set_customer_user_id",i)}analyticsSetCustomerIdAndLogSession(e){const i={user_id:e.user_id};null==t||t.natively.trigger(void 0,37,void 0,"analytics_set_customer_id_and_log_session",i)}analyticsWaitForCustomerUserId(e){const i={wait:e.wait};null==t||t.natively.trigger(void 0,37,void 0,"analytics_wait_for_customer_user_id",i)}requestAppReview(){null==t||t.natively.trigger(void 0,0,void 0,"request_review")}attShowPopup(e){null==t||t.natively.trigger(void 0,41,e,"att_show_popup")}attGetStatus(e){null==t||t.natively.trigger(void 0,41,e,"att_get_status")}getInsets(e){null==t||t.natively.trigger(void 0,36,e,"get_insets")}getLocales(e){null==t||t.natively.trigger(void 0,40,e,"get_locales")}setLocale(e,i){null==t||t.natively.trigger(void 0,40,i,"set_locale",{locale:e})}setAppBackgroundColor(e){null==t||t.natively.trigger(void 0,1,void 0,"app_background",{color:e})}setAppProgressColor(e){null==t||t.natively.trigger(void 0,1,void 0,"app_progress",{color:e})}setAppSwipeNavigation(e){null==t||t.natively.trigger(void 0,22,void 0,"app_navigation",{toggle:e})}setAppPullToRefresh(e){null==t||t.natively.trigger(void 0,1,void 0,"app_pull",{toggle:e})}setAppOrientation(e){null==t||t.natively.trigger(void 0,3,void 0,"app_orientation",{orientation:e})}setAppStatusBarStyle(e){null==t||t.natively.trigger(void 0,22,void 0,"status_bar_style",{style:e})}hideLoadingScreen(){null==t||t.natively.trigger(void 0,17,void 0,"loading_screen",{show_loader:!1,auto_hide:!0})}showLoadingScreen(e){null==t||t.natively.trigger(void 0,17,void 0,"loading_screen",{show_loader:!0,auto_hide:e||!1})}openAppSettings(){null==t||t.natively.trigger(void 0,0,void 0,"open_appsettings")}showTabBar(){null==t||t.natively.trigger(void 0,33,void 0,"show_tab_bar")}enableWakelock(){null==t||t.natively.trigger(void 0,34,void 0,"wakelock_enable")}disableWakelock(){null==t||t.natively.trigger(void 0,34,void 0,"wakelock_disable")}hideTabBar(){null==t||t.natively.trigger(void 0,33,void 0,"hide_tab_bar")}reloadWebview(){null==t||t.natively.trigger(void 0,35,void 0,"reset_webview")}getBatteryInfo(e){null==t||t.natively.trigger(void 0,43,e,"battery_info")}hapticPattern(e,i){null==t||t.natively.trigger(void 0,22,void 0,"haptic_pattern",{pattern:e,delay:i})}openPDF(e,i){const l={url:e.url||"",base64:e.base64||"",fileName:e.fileName||`pdf-${(new Date).getTime()}.pdf`,download:!0===e.download};null==t||t.natively.trigger(void 0,38,i,"open_pdf",l)}hapticImpact(e){null==t||t.natively.trigger(void 0,22,void 0,"haptic_impact",{type:e})}hapticNotification(e){null==t||t.natively.trigger(void 0,22,void 0,"haptic_notification",{type:e})}}const a=()=>Date.now().toString(36)+Math.random().toString(36).substring(2);class n{constructor(){this.id=a()}signin(e){null==t||t.natively.trigger(this.id,16,e,"apple_signin",{})}}class r{constructor(){this.id=a()}copy(e){null==t||t.natively.trigger(void 0,11,void 0,"clipboard_copy",{text:e})}paste(e){null==t||t.natively.trigger(this.id,11,e,"clipboard_paste")}}class s{constructor(){this.id=a()}browserInfo(){var e,i,l,a;return{isNativeApp:void 0!==(null==t?void 0:t.$agent),isIOSApp:(null===(i=null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.userAgent)||void 0===i?void 0:i.includes("Natively/iOS"))||!1,isAndroidApp:(null===(a=null===(l=null==t?void 0:t.navigator)||void 0===l?void 0:l.userAgent)||void 0===a?void 0:a.includes("Natively/Android"))||!1}}getAppInfo(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(this.id,0,e,"app_info"))}connectivity(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(void 0,0,e,"connectivity"))}app_state(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(void 0,19,e,"app_state"))}keyboard_visibility(e){(null==t?void 0:t.natively)&&(null==t||t.natively.trigger(void 0,34,e,"keyboard_visibility"))}}class o{constructor(){this.id=a()}getOneSignalId(e){null==t||t.natively.trigger(this.id,0,e,"onesignal_playerid")}requestPermission(e,i){null==t||t.natively.trigger(this.id,0,i,"push_register",{fallbackToSettings:e})}getPermissionStatus(e){null==t||t.natively.trigger(this.id,0,e,"push_permission")}getExternalId(e){null==t||t.natively.trigger(this.id,0,e,"onesignal_externalid")}setExternalId(e,i){null==t||t.natively.trigger(this.id,0,i,"onesignal_setexternalid",e)}removeExternalId(e){null==t||t.natively.trigger(this.id,0,e,"onesignal_removeexternalid")}requestLiveUpdatePermission(e){null==t||t.natively.trigger(this.id,0,e,"live_update_permission")}setupLiveUpdate(e,i){null==t||t.natively.trigger(this.id,0,i,"live_update_setup",e)}startLiveUpdate(e,i){this.setupLiveUpdate(e,i)}updateLiveUpdate(e,i){null==t||t.natively.trigger(this.id,0,i,"live_update_update",e)}endLiveUpdate(e,i){null==t||t.natively.trigger(this.id,0,i,"live_update_end",e)}}class d{constructor(){this.id=a()}getUserGeolocation(e,i){null==t||t.natively.trigger(this.id,0,i,"geolocation",{distance:e})}requestPermission(e){null==t||t.natively.trigger(this.id,0,e,"geo_register")}getPermissionStatus(e){null==t||t.natively.trigger(this.id,0,e,"geo_permission")}}class u{constructor(){this.id=a()}current(e,i,l,a,n=!0){null==t||t.natively.trigger(this.id,12,a,"location_current",{minAccuracy:e,accuracyType:i,priority:l,fallbackToSettings:n})}permission(e){null==t||t.natively.trigger(this.id,6,e,"location_permission")}start(e,i,l,a,n,r=!0){null==t||t.natively.trigger(this.id,12,n,"location_start",{minAccuracy:i,accuracyType:l,priority:a,fallbackToSettings:r,interval:e})}stop(){null==t||t.natively.trigger(this.id,3,void 0,"location_stop",{})}startBackground(e,i,l,a,n,r,s=!0){const o={identifier:null!=n?n:"empty",interval:null!=e?e:6e4,minAccuracy:null!=i?i:50,accuracyType:null!=l?l:"Best",priority:null!=a?a:"BALANCED",fallbackToSettings:s};null==t||t.natively.trigger(this.id,12,r,"location_start_bg",o)}statusBackground(e){null==t||t.natively.trigger(this.id,20,e,"location_status_bg",{})}stopBackground(e){null==t||t.natively.trigger(this.id,4,e,"location_stop_bg",{})}}class g{constructor(){this.id=a()}sendSMS(e,i,l){const a={body:null!=e?e:"",recipient:null!=i?i:""};null==t||t.natively.trigger(this.id,0,l,"send_sms",a)}sendEmail(e,i,l,a){const n={subject:null!=e?e:"",body:null!=i?i:"",recipient:null!=l?l:""};null==t||t.natively.trigger(this.id,0,a,"send_email",n)}}class v{constructor(){this.id=a()}setStorageValue(e,i){null==t||t.natively.trigger(this.id,0,void 0,"set_storage_value",{key:e,value:i})}getStorageValue(e,i){null==t||t.natively.trigger(this.id,0,i,"get_storage_value",{key:e})}removeStorageValue(e){null==t||t.natively.trigger(this.id,0,void 0,"remove_storage_value",{key:e})}resetStorage(){null==t||t.natively.trigger(this.id,0,void 0,"reset_storage")}}class c{constructor(e){this.id=a(),this.allowPass=e}checkBiometricsSupport(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_support",{allowPass:this.allowPass})}checkCredentials(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_has_credentials")}verifyUserIdentify(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_verify",{allowPass:this.allowPass})}getUserCredentials(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_auth",{allowPass:this.allowPass})}removeUserCredentials(e){null==t||t.natively.trigger(this.id,0,e,"biometrics_remove_credentials")}saveUserCredentials(e,i,l){null==t||t.natively.trigger(this.id,0,l,"biometrics_auth",{allowPass:this.allowPass,login:e,password:i})}}class y{constructor(){this.id=a()}showDatePicker(e,i,l,a,n){const r={type:null!=l?l:"DATE",style:null!=a?a:"LIGHT",title:null!=e?e:"",description:null!=i?i:""};null==t||t.natively.trigger(this.id,0,n,"datepicker",r)}}class _{constructor(){this.id=a()}showCamera(e,i,l,a){const n={type:null!=e?e:"photo",quality:null!=i?i:"high",camera:null!=l?l:"BACK"};null==t||t.natively.trigger(this.id,2,a,"open_camera",n)}}class h{constructor(){this.id=a()}available(e){null==t||t.natively.trigger(this.id,10,e,"health_available",{})}requestAuthorization(e,i,l){null==t||t.natively.trigger(this.id,10,l,"health_register",{write_data_types:e,read_data_types:i})}permissionStatus(e,i){null==t||t.natively.trigger(this.id,10,i,"health_permission",{data_type:e})}getAllCharacteristics(e){null==t||t.natively.trigger(this.id,10,e,"health_get_all_characteristics",{})}getStatisticQuantity(e,i,l,a,n){const r={data_type:e,interval:i};l&&(r.start_date=l.getTime()),a&&(r.end_date=a.getTime()),null==t||t.natively.trigger(this.id,10,n,"health_get_statistic_quantity",r)}getDailySleepAnalysis(e,i,l,a){const n={limit:l||100};e&&(n.start_date=e.getTime()),i&&(n.end_date=i.getTime()),null==t||t.natively.trigger(this.id,10,a,"health_get_daily_sleep_analysis",n)}getWorkouts(e,i,l,a){const n={limit:l||100};e&&(n.start_date=e.getTime()),i&&(n.end_date=i.getTime()),null==t||t.natively.trigger(this.id,21,a,"health_get_workouts",n)}getHealthConnectStatus(e){null==t||t.natively.trigger(this.id,40,e,"health_connect_status",{})}installHealthConnect(e){null==t||t.natively.trigger(this.id,40,e,"health_connect_install",{})}writeWorkout(e,i){const l=Object.assign({},e);(null==e?void 0:e.start_date)instanceof Date&&(l.start_date=e.start_date.getTime()),(null==e?void 0:e.end_date)instanceof Date&&(l.end_date=e.end_date.getTime()),null==t||t.natively.trigger(this.id,39,i,"health_write_workout",l)}writeNutrition(e,i){const l=Object.assign({},e);(null==e?void 0:e.start_date)instanceof Date&&(l.start_date=e.start_date.getTime()),(null==e?void 0:e.end_date)instanceof Date&&(l.end_date=e.end_date.getTime()),Array.isArray(null==e?void 0:e.items)&&(l.items=e.items.map((e=>{const i=Object.assign({},e);return(null==e?void 0:e.start_date)instanceof Date&&(i.start_date=e.start_date.getTime()),(null==e?void 0:e.end_date)instanceof Date&&(i.end_date=e.end_date.getTime()),i}))),null==t||t.natively.trigger(this.id,39,i,"health_write_nutrition",l)}getActivitySummary(e,i,l){const a={};e&&(a.start_date=e.getTime()),i&&(a.end_date=i.getTime()),null==t||t.natively.trigger(this.id,10,l,"health_get_activity_summary",a)}}class p{constructor(){this.id=a()}showScanner(e){null==t||t.natively.trigger(this.id,2,e,"open_scanner",{})}showDocumentScanner(e,i,l,a,n,r,s,o,d,u,g,v,c){const y={};o&&(y.source=o),n&&(y.menuColor=n),u&&(y.pageMode=u),null==e||isNaN(e)||(y.jpegQuality=e),a&&(y.highlightColor=a),i&&(y.foregroundColor=i),l&&(y.backgroundColor=l),r&&(y.defaultFlashMode=r),s&&(y.defaultScanOrientation=s),g&&(y.defaultFilter=g),v&&(y.availableFilters=v),d&&(y.ocrConfiguration={languages:[d]}),null==t||t.natively.trigger(this.id,21,c,"open_document_scanner",y)}}class b{constructor(){this.id=a()}login(e,i,l){const a=null!=i?i:"";null==t||t.natively.trigger(this.id,3,l,"purchases_login",{login:e,email:a})}logout(e){null==t||t.natively.trigger(this.id,3,e,"purchases_logout",{})}customerId(e){null==t||t.natively.trigger(this.id,3,e,"purchases_customerid",{})}restore(e){null==t||t.natively.trigger(this.id,10,e,"purchases_restore",{})}showPaywall(e,i,l){const a={offeringId:i,shouldShowCloseButton:e};null==t||t.natively.trigger(this.id,38,l,"purchases_show_paywall",a)}showPaywallIfNeeded(e,i,l,a){const n={offeringName:l,entitlementId:e,shouldShowCloseButton:i};null==t||t.natively.trigger(this.id,38,a,"purchases_show_paywall_if_needed",n)}purchasePackage(e,i,l,a){null==t||t.natively.trigger(this.id,3,i,"purchases_package",{packageId:e,oldProductId:null!=l?l:null,prorationMode:null!=a?a:null})}packagePrice(e,i){null==t||t.natively.trigger(this.id,8,i,"purchases_price",{packageId:e})}showCustomerCenter(e){null==t||t.natively.trigger(this.id,42,e,"purchases_show_customer_center",{})}getOfferings(e){null==t||t.natively.trigger(this.id,44,e,"purchases_get_offerings",{})}}class m{constructor(){this.id=a()}getAllContacts(e){null==t||t.natively.trigger(this.id,3,e,"contacts_all",{})}createContact(e,i,l,a,n){const r={firstName:e,lastName:null!=i?i:"",email:null!=l?l:"",phone:null!=a?a:""};null==t||t.natively.trigger(this.id,3,n,"contacts_save",r)}}class f{constructor(){this.id=a()}showMediaPicker(e){null==t||t.natively.trigger(this.id,8,e,"mediapicker",{})}}class w{constructor(){this.id=a()}showRecorder(e,i){const l={max_duration:null!=e?e:0};null==t||t.natively.trigger(this.id,13,i,"record_start",l)}}class N{constructor(){this.id=a()}buildMetadata(e){const i={};return e?(void 0!==e.id&&(i.id=e.id),void 0!==e.title&&(i.title=e.title),void 0!==e.artist&&(i.artist=e.artist),void 0!==e.album&&(i.album=e.album),void 0!==e.genre&&(i.genre=e.genre),void 0!==e.artwork&&(i.artwork=e.artwork),null!=e.duration&&(i.duration=e.duration),void 0!==e.extras&&(i.extras=e.extras),i):i}play(e,i,l){var a,n;const r=Object.assign({source:e,is_stream:null!==(a=null==i?void 0:i.is_stream)&&void 0!==a&&a,autoplay:null===(n=null==i?void 0:i.autoplay)||void 0===n||n},this.buildMetadata(i));void 0!==(null==i?void 0:i.headers)&&(r.headers=i.headers),null!=(null==i?void 0:i.start_position)&&(r.start_position=i.start_position),null!=(null==i?void 0:i.volume)&&(r.volume=i.volume),null!=(null==i?void 0:i.speed)&&(r.speed=i.speed),null==t||t.natively.trigger(this.id,39,l,"audio_play",r)}pause(e){null==t||t.natively.trigger(this.id,39,e,"audio_pause",{})}stop(e){null==t||t.natively.trigger(this.id,39,e,"audio_stop",{})}seek(e,i){null==t||t.natively.trigger(this.id,39,i,"audio_seek",{position:e})}queueAdd(e,i,l){var a,n;const r=Object.assign({source:e,play_now:null!==(a=null==i?void 0:i.play_now)&&void 0!==a&&a,is_stream:null!==(n=null==i?void 0:i.is_stream)&&void 0!==n&&n},this.buildMetadata(i));void 0!==(null==i?void 0:i.headers)&&(r.headers=i.headers),null==t||t.natively.trigger(this.id,39,l,"audio_queue_add",r)}queueGet(e){null==t||t.natively.trigger(this.id,39,e,"audio_queue_get",{})}queueRemove(e,i){null==t||t.natively.trigger(this.id,39,i,"audio_queue_remove",{index:e})}setMetadata(e,i){const l=this.buildMetadata(e);null==t||t.natively.trigger(this.id,39,i,"audio_set_metadata",l)}setVolume(e,i){null==t||t.natively.trigger(this.id,39,i,"audio_set_volume",{volume:e})}setSpeed(e,i){null==t||t.natively.trigger(this.id,39,i,"audio_set_speed",{speed:e})}}class A{constructor(e,i,l=!1,n,r=!1,s){var o,d,u,g,v,c;this.id=a();const y={};(null==t?void 0:t.natively.isAndroidApp)?y.unitId=null!==(o=e.androidUnitId)&&void 0!==o?o:"ca-app-pub-3940256099942544/6300978111":(null==t?void 0:t.natively.isIOSApp)&&(y.unitId=null!==(d=e.iOSUnitId)&&void 0!==d?d:"ca-app-pub-3940256099942544/2934735716"),y.position=null!==(u=e.position)&&void 0!==u?u:"BOTTOM",y.sizeType=null!==(g=e.sizeType)&&void 0!==g?g:"AUTO",y.width=null!==(v=e.custom_width)&&void 0!==v?v:320,y.height=null!==(c=e.custom_height)&&void 0!==c?c:50,null==t||t.natively.trigger(this.id,14,(e=>{null==i||i(e),l&&(null==t||t.natively.trigger(this.id,14,(e=>{null==n||n(e),r&&(null==t||t.natively.trigger(this.id,14,s,"bannerad_show",{}))}),"bannerad_load",{}))}),"bannerad_setup",y)}loadAd(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_load",{})}showBanner(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_show",{})}hideBanner(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_hide",{})}bannerIsReady(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_ready",{})}bannerIsVisible(e){null==t||t.natively.trigger(this.id,14,e,"bannerad_visible",{})}}class S{constructor(e="ca-app-pub-3940256099942544/4411468910",i="ca-app-pub-3940256099942544/1033173712",l,n=!1,r){this.id=a(),(null==t?void 0:t.natively.isAndroidApp)?this.unitId=i:(null==t?void 0:t.natively.isIOSApp)&&(this.unitId=e),this.auto_ad_reload=n,this.auto_ad_reload_callback=r,this.loadAd(l)}loadAd(e){var i;const l={unitId:null!==(i=this.unitId)&&void 0!==i?i:"ca-app-pub-3940256099942544/4411468910"};null==t||t.natively.trigger(this.id,14,e,"interstitialad_setup",l)}showInterstitialAd(e){null==t||t.natively.trigger(this.id,14,(i=>{e(i),"DID_DISMISS_AD"===i.event&&this.auto_ad_reload&&setTimeout((()=>{this.loadAd(this.auto_ad_reload_callback)}),500)}),"interstitialad_show",{})}interstitialIsReady(e){null==t||t.natively.trigger(this.id,14,e,"interstitialad_ready",{})}}class k{constructor(e,i,t,l){this.id=a(),this.readAlertMessage=e,this.writeAlertMessage=i,this.readDetectedMessage=t,this.writeDetectedMessage=l}read(e){var i,l;const a={alertMessage:null!==(i=this.readAlertMessage)&&void 0!==i?i:"please set readAlertMessage",detectedMessage:null!==(l=this.readDetectedMessage)&&void 0!==l?l:"readDetectedMessage"};null==t||t.natively.trigger(this.id,15,e,"nfc_read",a)}write(e,i,l,a){var n,r;const s={alertMessage:null!==(n=this.writeAlertMessage)&&void 0!==n?n:"please set writeAlertMessage",detectedMessage:null!==(r=this.writeDetectedMessage)&&void 0!==r?r:"please set writeDetectedMessage",recordData:null!=i?i:"please set recordData",recordId:null!=e?e:"please set recordId",recordDataType:null!=l?l:"please set recordDataType"};null==t||t.natively.trigger(this.id,15,a,"nfc_write",s)}available(e){null==t||t.natively.trigger(this.id,15,e,"nfc_available",{})}}class I{constructor(){this.id=a()}firebase_get_token(e){null==t||t.natively.trigger(this.id,31,e,"firebase_get_token")}firebase_get_apns_token(e){null==t||t.natively.trigger(this.id,31,e,"firebase_get_apns_token")}firebase_request_permission(e){null==t||t.natively.trigger(this.id,31,e,"firebase_request_permission")}firebase_has_permission(e){null==t||t.natively.trigger(this.id,31,e,"firebase_has_permission")}firebase_subscribe_to_topic(e,i){null==t||t.natively.trigger(this.id,31,i,"firebase_subscribe_to_topic",{topic:e})}firebase_unsubscribe_from_topic(e,i){null==t||t.natively.trigger(this.id,31,i,"firebase_unsubscribe_from_topic",{topic:e})}}class T{constructor(){this.id=a()}setProfile(e,i){null==t||t.natively.trigger(this.id,32,i,"klaviyo_set_profile",e)}getExternalId(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_external_id")}resetProfile(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_reset_profile")}registerToken(e,i){null==t||t.natively.trigger(this.id,32,e,"klaviyo_register_token",{token:i})}pushPermission(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_push_permission")}pushRegister(e){null==t||t.natively.trigger(this.id,32,e,"klaviyo_push_register")}}class C{constructor(){this.id=a()}createCalendarEvent(e,i,l,a,n,r,s){const o={title:e,timezone:a,calendarId:n,description:r,endDate:null==i?void 0:i.toISOString(),startDate:l.toISOString()};null==t||t.natively.trigger(void 0,37,s,"calendar_event",o)}retrieveCalendars(e){null==t||t.natively.trigger(void 0,37,e,"retrieve_calendars",{})}}const D=()=>null==t?void 0:t.natively;t&&(t.natively=new l,t.NativelyAdmobBanner=A,t.NativelyAdmobInterstitial=S,t.NativelyAppleSignInService=n,t.NativelyAudioRecorder=w,t.NativelyAudioPlayer=N,t.NativelyBiometrics=c,t.NativelyCamera=_,t.NativelyClipboard=r,t.NativelyContacts=m,t.NativelyDatePicker=y,t.NativelyGeolocation=d,t.NativelyHealth=h,t.NativelyInfo=s,t.NativelyLocation=u,t.NativelyMediaPicker=f,t.NativelyMessage=g,t.NativelyNFCService=k,t.NativelyNotifications=o,t.NativelyPurchases=b,t.NativelyScanner=p,t.NativelyStorage=v,t.NativelyCalendar=C,t.NativelyFirebaseNotifications=I,t.NativelyKlaviyoNotifications=T),null==t||t.natively.addObserver((()=>null==t?void 0:t.natively.trigger(void 0,0,(e=>{t&&(t.natively.min_app_version=e.minSDKVersion,t.natively.app_version=e.sdkVersion)}),"app_info",{})))})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natively",
3
- "version": "2.27.1",
3
+ "version": "2.28.0",
4
4
  "description": "Natively SDK for building native-like web applications",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,39 +0,0 @@
1
- export interface NativelyLiveUpdateSegment {
2
- length: number;
3
- color?: string;
4
- }
5
- export interface NativelyLiveUpdatePoint {
6
- position: number;
7
- color?: string;
8
- }
9
- export interface NativelyLiveUpdatePayload {
10
- id: string;
11
- title: string;
12
- body?: string;
13
- progress?: number;
14
- max_progress?: number;
15
- indeterminate?: boolean;
16
- ongoing?: boolean;
17
- silent?: boolean;
18
- auto_cancel?: boolean;
19
- only_alert_once?: boolean;
20
- show_when?: boolean;
21
- when_epoch_ms?: number;
22
- uses_chronometer?: boolean;
23
- chronometer_count_down?: boolean;
24
- channel_id?: string;
25
- channel_name?: string;
26
- channel_description?: string;
27
- short_critical_text?: string;
28
- styled_by_progress?: boolean;
29
- segments?: NativelyLiveUpdateSegment[];
30
- points?: NativelyLiveUpdatePoint[];
31
- url?: string;
32
- }
33
- export declare class NativelyLiveUpdates {
34
- private readonly id;
35
- requestPermission(callback: Function): void;
36
- start(payload: NativelyLiveUpdatePayload, callback?: Function): void;
37
- update(payload: NativelyLiveUpdatePayload, callback?: Function): void;
38
- end(payload: Pick<NativelyLiveUpdatePayload, "id" | "title"> & Partial<NativelyLiveUpdatePayload>, callback?: Function): void;
39
- }
@@ -1,22 +0,0 @@
1
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
- import { generateID } from "../utils/generateID.js";
5
- import globalContext from "../utils/globalThis.js";
6
- export class NativelyLiveUpdates {
7
- constructor() {
8
- _defineProperty(this, "id", generateID());
9
- }
10
- requestPermission(callback) {
11
- globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 45, callback, "live_update_permission", {});
12
- }
13
- start(payload, callback) {
14
- globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 45, callback, "live_update_setup", payload);
15
- }
16
- update(payload, callback) {
17
- globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 45, callback, "live_update_update", payload);
18
- }
19
- end(payload, callback) {
20
- globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 45, callback, "live_update_end", payload);
21
- }
22
- }
@@ -1,30 +0,0 @@
1
- export interface NativelyQuickActionPayload {
2
- type: string;
3
- url: string;
4
- title?: string;
5
- subtitle?: string;
6
- is_enabled?: boolean;
7
- icon?: string;
8
- ios_icon?: string;
9
- android_icon?: string;
10
- }
11
- export interface NativelyQuickActionState {
12
- type: string;
13
- url: string;
14
- title: string;
15
- subtitle?: string;
16
- is_enabled: boolean;
17
- icon?: string;
18
- ios_icon?: string;
19
- android_icon?: string;
20
- }
21
- export interface NativelyQuickActionsResponse {
22
- status: string;
23
- actions: NativelyQuickActionState[];
24
- }
25
- export declare class NativelyQuickActions {
26
- private readonly id;
27
- setActions(actions: NativelyQuickActionPayload[], callback?: (response: NativelyQuickActionsResponse) => void): void;
28
- clear(callback?: (response: NativelyQuickActionsResponse) => void): void;
29
- private normalizeAction;
30
- }
@@ -1,43 +0,0 @@
1
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
- import { generateID } from "../utils/generateID.js";
5
- import globalContext from "../utils/globalThis.js";
6
- export class NativelyQuickActions {
7
- constructor() {
8
- _defineProperty(this, "id", generateID());
9
- }
10
- setActions(actions, callback) {
11
- globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 46, callback, "quick_actions", {
12
- actions: actions.map(action => this.normalizeAction(action))
13
- });
14
- }
15
- clear(callback) {
16
- globalContext === null || globalContext === void 0 || globalContext.natively.trigger(this.id, 46, callback, "clear_quick_actions", {});
17
- }
18
- normalizeAction(action) {
19
- var normalizedAction = {
20
- type: action.type,
21
- url: action.url
22
- };
23
- if (typeof action.title !== "undefined") {
24
- normalizedAction.title = action.title;
25
- }
26
- if (typeof action.subtitle !== "undefined") {
27
- normalizedAction.subtitle = action.subtitle;
28
- }
29
- if (typeof action.is_enabled !== "undefined") {
30
- normalizedAction.is_enabled = action.is_enabled;
31
- }
32
- if (typeof action.icon !== "undefined") {
33
- normalizedAction.icon = action.icon;
34
- }
35
- if (typeof action.ios_icon !== "undefined") {
36
- normalizedAction.ios_icon = action.ios_icon;
37
- }
38
- if (typeof action.android_icon !== "undefined") {
39
- normalizedAction.android_icon = action.android_icon;
40
- }
41
- return normalizedAction;
42
- }
43
- }
@@ -1 +0,0 @@
1
- export declare const SDK_VERSION = "2.26.5";
@@ -1 +0,0 @@
1
- export var SDK_VERSION = "2.26.5";