@schematichq/schematic-react 0.2.0-rc.2 → 0.2.0-rc.3

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.
@@ -28,6 +28,56 @@ import { Stripe } from '@stripe/stripe-js';
28
28
  import { Substitute } from 'styled-components/dist/types';
29
29
  import { Traits } from '@schematichq/schematic-js';
30
30
 
31
+ declare interface ApiResponse<T> {
32
+ raw: Response;
33
+ value(): Promise<T>;
34
+ }
35
+
36
+ /**
37
+ * Schematic API
38
+ * Schematic API
39
+ *
40
+ * The version of the OpenAPI document: 0.1
41
+ *
42
+ *
43
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
44
+ * https://openapi-generator.tech
45
+ * Do not edit the class manually.
46
+ */
47
+ declare const BASE_PATH: string;
48
+
49
+ /**
50
+ * This is the base class for all generated API classes.
51
+ */
52
+ declare class BaseAPI {
53
+ protected configuration: Configuration;
54
+ private static readonly jsonRegex;
55
+ private middleware;
56
+ constructor(configuration?: Configuration);
57
+ withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T;
58
+ withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware["pre"]>): T;
59
+ withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware["post"]>): T;
60
+ /**
61
+ * Check if the given MIME is a JSON MIME.
62
+ * JSON MIME examples:
63
+ * application/json
64
+ * application/json; charset=UTF8
65
+ * APPLICATION/JSON
66
+ * application/vnd.company+json
67
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
68
+ * @return True if the given MIME is JSON, false otherwise.
69
+ */
70
+ protected isJsonMime(mime: string | null | undefined): boolean;
71
+ protected request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response>;
72
+ private createFetchParams;
73
+ private fetchApi;
74
+ /**
75
+ * Create a shallow clone of `this` by constructing a new instance
76
+ * and then shallow cloning data members.
77
+ */
78
+ private clone;
79
+ }
80
+
31
81
  declare type BaseSchematicProviderProps = Omit<SchematicJS.SchematicOptions, "client" | "publishableKey"> & {
32
82
  children: React.ReactNode;
33
83
  };
@@ -295,6 +345,55 @@ declare interface BillingProductForSubscriptionResponseData {
295
345
  updatedAt: Date;
296
346
  }
297
347
 
348
+ /**
349
+ * Schematic API
350
+ * Schematic API
351
+ *
352
+ * The version of the OpenAPI document: 0.1
353
+ *
354
+ *
355
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
356
+ * https://openapi-generator.tech
357
+ * Do not edit the class manually.
358
+ */
359
+ /**
360
+ * The created resource
361
+ * @export
362
+ * @interface BillingSubscriptionResponseData
363
+ */
364
+ declare interface BillingSubscriptionResponseData {
365
+ /**
366
+ *
367
+ * @type {Date}
368
+ * @memberof BillingSubscriptionResponseData
369
+ */
370
+ expiredAt?: Date | null;
371
+ /**
372
+ *
373
+ * @type {string}
374
+ * @memberof BillingSubscriptionResponseData
375
+ */
376
+ externalId: string;
377
+ /**
378
+ *
379
+ * @type {number}
380
+ * @memberof BillingSubscriptionResponseData
381
+ */
382
+ id: number;
383
+ /**
384
+ *
385
+ * @type {Date}
386
+ * @memberof BillingSubscriptionResponseData
387
+ */
388
+ updatedAt: Date;
389
+ }
390
+
391
+ declare class BlobApiResponse {
392
+ raw: Response;
393
+ constructor(raw: Response);
394
+ value(): Promise<Blob>;
395
+ }
396
+
298
397
  export declare const Box: IStyledComponentBase<"web", Substitute<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ComponentProps>> & string;
299
398
 
300
399
  export declare type BoxProps = ComponentProps;
@@ -313,6 +412,8 @@ export declare type ButtonStyleTypes = "blue" | "white" | "red" | "black";
313
412
 
314
413
  export declare type ButtonVariantTypes = "solid" | "outline" | "ghost" | "link";
315
414
 
415
+ declare function canConsumeForm(consumes: Consume[]): boolean;
416
+
316
417
  export declare const Card: ForwardRefExoticComponent<CardProps & RefAttributes<HTMLDivElement | null>>;
317
418
 
318
419
  export declare interface CardProps {
@@ -320,6 +421,90 @@ export declare interface CardProps {
320
421
  className?: string;
321
422
  }
322
423
 
424
+ /**
425
+ * Schematic API
426
+ * Schematic API
427
+ *
428
+ * The version of the OpenAPI document: 0.1
429
+ *
430
+ *
431
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
432
+ * https://openapi-generator.tech
433
+ * Do not edit the class manually.
434
+ */
435
+ /**
436
+ *
437
+ * @export
438
+ * @interface ChangeSubscriptionRequestBody
439
+ */
440
+ declare interface ChangeSubscriptionRequestBody {
441
+ /**
442
+ *
443
+ * @type {string}
444
+ * @memberof ChangeSubscriptionRequestBody
445
+ */
446
+ newPlanId: string;
447
+ /**
448
+ *
449
+ * @type {string}
450
+ * @memberof ChangeSubscriptionRequestBody
451
+ */
452
+ newPriceId: string;
453
+ }
454
+
455
+ /**
456
+ *
457
+ */
458
+ declare class CheckoutApi extends runtime.BaseAPI {
459
+ /**
460
+ * Checkout
461
+ */
462
+ checkoutRaw(requestParameters: CheckoutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CheckoutResponse>>;
463
+ /**
464
+ * Checkout
465
+ */
466
+ checkout(requestParameters: CheckoutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CheckoutResponse>;
467
+ /**
468
+ * Hydrate component
469
+ */
470
+ hydrateComponentRaw(requestParameters: HydrateComponentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HydrateComponentResponse>>;
471
+ /**
472
+ * Hydrate component
473
+ */
474
+ hydrateComponent(requestParameters: HydrateComponentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HydrateComponentResponse>;
475
+ }
476
+
477
+ declare interface CheckoutRequest {
478
+ changeSubscriptionRequestBody: ChangeSubscriptionRequestBody;
479
+ }
480
+
481
+ /**
482
+ *
483
+ * @export
484
+ * @interface CheckoutResponse
485
+ */
486
+ declare interface CheckoutResponse {
487
+ /**
488
+ *
489
+ * @type {BillingSubscriptionResponseData}
490
+ * @memberof CheckoutResponse
491
+ */
492
+ data: BillingSubscriptionResponseData;
493
+ /**
494
+ * Input parameters
495
+ * @type {object}
496
+ * @memberof CheckoutResponse
497
+ */
498
+ params: object;
499
+ }
500
+
501
+ declare const COLLECTION_FORMATS: {
502
+ csv: string;
503
+ ssv: string;
504
+ tsv: string;
505
+ pipes: string;
506
+ };
507
+
323
508
  export declare const Column: ForwardRefExoticComponent<Omit<ColumnProps, "ref"> & RefAttributes<HTMLDivElement | null>>;
324
509
 
325
510
  export declare interface ColumnProps extends React.HTMLProps<HTMLDivElement> {
@@ -619,6 +804,12 @@ declare interface ComponentHydrateResponseData {
619
804
  * @memberof ComponentHydrateResponseData
620
805
  */
621
806
  subscription?: CompanySubscriptionResponseData;
807
+ /**
808
+ *
809
+ * @type {InvoiceResponseData}
810
+ * @memberof ComponentHydrateResponseData
811
+ */
812
+ upcomingInvoice?: InvoiceResponseData;
622
813
  }
623
814
 
624
815
  declare interface ComponentProps extends TransientCSSProperties {
@@ -688,6 +879,22 @@ declare interface ComponentResponseData {
688
879
  updatedAt: Date;
689
880
  }
690
881
 
882
+ declare class Configuration {
883
+ private configuration;
884
+ constructor(configuration?: ConfigurationParameters);
885
+ set config(configuration: Configuration);
886
+ get basePath(): string;
887
+ get fetchApi(): FetchAPI | undefined;
888
+ get middleware(): Middleware[];
889
+ get queryParamsStringify(): (params: HTTPQuery) => string;
890
+ get username(): string | undefined;
891
+ get password(): string | undefined;
892
+ get apiKey(): ((name: string) => string | Promise<string>) | undefined;
893
+ get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined;
894
+ get headers(): HTTPHeaders | undefined;
895
+ get credentials(): RequestCredentials | undefined;
896
+ }
897
+
691
898
  declare interface ConfigurationParameters {
692
899
  basePath?: string;
693
900
  fetchApi?: FetchAPI;
@@ -701,6 +908,10 @@ declare interface ConfigurationParameters {
701
908
  credentials?: RequestCredentials;
702
909
  }
703
910
 
911
+ declare interface Consume {
912
+ contentType: string;
913
+ }
914
+
704
915
  declare const _default: {
705
916
  alarm: number;
706
917
  "arrow-curved": number;
@@ -801,6 +1012,8 @@ declare const _default: {
801
1012
  wind: number;
802
1013
  };
803
1014
 
1015
+ declare const DefaultConfig: Configuration;
1016
+
804
1017
  export declare const defaultSettings: EmbedSettings;
805
1018
 
806
1019
  export declare const defaultTheme: EmbedThemeSettings;
@@ -939,7 +1152,8 @@ declare interface ElementProps {
939
1152
  export declare const EmbedContext: Context<EmbedContextProps>;
940
1153
 
941
1154
  export declare interface EmbedContextProps {
942
- data: RecursivePartial<ComponentHydrateResponseData>;
1155
+ api: CheckoutApi | null;
1156
+ data: ComponentHydrateResponseData;
943
1157
  nodes: SerializedNodeWithChildren[];
944
1158
  settings: EmbedSettings;
945
1159
  stripe: Promise<Stripe | null> | null;
@@ -1570,6 +1784,12 @@ declare type FeatureUsageResponseDataAllocationTypeEnum = (typeof FeatureUsageRe
1570
1784
 
1571
1785
  declare type FetchAPI = WindowOrWorkerGlobalScope["fetch"];
1572
1786
 
1787
+ declare class FetchError extends Error {
1788
+ cause: Error;
1789
+ name: "FetchError";
1790
+ constructor(cause: Error, msg?: string);
1791
+ }
1792
+
1573
1793
  declare interface FetchParams {
1574
1794
  url: string;
1575
1795
  init: RequestInit;
@@ -1671,14 +1891,49 @@ ref?: ((instance: HTMLDivElement | null) => void | DO_NOT_USE_OR_YOU_WILL_BE_FIR
1671
1891
 
1672
1892
  declare type FontStyle = keyof EmbedThemeSettings["typography"];
1673
1893
 
1894
+ declare type HTTPBody = Json | FormData | URLSearchParams;
1895
+
1674
1896
  declare type HTTPHeaders = {
1675
1897
  [key: string]: string;
1676
1898
  };
1677
1899
 
1900
+ declare type HTTPMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
1901
+
1678
1902
  declare type HTTPQuery = {
1679
1903
  [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery;
1680
1904
  };
1681
1905
 
1906
+ declare type HTTPRequestInit = {
1907
+ headers?: HTTPHeaders;
1908
+ method: HTTPMethod;
1909
+ credentials?: RequestCredentials;
1910
+ body?: HTTPBody;
1911
+ };
1912
+
1913
+ declare interface HydrateComponentRequest {
1914
+ componentId: string;
1915
+ }
1916
+
1917
+ /**
1918
+ *
1919
+ * @export
1920
+ * @interface HydrateComponentResponse
1921
+ */
1922
+ declare interface HydrateComponentResponse {
1923
+ /**
1924
+ *
1925
+ * @type {ComponentHydrateResponseData}
1926
+ * @memberof HydrateComponentResponse
1927
+ */
1928
+ data: ComponentHydrateResponseData;
1929
+ /**
1930
+ * Input parameters
1931
+ * @type {object}
1932
+ * @memberof HydrateComponentResponse
1933
+ */
1934
+ params: object;
1935
+ }
1936
+
1682
1937
  export declare const Icon: ({ name, className, ...props }: IconProps) => JSX_2.Element;
1683
1938
 
1684
1939
  export declare type IconNameTypes = keyof typeof _default;
@@ -1700,6 +1955,11 @@ export declare const IncludedFeatures: ForwardRefExoticComponent<ElementProps &
1700
1955
 
1701
1956
  export declare type IncludedFeaturesProps = DesignProps_2;
1702
1957
 
1958
+ declare type InitOverrideFunction = (requestContext: {
1959
+ init: HTTPRequestInit;
1960
+ context: RequestOpts;
1961
+ }) => Promise<RequestInit>;
1962
+
1703
1963
  /**
1704
1964
  * Schematic API
1705
1965
  * Schematic API
@@ -1813,8 +2073,19 @@ export declare const Invoices: ForwardRefExoticComponent<ElementProps & Recursiv
1813
2073
 
1814
2074
  export declare type InvoicesProps = DesignProps_6;
1815
2075
 
2076
+ declare type Json = any;
2077
+
2078
+ declare class JSONApiResponse<T> {
2079
+ raw: Response;
2080
+ private transformer;
2081
+ constructor(raw: Response, transformer?: ResponseTransformer<T>);
2082
+ value(): Promise<T>;
2083
+ }
2084
+
1816
2085
  export { Keys }
1817
2086
 
2087
+ declare function mapValues(data: any, fn: (item: any) => any): {};
2088
+
1818
2089
  export declare const MeteredFeatures: ForwardRefExoticComponent<ElementProps & RecursivePartial<DesignProps_3> & HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement | null>>;
1819
2090
 
1820
2091
  export declare type MeteredFeaturesProps = DesignProps_3;
@@ -1825,14 +2096,20 @@ declare interface Middleware {
1825
2096
  onError?(context: ErrorContext): Promise<Response | void>;
1826
2097
  }
1827
2098
 
1828
- export declare const OverlayHeader: ({ children }: {
2099
+ declare type ModelPropertyNaming = "camelCase" | "snake_case" | "PascalCase" | "original";
2100
+
2101
+ export declare const OverlayHeader: ({ children, onClose, }: {
1829
2102
  children: ReactNode;
2103
+ onClose?: () => void;
1830
2104
  }) => JSX_2.Element;
1831
2105
 
1832
- export declare const OverlaySideBar: ({ pricePeriod, setPricePeriod, setCheckoutStage, }: {
2106
+ export declare const OverlaySideBar: ({ pricePeriod, setPricePeriod, checkoutStage, setCheckoutStage, currentPlan, selectedPlan, }: {
1833
2107
  pricePeriod: "month" | "year";
1834
2108
  setPricePeriod: Dispatch<SetStateAction<"month" | "year">>;
2109
+ checkoutStage: "plan" | "checkout";
1835
2110
  setCheckoutStage: Dispatch<SetStateAction<"plan" | "checkout">>;
2111
+ currentPlan?: BillingPlan;
2112
+ selectedPlan?: CompanyPlanDetailResponseData;
1836
2113
  }) => JSX_2.Element;
1837
2114
 
1838
2115
  export declare const OverlayWrapper: ({ children, size, }: {
@@ -2173,6 +2450,8 @@ export declare interface ProgressBarProps extends React.ComponentPropsWithoutRef
2173
2450
  barWidth?: string | number;
2174
2451
  }
2175
2452
 
2453
+ declare function querystring(params: HTTPQuery, prefix?: string): string;
2454
+
2176
2455
  declare type RecursivePartial<T> = {
2177
2456
  [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P];
2178
2457
  };
@@ -2183,6 +2462,20 @@ declare interface RequestContext {
2183
2462
  init: RequestInit;
2184
2463
  }
2185
2464
 
2465
+ declare interface RequestOpts {
2466
+ path: string;
2467
+ method: HTTPMethod;
2468
+ headers: HTTPHeaders;
2469
+ query?: HTTPQuery;
2470
+ body?: HTTPBody;
2471
+ }
2472
+
2473
+ declare class RequiredError extends Error {
2474
+ field: string;
2475
+ name: "RequiredError";
2476
+ constructor(field: string, msg?: string);
2477
+ }
2478
+
2186
2479
  declare interface ResponseContext {
2187
2480
  fetch: FetchAPI;
2188
2481
  url: string;
@@ -2190,6 +2483,16 @@ declare interface ResponseContext {
2190
2483
  response: Response;
2191
2484
  }
2192
2485
 
2486
+ declare class ResponseError extends Error {
2487
+ response: Response;
2488
+ name: "ResponseError";
2489
+ constructor(response: Response, msg?: string);
2490
+ }
2491
+
2492
+ declare interface ResponseTransformer<T> {
2493
+ (json: any): T;
2494
+ }
2495
+
2193
2496
  export declare const Root: ForwardRefExoticComponent<Omit<RootProps, "ref"> & RefAttributes<HTMLDivElement | null>>;
2194
2497
 
2195
2498
  export declare interface RootProps extends React.HTMLProps<HTMLDivElement> {
@@ -2496,6 +2799,45 @@ declare interface RuleDetailResponseData {
2496
2799
  value: boolean;
2497
2800
  }
2498
2801
 
2802
+ declare namespace runtime {
2803
+ export {
2804
+ querystring,
2805
+ mapValues,
2806
+ canConsumeForm,
2807
+ BASE_PATH,
2808
+ ConfigurationParameters,
2809
+ Configuration,
2810
+ DefaultConfig,
2811
+ BaseAPI,
2812
+ ResponseError,
2813
+ FetchError,
2814
+ RequiredError,
2815
+ COLLECTION_FORMATS,
2816
+ FetchAPI,
2817
+ Json,
2818
+ HTTPMethod,
2819
+ HTTPHeaders,
2820
+ HTTPQuery,
2821
+ HTTPBody,
2822
+ HTTPRequestInit,
2823
+ ModelPropertyNaming,
2824
+ InitOverrideFunction,
2825
+ FetchParams,
2826
+ RequestOpts,
2827
+ Consume,
2828
+ RequestContext,
2829
+ ResponseContext,
2830
+ ErrorContext,
2831
+ Middleware,
2832
+ ApiResponse,
2833
+ ResponseTransformer,
2834
+ JSONApiResponse,
2835
+ VoidApiResponse,
2836
+ BlobApiResponse,
2837
+ TextApiResponse
2838
+ }
2839
+ }
2840
+
2499
2841
  export { Schematic }
2500
2842
 
2501
2843
  export { SchematicContext }
@@ -2570,6 +2912,12 @@ declare interface StripeEmbedInfo {
2570
2912
  declare const Text_2: IStyledComponentBase<"web", Substitute<DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, TextProps>> & string;
2571
2913
  export { Text_2 as Text }
2572
2914
 
2915
+ declare class TextApiResponse {
2916
+ raw: Response;
2917
+ constructor(raw: Response);
2918
+ value(): Promise<string>;
2919
+ }
2920
+
2573
2921
  export declare interface TextProps extends ComponentProps {
2574
2922
  $align?: ComponentProps["$textAlign"];
2575
2923
  $font?: ComponentProps["$fontFamily"];
@@ -2620,4 +2968,10 @@ export declare const Viewport: ForwardRefExoticComponent<Omit<ViewportProps, "re
2620
2968
  export declare interface ViewportProps extends React.HTMLProps<HTMLDivElement> {
2621
2969
  }
2622
2970
 
2971
+ declare class VoidApiResponse {
2972
+ raw: Response;
2973
+ constructor(raw: Response);
2974
+ value(): Promise<void>;
2975
+ }
2976
+
2623
2977
  export { }