agentmall 0.1.0 → 0.1.2
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/dist/cli.js +41 -15
- package/dist/index.cjs +37 -7
- package/dist/index.d.cts +22 -4
- package/dist/index.d.ts +22 -4
- package/dist/index.js +37 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -65,6 +65,7 @@ function createIdempotencyKey() {
|
|
|
65
65
|
var AgentMall = class {
|
|
66
66
|
baseUrl;
|
|
67
67
|
apiSecret;
|
|
68
|
+
account;
|
|
68
69
|
_fetch;
|
|
69
70
|
products;
|
|
70
71
|
purchases;
|
|
@@ -73,6 +74,7 @@ var AgentMall = class {
|
|
|
73
74
|
constructor(config = {}) {
|
|
74
75
|
this.baseUrl = (config.baseUrl ?? BASE_URL).replace(/\/$/, "");
|
|
75
76
|
this.apiSecret = config.apiSecret;
|
|
77
|
+
this.account = config.account;
|
|
76
78
|
this._fetch = config.fetch ?? globalThis.fetch.bind(globalThis);
|
|
77
79
|
this.products = new AgentMallProducts(this);
|
|
78
80
|
this.purchases = new AgentMallPurchases(this);
|
|
@@ -80,6 +82,10 @@ var AgentMall = class {
|
|
|
80
82
|
this.refunds = new AgentMallRefunds(this);
|
|
81
83
|
}
|
|
82
84
|
/** @internal */
|
|
85
|
+
getAccount() {
|
|
86
|
+
return this.account;
|
|
87
|
+
}
|
|
88
|
+
/** @internal */
|
|
83
89
|
async request(method, path, options) {
|
|
84
90
|
const url = new URL(`${this.baseUrl}${path}`);
|
|
85
91
|
if (options?.params) {
|
|
@@ -159,8 +165,28 @@ var AgentMallPurchases = class {
|
|
|
159
165
|
}
|
|
160
166
|
});
|
|
161
167
|
}
|
|
162
|
-
/** Get a single purchase by ID
|
|
163
|
-
async get(id) {
|
|
168
|
+
/** Get a single purchase by ID using either operator auth or the payer wallet. */
|
|
169
|
+
async get(id, options) {
|
|
170
|
+
const account = options?.account ?? this.client.getAccount();
|
|
171
|
+
if (account) {
|
|
172
|
+
const challenge = await this.client.request(
|
|
173
|
+
"POST",
|
|
174
|
+
"/api/purchases/status/challenge",
|
|
175
|
+
{
|
|
176
|
+
body: { id }
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
const signature = await account.signMessage({
|
|
180
|
+
message: challenge.message
|
|
181
|
+
});
|
|
182
|
+
return this.client.request("POST", "/api/purchases/status", {
|
|
183
|
+
body: {
|
|
184
|
+
id,
|
|
185
|
+
challenge: challenge.challenge,
|
|
186
|
+
signature
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
164
190
|
return this.client.request("GET", "/api/purchases", {
|
|
165
191
|
auth: true,
|
|
166
192
|
params: { id }
|
|
@@ -222,15 +248,19 @@ var AgentMallRefunds = class {
|
|
|
222
248
|
// src/purchase.ts
|
|
223
249
|
async function purchase(config) {
|
|
224
250
|
const { account, baseUrl, ...body } = config;
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
251
|
+
let mppxClient;
|
|
252
|
+
try {
|
|
253
|
+
mppxClient = await import("mppx/client");
|
|
254
|
+
} catch {
|
|
255
|
+
throw new Error("mppx is required for purchases. Install it: npm install mppx");
|
|
256
|
+
}
|
|
257
|
+
const Mppx = mppxClient.Mppx;
|
|
258
|
+
const tempo = mppxClient.tempo;
|
|
228
259
|
if (!Mppx || !tempo) {
|
|
229
260
|
throw new Error("mppx is required for purchases. Install it: npm install mppx");
|
|
230
261
|
}
|
|
231
262
|
const mppx = Mppx.create({
|
|
232
|
-
methods: [tempo({ account })]
|
|
233
|
-
polyfill: false
|
|
263
|
+
methods: [tempo({ account })]
|
|
234
264
|
});
|
|
235
265
|
const client = new AgentMall({
|
|
236
266
|
baseUrl: baseUrl ?? BASE_URL,
|
|
@@ -512,11 +542,7 @@ async function buy(urlArg) {
|
|
|
512
542
|
}
|
|
513
543
|
async function status(purchaseId) {
|
|
514
544
|
const apiSecret = process.env.AGENTMALL_API_SECRET;
|
|
515
|
-
|
|
516
|
-
console.error("\x1B[31mAGENTMALL_API_SECRET is required.\x1B[0m");
|
|
517
|
-
process.exit(1);
|
|
518
|
-
}
|
|
519
|
-
const client = new AgentMall({ apiSecret });
|
|
545
|
+
const client = apiSecret ? new AgentMall({ apiSecret }) : new AgentMall({ account: await resolveAccount() });
|
|
520
546
|
const result = await client.purchases.get(purchaseId);
|
|
521
547
|
displayStatus(result);
|
|
522
548
|
}
|
|
@@ -564,12 +590,12 @@ function printHelp() {
|
|
|
564
590
|
Usage:
|
|
565
591
|
agentmall [url] Buy a product (interactive)
|
|
566
592
|
agentmall buy <url> Buy a product
|
|
567
|
-
agentmall status <id> Check order status
|
|
593
|
+
agentmall status <id> Check order status with the payer wallet
|
|
568
594
|
agentmall help Show this help
|
|
569
595
|
|
|
570
596
|
Environment:
|
|
571
|
-
MPPX_PRIVATE_KEY Wallet private key for payments
|
|
572
|
-
AGENTMALL_API_SECRET Operator secret for read endpoints
|
|
597
|
+
MPPX_PRIVATE_KEY Wallet private key for payments and buyer status checks
|
|
598
|
+
AGENTMALL_API_SECRET Operator secret for internal admin read endpoints
|
|
573
599
|
`);
|
|
574
600
|
}
|
|
575
601
|
main();
|
package/dist/index.cjs
CHANGED
|
@@ -108,6 +108,7 @@ function createIdempotencyKey() {
|
|
|
108
108
|
var AgentMall = class {
|
|
109
109
|
baseUrl;
|
|
110
110
|
apiSecret;
|
|
111
|
+
account;
|
|
111
112
|
_fetch;
|
|
112
113
|
products;
|
|
113
114
|
purchases;
|
|
@@ -116,6 +117,7 @@ var AgentMall = class {
|
|
|
116
117
|
constructor(config = {}) {
|
|
117
118
|
this.baseUrl = (config.baseUrl ?? BASE_URL).replace(/\/$/, "");
|
|
118
119
|
this.apiSecret = config.apiSecret;
|
|
120
|
+
this.account = config.account;
|
|
119
121
|
this._fetch = config.fetch ?? globalThis.fetch.bind(globalThis);
|
|
120
122
|
this.products = new AgentMallProducts(this);
|
|
121
123
|
this.purchases = new AgentMallPurchases(this);
|
|
@@ -123,6 +125,10 @@ var AgentMall = class {
|
|
|
123
125
|
this.refunds = new AgentMallRefunds(this);
|
|
124
126
|
}
|
|
125
127
|
/** @internal */
|
|
128
|
+
getAccount() {
|
|
129
|
+
return this.account;
|
|
130
|
+
}
|
|
131
|
+
/** @internal */
|
|
126
132
|
async request(method, path, options) {
|
|
127
133
|
const url = new URL(`${this.baseUrl}${path}`);
|
|
128
134
|
if (options?.params) {
|
|
@@ -202,8 +208,28 @@ var AgentMallPurchases = class {
|
|
|
202
208
|
}
|
|
203
209
|
});
|
|
204
210
|
}
|
|
205
|
-
/** Get a single purchase by ID
|
|
206
|
-
async get(id) {
|
|
211
|
+
/** Get a single purchase by ID using either operator auth or the payer wallet. */
|
|
212
|
+
async get(id, options) {
|
|
213
|
+
const account = options?.account ?? this.client.getAccount();
|
|
214
|
+
if (account) {
|
|
215
|
+
const challenge = await this.client.request(
|
|
216
|
+
"POST",
|
|
217
|
+
"/api/purchases/status/challenge",
|
|
218
|
+
{
|
|
219
|
+
body: { id }
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
const signature = await account.signMessage({
|
|
223
|
+
message: challenge.message
|
|
224
|
+
});
|
|
225
|
+
return this.client.request("POST", "/api/purchases/status", {
|
|
226
|
+
body: {
|
|
227
|
+
id,
|
|
228
|
+
challenge: challenge.challenge,
|
|
229
|
+
signature
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
207
233
|
return this.client.request("GET", "/api/purchases", {
|
|
208
234
|
auth: true,
|
|
209
235
|
params: { id }
|
|
@@ -265,15 +291,19 @@ var AgentMallRefunds = class {
|
|
|
265
291
|
// src/purchase.ts
|
|
266
292
|
async function purchase(config) {
|
|
267
293
|
const { account, baseUrl, ...body } = config;
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
294
|
+
let mppxClient;
|
|
295
|
+
try {
|
|
296
|
+
mppxClient = await import("mppx/client");
|
|
297
|
+
} catch {
|
|
298
|
+
throw new Error("mppx is required for purchases. Install it: npm install mppx");
|
|
299
|
+
}
|
|
300
|
+
const Mppx = mppxClient.Mppx;
|
|
301
|
+
const tempo = mppxClient.tempo;
|
|
271
302
|
if (!Mppx || !tempo) {
|
|
272
303
|
throw new Error("mppx is required for purchases. Install it: npm install mppx");
|
|
273
304
|
}
|
|
274
305
|
const mppx = Mppx.create({
|
|
275
|
-
methods: [tempo({ account })]
|
|
276
|
-
polyfill: false
|
|
306
|
+
methods: [tempo({ account })]
|
|
277
307
|
});
|
|
278
308
|
const client = new AgentMall({
|
|
279
309
|
baseUrl: baseUrl ?? BASE_URL,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
type AgentMallConfig = {
|
|
2
2
|
/** API base URL. Defaults to https://api.agentmall.sh */
|
|
3
3
|
baseUrl?: string;
|
|
4
|
-
/** Operator API secret for read endpoints (Bearer auth). */
|
|
4
|
+
/** Operator API secret for admin read endpoints (Bearer auth). */
|
|
5
5
|
apiSecret?: string;
|
|
6
|
+
/** Wallet account used for buyer-authenticated purchase status reads. */
|
|
7
|
+
account?: WalletAccount;
|
|
6
8
|
/** Custom fetch implementation (e.g. mppx-wrapped fetch for automatic 402 handling). */
|
|
7
9
|
fetch?: typeof globalThis.fetch;
|
|
8
10
|
};
|
|
11
|
+
type WalletAccount = {
|
|
12
|
+
address: string;
|
|
13
|
+
signMessage(args: {
|
|
14
|
+
message: string;
|
|
15
|
+
}): Promise<string>;
|
|
16
|
+
};
|
|
9
17
|
type ProductVariant = {
|
|
10
18
|
label?: string;
|
|
11
19
|
value: string;
|
|
@@ -65,6 +73,11 @@ type CreatePurchaseResponse = {
|
|
|
65
73
|
status: PurchaseLifecycleStatus;
|
|
66
74
|
deduplicated?: boolean;
|
|
67
75
|
};
|
|
76
|
+
type PurchaseStatusChallenge = {
|
|
77
|
+
challenge: string;
|
|
78
|
+
message: string;
|
|
79
|
+
expiresAt: number;
|
|
80
|
+
};
|
|
68
81
|
type PurchaseItem = {
|
|
69
82
|
productRef: string;
|
|
70
83
|
quantity: number;
|
|
@@ -131,6 +144,7 @@ type RefundFilters = {
|
|
|
131
144
|
declare class AgentMall {
|
|
132
145
|
private baseUrl;
|
|
133
146
|
private apiSecret?;
|
|
147
|
+
private account?;
|
|
134
148
|
private _fetch;
|
|
135
149
|
products: AgentMallProducts;
|
|
136
150
|
purchases: AgentMallPurchases;
|
|
@@ -138,6 +152,8 @@ declare class AgentMall {
|
|
|
138
152
|
refunds: AgentMallRefunds;
|
|
139
153
|
constructor(config?: AgentMallConfig);
|
|
140
154
|
/** @internal */
|
|
155
|
+
getAccount(): WalletAccount | undefined;
|
|
156
|
+
/** @internal */
|
|
141
157
|
request<T>(method: string, path: string, options?: {
|
|
142
158
|
body?: unknown;
|
|
143
159
|
auth?: boolean;
|
|
@@ -159,8 +175,10 @@ declare class AgentMallPurchases {
|
|
|
159
175
|
* Use mppx-wrapped fetch to handle payment automatically, or catch PaymentRequiredError.
|
|
160
176
|
*/
|
|
161
177
|
create(body: CreatePurchaseRequest): Promise<CreatePurchaseResponse>;
|
|
162
|
-
/** Get a single purchase by ID
|
|
163
|
-
get(id: string
|
|
178
|
+
/** Get a single purchase by ID using either operator auth or the payer wallet. */
|
|
179
|
+
get(id: string, options?: {
|
|
180
|
+
account?: WalletAccount;
|
|
181
|
+
}): Promise<Purchase>;
|
|
164
182
|
/** List purchases. Requires apiSecret. */
|
|
165
183
|
list(filters?: PurchaseFilters): Promise<Purchase[]>;
|
|
166
184
|
}
|
|
@@ -230,4 +248,4 @@ declare const BASE_URL = "https://api.agentmall.sh";
|
|
|
230
248
|
declare const SERVICE_FEE_CENTS = 150;
|
|
231
249
|
declare const SUPPORTED_RETAILERS: readonly ["amazon.com", "walmart.com", "target.com", "bestbuy.com", "homedepot.com", "ebay.com", "lowes.com", "wayfair.com", "acehardware.com", "1800flowers.com", "pokemoncenter.com"];
|
|
232
250
|
|
|
233
|
-
export { AgentMall, type AgentMallConfig, AgentMallError, BASE_URL, ConflictError, type CreatePurchaseRequest, type CreatePurchaseResponse, type DeliveryAddress, type Payment, type PaymentFilters, PaymentRequiredError, type ProductLookup, type ProductVariant, type Purchase, type PurchaseFilters, type PurchaseItem, type PurchaseItemInput, type PurchaseLifecycleStatus, RateLimitError, type Refund, type RefundFilters, SERVICE_FEE_CENTS, SUPPORTED_RETAILERS, ValidationError, type VariantSelection, purchase };
|
|
251
|
+
export { AgentMall, type AgentMallConfig, AgentMallError, BASE_URL, ConflictError, type CreatePurchaseRequest, type CreatePurchaseResponse, type DeliveryAddress, type Payment, type PaymentFilters, PaymentRequiredError, type ProductLookup, type ProductVariant, type Purchase, type PurchaseFilters, type PurchaseItem, type PurchaseItemInput, type PurchaseLifecycleStatus, type PurchaseStatusChallenge, RateLimitError, type Refund, type RefundFilters, SERVICE_FEE_CENTS, SUPPORTED_RETAILERS, ValidationError, type VariantSelection, type WalletAccount, purchase };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
type AgentMallConfig = {
|
|
2
2
|
/** API base URL. Defaults to https://api.agentmall.sh */
|
|
3
3
|
baseUrl?: string;
|
|
4
|
-
/** Operator API secret for read endpoints (Bearer auth). */
|
|
4
|
+
/** Operator API secret for admin read endpoints (Bearer auth). */
|
|
5
5
|
apiSecret?: string;
|
|
6
|
+
/** Wallet account used for buyer-authenticated purchase status reads. */
|
|
7
|
+
account?: WalletAccount;
|
|
6
8
|
/** Custom fetch implementation (e.g. mppx-wrapped fetch for automatic 402 handling). */
|
|
7
9
|
fetch?: typeof globalThis.fetch;
|
|
8
10
|
};
|
|
11
|
+
type WalletAccount = {
|
|
12
|
+
address: string;
|
|
13
|
+
signMessage(args: {
|
|
14
|
+
message: string;
|
|
15
|
+
}): Promise<string>;
|
|
16
|
+
};
|
|
9
17
|
type ProductVariant = {
|
|
10
18
|
label?: string;
|
|
11
19
|
value: string;
|
|
@@ -65,6 +73,11 @@ type CreatePurchaseResponse = {
|
|
|
65
73
|
status: PurchaseLifecycleStatus;
|
|
66
74
|
deduplicated?: boolean;
|
|
67
75
|
};
|
|
76
|
+
type PurchaseStatusChallenge = {
|
|
77
|
+
challenge: string;
|
|
78
|
+
message: string;
|
|
79
|
+
expiresAt: number;
|
|
80
|
+
};
|
|
68
81
|
type PurchaseItem = {
|
|
69
82
|
productRef: string;
|
|
70
83
|
quantity: number;
|
|
@@ -131,6 +144,7 @@ type RefundFilters = {
|
|
|
131
144
|
declare class AgentMall {
|
|
132
145
|
private baseUrl;
|
|
133
146
|
private apiSecret?;
|
|
147
|
+
private account?;
|
|
134
148
|
private _fetch;
|
|
135
149
|
products: AgentMallProducts;
|
|
136
150
|
purchases: AgentMallPurchases;
|
|
@@ -138,6 +152,8 @@ declare class AgentMall {
|
|
|
138
152
|
refunds: AgentMallRefunds;
|
|
139
153
|
constructor(config?: AgentMallConfig);
|
|
140
154
|
/** @internal */
|
|
155
|
+
getAccount(): WalletAccount | undefined;
|
|
156
|
+
/** @internal */
|
|
141
157
|
request<T>(method: string, path: string, options?: {
|
|
142
158
|
body?: unknown;
|
|
143
159
|
auth?: boolean;
|
|
@@ -159,8 +175,10 @@ declare class AgentMallPurchases {
|
|
|
159
175
|
* Use mppx-wrapped fetch to handle payment automatically, or catch PaymentRequiredError.
|
|
160
176
|
*/
|
|
161
177
|
create(body: CreatePurchaseRequest): Promise<CreatePurchaseResponse>;
|
|
162
|
-
/** Get a single purchase by ID
|
|
163
|
-
get(id: string
|
|
178
|
+
/** Get a single purchase by ID using either operator auth or the payer wallet. */
|
|
179
|
+
get(id: string, options?: {
|
|
180
|
+
account?: WalletAccount;
|
|
181
|
+
}): Promise<Purchase>;
|
|
164
182
|
/** List purchases. Requires apiSecret. */
|
|
165
183
|
list(filters?: PurchaseFilters): Promise<Purchase[]>;
|
|
166
184
|
}
|
|
@@ -230,4 +248,4 @@ declare const BASE_URL = "https://api.agentmall.sh";
|
|
|
230
248
|
declare const SERVICE_FEE_CENTS = 150;
|
|
231
249
|
declare const SUPPORTED_RETAILERS: readonly ["amazon.com", "walmart.com", "target.com", "bestbuy.com", "homedepot.com", "ebay.com", "lowes.com", "wayfair.com", "acehardware.com", "1800flowers.com", "pokemoncenter.com"];
|
|
232
250
|
|
|
233
|
-
export { AgentMall, type AgentMallConfig, AgentMallError, BASE_URL, ConflictError, type CreatePurchaseRequest, type CreatePurchaseResponse, type DeliveryAddress, type Payment, type PaymentFilters, PaymentRequiredError, type ProductLookup, type ProductVariant, type Purchase, type PurchaseFilters, type PurchaseItem, type PurchaseItemInput, type PurchaseLifecycleStatus, RateLimitError, type Refund, type RefundFilters, SERVICE_FEE_CENTS, SUPPORTED_RETAILERS, ValidationError, type VariantSelection, purchase };
|
|
251
|
+
export { AgentMall, type AgentMallConfig, AgentMallError, BASE_URL, ConflictError, type CreatePurchaseRequest, type CreatePurchaseResponse, type DeliveryAddress, type Payment, type PaymentFilters, PaymentRequiredError, type ProductLookup, type ProductVariant, type Purchase, type PurchaseFilters, type PurchaseItem, type PurchaseItemInput, type PurchaseLifecycleStatus, type PurchaseStatusChallenge, RateLimitError, type Refund, type RefundFilters, SERVICE_FEE_CENTS, SUPPORTED_RETAILERS, ValidationError, type VariantSelection, type WalletAccount, purchase };
|
package/dist/index.js
CHANGED
|
@@ -63,6 +63,7 @@ function createIdempotencyKey() {
|
|
|
63
63
|
var AgentMall = class {
|
|
64
64
|
baseUrl;
|
|
65
65
|
apiSecret;
|
|
66
|
+
account;
|
|
66
67
|
_fetch;
|
|
67
68
|
products;
|
|
68
69
|
purchases;
|
|
@@ -71,6 +72,7 @@ var AgentMall = class {
|
|
|
71
72
|
constructor(config = {}) {
|
|
72
73
|
this.baseUrl = (config.baseUrl ?? BASE_URL).replace(/\/$/, "");
|
|
73
74
|
this.apiSecret = config.apiSecret;
|
|
75
|
+
this.account = config.account;
|
|
74
76
|
this._fetch = config.fetch ?? globalThis.fetch.bind(globalThis);
|
|
75
77
|
this.products = new AgentMallProducts(this);
|
|
76
78
|
this.purchases = new AgentMallPurchases(this);
|
|
@@ -78,6 +80,10 @@ var AgentMall = class {
|
|
|
78
80
|
this.refunds = new AgentMallRefunds(this);
|
|
79
81
|
}
|
|
80
82
|
/** @internal */
|
|
83
|
+
getAccount() {
|
|
84
|
+
return this.account;
|
|
85
|
+
}
|
|
86
|
+
/** @internal */
|
|
81
87
|
async request(method, path, options) {
|
|
82
88
|
const url = new URL(`${this.baseUrl}${path}`);
|
|
83
89
|
if (options?.params) {
|
|
@@ -157,8 +163,28 @@ var AgentMallPurchases = class {
|
|
|
157
163
|
}
|
|
158
164
|
});
|
|
159
165
|
}
|
|
160
|
-
/** Get a single purchase by ID
|
|
161
|
-
async get(id) {
|
|
166
|
+
/** Get a single purchase by ID using either operator auth or the payer wallet. */
|
|
167
|
+
async get(id, options) {
|
|
168
|
+
const account = options?.account ?? this.client.getAccount();
|
|
169
|
+
if (account) {
|
|
170
|
+
const challenge = await this.client.request(
|
|
171
|
+
"POST",
|
|
172
|
+
"/api/purchases/status/challenge",
|
|
173
|
+
{
|
|
174
|
+
body: { id }
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
const signature = await account.signMessage({
|
|
178
|
+
message: challenge.message
|
|
179
|
+
});
|
|
180
|
+
return this.client.request("POST", "/api/purchases/status", {
|
|
181
|
+
body: {
|
|
182
|
+
id,
|
|
183
|
+
challenge: challenge.challenge,
|
|
184
|
+
signature
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
162
188
|
return this.client.request("GET", "/api/purchases", {
|
|
163
189
|
auth: true,
|
|
164
190
|
params: { id }
|
|
@@ -220,15 +246,19 @@ var AgentMallRefunds = class {
|
|
|
220
246
|
// src/purchase.ts
|
|
221
247
|
async function purchase(config) {
|
|
222
248
|
const { account, baseUrl, ...body } = config;
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
249
|
+
let mppxClient;
|
|
250
|
+
try {
|
|
251
|
+
mppxClient = await import("mppx/client");
|
|
252
|
+
} catch {
|
|
253
|
+
throw new Error("mppx is required for purchases. Install it: npm install mppx");
|
|
254
|
+
}
|
|
255
|
+
const Mppx = mppxClient.Mppx;
|
|
256
|
+
const tempo = mppxClient.tempo;
|
|
226
257
|
if (!Mppx || !tempo) {
|
|
227
258
|
throw new Error("mppx is required for purchases. Install it: npm install mppx");
|
|
228
259
|
}
|
|
229
260
|
const mppx = Mppx.create({
|
|
230
|
-
methods: [tempo({ account })]
|
|
231
|
-
polyfill: false
|
|
261
|
+
methods: [tempo({ account })]
|
|
232
262
|
});
|
|
233
263
|
const client = new AgentMall({
|
|
234
264
|
baseUrl: baseUrl ?? BASE_URL,
|