@plaidev/karte-action-sdk 1.1.270-29270413.6a2b1dc5c → 1.1.270-29270501.62e803ca6

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.
@@ -5,7 +5,7 @@ export declare const none: () => () => void;
5
5
  /** @internal */
6
6
  export declare const moveTo: (to: string) => () => void;
7
7
  /** @internal */
8
- export declare const linkTo: (to: string, targetBlank?: boolean, decode?: boolean) => () => void;
8
+ export declare const linkTo: (to: string, targetBlank?: boolean, decode?: boolean, keepNativeActionViewed?: boolean) => () => void;
9
9
  /** @internal */
10
10
  export declare const closeApp: (trigger: CloseTrigger) => () => void;
11
11
  /** @internal */
@@ -5,7 +5,7 @@ export declare const none: () => () => void;
5
5
  /** @internal */
6
6
  export declare const moveTo: (to: string) => () => void;
7
7
  /** @internal */
8
- export declare const linkTo: (to: string, targetBlank?: boolean, decode?: boolean) => () => void;
8
+ export declare const linkTo: (to: string, targetBlank?: boolean, decode?: boolean, keepNativeActionViewed?: boolean) => () => void;
9
9
  /** @internal */
10
10
  export declare const closeApp: (trigger: CloseTrigger) => () => void;
11
11
  /** @internal */
@@ -372,6 +372,11 @@ const OnClickOperationOptions = [
372
372
  name: "decode",
373
373
  type: "BooleanKeyword",
374
374
  default: false
375
+ },
376
+ {
377
+ name: "keep_native_action_viewed",
378
+ type: "BooleanKeyword",
379
+ default: false
375
380
  }
376
381
  ]
377
382
  },
@@ -3791,7 +3796,7 @@ const moveTo = (to) => () => {
3791
3796
  _moveTo(to);
3792
3797
  };
3793
3798
  /** @internal */
3794
- const linkTo = (to, targetBlank = true, decode = false) => () => {
3799
+ const linkTo = (to, targetBlank = true, decode = false, keepNativeActionViewed = false) => () => {
3795
3800
  const decodedTo = decode ? decodeURI(to) : to;
3796
3801
  const { target } = getActionRunnerContext() ?? {};
3797
3802
  async function sleep(ms) {
@@ -3804,7 +3809,8 @@ const linkTo = (to, targetBlank = true, decode = false) => () => {
3804
3809
  });
3805
3810
  await sleep(450);
3806
3811
  }
3807
- if (targetBlank) if (target === "native") {
3812
+ let doTransitionByLocation = true;
3813
+ if (target === "native" && targetBlank && keepNativeActionViewed) {
3808
3814
  const win = window;
3809
3815
  const nativeMessageName = "open_url";
3810
3816
  const nativeMessageData = {
@@ -3813,9 +3819,13 @@ const linkTo = (to, targetBlank = true, decode = false) => () => {
3813
3819
  };
3814
3820
  win.NativeBridge?.onReceivedMessage(nativeMessageName, JSON.stringify(nativeMessageData));
3815
3821
  win.webkit?.messageHandlers[nativeMessageName]?.postMessage(nativeMessageData);
3816
- } else window.open(decodedTo, "_blank");
3822
+ doTransitionByLocation = false;
3823
+ } else if (target === "web" && targetBlank) {
3824
+ window.open(decodedTo, "_blank");
3825
+ doTransitionByLocation = false;
3826
+ }
3817
3827
  Promise.race([_send(), sleep(650)]).then(() => {
3818
- if (!targetBlank) location.href = decodedTo;
3828
+ if (doTransitionByLocation) location.href = decodedTo;
3819
3829
  });
3820
3830
  };
3821
3831
  /** @internal */
@@ -104,6 +104,10 @@ export declare const OnClickOperationOptions: readonly [{
104
104
  readonly name: "decode";
105
105
  readonly type: "BooleanKeyword";
106
106
  readonly default: false;
107
+ }, {
108
+ readonly name: "keep_native_action_viewed";
109
+ readonly type: "BooleanKeyword";
110
+ readonly default: false;
107
111
  }];
108
112
  }, {
109
113
  readonly operation: "moveTo";
package/dist/index.es.js CHANGED
@@ -372,6 +372,11 @@ const OnClickOperationOptions = [
372
372
  name: "decode",
373
373
  type: "BooleanKeyword",
374
374
  default: false
375
+ },
376
+ {
377
+ name: "keep_native_action_viewed",
378
+ type: "BooleanKeyword",
379
+ default: false
375
380
  }
376
381
  ]
377
382
  },
@@ -3786,7 +3791,7 @@ const moveTo = (to) => () => {
3786
3791
  _moveTo(to);
3787
3792
  };
3788
3793
  /** @internal */
3789
- const linkTo = (to, targetBlank = true, decode = false) => () => {
3794
+ const linkTo = (to, targetBlank = true, decode = false, keepNativeActionViewed = false) => () => {
3790
3795
  const decodedTo = decode ? decodeURI(to) : to;
3791
3796
  const { target } = getActionRunnerContext() ?? {};
3792
3797
  async function sleep(ms) {
@@ -3799,7 +3804,8 @@ const linkTo = (to, targetBlank = true, decode = false) => () => {
3799
3804
  });
3800
3805
  await sleep(450);
3801
3806
  }
3802
- if (targetBlank) if (target === "native") {
3807
+ let doTransitionByLocation = true;
3808
+ if (target === "native" && targetBlank && keepNativeActionViewed) {
3803
3809
  const win = window;
3804
3810
  const nativeMessageName = "open_url";
3805
3811
  const nativeMessageData = {
@@ -3808,9 +3814,13 @@ const linkTo = (to, targetBlank = true, decode = false) => () => {
3808
3814
  };
3809
3815
  win.NativeBridge?.onReceivedMessage(nativeMessageName, JSON.stringify(nativeMessageData));
3810
3816
  win.webkit?.messageHandlers[nativeMessageName]?.postMessage(nativeMessageData);
3811
- } else window.open(decodedTo, "_blank");
3817
+ doTransitionByLocation = false;
3818
+ } else if (target === "web" && targetBlank) {
3819
+ window.open(decodedTo, "_blank");
3820
+ doTransitionByLocation = false;
3821
+ }
3812
3822
  Promise.race([_send(), sleep(650)]).then(() => {
3813
- if (!targetBlank) location.href = decodedTo;
3823
+ if (doTransitionByLocation) location.href = decodedTo;
3814
3824
  });
3815
3825
  };
3816
3826
  /** @internal */
package/dist/prop.d.ts CHANGED
@@ -104,6 +104,10 @@ export declare const OnClickOperationOptions: readonly [{
104
104
  readonly name: "decode";
105
105
  readonly type: "BooleanKeyword";
106
106
  readonly default: false;
107
+ }, {
108
+ readonly name: "keep_native_action_viewed";
109
+ readonly type: "BooleanKeyword";
110
+ readonly default: false;
107
111
  }];
108
112
  }, {
109
113
  readonly operation: "moveTo";
@@ -5,7 +5,7 @@ export declare const none: () => () => void;
5
5
  /** @internal */
6
6
  export declare const moveTo: (to: string) => () => void;
7
7
  /** @internal */
8
- export declare const linkTo: (to: string, targetBlank?: boolean, decode?: boolean) => () => void;
8
+ export declare const linkTo: (to: string, targetBlank?: boolean, decode?: boolean, keepNativeActionViewed?: boolean) => () => void;
9
9
  /** @internal */
10
10
  export declare const closeApp: (trigger: CloseTrigger) => () => void;
11
11
  /** @internal */
@@ -5,7 +5,7 @@ export declare const none: () => () => void;
5
5
  /** @internal */
6
6
  export declare const moveTo: (to: string) => () => void;
7
7
  /** @internal */
8
- export declare const linkTo: (to: string, targetBlank?: boolean, decode?: boolean) => () => void;
8
+ export declare const linkTo: (to: string, targetBlank?: boolean, decode?: boolean, keepNativeActionViewed?: boolean) => () => void;
9
9
  /** @internal */
10
10
  export declare const closeApp: (trigger: CloseTrigger) => () => void;
11
11
  /** @internal */
@@ -371,6 +371,11 @@ const OnClickOperationOptions = [
371
371
  name: "decode",
372
372
  type: "BooleanKeyword",
373
373
  default: false
374
+ },
375
+ {
376
+ name: "keep_native_action_viewed",
377
+ type: "BooleanKeyword",
378
+ default: false
374
379
  }
375
380
  ]
376
381
  },
@@ -3663,7 +3668,7 @@ const moveTo = (to) => () => {
3663
3668
  _moveTo(to);
3664
3669
  };
3665
3670
  /** @internal */
3666
- const linkTo = (to, targetBlank = true, decode = false) => () => {
3671
+ const linkTo = (to, targetBlank = true, decode = false, keepNativeActionViewed = false) => () => {
3667
3672
  const decodedTo = decode ? decodeURI(to) : to;
3668
3673
  const { target } = getActionRunnerContext() ?? {};
3669
3674
  async function sleep(ms) {
@@ -3676,7 +3681,8 @@ const linkTo = (to, targetBlank = true, decode = false) => () => {
3676
3681
  });
3677
3682
  await sleep(450);
3678
3683
  }
3679
- if (targetBlank) if (target === "native") {
3684
+ let doTransitionByLocation = true;
3685
+ if (target === "native" && targetBlank && keepNativeActionViewed) {
3680
3686
  const win = window;
3681
3687
  const nativeMessageName = "open_url";
3682
3688
  const nativeMessageData = {
@@ -3685,9 +3691,13 @@ const linkTo = (to, targetBlank = true, decode = false) => () => {
3685
3691
  };
3686
3692
  win.NativeBridge?.onReceivedMessage(nativeMessageName, JSON.stringify(nativeMessageData));
3687
3693
  win.webkit?.messageHandlers[nativeMessageName]?.postMessage(nativeMessageData);
3688
- } else window.open(decodedTo, "_blank");
3694
+ doTransitionByLocation = false;
3695
+ } else if (target === "web" && targetBlank) {
3696
+ window.open(decodedTo, "_blank");
3697
+ doTransitionByLocation = false;
3698
+ }
3689
3699
  Promise.race([_send(), sleep(650)]).then(() => {
3690
- if (!targetBlank) location.href = decodedTo;
3700
+ if (doTransitionByLocation) location.href = decodedTo;
3691
3701
  });
3692
3702
  };
3693
3703
  /** @internal */
@@ -104,6 +104,10 @@ export declare const OnClickOperationOptions: readonly [{
104
104
  readonly name: "decode";
105
105
  readonly type: "BooleanKeyword";
106
106
  readonly default: false;
107
+ }, {
108
+ readonly name: "keep_native_action_viewed";
109
+ readonly type: "BooleanKeyword";
110
+ readonly default: false;
107
111
  }];
108
112
  }, {
109
113
  readonly operation: "moveTo";
@@ -371,6 +371,11 @@ const OnClickOperationOptions = [
371
371
  name: "decode",
372
372
  type: "BooleanKeyword",
373
373
  default: false
374
+ },
375
+ {
376
+ name: "keep_native_action_viewed",
377
+ type: "BooleanKeyword",
378
+ default: false
374
379
  }
375
380
  ]
376
381
  },
@@ -3632,7 +3637,7 @@ const moveTo = (to) => () => {
3632
3637
  _moveTo(to);
3633
3638
  };
3634
3639
  /** @internal */
3635
- const linkTo = (to, targetBlank = true, decode = false) => () => {
3640
+ const linkTo = (to, targetBlank = true, decode = false, keepNativeActionViewed = false) => () => {
3636
3641
  const decodedTo = decode ? decodeURI(to) : to;
3637
3642
  const { target } = getActionRunnerContext() ?? {};
3638
3643
  async function sleep(ms) {
@@ -3645,7 +3650,8 @@ const linkTo = (to, targetBlank = true, decode = false) => () => {
3645
3650
  });
3646
3651
  await sleep(450);
3647
3652
  }
3648
- if (targetBlank) if (target === "native") {
3653
+ let doTransitionByLocation = true;
3654
+ if (target === "native" && targetBlank && keepNativeActionViewed) {
3649
3655
  const win = window;
3650
3656
  const nativeMessageName = "open_url";
3651
3657
  const nativeMessageData = {
@@ -3654,9 +3660,13 @@ const linkTo = (to, targetBlank = true, decode = false) => () => {
3654
3660
  };
3655
3661
  win.NativeBridge?.onReceivedMessage(nativeMessageName, JSON.stringify(nativeMessageData));
3656
3662
  win.webkit?.messageHandlers[nativeMessageName]?.postMessage(nativeMessageData);
3657
- } else window.open(decodedTo, "_blank");
3663
+ doTransitionByLocation = false;
3664
+ } else if (target === "web" && targetBlank) {
3665
+ window.open(decodedTo, "_blank");
3666
+ doTransitionByLocation = false;
3667
+ }
3658
3668
  Promise.race([_send(), sleep(650)]).then(() => {
3659
- if (!targetBlank) location.href = decodedTo;
3669
+ if (doTransitionByLocation) location.href = decodedTo;
3660
3670
  });
3661
3671
  };
3662
3672
  /** @internal */
@@ -371,6 +371,11 @@ const OnClickOperationOptions = [
371
371
  name: "decode",
372
372
  type: "BooleanKeyword",
373
373
  default: false
374
+ },
375
+ {
376
+ name: "keep_native_action_viewed",
377
+ type: "BooleanKeyword",
378
+ default: false
374
379
  }
375
380
  ]
376
381
  },
@@ -3632,7 +3637,7 @@ const moveTo = (to) => () => {
3632
3637
  _moveTo(to);
3633
3638
  };
3634
3639
  /** @internal */
3635
- const linkTo = (to, targetBlank = true, decode = false) => () => {
3640
+ const linkTo = (to, targetBlank = true, decode = false, keepNativeActionViewed = false) => () => {
3636
3641
  const decodedTo = decode ? decodeURI(to) : to;
3637
3642
  const { target } = getActionRunnerContext() ?? {};
3638
3643
  async function sleep(ms) {
@@ -3645,7 +3650,8 @@ const linkTo = (to, targetBlank = true, decode = false) => () => {
3645
3650
  });
3646
3651
  await sleep(450);
3647
3652
  }
3648
- if (targetBlank) if (target === "native") {
3653
+ let doTransitionByLocation = true;
3654
+ if (target === "native" && targetBlank && keepNativeActionViewed) {
3649
3655
  const win = window;
3650
3656
  const nativeMessageName = "open_url";
3651
3657
  const nativeMessageData = {
@@ -3654,9 +3660,13 @@ const linkTo = (to, targetBlank = true, decode = false) => () => {
3654
3660
  };
3655
3661
  win.NativeBridge?.onReceivedMessage(nativeMessageName, JSON.stringify(nativeMessageData));
3656
3662
  win.webkit?.messageHandlers[nativeMessageName]?.postMessage(nativeMessageData);
3657
- } else window.open(decodedTo, "_blank");
3663
+ doTransitionByLocation = false;
3664
+ } else if (target === "web" && targetBlank) {
3665
+ window.open(decodedTo, "_blank");
3666
+ doTransitionByLocation = false;
3667
+ }
3658
3668
  Promise.race([_send(), sleep(650)]).then(() => {
3659
- if (!targetBlank) location.href = decodedTo;
3669
+ if (doTransitionByLocation) location.href = decodedTo;
3660
3670
  });
3661
3671
  };
3662
3672
  /** @internal */
@@ -104,6 +104,10 @@ export declare const OnClickOperationOptions: readonly [{
104
104
  readonly name: "decode";
105
105
  readonly type: "BooleanKeyword";
106
106
  readonly default: false;
107
+ }, {
108
+ readonly name: "keep_native_action_viewed";
109
+ readonly type: "BooleanKeyword";
110
+ readonly default: false;
107
111
  }];
108
112
  }, {
109
113
  readonly operation: "moveTo";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaidev/karte-action-sdk",
3
- "version": "1.1.270-29270413.6a2b1dc5c",
3
+ "version": "1.1.270-29270501.62e803ca6",
4
4
  "author": "Plaid Inc.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",