@wix/auto_sdk_benefit-programs_balances 1.0.22 → 1.0.23
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/build/cjs/index.d.ts +12 -8
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/{benefit-programs-v1-balance-balances.universal-m87JvYFn.d.ts → index.typings.d.ts} +109 -1
- package/build/cjs/index.typings.js +539 -0
- package/build/cjs/index.typings.js.map +1 -0
- package/build/cjs/meta.d.ts +2 -1
- package/build/es/index.d.mts +12 -8
- package/build/es/index.mjs.map +1 -1
- package/build/es/{benefit-programs-v1-balance-balances.universal-m87JvYFn.d.mts → index.typings.d.mts} +109 -1
- package/build/es/index.typings.mjs +503 -0
- package/build/es/index.typings.mjs.map +1 -0
- package/build/es/meta.d.mts +2 -1
- package/build/internal/cjs/index.d.ts +12 -8
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/{benefit-programs-v1-balance-balances.universal-m87JvYFn.d.ts → index.typings.d.ts} +109 -1
- package/build/internal/cjs/index.typings.js +539 -0
- package/build/internal/cjs/index.typings.js.map +1 -0
- package/build/internal/cjs/meta.d.ts +2 -1
- package/build/internal/es/index.d.mts +12 -8
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/{benefit-programs-v1-balance-balances.universal-m87JvYFn.d.mts → index.typings.d.mts} +109 -1
- package/build/internal/es/index.typings.mjs +503 -0
- package/build/internal/es/index.typings.mjs.map +1 -0
- package/build/internal/es/meta.d.mts +2 -1
- package/package.json +5 -4
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { NonNullablePaths } from '@wix/sdk-types';
|
|
2
|
+
|
|
1
3
|
interface Balance {
|
|
2
4
|
/**
|
|
3
5
|
* Balance ID. This is the same as the associated pool's ID.
|
|
@@ -95,6 +97,8 @@ declare enum IdentityType {
|
|
|
95
97
|
/** A Wix account holder, such as a site owner or contributor. */
|
|
96
98
|
WIX_USER = "WIX_USER"
|
|
97
99
|
}
|
|
100
|
+
/** @enumType */
|
|
101
|
+
type IdentityTypeWithLiterals = IdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER';
|
|
98
102
|
interface BalanceAmount {
|
|
99
103
|
/**
|
|
100
104
|
* number of available credits.
|
|
@@ -386,6 +390,8 @@ declare enum LimitRule {
|
|
|
386
390
|
/** If the limit is exceeded, the operation will succeed but the balance will be adjusted so that it satisfies the provided limits. If the resulting balance is below the lower_limit, it will be set to the lower_limit. If the resulting balance is above the upper_limit, it will be set to the upper_limit. */
|
|
387
391
|
HARD_ENFORCE = "HARD_ENFORCE"
|
|
388
392
|
}
|
|
393
|
+
/** @enumType */
|
|
394
|
+
type LimitRuleWithLiterals = LimitRule | 'UNKNOWN_LIMIT_RULE' | 'FAIL' | 'SOFT_ENFORCE' | 'HARD_ENFORCE';
|
|
389
395
|
interface SetOptions {
|
|
390
396
|
/**
|
|
391
397
|
* Amount to set the balance's available credits to.
|
|
@@ -770,6 +776,49 @@ declare enum WebhookIdentityType {
|
|
|
770
776
|
}
|
|
771
777
|
/** @enumType */
|
|
772
778
|
type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP';
|
|
779
|
+
type ChangeBalanceApplicationErrors = {
|
|
780
|
+
code?: 'ALREADY_EXECUTED';
|
|
781
|
+
description?: string;
|
|
782
|
+
data?: Record<string, any>;
|
|
783
|
+
} | {
|
|
784
|
+
code?: 'BALANCE_EXCEEDED_LIMITS';
|
|
785
|
+
description?: string;
|
|
786
|
+
data?: BalanceExceededLimits;
|
|
787
|
+
};
|
|
788
|
+
type RevertBalanceChangeApplicationErrors = {
|
|
789
|
+
code?: 'CHANGE_ALREADY_REVERTED';
|
|
790
|
+
description?: string;
|
|
791
|
+
data?: ChangeAlreadyReverted;
|
|
792
|
+
} | {
|
|
793
|
+
code?: 'NOT_ENOUGH_BALANCE';
|
|
794
|
+
description?: string;
|
|
795
|
+
data?: NotEnoughBalance;
|
|
796
|
+
} | {
|
|
797
|
+
code?: 'TRANSACTION_NOT_FOUND';
|
|
798
|
+
description?: string;
|
|
799
|
+
data?: Record<string, any>;
|
|
800
|
+
};
|
|
801
|
+
/**
|
|
802
|
+
* Retrieves a balance.
|
|
803
|
+
* @param poolId - ID of the pool associated with the balance to retrieve. This is also the ID of the balance.
|
|
804
|
+
* @public
|
|
805
|
+
* @documentationMaturity preview
|
|
806
|
+
* @requiredField poolId
|
|
807
|
+
* @permissionId BENEFIT_PROGRAMS.BALANCE_READ
|
|
808
|
+
* @applicableIdentity APP
|
|
809
|
+
* @returns Retrieved balance.
|
|
810
|
+
* @fqn wix.benefit_programs.v1.balance.BalanceService.GetBalance
|
|
811
|
+
*/
|
|
812
|
+
declare function getBalance(poolId: string): Promise<NonNullablePaths<Balance, `_id` | `beneficiary.anonymousVisitorId` | `beneficiary.memberId` | `beneficiary.wixUserId` | `amount.available` | `poolInfo._id` | `poolInfo.status`, 3>>;
|
|
813
|
+
/**
|
|
814
|
+
* Retrieves a list of balances.
|
|
815
|
+
* @public
|
|
816
|
+
* @documentationMaturity preview
|
|
817
|
+
* @permissionId BENEFIT_PROGRAMS.BALANCE_READ
|
|
818
|
+
* @applicableIdentity APP
|
|
819
|
+
* @fqn wix.benefit_programs.v1.balance.BalanceService.ListBalances
|
|
820
|
+
*/
|
|
821
|
+
declare function listBalances(options?: ListBalancesOptions): Promise<NonNullablePaths<ListBalancesResponse, `balances` | `balances.${number}._id` | `balances.${number}.beneficiary.anonymousVisitorId` | `balances.${number}.beneficiary.memberId` | `balances.${number}.beneficiary.wixUserId` | `balances.${number}.amount.available` | `balances.${number}.poolInfo._id` | `balances.${number}.poolInfo.status`, 5>>;
|
|
773
822
|
interface ListBalancesOptions {
|
|
774
823
|
/**
|
|
775
824
|
* List of IDs of the pools associated with the balances to retrieve. These are also the IDs of the balances.
|
|
@@ -780,6 +829,25 @@ interface ListBalancesOptions {
|
|
|
780
829
|
/** Cursor paging. */
|
|
781
830
|
cursorPaging?: CursorPaging;
|
|
782
831
|
}
|
|
832
|
+
/**
|
|
833
|
+
* Creates a query to retrieve a list of balances.
|
|
834
|
+
*
|
|
835
|
+
* The Query Balances method builds a query to retrieve a list of balances and returns a `BalancesQueryBuilder` object.
|
|
836
|
+
*
|
|
837
|
+
* The returned object contains the query definition, which is used to run the query using the `find()` method.
|
|
838
|
+
*
|
|
839
|
+
* You can refine the query by chaining `BalancesQueryBuilder` methods onto the query. `BalancesQueryBuilder` methods enable you to filter, sort, and control the results that Query Balances returns.
|
|
840
|
+
*
|
|
841
|
+
* Query Balances has a default paging limit of 50, which you can override.
|
|
842
|
+
*
|
|
843
|
+
* For a full description of the item object, see the object returned for the `items` property in `BalancesQueryResult`.
|
|
844
|
+
* @public
|
|
845
|
+
* @documentationMaturity preview
|
|
846
|
+
* @permissionId BENEFIT_PROGRAMS.BALANCE_READ
|
|
847
|
+
* @applicableIdentity APP
|
|
848
|
+
* @fqn wix.benefit_programs.v1.balance.BalanceService.QueryBalances
|
|
849
|
+
*/
|
|
850
|
+
declare function queryBalances(): BalancesQueryBuilder;
|
|
783
851
|
interface QueryCursorResult {
|
|
784
852
|
cursors: Cursors;
|
|
785
853
|
hasNext: () => boolean;
|
|
@@ -857,6 +925,25 @@ interface BalancesQueryBuilder {
|
|
|
857
925
|
/** @documentationMaturity preview */
|
|
858
926
|
find: () => Promise<BalancesQueryResult>;
|
|
859
927
|
}
|
|
928
|
+
/**
|
|
929
|
+
* Changes the number of available credits in a balance.
|
|
930
|
+
*
|
|
931
|
+
* You can adjust or set the number of available credits.
|
|
932
|
+
* @param poolId - ID of the pool associated with the balance to change. This is also the ID of the balance.
|
|
933
|
+
* @param idempotencyKey - Unique identifier, generated by the client.
|
|
934
|
+
* Used to recognize repeated attempts to make the same request.
|
|
935
|
+
* @public
|
|
936
|
+
* @documentationMaturity preview
|
|
937
|
+
* @requiredField idempotencyKey
|
|
938
|
+
* @requiredField options.operation
|
|
939
|
+
* @requiredField poolId
|
|
940
|
+
* @permissionId BENEFIT_PROGRAMS.BALANCE_CHANGE
|
|
941
|
+
* @applicableIdentity APP
|
|
942
|
+
* @fqn wix.benefit_programs.v1.balance.BalanceService.ChangeBalance
|
|
943
|
+
*/
|
|
944
|
+
declare function changeBalance(poolId: string, idempotencyKey: string, options?: ChangeBalanceOptions): Promise<NonNullablePaths<ChangeBalanceResponse, `balance._id` | `balance.beneficiary.anonymousVisitorId` | `balance.beneficiary.memberId` | `balance.beneficiary.wixUserId` | `balance.amount.available` | `balance.poolInfo._id` | `balance.poolInfo.status`, 4> & {
|
|
945
|
+
__applicationErrorsType?: ChangeBalanceApplicationErrors;
|
|
946
|
+
}>;
|
|
860
947
|
interface ChangeBalanceOptions extends ChangeBalanceOptionsOperationOneOf {
|
|
861
948
|
/** Identity changing the balance. */
|
|
862
949
|
instructingParty?: CommonIdentificationData;
|
|
@@ -876,9 +963,30 @@ interface ChangeBalanceOptionsOperationOneOf {
|
|
|
876
963
|
/** Set the balance to a specific number of credits. */
|
|
877
964
|
setOptions?: SetOptions;
|
|
878
965
|
}
|
|
966
|
+
/**
|
|
967
|
+
* Reverts a transaction created by calling Change Balance.
|
|
968
|
+
*
|
|
969
|
+
* For example, if a transaction increased a balance's available credits by 5,
|
|
970
|
+
* calling Revert Balance Change with the transaction's ID will decrease the balance's available credit by 5.
|
|
971
|
+
*
|
|
972
|
+
* > **Note:** If the Change Balance call set the balance, Revert Transaction reverts the amount the balance changed by, ensuring subsequent balance changes are still reflected after the reversion.
|
|
973
|
+
* @param transactionId - ID of the transaction associated with the balance change to revert.
|
|
974
|
+
* @param idempotencyKey - Unique identifier, generated by the client.
|
|
975
|
+
* Used to recognize repeated attempts to make the same request.
|
|
976
|
+
* @public
|
|
977
|
+
* @documentationMaturity preview
|
|
978
|
+
* @requiredField idempotencyKey
|
|
979
|
+
* @requiredField transactionId
|
|
980
|
+
* @permissionId BENEFIT_PROGRAMS.BALANCE_CHANGE
|
|
981
|
+
* @applicableIdentity APP
|
|
982
|
+
* @fqn wix.benefit_programs.v1.balance.BalanceService.RevertBalanceChange
|
|
983
|
+
*/
|
|
984
|
+
declare function revertBalanceChange(transactionId: string, idempotencyKey: string, options?: RevertBalanceChangeOptions): Promise<RevertBalanceChangeResponse & {
|
|
985
|
+
__applicationErrorsType?: RevertBalanceChangeApplicationErrors;
|
|
986
|
+
}>;
|
|
879
987
|
interface RevertBalanceChangeOptions {
|
|
880
988
|
/** Identity reverting the balance change. */
|
|
881
989
|
instructingParty?: CommonIdentificationData;
|
|
882
990
|
}
|
|
883
991
|
|
|
884
|
-
export { type
|
|
992
|
+
export { type ActionEvent, type AdjustOptions, type ApplicationError, type Balance, type BalanceAmount, type BalanceChangeBalanceRequest, type BalanceChangeBalanceRequestOperationOneOf, type BalanceExceededLimits, type BalancesQueryBuilder, type BalancesQueryResult, type BulkActionMetadata, type BulkChangeBalanceResult, type BulkChangeBalancesRequest, type BulkChangeBalancesResponse, type ChangeAlreadyReverted, type ChangeBalanceApplicationErrors, type ChangeBalanceOptions, type ChangeBalanceOptionsOperationOneOf, type ChangeBalanceRequest, type ChangeBalanceRequestOperationOneOf, ChangeBalanceRequestType, type ChangeBalanceRequestTypeWithLiterals, type ChangeBalanceResponse, type CommonIdentificationData, type CommonIdentificationDataIdOneOf, type CursorPaging, type CursorPagingMetadata, type CursorQuery, type CursorQueryPagingMethodOneOf, type Cursors, type DomainEvent, type DomainEventBodyOneOf, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type ExtendedFields, type GetBalanceRequest, type GetBalanceResponse, type GetTransactionReversibilityRequest, type GetTransactionReversibilityResponse, type IdentificationData, type IdentificationDataIdOneOf, IdentityType, type IdentityTypeWithLiterals, type Item, type ItemMetadata, LimitRule, type LimitRuleWithLiterals, type ListBalancesOptions, type ListBalancesRequest, type ListBalancesResponse, type MessageEnvelope, type NotEnoughBalance, type PoolInfo, PoolStatus, type PoolStatusWithLiterals, type QueryBalancesRequest, type QueryBalancesResponse, type RestoreInfo, type RevertBalanceChangeApplicationErrors, type RevertBalanceChangeOptions, type RevertBalanceChangeRequest, type RevertBalanceChangeResponse, type RolloverConfigurationInfo, type SetInitialOptions, type SetOptions, SortOrder, type SortOrderWithLiterals, type Sorting, type TransactionDetails, TransactionReversibility, type TransactionReversibilityWithLiterals, Type, type TypeWithLiterals, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, changeBalance, getBalance, listBalances, queryBalances, revertBalanceChange };
|