@stigg/js-client-sdk 0.35.0 → 0.38.0

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,9 +1,11 @@
1
1
  import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
2
2
  import PaywallApi from './PaywallApi';
3
3
  import CustomersApi from './CustomersApi';
4
+ import CouponsApi from './CouponsApi';
4
5
  declare class ApiGateway {
5
6
  paywall: PaywallApi;
6
7
  customers: CustomersApi;
8
+ coupons: CouponsApi;
7
9
  constructor(client: ApolloClient<NormalizedCacheObject>);
8
10
  }
9
11
  export default ApiGateway;
@@ -0,0 +1,8 @@
1
+ import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core';
2
+ import { FetchCouponsQuery } from './generated/types';
3
+ declare class CouponsApi {
4
+ private readonly client;
5
+ constructor(client: ApolloClient<NormalizedCacheObject>);
6
+ getCoupons(): Promise<import("@apollo/client/core").ApolloQueryResult<FetchCouponsQuery>>;
7
+ }
8
+ export default CouponsApi;
@@ -41,6 +41,7 @@ export declare type AddCompatibleAddonsToPlanInput = {
41
41
  relationIds: Array<Scalars['String']>;
42
42
  };
43
43
  export declare type AddonCreateInput = {
44
+ additionalMetaData?: InputMaybe<Scalars['JSON']>;
44
45
  billingId?: InputMaybe<Scalars['String']>;
45
46
  description?: InputMaybe<Scalars['String']>;
46
47
  displayName: Scalars['String'];
@@ -120,10 +121,20 @@ export declare enum ApiKeyType {
120
121
  Client = "CLIENT",
121
122
  Server = "SERVER"
122
123
  }
124
+ export declare type ArchiveCouponInput = {
125
+ environmentId?: InputMaybe<Scalars['String']>;
126
+ refId: Scalars['String'];
127
+ };
123
128
  export declare type ArchivePlanInput = {
124
129
  environmentId: Scalars['String'];
125
130
  id: Scalars['String'];
126
131
  };
132
+ export declare type AttachCustomerPaymentMethodInput = {
133
+ environmentId?: InputMaybe<Scalars['String']>;
134
+ paymentMethodId: Scalars['String'];
135
+ refId: Scalars['String'];
136
+ vendorIdentifier: VendorIdentifier;
137
+ };
127
138
  /** Billing model. */
128
139
  export declare enum BillingModel {
129
140
  FlatFee = "FLAT_FEE",
@@ -176,6 +187,104 @@ export declare enum ChangeType {
176
187
  Deleted = "DELETED",
177
188
  Modified = "MODIFIED"
178
189
  }
190
+ export declare type CouponFilter = {
191
+ and?: InputMaybe<Array<CouponFilter>>;
192
+ billingId?: InputMaybe<StringFieldComparison>;
193
+ createdAt?: InputMaybe<DateFieldComparison>;
194
+ customers?: InputMaybe<CouponFilterCustomerFilter>;
195
+ description?: InputMaybe<StringFieldComparison>;
196
+ environmentId?: InputMaybe<StringFieldComparison>;
197
+ id?: InputMaybe<StringFieldComparison>;
198
+ name?: InputMaybe<StringFieldComparison>;
199
+ or?: InputMaybe<Array<CouponFilter>>;
200
+ refId?: InputMaybe<StringFieldComparison>;
201
+ status?: InputMaybe<CouponStatusFilterComparison>;
202
+ type?: InputMaybe<CouponTypeFilterComparison>;
203
+ updatedAt?: InputMaybe<DateFieldComparison>;
204
+ };
205
+ export declare type CouponFilterCustomerFilter = {
206
+ and?: InputMaybe<Array<CouponFilterCustomerFilter>>;
207
+ billingId?: InputMaybe<StringFieldComparison>;
208
+ createdAt?: InputMaybe<DateFieldComparison>;
209
+ crmHubspotCompanyId?: InputMaybe<StringFieldComparison>;
210
+ crmHubspotCompanyUrl?: InputMaybe<StringFieldComparison>;
211
+ crmId?: InputMaybe<StringFieldComparison>;
212
+ email?: InputMaybe<StringFieldComparison>;
213
+ environmentId?: InputMaybe<StringFieldComparison>;
214
+ id?: InputMaybe<StringFieldComparison>;
215
+ name?: InputMaybe<StringFieldComparison>;
216
+ or?: InputMaybe<Array<CouponFilterCustomerFilter>>;
217
+ refId?: InputMaybe<StringFieldComparison>;
218
+ updatedAt?: InputMaybe<DateFieldComparison>;
219
+ };
220
+ export declare type CouponSort = {
221
+ direction: SortDirection;
222
+ field: CouponSortFields;
223
+ nulls?: InputMaybe<SortNulls>;
224
+ };
225
+ export declare enum CouponSortFields {
226
+ BillingId = "billingId",
227
+ CreatedAt = "createdAt",
228
+ Description = "description",
229
+ EnvironmentId = "environmentId",
230
+ Id = "id",
231
+ Name = "name",
232
+ RefId = "refId",
233
+ Status = "status",
234
+ Type = "type",
235
+ UpdatedAt = "updatedAt"
236
+ }
237
+ /** The status of the coupon */
238
+ export declare enum CouponStatus {
239
+ Active = "ACTIVE",
240
+ Archived = "ARCHIVED"
241
+ }
242
+ export declare type CouponStatusFilterComparison = {
243
+ eq?: InputMaybe<CouponStatus>;
244
+ gt?: InputMaybe<CouponStatus>;
245
+ gte?: InputMaybe<CouponStatus>;
246
+ iLike?: InputMaybe<CouponStatus>;
247
+ in?: InputMaybe<Array<CouponStatus>>;
248
+ is?: InputMaybe<Scalars['Boolean']>;
249
+ isNot?: InputMaybe<Scalars['Boolean']>;
250
+ like?: InputMaybe<CouponStatus>;
251
+ lt?: InputMaybe<CouponStatus>;
252
+ lte?: InputMaybe<CouponStatus>;
253
+ neq?: InputMaybe<CouponStatus>;
254
+ notILike?: InputMaybe<CouponStatus>;
255
+ notIn?: InputMaybe<Array<CouponStatus>>;
256
+ notLike?: InputMaybe<CouponStatus>;
257
+ };
258
+ /** The type of the coupon */
259
+ export declare enum CouponType {
260
+ Fixed = "FIXED",
261
+ Percentage = "PERCENTAGE"
262
+ }
263
+ export declare type CouponTypeFilterComparison = {
264
+ eq?: InputMaybe<CouponType>;
265
+ gt?: InputMaybe<CouponType>;
266
+ gte?: InputMaybe<CouponType>;
267
+ iLike?: InputMaybe<CouponType>;
268
+ in?: InputMaybe<Array<CouponType>>;
269
+ is?: InputMaybe<Scalars['Boolean']>;
270
+ isNot?: InputMaybe<Scalars['Boolean']>;
271
+ like?: InputMaybe<CouponType>;
272
+ lt?: InputMaybe<CouponType>;
273
+ lte?: InputMaybe<CouponType>;
274
+ neq?: InputMaybe<CouponType>;
275
+ notILike?: InputMaybe<CouponType>;
276
+ notIn?: InputMaybe<Array<CouponType>>;
277
+ notLike?: InputMaybe<CouponType>;
278
+ };
279
+ export declare type CreateCouponInput = {
280
+ additionalMetaData?: InputMaybe<Scalars['JSON']>;
281
+ description?: InputMaybe<Scalars['String']>;
282
+ discountValue: Scalars['Float'];
283
+ environmentId: Scalars['String'];
284
+ name: Scalars['String'];
285
+ refId: Scalars['String'];
286
+ type: CouponType;
287
+ };
179
288
  export declare type CreateEnvironment = {
180
289
  createdAt?: InputMaybe<Scalars['DateTime']>;
181
290
  description?: InputMaybe<Scalars['String']>;
@@ -299,6 +408,7 @@ export declare type CustomerInput = {
299
408
  additionalMetaData?: InputMaybe<Scalars['JSON']>;
300
409
  billingId?: InputMaybe<Scalars['String']>;
301
410
  billingInformation?: InputMaybe<CustomerBillingInfo>;
411
+ couponRefId?: InputMaybe<Scalars['String']>;
302
412
  crmId?: InputMaybe<Scalars['String']>;
303
413
  email?: InputMaybe<Scalars['String']>;
304
414
  environmentId?: InputMaybe<Scalars['String']>;
@@ -498,6 +608,10 @@ export declare enum EntitlementResetPeriod {
498
608
  Month = "MONTH",
499
609
  Week = "WEEK"
500
610
  }
611
+ export declare enum EntitySelectionMode {
612
+ BlackList = "BLACK_LIST",
613
+ WhiteList = "WHITE_LIST"
614
+ }
501
615
  export declare type EnvironmentFilter = {
502
616
  and?: InputMaybe<Array<EnvironmentFilter>>;
503
617
  createdAt?: InputMaybe<DateFieldComparison>;
@@ -519,11 +633,15 @@ export declare enum EnvironmentSortFields {
519
633
  }
520
634
  /** error codes */
521
635
  export declare enum ErrorCode {
636
+ AddonHasToHavePriceError = "AddonHasToHavePriceError",
522
637
  AddonNotFound = "AddonNotFound",
638
+ ArchivedCouponCantBeApplied = "ArchivedCouponCantBeApplied",
523
639
  BadUserInput = "BadUserInput",
524
640
  BillingPeriodMissingError = "BillingPeriodMissingError",
525
641
  CheckoutIsNotSupported = "CheckoutIsNotSupported",
642
+ CouponNotFound = "CouponNotFound",
526
643
  CustomerHasNoPaymentMethod = "CustomerHasNoPaymentMethod",
644
+ CustomerNoBillingId = "CustomerNoBillingId",
527
645
  CustomerNotFound = "CustomerNotFound",
528
646
  DraftPlanCantBeArchived = "DraftPlanCantBeArchived",
529
647
  DuplicatedEntityNotAllowed = "DuplicatedEntityNotAllowed",
@@ -532,6 +650,8 @@ export declare enum ErrorCode {
532
650
  FailedToImportCustomer = "FailedToImportCustomer",
533
651
  FeatureNotFound = "FeatureNotFound",
534
652
  IdentityForbidden = "IdentityForbidden",
653
+ ImportAlreadyInProgress = "ImportAlreadyInProgress",
654
+ InitStripePaymentMethodError = "InitStripePaymentMethodError",
535
655
  IntegrationNotFound = "IntegrationNotFound",
536
656
  IntegrityViolation = "IntegrityViolation",
537
657
  InvalidAddressError = "InvalidAddressError",
@@ -555,6 +675,8 @@ export declare enum ErrorCode {
555
675
  PriceNotFound = "PriceNotFound",
556
676
  RateLimitExceeded = "RateLimitExceeded",
557
677
  ResyncAlreadyInProgress = "ResyncAlreadyInProgress",
678
+ SelectedBillingModelDoesntMatchImportedItemError = "SelectedBillingModelDoesntMatchImportedItemError",
679
+ StripeCustomerIsDeleted = "StripeCustomerIsDeleted",
558
680
  SubscriptionAlreadyCanceledOrExpired = "SubscriptionAlreadyCanceledOrExpired",
559
681
  SubscriptionMustHaveSinglePlanError = "SubscriptionMustHaveSinglePlanError",
560
682
  SubscriptionNotFound = "SubscriptionNotFound",
@@ -573,6 +695,9 @@ export declare enum EventLogType {
573
695
  AddonCreated = "ADDON_CREATED",
574
696
  AddonDeleted = "ADDON_DELETED",
575
697
  AddonUpdated = "ADDON_UPDATED",
698
+ CouponArchived = "COUPON_ARCHIVED",
699
+ CouponCreated = "COUPON_CREATED",
700
+ CouponUpdated = "COUPON_UPDATED",
576
701
  CustomerCreated = "CUSTOMER_CREATED",
577
702
  CustomerDeleted = "CUSTOMER_DELETED",
578
703
  CustomerUpdated = "CUSTOMER_UPDATED",
@@ -583,6 +708,8 @@ export declare enum EventLogType {
583
708
  FeatureCreated = "FEATURE_CREATED",
584
709
  FeatureDeleted = "FEATURE_DELETED",
585
710
  FeatureUpdated = "FEATURE_UPDATED",
711
+ ImportIntegrationCatalogTriggered = "IMPORT_INTEGRATION_CATALOG_TRIGGERED",
712
+ ImportIntegrationCustomersTriggered = "IMPORT_INTEGRATION_CUSTOMERS_TRIGGERED",
586
713
  MeasurementReported = "MEASUREMENT_REPORTED",
587
714
  PackagePublished = "PACKAGE_PUBLISHED",
588
715
  PlanCreated = "PLAN_CREATED",
@@ -600,7 +727,8 @@ export declare enum EventLogType {
600
727
  SubscriptionTrialEndsSoon = "SUBSCRIPTION_TRIAL_ENDS_SOON",
601
728
  SubscriptionTrialExpired = "SUBSCRIPTION_TRIAL_EXPIRED",
602
729
  SubscriptionTrialStarted = "SUBSCRIPTION_TRIAL_STARTED",
603
- SubscriptionUpdated = "SUBSCRIPTION_UPDATED"
730
+ SubscriptionUpdated = "SUBSCRIPTION_UPDATED",
731
+ SubscriptionUsageUpdated = "SUBSCRIPTION_USAGE_UPDATED"
604
732
  }
605
733
  export declare type FeatureFilter = {
606
734
  and?: InputMaybe<Array<FeatureFilter>>;
@@ -755,6 +883,51 @@ export declare type ImportCustomerInput = {
755
883
  name?: InputMaybe<Scalars['String']>;
756
884
  refId: Scalars['String'];
757
885
  };
886
+ export declare type ImportIntegrationCatalogInput = {
887
+ billingModel?: InputMaybe<BillingModel>;
888
+ entitySelectionMode: EntitySelectionMode;
889
+ environmentId: Scalars['String'];
890
+ featureUnitName?: InputMaybe<Scalars['String']>;
891
+ featureUnitPluralName?: InputMaybe<Scalars['String']>;
892
+ plansSelectionBlacklist?: InputMaybe<Array<Scalars['String']>>;
893
+ plansSelectionWhitelist?: InputMaybe<Array<Scalars['String']>>;
894
+ productId: Scalars['String'];
895
+ selectedAddonBillingIds: Array<Scalars['String']>;
896
+ vendorIdentifier: VendorIdentifier;
897
+ };
898
+ export declare type ImportIntegrationCustomersInput = {
899
+ customersSelectionBlacklist?: InputMaybe<Array<Scalars['String']>>;
900
+ customersSelectionWhitelist?: InputMaybe<Array<Scalars['String']>>;
901
+ entitySelectionMode: EntitySelectionMode;
902
+ environmentId: Scalars['String'];
903
+ productId: Scalars['String'];
904
+ vendorIdentifier: VendorIdentifier;
905
+ };
906
+ export declare type ImportIntegrationTaskFilter = {
907
+ and?: InputMaybe<Array<ImportIntegrationTaskFilter>>;
908
+ createdAt?: InputMaybe<DateFieldComparison>;
909
+ environmentId?: InputMaybe<StringFieldComparison>;
910
+ id?: InputMaybe<StringFieldComparison>;
911
+ or?: InputMaybe<Array<ImportIntegrationTaskFilter>>;
912
+ status?: InputMaybe<TaskStatusFilterComparison>;
913
+ taskType?: InputMaybe<TaskTypeFilterComparison>;
914
+ };
915
+ export declare type ImportIntegrationTaskSort = {
916
+ direction: SortDirection;
917
+ field: ImportIntegrationTaskSortFields;
918
+ nulls?: InputMaybe<SortNulls>;
919
+ };
920
+ export declare enum ImportIntegrationTaskSortFields {
921
+ CreatedAt = "createdAt",
922
+ EnvironmentId = "environmentId",
923
+ Id = "id",
924
+ Status = "status",
925
+ TaskType = "taskType"
926
+ }
927
+ export declare type InitAddStripeCustomerPaymentMethodInput = {
928
+ customerRefId: Scalars['String'];
929
+ environmentId?: InputMaybe<Scalars['String']>;
930
+ };
758
931
  export declare type InitiateCheckoutInput = {
759
932
  addons?: InputMaybe<Array<SubscriptionAddonInput>>;
760
933
  billingPeriod: BillingPeriod;
@@ -1015,7 +1188,13 @@ export declare type PackageStatusFilterComparison = {
1015
1188
  notIn?: InputMaybe<Array<PackageStatus>>;
1016
1189
  notLike?: InputMaybe<PackageStatus>;
1017
1190
  };
1191
+ /** Type of a payment method */
1192
+ export declare enum PaymentMethodType {
1193
+ Bank = "BANK",
1194
+ Card = "CARD"
1195
+ }
1018
1196
  export declare type PlanCreateInput = {
1197
+ additionalMetaData?: InputMaybe<Scalars['JSON']>;
1019
1198
  billingId?: InputMaybe<Scalars['String']>;
1020
1199
  description?: InputMaybe<Scalars['String']>;
1021
1200
  displayName: Scalars['String'];
@@ -1172,6 +1351,7 @@ export declare type PricingTypeFilterComparison = {
1172
1351
  notLike?: InputMaybe<PricingType>;
1173
1352
  };
1174
1353
  export declare type ProductCreateInput = {
1354
+ additionalMetaData?: InputMaybe<Scalars['JSON']>;
1175
1355
  description?: InputMaybe<Scalars['String']>;
1176
1356
  displayName?: InputMaybe<Scalars['String']>;
1177
1357
  environmentId: Scalars['String'];
@@ -1309,6 +1489,12 @@ export declare type RemoveCompatibleAddonsFromPlanInput = {
1309
1489
  /** The ids of the relations. */
1310
1490
  relationIds: Array<Scalars['String']>;
1311
1491
  };
1492
+ export declare type RemoveCouponFromCustomerInput = {
1493
+ /** The id of the record. */
1494
+ id: Scalars['String'];
1495
+ /** The id of relation. */
1496
+ relationId: Scalars['String'];
1497
+ };
1312
1498
  export declare type ResyncIntegrationInput = {
1313
1499
  environmentId: Scalars['String'];
1314
1500
  vendorIdentifier: VendorIdentifier;
@@ -1325,6 +1511,12 @@ export declare type SetCompatibleAddonsOnPlanInput = {
1325
1511
  /** The ids of the relations. */
1326
1512
  relationIds: Array<Scalars['String']>;
1327
1513
  };
1514
+ export declare type SetCouponOnCustomerInput = {
1515
+ /** The id of the record. */
1516
+ id: Scalars['String'];
1517
+ /** The id of relation. */
1518
+ relationId: Scalars['String'];
1519
+ };
1328
1520
  /** Sort Directions */
1329
1521
  export declare enum SortDirection {
1330
1522
  Asc = "ASC",
@@ -1356,6 +1548,20 @@ export declare type StripeCredentialsInput = {
1356
1548
  authorizationCode: Scalars['String'];
1357
1549
  isTestMode: Scalars['Boolean'];
1358
1550
  };
1551
+ export declare type StripeCustomerSearchInput = {
1552
+ customerName?: InputMaybe<Scalars['String']>;
1553
+ environmentId: Scalars['String'];
1554
+ nextPage?: InputMaybe<Scalars['String']>;
1555
+ };
1556
+ export declare type StripeProductSearchInput = {
1557
+ environmentId: Scalars['String'];
1558
+ nextPage?: InputMaybe<Scalars['String']>;
1559
+ productName?: InputMaybe<Scalars['String']>;
1560
+ };
1561
+ export declare type StripeSubscriptionSearchInput = {
1562
+ environmentId: Scalars['String'];
1563
+ nextPage?: InputMaybe<Scalars['String']>;
1564
+ };
1359
1565
  export declare type SubscriptionAddonFilter = {
1360
1566
  addon?: InputMaybe<SubscriptionAddonFilterAddonFilter>;
1361
1567
  and?: InputMaybe<Array<SubscriptionAddonFilter>>;
@@ -1478,6 +1684,7 @@ export declare enum SubscriptionEndSetup {
1478
1684
  export declare type SubscriptionInput = {
1479
1685
  additionalMetaData?: InputMaybe<Scalars['JSON']>;
1480
1686
  addons?: InputMaybe<Array<SubscriptionAddonInput>>;
1687
+ awaitPaymentConfirmation?: InputMaybe<Scalars['Boolean']>;
1481
1688
  billingId?: InputMaybe<Scalars['String']>;
1482
1689
  billingPeriod?: InputMaybe<BillingPeriod>;
1483
1690
  crmId?: InputMaybe<Scalars['String']>;
@@ -1590,11 +1797,18 @@ export declare type SubscriptionStatusFilterComparison = {
1590
1797
  notIn?: InputMaybe<Array<SubscriptionStatus>>;
1591
1798
  notLike?: InputMaybe<SubscriptionStatus>;
1592
1799
  };
1800
+ /** Status of the integration sync */
1801
+ export declare enum SyncStatus {
1802
+ Error = "ERROR",
1803
+ NoSyncRequired = "NO_SYNC_REQUIRED",
1804
+ Pending = "PENDING",
1805
+ Success = "SUCCESS"
1806
+ }
1593
1807
  export declare enum TaskStatus {
1594
1808
  Completed = "COMPLETED",
1595
1809
  Failed = "FAILED",
1596
1810
  InProgress = "IN_PROGRESS",
1597
- PartiallyCompleted = "PARTIALLY_COMPLETED",
1811
+ PartiallyFailed = "PARTIALLY_FAILED",
1598
1812
  Pending = "PENDING"
1599
1813
  }
1600
1814
  export declare type TaskStatusFilterComparison = {
@@ -1614,6 +1828,8 @@ export declare type TaskStatusFilterComparison = {
1614
1828
  notLike?: InputMaybe<TaskStatus>;
1615
1829
  };
1616
1830
  export declare enum TaskType {
1831
+ ImportIntegrationCatalog = "IMPORT_INTEGRATION_CATALOG",
1832
+ ImportIntegrationCustomers = "IMPORT_INTEGRATION_CUSTOMERS",
1617
1833
  ResyncIntegration = "RESYNC_INTEGRATION",
1618
1834
  SubscriptionMigration = "SUBSCRIPTION_MIGRATION"
1619
1835
  }
@@ -1646,10 +1862,23 @@ export declare enum TrialPeriodUnits {
1646
1862
  Day = "DAY",
1647
1863
  Month = "MONTH"
1648
1864
  }
1865
+ export declare type UpdateAccountInput = {
1866
+ displayName: Scalars['String'];
1867
+ id: Scalars['String'];
1868
+ timezone?: InputMaybe<Scalars['String']>;
1869
+ };
1870
+ export declare type UpdateCouponInput = {
1871
+ additionalMetaData?: InputMaybe<Scalars['JSON']>;
1872
+ description?: InputMaybe<Scalars['String']>;
1873
+ environmentId?: InputMaybe<Scalars['String']>;
1874
+ name: Scalars['String'];
1875
+ refId: Scalars['String'];
1876
+ };
1649
1877
  export declare type UpdateCustomerInput = {
1650
1878
  additionalMetaData?: InputMaybe<Scalars['JSON']>;
1651
1879
  billingId?: InputMaybe<Scalars['String']>;
1652
1880
  billingInformation?: InputMaybe<CustomerBillingInfo>;
1881
+ couponRefId?: InputMaybe<Scalars['String']>;
1653
1882
  crmId?: InputMaybe<Scalars['String']>;
1654
1883
  email?: InputMaybe<Scalars['String']>;
1655
1884
  environmentId?: InputMaybe<Scalars['String']>;
@@ -1844,6 +2073,60 @@ export declare type ZuoraCredentialsInput = {
1844
2073
  clientId: Scalars['String'];
1845
2074
  clientSecret: Scalars['String'];
1846
2075
  };
2076
+ export declare type CouponFragment = {
2077
+ __typename?: 'Coupon';
2078
+ id: string;
2079
+ discountValue: number;
2080
+ type: CouponType;
2081
+ additionalMetaData?: any | null | undefined;
2082
+ refId: string;
2083
+ name: string;
2084
+ description?: string | null | undefined;
2085
+ createdAt: any;
2086
+ updatedAt: any;
2087
+ billingId?: string | null | undefined;
2088
+ billingLinkUrl?: string | null | undefined;
2089
+ status: CouponStatus;
2090
+ syncStates?: Array<{
2091
+ __typename?: 'SyncState';
2092
+ vendorIdentifier: VendorIdentifier;
2093
+ status: SyncStatus;
2094
+ }> | null | undefined;
2095
+ customers?: Array<{
2096
+ __typename?: 'Customer';
2097
+ id: string;
2098
+ }> | null | undefined;
2099
+ };
2100
+ export declare type FetchCouponsQueryVariables = Exact<{
2101
+ filter?: Maybe<CouponFilter>;
2102
+ sorting?: Maybe<Array<CouponSort> | CouponSort>;
2103
+ paging?: Maybe<CursorPaging>;
2104
+ }>;
2105
+ export declare type FetchCouponsQuery = {
2106
+ __typename?: 'Query';
2107
+ coupons: {
2108
+ __typename?: 'CouponConnection';
2109
+ edges: Array<{
2110
+ __typename?: 'CouponEdge';
2111
+ node: {
2112
+ __typename?: 'Coupon';
2113
+ } & CouponFragment;
2114
+ }>;
2115
+ };
2116
+ };
2117
+ export declare type TotalPriceFragment = {
2118
+ __typename?: 'CustomerSubscriptionTotalPrice';
2119
+ subTotal: {
2120
+ __typename?: 'Money';
2121
+ amount: number;
2122
+ currency: Currency;
2123
+ };
2124
+ total: {
2125
+ __typename?: 'Money';
2126
+ amount: number;
2127
+ currency: Currency;
2128
+ };
2129
+ };
1847
2130
  export declare type SubscriptionFragment = {
1848
2131
  __typename?: 'CustomerSubscription';
1849
2132
  id: string;
@@ -1864,6 +2147,9 @@ export declare type SubscriptionFragment = {
1864
2147
  __typename?: 'Price';
1865
2148
  } & PriceFragment;
1866
2149
  }> | null | undefined;
2150
+ totalPrice?: ({
2151
+ __typename?: 'CustomerSubscriptionTotalPrice';
2152
+ } & TotalPriceFragment) | null | undefined;
1867
2153
  plan: {
1868
2154
  __typename?: 'Plan';
1869
2155
  id: string;
@@ -1976,6 +2262,13 @@ export declare type CustomerFragment = {
1976
2262
  hasPaymentMethod: boolean;
1977
2263
  refId: string;
1978
2264
  additionalMetaData?: any | null | undefined;
2265
+ trialedPlans?: Array<{
2266
+ __typename?: 'TrialedPlan';
2267
+ productId?: string | null | undefined;
2268
+ productRefId?: string | null | undefined;
2269
+ planRefId?: string | null | undefined;
2270
+ planId?: string | null | undefined;
2271
+ }> | null | undefined;
1979
2272
  promotionalEntitlements: Array<{
1980
2273
  __typename?: 'PromotionalEntitlement';
1981
2274
  } & PromotionalEntitlementFragment>;
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Customer, Entitlement, Plan, BooleanEntitlement, NumericEntitlement, MeteredEntitlement, GetBooleanEntitlement, GetNumericEntitlement, GetMeteredEntitlement, GetPaywall } from './models';
1
+ import { BooleanEntitlement, Coupon, Customer, Entitlement, GetBooleanEntitlement, GetMeteredEntitlement, GetNumericEntitlement, GetPaywall, MeteredEntitlement, NumericEntitlement, Plan, Subscription, WaitForCheckoutCompleted } from './models';
2
2
  import { ClientConfiguration } from './configuration';
3
3
  export interface StiggClient {
4
4
  getBooleanEntitlement: (params: GetBooleanEntitlement) => BooleanEntitlement;
@@ -9,6 +9,7 @@ export interface StiggClient {
9
9
  getCustomer: () => Promise<Customer>;
10
10
  getEntitlements: () => Promise<Entitlement[]>;
11
11
  refresh: () => Promise<void>;
12
+ waitForCheckoutCompleted(params?: WaitForCheckoutCompleted): Promise<Subscription | null>;
12
13
  }
13
14
  export declare class Stigg implements StiggClient {
14
15
  private readonly apiGateway;
@@ -60,6 +61,12 @@ export declare class Stigg implements StiggClient {
60
61
  * @returns {Promise<Plan[]>}
61
62
  */
62
63
  getPaywall({ productId }?: GetPaywall): Promise<Plan[]>;
64
+ /**
65
+ * Get a list of coupons
66
+ *
67
+ * @returns {Promise<Coupon[]>}
68
+ */
69
+ getCoupons(): Promise<Coupon[]>;
63
70
  /**
64
71
  * Get a customer
65
72
  *
@@ -72,5 +79,15 @@ export declare class Stigg implements StiggClient {
72
79
  * @returns {Promise<Entitlement[]>}
73
80
  */
74
81
  getEntitlements(): Promise<Entitlement[]>;
82
+ /**
83
+ * Waits for a subscription to be activated after a completed checkout.
84
+ * This method should be called on page load after the customer is redirected to the success URL.
85
+ * Returns the new subscription.
86
+ *
87
+ * @returns {Promise<Subscription | null>}
88
+ * @param timeoutMs
89
+ * @param refreshOnComplete should refresh entitlements if subscription was found
90
+ */
91
+ waitForCheckoutCompleted({ timeoutMs, refreshOnComplete, }?: WaitForCheckoutCompleted): Promise<Subscription | null>;
75
92
  private withErrorHandling;
76
93
  }