@driveflux/pdf 1.6.69 → 1.6.70

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.
@@ -1,23 +1,22 @@
1
- export const mockTermsOfUse = {
1
+ export var mockTermsOfUse = {
2
2
  items: [
3
3
  {
4
4
  content: 'Terms of Use',
5
5
  items: [
6
6
  {
7
7
  content: 'These Terms of ***Use*** are NOT no yes defined and govern the relationship, rules and regulations of the interactions by FLUX and its Members.',
8
- items: [],
9
- },
10
- ],
8
+ items: []
9
+ }
10
+ ]
11
11
  },
12
12
  {
13
13
  content: 'Introduction',
14
14
  items: [
15
15
  {
16
16
  content: 'FLUX is an online business functioning as a technology provider that facilitates vehicle subscriptions.',
17
- items: [],
18
- },
19
- ],
20
- },
21
- ],
17
+ items: []
18
+ }
19
+ ]
20
+ }
21
+ ]
22
22
  };
23
- //# sourceMappingURL=tou.js.map
@@ -1,3 +1,82 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
14
+ function _object_spread(target) {
15
+ for(var i = 1; i < arguments.length; i++){
16
+ var source = arguments[i] != null ? arguments[i] : {};
17
+ var ownKeys = Object.keys(source);
18
+ if (typeof Object.getOwnPropertySymbols === "function") {
19
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
20
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
21
+ }));
22
+ }
23
+ ownKeys.forEach(function(key) {
24
+ _define_property(target, key, source[key]);
25
+ });
26
+ }
27
+ return target;
28
+ }
29
+ function ownKeys(object, enumerableOnly) {
30
+ var keys = Object.keys(object);
31
+ if (Object.getOwnPropertySymbols) {
32
+ var symbols = Object.getOwnPropertySymbols(object);
33
+ if (enumerableOnly) {
34
+ symbols = symbols.filter(function(sym) {
35
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
36
+ });
37
+ }
38
+ keys.push.apply(keys, symbols);
39
+ }
40
+ return keys;
41
+ }
42
+ function _object_spread_props(target, source) {
43
+ source = source != null ? source : {};
44
+ if (Object.getOwnPropertyDescriptors) {
45
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
46
+ } else {
47
+ ownKeys(Object(source)).forEach(function(key) {
48
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
49
+ });
50
+ }
51
+ return target;
52
+ }
53
+ function _object_without_properties(source, excluded) {
54
+ if (source == null) return {};
55
+ var target = _object_without_properties_loose(source, excluded);
56
+ var key, i;
57
+ if (Object.getOwnPropertySymbols) {
58
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
59
+ for(i = 0; i < sourceSymbolKeys.length; i++){
60
+ key = sourceSymbolKeys[i];
61
+ if (excluded.indexOf(key) >= 0) continue;
62
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
63
+ target[key] = source[key];
64
+ }
65
+ }
66
+ return target;
67
+ }
68
+ function _object_without_properties_loose(source, excluded) {
69
+ if (source == null) return {};
70
+ var target = {};
71
+ var sourceKeys = Object.keys(source);
72
+ var key, i;
73
+ for(i = 0; i < sourceKeys.length; i++){
74
+ key = sourceKeys[i];
75
+ if (excluded.indexOf(key) >= 0) continue;
76
+ target[key] = source[key];
77
+ }
78
+ return target;
79
+ }
1
80
  import { jsx as _jsx } from "react/jsx-runtime";
2
81
  import { Font, Page } from '@react-pdf/renderer';
3
82
  Font.register({
@@ -5,30 +84,40 @@ Font.register({
5
84
  fonts: [
6
85
  {
7
86
  src: 'https://fonts.gstatic.com/s/figtree/v8/_Xmz-HUzqDCFdgfMsYiV_F7wfS-Bs_d_QF5e.ttf',
8
- fontWeight: 'normal',
87
+ fontWeight: 'normal'
9
88
  },
10
89
  {
11
90
  src: 'https://fonts.gstatic.com/s/figtree/v8/_Xmz-HUzqDCFdgfMsYiV_F7wfS-Bs_eYR15e.ttf',
12
- fontWeight: 'bold',
91
+ fontWeight: 'bold'
13
92
  },
14
93
  {
15
94
  src: 'https://fonts.gstatic.com/s/figtree/v8/_Xm9-HUzqDCFdgfMm4GnA4aZFrUvtOK3A7YdyEU.ttf',
16
95
  fontWeight: 'normal',
17
- fontStyle: 'italic',
96
+ fontStyle: 'italic'
18
97
  },
19
98
  {
20
99
  src: 'https://fonts.gstatic.com/s/figtree/v8/_Xm9-HUzqDCFdgfMm4GnA4aZFrUvtOK3A1EayEU.ttf',
21
100
  fontWeight: 'bold',
22
- fontStyle: 'italic',
23
- },
24
- ],
101
+ fontStyle: 'italic'
102
+ }
103
+ ]
25
104
  });
26
105
  Font.register({
27
106
  family: 'Allura',
28
- src: 'https://fonts.gstatic.com/s/allura/v21/9oRPNYsQpS4zjuAPjAIXPtrrGA.ttf',
107
+ src: 'https://fonts.gstatic.com/s/allura/v21/9oRPNYsQpS4zjuAPjAIXPtrrGA.ttf'
29
108
  });
30
- const StandardDocument = ({ children, style, ...props }) => {
31
- return (_jsx(Page, { style: { fontFamily: 'Figtree', fontStyle: 'normal', ...style }, ...props, children: children }));
109
+ var StandardDocument = function(_param) {
110
+ var children = _param.children, style = _param.style, props = _object_without_properties(_param, [
111
+ "children",
112
+ "style"
113
+ ]);
114
+ return /*#__PURE__*/ _jsx(Page, _object_spread_props(_object_spread({
115
+ style: _object_spread({
116
+ fontFamily: 'Figtree',
117
+ fontStyle: 'normal'
118
+ }, style)
119
+ }, props), {
120
+ children: children
121
+ }));
32
122
  };
33
123
  export default StandardDocument;
34
- //# sourceMappingURL=StandardPage.js.map
@@ -1,15 +1,101 @@
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
+ }
1
26
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
27
  import { Text, View } from '@react-pdf/renderer';
3
28
  import { renderMarkdown } from './utils.js';
4
- const TermsOfUse = ({ termsOfUse }) => {
5
- const getTerms = (items, indices = []) => {
6
- return items.map((item, i) => {
7
- const currentIndices = [...indices, i + 1];
8
- const indicesString = currentIndices.join('.');
9
- return (_jsxs(View, { style: { rowGap: 16 }, children: [item.content && (_jsxs(View, { style: { flexDirection: 'row', columnGap: 16 }, children: [_jsx(Text, { style: { fontWeight: 'bold' }, children: indicesString }), _jsxs(Text, { style: { textAlign: 'justify', flex: 1 }, children: [renderMarkdown(item.content), ' '] })] })), item.items?.length > 0 && (_jsx(View, { style: { paddingLeft: 16, rowGap: 16 }, children: getTerms(item.items, currentIndices) }))] }, indicesString));
29
+ var TermsOfUse = function(param) {
30
+ var termsOfUse = param.termsOfUse;
31
+ var getTerms = function(items) {
32
+ var indices = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
33
+ return items.map(function(item, i) {
34
+ var _item_items;
35
+ var currentIndices = _to_consumable_array(indices).concat([
36
+ i + 1
37
+ ]);
38
+ var indicesString = currentIndices.join('.');
39
+ return /*#__PURE__*/ _jsxs(View, {
40
+ style: {
41
+ rowGap: 16
42
+ },
43
+ children: [
44
+ item.content && /*#__PURE__*/ _jsxs(View, {
45
+ style: {
46
+ flexDirection: 'row',
47
+ columnGap: 16
48
+ },
49
+ children: [
50
+ /*#__PURE__*/ _jsx(Text, {
51
+ style: {
52
+ fontWeight: 'bold'
53
+ },
54
+ children: indicesString
55
+ }),
56
+ /*#__PURE__*/ _jsxs(Text, {
57
+ style: {
58
+ textAlign: 'justify',
59
+ flex: 1
60
+ },
61
+ children: [
62
+ renderMarkdown(item.content),
63
+ ' '
64
+ ]
65
+ })
66
+ ]
67
+ }),
68
+ ((_item_items = item.items) === null || _item_items === void 0 ? void 0 : _item_items.length) > 0 && /*#__PURE__*/ _jsx(View, {
69
+ style: {
70
+ paddingLeft: 16,
71
+ rowGap: 16
72
+ },
73
+ children: getTerms(item.items, currentIndices)
74
+ })
75
+ ]
76
+ }, indicesString);
10
77
  });
11
78
  };
12
- 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) })] }));
79
+ return /*#__PURE__*/ _jsxs(View, {
80
+ style: {
81
+ rowGap: 16
82
+ },
83
+ children: [
84
+ /*#__PURE__*/ _jsx(Text, {
85
+ style: {
86
+ fontWeight: 'bold',
87
+ textTransform: 'uppercase'
88
+ },
89
+ children: 'Terms of Use'
90
+ }),
91
+ /*#__PURE__*/ _jsx(View, {
92
+ style: {
93
+ rowGap: 16,
94
+ lineHeight: 1.4
95
+ },
96
+ children: getTerms(termsOfUse.items)
97
+ })
98
+ ]
99
+ });
13
100
  };
14
101
  export default TermsOfUse;
15
- //# sourceMappingURL=TermsOfUse.js.map
@@ -1,17 +1,103 @@
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
+ }
1
26
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
27
  import { Text, View } from '@react-pdf/renderer';
3
28
  import { useMemo } from 'react';
4
29
  import { renderMarkdown } from './utils.js';
5
- const TermsOfUseSubSection = ({ indices, subSection }) => {
6
- const { indicesString, paddingLeft } = useMemo(() => ({
7
- indicesString: indices.reduce((prev, curr, i) => `${prev}${curr}${i === indices.length - 1 ? '' : '.'}`, ''),
8
- paddingLeft: Math.max(indices.length - 2, 0) * 16,
9
- }), [indices.length, indices.reduce]);
10
- 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: typeof subSection === 'string'
11
- ? renderMarkdown(subSection)
12
- : renderMarkdown(subSection.paragraph) })] }, indicesString), subSection.subSections.map((subSection, i) => (_jsx(TermsOfUseSubSection, { indices: [...indices, i + 1], subSection: subSection }, `${indices}.${
13
- // biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
14
- i}`)))] }, indicesString)) : null;
30
+ var TermsOfUseSubSection = function(param) {
31
+ var indices = param.indices, subSection = param.subSection;
32
+ var _useMemo = useMemo(function() {
33
+ return {
34
+ indicesString: indices.reduce(function(prev, curr, i) {
35
+ return "".concat(prev).concat(curr).concat(i === indices.length - 1 ? '' : '.');
36
+ }, ''),
37
+ paddingLeft: Math.max(indices.length - 2, 0) * 16
38
+ };
39
+ }, [
40
+ indices.length,
41
+ indices.reduce
42
+ ]), indicesString = _useMemo.indicesString, paddingLeft = _useMemo.paddingLeft;
43
+ return typeof subSection === 'string' ? /*#__PURE__*/ _jsxs(View, {
44
+ style: {
45
+ flexDirection: 'row',
46
+ paddingLeft: paddingLeft,
47
+ columnGap: 16
48
+ },
49
+ children: [
50
+ /*#__PURE__*/ _jsx(Text, {
51
+ style: {
52
+ fontWeight: 'bold'
53
+ },
54
+ children: indicesString
55
+ }),
56
+ /*#__PURE__*/ _jsx(Text, {
57
+ style: {
58
+ textAlign: 'justify',
59
+ flex: 1
60
+ },
61
+ children: subSection
62
+ })
63
+ ]
64
+ }, indicesString) : 'subSections' in subSection ? /*#__PURE__*/ _jsxs(View, {
65
+ style: {
66
+ gap: 16
67
+ },
68
+ children: [
69
+ /*#__PURE__*/ _jsxs(View, {
70
+ style: {
71
+ flexDirection: 'row',
72
+ paddingLeft: paddingLeft,
73
+ columnGap: 16
74
+ },
75
+ children: [
76
+ /*#__PURE__*/ _jsx(Text, {
77
+ style: {
78
+ fontWeight: 'bold'
79
+ },
80
+ children: indicesString
81
+ }),
82
+ /*#__PURE__*/ _jsx(Text, {
83
+ style: {
84
+ textAlign: 'justify',
85
+ flex: 1
86
+ },
87
+ children: typeof subSection === 'string' ? renderMarkdown(subSection) : renderMarkdown(subSection.paragraph)
88
+ })
89
+ ]
90
+ }, indicesString),
91
+ subSection.subSections.map(function(subSection, i) {
92
+ return /*#__PURE__*/ _jsx(TermsOfUseSubSection, {
93
+ indices: _to_consumable_array(indices).concat([
94
+ i + 1
95
+ ]),
96
+ subSection: subSection
97
+ }, "".// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
98
+ concat(indices, ".").concat(i));
99
+ })
100
+ ]
101
+ }, indicesString) : null;
15
102
  };
16
103
  export default TermsOfUseSubSection;
17
- //# sourceMappingURL=TermsOfUseSubSection.js.map
@@ -1,32 +1,37 @@
1
1
  import { Text } from '@react-pdf/renderer';
2
2
  import React from 'react';
3
- export const formatIdentification = (identification) => {
4
- return identification?.type === 'id'
5
- ? `${identification?.number?.slice(0, 6)}-${identification?.number?.slice(6, 8)}-${identification?.number?.slice(8)}`
6
- : identification?.number || '-';
3
+ export var formatIdentification = function(identification) {
4
+ var _identification_number, _identification_number1, _identification_number2;
5
+ return (identification === null || identification === void 0 ? void 0 : identification.type) === 'id' ? "".concat(identification === null || identification === void 0 ? void 0 : (_identification_number = identification.number) === null || _identification_number === void 0 ? void 0 : _identification_number.slice(0, 6), "-").concat(identification === null || identification === void 0 ? void 0 : (_identification_number1 = identification.number) === null || _identification_number1 === void 0 ? void 0 : _identification_number1.slice(6, 8), "-").concat(identification === null || identification === void 0 ? void 0 : (_identification_number2 = identification.number) === null || _identification_number2 === void 0 ? void 0 : _identification_number2.slice(8)) : (identification === null || identification === void 0 ? void 0 : identification.number) || '-';
7
6
  };
8
- export const renderMarkdown = (text) => {
9
- const parts = text.split(/(\*\*\*.*?\*\*\*|\*\*.*?\*\*|\*.*?\*)/g);
10
- return parts.map((part, index) => {
7
+ export var renderMarkdown = function(text) {
8
+ var parts = text.split(/(\*\*\*.*?\*\*\*|\*\*.*?\*\*|\*.*?\*)/g);
9
+ return parts.map(function(part, index) {
11
10
  if (part.startsWith('***') && part.endsWith('***')) {
12
11
  return React.createElement(Text, {
13
12
  key: index,
14
- style: { fontWeight: 'bold', fontStyle: 'italic' },
13
+ style: {
14
+ fontWeight: 'bold',
15
+ fontStyle: 'italic'
16
+ }
15
17
  }, part.slice(3, -3));
16
18
  }
17
19
  if (part.startsWith('**') && part.endsWith('**')) {
18
20
  return React.createElement(Text, {
19
21
  key: index,
20
- style: { fontWeight: 'bold' },
22
+ style: {
23
+ fontWeight: 'bold'
24
+ }
21
25
  }, part.slice(2, -2));
22
26
  }
23
27
  if (part.startsWith('*') && part.endsWith('*')) {
24
28
  return React.createElement(Text, {
25
29
  key: index,
26
- style: { fontStyle: 'italic' },
30
+ style: {
31
+ fontStyle: 'italic'
32
+ }
27
33
  }, part.slice(1, -1));
28
34
  }
29
35
  return part;
30
36
  });
31
37
  };
32
- //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@driveflux/pdf",
3
- "version": "1.6.69",
3
+ "version": "1.6.70",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -12,7 +12,7 @@
12
12
  "dist"
13
13
  ],
14
14
  "dependencies": {
15
- "@driveflux/db": "2.2.52",
15
+ "@driveflux/db": "2.2.53",
16
16
  "@driveflux/env": "1.5.0",
17
17
  "@driveflux/format-money": "5.4.1",
18
18
  "@driveflux/time": "4.4.1",