@controleonline/ui-crm 1.0.44 → 1.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/.github/workflows/integration-source-gate.yml +1 -15
  2. package/.github/workflows/manager-worker.yml +155 -7
  3. package/.github/workflows/publish-npm.yml +22 -73
  4. package/.release/rc-manifest.json +13 -0
  5. package/AGENTS.md +0 -2
  6. package/package.json +2 -2
  7. package/src/react/pages/crm/hooks/useCrmData.js +17 -23
  8. package/src/react/pages/mcp/McpPage.js +301 -0
  9. package/src/react/pages/mcp/McpPage.styles.js +116 -0
  10. package/src/react/pages/proposals/CreateProposalsModal.js +0 -1
  11. package/src/react/pages/proposals/index.js +33 -14
  12. package/src/react/pages/settings/GeneralSettings.js +17 -9
  13. package/src/react/pages/settings/GeneralSettings.shared.js +20 -20
  14. package/src/react/pages/settings/GeneralSettings.styles.js +0 -2
  15. package/src/react/pages/settings/sections/AiProvidersSection.js +263 -0
  16. package/src/react/pages/settings/sections/DeviceRuntimeFooterSection.js +11 -11
  17. package/src/react/pages/settings/sections/IntegrationsSection.js +17 -17
  18. package/src/react/pages/settings/sections/LogSection.js +10 -10
  19. package/src/react/pages/settings/sections/LoginSection.js +13 -13
  20. package/src/react/pages/settings/sections/LoyaltyProductPicker.js +145 -58
  21. package/src/react/pages/settings/sections/LoyaltySection.js +9 -35
  22. package/src/react/pages/settings/sections/MaintenanceSection.js +16 -16
  23. package/src/react/pages/settings/sections/MapsSection.js +257 -81
  24. package/src/react/pages/settings/sections/ShopSection.js +2 -2
  25. package/src/react/pages/settings/sections/shop/ShopFranchiseLocatorSection.js +28 -7
  26. package/src/react/pages/settings/sections/shop/ShopLoyaltySection.js +8 -54
  27. package/src/react/pages/settings/sections/shop/shopSettingsShared.js +11 -32
  28. package/src/react/router/routes.js +14 -0
  29. package/src/react/utils/proposalProductSelection.js +13 -103
  30. package/src/tests/browser/crm/create-proposal-product-category-filter.spec.js +0 -25
  31. package/src/tests/browser/manager/general-settings-maps.spec.js +347 -173
  32. package/src/tests/react/utils/proposalProductSelection.test.js +1 -57
  33. package/src/react/pages/settings/sections/MapsFranchisePreview.js +0 -102
  34. package/src/react/pages/settings/sections/MapsMapasControls.js +0 -262
  35. package/src/react/pages/settings/sections/loyaltyProductCompany.js +0 -57
  36. package/src/react/pages/settings/sections/mapsSectionHelpers.js +0 -137
  37. package/src/react/utils/clientDetailsNavigation.js +0 -56
  38. package/src/react/utils/clientSellerVisibility.js +0 -60
  39. package/src/react/utils/proposalStatus.js +0 -160
  40. package/src/tests/react/pages/settings/sections/loyaltyProductCompany.test.js +0 -41
  41. package/src/tests/react/pages/settings/sections/mapsSectionHelpers.test.js +0 -38
  42. package/src/tests/react/utils/clientDetailsNavigation.test.js +0 -98
  43. package/src/tests/react/utils/clientSellerVisibility.test.js +0 -74
  44. package/src/tests/react/utils/proposalStatus.test.mjs +0 -77
@@ -34,21 +34,7 @@ jobs:
34
34
  - uses: actions/checkout@v4
35
35
  if: github.base_ref != 'dev'
36
36
  with:
37
- repository: ${{ github.event.pull_request.head.repo.full_name }}
38
- ref: ${{ github.event.pull_request.head.sha }}
39
- persist-credentials: false
40
-
41
- - name: Validate checked-out pull request head
42
- if: github.base_ref != 'dev'
43
- env:
44
- EXPECTED_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
45
- run: |
46
- set -eu
47
- actual=$(git rev-parse HEAD)
48
- test "$actual" = "$EXPECTED_HEAD_SHA" || {
49
- echo "::error::Checked out $actual, expected pull request head $EXPECTED_HEAD_SHA."
50
- exit 1
51
- }
37
+ ref: ${{ github.head_ref }}
52
38
 
53
39
  - name: Validate frozen RC manifest
54
40
  if: github.base_ref != 'dev'
@@ -1,19 +1,167 @@
1
1
  name: Manager Worker
2
2
 
3
3
  on:
4
- workflow_dispatch:
5
-
6
- # PAUSA CTO ControleOnline/agents-mcp#201 (2026-08-29)
7
- # Trigger original desativado: push em master, dev, staging.
4
+ push:
5
+ branches: [master, dev, staging]
8
6
 
9
7
  permissions:
10
- contents: read
8
+ contents: write
11
9
  issues: write
12
10
  pull-requests: write
13
11
 
12
+ # Orquestrador: Manager resolve/cria issue e decide quais workers invocar.
13
+ # Padrão de branch da org = master (não usar main).
14
14
  jobs:
15
15
  manager:
16
- name: Manager — paused
16
+ name: Manager — resolve + plano de workers
17
+ runs-on: ubuntu-latest
18
+ outputs:
19
+ issue_number: ${{ steps.mgr.outputs.issue_number }}
20
+ created: ${{ steps.mgr.outputs.created }}
21
+ run_qa: ${{ steps.mgr.outputs.run_qa }}
22
+ run_security: ${{ steps.mgr.outputs.run_security }}
23
+ run_docs: ${{ steps.mgr.outputs.run_docs }}
24
+ run_gates: ${{ steps.mgr.outputs.run_gates }}
25
+ base_branch: ${{ steps.mgr.outputs.base_branch }}
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ with:
29
+ fetch-depth: 0
30
+
31
+ - name: Manager subworker
32
+ id: mgr
33
+ uses: ./.github/actions/workers/manager
34
+ with:
35
+ gh_token: ${{ secrets.GH_TOKEN }}
36
+ branch: ${{ github.ref_name }}
37
+
38
+ # Workers invocados pelo plano do Manager (paralelo quando ambos true)
39
+ qa:
40
+ name: QA (invocado pelo Manager)
41
+ needs: manager
42
+ if: needs.manager.outputs.run_qa == 'true'
43
+ runs-on: ubuntu-latest
44
+ steps:
45
+ - uses: actions/checkout@v4
46
+ - uses: ./.github/actions/workers/qa
47
+ with:
48
+ gh_token: ${{ secrets.GH_TOKEN }}
49
+ issue_number: ${{ needs.manager.outputs.issue_number }}
50
+ base_branch: ${{ needs.manager.outputs.base_branch }}
51
+
52
+ security:
53
+ name: Security (invocado pelo Manager)
54
+ needs: manager
55
+ if: needs.manager.outputs.run_security == 'true'
56
+ runs-on: ubuntu-latest
57
+ steps:
58
+ - uses: actions/checkout@v4
59
+ - uses: ./.github/actions/workers/security
60
+ with:
61
+ gh_token: ${{ secrets.GH_TOKEN }}
62
+ issue_number: ${{ needs.manager.outputs.issue_number }}
63
+ base_branch: ${{ needs.manager.outputs.base_branch }}
64
+
65
+ technical-documenter:
66
+ name: Technical Documenter (invocado pelo Manager)
67
+ needs: manager
68
+ if: needs.manager.outputs.run_docs == 'true'
69
+ runs-on: ubuntu-latest
70
+ steps:
71
+ - uses: actions/checkout@v4
72
+ - uses: ./.github/actions/workers/technical-documenter
73
+ with:
74
+ gh_token: ${{ secrets.GH_TOKEN }}
75
+ issue_number: ${{ needs.manager.outputs.issue_number }}
76
+ base_branch: ${{ needs.manager.outputs.base_branch }}
77
+
78
+ # master: se faltar gate do quarteto → tags + workers faltantes
79
+ master-gates:
80
+ name: Master gates (quarteto)
81
+ needs: manager
82
+ if: needs.manager.outputs.run_gates == 'true'
83
+ runs-on: ubuntu-latest
84
+ outputs:
85
+ need_qa: ${{ steps.check.outputs.need_qa }}
86
+ need_security: ${{ steps.check.outputs.need_security }}
87
+ need_docs: ${{ steps.check.outputs.need_docs }}
88
+ steps:
89
+ - uses: actions/checkout@v4
90
+ - name: Inspect quarteto e tags
91
+ id: check
92
+ env:
93
+ GH_TOKEN: ${{ secrets.GH_TOKEN }}
94
+ ISSUE: ${{ needs.manager.outputs.issue_number }}
95
+ REPO: ${{ github.repository }}
96
+ run: |
97
+ set -euo pipefail
98
+ LABELS=$(gh issue view "$ISSUE" --repo "$REPO" --json labels --jq '[.labels[].name] | join(",")')
99
+ echo "Labels: $LABELS"
100
+
101
+ need_qa=false
102
+ need_security=false
103
+ need_docs=false
104
+
105
+ echo "$LABELS" | grep -q 'qa:accepted' || need_qa=true
106
+ echo "$LABELS" | grep -q 'security:accepted' || need_security=true
107
+ echo "$LABELS" | grep -q 'agent:technical-documenter:done' || need_docs=true
108
+
109
+ echo "need_qa=$need_qa" >> "$GITHUB_OUTPUT"
110
+ echo "need_security=$need_security" >> "$GITHUB_OUTPUT"
111
+ echo "need_docs=$need_docs" >> "$GITHUB_OUTPUT"
112
+
113
+ [ "$need_qa" = true ] && gh issue edit "$ISSUE" --repo "$REPO" --add-label "agent:qa" || true
114
+ [ "$need_security" = true ] && gh issue edit "$ISSUE" --repo "$REPO" --add-label "agent:security" || true
115
+ [ "$need_docs" = true ] && gh issue edit "$ISSUE" --repo "$REPO" --add-label "agent:technical-documenter" || true
116
+
117
+ gh issue comment "$ISSUE" --repo "$REPO" --body \
118
+ "Master gates (Manager): need_qa=$need_qa need_security=$need_security need_docs=$need_docs"
119
+
120
+ master-qa:
121
+ name: QA (master gap via Manager)
122
+ needs: [manager, master-gates]
123
+ if: needs.master-gates.outputs.need_qa == 'true'
17
124
  runs-on: ubuntu-latest
18
125
  steps:
19
- - run: echo "Manager Worker paused by ControleOnline/agents-mcp#201"
126
+ - uses: actions/checkout@v4
127
+ - uses: ./.github/actions/workers/qa
128
+ with:
129
+ gh_token: ${{ secrets.GH_TOKEN }}
130
+ issue_number: ${{ needs.manager.outputs.issue_number }}
131
+ base_branch: master
132
+
133
+ master-security:
134
+ name: Security (master gap via Manager)
135
+ needs: [manager, master-gates]
136
+ if: needs.master-gates.outputs.need_security == 'true'
137
+ runs-on: ubuntu-latest
138
+ steps:
139
+ - uses: actions/checkout@v4
140
+ - uses: ./.github/actions/workers/security
141
+ with:
142
+ gh_token: ${{ secrets.GH_TOKEN }}
143
+ issue_number: ${{ needs.manager.outputs.issue_number }}
144
+ base_branch: master
145
+
146
+ # Em push para master: bump patch + cria tag vX.Y.Z (dispara publish-npm.yml)
147
+ # Ignora commits de release ([skip bump]) para evitar loop.
148
+ version-tag:
149
+ name: Bump version + tag
150
+ if: github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, '[skip bump]')
151
+ runs-on: ubuntu-latest
152
+ steps:
153
+ - uses: actions/checkout@v4
154
+ with:
155
+ fetch-depth: 0
156
+ token: ${{ secrets.GH_TOKEN }}
157
+
158
+ - uses: actions/setup-node@v4
159
+ with:
160
+ node-version: '24'
161
+
162
+ - name: Bump patch + tag
163
+ run: |
164
+ git config user.name "github-actions[bot]"
165
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
166
+ npm version patch -m "chore(release): %s [skip bump]"
167
+ git push origin HEAD:master --follow-tags
@@ -2,90 +2,39 @@ name: Publish Package to npmjs
2
2
 
3
3
  on:
4
4
  push:
5
+ tags:
6
+ - 'v*'
5
7
 
6
8
  permissions:
7
- contents: write
8
9
  id-token: write
9
-
10
- concurrency:
11
- group: ${{ github.repository }}-npm-release
12
- cancel-in-progress: false
10
+ contents: read
13
11
 
14
12
  jobs:
15
13
  publish:
16
- if: ${{ github.repository_owner == 'ControleOnline' && (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) }}
17
14
  runs-on: ubuntu-latest
15
+ permissions:
16
+ id-token: write
17
+ contents: read
18
18
  steps:
19
19
  - uses: actions/checkout@v4
20
- with:
21
- ref: ${{ github.ref }}
22
- fetch-depth: 0
23
- - name: Validate package metadata and create version tag
24
- id: release
25
- env:
26
- REF_TYPE: ${{ github.ref_type }}
27
- REF_NAME: ${{ github.ref_name }}
28
- EXPECTED_REPOSITORY: ${{ github.repository }}
29
- run: |
30
- node <<'NODE'
31
- const fs = require('node:fs');
32
- const cp = require('node:child_process');
33
- const pkg = require('./package.json');
34
- const expectedUrl = `https://github.com/${process.env.EXPECTED_REPOSITORY}`;
35
- if (!/^\d+\.\d+\.\d+$/.test(String(pkg.version))) throw new Error(`Expected stable X.Y.Z, got ${pkg.version}`);
36
- if (pkg.repository?.url !== expectedUrl) throw new Error(`repository.url must be ${expectedUrl}; got ${pkg.repository?.url}`);
37
- const sourceSha = cp.execFileSync('git', ['rev-parse', 'HEAD'], {encoding:'utf8'}).trim();
38
- let tag = '';
39
- if (process.env.REF_TYPE === 'tag') {
40
- tag = process.env.REF_NAME;
41
- if (tag !== `v${pkg.version}`) throw new Error(`Tag ${tag} does not match package version ${pkg.version}`);
42
- } else {
43
- let previous = '';
44
- try { previous = JSON.parse(cp.execFileSync('git', ['show', `${sourceSha}^:package.json`], {encoding:'utf8'})).version || ''; } catch {}
45
- if (previous === pkg.version) { fs.appendFileSync(process.env.GITHUB_OUTPUT, 'release_tag=\n'); process.exit(0); }
46
- const parts = String(pkg.version).split('.').map(Number);
47
- if (previous) {
48
- const old = String(previous).split('.').map(Number);
49
- let cmp = 0; for (let i=0;i<3;i++) { if ((parts[i]||0)!==(old[i]||0)) { cmp=(parts[i]||0)>(old[i]||0)?1:-1; break; } }
50
- if (cmp <= 0) throw new Error(`Version ${pkg.version} must be greater than first-parent version ${previous}`);
51
- }
52
- tag = `v${pkg.version}`;
53
- const existing = cp.spawnSync('git', ['ls-remote', '--exit-code', '--refs', 'origin', `refs/tags/${tag}`], {encoding:'utf8'});
54
- if (existing.status === 0) {
55
- cp.execFileSync('git', ['fetch', 'origin', `refs/tags/${tag}:refs/tags/${tag}`], {stdio:'inherit'});
56
- const tagged = cp.execFileSync('git', ['rev-parse', `${tag}^{commit}`], {encoding:'utf8'}).trim();
57
- if (tagged !== sourceSha) throw new Error(`Immutable tag ${tag} already points at ${tagged}, not ${sourceSha}`);
58
- } else {
59
- cp.execFileSync('git', ['config', 'user.name', 'github-actions[bot]']);
60
- cp.execFileSync('git', ['config', 'user.email', '41898282+github-actions[bot]@users.noreply.github.com']);
61
- cp.execFileSync('git', ['tag', '-a', tag, sourceSha, '-m', `Release ${pkg.name}@${pkg.version}`], {stdio:'inherit'});
62
- cp.execFileSync('git', ['push', 'origin', `refs/tags/${tag}`], {stdio:'inherit'});
63
- }
64
- }
65
- fs.appendFileSync(process.env.GITHUB_OUTPUT, `release_tag=${tag}\n`);
66
- console.log(`Validated ${pkg.name}@${pkg.version} from ${sourceSha}; release tag ${tag}`);
67
- NODE
20
+
68
21
  - uses: actions/setup-node@v4
69
- if: steps.release.outputs.release_tag != ''
70
22
  with:
71
- node-version: 24
23
+ node-version: '24'
24
+
72
25
  - name: Ensure npm 11.5.1+ (OIDC support)
73
- if: steps.release.outputs.release_tag != ''
74
26
  run: |
75
- npm install --global npm@latest
76
- npm --version
77
- - name: Skip if version is already on npm
78
- id: registry
79
- if: steps.release.outputs.release_tag != ''
27
+ npm install -g npm@latest
28
+ echo "node=$(node -v) npm=$(npm -v)"
29
+
30
+ - name: Prepare registry (OIDC only — no classic token)
31
+ run: |
32
+ unset NODE_AUTH_TOKEN NPM_TOKEN || true
33
+ rm -f .npmrc "$HOME/.npmrc" || true
34
+ npm config delete //registry.npmjs.org/:_authToken 2>/dev/null || true
35
+ npm config set registry https://registry.npmjs.org/
36
+
37
+ - name: Publish to npmjs (Trusted Publishing / OIDC)
80
38
  run: |
81
- PACKAGE_NAME=$(node -p "require('./package.json').name")
82
- PACKAGE_VERSION=$(node -p "require('./package.json').version")
83
- if npm view "$PACKAGE_NAME@$PACKAGE_VERSION" version >/dev/null 2>&1; then
84
- echo 'published=true' >> "$GITHUB_OUTPUT"
85
- echo "$PACKAGE_NAME@$PACKAGE_VERSION is already published; skipping duplicate publish"
86
- else
87
- echo 'published=false' >> "$GITHUB_OUTPUT"
88
- fi
89
- - name: Publish to npmjs with trusted publishing
90
- if: steps.release.outputs.release_tag != '' && steps.registry.outputs.published != 'true'
91
- run: npm publish --access public --loglevel verbose
39
+ unset NODE_AUTH_TOKEN NPM_TOKEN || true
40
+ npm publish --access public
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": "1.0.45",
3
+ "rc": 1,
4
+ "branch": "rc/1.0.45-rc.1",
5
+ "baseMaster": "76645478d3274febfbc449f214dd94b4655884c0",
6
+ "tasks": [
7
+ 1284
8
+ ],
9
+ "frozen": true,
10
+ "repositories": {
11
+ "ControleOnline/ui-crm": "15e3b92b804b9562c00d9323abbc3a3c3e57f15b"
12
+ }
13
+ }
package/AGENTS.md CHANGED
@@ -26,14 +26,12 @@ Sempre comece pela **Home** da wiki e siga as categorias abaixo.
26
26
  | [Oportunidades — ordenação por data de retorno](https://github.com/ControleOnline/ui-crm/wiki/Oportunidades-Ordenacao-por-Data-de-Retorno) | Ordenação client-side por dueDate/alterDate (mais antiga → mais nova) |
27
27
  | [Income Statements — Demonstrativo geral](https://github.com/ControleOnline/ui-crm/wiki) | Visão empresa por categorias (comission/royalties); ver `docs/technical/Income-Statements-Demonstrativo.md` |
28
28
  | [Visão Vendedor — Comissões](https://github.com/ControleOnline/ui-crm/wiki/Visao-Vendedor-Comissoes) | Invoices tipo `comission`; vendedor recebe; filtro cliente + período |
29
- | [Royalties a pagar — visão Franqueado](https://github.com/ControleOnline/ui-crm/wiki/Royalties-a-pagar-Franqueado) | Invoices tipo `royalties`; franqueado paga à franqueadora; payer=currentCompany |
30
29
 
31
30
 
32
31
  Cópias versionadas no Git:
33
32
  - `docs/technical/Cliente-Vendedor-Vinculo-e-Permissoes.md`
34
33
  - `docs/technical/Propostas-Filtro-de-Status.md`
35
34
  - `docs/technical/Visao-Vendedor-Comissoes.md`
36
- - `docs/technical/Royalties-a-pagar-Franqueado.md`
37
35
 
38
36
  ### Visão deste módulo
39
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@controleonline/ui-crm",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "author": "ControleOnline",
5
5
  "description": "ControleOnline CRM Quasar UI Component",
6
6
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "repository": {
28
28
  "type": "git",
29
- "url": "https://github.com/ControleOnline/ui-crm"
29
+ "url": "https://github.com/ControleOnline/ui-crm.git"
30
30
  },
31
31
  "bugs": "",
32
32
  "homepage": "https://www.controleonline.com/devs/plugins",
@@ -16,9 +16,6 @@ import {
16
16
  } from '../../../utils/opportunityPeople';
17
17
 
18
18
  const { getOpportunityEmptyStateMode } = require('../../../utils/opportunityEmptyState');
19
- const {
20
- resolveClientDetailsNavigation,
21
- } = require('../../../utils/clientDetailsNavigation');
22
19
 
23
20
  const getStatusFilterLabel = item => {
24
21
  const normalized = String(item?.realStatus || item?.status || '')
@@ -421,31 +418,28 @@ const useCrmData = ({ iconComponent, navigation, showError }) => {
421
418
  const handleEditProvider = useCallback(
422
419
  opportunity => {
423
420
  const reference = normalizePeopleReferenceValue(opportunity?.client);
424
- const matchedPerson = getPersonByReference(opportunity?.client);
425
- const navigationContext = resolveClientDetailsNavigation({
426
- reference,
427
- matchedPerson,
428
- opportunityClient: opportunity?.client,
429
- fallbackName:
430
- getProviderName(opportunity?.client) ||
431
- global.t?.t('people', 'label', 'client'),
432
- });
433
-
434
- if (!navigationContext) {
421
+ if (!reference) {
435
422
  showError?.(global.t?.t('people', 'toast', 'providerNotIdentified'));
436
423
  return;
437
424
  }
438
425
 
439
- peopleActions?.setItem?.(navigationContext.selectedClient);
440
- navigation.navigate('ClientDetails', navigationContext.params);
426
+ const matchedPerson = getPersonByReference(opportunity?.client);
427
+ const selectedClient =
428
+ matchedPerson ||
429
+ (typeof opportunity?.client === 'object' && opportunity?.client
430
+ ? opportunity.client
431
+ : null) ||
432
+ {
433
+ id: String(reference || '').replace(/\D/g, ''),
434
+ '@id': reference,
435
+ name:
436
+ getProviderName(opportunity?.client) ||
437
+ global.t?.t('people', 'label', 'client'),
438
+ };
439
+
440
+ navigation.navigate('ClientDetails', { client: selectedClient });
441
441
  },
442
- [
443
- getPersonByReference,
444
- getProviderName,
445
- navigation,
446
- peopleActions,
447
- showError,
448
- ],
442
+ [getPersonByReference, getProviderName, navigation, showError],
449
443
  );
450
444
 
451
445
  return {