@things-factory/saas 0.0.0-stage → 10.1.234
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/README.md +19 -2
- package/dist-client/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +5 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/components/saas-bill-editor.d.ts +59 -0
- package/dist-client/components/saas-bill-editor.js +211 -0
- package/dist-client/components/saas-bill-editor.js.map +1 -0
- package/dist-client/entity360/saas-account-360.d.ts +12 -0
- package/dist-client/entity360/saas-account-360.js +231 -0
- package/dist-client/entity360/saas-account-360.js.map +1 -0
- package/dist-client/index.d.ts +3 -0
- package/dist-client/index.js +4 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/saas-account-list.d.ts +57 -0
- package/dist-client/pages/saas-account-list.js +175 -0
- package/dist-client/pages/saas-account-list.js.map +1 -0
- package/dist-client/pages/saas-account-page.d.ts +54 -0
- package/dist-client/pages/saas-account-page.js +352 -0
- package/dist-client/pages/saas-account-page.js.map +1 -0
- package/dist-client/pages/saas-cost-trend.d.ts +23 -0
- package/dist-client/pages/saas-cost-trend.js +219 -0
- package/dist-client/pages/saas-cost-trend.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +16 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-client/words.d.ts +47 -0
- package/dist-client/words.js +39 -0
- package/dist-client/words.js.map +1 -0
- package/dist-server/index.d.ts +1 -0
- package/dist-server/index.js +9 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/role-tasks.d.ts +2 -0
- package/dist-server/role-tasks.js +16 -0
- package/dist-server/role-tasks.js.map +1 -0
- package/dist-server/service/checks.d.ts +32 -0
- package/dist-server/service/checks.js +83 -0
- package/dist-server/service/checks.js.map +1 -0
- package/dist-server/service/index.d.ts +20 -0
- package/dist-server/service/index.js +38 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/saas-access.d.ts +20 -0
- package/dist-server/service/saas-access.js +36 -0
- package/dist-server/service/saas-access.js.map +1 -0
- package/dist-server/service/saas-account.d.ts +43 -0
- package/dist-server/service/saas-account.js +166 -0
- package/dist-server/service/saas-account.js.map +1 -0
- package/dist-server/service/saas-bill.d.ts +41 -0
- package/dist-server/service/saas-bill.js +160 -0
- package/dist-server/service/saas-bill.js.map +1 -0
- package/dist-server/service/saas-mutation.d.ts +12 -0
- package/dist-server/service/saas-mutation.js +103 -0
- package/dist-server/service/saas-mutation.js.map +1 -0
- package/dist-server/service/saas-query.d.ts +69 -0
- package/dist-server/service/saas-query.js +215 -0
- package/dist-server/service/saas-query.js.map +1 -0
- package/dist-server/service/saas-rules.d.ts +138 -0
- package/dist-server/service/saas-rules.js +217 -0
- package/dist-server/service/saas-rules.js.map +1 -0
- package/dist-server/service/saas-seat.d.ts +25 -0
- package/dist-server/service/saas-seat.js +105 -0
- package/dist-server/service/saas-seat.js.map +1 -0
- package/dist-server/service/saas-service.d.ts +119 -0
- package/dist-server/service/saas-service.js +492 -0
- package/dist-server/service/saas-service.js.map +1 -0
- package/dist-server/service/saas-subscription.d.ts +44 -0
- package/dist-server/service/saas-subscription.js +174 -0
- package/dist-server/service/saas-subscription.js.map +1 -0
- package/dist-server/service/saas-trend-type.d.ts +9 -0
- package/dist-server/service/saas-trend-type.js +37 -0
- package/dist-server/service/saas-trend-type.js.map +1 -0
- package/dist-server/service/saas-type.d.ts +113 -0
- package/dist-server/service/saas-type.js +430 -0
- package/dist-server/service/saas-type.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/package.json +49 -4
- package/things-factory.config.js +13 -0
- package/translations/en.json +185 -0
- package/translations/es.json +185 -0
- package/translations/ja.json +185 -0
- package/translations/ko.json +185 -0
- package/translations/ms.json +185 -0
- package/translations/zh.json +185 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA","sourcesContent":["export { SaasBillEditor } from './components/saas-bill-editor.js'\nexport { registerSaasAccount360 } from './entity360/saas-account-360.js'\nexport { trendTitle } from './words.js'\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
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, its admins and its bills.
|
|
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 {};
|
|
@@ -0,0 +1,175 @@
|
|
|
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/grid.js';
|
|
16
|
+
import { ACCOUNT_STATUSES, fieldWord, filterOptionsOf, optionsOf, picker, trendTitle } from '../words.js';
|
|
17
|
+
const FIELDS = ['name', 'counterparty', 'identifier', 'parent', 'purpose', 'billingEmail', 'paymentAccount', 'currency', 'billingDay', 'secretLocation', 'increaseAlertRate', '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 billingDay secretLocation increaseAlertRate status closedOn description
|
|
21
|
+
trend { months values nextMonths expected currency }
|
|
22
|
+
`;
|
|
23
|
+
/**
|
|
24
|
+
* 구독 서비스 — the accounts the domain holds with vendors (ADR-0177 decision 2), typed like a spreadsheet and saved together.
|
|
25
|
+
* An account opens to its subscriptions, their seats, its admins and its bills.
|
|
26
|
+
*/
|
|
27
|
+
let SaasAccountList = class SaasAccountList extends localize(i18next)(PageView) {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
/** Only the accounts the signed-in person administers, opened and not kept here. */
|
|
31
|
+
this.mine = false;
|
|
32
|
+
}
|
|
33
|
+
static { this.styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]; }
|
|
34
|
+
get context() {
|
|
35
|
+
const title = i18next.t(this.mine ? 'title.my-saas-account-list' : 'title.saas-account-list');
|
|
36
|
+
return {
|
|
37
|
+
title,
|
|
38
|
+
search: { handler: (search) => (this.grist.searchText = search), value: this.grist?.searchText || '' },
|
|
39
|
+
filter: { handler: () => this.grist.toggleHeadroom() },
|
|
40
|
+
actions: this.mine
|
|
41
|
+
? []
|
|
42
|
+
: [
|
|
43
|
+
{ title: i18next.t('button.saas-cost-trend'), icon: 'monitoring', action: () => navigate('saas-cost-trend') },
|
|
44
|
+
{ title: i18next.t('button.add'), icon: 'add', action: () => this.grist.addRecordToTop({ currency: 'KRW', status: 'ACTIVE' }) },
|
|
45
|
+
{ title: i18next.t('button.delete'), action: () => this.save(true), ...CommonButtonStyles.delete },
|
|
46
|
+
{ title: i18next.t('button.save'), action: () => this.save(), ...CommonButtonStyles.save }
|
|
47
|
+
],
|
|
48
|
+
exportable: { name: title, data: () => this.grist.exportRecords() }
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
render() {
|
|
52
|
+
return html `<ox-grist class="page-fill" search-mode="term" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
53
|
+
<div slot="headroom" class="header">
|
|
54
|
+
<div class="filters"><ox-filters-form without-search autofocus></ox-filters-form></div>
|
|
55
|
+
</div>
|
|
56
|
+
</ox-grist>`;
|
|
57
|
+
}
|
|
58
|
+
async pageInitialized() {
|
|
59
|
+
const editable = { editable: !this.mine };
|
|
60
|
+
const text = (name, width, extra = {}) => ({ type: 'string', name, header: fieldWord('saas-account', name), width, sortable: true, ...extra, record: { ...editable, ...extra.record } });
|
|
61
|
+
const object = (name, width, queryName, columns) => ({
|
|
62
|
+
type: 'object',
|
|
63
|
+
name,
|
|
64
|
+
header: fieldWord('saas-account', name),
|
|
65
|
+
width,
|
|
66
|
+
record: { ...editable, editor: getEditor('resource-object'), options: picker(queryName, columns) }
|
|
67
|
+
});
|
|
68
|
+
const open = (record) => record?.id && navigate(`saas-account-page?id=${record.id}`);
|
|
69
|
+
this.gristConfig = {
|
|
70
|
+
rows: { appendable: !this.mine, selectable: { multiple: !this.mine } },
|
|
71
|
+
pagination: { limit: 100, pages: [50, 100] },
|
|
72
|
+
emptyNote: {
|
|
73
|
+
title: i18next.t(this.mine ? 'text.my-saas-account-empty' : 'text.saas-account-empty'),
|
|
74
|
+
description: i18next.t(this.mine ? 'text.my-saas-account-empty-description' : 'text.saas-account-empty-description')
|
|
75
|
+
},
|
|
76
|
+
list: { fields: ['name', 'identifier'], details: ['purpose', 'admins'] },
|
|
77
|
+
columns: [
|
|
78
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
79
|
+
...(this.mine ? [] : [{ type: 'gutter', gutterName: 'row-selector', multiple: true }]),
|
|
80
|
+
{ type: 'gutter', gutterName: 'button', icon: 'open_in_new', handlers: { click: (_c, _d, _col, record) => open(record) } },
|
|
81
|
+
/* The name opens the account's 360 (ADR-0067); a new row is typed into. */
|
|
82
|
+
text('name', 180, { record: { mandatory: true, renderer: (value, _c, record) => (record?.id ? entity360Name({ __typename: 'SaasAccount', ...record }, value) : value ?? '') } }),
|
|
83
|
+
/* The last twelve months billed, the next three expected dashed (ADR-0177 decision 10). */
|
|
84
|
+
{ type: 'sparkline', name: 'trend', header: fieldWord('saas-account', 'trend'), width: 120, record: { options: { title: (value) => trendTitle(value) } } },
|
|
85
|
+
object('counterparty', 150, 'counterpartyChoices', [{ name: 'name', header: fieldWord('saas-account', 'counterparty') }]),
|
|
86
|
+
text('identifier', 150),
|
|
87
|
+
object('parent', 140, 'saasAccounts', [{ name: 'name', header: fieldWord('saas-account', 'parent') }]),
|
|
88
|
+
text('purpose', 120),
|
|
89
|
+
{
|
|
90
|
+
type: 'string',
|
|
91
|
+
name: 'admins',
|
|
92
|
+
header: fieldWord('saas-account', 'admins'),
|
|
93
|
+
width: 160,
|
|
94
|
+
record: { renderer: (value) => (value ?? []).map(one => one.name).join(', ') }
|
|
95
|
+
},
|
|
96
|
+
object('paymentAccount', 150, 'bankAccounts', [{ name: 'name', header: fieldWord('saas-account', 'paymentAccount') }]),
|
|
97
|
+
text('currency', 60, { record: { align: 'center' } }),
|
|
98
|
+
{ type: 'integer', name: 'billingDay', header: fieldWord('saas-account', 'billingDay'), width: 70, record: { ...editable, align: 'right' } },
|
|
99
|
+
{ type: 'float', name: 'increaseAlertRate', header: fieldWord('saas-account', 'increaseAlertRate'), width: 80, hidden: true, record: { ...editable, align: 'right' } },
|
|
100
|
+
text('billingEmail', 160, { hidden: true }),
|
|
101
|
+
text('secretLocation', 160),
|
|
102
|
+
{
|
|
103
|
+
type: 'select',
|
|
104
|
+
name: 'status',
|
|
105
|
+
header: fieldWord('saas-account', 'status'),
|
|
106
|
+
width: 80,
|
|
107
|
+
sortable: true,
|
|
108
|
+
record: { ...editable, options: optionsOf('saas-account-status', ACCOUNT_STATUSES) },
|
|
109
|
+
filter: { type: 'select', operator: 'eq', options: filterOptionsOf('saas-account-status', ACCOUNT_STATUSES) }
|
|
110
|
+
},
|
|
111
|
+
text('closedOn', 100, { record: { align: 'center' } }),
|
|
112
|
+
text('description', 200)
|
|
113
|
+
],
|
|
114
|
+
sorters: [{ name: 'name' }]
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [], search }) {
|
|
118
|
+
if (this.mine) {
|
|
119
|
+
const response = await client.query({ query: gql `query { rows: mySaasAccounts { ${ACCOUNT_FIELDS} } }`, fetchPolicy: 'network-only' });
|
|
120
|
+
if (response.errors?.length)
|
|
121
|
+
throw response;
|
|
122
|
+
return { total: response.data.rows.length, records: response.data.rows };
|
|
123
|
+
}
|
|
124
|
+
const response = await client.query({
|
|
125
|
+
query: gql `
|
|
126
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $search: String) {
|
|
127
|
+
responses: saasAccounts(filters: $filters, pagination: $pagination, sortings: $sortings, search: $search) {
|
|
128
|
+
items { ${ACCOUNT_FIELDS} }
|
|
129
|
+
total
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
`,
|
|
133
|
+
variables: { filters, pagination: { page, limit }, sortings, search: search?.trim() || undefined },
|
|
134
|
+
fetchPolicy: 'network-only'
|
|
135
|
+
});
|
|
136
|
+
if (response.errors?.length)
|
|
137
|
+
throw response;
|
|
138
|
+
return { total: response.data.responses.total, records: response.data.responses.items };
|
|
139
|
+
}
|
|
140
|
+
async save(deleting = false) {
|
|
141
|
+
/* A picked row goes as its id. */
|
|
142
|
+
const shape = ({ counterparty, parent, paymentAccount, ...patch }) => ({
|
|
143
|
+
...patch,
|
|
144
|
+
...(counterparty === undefined ? {} : { counterpartyId: counterparty?.id ?? null }),
|
|
145
|
+
...(parent === undefined ? {} : { parentId: parent?.id ?? null }),
|
|
146
|
+
...(paymentAccount === undefined ? {} : { paymentAccountId: paymentAccount?.id ?? null })
|
|
147
|
+
});
|
|
148
|
+
if (await saveGrid(this.grist, FIELDS, 'updateMultipleSaasAccount', 'SaasAccountPatch', {}, deleting, shape))
|
|
149
|
+
this.grist.fetch();
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
__decorate([
|
|
153
|
+
state(),
|
|
154
|
+
__metadata("design:type", Object)
|
|
155
|
+
], SaasAccountList.prototype, "gristConfig", void 0);
|
|
156
|
+
__decorate([
|
|
157
|
+
query('ox-grist'),
|
|
158
|
+
__metadata("design:type", DataGrist)
|
|
159
|
+
], SaasAccountList.prototype, "grist", void 0);
|
|
160
|
+
SaasAccountList = __decorate([
|
|
161
|
+
customElement('saas-account-list')
|
|
162
|
+
], SaasAccountList);
|
|
163
|
+
export { SaasAccountList };
|
|
164
|
+
/** 내가 관리하는 구독 서비스 — the accounts the signed-in person is named an admin of, whatever their seat (ADR-0177 Q4). */
|
|
165
|
+
let MySaasAccountList = class MySaasAccountList extends SaasAccountList {
|
|
166
|
+
constructor() {
|
|
167
|
+
super(...arguments);
|
|
168
|
+
this.mine = true;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
MySaasAccountList = __decorate([
|
|
172
|
+
customElement('my-saas-account-list')
|
|
173
|
+
], MySaasAccountList);
|
|
174
|
+
export { MySaasAccountList };
|
|
175
|
+
//# sourceMappingURL=saas-account-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,EAA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vB,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/grid.js'\n\nimport { ACCOUNT_STATUSES, fieldWord, filterOptionsOf, optionsOf, picker, trendTitle } from '../words.js'\n\nconst FIELDS = ['name', 'counterparty', 'identifier', 'parent', 'purpose', 'billingEmail', 'paymentAccount', 'currency', 'billingDay', 'secretLocation', 'increaseAlertRate', '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 billingDay secretLocation increaseAlertRate status closedOn description\n trend { months values nextMonths expected currency }\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, its admins and its bills.\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.saas-cost-trend'), icon: 'monitoring', action: () => navigate('saas-cost-trend') },\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 /* The last twelve months billed, the next three expected dashed (ADR-0177 decision 10). */\n { type: 'sparkline', name: 'trend', header: fieldWord('saas-account', 'trend'), width: 120, record: { options: { title: (value: any) => trendTitle(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 { type: 'integer', name: 'billingDay', header: fieldWord('saas-account', 'billingDay'), width: 70, record: { ...editable, align: 'right' } },\n { type: 'float', name: 'increaseAlertRate', header: fieldWord('saas-account', 'increaseAlertRate'), width: 80, hidden: true, record: { ...editable, align: 'right' } },\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"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import '@operato/data-grist/ox-grist.js';
|
|
2
|
+
import '../components/saas-bill-editor.js';
|
|
3
|
+
import { PageView } from '@operato/shell';
|
|
4
|
+
type Tab = 'subscriptions' | 'seats' | 'bills' | 'admins';
|
|
5
|
+
declare const SaasAccountPage_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
|
|
6
|
+
/**
|
|
7
|
+
* 구독 서비스 한 계정 — tab by tab its subscriptions, the seats of one of them, its bills month by month and who administers
|
|
8
|
+
* it (ADR-0177 decisions 2-6). The keepers keep all of it; an admin keeps what is under their own account, not the account
|
|
9
|
+
* or its admins.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SaasAccountPage extends SaasAccountPage_base {
|
|
12
|
+
static styles: import("lit").CSSResult[];
|
|
13
|
+
accountId: string;
|
|
14
|
+
account?: any;
|
|
15
|
+
subscriptions: any[];
|
|
16
|
+
subscriptionId: string;
|
|
17
|
+
tab: Tab;
|
|
18
|
+
keeper: boolean;
|
|
19
|
+
gristConfig: any;
|
|
20
|
+
private grist;
|
|
21
|
+
get context(): {
|
|
22
|
+
title: any;
|
|
23
|
+
actions: ({
|
|
24
|
+
title: string;
|
|
25
|
+
icon: string;
|
|
26
|
+
action: () => void;
|
|
27
|
+
} | {
|
|
28
|
+
icon: string;
|
|
29
|
+
emphasis: {
|
|
30
|
+
raised: boolean;
|
|
31
|
+
outlined: boolean;
|
|
32
|
+
dense: boolean;
|
|
33
|
+
danger: boolean;
|
|
34
|
+
};
|
|
35
|
+
title: string;
|
|
36
|
+
action: () => Promise<void>;
|
|
37
|
+
})[];
|
|
38
|
+
};
|
|
39
|
+
pageUpdated(changes: any, lifecycle: any): Promise<void>;
|
|
40
|
+
private seatPlans;
|
|
41
|
+
private read;
|
|
42
|
+
private blank;
|
|
43
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
44
|
+
private configOf;
|
|
45
|
+
fetchHandler(): Promise<{
|
|
46
|
+
total: any;
|
|
47
|
+
records: any;
|
|
48
|
+
}>;
|
|
49
|
+
private openBill;
|
|
50
|
+
private save;
|
|
51
|
+
/** The admins are a field of the account - the grid's rows, less the deleted, saved as its list. */
|
|
52
|
+
private saveAdmins;
|
|
53
|
+
}
|
|
54
|
+
export {};
|