@phis/ui 0.7.8 → 0.8.0
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/components/controls/phi-address-control.d.ts +23 -0
- package/components/controls/phi-address-control.js +43 -0
- package/components/controls/phi-color-control.d.ts +3 -1
- package/components/controls/phi-color-control.js +2 -2
- package/components/controls/phi-country-select-control.d.ts +22 -0
- package/components/controls/phi-country-select-control.js +16 -0
- package/components/controls/phi-dialog-control.d.ts +1 -1
- package/components/controls/phi-drawer-control-adapter.d.ts +1 -1
- package/components/controls/phi-drawer-control-adapter.js +5 -3
- package/components/controls/phi-drawer-control.d.ts +7 -5
- package/components/controls/phi-float-button-control.d.ts +8 -1
- package/components/controls/phi-float-button-control.js +19 -3
- package/components/controls/phi-form-control.js +52 -8
- package/components/controls/phi-modal-control-adapter.d.ts +1 -1
- package/components/controls/phi-modal-control-adapter.js +14 -37
- package/components/controls/phi-modal-control.d.ts +5 -5
- package/components/controls/phi-options-provider.d.ts +1 -0
- package/components/controls/phi-options-provider.js +1 -0
- package/components/controls/phi-overlay-control-contract.d.ts +52 -17
- package/components/controls/phi-overlay-control-contract.js +55 -30
- package/components/controls/phi-reveal-once-dialog-control.d.ts +21 -0
- package/components/controls/phi-reveal-once-dialog-control.js +52 -0
- package/components/controls/phi-reveal-once-dialog-labels.d.ts +10 -0
- package/components/controls/phi-reveal-once-dialog-labels.js +5 -0
- package/components/forms/flags-field.d.ts +22 -0
- package/components/forms/flags-field.js +58 -0
- package/components/forms/form-option-flags.d.ts +20 -0
- package/components/forms/form-option-flags.js +38 -0
- package/components/forms/form-provider-contract.d.ts +23 -0
- package/components/forms/form-provider-contract.js +36 -0
- package/components/forms/form-provider-registry.d.ts +5 -1
- package/components/forms/shared-form-provider-registry.js +13 -0
- package/components/forms/structured-field-labels.d.ts +24 -0
- package/components/forms/structured-field-labels.js +43 -0
- package/components/forms/structured-form-field-controls.d.ts +12 -0
- package/components/forms/structured-form-field-controls.js +65 -0
- package/components/overlays/phi-overlay-container-client.js +2 -2
- package/components/regions/phi-cms-region-shell.js +2 -2
- package/components/regions/presets/content-entry-editor-page-tree.js +12 -3
- package/components/regions/presets/phi-settings-page-shell-tree.d.ts +6 -2
- package/components/regions/presets/phi-settings-page-shell-tree.js +1 -1
- package/components/root/phi-root-theme-resolver.js +3 -0
- package/components/shell/phi-antd-icon.d.ts +1 -8
- package/components/shell/phi-antd-icon.js +1 -227
- package/components/shell/phi-icon-names.d.ts +19 -0
- package/components/shell/phi-icon-names.js +264 -0
- package/components/shell/phi-icon.d.ts +2 -11
- package/components/shell/phi-icon.js +4 -32
- package/components/widgets/client/shared/phi-command-buttons.d.ts +13 -2
- package/components/widgets/client/shared/phi-command-buttons.js +10 -4
- package/components/widgets/client/shared/phi-rendered-value.js +27 -3
- package/components/widgets/client/shared/phi-table-provider-refusal.d.ts +13 -0
- package/components/widgets/client/shared/phi-table-provider-refusal.js +13 -0
- package/components/widgets/config/background.d.ts +3 -2
- package/components/widgets/config/choice-shared.d.ts +10 -1
- package/components/widgets/config/choice-shared.js +8 -2
- package/components/widgets/label-sets/admin-locales.js +1 -1
- package/components/widgets/label-sets/admin-users.d.ts +2 -5
- package/components/widgets/label-sets/admin-users.js +4 -10
- package/components/widgets/label-sets/effects.js +2 -4
- package/components/widgets/label-sets/profile.d.ts +13 -0
- package/components/widgets/label-sets/profile.js +28 -0
- package/components/widgets/label-sets/search-results.js +2 -4
- package/components/widgets/label-sets/table.js +9 -0
- package/components/widgets/label-types/effects.d.ts +3 -2
- package/components/widgets/label-types/effects.js +1 -2
- package/components/widgets/label-types/search-results.d.ts +2 -2
- package/components/widgets/label-types/search-results.js +1 -2
- package/components/widgets/label-types/table.d.ts +3 -0
- package/components/widgets/label-types/table.js +2 -0
- package/components/widgets/server/builder-chrome.d.ts +4 -1
- package/components/widgets/server/builder-chrome.js +2 -2
- package/components/widgets/shared/markdown-body-client.d.ts +26 -0
- package/components/widgets/shared/markdown-body-client.js +31 -1
- package/components/widgets/shared/markdown-render.d.ts +10 -2
- package/components/widgets/shared/markdown-render.js +35 -13
- package/constants/countries.d.ts +9 -0
- package/constants/countries.js +28 -0
- package/constants/customer-file.d.ts +25 -0
- package/constants/customer-file.js +26 -0
- package/constants/record-field-kinds.d.ts +15 -0
- package/constants/record-field-kinds.js +13 -0
- package/constants/runtime-module-ownership.js +12 -0
- package/constants/runtime-render-client-types.d.ts +5 -0
- package/constants/runtime-render-client-types.js +5 -0
- package/{plugins/runtime-modules/threads/controller/address.js → constants/threads-controller-address.js} +1 -1
- package/constants.d.ts +1 -0
- package/constants.js +2 -0
- package/gateway/form-handler-request.d.ts +22 -0
- package/gateway/form-handler-request.js +40 -0
- package/gateway/label-set.d.ts +15 -2
- package/gateway/label-set.js +60 -22
- package/gateway/site-form-route.js +11 -2
- package/helpers/address-field.d.ts +43 -0
- package/helpers/address-field.js +68 -0
- package/helpers/cms-dialog.d.ts +5 -20
- package/helpers/cms-dialog.js +8 -13
- package/helpers/cms-page-catalog.d.ts +10 -0
- package/helpers/cms-page-catalog.js +19 -0
- package/helpers/cms-preset-nodes.d.ts +4 -4
- package/helpers/cms-preset-nodes.js +1 -1
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/country-names.d.ts +12 -0
- package/helpers/country-names.js +14 -0
- package/helpers/phi-metadata.d.ts +33 -1
- package/helpers/phi-metadata.js +62 -1
- package/helpers/preset-table-check.d.ts +34 -0
- package/helpers/preset-table-check.js +124 -0
- package/helpers/preset-text-source-check.d.ts +4 -1
- package/helpers/preset-text-source-check.js +6 -1
- package/helpers/preset-tree-contract-check.d.ts +3 -2
- package/helpers/preset-tree-contract-check.js +30 -5
- package/helpers/public-route-claims.d.ts +9 -1
- package/helpers/public-route-claims.js +23 -3
- package/helpers/record-fields.d.ts +1 -5
- package/helpers/record-fields.js +15 -6
- package/helpers/route-address-check.d.ts +22 -2
- package/helpers/route-address-check.js +29 -8
- package/helpers/site-address-row.d.ts +23 -0
- package/helpers/site-address-row.js +36 -0
- package/helpers/surface-style.d.ts +8 -1
- package/helpers/surface-style.js +12 -2
- package/helpers/thread-inbox-row.d.ts +20 -0
- package/helpers/thread-inbox-row.js +26 -0
- package/helpers/translation-format.d.ts +26 -0
- package/helpers/translation-format.js +31 -0
- package/module-labels.d.ts +1 -1
- package/module-labels.js +1 -1
- package/module-page-check.d.ts +1 -0
- package/module-page-check.js +1 -0
- package/module-records.d.ts +2 -2
- package/module-records.js +1 -0
- package/next/area-route.js +34 -1
- package/next/root-route.js +4 -5
- package/package.json +2 -2
- package/plugins/runtime-modules/accounting/customer-file-access.d.ts +11 -0
- package/plugins/runtime-modules/accounting/customer-file-access.js +12 -0
- package/plugins/runtime-modules/accounting/data-providers.js +1 -1
- package/plugins/runtime-modules/accounting/ids.d.ts +11 -0
- package/plugins/runtime-modules/accounting/ids.js +23 -0
- package/plugins/runtime-modules/accounting/presets.js +32 -5
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +66 -0
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +122 -0
- package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.js +2 -2
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +26 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +381 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.js +4 -0
- package/plugins/runtime-modules/app/client-data-providers.d.ts +7 -0
- package/plugins/runtime-modules/app/client-data-providers.js +9 -0
- package/plugins/runtime-modules/app/data-providers.d.ts +98 -0
- package/plugins/runtime-modules/app/data-providers.js +80 -0
- package/plugins/runtime-modules/app/definition.d.ts +131 -0
- package/plugins/runtime-modules/app/definition.js +2 -0
- package/plugins/runtime-modules/app/forms.d.ts +46 -1
- package/plugins/runtime-modules/app/forms.js +195 -1
- package/plugins/runtime-modules/app/ids.d.ts +7 -0
- package/plugins/runtime-modules/app/ids.js +8 -0
- package/plugins/runtime-modules/app/module.d.ts +131 -0
- package/plugins/runtime-modules/app/services/addresses-table.d.ts +135 -0
- package/plugins/runtime-modules/app/services/addresses-table.js +101 -0
- package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +17 -0
- package/plugins/runtime-modules/app/trees/account-addresses-panel.js +179 -0
- package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +62 -0
- package/plugins/runtime-modules/app/trees/addresses-label-set.js +108 -0
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +27 -2
- package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +1 -0
- package/plugins/runtime-modules/app/trees/profile-label-set.js +3 -0
- package/plugins/runtime-modules/asset/presets.d.ts +4 -0
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +4 -2
- package/plugins/runtime-modules/auth/trees/phi-auth-area-overlay-tree.server.js +4 -2
- package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +2 -2
- package/plugins/runtime-modules/auth/widgets/logout/client.d.ts +1 -1
- package/plugins/runtime-modules/auth/widgets/logout/client.js +2 -2
- package/plugins/runtime-modules/auth/widgets/security/client.d.ts +5 -1
- package/plugins/runtime-modules/auth/widgets/security/client.js +12 -10
- package/plugins/runtime-modules/avatar/overlay-tree.server.js +1 -1
- package/plugins/runtime-modules/blog/presets.d.ts +4 -0
- package/plugins/runtime-modules/builder/clients/inspector-image-field.d.ts +2 -1
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -2
- package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.d.ts +23 -0
- package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.js +38 -0
- package/plugins/runtime-modules/builder/clients/mode-switch.d.ts +4 -1
- package/plugins/runtime-modules/builder/clients/mode-switch.js +2 -15
- package/plugins/runtime-modules/builder/clients/pages-workspace.js +2 -0
- package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +2 -1
- package/plugins/runtime-modules/builder/controller/draft-status-controller.js +28 -1
- package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +5 -0
- package/plugins/runtime-modules/builder/page-presets.server.d.ts +7 -0
- package/plugins/runtime-modules/builder/page-presets.server.js +10 -1
- package/plugins/runtime-modules/builder/persistence.js +4 -0
- package/plugins/runtime-modules/builder/public-route-collisions.js +8 -3
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +3 -1
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +33 -6
- package/plugins/runtime-modules/builder/widgets/chrome/config.d.ts +6 -4
- package/plugins/runtime-modules/builder/widgets/chrome/config.js +11 -1
- package/plugins/runtime-modules/builder/widgets/inspector-header/authoring.d.ts +2 -2
- package/plugins/runtime-modules/builder/widgets/inspector-header/plugin.d.ts +2 -2
- package/plugins/runtime-modules/builder/widgets/mode-switch/plugin.js +1 -1
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +2 -2
- package/plugins/runtime-modules/client-manifests/app.js +3 -0
- package/plugins/runtime-modules/client-manifests/builder.js +10 -0
- package/plugins/runtime-modules/content-entry-routes.d.ts +4 -0
- package/plugins/runtime-modules/contracts.js +31 -1
- package/plugins/runtime-modules/core/definition.d.ts +23 -0
- package/plugins/runtime-modules/core/form-providers.d.ts +23 -0
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.d.ts +0 -17
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.js +2 -23
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +0 -1
- package/plugins/runtime-modules/core/widgets/card/config.js +0 -1
- package/plugins/runtime-modules/core/widgets/card/editor.js +1 -1
- package/plugins/runtime-modules/core/widgets/command-toolbar/client.js +3 -0
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +316 -1
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.js +4 -4
- package/plugins/runtime-modules/core/widgets/dimension/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/float-button/client.js +4 -1
- package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +326 -3
- package/plugins/runtime-modules/core/widgets/float-button/config.js +5 -2
- package/plugins/runtime-modules/core/widgets/header-navigation/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/length/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
- package/plugins/runtime-modules/core/widgets/markdown/server.d.ts +6 -2
- package/plugins/runtime-modules/core/widgets/markdown/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.d.ts +12 -0
- package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.js +68 -0
- package/plugins/runtime-modules/core/widgets/number-input/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +2 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +20 -5
- package/plugins/runtime-modules/core/widgets/table/config.js +6 -0
- package/plugins/runtime-modules/core/widgets/table/reader-query.d.ts +17 -0
- package/plugins/runtime-modules/core/widgets/table/reader-query.js +33 -0
- package/plugins/runtime-modules/dashboard/trees/dashboard-cards-page-tree.js +3 -1
- package/plugins/runtime-modules/descriptor-compiler.d.ts +19 -3
- package/plugins/runtime-modules/descriptor-compiler.js +44 -16
- package/plugins/runtime-modules/editor/presets.d.ts +4 -0
- package/plugins/runtime-modules/editor/trees/phi-default-editor-releases-page-tree.js +3 -1
- package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +5 -1
- package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +5 -1
- package/plugins/runtime-modules/localization/presets.d.ts +4 -0
- package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +3 -1
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +4 -2
- package/plugins/runtime-modules/news/presets.d.ts +4 -0
- package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +6 -2
- package/plugins/runtime-modules/resolver.js +17 -0
- package/plugins/runtime-modules/revisions/controller/client.js +13 -11
- package/plugins/runtime-modules/revisions/controller/draft-context-target.d.ts +25 -0
- package/plugins/runtime-modules/revisions/controller/draft-context-target.js +33 -0
- package/plugins/runtime-modules/revisions/presets.d.ts +4 -0
- package/plugins/runtime-modules/revisions/services/table.js +13 -4
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +3 -1
- package/plugins/runtime-modules/search/widgets/search-results/client.js +4 -2
- package/plugins/runtime-modules/theme/presets.d.ts +4 -0
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +76 -4
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +3 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +2 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +19 -7
- package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
- package/plugins/runtime-modules/threads/controller/definition.js +1 -1
- package/plugins/runtime-modules/threads/data-providers.d.ts +115 -2
- package/plugins/runtime-modules/threads/data-providers.js +85 -0
- package/plugins/runtime-modules/threads/definition.d.ts +115 -2
- package/plugins/runtime-modules/threads/definition.js +1 -1
- package/plugins/runtime-modules/threads/ids.d.ts +2 -0
- package/plugins/runtime-modules/threads/ids.js +3 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +192 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.js +164 -0
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +5 -3
- package/plugins/runtime-modules/user-management/client-data-providers.js +5 -0
- package/plugins/runtime-modules/user-management/data-providers.d.ts +159 -0
- package/plugins/runtime-modules/user-management/data-providers.js +101 -3
- package/plugins/runtime-modules/user-management/definition.d.ts +159 -0
- package/plugins/runtime-modules/user-management/ids.d.ts +9 -0
- package/plugins/runtime-modules/user-management/ids.js +9 -0
- package/plugins/runtime-modules/user-management/presets.js +17 -1
- package/plugins/runtime-modules/user-management/services/users-access-table.d.ts +378 -0
- package/plugins/runtime-modules/user-management/services/users-access-table.js +132 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +86 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +118 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.d.ts +20 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +166 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +19 -18
- package/server-helpers/cms-page-record.d.ts +9 -1
- package/server-helpers/cms-page-record.js +11 -1
- package/server-helpers/cms-request.js +8 -5
- package/server-helpers/link-preview-image.d.ts +30 -0
- package/server-helpers/link-preview-image.js +57 -0
- package/server-helpers/search-text.js +3 -0
- package/server-helpers.d.ts +1 -1
- package/server-helpers.js +1 -1
- package/styles/shell.css +30 -6
- package/theme/phi-theme-composition.js +9 -0
- package/theme/phi-theme-inverse-ground.d.ts +39 -0
- package/theme/phi-theme-inverse-ground.js +103 -0
- package/theme/phi-theme-tokens.d.ts +2 -1
- package/theme/phi-theme-tokens.js +2 -0
- package/types/cms-module-descriptors.d.ts +14 -0
- package/types/cms-overlay.d.ts +13 -6
- package/types/cms-overlay.js +6 -22
- package/types/cms-plugins.d.ts +14 -2
- package/types/cms.d.ts +10 -0
- package/types/core-widget-placements.d.ts +3 -3
- package/types/link-preview.d.ts +19 -0
- package/types/link-preview.js +19 -0
- package/types/record-provider.d.ts +22 -1
- package/types/site-theme.d.ts +27 -0
- package/types/table-embed.d.ts +48 -0
- package/types/table-embed.js +1 -0
- package/types/table-widget.d.ts +14 -0
- package/types/widget-runtime.d.ts +3 -0
- package/types.d.ts +1 -0
- /package/{plugins/runtime-modules/threads/controller/address.d.ts → constants/threads-controller-address.d.ts} +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The account's own address book on this Site (`users:v1`, phis-server SERVER_ADDONS.md): the current
|
|
3
|
+
* addresses only, never a `Superseded` or `Removed` one.
|
|
4
|
+
*
|
|
5
|
+
* `live` and `authoringMode: "none"`: they are the signed-in person's, and nobody composing a Page has any
|
|
6
|
+
* business reading them. An address never changes in Core -- a change is a new version that replaces it --
|
|
7
|
+
* so the row's id moves with every edit, which is why every write reads the view again. Adding and editing
|
|
8
|
+
* are the Module's two Forms; the Table runs removal and the two defaults itself.
|
|
9
|
+
*/
|
|
10
|
+
export declare const PHI_APP_RUNTIME_DATA_PROVIDER_DESCRIPTORS: {
|
|
11
|
+
key: `${string}/${string}`;
|
|
12
|
+
ownerModuleId: "@phis/ui/modules/app";
|
|
13
|
+
kind: "table";
|
|
14
|
+
executionMode: "live";
|
|
15
|
+
authoringMode: "none";
|
|
16
|
+
title: string;
|
|
17
|
+
description: string;
|
|
18
|
+
resources: {
|
|
19
|
+
resourceKey: string;
|
|
20
|
+
title: string;
|
|
21
|
+
rowIdentityPath: string;
|
|
22
|
+
recordRead: true;
|
|
23
|
+
fields: ({
|
|
24
|
+
key: string;
|
|
25
|
+
title: string;
|
|
26
|
+
type: "number";
|
|
27
|
+
required: true;
|
|
28
|
+
options?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
key: string;
|
|
31
|
+
title: string;
|
|
32
|
+
type: "string";
|
|
33
|
+
required?: undefined;
|
|
34
|
+
options?: undefined;
|
|
35
|
+
} | {
|
|
36
|
+
key: string;
|
|
37
|
+
title: string;
|
|
38
|
+
type: "enum[]";
|
|
39
|
+
options: {
|
|
40
|
+
value: "billing" | "shipping" | "defaultBilling" | "defaultShipping";
|
|
41
|
+
label: "billing" | "shipping" | "defaultBilling" | "defaultShipping";
|
|
42
|
+
}[];
|
|
43
|
+
required?: undefined;
|
|
44
|
+
} | {
|
|
45
|
+
key: string;
|
|
46
|
+
title: string;
|
|
47
|
+
type: "boolean";
|
|
48
|
+
required?: undefined;
|
|
49
|
+
options?: undefined;
|
|
50
|
+
} | {
|
|
51
|
+
key: string;
|
|
52
|
+
title: string;
|
|
53
|
+
type: "datetime";
|
|
54
|
+
required?: undefined;
|
|
55
|
+
options?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
key: string;
|
|
58
|
+
title: string;
|
|
59
|
+
type: "json";
|
|
60
|
+
required?: undefined;
|
|
61
|
+
options?: undefined;
|
|
62
|
+
} | {
|
|
63
|
+
key: string;
|
|
64
|
+
title: string;
|
|
65
|
+
type: "number";
|
|
66
|
+
required?: undefined;
|
|
67
|
+
options?: undefined;
|
|
68
|
+
})[];
|
|
69
|
+
query: {
|
|
70
|
+
search: false;
|
|
71
|
+
filterFields: never[];
|
|
72
|
+
sorting: "none";
|
|
73
|
+
pagination: "none";
|
|
74
|
+
};
|
|
75
|
+
actions: ({
|
|
76
|
+
key: string;
|
|
77
|
+
title: string;
|
|
78
|
+
scope: "row";
|
|
79
|
+
intent: "write";
|
|
80
|
+
disabledWhen: {
|
|
81
|
+
match: "any";
|
|
82
|
+
conditions: {
|
|
83
|
+
source: "row";
|
|
84
|
+
valuePath: string;
|
|
85
|
+
operator: "truthy";
|
|
86
|
+
}[];
|
|
87
|
+
};
|
|
88
|
+
confirmation?: undefined;
|
|
89
|
+
} | {
|
|
90
|
+
key: string;
|
|
91
|
+
title: string;
|
|
92
|
+
scope: "row";
|
|
93
|
+
intent: "destructive";
|
|
94
|
+
confirmation: "required";
|
|
95
|
+
disabledWhen?: undefined;
|
|
96
|
+
})[];
|
|
97
|
+
}[];
|
|
98
|
+
}[];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { PHI_APP_ADDRESSES_DATA_PROVIDER_KEY, PHI_APP_ADDRESSES_RESOURCE_KEY, PHI_APP_RUNTIME_MODULE_ID, } from "./ids";
|
|
2
|
+
/** What an address is for, as the Table's tags name it; the bits are `PhisSiteAddressFlags`. */
|
|
3
|
+
const PHI_APP_ADDRESS_PURPOSES = ["billing", "shipping", "defaultBilling", "defaultShipping"];
|
|
4
|
+
/**
|
|
5
|
+
* The account's own address book on this Site (`users:v1`, phis-server SERVER_ADDONS.md): the current
|
|
6
|
+
* addresses only, never a `Superseded` or `Removed` one.
|
|
7
|
+
*
|
|
8
|
+
* `live` and `authoringMode: "none"`: they are the signed-in person's, and nobody composing a Page has any
|
|
9
|
+
* business reading them. An address never changes in Core -- a change is a new version that replaces it --
|
|
10
|
+
* so the row's id moves with every edit, which is why every write reads the view again. Adding and editing
|
|
11
|
+
* are the Module's two Forms; the Table runs removal and the two defaults itself.
|
|
12
|
+
*/
|
|
13
|
+
export const PHI_APP_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
|
|
14
|
+
{
|
|
15
|
+
key: PHI_APP_ADDRESSES_DATA_PROVIDER_KEY,
|
|
16
|
+
ownerModuleId: PHI_APP_RUNTIME_MODULE_ID,
|
|
17
|
+
kind: "table",
|
|
18
|
+
executionMode: "live",
|
|
19
|
+
authoringMode: "none",
|
|
20
|
+
title: "My addresses",
|
|
21
|
+
description: "The signed-in person's current billing and shipping addresses on this Site.",
|
|
22
|
+
resources: [
|
|
23
|
+
{
|
|
24
|
+
resourceKey: PHI_APP_ADDRESSES_RESOURCE_KEY,
|
|
25
|
+
title: "Addresses",
|
|
26
|
+
rowIdentityPath: "id",
|
|
27
|
+
recordRead: true,
|
|
28
|
+
fields: [
|
|
29
|
+
{ key: "id", title: "ID", type: "number", required: true },
|
|
30
|
+
{ key: "name", title: "Name", type: "string" },
|
|
31
|
+
{ key: "companyName", title: "Company", type: "string" },
|
|
32
|
+
{ key: "line1", title: "Address line 1", type: "string" },
|
|
33
|
+
{ key: "line2", title: "Address line 2", type: "string" },
|
|
34
|
+
{ key: "postalCode", title: "Postal code", type: "string" },
|
|
35
|
+
{ key: "city", title: "City", type: "string" },
|
|
36
|
+
{ key: "region", title: "Region", type: "string" },
|
|
37
|
+
{ key: "country", title: "Country", type: "string" },
|
|
38
|
+
// The parts after the name on one line, for a list that is read rather than edited.
|
|
39
|
+
{ key: "lines", title: "Address", type: "string" },
|
|
40
|
+
{
|
|
41
|
+
key: "purposes",
|
|
42
|
+
title: "Purposes",
|
|
43
|
+
type: "enum[]",
|
|
44
|
+
options: PHI_APP_ADDRESS_PURPOSES.map((value) => ({ value, label: value })),
|
|
45
|
+
},
|
|
46
|
+
{ key: "billing", title: "Billing", type: "boolean" },
|
|
47
|
+
{ key: "shipping", title: "Shipping", type: "boolean" },
|
|
48
|
+
{ key: "defaultBilling", title: "Default billing", type: "boolean" },
|
|
49
|
+
{ key: "defaultShipping", title: "Default shipping", type: "boolean" },
|
|
50
|
+
{ key: "createdAt", title: "Added", type: "datetime" },
|
|
51
|
+
// What the edit Form opens on: the parts as the `address` field holds them, the purposes as `flags`.
|
|
52
|
+
{ key: "address", title: "Address parts", type: "json" },
|
|
53
|
+
{ key: "flags", title: "Flags", type: "number" },
|
|
54
|
+
],
|
|
55
|
+
query: { search: false, filterFields: [], sorting: "none", pagination: "none" },
|
|
56
|
+
actions: [
|
|
57
|
+
{
|
|
58
|
+
key: "makeDefaultBilling",
|
|
59
|
+
title: "Use for billing by default",
|
|
60
|
+
scope: "row",
|
|
61
|
+
intent: "write",
|
|
62
|
+
disabledWhen: { match: "any", conditions: [
|
|
63
|
+
{ source: "row", valuePath: "defaultBilling", operator: "truthy" },
|
|
64
|
+
] },
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
key: "makeDefaultShipping",
|
|
68
|
+
title: "Use for shipping by default",
|
|
69
|
+
scope: "row",
|
|
70
|
+
intent: "write",
|
|
71
|
+
disabledWhen: { match: "any", conditions: [
|
|
72
|
+
{ source: "row", valuePath: "defaultShipping", operator: "truthy" },
|
|
73
|
+
] },
|
|
74
|
+
},
|
|
75
|
+
{ key: "delete", title: "Remove", scope: "row", intent: "destructive", confirmation: "required" },
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
];
|
|
@@ -18,6 +18,48 @@ export declare const PHI_APP_RUNTIME_MODULE_DEFINITION: Omit<{
|
|
|
18
18
|
csrfPath: string;
|
|
19
19
|
requiresCsrf: true;
|
|
20
20
|
credentialPolicy: "site-session";
|
|
21
|
+
} | {
|
|
22
|
+
key: `${string}/${string}`;
|
|
23
|
+
ownerModuleId: "@phis/ui/modules/app";
|
|
24
|
+
title: string;
|
|
25
|
+
phase: "submit";
|
|
26
|
+
handlerKey: "site.app.profile-phone";
|
|
27
|
+
category: "site";
|
|
28
|
+
transport: "relay";
|
|
29
|
+
method: "PATCH";
|
|
30
|
+
endpointKey: null;
|
|
31
|
+
upstreamPath: string;
|
|
32
|
+
csrfPath: string;
|
|
33
|
+
requiresCsrf: true;
|
|
34
|
+
credentialPolicy: "site-session";
|
|
35
|
+
} | {
|
|
36
|
+
key: `${string}/${string}`;
|
|
37
|
+
ownerModuleId: "@phis/ui/modules/app";
|
|
38
|
+
title: string;
|
|
39
|
+
phase: "submit";
|
|
40
|
+
handlerKey: "site.app.address-create";
|
|
41
|
+
category: "site";
|
|
42
|
+
transport: "relay";
|
|
43
|
+
method: "POST";
|
|
44
|
+
endpointKey: null;
|
|
45
|
+
upstreamPath: string;
|
|
46
|
+
csrfPath: null;
|
|
47
|
+
requiresCsrf: false;
|
|
48
|
+
credentialPolicy: "site-session";
|
|
49
|
+
} | {
|
|
50
|
+
key: `${string}/${string}`;
|
|
51
|
+
ownerModuleId: "@phis/ui/modules/app";
|
|
52
|
+
title: string;
|
|
53
|
+
phase: "submit";
|
|
54
|
+
handlerKey: "site.app.address-edit";
|
|
55
|
+
category: "site";
|
|
56
|
+
transport: "relay";
|
|
57
|
+
method: "PUT";
|
|
58
|
+
endpointKey: null;
|
|
59
|
+
upstreamPath: string;
|
|
60
|
+
csrfPath: null;
|
|
61
|
+
requiresCsrf: false;
|
|
62
|
+
credentialPolicy: "site-session";
|
|
21
63
|
} | {
|
|
22
64
|
key: `${string}/${string}`;
|
|
23
65
|
ownerModuleId: "@phis/ui/modules/app";
|
|
@@ -62,6 +104,95 @@ export declare const PHI_APP_RUNTIME_MODULE_DEFINITION: Omit<{
|
|
|
62
104
|
credentialPolicy: "site-session";
|
|
63
105
|
})[];
|
|
64
106
|
};
|
|
107
|
+
dataProviders: {
|
|
108
|
+
key: `${string}/${string}`;
|
|
109
|
+
ownerModuleId: "@phis/ui/modules/app";
|
|
110
|
+
kind: "table";
|
|
111
|
+
executionMode: "live";
|
|
112
|
+
authoringMode: "none";
|
|
113
|
+
title: string;
|
|
114
|
+
description: string;
|
|
115
|
+
resources: {
|
|
116
|
+
resourceKey: string;
|
|
117
|
+
title: string;
|
|
118
|
+
rowIdentityPath: string;
|
|
119
|
+
recordRead: true;
|
|
120
|
+
fields: ({
|
|
121
|
+
key: string;
|
|
122
|
+
title: string;
|
|
123
|
+
type: "number";
|
|
124
|
+
required: true;
|
|
125
|
+
options?: undefined;
|
|
126
|
+
} | {
|
|
127
|
+
key: string;
|
|
128
|
+
title: string;
|
|
129
|
+
type: "string";
|
|
130
|
+
required?: undefined;
|
|
131
|
+
options?: undefined;
|
|
132
|
+
} | {
|
|
133
|
+
key: string;
|
|
134
|
+
title: string;
|
|
135
|
+
type: "enum[]";
|
|
136
|
+
options: {
|
|
137
|
+
value: "billing" | "shipping" | "defaultBilling" | "defaultShipping";
|
|
138
|
+
label: "billing" | "shipping" | "defaultBilling" | "defaultShipping";
|
|
139
|
+
}[];
|
|
140
|
+
required?: undefined;
|
|
141
|
+
} | {
|
|
142
|
+
key: string;
|
|
143
|
+
title: string;
|
|
144
|
+
type: "boolean";
|
|
145
|
+
required?: undefined;
|
|
146
|
+
options?: undefined;
|
|
147
|
+
} | {
|
|
148
|
+
key: string;
|
|
149
|
+
title: string;
|
|
150
|
+
type: "datetime";
|
|
151
|
+
required?: undefined;
|
|
152
|
+
options?: undefined;
|
|
153
|
+
} | {
|
|
154
|
+
key: string;
|
|
155
|
+
title: string;
|
|
156
|
+
type: "json";
|
|
157
|
+
required?: undefined;
|
|
158
|
+
options?: undefined;
|
|
159
|
+
} | {
|
|
160
|
+
key: string;
|
|
161
|
+
title: string;
|
|
162
|
+
type: "number";
|
|
163
|
+
required?: undefined;
|
|
164
|
+
options?: undefined;
|
|
165
|
+
})[];
|
|
166
|
+
query: {
|
|
167
|
+
search: false;
|
|
168
|
+
filterFields: never[];
|
|
169
|
+
sorting: "none";
|
|
170
|
+
pagination: "none";
|
|
171
|
+
};
|
|
172
|
+
actions: ({
|
|
173
|
+
key: string;
|
|
174
|
+
title: string;
|
|
175
|
+
scope: "row";
|
|
176
|
+
intent: "write";
|
|
177
|
+
disabledWhen: {
|
|
178
|
+
match: "any";
|
|
179
|
+
conditions: {
|
|
180
|
+
source: "row";
|
|
181
|
+
valuePath: string;
|
|
182
|
+
operator: "truthy";
|
|
183
|
+
}[];
|
|
184
|
+
};
|
|
185
|
+
confirmation?: undefined;
|
|
186
|
+
} | {
|
|
187
|
+
key: string;
|
|
188
|
+
title: string;
|
|
189
|
+
scope: "row";
|
|
190
|
+
intent: "destructive";
|
|
191
|
+
confirmation: "required";
|
|
192
|
+
disabledWhen?: undefined;
|
|
193
|
+
})[];
|
|
194
|
+
}[];
|
|
195
|
+
}[];
|
|
65
196
|
moduleId: "@phis/ui/modules/app";
|
|
66
197
|
area: "app";
|
|
67
198
|
}, "area"> & {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { definePhiAreaBaseRuntimeModuleDefinition } from "../area-base-definition";
|
|
2
2
|
import { PHI_APP_FORM_HANDLER_PROVIDER_DESCRIPTORS } from "./forms";
|
|
3
|
+
import { PHI_APP_RUNTIME_DATA_PROVIDER_DESCRIPTORS } from "./data-providers";
|
|
3
4
|
import { PHI_APP_RUNTIME_MODULE_IDENTITY } from "./ids";
|
|
4
5
|
import { PHI_CORE_SERVER_BINDING, } from "../../../types/server-capabilities";
|
|
5
6
|
export const PHI_APP_RUNTIME_MODULE_DEFINITION = definePhiAreaBaseRuntimeModuleDefinition({
|
|
@@ -12,4 +13,5 @@ export const PHI_APP_RUNTIME_MODULE_DEFINITION = definePhiAreaBaseRuntimeModuleD
|
|
|
12
13
|
formProviders: {
|
|
13
14
|
handlers: PHI_APP_FORM_HANDLER_PROVIDER_DESCRIPTORS,
|
|
14
15
|
},
|
|
16
|
+
dataProviders: PHI_APP_RUNTIME_DATA_PROVIDER_DESCRIPTORS,
|
|
15
17
|
});
|
|
@@ -12,11 +12,14 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const PHI_APP_FORM_IDS: {
|
|
14
14
|
readonly profileName: `${string}/forms/${string}`;
|
|
15
|
+
readonly profilePhone: `${string}/forms/${string}`;
|
|
16
|
+
readonly addressCreate: `${string}/forms/${string}`;
|
|
17
|
+
readonly addressEdit: `${string}/forms/${string}`;
|
|
15
18
|
readonly profileNewsletter: `${string}/forms/${string}`;
|
|
16
19
|
readonly profileLocale: `${string}/forms/${string}`;
|
|
17
20
|
readonly profileTheme: `${string}/forms/${string}`;
|
|
18
21
|
};
|
|
19
|
-
export declare const PHI_APP_RUNTIME_MODULE_FORMS: readonly [import("../contracts").PhiRuntimeModuleFormDefinition, import("../contracts").PhiRuntimeModuleFormDefinition, import("../contracts").PhiRuntimeModuleFormDefinition, import("../contracts").PhiRuntimeModuleFormDefinition];
|
|
22
|
+
export declare const PHI_APP_RUNTIME_MODULE_FORMS: readonly [import("../contracts").PhiRuntimeModuleFormDefinition, import("../contracts").PhiRuntimeModuleFormDefinition, import("../contracts").PhiRuntimeModuleFormDefinition, import("../contracts").PhiRuntimeModuleFormDefinition, import("../contracts").PhiRuntimeModuleFormDefinition, import("../contracts").PhiRuntimeModuleFormDefinition, import("../contracts").PhiRuntimeModuleFormDefinition];
|
|
20
23
|
export declare const PHI_APP_FORM_HANDLER_PROVIDER_DESCRIPTORS: ({
|
|
21
24
|
key: `${string}/${string}`;
|
|
22
25
|
ownerModuleId: "@phis/ui/modules/app";
|
|
@@ -31,6 +34,48 @@ export declare const PHI_APP_FORM_HANDLER_PROVIDER_DESCRIPTORS: ({
|
|
|
31
34
|
csrfPath: string;
|
|
32
35
|
requiresCsrf: true;
|
|
33
36
|
credentialPolicy: "site-session";
|
|
37
|
+
} | {
|
|
38
|
+
key: `${string}/${string}`;
|
|
39
|
+
ownerModuleId: "@phis/ui/modules/app";
|
|
40
|
+
title: string;
|
|
41
|
+
phase: "submit";
|
|
42
|
+
handlerKey: "site.app.profile-phone";
|
|
43
|
+
category: "site";
|
|
44
|
+
transport: "relay";
|
|
45
|
+
method: "PATCH";
|
|
46
|
+
endpointKey: null;
|
|
47
|
+
upstreamPath: string;
|
|
48
|
+
csrfPath: string;
|
|
49
|
+
requiresCsrf: true;
|
|
50
|
+
credentialPolicy: "site-session";
|
|
51
|
+
} | {
|
|
52
|
+
key: `${string}/${string}`;
|
|
53
|
+
ownerModuleId: "@phis/ui/modules/app";
|
|
54
|
+
title: string;
|
|
55
|
+
phase: "submit";
|
|
56
|
+
handlerKey: "site.app.address-create";
|
|
57
|
+
category: "site";
|
|
58
|
+
transport: "relay";
|
|
59
|
+
method: "POST";
|
|
60
|
+
endpointKey: null;
|
|
61
|
+
upstreamPath: string;
|
|
62
|
+
csrfPath: null;
|
|
63
|
+
requiresCsrf: false;
|
|
64
|
+
credentialPolicy: "site-session";
|
|
65
|
+
} | {
|
|
66
|
+
key: `${string}/${string}`;
|
|
67
|
+
ownerModuleId: "@phis/ui/modules/app";
|
|
68
|
+
title: string;
|
|
69
|
+
phase: "submit";
|
|
70
|
+
handlerKey: "site.app.address-edit";
|
|
71
|
+
category: "site";
|
|
72
|
+
transport: "relay";
|
|
73
|
+
method: "PUT";
|
|
74
|
+
endpointKey: null;
|
|
75
|
+
upstreamPath: string;
|
|
76
|
+
csrfPath: null;
|
|
77
|
+
requiresCsrf: false;
|
|
78
|
+
credentialPolicy: "site-session";
|
|
34
79
|
} | {
|
|
35
80
|
key: `${string}/${string}`;
|
|
36
81
|
ownerModuleId: "@phis/ui/modules/app";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { createPhiFormLabelSetLoader } from "../../../components/forms/shared-form-loaders";
|
|
2
2
|
import { createPhiFormId } from "../../../types/form-id";
|
|
3
3
|
import { PHI_SHARED_PACKAGE_NAME } from "../../../types/signals";
|
|
4
|
-
import { PHI_FORM_FIELD_PROVIDER_KEYS, createPhiSharedFormProviderKey, } from "../../../components/forms/form-provider-contract";
|
|
4
|
+
import { PHI_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_VALIDATION_PROVIDER_KEYS, createPhiSharedFormProviderKey, } from "../../../components/forms/form-provider-contract";
|
|
5
5
|
import { PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS } from "../../../constants/core-data-provider-keys";
|
|
6
6
|
import { definePhiRuntimeModuleForm } from "../../../components/forms/form-registry";
|
|
7
7
|
import { PHI_APP_RUNTIME_MODULE_ID } from "./ids";
|
|
8
8
|
import { phiFormLabel as label } from "../../../components/forms/form-descriptor-text";
|
|
9
|
+
import { PhisSiteAddressFlags } from "@phis/contracts/users";
|
|
9
10
|
/**
|
|
10
11
|
* What a signed-in person can settle about their own account, as Forms rather than as Widgets.
|
|
11
12
|
*
|
|
@@ -20,17 +21,25 @@ import { phiFormLabel as label } from "../../../components/forms/form-descriptor
|
|
|
20
21
|
*/
|
|
21
22
|
export const PHI_APP_FORM_IDS = {
|
|
22
23
|
profileName: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "app/profile-name"),
|
|
24
|
+
profilePhone: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "app/profile-phone"),
|
|
25
|
+
addressCreate: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "app/address-create"),
|
|
26
|
+
addressEdit: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "app/address-edit"),
|
|
23
27
|
profileNewsletter: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "app/profile-newsletter"),
|
|
24
28
|
profileLocale: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "app/profile-locale"),
|
|
25
29
|
profileTheme: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "app/profile-theme"),
|
|
26
30
|
};
|
|
27
31
|
const PHI_APP_FORM_HANDLER_KEYS = {
|
|
28
32
|
profileName: "site.app.profile-name",
|
|
33
|
+
profilePhone: "site.app.profile-phone",
|
|
34
|
+
addressCreate: "site.app.address-create",
|
|
35
|
+
addressEdit: "site.app.address-edit",
|
|
29
36
|
profileNewsletter: "site.app.profile-newsletter",
|
|
30
37
|
profileLocale: "site.app.profile-locale",
|
|
31
38
|
profileTheme: "site.app.profile-theme",
|
|
32
39
|
};
|
|
33
40
|
const NAME_LABEL_SET_KEY = "@phis/ui/modules/app/labels/profile-name";
|
|
41
|
+
const PHONE_LABEL_SET_KEY = "@phis/ui/modules/app/labels/profile-phone";
|
|
42
|
+
const ADDRESS_LABEL_SET_KEY = "@phis/ui/modules/app/labels/address";
|
|
34
43
|
const NEWSLETTER_LABEL_SET_KEY = "@phis/ui/modules/app/labels/profile-newsletter";
|
|
35
44
|
const LOCALE_LABEL_SET_KEY = "@phis/ui/modules/app/labels/profile-locale";
|
|
36
45
|
const THEME_LABEL_SET_KEY = "@phis/ui/modules/app/labels/profile-theme";
|
|
@@ -79,6 +88,91 @@ const nameDescriptor = {
|
|
|
79
88
|
},
|
|
80
89
|
layout: { gap: { compact: "sm", medium: "base" } },
|
|
81
90
|
};
|
|
91
|
+
/**
|
|
92
|
+
* The two numbers beside the name, a Form of their own because Core keeps them behind their own write
|
|
93
|
+
* (`PATCH /api/v1/auth/profile/phone`), which takes both at once: what is sent is what is kept, an empty
|
|
94
|
+
* field clears its number. They are written as the person writes them -- spaces, a leading `+`, an
|
|
95
|
+
* extension -- so the rule is the Core's own length and nothing about the digits; the member picker finds a
|
|
96
|
+
* person by them either way.
|
|
97
|
+
*/
|
|
98
|
+
const PHONE_MAX_LENGTH = 64;
|
|
99
|
+
const phoneDescriptor = {
|
|
100
|
+
schemaVersion: 1,
|
|
101
|
+
key: PHI_APP_FORM_IDS.profilePhone,
|
|
102
|
+
labelSetKey: PHONE_LABEL_SET_KEY,
|
|
103
|
+
fields: [
|
|
104
|
+
{
|
|
105
|
+
key: "phone",
|
|
106
|
+
fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.tel,
|
|
107
|
+
label: label("phone", "Business phone"),
|
|
108
|
+
autoComplete: "work tel",
|
|
109
|
+
validation: [{
|
|
110
|
+
providerKey: PHI_FORM_VALIDATION_PROVIDER_KEYS.maxLength,
|
|
111
|
+
message: label("tooLong", "At most 64 characters."),
|
|
112
|
+
config: { max: PHONE_MAX_LENGTH },
|
|
113
|
+
}],
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
key: "mobile",
|
|
117
|
+
fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.tel,
|
|
118
|
+
label: label("mobile", "Mobile"),
|
|
119
|
+
autoComplete: "mobile tel",
|
|
120
|
+
validation: [{
|
|
121
|
+
providerKey: PHI_FORM_VALIDATION_PROVIDER_KEYS.maxLength,
|
|
122
|
+
message: label("tooLong", "At most 64 characters."),
|
|
123
|
+
config: { max: PHONE_MAX_LENGTH },
|
|
124
|
+
}],
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
success: {
|
|
128
|
+
title: label("successTitle", "Numbers updated"),
|
|
129
|
+
text: label("successText", "Your telephone numbers have been saved."),
|
|
130
|
+
},
|
|
131
|
+
layout: { gap: { compact: "sm", medium: "base" } },
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* One address of the account's book, added or changed (`users:v1`, phis-server
|
|
135
|
+
* `/api/site/account/addresses`): the same two fields twice, the change with the hidden id of the version
|
|
136
|
+
* it replaces in its address. Core takes `{ address, flags }`, and the fields are those two values: the
|
|
137
|
+
* `address` field holds the parts as `PhisSiteAddressInput` and its own rules, the `flags` field what the
|
|
138
|
+
* address is for as `PhisSiteAddressFlags`, a default offered only beside its purpose -- Core refuses a
|
|
139
|
+
* default for a purpose the address does not have.
|
|
140
|
+
*/
|
|
141
|
+
const ADDRESS_FLAG_OPTIONS = [
|
|
142
|
+
{ value: String(PhisSiteAddressFlags.Billing), label: label("billing", "Billing address") },
|
|
143
|
+
{ value: String(PhisSiteAddressFlags.Shipping), label: label("shipping", "Shipping address") },
|
|
144
|
+
{ value: String(PhisSiteAddressFlags.DefaultBilling), label: label("defaultBilling", "Default for billing") },
|
|
145
|
+
{ value: String(PhisSiteAddressFlags.DefaultShipping), label: label("defaultShipping", "Default for shipping") },
|
|
146
|
+
];
|
|
147
|
+
function addressDescriptor(formId, mode) {
|
|
148
|
+
return {
|
|
149
|
+
schemaVersion: 1,
|
|
150
|
+
key: formId,
|
|
151
|
+
labelSetKey: ADDRESS_LABEL_SET_KEY,
|
|
152
|
+
fields: [
|
|
153
|
+
...(mode === "edit" ? [{ key: "id", fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.hidden }] : []),
|
|
154
|
+
{ key: "address", fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.address },
|
|
155
|
+
{
|
|
156
|
+
key: "flags",
|
|
157
|
+
fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.flags,
|
|
158
|
+
label: label("purposes", "Used for"),
|
|
159
|
+
options: ADDRESS_FLAG_OPTIONS,
|
|
160
|
+
config: {
|
|
161
|
+
requires: {
|
|
162
|
+
[String(PhisSiteAddressFlags.DefaultBilling)]: String(PhisSiteAddressFlags.Billing),
|
|
163
|
+
[String(PhisSiteAddressFlags.DefaultShipping)]: String(PhisSiteAddressFlags.Shipping),
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
...(mode === "create" ? { initialValue: PhisSiteAddressFlags.Billing | PhisSiteAddressFlags.Shipping } : {}),
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
success: {
|
|
170
|
+
title: label("successTitle", "Address saved"),
|
|
171
|
+
text: label("successText", "Your address has been saved."),
|
|
172
|
+
},
|
|
173
|
+
layout: { gap: { compact: "sm", medium: "base" } },
|
|
174
|
+
};
|
|
175
|
+
}
|
|
82
176
|
/**
|
|
83
177
|
* One switch, and therefore no Save button: the Preset routes the Form's own `stateChange` back to
|
|
84
178
|
* its `submit` channel, so flipping it is the submit. A panel holding more than one field states a
|
|
@@ -177,6 +271,15 @@ const loadNameLabels = createPhiFormLabelSetLoader(() => import("../../../compon
|
|
|
177
271
|
successText: labels.feedback.successText,
|
|
178
272
|
actions: { submitLabel: labels.submitLabel },
|
|
179
273
|
}));
|
|
274
|
+
const loadPhoneLabels = createPhiFormLabelSetLoader(() => import("../../../components/widgets/label-sets/profile").then((module) => module.getPhiProfilePhoneWidgetLabels), (labels) => ({
|
|
275
|
+
phone: labels.fields.phone,
|
|
276
|
+
mobile: labels.fields.mobile,
|
|
277
|
+
tooLong: labels.tooLong,
|
|
278
|
+
successTitle: labels.feedback.successTitle,
|
|
279
|
+
successText: labels.feedback.successText,
|
|
280
|
+
actions: { submitLabel: labels.submitLabel },
|
|
281
|
+
}));
|
|
282
|
+
const loadAddressLabels = createPhiFormLabelSetLoader(() => import("./trees/addresses-label-set").then((module) => module.getPhiAppAddressesLabels), (labels) => ({ ...labels.form, actions: { submitLabel: labels.save } }));
|
|
180
283
|
const loadNewsletterLabels = createPhiFormLabelSetLoader(() => import("../../../components/widgets/label-sets/profile").then((module) => module.getPhiProfileOverviewWidgetLabels), (labels) => ({
|
|
181
284
|
newsletter: labels.newsletterLabel,
|
|
182
285
|
newsletterDescription: labels.newsletterDescription,
|
|
@@ -205,6 +308,48 @@ export const PHI_APP_RUNTIME_MODULE_FORMS = [
|
|
|
205
308
|
submitHandlerKey: PHI_APP_FORM_HANDLER_KEYS.profileName,
|
|
206
309
|
loadLabels: loadNameLabels,
|
|
207
310
|
}),
|
|
311
|
+
definePhiRuntimeModuleForm({
|
|
312
|
+
ownerModuleId: PHI_APP_RUNTIME_MODULE_ID,
|
|
313
|
+
areas: ["app"],
|
|
314
|
+
formId: PHI_APP_FORM_IDS.profilePhone,
|
|
315
|
+
version: 1,
|
|
316
|
+
flags: 0,
|
|
317
|
+
title: "Telephone numbers",
|
|
318
|
+
description: "The business telephone and mobile number this account can be reached at.",
|
|
319
|
+
category: "forms",
|
|
320
|
+
tags: ["profile", "account"],
|
|
321
|
+
descriptor: phoneDescriptor,
|
|
322
|
+
submitHandlerKey: PHI_APP_FORM_HANDLER_KEYS.profilePhone,
|
|
323
|
+
loadLabels: loadPhoneLabels,
|
|
324
|
+
}),
|
|
325
|
+
definePhiRuntimeModuleForm({
|
|
326
|
+
ownerModuleId: PHI_APP_RUNTIME_MODULE_ID,
|
|
327
|
+
areas: ["app"],
|
|
328
|
+
formId: PHI_APP_FORM_IDS.addressCreate,
|
|
329
|
+
version: 1,
|
|
330
|
+
flags: 0,
|
|
331
|
+
title: "Add address",
|
|
332
|
+
description: "A billing or shipping address of this account on this site.",
|
|
333
|
+
category: "forms",
|
|
334
|
+
tags: ["profile", "account", "address"],
|
|
335
|
+
descriptor: addressDescriptor(PHI_APP_FORM_IDS.addressCreate, "create"),
|
|
336
|
+
submitHandlerKey: PHI_APP_FORM_HANDLER_KEYS.addressCreate,
|
|
337
|
+
loadLabels: loadAddressLabels,
|
|
338
|
+
}),
|
|
339
|
+
definePhiRuntimeModuleForm({
|
|
340
|
+
ownerModuleId: PHI_APP_RUNTIME_MODULE_ID,
|
|
341
|
+
areas: ["app"],
|
|
342
|
+
formId: PHI_APP_FORM_IDS.addressEdit,
|
|
343
|
+
version: 1,
|
|
344
|
+
flags: 0,
|
|
345
|
+
title: "Change address",
|
|
346
|
+
description: "A new version of one of this account's addresses, replacing it.",
|
|
347
|
+
category: "forms",
|
|
348
|
+
tags: ["profile", "account", "address"],
|
|
349
|
+
descriptor: addressDescriptor(PHI_APP_FORM_IDS.addressEdit, "edit"),
|
|
350
|
+
submitHandlerKey: PHI_APP_FORM_HANDLER_KEYS.addressEdit,
|
|
351
|
+
loadLabels: loadAddressLabels,
|
|
352
|
+
}),
|
|
208
353
|
definePhiRuntimeModuleForm({
|
|
209
354
|
ownerModuleId: PHI_APP_RUNTIME_MODULE_ID,
|
|
210
355
|
areas: ["app"],
|
|
@@ -271,6 +416,55 @@ export const PHI_APP_FORM_HANDLER_PROVIDER_DESCRIPTORS = [
|
|
|
271
416
|
requiresCsrf: true,
|
|
272
417
|
credentialPolicy: "site-session",
|
|
273
418
|
},
|
|
419
|
+
{
|
|
420
|
+
key: createPhiSharedFormProviderKey("handler", "app-profile-phone"),
|
|
421
|
+
ownerModuleId: PHI_APP_RUNTIME_MODULE_ID,
|
|
422
|
+
title: "Profile telephone numbers",
|
|
423
|
+
phase: "submit",
|
|
424
|
+
handlerKey: PHI_APP_FORM_HANDLER_KEYS.profilePhone,
|
|
425
|
+
category: "site",
|
|
426
|
+
transport: "relay",
|
|
427
|
+
method: "PATCH",
|
|
428
|
+
endpointKey: null,
|
|
429
|
+
upstreamPath: "/api/v1/auth/profile/phone",
|
|
430
|
+
csrfPath: "/api/v1/auth/csrf",
|
|
431
|
+
requiresCsrf: true,
|
|
432
|
+
credentialPolicy: "site-session",
|
|
433
|
+
},
|
|
434
|
+
/*
|
|
435
|
+
* The address book's two writes. The Form's two values are Core's `{ address, flags }`; a change names
|
|
436
|
+
* the version it replaces in its path, the hidden `id` as `{id}`.
|
|
437
|
+
*/
|
|
438
|
+
{
|
|
439
|
+
key: createPhiSharedFormProviderKey("handler", "app-address-create"),
|
|
440
|
+
ownerModuleId: PHI_APP_RUNTIME_MODULE_ID,
|
|
441
|
+
title: "Add address",
|
|
442
|
+
phase: "submit",
|
|
443
|
+
handlerKey: PHI_APP_FORM_HANDLER_KEYS.addressCreate,
|
|
444
|
+
category: "site",
|
|
445
|
+
transport: "relay",
|
|
446
|
+
method: "POST",
|
|
447
|
+
endpointKey: null,
|
|
448
|
+
upstreamPath: "/api/site/account/addresses",
|
|
449
|
+
csrfPath: null,
|
|
450
|
+
requiresCsrf: false,
|
|
451
|
+
credentialPolicy: "site-session",
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
key: createPhiSharedFormProviderKey("handler", "app-address-edit"),
|
|
455
|
+
ownerModuleId: PHI_APP_RUNTIME_MODULE_ID,
|
|
456
|
+
title: "Change address",
|
|
457
|
+
phase: "submit",
|
|
458
|
+
handlerKey: PHI_APP_FORM_HANDLER_KEYS.addressEdit,
|
|
459
|
+
category: "site",
|
|
460
|
+
transport: "relay",
|
|
461
|
+
method: "PUT",
|
|
462
|
+
endpointKey: null,
|
|
463
|
+
upstreamPath: "/api/site/account/addresses/{id}",
|
|
464
|
+
csrfPath: null,
|
|
465
|
+
requiresCsrf: false,
|
|
466
|
+
credentialPolicy: "site-session",
|
|
467
|
+
},
|
|
274
468
|
{
|
|
275
469
|
key: createPhiSharedFormProviderKey("handler", "app-profile-newsletter"),
|
|
276
470
|
ownerModuleId: PHI_APP_RUNTIME_MODULE_ID,
|
|
@@ -8,3 +8,10 @@ export declare const PHI_APP_RUNTIME_MODULE_ID: "@phis/ui/modules/app";
|
|
|
8
8
|
export declare const PHI_APP_RUNTIME_MODULE_IDENTITY: {
|
|
9
9
|
readonly moduleId: "@phis/ui/modules/app";
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* The signed-in person's own addresses on this Site (phis-server `GET /api/site/account/addresses`,
|
|
13
|
+
* `users:v1`), as the account lists, adds, changes and removes them.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PHI_APP_ADDRESSES_DATA_PROVIDER_KEY: `${string}/${string}`;
|
|
16
|
+
/** The one resource the addresses Provider answers. */
|
|
17
|
+
export declare const PHI_APP_ADDRESSES_RESOURCE_KEY = "addresses";
|