@driveflux/pdf 1.0.15 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/__mocks__/quotation.d.ts +1 -1
  2. package/dist/__mocks__/quotation.d.ts.map +1 -1
  3. package/dist/__mocks__/quotation.js +1 -2
  4. package/dist/__mocks__/subscription.d.ts +1 -1
  5. package/dist/__mocks__/subscription.d.ts.map +1 -1
  6. package/dist/templates/QuotationPdf/CustomerSubscriptionSection.d.ts.map +1 -1
  7. package/dist/templates/QuotationPdf/CustomerSubscriptionSection.js +2 -10
  8. package/dist/templates/QuotationPdf/index.d.ts +1 -1
  9. package/dist/templates/QuotationPdf/index.d.ts.map +1 -1
  10. package/dist/templates/QuotationPdf/translations.d.ts +0 -1
  11. package/dist/templates/QuotationPdf/translations.d.ts.map +1 -1
  12. package/dist/templates/QuotationPdf/translations.js +1 -4
  13. package/dist/templates/QuotationPdf/utils.d.ts +3 -4
  14. package/dist/templates/QuotationPdf/utils.d.ts.map +1 -1
  15. package/dist/templates/QuotationPdf/utils.js +0 -14
  16. package/dist/templates/SubscriptionAgreement/index.d.ts +1 -1
  17. package/dist/templates/SubscriptionAgreement/index.d.ts.map +1 -1
  18. package/dist/templates/SubscriptionAgreement/translations.d.ts.map +1 -1
  19. package/dist/templates/SubscriptionAgreement/utils.d.ts +1 -1
  20. package/dist/templates/SubscriptionAgreement/utils.d.ts.map +1 -1
  21. package/dist/theme/colors.d.ts.map +1 -1
  22. package/dist/theme/colors.js +36 -36
  23. package/dist/utils.d.ts +2 -8
  24. package/dist/utils.d.ts.map +1 -1
  25. package/dist/utils.js +7 -31
  26. package/package.json +23 -20
  27. package/.eslintrc +0 -3
  28. package/.swcrc +0 -14
  29. package/.turbo/turbo-build.log +0 -6
  30. package/CHANGELOG.md +0 -186
  31. package/dist/cjs/__mocks__/quotation.js +0 -70
  32. package/dist/cjs/__mocks__/subscription.js +0 -1079
  33. package/dist/cjs/components/FluxLogo.js +0 -76
  34. package/dist/cjs/components/StandardPage.js +0 -129
  35. package/dist/cjs/debug.js +0 -234
  36. package/dist/cjs/index.js +0 -20
  37. package/dist/cjs/templates/QuotationPdf/CustomerSubscriptionSection.js +0 -155
  38. package/dist/cjs/templates/QuotationPdf/GFV.js +0 -57
  39. package/dist/cjs/templates/QuotationPdf/Header.js +0 -86
  40. package/dist/cjs/templates/QuotationPdf/Pricing.js +0 -430
  41. package/dist/cjs/templates/QuotationPdf/QuotationPdfPage.js +0 -45
  42. package/dist/cjs/templates/QuotationPdf/SectionBoxNew.js +0 -43
  43. package/dist/cjs/templates/QuotationPdf/TermsSection.js +0 -60
  44. package/dist/cjs/templates/QuotationPdf/index.js +0 -208
  45. package/dist/cjs/templates/QuotationPdf/translations.js +0 -106
  46. package/dist/cjs/templates/QuotationPdf/utils.js +0 -108
  47. package/dist/cjs/templates/SubscriptionAgreement/Confirmation.js +0 -95
  48. package/dist/cjs/templates/SubscriptionAgreement/CoverPage.js +0 -110
  49. package/dist/cjs/templates/SubscriptionAgreement/CoverPageSection.js +0 -35
  50. package/dist/cjs/templates/SubscriptionAgreement/Details.js +0 -161
  51. package/dist/cjs/templates/SubscriptionAgreement/Footer.js +0 -68
  52. package/dist/cjs/templates/SubscriptionAgreement/Header.js +0 -61
  53. package/dist/cjs/templates/SubscriptionAgreement/LabelValue.js +0 -39
  54. package/dist/cjs/templates/SubscriptionAgreement/SubscriptionAgreementPage.js +0 -48
  55. package/dist/cjs/templates/SubscriptionAgreement/TermsOfUse.js +0 -72
  56. package/dist/cjs/templates/SubscriptionAgreement/TermsOfUseSubSection.js +0 -108
  57. package/dist/cjs/templates/SubscriptionAgreement/index.js +0 -276
  58. package/dist/cjs/templates/SubscriptionAgreement/translations.js +0 -666
  59. package/dist/cjs/templates/SubscriptionAgreement/utils.js +0 -14
  60. package/dist/cjs/templates/index.js +0 -19
  61. package/dist/cjs/theme/colors.js +0 -147
  62. package/dist/cjs/theme/index.js +0 -18
  63. package/dist/cjs/types.js +0 -4
  64. package/dist/cjs/utils.js +0 -184
  65. package/dist/cjs/watch.js +0 -20
  66. package/index.cjs +0 -1
  67. package/index.d.ts +0 -1
  68. package/src/__mocks__/quotation.ts +0 -63
  69. package/src/__mocks__/subscription.ts +0 -803
  70. package/src/components/FluxLogo.tsx +0 -52
  71. package/src/components/StandardPage.tsx +0 -32
  72. package/src/debug.ts +0 -45
  73. package/src/index.ts +0 -3
  74. package/src/templates/QuotationPdf/CustomerSubscriptionSection.tsx +0 -73
  75. package/src/templates/QuotationPdf/GFV.tsx +0 -29
  76. package/src/templates/QuotationPdf/Header.tsx +0 -31
  77. package/src/templates/QuotationPdf/Pricing.tsx +0 -214
  78. package/src/templates/QuotationPdf/QuotationPdfPage.tsx +0 -25
  79. package/src/templates/QuotationPdf/SectionBoxNew.tsx +0 -20
  80. package/src/templates/QuotationPdf/TermsSection.tsx +0 -28
  81. package/src/templates/QuotationPdf/index.tsx +0 -46
  82. package/src/templates/QuotationPdf/translations.ts +0 -84
  83. package/src/templates/QuotationPdf/utils.ts +0 -59
  84. package/src/templates/SubscriptionAgreement/Confirmation.tsx +0 -49
  85. package/src/templates/SubscriptionAgreement/CoverPage.tsx +0 -52
  86. package/src/templates/SubscriptionAgreement/CoverPageSection.tsx +0 -25
  87. package/src/templates/SubscriptionAgreement/Details.tsx +0 -127
  88. package/src/templates/SubscriptionAgreement/Footer.tsx +0 -37
  89. package/src/templates/SubscriptionAgreement/Header.tsx +0 -37
  90. package/src/templates/SubscriptionAgreement/LabelValue.tsx +0 -19
  91. package/src/templates/SubscriptionAgreement/SubscriptionAgreementPage.tsx +0 -24
  92. package/src/templates/SubscriptionAgreement/TermsOfUse.tsx +0 -30
  93. package/src/templates/SubscriptionAgreement/TermsOfUseSubSection.tsx +0 -44
  94. package/src/templates/SubscriptionAgreement/index.tsx +0 -66
  95. package/src/templates/SubscriptionAgreement/translations.ts +0 -664
  96. package/src/templates/SubscriptionAgreement/utils.ts +0 -7
  97. package/src/templates/index.ts +0 -2
  98. package/src/theme/colors.ts +0 -180
  99. package/src/theme/index.ts +0 -1
  100. package/src/types.ts +0 -1
  101. package/src/utils.ts +0 -27
  102. package/src/watch.ts +0 -16
  103. package/tsconfig.json +0 -13
  104. package/tsconfig.tsbuildinfo +0 -1
@@ -1,161 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- var _jsxruntime = require("react/jsx-runtime");
12
- var _user = require("@driveflux/db/models/user");
13
- var _time = require("@driveflux/time");
14
- var _renderer = require("@react-pdf/renderer");
15
- var _react = require("react");
16
- var _index = require("../../theme/index.js");
17
- var _LabelValue = /*#__PURE__*/ _interop_require_default(require("./LabelValue.js"));
18
- function _interop_require_default(obj) {
19
- return obj && obj.__esModule ? obj : {
20
- default: obj
21
- };
22
- }
23
- var Details = function(param) {
24
- var tDetails = param.tDetails, subscription = param.subscription;
25
- var details = (0, _react.useMemo)(function() {
26
- var _subscription_user_identification, _subscription_vehicle, _subscription_vehicle1, _subscription_vehicle2, _subscription_vehicle3, _subscription_schedule, _subscription_schedule1;
27
- return {
28
- member: [
29
- {
30
- key: tDetails.member.name,
31
- value: (0, _user.userName)(subscription.user)
32
- },
33
- {
34
- key: tDetails.member.idOrPassportNo,
35
- value: (_subscription_user_identification = subscription.user.identification) === null || _subscription_user_identification === void 0 ? void 0 : _subscription_user_identification.number
36
- }
37
- ],
38
- vehicle: [
39
- {
40
- key: tDetails.vehicle.make,
41
- value: (_subscription_vehicle = subscription.vehicle) === null || _subscription_vehicle === void 0 ? void 0 : _subscription_vehicle.make
42
- },
43
- {
44
- key: tDetails.vehicle.model,
45
- value: (_subscription_vehicle1 = subscription.vehicle) === null || _subscription_vehicle1 === void 0 ? void 0 : _subscription_vehicle1.vehicleModel
46
- },
47
- {
48
- key: tDetails.vehicle.year,
49
- value: (_subscription_vehicle2 = subscription.vehicle) === null || _subscription_vehicle2 === void 0 ? void 0 : _subscription_vehicle2.year
50
- },
51
- {
52
- key: tDetails.vehicle.plateNo,
53
- value: (_subscription_vehicle3 = subscription.vehicle) === null || _subscription_vehicle3 === void 0 ? void 0 : _subscription_vehicle3.registrationNumber
54
- }
55
- ],
56
- subscription: [
57
- {
58
- key: tDetails.subscription.subscriptionPlan,
59
- value: getPlanTranslation(subscription.plan)
60
- },
61
- {
62
- key: tDetails.subscription.mileagePackage,
63
- value: getFullMileagePackageTranslation(subscription.mileagePackage)
64
- },
65
- {
66
- key: tDetails.subscription.startDate,
67
- value: subscription.startedAt ? (0, _time.format)(subscription.startedAt, 'dd-MM-yyyy') : undefined
68
- },
69
- {
70
- key: tDetails.subscription.endDate,
71
- value: subscription.endedAt ? (0, _time.format)(subscription.endedAt, 'dd-MM-yyyy') : ((_subscription_schedule = subscription.schedule) === null || _subscription_schedule === void 0 ? void 0 : _subscription_schedule.endAt) ? (0, _time.format)((_subscription_schedule1 = subscription.schedule) === null || _subscription_schedule1 === void 0 ? void 0 : _subscription_schedule1.endAt, 'dd-MM-yyyy') : undefined
72
- }
73
- ]
74
- };
75
- }, []);
76
- var border = "1px solid ".concat(_index.colors.primary2);
77
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_renderer.View, {
78
- style: {
79
- borderLeft: border,
80
- borderRight: border
81
- },
82
- children: [
83
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.View, {
84
- style: {
85
- backgroundColor: _index.colors.primary1,
86
- borderTop: border,
87
- padding: 8
88
- },
89
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
90
- style: {
91
- fontWeight: 'bold',
92
- textTransform: 'uppercase',
93
- letterSpacing: 1
94
- },
95
- children: tDetails.agreement
96
- })
97
- }),
98
- Object.keys(details).map(function(key, i) {
99
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_renderer.View, {
100
- style: {
101
- padding: 8,
102
- paddingBottom: 16,
103
- rowGap: 8,
104
- borderTop: border
105
- },
106
- children: [
107
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
108
- style: {
109
- textTransform: 'uppercase',
110
- color: _index.colors.primary2,
111
- fontSize: 8,
112
- letterSpacing: 1
113
- },
114
- children: "".concat(key, " details")
115
- }),
116
- details[key].map(function(line) {
117
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_LabelValue.default, {
118
- label: line.key,
119
- value: line.value
120
- }, line.key);
121
- })
122
- ]
123
- }, key);
124
- })
125
- ]
126
- });
127
- };
128
- var _default = Details;
129
- // TODO: replace this with dump's once the package is ready
130
- var getPlanTranslation = function(plan, vehicleType) {
131
- switch(plan){
132
- case 'plan60':
133
- return vehicleType === 'motorcycle' ? '60 Months' : '60 Months (Basic)';
134
- case 'plan36':
135
- return '36 Months';
136
- case 'plan24':
137
- return '24 Months';
138
- case 'plan12':
139
- return '12 Months';
140
- case 'plan1':
141
- return 'Monthly (Ultra)';
142
- case 'planWeekly':
143
- return 'Weekly';
144
- default:
145
- return 'Unknown Plan';
146
- }
147
- };
148
- var getFullMileagePackageTranslation = function(plan) {
149
- switch(plan){
150
- case 'lite':
151
- return 'Lite - 1,250KM';
152
- case 'standard':
153
- return 'Standard - 2,000KM';
154
- case 'plus':
155
- return 'Plus - 2,750KM';
156
- case 'unlimited':
157
- return 'Unlimited';
158
- default:
159
- return 'Unknown Mileage Package';
160
- }
161
- };
@@ -1,68 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- var _jsxruntime = require("react/jsx-runtime");
12
- var _renderer = require("@react-pdf/renderer");
13
- var _colors = require("../../theme/colors.js");
14
- var Footer = function(param) {
15
- var tComputerGenerated = param.tComputerGenerated, tPage = param.tPage, tOf = param.tOf;
16
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_renderer.View, {
17
- fixed: true,
18
- style: {
19
- justifyContent: 'space-between',
20
- flexDirection: 'row',
21
- paddingTop: 16,
22
- marginTop: 16,
23
- borderTop: "1px solid ".concat(_colors.colors.links),
24
- color: _colors.colors.primary2,
25
- fontSize: 8
26
- },
27
- children: [
28
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
29
- children: tComputerGenerated
30
- }),
31
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_renderer.View, {
32
- style: {
33
- flexDirection: 'row',
34
- columnGap: 4
35
- },
36
- children: [
37
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
38
- children: tPage
39
- }),
40
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
41
- style: {
42
- fontWeight: 'bold',
43
- color: _colors.colors.black
44
- },
45
- render: function(param) {
46
- var pageNumber = param.pageNumber;
47
- return "".concat(pageNumber);
48
- }
49
- }),
50
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
51
- children: tOf
52
- }),
53
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
54
- style: {
55
- fontWeight: 'bold',
56
- color: _colors.colors.black
57
- },
58
- render: function(param) {
59
- var totalPages = param.totalPages;
60
- return "".concat(totalPages);
61
- }
62
- })
63
- ]
64
- })
65
- ]
66
- });
67
- };
68
- var _default = Footer;
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- var _jsxruntime = require("react/jsx-runtime");
12
- var _renderer = require("@react-pdf/renderer");
13
- var _FluxLogo = /*#__PURE__*/ _interop_require_default(require("../../components/FluxLogo.js"));
14
- var _colors = require("../../theme/colors.js");
15
- function _interop_require_default(obj) {
16
- return obj && obj.__esModule ? obj : {
17
- default: obj
18
- };
19
- }
20
- var Header = function(param) {
21
- var tTitle = param.tTitle, userId = param.userId, subscriptionId = param.subscriptionId;
22
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_renderer.View, {
23
- fixed: true,
24
- style: {
25
- flexDirection: 'row',
26
- justifyContent: 'space-between',
27
- alignItems: 'center',
28
- paddingBottom: 40,
29
- // to not get pushed by the content
30
- minHeight: 69
31
- },
32
- children: [
33
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Link, {
34
- src: "https://driveflux.com",
35
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_FluxLogo.default, {})
36
- }),
37
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_renderer.View, {
38
- style: {
39
- rowGap: 4,
40
- fontSize: 8,
41
- alignItems: 'flex-end'
42
- },
43
- children: [
44
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
45
- style: {
46
- fontWeight: 'bold'
47
- },
48
- children: tTitle
49
- }),
50
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
51
- style: {
52
- color: _colors.colors.primary2
53
- },
54
- children: "FLUX-".concat(userId, "-").concat(subscriptionId)
55
- })
56
- ]
57
- })
58
- ]
59
- });
60
- };
61
- var _default = Header;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- var _jsxruntime = require("react/jsx-runtime");
12
- var _renderer = require("@react-pdf/renderer");
13
- var LabelValue = function(param) {
14
- var label = param.label, value = param.value;
15
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_renderer.View, {
16
- style: {
17
- flexDirection: 'row'
18
- },
19
- children: [
20
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
21
- style: {
22
- minWidth: 120,
23
- textTransform: 'capitalize'
24
- },
25
- children: label
26
- }),
27
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
28
- children: ":"
29
- }),
30
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
31
- style: {
32
- paddingLeft: 16
33
- },
34
- children: !!value ? "".concat(value) : '-'
35
- })
36
- ]
37
- });
38
- };
39
- var _default = LabelValue;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- var _jsxruntime = require("react/jsx-runtime");
12
- var _renderer = require("@react-pdf/renderer");
13
- var _StandardPage = /*#__PURE__*/ _interop_require_default(require("../../components/StandardPage.js"));
14
- var _Footer = /*#__PURE__*/ _interop_require_default(require("./Footer.js"));
15
- var _Header = /*#__PURE__*/ _interop_require_default(require("./Header.js"));
16
- function _interop_require_default(obj) {
17
- return obj && obj.__esModule ? obj : {
18
- default: obj
19
- };
20
- }
21
- var SubscriptionAgreementPage = function(param) {
22
- var t = param.t, userId = param.userId, subscriptionId = param.subscriptionId, children = param.children;
23
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_StandardPage.default, {
24
- style: {
25
- padding: 40,
26
- fontSize: 10
27
- },
28
- children: [
29
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_Header.default, {
30
- tTitle: t.title,
31
- userId: userId,
32
- subscriptionId: subscriptionId
33
- }),
34
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.View, {
35
- style: {
36
- flex: 1
37
- },
38
- children: children
39
- }),
40
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_Footer.default, {
41
- tComputerGenerated: t.computerGenerated,
42
- tPage: t.page,
43
- tOf: t.of
44
- })
45
- ]
46
- });
47
- };
48
- var _default = SubscriptionAgreementPage;
@@ -1,72 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- var _jsxruntime = require("react/jsx-runtime");
12
- var _renderer = require("@react-pdf/renderer");
13
- var _TermsOfUseSubSection = /*#__PURE__*/ _interop_require_default(require("./TermsOfUseSubSection.js"));
14
- function _interop_require_default(obj) {
15
- return obj && obj.__esModule ? obj : {
16
- default: obj
17
- };
18
- }
19
- var TermsOfUse = function(param) {
20
- var t = param.t;
21
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_renderer.View, {
22
- style: {
23
- rowGap: 16
24
- },
25
- children: [
26
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
27
- style: {
28
- fontWeight: 'bold',
29
- textTransform: 'uppercase'
30
- },
31
- children: t.title
32
- }),
33
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.View, {
34
- style: {
35
- rowGap: 16,
36
- lineHeight: 1.4
37
- },
38
- children: t.content.map(function(section, i) {
39
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_renderer.View, {
40
- style: {
41
- rowGap: 16
42
- },
43
- children: [
44
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
45
- style: {
46
- fontWeight: 'bold'
47
- },
48
- children: "".concat(i + 1, " ").concat(section.title)
49
- }),
50
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.View, {
51
- style: {
52
- rowGap: 16,
53
- paddingLeft: 16
54
- },
55
- children: section.subSections.map(function(subSection, j) {
56
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TermsOfUseSubSection.default, {
57
- indices: [
58
- i + 1,
59
- j + 1
60
- ],
61
- subSection: subSection
62
- }, "".concat(i + 1, ".").concat(j));
63
- })
64
- })
65
- ]
66
- }, section.title);
67
- })
68
- })
69
- ]
70
- });
71
- };
72
- var _default = TermsOfUse;
@@ -1,108 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return _default;
9
- }
10
- });
11
- var _jsxruntime = require("react/jsx-runtime");
12
- var _renderer = require("@react-pdf/renderer");
13
- var _react = require("react");
14
- function _array_like_to_array(arr, len) {
15
- if (len == null || len > arr.length) len = arr.length;
16
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
17
- return arr2;
18
- }
19
- function _array_without_holes(arr) {
20
- if (Array.isArray(arr)) return _array_like_to_array(arr);
21
- }
22
- function _iterable_to_array(iter) {
23
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
24
- }
25
- function _non_iterable_spread() {
26
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
27
- }
28
- function _to_consumable_array(arr) {
29
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
30
- }
31
- function _unsupported_iterable_to_array(o, minLen) {
32
- if (!o) return;
33
- if (typeof o === "string") return _array_like_to_array(o, minLen);
34
- var n = Object.prototype.toString.call(o).slice(8, -1);
35
- if (n === "Object" && o.constructor) n = o.constructor.name;
36
- if (n === "Map" || n === "Set") return Array.from(n);
37
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
38
- }
39
- var TermsOfUseSubSection = function(param) {
40
- var indices = param.indices, subSection = param.subSection;
41
- var _useMemo = (0, _react.useMemo)(function() {
42
- return {
43
- indicesString: indices.reduce(function(prev, curr, i) {
44
- return "".concat(prev).concat(curr).concat(i === indices.length - 1 ? '' : '.');
45
- }, ''),
46
- paddingLeft: Math.max(indices.length - 2, 0) * 16
47
- };
48
- }, []), indicesString = _useMemo.indicesString, paddingLeft = _useMemo.paddingLeft;
49
- return typeof subSection === 'string' ? /*#__PURE__*/ (0, _jsxruntime.jsxs)(_renderer.View, {
50
- style: {
51
- flexDirection: 'row',
52
- paddingLeft: paddingLeft,
53
- columnGap: 16
54
- },
55
- children: [
56
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
57
- style: {
58
- fontWeight: 'bold'
59
- },
60
- children: indicesString
61
- }),
62
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
63
- style: {
64
- textAlign: 'justify',
65
- flex: 1
66
- },
67
- children: subSection
68
- })
69
- ]
70
- }, indicesString) : 'subSections' in subSection ? /*#__PURE__*/ (0, _jsxruntime.jsxs)(_renderer.View, {
71
- style: {
72
- gap: 16
73
- },
74
- children: [
75
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_renderer.View, {
76
- style: {
77
- flexDirection: 'row',
78
- paddingLeft: paddingLeft,
79
- columnGap: 16
80
- },
81
- children: [
82
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
83
- style: {
84
- fontWeight: 'bold'
85
- },
86
- children: indicesString
87
- }),
88
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Text, {
89
- style: {
90
- textAlign: 'justify',
91
- flex: 1
92
- },
93
- children: subSection.paragraph
94
- })
95
- ]
96
- }, indicesString),
97
- subSection.subSections.map(function(subSection, i) {
98
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(TermsOfUseSubSection, {
99
- indices: _to_consumable_array(indices).concat([
100
- i + 1
101
- ]),
102
- subSection: subSection
103
- }, "".concat(indices, ".").concat(i));
104
- })
105
- ]
106
- }, indicesString) : null;
107
- };
108
- var _default = TermsOfUseSubSection;