@stigg/js-client-sdk 0.36.0 → 0.37.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;
@@ -121,6 +121,10 @@ export declare enum ApiKeyType {
121
121
  Client = "CLIENT",
122
122
  Server = "SERVER"
123
123
  }
124
+ export declare type ArchiveCouponInput = {
125
+ environmentId?: InputMaybe<Scalars['String']>;
126
+ refId: Scalars['String'];
127
+ };
124
128
  export declare type ArchivePlanInput = {
125
129
  environmentId: Scalars['String'];
126
130
  id: Scalars['String'];
@@ -183,6 +187,104 @@ export declare enum ChangeType {
183
187
  Deleted = "DELETED",
184
188
  Modified = "MODIFIED"
185
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
+ };
186
288
  export declare type CreateEnvironment = {
187
289
  createdAt?: InputMaybe<Scalars['DateTime']>;
188
290
  description?: InputMaybe<Scalars['String']>;
@@ -306,6 +408,7 @@ export declare type CustomerInput = {
306
408
  additionalMetaData?: InputMaybe<Scalars['JSON']>;
307
409
  billingId?: InputMaybe<Scalars['String']>;
308
410
  billingInformation?: InputMaybe<CustomerBillingInfo>;
411
+ couponRefId?: InputMaybe<Scalars['String']>;
309
412
  crmId?: InputMaybe<Scalars['String']>;
310
413
  email?: InputMaybe<Scalars['String']>;
311
414
  environmentId?: InputMaybe<Scalars['String']>;
@@ -530,10 +633,13 @@ export declare enum EnvironmentSortFields {
530
633
  }
531
634
  /** error codes */
532
635
  export declare enum ErrorCode {
636
+ AddonHasToHavePriceError = "AddonHasToHavePriceError",
533
637
  AddonNotFound = "AddonNotFound",
638
+ ArchivedCouponCantBeApplied = "ArchivedCouponCantBeApplied",
534
639
  BadUserInput = "BadUserInput",
535
640
  BillingPeriodMissingError = "BillingPeriodMissingError",
536
641
  CheckoutIsNotSupported = "CheckoutIsNotSupported",
642
+ CouponNotFound = "CouponNotFound",
537
643
  CustomerHasNoPaymentMethod = "CustomerHasNoPaymentMethod",
538
644
  CustomerNoBillingId = "CustomerNoBillingId",
539
645
  CustomerNotFound = "CustomerNotFound",
@@ -569,6 +675,7 @@ export declare enum ErrorCode {
569
675
  PriceNotFound = "PriceNotFound",
570
676
  RateLimitExceeded = "RateLimitExceeded",
571
677
  ResyncAlreadyInProgress = "ResyncAlreadyInProgress",
678
+ SelectedBillingModelDoesntMatchImportedItemError = "SelectedBillingModelDoesntMatchImportedItemError",
572
679
  StripeCustomerIsDeleted = "StripeCustomerIsDeleted",
573
680
  SubscriptionAlreadyCanceledOrExpired = "SubscriptionAlreadyCanceledOrExpired",
574
681
  SubscriptionMustHaveSinglePlanError = "SubscriptionMustHaveSinglePlanError",
@@ -588,6 +695,9 @@ export declare enum EventLogType {
588
695
  AddonCreated = "ADDON_CREATED",
589
696
  AddonDeleted = "ADDON_DELETED",
590
697
  AddonUpdated = "ADDON_UPDATED",
698
+ CouponArchived = "COUPON_ARCHIVED",
699
+ CouponCreated = "COUPON_CREATED",
700
+ CouponUpdated = "COUPON_UPDATED",
591
701
  CustomerCreated = "CUSTOMER_CREATED",
592
702
  CustomerDeleted = "CUSTOMER_DELETED",
593
703
  CustomerUpdated = "CUSTOMER_UPDATED",
@@ -774,8 +884,11 @@ export declare type ImportCustomerInput = {
774
884
  refId: Scalars['String'];
775
885
  };
776
886
  export declare type ImportIntegrationCatalogInput = {
887
+ billingModel?: InputMaybe<BillingModel>;
777
888
  entitySelectionMode: EntitySelectionMode;
778
889
  environmentId: Scalars['String'];
890
+ featureUnitName?: InputMaybe<Scalars['String']>;
891
+ featureUnitPluralName?: InputMaybe<Scalars['String']>;
779
892
  plansSelectionBlacklist?: InputMaybe<Array<Scalars['String']>>;
780
893
  plansSelectionWhitelist?: InputMaybe<Array<Scalars['String']>>;
781
894
  productId: Scalars['String'];
@@ -1376,6 +1489,12 @@ export declare type RemoveCompatibleAddonsFromPlanInput = {
1376
1489
  /** The ids of the relations. */
1377
1490
  relationIds: Array<Scalars['String']>;
1378
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
+ };
1379
1498
  export declare type ResyncIntegrationInput = {
1380
1499
  environmentId: Scalars['String'];
1381
1500
  vendorIdentifier: VendorIdentifier;
@@ -1392,6 +1511,12 @@ export declare type SetCompatibleAddonsOnPlanInput = {
1392
1511
  /** The ids of the relations. */
1393
1512
  relationIds: Array<Scalars['String']>;
1394
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
+ };
1395
1520
  /** Sort Directions */
1396
1521
  export declare enum SortDirection {
1397
1522
  Asc = "ASC",
@@ -1742,10 +1867,18 @@ export declare type UpdateAccountInput = {
1742
1867
  id: Scalars['String'];
1743
1868
  timezone?: InputMaybe<Scalars['String']>;
1744
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
+ };
1745
1877
  export declare type UpdateCustomerInput = {
1746
1878
  additionalMetaData?: InputMaybe<Scalars['JSON']>;
1747
1879
  billingId?: InputMaybe<Scalars['String']>;
1748
1880
  billingInformation?: InputMaybe<CustomerBillingInfo>;
1881
+ couponRefId?: InputMaybe<Scalars['String']>;
1749
1882
  crmId?: InputMaybe<Scalars['String']>;
1750
1883
  email?: InputMaybe<Scalars['String']>;
1751
1884
  environmentId?: InputMaybe<Scalars['String']>;
@@ -1940,6 +2073,60 @@ export declare type ZuoraCredentialsInput = {
1940
2073
  clientId: Scalars['String'];
1941
2074
  clientSecret: Scalars['String'];
1942
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
+ };
1943
2130
  export declare type SubscriptionFragment = {
1944
2131
  __typename?: 'CustomerSubscription';
1945
2132
  id: string;
@@ -1960,6 +2147,9 @@ export declare type SubscriptionFragment = {
1960
2147
  __typename?: 'Price';
1961
2148
  } & PriceFragment;
1962
2149
  }> | null | undefined;
2150
+ totalPrice?: ({
2151
+ __typename?: 'CustomerSubscriptionTotalPrice';
2152
+ } & TotalPriceFragment) | null | undefined;
1963
2153
  plan: {
1964
2154
  __typename?: 'Plan';
1965
2155
  id: string;
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 { Customer, Entitlement, Plan, BooleanEntitlement, NumericEntitlement, MeteredEntitlement, GetBooleanEntitlement, GetNumericEntitlement, GetMeteredEntitlement, GetPaywall, Coupon } from './models';
2
2
  import { ClientConfiguration } from './configuration';
3
3
  export interface StiggClient {
4
4
  getBooleanEntitlement: (params: GetBooleanEntitlement) => BooleanEntitlement;
@@ -60,6 +60,12 @@ export declare class Stigg implements StiggClient {
60
60
  * @returns {Promise<Plan[]>}
61
61
  */
62
62
  getPaywall({ productId }?: GetPaywall): Promise<Plan[]>;
63
+ /**
64
+ * Get a list of coupons
65
+ *
66
+ * @returns {Promise<Coupon[]>}
67
+ */
68
+ getCoupons(): Promise<Coupon[]>;
63
69
  /**
64
70
  * Get a customer
65
71
  *