lecodes-sdk 2.4.2 → 2.4.3

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.
@@ -8,6 +8,9 @@
8
8
  // const back = await Browser.open(checkoutUrl, { returnUrl: [paid, failed], embedded: true })
9
9
  // a checkout in an embedded page,
10
10
  // resolved with the URL it reached
11
+ // (navigated to in the page, or
12
+ // opened by a bank's app through
13
+ // the app's verified link)
11
14
  //
12
15
  // It resolves with the return URL reached, or null when the user left. `returnUrl` says what ENDS
13
16
  // the page; `embedded` says WHERE it runs — the system sheet (shared logins, passkeys, Apple Pay;
@@ -38,7 +41,8 @@ export interface BrowserOpenOptions {
38
41
  /** What ends the page: a URL prefix, or several (a checkout's success and failure URLs). The
39
42
  * promise resolves with the URL reached. In the sheet every prefix must share one scheme — the
40
43
  * platform intercepts one; a custom scheme needs app.json `urlScheme`, an https one the app's
41
- * verified links. */
44
+ * verified links (app.json `appLinks`). Embedded, the view intercepts the navigation itself,
45
+ * and a verified https return from another app (a bank's) ends the page too. */
42
46
  returnUrl?: string | string[]
43
47
  /** Run the page in an embedded WebView under a close bar instead of the system sheet. The
44
48
  * WebView intercepts any return URL itself, https included. */
@@ -157,10 +161,16 @@ const openEmbedded = (url: string, options: BrowserOpenOptions): Promise<string
157
161
  if (routed) Router.pop()
158
162
  else { screen.close(); previous?.open() }
159
163
  }
164
+ // Two ways the return URL arrives: the page navigates to it inside the view (`stop`), or
165
+ // another app does — a bank's app the checkout handed off to sends the person back through the
166
+ // app's verified link (app.json "appLinks"), which reaches the app as its "url" event while the
167
+ // page still shows the bank's form. Both end the flow; `done` makes the second a no-op.
160
168
  let done = false
169
+ const off = stops.length ? _onAppUrl(back => { if (matching(back, stops)) finish(back) }) : () => {}
161
170
  const finish = (back: string | null): void => {
162
171
  if (done) return
163
172
  done = true
173
+ off()
164
174
  leave()
165
175
  resolve(back)
166
176
  }
package/src/version.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  // same manifest). Its MAJOR is the bundle ↔ runtime contract: a bundle's `// sdk:` header line
5
5
  // and a host's embedded version must agree on the major for the host to run the bundle; minor
6
6
  // and patch never gate anything (features are detected, never versioned).
7
- export const SDK_VERSION = "2.4.2"
7
+ export const SDK_VERSION = "2.4.3"
8
8
 
9
9
  /** The major of a semver string, or null when it is not one. */
10
10
  export const sdkMajor = (version: string | null | undefined): number | null => {