@argento-sdk/web 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ Argento studio software license
2
+
3
+ Copyright 2026 Argento. All rights reserved.
4
+
5
+ Argento grants the receiving studio a nonexclusive license to install and run
6
+ the released Argento server, simulator and command-line tools for its own games
7
+ and to keep backup copies. The studio may use and adapt the supplied sample
8
+ integrations and embed the web and Unity SDKs in games it distributes to
9
+ players. The studio may distribute copies of the SDKs as part of those games.
10
+
11
+ Redistribution of the Argento server, standalone SDKs and tools, sublicensing
12
+ them, or offering them as a software service to other studios requires separate
13
+ written permission from Argento. Third-party components retain their own
14
+ licenses. The studio supplies its own payment-provider account and credentials.
@@ -0,0 +1,9 @@
1
+ import type { OrderView } from "./generated.js";
2
+ /** Mount a Spanish checkout into the studio's own layout. No credentials enter the QR. */
3
+ export declare function mountCheckout(root: HTMLElement, retry: (newOrder: boolean) => void, simulation?: boolean | "hosted-test", apiBaseUrl?: string): {
4
+ show(order: OrderView): void;
5
+ busy(): void;
6
+ pushLimited(): void;
7
+ error(): void;
8
+ clear(): void;
9
+ };
@@ -0,0 +1,142 @@
1
+ import QRCode from "qrcode";
2
+ const labels = {
3
+ CREATED: [
4
+ "Preparando el cobro",
5
+ "Guardamos tu pedido. El código aparecerá aquí.",
6
+ ],
7
+ UNKNOWN_CHARGE: [
8
+ "Estamos verificando tu cobro",
9
+ "Espera la confirmación antes de hacer otro pago. Puedes cerrar el juego y volver.",
10
+ ],
11
+ AWAITING_PAYMENT: [
12
+ "Esperando tu pago",
13
+ "En tu app bancaria, abre CoDi, escanea el QR y confirma el importe.",
14
+ ],
15
+ EXPIRED: [
16
+ "Cobro vencido",
17
+ "Puedes generar otro cobro. Si ya pagaste, guarda la referencia y espera la confirmación.",
18
+ ],
19
+ FAILED: [
20
+ "El cobro no se pudo crear",
21
+ "Genera otro cobro para volver a intentarlo.",
22
+ ],
23
+ HELD: [
24
+ "Tu pago está en revisión",
25
+ "Guarda la referencia para consultar este pago con el estudio.",
26
+ ],
27
+ GRANTED: ["Pago recibido", "Estamos guardando el artículo en tu mochila."],
28
+ DELIVERED: [
29
+ "Artículo entregado",
30
+ "Tu recibo queda disponible en esta partida.",
31
+ ],
32
+ };
33
+ /** Mount a Spanish checkout into the studio's own layout. No credentials enter the QR. */
34
+ export function mountCheckout(root, retry, simulation = false, apiBaseUrl = window.location.origin) {
35
+ root.innerHTML = `
36
+ <h3 id="order-title" aria-live="polite"></h3>
37
+ <p data-description></p>
38
+ <p data-summary></p>
39
+ <img id="qr" alt="Código QR del cobro" hidden>
40
+ <details data-details hidden><summary>Ver datos del QR</summary><code id="payload"></code></details>
41
+ <p id="reference" hidden></p>
42
+ <p data-sim hidden></p><button type="button" data-retry hidden></button>
43
+ <p><a data-privacy target="_blank" rel="noopener noreferrer">Aviso de privacidad</a></p>`;
44
+ const privacyUrl = new URL(apiBaseUrl.replace(/\/$/, "") + "/privacy", window.location.href);
45
+ if (!["https:", "http:"].includes(privacyUrl.protocol))
46
+ throw new TypeError("Invalid studio API URL");
47
+ root.querySelector("[data-privacy]").href = privacyUrl.href;
48
+ const node = (selector) => root.querySelector(selector);
49
+ const qr = node("#qr");
50
+ const action = node("[data-retry]");
51
+ let lastQr = "";
52
+ let newOrder = false;
53
+ action.onclick = () => retry(newOrder);
54
+ root.hidden = true;
55
+ function view(state, title, description, order) {
56
+ root.hidden = false;
57
+ root.dataset.state = state;
58
+ node("#order-title").textContent = title;
59
+ const push = order?.pushState === "AWAITING_PAYMENT";
60
+ const uncertainPush = order?.pushState === "UNKNOWN_CHARGE" && state === "AWAITING_PAYMENT";
61
+ const failedPush = order?.pushState === "FAILED" && state === "AWAITING_PAYMENT";
62
+ node("[data-description]").textContent =
63
+ uncertainPush
64
+ ? "Estamos comprobando si se envió el aviso a tu celular. Espera antes de hacer otro pago."
65
+ : failedPush
66
+ ? "No se envió el aviso a tu celular. Puedes usar el QR de este pedido en tu app bancaria."
67
+ : push && state === "AWAITING_PAYMENT"
68
+ ? (simulation ? "Aviso de prueba. En un cobro real, revisa CoDi en tu app bancaria y confirma el importe." : "Revisa el aviso de CoDi en tu app bancaria y confirma el importe.")
69
+ : simulation && state === "AWAITING_PAYMENT"
70
+ ? "Este QR es de prueba. En un cobro real, lo escaneas desde CoDi en tu app bancaria y confirmas el importe."
71
+ : description;
72
+ node("[data-summary]").textContent = order
73
+ ? String(("name" in order.item && order.item.name) || order.sku) +
74
+ " · " +
75
+ new Intl.NumberFormat("es-MX", {
76
+ style: "currency",
77
+ currency: order.currency,
78
+ }).format(order.priceCentavos / 100) +
79
+ " " +
80
+ order.currency
81
+ : "";
82
+ node("#reference").hidden = !order;
83
+ node("#reference").textContent = order ? "Referencia " + order.numRef : "";
84
+ const value = state === "AWAITING_PAYMENT" && !push && !uncertainPush ? (order?.qrString ?? "") : "";
85
+ node("[data-details]").hidden = !value;
86
+ node("#payload").textContent = value;
87
+ const sim = node("[data-sim]");
88
+ const simId = push ? order?.pushTransactionId : value && order?.qrId;
89
+ sim.hidden = simulation !== true || state !== "AWAITING_PAYMENT" || !simId;
90
+ sim.textContent = !sim.hidden
91
+ ? "Para probar este cobro, ejecuta ./pay.sh " +
92
+ simId +
93
+ " en la carpeta del simulador."
94
+ : "";
95
+ if (value !== lastQr) {
96
+ lastQr = value;
97
+ qr.hidden = true;
98
+ qr.removeAttribute("src");
99
+ if (value)
100
+ void QRCode.toDataURL(value, { width: 256, margin: 4 })
101
+ .then((src) => {
102
+ if (lastQr === value) {
103
+ qr.src = src;
104
+ qr.hidden = false;
105
+ }
106
+ })
107
+ .catch(() => {
108
+ /* The accessible text payload remains available. */
109
+ });
110
+ }
111
+ newOrder = state === "EXPIRED" || state === "FAILED";
112
+ action.hidden = !newOrder && state !== "ERROR" && state !== "PUSH_LIMIT";
113
+ action.textContent = state === "PUSH_LIMIT" ? "Pagar con QR" : newOrder ? "Generar otro cobro" : "Reintentar";
114
+ }
115
+ return {
116
+ show(order) {
117
+ const state = order.held && !["GRANTED", "DELIVERED"].includes(order.state)
118
+ ? "HELD"
119
+ : order.state;
120
+ const [title, text] = labels[state] ?? [
121
+ "Consultando el cobro",
122
+ "Espera mientras comprobamos el estado del pedido.",
123
+ ];
124
+ view(state, title, text, order);
125
+ },
126
+ busy() {
127
+ view("CREATING", "Creando tu cobro", "Estamos consultando el precio y preparando el cobro.");
128
+ },
129
+ pushLimited() {
130
+ view("PUSH_LIMIT", "Se alcanzó el límite de avisos", "Puedes usar un QR para pagar este mismo pedido.");
131
+ },
132
+ error() {
133
+ view("ERROR", "No pudimos consultar el cobro", "Reintenta para recuperar el mismo pedido.");
134
+ },
135
+ clear() {
136
+ root.hidden = true;
137
+ delete root.dataset.state;
138
+ lastQr = "";
139
+ qr.hidden = true;
140
+ },
141
+ };
142
+ }
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Argento studio game API
3
+ * 0.1.0
4
+ * DO NOT MODIFY - This file has been generated using oazapfts.
5
+ * See https://www.npmjs.com/package/oazapfts
6
+ */
7
+ import * as Oazapfts from "@oazapfts/runtime";
8
+ export declare const defaults: Oazapfts.Defaults<Oazapfts.CustomHeaders>;
9
+ export declare const servers: {};
10
+ export type CatalogEntry = {
11
+ currency: string;
12
+ item: object;
13
+ priceCentavos: number;
14
+ sku: string;
15
+ };
16
+ export type EntitlementView = {
17
+ id: string;
18
+ item: object;
19
+ kind: string;
20
+ orderId?: string | null;
21
+ sku: string;
22
+ };
23
+ export type GiftRequest = {
24
+ idempotencyKey: string;
25
+ nickname: string;
26
+ sku: string;
27
+ };
28
+ export type GiftLink = {
29
+ expiresAt: string;
30
+ orderId: string;
31
+ path: string;
32
+ };
33
+ export type PhoneStatus = {
34
+ remembered: boolean;
35
+ };
36
+ export type PhoneNumber = {
37
+ phoneNumber: string;
38
+ };
39
+ export type RequestId = {
40
+ id: string;
41
+ };
42
+ export type Purchase = {
43
+ idempotencyKey: string;
44
+ sku: string;
45
+ };
46
+ export type OrderView = {
47
+ currency: string;
48
+ expiresAt: string;
49
+ held: boolean;
50
+ id: string;
51
+ item: object;
52
+ numRef: string;
53
+ priceCentavos: number;
54
+ pushState?: string | null;
55
+ pushTransactionId?: string | null;
56
+ qrId?: string | null;
57
+ qrString?: string | null;
58
+ sku: string;
59
+ state: string;
60
+ };
61
+ export type PushPurchase = {
62
+ idempotencyKey: string;
63
+ /** Omit to reuse the player's saved number or recover a previously submitted push. */
64
+ phoneNumber?: string | null;
65
+ sku: string;
66
+ };
67
+ export type GiftPush = {
68
+ phoneNumber: string;
69
+ };
70
+ export type GameRequest = {
71
+ gameId: string;
72
+ };
73
+ export type Credentials = {
74
+ gameId: string;
75
+ playerId: string;
76
+ recoveryCode: string;
77
+ token: string;
78
+ };
79
+ export type Player = {
80
+ gameId: string;
81
+ playerId: string;
82
+ };
83
+ export type RecoveryRequest = {
84
+ gameId: string;
85
+ recoveryCode: string;
86
+ /** A fresh random UUID v4. Persist it before sending and reuse it after a lost reply. */
87
+ requestId?: string | null;
88
+ };
89
+ export declare function listCatalog(opts?: Oazapfts.RequestOpts): Promise<CatalogEntry[]>;
90
+ export declare function listEntitlements(opts?: Oazapfts.RequestOpts): Promise<EntitlementView[]>;
91
+ export declare function acknowledgeEntitlement(id: string, opts?: Oazapfts.RequestOpts): Promise<never>;
92
+ export declare function issueGift(giftRequest: GiftRequest, opts?: Oazapfts.RequestOpts): Promise<GiftLink>;
93
+ export declare function health(opts?: Oazapfts.RequestOpts): Promise<never>;
94
+ export declare function getPhoneStatus(opts?: Oazapfts.RequestOpts): Promise<PhoneStatus>;
95
+ export declare function rememberPhone(phoneNumber: PhoneNumber, opts?: Oazapfts.RequestOpts): Promise<never>;
96
+ export declare function forgetPhone(opts?: Oazapfts.RequestOpts): Promise<never>;
97
+ export declare function requestPersonalDataDeletion(opts?: Oazapfts.RequestOpts): Promise<RequestId>;
98
+ export declare function createOrder(purchase: Purchase, opts?: Oazapfts.RequestOpts): Promise<OrderView>;
99
+ export declare function createPushOrder(pushPurchase: PushPurchase, opts?: Oazapfts.RequestOpts): Promise<OrderView>;
100
+ export declare function getOrder(id: string, opts?: Oazapfts.RequestOpts): Promise<OrderView>;
101
+ export declare function orderEvents(id: string, opts?: Oazapfts.RequestOpts): Promise<never>;
102
+ export declare function getGiftPage(token: string, opts?: Oazapfts.RequestOpts): Promise<never>;
103
+ export declare function requestGiftPush(token: string, giftPush: GiftPush, opts?: Oazapfts.RequestOpts): Promise<never>;
104
+ export declare function createAnonymousPlayer(gameRequest: GameRequest, opts?: Oazapfts.RequestOpts): Promise<Credentials>;
105
+ export declare function getPlayer(opts?: Oazapfts.RequestOpts): Promise<Player>;
106
+ export declare function recoverPlayer(recoveryRequest: RecoveryRequest, opts?: Oazapfts.RequestOpts): Promise<Credentials>;
107
+ export declare function receivePeyWebhook(webhookId: string, webhookTimestamp: string, webhookSignature: string, body: object, opts?: Oazapfts.RequestOpts): Promise<never>;
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Argento studio game API
3
+ * 0.1.0
4
+ * DO NOT MODIFY - This file has been generated using oazapfts.
5
+ * See https://www.npmjs.com/package/oazapfts
6
+ */
7
+ import * as Oazapfts from "@oazapfts/runtime";
8
+ export const defaults = {
9
+ headers: {},
10
+ baseUrl: "/"
11
+ };
12
+ const oazapfts = Oazapfts.runtime(defaults);
13
+ export const servers = {};
14
+ export function listCatalog(opts) {
15
+ return oazapfts.ok(oazapfts.fetchJson("/catalog", {
16
+ ...opts
17
+ }));
18
+ }
19
+ export function listEntitlements(opts) {
20
+ return oazapfts.ok(oazapfts.fetchJson("/entitlements", {
21
+ ...opts
22
+ }));
23
+ }
24
+ export function acknowledgeEntitlement(id, opts) {
25
+ return oazapfts.ok(oazapfts.fetchText(`/entitlements/${encodeURIComponent(id)}/ack`, {
26
+ ...opts,
27
+ method: "POST"
28
+ }));
29
+ }
30
+ export function issueGift(giftRequest, opts) {
31
+ return oazapfts.ok(oazapfts.fetchJson("/gifts", oazapfts.json({
32
+ ...opts,
33
+ method: "POST",
34
+ body: giftRequest
35
+ })));
36
+ }
37
+ export function health(opts) {
38
+ return oazapfts.ok(oazapfts.fetchText("/health", {
39
+ ...opts
40
+ }));
41
+ }
42
+ export function getPhoneStatus(opts) {
43
+ return oazapfts.ok(oazapfts.fetchJson("/me/phone", {
44
+ ...opts
45
+ }));
46
+ }
47
+ export function rememberPhone(phoneNumber, opts) {
48
+ return oazapfts.ok(oazapfts.fetchText("/me/phone", oazapfts.json({
49
+ ...opts,
50
+ method: "PUT",
51
+ body: phoneNumber
52
+ })));
53
+ }
54
+ export function forgetPhone(opts) {
55
+ return oazapfts.ok(oazapfts.fetchText("/me/phone", {
56
+ ...opts,
57
+ method: "DELETE"
58
+ }));
59
+ }
60
+ export function requestPersonalDataDeletion(opts) {
61
+ return oazapfts.ok(oazapfts.fetchJson("/me/privacy-requests", {
62
+ ...opts,
63
+ method: "POST"
64
+ }));
65
+ }
66
+ export function createOrder(purchase, opts) {
67
+ return oazapfts.ok(oazapfts.fetchJson("/orders", oazapfts.json({
68
+ ...opts,
69
+ method: "POST",
70
+ body: purchase
71
+ })));
72
+ }
73
+ export function createPushOrder(pushPurchase, opts) {
74
+ return oazapfts.ok(oazapfts.fetchJson("/orders/push", oazapfts.json({
75
+ ...opts,
76
+ method: "POST",
77
+ body: pushPurchase
78
+ })));
79
+ }
80
+ export function getOrder(id, opts) {
81
+ return oazapfts.ok(oazapfts.fetchJson(`/orders/${encodeURIComponent(id)}`, {
82
+ ...opts
83
+ }));
84
+ }
85
+ export function orderEvents(id, opts) {
86
+ return oazapfts.ok(oazapfts.fetchText(`/orders/${encodeURIComponent(id)}/events`, {
87
+ ...opts
88
+ }));
89
+ }
90
+ export function getGiftPage(token, opts) {
91
+ return oazapfts.ok(oazapfts.fetchText(`/pay/${encodeURIComponent(token)}`, {
92
+ ...opts
93
+ }));
94
+ }
95
+ export function requestGiftPush(token, giftPush, opts) {
96
+ return oazapfts.ok(oazapfts.fetchText(`/pay/${encodeURIComponent(token)}/push`, oazapfts.json({
97
+ ...opts,
98
+ method: "POST",
99
+ body: giftPush
100
+ })));
101
+ }
102
+ export function createAnonymousPlayer(gameRequest, opts) {
103
+ return oazapfts.ok(oazapfts.fetchJson("/players/anonymous", oazapfts.json({
104
+ ...opts,
105
+ method: "POST",
106
+ body: gameRequest
107
+ })));
108
+ }
109
+ export function getPlayer(opts) {
110
+ return oazapfts.ok(oazapfts.fetchJson("/players/me", {
111
+ ...opts
112
+ }));
113
+ }
114
+ export function recoverPlayer(recoveryRequest, opts) {
115
+ return oazapfts.ok(oazapfts.fetchJson("/players/recover", oazapfts.json({
116
+ ...opts,
117
+ method: "POST",
118
+ body: recoveryRequest
119
+ })));
120
+ }
121
+ export function receivePeyWebhook(webhookId, webhookTimestamp, webhookSignature, body, opts) {
122
+ return oazapfts.ok(oazapfts.fetchText("/webhooks/pey", oazapfts.json({
123
+ ...opts,
124
+ method: "POST",
125
+ body,
126
+ headers: oazapfts.mergeHeaders(opts?.headers, {
127
+ "webhook-id": webhookId,
128
+ "webhook-timestamp": webhookTimestamp,
129
+ "webhook-signature": webhookSignature
130
+ })
131
+ })));
132
+ }
@@ -0,0 +1,25 @@
1
+ import * as api from "./generated.js";
2
+ export declare const SDK_VERSION = "0.1.0";
3
+ export { watchOrder } from "./watch.js";
4
+ export * as api from "./generated.js";
5
+ export type { Credentials, EntitlementView, OrderView, CatalogEntry } from "./generated.js";
6
+ /** Keep credentials per instance so separate games and players cannot share headers. */
7
+ export declare class PlayerClient {
8
+ readonly baseUrl: string;
9
+ readonly token: string;
10
+ private readonly options;
11
+ constructor(baseUrl: string, token: string, fetcher?: typeof fetch);
12
+ catalog(): Promise<api.CatalogEntry[]>;
13
+ create(purchase: api.Purchase): Promise<api.OrderView>;
14
+ push(purchase: api.PushPurchase): Promise<api.OrderView>;
15
+ gift(request: api.GiftRequest): Promise<api.GiftLink>;
16
+ phoneStatus(): Promise<api.PhoneStatus>;
17
+ rememberPhone(phoneNumber: string): Promise<never>;
18
+ forgetPhone(): Promise<never>;
19
+ order(id: string, signal?: AbortSignal): Promise<api.OrderView>;
20
+ pending(): Promise<api.EntitlementView[]>;
21
+ ack(id: string): Promise<never>;
22
+ stream(id: string, signal: AbortSignal): Promise<Response>;
23
+ /** apply must resolve only after the game's inventory transaction commits. */
24
+ recover(apply: (grant: api.EntitlementView) => Promise<void>): Promise<void>;
25
+ }
package/dist/index.js ADDED
@@ -0,0 +1,40 @@
1
+ import * as api from "./generated.js";
2
+ export const SDK_VERSION = "0.1.0";
3
+ export { watchOrder } from "./watch.js";
4
+ export * as api from "./generated.js";
5
+ /** Keep credentials per instance so separate games and players cannot share headers. */
6
+ export class PlayerClient {
7
+ baseUrl;
8
+ token;
9
+ options;
10
+ constructor(baseUrl, token, fetcher = globalThis.fetch) {
11
+ this.baseUrl = baseUrl;
12
+ this.token = token;
13
+ this.options = { baseUrl, headers: { Authorization: "Bearer " + token }, fetch: fetcher };
14
+ }
15
+ catalog() { return api.listCatalog(this.options); }
16
+ create(purchase) { return api.createOrder(purchase, this.options); }
17
+ push(purchase) { return api.createPushOrder(purchase, this.options); }
18
+ gift(request) { return api.issueGift(request, this.options); }
19
+ phoneStatus() { return api.getPhoneStatus(this.options); }
20
+ rememberPhone(phoneNumber) { return api.rememberPhone({ phoneNumber }, this.options); }
21
+ forgetPhone() { return api.forgetPhone(this.options); }
22
+ order(id, signal) { return api.getOrder(id, { ...this.options, signal }); }
23
+ pending() { return api.listEntitlements(this.options); }
24
+ ack(id) { return api.acknowledgeEntitlement(id, this.options); }
25
+ stream(id, signal) {
26
+ const url = this.baseUrl.replace(/\/$/, "") + "/orders/" + encodeURIComponent(id) + "/events";
27
+ // The browser fetch function requires its native receiver when invoked as a method.
28
+ const fetcher = this.options.fetch;
29
+ return fetcher(url, {
30
+ headers: { Authorization: "Bearer " + this.token, Accept: "text/event-stream" }, signal,
31
+ });
32
+ }
33
+ /** apply must resolve only after the game's inventory transaction commits. */
34
+ async recover(apply) {
35
+ for (const grant of await this.pending()) {
36
+ await apply(grant);
37
+ await this.ack(grant.id);
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,4 @@
1
+ import type { OrderView } from "./generated.js";
2
+ import type { PlayerClient } from "./index.js";
3
+ /** An authenticated stream always starts with a fresh committed snapshot. */
4
+ export declare function watchOrder(client: PlayerClient, id: string, signal: AbortSignal, changed: (order: OrderView) => Promise<void>, connection: (mode: "stream" | "poll" | "offline") => void): Promise<void>;
package/dist/watch.js ADDED
@@ -0,0 +1,76 @@
1
+ import { createParser } from "eventsource-parser";
2
+ function wait(signal, ms) {
3
+ return new Promise(resolve => {
4
+ function done() {
5
+ clearTimeout(timer);
6
+ signal.removeEventListener("abort", done);
7
+ resolve();
8
+ }
9
+ const timer = setTimeout(done, ms);
10
+ signal.addEventListener("abort", done, { once: true });
11
+ if (signal.aborted)
12
+ done();
13
+ });
14
+ }
15
+ /** An authenticated stream always starts with a fresh committed snapshot. */
16
+ export async function watchOrder(client, id, signal, changed, connection) {
17
+ while (!signal.aborted) {
18
+ const idle = new AbortController();
19
+ const streamSignal = AbortSignal.any([signal, idle.signal]);
20
+ // Heartbeat comments arrive every 15s. A silent proxy must also trigger polling.
21
+ const timeout = () => setTimeout(() => idle.abort(), 25_000);
22
+ let timer = timeout();
23
+ try {
24
+ const response = await client.stream(id, streamSignal);
25
+ if (!response.ok || !response.body || !response.headers.get("content-type")?.startsWith("text/event-stream")) {
26
+ throw new Error("Order stream unavailable");
27
+ }
28
+ const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
29
+ const snapshots = [];
30
+ const parser = createParser({
31
+ onEvent(event) {
32
+ if (event.event === "order")
33
+ snapshots.push(JSON.parse(event.data));
34
+ },
35
+ });
36
+ try {
37
+ connection("stream");
38
+ while (!streamSignal.aborted) {
39
+ const chunk = await reader.read();
40
+ if (chunk.done)
41
+ break;
42
+ clearTimeout(timer);
43
+ timer = timeout();
44
+ parser.feed(chunk.value);
45
+ for (const snapshot of snapshots.splice(0))
46
+ await changed(snapshot);
47
+ }
48
+ }
49
+ finally {
50
+ await reader.cancel().catch(() => { });
51
+ reader.releaseLock();
52
+ }
53
+ }
54
+ catch {
55
+ // A disconnect, idle connection or failed delivery resumes through the durable HTTP reads.
56
+ }
57
+ finally {
58
+ clearTimeout(timer);
59
+ idle.abort();
60
+ }
61
+ if (signal.aborted)
62
+ return;
63
+ try {
64
+ const order = await client.order(id, AbortSignal.any([signal, AbortSignal.timeout(5_000)]));
65
+ if (signal.aborted)
66
+ return;
67
+ connection("poll");
68
+ await changed(order);
69
+ }
70
+ catch {
71
+ if (!signal.aborted)
72
+ connection("offline");
73
+ }
74
+ await wait(signal, 2_000);
75
+ }
76
+ }
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
1
  {
2
2
  "name": "@argento-sdk/web",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "license": "SEE LICENSE IN LICENSE",
5
+ "repository": {"type": "git", "url": "git+https://github.com/argentohq/platform.git", "directory": "web/sdk"},
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ },
12
+ "./checkout": {
13
+ "types": "./dist/checkout.d.ts",
14
+ "import": "./dist/checkout.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc -p tsconfig.json",
22
+ "check": "tsc -p tsconfig.json --noEmit",
23
+ "prepack": "npm run build",
24
+ "generate": "oazapfts --optimistic ../../spec/openapi.json src/generated.ts",
25
+ "check:generated": "./check-generated.sh"
26
+ },
27
+ "devDependencies": {
28
+ "@types/qrcode": "1.5.6",
29
+ "fake-indexeddb": "6.2.8",
30
+ "oazapfts": "7.5.0",
31
+ "typescript": "5.9.3"
32
+ },
33
+ "dependencies": {
34
+ "@oazapfts/runtime": "1.2.0",
35
+ "eventsource-parser": "3.1.1",
36
+ "qrcode": "1.5.4"
37
+ }
38
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.