@pega/custom-dx-components 26.1.11 → 26.1.12-alpha-0.1
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 +6 -2
- package/package.json +44 -61
- package/src/ai/README.md +44 -0
- package/src/ai/catalog/README.md +133 -0
- package/src/ai/catalog/best-practices/README.md +24 -0
- package/src/ai/catalog/best-practices/accessibility-for-async-components.md +53 -0
- package/src/ai/catalog/best-practices/error-handling-and-resiliency.md +116 -0
- package/src/ai/catalog/best-practices/genai-assistant-integration-patterns.md +49 -0
- package/src/ai/catalog/best-practices/performance-and-efficiency.md +109 -0
- package/src/ai/catalog/best-practices/security-considerations.md +93 -0
- package/src/ai/catalog/best-practices/testing-pconnect-components.md +245 -0
- package/src/ai/catalog/best-practices/troubleshooting-common-pitfalls.md +132 -0
- package/src/ai/catalog/pconnect-assignment-lifecycle/SKILL.md +44 -0
- package/src/ai/catalog/pconnect-assignment-lifecycle/cookbooks/README.md +39 -0
- package/src/ai/catalog/pconnect-assignment-lifecycle/cookbooks/approval-workflow-decision.md +47 -0
- package/src/ai/catalog/pconnect-assignment-lifecycle/cookbooks/attachment-upload.md +45 -0
- package/src/ai/catalog/pconnect-assignment-lifecycle/cookbooks/bulk-action-submit.md +50 -0
- package/src/ai/catalog/pconnect-assignment-lifecycle/cookbooks/confirm-before-destructive-action.md +43 -0
- package/src/ai/catalog/pconnect-assignment-lifecycle/cookbooks/create-and-stage-new-case.md +45 -0
- package/src/ai/catalog/pconnect-assignment-lifecycle/cookbooks/graceful-submit-failure.md +39 -0
- package/src/ai/catalog/pconnect-assignment-lifecycle/cookbooks/modal-assignment-submit.md +58 -0
- package/src/ai/catalog/pconnect-assignment-lifecycle/cookbooks/multi-step-wizard.md +44 -0
- package/src/ai/catalog/pconnect-assignment-lifecycle/cookbooks/resolve-or-ignore-duplicate.md +47 -0
- package/src/ai/catalog/pconnect-assignment-lifecycle/cookbooks/safe-case-deletion.md +36 -0
- package/src/ai/catalog/pconnect-case-collaboration/SKILL.md +42 -0
- package/src/ai/catalog/pconnect-case-collaboration/cookbooks/README.md +36 -0
- package/src/ai/catalog/pconnect-case-collaboration/cookbooks/look-up-user-details.md +43 -0
- package/src/ai/catalog/pconnect-case-collaboration/cookbooks/manage-case-attachments.md +51 -0
- package/src/ai/catalog/pconnect-case-collaboration/cookbooks/manage-case-participants.md +52 -0
- package/src/ai/catalog/pconnect-case-collaboration/cookbooks/participant-and-follower.md +40 -0
- package/src/ai/catalog/pconnect-case-collaboration/cookbooks/post-and-manage-feed.md +50 -0
- package/src/ai/catalog/pconnect-case-collaboration/cookbooks/relate-cases.md +35 -0
- package/src/ai/catalog/pconnect-case-collaboration/cookbooks/tag-case-and-find-related.md +44 -0
- package/src/ai/catalog/pconnect-data-subscriptions/SKILL.md +42 -0
- package/src/ai/catalog/pconnect-data-subscriptions/cookbooks/README.md +35 -0
- package/src/ai/catalog/pconnect-data-subscriptions/cookbooks/data-page-subscription-cleanup.md +41 -0
- package/src/ai/catalog/pconnect-data-subscriptions/cookbooks/publish-and-subscribe-events.md +40 -0
- package/src/ai/catalog/pconnect-data-subscriptions/cookbooks/pubsub-cleanup.md +38 -0
- package/src/ai/catalog/pconnect-data-subscriptions/cookbooks/query-paginated-list-data.md +44 -0
- package/src/ai/catalog/pconnect-data-subscriptions/cookbooks/realtime-case-subscription.md +46 -0
- package/src/ai/catalog/pconnect-data-subscriptions/cookbooks/refresh-and-update-data.md +41 -0
- package/src/ai/catalog/pconnect-forms-and-fields/SKILL.md +44 -0
- package/src/ai/catalog/pconnect-forms-and-fields/cookbooks/README.md +36 -0
- package/src/ai/catalog/pconnect-forms-and-fields/cookbooks/autosave-tracking.md +45 -0
- package/src/ai/catalog/pconnect-forms-and-fields/cookbooks/cascading-dependent-fields.md +51 -0
- package/src/ai/catalog/pconnect-forms-and-fields/cookbooks/collect-form-changes-for-manual-save.md +45 -0
- package/src/ai/catalog/pconnect-forms-and-fields/cookbooks/custom-field-validators.md +44 -0
- package/src/ai/catalog/pconnect-forms-and-fields/cookbooks/discard-changes-and-reset-form.md +41 -0
- package/src/ai/catalog/pconnect-forms-and-fields/cookbooks/full-form-validation.md +38 -0
- package/src/ai/catalog/pconnect-forms-and-fields/cookbooks/persist-widget-ui-state.md +41 -0
- package/src/ai/catalog/pconnect-lists-and-views/SKILL.md +44 -0
- package/src/ai/catalog/pconnect-lists-and-views/cookbooks/README.md +35 -0
- package/src/ai/catalog/pconnect-lists-and-views/cookbooks/activate-and-switch-container-items.md +52 -0
- package/src/ai/catalog/pconnect-lists-and-views/cookbooks/container-item-lifecycle.md +61 -0
- package/src/ai/catalog/pconnect-lists-and-views/cookbooks/insert-delete-list-rows.md +40 -0
- package/src/ai/catalog/pconnect-lists-and-views/cookbooks/reorder-list-rows.md +39 -0
- package/src/ai/catalog/pconnect-lists-and-views/cookbooks/repeating-row-edit.md +39 -0
- package/src/ai/catalog/pconnect-lists-and-views/cookbooks/view-personalization.md +60 -0
- package/src/ai/catalog/pconnect-navigation-locale-genai/SKILL.md +45 -0
- package/src/ai/catalog/pconnect-navigation-locale-genai/cookbooks/README.md +35 -0
- package/src/ai/catalog/pconnect-navigation-locale-genai/cookbooks/agent-conversation-for-tasks.md +54 -0
- package/src/ai/catalog/pconnect-navigation-locale-genai/cookbooks/bookmarkable-filter-state.md +40 -0
- package/src/ai/catalog/pconnect-navigation-locale-genai/cookbooks/deep-link-semantic-url.md +39 -0
- package/src/ai/catalog/pconnect-navigation-locale-genai/cookbooks/genai-assistant-conversation.md +43 -0
- package/src/ai/catalog/pconnect-navigation-locale-genai/cookbooks/locale-switch-and-relocalize.md +38 -0
- package/src/ai/catalog/pconnect-navigation-locale-genai/cookbooks/persist-operator-preferences.md +40 -0
- package/src/ai/catalog/references/architecture-overview.md +52 -0
- package/src/ai/catalog/references/pconnect-actions-api.md +948 -0
- package/src/ai/catalog/references/pconnect-case-info-data-info-localization.md +618 -0
- package/src/ai/catalog/references/pconnect-case-validation-utilities.md +238 -0
- package/src/ai/catalog/references/pconnect-container-manager.md +215 -0
- package/src/ai/catalog/references/pconnect-list-actions.md +250 -0
- package/src/ai/catalog/references/pconnect-misc-suggestions-creation.md +231 -0
- package/src/ai/catalog/references/pconnect-reference-context-component.md +471 -0
- package/src/ai/catalog/references/pconnect-state-config.md +316 -0
- package/src/ai/catalog/references/pconnect-validation-api.md +45 -0
- package/src/ai/catalog/references/pcore-analytics-genai-details.md +50 -0
- package/src/ai/catalog/references/pcore-bootstrap-init-details.md +121 -0
- package/src/ai/catalog/references/pcore-bootstrap-registry-routing.md +253 -0
- package/src/ai/catalog/references/pcore-case-collaboration-details.md +191 -0
- package/src/ai/catalog/references/pcore-case-collaboration-genai.md +264 -0
- package/src/ai/catalog/references/pcore-environment-info-details.md +96 -0
- package/src/ai/catalog/references/pcore-environment-locale-namespace.md +175 -0
- package/src/ai/catalog/references/pcore-messaging-details.md +99 -0
- package/src/ai/catalog/references/pcore-misc-details.md +207 -0
- package/src/ai/catalog/references/pcore-misc-utilities.md +325 -0
- package/src/ai/catalog/references/pcore-rest-data-details.md +164 -0
- package/src/ai/catalog/references/pcore-rest-data-messaging.md +308 -0
- package/src/ai/catalog/references/pcore-store-context-details.md +40 -0
- package/src/ai/catalog/references/pcore-store-context-state.md +130 -0
- package/src/ai/index.js +154 -0
- package/src/ai/project/.claude/skills/boolean/SKILL.md +43 -0
- package/src/ai/project/.claude/skills/case/SKILL.md +58 -0
- package/src/ai/project/.claude/skills/create-dx-component/SKILL.md +98 -0
- package/src/ai/project/.claude/skills/create-dx-component/assets/PConnProps.d.ts +24 -0
- package/src/ai/project/.claude/skills/create-dx-component/assets/create-nonce.ts +5 -0
- package/src/ai/project/.claude/skills/create-dx-component/assets/event-utils.ts +18 -0
- package/src/ai/project/.claude/skills/create-dx-component/assets/styles.ts +7 -0
- package/src/ai/project/.claude/skills/create-dx-component/cookbooks/README.md +28 -0
- package/src/ai/project/.claude/skills/create-dx-component/cookbooks/build-a-data-widget.md +281 -0
- package/src/ai/project/.claude/skills/create-dx-component/cookbooks/field-with-limits-and-validation.md +156 -0
- package/src/ai/project/.claude/skills/create-dx-component/cookbooks/status-badge-field.md +97 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/accessibility.md +71 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/choosing-type-and-subtype.md +79 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/cli-workflow.md +125 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/component-patterns.md +241 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/config-schema.md +296 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/cosmos-components.md +137 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/field-behavior.md +155 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/field-essentials.md +90 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/field-subtypes-extra.md +68 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/localization.md +30 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/pcore-pconnect-apis.md +77 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/presentation-essentials.md +57 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/props-contract.md +182 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/state-matrix.md +102 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/storybook-pattern.md +262 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/styles-pattern.md +54 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/template-essentials.md +87 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/template-patterns.md +131 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/test-pattern.md +215 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/ui-gallery-reuse.md +93 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/widget-essentials.md +84 -0
- package/src/ai/project/.claude/skills/create-dx-component/references/widget-patterns.md +164 -0
- package/src/ai/project/.claude/skills/currency/SKILL.md +46 -0
- package/src/ai/project/.claude/skills/date/SKILL.md +46 -0
- package/src/ai/project/.claude/skills/decimal/SKILL.md +49 -0
- package/src/ai/project/.claude/skills/details/SKILL.md +60 -0
- package/src/ai/project/.claude/skills/email/SKILL.md +42 -0
- package/src/ai/project/.claude/skills/field/SKILL.md +68 -0
- package/src/ai/project/.claude/skills/form/SKILL.md +51 -0
- package/src/ai/project/.claude/skills/generate-component-set/SKILL.md +80 -0
- package/src/ai/project/.claude/skills/generate-component-set/component-manifest.json +161 -0
- package/src/ai/project/.claude/skills/identify-components/SKILL.md +76 -0
- package/src/ai/project/.claude/skills/integer/SKILL.md +45 -0
- package/src/ai/project/.claude/skills/page/SKILL.md +60 -0
- package/src/ai/project/.claude/skills/page-widget/SKILL.md +55 -0
- package/src/ai/project/.claude/skills/percentage/SKILL.md +52 -0
- package/src/ai/project/.claude/skills/phone/SKILL.md +44 -0
- package/src/ai/project/.claude/skills/picklist/SKILL.md +50 -0
- package/src/ai/project/.claude/skills/plan-dx-component/SKILL.md +51 -0
- package/src/ai/project/.claude/skills/plan-dx-component/references/design-system-mapping.md +108 -0
- package/src/ai/project/.claude/skills/plan-dx-component/references/intake.md +146 -0
- package/src/ai/project/.claude/skills/plan-dx-component/references/plan-template.md +76 -0
- package/src/ai/project/.claude/skills/plan-dx-component/references/requirements-template.md +88 -0
- package/src/ai/project/.claude/skills/presentation/SKILL.md +61 -0
- package/src/ai/project/.claude/skills/publish-library/SKILL.md +106 -0
- package/src/ai/project/.claude/skills/radiobuttons/SKILL.md +51 -0
- package/src/ai/project/.claude/skills/review-component/SKILL.md +49 -0
- package/src/ai/project/.claude/skills/review-component/references/checklist.md +77 -0
- package/src/ai/project/.claude/skills/template/SKILL.md +60 -0
- package/src/ai/project/.claude/skills/text/SKILL.md +45 -0
- package/src/ai/project/.claude/skills/update-dx-component/SKILL.md +56 -0
- package/src/ai/project/.claude/skills/update-dx-component/references/maintenance.md +43 -0
- package/src/ai/project/.claude/skills/url/SKILL.md +46 -0
- package/src/ai/project/.claude/skills/validate-component/SKILL.md +78 -0
- package/src/ai/project/.claude/skills/validate-component/references/runtime-troubleshooting.md +56 -0
- package/src/ai/project/.claude/skills/validate-component/scripts/check-component.mjs +327 -0
- package/src/ai/project/.claude/skills/widget/SKILL.md +59 -0
- package/src/ai/project/.gemini/settings.json +5 -0
- package/src/ai/project/AGENTS.md +74 -0
- package/src/ai/readme-section.md +91 -0
- package/src/cli.js +48 -7
- package/src/constants.js +54 -53
- package/src/internal-tests.js +27 -0
- package/src/tasks/ai-toggle/index.js +46 -0
- package/src/tasks/authenticate/helper.js +38 -38
- package/src/tasks/authenticate/index.js +17 -15
- package/src/tasks/build-all/helper.js +4 -4
- package/src/tasks/build-all/index.js +7 -7
- package/src/tasks/build-comp/helper.js +17 -17
- package/src/tasks/build-comp/index.js +10 -10
- package/src/tasks/build-jest-assets/index.js +7 -9
- package/src/tasks/build-lib/helper.js +8 -8
- package/src/tasks/build-lib/index.js +8 -8
- package/src/tasks/bundle/builder/index.js +9 -12
- package/src/tasks/bundle/builder/modules.js +8 -9
- package/src/tasks/bundle/builder/paths.js +2 -19
- package/src/tasks/bundle/builder/webpack.config.js +60 -77
- package/src/tasks/bundle/index.js +8 -8
- package/src/tasks/create/index.js +35 -35
- package/src/tasks/create/templates/Constellation/Field/Boolean/index.tsx.mustache +1 -36
- package/src/tasks/create/templates/Constellation/Field/Date/date.ts.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Field/Date/index.tsx.mustache +2 -27
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-utils.ts.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Field/DateTime/date.ts.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Field/DateTime/index.tsx.mustache +2 -35
- package/src/tasks/create/templates/Constellation/Field/Decimal/index.tsx.mustache +3 -36
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.tsx.mustache +4 -39
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.tsx.mustache +4 -53
- package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/index.tsx.mustache +5 -5
- package/src/tasks/create/templates/Constellation/Field/Integer/index.tsx.mustache +3 -36
- package/src/tasks/create/templates/Constellation/Field/Picklist/index.tsx.mustache +7 -42
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/component-constants.ts +1 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/date.ts.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/embed-utils.ts.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/index.tsx.mustache +11 -11
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/repeat-utils.ts.mustache +3 -13
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/textformat-utils.tsx.mustache +2 -3
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/utils.ts.mustache +28 -28
- package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/textformat-utils.tsx.mustache +2 -3
- package/src/tasks/create/templates/Constellation/Field/Text/index.tsx.mustache +4 -33
- package/src/tasks/create/templates/Constellation/Field/Text-Email/index.tsx.mustache +3 -33
- package/src/tasks/create/templates/Constellation/Field/Text-Input/index.tsx.mustache +3 -31
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.tsx.mustache +3 -31
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.tsx.mustache +3 -35
- package/src/tasks/create/templates/Constellation/Field/Text-URL/index.tsx.mustache +3 -33
- package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.tsx.mustache +2 -3
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/index.tsx.mustache +2 -35
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.ts.mustache +2 -2
- package/src/tasks/create/templates/Constellation/Template/DETAILS/Avatar.tsx.mustache +19 -15
- package/src/tasks/create/templates/Constellation/Template/DETAILS/Operator.tsx.mustache +6 -6
- package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Template/DETAILS/index.tsx.mustache +4 -8
- package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.ts.mustache +9 -9
- package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +4 -8
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/Avatar.tsx.mustache +19 -15
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/Operator.tsx.mustache +6 -6
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.ts.mustache +9 -9
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.ts.mustache +4 -8
- package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.tsx.mustache +8 -8
- package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.tsx.mustache +8 -8
- package/src/tasks/create/templates/Constellation/Template/PAGE/utils.ts.mustache +4 -9
- package/src/tasks/create/templates/Constellation/Widget/CASE/demo.test.tsx.mustache +3 -3
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Avatar.tsx.mustache +19 -14
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Operator.tsx.mustache +6 -6
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.ts.mustache +1 -1
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/index.tsx.mustache +5 -5
- package/src/tasks/create/templates/Launchpad/Field/Text-Phone/index.tsx.mustache +3 -35
- package/src/tasks/create/templates/Launchpad/Field/__components.md +1 -1
- package/src/tasks/create/templates/Launchpad/Template/FORM/demo.stories.tsx.mustache +8 -8
- package/src/tasks/create/templates/Launchpad/Template/FORM-region/demo.stories.tsx.mustache +8 -8
- package/src/tasks/create/templates/Launchpad/Widget/CASE/demo.test.tsx.mustache +3 -3
- package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/mock.ts.mustache +1 -1
- package/src/tasks/create-all/index.js +42 -41
- package/src/tasks/create-lib/helper.js +13 -13
- package/src/tasks/create-lib/index.js +5 -5
- package/src/tasks/create-version/helper.js +10 -10
- package/src/tasks/create-version/index.js +3 -4
- package/src/tasks/delete/helper.js +20 -19
- package/src/tasks/delete/index.js +2 -2
- package/src/tasks/delete-all/helper.js +26 -25
- package/src/tasks/delete-all/index.js +2 -2
- package/src/tasks/delete-lib/helper.js +6 -6
- package/src/tasks/delete-lib/index.js +6 -6
- package/src/tasks/delete-pub/helper.js +18 -18
- package/src/tasks/delete-pub/index.js +8 -8
- package/src/tasks/delete-version/index.js +2 -2
- package/src/tasks/dev-server/index.js +1 -1
- package/src/tasks/export-archive/helper.js +21 -21
- package/src/tasks/export-archive/index.js +27 -40
- package/src/tasks/export-rc/helper.js +34 -34
- package/src/tasks/export-rc/index.js +21 -31
- package/src/tasks/import-archive/helper.js +39 -39
- package/src/tasks/import-archive/index.js +69 -89
- package/src/tasks/import-comp/helper.js +8 -8
- package/src/tasks/import-comp/index.js +30 -42
- package/src/tasks/index.js +5 -0
- package/src/tasks/init/Node.gitignore +149 -0
- package/src/tasks/init/helper.js +15 -8
- package/src/tasks/init/index.js +115 -35
- package/src/tasks/init/template/.prettierrc.json +4 -1
- package/src/tasks/init/template/.storybook/main.ts +1 -4
- package/src/tasks/init/template/.storybook/manager.ts +1 -1
- package/src/tasks/init/template/.storybook/preview.tsx +2 -2
- package/src/tasks/init/template/.storybook/theme.js +1 -1
- package/src/tasks/init/template/.vscode/extensions.json +0 -1
- package/src/tasks/init/template/README.md +2 -2
- package/src/tasks/init/template/eslint.config.mjs +13 -155
- package/src/tasks/init/template/jest.config.cjs +2 -0
- package/src/tasks/init/template/package-lock.json +26864 -0
- package/src/tasks/init/template/package.json.mustache +19 -74
- package/src/tasks/init/template/setupTests.ts +10 -4
- package/src/tasks/init/template/tsconfig.json +14 -6
- package/src/tasks/internal-test/index.js +21 -0
- package/src/tasks/internal-test-full/index.js +15 -0
- package/src/tasks/internal-test-functional/index.js +15 -0
- package/src/tasks/internal-test-unit/index.js +13 -0
- package/src/tasks/linter/index.js +2 -2
- package/src/tasks/list/helper.js +41 -40
- package/src/tasks/list/index.js +3 -3
- package/src/tasks/list-lib/helper.js +5 -5
- package/src/tasks/list-lib/index.js +8 -8
- package/src/tasks/list-pub/helper.js +23 -16
- package/src/tasks/list-pub/index.js +24 -21
- package/src/tasks/move/helper.js +8 -8
- package/src/tasks/move/index.js +19 -23
- package/src/tasks/promote-webpack/index.js +4 -4
- package/src/tasks/promote-webpack/webpack.config.js +62 -93
- package/src/tasks/publish/helper.js +21 -21
- package/src/tasks/publish/index.js +16 -16
- package/src/tasks/publish-all/helper.js +20 -20
- package/src/tasks/publish-all/index.js +11 -12
- package/src/tasks/publish-archive/helper.js +9 -9
- package/src/tasks/publish-archive/index.js +12 -14
- package/src/tasks/publish-lib/helper.js +3 -3
- package/src/tasks/publish-lib/index.js +28 -34
- package/src/tasks/quarantine/index.js +8 -8
- package/src/tasks/rename/index.js +26 -30
- package/src/tasks/rename-lib/index.js +21 -25
- package/src/tasks/restore/index.js +8 -8
- package/src/tasks/restore-config/index.js +3 -5
- package/src/tasks/set-perm/index.js +8 -8
- package/src/tasks/show-help/index.js +17 -9
- package/src/tasks/show-status/index.js +2 -2
- package/src/tasks/store/index.js +8 -8
- package/src/tasks/switch-lib/helper.js +7 -7
- package/src/tasks/switch-lib/index.js +7 -7
- package/src/tasks/switch-version/helper.js +6 -6
- package/src/tasks/switch-version/index.js +7 -7
- package/src/tasks/update/index.js +1 -1
- package/src/tasks/upgrade/index.js +7 -7
- package/src/tasks/validator/index.js +49 -203
- package/src/util.js +169 -186
- package/src/rules/no-pcore-pconnect-in-presentation.js +0 -103
- package/src/tasks/init/template/.stylelintrc.json +0 -4
- package/src/tasks/init/template/babel.config.cjs +0 -22
- package/src/tasks/init/template/cspell.json +0 -14
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Look up operator details to display in a participant or feed card
|
|
3
|
+
keywords: [operator lookup, user profile, glimpse, avatar, display name]
|
|
4
|
+
primary_methods: [UserApi.getOperatorDetails]
|
|
5
|
+
related: [manage-case-participants]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Recipe: Look up operator details to display in a participant or feed card
|
|
9
|
+
|
|
10
|
+
> Part of the [Case Collaboration & Relationships cookbook](./README.md) — [skill overview](../SKILL.md).
|
|
11
|
+
|
|
12
|
+
## Problem
|
|
13
|
+
|
|
14
|
+
A participant card, feed entry, or follower row only has a raw operator/user ID and needs to render a display name, role, and other profile details.
|
|
15
|
+
|
|
16
|
+
## Solution
|
|
17
|
+
|
|
18
|
+
Uses `UserApi` (via `PCore.getUserApi()`, see [pcore-case-collaboration-details.md](../../references/pcore-case-collaboration-details.md)).
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
const { getOperatorDetails } = PCore.getUserApi();
|
|
22
|
+
|
|
23
|
+
// The typedefs type the result as a bare `object`; at runtime it is an Axios-style response, so cast to read `.data`.
|
|
24
|
+
const { data } = (await getOperatorDetails(operatorID)) as { data: Record<string, unknown> };
|
|
25
|
+
// data typically includes display name and other glimpse/profile fields — render defensively,
|
|
26
|
+
// since the exact shape depends on what the operator's profile has configured.
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
If `isBusinessID` is true for the caller's identifier type, pass it explicitly:
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
const { data } = (await getOperatorDetails(businessID, true)) as { data: Record<string, unknown> };
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Discussion
|
|
36
|
+
|
|
37
|
+
**SHOULD** cache the result per operator ID within a single view render (for example, a list of 30 feed entries from the same 3 authors) rather than calling `getOperatorDetails` once per row — the same operator's details do not change between rows in the same render pass.
|
|
38
|
+
|
|
39
|
+
**MUST NOT** assume every field is present on `data` — profile completeness varies per operator; render a sensible fallback (for example, the raw ID) if a display name is missing.
|
|
40
|
+
|
|
41
|
+
## Related recipes
|
|
42
|
+
|
|
43
|
+
- [List, look up, and update a case's participants](./manage-case-participants.md)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: List, edit, and delete a case's existing attachments
|
|
3
|
+
keywords: [attachment list, attachment panel, edit attachment, delete attachment, attachment categories]
|
|
4
|
+
primary_methods:
|
|
5
|
+
[
|
|
6
|
+
AttachmentUtils.getCaseAttachments,
|
|
7
|
+
AttachmentUtils.getAttachmentCategories,
|
|
8
|
+
AttachmentUtils.editAttachment,
|
|
9
|
+
AttachmentUtils.deleteAttachment
|
|
10
|
+
]
|
|
11
|
+
related: [post-and-manage-feed]
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Recipe: List, edit, and delete a case's existing attachments
|
|
15
|
+
|
|
16
|
+
> Part of the [Case Collaboration & Relationships cookbook](./README.md) — [skill overview](../SKILL.md).
|
|
17
|
+
|
|
18
|
+
## Problem
|
|
19
|
+
|
|
20
|
+
An attachments panel needs to show every file already linked to a case, let the user recategorize or rename one, and remove one — this is a separate concern from the initial upload-and-link flow.
|
|
21
|
+
|
|
22
|
+
## Solution
|
|
23
|
+
|
|
24
|
+
Uses `AttachmentUtils` (via `PCore.getAttachmentUtils()`, see [pcore-case-collaboration-details.md](../../references/pcore-case-collaboration-details.md)).
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
const { getCaseAttachments, getAttachmentCategories, editAttachment, deleteAttachment } = PCore.getAttachmentUtils();
|
|
28
|
+
|
|
29
|
+
// Populate the panel's list, including thumbnails for image attachments.
|
|
30
|
+
const attachments = await getCaseAttachments(caseID, context, true);
|
|
31
|
+
|
|
32
|
+
// Populate a "category" dropdown before showing the edit form.
|
|
33
|
+
const categories = await getAttachmentCategories(caseID, 'File', context);
|
|
34
|
+
|
|
35
|
+
// Rename/recategorize an existing attachment.
|
|
36
|
+
await editAttachment(attachmentID, { name: 'Signed contract.pdf', category: 'Legal' }, context);
|
|
37
|
+
|
|
38
|
+
// Remove an attachment (confirm first — see the destructive-action confirmation recipe).
|
|
39
|
+
await deleteAttachment(attachmentID, context);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Discussion
|
|
43
|
+
|
|
44
|
+
**SHOULD** gate `deleteAttachment` behind a confirmation prompt — see [Show a custom confirmation dialog before a destructive action](../../pconnect-assignment-lifecycle/cookbooks/confirm-before-destructive-action.md) — since it is irreversible from the component's perspective.
|
|
45
|
+
|
|
46
|
+
**MUST** re-fetch with `getCaseAttachments` (or update local state directly) after `editAttachment`/`deleteAttachment` — neither returns the full refreshed attachment list.
|
|
47
|
+
|
|
48
|
+
## Related recipes
|
|
49
|
+
|
|
50
|
+
- [Upload a file, attach it to a case, and handle a failed upload](../../pconnect-assignment-lifecycle/cookbooks/attachment-upload.md)
|
|
51
|
+
- [Show a custom confirmation dialog before a destructive action](../../pconnect-assignment-lifecycle/cookbooks/confirm-before-destructive-action.md)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: List, look up, and update a case's participants
|
|
3
|
+
keywords: [participants list, stakeholder list, team panel, participant roles, edit participant]
|
|
4
|
+
primary_methods:
|
|
5
|
+
[
|
|
6
|
+
StakeholderUtils.getParticipants,
|
|
7
|
+
StakeholderUtils.getParticipant,
|
|
8
|
+
StakeholderUtils.getParticipantRoles,
|
|
9
|
+
StakeholderUtils.updateParticipant
|
|
10
|
+
]
|
|
11
|
+
related: [participant-and-follower, look-up-user-details]
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Recipe: List, look up, and update a case's participants
|
|
15
|
+
|
|
16
|
+
> Part of the [Case Collaboration & Relationships cookbook](./README.md) — [skill overview](../SKILL.md).
|
|
17
|
+
|
|
18
|
+
## Problem
|
|
19
|
+
|
|
20
|
+
A "Team" panel needs to display every participant on a case, let the user drill into one participant's details, and save an edit to that participant — distinct from adding a brand-new participant.
|
|
21
|
+
|
|
22
|
+
## Solution
|
|
23
|
+
|
|
24
|
+
Uses `StakeholderUtils` (via `PCore.getStakeholderUtils()`, see [pcore-case-collaboration-details.md](../../references/pcore-case-collaboration-details.md)).
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
const { getParticipants, getParticipant, getParticipantRoles, updateParticipant } = PCore.getStakeholderUtils();
|
|
28
|
+
|
|
29
|
+
// Populate the panel's list.
|
|
30
|
+
const participants = await getParticipants(caseID, pConn);
|
|
31
|
+
|
|
32
|
+
// Fetch the roles configured for the case (for example, to offer role choices when adding a participant).
|
|
33
|
+
const availableRoles = await getParticipantRoles(caseID, pConn);
|
|
34
|
+
|
|
35
|
+
// Drill into one participant when the user selects a row.
|
|
36
|
+
const participant = await getParticipant(caseID, participantID, pConn);
|
|
37
|
+
|
|
38
|
+
// Save an edit to that participant. ParticipantData is { content: Record<string, string>; pageInstructions?: object[] },
|
|
39
|
+
// so the edited participant fields go inside `content`.
|
|
40
|
+
await updateParticipant(caseID, participantID, { content: { pyFirstName: 'Sam', pyLastName: 'Smith' } }, pConn);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Discussion
|
|
44
|
+
|
|
45
|
+
**SHOULD** re-fetch with `getParticipants` after `updateParticipant` if the list view needs to reflect the change immediately — `updateParticipant` does not return the full refreshed list.
|
|
46
|
+
|
|
47
|
+
**MUST** call `getParticipantRoles` to populate role choices from configuration rather than hardcoding role IDs in the component — available roles are case-type-specific and can change without a component release.
|
|
48
|
+
|
|
49
|
+
## Related recipes
|
|
50
|
+
|
|
51
|
+
- [Add a participant to a case and make them a follower](./participant-and-follower.md)
|
|
52
|
+
- [Look up operator details for display](./look-up-user-details.md)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Add a participant to a case and make them a follower
|
|
3
|
+
keywords: [stakeholder, participant, role, follower, notify a user]
|
|
4
|
+
primary_methods: [StakeholderUtils.createParticipant, CaseFollowerApi.addCaseFollower]
|
|
5
|
+
related: [relate-cases]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Recipe: Add a participant to a case and make them a follower
|
|
9
|
+
|
|
10
|
+
> Part of the [Case Collaboration & Relationships cookbook](./README.md) — [skill overview](../SKILL.md).
|
|
11
|
+
|
|
12
|
+
## Problem
|
|
13
|
+
|
|
14
|
+
A user needs to be added to a case in a specific role, and separately opted in to update notifications.
|
|
15
|
+
|
|
16
|
+
## Solution
|
|
17
|
+
|
|
18
|
+
Uses `StakeholderUtils` and `CaseFollowerApi` (both via `PCore.get*()`, see [pcore-case-collaboration-details.md](../../references/pcore-case-collaboration-details.md)).
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
const { createParticipant } = PCore.getStakeholderUtils();
|
|
22
|
+
const { addCaseFollower } = PCore.getCaseFollowerApi();
|
|
23
|
+
|
|
24
|
+
// participantData is { content: Record<string, string>; pageInstructions?: object[] },
|
|
25
|
+
// for example { content: { pyFirstName: 'Sam', pyLastName: 'Smith', pyEmail1: 'sam.smith@example.com' } }.
|
|
26
|
+
// createParticipant resolves to void — it does not return the new participant.
|
|
27
|
+
await createParticipant(caseID, roleID, participantData, pConn);
|
|
28
|
+
|
|
29
|
+
// Following is a separate concept from being a participant — add both if the user should get updates.
|
|
30
|
+
// addCaseFollower takes an array of user IDs.
|
|
31
|
+
await addCaseFollower(caseID, [userID], context);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Discussion
|
|
35
|
+
|
|
36
|
+
**MUST** call both APIs if the user needs both roles — creating a participant does NOT automatically make them a follower. They are independent concepts.
|
|
37
|
+
|
|
38
|
+
## Related recipes
|
|
39
|
+
|
|
40
|
+
- [Relate two cases together and confirm the relationship](./relate-cases.md)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Post, edit, and delete messages on a case's feed
|
|
3
|
+
keywords: [feed, pulse, comment, post message, discussion, reply]
|
|
4
|
+
primary_methods: [FeedUtils.getFeeds, FeedUtils.postMessage, FeedUtils.editMessage, FeedUtils.deleteMessage]
|
|
5
|
+
related: [manage-case-attachments]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Recipe: Post, edit, and delete messages on a case's feed
|
|
9
|
+
|
|
10
|
+
> Part of the [Case Collaboration & Relationships cookbook](./README.md) — [skill overview](../SKILL.md).
|
|
11
|
+
|
|
12
|
+
## Problem
|
|
13
|
+
|
|
14
|
+
A discussion/feed panel needs to load a case's existing feed entries, let the user post a new message (and reply to an existing one), and let the message's own author edit or delete it afterward.
|
|
15
|
+
|
|
16
|
+
## Solution
|
|
17
|
+
|
|
18
|
+
Uses `FeedUtils` (via `PCore.getFeedUtils()`, see [pcore-case-collaboration-details.md](../../references/pcore-case-collaboration-details.md)).
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
const { getFeeds, postMessage, editMessage, deleteMessage } = PCore.getFeedUtils();
|
|
22
|
+
|
|
23
|
+
// Initial load.
|
|
24
|
+
const feed = await getFeeds(context, feedID, feedClass, filters, cancelTokenSource, pConn);
|
|
25
|
+
|
|
26
|
+
// Post a new top-level message.
|
|
27
|
+
await postMessage(context, 'Reviewed and approved.', pConn);
|
|
28
|
+
|
|
29
|
+
// Reply to an existing message.
|
|
30
|
+
await postMessage(context, 'Confirming this is resolved.', pConn, undefined, true, undefined);
|
|
31
|
+
|
|
32
|
+
// Author-only edit.
|
|
33
|
+
await editMessage({ messageID, message: 'Reviewed and approved — see attached notes.', pConn });
|
|
34
|
+
|
|
35
|
+
// Author-only delete (void return — re-fetch or optimistically remove from local state).
|
|
36
|
+
deleteMessage(messageID, false, undefined, pConn);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
To load more/older entries in a paginated feed, call `getFeeds` again with `isLoadMore: true` rather than re-requesting from the beginning.
|
|
40
|
+
|
|
41
|
+
## Discussion
|
|
42
|
+
|
|
43
|
+
**MUST NOT** assume `deleteMessage` returns the updated feed — it returns `void`. Either re-call `getFeeds` or remove the message from local state directly after a successful call.
|
|
44
|
+
|
|
45
|
+
**SHOULD** pass a `cancelTokenSource` to `getFeeds` so an in-flight feed request can be canceled if the user navigates away before it resolves (see [Cancel Requests That Are No Longer Needed](../../best-practices/performance-and-efficiency.md#cancel-requests-that-are-no-longer-needed)).
|
|
46
|
+
|
|
47
|
+
## Related recipes
|
|
48
|
+
|
|
49
|
+
- [Upload a file, attach it to a case, and handle a failed upload](../../pconnect-assignment-lifecycle/cookbooks/attachment-upload.md)
|
|
50
|
+
- [List, look up, and update a case's participants](./manage-case-participants.md)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Relate two cases together and confirm the relationship
|
|
3
|
+
keywords: [related case, link cases, case relationship]
|
|
4
|
+
primary_methods: [RelatedCasesApi.addRelatedCases, RelatedCasesApi.getRelatedCases]
|
|
5
|
+
related: [participant-and-follower]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Recipe: Relate two cases together and confirm the relationship
|
|
9
|
+
|
|
10
|
+
> Part of the [Case Collaboration & Relationships cookbook](./README.md) — [skill overview](../SKILL.md).
|
|
11
|
+
|
|
12
|
+
## Problem
|
|
13
|
+
|
|
14
|
+
Two existing cases need to be linked as related cases, and the UI needs to refresh to show the new relationship.
|
|
15
|
+
|
|
16
|
+
## Solution
|
|
17
|
+
|
|
18
|
+
Uses `RelatedCasesApi` (via `PCore.getRelatedCasesApi()`, see [pcore-case-collaboration-details.md](../../references/pcore-case-collaboration-details.md)).
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
const { addRelatedCases, getRelatedCases } = PCore.getRelatedCasesApi();
|
|
22
|
+
|
|
23
|
+
await addRelatedCases(caseID, [{ caseID: relatedCaseID }], context);
|
|
24
|
+
|
|
25
|
+
// Re-fetch to confirm the relationship was recorded and to refresh any related-cases widget.
|
|
26
|
+
const relatedCases = await getRelatedCases(caseID, context);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Discussion
|
|
30
|
+
|
|
31
|
+
**MUST** re-fetch with `getRelatedCases` if a widget needs to reflect the new relationship immediately — `addRelatedCases` does NOT return the updated list itself.
|
|
32
|
+
|
|
33
|
+
## Related recipes
|
|
34
|
+
|
|
35
|
+
- [Add a participant to a case and make them a follower](./participant-and-follower.md)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Tag a case and browse other cases sharing that tag
|
|
3
|
+
keywords: [tag, label, categorize case, find similar cases, tags landing page]
|
|
4
|
+
primary_methods: [TagUtils.postTags, TagUtils.getTags, TagUtils.getTaggedCases, TagUtils.removeTag]
|
|
5
|
+
related: [relate-cases, participant-and-follower]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Recipe: Tag a case and browse other cases sharing that tag
|
|
9
|
+
|
|
10
|
+
> Part of the [Case Collaboration & Relationships cookbook](./README.md) — [skill overview](../SKILL.md).
|
|
11
|
+
|
|
12
|
+
## Problem
|
|
13
|
+
|
|
14
|
+
A user wants to apply an informal, ad-hoc label to a case (for example "Escalated") and later browse other cases that share tags with it — without creating a formal case relationship.
|
|
15
|
+
|
|
16
|
+
## Solution
|
|
17
|
+
|
|
18
|
+
Uses `TagUtils` (via `PCore.getTagUtils()`, see [pcore-case-collaboration-details.md](../../references/pcore-case-collaboration-details.md)).
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
const { getTags, postTags, getTaggedCases, removeTag } = PCore.getTagUtils();
|
|
22
|
+
|
|
23
|
+
await postTags(caseID, [{ Name: 'Escalated' }], pConn);
|
|
24
|
+
|
|
25
|
+
// Re-fetch to get the newly-created tag's own ID — postTags does not return it.
|
|
26
|
+
const tags = await getTags(caseID, pConn);
|
|
27
|
+
|
|
28
|
+
const relatedByTag = await getTaggedCases(caseID, pConn);
|
|
29
|
+
|
|
30
|
+
async function onRemoveTag(tagID: string) {
|
|
31
|
+
await removeTag(caseID, tagID, pConn);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Discussion
|
|
36
|
+
|
|
37
|
+
**MUST** call `getTags` again after `postTags` if you need to reference the tag you just added (for example, to render an immediate "remove" button next to it) — `removeTag` needs the tag's own ID, not its name, and `postTags` does NOT return the created tag's ID.
|
|
38
|
+
|
|
39
|
+
Tags are a distinct, lighter-weight concept from a formal case relationship: use this recipe for informal cross-cutting labels a user assigns themselves, and use [Relate two cases](./relate-cases.md) when the relationship is a structured, first-class link between two specific cases.
|
|
40
|
+
|
|
41
|
+
## Related recipes
|
|
42
|
+
|
|
43
|
+
- [Relate two cases](./relate-cases.md)
|
|
44
|
+
- [Add a participant and follower](./participant-and-follower.md)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pconnect-data-subscriptions
|
|
3
|
+
description: 'Reference catalog and cookbook for PCore/PConnect APIs governing data subscriptions and real-time updates — DataPageUtils, PubSubUtils, Events, MessagingServiceManager, and DataApiUtils — with recipes for subscribing to a data page with cleanup, publish/subscribe between unrelated components, subscribing to real-time server-pushed case updates, publishing a custom application-wide event, force-refreshing a stale cached data page, and querying a paginated/filterable list data view. Use when you need the exact signature for these APIs, or the correct subscribe/unsubscribe sequence to avoid orphaned handlers.'
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: 'Use when subscribing to a data page, publishing/subscribing between components, or reacting to real-time server-pushed case updates — for the exact DataPageUtils/PubSubUtils/MessagingServiceManager signature, or the correct subscribe/unsubscribe order.'
|
|
6
|
+
metadata:
|
|
7
|
+
verified-against: 'latest 26.x'
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Data Subscriptions & Real-time — PCore/PConnect Skill
|
|
11
|
+
|
|
12
|
+
This skill covers the PCore/PConnect APIs and recipes for **data subscriptions and real-time updates**: data page subscriptions, application-wide pub/sub between unrelated components, and server-pushed real-time case updates. It is one of the PCore/PConnect API skills — see the [skills index](../README.md) for the full method catalog, architecture primer, and the other five skills.
|
|
13
|
+
|
|
14
|
+
## When to Use This Skill
|
|
15
|
+
|
|
16
|
+
Load this skill when:
|
|
17
|
+
|
|
18
|
+
- You need the exact parameters, return type, or purpose of a `DataPageUtils`, `PubSubUtils`, `Events`, or `MessagingServiceManager` method.
|
|
19
|
+
- You're subscribing a component to a data page, an application-wide event, or a server-pushed WebSocket message, and need to avoid an orphaned subscription after unmount.
|
|
20
|
+
- You're unsure whether to use `PubSubUtils` (same-tab, locally published events) or `MessagingServiceManager` (server-pushed, cross-session updates).
|
|
21
|
+
|
|
22
|
+
If your task is about cascading one field from another (which also uses a subscribe/unsubscribe pattern, via `CascadeManager`), see [pconnect-forms-and-fields](../pconnect-forms-and-fields/SKILL.md) instead.
|
|
23
|
+
|
|
24
|
+
New to PCore/PConnect? Start with [Architecture at a Glance](../references/architecture-overview.md).
|
|
25
|
+
|
|
26
|
+
## Key Reference Files
|
|
27
|
+
|
|
28
|
+
| File | Class(es) | Obtained via |
|
|
29
|
+
| ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------- |
|
|
30
|
+
| [../references/pcore-rest-data-details.md](../references/pcore-rest-data-details.md) | `DataPageUtils`, `DataApi`, `DataApiUtils` | `PCore.get*()` |
|
|
31
|
+
| [../references/pcore-messaging-details.md](../references/pcore-messaging-details.md) | `PubSubUtils`, `Events`, `MessagingServiceManager`, `MessageManager` | `PCore.get*()` |
|
|
32
|
+
| [../references/pcore-rest-data-messaging.md](../references/pcore-rest-data-messaging.md) | REST client, data pages/views, cascade, messaging, refresh | `PCore.get*()` |
|
|
33
|
+
|
|
34
|
+
See the [full reference index](../README.md) for every other PCore/PConnect method not directly related to this skill's topic.
|
|
35
|
+
|
|
36
|
+
## Cookbooks
|
|
37
|
+
|
|
38
|
+
Multi-method, ordering/cleanup recipes for this skill's topic live in [cookbooks/README.md](./cookbooks/README.md): subscribing to a data page with cleanup, publish/subscribe between unrelated components, real-time server-pushed case update subscriptions, publishing a custom application-wide event, force-refreshing a stale cached data page, and querying a paginated/filterable list data view.
|
|
39
|
+
|
|
40
|
+
Use the reference files above for a single method's signature. Use the cookbook index when you need the **order** multiple methods should be called in to complete a task.
|
|
41
|
+
|
|
42
|
+
For testing subscribe/unsubscribe behavior, security considerations, performance (avoiding redundant subscriptions, canceling stale requests), resiliency when offline, accessibly announcing server-pushed updates, or troubleshooting a subscription that keeps firing after unmount, see [Cross-Cutting Best Practices](../best-practices/README.md).
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Data Subscriptions & Real-time Cookbook — Recipe Index
|
|
3
|
+
description: Multi-method recipes for data page subscriptions, pub/sub, and real-time case updates, indexed by symptom/keyword and primary method for AI/RAG retrieval.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Cookbook: Data Subscriptions & Real-time
|
|
7
|
+
|
|
8
|
+
> Part of the [Data Subscriptions & Real-time skill](../SKILL.md).
|
|
9
|
+
|
|
10
|
+
Every file in [`../../references/`](../../references/) documents one method at a time. Each file in this folder shows how to **chain multiple documented methods together** to complete one common real-world task. Every recipe only uses methods already cataloged in `references/` — follow the links in each recipe for full signatures. Nothing here invents a new API; every call is a direct composition of already-documented methods.
|
|
11
|
+
|
|
12
|
+
Each recipe is a single, self-contained file with:
|
|
13
|
+
|
|
14
|
+
- YAML frontmatter (`keywords`, `primary_methods`, `related`) for structured/metadata search.
|
|
15
|
+
- A **Problem** statement — what you're trying to accomplish, in plain language.
|
|
16
|
+
- A **Solution** — the minimal correct code, linking to the individual reference files for each method used.
|
|
17
|
+
- A **Discussion** — the ordering/cleanup/gotcha pitfall that makes this worth documenting as a recipe instead of assembling from scratch.
|
|
18
|
+
- **Related recipes** — links to recipes that share a pattern (lifecycle, cleanup, error handling, etc.), including recipes in sibling skills.
|
|
19
|
+
|
|
20
|
+
## Recipe Index
|
|
21
|
+
|
|
22
|
+
Search by symptom or keyword before assembling a sequence of calls from scratch — there is a good chance the ordering/cleanup pitfalls have already been worked out below.
|
|
23
|
+
|
|
24
|
+
| Recipe | Keywords | Primary methods |
|
|
25
|
+
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------- |
|
|
26
|
+
| [Data page subscription cleanup](./data-page-subscription-cleanup.md) | data page, polling, server push, memory leak, unmount, useEffect cleanup | `DataPageUtils` |
|
|
27
|
+
| [Pub/sub cleanup](./pubsub-cleanup.md) | event bus, publish, subscribe, cross-component communication, orphaned handler | `PubSubUtils`, `Events` |
|
|
28
|
+
| [Real-time case update subscription](./realtime-case-subscription.md) | WebSocket, server push, real-time update, live case status, messaging service | `MessagingServiceManager` |
|
|
29
|
+
| [Publish a custom application-wide event](./publish-and-subscribe-events.md) | event bus, publish, custom event, cross-component communication, broadcast | `PubSubUtils` |
|
|
30
|
+
| [Force-refresh a stale cached data page](./refresh-and-update-data.md) | refresh, stale cache, cache invalidation, force reload, refresh button | `DataPageUtils` |
|
|
31
|
+
| [Query a paginated, filterable list data view](./query-paginated-list-data.md) | list query, pagination, filter, sort, data view, search results | `DataApiUtils` |
|
|
32
|
+
|
|
33
|
+
Use the individual reference files in [`../../references/`](../../references/) to look up a single method's exact signature. Use a recipe here when you need to know the **order** multiple methods should be called in to complete a task.
|
|
34
|
+
|
|
35
|
+
As more cookbooks are added, add one file per recipe (not more content to an existing recipe file) and a row here — see any existing recipe file for the expected frontmatter/structure.
|
package/src/ai/catalog/pconnect-data-subscriptions/cookbooks/data-page-subscription-cleanup.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Subscribe to a data page and clean up on unmount
|
|
3
|
+
keywords: [data page, polling, server push, memory leak, unmount, useEffect cleanup]
|
|
4
|
+
primary_methods: [DataPageUtils.subscribeToDataPageUpdates, DataPageUtils.unsubscribeToDataPageUpdates]
|
|
5
|
+
related: [pubsub-cleanup, cascading-dependent-fields, autosave-tracking]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Recipe: Subscribe to a data page and clean up on unmount
|
|
9
|
+
|
|
10
|
+
> Part of the [Data Subscriptions & Real-time cookbook](./README.md) — [skill overview](../SKILL.md).
|
|
11
|
+
|
|
12
|
+
## Problem
|
|
13
|
+
|
|
14
|
+
A component needs to react to server-pushed updates to a data page, without leaking a subscription after the component unmounts.
|
|
15
|
+
|
|
16
|
+
## Solution
|
|
17
|
+
|
|
18
|
+
Uses `PCore.getDataPageUtils()` (see [pcore-rest-data-details.md](../../references/pcore-rest-data-details.md)) inside a component lifecycle.
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const subscriptionId = 'my-component-subscription';
|
|
23
|
+
|
|
24
|
+
PCore.getDataPageUtils().subscribeToDataPageUpdates(subscriptionId, onDataPageUpdate, 'D_Cases');
|
|
25
|
+
|
|
26
|
+
return () => {
|
|
27
|
+
// Always unsubscribe on unmount — an orphaned subscription keeps firing after the component is gone.
|
|
28
|
+
PCore.getDataPageUtils().unsubscribeToDataPageUpdates(subscriptionId, 'D_Cases');
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Discussion
|
|
34
|
+
|
|
35
|
+
**MUST** use the exact same `subscriptionId` and `dataPageName` pair for both subscribe and unsubscribe. **NEVER** let them drift apart — a mismatch makes the unsubscribe silently no-op, and the original callback keeps firing.
|
|
36
|
+
|
|
37
|
+
## Related recipes
|
|
38
|
+
|
|
39
|
+
- [Publish/subscribe between unrelated components, with cleanup](./pubsub-cleanup.md)
|
|
40
|
+
- [Register cascading/dependent fields and clean them up](../../pconnect-forms-and-fields/cookbooks/cascading-dependent-fields.md)
|
|
41
|
+
- [Track autosave status while editing a form](../../pconnect-forms-and-fields/cookbooks/autosave-tracking.md)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Publish a custom application-wide event for other components to react to
|
|
3
|
+
keywords: [event bus, publish, custom event, cross-component communication, broadcast]
|
|
4
|
+
primary_methods: [PubSubUtils.publish, PubSubUtils.subscribeOnce]
|
|
5
|
+
related: [pubsub-cleanup]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Recipe: Publish a custom application-wide event for other components to react to
|
|
9
|
+
|
|
10
|
+
> Part of the [Data Subscriptions & Real-time cookbook](./README.md) — [skill overview](../SKILL.md).
|
|
11
|
+
|
|
12
|
+
## Problem
|
|
13
|
+
|
|
14
|
+
A component completes an action (for example, "review submitted") that several unrelated components elsewhere in the page need to react to, without wiring them together directly through props or a shared parent.
|
|
15
|
+
|
|
16
|
+
## Solution
|
|
17
|
+
|
|
18
|
+
Uses `PCore.getPubSubUtils()` (see [pcore-messaging-details.md](../../references/pcore-messaging-details.md)). This is the publisher side of the pattern documented from the subscriber side in [Publish/subscribe between unrelated components, with cleanup](./pubsub-cleanup.md).
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
const CUSTOM_EVENT = 'my-app:review-submitted';
|
|
22
|
+
|
|
23
|
+
// Publisher — fires after the action completes.
|
|
24
|
+
function onReviewSubmitted(caseID) {
|
|
25
|
+
PCore.getPubSubUtils().publish(CUSTOM_EVENT, { caseID });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// A subscriber that only needs to react the next time this happens, not every time.
|
|
29
|
+
PCore.getPubSubUtils().subscribeOnce(CUSTOM_EVENT, ({ caseID }) => refreshSummaryPanel(caseID), 'summary-panel-once');
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Discussion
|
|
33
|
+
|
|
34
|
+
**SHOULD** namespace custom event names (for example, `my-app:review-submitted`) rather than a bare string like `reviewSubmitted` — `PubSubUtils` is a single, application-wide bus shared by every component, and an unnamespaced string can collide with another component's event.
|
|
35
|
+
|
|
36
|
+
**MUST** use `subscribeOnce` (not `subscribe` followed by a manual `unsubscribe` inside the handler) when a listener genuinely only needs to fire one time — it self-removes after the first invocation, which is easy to get wrong by hand.
|
|
37
|
+
|
|
38
|
+
## Related recipes
|
|
39
|
+
|
|
40
|
+
- [Publish/subscribe between unrelated components, with cleanup](./pubsub-cleanup.md)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Publish/subscribe between unrelated components, with cleanup
|
|
3
|
+
keywords: [event bus, publish, subscribe, cross-component communication, orphaned handler]
|
|
4
|
+
primary_methods: [PubSubUtils.subscribe, PubSubUtils.unsubscribe, Events.getCaseEvent]
|
|
5
|
+
related: [data-page-subscription-cleanup, cascading-dependent-fields]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Recipe: Publish/subscribe between unrelated components, with cleanup
|
|
9
|
+
|
|
10
|
+
> Part of the [Data Subscriptions & Real-time cookbook](./README.md) — [skill overview](../SKILL.md).
|
|
11
|
+
|
|
12
|
+
## Problem
|
|
13
|
+
|
|
14
|
+
Two components that don't share a parent/child relationship need to communicate through an application-wide event, without leaving a stale handler registered after either unmounts.
|
|
15
|
+
|
|
16
|
+
## Solution
|
|
17
|
+
|
|
18
|
+
Uses `PCore.getPubSubUtils()` (see [pcore-messaging-details.md](../../references/pcore-messaging-details.md)).
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const { subscribe, unsubscribe } = PCore.getPubSubUtils();
|
|
23
|
+
const handlerName = 'my-widget-stage-listener';
|
|
24
|
+
|
|
25
|
+
subscribe(PCore.getEvents().getCaseEvent().CREATE_STAGE_DONE, onStageCreated, handlerName);
|
|
26
|
+
|
|
27
|
+
return () => unsubscribe(PCore.getEvents().getCaseEvent().CREATE_STAGE_DONE, handlerName);
|
|
28
|
+
}, []);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Discussion
|
|
32
|
+
|
|
33
|
+
**MUST** use the same `name` for `subscribe`/`unsubscribe`. **NEVER** mismatch them (for example, unsubscribing with a different string) — doing so silently leaves the original handler active.
|
|
34
|
+
|
|
35
|
+
## Related recipes
|
|
36
|
+
|
|
37
|
+
- [Subscribe to a data page and clean up on unmount](./data-page-subscription-cleanup.md)
|
|
38
|
+
- [Register cascading/dependent fields and clean them up](../../pconnect-forms-and-fields/cookbooks/cascading-dependent-fields.md)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Query a paginated, filterable list data view
|
|
3
|
+
keywords: [list query, pagination, filter, sort, data view, search results]
|
|
4
|
+
primary_methods: [DataApiUtils.getData, DataApiUtils.getListCount, DataApiUtils.getDataViewMetadata]
|
|
5
|
+
related: [refresh-and-update-data]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Recipe: Query a paginated, filterable list data view
|
|
9
|
+
|
|
10
|
+
> Part of the [Data Subscriptions & Real-time cookbook](./README.md) — [skill overview](../SKILL.md).
|
|
11
|
+
|
|
12
|
+
## Problem
|
|
13
|
+
|
|
14
|
+
A grid/table needs to fetch a page of results from a list data view with filters and sorting applied, show a total record count for the pager, and know which columns are filterable/sortable ahead of rendering filter controls.
|
|
15
|
+
|
|
16
|
+
## Solution
|
|
17
|
+
|
|
18
|
+
Uses `PCore.getDataApiUtils()` (see [pcore-rest-data-details.md](../../references/pcore-rest-data-details.md)).
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
const { getData, getListCount, getDataViewMetadata } = PCore.getDataApiUtils();
|
|
22
|
+
|
|
23
|
+
// Render filter controls from the data view's own field metadata rather than hardcoding column config.
|
|
24
|
+
const metadata = await getDataViewMetadata('D_CaseSearchResults', context);
|
|
25
|
+
|
|
26
|
+
const payload = {
|
|
27
|
+
paging: { pageSize: 20, pageNumber: 1 },
|
|
28
|
+
sortBy: [{ field: 'pxCreateDateTime', direction: 'DESC' }],
|
|
29
|
+
filters: [{ field: 'pyStatusWork', operator: 'IN', values: ['Open'] }]
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const { data } = await getData('D_CaseSearchResults', payload, context);
|
|
33
|
+
const { data: count } = await getListCount('D_CaseSearchResults', payload, context);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Discussion
|
|
37
|
+
|
|
38
|
+
**SHOULD** call `getDataViewMetadata` once (and cache the result) to discover which fields are actually queryable/sortable, rather than assuming every visible column supports server-side filtering — an unsupported filter field is silently ignored by some data views rather than raising an error.
|
|
39
|
+
|
|
40
|
+
**MUST** pass the identical `payload` (filters and paging) to both `getData` and `getListCount` — a mismatched payload returns a total count that doesn't correspond to the rows actually shown, breaking the pager.
|
|
41
|
+
|
|
42
|
+
## Related recipes
|
|
43
|
+
|
|
44
|
+
- [Force-refresh a stale cached data page on demand](./refresh-and-update-data.md)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Subscribe to real-time case updates pushed from the server
|
|
3
|
+
keywords: [WebSocket, server push, real-time update, live case status, messaging service]
|
|
4
|
+
primary_methods:
|
|
5
|
+
[MessagingServiceManager.subscribe, MessagingServiceManager.unsubscribe, MessagingServiceManager.getCaseSubscription]
|
|
6
|
+
related: [pubsub-cleanup, data-page-subscription-cleanup]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Recipe: Subscribe to real-time case updates pushed from the server
|
|
10
|
+
|
|
11
|
+
> Part of the [Data Subscriptions & Real-time cookbook](./README.md) — [skill overview](../SKILL.md).
|
|
12
|
+
|
|
13
|
+
## Problem
|
|
14
|
+
|
|
15
|
+
A component needs to reflect another user's changes to the same case in near-real-time (for example, a live "someone else updated this case" banner), which requires a server-pushed message rather than a purely local, same-tab event.
|
|
16
|
+
|
|
17
|
+
## Solution
|
|
18
|
+
|
|
19
|
+
Uses `MessagingServiceManager` (via `PCore.getMessagingServiceManager()`, see [pcore-messaging-details.md](../../references/pcore-messaging-details.md)).
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const manager = PCore.getMessagingServiceManager();
|
|
24
|
+
|
|
25
|
+
// The filter is { matcher, criteria }: 'CASE' with the case ID selects server pushes for that case.
|
|
26
|
+
// caseID is the case ID string (the same value as pConn.getCaseSummary().caseID; the typedef examples use
|
|
27
|
+
// 'Approval-Request A-101'). Do not use getCaseSummary().ID: that is the assignment ID.
|
|
28
|
+
const subscriptionId = manager.subscribe(
|
|
29
|
+
{ matcher: 'CASE', criteria: { caseId: caseID } },
|
|
30
|
+
(payload: unknown) => showLiveUpdateBanner(payload),
|
|
31
|
+
pConn.getContextName()
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
// subscribe returns the subscription id (a string), not an unsubscribe function.
|
|
35
|
+
return () => manager.unsubscribe(subscriptionId);
|
|
36
|
+
}, [caseID]);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Discussion
|
|
40
|
+
|
|
41
|
+
`MessagingServiceManager` is a distinct transport from `PubSubUtils`: this `subscribe` reacts to server-pushed WebSocket messages describing changes made in other sessions, while `PubSubUtils.subscribe` (see [Publish/subscribe between unrelated components](./pubsub-cleanup.md)) only reacts to events published locally within the same browser tab. **NEVER** expect `PubSubUtils` to notice another user's edit. **MUST** apply the same unsubscribe-on-unmount discipline here — an orphaned `MessagingServiceManager` subscription keeps a live socket handler registered for a component that no longer exists.
|
|
42
|
+
|
|
43
|
+
## Related recipes
|
|
44
|
+
|
|
45
|
+
- [Publish/subscribe between unrelated components, with cleanup](./pubsub-cleanup.md)
|
|
46
|
+
- [Subscribe to a data page and clean up on unmount](./data-page-subscription-cleanup.md)
|