@mj-biz-apps/common-ng 5.44.0 → 5.45.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.
Files changed (33) hide show
  1. package/dist/lib/components/selling-company-field/__tests__/selling-company-confirm.test.d.ts +2 -0
  2. package/dist/lib/components/selling-company-field/__tests__/selling-company-confirm.test.d.ts.map +1 -0
  3. package/dist/lib/components/selling-company-field/__tests__/selling-company-confirm.test.js +53 -0
  4. package/dist/lib/components/selling-company-field/__tests__/selling-company-confirm.test.js.map +1 -0
  5. package/dist/lib/components/selling-company-field/__tests__/selling-company-field.component.test.d.ts +2 -0
  6. package/dist/lib/components/selling-company-field/__tests__/selling-company-field.component.test.d.ts.map +1 -0
  7. package/dist/lib/components/selling-company-field/__tests__/selling-company-field.component.test.js +166 -0
  8. package/dist/lib/components/selling-company-field/__tests__/selling-company-field.component.test.js.map +1 -0
  9. package/dist/lib/components/selling-company-field/selling-company-confirm.d.ts +36 -0
  10. package/dist/lib/components/selling-company-field/selling-company-confirm.d.ts.map +1 -0
  11. package/dist/lib/components/selling-company-field/selling-company-confirm.js +54 -0
  12. package/dist/lib/components/selling-company-field/selling-company-confirm.js.map +1 -0
  13. package/dist/lib/components/selling-company-field/selling-company-field.component.d.ts +63 -0
  14. package/dist/lib/components/selling-company-field/selling-company-field.component.d.ts.map +1 -0
  15. package/dist/lib/components/selling-company-field/selling-company-field.component.js +221 -0
  16. package/dist/lib/components/selling-company-field/selling-company-field.component.js.map +1 -0
  17. package/dist/lib/data/__tests__/party-signal-store.test.d.ts +2 -0
  18. package/dist/lib/data/__tests__/party-signal-store.test.d.ts.map +1 -0
  19. package/dist/lib/data/__tests__/party-signal-store.test.js +98 -0
  20. package/dist/lib/data/__tests__/party-signal-store.test.js.map +1 -0
  21. package/dist/lib/data/common-settings.d.ts +18 -0
  22. package/dist/lib/data/common-settings.d.ts.map +1 -0
  23. package/dist/lib/data/common-settings.js +39 -0
  24. package/dist/lib/data/common-settings.js.map +1 -0
  25. package/dist/lib/data/party-signal-store.d.ts +39 -0
  26. package/dist/lib/data/party-signal-store.d.ts.map +1 -0
  27. package/dist/lib/data/party-signal-store.js +101 -0
  28. package/dist/lib/data/party-signal-store.js.map +1 -0
  29. package/dist/public-api.d.ts +4 -0
  30. package/dist/public-api.d.ts.map +1 -1
  31. package/dist/public-api.js +6 -0
  32. package/dist/public-api.js.map +1 -1
  33. package/package.json +2 -2
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=selling-company-confirm.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selling-company-confirm.test.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/selling-company-field/__tests__/selling-company-confirm.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,53 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { SellingCompanyConfirm } from '../selling-company-confirm';
3
+ describe('SellingCompanyConfirm', () => {
4
+ it('writes the default without asking', () => {
5
+ const confirm = new SellingCompanyConfirm('default-id');
6
+ expect(confirm.Propose('default-id')).toEqual({ Write: 'default-id', Ask: null });
7
+ expect(confirm.Pending).toBeNull();
8
+ });
9
+ it('treats the default as the same company whatever case the ID arrives in', () => {
10
+ const confirm = new SellingCompanyConfirm('AbC-123');
11
+ expect(confirm.Propose('abc-123')).toEqual({ Write: 'abc-123', Ask: null });
12
+ });
13
+ it('holds any other company for confirmation instead of writing it', () => {
14
+ const confirm = new SellingCompanyConfirm('default-id');
15
+ expect(confirm.Propose('other-id')).toEqual({ Write: null, Ask: 'other-id' });
16
+ expect(confirm.Pending).toBe('other-id');
17
+ });
18
+ it('writes the held value on confirm and clears the pending state', () => {
19
+ const confirm = new SellingCompanyConfirm('default-id');
20
+ confirm.Propose('other-id');
21
+ expect(confirm.Confirm()).toBe('other-id');
22
+ expect(confirm.Pending).toBeNull();
23
+ });
24
+ it('restores the caller-supplied previous value on revert', () => {
25
+ const confirm = new SellingCompanyConfirm('default-id');
26
+ confirm.Propose('other-id');
27
+ expect(confirm.Revert('previous-id')).toBe('previous-id');
28
+ expect(confirm.Pending).toBeNull();
29
+ });
30
+ it('replaces an unanswered question rather than stacking two', () => {
31
+ const confirm = new SellingCompanyConfirm('default-id');
32
+ confirm.Propose('first-id');
33
+ expect(confirm.Propose('second-id').Ask).toBe('second-id');
34
+ expect(confirm.Confirm()).toBe('second-id');
35
+ });
36
+ it('clears a pending question when the user goes back to the default', () => {
37
+ const confirm = new SellingCompanyConfirm('default-id');
38
+ confirm.Propose('other-id');
39
+ expect(confirm.Propose('default-id')).toEqual({ Write: 'default-id', Ask: null });
40
+ expect(confirm.Pending).toBeNull();
41
+ });
42
+ it('always allows clearing the field, since an empty value books nothing', () => {
43
+ const confirm = new SellingCompanyConfirm('default-id');
44
+ expect(confirm.Propose(null)).toEqual({ Write: null, Ask: null });
45
+ expect(confirm.Propose('')).toEqual({ Write: '', Ask: null });
46
+ });
47
+ it('never asks when the instance has no default configured', () => {
48
+ const confirm = new SellingCompanyConfirm(null);
49
+ expect(confirm.Propose('anything')).toEqual({ Write: 'anything', Ask: null });
50
+ expect(confirm.Pending).toBeNull();
51
+ });
52
+ });
53
+ //# sourceMappingURL=selling-company-confirm.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selling-company-confirm.test.js","sourceRoot":"","sources":["../../../../../src/lib/components/selling-company-field/__tests__/selling-company-confirm.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACnC,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QACzC,MAAM,OAAO,GAAG,IAAI,qBAAqB,CAAC,YAAY,CAAC,CAAC;QACxD,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,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,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;QAClE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAC9D,MAAM,OAAO,GAAG,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9E,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import '@angular/compiler';
2
+ //# sourceMappingURL=selling-company-field.component.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selling-company-field.component.test.d.ts","sourceRoot":"","sources":["../../../../../src/lib/components/selling-company-field/__tests__/selling-company-field.component.test.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC"}
@@ -0,0 +1,166 @@
1
+ import '@angular/compiler';
2
+ import { ChangeDetectorRef, Injector, runInInjectionContext } from '@angular/core';
3
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
4
+ const H = vi.hoisted(() => ({
5
+ settingValue: 'default-co',
6
+ employeeID: null,
7
+ companies: [
8
+ { ID: 'default-co', Name: 'Default Selling Co' },
9
+ { ID: 'other-co', Name: 'Other Co' },
10
+ { ID: 'employee-co', Name: 'Employee Co' },
11
+ ],
12
+ employeeRows: [],
13
+ runView: vi.fn(),
14
+ }));
15
+ vi.mock('@memberjunction/core', async (importOriginal) => {
16
+ const actual = await importOriginal();
17
+ class MockMetadata {
18
+ static Provider = {};
19
+ get CurrentUser() {
20
+ return { ID: 'u1', EmployeeID: H.employeeID };
21
+ }
22
+ get Applications() {
23
+ return [{ ID: 'app-common', Name: 'Common' }];
24
+ }
25
+ }
26
+ return {
27
+ ...actual,
28
+ Metadata: MockMetadata,
29
+ RunView: { FromMetadataProvider: () => ({ RunView: H.runView }) },
30
+ };
31
+ });
32
+ vi.mock('@memberjunction/core-entities', async (importOriginal) => ({
33
+ ...(await importOriginal()),
34
+ ApplicationSettingEngine: {
35
+ Instance: {
36
+ Config: async () => undefined,
37
+ GetSetting: (name) => (name === 'DefaultSellingCompanyID' ? H.settingValue : undefined),
38
+ },
39
+ },
40
+ }));
41
+ vi.mock('@memberjunction/ng-base-forms', () => ({ BaseFormsModule: class {
42
+ } }));
43
+ import { SellingCompanyFieldComponent } from '../selling-company-field.component';
44
+ function record(isSaved, companyID = null) {
45
+ const values = { CompanyID: companyID };
46
+ return {
47
+ IsSaved: isSaved,
48
+ values,
49
+ Get: (field) => values[field],
50
+ Set: (field, value) => {
51
+ values[field] = value;
52
+ },
53
+ };
54
+ }
55
+ /**
56
+ * The component resolves ChangeDetectorRef with `inject()`, which needs an injection context.
57
+ * A one-provider injector gives it one without standing up TestBed — these are unit tests of the
58
+ * default-and-confirm behaviour, not of rendering.
59
+ */
60
+ async function build(rec) {
61
+ const injector = Injector.create({
62
+ providers: [{ provide: ChangeDetectorRef, useValue: { markForCheck: () => undefined } }],
63
+ });
64
+ const component = runInInjectionContext(injector, () => new SellingCompanyFieldComponent());
65
+ component.Record = rec;
66
+ await component.ngOnInit();
67
+ return component;
68
+ }
69
+ describe('SellingCompanyFieldComponent', () => {
70
+ beforeEach(() => {
71
+ H.settingValue = 'default-co';
72
+ H.employeeID = null;
73
+ H.employeeRows = [];
74
+ H.runView.mockImplementation(async (params) => params.EntityName === 'MJ: Employees'
75
+ ? { Success: true, Results: H.employeeRows }
76
+ : { Success: true, Results: H.companies });
77
+ });
78
+ it('defaults a new record to the configured company', async () => {
79
+ const rec = record(false);
80
+ await build(rec);
81
+ expect(rec.values['CompanyID']).toBe('default-co');
82
+ });
83
+ it('prefers the user own company over the configured setting', async () => {
84
+ H.employeeID = 'emp-1';
85
+ H.employeeRows = [{ CompanyID: 'employee-co' }];
86
+ const rec = record(false);
87
+ const component = await build(rec);
88
+ expect(rec.values['CompanyID']).toBe('employee-co');
89
+ expect(component.DefaultName).toBe('Employee Co');
90
+ });
91
+ it('ignores an employee company this instance does not know', async () => {
92
+ H.employeeID = 'emp-1';
93
+ H.employeeRows = [{ CompanyID: 'some-unknown-co' }];
94
+ const rec = record(false);
95
+ await build(rec);
96
+ expect(rec.values['CompanyID']).toBe('default-co');
97
+ });
98
+ it('never overwrites a company already on the record', async () => {
99
+ const rec = record(false, 'other-co');
100
+ await build(rec);
101
+ expect(rec.values['CompanyID']).toBe('other-co');
102
+ });
103
+ it('leaves a saved record alone', async () => {
104
+ const rec = record(true);
105
+ await build(rec);
106
+ expect(rec.values['CompanyID']).toBeNull();
107
+ });
108
+ it('writes nothing and asks nothing when the instance configured no default', async () => {
109
+ H.settingValue = null;
110
+ const rec = record(false);
111
+ const component = await build(rec);
112
+ expect(rec.values['CompanyID']).toBeNull();
113
+ rec.Set('CompanyID', 'other-co');
114
+ component.OnValueChange('other-co');
115
+ expect(component.AskName).toBeNull();
116
+ expect(rec.values['CompanyID']).toBe('other-co');
117
+ });
118
+ it('holds another company, restoring the previous value while the question is open', async () => {
119
+ const rec = record(false);
120
+ const component = await build(rec);
121
+ rec.Set('CompanyID', 'other-co'); // mj-form-field writes before it emits
122
+ component.OnValueChange('other-co');
123
+ expect(component.AskName).toBe('Other Co');
124
+ expect(component.DefaultName).toBe('Default Selling Co');
125
+ expect(rec.values['CompanyID']).toBe('default-co');
126
+ });
127
+ it('writes the held company on confirm', async () => {
128
+ const rec = record(false);
129
+ const component = await build(rec);
130
+ rec.Set('CompanyID', 'other-co');
131
+ component.OnValueChange('other-co');
132
+ component.OnConfirm();
133
+ expect(rec.values['CompanyID']).toBe('other-co');
134
+ expect(component.AskName).toBeNull();
135
+ });
136
+ it('keeps the previous company on revert', async () => {
137
+ const rec = record(false);
138
+ const component = await build(rec);
139
+ rec.Set('CompanyID', 'other-co');
140
+ component.OnValueChange('other-co');
141
+ component.OnRevert();
142
+ expect(rec.values['CompanyID']).toBe('default-co');
143
+ expect(component.AskName).toBeNull();
144
+ });
145
+ it('asks again after a confirmed choice, using the confirmed value as what to revert to', async () => {
146
+ const rec = record(false);
147
+ const component = await build(rec);
148
+ rec.Set('CompanyID', 'other-co');
149
+ component.OnValueChange('other-co');
150
+ component.OnConfirm();
151
+ rec.Set('CompanyID', 'employee-co');
152
+ component.OnValueChange('employee-co');
153
+ expect(component.AskName).toBe('Employee Co');
154
+ component.OnRevert();
155
+ expect(rec.values['CompanyID']).toBe('other-co');
156
+ });
157
+ it('names a company by ID rather than hiding the question when the company list cannot be read', async () => {
158
+ H.runView.mockImplementation(async () => ({ Success: false, ErrorMessage: 'denied', Results: [] }));
159
+ const rec = record(false);
160
+ const component = await build(rec);
161
+ rec.Set('CompanyID', 'other-co');
162
+ component.OnValueChange('other-co');
163
+ expect(component.AskName).toBe('other-co');
164
+ });
165
+ });
166
+ //# sourceMappingURL=selling-company-field.component.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selling-company-field.component.test.js","sourceRoot":"","sources":["../../../../../src/lib/components/selling-company-field/__tests__/selling-company-field.component.test.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9D,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACxB,YAAY,EAAE,YAA6B;IAC3C,UAAU,EAAE,IAAqB;IACj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AAI,EAAE;QACxG,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QACpG,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QAEnC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACjC,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACpC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Which selling-company choices go straight through and which pause for a confirmation.
3
+ *
4
+ * The selling company decides which legal entity books the revenue on an order or a contract, and
5
+ * the picker can offer dozens of companies whose names differ by a word. Getting it wrong is silent
6
+ * — the record looks correct afterwards. So the default is written without ceremony and anything
7
+ * else is held until the user says yes.
8
+ *
9
+ * Pure and synchronous on purpose: the rule is the part worth testing, and it is testable here
10
+ * without a record, a provider or a rendered field.
11
+ */
12
+ export declare class SellingCompanyConfirm {
13
+ private readonly defaultID;
14
+ private pending;
15
+ /**
16
+ * @param defaultID the resolved default company, or null when this instance has none
17
+ * configured — in which case nothing is ever held back, because there is no
18
+ * expectation to depart from.
19
+ */
20
+ constructor(defaultID: string | null);
21
+ /** The choice currently awaiting an answer, or null when nothing is pending. */
22
+ get Pending(): string | null;
23
+ /**
24
+ * Offer a choice. Returns what to write now (`Write`) and what to ask about (`Ask`); exactly
25
+ * one of them is non-null. Clearing the field is always allowed — an empty value books nothing.
26
+ */
27
+ Propose(id: string | null): {
28
+ Write: string | null;
29
+ Ask: string | null;
30
+ };
31
+ /** The user said yes. Returns the value to write. */
32
+ Confirm(): string | null;
33
+ /** The user said no, or moved on without answering. Returns the value to restore. */
34
+ Revert(previous: string | null): string | null;
35
+ }
36
+ //# sourceMappingURL=selling-company-confirm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selling-company-confirm.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/selling-company-field/selling-company-confirm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,qBAAa,qBAAqB;IAQlB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAPtC,OAAO,CAAC,OAAO,CAAuB;IAEtC;;;;OAIG;gBAC0B,SAAS,EAAE,MAAM,GAAG,IAAI;IAErD,gFAAgF;IAChF,IAAW,OAAO,IAAI,MAAM,GAAG,IAAI,CAElC;IAED;;;OAGG;IACI,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG;QAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;IAS/E,qDAAqD;IAC9C,OAAO,IAAI,MAAM,GAAG,IAAI;IAM/B,qFAAqF;IAC9E,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI;CAIxD"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Which selling-company choices go straight through and which pause for a confirmation.
3
+ *
4
+ * The selling company decides which legal entity books the revenue on an order or a contract, and
5
+ * the picker can offer dozens of companies whose names differ by a word. Getting it wrong is silent
6
+ * — the record looks correct afterwards. So the default is written without ceremony and anything
7
+ * else is held until the user says yes.
8
+ *
9
+ * Pure and synchronous on purpose: the rule is the part worth testing, and it is testable here
10
+ * without a record, a provider or a rendered field.
11
+ */
12
+ export class SellingCompanyConfirm {
13
+ defaultID;
14
+ pending = null;
15
+ /**
16
+ * @param defaultID the resolved default company, or null when this instance has none
17
+ * configured — in which case nothing is ever held back, because there is no
18
+ * expectation to depart from.
19
+ */
20
+ constructor(defaultID) {
21
+ this.defaultID = defaultID;
22
+ }
23
+ /** The choice currently awaiting an answer, or null when nothing is pending. */
24
+ get Pending() {
25
+ return this.pending;
26
+ }
27
+ /**
28
+ * Offer a choice. Returns what to write now (`Write`) and what to ask about (`Ask`); exactly
29
+ * one of them is non-null. Clearing the field is always allowed — an empty value books nothing.
30
+ */
31
+ Propose(id) {
32
+ if (!id || !this.defaultID || sameID(id, this.defaultID)) {
33
+ this.pending = null;
34
+ return { Write: id, Ask: null };
35
+ }
36
+ this.pending = id;
37
+ return { Write: null, Ask: id };
38
+ }
39
+ /** The user said yes. Returns the value to write. */
40
+ Confirm() {
41
+ const confirmed = this.pending;
42
+ this.pending = null;
43
+ return confirmed;
44
+ }
45
+ /** The user said no, or moved on without answering. Returns the value to restore. */
46
+ Revert(previous) {
47
+ this.pending = null;
48
+ return previous;
49
+ }
50
+ }
51
+ function sameID(a, b) {
52
+ return a.trim().toLowerCase() === b.trim().toLowerCase();
53
+ }
54
+ //# sourceMappingURL=selling-company-confirm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selling-company-confirm.js","sourceRoot":"","sources":["../../../../src/lib/components/selling-company-field/selling-company-confirm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,OAAO,qBAAqB;IAQD;IAPrB,OAAO,GAAkB,IAAI,CAAC;IAEtC;;;;OAIG;IACH,YAA6B,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;IAAG,CAAC;IAEzD,gFAAgF;IAChF,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,OAAO,CAAC,EAAiB;QAC5B,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACvD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;QACpC,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IACpC,CAAC;IAED,qDAAqD;IAC9C,OAAO;QACV,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,qFAAqF;IAC9E,MAAM,CAAC,QAAuB;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAED,SAAS,MAAM,CAAC,CAAS,EAAE,CAAS;IAChC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { EventEmitter, OnInit } from '@angular/core';
2
+ import { BaseEntity } from '@memberjunction/core';
3
+ import { type FormContext, type FormNavigationEvent } from '@memberjunction/ng-base-forms';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * `bizapps-selling-company-field` — the company foreign key on an order or a contract, with a
7
+ * default and a confirmation.
8
+ *
9
+ * This field decides which legal entity books the revenue, and the picker behind it lists every
10
+ * company row the instance has. Two failure modes follow from that, and this component exists for
11
+ * both.
12
+ *
13
+ * **A default nobody chose is worse than no default.** Apps have defaulted this field by whichever
14
+ * company sorted first alphabetically, or by the first product on the order — rules nobody wrote
15
+ * down and nobody can see. The default here is the current user's own company when they have one
16
+ * and it is a company this instance sells from, otherwise the value the instance configured in the
17
+ * Common `DefaultSellingCompanyID` setting, otherwise nothing. An instance that configures nothing
18
+ * gets a blank field, which is the pre-existing behaviour rather than a guess.
19
+ *
20
+ * **Departing from the default must be deliberate.** Companies can differ by a single word, and an
21
+ * order booked to the wrong entity looks perfectly correct afterwards — nothing on screen says
22
+ * otherwise. So anything other than the default is held, named back to the user against the
23
+ * default, and written only when they confirm. The value is restored if they move on without
24
+ * answering: an unanswered question must not decide where revenue lands.
25
+ *
26
+ * It wraps `mj-form-field` rather than replacing it, so the dropdown, keyboard behaviour and
27
+ * link rendering stay the platform's. It owns only the default and the confirmation, which is why
28
+ * it does not wait on the platform lookup-strategy seam.
29
+ */
30
+ export declare class SellingCompanyFieldComponent implements OnInit {
31
+ private readonly cdr;
32
+ Record: BaseEntity;
33
+ FieldName: string;
34
+ EditMode: boolean;
35
+ ShowLabel: boolean;
36
+ FormContext?: FormContext;
37
+ Navigate: EventEmitter<FormNavigationEvent>;
38
+ /** The company being asked about, by name, or null when nothing is pending. */
39
+ AskName: string | null;
40
+ /** The resolved default's name, for the question. Empty when the instance configured none. */
41
+ DefaultName: string;
42
+ private confirm;
43
+ private previous;
44
+ private readonly names;
45
+ ngOnInit(): Promise<void>;
46
+ OnValueChange(newValue: unknown): void;
47
+ OnConfirm(): void;
48
+ OnRevert(): void;
49
+ /** Only on a new record with the field still empty; never overwrite what is already booked. */
50
+ private applyDefault;
51
+ private current;
52
+ private nameOf;
53
+ private loadCompanyNames;
54
+ /**
55
+ * The user's own company, when they are linked to an employee record and that employee's
56
+ * company is one this instance knows. An employee of a company that is not in the list is not
57
+ * a signal about where to book.
58
+ */
59
+ private employeeCompanyID;
60
+ static ɵfac: i0.ɵɵFactoryDeclaration<SellingCompanyFieldComponent, never>;
61
+ static ɵcmp: i0.ɵɵComponentDeclaration<SellingCompanyFieldComponent, "bizapps-selling-company-field", never, { "Record": { "alias": "Record"; "required": true; }; "FieldName": { "alias": "FieldName"; "required": false; }; "EditMode": { "alias": "EditMode"; "required": false; }; "ShowLabel": { "alias": "ShowLabel"; "required": false; }; "FormContext": { "alias": "FormContext"; "required": false; }; }, { "Navigate": "Navigate"; }, never, never, true, never>;
62
+ }
63
+ //# sourceMappingURL=selling-company-field.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selling-company-field.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/selling-company-field/selling-company-field.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyD,YAAY,EAAS,MAAM,EAAqC,MAAM,eAAe,CAAC;AACtJ,OAAO,EAAE,UAAU,EAAqB,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAmB,KAAK,WAAW,EAAE,KAAK,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;;AAQ5G;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAiDa,4BAA6B,YAAW,MAAM;IACvD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA6B;IAEtB,MAAM,EAAG,UAAU,CAAC;IACtC,SAAS,SAAe;IACxB,QAAQ,UAAS;IACjB,SAAS,UAAQ;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;IACzB,QAAQ,oCAA2C;IAE7D,+EAA+E;IACxE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAQ;IACrC,8FAA8F;IACvF,WAAW,SAAM;IAExB,OAAO,CAAC,OAAO,CAAmC;IAClD,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA6B;IAEtC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAa/B,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAetC,SAAS,IAAI,IAAI;IAQjB,QAAQ,IAAI,IAAI;IAMvB,+FAA+F;IAC/F,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,MAAM;YAIA,gBAAgB;IAe9B;;;;OAIG;YACW,iBAAiB;yCAjGtB,4BAA4B;2CAA5B,4BAA4B;CAgHxC"}
@@ -0,0 +1,221 @@
1
+ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output, ViewEncapsulation, inject } from '@angular/core';
2
+ import { Metadata, RunView } from '@memberjunction/core';
3
+ import { BaseFormsModule } from '@memberjunction/ng-base-forms';
4
+ import { CommonSettings } from '../../data/common-settings';
5
+ import { SellingCompanyConfirm } from './selling-company-confirm';
6
+ import * as i0 from "@angular/core";
7
+ import * as i1 from "@memberjunction/ng-base-forms";
8
+ function SellingCompanyFieldComponent_Conditional_1_Conditional_5_Template(rf, ctx) { if (rf & 1) {
9
+ i0.ɵɵtext(0);
10
+ } if (rf & 2) {
11
+ const ctx_r1 = i0.ɵɵnextContext(2);
12
+ i0.ɵɵtextInterpolate1(" rather than ", ctx_r1.DefaultName, " ");
13
+ } }
14
+ function SellingCompanyFieldComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
15
+ const _r1 = i0.ɵɵgetCurrentView();
16
+ i0.ɵɵelementStart(0, "div", 1)(1, "span");
17
+ i0.ɵɵtext(2, " Book to ");
18
+ i0.ɵɵelementStart(3, "strong");
19
+ i0.ɵɵtext(4);
20
+ i0.ɵɵelementEnd();
21
+ i0.ɵɵconditionalCreate(5, SellingCompanyFieldComponent_Conditional_1_Conditional_5_Template, 1, 1);
22
+ i0.ɵɵtext(6, " ? ");
23
+ i0.ɵɵelementEnd();
24
+ i0.ɵɵelementStart(7, "button", 2);
25
+ i0.ɵɵlistener("click", function SellingCompanyFieldComponent_Conditional_1_Template_button_click_7_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnConfirm()); });
26
+ i0.ɵɵtext(8, "Confirm");
27
+ i0.ɵɵelementEnd();
28
+ i0.ɵɵelementStart(9, "button", 3);
29
+ i0.ɵɵlistener("click", function SellingCompanyFieldComponent_Conditional_1_Template_button_click_9_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnRevert()); });
30
+ i0.ɵɵtext(10, "Revert");
31
+ i0.ɵɵelementEnd()();
32
+ } if (rf & 2) {
33
+ const ctx_r1 = i0.ɵɵnextContext();
34
+ i0.ɵɵadvance(4);
35
+ i0.ɵɵtextInterpolate(ctx_r1.AskName);
36
+ i0.ɵɵadvance();
37
+ i0.ɵɵconditional(ctx_r1.DefaultName ? 5 : -1);
38
+ } }
39
+ const COMPANIES_ENTITY = 'MJ: Companies';
40
+ const EMPLOYEES_ENTITY = 'MJ: Employees';
41
+ /**
42
+ * `bizapps-selling-company-field` — the company foreign key on an order or a contract, with a
43
+ * default and a confirmation.
44
+ *
45
+ * This field decides which legal entity books the revenue, and the picker behind it lists every
46
+ * company row the instance has. Two failure modes follow from that, and this component exists for
47
+ * both.
48
+ *
49
+ * **A default nobody chose is worse than no default.** Apps have defaulted this field by whichever
50
+ * company sorted first alphabetically, or by the first product on the order — rules nobody wrote
51
+ * down and nobody can see. The default here is the current user's own company when they have one
52
+ * and it is a company this instance sells from, otherwise the value the instance configured in the
53
+ * Common `DefaultSellingCompanyID` setting, otherwise nothing. An instance that configures nothing
54
+ * gets a blank field, which is the pre-existing behaviour rather than a guess.
55
+ *
56
+ * **Departing from the default must be deliberate.** Companies can differ by a single word, and an
57
+ * order booked to the wrong entity looks perfectly correct afterwards — nothing on screen says
58
+ * otherwise. So anything other than the default is held, named back to the user against the
59
+ * default, and written only when they confirm. The value is restored if they move on without
60
+ * answering: an unanswered question must not decide where revenue lands.
61
+ *
62
+ * It wraps `mj-form-field` rather than replacing it, so the dropdown, keyboard behaviour and
63
+ * link rendering stay the platform's. It owns only the default and the confirmation, which is why
64
+ * it does not wait on the platform lookup-strategy seam.
65
+ */
66
+ export class SellingCompanyFieldComponent {
67
+ cdr = inject(ChangeDetectorRef);
68
+ Record;
69
+ FieldName = 'CompanyID';
70
+ EditMode = false;
71
+ ShowLabel = true;
72
+ FormContext;
73
+ Navigate = new EventEmitter();
74
+ /** The company being asked about, by name, or null when nothing is pending. */
75
+ AskName = null;
76
+ /** The resolved default's name, for the question. Empty when the instance configured none. */
77
+ DefaultName = '';
78
+ confirm = new SellingCompanyConfirm(null);
79
+ previous = null;
80
+ names = new Map();
81
+ async ngOnInit() {
82
+ const metadata = new Metadata();
83
+ await CommonSettings.Load(Metadata.Provider, metadata.CurrentUser);
84
+ await this.loadCompanyNames();
85
+ const defaultID = (await this.employeeCompanyID(metadata)) ?? CommonSettings.DefaultSellingCompanyID;
86
+ this.confirm = new SellingCompanyConfirm(defaultID);
87
+ this.DefaultName = defaultID ? this.nameOf(defaultID) : '';
88
+ this.applyDefault(defaultID);
89
+ this.previous = this.current();
90
+ this.cdr.markForCheck();
91
+ }
92
+ OnValueChange(newValue) {
93
+ const proposed = newValue ? String(newValue) : null;
94
+ const outcome = this.confirm.Propose(proposed);
95
+ if (outcome.Ask) {
96
+ // mj-form-field writes the record before it emits, so put the old value back while the
97
+ // question is open. Nothing is booked to a company the user has not agreed to.
98
+ this.Record.Set(this.FieldName, this.previous);
99
+ this.AskName = this.nameOf(outcome.Ask);
100
+ }
101
+ else {
102
+ this.AskName = null;
103
+ this.previous = outcome.Write;
104
+ }
105
+ this.cdr.markForCheck();
106
+ }
107
+ OnConfirm() {
108
+ const confirmed = this.confirm.Confirm();
109
+ this.Record.Set(this.FieldName, confirmed);
110
+ this.previous = confirmed;
111
+ this.AskName = null;
112
+ this.cdr.markForCheck();
113
+ }
114
+ OnRevert() {
115
+ this.Record.Set(this.FieldName, this.confirm.Revert(this.previous));
116
+ this.AskName = null;
117
+ this.cdr.markForCheck();
118
+ }
119
+ /** Only on a new record with the field still empty; never overwrite what is already booked. */
120
+ applyDefault(defaultID) {
121
+ if (defaultID && !this.Record.IsSaved && !this.Record.Get(this.FieldName)) {
122
+ this.Record.Set(this.FieldName, defaultID);
123
+ }
124
+ }
125
+ current() {
126
+ const value = this.Record.Get(this.FieldName);
127
+ return value ? String(value) : null;
128
+ }
129
+ nameOf(id) {
130
+ return this.names.get(id.trim().toLowerCase()) ?? id;
131
+ }
132
+ async loadCompanyNames() {
133
+ const result = await RunView.FromMetadataProvider(Metadata.Provider).RunView({
134
+ EntityName: COMPANIES_ENTITY,
135
+ Fields: ['ID', 'Name'],
136
+ ResultType: 'simple',
137
+ OrderBy: 'Name',
138
+ });
139
+ if (!result.Success) {
140
+ return; // The question falls back to naming companies by ID rather than not appearing.
141
+ }
142
+ for (const company of result.Results) {
143
+ this.names.set(company.ID.trim().toLowerCase(), company.Name);
144
+ }
145
+ }
146
+ /**
147
+ * The user's own company, when they are linked to an employee record and that employee's
148
+ * company is one this instance knows. An employee of a company that is not in the list is not
149
+ * a signal about where to book.
150
+ */
151
+ async employeeCompanyID(metadata) {
152
+ const employeeID = metadata.CurrentUser?.EmployeeID;
153
+ if (!employeeID) {
154
+ return null;
155
+ }
156
+ const result = await RunView.FromMetadataProvider(Metadata.Provider).RunView({
157
+ EntityName: EMPLOYEES_ENTITY,
158
+ ExtraFilter: `ID = '${String(employeeID).replace(/'/g, "''")}'`,
159
+ Fields: ['CompanyID'],
160
+ ResultType: 'simple',
161
+ MaxRows: 1,
162
+ });
163
+ const companyID = result.Success ? result.Results[0]?.CompanyID : null;
164
+ return companyID && this.names.has(companyID.trim().toLowerCase()) ? companyID : null;
165
+ }
166
+ static ɵfac = function SellingCompanyFieldComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SellingCompanyFieldComponent)(); };
167
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SellingCompanyFieldComponent, selectors: [["bizapps-selling-company-field"]], inputs: { Record: "Record", FieldName: "FieldName", EditMode: "EditMode", ShowLabel: "ShowLabel", FormContext: "FormContext" }, outputs: { Navigate: "Navigate" }, decls: 2, vars: 6, consts: [["Type", "textbox", "LinkType", "Record", 3, "ValueChange", "Navigate", "Record", "ShowLabel", "FieldName", "EditMode", "FormContext"], ["role", "alertdialog", "aria-live", "polite", 1, "bizapps-selling-confirm"], ["type", "button", 1, "bizapps-selling-confirm-yes", 3, "click"], ["type", "button", 1, "bizapps-selling-confirm-no", 3, "click"]], template: function SellingCompanyFieldComponent_Template(rf, ctx) { if (rf & 1) {
168
+ i0.ɵɵelementStart(0, "mj-form-field", 0);
169
+ i0.ɵɵlistener("ValueChange", function SellingCompanyFieldComponent_Template_mj_form_field_ValueChange_0_listener($event) { return ctx.OnValueChange($event.NewValue); })("Navigate", function SellingCompanyFieldComponent_Template_mj_form_field_Navigate_0_listener($event) { return ctx.Navigate.emit($event); });
170
+ i0.ɵɵelementEnd();
171
+ i0.ɵɵconditionalCreate(1, SellingCompanyFieldComponent_Conditional_1_Template, 11, 2, "div", 1);
172
+ } if (rf & 2) {
173
+ i0.ɵɵproperty("Record", ctx.Record)("ShowLabel", ctx.ShowLabel)("FieldName", ctx.FieldName)("EditMode", ctx.EditMode)("FormContext", ctx.FormContext);
174
+ i0.ɵɵadvance();
175
+ i0.ɵɵconditional(ctx.AskName ? 1 : -1);
176
+ } }, dependencies: [BaseFormsModule, i1.MjFormFieldComponent], styles: ["\n .bizapps-selling-confirm {\n display: flex;\n flex-wrap: wrap;\n gap: var(--mj-space-2);\n align-items: center;\n margin-top: var(--mj-space-1);\n padding: var(--mj-space-2) var(--mj-space-3);\n border: 1px solid var(--mj-status-warning);\n border-radius: var(--mj-radius-md);\n background: var(--mj-bg-surface-sunken);\n font-size: var(--mj-text-sm);\n }\n "], encapsulation: 2, changeDetection: 0 });
177
+ }
178
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SellingCompanyFieldComponent, [{
179
+ type: Component,
180
+ args: [{ selector: 'bizapps-selling-company-field', standalone: true, imports: [BaseFormsModule], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: `
181
+ <mj-form-field
182
+ [Record]="Record"
183
+ [ShowLabel]="ShowLabel"
184
+ [FieldName]="FieldName"
185
+ Type="textbox"
186
+ LinkType="Record"
187
+ [EditMode]="EditMode"
188
+ [FormContext]="FormContext"
189
+ (ValueChange)="OnValueChange($event.NewValue)"
190
+ (Navigate)="Navigate.emit($event)"
191
+ ></mj-form-field>
192
+ @if (AskName) {
193
+ <div class="bizapps-selling-confirm" role="alertdialog" aria-live="polite">
194
+ <span>
195
+ Book to <strong>{{ AskName }}</strong>
196
+ @if (DefaultName) {
197
+ rather than {{ DefaultName }}
198
+ }
199
+ ?
200
+ </span>
201
+ <button type="button" class="bizapps-selling-confirm-yes" (click)="OnConfirm()">Confirm</button>
202
+ <button type="button" class="bizapps-selling-confirm-no" (click)="OnRevert()">Revert</button>
203
+ </div>
204
+ }
205
+ `, styles: ["\n .bizapps-selling-confirm {\n display: flex;\n flex-wrap: wrap;\n gap: var(--mj-space-2);\n align-items: center;\n margin-top: var(--mj-space-1);\n padding: var(--mj-space-2) var(--mj-space-3);\n border: 1px solid var(--mj-status-warning);\n border-radius: var(--mj-radius-md);\n background: var(--mj-bg-surface-sunken);\n font-size: var(--mj-text-sm);\n }\n "] }]
206
+ }], null, { Record: [{
207
+ type: Input,
208
+ args: [{ required: true }]
209
+ }], FieldName: [{
210
+ type: Input
211
+ }], EditMode: [{
212
+ type: Input
213
+ }], ShowLabel: [{
214
+ type: Input
215
+ }], FormContext: [{
216
+ type: Input
217
+ }], Navigate: [{
218
+ type: Output
219
+ }] }); })();
220
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SellingCompanyFieldComponent, { className: "SellingCompanyFieldComponent", filePath: "lib/components/selling-company-field/selling-company-field.component.ts", lineNumber: 85 }); })();
221
+ //# sourceMappingURL=selling-company-field.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selling-company-field.component.js","sourceRoot":"","sources":["../../../../src/lib/components/selling-company-field/selling-company-field.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAU,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACtJ,OAAO,EAAc,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,eAAe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K,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1F,CAAC;sHA/GQ,4BAA4B;6DAA5B,4BAA4B;YA1CjC,wCAUC;YADG,AADA,kIAAe,kCAA8B,IAAC,+GAClC,yBAAqB,IAAC;YACrC,iBAAgB;YACjB,+FAAe;;YAJX,AADA,AAHA,AADA,AADA,mCAAiB,4BACM,4BACA,0BAGF,gCACM;YAI/B,cAYC;YAZD,sCAYC;4BA3BK,eAAe;;iFA8ChB,4BAA4B;cAjDxC,SAAS;2BACI,+BAA+B,cAC7B,IAAI,WACP,CAAC,eAAe,CAAC,iBACX,iBAAiB,CAAC,IAAI,mBACpB,uBAAuB,CAAC,MAAM,YACrC;;;;;;;;;;;;;;;;;;;;;;;;;KAyBT;;kBAqBA,KAAK;mBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;kBACxB,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,MAAM;;kFARE,4BAA4B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=party-signal-store.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"party-signal-store.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/data/__tests__/party-signal-store.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,98 @@
1
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
2
+ const H = vi.hoisted(() => ({
3
+ queries: [
4
+ { ID: 'Q1', Name: 'Party Customer Roster', Category: 'Party Signals', Description: 'orders [signal: order|orders]' },
5
+ { ID: 'Q2', Name: 'Customer Roster', Category: 'Party Signals', Description: 'contracts [signal: contract|contracts]' },
6
+ { ID: 'Q3', Name: 'Directory Dashboard Summary', Category: 'Common', Description: 'unrelated' },
7
+ ],
8
+ config: vi.fn(async () => undefined),
9
+ runQuery: vi.fn(async (params) => {
10
+ if (params.QueryID === 'Q1') {
11
+ return {
12
+ Success: true,
13
+ Results: [
14
+ { PartyKind: 'organization', PartyID: 'ORG-A', Count: 4, LastActivityAt: '2026-08-01' },
15
+ { PartyKind: 'person', PartyID: 'PER-A', Count: 1, LastActivityAt: '2026-01-01' },
16
+ ],
17
+ };
18
+ }
19
+ return { Success: false, ErrorMessage: 'no read permission', Results: [] };
20
+ }),
21
+ }));
22
+ // The common-entities barrel pulls in the generated entity subclasses, which extend BaseEntity,
23
+ // so @memberjunction/core has to keep its real exports; only what this store calls is replaced.
24
+ vi.mock('@memberjunction/core', async (importOriginal) => ({
25
+ ...(await importOriginal()),
26
+ Metadata: Object.assign(class {
27
+ get CurrentUser() {
28
+ return { ID: 'u1' };
29
+ }
30
+ }, { Provider: {} }),
31
+ RunQuery: class {
32
+ RunQuery = H.runQuery;
33
+ },
34
+ LogError: () => undefined,
35
+ }));
36
+ vi.mock('@memberjunction/core-entities', async (importOriginal) => ({
37
+ ...(await importOriginal()),
38
+ QueryEngine: {
39
+ Instance: {
40
+ Config: H.config,
41
+ get Queries() {
42
+ return H.queries;
43
+ },
44
+ },
45
+ },
46
+ }));
47
+ import { PartySignalStore } from '../party-signal-store';
48
+ function freshStore() {
49
+ return PartySignalStore.Instance;
50
+ }
51
+ describe('PartySignalStore', () => {
52
+ beforeEach(async () => {
53
+ H.runQuery.mockClear();
54
+ H.config.mockClear();
55
+ await freshStore().Reset();
56
+ });
57
+ it('runs only the queries in the Party Signals category', async () => {
58
+ const store = freshStore();
59
+ await store.Load();
60
+ expect(H.runQuery).toHaveBeenCalledTimes(2);
61
+ expect(H.runQuery.mock.calls.map((call) => call[0].QueryID).sort()).toEqual(['Q1', 'Q2']);
62
+ });
63
+ it('merges the rows into a roster keyed case-insensitively by party ID', async () => {
64
+ const store = freshStore();
65
+ await store.Load();
66
+ expect(store.Get('org-a')?.TotalCount).toBe(4);
67
+ expect(store.Get('ORG-A')?.Signals[0].NounPlural).toBe('orders');
68
+ expect(store.Get('nobody')).toBeNull();
69
+ });
70
+ it('separates customers by kind, most recent activity first', async () => {
71
+ const store = freshStore();
72
+ await store.Load();
73
+ expect(store.Customers('organization').map((entry) => entry.PartyID)).toEqual(['ORG-A']);
74
+ expect(store.Customers('person').map((entry) => entry.PartyID)).toEqual(['PER-A']);
75
+ });
76
+ it('records a query it could not read as a warning instead of failing the whole roster', async () => {
77
+ const store = freshStore();
78
+ await store.Load();
79
+ expect(store.Warnings).toHaveLength(1);
80
+ expect(store.Warnings[0]).toContain('Customer Roster');
81
+ expect(store.Customers('organization')).toHaveLength(1);
82
+ });
83
+ it('loads once for concurrent callers and not again afterwards', async () => {
84
+ const store = freshStore();
85
+ await Promise.all([store.Load(), store.Load(), store.Load()]);
86
+ await store.Load();
87
+ expect(H.runQuery).toHaveBeenCalledTimes(2);
88
+ expect(store.Loaded).toBe(true);
89
+ });
90
+ it('re-runs the queries on an explicit refresh and drops the previous warnings', async () => {
91
+ const store = freshStore();
92
+ await store.Load();
93
+ await store.Refresh();
94
+ expect(H.runQuery).toHaveBeenCalledTimes(4);
95
+ expect(store.Warnings).toHaveLength(1);
96
+ });
97
+ });
98
+ //# sourceMappingURL=party-signal-store.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"party-signal-store.test.js","sourceRoot":"","sources":["../../../../src/lib/data/__tests__/party-signal-store.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9D,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACxB,OAAO,EAAE;QACL,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,uBAAuB,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,+BAA+B,EAAE;QACpH,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,eAA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,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QACvD,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,KAAK,IAAI,EAAE;QACxE,MAAM,KAAK,GAAG,UAAU,EAAE,CAAC;QAC3B,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAC9D,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC5C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4EAA4E,EAAE,KAAK,IAAI,EAAE;QACxF,MAAM,KAAK,GAAG,UAAU,EAAE,CAAC;QAC3B,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QACtB,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC5C,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { type IMetadataProvider, type UserInfo } from '@memberjunction/core';
2
+ export declare const COMMON_SETTING: {
3
+ /** The `MJ: Companies` row that new orders and contracts default their selling company to. */
4
+ readonly DefaultSellingCompanyID: "DefaultSellingCompanyID";
5
+ };
6
+ export declare class CommonSettings {
7
+ /** Idempotent; the engine caches, so callers may call this on every component init. */
8
+ static Load(provider?: IMetadataProvider, user?: UserInfo): Promise<void>;
9
+ /**
10
+ * The configured default selling company, or null when this instance has not set one — in
11
+ * which case the field stays blank and nothing is confirmed, which is the pre-existing
12
+ * behaviour rather than a guess.
13
+ */
14
+ static get DefaultSellingCompanyID(): string | null;
15
+ private static read;
16
+ private static applicationID;
17
+ }
18
+ //# sourceMappingURL=common-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-settings.d.ts","sourceRoot":"","sources":["../../../src/lib/data/common-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,iBAAiB,EAAE,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAavF,eAAO,MAAM,cAAc;IACvB,8FAA8F;;CAExF,CAAC;AAEX,qBAAa,cAAc;IACvB,uFAAuF;WACnE,IAAI,CAAC,QAAQ,CAAC,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAKtF;;;;OAIG;IACH,WAAkB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAEzD;IAED,OAAO,CAAC,MAAM,CAAC,IAAI;IAMnB,OAAO,CAAC,MAAM,CAAC,aAAa;CAG/B"}
@@ -0,0 +1,39 @@
1
+ import { Metadata } from '@memberjunction/core';
2
+ import { ApplicationSettingEngine } from '@memberjunction/core-entities';
3
+ /**
4
+ * The Common application's own settings, read by name.
5
+ *
6
+ * These are per-instance values that the shared library cannot know: Common ships each row with a
7
+ * documented name and an empty value, and the host that installs it fills the value in. Reading
8
+ * them through a named accessor rather than a bare string at each call site keeps a typo from
9
+ * silently reading as "not configured".
10
+ */
11
+ const COMMON_APPLICATION_NAME = 'Common';
12
+ export const COMMON_SETTING = {
13
+ /** The `MJ: Companies` row that new orders and contracts default their selling company to. */
14
+ DefaultSellingCompanyID: 'DefaultSellingCompanyID',
15
+ };
16
+ export class CommonSettings {
17
+ /** Idempotent; the engine caches, so callers may call this on every component init. */
18
+ static async Load(provider, user) {
19
+ const metadata = new Metadata();
20
+ await ApplicationSettingEngine.Instance.Config(false, user ?? metadata.CurrentUser, provider ?? Metadata.Provider);
21
+ }
22
+ /**
23
+ * The configured default selling company, or null when this instance has not set one — in
24
+ * which case the field stays blank and nothing is confirmed, which is the pre-existing
25
+ * behaviour rather than a guess.
26
+ */
27
+ static get DefaultSellingCompanyID() {
28
+ return this.read(COMMON_SETTING.DefaultSellingCompanyID);
29
+ }
30
+ static read(name) {
31
+ const raw = ApplicationSettingEngine.Instance.GetSetting(name, this.applicationID());
32
+ const value = (raw ?? '').trim();
33
+ return value.length > 0 ? value : null;
34
+ }
35
+ static applicationID() {
36
+ return new Metadata().Applications?.find((application) => application.Name === COMMON_APPLICATION_NAME)?.ID;
37
+ }
38
+ }
39
+ //# sourceMappingURL=common-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-settings.js","sourceRoot":"","sources":["../../../src/lib/data/common-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAyC,MAAM,sBAAsB,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE;;;;;;;GAOG;AACH,MAAM,uBAAuB,GAAG,QAAQ,CAAC;AAEzC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,8FAA8F;IAC9F,uBAAuB,EAAE,yBAAyB;CAC5C,CAAC;AAEX,MAAM,OAAO,cAAc;IACvB,uFAAuF;IAChF,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAA4B,EAAE,IAAe;QAClE,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAChC,MAAM,wBAAwB,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,IAAI,QAAQ,CAAC,WAAW,EAAE,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACvH,CAAC;IAED;;;;OAIG;IACI,MAAM,KAAK,uBAAuB;QACrC,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC;IAC7D,CAAC;IAEO,MAAM,CAAC,IAAI,CAAC,IAAY;QAC5B,MAAM,GAAG,GAAG,wBAAwB,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QACrF,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3C,CAAC;IAEO,MAAM,CAAC,aAAa;QACxB,OAAO,IAAI,QAAQ,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,KAAK,uBAAuB,CAAC,EAAE,EAAE,CAAC;IAChH,CAAC;CACJ"}
@@ -0,0 +1,39 @@
1
+ import { type PartyKind, type PartyRosterEntry } from '@mj-biz-apps/common-entities';
2
+ import { type IMetadataProvider, type UserInfo } from '@memberjunction/core';
3
+ import { BaseSingleton } from '@memberjunction/global';
4
+ /**
5
+ * The session's answer to "who are our customers".
6
+ *
7
+ * Common cannot see the orders, contracts or sales schemas, so it discovers every query in the
8
+ * `Party Signals` category through metadata, runs each once as the current user, and merges the
9
+ * rows into one roster. Adding an app to the answer is shipping a query in that category — no
10
+ * import, no registration, no change here.
11
+ *
12
+ * Loaded once per session rather than per keystroke: the roster is hundreds to low thousands of
13
+ * rows of IDs, counts and dates, and the picker ranks it in memory. A query the user has no
14
+ * permission to read contributes nothing and is recorded in {@link Warnings}; the picker still
15
+ * searches the directory, so a missing signal degrades ranking rather than breaking the field.
16
+ */
17
+ export declare class PartySignalStore extends BaseSingleton<PartySignalStore> {
18
+ private roster;
19
+ private loading;
20
+ private warnings;
21
+ private loaded;
22
+ static get Instance(): PartySignalStore;
23
+ get Loaded(): boolean;
24
+ /** One entry per signal query that could not be read or did not run. */
25
+ get Warnings(): ReadonlyArray<string>;
26
+ /** Idempotent, and safe to call from several pickers at once — they share one load. */
27
+ Load(provider?: IMetadataProvider, user?: UserInfo): Promise<void>;
28
+ /** Re-read the signals — after creating a party, or when a picker asks for fresh counts. */
29
+ Refresh(provider?: IMetadataProvider, user?: UserInfo): Promise<void>;
30
+ /** Drop everything loaded. Exposed so a test, or a user switch, starts from nothing. */
31
+ Reset(): Promise<void>;
32
+ /** The roster entry for a party, or null when the party is not a customer of any app. */
33
+ Get(partyID: string): PartyRosterEntry | null;
34
+ /** Customers of one kind, most recent activity first, never-active last, then by ID. */
35
+ Customers(kind: PartyKind): PartyRosterEntry[];
36
+ private loadRoster;
37
+ private runSource;
38
+ }
39
+ //# sourceMappingURL=party-signal-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"party-signal-store.d.ts","sourceRoot":"","sources":["../../../src/lib/data/party-signal-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,SAAS,EACd,KAAK,gBAAgB,EAGxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAgC,KAAK,iBAAiB,EAAE,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3G,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,qBAAa,gBAAiB,SAAQ,aAAa,CAAC,gBAAgB,CAAC;IACjE,OAAO,CAAC,MAAM,CAAuC;IACrD,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,MAAM,CAAS;IAEvB,WAAkB,QAAQ,IAAI,gBAAgB,CAE7C;IAED,IAAW,MAAM,IAAI,OAAO,CAE3B;IAED,wEAAwE;IACxE,IAAW,QAAQ,IAAI,aAAa,CAAC,MAAM,CAAC,CAE3C;IAED,uFAAuF;IAC1E,IAAI,CAAC,QAAQ,CAAC,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ/E,4FAA4F;IAC/E,OAAO,CAAC,QAAQ,CAAC,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAKlF,wFAAwF;IAC3E,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQnC,yFAAyF;IAClF,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAIpD,wFAAwF;IACjF,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,gBAAgB,EAAE;YAIvC,UAAU;YAeV,SAAS;CAe1B"}
@@ -0,0 +1,101 @@
1
+ import { MergePartySignalRows, ParseSignalNouns, PARTY_SIGNALS_CATEGORY, } from '@mj-biz-apps/common-entities';
2
+ import { LogError, Metadata, RunQuery } from '@memberjunction/core';
3
+ import { QueryEngine } from '@memberjunction/core-entities';
4
+ import { BaseSingleton } from '@memberjunction/global';
5
+ /**
6
+ * The session's answer to "who are our customers".
7
+ *
8
+ * Common cannot see the orders, contracts or sales schemas, so it discovers every query in the
9
+ * `Party Signals` category through metadata, runs each once as the current user, and merges the
10
+ * rows into one roster. Adding an app to the answer is shipping a query in that category — no
11
+ * import, no registration, no change here.
12
+ *
13
+ * Loaded once per session rather than per keystroke: the roster is hundreds to low thousands of
14
+ * rows of IDs, counts and dates, and the picker ranks it in memory. A query the user has no
15
+ * permission to read contributes nothing and is recorded in {@link Warnings}; the picker still
16
+ * searches the directory, so a missing signal degrades ranking rather than breaking the field.
17
+ */
18
+ export class PartySignalStore extends BaseSingleton {
19
+ roster = new Map();
20
+ loading = null;
21
+ warnings = [];
22
+ loaded = false;
23
+ static get Instance() {
24
+ return super.getInstance();
25
+ }
26
+ get Loaded() {
27
+ return this.loaded;
28
+ }
29
+ /** One entry per signal query that could not be read or did not run. */
30
+ get Warnings() {
31
+ return this.warnings;
32
+ }
33
+ /** Idempotent, and safe to call from several pickers at once — they share one load. */
34
+ async Load(provider, user) {
35
+ if (this.loaded) {
36
+ return;
37
+ }
38
+ this.loading ??= this.loadRoster(provider, user);
39
+ await this.loading;
40
+ }
41
+ /** Re-read the signals — after creating a party, or when a picker asks for fresh counts. */
42
+ async Refresh(provider, user) {
43
+ await this.Reset();
44
+ await this.Load(provider, user);
45
+ }
46
+ /** Drop everything loaded. Exposed so a test, or a user switch, starts from nothing. */
47
+ async Reset() {
48
+ await this.loading?.catch(() => undefined);
49
+ this.roster = new Map();
50
+ this.warnings = [];
51
+ this.loaded = false;
52
+ this.loading = null;
53
+ }
54
+ /** The roster entry for a party, or null when the party is not a customer of any app. */
55
+ Get(partyID) {
56
+ return this.roster.get((partyID ?? '').trim().toLowerCase()) ?? null;
57
+ }
58
+ /** Customers of one kind, most recent activity first, never-active last, then by ID. */
59
+ Customers(kind) {
60
+ return [...this.roster.values()].filter((entry) => entry.Kind === kind).sort(byRecencyThenID);
61
+ }
62
+ async loadRoster(provider, user) {
63
+ const providerToUse = provider ?? Metadata.Provider;
64
+ const userToUse = user ?? new Metadata().CurrentUser;
65
+ try {
66
+ await QueryEngine.Instance.Config(false, userToUse, providerToUse);
67
+ const queries = QueryEngine.Instance.Queries.filter((query) => query.Category === PARTY_SIGNALS_CATEGORY);
68
+ const sources = await Promise.all(queries.map((query) => this.runSource(query.ID, query.Name, query.Description, userToUse)));
69
+ this.roster = new Map(MergePartySignalRows(sources).map((entry) => [entry.PartyID.toLowerCase(), entry]));
70
+ }
71
+ catch (error) {
72
+ this.warnings.push(`Party Signals could not be loaded: ${messageOf(error)}`);
73
+ LogError(`PartySignalStore: ${messageOf(error)}`);
74
+ }
75
+ this.loaded = true;
76
+ }
77
+ async runSource(id, name, description, user) {
78
+ const source = { QueryKey: name, ...ParseSignalNouns(description), Rows: [] };
79
+ try {
80
+ const result = await new RunQuery().RunQuery({ QueryID: id }, user);
81
+ if (result.Success) {
82
+ source.Rows = result.Results ?? [];
83
+ }
84
+ else {
85
+ this.warnings.push(`${name}: ${result.ErrorMessage ?? 'failed'}`);
86
+ }
87
+ }
88
+ catch (error) {
89
+ this.warnings.push(`${name}: ${messageOf(error)}`);
90
+ LogError(`PartySignalStore: ${name} failed — ${messageOf(error)}`);
91
+ }
92
+ return source;
93
+ }
94
+ }
95
+ function byRecencyThenID(a, b) {
96
+ return (b.LastActivityAt?.getTime() ?? 0) - (a.LastActivityAt?.getTime() ?? 0) || a.PartyID.localeCompare(b.PartyID);
97
+ }
98
+ function messageOf(error) {
99
+ return error instanceof Error ? error.message : String(error);
100
+ }
101
+ //# sourceMappingURL=party-signal-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"party-signal-store.js","sourceRoot":"","sources":["../../../src/lib/data/party-signal-store.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,GAKzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAyC,MAAM,sBAAsB,CAAC;AAC3G,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,gBAAiB,SAAQ,aAA+B;IACzD,MAAM,GAAG,IAAI,GAAG,EAA4B,CAAC;IAC7C,OAAO,GAAyB,IAAI,CAAC;IACrC,QAAQ,GAAa,EAAE,CAAC;IACxB,MAAM,GAAG,KAAK,CAAC;IAEhB,MAAM,KAAK,QAAQ;QACtB,OAAO,KAAK,CAAC,WAAW,EAAoB,CAAC;IACjD,CAAC;IAED,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,wEAAwE;IACxE,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;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ard.page'
35
35
  export { CommonPeoplePageComponent } from './lib/pages/people-list.page';
36
36
  export { CommonOrganizationsPageComponent } from './lib/pages/organizations-list.page';
37
37
  export { CommonActivitiesPageComponent } from './lib/pages/activities-dashboard.page';
38
+ export { PartySignalStore } from './lib/data/party-signal-store';
39
+ export { CommonSettings, COMMON_SETTING } from './lib/data/common-settings';
40
+ export { SellingCompanyFieldComponent } from './lib/components/selling-company-field/selling-company-field.component';
41
+ export { SellingCompanyConfirm } from './lib/components/selling-company-field/selling-company-confirm';
38
42
  /**
39
43
  * Bootstrap function called during MJExplorer initialization.
40
44
  * Static imports above handle all registration.
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,8BAA8B,CAAC;AAGtC,OAAO,wCAAwC,CAAC;AAGhD,OAAO,kCAAkC,CAAC;AAM1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAGrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AAClG,OAAO,EAAE,0BAA0B,EAAE,MAAM,oEAAoE,CAAC;AAChH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gEAAgE,CAAC;AAC3G,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,kEAAkE,CAAC;AAC1H,OAAO,EAAE,gCAAgC,EAAE,MAAM,yEAAyE,CAAC;AAC3H,OAAO,EAAE,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,gDAAgD,CAAC;AACtG,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAC/F,OAAO,EACH,oBAAoB,EACpB,mBAAmB,E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BAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAGlF,OAAO,0CAA0C,CAAC;AAElD,OAAO,EACH,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,2BAA2B,EAC3B,+BAA+B,EAC/B,wBAAwB,EAC3B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAItF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wEAAwE,CAAC;AACtH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gEAAgE,CAAC;AAEvG;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
@@ -42,6 +42,12 @@ export { CommonDashboardPageComponent } from './lib/pages/common-dashboard.page'
42
42
  export { CommonPeoplePageComponent } from './lib/pages/people-list.page';
43
43
  export { CommonOrganizationsPageComponent } from './lib/pages/organizations-list.page';
44
44
  export { CommonActivitiesPageComponent } from './lib/pages/activities-dashboard.page';
45
+ // Party pickers. The Party Signals contract itself lives in @mj-biz-apps/common-entities; these are
46
+ // the client-side reader, the per-instance settings, and the selling-company field.
47
+ export { PartySignalStore } from './lib/data/party-signal-store';
48
+ export { CommonSettings, COMMON_SETTING } from './lib/data/common-settings';
49
+ export { SellingCompanyFieldComponent } from './lib/components/selling-company-field/selling-company-field.component';
50
+ export { SellingCompanyConfirm } from './lib/components/selling-company-field/selling-company-confirm';
45
51
  /**
46
52
  * Bootstrap function called during MJExplorer initialization.
47
53
  * Static imports above handle all registration.
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,mFAAmF;AACnF,OAAO,8BAA8B,CAAC;AAEtC,iFAAiF;AACjF,OAAO,wCAAwC,CAAC;AAEhD,mEAAmE;AACnE,OAAO,kCAAkC,CAAC;AAK1C,0BAA0B;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,yBAAyB;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AAClG,OAAO,EAAE,0BAA0B,EAAE,MAAM,oEAAoE,CAAC;AAChH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gEAAgE,CAAC;AAC3G,OAAO,EAAE,yBAAyB,EAAe,MAAM,kEAAkE,CAAC;AAC1H,OAAO,EAAE,gCAAgC,EAAE,MAAM,yEAAyE,CAAC;AAC3H,OAAO,EAAE,iBAAiB,EAAqB,MAAM,gDAAgD,CAAC;AACtG,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAC/F,OAAO,EACH,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,GAOrB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4DAA4D,CAAC;AACrG,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AACjH,OAAO,EAAE,yBAAyB,EAAE,MAAM,8DAA8D,CAAC;AACzG,OAAO,EAAE,0BAA0B,EAAE,M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,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAEtF,oGAAoG;AACpG,oFAAoF;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wEAAwE,CAAC;AACtH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gEAAgE,CAAC;AAEvG;;;GAGG;AACH,MAAM,UAAU,uBAAuB;IACnC,0BAA0B,EAAE,CAAC;AACjC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mj-biz-apps/common-ng",
3
3
  "type": "module",
4
- "version": "5.44.0",
4
+ "version": "5.45.0",
5
5
  "description": "BizApps Common Angular bootstrap - form components and module for the Common business entities Open App",
6
6
  "main": "dist/public-api.js",
7
7
  "types": "dist/public-api.d.ts",
@@ -14,7 +14,7 @@
14
14
  "author": "MemberJunction.com",
15
15
  "license": "BUSL-1.1",
16
16
  "dependencies": {
17
- "@mj-biz-apps/common-entities": "5.44.0"
17
+ "@mj-biz-apps/common-entities": "5.45.0"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@angular/animations": "^21.1.3",