@andco/protocol 0.0.1
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/LICENSE +202 -0
- package/README.md +44 -0
- package/dist/authorization-preparation.d.ts +754 -0
- package/dist/authorization-preparation.d.ts.map +1 -0
- package/dist/authorization-preparation.js +187 -0
- package/dist/authorization.d.ts +99 -0
- package/dist/authorization.d.ts.map +1 -0
- package/dist/authorization.js +227 -0
- package/dist/automatic-charge.d.ts +314 -0
- package/dist/automatic-charge.d.ts.map +1 -0
- package/dist/automatic-charge.js +126 -0
- package/dist/bank-account-authorization.d.ts +6 -0
- package/dist/bank-account-authorization.d.ts.map +1 -0
- package/dist/bank-account-authorization.js +13 -0
- package/dist/callback-state.d.ts +10 -0
- package/dist/callback-state.d.ts.map +1 -0
- package/dist/callback-state.js +28 -0
- package/dist/consent.d.ts +48 -0
- package/dist/consent.d.ts.map +1 -0
- package/dist/consent.js +110 -0
- package/dist/constants.d.ts +17 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +20 -0
- package/dist/errors.d.ts +70 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +80 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/intent-input.d.ts +637 -0
- package/dist/intent-input.d.ts.map +1 -0
- package/dist/intent-input.js +101 -0
- package/dist/messages/authorization-response.d.ts +12 -0
- package/dist/messages/authorization-response.d.ts.map +1 -0
- package/dist/messages/authorization-response.js +9 -0
- package/dist/messages/base.d.ts +31 -0
- package/dist/messages/base.d.ts.map +1 -0
- package/dist/messages/base.js +30 -0
- package/dist/messages/click.d.ts +11 -0
- package/dist/messages/click.d.ts.map +1 -0
- package/dist/messages/click.js +8 -0
- package/dist/messages/error.d.ts +13 -0
- package/dist/messages/error.d.ts.map +1 -0
- package/dist/messages/error.js +9 -0
- package/dist/messages/index.d.ts +75 -0
- package/dist/messages/index.d.ts.map +1 -0
- package/dist/messages/index.js +27 -0
- package/dist/messages/init.d.ts +9 -0
- package/dist/messages/init.d.ts.map +1 -0
- package/dist/messages/init.js +6 -0
- package/dist/messages/popup.d.ts +108 -0
- package/dist/messages/popup.d.ts.map +1 -0
- package/dist/messages/popup.js +62 -0
- package/dist/messages/ready.d.ts +9 -0
- package/dist/messages/ready.d.ts.map +1 -0
- package/dist/messages/ready.js +6 -0
- package/dist/messages/set-preferences.d.ts +16 -0
- package/dist/messages/set-preferences.d.ts.map +1 -0
- package/dist/messages/set-preferences.js +20 -0
- package/dist/miniapp-icon.d.ts +4 -0
- package/dist/miniapp-icon.d.ts.map +1 -0
- package/dist/miniapp-icon.js +68 -0
- package/dist/miniapp-manifest.d.ts +71 -0
- package/dist/miniapp-manifest.d.ts.map +1 -0
- package/dist/miniapp-manifest.js +46 -0
- package/dist/native-copy.d.ts +7 -0
- package/dist/native-copy.d.ts.map +1 -0
- package/dist/native-copy.js +436 -0
- package/dist/native-intent.d.ts +402 -0
- package/dist/native-intent.d.ts.map +1 -0
- package/dist/native-intent.js +410 -0
- package/dist/native.d.ts +55 -0
- package/dist/native.d.ts.map +1 -0
- package/dist/native.js +53 -0
- package/dist/oauth.d.ts +4 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +3 -0
- package/dist/release.d.ts +3 -0
- package/dist/release.d.ts.map +1 -0
- package/dist/release.js +2 -0
- package/dist/scopes.d.ts +35 -0
- package/dist/scopes.d.ts.map +1 -0
- package/dist/scopes.js +15 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +14 -0
- package/dist/transport/financial-events.d.ts +134 -0
- package/dist/transport/financial-events.d.ts.map +1 -0
- package/dist/transport/financial-events.js +120 -0
- package/dist/transport/generated/oauth-api.d.ts +1685 -0
- package/dist/transport/generated/oauth-api.d.ts.map +1 -0
- package/dist/transport/generated/oauth-api.js +5 -0
- package/dist/transport/index.d.ts +6 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +5 -0
- package/dist/transport/intents.d.ts +81 -0
- package/dist/transport/intents.d.ts.map +1 -0
- package/dist/transport/intents.js +286 -0
- package/dist/transport/rest.d.ts +76 -0
- package/dist/transport/rest.d.ts.map +1 -0
- package/dist/transport/rest.js +48 -0
- package/dist/transport/runtime.d.ts +8 -0
- package/dist/transport/runtime.d.ts.map +1 -0
- package/dist/transport/runtime.js +16 -0
- package/dist/transport/webhooks.d.ts +27 -0
- package/dist/transport/webhooks.d.ts.map +1 -0
- package/dist/transport/webhooks.js +68 -0
- package/dist/urls.d.ts +71 -0
- package/dist/urls.d.ts.map +1 -0
- package/dist/urls.js +132 -0
- package/dist/userinfo.d.ts +11 -0
- package/dist/userinfo.d.ts.map +1 -0
- package/dist/userinfo.js +9 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +45 -0
- package/dist/webhook-input.d.ts +22 -0
- package/dist/webhook-input.d.ts.map +1 -0
- package/dist/webhook-input.js +11 -0
- package/dist/webhook-signature.d.ts +54 -0
- package/dist/webhook-signature.d.ts.map +1 -0
- package/dist/webhook-signature.js +74 -0
- package/dist/window-features.d.ts +28 -0
- package/dist/window-features.d.ts.map +1 -0
- package/dist/window-features.js +55 -0
- package/package.json +63 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"window-features.d.ts","sourceRoot":"","sources":["../src/window-features.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;AAEtG,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,+CAA+C;IAC/C,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,QAAmB,EAAE,GAAG,OAAO,EAAE,EAAE,kBAAkB,GAAG,MAAM,CAmClG;AAED,gGAAgG;AAChG,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** Browser popup geometry shared by every Andco surface that opens one. */
|
|
2
|
+
/**
|
|
3
|
+
* Builds a `window.open` features string.
|
|
4
|
+
*
|
|
5
|
+
* Part of the Protocol Contract rather than the SDK because both sides open the same popups: the
|
|
6
|
+
* Platform's own bridge positions a window exactly as an integrator's does, and two implementations
|
|
7
|
+
* would place them differently.
|
|
8
|
+
*/
|
|
9
|
+
export function windowFeaturesFrom({ position = "center", ...options }) {
|
|
10
|
+
const width = Number(options["width"]);
|
|
11
|
+
const height = Number(options["height"]);
|
|
12
|
+
let left;
|
|
13
|
+
let top;
|
|
14
|
+
switch (position) {
|
|
15
|
+
case "top-left":
|
|
16
|
+
left = 0;
|
|
17
|
+
top = 0;
|
|
18
|
+
break;
|
|
19
|
+
case "top-right":
|
|
20
|
+
left = screen.width - width;
|
|
21
|
+
top = 0;
|
|
22
|
+
break;
|
|
23
|
+
case "bottom-left":
|
|
24
|
+
left = 0;
|
|
25
|
+
top = screen.height - height;
|
|
26
|
+
break;
|
|
27
|
+
case "bottom-right":
|
|
28
|
+
left = screen.width - width;
|
|
29
|
+
top = screen.height - height;
|
|
30
|
+
break;
|
|
31
|
+
default:
|
|
32
|
+
left = Math.max(0, Math.round((screen.width - width) / 2));
|
|
33
|
+
top = Math.max(0, Math.round((screen.height - height) / 2));
|
|
34
|
+
}
|
|
35
|
+
const features = [];
|
|
36
|
+
for (const [key, value] of Object.entries({ ...options, left, top })) {
|
|
37
|
+
if (value === undefined || value === false)
|
|
38
|
+
continue;
|
|
39
|
+
// A bare name is the established spelling for a boolean feature.
|
|
40
|
+
features.push(value === true ? key : `${key}=${String(value)}`);
|
|
41
|
+
}
|
|
42
|
+
return features.join(",");
|
|
43
|
+
}
|
|
44
|
+
/** Whether this runtime has a DOM. A pure predicate both sides use before touching `window`. */
|
|
45
|
+
export function isBrowser() {
|
|
46
|
+
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Prefix of the `window.name` an Andco popup carries, followed by its Presentation ID.
|
|
50
|
+
*
|
|
51
|
+
* Part of the Protocol Contract because both sides read it: whoever opens the popup writes the
|
|
52
|
+
* name, and the callback document uses it to recognise that the result is its to relay. Two
|
|
53
|
+
* spellings mean a popup that authorizes successfully and then never reports back.
|
|
54
|
+
*/
|
|
55
|
+
export const ANDCO_POPUP_NAME_PREFIX = "andco-popup-";
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@andco/protocol",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"andco": {
|
|
5
|
+
"release": 1780358400
|
|
6
|
+
},
|
|
7
|
+
"private": false,
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./authorization": {
|
|
20
|
+
"types": "./dist/authorization.d.ts",
|
|
21
|
+
"import": "./dist/authorization.js",
|
|
22
|
+
"default": "./dist/authorization.js"
|
|
23
|
+
},
|
|
24
|
+
"./messages": {
|
|
25
|
+
"types": "./dist/messages/index.d.ts",
|
|
26
|
+
"import": "./dist/messages/index.js",
|
|
27
|
+
"default": "./dist/messages/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./transport": {
|
|
30
|
+
"types": "./dist/transport/index.d.ts",
|
|
31
|
+
"import": "./dist/transport/index.js",
|
|
32
|
+
"default": "./dist/transport/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./server": {
|
|
35
|
+
"types": "./dist/server.d.ts",
|
|
36
|
+
"import": "./dist/server.js",
|
|
37
|
+
"default": "./dist/server.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist"
|
|
42
|
+
],
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"openapi-fetch": "^0.17.0",
|
|
45
|
+
"valibot": "^1.5.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"openapi-typescript": "^7.13.0",
|
|
49
|
+
"typescript": "^6.0.3"
|
|
50
|
+
},
|
|
51
|
+
"license": "Apache-2.0",
|
|
52
|
+
"description": "Shared protocol types, message schemas and transport contracts for the Andco SDK.",
|
|
53
|
+
"scripts": {
|
|
54
|
+
"clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
55
|
+
"sync-release": "node scripts/sync-release.mjs",
|
|
56
|
+
"generate:openapi": "openapi-typescript openapi/oauth-api.yaml -o src/transport/generated/oauth-api.ts && biome format --write src/transport/generated/oauth-api.ts",
|
|
57
|
+
"build": "pnpm run clean && pnpm run sync-release && tsc",
|
|
58
|
+
"dev": "tsc --watch --preserveWatchOutput",
|
|
59
|
+
"check-types": "tsc --noEmit",
|
|
60
|
+
"lint": "tsc --noEmit",
|
|
61
|
+
"test": "vitest run"
|
|
62
|
+
}
|
|
63
|
+
}
|