@wix/auto_sdk_loyalty_earning-rules 1.0.15 → 1.0.17

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.
@@ -1,3 +1,5 @@
1
+ import { NonNullablePaths } from '@wix/sdk-types';
2
+
1
3
  /**
2
4
  * A loyalty earning rule defines how customers earn points in a loyalty program.
3
5
  * You can create rules for different activities, such as making purchases.
@@ -1013,17 +1015,143 @@ interface LoyaltyEarningRuleCreatedEnvelope {
1013
1015
  entity: LoyaltyEarningRule;
1014
1016
  metadata: EventMetadata;
1015
1017
  }
1018
+ /**
1019
+ * Triggered when an earning rule is created.
1020
+ * @permissionScope Read Loyalty
1021
+ * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
1022
+ * @permissionScope Manage Loyalty
1023
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
1024
+ * @permissionScope Manage Restaurants - all permissions
1025
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1026
+ * @permissionId LOYALTY.READ_EARNING_RULES
1027
+ * @webhook
1028
+ * @eventType wix.loyalty.v1.loyalty_earning_rule_created
1029
+ * @slug created
1030
+ */
1031
+ declare function onLoyaltyEarningRuleCreated(handler: (event: LoyaltyEarningRuleCreatedEnvelope) => void | Promise<void>): void;
1016
1032
  interface LoyaltyEarningRuleDeletedEnvelope {
1017
1033
  metadata: EventMetadata;
1018
1034
  }
1035
+ /**
1036
+ * Triggered when an earning rule is deleted.
1037
+ * @permissionScope Read Loyalty
1038
+ * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
1039
+ * @permissionScope Manage Loyalty
1040
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
1041
+ * @permissionScope Manage Restaurants - all permissions
1042
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1043
+ * @permissionId LOYALTY.READ_EARNING_RULES
1044
+ * @webhook
1045
+ * @eventType wix.loyalty.v1.loyalty_earning_rule_deleted
1046
+ * @slug deleted
1047
+ */
1048
+ declare function onLoyaltyEarningRuleDeleted(handler: (event: LoyaltyEarningRuleDeletedEnvelope) => void | Promise<void>): void;
1019
1049
  interface LoyaltyEarningRuleUpdatedEnvelope {
1020
1050
  entity: LoyaltyEarningRule;
1021
1051
  metadata: EventMetadata;
1022
1052
  }
1053
+ /**
1054
+ * Triggered when an earning rule is updated.
1055
+ * @permissionScope Read Loyalty
1056
+ * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
1057
+ * @permissionScope Manage Loyalty
1058
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
1059
+ * @permissionScope Manage Restaurants - all permissions
1060
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1061
+ * @permissionId LOYALTY.READ_EARNING_RULES
1062
+ * @webhook
1063
+ * @eventType wix.loyalty.v1.loyalty_earning_rule_updated
1064
+ * @slug updated
1065
+ */
1066
+ declare function onLoyaltyEarningRuleUpdated(handler: (event: LoyaltyEarningRuleUpdatedEnvelope) => void | Promise<void>): void;
1067
+ type LoyaltyEarningRuleNonNullablePaths = `fixedAmount.configs` | `fixedAmount.configs.${number}.points` | `conversionRate.configs` | `conversionRate.configs.${number}.moneyAmount` | `conversionRate.configs.${number}.points` | `sourceAppId` | `triggerAppId` | `triggerActivityType` | `title` | `status` | `metadata.canBeDeleted`;
1068
+ /**
1069
+ * Creates a non-automated earning rule.
1070
+ *
1071
+ * >**Note**: You can only create non-automated earning rules from a supported list.
1072
+ * For the supported list of services, see the introduction.
1073
+ * @param earningRule - Earning rule to create.
1074
+ * @public
1075
+ * @requiredField earningRule
1076
+ * @requiredField earningRule.sourceAppId
1077
+ * @requiredField earningRule.status
1078
+ * @requiredField earningRule.title
1079
+ * @requiredField earningRule.triggerActivityType
1080
+ * @requiredField earningRule.triggerAppId
1081
+ * @permissionId LOYALTY.MANAGE_EARNING_RULES
1082
+ * @applicableIdentity APP
1083
+ * @returns Created earning rule.
1084
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.CreateLoyaltyEarningRule
1085
+ */
1086
+ declare function createLoyaltyEarningRule(earningRule: NonNullablePaths<LoyaltyEarningRule, `sourceAppId` | `status` | `title` | `triggerActivityType` | `triggerAppId`>): Promise<NonNullablePaths<LoyaltyEarningRule, LoyaltyEarningRuleNonNullablePaths>>;
1087
+ /**
1088
+ * Creates multiple non-automated earning rules.
1089
+ *
1090
+ * >**Note**: You can only create non-automated earning rules from a supported list.
1091
+ * For the supported list of services, see the introduction.
1092
+ * @param earningRules - Earning rules to create.
1093
+ * @public
1094
+ * @requiredField earningRules
1095
+ * @requiredField earningRules.sourceAppId
1096
+ * @requiredField earningRules.status
1097
+ * @requiredField earningRules.title
1098
+ * @requiredField earningRules.triggerActivityType
1099
+ * @requiredField earningRules.triggerAppId
1100
+ * @permissionId LOYALTY.MANAGE_EARNING_RULES
1101
+ * @applicableIdentity APP
1102
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.BulkCreateLoyaltyEarningRules
1103
+ */
1104
+ declare function bulkCreateLoyaltyEarningRules(earningRules: NonNullablePaths<LoyaltyEarningRule, `sourceAppId` | `status` | `title` | `triggerActivityType` | `triggerAppId`>[]): Promise<NonNullablePaths<BulkCreateLoyaltyEarningRulesResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | {
1105
+ [P in LoyaltyEarningRuleNonNullablePaths]: `results.${number}.item.${P}`;
1106
+ }[LoyaltyEarningRuleNonNullablePaths] | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`>>;
1107
+ /**
1108
+ * Creates a custom automated earning rule.
1109
+ *
1110
+ * To learn more about the automated rules, read the introduction.
1111
+ * @param type - Type of the custom earning rule.
1112
+ * @public
1113
+ * @requiredField type
1114
+ * @permissionId LOYALTY.MANAGE_EARNING_RULES
1115
+ * @applicableIdentity APP
1116
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.CreateCustomLoyaltyEarningRule
1117
+ */
1118
+ declare function createCustomLoyaltyEarningRule(type: TypeWithLiterals, options?: CreateCustomLoyaltyEarningRuleOptions): Promise<NonNullablePaths<CreateCustomLoyaltyEarningRuleResponse, {
1119
+ [P in LoyaltyEarningRuleNonNullablePaths]: `earningRule.${P}`;
1120
+ }[LoyaltyEarningRuleNonNullablePaths]>>;
1023
1121
  interface CreateCustomLoyaltyEarningRuleOptions {
1024
1122
  /** Custom earning rule to create. */
1025
1123
  earningRule?: CustomLoyaltyEarningRule;
1026
1124
  }
1125
+ /**
1126
+ * Retrieves a specified non-automated earning rule.
1127
+ * @param _id - ID of the earning rule to retrieve.
1128
+ * @public
1129
+ * @requiredField _id
1130
+ * @permissionId LOYALTY.READ_EARNING_RULES
1131
+ * @applicableIdentity APP
1132
+ * @applicableIdentity VISITOR
1133
+ * @returns Retrieved earning rule.
1134
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.GetLoyaltyEarningRule
1135
+ */
1136
+ declare function getLoyaltyEarningRule(_id: string): Promise<NonNullablePaths<LoyaltyEarningRule, LoyaltyEarningRuleNonNullablePaths>>;
1137
+ /**
1138
+ * Updates an earning rule.
1139
+ *
1140
+ * Supports partial updates.
1141
+ *
1142
+ * Revision number, which increments by 1 each time the earning rule is updated. To prevent conflicting changes,
1143
+ * the current revision must be passed when updating the earning rule.
1144
+ * @param _id - Loyalty earning rule ID.
1145
+ * @public
1146
+ * @requiredField _id
1147
+ * @requiredField earningRule
1148
+ * @permissionId LOYALTY.MANAGE_EARNING_RULES
1149
+ * @applicableIdentity APP
1150
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.UpdateLoyaltyEarningRule
1151
+ */
1152
+ declare function updateLoyaltyEarningRule(_id: string, earningRule: UpdateLoyaltyEarningRule): Promise<NonNullablePaths<UpdateLoyaltyEarningRuleResponse, {
1153
+ [P in LoyaltyEarningRuleNonNullablePaths]: `earningRule.${P}`;
1154
+ }[LoyaltyEarningRuleNonNullablePaths]>>;
1027
1155
  interface UpdateLoyaltyEarningRule {
1028
1156
  /** Fixed amount of points awarded for each qualifying activity. */
1029
1157
  fixedAmount?: FixedAmount;
@@ -1081,6 +1209,16 @@ interface UpdateLoyaltyEarningRule {
1081
1209
  */
1082
1210
  metadata?: Metadata;
1083
1211
  }
1212
+ /**
1213
+ * Deletes a non-automated earning rule.
1214
+ * @param _id - ID of the earning rule to delete.
1215
+ * @public
1216
+ * @requiredField _id
1217
+ * @permissionId LOYALTY.MANAGE_EARNING_RULES
1218
+ * @applicableIdentity APP
1219
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.DeleteLoyaltyEarningRule
1220
+ */
1221
+ declare function deleteLoyaltyEarningRule(_id: string, options?: DeleteLoyaltyEarningRuleOptions): Promise<void>;
1084
1222
  interface DeleteLoyaltyEarningRuleOptions {
1085
1223
  /**
1086
1224
  * Revision of the earning rule. Incremented by 1 each time the earning rule is updated.
@@ -1088,6 +1226,33 @@ interface DeleteLoyaltyEarningRuleOptions {
1088
1226
  */
1089
1227
  revision?: string;
1090
1228
  }
1229
+ /**
1230
+ * Deletes a custom automated earning rule.
1231
+ *
1232
+ * > **Note:** Pre-installed automated rules can only be paused, not deleted.
1233
+ * @param _id - ID of the earning rule to delete.
1234
+ * @public
1235
+ * @requiredField _id
1236
+ * @permissionId LOYALTY.MANAGE_EARNING_RULES
1237
+ * @applicableIdentity APP
1238
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.DeleteAutomationEarningRule
1239
+ */
1240
+ declare function deleteAutomationEarningRule(_id: string): Promise<void>;
1241
+ /**
1242
+ * Retrieves a list of earning rules.
1243
+ *
1244
+ * Returns both automated and non-automated earning rules.
1245
+ *
1246
+ * You can filter the results by `triggerAppId` or `triggerActivityType`.
1247
+ * @public
1248
+ * @permissionId LOYALTY.READ_EARNING_RULES
1249
+ * @applicableIdentity APP
1250
+ * @applicableIdentity VISITOR
1251
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.ListEarningRules
1252
+ */
1253
+ declare function listEarningRules(options?: ListEarningRulesOptions): Promise<NonNullablePaths<ListEarningRulesResponse, {
1254
+ [P in LoyaltyEarningRuleNonNullablePaths]: `earningRules.${number}.${P}`;
1255
+ }[LoyaltyEarningRuleNonNullablePaths]>>;
1091
1256
  interface ListEarningRulesOptions {
1092
1257
  /** App ID that triggers the point assignment. For example, `9a5d83fd-8570-482e-81ab-cfa88942ee60`. */
1093
1258
  triggerAppId?: string | null;
@@ -1095,4 +1260,4 @@ interface ListEarningRulesOptions {
1095
1260
  triggerActivityType?: string | null;
1096
1261
  }
1097
1262
 
1098
- export { type DomainEvent as $, type ApplicationError as A, type BulkCreateLoyaltyEarningRulesResponse as B, type CreateCustomLoyaltyEarningRuleOptions as C, type DeleteLoyaltyEarningRuleOptions as D, type EarningRuleDisabled as E, type FixedAmount as F, type GetLoyaltyEarningRuleRequest as G, type GetLoyaltyEarningRuleResponse as H, type ItemMetadata as I, type UpdateLoyaltyEarningRuleRequest as J, type DeleteLoyaltyEarningRuleRequest as K, type LoyaltyEarningRule as L, type Metadata as M, Namespace as N, type DeleteLoyaltyEarningRuleResponse as O, type DeleteAutomationEarningRuleRequest as P, type DeleteAutomationEarningRuleResponse as Q, type ListEarningRulesRequest as R, Status as S, type TypeWithLiterals as T, type UpdateLoyaltyEarningRule as U, type ListEarningRulesInTierRequest as V, WebhookIdentityType as W, type CursorPaging as X, type ListEarningRulesInTierResponse as Y, type PagingMetadataV2 as Z, type Cursors as _, type CreateCustomLoyaltyEarningRuleResponse as a, type DomainEventBodyOneOf as a0, type EntityCreatedEvent as a1, type RestoreInfo as a2, type EntityUpdatedEvent as a3, type EntityDeletedEvent as a4, type ActionEvent as a5, type Empty as a6, type InvalidateEarningRuleCacheRequest as a7, type InvalidateEarningRuleCacheResponse as a8, type MetaSiteSpecialEvent as a9, type IdentificationDataIdOneOf as aA, type BaseEventMetadata as aB, type EventMetadata as aC, type MetaSiteSpecialEventPayloadOneOf as aa, type Asset as ab, type SiteCreated as ac, type SiteTransferred as ad, type SiteDeleted as ae, type DeleteContext as af, type SiteUndeleted as ag, type SitePublished as ah, type SiteUnpublished as ai, type SiteMarkedAsTemplate as aj, type SiteMarkedAsWixSite as ak, type ServiceProvisioned as al, type ServiceRemoved as am, type SiteRenamed as an, type SiteHardDeleted as ao, type NamespaceChanged as ap, type StudioAssigned as aq, type StudioUnassigned as ar, type SiteUrlChanged as as, type SitePurgedExternally as at, type OdeditorAssigned as au, type OdeditorUnassigned as av, type PicassoAssigned as aw, type PicassoUnassigned as ax, type MessageEnvelope as ay, type IdentificationData as az, type UpdateLoyaltyEarningRuleResponse as b, type ListEarningRulesOptions as c, type ListEarningRulesResponse as d, type LoyaltyEarningRuleCreatedEnvelope as e, type LoyaltyEarningRuleDeletedEnvelope as f, type LoyaltyEarningRuleUpdatedEnvelope as g, LoyaltyEarningRuleTypeTagType as h, Type as i, State as j, SiteCreatedContext as k, DeleteStatus as l, type LoyaltyEarningRuleTypeOneOf as m, type FixedAmountConfig as n, type ConversionRate as o, type ConversionRateConfig as p, type LoyaltyEarningRuleTypeTag as q, type CacheInvalidated as r, type CreateLoyaltyEarningRuleRequest as s, type CreateLoyaltyEarningRuleResponse as t, type BulkCreateLoyaltyEarningRulesRequest as u, type BulkLoyaltyEarningRuleResult as v, type BulkActionMetadata as w, type CreateCustomLoyaltyEarningRuleRequest as x, type CustomLoyaltyEarningRule as y, type CustomLoyaltyEarningRuleTypeOneOf as z };
1263
+ export { type ActionEvent, type ApplicationError, type Asset, type BaseEventMetadata, type BulkActionMetadata, type BulkCreateLoyaltyEarningRulesRequest, type BulkCreateLoyaltyEarningRulesResponse, type BulkLoyaltyEarningRuleResult, type CacheInvalidated, type ConversionRate, type ConversionRateConfig, type CreateCustomLoyaltyEarningRuleOptions, type CreateCustomLoyaltyEarningRuleRequest, type CreateCustomLoyaltyEarningRuleResponse, type CreateLoyaltyEarningRuleRequest, type CreateLoyaltyEarningRuleResponse, type CursorPaging, type Cursors, type CustomLoyaltyEarningRule, type CustomLoyaltyEarningRuleTypeOneOf, type DeleteAutomationEarningRuleRequest, type DeleteAutomationEarningRuleResponse, type DeleteContext, type DeleteLoyaltyEarningRuleOptions, type DeleteLoyaltyEarningRuleRequest, type DeleteLoyaltyEarningRuleResponse, DeleteStatus, type DeleteStatusWithLiterals, type DomainEvent, type DomainEventBodyOneOf, type EarningRuleDisabled, type Empty, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type EventMetadata, type FixedAmount, type FixedAmountConfig, type GetLoyaltyEarningRuleRequest, type GetLoyaltyEarningRuleResponse, type IdentificationData, type IdentificationDataIdOneOf, type InvalidateEarningRuleCacheRequest, type InvalidateEarningRuleCacheResponse, type ItemMetadata, type ListEarningRulesInTierRequest, type ListEarningRulesInTierResponse, type ListEarningRulesOptions, type ListEarningRulesRequest, type ListEarningRulesResponse, type LoyaltyEarningRule, type LoyaltyEarningRuleCreatedEnvelope, type LoyaltyEarningRuleDeletedEnvelope, type LoyaltyEarningRuleTypeOneOf, type LoyaltyEarningRuleTypeTag, LoyaltyEarningRuleTypeTagType, type LoyaltyEarningRuleTypeTagTypeWithLiterals, type LoyaltyEarningRuleUpdatedEnvelope, type MessageEnvelope, type MetaSiteSpecialEvent, type MetaSiteSpecialEventPayloadOneOf, type Metadata, Namespace, type NamespaceChanged, type NamespaceWithLiterals, type OdeditorAssigned, type OdeditorUnassigned, type PagingMetadataV2, type PicassoAssigned, type PicassoUnassigned, type RestoreInfo, type ServiceProvisioned, type ServiceRemoved, type SiteCreated, SiteCreatedContext, type SiteCreatedContextWithLiterals, type SiteDeleted, type SiteHardDeleted, type SiteMarkedAsTemplate, type SiteMarkedAsWixSite, type SitePublished, type SitePurgedExternally, type SiteRenamed, type SiteTransferred, type SiteUndeleted, type SiteUnpublished, type SiteUrlChanged, State, type StateWithLiterals, Status, type StatusWithLiterals, type StudioAssigned, type StudioUnassigned, Type, type TypeWithLiterals, type UpdateLoyaltyEarningRule, type UpdateLoyaltyEarningRuleRequest, type UpdateLoyaltyEarningRuleResponse, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, bulkCreateLoyaltyEarningRules, createCustomLoyaltyEarningRule, createLoyaltyEarningRule, deleteAutomationEarningRule, deleteLoyaltyEarningRule, getLoyaltyEarningRule, listEarningRules, onLoyaltyEarningRuleCreated, onLoyaltyEarningRuleDeleted, onLoyaltyEarningRuleUpdated, updateLoyaltyEarningRule };