@voltro/plugin-economy 0.0.0-stage → 0.88.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/CHANGELOG.md +24492 -0
- package/LICENSE +61 -0
- package/README.md +2719 -2
- package/SECURITY.md +56 -0
- package/THIRD-PARTY-NOTICES.md +9841 -0
- package/dist/amount.js +20 -0
- package/dist/appleIap.server.js +262 -0
- package/dist/appleIapNotifications.server.js +162 -0
- package/dist/appleIapTrust.server.js +30 -0
- package/dist/bundleValue.server.js +112 -0
- package/dist/canonicalDataJson.js +10 -0
- package/dist/capture.js +53 -0
- package/dist/codePort.fixture.js +123 -0
- package/dist/codeStore.server.js +439 -0
- package/dist/codeTables.entity.js +43 -0
- package/dist/codes.d.ts +150 -0
- package/dist/codes.js +82 -0
- package/dist/components.d.ts +397 -0
- package/dist/components.js +283 -0
- package/dist/consistency.server.js +115 -0
- package/dist/containerStore.server.js +687 -0
- package/dist/containerStore.testFixtures.js +75 -0
- package/dist/containerTables.entity.js +45 -0
- package/dist/containers.d.ts +311 -0
- package/dist/containers.fixture.js +128 -0
- package/dist/containers.js +214 -0
- package/dist/containers.server.js +39 -0
- package/dist/containersPort.fixture.js +74 -0
- package/dist/currency.js +32 -0
- package/dist/declarationFixtures.js +61 -0
- package/dist/economy-app/events/economy.refundReversed.event.ts +1 -0
- package/dist/economy-app/events/economy.refunded.event.ts +1 -0
- package/dist/economyPort.fixture.js +124 -0
- package/dist/errors.d.ts +14 -0
- package/dist/errors.js +21 -0
- package/dist/events.d.ts +46 -0
- package/dist/events.js +1 -0
- package/dist/googleIap.server.js +391 -0
- package/dist/googleIapNotifications.server.js +130 -0
- package/dist/googleIapSubscription.server.js +183 -0
- package/dist/iap.d.ts +309 -0
- package/dist/iap.js +303 -0
- package/dist/iap.testFixtures.js +144 -0
- package/dist/iapAccountTables.entity.js +39 -0
- package/dist/iapAccounts.server.js +200 -0
- package/dist/iapBinding.server.js +523 -0
- package/dist/iapCheckout.server.js +97 -0
- package/dist/iapCompletion.server.js +55 -0
- package/dist/iapCurrentState.server.js +107 -0
- package/dist/iapCurrentState.testFixtures.js +22 -0
- package/dist/iapCurrentStatePort.fixture.js +63 -0
- package/dist/iapEntitlements.d.ts +79 -0
- package/dist/iapEntitlements.js +57 -0
- package/dist/iapEntitlements.server.js +48 -0
- package/dist/iapEntitlementsBinding.server.js +105 -0
- package/dist/iapEntitlementsPort.fixture.js +80 -0
- package/dist/iapInstalledEntitlements.testFixtures.js +75 -0
- package/dist/iapInstalledNotifications.testFixtures.js +93 -0
- package/dist/iapInventoryRefunds.server.js +261 -0
- package/dist/iapNotificationCustodyPort.fixture.js +67 -0
- package/dist/iapNotificationPort.fixture.js +73 -0
- package/dist/iapNotificationProcessor.server.js +134 -0
- package/dist/iapNotificationProcessor.testFixtures.js +63 -0
- package/dist/iapNotificationProcessorPort.fixture.js +55 -0
- package/dist/iapNotificationSchedule.server.js +69 -0
- package/dist/iapNotificationStore.server.js +352 -0
- package/dist/iapNotificationStore.testFixtures.js +31 -0
- package/dist/iapNotificationTables.entity.js +48 -0
- package/dist/iapNotificationTarget.server.js +36 -0
- package/dist/iapNotificationTarget.testFixtures.js +29 -0
- package/dist/iapNotifications.d.ts +644 -0
- package/dist/iapNotifications.js +6 -0
- package/dist/iapNotifications.server.js +95 -0
- package/dist/iapNotificationsBinding.server.js +232 -0
- package/dist/iapNotificationsSystemPort.fixture.js +50 -0
- package/dist/iapPlugin.testFixtures.js +59 -0
- package/dist/iapPort.fixture.js +74 -0
- package/dist/iapProviderCapture.server.js +17 -0
- package/dist/iapRecovery.d.ts +146 -0
- package/dist/iapRecovery.js +89 -0
- package/dist/iapRefundEventDelivery.server.js +82 -0
- package/dist/iapRefundEvents.js +44 -0
- package/dist/iapRefundEventsPort.fixture.js +59 -0
- package/dist/iapRefundPort.fixture.js +54 -0
- package/dist/iapRefundTables.entity.js +55 -0
- package/dist/iapRefunds.d.ts +755 -0
- package/dist/iapRefunds.js +6 -0
- package/dist/iapRefunds.server.js +553 -0
- package/dist/iapRefunds.testFixtures.js +64 -0
- package/dist/iapSpendAdmission.server.js +98 -0
- package/dist/iapStore.server.js +740 -0
- package/dist/iapStore.testFixtures.js +127 -0
- package/dist/iapTables.entity.js +80 -0
- package/dist/iapVerification.server.js +120 -0
- package/dist/index.d.ts +2984 -0
- package/dist/index.js +15 -0
- package/dist/intentionRecovery.js +133 -0
- package/dist/ledger.js +77 -0
- package/dist/loyalty.d.ts +274 -0
- package/dist/loyalty.fixture.js +92 -0
- package/dist/loyalty.js +311 -0
- package/dist/loyaltyBinding.server.js +203 -0
- package/dist/loyaltyPort.fixture.js +86 -0
- package/dist/loyaltyShopSource.server.js +90 -0
- package/dist/loyaltyStore.server.js +552 -0
- package/dist/loyaltyStore.testFixtures.js +82 -0
- package/dist/loyaltyTables.entity.js +49 -0
- package/dist/offerMerchandising.fixture.js +114 -0
- package/dist/offerMerchandising.js +282 -0
- package/dist/offerPolicies.d.ts +441 -0
- package/dist/offerPolicies.fixture.js +53 -0
- package/dist/offerPolicies.js +267 -0
- package/dist/piggyBanks.d.ts +272 -0
- package/dist/piggyBanks.fixture.js +70 -0
- package/dist/piggyBanks.js +200 -0
- package/dist/piggyBinding.server.js +204 -0
- package/dist/piggyPort.fixture.js +72 -0
- package/dist/piggyStore.server.js +610 -0
- package/dist/piggyStore.testFixtures.js +97 -0
- package/dist/piggyTables.entity.js +40 -0
- package/dist/plugin.js +1047 -0
- package/dist/port.js +12 -0
- package/dist/price.d.ts +99 -0
- package/dist/price.js +143 -0
- package/dist/purchaseRecovery.js +55 -0
- package/dist/reports.server.js +114 -0
- package/dist/rpc.d.ts +3201 -0
- package/dist/rpc.js +1200 -0
- package/dist/sanctionsTradeAuthority.server.js +79 -0
- package/dist/server.d.ts +3856 -0
- package/dist/server.js +43 -0
- package/dist/shop.d.ts +279 -0
- package/dist/shop.js +195 -0
- package/dist/shop.testFixtures.js +113 -0
- package/dist/shopPort.fixture.js +71 -0
- package/dist/shopPresentation.js +67 -0
- package/dist/shopStore.server.js +623 -0
- package/dist/shopTables.entity.js +62 -0
- package/dist/shopUiCopy.js +56 -0
- package/dist/spendLimits.d.ts +140 -0
- package/dist/spendLimits.fixture.js +52 -0
- package/dist/spendLimits.js +154 -0
- package/dist/spendLimitsPort.fixture.js +119 -0
- package/dist/subscriptionBinding.server.js +210 -0
- package/dist/subscriptionStore.server.js +642 -0
- package/dist/subscriptionStore.testFixtures.js +71 -0
- package/dist/subscriptionTables.entity.js +36 -0
- package/dist/subscriptions.d.ts +394 -0
- package/dist/subscriptions.fixture.js +96 -0
- package/dist/subscriptions.js +212 -0
- package/dist/subscriptionsPort.fixture.js +75 -0
- package/dist/systemFixtures.js +88 -0
- package/dist/tables.entity.js +82 -0
- package/dist/testing.d.ts +4615 -0
- package/dist/testing.js +29 -0
- package/dist/tradeAuthority.server.js +171 -0
- package/dist/tradeBinding.server.js +200 -0
- package/dist/tradeComponents.js +341 -0
- package/dist/tradeEscrow.server.js +231 -0
- package/dist/tradeEscrow.testFixtures.js +132 -0
- package/dist/tradeExpiry.server.js +42 -0
- package/dist/tradeRecovery.js +47 -0
- package/dist/tradeStore.server.js +749 -0
- package/dist/tradeStore.testFixtures.js +72 -0
- package/dist/tradeTables.entity.js +65 -0
- package/dist/tradeUiCopy.js +78 -0
- package/dist/trades.d.ts +246 -0
- package/dist/trades.fixture.js +102 -0
- package/dist/trades.js +288 -0
- package/dist/tradesPort.fixture.js +93 -0
- package/dist/walletEscrow.js +105 -0
- package/dist/walletEscrow.server.js +375 -0
- package/dist/walletKeys.server.js +4 -0
- package/dist/walletStore.js +570 -0
- package/dist/web.d.ts +2257 -0
- package/dist/web.js +8 -0
- package/package.json +161 -4
package/dist/codes.d.ts
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { Context } from 'effect';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
|
+
import { PluginPrivacyTarget } from '@voltro/protocol';
|
|
4
|
+
import { Schema } from 'effect';
|
|
5
|
+
import { Subject } from '@voltro/protocol';
|
|
6
|
+
import { YieldableError } from 'effect/Cause';
|
|
7
|
+
|
|
8
|
+
export declare const captureCodeIntent: (input: RedeemCodeInput) => RedeemCodeInput;
|
|
9
|
+
|
|
10
|
+
export declare const captureCodeService: (input: CodeService) => CodeService;
|
|
11
|
+
|
|
12
|
+
/** Case-sensitive code intention, never normalization that expands authority. */
|
|
13
|
+
export declare const captureCodeValue: (input: unknown) => string;
|
|
14
|
+
|
|
15
|
+
export declare interface CodeDefinition {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly version?: string | undefined;
|
|
18
|
+
readonly campaign: string;
|
|
19
|
+
readonly items?: readonly {
|
|
20
|
+
readonly itemId: string | undefined;
|
|
21
|
+
readonly qty: number;
|
|
22
|
+
}[];
|
|
23
|
+
readonly currencies?: readonly {
|
|
24
|
+
readonly currency: string | undefined;
|
|
25
|
+
readonly amount: EconomyAmountInput;
|
|
26
|
+
}[];
|
|
27
|
+
readonly from?: number | null;
|
|
28
|
+
readonly until?: number | null;
|
|
29
|
+
readonly limits: {
|
|
30
|
+
readonly global: number;
|
|
31
|
+
readonly perPlayer: number;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export declare type CodeEligibility = (input: CodeEligibilityContext) => boolean;
|
|
36
|
+
|
|
37
|
+
export declare interface CodeEligibilityContext {
|
|
38
|
+
readonly definition: PromoCode;
|
|
39
|
+
readonly at: number;
|
|
40
|
+
readonly claims: number;
|
|
41
|
+
readonly playerClaims: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export declare type CodeObservation = {
|
|
45
|
+
readonly requestId: string;
|
|
46
|
+
readonly state: 'not-observed' | 'pending';
|
|
47
|
+
} | {
|
|
48
|
+
readonly requestId: string;
|
|
49
|
+
readonly state: 'fulfilled';
|
|
50
|
+
readonly receipt: CodeReceipt;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export declare class CodePort extends CodePort_base {
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare const CodePort_base: Context.ServiceClass<CodePort, "@voltro/CodePort", CodeService>;
|
|
57
|
+
|
|
58
|
+
export declare interface CodeReceipt {
|
|
59
|
+
readonly operationId: string;
|
|
60
|
+
readonly codeId: string;
|
|
61
|
+
readonly version: string;
|
|
62
|
+
readonly campaign: string;
|
|
63
|
+
readonly at: number;
|
|
64
|
+
readonly transfers: readonly {
|
|
65
|
+
readonly txId: string;
|
|
66
|
+
readonly currency: string;
|
|
67
|
+
readonly amount: string;
|
|
68
|
+
readonly at: number;
|
|
69
|
+
}[];
|
|
70
|
+
readonly grants: readonly {
|
|
71
|
+
readonly operationId: string;
|
|
72
|
+
readonly kind: 'grant';
|
|
73
|
+
readonly changes: readonly {
|
|
74
|
+
readonly instanceId: string;
|
|
75
|
+
readonly delta: number;
|
|
76
|
+
}[];
|
|
77
|
+
readonly at: number;
|
|
78
|
+
}[];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export declare interface CodeService {
|
|
82
|
+
readonly create: (subject: Subject, input: CreateCodeInput) => Effect.Effect<void, EconomyError>;
|
|
83
|
+
readonly redeem: (subject: Subject, input: RedeemCodeInput) => Effect.Effect<CodeReceipt, EconomyError>;
|
|
84
|
+
readonly receipt: (subject: Subject, input: RedeemCodeInput) => Effect.Effect<CodeObservation, EconomyError>;
|
|
85
|
+
readonly exportSubject: (target: PluginPrivacyTarget) => Effect.Effect<unknown, EconomyError>;
|
|
86
|
+
readonly eraseSubject: (target: PluginPrivacyTarget) => Effect.Effect<void, EconomyError>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export declare interface CreateCodeInput {
|
|
90
|
+
readonly tenantId: string;
|
|
91
|
+
readonly code: string;
|
|
92
|
+
readonly definition: CodeDefinition | PromoCode;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
declare interface CurrencyDefinition {
|
|
96
|
+
readonly id: string;
|
|
97
|
+
readonly kind: 'soft' | 'hard';
|
|
98
|
+
readonly cap?: EconomyAmountInput;
|
|
99
|
+
readonly premium?: boolean;
|
|
100
|
+
readonly display?: {
|
|
101
|
+
readonly nameKey: string;
|
|
102
|
+
} | null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** One default, independently preserved as the hard safety envelope for custom
|
|
106
|
+
* rules. A custom rule can narrow admission; never raise captured code limits. */
|
|
107
|
+
export declare const defaultCodeEligibility: CodeEligibility;
|
|
108
|
+
|
|
109
|
+
/** Code values are supplied privately at runtime; declarations contain no code,
|
|
110
|
+
* provider credential, amount chosen by a player or alternative grant writer. */
|
|
111
|
+
export declare const defineCode: (input: CodeDefinition | PromoCode, declarations: readonly CurrencyDefinition[]) => PromoCode;
|
|
112
|
+
|
|
113
|
+
declare type EconomyAmountInput = string | number | bigint;
|
|
114
|
+
|
|
115
|
+
/** Redacted codes; never carries owners, amounts or provider payloads. */
|
|
116
|
+
declare class EconomyError extends EconomyError_base {
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare const EconomyError_base: Schema.Class<EconomyError, Schema.TaggedStruct<"EconomyError", {
|
|
120
|
+
readonly code: Schema.Literals<readonly ["invalid_currency", "invalid_amount", "overflow", "invalid_price", "real_money_disabled", "invalid_input", "invalid_record", "currency_cap_reached", "insufficient_funds", "conflict", "forbidden", "unavailable", "not_found", "erased", "limit_exceeded", "already_redeemed"]>;
|
|
121
|
+
}>, YieldableError>;
|
|
122
|
+
|
|
123
|
+
export declare interface PromoCode {
|
|
124
|
+
readonly id: string;
|
|
125
|
+
readonly version: string;
|
|
126
|
+
readonly campaign: string;
|
|
127
|
+
readonly items: readonly {
|
|
128
|
+
readonly itemId: string;
|
|
129
|
+
readonly qty: number;
|
|
130
|
+
}[];
|
|
131
|
+
readonly currencies: readonly {
|
|
132
|
+
readonly currency: string;
|
|
133
|
+
readonly amount: string;
|
|
134
|
+
}[];
|
|
135
|
+
readonly from: number | null;
|
|
136
|
+
readonly until: number | null;
|
|
137
|
+
readonly limits: {
|
|
138
|
+
readonly global: number;
|
|
139
|
+
readonly perPlayer: number;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export declare interface RedeemCodeInput {
|
|
144
|
+
readonly code: string;
|
|
145
|
+
readonly requestId: string;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export declare const resolveCodeEligibility: (input: CodeEligibilityContext, declarations: readonly CurrencyDefinition[], slot?: CodeEligibility) => boolean;
|
|
149
|
+
|
|
150
|
+
export { }
|
package/dist/codes.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { economyError as e } from "./errors.js";
|
|
2
|
+
import { captureBoundMethods as t, dataList as n, dataObject as r, identifier as i } from "./capture.js";
|
|
3
|
+
import { positiveAmount as a } from "./amount.js";
|
|
4
|
+
import { captureCurrencies as o } from "./currency.js";
|
|
5
|
+
import { shopInteger as s } from "./shop.js";
|
|
6
|
+
import { Context as c } from "effect";
|
|
7
|
+
// src/codes.ts
|
|
8
|
+
var l = (t, c) => {
|
|
9
|
+
let l = r(t, [
|
|
10
|
+
"id",
|
|
11
|
+
"version",
|
|
12
|
+
"campaign",
|
|
13
|
+
"items",
|
|
14
|
+
"currencies",
|
|
15
|
+
"from",
|
|
16
|
+
"until",
|
|
17
|
+
"limits"
|
|
18
|
+
]), u = o(c), d = Object.freeze(n(l.items ?? [], 16).map((e) => {
|
|
19
|
+
let t = r(e, ["itemId", "qty"]);
|
|
20
|
+
return Object.freeze({
|
|
21
|
+
itemId: i(t.itemId),
|
|
22
|
+
qty: s(t.qty, 1, 1e6)
|
|
23
|
+
});
|
|
24
|
+
})), f = Object.freeze(n(l.currencies ?? [], 16).map((t) => {
|
|
25
|
+
let n = r(t, ["currency", "amount"]), o = i(n.currency), s = u.find((e) => e.id === o), c = a(n.amount);
|
|
26
|
+
if (!s || c > BigInt(s.cap)) throw e("invalid_currency");
|
|
27
|
+
return Object.freeze({
|
|
28
|
+
currency: o,
|
|
29
|
+
amount: c.toString()
|
|
30
|
+
});
|
|
31
|
+
}));
|
|
32
|
+
if (!d.length && !f.length || new Set(d.map((e) => e.itemId)).size !== d.length || new Set(f.map((e) => e.currency)).size !== f.length) throw e("invalid_input");
|
|
33
|
+
let p = l.from == null ? null : s(l.from, 0, 864e13), m = l.until == null ? null : s(l.until, 1, 864e13);
|
|
34
|
+
if (p !== null && m !== null && p >= m) throw e("invalid_input");
|
|
35
|
+
let h = r(l.limits, ["global", "perPlayer"]), g = s(h.global, 1, 1e5), _ = s(h.perPlayer, 1, g);
|
|
36
|
+
return Object.freeze({
|
|
37
|
+
id: i(l.id),
|
|
38
|
+
version: i(l.version ?? "1"),
|
|
39
|
+
campaign: i(l.campaign),
|
|
40
|
+
items: d,
|
|
41
|
+
currencies: f,
|
|
42
|
+
from: p,
|
|
43
|
+
until: m,
|
|
44
|
+
limits: Object.freeze({
|
|
45
|
+
global: g,
|
|
46
|
+
perPlayer: _
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}, u = class extends c.Service()("@voltro/CodePort") {}, d = (e) => t(e, [
|
|
50
|
+
"create",
|
|
51
|
+
"redeem",
|
|
52
|
+
"receipt",
|
|
53
|
+
"exportSubject",
|
|
54
|
+
"eraseSubject"
|
|
55
|
+
]), f = ({ definition: e, at: t, claims: n, playerClaims: r }) => (e.from === null || t >= e.from) && (e.until === null || t < e.until) && n < e.limits.global && r < e.limits.perPlayer, p = (t, n, i = f) => {
|
|
56
|
+
if (typeof i != "function") throw e("invalid_input");
|
|
57
|
+
let a = r(t, [
|
|
58
|
+
"definition",
|
|
59
|
+
"at",
|
|
60
|
+
"claims",
|
|
61
|
+
"playerClaims"
|
|
62
|
+
]), o = l(a.definition, n), c = Object.freeze({
|
|
63
|
+
definition: o,
|
|
64
|
+
at: s(a.at, 0, 864e13),
|
|
65
|
+
claims: s(a.claims, 0, 1e5),
|
|
66
|
+
playerClaims: s(a.playerClaims, 0, 1e5)
|
|
67
|
+
});
|
|
68
|
+
if (c.playerClaims > c.claims) throw e("invalid_input");
|
|
69
|
+
let u = i(c);
|
|
70
|
+
if (typeof u != "boolean") throw e("invalid_input");
|
|
71
|
+
return u && f(c);
|
|
72
|
+
}, m = (t) => {
|
|
73
|
+
if (typeof t != "string" || !/^[A-Za-z0-9_-]{8,120}$/.test(t)) throw e("invalid_input");
|
|
74
|
+
return t;
|
|
75
|
+
}, h = (e) => {
|
|
76
|
+
let t = r(e, ["code", "requestId"]);
|
|
77
|
+
return Object.freeze({
|
|
78
|
+
code: m(t.code),
|
|
79
|
+
requestId: i(t.requestId)
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
export { u as CodePort, h as captureCodeIntent, d as captureCodeService, m as captureCodeValue, f as defaultCodeEligibility, l as defineCode, p as resolveCodeEligibility };
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export declare const captureShopOfferView: (input: ShopOfferView) => ShopOfferView;
|
|
4
|
+
|
|
5
|
+
declare type ContentProps = {
|
|
6
|
+
readonly title: (key: string) => string;
|
|
7
|
+
readonly currencyLabel?: ((id: string) => string) | undefined;
|
|
8
|
+
readonly renderRewards?: ((view: ShopOfferView) => ReactNode) | undefined;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
declare type CopyProps = {
|
|
12
|
+
readonly locale?: 'en' | 'de' | undefined;
|
|
13
|
+
readonly copy?: ShopUiCopy | undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare type CopyProps_2 = {
|
|
17
|
+
readonly locale?: 'en' | 'de' | undefined;
|
|
18
|
+
readonly copy?: TradeUiCopy | undefined;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
declare type EconomyAmountInput = string | number | bigint;
|
|
22
|
+
|
|
23
|
+
declare type EconomyChannel = 'web' | 'ios' | 'android' | 'steam';
|
|
24
|
+
|
|
25
|
+
declare type Labels = {
|
|
26
|
+
readonly itemLabel?: ((instanceId: string) => string) | undefined;
|
|
27
|
+
readonly currencyLabel?: ((currency: string) => string) | undefined;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export declare const OfferCard: (props: OfferCardProps) => ReactNode;
|
|
31
|
+
|
|
32
|
+
export declare interface OfferCardProps extends CopyProps, ContentProps {
|
|
33
|
+
readonly view: ShopOfferView;
|
|
34
|
+
readonly at: number;
|
|
35
|
+
readonly busy?: boolean | undefined;
|
|
36
|
+
readonly onSelect: (view: ShopOfferView, currency: string | undefined) => void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare type Price = {
|
|
40
|
+
readonly kind: 'virtual';
|
|
41
|
+
readonly options: readonly ResolvedVirtualPriceOption[];
|
|
42
|
+
} | ({
|
|
43
|
+
readonly kind: 'real';
|
|
44
|
+
} & RealPriceDefinition) | {
|
|
45
|
+
readonly kind: 'mixed';
|
|
46
|
+
readonly real: RealPriceDefinition;
|
|
47
|
+
readonly virtual: readonly ResolvedVirtualPriceOption[];
|
|
48
|
+
} | {
|
|
49
|
+
readonly kind: 'free';
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** Protected native-modal confirmation. Transport/journal and uncertain recovery remain parent-owned. */
|
|
53
|
+
export declare const PurchaseDialog: (props: PurchaseDialogProps) => ReactNode;
|
|
54
|
+
|
|
55
|
+
export declare interface PurchaseDialogProps extends CopyProps, ContentProps {
|
|
56
|
+
readonly open: boolean;
|
|
57
|
+
readonly view: ShopOfferView;
|
|
58
|
+
readonly intention: ShopBuyInput;
|
|
59
|
+
readonly at: number;
|
|
60
|
+
readonly busy: boolean;
|
|
61
|
+
readonly error?: unknown;
|
|
62
|
+
readonly receipt?: ShopOrderReceipt | undefined;
|
|
63
|
+
readonly onConfirm: (request: ShopBuyInput) => void;
|
|
64
|
+
readonly onClose: () => void;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Mount above transient offer errors/filters; closing an offer never deletes this reference. */
|
|
68
|
+
export declare const PurchaseRecovery: (props: PurchaseRecoveryProps) => ReactNode;
|
|
69
|
+
|
|
70
|
+
export declare interface PurchaseRecoveryProps extends CopyProps {
|
|
71
|
+
readonly reference: ShopPurchaseReference | undefined;
|
|
72
|
+
readonly busy: boolean;
|
|
73
|
+
readonly error?: unknown;
|
|
74
|
+
readonly onRetry: (request: ShopBuyInput) => void;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
declare interface RealPriceDefinition {
|
|
78
|
+
/** Integer minor-unit references; verified store receipts remain authoritative. */
|
|
79
|
+
readonly prices: Readonly<Record<string, number>>;
|
|
80
|
+
readonly storeProductIds: Partial<Readonly<Record<EconomyChannel, string>>>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare interface ResolvedVirtualPriceOption {
|
|
84
|
+
readonly currency: string;
|
|
85
|
+
readonly amount: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
declare interface ShopBuyInput {
|
|
89
|
+
readonly offerId: string;
|
|
90
|
+
readonly offerVersion: string;
|
|
91
|
+
readonly offerDigest: string;
|
|
92
|
+
readonly requestId: string;
|
|
93
|
+
readonly currency?: string | undefined;
|
|
94
|
+
readonly qty?: number | undefined;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export declare const ShopGrid: (props: ShopGridProps) => ReactNode;
|
|
98
|
+
|
|
99
|
+
export declare interface ShopGridProps extends CopyProps, ContentProps {
|
|
100
|
+
readonly source: {
|
|
101
|
+
readonly data: readonly ShopOfferView[] | undefined;
|
|
102
|
+
readonly loading: boolean;
|
|
103
|
+
readonly error: unknown;
|
|
104
|
+
};
|
|
105
|
+
readonly at: number;
|
|
106
|
+
readonly busy?: boolean | undefined;
|
|
107
|
+
readonly onSelect: OfferCardProps['onSelect'];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
declare interface ShopItemGrant {
|
|
111
|
+
readonly itemId: string;
|
|
112
|
+
readonly qty: number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
declare interface ShopOffer {
|
|
116
|
+
readonly id: string;
|
|
117
|
+
readonly version: string;
|
|
118
|
+
readonly titleKey: string;
|
|
119
|
+
readonly price: Price;
|
|
120
|
+
readonly items: readonly ShopItemGrant[];
|
|
121
|
+
readonly currencies: readonly {
|
|
122
|
+
readonly currency: string;
|
|
123
|
+
readonly amount: string;
|
|
124
|
+
}[];
|
|
125
|
+
readonly from: number | null;
|
|
126
|
+
readonly until: number | null;
|
|
127
|
+
readonly segment: string | null;
|
|
128
|
+
readonly flag: string | null;
|
|
129
|
+
readonly countries: readonly string[];
|
|
130
|
+
readonly limits: {
|
|
131
|
+
readonly perPlayer: number | null;
|
|
132
|
+
readonly perDay: number | null;
|
|
133
|
+
readonly global: number | null;
|
|
134
|
+
};
|
|
135
|
+
readonly oneTime: boolean;
|
|
136
|
+
readonly maxQuantity: number;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export declare const shopOfferAvailable: (view: ShopOfferView, at: number) => boolean;
|
|
140
|
+
|
|
141
|
+
declare interface ShopOfferView {
|
|
142
|
+
readonly offerDigest: string;
|
|
143
|
+
readonly offer: ShopOffer;
|
|
144
|
+
readonly price: Price;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
declare interface ShopOrderReceipt {
|
|
148
|
+
readonly orderId: string;
|
|
149
|
+
readonly offerId: string;
|
|
150
|
+
readonly offerVersion: string;
|
|
151
|
+
readonly offerDigest: string;
|
|
152
|
+
readonly quantity: number;
|
|
153
|
+
readonly at: number;
|
|
154
|
+
readonly pricePaid: {
|
|
155
|
+
readonly kind: 'free';
|
|
156
|
+
} | {
|
|
157
|
+
readonly kind: 'virtual';
|
|
158
|
+
readonly currency: string;
|
|
159
|
+
readonly amount: string;
|
|
160
|
+
};
|
|
161
|
+
readonly transfers: readonly {
|
|
162
|
+
readonly txId: string;
|
|
163
|
+
readonly currency: string;
|
|
164
|
+
readonly amount: string;
|
|
165
|
+
readonly at: number;
|
|
166
|
+
}[];
|
|
167
|
+
readonly grants: readonly {
|
|
168
|
+
readonly operationId: string;
|
|
169
|
+
readonly kind: 'grant';
|
|
170
|
+
readonly changes: readonly {
|
|
171
|
+
readonly instanceId: string;
|
|
172
|
+
readonly delta: number;
|
|
173
|
+
}[];
|
|
174
|
+
readonly at: number;
|
|
175
|
+
}[];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
declare const shopPayment: (price: Price, currency: string | null, quantity: number) => ShopOrderReceipt["pricePaid"];
|
|
179
|
+
|
|
180
|
+
declare interface ShopPurchaseReference {
|
|
181
|
+
readonly version: 1;
|
|
182
|
+
/** Stable app + authenticated account/tenant scope; no endpoint credentials. */
|
|
183
|
+
readonly scope: string;
|
|
184
|
+
readonly request: ShopBuyInput;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export declare interface ShopPurchaseTerms {
|
|
188
|
+
readonly request: ShopBuyInput;
|
|
189
|
+
readonly current: ReturnType<typeof shopPayment>;
|
|
190
|
+
/** The immutable declaration is the ceiling; a personalized discount is not a fixed quote. */
|
|
191
|
+
readonly maximum: ReturnType<typeof shopPayment>;
|
|
192
|
+
readonly discountPercent: number;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export declare const shopPurchaseTerms: (input: ShopOfferView, intention: ShopBuyInput) => ShopPurchaseTerms;
|
|
196
|
+
|
|
197
|
+
export declare interface ShopUiCopy {
|
|
198
|
+
readonly shop: string;
|
|
199
|
+
readonly loading: string;
|
|
200
|
+
readonly unavailable: string;
|
|
201
|
+
readonly empty: string;
|
|
202
|
+
readonly choose: string;
|
|
203
|
+
readonly free: string;
|
|
204
|
+
readonly oneTime: string;
|
|
205
|
+
readonly closed: string;
|
|
206
|
+
readonly providersMissing: string;
|
|
207
|
+
readonly confirm: string;
|
|
208
|
+
readonly cancel: string;
|
|
209
|
+
readonly sending: string;
|
|
210
|
+
readonly uncertain: string;
|
|
211
|
+
readonly retry: string;
|
|
212
|
+
readonly complete: string;
|
|
213
|
+
readonly invalid: string;
|
|
214
|
+
readonly originalRequest: string;
|
|
215
|
+
readonly originalOffer: string;
|
|
216
|
+
readonly pricePolicy: string;
|
|
217
|
+
readonly currentPrice: string;
|
|
218
|
+
readonly maximumPrice: string;
|
|
219
|
+
readonly quantity: string;
|
|
220
|
+
readonly endsIn: (seconds: number) => string;
|
|
221
|
+
readonly discount: (percent: number) => string;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export declare const shopUiCopy: Readonly<Readonly<Record<"en" | "de", ShopUiCopy>>>;
|
|
225
|
+
|
|
226
|
+
/** Protected native-modal confirmation. Journal/uncertain recovery remain parent-owned. */
|
|
227
|
+
export declare const TradeAcceptDialog: (props: TradeAcceptDialogProps) => ReactNode;
|
|
228
|
+
|
|
229
|
+
export declare interface TradeAcceptDialogProps extends TradeTermsProps {
|
|
230
|
+
readonly open: boolean;
|
|
231
|
+
readonly actorId: string;
|
|
232
|
+
readonly at: number;
|
|
233
|
+
readonly intention: TradeAcceptInput;
|
|
234
|
+
readonly busy: boolean;
|
|
235
|
+
readonly error?: unknown;
|
|
236
|
+
readonly receipt?: TradeReceipt | undefined;
|
|
237
|
+
readonly onConfirm: (intention: TradeAcceptInput) => void;
|
|
238
|
+
readonly onClose: () => void;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
declare interface TradeAcceptInput {
|
|
242
|
+
readonly tradeId: string;
|
|
243
|
+
readonly tradeDigest: string;
|
|
244
|
+
readonly requestId: string;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
declare interface TradeCurrencyIntention {
|
|
248
|
+
readonly currency: string;
|
|
249
|
+
readonly amount: EconomyAmountInput;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
declare type TradeIntention = {
|
|
253
|
+
readonly kind: 'propose';
|
|
254
|
+
readonly input: TradeProposeInput;
|
|
255
|
+
} | {
|
|
256
|
+
readonly kind: 'accept';
|
|
257
|
+
readonly input: TradeAcceptInput;
|
|
258
|
+
} | {
|
|
259
|
+
readonly kind: 'cancel';
|
|
260
|
+
readonly input: {
|
|
261
|
+
readonly tradeId: string;
|
|
262
|
+
readonly requestId: string;
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/** Mount above transient Trade list errors/dialogs; no dismiss action or silent journal deletion. */
|
|
267
|
+
export declare const TradeIntentionRecovery: (props: TradeIntentionRecoveryProps) => ReactNode;
|
|
268
|
+
|
|
269
|
+
export declare interface TradeIntentionRecoveryProps extends CopyProps_2, Labels {
|
|
270
|
+
readonly reference: TradeIntentionReference | undefined;
|
|
271
|
+
readonly scope: string | undefined;
|
|
272
|
+
readonly busy: boolean;
|
|
273
|
+
readonly error?: unknown;
|
|
274
|
+
readonly onRetry: (intention: TradeIntention) => void;
|
|
275
|
+
readonly onCheckReceipt?: ((requestId: string) => void) | undefined;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
declare interface TradeIntentionReference {
|
|
279
|
+
readonly version: 1;
|
|
280
|
+
readonly scope: string;
|
|
281
|
+
readonly request: TradeIntention;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
declare interface TradeItemIntention {
|
|
285
|
+
readonly instanceId: string;
|
|
286
|
+
readonly qty: number;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
declare interface TradeLeg {
|
|
290
|
+
readonly items: readonly TradeItemIntention[];
|
|
291
|
+
readonly currencies: readonly {
|
|
292
|
+
readonly currency: string;
|
|
293
|
+
readonly amount: string;
|
|
294
|
+
}[];
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
declare interface TradeLegDefinition {
|
|
298
|
+
readonly items: readonly TradeItemIntention[];
|
|
299
|
+
readonly currencies: readonly TradeCurrencyIntention[];
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export declare const TradeList: (props: TradeListProps) => ReactNode;
|
|
303
|
+
|
|
304
|
+
export declare interface TradeListProps extends CopyProps_2, Labels {
|
|
305
|
+
readonly source: {
|
|
306
|
+
readonly data: readonly TradeView[] | undefined;
|
|
307
|
+
readonly loading: boolean;
|
|
308
|
+
readonly error: unknown;
|
|
309
|
+
};
|
|
310
|
+
/** Presentation only. The actual server derives its Subject; this never authorizes a write. */
|
|
311
|
+
readonly actorId: string;
|
|
312
|
+
readonly at: number;
|
|
313
|
+
readonly busy?: boolean | undefined;
|
|
314
|
+
readonly onAccept: (view: TradeView) => void;
|
|
315
|
+
readonly onCancel: (view: TradeView) => void;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
declare interface TradeProposeInput {
|
|
319
|
+
readonly toId: string | null;
|
|
320
|
+
readonly offered: TradeLegDefinition;
|
|
321
|
+
readonly requested: TradeLegDefinition;
|
|
322
|
+
readonly durationMs: number;
|
|
323
|
+
readonly requestId: string;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
declare interface TradeReceipt {
|
|
327
|
+
readonly operationId: string;
|
|
328
|
+
readonly requestId: string;
|
|
329
|
+
readonly trade: TradeView;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
declare interface TradeTaxView {
|
|
333
|
+
readonly leg: 'offered' | 'requested';
|
|
334
|
+
readonly currency: string;
|
|
335
|
+
readonly gross: string;
|
|
336
|
+
readonly net: string;
|
|
337
|
+
readonly tax: string;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** Original server disclosure; no current player values, computed price or trust facts. */
|
|
341
|
+
export declare const TradeTerms: (props: TradeTermsProps) => ReactNode;
|
|
342
|
+
|
|
343
|
+
export declare interface TradeTermsProps extends CopyProps_2, Labels {
|
|
344
|
+
readonly view: TradeView;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export declare interface TradeUiCopy {
|
|
348
|
+
readonly title: string;
|
|
349
|
+
readonly loading: string;
|
|
350
|
+
readonly unavailable: string;
|
|
351
|
+
readonly invalid: string;
|
|
352
|
+
readonly empty: string;
|
|
353
|
+
readonly offered: string;
|
|
354
|
+
readonly requested: string;
|
|
355
|
+
readonly emptyLeg: string;
|
|
356
|
+
readonly accept: string;
|
|
357
|
+
readonly cancel: string;
|
|
358
|
+
readonly close: string;
|
|
359
|
+
readonly confirm: string;
|
|
360
|
+
readonly confirmation: string;
|
|
361
|
+
readonly confirmationHelp: string;
|
|
362
|
+
readonly expired: string;
|
|
363
|
+
readonly sending: string;
|
|
364
|
+
readonly complete: string;
|
|
365
|
+
readonly recovery: string;
|
|
366
|
+
readonly uncertain: string;
|
|
367
|
+
readonly retry: string;
|
|
368
|
+
readonly checkReceipt: string;
|
|
369
|
+
readonly reference: string;
|
|
370
|
+
readonly operation: {
|
|
371
|
+
readonly propose: string;
|
|
372
|
+
readonly accept: string;
|
|
373
|
+
readonly cancel: string;
|
|
374
|
+
};
|
|
375
|
+
readonly status: Readonly<Record<TradeView['state'], string>>;
|
|
376
|
+
readonly expires: (date: string) => string;
|
|
377
|
+
readonly payment: (gross: string, net: string, tax: string, currency: string) => string;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export declare const tradeUiCopy: Readonly<Readonly<Record<"en" | "de", TradeUiCopy>>>;
|
|
381
|
+
|
|
382
|
+
declare interface TradeView {
|
|
383
|
+
readonly tradeId: string;
|
|
384
|
+
readonly tradeDigest: string;
|
|
385
|
+
readonly proposerId: string;
|
|
386
|
+
readonly toId: string | null;
|
|
387
|
+
readonly offered: TradeLeg;
|
|
388
|
+
readonly requested: TradeLeg;
|
|
389
|
+
readonly createdAt: number;
|
|
390
|
+
readonly expiresAt: number;
|
|
391
|
+
readonly state: 'proposed' | 'accepted' | 'cancelled' | 'expired';
|
|
392
|
+
readonly accepterId: string | null;
|
|
393
|
+
readonly rulesVersion: string;
|
|
394
|
+
readonly taxes: readonly TradeTaxView[];
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export { }
|