@lifeready/core 1.1.20 → 1.1.22

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.
@@ -2915,6 +2915,13 @@ var LinkTypeField;
2915
2915
  LinkTypeField["HARD"] = "HARD";
2916
2916
  LinkTypeField["SOFT"] = "SOFT";
2917
2917
  })(LinkTypeField || (LinkTypeField = {}));
2918
+ var PlanStateField;
2919
+ (function (PlanStateField) {
2920
+ PlanStateField["TRIALLING"] = "TRIALLING";
2921
+ PlanStateField["ACTIVE"] = "ACTIVE";
2922
+ PlanStateField["CANCELLED"] = "CANCELLED";
2923
+ PlanStateField["EXPIRED"] = "EXPIRED";
2924
+ })(PlanStateField || (PlanStateField = {}));
2918
2925
 
2919
2926
  function handleCognitoCallback(method) {
2920
2927
  return new Promise((resolve, reject) => method((err, result) => (err ? reject(err) : resolve(result))));
@@ -9712,6 +9719,311 @@ class StripeCheckoutSession {
9712
9719
  class StripeBillingPortalSession {
9713
9720
  }
9714
9721
 
9722
+ const PlanFields = `
9723
+ id
9724
+ created
9725
+ modified
9726
+ name
9727
+ description
9728
+ currentStates {
9729
+ id
9730
+ created
9731
+ modified
9732
+ periodStart
9733
+ periodEnd
9734
+ state
9735
+ }
9736
+ currentPriceOption {
9737
+ priceId
9738
+ name
9739
+ amount
9740
+ currency
9741
+ intervalUnit
9742
+ intervalCount
9743
+ }
9744
+ alternativePriceOptions {
9745
+ priceId
9746
+ name
9747
+ amount
9748
+ currency
9749
+ intervalUnit
9750
+ intervalCount
9751
+ }
9752
+ `;
9753
+ const InitiateStripePaymentMethodCaptureMutation = gqlTyped `
9754
+ mutation InitiateStripePaymentMethodCaptureMutation {
9755
+ initiateStripePaymentMethodCapture(input: {}) {
9756
+ paymentCapture {
9757
+ stripeIntentId
9758
+ stripeClientSecret
9759
+ }
9760
+ }
9761
+ }
9762
+ `;
9763
+ const CompleteStripePaymentMethodCaptureMutation = gqlTyped `
9764
+ mutation CompleteStripePaymentMethodCaptureMutation($input: CompleteStripePaymentMethodCaptureInput!) {
9765
+ completeStripePaymentMethodCapture(input: $input) {
9766
+ paymentMethod {
9767
+ id
9768
+ created
9769
+ modified
9770
+ card {
9771
+ brand
9772
+ lastFourDigits
9773
+ expiryYear
9774
+ expiryMonth
9775
+ }
9776
+ isDefault
9777
+ }
9778
+ }
9779
+ }
9780
+ `;
9781
+ const RemovePaymentMethodMutation = gqlTyped `
9782
+ mutation RemovePaymentMethodMutation($input: RemovePaymentMethodInput!) {
9783
+ removePaymentMethod(input: $input) {
9784
+ id
9785
+ }
9786
+ }
9787
+ `;
9788
+ const SetDefaultPaymentMethodMutation = gqlTyped `
9789
+ mutation SetDefaultPaymentMethodMutation($input: SetDefaultPaymentMethodInput!) {
9790
+ setDefaultPaymentMethod(input: $input) {
9791
+ paymentMethod {
9792
+ id
9793
+ }
9794
+ }
9795
+ }
9796
+ `;
9797
+ const RemoveDefaultPaymentMethodMutation = gqlTyped `
9798
+ mutation RemoveDefaultPaymentMethodMutation {
9799
+ removeDefaultPaymentMethod(input: {}) {
9800
+ paymentMethod {
9801
+ id
9802
+ }
9803
+ }
9804
+ }
9805
+ `;
9806
+ const IssuePlanMutation = gqlTyped `
9807
+ mutation IssuePlanMutation($input: IssuePlanInput!) {
9808
+ issuePlan(input: $input) {
9809
+ plan {
9810
+ ${PlanFields}
9811
+ }
9812
+ }
9813
+ }
9814
+ `;
9815
+ const CancelPlanMutation = gqlTyped `
9816
+ mutation CancelPlanMutation($input: CancelPlanInput!) {
9817
+ cancelPlan(input: $input) {
9818
+ plan {
9819
+ ${PlanFields}
9820
+ }
9821
+ }
9822
+ }
9823
+ `;
9824
+ const ChangePriceOptionMutation = gqlTyped `
9825
+ mutation ChangePriceOptionMutation($input: ChangePriceOptionInput!) {
9826
+ changePriceOption(input: $input) {
9827
+ plan {
9828
+ ${PlanFields}
9829
+ }
9830
+ }
9831
+ }
9832
+ `;
9833
+ const ReactivatePlanMutation = gqlTyped `
9834
+ mutation ReactivatePlanMutation($input: ReactivatePlanInput!) {
9835
+ reactivatePlan(input: $input) {
9836
+ plan {
9837
+ ${PlanFields}
9838
+ }
9839
+ }
9840
+ }
9841
+ `;
9842
+
9843
+ let Plan2Service = class Plan2Service extends LrService {
9844
+ constructor(ngZone, injector) {
9845
+ super(injector);
9846
+ this.ngZone = ngZone;
9847
+ this.injector = injector;
9848
+ }
9849
+ initiateStripePaymentMethodCapture() {
9850
+ return this.mutate(this.initiateStripePaymentMethodCaptureMutation());
9851
+ }
9852
+ /**
9853
+ * Starts a stripe payment capture intent. On intent can only add one card.
9854
+ * @returns Promise that resolves to a mutation
9855
+ */
9856
+ initiateStripePaymentMethodCaptureMutation() {
9857
+ return new LrMutation({
9858
+ mutation: InitiateStripePaymentMethodCaptureMutation,
9859
+ variables: {
9860
+ input: {},
9861
+ },
9862
+ });
9863
+ }
9864
+ completeStripePaymentMethodCapture(stripeIntentId) {
9865
+ return this.mutate(this.completeStripePaymentMethodCaptureMutation(stripeIntentId));
9866
+ }
9867
+ /**
9868
+ * Completes the payment capture intent. Call this after calling stripe.confirmCardSetup.
9869
+ *
9870
+ * The return result of this mutation can be used to update the UI. Because this is a mutation
9871
+ * we always get the most up to date data from the BD.
9872
+ *
9873
+ * @returns Promise that resolves to a mutation with the just created PaymentMethodNode
9874
+ */
9875
+ completeStripePaymentMethodCaptureMutation(stripeIntentId) {
9876
+ return new LrMutation({
9877
+ mutation: CompleteStripePaymentMethodCaptureMutation,
9878
+ variables: {
9879
+ input: { stripeIntentId },
9880
+ },
9881
+ });
9882
+ }
9883
+ setDefaultPaymentMethod(paymentMethodId) {
9884
+ return this.mutate(this.setDefaultPaymentMethodMutation(paymentMethodId));
9885
+ }
9886
+ /**
9887
+ * Mutation that sets the default payment method for the current user.
9888
+ *
9889
+ * @param paymentMethodId The id from PaymentMethodNode
9890
+ * @returns Promise that resolves to a mutation
9891
+ */
9892
+ setDefaultPaymentMethodMutation(paymentMethodId) {
9893
+ return new LrMutation({
9894
+ mutation: SetDefaultPaymentMethodMutation,
9895
+ variables: {
9896
+ input: {
9897
+ paymentMethodId,
9898
+ },
9899
+ },
9900
+ });
9901
+ }
9902
+ removeDefaultPaymentMethod() {
9903
+ return this.mutate(this.removeDefaultPaymentMethodMutation());
9904
+ }
9905
+ /**
9906
+ * Mutation that removes a the default payment method
9907
+ *
9908
+ * @returns Promise that resolves to a mutation
9909
+ */
9910
+ removeDefaultPaymentMethodMutation() {
9911
+ return new LrMutation({
9912
+ mutation: RemoveDefaultPaymentMethodMutation,
9913
+ variables: {
9914
+ input: {},
9915
+ },
9916
+ });
9917
+ }
9918
+ issuePlan(options) {
9919
+ return this.mutate(this.issuePlanMutation(options));
9920
+ }
9921
+ /**
9922
+ * Mutation that issues a new plan for the current user.
9923
+ *
9924
+ * @param options.issuerUid The same issuerUid that is in the AvailablePlanField returned by queries such as availablePublicPlans
9925
+ * @param options.planUid The same planUid that is in the AvailablePlanField returned by queries such as availablePublicPlans
9926
+ * @param options.priceId The priceId from PriceOptionField (eg. inside AvailablePlanField)
9927
+ * @param options.promotionalCode promotion code where applicable
9928
+ * @returns Promise that resolves to a mutation
9929
+ */
9930
+ issuePlanMutation(options) {
9931
+ return new LrMutation({
9932
+ mutation: IssuePlanMutation,
9933
+ variables: {
9934
+ input: options,
9935
+ },
9936
+ });
9937
+ }
9938
+ removePaymentMethod(paymentMethodId) {
9939
+ return this.mutate(this.removePaymentMethodMutation(paymentMethodId));
9940
+ }
9941
+ /**
9942
+ * Mutation that removes a payment method for the current user
9943
+ *
9944
+ * @param paymentMethodId The id from PaymentMethodNode
9945
+ * @returns Promise that resolves to a mutation
9946
+ */
9947
+ removePaymentMethodMutation(paymentMethodId) {
9948
+ return new LrMutation({
9949
+ mutation: RemovePaymentMethodMutation,
9950
+ variables: {
9951
+ input: {
9952
+ paymentMethodId,
9953
+ },
9954
+ },
9955
+ });
9956
+ }
9957
+ cancelPlan(options) {
9958
+ return this.mutate(this.cancelPlanMutation(options));
9959
+ }
9960
+ /**
9961
+ * Mutation that removes a payment method for the current user
9962
+ *
9963
+ * @param options.planId The id from IssuedPlanNode
9964
+ * @param options.immediate If true, cancel plan effective immediately. Default false.
9965
+ * @returns Promise that resolves to a mutation
9966
+ */
9967
+ cancelPlanMutation(options) {
9968
+ return new LrMutation({
9969
+ mutation: CancelPlanMutation,
9970
+ variables: {
9971
+ input: options,
9972
+ },
9973
+ });
9974
+ }
9975
+ changePriceOption(options) {
9976
+ return this.mutate(this.changePriceOptionMutation(options));
9977
+ }
9978
+ /**
9979
+ * Change the price option for a plan.
9980
+ *
9981
+ * @param options.planId The id from IssuedPlanNode
9982
+ * @param options.priceId The priceId from PriceOptionField (eg. inside AvailablePlanField)
9983
+ * @returns Promise that resolves to a mutation
9984
+ */
9985
+ changePriceOptionMutation(options) {
9986
+ return new LrMutation({
9987
+ mutation: ChangePriceOptionMutation,
9988
+ variables: {
9989
+ input: options,
9990
+ },
9991
+ });
9992
+ }
9993
+ reactivatePlan(planId) {
9994
+ return this.mutate(this.reactivatePlanMutation(planId));
9995
+ }
9996
+ /**
9997
+ * Reactivate a cancelled plan with a specified price option.
9998
+ *
9999
+ * @param options.planId The id from IssuedPlanNode
10000
+ * @returns Promise that resolves to a mutation
10001
+ */
10002
+ reactivatePlanMutation(planId) {
10003
+ return new LrMutation({
10004
+ mutation: ReactivatePlanMutation,
10005
+ variables: {
10006
+ input: { planId },
10007
+ },
10008
+ });
10009
+ }
10010
+ };
10011
+ Plan2Service.ɵprov = ɵɵdefineInjectable({ factory: function Plan2Service_Factory() { return new Plan2Service(ɵɵinject(NgZone), ɵɵinject(INJECTOR)); }, token: Plan2Service, providedIn: "root" });
10012
+ Plan2Service.decorators = [
10013
+ { type: Injectable, args: [{
10014
+ providedIn: 'root',
10015
+ },] }
10016
+ ];
10017
+ Plan2Service.ctorParameters = () => [
10018
+ { type: NgZone },
10019
+ { type: Injector }
10020
+ ];
10021
+ Plan2Service = __decorate([
10022
+ RunOutsideAngular({
10023
+ ngZoneName: 'ngZone',
10024
+ })
10025
+ ], Plan2Service);
10026
+
9715
10027
  const SharedContactCardFields = `
9716
10028
  id
9717
10029
  owner {
@@ -12782,5 +13094,5 @@ TwoFactorService.ctorParameters = () => [
12782
13094
  * Generated bundle index. Do not edit.
12783
13095
  */
12784
13096
 
12785
- export { AccessLevel, AccessRoleChoice, AccessRoleMethodChoice, ApiContactCard, ApiCurrentUser, ArchiveDirectoryMutation, CancelUserDeleteMutation, Category, CategoryFields, CategoryFilter, CategoryMetaService, CategoryService, ClaimApproverState, ClaimState, CognitoChallengeUser, CommonProcessorsService, CompleteOtkMutation, Config, ContactCard2Service, ContactCardAddress, ContactCardName, CreateCategoryMutation, CreateContactCardMutation$1 as CreateContactCardMutation, CreateFileMutation, CreateFileQuery, CreateLbopQuery, CreateRecordContainerMutation, CreateRecordMutation, CreateVaultMutation, CurrentCategory, CurrentUser, CurrentUserKey, CurrentUserQuery, CurrentUserSharedKeyQuery, DEFAULT_BREADCRUMB_DEPTH, DEFAULT_DESCENDANTS_DEPTH, DefaultCategory, DefaultProcessorOptions, DefaultVaultFilter, DeleteCategoryMutation, DeleteFileMutation, DeleteLbopQuery, DeleteRecordMutation, DirectoryQuery, DirectoryType, FeatureAction, Features, FetchKeyGraphField, FileOperationField, FileQuery, FileType, FileUploadService, GetCategoriesQuery, GetCategoryKeyIdQuery, GetCategoryQuery, GetMySharedCategoriesQuery, GetRecordQuery, GetRootDirectoryIdsQuery, GetTrustedPartyCategoriesQuery, GetVaultsQuery, IdleService, InitiateOtkMutation, Item2Service, KC_CONFIG, KeyExchange2Service, KeyExchangeFields, KeyExchangeMode, KeyExchangeOtkState, KeyExchangeQuery, KeyExchangeService, KeyExchangeState, KeyExchangeTokenQuery, KeyExchangesQuery, KeyGraphField, KeyGraphFragment, LbopQuery, LbopService, LbopsQuery, LifeReadyAuthService, LifeReadyModule, LinkTypeField, LoadedCategoryTree, LockService, LockState, LoginHistoryQuery, LoginResult, LrApiErrorCode, LrApolloService, LrAuthException, LrBadArgumentException, LrBadLogicException, LrBadRequestException, LrBadStateException, LrCodeMismatchException, LrConcurrentAccessException, LrEncryptionException, LrError, LrErrorCode, LrException, LrExpiredCodeException, LrExpiredException, LrGraphQLService, LrLockedException, LrMergedMutation, LrMutation, LrMutationBase, LrNotFoundException, LrRecord, LrService, LrSuspiciousException, LrUnsupportedException, MainContactCard, MainContactCardFields, MainContactCardPlainFields, MainContactCardProperty, MessageService, MoveDirectoryQuery, MoveFileQuery, NewAttachment, NewCategory, NewOrUpdatedAttachment, NewRecord, NotificationService, OtkState, OwnerPlainDataJson, PassIdpApiResult, PasswordChangeStatus, PasswordCheck, PasswordService, PermissionChoice, PersistService, Plan, PlanService, PlanState, ProfileDetailsService, ProfileService, QueryProcessorService, RecordAttachment, RecordAttachmentFilter, RecordAttachmentService, RecordContentFilter, RecordField, RecordFieldType, RecordFilter, RecordService, RecordType, RecordTypeField, RecordTypeFieldOption, RecordTypeService, RecordTypeSummary, RecoveryStatus, RegisterResult, RegisterService, RequestUserDeleteMutation, RespondOtkMutation, RevertFileQuery, ScenarioLastClaimState, ScenarioService, ScenarioState, ServerConfigService, ServerTimeQuery, SharedAccess, SharedContactCard2Service, StripeBillingPortalSession, StripeCheckoutSession, Subscription, TimeService, TpAssemblyState, TpClaimApproverState, TpClaimState, TpPasswordResetRequestService, TpPasswordResetService, TpPasswordResetUserService, TrustedParty2Service, TrustedPartyDetails, TwoFactorService, UnarchiveDirectoryMutation, UpdateCategoryMutation, UpdateContactCardMutation$1 as UpdateContactCardMutation, UpdateFileQuery, UpdateLbopQuery, UpdateRecordContainerMutation, UpdateRecordMutation, UpdatedCategory, UpdatedRecord, UserDeleteState, UserPlan, UserService, UserSharedKeyFields, Vault, VaultCategory, VaultFields, VaultRecord, VaultRecordType, WebCryptoService, awsFetch, configureAmplifyAuth, configureApollo, fragmentSpreadAstSelection, gqlTyped, handleApolloError, handleCognitoCallback, initialiseAuth, mapEdges, mapUserPlans, parentCategoriesField, processConnection, throwClaimIdMismatch, throwClaimNotApproved, ɵ0, KeyGraphService as ɵa, EncryptionService as ɵb, KeyService as ɵc, KeyFactoryService as ɵd, KeyMetaService as ɵe, LrGraphQLService as ɵf, TpPasswordResetProcessorService as ɵg, RunOutsideAngular as ɵh, TpPasswordResetAssemblyController as ɵi, TpAssemblyController as ɵj, LrService as ɵk, SharedContactCardService as ɵl, TrustedPartyService as ɵm, ScenarioAssemblyController as ɵn, TpPasswordResetPrivateService as ɵo };
13097
+ export { AccessLevel, AccessRoleChoice, AccessRoleMethodChoice, ApiContactCard, ApiCurrentUser, ArchiveDirectoryMutation, CancelUserDeleteMutation, Category, CategoryFields, CategoryFilter, CategoryMetaService, CategoryService, ClaimApproverState, ClaimState, CognitoChallengeUser, CommonProcessorsService, CompleteOtkMutation, Config, ContactCard2Service, ContactCardAddress, ContactCardName, CreateCategoryMutation, CreateContactCardMutation$1 as CreateContactCardMutation, CreateFileMutation, CreateFileQuery, CreateLbopQuery, CreateRecordContainerMutation, CreateRecordMutation, CreateVaultMutation, CurrentCategory, CurrentUser, CurrentUserKey, CurrentUserQuery, CurrentUserSharedKeyQuery, DEFAULT_BREADCRUMB_DEPTH, DEFAULT_DESCENDANTS_DEPTH, DefaultCategory, DefaultProcessorOptions, DefaultVaultFilter, DeleteCategoryMutation, DeleteFileMutation, DeleteLbopQuery, DeleteRecordMutation, DirectoryQuery, DirectoryType, FeatureAction, Features, FetchKeyGraphField, FileOperationField, FileQuery, FileType, FileUploadService, GetCategoriesQuery, GetCategoryKeyIdQuery, GetCategoryQuery, GetMySharedCategoriesQuery, GetRecordQuery, GetRootDirectoryIdsQuery, GetTrustedPartyCategoriesQuery, GetVaultsQuery, IdleService, InitiateOtkMutation, Item2Service, KC_CONFIG, KeyExchange2Service, KeyExchangeFields, KeyExchangeMode, KeyExchangeOtkState, KeyExchangeQuery, KeyExchangeService, KeyExchangeState, KeyExchangeTokenQuery, KeyExchangesQuery, KeyGraphField, KeyGraphFragment, LbopQuery, LbopService, LbopsQuery, LifeReadyAuthService, LifeReadyModule, LinkTypeField, LoadedCategoryTree, LockService, LockState, LoginHistoryQuery, LoginResult, LrApiErrorCode, LrApolloService, LrAuthException, LrBadArgumentException, LrBadLogicException, LrBadRequestException, LrBadStateException, LrCodeMismatchException, LrConcurrentAccessException, LrEncryptionException, LrError, LrErrorCode, LrException, LrExpiredCodeException, LrExpiredException, LrGraphQLService, LrLockedException, LrMergedMutation, LrMutation, LrMutationBase, LrNotFoundException, LrRecord, LrService, LrSuspiciousException, LrUnsupportedException, MainContactCard, MainContactCardFields, MainContactCardPlainFields, MainContactCardProperty, MessageService, MoveDirectoryQuery, MoveFileQuery, NewAttachment, NewCategory, NewOrUpdatedAttachment, NewRecord, NotificationService, OtkState, OwnerPlainDataJson, PassIdpApiResult, PasswordChangeStatus, PasswordCheck, PasswordService, PermissionChoice, PersistService, Plan, Plan2Service, PlanService, PlanState, PlanStateField, ProfileDetailsService, ProfileService, QueryProcessorService, RecordAttachment, RecordAttachmentFilter, RecordAttachmentService, RecordContentFilter, RecordField, RecordFieldType, RecordFilter, RecordService, RecordType, RecordTypeField, RecordTypeFieldOption, RecordTypeService, RecordTypeSummary, RecoveryStatus, RegisterResult, RegisterService, RequestUserDeleteMutation, RespondOtkMutation, RevertFileQuery, ScenarioLastClaimState, ScenarioService, ScenarioState, ServerConfigService, ServerTimeQuery, SharedAccess, SharedContactCard2Service, StripeBillingPortalSession, StripeCheckoutSession, Subscription, TimeService, TpAssemblyState, TpClaimApproverState, TpClaimState, TpPasswordResetRequestService, TpPasswordResetService, TpPasswordResetUserService, TrustedParty2Service, TrustedPartyDetails, TwoFactorService, UnarchiveDirectoryMutation, UpdateCategoryMutation, UpdateContactCardMutation$1 as UpdateContactCardMutation, UpdateFileQuery, UpdateLbopQuery, UpdateRecordContainerMutation, UpdateRecordMutation, UpdatedCategory, UpdatedRecord, UserDeleteState, UserPlan, UserService, UserSharedKeyFields, Vault, VaultCategory, VaultFields, VaultRecord, VaultRecordType, WebCryptoService, awsFetch, configureAmplifyAuth, configureApollo, fragmentSpreadAstSelection, gqlTyped, handleApolloError, handleCognitoCallback, initialiseAuth, mapEdges, mapUserPlans, parentCategoriesField, processConnection, throwClaimIdMismatch, throwClaimNotApproved, ɵ0, KeyGraphService as ɵa, EncryptionService as ɵb, KeyService as ɵc, KeyFactoryService as ɵd, KeyMetaService as ɵe, LrGraphQLService as ɵf, TpPasswordResetProcessorService as ɵg, RunOutsideAngular as ɵh, TpPasswordResetAssemblyController as ɵi, TpAssemblyController as ɵj, LrService as ɵk, SharedContactCardService as ɵl, TrustedPartyService as ɵm, ScenarioAssemblyController as ɵn, TpPasswordResetPrivateService as ɵo };
12786
13098
  //# sourceMappingURL=lifeready-core.js.map