@aigens/aigens-sdk-core 0.0.16 → 0.0.19

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
@@ -22,6 +22,7 @@ npx cap sync
22
22
  * [`isInstalledApp(...)`](#isinstalledapp)
23
23
  * [`getIsProductionEnvironment()`](#getisproductionenvironment)
24
24
  * [`openExternalUrl(...)`](#openexternalurl)
25
+ * [Interfaces](#interfaces)
25
26
 
26
27
  </docgen-index>
27
28
 
@@ -76,14 +77,14 @@ finish(options: any) => Promise<any>
76
77
  ### getMember(...)
77
78
 
78
79
  ```typescript
79
- getMember(options: any) => Promise<any>
80
+ getMember(options: any) => Promise<{ member: Member; }>
80
81
  ```
81
82
 
82
83
  | Param | Type |
83
84
  | ------------- | ---------------- |
84
85
  | **`options`** | <code>any</code> |
85
86
 
86
- **Returns:** <code>Promise&lt;any&gt;</code>
87
+ **Returns:** <code>Promise&lt;{ member: <a href="#member">Member</a>; }&gt;</code>
87
88
 
88
89
  --------------------
89
90
 
@@ -91,14 +92,14 @@ getMember(options: any) => Promise<any>
91
92
  ### getDeeplink(...)
92
93
 
93
94
  ```typescript
94
- getDeeplink(options: any) => Promise<any>
95
+ getDeeplink(options: any) => Promise<{ deeplink: Deeplink; }>
95
96
  ```
96
97
 
97
98
  | Param | Type |
98
99
  | ------------- | ---------------- |
99
100
  | **`options`** | <code>any</code> |
100
101
 
101
- **Returns:** <code>Promise&lt;any&gt;</code>
102
+ **Returns:** <code>Promise&lt;{ deeplink: <a href="#deeplink">Deeplink</a>; }&gt;</code>
102
103
 
103
104
  --------------------
104
105
 
@@ -158,4 +159,33 @@ openExternalUrl(options: { url: string; }) => Promise<any>
158
159
 
159
160
  --------------------
160
161
 
162
+
163
+ ### Interfaces
164
+
165
+
166
+ #### Member
167
+
168
+ | Prop | Type |
169
+ | -------------------------- | -------------------- |
170
+ | **`"memberCode"`** | <code>string</code> |
171
+ | **`"source"`** | <code>string</code> |
172
+ | **`"sessionId"`** | <code>string</code> |
173
+ | **`"pushId"`** | <code>string</code> |
174
+ | **`"deviceId"`** | <code>string</code> |
175
+ | **`"universalLink"`** | <code>string</code> |
176
+ | **`"appleMerchantId"`** | <code>string</code> |
177
+ | **`"cachedOrderContext"`** | <code>boolean</code> |
178
+ | **`"name"`** | <code>string</code> |
179
+ | **`"email"`** | <code>string</code> |
180
+ | **`"phone"`** | <code>string</code> |
181
+
182
+
183
+ #### Deeplink
184
+
185
+ | Prop | Type |
186
+ | ----------------------- | ------------------- |
187
+ | **`"addItemId"`** | <code>string</code> |
188
+ | **`"addDiscountCode"`** | <code>string</code> |
189
+ | **`"addOfferId"`** | <code>string</code> |
190
+
161
191
  </docgen-api>
@@ -2,6 +2,7 @@ package com.aigens.sdk;
2
2
 
3
3
  import android.app.Activity;
4
4
  import android.content.Intent;
5
+ import android.content.pm.ApplicationInfo;
5
6
  import android.content.res.AssetManager;
6
7
  import android.graphics.Bitmap;
7
8
  import android.graphics.Color;
@@ -13,11 +14,10 @@ import android.util.Log;
13
14
  import android.view.View;
14
15
  import android.webkit.ServiceWorkerClient;
15
16
  import android.webkit.ServiceWorkerController;
16
- import android.webkit.WebResourceError;
17
+ import android.webkit.ValueCallback;
17
18
  import android.webkit.WebResourceRequest;
18
19
  import android.webkit.WebResourceResponse;
19
20
  import android.webkit.WebView;
20
- import android.webkit.WebViewClient;
21
21
  import android.widget.Button;
22
22
 
23
23
  import com.aigens.sdk.plugins.CorePlugin;
@@ -25,9 +25,14 @@ import com.getcapacitor.Bridge;
25
25
  import com.getcapacitor.BridgeActivity;
26
26
  import com.getcapacitor.BridgeWebViewClient;
27
27
  import com.getcapacitor.CapConfig;
28
+ import com.getcapacitor.JSExport;
29
+ import com.getcapacitor.Logger;
30
+ import com.getcapacitor.NativePlugin;
28
31
  import com.getcapacitor.Plugin;
32
+ import com.getcapacitor.PluginHandle;
29
33
  import com.getcapacitor.PluginLoadException;
30
34
  import com.getcapacitor.PluginManager;
35
+ import com.getcapacitor.annotation.CapacitorPlugin;
31
36
 
32
37
  import org.json.JSONException;
33
38
  import org.json.JSONObject;
@@ -37,6 +42,8 @@ import java.io.IOException;
37
42
  import java.io.InputStream;
38
43
  import java.io.InputStreamReader;
39
44
  import java.util.ArrayList;
45
+ import java.util.Collection;
46
+ import java.util.HashMap;
40
47
  import java.util.List;
41
48
  import java.util.Map;
42
49
 
@@ -50,6 +57,7 @@ public class WebContainerActivity extends BridgeActivity {
50
57
  private Map member;
51
58
  private Map deeplink;
52
59
  private boolean ENVIRONMENT_PRODUCTION = true;
60
+ private List<Class<? extends Plugin>> allPlugins;
53
61
  private String[] shouldRedirectList = new String[]{
54
62
  "/scan?",
55
63
  "/qr?",
@@ -187,7 +195,7 @@ public class WebContainerActivity extends BridgeActivity {
187
195
 
188
196
  CapConfig cc = new CapConfig(null, config);
189
197
 
190
- List<Class<? extends Plugin>> plugins = new ArrayList<>();
198
+ allPlugins = new ArrayList<>();
191
199
 
192
200
  List<Class<? extends Plugin>> auto = loadPlugins();
193
201
 
@@ -198,7 +206,7 @@ public class WebContainerActivity extends BridgeActivity {
198
206
  if (clsName.endsWith("SplashScreenPlugin")) {
199
207
  //don't add the splash screen plugin so it doesn't show the splash screen again
200
208
  } else {
201
- plugins.add(c);
209
+ allPlugins.add(c);
202
210
  }
203
211
 
204
212
  }
@@ -210,12 +218,12 @@ public class WebContainerActivity extends BridgeActivity {
210
218
  "com.aigens.alipay.AliPayPlugin",
211
219
  "com.aigens.alipayhk.AliPayhkPlugin",
212
220
  "com.aigens.payme.PaymePlugin",
213
- }, plugins);
214
- addExtraPlugins(intent.getStringArrayExtra("extraClasspaths"), plugins);
221
+ }, allPlugins);
222
+ addExtraPlugins(intent.getStringArrayExtra("extraClasspaths"), allPlugins);
215
223
 
216
- debug("App plugins:" + plugins);
224
+ debug("App plugins:" + allPlugins);
217
225
 
218
- super.init(currentInstanceState, plugins, cc);
226
+ super.init(currentInstanceState, allPlugins, cc);
219
227
 
220
228
  //still have time to override webview client to avoid any intercept
221
229
 
@@ -225,16 +233,19 @@ public class WebContainerActivity extends BridgeActivity {
225
233
  this.bridge.getWebView().setWebViewClient(wvc);
226
234
  this.bridge.getWebView().setWebContentsDebuggingEnabled(true);
227
235
 
228
- // this.bridge.getWebView().getSettings().setAppCacheEnabled(false);
229
- // this.bridge.getWebView().clearCache(true);
230
- // this.bridge.getWebView().clearHistory();
231
- // this.bridge.getWebView().clearFormData();
232
- // this.bridge.getWebView().getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
236
+
237
+ // this.bridge.getWebView().getSettings().setAppCacheEnabled(false);
238
+ // this.bridge.getWebView().clearCache(true);
239
+ // this.bridge.getWebView().clearHistory();
240
+ // this.bridge.getWebView().clearFormData();
241
+ // this.bridge.getWebView().getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
233
242
 
234
243
  initView(intent);
235
244
  initLayout(false, true, false);
236
245
 
237
- disableServiceWorker(this.url, this.bridge);
246
+ // sometime not callback , use Use manual injection js
247
+ // disableServiceWorker(this.url, this.bridge);
248
+
238
249
  }
239
250
 
240
251
  private void addExtraPlugins(String[] extraClasspaths, List<Class<? extends Plugin>> plugins) {
@@ -346,23 +357,92 @@ public class WebContainerActivity extends BridgeActivity {
346
357
  return plugins;
347
358
  }
348
359
 
360
+ private boolean isDevMode() {
361
+ return (this.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
362
+ }
363
+ private void mapPlugin(List<Class<? extends Plugin>> allPlugins, Map<String, PluginHandle> plugins) {
364
+ for (Class<? extends Plugin> pluginClass : allPlugins) {
365
+ String pluginName;
366
+ CapacitorPlugin pluginAnnotation = pluginClass.getAnnotation(CapacitorPlugin.class);
367
+ if (pluginAnnotation == null) {
368
+ NativePlugin legacyPluginAnnotation = pluginClass.getAnnotation(NativePlugin.class);
369
+ if (legacyPluginAnnotation == null) {
370
+ Logger.error("Plugin doesn't have the @CapacitorPlugin annotation. Please add it");
371
+ continue;
372
+ }
373
+ pluginName = legacyPluginAnnotation.name();
374
+ } else {
375
+ pluginName = pluginAnnotation.name();
376
+ }
377
+
378
+ String pluginId = pluginClass.getSimpleName();
379
+
380
+ // Use the supplied name as the id if available
381
+ if (!pluginName.equals("")) {
382
+ pluginId = pluginName;
383
+ }
384
+ try {
385
+ PluginHandle handle = this.bridge.getPlugin(pluginId);
386
+ if (handle != null) {
387
+ plugins.put(pluginId, handle);
388
+ }
389
+ } catch (Exception ex) {
390
+ Logger.error(
391
+ "NativePlugin " +
392
+ pluginClass.getName() +
393
+ " is invalid. Ensure the @CapacitorPlugin annotation exists on the plugin class and" +
394
+ " the class extends Plugin"
395
+ );
396
+ }
397
+ }
398
+
399
+ }
400
+
401
+ private String getJSInjectorString() {
402
+ try {
403
+ String globalJS = JSExport.getGlobalJS(this, config.isLoggingEnabled(), isDevMode());
404
+ String bridgeJS = JSExport.getBridgeJS(this);
405
+ Map<String, PluginHandle> plugins = new HashMap<>();
406
+ mapPlugin(allPlugins, plugins);
407
+ String pluginJS = JSExport.getPluginJS(plugins.values());
408
+ String cordovaJS = JSExport.getCordovaJS(this);
409
+ String cordovaPluginsJS = JSExport.getCordovaPluginJS(this);
410
+ String cordovaPluginsFileJS = JSExport.getCordovaPluginsFileJS(this);
411
+ String localUrlJS = "window.WEBVIEW_SERVER_URL = '" + this.url + "';";
412
+ return (
413
+ globalJS +
414
+ "\n\n" +
415
+ localUrlJS +
416
+ "\n\n" +
417
+ bridgeJS +
418
+ "\n\n" +
419
+ pluginJS +
420
+ "\n\n" +
421
+ cordovaJS +
422
+ "\n\n" +
423
+ cordovaPluginsFileJS +
424
+ "\n\n" +
425
+ cordovaPluginsJS
426
+ );
427
+ } catch (Exception ex) {
428
+ Logger.error("Unable to export Capacitor JS. App will not function!", ex);
429
+ }
430
+ return "";
431
+ }
432
+
349
433
  private static boolean SW_DISABLED = false;
350
434
 
351
435
  private static void disableServiceWorker(String originUrl, Bridge bridge) {
352
436
 
353
437
  if (SW_DISABLED) return;
354
-
355
438
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
356
439
  ServiceWorkerController.getInstance().setServiceWorkerClient(new ServiceWorkerClient() {
357
440
  @Override
358
441
  public WebResourceResponse shouldInterceptRequest(WebResourceRequest request) {
359
-
360
- // Fixed: Sometimes the plugin cannot be loaded
361
- // String currentUrl = request.getUrl().toString();
362
- // if (currentUrl.equals(originUrl)) {
363
- // return bridge.getLocalServer().shouldInterceptRequest(request);
364
- // }
365
- // return null;
442
+ // don't know why this callback suddenly stopped working
443
+ if (bridge == null) {
444
+ return null;
445
+ }
366
446
  return bridge.getLocalServer().shouldInterceptRequest(request);
367
447
  }
368
448
  });
@@ -504,8 +584,9 @@ public class WebContainerActivity extends BridgeActivity {
504
584
  String url = request.getUrl().toString();
505
585
  //debug("shouldInterceptRequest", url);
506
586
 
507
- Log.wtf("shouldInterceptRequestUrl:", url);
587
+ // Log.wtf("shouldInterceptRequestUrl:", url);
508
588
 
589
+ // call super.shouldInterceptRequest(view, request); at: disableServiceWorker method
509
590
 
510
591
  //support redirect from /scan
511
592
  // for (String r: shouldRedirectList) {
@@ -513,8 +594,6 @@ public class WebContainerActivity extends BridgeActivity {
513
594
  // return null;
514
595
  // }
515
596
  // }
516
-
517
- // call super.shouldInterceptRequest(view, request); at: disableServiceWorker method
518
597
  return null;
519
598
 
520
599
  // if(url.indexOf("/scan?") > 0 || url.indexOf("/qr?") > 0 || url.indexOf("//scan") > 0){
@@ -545,6 +624,26 @@ public class WebContainerActivity extends BridgeActivity {
545
624
  return shouldOverrideUrl(view, url);
546
625
  }
547
626
 
627
+ private void injectJs(String content) {
628
+ String str = "javascript:(function() { "
629
+ + " " //turns to red the background color
630
+ + " var script=document.createElement('script'); "
631
+ + " script.setAttribute('type','text/javascript'); "
632
+ + " script.setAttribute('id', 'test'); "
633
+ + " script.innerText='"
634
+ + content +
635
+ "'; "
636
+ + " document.getElementsByTagName('head')[0].appendChild(script); "
637
+ + "})()";
638
+ // Log.wtf("injector", content);
639
+ bridge.getWebView().evaluateJavascript(content, new ValueCallback<String>() {
640
+ @Override
641
+ public void onReceiveValue(String value) {
642
+ // Log.i("onReceiveValue", value);
643
+ }
644
+ });
645
+ // bridge.getWebView().loadUrl(str);
646
+ }
548
647
  @Override
549
648
  public void onPageStarted(WebView view, String url, Bitmap favicon) {
550
649
 
@@ -554,6 +653,8 @@ public class WebContainerActivity extends BridgeActivity {
554
653
 
555
654
  //bridge.getWebView().setVisibility(View.VISIBLE);
556
655
  initLayout(true, false, false);
656
+
657
+ injectJs(getJSInjectorString());
557
658
  }
558
659
 
559
660
  @Override
package/dist/docs.json CHANGED
@@ -55,7 +55,7 @@
55
55
  },
56
56
  {
57
57
  "name": "getMember",
58
- "signature": "(options: any) => Promise<any>",
58
+ "signature": "(options: any) => Promise<{ member: Member; }>",
59
59
  "parameters": [
60
60
  {
61
61
  "name": "options",
@@ -63,15 +63,17 @@
63
63
  "type": "any"
64
64
  }
65
65
  ],
66
- "returns": "Promise<any>",
66
+ "returns": "Promise<{ member: Member; }>",
67
67
  "tags": [],
68
68
  "docs": "",
69
- "complexTypes": [],
69
+ "complexTypes": [
70
+ "Member"
71
+ ],
70
72
  "slug": "getmember"
71
73
  },
72
74
  {
73
75
  "name": "getDeeplink",
74
- "signature": "(options: any) => Promise<any>",
76
+ "signature": "(options: any) => Promise<{ deeplink: Deeplink; }>",
75
77
  "parameters": [
76
78
  {
77
79
  "name": "options",
@@ -79,10 +81,12 @@
79
81
  "type": "any"
80
82
  }
81
83
  ],
82
- "returns": "Promise<any>",
84
+ "returns": "Promise<{ deeplink: Deeplink; }>",
83
85
  "tags": [],
84
86
  "docs": "",
85
- "complexTypes": [],
87
+ "complexTypes": [
88
+ "Deeplink"
89
+ ],
86
90
  "slug": "getdeeplink"
87
91
  },
88
92
  {
@@ -146,7 +150,124 @@
146
150
  ],
147
151
  "properties": []
148
152
  },
149
- "interfaces": [],
153
+ "interfaces": [
154
+ {
155
+ "name": "Member",
156
+ "slug": "member",
157
+ "docs": "",
158
+ "tags": [],
159
+ "methods": [],
160
+ "properties": [
161
+ {
162
+ "name": "\"memberCode\"",
163
+ "tags": [],
164
+ "docs": "",
165
+ "complexTypes": [],
166
+ "type": "string | undefined"
167
+ },
168
+ {
169
+ "name": "\"source\"",
170
+ "tags": [],
171
+ "docs": "",
172
+ "complexTypes": [],
173
+ "type": "string | undefined"
174
+ },
175
+ {
176
+ "name": "\"sessionId\"",
177
+ "tags": [],
178
+ "docs": "",
179
+ "complexTypes": [],
180
+ "type": "string | undefined"
181
+ },
182
+ {
183
+ "name": "\"pushId\"",
184
+ "tags": [],
185
+ "docs": "",
186
+ "complexTypes": [],
187
+ "type": "string | undefined"
188
+ },
189
+ {
190
+ "name": "\"deviceId\"",
191
+ "tags": [],
192
+ "docs": "",
193
+ "complexTypes": [],
194
+ "type": "string"
195
+ },
196
+ {
197
+ "name": "\"universalLink\"",
198
+ "tags": [],
199
+ "docs": "",
200
+ "complexTypes": [],
201
+ "type": "string | undefined"
202
+ },
203
+ {
204
+ "name": "\"appleMerchantId\"",
205
+ "tags": [],
206
+ "docs": "",
207
+ "complexTypes": [],
208
+ "type": "string | undefined"
209
+ },
210
+ {
211
+ "name": "\"cachedOrderContext\"",
212
+ "tags": [],
213
+ "docs": "",
214
+ "complexTypes": [],
215
+ "type": "boolean | undefined"
216
+ },
217
+ {
218
+ "name": "\"name\"",
219
+ "tags": [],
220
+ "docs": "",
221
+ "complexTypes": [],
222
+ "type": "string | undefined"
223
+ },
224
+ {
225
+ "name": "\"email\"",
226
+ "tags": [],
227
+ "docs": "",
228
+ "complexTypes": [],
229
+ "type": "string | undefined"
230
+ },
231
+ {
232
+ "name": "\"phone\"",
233
+ "tags": [],
234
+ "docs": "",
235
+ "complexTypes": [],
236
+ "type": "string | undefined"
237
+ }
238
+ ]
239
+ },
240
+ {
241
+ "name": "Deeplink",
242
+ "slug": "deeplink",
243
+ "docs": "",
244
+ "tags": [],
245
+ "methods": [],
246
+ "properties": [
247
+ {
248
+ "name": "\"addItemId\"",
249
+ "tags": [],
250
+ "docs": "",
251
+ "complexTypes": [],
252
+ "type": "string | undefined"
253
+ },
254
+ {
255
+ "name": "\"addDiscountCode\"",
256
+ "tags": [],
257
+ "docs": "",
258
+ "complexTypes": [],
259
+ "type": "string | undefined"
260
+ },
261
+ {
262
+ "name": "\"addOfferId\"",
263
+ "tags": [],
264
+ "docs": "",
265
+ "complexTypes": [],
266
+ "type": "string | undefined"
267
+ }
268
+ ]
269
+ }
270
+ ],
150
271
  "enums": [],
151
272
  "typeAliases": [],
152
273
  "pluginConfigs": []
@@ -2,8 +2,12 @@ export interface CorePlugin {
2
2
  echo(options: any): Promise<any>;
3
3
  dismiss(options: any): Promise<any>;
4
4
  finish(options: any): Promise<any>;
5
- getMember(options: any): Promise<any>;
6
- getDeeplink(options: any): Promise<any>;
5
+ getMember(options: any): Promise<{
6
+ member: Member;
7
+ }>;
8
+ getDeeplink(options: any): Promise<{
9
+ deeplink: Deeplink;
10
+ }>;
7
11
  openBrowser(options: any): Promise<any>;
8
12
  isInstalledApp(options: {
9
13
  key: string;
@@ -17,3 +21,21 @@ export interface CorePlugin {
17
21
  url: string;
18
22
  }): Promise<any>;
19
23
  }
24
+ export interface Member {
25
+ "memberCode"?: string;
26
+ "source"?: string;
27
+ "sessionId"?: string;
28
+ "pushId"?: string;
29
+ "deviceId": string;
30
+ "universalLink"?: string;
31
+ "appleMerchantId"?: string;
32
+ "cachedOrderContext"?: boolean;
33
+ "name"?: string;
34
+ "email"?: string;
35
+ "phone"?: string;
36
+ }
37
+ export interface Deeplink {
38
+ "addItemId"?: string;
39
+ "addDiscountCode"?: string;
40
+ "addOfferId"?: string;
41
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface CorePlugin {\n echo(options: any): Promise<any>;\n dismiss(options: any): Promise<any>;\n finish(options: any): Promise<any>;\n getMember(options: any): Promise<any>;\n getDeeplink(options: any): Promise<any>;\n openBrowser(options: any): Promise<any>;\n isInstalledApp(options: { key: string }): Promise<{ install: boolean }>;\n getIsProductionEnvironment(): Promise<{ isPrd: boolean }>;\n openExternalUrl(options: { url: string }): Promise<any>;\n\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface CorePlugin {\n echo(options: any): Promise<any>;\n dismiss(options: any): Promise<any>;\n finish(options: any): Promise<any>;\n getMember(options: any): Promise<{ member: Member }>;\n getDeeplink(options: any): Promise<{ deeplink: Deeplink }>;\n openBrowser(options: any): Promise<any>;\n isInstalledApp(options: { key: string }): Promise<{ install: boolean }>;\n getIsProductionEnvironment(): Promise<{ isPrd: boolean }>;\n openExternalUrl(options: { url: string }): Promise<any>;\n\n}\nexport interface Member {\n \"memberCode\"?: string;\n \"source\"?: string;\n \"sessionId\"?: string;\n \"pushId\"?: string;\n \"deviceId\": string;\n \"universalLink\"?: string;\n \"appleMerchantId\"?: string;\n \"cachedOrderContext\"?: boolean;\n \"name\"?: string;\n \"email\"?: string;\n \"phone\"?: string;\n}\nexport interface Deeplink {\n \"addItemId\"?: string;\n \"addDiscountCode\"?: string;\n \"addOfferId\"?: string;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,9 +1,13 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import type { CorePlugin } from './definitions';
2
+ import type { CorePlugin, Deeplink, Member } from './definitions';
3
3
  export declare class CoreWeb extends WebPlugin implements CorePlugin {
4
4
  echo(options: any): Promise<any>;
5
- getMember(options: any): Promise<any>;
6
- getDeeplink(options: any): Promise<any>;
5
+ getMember(options: any): Promise<{
6
+ member: Member;
7
+ }>;
8
+ getDeeplink(options: any): Promise<{
9
+ deeplink: Deeplink;
10
+ }>;
7
11
  dismiss(options: any): Promise<any>;
8
12
  finish(options: any): Promise<any>;
9
13
  openBrowser(options: any): Promise<any>;
@@ -1 +1 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KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAAwB;QACzC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAAwB;QAC1C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACnC,OAAO;YACH,IAAI,EAAE,IAAI;SACb,CAAA;IACL,CAAC;IAED,KAAK,CAAC,0BAA0B;QAC5B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CAGJ","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { CorePlugin } from './definitions';\n\n\nexport class CoreWeb extends WebPlugin implements CorePlugin {\n async echo(options: any): Promise<any> {\n console.log('ECHO', options);\n return options;\n }\n\n async getMember(options: any): Promise<any> {\n console.log('GET MEMBER', options);\n var result = {} as any;\n var w = window as any;\n result.member = w.aigens?.context?.member;\n return result;\n }\n async getDeeplink(options: any): Promise<any> {\n console.log('GET Deeplink', options);\n var result = {} as any;\n var w = window as any;\n result.deeplink = w.aigens?.context?.deeplink;\n return result;\n }\n\n async dismiss(options: any): Promise<any> {\n console.log('DISMISS', options);\n return options;\n }\n\n async finish(options: any): Promise<any> {\n console.log('FINISH', options);\n return options;\n }\n\n async openBrowser(options: any): Promise<any> {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n\n async isInstalledApp(options: { key: string }): Promise<{ install: boolean }> {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n\n async openExternalUrl(options: { url: string }): Promise<any> {\n window.open(options.url, \"_blank\");\n return {\n open: true\n }\n }\n\n async getIsProductionEnvironment(): Promise<{ isPrd: boolean }> {\n return { isPrd: true };\n }\n\n\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":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,CAAC,cAAc,CAAC,OAAwB;QACzC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAAwB;QAC1C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACnC,OAAO;YACH,IAAI,EAAE,IAAI;SACb,CAAA;IACL,CAAC;IAED,KAAK,CAAC,0BAA0B;QAC5B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CAGJ","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { CorePlugin, Deeplink, Member } from './definitions';\n\n\nexport class CoreWeb extends WebPlugin implements CorePlugin {\n async echo(options: any): Promise<any> {\n console.log('ECHO', options);\n return options;\n }\n\n async getMember(options: any): Promise<{ member: Member }> {\n console.log('GET MEMBER', options);\n var result = {} as any;\n var w = window as any;\n result.member = w.aigens?.context?.member;\n return result;\n }\n async getDeeplink(options: any): Promise<{ deeplink: Deeplink }> {\n console.log('GET Deeplink', options);\n var result = {} as any;\n var w = window as any;\n result.deeplink = w.aigens?.context?.deeplink;\n return result;\n }\n\n async dismiss(options: any): Promise<any> {\n console.log('DISMISS', options);\n return options;\n }\n\n async finish(options: any): Promise<any> {\n console.log('FINISH', options);\n return options;\n }\n\n async openBrowser(options: any): Promise<any> {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n\n async isInstalledApp(options: { key: string }): Promise<{ install: boolean }> {\n console.log(options);\n throw new Error('Method not implemented.');\n }\n\n async openExternalUrl(options: { url: string }): Promise<any> {\n window.open(options.url, \"_blank\");\n return {\n open: true\n }\n }\n\n async getIsProductionEnvironment(): Promise<{ isPrd: boolean }> {\n return { isPrd: true };\n }\n\n\n}\n"]}
@@ -51,6 +51,10 @@ import Capacitor
51
51
  return
52
52
  }
53
53
 
54
+ if universalLink.isEmpty || !url.absoluteString.starts(with: universalLink) {
55
+ return;
56
+ }
57
+
54
58
  let rUrl = URLRequest(url: url)
55
59
  webView?.load(rUrl)
56
60
  }
@@ -65,6 +69,10 @@ import Capacitor
65
69
  return
66
70
  }
67
71
 
72
+ if universalLink.isEmpty || !url.absoluteString.starts(with: universalLink) {
73
+ return;
74
+ }
75
+
68
76
 
69
77
  let rUrl = URLRequest(url: url)
70
78
  webView?.load(rUrl)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigens/aigens-sdk-core",
3
- "version": "0.0.16",
3
+ "version": "0.0.19",
4
4
  "description": "Aigens Order.Place Core Plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",