@things-factory/saas 10.1.246 → 10.1.248

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.
Files changed (66) hide show
  1. package/package.json +10 -10
  2. package/dist-client/bootstrap.d.ts +0 -1
  3. package/dist-client/bootstrap.js +0 -5
  4. package/dist-client/bootstrap.js.map +0 -1
  5. package/dist-client/entity360/saas-account-360.d.ts +0 -11
  6. package/dist-client/entity360/saas-account-360.js +0 -178
  7. package/dist-client/entity360/saas-account-360.js.map +0 -1
  8. package/dist-client/index.d.ts +0 -1
  9. package/dist-client/index.js +0 -2
  10. package/dist-client/index.js.map +0 -1
  11. package/dist-client/pages/saas-account-list.d.ts +0 -57
  12. package/dist-client/pages/saas-account-list.js +0 -169
  13. package/dist-client/pages/saas-account-list.js.map +0 -1
  14. package/dist-client/pages/saas-account-page.d.ts +0 -52
  15. package/dist-client/pages/saas-account-page.js +0 -332
  16. package/dist-client/pages/saas-account-page.js.map +0 -1
  17. package/dist-client/route.d.ts +0 -1
  18. package/dist-client/route.js +0 -13
  19. package/dist-client/route.js.map +0 -1
  20. package/dist-client/tsconfig.tsbuildinfo +0 -1
  21. package/dist-client/words.d.ts +0 -34
  22. package/dist-client/words.js +0 -22
  23. package/dist-client/words.js.map +0 -1
  24. package/dist-server/index.d.ts +0 -1
  25. package/dist-server/index.js +0 -9
  26. package/dist-server/index.js.map +0 -1
  27. package/dist-server/role-tasks.d.ts +0 -2
  28. package/dist-server/role-tasks.js +0 -18
  29. package/dist-server/role-tasks.js.map +0 -1
  30. package/dist-server/service/checks.d.ts +0 -27
  31. package/dist-server/service/checks.js +0 -70
  32. package/dist-server/service/checks.js.map +0 -1
  33. package/dist-server/service/index.d.ts +0 -18
  34. package/dist-server/service/index.js +0 -34
  35. package/dist-server/service/index.js.map +0 -1
  36. package/dist-server/service/saas-access.d.ts +0 -20
  37. package/dist-server/service/saas-access.js +0 -36
  38. package/dist-server/service/saas-access.js.map +0 -1
  39. package/dist-server/service/saas-account.d.ts +0 -39
  40. package/dist-server/service/saas-account.js +0 -151
  41. package/dist-server/service/saas-account.js.map +0 -1
  42. package/dist-server/service/saas-mutation.d.ts +0 -10
  43. package/dist-server/service/saas-mutation.js +0 -87
  44. package/dist-server/service/saas-mutation.js.map +0 -1
  45. package/dist-server/service/saas-query.d.ts +0 -21
  46. package/dist-server/service/saas-query.js +0 -168
  47. package/dist-server/service/saas-query.js.map +0 -1
  48. package/dist-server/service/saas-rules.d.ts +0 -41
  49. package/dist-server/service/saas-rules.js +0 -62
  50. package/dist-server/service/saas-rules.js.map +0 -1
  51. package/dist-server/service/saas-seat.d.ts +0 -26
  52. package/dist-server/service/saas-seat.js +0 -110
  53. package/dist-server/service/saas-seat.js.map +0 -1
  54. package/dist-server/service/saas-service.d.ts +0 -19
  55. package/dist-server/service/saas-service.js +0 -223
  56. package/dist-server/service/saas-service.js.map +0 -1
  57. package/dist-server/service/saas-subscription.d.ts +0 -45
  58. package/dist-server/service/saas-subscription.js +0 -174
  59. package/dist-server/service/saas-subscription.js.map +0 -1
  60. package/dist-server/service/saas-sync.d.ts +0 -34
  61. package/dist-server/service/saas-sync.js +0 -106
  62. package/dist-server/service/saas-sync.js.map +0 -1
  63. package/dist-server/service/saas-type.d.ts +0 -89
  64. package/dist-server/service/saas-type.js +0 -338
  65. package/dist-server/service/saas-type.js.map +0 -1
  66. package/dist-server/tsconfig.tsbuildinfo +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/saas",
3
- "version": "10.1.246",
3
+ "version": "10.1.248",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -36,16 +36,16 @@
36
36
  "@operato/shell": "^10.29.39",
37
37
  "@operato/styles": "^10.29.1",
38
38
  "@operato/utils": "^10.0.0",
39
- "@things-factory/accounting": "^10.1.246",
40
- "@things-factory/asset": "^10.1.246",
41
- "@things-factory/auth-base": "^10.1.246",
42
- "@things-factory/biz-base": "^10.1.246",
43
- "@things-factory/fact-change": "^10.1.246",
44
- "@things-factory/i18n-base": "^10.1.246",
45
- "@things-factory/organization": "^10.1.246",
46
- "@things-factory/shell": "^10.1.246",
39
+ "@things-factory/accounting": "^10.1.248",
40
+ "@things-factory/asset": "^10.1.248",
41
+ "@things-factory/auth-base": "^10.1.247",
42
+ "@things-factory/biz-base": "^10.1.247",
43
+ "@things-factory/fact-change": "^10.1.247",
44
+ "@things-factory/i18n-base": "^10.1.247",
45
+ "@things-factory/organization": "^10.1.247",
46
+ "@things-factory/shell": "^10.1.247",
47
47
  "graphql-tag": "^2.12.6",
48
48
  "lit": "^3.1.2"
49
49
  },
50
- "gitHead": "46c0d3c93edf765cc1f13040b1f9d03fd1d9e60b"
50
+ "gitHead": "ca390a4b791d6e8630388167d3da6031034b5a5e"
51
51
  }
@@ -1 +0,0 @@
1
- export default function bootstrap(): void;
@@ -1,5 +0,0 @@
1
- import { registerSaasAccount360 } from './entity360/saas-account-360.js';
2
- export default function bootstrap() {
3
- registerSaasAccount360();
4
- }
5
- //# sourceMappingURL=bootstrap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AAExE,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,sBAAsB,EAAE,CAAA;AAC1B,CAAC","sourcesContent":["import { registerSaasAccount360 } from './entity360/saas-account-360.js'\n\nexport default function bootstrap() {\n registerSaasAccount360()\n}\n"]}
@@ -1,11 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import { type Entity360DoorAnswer, type Entity360Subject } from '@operato/layout';
3
- export declare function registerSaasAccount360(): void;
4
- export declare class SaasAccount360 extends LitElement {
5
- static styles: import("lit").CSSResult;
6
- subject?: Entity360Subject;
7
- answer?: Entity360DoorAnswer<any>;
8
- updated(changed: Map<string, unknown>): void;
9
- private read;
10
- render(): import("lit-html").TemplateResult<1>;
11
- }
@@ -1,178 +0,0 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import gql from 'graphql-tag';
3
- import { css, html, LitElement, nothing } from 'lit';
4
- import { customElement, property, state } from 'lit/decorators.js';
5
- import { client } from '@operato/graphql';
6
- import { i18next } from '@operato/i18n';
7
- import { entity360Name, readEntity360Door, registerEntity360Kind, registerEntity360Section } from '@operato/layout';
8
- import { navigate } from '@operato/shell';
9
- import { amountText, wordOf } from '../words.js';
10
- /*
11
- * A subscription account's 360 (ADR-0177 decision 11) - one account read deep: what it is and how it is paid, what is
12
- * subscribed under it with the reference its quantities and unit prices make, and what moved on it. No months and no
13
- * bank lines - the money is a recurring item's (개정 7). Reading first; the account's screen opens from a quiet button
14
- * beside the heading.
15
- */
16
- export function registerSaasAccount360() {
17
- registerEntity360Kind({
18
- kind: 'saas-account',
19
- typenames: ['SaasAccount'],
20
- /* Not yet a record the assistant's conversation follows - the module registers no subject describer for it. */
21
- assistantSubject: false,
22
- title: ({ value }) => `${i18next.t('title.saas-account-page')} · ${value.name || ''}`,
23
- context: ({ value }) => [value.identifier, value.currency].filter(Boolean).join(' · ')
24
- });
25
- registerEntity360Section('saas-account', { name: 'overview', order: 10, render: subject => html `<saas-account-360 .subject=${subject}></saas-account-360>` });
26
- }
27
- const ACCOUNT = gql `
28
- query ($id: String!) {
29
- saasAccount(id: $id) {
30
- id name identifier purpose currency status closedOn
31
- counterparty { id name } paymentAccount { id name } parent { id name } admins { id name }
32
- }
33
- saasSubscriptions(accountId: $id) { id name billing quantity unitPrice referenceAmount renewalOn autoRenew status seatsHeld }
34
- saasChanges(accountId: $id) { subject field fromValue toValue at changedBy }
35
- }
36
- `;
37
- let SaasAccount360 = class SaasAccount360 extends LitElement {
38
- static { this.styles = css `
39
- :host {
40
- display: flex;
41
- flex-direction: column;
42
- gap: var(--spacing-large, 12px);
43
- font-size: var(--ui-t-body, 13px);
44
- line-height: 1.5;
45
- }
46
- dl {
47
- margin: 0;
48
- display: grid;
49
- grid-template-columns: max-content 1fr;
50
- gap: var(--spacing-small, 4px) var(--spacing-large, 12px);
51
- }
52
- dt,
53
- th,
54
- .muted {
55
- color: var(--ui-muted);
56
- }
57
- dd {
58
- margin: 0;
59
- overflow-wrap: anywhere;
60
- }
61
- table {
62
- width: 100%;
63
- border-collapse: collapse;
64
- font-variant-numeric: tabular-nums;
65
- }
66
- th,
67
- td {
68
- padding: 4px 6px;
69
- border-bottom: 1px solid var(--ui-line, var(--md-sys-color-outline-variant));
70
- text-align: right;
71
- font-weight: normal;
72
- }
73
- th:first-child,
74
- td:first-child {
75
- text-align: left;
76
- }
77
- .quiet {
78
- border: none;
79
- background: none;
80
- padding: 0;
81
- color: var(--md-sys-color-primary);
82
- font: inherit;
83
- cursor: pointer;
84
- }
85
- `; }
86
- updated(changed) {
87
- if (changed.has('subject'))
88
- this.read();
89
- }
90
- async read() {
91
- const id = this.subject?.id;
92
- this.answer = undefined;
93
- if (!id)
94
- return;
95
- let response;
96
- try {
97
- response = await client.query({ query: ACCOUNT, variables: { id }, fetchPolicy: 'no-cache', errorPolicy: 'all' });
98
- }
99
- catch (e) {
100
- response = { data: null, errors: e?.graphQLErrors?.length ? e.graphQLErrors : [{ message: e?.message ?? String(e) }] };
101
- }
102
- if (this.subject?.id !== id)
103
- return;
104
- this.answer = readEntity360Door(response, data => (data?.saasAccount ? data : null));
105
- }
106
- render() {
107
- const state = this.answer?.state ?? 'loading';
108
- const data = this.answer?.data;
109
- const one = data?.saasAccount;
110
- const section = (heading, body, action) => html `<ox-entity360-section .heading=${heading} .state=${state} .message=${this.answer?.message ?? ''}>${action ? html `<span slot="actions">${action}</span>` : nothing}${one ? body : nothing}</ox-entity360-section>`;
111
- if (!one)
112
- return section(i18next.t('title.saas-account-page'), nothing);
113
- const subs = data.saasSubscriptions ?? [];
114
- const live = subs.filter(sub => sub.status !== 'CANCELLED');
115
- const reference = live.map(sub => sub.referenceAmount).filter((value) => value !== null && value !== undefined);
116
- const changes = data.saasChanges ?? [];
117
- const nextRenewal = subs
118
- .filter(sub => sub.status === 'ACTIVE' && sub.renewalOn)
119
- .map(sub => sub.renewalOn)
120
- .sort()[0];
121
- const open = html `<button class="quiet" @click=${() => navigate(`saas-account-page?id=${one.id}`)}>${i18next.t('button.saas-open-account')}</button>`;
122
- const party = (value) => (value ? entity360Name({ __typename: 'Counterparty', ...value }, value.name) : '—');
123
- return html `
124
- ${section(one.name, html `<dl>
125
- <dt>${i18next.t('field.saas-account-counterparty')}</dt>
126
- <dd>${party(one.counterparty)}</dd>
127
- <dt>${i18next.t('field.saas-account-payment-account')}</dt>
128
- <dd>${one.paymentAccount?.name ?? '—'}</dd>
129
- <dt>${i18next.t('field.saas-account-currency')}</dt>
130
- <dd>${one.currency}</dd>
131
- <dt>${i18next.t('text.saas-360-next-renewal')}</dt>
132
- <dd>${nextRenewal ?? '—'}</dd>
133
- <dt>${i18next.t('field.saas-account-admins')}</dt>
134
- <dd>${(one.admins ?? []).map((admin) => admin.name).join(', ') || '—'}</dd>
135
- <dt>${i18next.t('field.saas-account-status')}</dt>
136
- <dd>${wordOf('saas-account-status', one.status)}${one.closedOn ? ` · ${one.closedOn}` : ''}</dd>
137
- </dl>`, open)}
138
- ${section(i18next.t('text.saas-tab-subscriptions'), subs.length
139
- ? html `<table>
140
- ${subs.map(sub => html `<tr>
141
- <td>${sub.name} <span class="muted">${wordOf('saas-billing', sub.billing)} · ${wordOf('saas-subscription-status', sub.status)}</span></td>
142
- <td class="muted">${sub.billing === 'SEAT' ? i18next.t('text.saas-360-seats', { held: sub.seatsHeld ?? 0, quantity: sub.quantity ?? 0 }) : ''}</td>
143
- <td>${amountText(sub.referenceAmount)}</td>
144
- </tr>`)}
145
- ${reference.length
146
- ? html `<tr>
147
- <td class="muted">${i18next.t('text.saas-360-reference')}</td>
148
- <td></td>
149
- <td>${amountText(reference.reduce((sum, value) => sum + value, 0))} ${one.currency}</td>
150
- </tr>`
151
- : nothing}
152
- </table>`
153
- : html `<div class="muted">${i18next.t('text.saas-subscriptions-empty')}</div>`)}
154
- ${section(i18next.t('text.saas-360-changes'), changes.length
155
- ? html `<table>
156
- ${changes.map(change => html `<tr>
157
- <td>${String(change.at).slice(0, 10)} <span class="muted">${change.changedBy ?? ''}</span></td>
158
- <td>${change.subject} · ${i18next.t(`text.saas-change-field-${change.field}`, { defaultValue: change.field })}</td>
159
- <td>${change.fromValue ?? '—'} → ${change.toValue ?? '—'}</td>
160
- </tr>`)}
161
- </table>`
162
- : html `<div class="muted">${i18next.t('text.saas-360-changes-empty')}</div>`)}
163
- `;
164
- }
165
- };
166
- __decorate([
167
- property({ attribute: false }),
168
- __metadata("design:type", Object)
169
- ], SaasAccount360.prototype, "subject", void 0);
170
- __decorate([
171
- state(),
172
- __metadata("design:type", Object)
173
- ], SaasAccount360.prototype, "answer", void 0);
174
- SaasAccount360 = __decorate([
175
- customElement('saas-account-360')
176
- ], SaasAccount360);
177
- export { SaasAccount360 };
178
- //# sourceMappingURL=saas-account-360.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"saas-account-360.js","sourceRoot":"","sources":["../../client/entity360/saas-account-360.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,wBAAwB,EAAmD,MAAM,iBAAiB,CAAA;AACpK,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MA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EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;+CAA2B;AACjD;IAAR,KAAK,EAAE;;8CAAkC;AAnD/B,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAkJ1B","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { entity360Name, readEntity360Door, registerEntity360Kind, registerEntity360Section, type Entity360DoorAnswer, type Entity360Subject } from '@operato/layout'\nimport { navigate } from '@operato/shell'\n\nimport { amountText, wordOf } from '../words.js'\n\n/*\n * A subscription account's 360 (ADR-0177 decision 11) - one account read deep: what it is and how it is paid, what is\n * subscribed under it with the reference its quantities and unit prices make, and what moved on it. No months and no\n * bank lines - the money is a recurring item's (개정 7). Reading first; the account's screen opens from a quiet button\n * beside the heading.\n */\nexport function registerSaasAccount360() {\n registerEntity360Kind({\n kind: 'saas-account',\n typenames: ['SaasAccount'],\n /* Not yet a record the assistant's conversation follows - the module registers no subject describer for it. */\n assistantSubject: false,\n title: ({ value }) => `${i18next.t('title.saas-account-page')} · ${value.name || ''}`,\n context: ({ value }) => [value.identifier, value.currency].filter(Boolean).join(' · ')\n })\n registerEntity360Section('saas-account', { name: 'overview', order: 10, render: subject => html`<saas-account-360 .subject=${subject}></saas-account-360>` })\n}\n\nconst ACCOUNT = gql`\n query ($id: String!) {\n saasAccount(id: $id) {\n id name identifier purpose currency status closedOn\n counterparty { id name } paymentAccount { id name } parent { id name } admins { id name }\n }\n saasSubscriptions(accountId: $id) { id name billing quantity unitPrice referenceAmount renewalOn autoRenew status seatsHeld }\n saasChanges(accountId: $id) { subject field fromValue toValue at changedBy }\n }\n`\n\n@customElement('saas-account-360')\nexport class SaasAccount360 extends LitElement {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-large, 12px);\n font-size: var(--ui-t-body, 13px);\n line-height: 1.5;\n }\n dl {\n margin: 0;\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: var(--spacing-small, 4px) var(--spacing-large, 12px);\n }\n dt,\n th,\n .muted {\n color: var(--ui-muted);\n }\n dd {\n margin: 0;\n overflow-wrap: anywhere;\n }\n table {\n width: 100%;\n border-collapse: collapse;\n font-variant-numeric: tabular-nums;\n }\n th,\n td {\n padding: 4px 6px;\n border-bottom: 1px solid var(--ui-line, var(--md-sys-color-outline-variant));\n text-align: right;\n font-weight: normal;\n }\n th:first-child,\n td:first-child {\n text-align: left;\n }\n .quiet {\n border: none;\n background: none;\n padding: 0;\n color: var(--md-sys-color-primary);\n font: inherit;\n cursor: pointer;\n }\n `\n\n @property({ attribute: false }) subject?: Entity360Subject\n @state() answer?: Entity360DoorAnswer<any>\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('subject')) this.read()\n }\n\n private async read() {\n const id = this.subject?.id\n this.answer = undefined\n if (!id) return\n let response: any\n try {\n response = await client.query({ query: ACCOUNT, variables: { id }, fetchPolicy: 'no-cache', errorPolicy: 'all' } as any)\n } catch (e: any) {\n response = { data: null, errors: e?.graphQLErrors?.length ? e.graphQLErrors : [{ message: e?.message ?? String(e) }] }\n }\n if (this.subject?.id !== id) return\n this.answer = readEntity360Door(response, data => (data?.saasAccount ? data : null))\n }\n\n render() {\n const state = this.answer?.state ?? 'loading'\n const data = this.answer?.data\n const one = data?.saasAccount\n const section = (heading: string, body: unknown, action?: unknown) =>\n html`<ox-entity360-section .heading=${heading} .state=${state} .message=${this.answer?.message ?? ''}>${action ? html`<span slot=\"actions\">${action}</span>` : nothing}${one ? body : nothing}</ox-entity360-section>`\n if (!one) return section(i18next.t('title.saas-account-page'), nothing)\n\n const subs: any[] = data.saasSubscriptions ?? []\n const live = subs.filter(sub => sub.status !== 'CANCELLED')\n const reference = live.map(sub => sub.referenceAmount).filter((value): value is number => value !== null && value !== undefined)\n const changes: any[] = data.saasChanges ?? []\n const nextRenewal = subs\n .filter(sub => sub.status === 'ACTIVE' && sub.renewalOn)\n .map(sub => sub.renewalOn)\n .sort()[0]\n const open = html`<button class=\"quiet\" @click=${() => navigate(`saas-account-page?id=${one.id}`)}>${i18next.t('button.saas-open-account')}</button>`\n const party = (value?: { id: string; name: string }) => (value ? entity360Name({ __typename: 'Counterparty', ...value }, value.name) : '—')\n\n return html`\n ${section(\n one.name,\n html`<dl>\n <dt>${i18next.t('field.saas-account-counterparty')}</dt>\n <dd>${party(one.counterparty)}</dd>\n <dt>${i18next.t('field.saas-account-payment-account')}</dt>\n <dd>${one.paymentAccount?.name ?? '—'}</dd>\n <dt>${i18next.t('field.saas-account-currency')}</dt>\n <dd>${one.currency}</dd>\n <dt>${i18next.t('text.saas-360-next-renewal')}</dt>\n <dd>${nextRenewal ?? '—'}</dd>\n <dt>${i18next.t('field.saas-account-admins')}</dt>\n <dd>${(one.admins ?? []).map((admin: any) => admin.name).join(', ') || '—'}</dd>\n <dt>${i18next.t('field.saas-account-status')}</dt>\n <dd>${wordOf('saas-account-status', one.status)}${one.closedOn ? ` · ${one.closedOn}` : ''}</dd>\n </dl>`,\n open\n )}\n ${section(\n i18next.t('text.saas-tab-subscriptions'),\n subs.length\n ? html`<table>\n ${subs.map(\n sub => html`<tr>\n <td>${sub.name} <span class=\"muted\">${wordOf('saas-billing', sub.billing)} · ${wordOf('saas-subscription-status', sub.status)}</span></td>\n <td class=\"muted\">${sub.billing === 'SEAT' ? i18next.t('text.saas-360-seats', { held: sub.seatsHeld ?? 0, quantity: sub.quantity ?? 0 }) : ''}</td>\n <td>${amountText(sub.referenceAmount)}</td>\n </tr>`\n )}\n ${reference.length\n ? html`<tr>\n <td class=\"muted\">${i18next.t('text.saas-360-reference')}</td>\n <td></td>\n <td>${amountText(reference.reduce((sum, value) => sum + value, 0))} ${one.currency}</td>\n </tr>`\n : nothing}\n </table>`\n : html`<div class=\"muted\">${i18next.t('text.saas-subscriptions-empty')}</div>`\n )}\n ${section(\n i18next.t('text.saas-360-changes'),\n changes.length\n ? html`<table>\n ${changes.map(\n change => html`<tr>\n <td>${String(change.at).slice(0, 10)} <span class=\"muted\">${change.changedBy ?? ''}</span></td>\n <td>${change.subject} · ${i18next.t(`text.saas-change-field-${change.field}`, { defaultValue: change.field })}</td>\n <td>${change.fromValue ?? '—'} → ${change.toValue ?? '—'}</td>\n </tr>`\n )}\n </table>`\n : html`<div class=\"muted\">${i18next.t('text.saas-360-changes-empty')}</div>`\n )}\n `\n }\n}\n"]}
@@ -1 +0,0 @@
1
- export { registerSaasAccount360 } from './entity360/saas-account-360.js';
@@ -1,2 +0,0 @@
1
- export { registerSaasAccount360 } from './entity360/saas-account-360.js';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA","sourcesContent":["export { registerSaasAccount360 } from './entity360/saas-account-360.js'\n"]}
@@ -1,57 +0,0 @@
1
- import '@operato/data-grist/ox-grist.js';
2
- import '@operato/data-grist/ox-filters-form.js';
3
- import { FetchOption } from '@operato/data-grist';
4
- import { PageView } from '@operato/shell';
5
- declare const SaasAccountList_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
6
- /**
7
- * 구독 서비스 — the accounts the domain holds with vendors (ADR-0177 decision 2), typed like a spreadsheet and saved together.
8
- * An account opens to its subscriptions, their seats and its admins. Its money is a recurring item's (개정 7).
9
- */
10
- export declare class SaasAccountList extends SaasAccountList_base {
11
- static styles: import("lit").CSSResult[];
12
- /** Only the accounts the signed-in person administers, opened and not kept here. */
13
- protected mine: boolean;
14
- gristConfig: any;
15
- private grist;
16
- get context(): {
17
- title: string;
18
- search: {
19
- handler: (search: string) => string;
20
- value: string;
21
- };
22
- filter: {
23
- handler: () => void;
24
- };
25
- actions: ({
26
- title: string;
27
- icon: string;
28
- action: () => void;
29
- } | {
30
- icon: string;
31
- emphasis: {
32
- raised: boolean;
33
- outlined: boolean;
34
- dense: boolean;
35
- danger: boolean;
36
- };
37
- title: string;
38
- action: () => Promise<void>;
39
- })[];
40
- exportable: {
41
- name: string;
42
- data: () => any[];
43
- };
44
- };
45
- render(): import("lit-html").TemplateResult<1>;
46
- pageInitialized(): Promise<void>;
47
- fetchHandler({ page, limit, sortings, filters, search }: FetchOption): Promise<{
48
- total: any;
49
- records: any;
50
- }>;
51
- private save;
52
- }
53
- /** 내가 관리하는 구독 서비스 — the accounts the signed-in person is named an admin of, whatever their seat (ADR-0177 Q4). */
54
- export declare class MySaasAccountList extends SaasAccountList {
55
- protected mine: boolean;
56
- }
57
- export {};
@@ -1,169 +0,0 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import '@operato/data-grist/ox-grist.js';
3
- import '@operato/data-grist/ox-filters-form.js';
4
- import gql from 'graphql-tag';
5
- import { html } from 'lit';
6
- import { customElement, query, state } from 'lit/decorators.js';
7
- import { DataGrist, getEditor } from '@operato/data-grist';
8
- import { client } from '@operato/graphql';
9
- import { i18next, localize } from '@operato/i18n';
10
- import { entity360Name } from '@operato/layout';
11
- import { navigate, PageView } from '@operato/shell';
12
- import { CommonButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
13
- import { isMobileDevice } from '@operato/utils';
14
- /* The register grids' save, the asset module's - this module saves its grids the same way. */
15
- import { saveGrid } from '@things-factory/asset/dist-client';
16
- import { ACCOUNT_STATUSES, fieldWord, filterOptionsOf, optionsOf, picker } from '../words.js';
17
- const FIELDS = ['name', 'counterparty', 'identifier', 'parent', 'purpose', 'billingEmail', 'paymentAccount', 'currency', 'secretLocation', 'status', 'closedOn', 'description'];
18
- const ACCOUNT_FIELDS = `
19
- id name counterparty { id name } identifier parent { id name } purpose admins { id name } billingEmail
20
- paymentAccount { id name } currency secretLocation status closedOn description
21
- `;
22
- /**
23
- * 구독 서비스 — the accounts the domain holds with vendors (ADR-0177 decision 2), typed like a spreadsheet and saved together.
24
- * An account opens to its subscriptions, their seats and its admins. Its money is a recurring item's (개정 7).
25
- */
26
- let SaasAccountList = class SaasAccountList extends localize(i18next)(PageView) {
27
- constructor() {
28
- super(...arguments);
29
- /** Only the accounts the signed-in person administers, opened and not kept here. */
30
- this.mine = false;
31
- }
32
- static { this.styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]; }
33
- get context() {
34
- const title = i18next.t(this.mine ? 'title.my-saas-account-list' : 'title.saas-account-list');
35
- return {
36
- title,
37
- search: { handler: (search) => (this.grist.searchText = search), value: this.grist?.searchText || '' },
38
- filter: { handler: () => this.grist.toggleHeadroom() },
39
- actions: this.mine
40
- ? []
41
- : [
42
- { title: i18next.t('button.add'), icon: 'add', action: () => this.grist.addRecordToTop({ currency: 'KRW', status: 'ACTIVE' }) },
43
- { title: i18next.t('button.delete'), action: () => this.save(true), ...CommonButtonStyles.delete },
44
- { title: i18next.t('button.save'), action: () => this.save(), ...CommonButtonStyles.save }
45
- ],
46
- exportable: { name: title, data: () => this.grist.exportRecords() }
47
- };
48
- }
49
- render() {
50
- return html `<ox-grist class="page-fill" search-mode="term" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
51
- <div slot="headroom" class="header">
52
- <div class="filters"><ox-filters-form without-search autofocus></ox-filters-form></div>
53
- </div>
54
- </ox-grist>`;
55
- }
56
- async pageInitialized() {
57
- const editable = { editable: !this.mine };
58
- const text = (name, width, extra = {}) => ({ type: 'string', name, header: fieldWord('saas-account', name), width, sortable: true, ...extra, record: { ...editable, ...extra.record } });
59
- const object = (name, width, queryName, columns) => ({
60
- type: 'object',
61
- name,
62
- header: fieldWord('saas-account', name),
63
- width,
64
- record: { ...editable, editor: getEditor('resource-object'), options: picker(queryName, columns) }
65
- });
66
- const open = (record) => record?.id && navigate(`saas-account-page?id=${record.id}`);
67
- this.gristConfig = {
68
- rows: { appendable: !this.mine, selectable: { multiple: !this.mine } },
69
- pagination: { limit: 100, pages: [50, 100] },
70
- emptyNote: {
71
- title: i18next.t(this.mine ? 'text.my-saas-account-empty' : 'text.saas-account-empty'),
72
- description: i18next.t(this.mine ? 'text.my-saas-account-empty-description' : 'text.saas-account-empty-description')
73
- },
74
- list: { fields: ['name', 'identifier'], details: ['purpose', 'admins'] },
75
- columns: [
76
- { type: 'gutter', gutterName: 'sequence' },
77
- ...(this.mine ? [] : [{ type: 'gutter', gutterName: 'row-selector', multiple: true }]),
78
- { type: 'gutter', gutterName: 'button', icon: 'open_in_new', handlers: { click: (_c, _d, _col, record) => open(record) } },
79
- /* The name opens the account's 360 (ADR-0067); a new row is typed into. */
80
- text('name', 180, { record: { mandatory: true, renderer: (value, _c, record) => (record?.id ? entity360Name({ __typename: 'SaasAccount', ...record }, value) : value ?? '') } }),
81
- object('counterparty', 150, 'counterpartyChoices', [{ name: 'name', header: fieldWord('saas-account', 'counterparty') }]),
82
- text('identifier', 150),
83
- object('parent', 140, 'saasAccounts', [{ name: 'name', header: fieldWord('saas-account', 'parent') }]),
84
- text('purpose', 120),
85
- {
86
- type: 'string',
87
- name: 'admins',
88
- header: fieldWord('saas-account', 'admins'),
89
- width: 160,
90
- record: { renderer: (value) => (value ?? []).map(one => one.name).join(', ') }
91
- },
92
- object('paymentAccount', 150, 'bankAccounts', [{ name: 'name', header: fieldWord('saas-account', 'paymentAccount') }]),
93
- text('currency', 60, { record: { align: 'center' } }),
94
- text('billingEmail', 160, { hidden: true }),
95
- text('secretLocation', 160),
96
- {
97
- type: 'select',
98
- name: 'status',
99
- header: fieldWord('saas-account', 'status'),
100
- width: 80,
101
- sortable: true,
102
- record: { ...editable, options: optionsOf('saas-account-status', ACCOUNT_STATUSES) },
103
- filter: { type: 'select', operator: 'eq', options: filterOptionsOf('saas-account-status', ACCOUNT_STATUSES) }
104
- },
105
- text('closedOn', 100, { record: { align: 'center' } }),
106
- text('description', 200)
107
- ],
108
- sorters: [{ name: 'name' }]
109
- };
110
- }
111
- async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [], search }) {
112
- if (this.mine) {
113
- const response = await client.query({ query: gql `query { rows: mySaasAccounts { ${ACCOUNT_FIELDS} } }`, fetchPolicy: 'network-only' });
114
- if (response.errors?.length)
115
- throw response;
116
- return { total: response.data.rows.length, records: response.data.rows };
117
- }
118
- const response = await client.query({
119
- query: gql `
120
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $search: String) {
121
- responses: saasAccounts(filters: $filters, pagination: $pagination, sortings: $sortings, search: $search) {
122
- items { ${ACCOUNT_FIELDS} }
123
- total
124
- }
125
- }
126
- `,
127
- variables: { filters, pagination: { page, limit }, sortings, search: search?.trim() || undefined },
128
- fetchPolicy: 'network-only'
129
- });
130
- if (response.errors?.length)
131
- throw response;
132
- return { total: response.data.responses.total, records: response.data.responses.items };
133
- }
134
- async save(deleting = false) {
135
- /* A picked row goes as its id. */
136
- const shape = ({ counterparty, parent, paymentAccount, ...patch }) => ({
137
- ...patch,
138
- ...(counterparty === undefined ? {} : { counterpartyId: counterparty?.id ?? null }),
139
- ...(parent === undefined ? {} : { parentId: parent?.id ?? null }),
140
- ...(paymentAccount === undefined ? {} : { paymentAccountId: paymentAccount?.id ?? null })
141
- });
142
- if (await saveGrid(this.grist, FIELDS, 'updateMultipleSaasAccount', 'SaasAccountPatch', {}, deleting, shape))
143
- this.grist.fetch();
144
- }
145
- };
146
- __decorate([
147
- state(),
148
- __metadata("design:type", Object)
149
- ], SaasAccountList.prototype, "gristConfig", void 0);
150
- __decorate([
151
- query('ox-grist'),
152
- __metadata("design:type", DataGrist)
153
- ], SaasAccountList.prototype, "grist", void 0);
154
- SaasAccountList = __decorate([
155
- customElement('saas-account-list')
156
- ], SaasAccountList);
157
- export { SaasAccountList };
158
- /** 내가 관리하는 구독 서비스 — the accounts the signed-in person is named an admin of, whatever their seat (ADR-0177 Q4). */
159
- let MySaasAccountList = class MySaasAccountList extends SaasAccountList {
160
- constructor() {
161
- super(...arguments);
162
- this.mine = true;
163
- }
164
- };
165
- MySaasAccountList = __decorate([
166
- customElement('my-saas-account-list')
167
- ], MySaasAccountList);
168
- export { MySaasAccountList };
169
- //# sourceMappingURL=saas-account-list.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"saas-account-list.js","sourceRoot":"","sources":["../../client/pages/saas-account-list.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAE/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EAAE,SAAS,EAAe,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AACnI,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,8FAA8F;AAC9F,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAA;AAE5D,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAE7F,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAA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AAE,IAAI,IAAI,EAAE,CAAC;YACnF,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC;YACjE,GAAG,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,cAAc,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC;SAC1F,CAAC,CAAA;QACF,IAAI,MAAM,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC;YAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IAClI,CAAC;;AAnHQ;IAAR,KAAK,EAAE;;oDAAiB;AACE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;8CAAA;AAPjC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA0H3B;;AAED,kHAAkH;AAE3G,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,eAAe;IAA/C;;QACK,SAAI,GAAG,IAAI,CAAA;IACvB,CAAC;CAAA,CAAA;AAFY,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CAE7B","sourcesContent":["import '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\n\nimport gql from 'graphql-tag'\nimport { html } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { DataGrist, FetchOption, getEditor } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { entity360Name } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n/* The register grids' save, the asset module's - this module saves its grids the same way. */\nimport { saveGrid } from '@things-factory/asset/dist-client'\n\nimport { ACCOUNT_STATUSES, fieldWord, filterOptionsOf, optionsOf, picker } from '../words.js'\n\nconst FIELDS = ['name', 'counterparty', 'identifier', 'parent', 'purpose', 'billingEmail', 'paymentAccount', 'currency', 'secretLocation', 'status', 'closedOn', 'description']\nconst ACCOUNT_FIELDS = `\n id name counterparty { id name } identifier parent { id name } purpose admins { id name } billingEmail\n paymentAccount { id name } currency secretLocation status closedOn description\n`\n\n/**\n * 구독 서비스 — the accounts the domain holds with vendors (ADR-0177 decision 2), typed like a spreadsheet and saved together.\n * An account opens to its subscriptions, their seats and its admins. Its money is a recurring item's (개정 7).\n */\n@customElement('saas-account-list')\nexport class SaasAccountList extends localize(i18next)(PageView) {\n static styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]\n\n /** Only the accounts the signed-in person administers, opened and not kept here. */\n protected mine = false\n\n @state() gristConfig: any\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n const title = i18next.t(this.mine ? 'title.my-saas-account-list' : 'title.saas-account-list')\n return {\n title,\n search: { handler: (search: string) => (this.grist.searchText = search), value: this.grist?.searchText || '' },\n filter: { handler: () => this.grist.toggleHeadroom() },\n actions: this.mine\n ? []\n : [\n { title: i18next.t('button.add'), icon: 'add', action: () => this.grist.addRecordToTop({ currency: 'KRW', status: 'ACTIVE' }) },\n { title: i18next.t('button.delete'), action: () => this.save(true), ...CommonButtonStyles.delete },\n { title: i18next.t('button.save'), action: () => this.save(), ...CommonButtonStyles.save }\n ],\n exportable: { name: title, data: () => this.grist.exportRecords() }\n }\n }\n\n render() {\n return html`<ox-grist class=\"page-fill\" search-mode=\"term\" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\"><ox-filters-form without-search autofocus></ox-filters-form></div>\n </div>\n </ox-grist>`\n }\n\n async pageInitialized() {\n const editable = { editable: !this.mine }\n const text = (name: string, width: number, extra: any = {}) => ({ type: 'string', name, header: fieldWord('saas-account', name), width, sortable: true, ...extra, record: { ...editable, ...extra.record } })\n const object = (name: string, width: number, queryName: string, columns: { name: string; header?: string }[]) => ({\n type: 'object',\n name,\n header: fieldWord('saas-account', name),\n width,\n record: { ...editable, editor: getEditor('resource-object'), options: picker(queryName, columns) }\n })\n const open = (record: any) => record?.id && navigate(`saas-account-page?id=${record.id}`)\n this.gristConfig = {\n rows: { appendable: !this.mine, selectable: { multiple: !this.mine } },\n pagination: { limit: 100, pages: [50, 100] },\n emptyNote: {\n title: i18next.t(this.mine ? 'text.my-saas-account-empty' : 'text.saas-account-empty'),\n description: i18next.t(this.mine ? 'text.my-saas-account-empty-description' : 'text.saas-account-empty-description')\n },\n list: { fields: ['name', 'identifier'], details: ['purpose', 'admins'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n ...(this.mine ? [] : [{ type: 'gutter', gutterName: 'row-selector', multiple: true }]),\n { type: 'gutter', gutterName: 'button', icon: 'open_in_new', handlers: { click: (_c: any, _d: any, _col: any, record: any) => open(record) } },\n /* The name opens the account's 360 (ADR-0067); a new row is typed into. */\n text('name', 180, { record: { mandatory: true, renderer: (value: string, _c: any, record: any) => (record?.id ? entity360Name({ __typename: 'SaasAccount', ...record }, value) : value ?? '') } }),\n object('counterparty', 150, 'counterpartyChoices', [{ name: 'name', header: fieldWord('saas-account', 'counterparty') }]),\n text('identifier', 150),\n object('parent', 140, 'saasAccounts', [{ name: 'name', header: fieldWord('saas-account', 'parent') }]),\n text('purpose', 120),\n {\n type: 'string',\n name: 'admins',\n header: fieldWord('saas-account', 'admins'),\n width: 160,\n record: { renderer: (value: any[]) => (value ?? []).map(one => one.name).join(', ') }\n },\n object('paymentAccount', 150, 'bankAccounts', [{ name: 'name', header: fieldWord('saas-account', 'paymentAccount') }]),\n text('currency', 60, { record: { align: 'center' } }),\n text('billingEmail', 160, { hidden: true }),\n text('secretLocation', 160),\n {\n type: 'select',\n name: 'status',\n header: fieldWord('saas-account', 'status'),\n width: 80,\n sortable: true,\n record: { ...editable, options: optionsOf('saas-account-status', ACCOUNT_STATUSES) },\n filter: { type: 'select', operator: 'eq', options: filterOptionsOf('saas-account-status', ACCOUNT_STATUSES) }\n },\n text('closedOn', 100, { record: { align: 'center' } }),\n text('description', 200)\n ],\n sorters: [{ name: 'name' }]\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [], search }: FetchOption) {\n if (this.mine) {\n const response = await client.query({ query: gql`query { rows: mySaasAccounts { ${ACCOUNT_FIELDS} } }`, fetchPolicy: 'network-only' })\n if (response.errors?.length) throw response\n return { total: response.data.rows.length, records: response.data.rows }\n }\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $search: String) {\n responses: saasAccounts(filters: $filters, pagination: $pagination, sortings: $sortings, search: $search) {\n items { ${ACCOUNT_FIELDS} }\n total\n }\n }\n `,\n variables: { filters, pagination: { page, limit }, sortings, search: search?.trim() || undefined },\n fetchPolicy: 'network-only'\n })\n if (response.errors?.length) throw response\n return { total: response.data.responses.total, records: response.data.responses.items }\n }\n\n private async save(deleting = false) {\n /* A picked row goes as its id. */\n const shape = ({ counterparty, parent, paymentAccount, ...patch }: any) => ({\n ...patch,\n ...(counterparty === undefined ? {} : { counterpartyId: counterparty?.id ?? null }),\n ...(parent === undefined ? {} : { parentId: parent?.id ?? null }),\n ...(paymentAccount === undefined ? {} : { paymentAccountId: paymentAccount?.id ?? null })\n })\n if (await saveGrid(this.grist, FIELDS, 'updateMultipleSaasAccount', 'SaasAccountPatch', {}, deleting, shape)) this.grist.fetch()\n }\n}\n\n/** 내가 관리하는 구독 서비스 — the accounts the signed-in person is named an admin of, whatever their seat (ADR-0177 Q4). */\n@customElement('my-saas-account-list')\nexport class MySaasAccountList extends SaasAccountList {\n protected mine = true\n}\n"]}
@@ -1,52 +0,0 @@
1
- import '@operato/data-grist/ox-grist.js';
2
- import { PageView } from '@operato/shell';
3
- type Tab = 'subscriptions' | 'seats' | 'admins';
4
- declare const SaasAccountPage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
5
- /**
6
- * 구독 서비스 한 계정 — tab by tab its subscriptions, the seats of one of them and who administers it (ADR-0177 decisions
7
- * 2-6; its money is a recurring item's, 개정 7). The keepers keep all of it; an admin keeps what is under their own account, not the account
8
- * or its admins.
9
- */
10
- export declare class SaasAccountPage extends SaasAccountPage_base {
11
- static styles: import("lit").CSSResult[];
12
- accountId: string;
13
- account?: any;
14
- subscriptions: any[];
15
- subscriptionId: string;
16
- tab: Tab;
17
- keeper: boolean;
18
- gristConfig: any;
19
- private grist;
20
- get context(): {
21
- title: any;
22
- actions: ({
23
- title: string;
24
- icon: string;
25
- action: () => void;
26
- } | {
27
- icon: string;
28
- emphasis: {
29
- raised: boolean;
30
- outlined: boolean;
31
- dense: boolean;
32
- danger: boolean;
33
- };
34
- title: string;
35
- action: () => Promise<void>;
36
- })[];
37
- };
38
- pageUpdated(changes: any, lifecycle: any): Promise<void>;
39
- private seatPlans;
40
- private read;
41
- private blank;
42
- render(): import("lit-html").TemplateResult<1>;
43
- private configOf;
44
- fetchHandler(): Promise<{
45
- total: any;
46
- records: any;
47
- }>;
48
- private save;
49
- /** The admins are a field of the account - the grid's rows, less the deleted, saved as its list. */
50
- private saveAdmins;
51
- }
52
- export {};