@devvit/payments 0.12.2-next-2025-10-30-15-21-54-b1c02a24a.0 → 0.12.2-next-2025-10-30-16-17-34-7aa25ec52.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/package.json +12 -7
- package/server/PaymentsClient.d.ts +12 -0
- package/server/PaymentsClient.d.ts.map +1 -0
- package/server/PaymentsClient.js +50 -0
- package/server/index.d.ts +3 -0
- package/server/index.d.ts.map +1 -0
- package/server/index.js +1 -0
- package/server/serverImportInClientCodePanic.d.ts +16 -0
- package/server/serverImportInClientCodePanic.d.ts.map +1 -0
- package/server/serverImportInClientCodePanic.js +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvit/payments",
|
|
3
|
-
"version": "0.12.2-next-2025-10-30-
|
|
3
|
+
"version": "0.12.2-next-2025-10-30-16-17-34-7aa25ec52.0",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"browser": "./client/index.js",
|
|
14
14
|
"default": "./client/clientImportInServerCodePanic.js"
|
|
15
15
|
},
|
|
16
|
+
"./server": {
|
|
17
|
+
"browser": "./server/serverImportInClientCodePanic.js",
|
|
18
|
+
"default": "./server/index.js"
|
|
19
|
+
},
|
|
16
20
|
"./helpers/*": {
|
|
17
21
|
"type": "./helpers/*.d.ts",
|
|
18
22
|
"import": "./helpers/*.js"
|
|
@@ -40,14 +44,15 @@
|
|
|
40
44
|
},
|
|
41
45
|
"types": "./dist/index.d.ts",
|
|
42
46
|
"dependencies": {
|
|
43
|
-
"@devvit/protos": "0.12.2-next-2025-10-30-
|
|
44
|
-
"@devvit/public-api": "0.12.2-next-2025-10-30-
|
|
45
|
-
"@devvit/
|
|
47
|
+
"@devvit/protos": "0.12.2-next-2025-10-30-16-17-34-7aa25ec52.0",
|
|
48
|
+
"@devvit/public-api": "0.12.2-next-2025-10-30-16-17-34-7aa25ec52.0",
|
|
49
|
+
"@devvit/server": "0.12.2-next-2025-10-30-16-17-34-7aa25ec52.0",
|
|
50
|
+
"@devvit/shared-types": "0.12.2-next-2025-10-30-16-17-34-7aa25ec52.0"
|
|
46
51
|
},
|
|
47
52
|
"devDependencies": {
|
|
48
53
|
"@ampproject/filesize": "4.3.0",
|
|
49
|
-
"@devvit/repo-tools": "0.12.2-next-2025-10-30-
|
|
50
|
-
"@devvit/tsconfig": "0.12.2-next-2025-10-30-
|
|
54
|
+
"@devvit/repo-tools": "0.12.2-next-2025-10-30-16-17-34-7aa25ec52.0",
|
|
55
|
+
"@devvit/tsconfig": "0.12.2-next-2025-10-30-16-17-34-7aa25ec52.0",
|
|
51
56
|
"esbuild": "0.25.9",
|
|
52
57
|
"eslint": "9.11.1",
|
|
53
58
|
"typescript": "5.8.3",
|
|
@@ -60,5 +65,5 @@
|
|
|
60
65
|
}
|
|
61
66
|
},
|
|
62
67
|
"source": "./src/index.ts",
|
|
63
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "48fd691eb5e3f44207237e6359746a42a3ee0795"
|
|
64
69
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type AcknowledgeOrderDeliveryResponse, type GetOrdersRequest, type GetOrdersResponse, type GetProductsRequest, type GetProductsResponse } from '@devvit/protos/types/devvit/plugin/payments/v1alpha/payments.js';
|
|
2
|
+
type RequiredGetOrderFields = 'limit';
|
|
3
|
+
export type GetOrdersFilters = Partial<Omit<GetOrdersRequest, RequiredGetOrderFields>> & Pick<GetOrdersRequest, RequiredGetOrderFields>;
|
|
4
|
+
export declare class PaymentsClient {
|
|
5
|
+
#private;
|
|
6
|
+
getProducts(filters?: Partial<GetProductsRequest>): Promise<GetProductsResponse>;
|
|
7
|
+
getOrders(filters: GetOrdersFilters): Promise<GetOrdersResponse>;
|
|
8
|
+
acknowledgeOrderDelivery(orderId: string): Promise<AcknowledgeOrderDeliveryResponse>;
|
|
9
|
+
}
|
|
10
|
+
export declare const payments: PaymentsClient;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=PaymentsClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaymentsClient.d.ts","sourceRoot":"","sources":["../../src/server/PaymentsClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,gCAAgC,EACrC,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAGzB,MAAM,iEAAiE,CAAC;AAIzE,KAAK,sBAAsB,GAAG,OAAO,CAAC;AACtC,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,CAAC,GACpF,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,CAAC;AAEjD,qBAAa,cAAc;;IAGzB,WAAW,CAAC,OAAO,GAAE,OAAO,CAAC,kBAAkB,CAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAapF,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAgBhE,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gCAAgC,CAAC;CAOrF;AAED,eAAO,MAAM,QAAQ,gBAAuB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
+
};
|
|
12
|
+
var _PaymentsClient_instances, _PaymentsClient_pluginCache, _PaymentsClient_plugin_get;
|
|
13
|
+
import { OrderStatus } from '@devvit/protos/json/devvit/payments/v1alpha/order.js';
|
|
14
|
+
import { PaymentsServiceDefinition, } from '@devvit/protos/types/devvit/plugin/payments/v1alpha/payments.js';
|
|
15
|
+
import { context } from '@devvit/server';
|
|
16
|
+
import { getDevvitConfig } from '@devvit/shared-types/server/get-devvit-config.js';
|
|
17
|
+
export class PaymentsClient {
|
|
18
|
+
constructor() {
|
|
19
|
+
_PaymentsClient_instances.add(this);
|
|
20
|
+
_PaymentsClient_pluginCache.set(this, void 0);
|
|
21
|
+
}
|
|
22
|
+
getProducts(filters = {}) {
|
|
23
|
+
return __classPrivateFieldGet(this, _PaymentsClient_instances, "a", _PaymentsClient_plugin_get).GetProducts({
|
|
24
|
+
// Defaults
|
|
25
|
+
skus: [],
|
|
26
|
+
metadata: {},
|
|
27
|
+
// User provided second, overwrites above
|
|
28
|
+
...filters,
|
|
29
|
+
}, context.metadata);
|
|
30
|
+
}
|
|
31
|
+
getOrders(filters) {
|
|
32
|
+
return __classPrivateFieldGet(this, _PaymentsClient_instances, "a", _PaymentsClient_plugin_get).GetOrders({
|
|
33
|
+
// Defaults
|
|
34
|
+
sku: '',
|
|
35
|
+
buyer: '',
|
|
36
|
+
status: OrderStatus.ORDER_STATUS_UNSPECIFIED,
|
|
37
|
+
metadata: {},
|
|
38
|
+
cursor: '',
|
|
39
|
+
// User provided second, overwrites above
|
|
40
|
+
...filters,
|
|
41
|
+
}, context.metadata);
|
|
42
|
+
}
|
|
43
|
+
acknowledgeOrderDelivery(orderId) {
|
|
44
|
+
return __classPrivateFieldGet(this, _PaymentsClient_instances, "a", _PaymentsClient_plugin_get).AcknowledgeOrderDelivery({ orderId }, context.metadata);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
_PaymentsClient_pluginCache = new WeakMap(), _PaymentsClient_instances = new WeakSet(), _PaymentsClient_plugin_get = function _PaymentsClient_plugin_get() {
|
|
48
|
+
return (__classPrivateFieldSet(this, _PaymentsClient_pluginCache, __classPrivateFieldGet(this, _PaymentsClient_pluginCache, "f") ?? getDevvitConfig().use(PaymentsServiceDefinition), "f"));
|
|
49
|
+
};
|
|
50
|
+
export const payments = new PaymentsClient();
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { payments, type PaymentsClient } from './PaymentsClient.js';
|
|
2
|
+
export type { FulfillOrderRequest, FulfillOrderResponse, RefundOrderRequest, RefundOrderResponse, } from '@devvit/protos/json/devvit/actor/payments/v1alpha/payments.js';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACpE,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,+DAA+D,CAAC"}
|
package/server/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { payments } from './PaymentsClient.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hey! If you're seeing this, you're probably trying to run server code in the
|
|
3
|
+
* client context, or you have your server build environment set up incorrectly.
|
|
4
|
+
* To fix this:
|
|
5
|
+
* 1) Check that you're not importing server code in your client files. If you
|
|
6
|
+
* are, you should import from `@devvit/payments/client` instead of
|
|
7
|
+
* `@devvit/payments/server`.
|
|
8
|
+
* 2) If this is coming from server code, ensure that your client's tsconfig &
|
|
9
|
+
* build environment is set up correctly - specifically, make sure you do NOT
|
|
10
|
+
* have `compilerOptions.customConditions` set to include `["browser"]` in
|
|
11
|
+
* your `tsconfig.json` file. Also, verify that whatever bundler you're using
|
|
12
|
+
* (esbuild, vite, etc.) is bundling the client code for a Node environment,
|
|
13
|
+
* and not a web browser!
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=serverImportInClientCodePanic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverImportInClientCodePanic.d.ts","sourceRoot":"","sources":["../../src/server/serverImportInClientCodePanic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hey! If you're seeing this, you're probably trying to run server code in the
|
|
3
|
+
* client context, or you have your server build environment set up incorrectly.
|
|
4
|
+
* To fix this:
|
|
5
|
+
* 1) Check that you're not importing server code in your client files. If you
|
|
6
|
+
* are, you should import from `@devvit/payments/client` instead of
|
|
7
|
+
* `@devvit/payments/server`.
|
|
8
|
+
* 2) If this is coming from server code, ensure that your client's tsconfig &
|
|
9
|
+
* build environment is set up correctly - specifically, make sure you do NOT
|
|
10
|
+
* have `compilerOptions.customConditions` set to include `["browser"]` in
|
|
11
|
+
* your `tsconfig.json` file. Also, verify that whatever bundler you're using
|
|
12
|
+
* (esbuild, vite, etc.) is bundling the client code for a Node environment,
|
|
13
|
+
* and not a web browser!
|
|
14
|
+
*/
|
|
15
|
+
console.error("Can't import server code in the client!");
|
|
16
|
+
export {};
|