@phis/ui 0.7.5 → 0.7.8

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 (158) hide show
  1. package/components/controls/phi-form-control.d.ts +3 -1
  2. package/components/controls/phi-form-control.js +15 -4
  3. package/components/forms/auth-admin-settings-labels.d.ts +1 -1
  4. package/components/forms/auth-admin-settings-labels.js +2 -2
  5. package/components/forms/extended-form-field-controls.d.ts +1 -1
  6. package/components/forms/extended-form-field-controls.js +23 -7
  7. package/components/forms/form-descriptor-contract.d.ts +1 -1
  8. package/components/forms/form-descriptor-contract.js +1 -1
  9. package/components/forms/form-descriptor-runtime-client.d.ts +4 -1
  10. package/components/forms/form-descriptor-runtime-client.js +33 -11
  11. package/components/forms/form-media-limits.d.ts +12 -0
  12. package/components/forms/form-media-limits.js +14 -0
  13. package/components/forms/form-provider-contract.d.ts +5 -0
  14. package/components/forms/form-provider-contract.js +9 -2
  15. package/components/forms/form-provider-registry.d.ts +14 -0
  16. package/components/forms/form-record-title.d.ts +14 -0
  17. package/components/forms/form-record-title.js +38 -0
  18. package/components/forms/form-widget-config.d.ts +3 -0
  19. package/components/forms/form-widget-config.js +2 -0
  20. package/components/forms/money-field-currency-key.d.ts +6 -0
  21. package/components/forms/money-field-currency-key.js +14 -0
  22. package/components/forms/money-field.d.ts +26 -3
  23. package/components/forms/money-field.js +54 -4
  24. package/components/forms/phi-form-widget.d.ts +1 -1
  25. package/components/forms/phi-form-widget.js +4 -0
  26. package/components/overlays/phi-overlay-container-client.js +8 -8
  27. package/components/overlays/phi-overlay-title.d.ts +7 -0
  28. package/components/overlays/phi-overlay-title.js +21 -0
  29. package/components/regions/presets/navigation-redirect.d.ts +4 -1
  30. package/components/regions/presets/navigation-redirect.js +6 -3
  31. package/components/tables/client/phi-table-binding.d.ts +3 -1
  32. package/components/tables/client/phi-table-binding.js +90 -49
  33. package/components/tables/client/phi-table-filter-options.d.ts +27 -0
  34. package/components/tables/client/phi-table-filter-options.js +35 -0
  35. package/components/widgets/accessible-areas.d.ts +1 -1
  36. package/components/widgets/accessible-areas.js +1 -1
  37. package/components/widgets/client/shared/phi-rendered-value.d.ts +10 -0
  38. package/components/widgets/client/shared/phi-rendered-value.js +54 -4
  39. package/components/widgets/client/shared/phi-table-provider.d.ts +10 -1
  40. package/components/widgets/client/shared/phi-table-provider.js +22 -0
  41. package/components/widgets/label-sets/admin-users.d.ts +15 -0
  42. package/components/widgets/label-sets/admin-users.js +31 -0
  43. package/constants/core-data-provider-keys.d.ts +7 -0
  44. package/constants/core-data-provider-keys.js +7 -0
  45. package/constants/phi-base-role-metadata.d.ts +2 -2
  46. package/constants/phi-base-role-metadata.js +1 -1
  47. package/constants/runtime-module-ownership.js +3 -0
  48. package/forms.d.ts +1 -1
  49. package/forms.js +1 -1
  50. package/gateway/capability-media-limits.d.ts +10 -0
  51. package/gateway/capability-media-limits.js +40 -0
  52. package/gateway/server-capabilities.js +4 -0
  53. package/helpers/money-amount.d.ts +7 -0
  54. package/helpers/money-amount.js +15 -0
  55. package/helpers/preset-tree-contract-check.d.ts +3 -2
  56. package/helpers/preset-tree-contract-check.js +60 -0
  57. package/helpers/record-title.d.ts +7 -0
  58. package/helpers/record-title.js +25 -0
  59. package/helpers/record-widget.d.ts +15 -0
  60. package/helpers/record-widget.js +57 -0
  61. package/package.json +2 -2
  62. package/plugins/runtime-modules/accounting/client-data-providers.d.ts +7 -0
  63. package/plugins/runtime-modules/accounting/client-data-providers.js +9 -0
  64. package/plugins/runtime-modules/accounting/data-providers.d.ts +63 -0
  65. package/plugins/runtime-modules/accounting/data-providers.js +127 -0
  66. package/plugins/runtime-modules/accounting/definition.d.ts +54 -2
  67. package/plugins/runtime-modules/accounting/definition.js +5 -3
  68. package/plugins/runtime-modules/accounting/ids.d.ts +20 -0
  69. package/plugins/runtime-modules/accounting/ids.js +27 -0
  70. package/plugins/runtime-modules/accounting/module.d.ts +52 -0
  71. package/plugins/runtime-modules/accounting/presets.js +23 -4
  72. package/plugins/runtime-modules/accounting/services/products-table.d.ts +93 -0
  73. package/plugins/runtime-modules/accounting/services/products-table.js +158 -0
  74. package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.d.ts +86 -0
  75. package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.js +123 -0
  76. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.d.ts +21 -0
  77. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.js +435 -0
  78. package/plugins/runtime-modules/app/presets.js +3 -6
  79. package/plugins/runtime-modules/app/trees/phi-default-app-area-preset-tree.d.ts +3 -6
  80. package/plugins/runtime-modules/app/trees/phi-default-app-area-preset-tree.js +4 -7
  81. package/plugins/runtime-modules/area-definitions.js +2 -2
  82. package/plugins/runtime-modules/asset/media-asset-field.d.ts +15 -0
  83. package/plugins/runtime-modules/asset/media-asset-field.js +21 -0
  84. package/plugins/runtime-modules/asset/media-asset-form-control.d.ts +4 -0
  85. package/plugins/runtime-modules/asset/media-asset-form-control.js +10 -5
  86. package/plugins/runtime-modules/asset/media-assets-field.d.ts +8 -0
  87. package/plugins/runtime-modules/asset/media-assets-field.js +10 -0
  88. package/plugins/runtime-modules/asset/media-assets-form-control.d.ts +5 -0
  89. package/plugins/runtime-modules/asset/media-assets-form-control.js +15 -6
  90. package/plugins/runtime-modules/auth/admin-settings-forms.js +1 -1
  91. package/plugins/runtime-modules/builder/controller/client.d.ts +5 -5
  92. package/plugins/runtime-modules/builder/controller/client.js +2 -1
  93. package/plugins/runtime-modules/builder/controller/definition.d.ts +4 -4
  94. package/plugins/runtime-modules/builder/controller/definition.js +7 -0
  95. package/plugins/runtime-modules/builder/controller/draft-command-controller.d.ts +3 -1
  96. package/plugins/runtime-modules/builder/controller/draft-command-controller.js +2 -1
  97. package/plugins/runtime-modules/builder/controller/draft-status-controller.js +44 -17
  98. package/plugins/runtime-modules/builder/controller/server-definition.d.ts +4 -4
  99. package/plugins/runtime-modules/builder/controller/workspace-controller.d.ts +3 -1
  100. package/plugins/runtime-modules/builder/controller/workspace-controller.js +8 -10
  101. package/plugins/runtime-modules/builder/developer-workspace-store.d.ts +10 -0
  102. package/plugins/runtime-modules/builder/developer-workspace-store.js +35 -1
  103. package/plugins/runtime-modules/builder/offered-page-catalog.d.ts +6 -0
  104. package/plugins/runtime-modules/builder/offered-page-catalog.js +35 -6
  105. package/plugins/runtime-modules/builder/persistence.d.ts +4 -1
  106. package/plugins/runtime-modules/builder/persistence.js +10 -3
  107. package/plugins/runtime-modules/client-manifests/accounting.js +5 -1
  108. package/plugins/runtime-modules/core/cards.js +2 -2
  109. package/plugins/runtime-modules/core/client-data-providers.js +5 -0
  110. package/plugins/runtime-modules/core/data-providers.js +14 -0
  111. package/plugins/runtime-modules/core/definition.d.ts +5 -0
  112. package/plugins/runtime-modules/core/form-providers.d.ts +5 -0
  113. package/plugins/runtime-modules/core/services/site-members-options.d.ts +27 -0
  114. package/plugins/runtime-modules/core/services/site-members-options.js +55 -0
  115. package/plugins/runtime-modules/core/widgets/form/config.d.ts +5 -0
  116. package/plugins/runtime-modules/core/widgets/form/config.js +3 -0
  117. package/plugins/runtime-modules/core/widgets/record/actions.d.ts +20 -0
  118. package/plugins/runtime-modules/core/widgets/record/actions.js +77 -0
  119. package/plugins/runtime-modules/core/widgets/record/client.js +71 -8
  120. package/plugins/runtime-modules/core/widgets/record/config.d.ts +66 -1
  121. package/plugins/runtime-modules/core/widgets/record/config.js +71 -2
  122. package/plugins/runtime-modules/core/widgets/spacer/client.js +3 -3
  123. package/plugins/runtime-modules/core/widgets/table/client.js +33 -29
  124. package/plugins/runtime-modules/core/widgets/table/config.js +5 -1
  125. package/plugins/runtime-modules/groups/data-providers.js +1 -1
  126. package/plugins/runtime-modules/groups/definition.js +1 -1
  127. package/plugins/runtime-modules/groups/page-visibility.d.ts +1 -1
  128. package/plugins/runtime-modules/groups/page-visibility.js +1 -1
  129. package/plugins/runtime-modules/groups/presets.js +1 -1
  130. package/plugins/runtime-modules/groups/services/options.js +1 -1
  131. package/plugins/runtime-modules/groups/services/table.js +1 -1
  132. package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -2
  133. package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +46 -39
  134. package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +1 -1
  135. package/plugins/runtime-modules/preset-contracts/pub-area.js +1 -0
  136. package/plugins/runtime-modules/revisions/controller/client.js +48 -46
  137. package/plugins/runtime-modules/revisions/services/table.js +3 -1
  138. package/plugins/runtime-modules/user-management/addon-roles.d.ts +60 -4
  139. package/plugins/runtime-modules/user-management/addon-roles.js +92 -8
  140. package/plugins/runtime-modules/user-management/addresses.d.ts +1 -1
  141. package/plugins/runtime-modules/user-management/controller/client.js +1 -1
  142. package/plugins/runtime-modules/user-management/data-providers.js +1 -0
  143. package/plugins/runtime-modules/user-management/forms.js +22 -0
  144. package/plugins/runtime-modules/user-management/presets.js +2 -2
  145. package/plugins/runtime-modules/user-management/services/options.d.ts +4 -0
  146. package/plugins/runtime-modules/user-management/services/options.js +14 -6
  147. package/plugins/runtime-modules/user-management/services/table.js +12 -3
  148. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +9 -4
  149. package/styles/builder-scaffold.css +7 -1
  150. package/styles/layout-authoring-scaffold.css +27 -0
  151. package/types/access.d.ts +1 -1
  152. package/types/access.js +7 -7
  153. package/types/core-widget-placements.d.ts +7 -0
  154. package/types/form-descriptor.d.ts +1 -1
  155. package/types/record-widget.d.ts +35 -0
  156. package/types/server-capabilities.d.ts +1 -1
  157. package/types/table-widget.d.ts +20 -0
  158. package/types/table-widget.js +44 -0
@@ -0,0 +1,158 @@
1
+ "use client";
2
+ import { isPhiRecord } from "../../../../helpers/is-record";
3
+ import { buildPhiTablePageParams, createPhiTableProviderRequestInit, readPhiTableRows, readPhiTableStringFilter, } from "../../../../components/widgets/client/shared/phi-table-provider-request";
4
+ import { readPhiTableProviderResponse, } from "../../../../components/widgets/client/shared/phi-table-provider-response";
5
+ import { createPhiTableProviderClient, } from "../../../../components/widgets/client/shared/phi-table-provider";
6
+ import { PhiTableProviderError, } from "../../../../types/table-widget";
7
+ import { PHI_ACCOUNTING_RUNTIME_DATA_PROVIDER_DESCRIPTORS } from "../data-providers";
8
+ import { PHI_ACCOUNTING_PRODUCTS_DATA_PROVIDER_KEY, PHI_ACCOUNTING_PRODUCTS_RESOURCE_KEY } from "../ids";
9
+ const API_PATH = "/api/site/products";
10
+ const RESPONSE_OPTIONS = { subject: "Products" };
11
+ // What a list shows before the reader picks another size; the Page names the same number.
12
+ const DEFAULT_PAGE_SIZE = 25;
13
+ // The route's largest page, which a record read asks for to find its one product among the matches.
14
+ const RECORD_SEARCH_PAGE_SIZE = 100;
15
+ const COMMANDS = new Set(["release", "lock", "unlock"]);
16
+ /*
17
+ * The version of each product as the terms dialog last read it (`readProductRecord`), which is what a
18
+ * release names: the operator releases the terms they compared, and Core refuses (409) a product that has
19
+ * moved on since -- the publisher changed its terms again while the dialog stood open. The Table's own
20
+ * list does not write it: the dialog's record is the one the release runs from.
21
+ */
22
+ const versionsShown = new Map();
23
+ const readParts = (value) => Array.isArray(value) ? value.filter((part) => typeof part === "string") : [];
24
+ function termValues(prefix, terms) {
25
+ return {
26
+ [`${prefix}Sale`]: terms ? terms.sale ?? null : null,
27
+ [`${prefix}ReferralUrl`]: terms ? terms.referralUrl ?? null : null,
28
+ [`${prefix}Free`]: terms ? terms.free === true : null,
29
+ [`${prefix}AccountRequired`]: terms ? terms.accountRequired === true : null,
30
+ [`${prefix}Parts`]: terms ? readParts(terms.parts) : null,
31
+ };
32
+ }
33
+ /**
34
+ * A directory row as the Table speaks it: Core's fields, and what the Page reads off them -- the state as
35
+ * a lock mark, the parts as a count, whether a release waits, and the terms in force beside the terms
36
+ * waiting. A publisher's product never released has nothing in force; its terms are what waits. The
37
+ * Site's own product (no publisher) is always released and never waits.
38
+ */
39
+ export function toPhiAccountingProductRow(product) {
40
+ const pending = isPhiRecord(product.pendingTerms) ? product.pendingTerms : null;
41
+ const released = product.released === true;
42
+ const parts = readParts(product.parts);
43
+ return {
44
+ ...product,
45
+ parts,
46
+ partCount: parts.length,
47
+ locked: product.state === "locked",
48
+ awaitingRelease: !released || pending !== null,
49
+ ...termValues("inForce", released ? product : null),
50
+ ...termValues("pending", released ? pending : product),
51
+ };
52
+ }
53
+ function readStateFilter(query) {
54
+ const value = query.filters?.state;
55
+ const states = Array.isArray(value) ? value : typeof value === "string" ? [value] : [];
56
+ return states.filter((state) => typeof state === "string" && Boolean(state.trim()));
57
+ }
58
+ function readTotal(result) {
59
+ if (typeof result?.total !== "number" || !Number.isFinite(result.total) || result.total < 0) {
60
+ throw new PhiTableProviderError("invalid-response", "Products total is invalid.");
61
+ }
62
+ return result.total;
63
+ }
64
+ async function readDirectory(params, signal) {
65
+ return readPhiTableProviderResponse(await fetch(`${API_PATH}?${params.toString()}`, createPhiTableProviderRequestInit(signal)), RESPONSE_OPTIONS);
66
+ }
67
+ function requireResource(resourceKey) {
68
+ if (resourceKey !== PHI_ACCOUNTING_PRODUCTS_RESOURCE_KEY) {
69
+ throw new PhiTableProviderError("resource-not-found", `Unknown Accounting resource "${resourceKey}".`);
70
+ }
71
+ }
72
+ async function queryProducts({ resourceKey, query, signal }) {
73
+ requireResource(resourceKey);
74
+ const params = buildPhiTablePageParams(query, DEFAULT_PAGE_SIZE);
75
+ const search = query.search?.trim() ?? "";
76
+ if (search)
77
+ params.set("q", search);
78
+ const supplier = readPhiTableStringFilter(query, "supplier");
79
+ if (supplier)
80
+ params.set("supplier", supplier);
81
+ const states = readStateFilter(query);
82
+ if (states.length > 0)
83
+ params.set("state", states.join(","));
84
+ // The switch asks for those waiting; off, it asks for nothing rather than for those not waiting.
85
+ if (query.filters?.pendingTerms === true)
86
+ params.set("pendingTerms", "true");
87
+ const result = await readDirectory(params, signal);
88
+ return { rows: readPhiTableRows(result?.rows).map(toPhiAccountingProductRow), total: readTotal(result) };
89
+ }
90
+ /**
91
+ * One product, read again for the record that sets its terms side by side. Core lists, it has no read of
92
+ * one product here, so the id is searched for -- it is part of what the search reads -- and the one
93
+ * product with exactly that id is taken from the matches.
94
+ */
95
+ async function readProductRecord({ resourceKey, rowIdentity, signal }) {
96
+ requireResource(resourceKey);
97
+ if (typeof rowIdentity !== "string" || !rowIdentity) {
98
+ throw new PhiTableProviderError("record-not-found", "A product id is required.");
99
+ }
100
+ const params = new URLSearchParams({ q: rowIdentity, page: "1", pageSize: String(RECORD_SEARCH_PAGE_SIZE) });
101
+ const result = await readDirectory(params, signal);
102
+ const product = readPhiTableRows(result?.rows).find((row) => row.id === rowIdentity);
103
+ if (!product) {
104
+ versionsShown.delete(rowIdentity);
105
+ throw new PhiTableProviderError("record-not-found", `The Site has no product ${rowIdentity}.`);
106
+ }
107
+ if (typeof product.version !== "number" || !Number.isSafeInteger(product.version) || product.version < 1) {
108
+ throw new PhiTableProviderError("invalid-response", `Product ${rowIdentity} has no version.`);
109
+ }
110
+ versionsShown.set(rowIdentity, product.version);
111
+ return toPhiAccountingProductRow(product);
112
+ }
113
+ /** The path of one operator command; the id is one segment, so its `@`, `/` and `:` are encoded. */
114
+ export function buildPhiAccountingProductCommandPath(productId, command) {
115
+ return `${API_PATH}/${encodeURIComponent(productId)}/${command}`;
116
+ }
117
+ /*
118
+ * The operator's three acts. Each can move the row out of what the filters show -- a lock out of the
119
+ * active ones, a release out of those waiting -- so the view is read again rather than patched. A release
120
+ * sends the version of the record the terms dialog shows (`versionsShown`); with none read there is
121
+ * nothing the operator compared, and it is refused here rather than sent without one.
122
+ */
123
+ async function mutateProducts(request) {
124
+ requireResource(request.resourceKey);
125
+ if (request.kind !== "action" || !COMMANDS.has(request.actionKey)) {
126
+ throw new PhiTableProviderError("mutation-not-supported", "Products are released, locked or unlocked here, never edited.");
127
+ }
128
+ if (typeof request.rowIdentity !== "string" || !request.rowIdentity) {
129
+ throw new PhiTableProviderError("invalid-query", "A product id is required.");
130
+ }
131
+ const init = createPhiTableProviderRequestInit(request.signal);
132
+ let body;
133
+ if (request.actionKey === "release") {
134
+ const expectedVersion = versionsShown.get(request.rowIdentity);
135
+ if (expectedVersion === undefined) {
136
+ throw new PhiTableProviderError("invalid-query", `The terms of ${request.rowIdentity} were not read; open them before releasing.`);
137
+ }
138
+ body = JSON.stringify({ expectedVersion });
139
+ }
140
+ await readPhiTableProviderResponse(await fetch(buildPhiAccountingProductCommandPath(request.rowIdentity, request.actionKey), {
141
+ ...init,
142
+ method: "POST",
143
+ ...(body === undefined ? {} : { body, headers: { ...init.headers, "content-type": "application/json" } }),
144
+ }), RESPONSE_OPTIONS);
145
+ return { status: "accepted", invalidation: "view" };
146
+ }
147
+ // Its own descriptor by key, not by position: a Provider added to the list must not take its place.
148
+ const resources = PHI_ACCOUNTING_RUNTIME_DATA_PROVIDER_DESCRIPTORS
149
+ .find((descriptor) => descriptor.key === PHI_ACCOUNTING_PRODUCTS_DATA_PROVIDER_KEY)?.resources ?? [];
150
+ /** The registration itself, apart from the component, so the requests it makes can be read in a test. */
151
+ export const PHI_ACCOUNTING_PRODUCTS_TABLE_PROVIDER_REGISTRATION = {
152
+ key: PHI_ACCOUNTING_PRODUCTS_DATA_PROVIDER_KEY,
153
+ resources,
154
+ query: queryProducts,
155
+ readRecord: readProductRecord,
156
+ mutate: mutateProducts,
157
+ };
158
+ export const PhiAccountingProductsTableProviderClient = createPhiTableProviderClient(PHI_ACCOUNTING_PRODUCTS_TABLE_PROVIDER_REGISTRATION);
@@ -0,0 +1,86 @@
1
+ import "server-only";
2
+ import { type PhiGlobalTranslatorOptions } from "../../../../gateway/tr";
3
+ export declare function getPhiAccountingProductsPageLabels(options: PhiGlobalTranslatorOptions): Promise<{
4
+ pageTitle: string;
5
+ pageDescription: string;
6
+ widgetLabel: string;
7
+ columns: {
8
+ picture: string;
9
+ title: string;
10
+ id: string;
11
+ supplier: string;
12
+ kind: string;
13
+ state: string;
14
+ sale: string;
15
+ free: string;
16
+ account: string;
17
+ parts: string;
18
+ waiting: string;
19
+ };
20
+ states: {
21
+ draft: string;
22
+ active: string;
23
+ withdrawn: string;
24
+ locked: string;
25
+ };
26
+ sales: {
27
+ own: string;
28
+ referral: string;
29
+ payout: string;
30
+ };
31
+ search: string;
32
+ filters: {
33
+ supplier: string;
34
+ supplierPlaceholder: string;
35
+ state: string;
36
+ waiting: string;
37
+ };
38
+ footer: string;
39
+ empty: {
40
+ title: string;
41
+ text: string;
42
+ };
43
+ actions: {
44
+ release: string;
45
+ lock: string;
46
+ unlock: string;
47
+ cancel: string;
48
+ };
49
+ release: {
50
+ description: string;
51
+ };
52
+ lock: {
53
+ title: string;
54
+ description: string;
55
+ };
56
+ unlock: {
57
+ title: string;
58
+ description: string;
59
+ };
60
+ terms: {
61
+ title: string;
62
+ titleOf: string;
63
+ release: string;
64
+ product: string;
65
+ sale: {
66
+ inForce: string;
67
+ waiting: string;
68
+ };
69
+ referral: {
70
+ inForce: string;
71
+ waiting: string;
72
+ };
73
+ free: {
74
+ inForce: string;
75
+ waiting: string;
76
+ };
77
+ account: {
78
+ inForce: string;
79
+ waiting: string;
80
+ };
81
+ parts: {
82
+ inForce: string;
83
+ waiting: string;
84
+ };
85
+ };
86
+ }>;
@@ -0,0 +1,123 @@
1
+ import "server-only";
2
+ import { PHI_TR_CTX_WEB_UI_LABEL } from "../../../../gateway/tr";
3
+ import { definePhiRuntimeModuleLabelSet, definePhiMessageLabel, getPhiLabelSet } from "../../../../gateway/label-set";
4
+ import { PHI_ACCOUNTING_RUNTIME_MODULE_IDENTITY } from "../ids";
5
+ /**
6
+ * What the product directory in the Accounting Area says: its frame, the Table's columns, filters and
7
+ * footer, the terms side by side in the dialog that releases them, and the three acts.
8
+ */
9
+ const PHI_ACCOUNTING_PRODUCTS_PAGE_LABEL_SET = definePhiRuntimeModuleLabelSet(PHI_ACCOUNTING_RUNTIME_MODULE_IDENTITY, {
10
+ key: "preset:accounting-products-page",
11
+ ctx: PHI_TR_CTX_WEB_UI_LABEL,
12
+ labels: {
13
+ page_title: "Products",
14
+ page_description: definePhiMessageLabel("Every product the Site's Add-ons supply: release their terms, lock and unlock them."),
15
+ widget_label: "products",
16
+ column_picture: "Picture",
17
+ column_title: "Title",
18
+ column_id: "ID",
19
+ column_supplier: "Supplier",
20
+ column_kind: "Kind",
21
+ column_state: "State",
22
+ column_sale: "Sale",
23
+ column_free: "Free",
24
+ column_account: "Account required",
25
+ column_parts: "Bundle parts",
26
+ column_waiting: "Terms waiting",
27
+ state_draft: "Draft",
28
+ state_active: "Active",
29
+ state_withdrawn: "Withdrawn",
30
+ state_locked: "Locked",
31
+ sale_own: "Own",
32
+ sale_referral: "Referral",
33
+ sale_payout: "Payout",
34
+ search_placeholder: "Title or ID",
35
+ filter_supplier: "Supplier",
36
+ filter_supplier_placeholder: "@scope/name",
37
+ filter_state: "State",
38
+ filter_waiting: "Terms waiting",
39
+ footer: "%1 products",
40
+ empty_title: definePhiMessageLabel("No product matches."),
41
+ empty_text: definePhiMessageLabel("The Site's Add-ons register their products here; none does yet, or the filters leave none."),
42
+ action_release: "Release terms",
43
+ action_lock: "Lock",
44
+ action_unlock: "Unlock",
45
+ action_cancel: "Cancel",
46
+ release_description: definePhiMessageLabel("The terms waiting for release take effect now, and the Add-ons that sell it are told."),
47
+ lock_title: "Lock %1?",
48
+ lock_description: definePhiMessageLabel("Nobody can acquire it, and no entitlement to it counts while it is locked. Its supplier cannot undo it."),
49
+ unlock_title: "Unlock %1?",
50
+ unlock_description: definePhiMessageLabel("It becomes withdrawn: entitlements count again, nobody acquires it until its supplier makes it active."),
51
+ terms_title: "Terms",
52
+ terms_title_of: "Terms: %1",
53
+ terms_release: "Release",
54
+ terms_product: "Product",
55
+ terms_sale_in_force: "Sale in force",
56
+ terms_sale_waiting: "Sale waiting for release",
57
+ terms_referral_in_force: "Referral address in force",
58
+ terms_referral_waiting: "Referral address waiting for release",
59
+ terms_free_in_force: "Free in force",
60
+ terms_free_waiting: "Free waiting for release",
61
+ terms_account_in_force: "Account required in force",
62
+ terms_account_waiting: "Account required waiting for release",
63
+ terms_parts_in_force: "Bundle parts in force",
64
+ terms_parts_waiting: "Bundle parts waiting for release",
65
+ },
66
+ });
67
+ export async function getPhiAccountingProductsPageLabels(options) {
68
+ const labels = await getPhiLabelSet(options, PHI_ACCOUNTING_PRODUCTS_PAGE_LABEL_SET);
69
+ return {
70
+ pageTitle: labels.page_title,
71
+ pageDescription: labels.page_description,
72
+ widgetLabel: labels.widget_label,
73
+ columns: {
74
+ picture: labels.column_picture,
75
+ title: labels.column_title,
76
+ id: labels.column_id,
77
+ supplier: labels.column_supplier,
78
+ kind: labels.column_kind,
79
+ state: labels.column_state,
80
+ sale: labels.column_sale,
81
+ free: labels.column_free,
82
+ account: labels.column_account,
83
+ parts: labels.column_parts,
84
+ waiting: labels.column_waiting,
85
+ },
86
+ states: {
87
+ draft: labels.state_draft,
88
+ active: labels.state_active,
89
+ withdrawn: labels.state_withdrawn,
90
+ locked: labels.state_locked,
91
+ },
92
+ sales: { own: labels.sale_own, referral: labels.sale_referral, payout: labels.sale_payout },
93
+ search: labels.search_placeholder,
94
+ filters: {
95
+ supplier: labels.filter_supplier,
96
+ supplierPlaceholder: labels.filter_supplier_placeholder,
97
+ state: labels.filter_state,
98
+ waiting: labels.filter_waiting,
99
+ },
100
+ footer: labels.footer,
101
+ empty: { title: labels.empty_title, text: labels.empty_text },
102
+ actions: {
103
+ release: labels.action_release,
104
+ lock: labels.action_lock,
105
+ unlock: labels.action_unlock,
106
+ cancel: labels.action_cancel,
107
+ },
108
+ release: { description: labels.release_description },
109
+ lock: { title: labels.lock_title, description: labels.lock_description },
110
+ unlock: { title: labels.unlock_title, description: labels.unlock_description },
111
+ terms: {
112
+ title: labels.terms_title,
113
+ titleOf: labels.terms_title_of,
114
+ release: labels.terms_release,
115
+ product: labels.terms_product,
116
+ sale: { inForce: labels.terms_sale_in_force, waiting: labels.terms_sale_waiting },
117
+ referral: { inForce: labels.terms_referral_in_force, waiting: labels.terms_referral_waiting },
118
+ free: { inForce: labels.terms_free_in_force, waiting: labels.terms_free_waiting },
119
+ account: { inForce: labels.terms_account_in_force, waiting: labels.terms_account_waiting },
120
+ parts: { inForce: labels.terms_parts_in_force, waiting: labels.terms_parts_waiting },
121
+ },
122
+ };
123
+ }
@@ -0,0 +1,21 @@
1
+ import type { PhiCmsPageNode, PhiResolvedCmsPageTree } from "../../../../types/cms";
2
+ import type { PhiBlockRuntime } from "../../../../types";
3
+ /**
4
+ * The Site's product directory (phis-server SERVER_ADDONS.md, `products:v1`).
5
+ *
6
+ * Every product of every supplier Add-on, in every state, for whoever the Accounting Area lets in --
7
+ * Admin, Maintainer and Accountant, the holders of Core's `accounting` access, which is also what Core
8
+ * asks of each act. The operator releases a publisher's terms and locks or unlocks; title, summary and
9
+ * picture stay the supplier's and are not edited here.
10
+ *
11
+ * The picture is a small column of its own and the icon stands ahead of the title, both the server's `icon`
12
+ * variant (`imageListPath`, `iconListPath`: 64 x 64, fitted whole, with their cache revisions).
13
+ * Releasing opens a dialog named after the product, whose record sets the terms in force beside the ones
14
+ * waiting; its Release runs the Provider's release on that record, and the dialog closes and the Table
15
+ * reads again. The dialog is the confirmation, so the release asks nothing more; lock and unlock stay the
16
+ * row's own acts with a question naming the product.
17
+ */
18
+ export declare function buildPhiDefaultAccountingProductsPageTree({ page, runtime, }: {
19
+ page: PhiCmsPageNode;
20
+ runtime: PhiBlockRuntime;
21
+ }): Promise<PhiResolvedCmsPageTree>;