@wix/auto_sdk_benefit-programs_programs 1.0.21 → 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.
@@ -1,3 +1,5 @@
1
+ import { NonNullablePaths } from '@wix/sdk-types';
2
+
1
3
  interface Program {
2
4
  /**
3
5
  * Program ID.
@@ -141,6 +143,8 @@ declare enum IdentityType {
141
143
  /** A Wix account holder, such as a site owner or contributor. */
142
144
  WIX_USER = "WIX_USER"
143
145
  }
146
+ /** @enumType */
147
+ type IdentityTypeWithLiterals = IdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER';
144
148
  interface ExtendedFields {
145
149
  /**
146
150
  * Extended field data. Each key corresponds to the namespace of the app that created the extended fields.
@@ -663,6 +667,70 @@ declare enum WebhookIdentityType {
663
667
  }
664
668
  /** @enumType */
665
669
  type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP';
670
+ /** @docsIgnore */
671
+ type ProvisionProgramApplicationErrors = {
672
+ code?: 'PROGRAM_ALREADY_EXISTS';
673
+ description?: string;
674
+ data?: ProgramAlreadyExists;
675
+ } | {
676
+ code?: 'IN_PROGRESS';
677
+ description?: string;
678
+ data?: Record<string, any>;
679
+ };
680
+ /** @docsIgnore */
681
+ type PauseProgramApplicationErrors = {
682
+ code?: 'PROGRAM_STATUS_TRANSITION_NOT_ALLOWED';
683
+ description?: string;
684
+ data?: ProgramStatusTransitionNotAllowed;
685
+ } | {
686
+ code?: 'ALREADY_EXECUTED';
687
+ description?: string;
688
+ data?: Record<string, any>;
689
+ } | {
690
+ code?: 'IN_PROGRESS';
691
+ description?: string;
692
+ data?: Record<string, any>;
693
+ };
694
+ /** @docsIgnore */
695
+ type ResumeProgramApplicationErrors = {
696
+ code?: 'PROGRAM_STATUS_TRANSITION_NOT_ALLOWED';
697
+ description?: string;
698
+ data?: ProgramStatusTransitionNotAllowed;
699
+ } | {
700
+ code?: 'ALREADY_EXECUTED';
701
+ description?: string;
702
+ data?: Record<string, any>;
703
+ } | {
704
+ code?: 'IN_PROGRESS';
705
+ description?: string;
706
+ data?: Record<string, any>;
707
+ };
708
+ /** @docsIgnore */
709
+ type EndProgramApplicationErrors = {
710
+ code?: 'PROGRAM_STATUS_TRANSITION_NOT_ALLOWED';
711
+ description?: string;
712
+ data?: ProgramStatusTransitionNotAllowed;
713
+ };
714
+ /**
715
+ * Creates a program for the specified beneficiary. Creating a program is also referred to as provisioning a program.
716
+ *
717
+ * You can provision a program from a program definition or a pool definition:
718
+ * - **Program definition**: The provisioned program has pools that are created from the pool definitions in the program definition.
719
+ * - **Pool definition**: The provisioned program has 1 pool that is created from the pool definition.
720
+ * @param poolDefinitionLookupId - The program definition or pool definition to use to provision the program.
721
+ * @public
722
+ * @documentationMaturity preview
723
+ * @requiredField options.beneficiary
724
+ * @requiredField options.externalProgramId
725
+ * @requiredField options.namespace
726
+ * @requiredField poolDefinitionLookupId
727
+ * @permissionId BENEFIT_PROGRAMS.PROGRAM_PROVISION
728
+ * @applicableIdentity APP
729
+ * @fqn wix.benefit_programs.v1.program.ProgramService.ProvisionProgram
730
+ */
731
+ declare function provisionProgram(poolDefinitionLookupId: PoolDefinitionLookupId, options?: NonNullablePaths<ProvisionProgramOptions, `beneficiary` | `externalProgramId` | `namespace`, 2>): Promise<NonNullablePaths<ProvisionProgramResponse, `jobId` | `program.status` | `program.beneficiary.anonymousVisitorId` | `program.beneficiary.memberId` | `program.beneficiary.wixUserId` | `program.programDefinition._id`, 4> & {
732
+ __applicationErrorsType?: ProvisionProgramApplicationErrors;
733
+ }>;
666
734
  interface ProvisionProgramOptions {
667
735
  /** Program beneficiary. */
668
736
  beneficiary: CommonIdentificationData;
@@ -691,6 +759,21 @@ interface ProvisionProgramOptions {
691
759
  */
692
760
  externalProgramId: string;
693
761
  }
762
+ /**
763
+ * Renews the specified program.
764
+ *
765
+ * The number of available credits in each pool in the program is defined in the corresponding pool's credit configuration.
766
+ * @param programId - ID of the program to renew.
767
+ * @public
768
+ * @documentationMaturity preview
769
+ * @requiredField options
770
+ * @requiredField options.idempotencyKey
771
+ * @requiredField programId
772
+ * @permissionId BENEFIT_PROGRAMS.PROGRAM_RENEW
773
+ * @applicableIdentity APP
774
+ * @fqn wix.benefit_programs.v1.program.ProgramService.RenewProgram
775
+ */
776
+ declare function renewProgram(programId: string, options: NonNullablePaths<RenewProgramOptions, `idempotencyKey`, 2>): Promise<NonNullablePaths<RenewProgramResponse, `jobId`, 2>>;
694
777
  interface RenewProgramOptions {
695
778
  /**
696
779
  * Idempotency key to ensure that the request is processed only once.
@@ -698,6 +781,21 @@ interface RenewProgramOptions {
698
781
  */
699
782
  idempotencyKey: string;
700
783
  }
784
+ /**
785
+ * Pauses the specified program. Benefits in the program's pools can't be redeemed until the program is resumed.
786
+ * @param programId - ID of the program to pause.
787
+ * @public
788
+ * @documentationMaturity preview
789
+ * @requiredField options
790
+ * @requiredField options.idempotencyKey
791
+ * @requiredField programId
792
+ * @permissionId BENEFIT_PROGRAMS.PROGRAM_PAUSE
793
+ * @applicableIdentity APP
794
+ * @fqn wix.benefit_programs.v1.program.ProgramService.PauseProgram
795
+ */
796
+ declare function pauseProgram(programId: string, options: NonNullablePaths<PauseProgramOptions, `idempotencyKey`, 2>): Promise<NonNullablePaths<PauseProgramResponse, `jobId`, 2> & {
797
+ __applicationErrorsType?: PauseProgramApplicationErrors;
798
+ }>;
701
799
  interface PauseProgramOptions {
702
800
  /**
703
801
  * Idempotency key to ensure that the request is processed only once.
@@ -705,6 +803,23 @@ interface PauseProgramOptions {
705
803
  */
706
804
  idempotencyKey: string;
707
805
  }
806
+ /**
807
+ * Resumes the specified program.
808
+ *
809
+ * Call this method for paused programs.
810
+ * @param programId - ID of program to resume.
811
+ * @public
812
+ * @documentationMaturity preview
813
+ * @requiredField options
814
+ * @requiredField options.idempotencyKey
815
+ * @requiredField programId
816
+ * @permissionId BENEFIT_PROGRAMS.PROGRAM_RESUME
817
+ * @applicableIdentity APP
818
+ * @fqn wix.benefit_programs.v1.program.ProgramService.ResumeProgram
819
+ */
820
+ declare function resumeProgram(programId: string, options: NonNullablePaths<ResumeProgramOptions, `idempotencyKey`, 2>): Promise<NonNullablePaths<ResumeProgramResponse, `jobId`, 2> & {
821
+ __applicationErrorsType?: ResumeProgramApplicationErrors;
822
+ }>;
708
823
  interface ResumeProgramOptions {
709
824
  /**
710
825
  * Idempotency key to ensure that the request is processed only once.
@@ -712,6 +827,39 @@ interface ResumeProgramOptions {
712
827
  */
713
828
  idempotencyKey: string;
714
829
  }
830
+ /**
831
+ * Ends the specified program.
832
+ * @param programId - ID of the program to end.
833
+ * @public
834
+ * @documentationMaturity preview
835
+ * @requiredField programId
836
+ * @permissionId BENEFIT_PROGRAMS.PROGRAM_END
837
+ * @applicableIdentity APP
838
+ * @fqn wix.benefit_programs.v1.program.ProgramService.EndProgram
839
+ */
840
+ declare function endProgram(programId: string): Promise<NonNullablePaths<EndProgramResponse, `jobId`, 2> & {
841
+ __applicationErrorsType?: EndProgramApplicationErrors;
842
+ }>;
843
+ /**
844
+ * Updates a program.
845
+ *
846
+ * Each time the program definition is updated,
847
+ * `revision` increments by 1.
848
+ * The current `revision` must be passed when updating the program definition.
849
+ * This ensures you're working with the latest program definition
850
+ * and prevents unintended overwrites.
851
+ * @param _id - Program ID.
852
+ * @public
853
+ * @documentationMaturity preview
854
+ * @requiredField _id
855
+ * @requiredField program
856
+ * @requiredField program.revision
857
+ * @permissionId BENEFIT_PROGRAMS.PROGRAM_UPDATE
858
+ * @applicableIdentity APP
859
+ * @returns Updated program.
860
+ * @fqn wix.benefit_programs.v1.program.ProgramService.UpdateProgram
861
+ */
862
+ declare function updateProgram(_id: string, program: NonNullablePaths<UpdateProgram, `revision`, 2>): Promise<NonNullablePaths<Program, `status` | `beneficiary.anonymousVisitorId` | `beneficiary.memberId` | `beneficiary.wixUserId` | `programDefinition._id`, 3>>;
715
863
  interface UpdateProgram {
716
864
  /**
717
865
  * Program ID.
@@ -790,6 +938,37 @@ interface UpdateProgram {
790
938
  */
791
939
  programDefinition?: ProgramDefinitionInfo;
792
940
  }
941
+ /**
942
+ * Retrieves a program.
943
+ * @param programId - ID of the program to retrieve.
944
+ * @public
945
+ * @documentationMaturity preview
946
+ * @requiredField programId
947
+ * @permissionId BENEFIT_PROGRAMS.PROGRAM_READ
948
+ * @applicableIdentity APP
949
+ * @returns Retrieved program.
950
+ * @fqn wix.benefit_programs.v1.program.ProgramService.GetProgram
951
+ */
952
+ declare function getProgram(programId: string): Promise<NonNullablePaths<Program, `status` | `beneficiary.anonymousVisitorId` | `beneficiary.memberId` | `beneficiary.wixUserId` | `programDefinition._id`, 3>>;
953
+ /**
954
+ * Creates a query to retrieve a list of programs.
955
+ *
956
+ * The Query Programs method builds a query to retrieve a list of programs and returns a `ProgramsQueryBuilder` object.
957
+ *
958
+ * The returned object contains the query definition, which is used to run the query using the `find()` method.
959
+ *
960
+ * You can refine the query by chaining `ProgramsQueryBuilder` methods onto the query. `ProgramsQueryBuilder` methods enable you to filter, sort, and control the results that Query Programs returns.
961
+ *
962
+ * Query Programs has a default paging limit of 50, which you can override.
963
+ *
964
+ * For a full description of the item object, see the object returned for the `items` property in `ProgramsQueryResult`.
965
+ * @public
966
+ * @documentationMaturity preview
967
+ * @permissionId BENEFIT_PROGRAMS.PROGRAM_READ
968
+ * @applicableIdentity APP
969
+ * @fqn wix.benefit_programs.v1.program.ProgramService.QueryPrograms
970
+ */
971
+ declare function queryPrograms(): ProgramsQueryBuilder;
793
972
  interface QueryCursorResult {
794
973
  cursors: Cursors;
795
974
  hasNext: () => boolean;
@@ -867,6 +1046,19 @@ interface ProgramsQueryBuilder {
867
1046
  /** @documentationMaturity preview */
868
1047
  find: () => Promise<ProgramsQueryResult>;
869
1048
  }
1049
+ /**
1050
+ * Retrieves a program with the specified external ID and namespace.
1051
+ * @param namespace - Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created.
1052
+ * @public
1053
+ * @documentationMaturity preview
1054
+ * @requiredField namespace
1055
+ * @requiredField options
1056
+ * @requiredField options.externalId
1057
+ * @permissionId BENEFIT_PROGRAMS.PROGRAM_READ
1058
+ * @applicableIdentity APP
1059
+ * @fqn wix.benefit_programs.v1.program.ProgramService.GetProgramByExternalIdAndNamespace
1060
+ */
1061
+ declare function getProgramByExternalIdAndNamespace(namespace: string, options: NonNullablePaths<GetProgramByExternalIdAndNamespaceOptions, `externalId`, 2>): Promise<NonNullablePaths<GetProgramByExternalIdAndNamespaceResponse, `program.status` | `program.beneficiary.anonymousVisitorId` | `program.beneficiary.memberId` | `program.beneficiary.wixUserId` | `program.programDefinition._id`, 4>>;
870
1062
  interface GetProgramByExternalIdAndNamespaceOptions {
871
1063
  /**
872
1064
  * Program's external ID.
@@ -875,4 +1067,4 @@ interface GetProgramByExternalIdAndNamespaceOptions {
875
1067
  externalId: string;
876
1068
  }
877
1069
 
878
- export { type Cursors as $, type ResumeProgramRequest as A, type EndProgramRequest as B, type CommonIdentificationData as C, type UpdateProgramStatusRequest as D, type EndProgramResponse as E, type UpdateProgramStatusResponse as F, type GetProgramByExternalIdAndNamespaceOptions as G, type UpsertMigratedProgramRequest as H, IdentityType as I, type UpsertMigratedProgramResponse as J, type UpdateProgramRequest as K, type UpdateProgramResponse as L, type GetProgramRequest as M, type GetProgramResponse as N, OrderStatus as O, type PoolDefinitionLookupId as P, type QueryProgramsRequest as Q, type RenewProgramOptions as R, SortOrder as S, type CursorQuery as T, type UpdateProgram as U, type CursorQueryPagingMethodOneOf as V, WebhookIdentityType as W, type Sorting as X, type CursorPaging as Y, type QueryProgramsResponse as Z, type CursorPagingMetadata as _, type ProvisionProgramOptions as a, type GetProgramByExternalIdAndNamespaceRequest as a0, type DomainEvent as a1, type DomainEventBodyOneOf as a2, type EntityCreatedEvent as a3, type RestoreInfo as a4, type EntityUpdatedEvent as a5, type EntityDeletedEvent as a6, type ActionEvent as a7, type MessageEnvelope as a8, type IdentificationData as a9, type IdentificationDataIdOneOf as aa, type ProgramsQueryResult as ab, type ProvisionProgramResponse as b, type RenewProgramResponse as c, type PauseProgramOptions as d, type PauseProgramResponse as e, type ResumeProgramOptions as f, type ResumeProgramResponse as g, type Program as h, type ProgramsQueryBuilder as i, type GetProgramByExternalIdAndNamespaceResponse as j, ProgramStatus as k, ProvisionProgramRequestProgramStatus as l, type CommonIdentificationDataIdOneOf as m, type ExtendedFields as n, type ProgramDefinitionInfo as o, type ProgramProvisioned as p, type ProgramRenewed as q, type ProgramEnded as r, type ProgramPaused as s, type ProgramResumed as t, type ProvisionProgramRequest as u, type PoolDefinitionLookupIdIdOneOf as v, type ProgramAlreadyExists as w, type RenewProgramRequest as x, type PauseProgramRequest as y, type ProgramStatusTransitionNotAllowed as z };
1070
+ export { type ActionEvent, type CommonIdentificationData, type CommonIdentificationDataIdOneOf, type CursorPaging, type CursorPagingMetadata, type CursorQuery, type CursorQueryPagingMethodOneOf, type Cursors, type DomainEvent, type DomainEventBodyOneOf, type EndProgramApplicationErrors, type EndProgramRequest, type EndProgramResponse, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type ExtendedFields, type GetProgramByExternalIdAndNamespaceOptions, type GetProgramByExternalIdAndNamespaceRequest, type GetProgramByExternalIdAndNamespaceResponse, type GetProgramRequest, type GetProgramResponse, type IdentificationData, type IdentificationDataIdOneOf, IdentityType, type IdentityTypeWithLiterals, type MessageEnvelope, OrderStatus, type OrderStatusWithLiterals, type PauseProgramApplicationErrors, type PauseProgramOptions, type PauseProgramRequest, type PauseProgramResponse, type PoolDefinitionLookupId, type PoolDefinitionLookupIdIdOneOf, type Program, type ProgramAlreadyExists, type ProgramDefinitionInfo, type ProgramEnded, type ProgramPaused, type ProgramProvisioned, type ProgramRenewed, type ProgramResumed, ProgramStatus, type ProgramStatusTransitionNotAllowed, type ProgramStatusWithLiterals, type ProgramsQueryBuilder, type ProgramsQueryResult, type ProvisionProgramApplicationErrors, type ProvisionProgramOptions, type ProvisionProgramRequest, ProvisionProgramRequestProgramStatus, type ProvisionProgramRequestProgramStatusWithLiterals, type ProvisionProgramResponse, type QueryProgramsRequest, type QueryProgramsResponse, type RenewProgramOptions, type RenewProgramRequest, type RenewProgramResponse, type RestoreInfo, type ResumeProgramApplicationErrors, type ResumeProgramOptions, type ResumeProgramRequest, type ResumeProgramResponse, SortOrder, type SortOrderWithLiterals, type Sorting, type UpdateProgram, type UpdateProgramRequest, type UpdateProgramResponse, type UpdateProgramStatusRequest, type UpdateProgramStatusResponse, type UpsertMigratedProgramRequest, type UpsertMigratedProgramResponse, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, endProgram, getProgram, getProgramByExternalIdAndNamespace, pauseProgram, provisionProgram, queryPrograms, renewProgram, resumeProgram, updateProgram };