@driveflux/pdf 1.6.63 → 1.6.65

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 (49) hide show
  1. package/dist/__mocks__/quotation.js +11 -10
  2. package/dist/__mocks__/subscription.d.ts +2 -0
  3. package/dist/__mocks__/subscription.d.ts.map +1 -1
  4. package/dist/__mocks__/subscription.js +148 -399
  5. package/dist/__mocks__/subscription.js.map +1 -1
  6. package/dist/__mocks__/tou.js +10 -9
  7. package/dist/components/FluxLogo.js +3 -62
  8. package/dist/components/StandardPage.js +8 -97
  9. package/dist/debug.js +30 -221
  10. package/dist/debug.js.map +1 -1
  11. package/dist/index.js +1 -0
  12. package/dist/templates/QuotationPdf/CustomerSubscriptionSection.js +27 -145
  13. package/dist/templates/QuotationPdf/GFV.js +12 -49
  14. package/dist/templates/QuotationPdf/Header.js +5 -63
  15. package/dist/templates/QuotationPdf/Pricing.js +201 -573
  16. package/dist/templates/QuotationPdf/QuotationPdfPage.js +3 -23
  17. package/dist/templates/QuotationPdf/SectionBoxNew.js +4 -34
  18. package/dist/templates/QuotationPdf/TermsSection.js +5 -42
  19. package/dist/templates/QuotationPdf/VehiclePhotos.js +24 -54
  20. package/dist/templates/QuotationPdf/index.js +11 -198
  21. package/dist/templates/QuotationPdf/translations.js +22 -34
  22. package/dist/templates/QuotationPdf/utils.js +29 -59
  23. package/dist/templates/SubscriptionAgreement/Confirmation.d.ts +2 -0
  24. package/dist/templates/SubscriptionAgreement/Confirmation.d.ts.map +1 -1
  25. package/dist/templates/SubscriptionAgreement/Confirmation.js +11 -66
  26. package/dist/templates/SubscriptionAgreement/Confirmation.js.map +1 -1
  27. package/dist/templates/SubscriptionAgreement/CoverPage.js +10 -77
  28. package/dist/templates/SubscriptionAgreement/CoverPageSection.js +5 -16
  29. package/dist/templates/SubscriptionAgreement/Details.js +43 -69
  30. package/dist/templates/SubscriptionAgreement/Footer.js +6 -48
  31. package/dist/templates/SubscriptionAgreement/Header.js +5 -35
  32. package/dist/templates/SubscriptionAgreement/LabelValue.js +3 -25
  33. package/dist/templates/SubscriptionAgreement/SubscriptionAgreementPage.js +3 -26
  34. package/dist/templates/SubscriptionAgreement/TermsOfUse.js +10 -92
  35. package/dist/templates/SubscriptionAgreement/TermsOfUseSubSection.js +9 -97
  36. package/dist/templates/SubscriptionAgreement/index.d.ts +3 -1
  37. package/dist/templates/SubscriptionAgreement/index.d.ts.map +1 -1
  38. package/dist/templates/SubscriptionAgreement/index.js +15 -250
  39. package/dist/templates/SubscriptionAgreement/index.js.map +1 -1
  40. package/dist/templates/SubscriptionAgreement/translations.js +193 -194
  41. package/dist/templates/SubscriptionAgreement/types.js +2 -1
  42. package/dist/templates/SubscriptionAgreement/utils.js +5 -3
  43. package/dist/templates/index.js +1 -0
  44. package/dist/theme/colors.js +63 -44
  45. package/dist/theme/index.js +1 -0
  46. package/dist/types.js +2 -1
  47. package/dist/utils.js +16 -166
  48. package/dist/watch.js +4 -3
  49. package/package.json +2 -2
@@ -2,45 +2,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Link, Text, View } from '@react-pdf/renderer';
3
3
  import FluxLogo from '../../components/FluxLogo.js';
4
4
  import { colors } from '../../theme/colors.js';
5
- var Header = function(param) {
6
- var tTitle = param.tTitle, userId = param.userId, subscriptionId = param.subscriptionId;
7
- return /*#__PURE__*/ _jsxs(View, {
8
- fixed: true,
9
- style: {
5
+ const Header = ({ tTitle, userId, subscriptionId }) => {
6
+ return (_jsxs(View, { fixed: true, style: {
10
7
  flexDirection: 'row',
11
8
  justifyContent: 'space-between',
12
9
  alignItems: 'center',
13
10
  paddingBottom: 40,
14
11
  // to not get pushed by the content
15
- minHeight: 69
16
- },
17
- children: [
18
- /*#__PURE__*/ _jsx(Link, {
19
- src: "https://driveflux.com",
20
- children: /*#__PURE__*/ _jsx(FluxLogo, {})
21
- }),
22
- /*#__PURE__*/ _jsxs(View, {
23
- style: {
24
- rowGap: 4,
25
- fontSize: 8,
26
- alignItems: 'flex-end'
27
- },
28
- children: [
29
- /*#__PURE__*/ _jsx(Text, {
30
- style: {
31
- fontWeight: 'bold'
32
- },
33
- children: tTitle
34
- }),
35
- /*#__PURE__*/ _jsx(Text, {
36
- style: {
37
- color: colors.primary2
38
- },
39
- children: "FLUX-".concat(userId, "-").concat(subscriptionId)
40
- })
41
- ]
42
- })
43
- ]
44
- });
12
+ minHeight: 69,
13
+ }, children: [_jsx(Link, { src: "https://driveflux.com", children: _jsx(FluxLogo, {}) }), _jsxs(View, { style: { rowGap: 4, fontSize: 8, alignItems: 'flex-end' }, children: [_jsx(Text, { style: { fontWeight: 'bold' }, children: tTitle }), _jsx(Text, { style: { color: colors.primary2 }, children: `FLUX-${userId}-${subscriptionId}` })] })] }));
45
14
  };
46
15
  export default Header;
16
+ //# sourceMappingURL=Header.js.map
@@ -1,29 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Text, View } from '@react-pdf/renderer';
3
- var LabelValue = function(param) {
4
- var label = param.label, value = param.value;
5
- return /*#__PURE__*/ _jsxs(View, {
6
- style: {
7
- flexDirection: 'row'
8
- },
9
- children: [
10
- /*#__PURE__*/ _jsx(Text, {
11
- style: {
12
- minWidth: 120,
13
- textTransform: 'capitalize'
14
- },
15
- children: label
16
- }),
17
- /*#__PURE__*/ _jsx(Text, {
18
- children: ':'
19
- }),
20
- /*#__PURE__*/ _jsx(Text, {
21
- style: {
22
- paddingLeft: 16
23
- },
24
- children: value ? "".concat(value) : '-'
25
- })
26
- ]
27
- });
3
+ const LabelValue = ({ label, value }) => {
4
+ return (_jsxs(View, { style: { flexDirection: 'row' }, children: [_jsx(Text, { style: { minWidth: 120, textTransform: 'capitalize' }, children: label }), _jsx(Text, { children: ':' }), _jsx(Text, { style: { paddingLeft: 16 }, children: value ? `${value}` : '-' })] }));
28
5
  };
29
6
  export default LabelValue;
7
+ //# sourceMappingURL=LabelValue.js.map
@@ -3,31 +3,8 @@ import { View } from '@react-pdf/renderer';
3
3
  import StandardPage from '../../components/StandardPage.js';
4
4
  import Footer from './Footer.js';
5
5
  import Header from './Header.js';
6
- var SubscriptionAgreementPage = function(param) {
7
- var t = param.t, userId = param.userId, subscriptionId = param.subscriptionId, children = param.children;
8
- return /*#__PURE__*/ _jsxs(StandardPage, {
9
- style: {
10
- padding: 40,
11
- fontSize: 10
12
- },
13
- children: [
14
- /*#__PURE__*/ _jsx(Header, {
15
- tTitle: t.title,
16
- userId: userId,
17
- subscriptionId: subscriptionId
18
- }),
19
- /*#__PURE__*/ _jsx(View, {
20
- style: {
21
- flex: 1
22
- },
23
- children: children
24
- }),
25
- /*#__PURE__*/ _jsx(Footer, {
26
- tComputerGenerated: t.computerGenerated,
27
- tPage: t.page,
28
- tOf: t.of
29
- })
30
- ]
31
- });
6
+ const SubscriptionAgreementPage = ({ t, userId, subscriptionId, children, }) => {
7
+ return (_jsxs(StandardPage, { style: { padding: 40, fontSize: 10 }, children: [_jsx(Header, { tTitle: t.title, userId: userId, subscriptionId: subscriptionId }), _jsx(View, { style: { flex: 1 }, children: children }), _jsx(Footer, { tComputerGenerated: t.computerGenerated, tPage: t.page, tOf: t.of })] }));
32
8
  };
33
9
  export default SubscriptionAgreementPage;
10
+ //# sourceMappingURL=SubscriptionAgreementPage.js.map
@@ -1,98 +1,16 @@
1
- function _array_like_to_array(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
5
- }
6
- function _array_without_holes(arr) {
7
- if (Array.isArray(arr)) return _array_like_to_array(arr);
8
- }
9
- function _iterable_to_array(iter) {
10
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
11
- }
12
- function _non_iterable_spread() {
13
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
14
- }
15
- function _to_consumable_array(arr) {
16
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
17
- }
18
- function _unsupported_iterable_to_array(o, minLen) {
19
- if (!o) return;
20
- if (typeof o === "string") return _array_like_to_array(o, minLen);
21
- var n = Object.prototype.toString.call(o).slice(8, -1);
22
- if (n === "Object" && o.constructor) n = o.constructor.name;
23
- if (n === "Map" || n === "Set") return Array.from(n);
24
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
25
- }
26
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
27
2
  import { Text, View } from '@react-pdf/renderer';
28
- var TermsOfUse = function(param) {
29
- var termsOfUse = param.termsOfUse;
30
- var getTerms = function(items) {
31
- var indices = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
32
- return items.map(function(item, i) {
33
- var _item_items;
34
- var currentIndices = _to_consumable_array(indices).concat([
35
- i + 1
36
- ]);
37
- var indicesString = currentIndices.join('.');
38
- return /*#__PURE__*/ _jsxs(View, {
39
- style: {
40
- rowGap: 16
41
- },
42
- children: [
43
- item.content && /*#__PURE__*/ _jsxs(View, {
44
- style: {
45
- flexDirection: 'row',
46
- columnGap: 16
47
- },
48
- children: [
49
- /*#__PURE__*/ _jsx(Text, {
50
- style: {
51
- fontWeight: 'bold'
52
- },
53
- children: indicesString
54
- }),
55
- /*#__PURE__*/ _jsx(Text, {
56
- style: {
57
- textAlign: 'justify',
58
- flex: 1
59
- },
60
- children: item.content
61
- })
62
- ]
63
- }),
64
- ((_item_items = item.items) === null || _item_items === void 0 ? void 0 : _item_items.length) > 0 && /*#__PURE__*/ _jsx(View, {
65
- style: {
66
- paddingLeft: 16,
67
- rowGap: 16
68
- },
69
- children: getTerms(item.items, currentIndices)
70
- })
71
- ]
72
- }, "".// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
73
- concat(indicesString, "-").concat(i));
3
+ const TermsOfUse = ({ termsOfUse }) => {
4
+ const getTerms = (items, indices = []) => {
5
+ return items.map((item, i) => {
6
+ const currentIndices = [...indices, i + 1];
7
+ const indicesString = currentIndices.join('.');
8
+ return (_jsxs(View, { style: { rowGap: 16 }, children: [item.content && (_jsxs(View, { style: { flexDirection: 'row', columnGap: 16 }, children: [_jsx(Text, { style: { fontWeight: 'bold' }, children: indicesString }), _jsx(Text, { style: { textAlign: 'justify', flex: 1 }, children: item.content })] })), item.items?.length > 0 && (_jsx(View, { style: { paddingLeft: 16, rowGap: 16 }, children: getTerms(item.items, currentIndices) }))] }, `${indicesString}-${
9
+ // biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
10
+ i}`));
74
11
  });
75
12
  };
76
- return /*#__PURE__*/ _jsxs(View, {
77
- style: {
78
- rowGap: 16
79
- },
80
- children: [
81
- /*#__PURE__*/ _jsx(Text, {
82
- style: {
83
- fontWeight: 'bold',
84
- textTransform: 'uppercase'
85
- },
86
- children: 'Terms of Use'
87
- }),
88
- /*#__PURE__*/ _jsx(View, {
89
- style: {
90
- rowGap: 16,
91
- lineHeight: 1.4
92
- },
93
- children: getTerms(termsOfUse.items)
94
- })
95
- ]
96
- });
13
+ return (_jsxs(View, { style: { rowGap: 16 }, children: [_jsx(Text, { style: { fontWeight: 'bold', textTransform: 'uppercase' }, children: 'Terms of Use' }), _jsx(View, { style: { rowGap: 16, lineHeight: 1.4 }, children: getTerms(termsOfUse.items) })] }));
97
14
  };
98
15
  export default TermsOfUse;
16
+ //# sourceMappingURL=TermsOfUse.js.map
@@ -1,102 +1,14 @@
1
- function _array_like_to_array(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
5
- }
6
- function _array_without_holes(arr) {
7
- if (Array.isArray(arr)) return _array_like_to_array(arr);
8
- }
9
- function _iterable_to_array(iter) {
10
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
11
- }
12
- function _non_iterable_spread() {
13
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
14
- }
15
- function _to_consumable_array(arr) {
16
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
17
- }
18
- function _unsupported_iterable_to_array(o, minLen) {
19
- if (!o) return;
20
- if (typeof o === "string") return _array_like_to_array(o, minLen);
21
- var n = Object.prototype.toString.call(o).slice(8, -1);
22
- if (n === "Object" && o.constructor) n = o.constructor.name;
23
- if (n === "Map" || n === "Set") return Array.from(n);
24
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
25
- }
26
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
27
2
  import { Text, View } from '@react-pdf/renderer';
28
3
  import { useMemo } from 'react';
29
- var TermsOfUseSubSection = function(param) {
30
- var indices = param.indices, subSection = param.subSection;
31
- var _useMemo = useMemo(function() {
32
- return {
33
- indicesString: indices.reduce(function(prev, curr, i) {
34
- return "".concat(prev).concat(curr).concat(i === indices.length - 1 ? '' : '.');
35
- }, ''),
36
- paddingLeft: Math.max(indices.length - 2, 0) * 16
37
- };
38
- }, [
39
- indices.length,
40
- indices.reduce
41
- ]), indicesString = _useMemo.indicesString, paddingLeft = _useMemo.paddingLeft;
42
- return typeof subSection === 'string' ? /*#__PURE__*/ _jsxs(View, {
43
- style: {
44
- flexDirection: 'row',
45
- paddingLeft: paddingLeft,
46
- columnGap: 16
47
- },
48
- children: [
49
- /*#__PURE__*/ _jsx(Text, {
50
- style: {
51
- fontWeight: 'bold'
52
- },
53
- children: indicesString
54
- }),
55
- /*#__PURE__*/ _jsx(Text, {
56
- style: {
57
- textAlign: 'justify',
58
- flex: 1
59
- },
60
- children: subSection
61
- })
62
- ]
63
- }, indicesString) : 'subSections' in subSection ? /*#__PURE__*/ _jsxs(View, {
64
- style: {
65
- gap: 16
66
- },
67
- children: [
68
- /*#__PURE__*/ _jsxs(View, {
69
- style: {
70
- flexDirection: 'row',
71
- paddingLeft: paddingLeft,
72
- columnGap: 16
73
- },
74
- children: [
75
- /*#__PURE__*/ _jsx(Text, {
76
- style: {
77
- fontWeight: 'bold'
78
- },
79
- children: indicesString
80
- }),
81
- /*#__PURE__*/ _jsx(Text, {
82
- style: {
83
- textAlign: 'justify',
84
- flex: 1
85
- },
86
- children: subSection.paragraph
87
- })
88
- ]
89
- }, indicesString),
90
- subSection.subSections.map(function(subSection, i) {
91
- return /*#__PURE__*/ _jsx(TermsOfUseSubSection, {
92
- indices: _to_consumable_array(indices).concat([
93
- i + 1
94
- ]),
95
- subSection: subSection
96
- }, "".// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
97
- concat(indices, ".").concat(i));
98
- })
99
- ]
100
- }, indicesString) : null;
4
+ const TermsOfUseSubSection = ({ indices, subSection }) => {
5
+ const { indicesString, paddingLeft } = useMemo(() => ({
6
+ indicesString: indices.reduce((prev, curr, i) => `${prev}${curr}${i === indices.length - 1 ? '' : '.'}`, ''),
7
+ paddingLeft: Math.max(indices.length - 2, 0) * 16,
8
+ }), [indices.length, indices.reduce]);
9
+ return typeof subSection === 'string' ? (_jsxs(View, { style: { flexDirection: 'row', paddingLeft, columnGap: 16 }, children: [_jsx(Text, { style: { fontWeight: 'bold' }, children: indicesString }), _jsx(Text, { style: { textAlign: 'justify', flex: 1 }, children: subSection })] }, indicesString)) : 'subSections' in subSection ? (_jsxs(View, { style: { gap: 16 }, children: [_jsxs(View, { style: { flexDirection: 'row', paddingLeft, columnGap: 16 }, children: [_jsx(Text, { style: { fontWeight: 'bold' }, children: indicesString }), _jsx(Text, { style: { textAlign: 'justify', flex: 1 }, children: subSection.paragraph })] }, indicesString), subSection.subSections.map((subSection, i) => (_jsx(TermsOfUseSubSection, { indices: [...indices, i + 1], subSection: subSection }, `${indices}.${
10
+ // biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
11
+ i}`)))] }, indicesString)) : null;
101
12
  };
102
13
  export default TermsOfUseSubSection;
14
+ //# sourceMappingURL=TermsOfUseSubSection.js.map
@@ -1,3 +1,4 @@
1
+ import type { SubscriptionSignature } from '@driveflux/db';
1
2
  import type { TermsOfUseSettings } from '@driveflux/db/types/helpers';
2
3
  import type { PdfTemplatesSupportedLocales } from '../../types.js';
3
4
  import type { SubscriptionForAgreement } from './types.js';
@@ -5,7 +6,8 @@ type Options = {
5
6
  locale?: PdfTemplatesSupportedLocales;
6
7
  subscription: SubscriptionForAgreement;
7
8
  termsOfUse: TermsOfUseSettings;
9
+ signature: SubscriptionSignature;
8
10
  };
9
- export declare const generateSubscriptionAgreementPdf: ({ locale, subscription, termsOfUse }: Options, fileName?: string) => Promise<Buffer<ArrayBufferLike>>;
11
+ export declare const generateSubscriptionAgreementPdf: ({ locale, subscription, termsOfUse, signature }: Options, fileName?: string) => Promise<Buffer<ArrayBufferLike>>;
10
12
  export {};
11
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAGrE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AAQlE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAE1D,KAAK,OAAO,GAAG;IACd,MAAM,CAAC,EAAE,4BAA4B,CAAA;IACrC,YAAY,EAAE,wBAAwB,CAAA;IACtC,UAAU,EAAE,kBAAkB,CAAA;CAC9B,CAAA;AAED,eAAO,MAAM,gCAAgC,GAC5C,sCAA6C,OAAO,EACpD,WAAW,MAAM,qCAcjB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAGrE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AAQlE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAE1D,KAAK,OAAO,GAAG;IACd,MAAM,CAAC,EAAE,4BAA4B,CAAA;IACrC,YAAY,EAAE,wBAAwB,CAAA;IACtC,UAAU,EAAE,kBAAkB,CAAA;IAC9B,SAAS,EAAE,qBAAqB,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,gCAAgC,GAC5C,iDAAwD,OAAO,EAC/D,WAAW,MAAM,qCAcjB,CAAA"}
@@ -1,179 +1,3 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
- try {
3
- var info = gen[key](arg);
4
- var value = info.value;
5
- } catch (error) {
6
- reject(error);
7
- return;
8
- }
9
- if (info.done) {
10
- resolve(value);
11
- } else {
12
- Promise.resolve(value).then(_next, _throw);
13
- }
14
- }
15
- function _async_to_generator(fn) {
16
- return function() {
17
- var self = this, args = arguments;
18
- return new Promise(function(resolve, reject) {
19
- var gen = fn.apply(self, args);
20
- function _next(value) {
21
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
- }
23
- function _throw(err) {
24
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
- }
26
- _next(undefined);
27
- });
28
- };
29
- }
30
- function _define_property(obj, key, value) {
31
- if (key in obj) {
32
- Object.defineProperty(obj, key, {
33
- value: value,
34
- enumerable: true,
35
- configurable: true,
36
- writable: true
37
- });
38
- } else {
39
- obj[key] = value;
40
- }
41
- return obj;
42
- }
43
- function _object_spread(target) {
44
- for(var i = 1; i < arguments.length; i++){
45
- var source = arguments[i] != null ? arguments[i] : {};
46
- var ownKeys = Object.keys(source);
47
- if (typeof Object.getOwnPropertySymbols === "function") {
48
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
49
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
50
- }));
51
- }
52
- ownKeys.forEach(function(key) {
53
- _define_property(target, key, source[key]);
54
- });
55
- }
56
- return target;
57
- }
58
- function ownKeys(object, enumerableOnly) {
59
- var keys = Object.keys(object);
60
- if (Object.getOwnPropertySymbols) {
61
- var symbols = Object.getOwnPropertySymbols(object);
62
- if (enumerableOnly) {
63
- symbols = symbols.filter(function(sym) {
64
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
65
- });
66
- }
67
- keys.push.apply(keys, symbols);
68
- }
69
- return keys;
70
- }
71
- function _object_spread_props(target, source) {
72
- source = source != null ? source : {};
73
- if (Object.getOwnPropertyDescriptors) {
74
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
75
- } else {
76
- ownKeys(Object(source)).forEach(function(key) {
77
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
78
- });
79
- }
80
- return target;
81
- }
82
- function _ts_generator(thisArg, body) {
83
- var f, y, t, g, _ = {
84
- label: 0,
85
- sent: function() {
86
- if (t[0] & 1) throw t[1];
87
- return t[1];
88
- },
89
- trys: [],
90
- ops: []
91
- };
92
- return g = {
93
- next: verb(0),
94
- "throw": verb(1),
95
- "return": verb(2)
96
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
97
- return this;
98
- }), g;
99
- function verb(n) {
100
- return function(v) {
101
- return step([
102
- n,
103
- v
104
- ]);
105
- };
106
- }
107
- function step(op) {
108
- if (f) throw new TypeError("Generator is already executing.");
109
- while(_)try {
110
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
111
- if (y = 0, t) op = [
112
- op[0] & 2,
113
- t.value
114
- ];
115
- switch(op[0]){
116
- case 0:
117
- case 1:
118
- t = op;
119
- break;
120
- case 4:
121
- _.label++;
122
- return {
123
- value: op[1],
124
- done: false
125
- };
126
- case 5:
127
- _.label++;
128
- y = op[1];
129
- op = [
130
- 0
131
- ];
132
- continue;
133
- case 7:
134
- op = _.ops.pop();
135
- _.trys.pop();
136
- continue;
137
- default:
138
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
139
- _ = 0;
140
- continue;
141
- }
142
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
143
- _.label = op[1];
144
- break;
145
- }
146
- if (op[0] === 6 && _.label < t[1]) {
147
- _.label = t[1];
148
- t = op;
149
- break;
150
- }
151
- if (t && _.label < t[2]) {
152
- _.label = t[2];
153
- _.ops.push(op);
154
- break;
155
- }
156
- if (t[2]) _.ops.pop();
157
- _.trys.pop();
158
- continue;
159
- }
160
- op = body.call(thisArg, _);
161
- } catch (e) {
162
- op = [
163
- 6,
164
- e
165
- ];
166
- y = 0;
167
- } finally{
168
- f = t = 0;
169
- }
170
- if (op[0] & 5) throw op[1];
171
- return {
172
- value: op[0] ? op[1] : void 0,
173
- done: true
174
- };
175
- }
176
- }
177
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
178
2
  import { Document } from '@react-pdf/renderer';
179
3
  import { useMemo } from 'react';
@@ -184,84 +8,25 @@ import Details from './Details.js';
184
8
  import SubscriptionAgreementPage from './SubscriptionAgreementPage.js';
185
9
  import TermsOfUse from './TermsOfUse.js';
186
10
  import { useTranslations } from './translations.js';
187
- export var generateSubscriptionAgreementPdf = /*#__PURE__*/ function() {
188
- var _ref = _async_to_generator(function(param, fileName) {
189
- var _param_locale, locale, subscription, termsOfUse;
190
- return _ts_generator(this, function(_state) {
191
- switch(_state.label){
192
- case 0:
193
- _param_locale = param.locale, locale = _param_locale === void 0 ? 'en' : _param_locale, subscription = param.subscription, termsOfUse = param.termsOfUse;
194
- if (!subscription.signature) {
195
- throw new Error('Signature not found');
196
- }
197
- return [
198
- 4,
199
- toPdf(/*#__PURE__*/ _jsx(SubscriptionAgreement, {
200
- locale: locale,
201
- signature: subscription.signature,
202
- subscription: subscription,
203
- termsOfUse: termsOfUse
204
- }), fileName)
205
- ];
206
- case 1:
207
- return [
208
- 2,
209
- _state.sent()
210
- ];
211
- }
212
- });
213
- });
214
- return function generateSubscriptionAgreementPdf(_, fileName) {
215
- return _ref.apply(this, arguments);
216
- };
217
- }();
218
- var SubscriptionAgreement = function(param) {
219
- var _param_locale = param.locale, locale = _param_locale === void 0 ? 'en' : _param_locale, signature = param.signature, subscription = param.subscription, termsOfUse = param.termsOfUse;
11
+ export const generateSubscriptionAgreementPdf = async ({ locale = 'en', subscription, termsOfUse, signature }, fileName) => {
12
+ if (!signature) {
13
+ throw new Error('Signature not found');
14
+ }
15
+ return await toPdf(_jsx(SubscriptionAgreement, { locale: locale, signature: signature, subscription: subscription, termsOfUse: termsOfUse }), fileName);
16
+ };
17
+ const SubscriptionAgreement = ({ locale = 'en', signature, subscription, termsOfUse, }) => {
220
18
  if (!signature.signedAt) {
221
- throw new Error("Missing 'signature.signedAt'");
19
+ throw new Error(`Missing 'signature.signedAt'`);
222
20
  }
223
- var useT = useTranslations(locale);
224
- var pageProps = useMemo(function() {
21
+ const useT = useTranslations(locale);
22
+ const pageProps = useMemo(() => {
225
23
  return {
226
24
  t: useT,
227
25
  userId: subscription.userId,
228
- subscriptionId: subscription.id
26
+ subscriptionId: subscription.id,
229
27
  };
230
- }, [
231
- subscription.userId,
232
- subscription.id,
233
- useT
234
- ]);
235
- var t = pageProps.t;
236
- return /*#__PURE__*/ _jsxs(Document, {
237
- title: t.title,
238
- language: locale,
239
- children: [
240
- /*#__PURE__*/ _jsx(SubscriptionAgreementPage, _object_spread_props(_object_spread({}, pageProps), {
241
- children: /*#__PURE__*/ _jsx(CoverPage, {
242
- tTitle: t.title,
243
- tCover: t.cover,
244
- signedAt: signature.signedAt,
245
- user: subscription.user
246
- })
247
- })),
248
- /*#__PURE__*/ _jsx(SubscriptionAgreementPage, _object_spread_props(_object_spread({}, pageProps), {
249
- children: /*#__PURE__*/ _jsx(TermsOfUse, {
250
- termsOfUse: termsOfUse
251
- })
252
- })),
253
- /*#__PURE__*/ _jsxs(SubscriptionAgreementPage, _object_spread_props(_object_spread({}, pageProps), {
254
- children: [
255
- /*#__PURE__*/ _jsx(Details, {
256
- tDetails: t.details,
257
- subscription: subscription
258
- }),
259
- /*#__PURE__*/ _jsx(Confirmation, {
260
- tConfirmation: t.confirmation,
261
- subscription: subscription
262
- })
263
- ]
264
- }))
265
- ]
266
- });
28
+ }, [subscription.userId, subscription.id, useT]);
29
+ const { t } = pageProps;
30
+ return (_jsxs(Document, { title: t.title, language: locale, children: [_jsx(SubscriptionAgreementPage, { ...pageProps, children: _jsx(CoverPage, { tTitle: t.title, tCover: t.cover, signedAt: signature.signedAt, user: subscription.user }) }), _jsx(SubscriptionAgreementPage, { ...pageProps, children: _jsx(TermsOfUse, { termsOfUse: termsOfUse }) }), _jsxs(SubscriptionAgreementPage, { ...pageProps, children: [_jsx(Details, { tDetails: t.details, subscription: subscription }), _jsx(Confirmation, { tConfirmation: t.confirmation, subscription: subscription, signature: signature })] })] }));
267
31
  };
32
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAW,OAAO,EAAE,MAAM,OAAO,CAAA;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,YAAY,MAAM,mBAAmB,CAAA;AAC5C,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,yBAAyB,MAAM,gCAAgC,CAAA;AACtE,OAAO,UAAU,MA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