@dropins/storefront-quote-management 0.0.1-alpha8 → 0.0.1-alpha9
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/api/graphql/NegotiableQuoteFragment.d.ts +1 -1
- package/api/index.d.ts +0 -1
- package/api/requestNegotiableQuote/requestNegotiableQuote.d.ts +6 -0
- package/api.js +4 -4
- package/api.js.map +1 -1
- package/chunks/requestNegotiableQuote.js +80 -5
- package/chunks/requestNegotiableQuote.js.map +1 -1
- package/components/index.d.ts +0 -1
- package/containers/RequestNegotiableQuoteForm/RequestNegotiableQuoteForm.d.ts +1 -0
- package/containers/RequestNegotiableQuoteForm.js +1 -1
- package/containers/RequestNegotiableQuoteForm.js.map +1 -1
- package/containers/index.d.ts +0 -1
- package/data/models/index.d.ts +0 -1
- package/data/models/negotiable-quote-model.d.ts +8 -46
- package/data/transforms/__fixtures__/negotiableQuoteData.d.ts +1 -76
- package/data/transforms/transform-quote.d.ts +2 -5
- package/i18n/en_US.json.d.ts +1 -14
- package/package.json +1 -1
- package/render.js +2 -3
- package/render.js.map +1 -1
- package/api/graphql/SearchResultPageInfoFragment.d.ts +0 -10
- package/api/graphql/SortFieldsFragment.d.ts +0 -10
- package/api/negotiableQuotes/graphql/NegotiableQuotesQuery.d.ts +0 -10
- package/api/negotiableQuotes/index.d.ts +0 -10
- package/api/negotiableQuotes/negotiableQuotes.d.ts +0 -39
- package/chunks/NegotiableQuoteFragment.js +0 -56
- package/chunks/NegotiableQuoteFragment.js.map +0 -1
- package/chunks/negotiableQuotes.js +0 -47
- package/chunks/negotiableQuotes.js.map +0 -1
- package/components/QuotesListTable/QuotesListTable.d.ts +0 -29
- package/components/QuotesListTable/index.d.ts +0 -11
- package/containers/QuotesListTable/QuotesListTable.d.ts +0 -72
- package/containers/QuotesListTable/index.d.ts +0 -11
- package/containers/QuotesListTable.d.ts +0 -3
- package/containers/QuotesListTable.js +0 -4
- package/containers/QuotesListTable.js.map +0 -1
- package/data/models/__fixtures__/negotiableQuotesListModel.d.ts +0 -5
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { NegotiableQuoteModel
|
|
1
|
+
import { NegotiableQuoteModel } from '../../models/negotiable-quote-model';
|
|
2
2
|
|
|
3
3
|
export declare const mockGraphQLResponse: {
|
|
4
4
|
data: {
|
|
5
5
|
requestNegotiableQuote: {
|
|
6
6
|
quote: {
|
|
7
7
|
uid: string;
|
|
8
|
-
name: string;
|
|
9
8
|
created_at: string;
|
|
10
|
-
updated_at: string;
|
|
11
9
|
status: string;
|
|
12
10
|
buyer: {
|
|
13
11
|
firstname: string;
|
|
@@ -48,7 +46,6 @@ export declare const mockGraphQLResponse: {
|
|
|
48
46
|
};
|
|
49
47
|
grand_total: {
|
|
50
48
|
value: number;
|
|
51
|
-
currency: string;
|
|
52
49
|
};
|
|
53
50
|
};
|
|
54
51
|
};
|
|
@@ -56,76 +53,4 @@ export declare const mockGraphQLResponse: {
|
|
|
56
53
|
};
|
|
57
54
|
};
|
|
58
55
|
export declare const expectedTransformedQuote: NegotiableQuoteModel;
|
|
59
|
-
export declare const mockNegotiableQuotesResponse: {
|
|
60
|
-
data: {
|
|
61
|
-
negotiableQuotes: {
|
|
62
|
-
items: {
|
|
63
|
-
uid: string;
|
|
64
|
-
name: string;
|
|
65
|
-
created_at: string;
|
|
66
|
-
updated_at: string;
|
|
67
|
-
status: NegotiableQuoteStatus;
|
|
68
|
-
buyer: {
|
|
69
|
-
firstname: string;
|
|
70
|
-
lastname: string;
|
|
71
|
-
};
|
|
72
|
-
items: {
|
|
73
|
-
product: {
|
|
74
|
-
uid: string;
|
|
75
|
-
sku: string;
|
|
76
|
-
name: string;
|
|
77
|
-
template_id: string;
|
|
78
|
-
template_name: string;
|
|
79
|
-
price_range: {
|
|
80
|
-
maximum_price: {
|
|
81
|
-
regular_price: {
|
|
82
|
-
value: number;
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
quantity: number;
|
|
88
|
-
}[];
|
|
89
|
-
prices: {
|
|
90
|
-
subtotal_excluding_tax: {
|
|
91
|
-
value: number;
|
|
92
|
-
};
|
|
93
|
-
subtotal_including_tax: {
|
|
94
|
-
value: number;
|
|
95
|
-
};
|
|
96
|
-
subtotal_with_discount_excluding_tax: {
|
|
97
|
-
value: number;
|
|
98
|
-
};
|
|
99
|
-
grand_total: {
|
|
100
|
-
value: number;
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
}[];
|
|
104
|
-
page_info: {
|
|
105
|
-
current_page: number;
|
|
106
|
-
page_size: number;
|
|
107
|
-
total_pages: number;
|
|
108
|
-
};
|
|
109
|
-
total_count: number;
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
export declare const mockEmptyNegotiableQuotesResponse: {
|
|
114
|
-
data: {
|
|
115
|
-
negotiableQuotes: {
|
|
116
|
-
items: never[];
|
|
117
|
-
page_info: {
|
|
118
|
-
current_page: number;
|
|
119
|
-
page_size: number;
|
|
120
|
-
total_pages: number;
|
|
121
|
-
};
|
|
122
|
-
total_count: number;
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
export declare const mockNullNegotiableQuotesResponse: {
|
|
127
|
-
data: {
|
|
128
|
-
negotiableQuotes: null;
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
56
|
//# sourceMappingURL=negotiableQuoteData.d.ts.map
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { NegotiableQuoteModel
|
|
1
|
+
import { NegotiableQuoteModel } from '../models/negotiable-quote-model';
|
|
2
2
|
|
|
3
|
-
export declare function transformQuote(
|
|
4
|
-
export declare function transformNegotiableQuotesList(quotesData: any): NegotiableQuotesListModel | null;
|
|
5
|
-
export declare function transformPaginationInfo(quotesData: NegotiableQuotesListModel | null): PaginationInfo | null;
|
|
6
|
-
export declare const getDefaultPageSizeOptions: () => number[];
|
|
3
|
+
export declare function transformQuote(response: any): NegotiableQuoteModel | null;
|
|
7
4
|
//# sourceMappingURL=transform-quote.d.ts.map
|
package/i18n/en_US.json.d.ts
CHANGED
|
@@ -21,20 +21,7 @@ declare const _default: {
|
|
|
21
21
|
"draftSaved": "Quote saved as draft successfully!"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
},
|
|
25
|
-
"QuoteManagement": {
|
|
26
|
-
"QuotesListTable": {
|
|
27
|
-
"quoteName": "Quote Name",
|
|
28
|
-
"created": "Created",
|
|
29
|
-
"createdBy": "Created By",
|
|
30
|
-
"status": "Status",
|
|
31
|
-
"lastUpdated": "Last Updated",
|
|
32
|
-
"quoteTemplate": "Quote Template",
|
|
33
|
-
"quoteTotal": "Quote Total",
|
|
34
|
-
"actions": "Action"
|
|
35
|
-
}
|
|
36
24
|
}
|
|
37
|
-
}
|
|
38
|
-
;
|
|
25
|
+
};
|
|
39
26
|
|
|
40
27
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@dropins/storefront-quote-management", "version": "0.0.1-
|
|
1
|
+
{"name": "@dropins/storefront-quote-management", "version": "0.0.1-alpha9", "@dropins/tools": "^1.5.0-beta4", "license": "SEE LICENSE IN LICENSE.md"}
|
package/render.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
(function(
|
|
4
|
-
|
|
5
|
-
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{Render as u}from"@dropins/tools/lib.js";import{useState as n,useEffect as d}from"@dropins/tools/preact-hooks.js";import{UIProvider as m}from"@dropins/tools/components.js";import{events as c}from"@dropins/tools/event-bus.js";const i={Request:{title:"Request a Quote",comment:"Comment",commentError:"Please add your comment",quoteName:"Quote name",quoteNameError:"Please add a quote name",attachmentsError:"Error uploading attachments",requestCta:"Request a Quote",saveDraftCta:"Save as draft",error:{header:"Error",unauthenticated:"Please sign in to request a quote.",unauthorized:"You are not authorized to request a quote.",missingCart:"Could not find a valid cart."},success:{header:"Success",submitted:"Quote request submitted successfully!",draftSaved:"Quote saved as draft successfully!"}}},l={QuotesListTable:{quoteName:"Quote Name",created:"Created",createdBy:"Created By",status:"Status",lastUpdated:"Last Updated",quoteTemplate:"Quote Template",quoteTotal:"Quote Total",actions:"Action"}},f={NegotiableQuote:i,QuoteManagement:l},q={default:f},Q=({children:a})=>{const[o,r]=n("en_US");return d(()=>{const e=c.on("locale",s=>{r(s)},{eager:!0});return()=>{e==null||e.off()}},[]),t(m,{lang:o,langDefinitions:q,children:a})},S=new u(t(Q,{}));export{S as render};
|
|
3
|
+
(function(a,o){try{if(typeof document<"u"){const e=document.createElement("style"),n=o.styleId;for(const t in o.attributes)e.setAttribute(t,o.attributes[t]);e.setAttribute("data-dropin",n),e.appendChild(document.createTextNode(a));const r=document.querySelector('style[data-dropin="sdk"]');if(r)r.after(e);else{const t=document.querySelector('link[rel="stylesheet"], style');t?t.before(e):document.head.append(e)}}}catch(e){console.error("dropin-styles (injectCodeFunction)",e)}})(".request-negotiable-quote-form{display:grid;gap:var(--spacing-small);align-items:flex-end;color:var(--color-neutral-800);width:100%}.request-negotiable-quote-form input:user-invalid,.request-negotiable-quote-form textarea:user-invalid{border-color:var(--color-alert-800)}.request-negotiable-quote-form__title{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.request-negotiable-quote-form__actions,.request-negotiable-quote-form [data-slot=AttachFileField]{display:flex;gap:var(--spacing-small)}.request-negotiable-quote-form__actions{justify-content:flex-start}.request-negotiable-quote-form__attach-file-field{justify-content:end}.request-negotiable-quote-form__attach-file-field label{background:none;color:var(--color-brand-500);font:var(--type-body-1-strong-font)}.request-negotiable-quote-form__attach-file-field label:hover{background:none}.request-negotiable-quote-form__error-banner svg{color:var(--color-alert-800)}",{styleId:"quote-management"});
|
|
4
|
+
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{Render as u}from"@dropins/tools/lib.js";import{useState as n,useEffect as m}from"@dropins/tools/preact-hooks.js";import{UIProvider as d}from"@dropins/tools/components.js";import{events as i}from"@dropins/tools/event-bus.js";const c={Request:{title:"Request a Quote",comment:"Comment",commentError:"Please add your comment",quoteName:"Quote name",quoteNameError:"Please add a quote name",attachmentsError:"Error uploading attachments",requestCta:"Request a Quote",saveDraftCta:"Save as draft",error:{header:"Error",unauthenticated:"Please sign in to request a quote.",unauthorized:"You are not authorized to request a quote.",missingCart:"Could not find a valid cart."},success:{header:"Success",submitted:"Quote request submitted successfully!",draftSaved:"Quote saved as draft successfully!"}}},f={NegotiableQuote:c},l={default:f},q=({children:r})=>{const[o,a]=n("en_US");return m(()=>{const e=i.on("locale",s=>{a(s)},{eager:!0});return()=>{e==null||e.off()}},[]),t(d,{lang:o,langDefinitions:l,children:r})},S=new u(t(q,{}));export{S as render};
|
|
6
5
|
//# sourceMappingURL=render.js.map
|
package/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sources":["/@dropins/storefront-quote-management/src/render/Provider.tsx","/@dropins/storefront-quote-management/src/render/render.tsx"],"sourcesContent":["import { FunctionComponent } from 'preact';\nimport { useState, useEffect } from 'preact/hooks';\nimport { UIProvider } from '@adobe-commerce/elsie/components';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\n\nimport en_US from '../i18n/en_US.json';\n\n// Langs\nconst langDefinitions = {\n default: en_US,\n};\n\ninterface CartProviderProps {\n children?: any;\n}\n\nexport const Provider: FunctionComponent<CartProviderProps> = ({\n children,\n}) => {\n const [lang, setLang] = useState<Lang>('en_US');\n\n // Events\n useEffect(() => {\n const localeEvent = events.on(\n 'locale',\n (locale: string) => {\n setLang(locale as Lang);\n },\n { eager: true }\n );\n return () => {\n localeEvent?.off();\n };\n }, []);\n\n return (\n <UIProvider lang={lang} langDefinitions={langDefinitions}>\n {children}\n </UIProvider>\n );\n};\n","import { Render } from '@adobe-commerce/elsie/lib';\nimport { Provider } from './Provider';\n\nexport const render = new Render(<Provider />);\n"],"names":["langDefinitions","en_US","Provider","children","lang","setLang","useState","useEffect","localeEvent","events","locale","jsx","UIProvider","render","Render"],"mappings":"
|
|
1
|
+
{"version":3,"file":"render.js","sources":["/@dropins/storefront-quote-management/src/render/Provider.tsx","/@dropins/storefront-quote-management/src/render/render.tsx"],"sourcesContent":["import { FunctionComponent } from 'preact';\nimport { useState, useEffect } from 'preact/hooks';\nimport { UIProvider } from '@adobe-commerce/elsie/components';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\n\nimport en_US from '../i18n/en_US.json';\n\n// Langs\nconst langDefinitions = {\n default: en_US,\n};\n\ninterface CartProviderProps {\n children?: any;\n}\n\nexport const Provider: FunctionComponent<CartProviderProps> = ({\n children,\n}) => {\n const [lang, setLang] = useState<Lang>('en_US');\n\n // Events\n useEffect(() => {\n const localeEvent = events.on(\n 'locale',\n (locale: string) => {\n setLang(locale as Lang);\n },\n { eager: true }\n );\n return () => {\n localeEvent?.off();\n };\n }, []);\n\n return (\n <UIProvider lang={lang} langDefinitions={langDefinitions}>\n {children}\n </UIProvider>\n );\n};\n","import { Render } from '@adobe-commerce/elsie/lib';\nimport { Provider } from './Provider';\n\nexport const render = new Render(<Provider />);\n"],"names":["langDefinitions","en_US","Provider","children","lang","setLang","useState","useEffect","localeEvent","events","locale","jsx","UIProvider","render","Render"],"mappings":"o3BASMA,EAAkB,CACtB,QAASC,CACX,EAMaC,EAAiD,CAAC,CAC7D,SAAAC,CACF,IAAM,CACJ,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAe,OAAO,EAG9C,OAAAC,EAAU,IAAM,CACd,MAAMC,EAAcC,EAAO,GACzB,SACCC,GAAmB,CAClBL,EAAQK,CAAc,CACxB,EACA,CAAE,MAAO,EAAA,CAAK,EAEhB,MAAO,IAAM,CACXF,GAAA,MAAAA,EAAa,KACf,CACF,EAAG,CAAA,CAAE,EAGHG,EAACC,EAAA,CAAW,KAAAR,EAAY,gBAAAJ,EACrB,SAAAG,CAAA,CACH,CAEJ,ECtCaU,EAAS,IAAIC,EAAOH,EAACT,IAAS,CAAE"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/********************************************************************
|
|
2
|
-
* Copyright 2025 Adobe
|
|
3
|
-
* All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
-
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
-
* accompanying it.
|
|
8
|
-
*******************************************************************/
|
|
9
|
-
export declare const SEARCH_RESULT_PAGE_INFO_FRAGMENT = "\n fragment SearchResultPageInfoFragment on SearchResultPageInfo {\n current_page\n page_size\n total_pages\n }\n";
|
|
10
|
-
//# sourceMappingURL=SearchResultPageInfoFragment.d.ts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/********************************************************************
|
|
2
|
-
* Copyright 2025 Adobe
|
|
3
|
-
* All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
-
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
-
* accompanying it.
|
|
8
|
-
*******************************************************************/
|
|
9
|
-
export declare const SORT_FIELDS_FRAGMENT = "\n fragment SortFieldsFragment on SortFields {\n default\n options {\n label\n value\n }\n }\n";
|
|
10
|
-
//# sourceMappingURL=SortFieldsFragment.d.ts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/********************************************************************
|
|
2
|
-
* Copyright 2025 Adobe
|
|
3
|
-
* All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
-
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
-
* accompanying it.
|
|
8
|
-
*******************************************************************/
|
|
9
|
-
export declare const NEGOTIABLE_QUOTES_QUERY: string;
|
|
10
|
-
//# sourceMappingURL=NegotiableQuotesQuery.d.ts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/********************************************************************
|
|
2
|
-
* Copyright 2025 Adobe
|
|
3
|
-
* All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
-
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
-
* accompanying it.
|
|
8
|
-
*******************************************************************/
|
|
9
|
-
export * from './negotiableQuotes';
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { NegotiableQuotesListModel } from '../../data/models/negotiable-quote-model';
|
|
2
|
-
|
|
3
|
-
export declare enum FilterMatchTypeEnum {
|
|
4
|
-
FULL = "FULL",
|
|
5
|
-
PARTIAL = "PARTIAL"
|
|
6
|
-
}
|
|
7
|
-
export interface FilterEqualTypeInput {
|
|
8
|
-
eq?: string;
|
|
9
|
-
in?: string[];
|
|
10
|
-
}
|
|
11
|
-
export interface FilterMatchTypeInput {
|
|
12
|
-
match?: string;
|
|
13
|
-
match_type?: FilterMatchTypeEnum;
|
|
14
|
-
}
|
|
15
|
-
export interface NegotiableQuoteFilterInput {
|
|
16
|
-
ids?: FilterEqualTypeInput;
|
|
17
|
-
name?: FilterMatchTypeInput;
|
|
18
|
-
}
|
|
19
|
-
export declare enum SortEnum {
|
|
20
|
-
ASC = "ASC",
|
|
21
|
-
DESC = "DESC"
|
|
22
|
-
}
|
|
23
|
-
export declare enum NegotiableQuoteSortableField {
|
|
24
|
-
QUOTE_NAME = "QUOTE_NAME",
|
|
25
|
-
CREATED_AT = "CREATED_AT",
|
|
26
|
-
UPDATED_AT = "UPDATED_AT"
|
|
27
|
-
}
|
|
28
|
-
export interface NegotiableQuoteSortInput {
|
|
29
|
-
sort_direction: SortEnum;
|
|
30
|
-
sort_field: NegotiableQuoteSortableField;
|
|
31
|
-
}
|
|
32
|
-
export interface NegotiableQuotesParams {
|
|
33
|
-
filter?: NegotiableQuoteFilterInput;
|
|
34
|
-
pageSize?: number;
|
|
35
|
-
currentPage?: number;
|
|
36
|
-
sort?: NegotiableQuoteSortInput;
|
|
37
|
-
}
|
|
38
|
-
export declare const negotiableQuotes: (params?: NegotiableQuotesParams) => Promise<NegotiableQuotesListModel>;
|
|
39
|
-
//# sourceMappingURL=negotiableQuotes.d.ts.map
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2025 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
const l={requestQuote:!1,editQuote:!1,deleteQuote:!1},o={authenticated:!1,permissions:l},p=new Proxy(o,{get:(t,a)=>t[a],set:(t,a,n)=>(t[a]=n,!0)});function i(t){var a,n;return{uid:t.uid,name:t.name,createdAt:t.created_at,updatedAt:t.updated_at,status:t.status,buyer:{firstname:t.buyer.firstname,lastname:t.buyer.lastname},comments:(a=t.comments)==null?void 0:a.map(e=>({uid:e.uid,createdAt:e.created_at,author:{firstname:e.author.firstname,lastname:e.author.lastname}})),items:(n=t.items)==null?void 0:n.map(e=>({product:{uid:e.product.uid,sku:e.product.sku,name:e.product.name,templateId:e.product.template_id,templateName:e.product.template_name,priceRange:{maximumPrice:{regularPrice:{value:e.product.price_range.maximum_price.regular_price.value}}}},quantity:e.quantity,prices:{subtotalExcludingTax:{value:t.prices.subtotal_excluding_tax.value},subtotalIncludingTax:{value:t.prices.subtotal_including_tax.value},subtotalWithDiscountExcludingTax:{value:t.prices.subtotal_with_discount_excluding_tax.value},grandTotal:{value:t.prices.grand_total.value,currency:t.prices.grand_total.currency}}}))}}function g(t){if(!t||!t.data||!t.data.requestNegotiableQuote)return null;const a=t.data.requestNegotiableQuote.quote;return i(a)}function m(t){var e;if(!t)return null;const a={items:((e=t.items)==null?void 0:e.filter(r=>r==null?void 0:r.uid).map(i))||[],pageInfo:{currentPage:t.page_info.current_page,pageSize:t.page_info.page_size,totalPages:t.page_info.total_pages},totalCount:t.total_count,sortFields:t.sort_fields?{default:t.sort_fields.default,options:t.sort_fields.options}:void 0},n=c(a);return{...a,paginationInfo:n||void 0}}function c(t){if(!(t!=null&&t.pageInfo)||!t.totalCount)return null;const{currentPage:a,pageSize:n,totalPages:e}=t.pageInfo,{totalCount:r}=t,s=r>0?(a-1)*n+1:0,u=Math.min(a*n,r);return{currentPage:a,totalCount:r,pageSize:n,startItem:s,endItem:u,totalPages:e,pageSizeOptions:[20,30,50,100,200]}}const _=()=>[20,30,50,100,200],f=`
|
|
4
|
-
fragment NegotiableQuoteFragment on NegotiableQuote {
|
|
5
|
-
uid
|
|
6
|
-
name
|
|
7
|
-
created_at
|
|
8
|
-
updated_at
|
|
9
|
-
status
|
|
10
|
-
buyer {
|
|
11
|
-
firstname
|
|
12
|
-
lastname
|
|
13
|
-
}
|
|
14
|
-
comments {
|
|
15
|
-
uid
|
|
16
|
-
created_at
|
|
17
|
-
author {
|
|
18
|
-
firstname
|
|
19
|
-
lastname
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
template_id
|
|
23
|
-
template_name
|
|
24
|
-
items {
|
|
25
|
-
product {
|
|
26
|
-
uid
|
|
27
|
-
sku
|
|
28
|
-
name
|
|
29
|
-
price_range {
|
|
30
|
-
maximum_price {
|
|
31
|
-
regular_price {
|
|
32
|
-
value
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
quantity
|
|
38
|
-
}
|
|
39
|
-
prices {
|
|
40
|
-
subtotal_excluding_tax {
|
|
41
|
-
value
|
|
42
|
-
}
|
|
43
|
-
subtotal_including_tax {
|
|
44
|
-
value
|
|
45
|
-
}
|
|
46
|
-
subtotal_with_discount_excluding_tax {
|
|
47
|
-
value
|
|
48
|
-
}
|
|
49
|
-
grand_total {
|
|
50
|
-
value
|
|
51
|
-
currency
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
`;export{l as D,f as N,m as a,_ as g,p as s,g as t};
|
|
56
|
-
//# sourceMappingURL=NegotiableQuoteFragment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NegotiableQuoteFragment.js","sources":["/@dropins/storefront-quote-management/src/lib/state.ts","/@dropins/storefront-quote-management/src/data/transforms/transform-quote.ts","/@dropins/storefront-quote-management/src/api/graphql/NegotiableQuoteFragment.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this \n * file in accordance with the terms of the Adobe license agreement \n * accompanying it. \n *******************************************************************/\n\nimport { State } from '../types/state.types';\n\nexport const DEFAULT_PERMISSIONS = {\n requestQuote: false,\n editQuote: false,\n deleteQuote: false,\n};\n\nconst _state: State = {\n authenticated: false,\n permissions: DEFAULT_PERMISSIONS,\n}\n\n// Proxy state to make it reactive\nexport const state = new Proxy(_state, {\n get: (target, key) => {\n return target[key as keyof State];\n },\n set: (target, key, value) => {\n target[key as keyof State] = value;\n return true;\n }\n})","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport {\n NegotiableQuoteModel,\n NegotiableQuotesListModel,\n PaginationInfo,\n} from '@/quote-management/data/models/negotiable-quote-model';\n\n// Base helper that transforms a single quote object directly\nfunction transformSingleQuote(quote: any): NegotiableQuoteModel {\n return {\n uid: quote.uid,\n name: quote.name,\n createdAt: quote.created_at,\n updatedAt: quote.updated_at,\n status: quote.status,\n buyer: {\n firstname: quote.buyer.firstname,\n lastname: quote.buyer.lastname,\n },\n comments: quote.comments?.map((comment: any) => ({\n uid: comment.uid,\n createdAt: comment.created_at,\n author: {\n firstname: comment.author.firstname,\n lastname: comment.author.lastname,\n },\n })),\n items: quote.items?.map((item: any) => ({\n product: {\n uid: item.product.uid,\n sku: item.product.sku,\n name: item.product.name,\n templateId: item.product.template_id,\n templateName: item.product.template_name,\n priceRange: {\n maximumPrice: {\n regularPrice: {\n value: item.product.price_range.maximum_price.regular_price.value,\n },\n },\n },\n },\n quantity: item.quantity,\n prices: {\n subtotalExcludingTax: {\n value: quote.prices.subtotal_excluding_tax.value,\n },\n subtotalIncludingTax: {\n value: quote.prices.subtotal_including_tax.value,\n },\n subtotalWithDiscountExcludingTax: {\n value: quote.prices.subtotal_with_discount_excluding_tax.value,\n },\n grandTotal: {\n value: quote.prices.grand_total.value,\n currency: quote.prices.grand_total.currency,\n },\n },\n })),\n };\n}\n\nexport function transformQuote(quoteData: any): NegotiableQuoteModel | null {\n if (!quoteData || !quoteData.data || !quoteData.data.requestNegotiableQuote) {\n return null;\n }\n\n const quote = quoteData.data.requestNegotiableQuote.quote;\n return transformSingleQuote(quote);\n}\n\nexport function transformNegotiableQuotesList(\n quotesData: any\n): NegotiableQuotesListModel | null {\n if (!quotesData) {\n return null;\n }\n\n const transformedModel = {\n items:\n quotesData.items\n ?.filter((quote: any) => quote?.uid)\n .map(transformSingleQuote) || [],\n pageInfo: {\n currentPage: quotesData.page_info.current_page,\n pageSize: quotesData.page_info.page_size,\n totalPages: quotesData.page_info.total_pages,\n },\n totalCount: quotesData.total_count,\n sortFields: quotesData.sort_fields\n ? {\n default: quotesData.sort_fields.default,\n options: quotesData.sort_fields.options,\n }\n : undefined,\n };\n\n // Calculate pagination info\n const paginationInfo = transformPaginationInfo(transformedModel);\n\n return {\n ...transformedModel,\n paginationInfo: paginationInfo || undefined,\n };\n}\n\nexport function transformPaginationInfo(\n quotesData: NegotiableQuotesListModel | null\n): PaginationInfo | null {\n if (!quotesData?.pageInfo || !quotesData.totalCount) {\n return null;\n }\n\n const { currentPage, pageSize, totalPages } = quotesData.pageInfo;\n const { totalCount } = quotesData;\n\n const startItem = totalCount > 0 ? (currentPage - 1) * pageSize + 1 : 0;\n const endItem = Math.min(currentPage * pageSize, totalCount);\n\n const pageSizeOptions = [20, 30, 50, 100, 200]; // Default page size options\n\n return {\n currentPage,\n totalCount,\n pageSize,\n startItem,\n endItem,\n totalPages,\n pageSizeOptions,\n };\n}\n\n// TODO: Check if admin has this configuration\nexport const getDefaultPageSizeOptions = () => [20, 30, 50, 100, 200];\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const NEGOTIABLE_QUOTE_FRAGMENT = /* GraphQL */ `\n fragment NegotiableQuoteFragment on NegotiableQuote {\n uid\n name\n created_at\n updated_at\n status\n buyer {\n firstname\n lastname\n }\n comments {\n uid\n created_at\n author {\n firstname\n lastname\n }\n }\n template_id\n template_name\n items {\n product {\n uid\n sku\n name\n price_range {\n maximum_price {\n regular_price {\n value\n }\n }\n }\n }\n quantity\n }\n prices {\n subtotal_excluding_tax {\n value\n }\n subtotal_including_tax {\n value\n }\n subtotal_with_discount_excluding_tax {\n value\n }\n grand_total {\n value\n currency\n }\n }\n }\n`;\n"],"names":["DEFAULT_PERMISSIONS","_state","state","target","key","value","transformSingleQuote","quote","_a","_b","comment","item","transformQuote","quoteData","transformNegotiableQuotesList","quotesData","transformedModel","paginationInfo","transformPaginationInfo","currentPage","pageSize","totalPages","totalCount","startItem","endItem","getDefaultPageSizeOptions","NEGOTIABLE_QUOTE_FRAGMENT"],"mappings":"AAWO,MAAMA,EAAsB,CAC/B,aAAc,GACd,UAAW,GACX,YAAa,EACjB,EAEMC,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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2025 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
import{fetchGraphQl as n}from"@dropins/tools/fetch-graphql.js";import{N as s,s as i,a as g}from"./NegotiableQuoteFragment.js";const u=`
|
|
4
|
-
fragment SearchResultPageInfoFragment on SearchResultPageInfo {
|
|
5
|
-
current_page
|
|
6
|
-
page_size
|
|
7
|
-
total_pages
|
|
8
|
-
}
|
|
9
|
-
`,l=`
|
|
10
|
-
fragment SortFieldsFragment on SortFields {
|
|
11
|
-
default
|
|
12
|
-
options {
|
|
13
|
-
label
|
|
14
|
-
value
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
`,E=`
|
|
18
|
-
query negotiableQuotes(
|
|
19
|
-
$filter: NegotiableQuoteFilterInput
|
|
20
|
-
$pageSize: Int
|
|
21
|
-
$currentPage: Int
|
|
22
|
-
$sort: NegotiableQuoteSortInput
|
|
23
|
-
) {
|
|
24
|
-
negotiableQuotes(
|
|
25
|
-
filter: $filter
|
|
26
|
-
pageSize: $pageSize
|
|
27
|
-
currentPage: $currentPage
|
|
28
|
-
sort: $sort
|
|
29
|
-
) {
|
|
30
|
-
items {
|
|
31
|
-
...NegotiableQuoteFragment
|
|
32
|
-
}
|
|
33
|
-
page_info {
|
|
34
|
-
...SearchResultPageInfoFragment
|
|
35
|
-
}
|
|
36
|
-
sort_fields {
|
|
37
|
-
...SortFieldsFragment
|
|
38
|
-
}
|
|
39
|
-
total_count
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
${s}
|
|
44
|
-
${u}
|
|
45
|
-
${l}
|
|
46
|
-
`;var c=(e=>(e.FULL="FULL",e.PARTIAL="PARTIAL",e))(c||{}),A=(e=>(e.ASC="ASC",e.DESC="DESC",e))(A||{}),f=(e=>(e.QUOTE_NAME="QUOTE_NAME",e.CREATED_AT="CREATED_AT",e.UPDATED_AT="UPDATED_AT",e))(f||{});const S=async(e={})=>{var r;if(!i.authenticated)return Promise.reject(new Error("Unauthorized"));const o={filter:e.filter||null,pageSize:e.pageSize||20,currentPage:e.currentPage||1,sort:e.sort||null};try{const t=await n(E,{variables:o});if(!((r=t==null?void 0:t.data)!=null&&r.negotiableQuotes))throw new Error("No quotes data received");const a=g(t.data.negotiableQuotes);if(!a)throw new Error("Failed to transform quotes data");return a}catch(t){return Promise.reject(t)}};export{c as F,f as N,A as S,S as n};
|
|
47
|
-
//# sourceMappingURL=negotiableQuotes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"negotiableQuotes.js","sources":["/@dropins/storefront-quote-management/src/api/graphql/SearchResultPageInfoFragment.ts","/@dropins/storefront-quote-management/src/api/graphql/SortFieldsFragment.ts","/@dropins/storefront-quote-management/src/api/negotiableQuotes/graphql/NegotiableQuotesQuery.ts","/@dropins/storefront-quote-management/src/api/negotiableQuotes/negotiableQuotes.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport const SEARCH_RESULT_PAGE_INFO_FRAGMENT = /* GraphQL */ `\n fragment SearchResultPageInfoFragment on SearchResultPageInfo {\n current_page\n page_size\n total_pages\n }\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nexport const SORT_FIELDS_FRAGMENT = /* GraphQL */ `\n fragment SortFieldsFragment on SortFields {\n default\n options {\n label\n value\n }\n }\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { NEGOTIABLE_QUOTE_FRAGMENT } from '@/quote-management/api/graphql/NegotiableQuoteFragment';\nimport { SEARCH_RESULT_PAGE_INFO_FRAGMENT } from '@/quote-management/api/graphql/SearchResultPageInfoFragment';\nimport { SORT_FIELDS_FRAGMENT } from '@/quote-management/api/graphql/SortFieldsFragment';\n\nexport const NEGOTIABLE_QUOTES_QUERY = /* GraphQL */ `\n query negotiableQuotes(\n $filter: NegotiableQuoteFilterInput\n $pageSize: Int\n $currentPage: Int\n $sort: NegotiableQuoteSortInput\n ) {\n negotiableQuotes(\n filter: $filter\n pageSize: $pageSize\n currentPage: $currentPage\n sort: $sort\n ) {\n items {\n ...NegotiableQuoteFragment\n }\n page_info {\n ...SearchResultPageInfoFragment\n }\n sort_fields {\n ...SortFieldsFragment\n }\n total_count\n }\n }\n\n ${NEGOTIABLE_QUOTE_FRAGMENT}\n ${SEARCH_RESULT_PAGE_INFO_FRAGMENT}\n ${SORT_FIELDS_FRAGMENT}\n`;\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@adobe-commerce/fetch-graphql';\nimport { NEGOTIABLE_QUOTES_QUERY } from './graphql/NegotiableQuotesQuery';\nimport { transformNegotiableQuotesList } from '@/quote-management/data/transforms';\nimport { NegotiableQuotesListModel } from '@/quote-management/data/models/negotiable-quote-model';\nimport { state } from '@/quote-management/lib/state';\n\nexport enum FilterMatchTypeEnum {\n FULL = 'FULL',\n PARTIAL = 'PARTIAL',\n}\n\nexport interface FilterEqualTypeInput {\n eq?: string;\n in?: string[];\n}\n\nexport interface FilterMatchTypeInput {\n match?: string;\n match_type?: FilterMatchTypeEnum;\n}\n\nexport interface NegotiableQuoteFilterInput {\n ids?: FilterEqualTypeInput;\n name?: FilterMatchTypeInput;\n}\n\nexport enum SortEnum {\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\nexport enum NegotiableQuoteSortableField {\n QUOTE_NAME = 'QUOTE_NAME',\n CREATED_AT = 'CREATED_AT',\n UPDATED_AT = 'UPDATED_AT',\n}\n\nexport interface NegotiableQuoteSortInput {\n sort_direction: SortEnum;\n sort_field: NegotiableQuoteSortableField;\n}\n\nexport interface NegotiableQuotesParams {\n filter?: NegotiableQuoteFilterInput;\n pageSize?: number;\n currentPage?: number;\n sort?: NegotiableQuoteSortInput;\n}\n\nexport const negotiableQuotes = async (\n params: NegotiableQuotesParams = {}\n): Promise<NegotiableQuotesListModel> => {\n if (!state.authenticated) {\n return Promise.reject(new Error('Unauthorized'));\n }\n\n const variables = {\n filter: params.filter || null,\n pageSize: params.pageSize || 20,\n currentPage: params.currentPage || 1,\n sort: params.sort || null,\n };\n\n try {\n const results: any = await fetchGraphQl(NEGOTIABLE_QUOTES_QUERY, {\n variables,\n });\n\n if (!results?.data?.negotiableQuotes) {\n throw new Error('No quotes data received');\n }\n\n const transformedData = transformNegotiableQuotesList(\n results.data.negotiableQuotes\n );\n\n if (!transformedData) {\n throw new Error('Failed to transform quotes data');\n }\n\n return transformedData;\n } catch (error) {\n return Promise.reject(error);\n }\n};\n"],"names":["SEARCH_RESULT_PAGE_INFO_FRAGMENT","SORT_FIELDS_FRAGMENT","NEGOTIABLE_QUOTES_QUERY","NEGOTIABLE_QUOTE_FRAGMENT","FilterMatchTypeEnum","SortEnum","NegotiableQuoteSortableField","negotiableQuotes","params","state","variables","results","fetchGraphQl","_a","transformedData","transformNegotiableQuotesList","error"],"mappings":"8HASO,MAAMA,EAAiD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECAj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
|
|
2
|
-
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
-
|
|
4
|
-
export interface QuotesListTableProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading' | 'children'> {
|
|
5
|
-
rowData: QuoteRowData[];
|
|
6
|
-
loading?: boolean;
|
|
7
|
-
className?: string;
|
|
8
|
-
emptyStateMessage?: VNode;
|
|
9
|
-
showItemRange?: boolean;
|
|
10
|
-
itemRangeMessage?: VNode;
|
|
11
|
-
showPageSizePicker?: boolean;
|
|
12
|
-
pageSizePickerMessage?: VNode;
|
|
13
|
-
showPagination?: boolean;
|
|
14
|
-
paginationMessage?: VNode;
|
|
15
|
-
}
|
|
16
|
-
export type QuoteRowData = {
|
|
17
|
-
id: string;
|
|
18
|
-
quoteName: VNode;
|
|
19
|
-
created: VNode;
|
|
20
|
-
createdBy: VNode;
|
|
21
|
-
status: VNode;
|
|
22
|
-
lastUpdated: VNode;
|
|
23
|
-
quoteTemplate: VNode;
|
|
24
|
-
quoteTotal: VNode;
|
|
25
|
-
actions: VNode;
|
|
26
|
-
[key: string]: VNode | string | number | undefined;
|
|
27
|
-
};
|
|
28
|
-
export declare const QuotesListTable: FunctionComponent<QuotesListTableProps>;
|
|
29
|
-
//# sourceMappingURL=QuotesListTable.d.ts.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/********************************************************************
|
|
2
|
-
* Copyright 2025 Adobe
|
|
3
|
-
* All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
-
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
-
* accompanying it.
|
|
8
|
-
*******************************************************************/
|
|
9
|
-
export * from './QuotesListTable';
|
|
10
|
-
export { QuotesListTable as default } from './QuotesListTable';
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'preact/compat';
|
|
2
|
-
import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
|
|
3
|
-
import { NegotiableQuoteModel } from '../../data/models';
|
|
4
|
-
|
|
5
|
-
export interface QuotesListTableProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
pageSize?: number;
|
|
7
|
-
showItemRange?: boolean;
|
|
8
|
-
showPageSizePicker?: boolean;
|
|
9
|
-
showPagination?: boolean;
|
|
10
|
-
onViewQuote?: (quoteId: string, quoteName: string, status: string) => void;
|
|
11
|
-
onPageSizeChange?: (pageSize: number) => void;
|
|
12
|
-
onPageChange?: (page: number) => void;
|
|
13
|
-
slots?: {
|
|
14
|
-
/** Slot for customizing the quote name cell content */
|
|
15
|
-
QuoteName?: SlotProps<{
|
|
16
|
-
quote: NegotiableQuoteModel;
|
|
17
|
-
}>;
|
|
18
|
-
/** Slot for customizing the created date cell content */
|
|
19
|
-
Created?: SlotProps<{
|
|
20
|
-
quote: NegotiableQuoteModel;
|
|
21
|
-
}>;
|
|
22
|
-
/** Slot for customizing the created by cell content */
|
|
23
|
-
CreatedBy?: SlotProps<{
|
|
24
|
-
quote: NegotiableQuoteModel;
|
|
25
|
-
}>;
|
|
26
|
-
/** Slot for customizing the status cell content */
|
|
27
|
-
Status?: SlotProps<{
|
|
28
|
-
quote: NegotiableQuoteModel;
|
|
29
|
-
}>;
|
|
30
|
-
/** Slot for customizing the last updated cell content */
|
|
31
|
-
LastUpdated?: SlotProps<{
|
|
32
|
-
quote: NegotiableQuoteModel;
|
|
33
|
-
}>;
|
|
34
|
-
/** Slot for customizing the quote template cell content */
|
|
35
|
-
QuoteTemplate?: SlotProps<{
|
|
36
|
-
quote: NegotiableQuoteModel;
|
|
37
|
-
}>;
|
|
38
|
-
/** Slot for customizing the quote total cell content */
|
|
39
|
-
QuoteTotal?: SlotProps<{
|
|
40
|
-
quote: NegotiableQuoteModel;
|
|
41
|
-
}>;
|
|
42
|
-
/** Slot for customizing the actions cell content */
|
|
43
|
-
Actions?: SlotProps<{
|
|
44
|
-
quote: NegotiableQuoteModel;
|
|
45
|
-
onViewQuote?: (id: string, name: string, status: string) => void;
|
|
46
|
-
}>;
|
|
47
|
-
/** Slot for customizing the empty quotes message */
|
|
48
|
-
EmptyQuotes?: SlotProps;
|
|
49
|
-
/** Slot for customizing the item range display */
|
|
50
|
-
ItemRange?: SlotProps<{
|
|
51
|
-
startItem: number;
|
|
52
|
-
endItem: number;
|
|
53
|
-
totalCount: number;
|
|
54
|
-
currentPage: number;
|
|
55
|
-
pageSize: number;
|
|
56
|
-
}>;
|
|
57
|
-
/** Slot for customizing the page size picker */
|
|
58
|
-
PageSizePicker?: SlotProps<{
|
|
59
|
-
pageSize: number;
|
|
60
|
-
pageSizeOptions: number[];
|
|
61
|
-
onPageSizeChange?: (pageSize: number) => void;
|
|
62
|
-
}>;
|
|
63
|
-
/** Slot for customizing the pagination */
|
|
64
|
-
Pagination?: SlotProps<{
|
|
65
|
-
currentPage: number;
|
|
66
|
-
totalPages: number;
|
|
67
|
-
onChange?: (page: number) => void;
|
|
68
|
-
}>;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
export declare const QuotesListTable: Container<QuotesListTableProps>;
|
|
72
|
-
//# sourceMappingURL=QuotesListTable.d.ts.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/********************************************************************
|
|
2
|
-
* Copyright 2025 Adobe
|
|
3
|
-
* All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this
|
|
6
|
-
* file in accordance with the terms of the Adobe license agreement
|
|
7
|
-
* accompanying it.
|
|
8
|
-
*******************************************************************/
|
|
9
|
-
export * from './QuotesListTable';
|
|
10
|
-
export { QuotesListTable as default } from './QuotesListTable';
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2025 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
import{jsxs as P,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{useState as Q,useEffect as X}from"@dropins/tools/preact-compat.js";import{classes as Y,Slot as o}from"@dropins/tools/lib.js";import{Table as Z,IllustratedMessage as V,Picker as q,Pagination as ee,Button as te,Price as ae}from"@dropins/tools/components.js";import{events as ne}from"@dropins/tools/event-bus.js";/* empty css */import{useText as ie}from"@dropins/tools/i18n.js";import{g as re}from"../chunks/NegotiableQuoteFragment.js";import"@dropins/tools/fetch-graphql.js";import{n as ce}from"../chunks/negotiableQuotes.js";const oe=({rowData:h=[],loading:S=!1,className:N,emptyStateMessage:y,showItemRange:v=!0,itemRangeMessage:m,showPageSizePicker:u=!0,pageSizePickerMessage:i,showPagination:x=!0,paginationMessage:l,...b})=>{const d=ie({quoteName:"QuoteManagement.QuotesListTable.quoteName",created:"QuoteManagement.QuotesListTable.created",createdBy:"QuoteManagement.QuotesListTable.createdBy",status:"QuoteManagement.QuotesListTable.status",lastUpdated:"QuoteManagement.QuotesListTable.lastUpdated",quoteTemplate:"QuoteManagement.QuotesListTable.quoteTemplate",quoteTotal:"QuoteManagement.QuotesListTable.quoteTotal",actions:"QuoteManagement.QuotesListTable.actions"}),s=[{key:"quoteName",label:d.quoteName},{key:"created",label:d.created},{key:"createdBy",label:d.createdBy},{key:"status",label:d.status},{key:"lastUpdated",label:d.lastUpdated},{key:"quoteTemplate",label:d.quoteTemplate},{key:"quoteTotal",label:d.quoteTotal},{key:"actions",label:d.actions}],z=!S&&h.length===0&&y,p=v&&m,f=u&&i,g=x&&l,T=p||f||g;return P("div",{...b,className:Y(["quote-management-quotes-list-table",N]),children:[t(Z,{columns:s,rowData:h,loading:S,mobileLayout:"none",className:"quote-management-quotes-list-table__table"}),z&&t("div",{className:"quotes-list-table__empty-state",children:y}),T&&P("div",{className:"quotes-list-table__footer",children:[t("div",{className:"quotes-list-table__item-range",children:p&&m}),t("div",{className:"quotes-list-table__pagination",children:g&&l}),t("div",{className:"quotes-list-table__page-size-picker",children:f&&i})]})]})},be=({pageSize:h,showItemRange:S=!0,showPageSizePicker:N=!0,showPagination:y=!0,onViewQuote:v,onPageSizeChange:m,onPageChange:u,slots:i,...x})=>{const[l,b]=Q(null),[d,s]=Q(!0),z=re()[0],[p,f]=Q(h||z),[g,T]=Q(1);X(()=>{const r=async()=>{try{s(!0);const c=await ce({pageSize:p,currentPage:g});b(c)}catch(c){console.error("Failed to fetch quotes:",c)}finally{s(!1)}},e=ne.on("authenticated",c=>{c?r():(b(null),s(!1))},{eager:!0});return()=>{e==null||e.off()}},[p,g]);const k=r=>{f(r),T(1),m==null||m(r)},_=r=>{T(r),u==null||u(r)},F=r=>{const e=r.target,c=e==null?void 0:e.value;c&&k(Number(c))},$=(r,e,c)=>r.filter(a=>a==null?void 0:a.uid).map(a=>{var I,w,B,M,A,U,C,O,R,D,E;const W=`${a.buyer.firstname} ${a.buyer.lastname}`;return{id:a.uid,quoteName:t(o,{name:"QuoteName",slot:e==null?void 0:e.QuoteName,context:{quote:a},children:t("span",{children:a.name})}),created:t(o,{name:"Created",slot:e==null?void 0:e.Created,context:{quote:a},children:t("span",{children:a.createdAt?new Date(a.createdAt).toLocaleDateString():"N/A"})}),createdBy:t(o,{name:"CreatedBy",slot:e==null?void 0:e.CreatedBy,context:{quote:a},children:t("span",{children:W})}),status:t(o,{name:"Status",slot:e==null?void 0:e.Status,context:{quote:a},children:t("span",{children:a.status})}),lastUpdated:t(o,{name:"LastUpdated",slot:e==null?void 0:e.LastUpdated,context:{quote:a},children:t("span",{children:a.updatedAt?new Date(a.updatedAt).toLocaleDateString():"N/A"})}),quoteTemplate:t(o,{name:"QuoteTemplate",slot:e==null?void 0:e.QuoteTemplate,context:{quote:a},children:t("span",{children:(B=(w=(I=a.items)==null?void 0:I[0])==null?void 0:w.product)==null?void 0:B.templateName})}),quoteTotal:t(o,{name:"QuoteTotal",slot:e==null?void 0:e.QuoteTotal,context:{quote:a},children:t(ae,{amount:(C=(U=(A=(M=a.items)==null?void 0:M[0])==null?void 0:A.prices)==null?void 0:U.grandTotal)==null?void 0:C.value,currency:(E=(D=(R=(O=a.items)==null?void 0:O[0])==null?void 0:R.prices)==null?void 0:D.grandTotal)==null?void 0:E.currency})}),actions:t(o,{name:"Actions",slot:e==null?void 0:e.Actions,context:{quote:a,onViewQuote:c},children:t(te,{variant:"tertiary",size:"medium",onClick:()=>c==null?void 0:c(a.uid,a.name,a.status),children:"View"})})}}),j=l!=null&&l.items?$(l.items,i,v):[],n=l==null?void 0:l.paginationInfo,L=!!n,G=t(o,{name:"EmptyQuotes",slot:i==null?void 0:i.EmptyQuotes,context:{quotesData:l},children:t(V,{heading:"No Quotes Found"})}),H=n?t(o,{name:"ItemRange",slot:i==null?void 0:i.ItemRange,context:n,children:P("span",{children:["Items ",n.startItem," to ",n.endItem," of"," ",n.totalCount," total"]})}):void 0,J=n&&n.pageSizeOptions?P(o,{name:"PageSizePicker",slot:i==null?void 0:i.PageSizePicker,context:{pageSize:n.pageSize,pageSizeOptions:n.pageSizeOptions,onPageSizeChange:k},children:[t("span",{children:"Show "}),t(q,{variant:"primary",size:"medium",value:String(n.pageSize),options:n.pageSizeOptions.map(r=>({value:String(r),text:String(r)})),handleSelect:F}),t("span",{children:" per page"})]}):void 0,K=n?t(o,{name:"Pagination",slot:i==null?void 0:i.Pagination,context:{currentPage:n.currentPage,totalPages:n.totalPages,onChange:_},children:t(ee,{currentPage:n.currentPage,totalPages:n.totalPages,onChange:_})}):void 0;return t(oe,{rowData:j,loading:d,className:x.className,emptyStateMessage:G,showItemRange:S&&L,itemRangeMessage:H,showPageSizePicker:N&&L,pageSizePickerMessage:J,showPagination:y&&L,paginationMessage:K})};export{be as QuotesListTable,be as default};
|
|
4
|
-
//# sourceMappingURL=QuotesListTable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QuotesListTable.js","sources":["/@dropins/storefront-quote-management/src/components/QuotesListTable/QuotesListTable.tsx","/@dropins/storefront-quote-management/src/containers/QuotesListTable/QuotesListTable.tsx"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Table } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/quote-management/components/QuotesListTable/QuotesListTable.css';\n\ntype Column = {\n key: string;\n label: string;\n};\n\nexport interface QuotesListTableProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'loading' | 'children'> {\n rowData: QuoteRowData[];\n loading?: boolean;\n className?: string;\n emptyStateMessage?: VNode;\n showItemRange?: boolean;\n itemRangeMessage?: VNode;\n showPageSizePicker?: boolean;\n pageSizePickerMessage?: VNode;\n showPagination?: boolean;\n paginationMessage?: VNode;\n}\n\nexport type QuoteRowData = {\n id: string;\n quoteName: VNode;\n created: VNode;\n createdBy: VNode;\n status: VNode;\n lastUpdated: VNode;\n quoteTemplate: VNode;\n quoteTotal: VNode;\n actions: VNode;\n [key: string]: VNode | string | number | undefined;\n};\n\nexport const QuotesListTable: FunctionComponent<QuotesListTableProps> = ({\n rowData = [],\n loading = false,\n className,\n emptyStateMessage,\n showItemRange = true,\n itemRangeMessage,\n showPageSizePicker = true,\n pageSizePickerMessage,\n showPagination = true,\n paginationMessage,\n ...props\n}) => {\n const dictionary = useText({\n quoteName: 'QuoteManagement.QuotesListTable.quoteName',\n created: 'QuoteManagement.QuotesListTable.created',\n createdBy: 'QuoteManagement.QuotesListTable.createdBy',\n status: 'QuoteManagement.QuotesListTable.status',\n lastUpdated: 'QuoteManagement.QuotesListTable.lastUpdated',\n quoteTemplate: 'QuoteManagement.QuotesListTable.quoteTemplate',\n quoteTotal: 'QuoteManagement.QuotesListTable.quoteTotal',\n actions: 'QuoteManagement.QuotesListTable.actions',\n });\n\n const columns: Column[] = [\n { key: 'quoteName', label: dictionary.quoteName },\n { key: 'created', label: dictionary.created },\n { key: 'createdBy', label: dictionary.createdBy },\n { key: 'status', label: dictionary.status },\n { key: 'lastUpdated', label: dictionary.lastUpdated },\n { key: 'quoteTemplate', label: dictionary.quoteTemplate },\n { key: 'quoteTotal', label: dictionary.quoteTotal },\n { key: 'actions', label: dictionary.actions },\n ];\n\n // Check if we should show empty state\n const shouldShowEmptyState =\n !loading && rowData.length === 0 && emptyStateMessage;\n\n // Show item range if requested and message is provided\n const shouldShowItemRange = showItemRange && itemRangeMessage;\n\n // Show page size picker if requested and message is provided\n const shouldShowPageSizePicker = showPageSizePicker && pageSizePickerMessage;\n\n // Show pagination if requested and message is provided\n const shouldShowPagination = showPagination && paginationMessage;\n\n // Show footer if any pagination element should be shown\n const shouldShowFooter =\n shouldShowItemRange || shouldShowPageSizePicker || shouldShowPagination;\n\n return (\n <div\n {...props}\n className={classes(['quote-management-quotes-list-table', className])}\n >\n <Table\n columns={columns}\n rowData={rowData}\n loading={loading}\n mobileLayout=\"none\"\n className=\"quote-management-quotes-list-table__table\"\n />\n {shouldShowEmptyState && (\n <div className=\"quotes-list-table__empty-state\">\n {emptyStateMessage}\n </div>\n )}\n {shouldShowFooter && (\n <div className=\"quotes-list-table__footer\">\n <div className=\"quotes-list-table__item-range\">\n {shouldShowItemRange && itemRangeMessage}\n </div>\n <div className=\"quotes-list-table__pagination\">\n {shouldShowPagination && paginationMessage}\n </div>\n <div className=\"quotes-list-table__page-size-picker\">\n {shouldShowPageSizePicker && pageSizePickerMessage}\n </div>\n </div>\n )}\n </div>\n );\n};\n","/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { HTMLAttributes, useEffect, useState } from 'preact/compat';\nimport { Container, Slot, SlotProps } from '@adobe-commerce/elsie/lib';\nimport {\n Price,\n Button,\n IllustratedMessage,\n Picker,\n Pagination,\n type PickerOption,\n} from '@adobe-commerce/elsie/components';\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n QuotesListTable as QuotesListTableComponent,\n QuoteRowData,\n} from '@/quote-management/components';\nimport { negotiableQuotes } from '@/quote-management/api';\nimport { getDefaultPageSizeOptions } from '@/quote-management/data/transforms';\nimport {\n NegotiableQuoteModel,\n NegotiableQuotesListModel,\n} from '@/quote-management/data/models';\n\nexport interface QuotesListTableProps extends HTMLAttributes<HTMLDivElement> {\n pageSize?: number;\n showItemRange?: boolean;\n showPageSizePicker?: boolean;\n showPagination?: boolean;\n onViewQuote?: (quoteId: string, quoteName: string, status: string) => void;\n onPageSizeChange?: (pageSize: number) => void;\n onPageChange?: (page: number) => void;\n slots?: {\n /** Slot for customizing the quote name cell content */\n QuoteName?: SlotProps<{ quote: NegotiableQuoteModel }>;\n /** Slot for customizing the created date cell content */\n Created?: SlotProps<{ quote: NegotiableQuoteModel }>;\n /** Slot for customizing the created by cell content */\n CreatedBy?: SlotProps<{ quote: NegotiableQuoteModel }>;\n /** Slot for customizing the status cell content */\n Status?: SlotProps<{ quote: NegotiableQuoteModel }>;\n /** Slot for customizing the last updated cell content */\n LastUpdated?: SlotProps<{ quote: NegotiableQuoteModel }>;\n /** Slot for customizing the quote template cell content */\n QuoteTemplate?: SlotProps<{ quote: NegotiableQuoteModel }>;\n /** Slot for customizing the quote total cell content */\n QuoteTotal?: SlotProps<{ quote: NegotiableQuoteModel }>;\n /** Slot for customizing the actions cell content */\n Actions?: SlotProps<{\n quote: NegotiableQuoteModel;\n onViewQuote?: (id: string, name: string, status: string) => void;\n }>;\n /** Slot for customizing the empty quotes message */\n EmptyQuotes?: SlotProps;\n /** Slot for customizing the item range display */\n ItemRange?: SlotProps<{\n startItem: number;\n endItem: number;\n totalCount: number;\n currentPage: number;\n pageSize: number;\n }>;\n /** Slot for customizing the page size picker */\n PageSizePicker?: SlotProps<{\n pageSize: number;\n pageSizeOptions: number[];\n onPageSizeChange?: (pageSize: number) => void;\n }>;\n /** Slot for customizing the pagination */\n Pagination?: SlotProps<{\n currentPage: number;\n totalPages: number;\n onChange?: (page: number) => void;\n }>;\n };\n}\n\nexport const QuotesListTable: Container<QuotesListTableProps> = ({\n pageSize,\n showItemRange = true,\n showPageSizePicker = true,\n showPagination = true,\n onViewQuote,\n onPageSizeChange,\n onPageChange,\n slots,\n ...props\n}) => {\n const [quotesData, setQuotesData] =\n useState<NegotiableQuotesListModel | null>(null);\n const [loading, setLoading] = useState(true);\n\n // Default to first page size option if no pageSize prop provided\n const defaultPageSize = getDefaultPageSizeOptions()[0];\n const [currentPageSize, setCurrentPageSize] = useState(\n pageSize || defaultPageSize\n );\n const [currentPage, setCurrentPage] = useState(1);\n\n // Fetch quotes data when authenticated\n useEffect(() => {\n const fetchQuotes = async () => {\n try {\n setLoading(true);\n const data = await negotiableQuotes({\n pageSize: currentPageSize,\n currentPage,\n });\n setQuotesData(data);\n } catch (error) {\n console.error('Failed to fetch quotes:', error);\n } finally {\n setLoading(false);\n }\n };\n\n // Listen for authentication events\n const unsubscribe = events.on(\n 'authenticated',\n (isAuthenticated) => {\n if (isAuthenticated) {\n fetchQuotes();\n } else {\n setQuotesData(null);\n setLoading(false);\n }\n },\n { eager: true }\n ); // eager: true means it fires immediately with current state\n\n return () => {\n unsubscribe?.off();\n };\n }, [currentPageSize, currentPage]);\n\n // Handle page size change\n const handlePageSizeChange = (newPageSize: number) => {\n setCurrentPageSize(newPageSize);\n setCurrentPage(1); // Reset to page 1 when page size changes\n onPageSizeChange?.(newPageSize); // Also call parent callback\n };\n\n // Handle page change\n const handlePageChange = (newPage: number) => {\n setCurrentPage(newPage);\n onPageChange?.(newPage); // Also call parent callback\n };\n\n // Handle page size picker selection\n const handlePageSizeSelect = (event: Event) => {\n const target = event.target as HTMLSelectElement;\n const value = target?.value;\n if (value) {\n handlePageSizeChange(Number(value));\n }\n };\n\n // Prepare transformed quote data for table component\n const prepareRowData = (\n quotes: NegotiableQuoteModel[],\n slots?: QuotesListTableProps['slots'],\n onViewQuote?: (quoteId: string, quoteName: string, status: string) => void\n ): QuoteRowData[] => {\n return quotes\n .filter((quote) => quote?.uid) // Filter out null quotes\n .map((quote) => {\n const createdByName = `${quote.buyer.firstname} ${quote.buyer.lastname}`;\n\n return {\n id: quote.uid,\n quoteName: (\n <Slot name=\"QuoteName\" slot={slots?.QuoteName} context={{ quote }}>\n <span>{quote.name}</span>\n </Slot>\n ),\n created: (\n <Slot name=\"Created\" slot={slots?.Created} context={{ quote }}>\n <span>\n {quote.createdAt\n ? new Date(quote.createdAt).toLocaleDateString()\n : 'N/A'}\n </span>\n </Slot>\n ),\n createdBy: (\n <Slot name=\"CreatedBy\" slot={slots?.CreatedBy} context={{ quote }}>\n <span>{createdByName}</span>\n </Slot>\n ),\n status: (\n <Slot name=\"Status\" slot={slots?.Status} context={{ quote }}>\n <span>{quote.status}</span>\n </Slot>\n ),\n lastUpdated: (\n <Slot\n name=\"LastUpdated\"\n slot={slots?.LastUpdated}\n context={{ quote }}\n >\n <span>\n {quote.updatedAt\n ? new Date(quote.updatedAt).toLocaleDateString()\n : 'N/A'}\n </span>\n </Slot>\n ),\n quoteTemplate: (\n <Slot\n name=\"QuoteTemplate\"\n slot={slots?.QuoteTemplate}\n context={{ quote }}\n >\n <span>{quote.items?.[0]?.product?.templateName}</span>\n </Slot>\n ),\n quoteTotal: (\n <Slot\n name=\"QuoteTotal\"\n slot={slots?.QuoteTotal}\n context={{ quote }}\n >\n <Price\n amount={quote.items?.[0]?.prices?.grandTotal?.value}\n currency={quote.items?.[0]?.prices?.grandTotal?.currency}\n />\n </Slot>\n ),\n actions: (\n <Slot\n name=\"Actions\"\n slot={slots?.Actions}\n context={{ quote, onViewQuote }}\n >\n <Button\n variant=\"tertiary\"\n size=\"medium\"\n onClick={() =>\n onViewQuote?.(quote.uid, quote.name, quote.status)\n }\n >\n View\n </Button>\n </Slot>\n ),\n };\n });\n };\n\n // Prepare data for rendering\n const rowData = quotesData?.items\n ? prepareRowData(quotesData.items, slots, onViewQuote)\n : [];\n\n const paginationInfo = quotesData?.paginationInfo;\n const shouldShowPagination = !!paginationInfo;\n\n // Empty state message\n const emptyStateMessage = (\n <Slot name=\"EmptyQuotes\" slot={slots?.EmptyQuotes} context={{ quotesData }}>\n <IllustratedMessage heading=\"No Quotes Found\" />\n </Slot>\n );\n\n // Item range message\n const itemRangeMessage = paginationInfo ? (\n <Slot name=\"ItemRange\" slot={slots?.ItemRange} context={paginationInfo}>\n <span>\n Items {paginationInfo.startItem} to {paginationInfo.endItem} of{' '}\n {paginationInfo.totalCount} total\n </span>\n </Slot>\n ) : undefined;\n\n // Prepare page size picker message for component\n const pageSizePickerMessage =\n paginationInfo && paginationInfo.pageSizeOptions ? (\n <Slot\n name=\"PageSizePicker\"\n slot={slots?.PageSizePicker}\n context={{\n pageSize: paginationInfo.pageSize,\n pageSizeOptions: paginationInfo.pageSizeOptions,\n onPageSizeChange: handlePageSizeChange,\n }}\n >\n <span>Show </span>\n <Picker\n variant=\"primary\"\n size=\"medium\"\n value={String(paginationInfo.pageSize)}\n options={paginationInfo.pageSizeOptions.map(\n (size): PickerOption => ({\n value: String(size),\n text: String(size),\n })\n )}\n handleSelect={handlePageSizeSelect}\n />\n <span> per page</span>\n </Slot>\n ) : undefined;\n\n // Prepare pagination message for component\n const paginationMessage = paginationInfo ? (\n <Slot\n name=\"Pagination\"\n slot={slots?.Pagination}\n context={{\n currentPage: paginationInfo.currentPage,\n totalPages: paginationInfo.totalPages,\n onChange: handlePageChange,\n }}\n >\n <Pagination\n currentPage={paginationInfo.currentPage}\n totalPages={paginationInfo.totalPages}\n onChange={handlePageChange}\n />\n </Slot>\n ) : undefined;\n\n return (\n <QuotesListTableComponent\n rowData={rowData}\n loading={loading}\n className={props.className as string}\n emptyStateMessage={emptyStateMessage}\n showItemRange={showItemRange && shouldShowPagination}\n itemRangeMessage={itemRangeMessage}\n showPageSizePicker={showPageSizePicker && shouldShowPagination}\n pageSizePickerMessage={pageSizePickerMessage}\n showPagination={showPagination && shouldShowPagination}\n paginationMessage={paginationMessage}\n />\n );\n};\n"],"names":["QuotesListTable","rowData","loading","className","emptyStateMessage","showItemRange","itemRangeMessage","showPageSizePicker","pageSizePickerMessage","showPagination","paginationMessage","props","dictionary","useText","columns","shouldShowEmptyState","shouldShowItemRange","shouldShowPageSizePicker","shouldShowPagination","shouldShowFooter","jsxs","classes","jsx","Table","pageSize","onViewQuote","onPageSizeChange","onPageChange","slots","quotesData","setQuotesData","useState","setLoading","defaultPageSize","getDefaultPageSizeOptions","currentPageSize","setCurrentPageSize","currentPage","setCurrentPage","useEffect","fetchQuotes","data","negotiableQuotes","error","unsubscribe","events","isAuthenticated","handlePageSizeChange","newPageSize","handlePageChange","newPage","handlePageSizeSelect","event","target","value","prepareRowData","quotes","quote","createdByName","Slot","_c","_b","_a","Price","_g","_f","_e","_d","_k","_j","_i","_h","Button","paginationInfo","IllustratedMessage","Picker","size","Pagination","QuotesListTableComponent"],"mappings":"ynBAgDO,MAAMA,GAA2D,CAAC,CACvE,QAAAC,EAAU,CAAA,EACV,QAAAC,EAAU,GACV,UAAAC,EACA,kBAAAC,EACA,cAAAC,EAAgB,GAChB,iBAAAC,EACA,mBAAAC,EAAqB,GACrB,sBAAAC,EACA,eAAAC,EAAiB,GACjB,kBAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAaC,GAAQ,CACzB,UAAW,4CACX,QAAS,0CACT,UAAW,4CACX,OAAQ,yCACR,YAAa,8CACb,cAAe,gDACf,WAAY,6CACZ,QAAS,yCAAA,CACV,EAEKC,EAAoB,CACxB,CAAE,IAAK,YAAa,MAAOF,EAAW,SAAA,EACtC,CAAE,IAAK,UAAW,MAAOA,EAAW,OAAA,EACpC,CAAE,IAAK,YAAa,MAAOA,EAAW,SAAA,EACtC,CAAE,IAAK,SAAU,MAAOA,EAAW,MAAA,EACnC,CAAE,IAAK,cAAe,MAAOA,EAAW,WAAA,EACxC,CAAE,IAAK,g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