tinacms 1.1.1 → 1.1.2

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.
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useCMS, Form, GlobalFormPlugin, EventBus, Modal, ModalPopup, ModalHeader, ModalBody, ModalActions, Button, LoadingDots, useLocalStorage, TinaCMS, BranchSwitcherPlugin, BranchDataProvider, TinaProvider, TinaMediaStore, DummyMediaStore, Nav, LocalWarning, Select, OverflowMenu, CursorPaginator, PopupModal, wrapFieldsWithMeta, FormStatus, FormBuilder } from "@tinacms/toolkit";
1
+ import { useCMS, Form, GlobalFormPlugin, EventBus, Modal, ModalPopup, ModalHeader, ModalBody, ModalActions, Button, LoadingDots, useLocalStorage, TinaCMS, BranchSwitcherPlugin, BranchDataProvider, TinaProvider, TinaMediaStore, DummyMediaStore, Nav, LocalWarning, BillingWarning, Select, OverflowMenu, CursorPaginator, PopupModal, wrapFieldsWithMeta, FormStatus, FormBuilder } from "@tinacms/toolkit";
2
2
  export * from "@tinacms/toolkit";
3
3
  export { MdxFieldPluginExtendible } from "@tinacms/toolkit";
4
4
  import * as G from "graphql";
@@ -2393,6 +2393,30 @@ mutation addPendingDocumentMutation(
2393
2393
  return null;
2394
2394
  }
2395
2395
  }
2396
+ async getBillingState() {
2397
+ if (!this.clientId) {
2398
+ return null;
2399
+ }
2400
+ const url = `${this.identityApiUrl}/v2/apps/${this.clientId}/billing/state`;
2401
+ try {
2402
+ const res = await this.fetchWithToken(url, {
2403
+ method: "GET"
2404
+ });
2405
+ const val = await res.json();
2406
+ if (!res.status.toString().startsWith("2")) {
2407
+ console.error(val.error);
2408
+ return null;
2409
+ }
2410
+ return {
2411
+ clientId: val.clientId || this.clientId,
2412
+ delinquencyDate: val.delinquencyDate,
2413
+ billingState: val.billingState
2414
+ };
2415
+ } catch (e) {
2416
+ console.error(e);
2417
+ return null;
2418
+ }
2419
+ }
2396
2420
  async listBranches() {
2397
2421
  const url = `${this.contentApiBase}/github/${this.clientId}/list_branches`;
2398
2422
  const res = await this.fetchWithToken(url, {
@@ -4780,7 +4804,7 @@ const PageWrapper = ({
4780
4804
  const PageHeader = ({
4781
4805
  isLocalMode,
4782
4806
  children
4783
- }) => /* @__PURE__ */ React.createElement(React.Fragment, null, isLocalMode && /* @__PURE__ */ React.createElement(LocalWarning, null), /* @__PURE__ */ React.createElement("div", {
4807
+ }) => /* @__PURE__ */ React.createElement(React.Fragment, null, isLocalMode && /* @__PURE__ */ React.createElement(LocalWarning, null), !isLocalMode && /* @__PURE__ */ React.createElement(BillingWarning, null), /* @__PURE__ */ React.createElement("div", {
4784
4808
  className: "bg-white pb-4 pt-16 border-b border-gray-200 px-12"
4785
4809
  }, /* @__PURE__ */ React.createElement("div", {
4786
4810
  className: "w-full mx-auto max-w-screen-xl"
@@ -5399,7 +5423,7 @@ const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
5399
5423
  const windowWidth = useWindowWidth();
5400
5424
  const renderNavToggle = windowWidth < navBreakpoint + 1;
5401
5425
  const headerPadding = renderNavToggle ? "px-20" : "px-6";
5402
- return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((_f = (_e = cms == null ? void 0 : cms.api) == null ? void 0 : _e.tina) == null ? void 0 : _f.isLocalMode) && /* @__PURE__ */ React.createElement(LocalWarning, null), /* @__PURE__ */ React.createElement("div", {
5426
+ return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((_f = (_e = cms == null ? void 0 : cms.api) == null ? void 0 : _e.tina) == null ? void 0 : _f.isLocalMode) ? /* @__PURE__ */ React.createElement(LocalWarning, null) : /* @__PURE__ */ React.createElement(BillingWarning, null), /* @__PURE__ */ React.createElement("div", {
5403
5427
  className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
5404
5428
  }, /* @__PURE__ */ React.createElement("div", {
5405
5429
  className: "max-w-form mx-auto"
@@ -5547,7 +5571,7 @@ const RenderForm = ({
5547
5571
  const windowWidth = useWindowWidth();
5548
5572
  const renderNavToggle = windowWidth < navBreakpoint + 1;
5549
5573
  const headerPadding = renderNavToggle ? "px-20" : "px-6";
5550
- return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) && /* @__PURE__ */ React.createElement(LocalWarning, null), /* @__PURE__ */ React.createElement("div", {
5574
+ return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) ? /* @__PURE__ */ React.createElement(LocalWarning, null) : /* @__PURE__ */ React.createElement(BillingWarning, null), /* @__PURE__ */ React.createElement("div", {
5551
5575
  className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
5552
5576
  }, /* @__PURE__ */ React.createElement("div", {
5553
5577
  className: "max-w-form mx-auto"
@@ -5580,7 +5604,7 @@ const ScreenPage = () => {
5580
5604
  const selectedScreen = screens.find(({ name }) => slugify(name) === screenName);
5581
5605
  return /* @__PURE__ */ React.createElement("div", {
5582
5606
  className: "relative w-full h-full flex flex-col items-stretch justify-between"
5583
- }, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) && /* @__PURE__ */ React.createElement(LocalWarning, null), renderNavToggle && /* @__PURE__ */ React.createElement("div", {
5607
+ }, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) ? /* @__PURE__ */ React.createElement(LocalWarning, null) : /* @__PURE__ */ React.createElement(BillingWarning, null), renderNavToggle && /* @__PURE__ */ React.createElement("div", {
5584
5608
  className: `py-5 border-b border-gray-200 bg-white pl-18`
5585
5609
  }, selectedScreen.name), /* @__PURE__ */ React.createElement("div", {
5586
5610
  className: "flex-1 overflow-y-auto relative flex flex-col items-stretch justify-between"
package/dist/index.js CHANGED
@@ -2409,6 +2409,30 @@ mutation addPendingDocumentMutation(
2409
2409
  return null;
2410
2410
  }
2411
2411
  }
2412
+ async getBillingState() {
2413
+ if (!this.clientId) {
2414
+ return null;
2415
+ }
2416
+ const url = `${this.identityApiUrl}/v2/apps/${this.clientId}/billing/state`;
2417
+ try {
2418
+ const res = await this.fetchWithToken(url, {
2419
+ method: "GET"
2420
+ });
2421
+ const val = await res.json();
2422
+ if (!res.status.toString().startsWith("2")) {
2423
+ console.error(val.error);
2424
+ return null;
2425
+ }
2426
+ return {
2427
+ clientId: val.clientId || this.clientId,
2428
+ delinquencyDate: val.delinquencyDate,
2429
+ billingState: val.billingState
2430
+ };
2431
+ } catch (e) {
2432
+ console.error(e);
2433
+ return null;
2434
+ }
2435
+ }
2412
2436
  async listBranches() {
2413
2437
  const url = `${this.contentApiBase}/github/${this.clientId}/list_branches`;
2414
2438
  const res = await this.fetchWithToken(url, {
@@ -4796,7 +4820,7 @@ This will work when developing locally but NOT when deployed to production.
4796
4820
  const PageHeader = ({
4797
4821
  isLocalMode,
4798
4822
  children
4799
- }) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, isLocalMode && /* @__PURE__ */ React__default["default"].createElement(toolkit.LocalWarning, null), /* @__PURE__ */ React__default["default"].createElement("div", {
4823
+ }) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, isLocalMode && /* @__PURE__ */ React__default["default"].createElement(toolkit.LocalWarning, null), !isLocalMode && /* @__PURE__ */ React__default["default"].createElement(toolkit.BillingWarning, null), /* @__PURE__ */ React__default["default"].createElement("div", {
4800
4824
  className: "bg-white pb-4 pt-16 border-b border-gray-200 px-12"
4801
4825
  }, /* @__PURE__ */ React__default["default"].createElement("div", {
4802
4826
  className: "w-full mx-auto max-w-screen-xl"
@@ -5415,7 +5439,7 @@ This will work when developing locally but NOT when deployed to production.
5415
5439
  const windowWidth = windowSize.useWindowWidth();
5416
5440
  const renderNavToggle = windowWidth < navBreakpoint + 1;
5417
5441
  const headerPadding = renderNavToggle ? "px-20" : "px-6";
5418
- return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, ((_f = (_e = cms == null ? void 0 : cms.api) == null ? void 0 : _e.tina) == null ? void 0 : _f.isLocalMode) && /* @__PURE__ */ React__default["default"].createElement(toolkit.LocalWarning, null), /* @__PURE__ */ React__default["default"].createElement("div", {
5442
+ return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, ((_f = (_e = cms == null ? void 0 : cms.api) == null ? void 0 : _e.tina) == null ? void 0 : _f.isLocalMode) ? /* @__PURE__ */ React__default["default"].createElement(toolkit.LocalWarning, null) : /* @__PURE__ */ React__default["default"].createElement(toolkit.BillingWarning, null), /* @__PURE__ */ React__default["default"].createElement("div", {
5419
5443
  className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
5420
5444
  }, /* @__PURE__ */ React__default["default"].createElement("div", {
5421
5445
  className: "max-w-form mx-auto"
@@ -5563,7 +5587,7 @@ This will work when developing locally but NOT when deployed to production.
5563
5587
  const windowWidth = windowSize.useWindowWidth();
5564
5588
  const renderNavToggle = windowWidth < navBreakpoint + 1;
5565
5589
  const headerPadding = renderNavToggle ? "px-20" : "px-6";
5566
- return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) && /* @__PURE__ */ React__default["default"].createElement(toolkit.LocalWarning, null), /* @__PURE__ */ React__default["default"].createElement("div", {
5590
+ return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) ? /* @__PURE__ */ React__default["default"].createElement(toolkit.LocalWarning, null) : /* @__PURE__ */ React__default["default"].createElement(toolkit.BillingWarning, null), /* @__PURE__ */ React__default["default"].createElement("div", {
5567
5591
  className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
5568
5592
  }, /* @__PURE__ */ React__default["default"].createElement("div", {
5569
5593
  className: "max-w-form mx-auto"
@@ -5596,7 +5620,7 @@ This will work when developing locally but NOT when deployed to production.
5596
5620
  const selectedScreen = screens.find(({ name }) => slugify(name) === screenName);
5597
5621
  return /* @__PURE__ */ React__default["default"].createElement("div", {
5598
5622
  className: "relative w-full h-full flex flex-col items-stretch justify-between"
5599
- }, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) && /* @__PURE__ */ React__default["default"].createElement(toolkit.LocalWarning, null), renderNavToggle && /* @__PURE__ */ React__default["default"].createElement("div", {
5623
+ }, ((_b = (_a = cms == null ? void 0 : cms.api) == null ? void 0 : _a.tina) == null ? void 0 : _b.isLocalMode) ? /* @__PURE__ */ React__default["default"].createElement(toolkit.LocalWarning, null) : /* @__PURE__ */ React__default["default"].createElement(toolkit.BillingWarning, null), renderNavToggle && /* @__PURE__ */ React__default["default"].createElement("div", {
5600
5624
  className: `py-5 border-b border-gray-200 bg-white pl-18`
5601
5625
  }, selectedScreen.name), /* @__PURE__ */ React__default["default"].createElement("div", {
5602
5626
  className: "flex-1 overflow-y-auto relative flex flex-col items-stretch justify-between"
@@ -126,6 +126,11 @@ export declare class Client {
126
126
  */
127
127
  fetchWithToken(input: RequestInfo, init?: RequestInit): Promise<Response>;
128
128
  getUser(): Promise<any>;
129
+ getBillingState(): Promise<{
130
+ clientId: string;
131
+ delinquencyDate: number;
132
+ billingState: 'current' | 'late' | 'delinquent';
133
+ }>;
129
134
  listBranches(): Promise<any>;
130
135
  createBranch({ baseBranch, branchName }: BranchData): Promise<string>;
131
136
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "exports": {
@@ -55,9 +55,9 @@
55
55
  "@headlessui/react": "^1.5.0",
56
56
  "@heroicons/react": "^1.0.4",
57
57
  "@react-hook/window-size": "^3.0.7",
58
- "@tinacms/schema-tools": "1.0.3",
58
+ "@tinacms/schema-tools": "1.1.0",
59
59
  "@tinacms/sharedctx": "1.0.0",
60
- "@tinacms/toolkit": "1.1.1",
60
+ "@tinacms/toolkit": "1.2.0",
61
61
  "crypto-js": "^4.0.0",
62
62
  "encoding": "0.1.13",
63
63
  "fetch-ponyfill": "^7.1.0",