@silexpert/core 1.0.107 → 1.0.109

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.
@@ -31,7 +31,7 @@ type brandColorType = {
31
31
  primary700: string
32
32
  };
33
33
 
34
- export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument, shouldHideBrandName = false): ReadCommercialDocumentTemplate {
34
+ export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoiceType, payload: CreateInvoiceDocument | CreatePreSaleDocument, shouldHideBrandName = false, nodeEnv = undefined): ReadCommercialDocumentTemplate {
35
35
  const products = _orderBy(payload.products.map((product) => productToReadProductEditing(product), 'reorder'));
36
36
  const vats = _orderBy(Object.values(_groupBy(products, 'vatFormatted')).map((v) => (vatToReadVatEditing(v)), 'value')).filter((v) => v.id !== Vat.MARGE.id);
37
37
  const thirdParty = thirdPartyToReadThirdPartyEditing(payload.thirdParty);
@@ -84,8 +84,8 @@ export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoic
84
84
  AccountingCategoryList.find((a) => a.id === payload.accountingCategory)
85
85
  ?.label ?? null,
86
86
  // @ts-ignore
87
- brandColors: getBrandConfig({ objectWaited: 'colors' }) as brandColorType,
88
- brandName: `${getBrandConfig({ objectWaited: 'name' })}`,
87
+ brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,
88
+ brandName: `${getBrandConfig({ objectWaited: 'name', nodeEnv })}`,
89
89
  shouldHideBrandName,
90
90
  };
91
91
 
@@ -121,7 +121,7 @@ export function generateCommercialDocument(idEstimateInvoiceType: EstimateInvoic
121
121
  };
122
122
  }
123
123
 
124
- export function generateAdvanceDocument(payload: CreateInvoiceDocument, shouldHideBrandName = false): ReadCommercialDocumentTemplate {
124
+ export function generateAdvanceDocument(payload: CreateInvoiceDocument, shouldHideBrandName = false, nodeEnv = undefined): ReadCommercialDocumentTemplate {
125
125
  if (!payload.deposit) throw new Error('Aucun acompte défini');
126
126
 
127
127
  const data: ReadDocumentEditing & { brandColors: brandColorType, brandName: string, shouldHideBrandName: boolean } = {
@@ -182,8 +182,8 @@ export function generateAdvanceDocument(payload: CreateInvoiceDocument, shouldHi
182
182
  AccountingCategoryList.find((a) => a.id === payload.accountingCategory)
183
183
  ?.label ?? null,
184
184
  // @ts-ignore
185
- brandColors: getBrandConfig({ objectWaited: 'colors' }) as brandColorType,
186
- brandName: `${getBrandConfig({ objectWaited: 'name' })}`,
185
+ brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,
186
+ brandName: `${getBrandConfig({ objectWaited: 'name', nodeEnv })}`,
187
187
  shouldHideBrandName,
188
188
  };
189
189
 
@@ -213,7 +213,7 @@ export function generateAdvanceDocument(payload: CreateInvoiceDocument, shouldHi
213
213
  };
214
214
  }
215
215
 
216
- export function generateMailHeader(params: CreateMailHeader, shouldHideBrandName = false): ReadCommercialMailTemplate {
216
+ export function generateMailHeader(params: CreateMailHeader, shouldHideBrandName = false, nodeEnv = undefined): ReadCommercialMailTemplate {
217
217
  dayjs.locale('fr');
218
218
  const data = {
219
219
  ...params.payload,
@@ -227,8 +227,7 @@ export function generateMailHeader(params: CreateMailHeader, shouldHideBrandName
227
227
  companyName: params.companyName,
228
228
  fileUrl: params.fileUrl,
229
229
  // @ts-ignore
230
- brandColors: getBrandConfig({ objectWaited: 'colors' }) as brandColorType,
231
- brandName: `${getBrandConfig({ objectWaited: 'name' })}`,
230
+ brandColors: getBrandConfig({ objectWaited: 'colors', nodeEnv }) as brandColorType,
232
231
  shouldHideBrandName,
233
232
  };
234
233
 
@@ -388,7 +388,7 @@ export class CommercialDocumentMailHTML {
388
388
  </div>
389
389
  </div>
390
390
  <% if (!shouldHideBrandName) { %>
391
- <div style="margin-top: 16px; width: fit-content; margin-left: auto; margin-right: auto; font-size: 14px;">
391
+ <div style="margin-top: 16px; width: fit-content; white-space: nowrap; margin-left: auto; margin-right: auto; font-size: 14px;">
392
392
  <div class="brand-tag" style="display: flex; line-height: 22px; height: 22px;">
393
393
  Généré par <% if (hostS3) { %><img src="<%= hostS3 %>config/logo-brand.png" alt="logo" style="max-height: 22px; margin-left: 8px;" /><% } %>
394
394
  </div>