@halix/action-sdk 1.0.38 β 1.0.39
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/README.md +31 -0
- package/lib/cjs/data-crud.js +43 -0
- package/lib/cjs/index.js +9 -2
- package/lib/cjs/lists.js +57 -0
- package/lib/cjs/payments.js +87 -0
- package/lib/cjs/types/data-crud.d.ts.map +1 -1
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/lists.d.ts +64 -3
- package/lib/cjs/types/lists.d.ts.map +1 -1
- package/lib/cjs/types/payments.d.ts +75 -0
- package/lib/cjs/types/payments.d.ts.map +1 -0
- package/lib/esm/data-crud.js +43 -0
- package/lib/esm/data-crud.js.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/index.mjs +6 -0
- package/lib/esm/lists.js +57 -0
- package/lib/esm/lists.js.map +1 -1
- package/lib/esm/payments.js +78 -0
- package/lib/esm/payments.js.map +1 -0
- package/lib/esm/types/index.d.ts +1 -0
- package/lib/esm/types/lists.d.ts +64 -3
- package/lib/esm/types/payments.d.ts +74 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,6 +91,7 @@ This action pattern is typical for use in Halixβs Lambda-style runtime environ
|
|
|
91
91
|
| `saveRelatedObject(...)` / `saveRelatedObjectAsObservable(...)` | Save objects and relationships |
|
|
92
92
|
| `deleteRelatedObject(...)` / `deleteRelatedObjectAsObservable(...)` | Delete a single related object |
|
|
93
93
|
| `deleteRelatedObjects(...)` / `deleteRelatedObjectsAsObservable(...)` | Delete multiple related objects (uses `keys` query param) |
|
|
94
|
+
| `submitStandalonePayment(...)` / `submitStandalonePaymentAsObservable(...)` | Finalize a payment from a gateway preauth result |
|
|
94
95
|
| `prepareSuccessResponse(...)` | Create a success response |
|
|
95
96
|
| `prepareErrorResponse(...)` | Create an error response |
|
|
96
97
|
|
|
@@ -112,6 +113,36 @@ These helpers simplify working with content resources and file uploads.
|
|
|
112
113
|
|
|
113
114
|
---
|
|
114
115
|
|
|
116
|
+
## Payment Helpers
|
|
117
|
+
|
|
118
|
+
Use `submitStandalonePayment(...)` after UI code has already produced a gateway preauth result and you need action code to finish the payment through the platform backend.
|
|
119
|
+
|
|
120
|
+
```js
|
|
121
|
+
const result = await hx.submitStandalonePayment({
|
|
122
|
+
payerKey: hx.userContext.userProxyKey,
|
|
123
|
+
payeeKey: hx.userContext.orgKey,
|
|
124
|
+
paymentAmount: 49.99,
|
|
125
|
+
preAuthResult,
|
|
126
|
+
hostObjectKey: invoice.objKey,
|
|
127
|
+
hostElementId: 'clientInvoice',
|
|
128
|
+
hostAttributeId: 'paymentStatus',
|
|
129
|
+
generateTransaction: true,
|
|
130
|
+
chargeDescription: 'Invoice payment'
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
console.log(result.paymentKey, result.paymentSummary);
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Notes:
|
|
137
|
+
- `organizationKey` is taken from `userContext.orgKey`, and `payerType` is fixed to `SolutionUserProxy`.
|
|
138
|
+
- The SDK assumes a Stripe preauth result and injects `paymentGateway: 'stripe'` before sending the request.
|
|
139
|
+
- Extra fields on `preAuthResult` are still passed through because Stripe completion may require gateway-specific values such as token or saved-payment-method identifiers.
|
|
140
|
+
- `hostObjectKey`, `hostElementId`, and `hostAttributeId` must point at a real solution-defined object field that the backend can update with the returned payment summary.
|
|
141
|
+
- `bankAccountPayment` is optional in the SDK wrapper; if omitted it is inferred from common ACH payment method values in the preauth result.
|
|
142
|
+
- `payeeKey` should be the organization receiving the payment.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
115
146
|
## π§ͺ Utilities
|
|
116
147
|
|
|
117
148
|
| Function | Description |
|
package/lib/cjs/data-crud.js
CHANGED
|
@@ -43,6 +43,49 @@ exports.deleteRelatedObjectsAsObservable = deleteRelatedObjectsAsObservable;
|
|
|
43
43
|
* - Retrieve all objects related to a parent object
|
|
44
44
|
* - Save a single object
|
|
45
45
|
* - Delete a single or multiple objects
|
|
46
|
+
*
|
|
47
|
+
* @usage
|
|
48
|
+
* ## When to Use
|
|
49
|
+
* - **Read objects without specifying parent scope** β `getAccessibleObjects` (most common read)
|
|
50
|
+
* - **Get single object by key** β `getObject`
|
|
51
|
+
* - **Get related objects (<50)** β `getRelatedObjects`
|
|
52
|
+
* - **Create/update single object** β `saveRelatedObject`
|
|
53
|
+
* - **Delete single object** β `deleteRelatedObject`
|
|
54
|
+
*
|
|
55
|
+
* ## When NOT to Use
|
|
56
|
+
* - **Large lists (100+)** β use lists skill with `getListData`
|
|
57
|
+
* - **Bulk updates** β use lists skill with `massEdit`
|
|
58
|
+
* - **Aggregations** β use data-aggregate skill
|
|
59
|
+
*
|
|
60
|
+
* ## Key Functions
|
|
61
|
+
* | Function | Use For |
|
|
62
|
+
* |----------|---------|
|
|
63
|
+
* | `getAccessibleObjects` | Read objects the current user can access (no parent scope needed) |
|
|
64
|
+
* | `getObject` | Single object by key |
|
|
65
|
+
* | `getRelatedObjects` | Children of a parent (small collections) |
|
|
66
|
+
* | `saveRelatedObject` | Create or update one object |
|
|
67
|
+
* | `deleteRelatedObject` | Delete one object |
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* // Get all accessible recipes
|
|
71
|
+
* const recipes = await hx.getAccessibleObjects('recipe');
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* // Get single recipe
|
|
75
|
+
* const recipe = await hx.getObject('recipe', recipeKey);
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* // Get ingredients (small collection)
|
|
79
|
+
* const ingredients = await hx.getRelatedObjects(
|
|
80
|
+
* 'recipe', recipeKey, 'ingredient'
|
|
81
|
+
* );
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* // Save new ingredient
|
|
85
|
+
* await hx.saveRelatedObject(
|
|
86
|
+
* 'recipe', recipeKey, 'ingredient',
|
|
87
|
+
* { name: 'Salt', amount: '1 tsp' }
|
|
88
|
+
* );
|
|
46
89
|
*/
|
|
47
90
|
const axios_1 = __importDefault(require("axios"));
|
|
48
91
|
const rxjs_1 = require("rxjs");
|
package/lib/cjs/index.js
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
// Unauthorized use outside the Halix platform is prohibited.
|
|
9
9
|
// Full license terms available in the LICENSE file.
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.
|
|
12
|
-
exports.debounceFn = exports.getValueFromObject = void 0;
|
|
11
|
+
exports.sendAIMessageAsObservable = exports.sendAIMessage = exports.submitStandalonePaymentAsObservable = exports.submitStandalonePayment = exports.getAggregateDataAsObservable = exports.getAggregateData = exports.AggregationResponse = exports.massDeleteAsObservable = exports.massDelete = exports.massEditAsObservable = exports.massEdit = exports.getListDataAsObservable = exports.getListData = exports.getOrganizationPreferenceAsObservable = exports.getUserPreferenceAsObservable = exports.getOrganizationPreference = exports.getUserPreference = exports.sendMessageAsObservable = exports.sendMessage = exports.MessageMethod = exports.createOrUpdateResourceAsObservable = exports.createOrUpdateResource = exports.sendFileContentsAsObservable = exports.sendFileContents = exports.saveResourceAsObservable = exports.saveResource = exports.getOrCreateResourceAsObservable = exports.getOrCreateResource = exports.deleteRelatedObjectsAsObservable = exports.deleteRelatedObjects = exports.deleteRelatedObjectAsObservable = exports.deleteRelatedObject = exports.saveRelatedObjectAsObservable = exports.saveRelatedObject = exports.getAccessibleObjectsAsObservable = exports.getAccessibleObjects = exports.getRelatedObjectsAsObservable = exports.getRelatedObjects = exports.getObjectAsObservable = exports.getObject = exports.prepareErrorResponse = exports.prepareSuccessResponse = exports.initialize = exports.useBody = exports.params = exports.userContext = exports.actionSubject = exports.serviceAddress = exports.sandboxKey = exports.getAuthToken = void 0;
|
|
12
|
+
exports.debounceFn = exports.getValueFromObject = exports.compareValues = exports.sortObjectArray = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* @module @halix/action-sdk
|
|
15
15
|
* @description Halix Platform action SDK for developing NodeJS Lambda-based actions on the Halix
|
|
@@ -103,6 +103,13 @@ Object.defineProperty(exports, "AggregationResponse", { enumerable: true, get: f
|
|
|
103
103
|
Object.defineProperty(exports, "getAggregateData", { enumerable: true, get: function () { return data_aggregate_1.getAggregateData; } });
|
|
104
104
|
Object.defineProperty(exports, "getAggregateDataAsObservable", { enumerable: true, get: function () { return data_aggregate_1.getAggregateDataAsObservable; } });
|
|
105
105
|
// ================================================================================
|
|
106
|
+
// PAYMENT FUNCTIONS
|
|
107
|
+
// ================================================================================
|
|
108
|
+
var payments_1 = require("./payments");
|
|
109
|
+
// Functions
|
|
110
|
+
Object.defineProperty(exports, "submitStandalonePayment", { enumerable: true, get: function () { return payments_1.submitStandalonePayment; } });
|
|
111
|
+
Object.defineProperty(exports, "submitStandalonePaymentAsObservable", { enumerable: true, get: function () { return payments_1.submitStandalonePaymentAsObservable; } });
|
|
112
|
+
// ================================================================================
|
|
106
113
|
// AI FUNCTIONS
|
|
107
114
|
// ================================================================================
|
|
108
115
|
var ai_1 = require("./ai");
|
package/lib/cjs/lists.js
CHANGED
|
@@ -51,11 +51,50 @@ const sdk_general_1 = require("./sdk-general");
|
|
|
51
51
|
/**
|
|
52
52
|
* Retrieves paginated list data. Supports authenticated/public access, filtering, sorting, and binary search.
|
|
53
53
|
*
|
|
54
|
+
* Common usage:
|
|
55
|
+
* - For most custom-element list UIs, start with only `dataElementId`, pagination fields,
|
|
56
|
+
* and `displayFields`.
|
|
57
|
+
* - Omit `parentDataElementId` and `parentKey` when you want the records the current user
|
|
58
|
+
* can already access.
|
|
59
|
+
* - Add `parentDataElementId` and `parentKey` only when the list must be anchored to a
|
|
60
|
+
* specific parent record.
|
|
61
|
+
* - Most callers should omit `options`. Use `options.search` only for binary-search
|
|
62
|
+
* navigation scenarios, and use `options.bypassTotal` only when you explicitly do not
|
|
63
|
+
* need the total count.
|
|
64
|
+
*
|
|
65
|
+
* Request shape:
|
|
66
|
+
* - `dataElementId` (required): root data element to retrieve
|
|
67
|
+
* - `pageNumber` / `pageSize` (optional): pagination
|
|
68
|
+
* - `displayFields` (optional): fields to populate in returned objects
|
|
69
|
+
* - `sort` (optional): sort fields such as `[{ attributeId: 'name' }]`
|
|
70
|
+
* - `filter` (optional): filter expression
|
|
71
|
+
* - `parentDataElementId` / `parentKey` (optional): explicit parent scope
|
|
72
|
+
*
|
|
54
73
|
* @param request - List configuration including dataElementId, parentDataElementId, parentKey, pagination, sort, filter
|
|
55
74
|
* @param options - Optional: isPublic, bypassTotal, search
|
|
56
75
|
* @returns Promise<ListDataResponse> with data array, total count, pageNumber
|
|
57
76
|
*
|
|
58
77
|
* @example
|
|
78
|
+
* // Most common case: one page of records the current user can access.
|
|
79
|
+
* const response = await getListData({
|
|
80
|
+
* dataElementId: 'student',
|
|
81
|
+
* pageNumber: 1,
|
|
82
|
+
* pageSize: 10,
|
|
83
|
+
* displayFields: ['name', 'studentNumber', 'email', 'grade']
|
|
84
|
+
* });
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* // Custom element pagination with an optional sort.
|
|
88
|
+
* const response = await getListData({
|
|
89
|
+
* dataElementId: 'student',
|
|
90
|
+
* pageNumber: currentPage,
|
|
91
|
+
* pageSize: 10,
|
|
92
|
+
* displayFields: ['name', 'studentNumber', 'email', 'grade'],
|
|
93
|
+
* sort: [{ attributeId: 'name' }]
|
|
94
|
+
* });
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* // Explicit parent scoping when the list must be anchored to a specific parent.
|
|
59
98
|
* const listData = await getListData({
|
|
60
99
|
* dataElementId: 'customer',
|
|
61
100
|
* parentDataElementId: 'company',
|
|
@@ -64,6 +103,24 @@ const sdk_general_1 = require("./sdk-general");
|
|
|
64
103
|
* pageSize: 50,
|
|
65
104
|
* displayFields: ['firstName', 'lastName', 'email']
|
|
66
105
|
* });
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* // options is rarely needed; omit it unless you need one of these behaviors.
|
|
109
|
+
* const response = await getListData(
|
|
110
|
+
* {
|
|
111
|
+
* dataElementId: 'student',
|
|
112
|
+
* pageNumber: 1,
|
|
113
|
+
* pageSize: 10,
|
|
114
|
+
* displayFields: ['name']
|
|
115
|
+
* },
|
|
116
|
+
* {
|
|
117
|
+
* search: {
|
|
118
|
+
* attributeId: 'name',
|
|
119
|
+
* value: 'Ada',
|
|
120
|
+
* total: 100
|
|
121
|
+
* }
|
|
122
|
+
* }
|
|
123
|
+
* );
|
|
67
124
|
*/
|
|
68
125
|
function getListData(request, options) {
|
|
69
126
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Halix SDK License v1.0
|
|
3
|
+
// Copyright (c) 2025 halix.io LLC.
|
|
4
|
+
//
|
|
5
|
+
// This source code is licensed for use **only** within applications
|
|
6
|
+
// running on the Halix platform, in accordance with Halix SDK guidelines.
|
|
7
|
+
//
|
|
8
|
+
// Unauthorized use outside the Halix platform is prohibited.
|
|
9
|
+
// Full license terms available in the LICENSE file.
|
|
10
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
11
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
13
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
14
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
15
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
16
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
20
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.submitStandalonePayment = submitStandalonePayment;
|
|
24
|
+
exports.submitStandalonePaymentAsObservable = submitStandalonePaymentAsObservable;
|
|
25
|
+
/**
|
|
26
|
+
* @module @halix/action-sdk/payments
|
|
27
|
+
* @description Payment completion helpers for the Halix Platform action SDK. This module provides
|
|
28
|
+
* a wrapper around the `standalonePayment` backend route, which finalizes a payment after a gateway
|
|
29
|
+
* component has already produced a preauthorization result.
|
|
30
|
+
*
|
|
31
|
+
* Typical flow:
|
|
32
|
+
* 1. Client/UI code collects payment details and obtains a gateway preauth result.
|
|
33
|
+
* 2. Action code calls `submitStandalonePayment(...)` with the payer, payee, host object, and preauth result.
|
|
34
|
+
* 3. The platform completes the payment, updates the host object's payment summary field, and optionally
|
|
35
|
+
* generates a sales transaction.
|
|
36
|
+
*/
|
|
37
|
+
const axios_1 = __importDefault(require("axios"));
|
|
38
|
+
const rxjs_1 = require("rxjs");
|
|
39
|
+
const sdk_general_1 = require("./sdk-general");
|
|
40
|
+
const STANDALONE_PAYMENT_URL = 'payments/sandboxes/:sandboxKey/standalonePayment';
|
|
41
|
+
const ASSUMED_PAYER_TYPE = 'SolutionUserProxy';
|
|
42
|
+
const ASSUMED_PAYMENT_GATEWAY = 'stripe';
|
|
43
|
+
const BANK_ACCOUNT_PAYMENT_METHODS = new Set(['us_bank_account', 'USBankAccount', 'bankAccount']);
|
|
44
|
+
function resolveBankAccountPayment(request) {
|
|
45
|
+
var _a;
|
|
46
|
+
if (request.bankAccountPayment !== undefined) {
|
|
47
|
+
return request.bankAccountPayment;
|
|
48
|
+
}
|
|
49
|
+
return BANK_ACCOUNT_PAYMENT_METHODS.has(((_a = request.preAuthResult) === null || _a === void 0 ? void 0 : _a.paymentMethod) || '');
|
|
50
|
+
}
|
|
51
|
+
function resolveOrganizationKey() {
|
|
52
|
+
const organizationKey = sdk_general_1.userContext === null || sdk_general_1.userContext === void 0 ? void 0 : sdk_general_1.userContext.orgKey;
|
|
53
|
+
if (!organizationKey) {
|
|
54
|
+
throw new Error('userContext.orgKey is required for standalone payments; check that initialize(event) has been called with a full userContext');
|
|
55
|
+
}
|
|
56
|
+
return organizationKey;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Completes a previously preauthorized standalone payment.
|
|
60
|
+
*
|
|
61
|
+
* This endpoint performs the final charge, updates the host object's payment summary attribute,
|
|
62
|
+
* persists billing address information back to the payer, and can optionally generate a linked
|
|
63
|
+
* sales transaction.
|
|
64
|
+
*/
|
|
65
|
+
function submitStandalonePayment(request) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
if (!sdk_general_1.getAuthToken) {
|
|
68
|
+
const errorMessage = 'SDK not initialized.';
|
|
69
|
+
console.error(errorMessage);
|
|
70
|
+
throw new Error(errorMessage);
|
|
71
|
+
}
|
|
72
|
+
const url = `${sdk_general_1.serviceAddress}/${STANDALONE_PAYMENT_URL.replace(':sandboxKey', sdk_general_1.sandboxKey)}`;
|
|
73
|
+
const authToken = yield (0, rxjs_1.lastValueFrom)((0, sdk_general_1.getAuthToken)());
|
|
74
|
+
const payload = Object.assign(Object.assign({}, request), { organizationKey: resolveOrganizationKey(), payerType: ASSUMED_PAYER_TYPE, bankAccountPayment: resolveBankAccountPayment(request), preAuthResult: Object.assign({ paymentGateway: ASSUMED_PAYMENT_GATEWAY }, request.preAuthResult) });
|
|
75
|
+
console.log('Sending POST request to ' + url + ' with token ' + authToken);
|
|
76
|
+
const response = yield axios_1.default.post(url, payload, {
|
|
77
|
+
headers: { Authorization: `Bearer ${authToken}` },
|
|
78
|
+
});
|
|
79
|
+
return response.data;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Observable version of submitStandalonePayment. See submitStandalonePayment for details.
|
|
84
|
+
*/
|
|
85
|
+
function submitStandalonePaymentAsObservable(request) {
|
|
86
|
+
return (0, rxjs_1.from)(submitStandalonePayment(request));
|
|
87
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-crud.d.ts","sourceRoot":"","sources":["../../../src/data-crud.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data-crud.d.ts","sourceRoot":"","sources":["../../../src/data-crud.ts"],"names":[],"mappings":"AAkEA,OAAO,EAAQ,UAAU,EAAiB,MAAM,MAAM,CAAC;AAOvD;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,mCAAmC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAMD;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,MAAM,EAAE,gBA6BlG;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,CAE1H;AAED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAgCvK;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,CAEhL;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,MAAM,EAAE,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG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AAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,CAE7J"}
|
package/lib/cjs/types/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { MessageMethod, type MessageRequest, sendMessage, sendMessageAsObservabl
|
|
|
10
10
|
export { getUserPreference, getOrganizationPreference, getUserPreferenceAsObservable, getOrganizationPreferenceAsObservable } from './preferences';
|
|
11
11
|
export { type SortField, type DataSortField, type BaseListDataRequest, type PagedListDataRequest, type ListDataResponse, type ListDataOptions, type ListDataSearchOptions, type MassEditValueType, type MassEditRequest, type MassDeleteRequest, type MassChangeResponse, getListData, getListDataAsObservable, massEdit, massEditAsObservable, massDelete, massDeleteAsObservable } from './lists';
|
|
12
12
|
export { AggregationResponse, type AggregationRequest, type AggregationRow, type AggregationGroup, type AggregationSort, type Aggregation, type AggregationGroupTransform, type TransformType, type AggregationType, getAggregateData, getAggregateDataAsObservable } from './data-aggregate';
|
|
13
|
+
export { type GatewayPaymentPreauthResult, type StandalonePaymentRequest, type StandalonePaymentResult, submitStandalonePayment, submitStandalonePaymentAsObservable } from './payments';
|
|
13
14
|
export { type AIRequestOptions, sendAIMessage, sendAIMessageAsObservable } from './ai';
|
|
14
15
|
export { sortObjectArray, compareValues, getValueFromObject, debounceFn } from './utilities';
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AASA;;;;GAIG;AAMH,OAAO,EAEH,YAAY,EACZ,UAAU,EACV,cAAc,EACd,aAAa,EACb,WAAW,EACX,MAAM,EACN,OAAO,EAGP,UAAU,EAGV,KAAK,WAAW,EAChB,KAAK,iBAAiB,EAGtB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,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AAM,aAAa,CAAC;AAMrB,OAAO,EAEH,iBAAiB,EACjB,yBAAyB,EACzB,6BAA6B,EAC7B,qCAAqC,EACxC,MAAM,eAAe,CAAC;AAMvB,OAAO,EAEH,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EAGvB,WAAW,EACX,uBAAuB,EACvB,QAAQ,EACR,oBAAoB,EACpB,UAAU,EACV,sBAAsB,EACzB,MAAM,SAAS,CAAC;AAMjB,OAAO,EAEH,mBAAmB,EAGnB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EAClB,KAAK,eAAe,EAGpB,gBAAgB,EAChB,4BAA4B,EAC/B,MAAM,kBAAkB,CAAC;AAM1B,OAAO,EAEH,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAG5B,uBAAuB,EACvB,mCAAmC,EACtC,MAAM,YAAY,CAAC;AAMpB,OAAO,EAEH,KAAK,gBAAgB,EAGrB,aAAa,EACb,yBAAyB,EAC5B,MAAM,MAAM,CAAC;AAMd,OAAO,EACH,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,UAAU,EACb,MAAM,aAAa,CAAC"}
|
package/lib/cjs/types/lists.d.ts
CHANGED
|
@@ -40,18 +40,22 @@ export interface BaseListDataRequest {
|
|
|
40
40
|
* The dataElementId must be related to this through a foreign key or key array.
|
|
41
41
|
* Works with parentKey to scope results. This is often an organization proxy
|
|
42
42
|
* or user proxy element, but not necessarily so.
|
|
43
|
+
*
|
|
44
|
+
* Note: in most cases, this can be omitted in which case the system will automatically
|
|
45
|
+
* return only the records the user can access.
|
|
43
46
|
*/
|
|
44
|
-
parentDataElementId
|
|
47
|
+
parentDataElementId?: string;
|
|
45
48
|
/**
|
|
46
49
|
* The key of an object that all records must be related to.
|
|
47
50
|
* Works with parentDataElementId to scope results.
|
|
48
51
|
*
|
|
49
|
-
*
|
|
52
|
+
* Note: in most cases, this can be omitted in which case the system will automatically
|
|
53
|
+
* return only the records the user can access.
|
|
50
54
|
*/
|
|
51
55
|
parentKey?: string;
|
|
52
56
|
/**
|
|
53
57
|
* Optional field to specify the foreign key field on the root element that defines
|
|
54
|
-
* the relationship to the parent. If omitted, a derived key is assumed.
|
|
58
|
+
* the relationship to the parent. If omitted, a derived key is assumed. Works with parentDataElementId to scope results.
|
|
55
59
|
*/
|
|
56
60
|
parentKeyField?: string;
|
|
57
61
|
/**
|
|
@@ -205,11 +209,50 @@ export interface MassChangeResponse {
|
|
|
205
209
|
/**
|
|
206
210
|
* Retrieves paginated list data. Supports authenticated/public access, filtering, sorting, and binary search.
|
|
207
211
|
*
|
|
212
|
+
* Common usage:
|
|
213
|
+
* - For most custom-element list UIs, start with only `dataElementId`, pagination fields,
|
|
214
|
+
* and `displayFields`.
|
|
215
|
+
* - Omit `parentDataElementId` and `parentKey` when you want the records the current user
|
|
216
|
+
* can already access.
|
|
217
|
+
* - Add `parentDataElementId` and `parentKey` only when the list must be anchored to a
|
|
218
|
+
* specific parent record.
|
|
219
|
+
* - Most callers should omit `options`. Use `options.search` only for binary-search
|
|
220
|
+
* navigation scenarios, and use `options.bypassTotal` only when you explicitly do not
|
|
221
|
+
* need the total count.
|
|
222
|
+
*
|
|
223
|
+
* Request shape:
|
|
224
|
+
* - `dataElementId` (required): root data element to retrieve
|
|
225
|
+
* - `pageNumber` / `pageSize` (optional): pagination
|
|
226
|
+
* - `displayFields` (optional): fields to populate in returned objects
|
|
227
|
+
* - `sort` (optional): sort fields such as `[{ attributeId: 'name' }]`
|
|
228
|
+
* - `filter` (optional): filter expression
|
|
229
|
+
* - `parentDataElementId` / `parentKey` (optional): explicit parent scope
|
|
230
|
+
*
|
|
208
231
|
* @param request - List configuration including dataElementId, parentDataElementId, parentKey, pagination, sort, filter
|
|
209
232
|
* @param options - Optional: isPublic, bypassTotal, search
|
|
210
233
|
* @returns Promise<ListDataResponse> with data array, total count, pageNumber
|
|
211
234
|
*
|
|
212
235
|
* @example
|
|
236
|
+
* // Most common case: one page of records the current user can access.
|
|
237
|
+
* const response = await getListData({
|
|
238
|
+
* dataElementId: 'student',
|
|
239
|
+
* pageNumber: 1,
|
|
240
|
+
* pageSize: 10,
|
|
241
|
+
* displayFields: ['name', 'studentNumber', 'email', 'grade']
|
|
242
|
+
* });
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* // Custom element pagination with an optional sort.
|
|
246
|
+
* const response = await getListData({
|
|
247
|
+
* dataElementId: 'student',
|
|
248
|
+
* pageNumber: currentPage,
|
|
249
|
+
* pageSize: 10,
|
|
250
|
+
* displayFields: ['name', 'studentNumber', 'email', 'grade'],
|
|
251
|
+
* sort: [{ attributeId: 'name' }]
|
|
252
|
+
* });
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* // Explicit parent scoping when the list must be anchored to a specific parent.
|
|
213
256
|
* const listData = await getListData({
|
|
214
257
|
* dataElementId: 'customer',
|
|
215
258
|
* parentDataElementId: 'company',
|
|
@@ -218,6 +261,24 @@ export interface MassChangeResponse {
|
|
|
218
261
|
* pageSize: 50,
|
|
219
262
|
* displayFields: ['firstName', 'lastName', 'email']
|
|
220
263
|
* });
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* // options is rarely needed; omit it unless you need one of these behaviors.
|
|
267
|
+
* const response = await getListData(
|
|
268
|
+
* {
|
|
269
|
+
* dataElementId: 'student',
|
|
270
|
+
* pageNumber: 1,
|
|
271
|
+
* pageSize: 10,
|
|
272
|
+
* displayFields: ['name']
|
|
273
|
+
* },
|
|
274
|
+
* {
|
|
275
|
+
* search: {
|
|
276
|
+
* attributeId: 'name',
|
|
277
|
+
* value: 'Ada',
|
|
278
|
+
* total: 100
|
|
279
|
+
* }
|
|
280
|
+
* }
|
|
281
|
+
* );
|
|
221
282
|
*/
|
|
222
283
|
export declare function getListData(request: PagedListDataRequest, options?: ListDataOptions): Promise<ListDataResponse>;
|
|
223
284
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lists.d.ts","sourceRoot":"","sources":["../../../src/lists.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAQ,UAAU,EAAiB,MAAM,MAAM,CAAC;AAOvD;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qDAAqD;IACrD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qCAAqC;IACrC,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,8GAA8G;IAC9G,WAAW,EAAE,MAAM,CAAC;IACpB,qFAAqF;IACrF,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,EAAE,CAAC;IAEvB
|
|
1
|
+
{"version":3,"file":"lists.d.ts","sourceRoot":"","sources":["../../../src/lists.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAQ,UAAU,EAAiB,MAAM,MAAM,CAAC;AAOvD;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qDAAqD;IACrD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qCAAqC;IACrC,YAAY,CAAC,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BAAgB,CAAC,CAuDrH;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAE9H;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAoBpF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,eAAe,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAE7F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAoBxF;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAEjG"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* Simplified Stripe-oriented gateway preauth result shape accepted by the standalone payment endpoint.
|
|
4
|
+
*
|
|
5
|
+
* The SDK assumes Stripe and injects `paymentGateway: 'stripe'` when sending the request. Other gateway-specific
|
|
6
|
+
* fields may still be required by the backend decoder and payment processor, so unknown additional fields are
|
|
7
|
+
* preserved and sent through unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export interface GatewayPaymentPreauthResult {
|
|
10
|
+
/** Billing info captured during payment entry. */
|
|
11
|
+
userBillingInfo: Record<string, any>;
|
|
12
|
+
/** Payment method identifier such as `creditCardOrOther` or `us_bank_account`. */
|
|
13
|
+
paymentMethod?: string;
|
|
14
|
+
/** Final amount that was preauthorized, including fees when applicable. */
|
|
15
|
+
totalAmount?: number;
|
|
16
|
+
/** Additional Stripe preauth data required by the backend, such as token IDs or saved payment method info. */
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Request payload for the standalone payment route.
|
|
21
|
+
*
|
|
22
|
+
* Notes:
|
|
23
|
+
* - `organizationKey` is sourced from `userContext.orgKey`.
|
|
24
|
+
* - `payerType` is assumed to be `SolutionUserProxy`.
|
|
25
|
+
* - `hostObjectKey`, `hostElementId`, and `hostAttributeId` identify the solution-defined object field that will be
|
|
26
|
+
* updated with the returned payment summary when processing completes.
|
|
27
|
+
*/
|
|
28
|
+
export interface StandalonePaymentRequest {
|
|
29
|
+
/** Payer object key. */
|
|
30
|
+
payerKey: string;
|
|
31
|
+
/** Organization key receiving the payment. */
|
|
32
|
+
payeeKey: string;
|
|
33
|
+
/** Base payment amount before any processing fee adjustments. */
|
|
34
|
+
paymentAmount: number;
|
|
35
|
+
/** Gateway preauthorization result produced by the payment UI flow. */
|
|
36
|
+
preAuthResult: GatewayPaymentPreauthResult;
|
|
37
|
+
/**
|
|
38
|
+
* Whether this payment should be completed as a bank-account/ACH payment.
|
|
39
|
+
*
|
|
40
|
+
* If omitted, the SDK infers it from `preAuthResult.paymentMethod` for common ACH method values.
|
|
41
|
+
*/
|
|
42
|
+
bankAccountPayment?: boolean;
|
|
43
|
+
/** Key of the host object to update with payment results. */
|
|
44
|
+
hostObjectKey: string;
|
|
45
|
+
/** Data element ID of the host object to update with payment results. */
|
|
46
|
+
hostElementId: string;
|
|
47
|
+
/** Attribute ID on the host object that must exist in the solution data model to store the payment summary. */
|
|
48
|
+
hostAttributeId: string;
|
|
49
|
+
/** If true, the backend also creates a non-POS sales transaction linked to the host object. */
|
|
50
|
+
generateTransaction?: boolean;
|
|
51
|
+
/** Optional override for the payment/transaction description. */
|
|
52
|
+
chargeDescription?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Result returned by the standalone payment route.
|
|
56
|
+
*/
|
|
57
|
+
export interface StandalonePaymentResult {
|
|
58
|
+
/** Persisted payment object key. */
|
|
59
|
+
paymentKey: string;
|
|
60
|
+
/** User-facing payment summary string written back to the host attribute. */
|
|
61
|
+
paymentSummary: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Completes a previously preauthorized standalone payment.
|
|
65
|
+
*
|
|
66
|
+
* This endpoint performs the final charge, updates the host object's payment summary attribute,
|
|
67
|
+
* persists billing address information back to the payer, and can optionally generate a linked
|
|
68
|
+
* sales transaction.
|
|
69
|
+
*/
|
|
70
|
+
export declare function submitStandalonePayment(request: StandalonePaymentRequest): Promise<StandalonePaymentResult>;
|
|
71
|
+
/**
|
|
72
|
+
* Observable version of submitStandalonePayment. See submitStandalonePayment for details.
|
|
73
|
+
*/
|
|
74
|
+
export declare function submitStandalonePaymentAsObservable(request: StandalonePaymentRequest): Observable<StandalonePaymentResult>;
|
|
75
|
+
//# sourceMappingURL=payments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../../src/payments.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAQ,UAAU,EAAiB,MAAM,MAAM,CAAC;AAQvD;;;;;;GAMG;AACH,MAAM,WAAW,2BAA2B;IACxC,kDAAkD;IAClD,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8GAA8G;IAC9G,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACrC,wBAAwB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,aAAa,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,aAAa,EAAE,2BAA2B,CAAC;IAC3C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,6DAA6D;IAC7D,aAAa,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,aAAa,EAAE,MAAM,CAAC;IACtB,+GAA+G;IAC/G,eAAe,EAAE,MAAM,CAAC;IACxB,+FAA+F;IAC/F,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iEAAiE;IACjE,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,cAAc,EAAE,MAAM,CAAC;CAC1B;AAoBD;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA2BjH;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,wBAAwB,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAE1H"}
|
package/lib/esm/data-crud.js
CHANGED
|
@@ -17,6 +17,49 @@
|
|
|
17
17
|
* - Retrieve all objects related to a parent object
|
|
18
18
|
* - Save a single object
|
|
19
19
|
* - Delete a single or multiple objects
|
|
20
|
+
*
|
|
21
|
+
* @usage
|
|
22
|
+
* ## When to Use
|
|
23
|
+
* - **Read objects without specifying parent scope** β `getAccessibleObjects` (most common read)
|
|
24
|
+
* - **Get single object by key** β `getObject`
|
|
25
|
+
* - **Get related objects (<50)** β `getRelatedObjects`
|
|
26
|
+
* - **Create/update single object** β `saveRelatedObject`
|
|
27
|
+
* - **Delete single object** β `deleteRelatedObject`
|
|
28
|
+
*
|
|
29
|
+
* ## When NOT to Use
|
|
30
|
+
* - **Large lists (100+)** β use lists skill with `getListData`
|
|
31
|
+
* - **Bulk updates** β use lists skill with `massEdit`
|
|
32
|
+
* - **Aggregations** β use data-aggregate skill
|
|
33
|
+
*
|
|
34
|
+
* ## Key Functions
|
|
35
|
+
* | Function | Use For |
|
|
36
|
+
* |----------|---------|
|
|
37
|
+
* | `getAccessibleObjects` | Read objects the current user can access (no parent scope needed) |
|
|
38
|
+
* | `getObject` | Single object by key |
|
|
39
|
+
* | `getRelatedObjects` | Children of a parent (small collections) |
|
|
40
|
+
* | `saveRelatedObject` | Create or update one object |
|
|
41
|
+
* | `deleteRelatedObject` | Delete one object |
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* // Get all accessible recipes
|
|
45
|
+
* const recipes = await hx.getAccessibleObjects('recipe');
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // Get single recipe
|
|
49
|
+
* const recipe = await hx.getObject('recipe', recipeKey);
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* // Get ingredients (small collection)
|
|
53
|
+
* const ingredients = await hx.getRelatedObjects(
|
|
54
|
+
* 'recipe', recipeKey, 'ingredient'
|
|
55
|
+
* );
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* // Save new ingredient
|
|
59
|
+
* await hx.saveRelatedObject(
|
|
60
|
+
* 'recipe', recipeKey, 'ingredient',
|
|
61
|
+
* { name: 'Salt', amount: '1 tsp' }
|
|
62
|
+
* );
|
|
20
63
|
*/
|
|
21
64
|
import axios from 'axios';
|
|
22
65
|
import { from, lastValueFrom } from 'rxjs';
|
package/lib/esm/data-crud.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-crud.js","sourceRoot":"","sources":["../../src/data-crud.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,mCAAmC;AACnC,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,EAAE;AACF,6DAA6D;AAC7D,oDAAoD;AAEpD
|
|
1
|
+
{"version":3,"file":"data-crud.js","sourceRoot":"","sources":["../../src/data-crud.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,mCAAmC;AACnC,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,EAAE;AACF,6DAA6D;AAC7D,oDAAoD;AAEpD;;;;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OAAO;AAIH,eAAe;AACf,aAAa,EACb,yBAAyB,EAC5B,MAAM,MAAM,CAAC;AAEd,mFAAmF;AACnF,oBAAoB;AACpB,mFAAmF;AAEnF,OAAO,EACH,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,UAAU,EACb,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,mCAAmC;AACnC,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,EAAE;AACF,6DAA6D;AAC7D,oDAAoD;AAEpD;;;;GAIG;AAEH,mFAAmF;AACnF,sDAAsD;AACtD,mFAAmF;AAEnF,OAAO;AACH,UAAU;AACV,YAAY,EACZ,UAAU,EACV,cAAc,EACd,aAAa,EACb,WAAW,EACX,MAAM,EACN,OAAO;AAEP,iBAAiB;AACjB,UAAU;AAkBV,mBAAmB;AACnB,sBAAsB,EACtB,oBAAoB,EACvB,MAAM,eAAe,CAAC;AAEvB,mFAAmF;AACnF,sBAAsB;AACtB,mFAAmF;AAEnF,OAAO;AAIH,iBAAiB;AACjB,SAAS,EACT,qBAAqB,EACrB,iBAAiB,EACjB,6BAA6B,EAC7B,oBAAoB,EACpB,gCAAgC;AAEhC,YAAY;AACZ,iBAAiB,EACjB,6BAA6B;AAE7B,cAAc;AACd,mBAAmB,EACnB,+BAA+B,EAC/B,oBAAoB,EACpB,gCAAgC,EACnC,MAAM,aAAa,CAAC;AAErB,mFAAmF;AACnF,oBAAoB;AACpB,mFAAmF;AAEnF,OAAO;AAIH,oBAAoB;AACpB,mBAAmB,EACnB,+BAA+B,EAC/B,YAAY,EACZ,wBAAwB,EACxB,gBAAgB,EAChB,4BAA4B,EAC5B,sBAAsB,EACtB,kCAAkC,EACrC,MAAM,WAAW,CAAC;AAEnB,mFAAmF;AACnF,sBAAsB;AACtB,mFAAmF;AAEnF,OAAO;AACH,kBAAkB;AAClB,aAAa;AAKb,sBAAsB;AACtB,WAAW,EACX,uBAAuB,EAC1B,MAAM,aAAa,CAAC;AAErB,mFAAmF;AACnF,uBAAuB;AACvB,mFAAmF;AAEnF,OAAO;AACH,uBAAuB;AACvB,iBAAiB,EACjB,yBAAyB,EACzB,6BAA6B,EAC7B,qCAAqC,EACxC,MAAM,eAAe,CAAC;AAEvB,mFAAmF;AACnF,sBAAsB;AACtB,mFAAmF;AAEnF,OAAO;AAcH,YAAY;AACZ,WAAW,EACX,uBAAuB,EACvB,QAAQ,EACR,oBAAoB,EACpB,UAAU,EACV,sBAAsB,EACzB,MAAM,SAAS,CAAC;AAEjB,mFAAmF;AACnF,2BAA2B;AAC3B,mFAAmF;AAEnF,OAAO;AACH,UAAU;AACV,mBAAmB;AAYnB,YAAY;AACZ,gBAAgB,EAChB,4BAA4B,EAC/B,MAAM,kBAAkB,CAAC;AAE1B,mFAAmF;AACnF,oBAAoB;AACpB,mFAAmF;AAEnF,OAAO;AAMH,YAAY;AACZ,uBAAuB,EACvB,mCAAmC,EACtC,MAAM,YAAY,CAAC;AAEpB,mFAAmF;AACnF,eAAe;AACf,mFAAmF;AAEnF,OAAO;AAIH,eAAe;AACf,aAAa,EACb,yBAAyB,EAC5B,MAAM,MAAM,CAAC;AAEd,mFAAmF;AACnF,oBAAoB;AACpB,mFAAmF;AAEnF,OAAO,EACH,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,UAAU,EACb,MAAM,aAAa,CAAC"}
|
package/lib/esm/index.mjs
CHANGED
|
@@ -66,6 +66,12 @@ AggregationResponse,
|
|
|
66
66
|
// Functions
|
|
67
67
|
getAggregateData, getAggregateDataAsObservable } from './data-aggregate';
|
|
68
68
|
// ================================================================================
|
|
69
|
+
// PAYMENT FUNCTIONS
|
|
70
|
+
// ================================================================================
|
|
71
|
+
export {
|
|
72
|
+
// Functions
|
|
73
|
+
submitStandalonePayment, submitStandalonePaymentAsObservable } from './payments';
|
|
74
|
+
// ================================================================================
|
|
69
75
|
// AI FUNCTIONS
|
|
70
76
|
// ================================================================================
|
|
71
77
|
export {
|
package/lib/esm/lists.js
CHANGED
|
@@ -31,11 +31,50 @@ import { sandboxKey, serviceAddress, getAuthToken } from './sdk-general';
|
|
|
31
31
|
/**
|
|
32
32
|
* Retrieves paginated list data. Supports authenticated/public access, filtering, sorting, and binary search.
|
|
33
33
|
*
|
|
34
|
+
* Common usage:
|
|
35
|
+
* - For most custom-element list UIs, start with only `dataElementId`, pagination fields,
|
|
36
|
+
* and `displayFields`.
|
|
37
|
+
* - Omit `parentDataElementId` and `parentKey` when you want the records the current user
|
|
38
|
+
* can already access.
|
|
39
|
+
* - Add `parentDataElementId` and `parentKey` only when the list must be anchored to a
|
|
40
|
+
* specific parent record.
|
|
41
|
+
* - Most callers should omit `options`. Use `options.search` only for binary-search
|
|
42
|
+
* navigation scenarios, and use `options.bypassTotal` only when you explicitly do not
|
|
43
|
+
* need the total count.
|
|
44
|
+
*
|
|
45
|
+
* Request shape:
|
|
46
|
+
* - `dataElementId` (required): root data element to retrieve
|
|
47
|
+
* - `pageNumber` / `pageSize` (optional): pagination
|
|
48
|
+
* - `displayFields` (optional): fields to populate in returned objects
|
|
49
|
+
* - `sort` (optional): sort fields such as `[{ attributeId: 'name' }]`
|
|
50
|
+
* - `filter` (optional): filter expression
|
|
51
|
+
* - `parentDataElementId` / `parentKey` (optional): explicit parent scope
|
|
52
|
+
*
|
|
34
53
|
* @param request - List configuration including dataElementId, parentDataElementId, parentKey, pagination, sort, filter
|
|
35
54
|
* @param options - Optional: isPublic, bypassTotal, search
|
|
36
55
|
* @returns Promise<ListDataResponse> with data array, total count, pageNumber
|
|
37
56
|
*
|
|
38
57
|
* @example
|
|
58
|
+
* // Most common case: one page of records the current user can access.
|
|
59
|
+
* const response = await getListData({
|
|
60
|
+
* dataElementId: 'student',
|
|
61
|
+
* pageNumber: 1,
|
|
62
|
+
* pageSize: 10,
|
|
63
|
+
* displayFields: ['name', 'studentNumber', 'email', 'grade']
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* // Custom element pagination with an optional sort.
|
|
68
|
+
* const response = await getListData({
|
|
69
|
+
* dataElementId: 'student',
|
|
70
|
+
* pageNumber: currentPage,
|
|
71
|
+
* pageSize: 10,
|
|
72
|
+
* displayFields: ['name', 'studentNumber', 'email', 'grade'],
|
|
73
|
+
* sort: [{ attributeId: 'name' }]
|
|
74
|
+
* });
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* // Explicit parent scoping when the list must be anchored to a specific parent.
|
|
39
78
|
* const listData = await getListData({
|
|
40
79
|
* dataElementId: 'customer',
|
|
41
80
|
* parentDataElementId: 'company',
|
|
@@ -44,6 +83,24 @@ import { sandboxKey, serviceAddress, getAuthToken } from './sdk-general';
|
|
|
44
83
|
* pageSize: 50,
|
|
45
84
|
* displayFields: ['firstName', 'lastName', 'email']
|
|
46
85
|
* });
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* // options is rarely needed; omit it unless you need one of these behaviors.
|
|
89
|
+
* const response = await getListData(
|
|
90
|
+
* {
|
|
91
|
+
* dataElementId: 'student',
|
|
92
|
+
* pageNumber: 1,
|
|
93
|
+
* pageSize: 10,
|
|
94
|
+
* displayFields: ['name']
|
|
95
|
+
* },
|
|
96
|
+
* {
|
|
97
|
+
* search: {
|
|
98
|
+
* attributeId: 'name',
|
|
99
|
+
* value: 'Ada',
|
|
100
|
+
* total: 100
|
|
101
|
+
* }
|
|
102
|
+
* }
|
|
103
|
+
* );
|
|
47
104
|
*/
|
|
48
105
|
export async function getListData(request, options) {
|
|
49
106
|
const isPublic = options?.isPublic ?? false;
|
package/lib/esm/lists.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lists.js","sourceRoot":"","sources":["../../src/lists.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,mCAAmC;AACnC,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,EAAE;AACF,6DAA6D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,QAAQ,CAAC,IAAI,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAwB;IACzD,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAA0B;IACvD,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,MAAM,YAAY,GAAG,sBAAsB,CAAC;QAC5C,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;IACD,MAAM,GAAG,GAAG,GAAG,cAAc,mBAAmB,UAAU,aAAa,CAAC;IAExE,0CAA0C;IAC1C,IAAI,SAAS,GAAG,MAAM,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC;IACpD,IAAI,OAAO,GAAQ;QACf,aAAa,EAAE,UAAU,SAAS,EAAE;KACvC,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,0BAA0B,GAAG,GAAG,GAAG,cAAc,GAAG,SAAS,CAAC,CAAC;IAE3E,uBAAuB;IACvB,IAAI,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAE3D,OAAO,QAAQ,CAAC,IAAI,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAA0B;IAC7D,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Halix SDK License v1.0
|
|
2
|
+
// Copyright (c) 2025 halix.io LLC.
|
|
3
|
+
//
|
|
4
|
+
// This source code is licensed for use **only** within applications
|
|
5
|
+
// running on the Halix platform, in accordance with Halix SDK guidelines.
|
|
6
|
+
//
|
|
7
|
+
// Unauthorized use outside the Halix platform is prohibited.
|
|
8
|
+
// Full license terms available in the LICENSE file.
|
|
9
|
+
/**
|
|
10
|
+
* @module @halix/action-sdk/payments
|
|
11
|
+
* @description Payment completion helpers for the Halix Platform action SDK. This module provides
|
|
12
|
+
* a wrapper around the `standalonePayment` backend route, which finalizes a payment after a gateway
|
|
13
|
+
* component has already produced a preauthorization result.
|
|
14
|
+
*
|
|
15
|
+
* Typical flow:
|
|
16
|
+
* 1. Client/UI code collects payment details and obtains a gateway preauth result.
|
|
17
|
+
* 2. Action code calls `submitStandalonePayment(...)` with the payer, payee, host object, and preauth result.
|
|
18
|
+
* 3. The platform completes the payment, updates the host object's payment summary field, and optionally
|
|
19
|
+
* generates a sales transaction.
|
|
20
|
+
*/
|
|
21
|
+
import axios from 'axios';
|
|
22
|
+
import { from, lastValueFrom } from 'rxjs';
|
|
23
|
+
import { sandboxKey, serviceAddress, getAuthToken, userContext } from './sdk-general';
|
|
24
|
+
const STANDALONE_PAYMENT_URL = 'payments/sandboxes/:sandboxKey/standalonePayment';
|
|
25
|
+
const ASSUMED_PAYER_TYPE = 'SolutionUserProxy';
|
|
26
|
+
const ASSUMED_PAYMENT_GATEWAY = 'stripe';
|
|
27
|
+
const BANK_ACCOUNT_PAYMENT_METHODS = new Set(['us_bank_account', 'USBankAccount', 'bankAccount']);
|
|
28
|
+
function resolveBankAccountPayment(request) {
|
|
29
|
+
if (request.bankAccountPayment !== undefined) {
|
|
30
|
+
return request.bankAccountPayment;
|
|
31
|
+
}
|
|
32
|
+
return BANK_ACCOUNT_PAYMENT_METHODS.has(request.preAuthResult?.paymentMethod || '');
|
|
33
|
+
}
|
|
34
|
+
function resolveOrganizationKey() {
|
|
35
|
+
const organizationKey = userContext?.orgKey;
|
|
36
|
+
if (!organizationKey) {
|
|
37
|
+
throw new Error('userContext.orgKey is required for standalone payments; check that initialize(event) has been called with a full userContext');
|
|
38
|
+
}
|
|
39
|
+
return organizationKey;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Completes a previously preauthorized standalone payment.
|
|
43
|
+
*
|
|
44
|
+
* This endpoint performs the final charge, updates the host object's payment summary attribute,
|
|
45
|
+
* persists billing address information back to the payer, and can optionally generate a linked
|
|
46
|
+
* sales transaction.
|
|
47
|
+
*/
|
|
48
|
+
export async function submitStandalonePayment(request) {
|
|
49
|
+
if (!getAuthToken) {
|
|
50
|
+
const errorMessage = 'SDK not initialized.';
|
|
51
|
+
console.error(errorMessage);
|
|
52
|
+
throw new Error(errorMessage);
|
|
53
|
+
}
|
|
54
|
+
const url = `${serviceAddress}/${STANDALONE_PAYMENT_URL.replace(':sandboxKey', sandboxKey)}`;
|
|
55
|
+
const authToken = await lastValueFrom(getAuthToken());
|
|
56
|
+
const payload = {
|
|
57
|
+
...request,
|
|
58
|
+
organizationKey: resolveOrganizationKey(),
|
|
59
|
+
payerType: ASSUMED_PAYER_TYPE,
|
|
60
|
+
bankAccountPayment: resolveBankAccountPayment(request),
|
|
61
|
+
preAuthResult: {
|
|
62
|
+
paymentGateway: ASSUMED_PAYMENT_GATEWAY,
|
|
63
|
+
...request.preAuthResult,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
console.log('Sending POST request to ' + url + ' with token ' + authToken);
|
|
67
|
+
const response = await axios.post(url, payload, {
|
|
68
|
+
headers: { Authorization: `Bearer ${authToken}` },
|
|
69
|
+
});
|
|
70
|
+
return response.data;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Observable version of submitStandalonePayment. See submitStandalonePayment for details.
|
|
74
|
+
*/
|
|
75
|
+
export function submitStandalonePaymentAsObservable(request) {
|
|
76
|
+
return from(submitStandalonePayment(request));
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=payments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments.js","sourceRoot":"","sources":["../../src/payments.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,mCAAmC;AACnC,EAAE;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AAG,cAAc,IAAI,sBAAsB,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,EAAE,CAAC;IAC7F,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG;QACZ,GAAG,OAAO;QACV,eAAe,EAAE,sBAAsB,EAAE;QACzC,SAAS,EAAE,kBAAkB;QAC7B,kBAAkB,EAAE,yBAAyB,CAAC,OAAO,CAAC;QACtD,aAAa,EAAE;YACX,cAAc,EAAE,uBAAuB;YACvC,GAAG,OAAO,CAAC,aAAa;SAC3B;KACJ,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,0BAA0B,GAAG,GAAG,GAAG,cAAc,GAAG,SAAS,CAAC,CAAC;IAE3E,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE;QAC5C,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,SAAS,EAAE,EAAE;KACpD,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mCAAmC,CAAC,OAAiC;IACjF,OAAO,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
package/lib/esm/types/index.d.ts
CHANGED
|
@@ -10,5 +10,6 @@ export { MessageMethod, type MessageRequest, sendMessage, sendMessageAsObservabl
|
|
|
10
10
|
export { getUserPreference, getOrganizationPreference, getUserPreferenceAsObservable, getOrganizationPreferenceAsObservable } from './preferences';
|
|
11
11
|
export { type SortField, type DataSortField, type BaseListDataRequest, type PagedListDataRequest, type ListDataResponse, type ListDataOptions, type ListDataSearchOptions, type MassEditValueType, type MassEditRequest, type MassDeleteRequest, type MassChangeResponse, getListData, getListDataAsObservable, massEdit, massEditAsObservable, massDelete, massDeleteAsObservable } from './lists';
|
|
12
12
|
export { AggregationResponse, type AggregationRequest, type AggregationRow, type AggregationGroup, type AggregationSort, type Aggregation, type AggregationGroupTransform, type TransformType, type AggregationType, getAggregateData, getAggregateDataAsObservable } from './data-aggregate';
|
|
13
|
+
export { type GatewayPaymentPreauthResult, type StandalonePaymentRequest, type StandalonePaymentResult, submitStandalonePayment, submitStandalonePaymentAsObservable } from './payments';
|
|
13
14
|
export { type AIRequestOptions, sendAIMessage, sendAIMessageAsObservable } from './ai';
|
|
14
15
|
export { sortObjectArray, compareValues, getValueFromObject, debounceFn } from './utilities';
|
package/lib/esm/types/lists.d.ts
CHANGED
|
@@ -40,18 +40,22 @@ export interface BaseListDataRequest {
|
|
|
40
40
|
* The dataElementId must be related to this through a foreign key or key array.
|
|
41
41
|
* Works with parentKey to scope results. This is often an organization proxy
|
|
42
42
|
* or user proxy element, but not necessarily so.
|
|
43
|
+
*
|
|
44
|
+
* Note: in most cases, this can be omitted in which case the system will automatically
|
|
45
|
+
* return only the records the user can access.
|
|
43
46
|
*/
|
|
44
|
-
parentDataElementId
|
|
47
|
+
parentDataElementId?: string;
|
|
45
48
|
/**
|
|
46
49
|
* The key of an object that all records must be related to.
|
|
47
50
|
* Works with parentDataElementId to scope results.
|
|
48
51
|
*
|
|
49
|
-
*
|
|
52
|
+
* Note: in most cases, this can be omitted in which case the system will automatically
|
|
53
|
+
* return only the records the user can access.
|
|
50
54
|
*/
|
|
51
55
|
parentKey?: string;
|
|
52
56
|
/**
|
|
53
57
|
* Optional field to specify the foreign key field on the root element that defines
|
|
54
|
-
* the relationship to the parent. If omitted, a derived key is assumed.
|
|
58
|
+
* the relationship to the parent. If omitted, a derived key is assumed. Works with parentDataElementId to scope results.
|
|
55
59
|
*/
|
|
56
60
|
parentKeyField?: string;
|
|
57
61
|
/**
|
|
@@ -205,11 +209,50 @@ export interface MassChangeResponse {
|
|
|
205
209
|
/**
|
|
206
210
|
* Retrieves paginated list data. Supports authenticated/public access, filtering, sorting, and binary search.
|
|
207
211
|
*
|
|
212
|
+
* Common usage:
|
|
213
|
+
* - For most custom-element list UIs, start with only `dataElementId`, pagination fields,
|
|
214
|
+
* and `displayFields`.
|
|
215
|
+
* - Omit `parentDataElementId` and `parentKey` when you want the records the current user
|
|
216
|
+
* can already access.
|
|
217
|
+
* - Add `parentDataElementId` and `parentKey` only when the list must be anchored to a
|
|
218
|
+
* specific parent record.
|
|
219
|
+
* - Most callers should omit `options`. Use `options.search` only for binary-search
|
|
220
|
+
* navigation scenarios, and use `options.bypassTotal` only when you explicitly do not
|
|
221
|
+
* need the total count.
|
|
222
|
+
*
|
|
223
|
+
* Request shape:
|
|
224
|
+
* - `dataElementId` (required): root data element to retrieve
|
|
225
|
+
* - `pageNumber` / `pageSize` (optional): pagination
|
|
226
|
+
* - `displayFields` (optional): fields to populate in returned objects
|
|
227
|
+
* - `sort` (optional): sort fields such as `[{ attributeId: 'name' }]`
|
|
228
|
+
* - `filter` (optional): filter expression
|
|
229
|
+
* - `parentDataElementId` / `parentKey` (optional): explicit parent scope
|
|
230
|
+
*
|
|
208
231
|
* @param request - List configuration including dataElementId, parentDataElementId, parentKey, pagination, sort, filter
|
|
209
232
|
* @param options - Optional: isPublic, bypassTotal, search
|
|
210
233
|
* @returns Promise<ListDataResponse> with data array, total count, pageNumber
|
|
211
234
|
*
|
|
212
235
|
* @example
|
|
236
|
+
* // Most common case: one page of records the current user can access.
|
|
237
|
+
* const response = await getListData({
|
|
238
|
+
* dataElementId: 'student',
|
|
239
|
+
* pageNumber: 1,
|
|
240
|
+
* pageSize: 10,
|
|
241
|
+
* displayFields: ['name', 'studentNumber', 'email', 'grade']
|
|
242
|
+
* });
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* // Custom element pagination with an optional sort.
|
|
246
|
+
* const response = await getListData({
|
|
247
|
+
* dataElementId: 'student',
|
|
248
|
+
* pageNumber: currentPage,
|
|
249
|
+
* pageSize: 10,
|
|
250
|
+
* displayFields: ['name', 'studentNumber', 'email', 'grade'],
|
|
251
|
+
* sort: [{ attributeId: 'name' }]
|
|
252
|
+
* });
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* // Explicit parent scoping when the list must be anchored to a specific parent.
|
|
213
256
|
* const listData = await getListData({
|
|
214
257
|
* dataElementId: 'customer',
|
|
215
258
|
* parentDataElementId: 'company',
|
|
@@ -218,6 +261,24 @@ export interface MassChangeResponse {
|
|
|
218
261
|
* pageSize: 50,
|
|
219
262
|
* displayFields: ['firstName', 'lastName', 'email']
|
|
220
263
|
* });
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* // options is rarely needed; omit it unless you need one of these behaviors.
|
|
267
|
+
* const response = await getListData(
|
|
268
|
+
* {
|
|
269
|
+
* dataElementId: 'student',
|
|
270
|
+
* pageNumber: 1,
|
|
271
|
+
* pageSize: 10,
|
|
272
|
+
* displayFields: ['name']
|
|
273
|
+
* },
|
|
274
|
+
* {
|
|
275
|
+
* search: {
|
|
276
|
+
* attributeId: 'name',
|
|
277
|
+
* value: 'Ada',
|
|
278
|
+
* total: 100
|
|
279
|
+
* }
|
|
280
|
+
* }
|
|
281
|
+
* );
|
|
221
282
|
*/
|
|
222
283
|
export declare function getListData(request: PagedListDataRequest, options?: ListDataOptions): Promise<ListDataResponse>;
|
|
223
284
|
/**
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* Simplified Stripe-oriented gateway preauth result shape accepted by the standalone payment endpoint.
|
|
4
|
+
*
|
|
5
|
+
* The SDK assumes Stripe and injects `paymentGateway: 'stripe'` when sending the request. Other gateway-specific
|
|
6
|
+
* fields may still be required by the backend decoder and payment processor, so unknown additional fields are
|
|
7
|
+
* preserved and sent through unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export interface GatewayPaymentPreauthResult {
|
|
10
|
+
/** Billing info captured during payment entry. */
|
|
11
|
+
userBillingInfo: Record<string, any>;
|
|
12
|
+
/** Payment method identifier such as `creditCardOrOther` or `us_bank_account`. */
|
|
13
|
+
paymentMethod?: string;
|
|
14
|
+
/** Final amount that was preauthorized, including fees when applicable. */
|
|
15
|
+
totalAmount?: number;
|
|
16
|
+
/** Additional Stripe preauth data required by the backend, such as token IDs or saved payment method info. */
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Request payload for the standalone payment route.
|
|
21
|
+
*
|
|
22
|
+
* Notes:
|
|
23
|
+
* - `organizationKey` is sourced from `userContext.orgKey`.
|
|
24
|
+
* - `payerType` is assumed to be `SolutionUserProxy`.
|
|
25
|
+
* - `hostObjectKey`, `hostElementId`, and `hostAttributeId` identify the solution-defined object field that will be
|
|
26
|
+
* updated with the returned payment summary when processing completes.
|
|
27
|
+
*/
|
|
28
|
+
export interface StandalonePaymentRequest {
|
|
29
|
+
/** Payer object key. */
|
|
30
|
+
payerKey: string;
|
|
31
|
+
/** Organization key receiving the payment. */
|
|
32
|
+
payeeKey: string;
|
|
33
|
+
/** Base payment amount before any processing fee adjustments. */
|
|
34
|
+
paymentAmount: number;
|
|
35
|
+
/** Gateway preauthorization result produced by the payment UI flow. */
|
|
36
|
+
preAuthResult: GatewayPaymentPreauthResult;
|
|
37
|
+
/**
|
|
38
|
+
* Whether this payment should be completed as a bank-account/ACH payment.
|
|
39
|
+
*
|
|
40
|
+
* If omitted, the SDK infers it from `preAuthResult.paymentMethod` for common ACH method values.
|
|
41
|
+
*/
|
|
42
|
+
bankAccountPayment?: boolean;
|
|
43
|
+
/** Key of the host object to update with payment results. */
|
|
44
|
+
hostObjectKey: string;
|
|
45
|
+
/** Data element ID of the host object to update with payment results. */
|
|
46
|
+
hostElementId: string;
|
|
47
|
+
/** Attribute ID on the host object that must exist in the solution data model to store the payment summary. */
|
|
48
|
+
hostAttributeId: string;
|
|
49
|
+
/** If true, the backend also creates a non-POS sales transaction linked to the host object. */
|
|
50
|
+
generateTransaction?: boolean;
|
|
51
|
+
/** Optional override for the payment/transaction description. */
|
|
52
|
+
chargeDescription?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Result returned by the standalone payment route.
|
|
56
|
+
*/
|
|
57
|
+
export interface StandalonePaymentResult {
|
|
58
|
+
/** Persisted payment object key. */
|
|
59
|
+
paymentKey: string;
|
|
60
|
+
/** User-facing payment summary string written back to the host attribute. */
|
|
61
|
+
paymentSummary: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Completes a previously preauthorized standalone payment.
|
|
65
|
+
*
|
|
66
|
+
* This endpoint performs the final charge, updates the host object's payment summary attribute,
|
|
67
|
+
* persists billing address information back to the payer, and can optionally generate a linked
|
|
68
|
+
* sales transaction.
|
|
69
|
+
*/
|
|
70
|
+
export declare function submitStandalonePayment(request: StandalonePaymentRequest): Promise<StandalonePaymentResult>;
|
|
71
|
+
/**
|
|
72
|
+
* Observable version of submitStandalonePayment. See submitStandalonePayment for details.
|
|
73
|
+
*/
|
|
74
|
+
export declare function submitStandalonePaymentAsObservable(request: StandalonePaymentRequest): Observable<StandalonePaymentResult>;
|