@voyantjs/crm-react 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +109 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/provider.d.ts +1 -38
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +1 -32
- package/dist/query-options.d.ts +1345 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +279 -0
- package/dist/schemas.d.ts +20 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +8 -0
- package/package.json +42 -46
package/LICENSE
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, Apache 2.0 Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 PixelMakers Studio SRL
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly
|
|
28
|
+
display and redistribute the Software for any Permitted Purpose identified
|
|
29
|
+
below.
|
|
30
|
+
|
|
31
|
+
### Permitted Purpose
|
|
32
|
+
|
|
33
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing
|
|
34
|
+
Use means making the Software available to others in a commercial product or
|
|
35
|
+
service that:
|
|
36
|
+
|
|
37
|
+
1. substitutes for the Software;
|
|
38
|
+
|
|
39
|
+
2. substitutes for any other product or service we offer using the Software
|
|
40
|
+
that exists as of the date we make the Software available; or
|
|
41
|
+
|
|
42
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
43
|
+
|
|
44
|
+
Permitted Purposes specifically include using the Software:
|
|
45
|
+
|
|
46
|
+
1. for your internal use and access;
|
|
47
|
+
|
|
48
|
+
2. for non-commercial education;
|
|
49
|
+
|
|
50
|
+
3. for non-commercial research; and
|
|
51
|
+
|
|
52
|
+
4. in connection with professional services that you provide to a licensee
|
|
53
|
+
using the Software in accordance with these Terms and Conditions.
|
|
54
|
+
|
|
55
|
+
### Patents
|
|
56
|
+
|
|
57
|
+
To the extent your use for a Permitted Purpose would necessarily infringe
|
|
58
|
+
our patents, the license grant above includes a license under our patents.
|
|
59
|
+
If you make a claim against any party that the Software infringes or
|
|
60
|
+
contributes to the infringement of any patent, then your patent license to
|
|
61
|
+
the Software ends immediately.
|
|
62
|
+
|
|
63
|
+
### Redistribution
|
|
64
|
+
|
|
65
|
+
The Terms and Conditions apply to all copies, modifications and derivatives
|
|
66
|
+
of the Software.
|
|
67
|
+
|
|
68
|
+
If you redistribute any copies, modifications or derivatives of the
|
|
69
|
+
Software, you must include a copy of or a link to these Terms and Conditions
|
|
70
|
+
and not remove any copyright notices provided in or with the Software.
|
|
71
|
+
|
|
72
|
+
### Disclaimer
|
|
73
|
+
|
|
74
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS
|
|
75
|
+
OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A
|
|
76
|
+
PARTICULAR PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
77
|
+
|
|
78
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO
|
|
79
|
+
THE SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
|
|
80
|
+
DAMAGES, EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
81
|
+
|
|
82
|
+
### Trademarks
|
|
83
|
+
|
|
84
|
+
Except for displaying the License Details and identifying us as the origin
|
|
85
|
+
of the Software, you have no right under these Terms and Conditions to use
|
|
86
|
+
our trademarks, trade names, service marks or product names.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Grant of Future License
|
|
91
|
+
|
|
92
|
+
We hereby irrevocably grant you an additional license to use the Software
|
|
93
|
+
under the Apache License, Version 2.0 that is effective on the second
|
|
94
|
+
anniversary of the date we make the Software available. On or after that
|
|
95
|
+
date, you may use the Software under the Apache License, Version 2.0, in
|
|
96
|
+
which case the following will apply:
|
|
97
|
+
|
|
98
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
99
|
+
use this file except in compliance with the License.
|
|
100
|
+
|
|
101
|
+
You may obtain a copy of the License at
|
|
102
|
+
|
|
103
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
104
|
+
|
|
105
|
+
Unless required by applicable law or agreed to in writing, software
|
|
106
|
+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
107
|
+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
108
|
+
License for the specific language governing permissions and limitations
|
|
109
|
+
under the License.
|
package/dist/index.d.ts
CHANGED
|
@@ -19,5 +19,6 @@ export { type UseQuotesOptions, useQuotes, } from "./hooks/use-quotes.js";
|
|
|
19
19
|
export { type UseStageOptions, type UseStagesOptions, useStage, useStages, } from "./hooks/use-stages.js";
|
|
20
20
|
export { useVoyantContext, type VoyantContextValue, VoyantProvider, type VoyantProviderProps, } from "./provider.js";
|
|
21
21
|
export { type ActivitiesListFilters, crmQueryKeys, type OpportunitiesListFilters, type OrganizationsListFilters, type PeopleListFilters, type PipelinesListFilters, type QuotesListFilters, type StagesListFilters, } from "./query-keys.js";
|
|
22
|
-
export {
|
|
22
|
+
export { getActivitiesQueryOptions, getOpportunitiesQueryOptions, getOpportunityQueryOptions, getOrganizationQueryOptions, getOrganizationsQueryOptions, getPeopleQueryOptions, getPersonActivitiesQueryOptions, getPersonNotesQueryOptions, getPersonOpportunitiesQueryOptions, getPersonQueryOptions, getPipelineQueryOptions, getPipelinesQueryOptions, getQuoteLinesQueryOptions, getQuoteQueryOptions, getQuotesQueryOptions, getStageQueryOptions, getStagesQueryOptions, } from "./query-options.js";
|
|
23
|
+
export { type ActivityLinkRecord, type ActivityRecord, activityLinkRecordSchema, activityRecordSchema, type OpportunityRecord, type OrganizationRecord, opportunityRecordSchema, organizationRecordSchema, type PersonNoteRecord, type PersonRecord, type PipelineRecord, personNoteRecordSchema, personRecordSchema, pipelineRecordSchema, type QuoteLineRecord, type QuoteRecord, quoteLineRecordSchema, quoteRecordSchema, type StageRecord, stageRecordSchema, } from "./schemas.js";
|
|
23
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,GACnB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,KAAK,oBAAoB,EACzB,aAAa,GACd,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,KAAK,kBAAkB,EACvB,WAAW,EACX,gBAAgB,GACjB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,mBAAmB,GACpB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,KAAK,uBAAuB,EAC5B,gBAAgB,GACjB,MAAM,8BAA8B,CAAA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GACV,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,KAAK,qBAAqB,EAC1B,YAAY,EACZ,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,KAAK,WAAW,EAChB,iBAAiB,GAClB,MAAM,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,aAAa,GACnB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,KAAK,oBAAoB,EACzB,aAAa,GACd,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,KAAK,kBAAkB,EACvB,WAAW,EACX,gBAAgB,GACjB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,mBAAmB,GACpB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,KAAK,uBAAuB,EAC5B,gBAAgB,GACjB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,KAAK,qBAAqB,EAC1B,cAAc,GACf,MAAM,4BAA4B,CAAA;A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EACvB,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,KAAK,qBAAqB,EAC1B,YAAY,EACZ,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,yBAAyB,EACzB,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,EAC5B,qBAAqB,EACrB,+BAA+B,EAC/B,0BAA0B,EAC1B,kCAAkC,EAClC,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,KAAK,WAAW,EAChB,iBAAiB,GAClB,MAAM,cAAc,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -19,4 +19,5 @@ export { useQuotes, } from "./hooks/use-quotes.js";
|
|
|
19
19
|
export { useStage, useStages, } from "./hooks/use-stages.js";
|
|
20
20
|
export { useVoyantContext, VoyantProvider, } from "./provider.js";
|
|
21
21
|
export { crmQueryKeys, } from "./query-keys.js";
|
|
22
|
-
export {
|
|
22
|
+
export { getActivitiesQueryOptions, getOpportunitiesQueryOptions, getOpportunityQueryOptions, getOrganizationQueryOptions, getOrganizationsQueryOptions, getPeopleQueryOptions, getPersonActivitiesQueryOptions, getPersonNotesQueryOptions, getPersonOpportunitiesQueryOptions, getPersonQueryOptions, getPipelineQueryOptions, getPipelinesQueryOptions, getQuoteLinesQueryOptions, getQuoteQueryOptions, getQuotesQueryOptions, getStageQueryOptions, getStagesQueryOptions, } from "./query-options.js";
|
|
23
|
+
export { activityLinkRecordSchema, activityRecordSchema, opportunityRecordSchema, organizationRecordSchema, personNoteRecordSchema, personRecordSchema, pipelineRecordSchema, quoteLineRecordSchema, quoteRecordSchema, stageRecordSchema, } from "./schemas.js";
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,39 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { type VoyantFetcher } from "./client.js";
|
|
3
|
-
export interface VoyantContextValue {
|
|
4
|
-
baseUrl: string;
|
|
5
|
-
fetcher: VoyantFetcher;
|
|
6
|
-
}
|
|
7
|
-
export interface VoyantProviderProps {
|
|
8
|
-
/**
|
|
9
|
-
* Base URL prepended to every CRM API call. For same-origin deployments this
|
|
10
|
-
* is usually `/api`; cross-origin consumers pass the full origin, e.g.
|
|
11
|
-
* `https://api.example.com`.
|
|
12
|
-
*/
|
|
13
|
-
baseUrl: string;
|
|
14
|
-
/**
|
|
15
|
-
* Optional fetcher override. Defaults to `window.fetch` with
|
|
16
|
-
* `credentials: "include"` so session cookies are sent automatically.
|
|
17
|
-
*/
|
|
18
|
-
fetcher?: VoyantFetcher;
|
|
19
|
-
children: ReactNode;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Wraps the CRM UI hooks in a configured context. Must be mounted above any
|
|
23
|
-
* component that calls `usePeople`, `usePerson`, etc.
|
|
24
|
-
*
|
|
25
|
-
* ```tsx
|
|
26
|
-
* <VoyantProvider baseUrl="/api">
|
|
27
|
-
* <App />
|
|
28
|
-
* </VoyantProvider>
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* This component assumes a `<QueryClientProvider>` already exists higher in
|
|
32
|
-
* the tree — it does not instantiate its own React Query client.
|
|
33
|
-
*/
|
|
34
|
-
export declare function VoyantProvider({ baseUrl, fetcher, children }: VoyantProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
-
/**
|
|
36
|
-
* Reads the current Voyant context. Throws if used outside `<VoyantProvider>`.
|
|
37
|
-
*/
|
|
38
|
-
export declare function useVoyantContext(): VoyantContextValue;
|
|
1
|
+
export { useVoyantReactContext as useVoyantContext, type VoyantReactContextValue as VoyantContextValue, VoyantReactProvider as VoyantProvider, type VoyantReactProviderProps as VoyantProviderProps, } from "@voyantjs/react";
|
|
39
2
|
//# sourceMappingURL=provider.d.ts.map
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,IAAI,gBAAgB,EACzC,KAAK,uBAAuB,IAAI,kBAAkB,EAClD,mBAAmB,IAAI,cAAc,EACrC,KAAK,wBAAwB,IAAI,mBAAmB,GACrD,MAAM,iBAAiB,CAAA"}
|
package/dist/provider.js
CHANGED
|
@@ -1,32 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext, useMemo } from "react";
|
|
4
|
-
import { defaultFetcher } from "./client.js";
|
|
5
|
-
const VoyantContext = createContext(null);
|
|
6
|
-
/**
|
|
7
|
-
* Wraps the CRM UI hooks in a configured context. Must be mounted above any
|
|
8
|
-
* component that calls `usePeople`, `usePerson`, etc.
|
|
9
|
-
*
|
|
10
|
-
* ```tsx
|
|
11
|
-
* <VoyantProvider baseUrl="/api">
|
|
12
|
-
* <App />
|
|
13
|
-
* </VoyantProvider>
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* This component assumes a `<QueryClientProvider>` already exists higher in
|
|
17
|
-
* the tree — it does not instantiate its own React Query client.
|
|
18
|
-
*/
|
|
19
|
-
export function VoyantProvider({ baseUrl, fetcher, children }) {
|
|
20
|
-
const value = useMemo(() => ({ baseUrl, fetcher: fetcher ?? defaultFetcher }), [baseUrl, fetcher]);
|
|
21
|
-
return _jsx(VoyantContext.Provider, { value: value, children: children });
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Reads the current Voyant context. Throws if used outside `<VoyantProvider>`.
|
|
25
|
-
*/
|
|
26
|
-
export function useVoyantContext() {
|
|
27
|
-
const context = useContext(VoyantContext);
|
|
28
|
-
if (!context) {
|
|
29
|
-
throw new Error('useVoyantContext must be used inside <VoyantProvider>. Wrap your app with <VoyantProvider baseUrl="/api" />.');
|
|
30
|
-
}
|
|
31
|
-
return context;
|
|
32
|
-
}
|
|
1
|
+
export { useVoyantReactContext as useVoyantContext, VoyantReactProvider as VoyantProvider, } from "@voyantjs/react";
|