@driveflux/pdf 1.0.1

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 (130) hide show
  1. package/.eslintrc +3 -0
  2. package/.swcrc +14 -0
  3. package/.turbo/turbo-build.log +6 -0
  4. package/CHANGELOG.md +69 -0
  5. package/dist/__mocks__/subscription.d.ts +3 -0
  6. package/dist/__mocks__/subscription.d.ts.map +1 -0
  7. package/dist/__mocks__/subscription.js +1069 -0
  8. package/dist/cjs/__mocks__/subscription.js +1079 -0
  9. package/dist/cjs/components/FluxLogo.js +76 -0
  10. package/dist/cjs/components/StandardPage.js +129 -0
  11. package/dist/cjs/debug.js +202 -0
  12. package/dist/cjs/index.js +20 -0
  13. package/dist/cjs/package.json +3 -0
  14. package/dist/cjs/templates/SubscriptionAgreement/Confirmation.js +95 -0
  15. package/dist/cjs/templates/SubscriptionAgreement/CoverPage.js +110 -0
  16. package/dist/cjs/templates/SubscriptionAgreement/CoverPageSection.js +35 -0
  17. package/dist/cjs/templates/SubscriptionAgreement/Details.js +161 -0
  18. package/dist/cjs/templates/SubscriptionAgreement/Footer.js +68 -0
  19. package/dist/cjs/templates/SubscriptionAgreement/Header.js +61 -0
  20. package/dist/cjs/templates/SubscriptionAgreement/LabelValue.js +39 -0
  21. package/dist/cjs/templates/SubscriptionAgreement/SubscriptionAgreementPage.js +48 -0
  22. package/dist/cjs/templates/SubscriptionAgreement/TermsOfUse.js +72 -0
  23. package/dist/cjs/templates/SubscriptionAgreement/TermsOfUseSubSection.js +108 -0
  24. package/dist/cjs/templates/SubscriptionAgreement/index.js +276 -0
  25. package/dist/cjs/templates/SubscriptionAgreement/translations.js +666 -0
  26. package/dist/cjs/templates/SubscriptionAgreement/utils.js +14 -0
  27. package/dist/cjs/templates/index.js +18 -0
  28. package/dist/cjs/theme/colors.js +147 -0
  29. package/dist/cjs/theme/index.js +18 -0
  30. package/dist/cjs/types.js +4 -0
  31. package/dist/cjs/utils.js +165 -0
  32. package/dist/cjs/watch.js +20 -0
  33. package/dist/components/FluxLogo.d.ts +3 -0
  34. package/dist/components/FluxLogo.d.ts.map +1 -0
  35. package/dist/components/FluxLogo.js +66 -0
  36. package/dist/components/StandardPage.d.ts +6 -0
  37. package/dist/components/StandardPage.d.ts.map +1 -0
  38. package/dist/components/StandardPage.js +114 -0
  39. package/dist/debug.d.ts +2 -0
  40. package/dist/debug.d.ts.map +1 -0
  41. package/dist/debug.js +198 -0
  42. package/dist/index.d.ts +4 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +3 -0
  45. package/dist/templates/SubscriptionAgreement/Confirmation.d.ts +10 -0
  46. package/dist/templates/SubscriptionAgreement/Confirmation.d.ts.map +1 -0
  47. package/dist/templates/SubscriptionAgreement/Confirmation.js +80 -0
  48. package/dist/templates/SubscriptionAgreement/CoverPage.d.ts +12 -0
  49. package/dist/templates/SubscriptionAgreement/CoverPage.d.ts.map +1 -0
  50. package/dist/templates/SubscriptionAgreement/CoverPage.js +95 -0
  51. package/dist/templates/SubscriptionAgreement/CoverPageSection.d.ts +7 -0
  52. package/dist/templates/SubscriptionAgreement/CoverPageSection.d.ts.map +1 -0
  53. package/dist/templates/SubscriptionAgreement/CoverPageSection.js +25 -0
  54. package/dist/templates/SubscriptionAgreement/Details.d.ts +10 -0
  55. package/dist/templates/SubscriptionAgreement/Details.d.ts.map +1 -0
  56. package/dist/templates/SubscriptionAgreement/Details.js +146 -0
  57. package/dist/templates/SubscriptionAgreement/Footer.d.ts +10 -0
  58. package/dist/templates/SubscriptionAgreement/Footer.d.ts.map +1 -0
  59. package/dist/templates/SubscriptionAgreement/Footer.js +58 -0
  60. package/dist/templates/SubscriptionAgreement/Header.d.ts +10 -0
  61. package/dist/templates/SubscriptionAgreement/Header.d.ts.map +1 -0
  62. package/dist/templates/SubscriptionAgreement/Header.js +46 -0
  63. package/dist/templates/SubscriptionAgreement/LabelValue.d.ts +8 -0
  64. package/dist/templates/SubscriptionAgreement/LabelValue.d.ts.map +1 -0
  65. package/dist/templates/SubscriptionAgreement/LabelValue.js +29 -0
  66. package/dist/templates/SubscriptionAgreement/SubscriptionAgreementPage.d.ts +10 -0
  67. package/dist/templates/SubscriptionAgreement/SubscriptionAgreementPage.d.ts.map +1 -0
  68. package/dist/templates/SubscriptionAgreement/SubscriptionAgreementPage.js +33 -0
  69. package/dist/templates/SubscriptionAgreement/TermsOfUse.d.ts +8 -0
  70. package/dist/templates/SubscriptionAgreement/TermsOfUse.d.ts.map +1 -0
  71. package/dist/templates/SubscriptionAgreement/TermsOfUse.js +57 -0
  72. package/dist/templates/SubscriptionAgreement/TermsOfUseSubSection.d.ts +12 -0
  73. package/dist/templates/SubscriptionAgreement/TermsOfUseSubSection.d.ts.map +1 -0
  74. package/dist/templates/SubscriptionAgreement/TermsOfUseSubSection.js +98 -0
  75. package/dist/templates/SubscriptionAgreement/index.d.ts +14 -0
  76. package/dist/templates/SubscriptionAgreement/index.d.ts.map +1 -0
  77. package/dist/templates/SubscriptionAgreement/index.js +261 -0
  78. package/dist/templates/SubscriptionAgreement/translations.d.ts +72 -0
  79. package/dist/templates/SubscriptionAgreement/translations.d.ts.map +1 -0
  80. package/dist/templates/SubscriptionAgreement/translations.js +656 -0
  81. package/dist/templates/SubscriptionAgreement/utils.d.ts +3 -0
  82. package/dist/templates/SubscriptionAgreement/utils.d.ts.map +1 -0
  83. package/dist/templates/SubscriptionAgreement/utils.js +4 -0
  84. package/dist/templates/index.d.ts +2 -0
  85. package/dist/templates/index.d.ts.map +1 -0
  86. package/dist/templates/index.js +1 -0
  87. package/dist/theme/colors.d.ts +148 -0
  88. package/dist/theme/colors.d.ts.map +1 -0
  89. package/dist/theme/colors.js +137 -0
  90. package/dist/theme/index.d.ts +2 -0
  91. package/dist/theme/index.d.ts.map +1 -0
  92. package/dist/theme/index.js +1 -0
  93. package/dist/types.d.ts +2 -0
  94. package/dist/types.d.ts.map +1 -0
  95. package/dist/types.js +1 -0
  96. package/dist/utils.d.ts +4 -0
  97. package/dist/utils.d.ts.map +1 -0
  98. package/dist/utils.js +150 -0
  99. package/dist/watch.d.ts +2 -0
  100. package/dist/watch.d.ts.map +1 -0
  101. package/dist/watch.js +11 -0
  102. package/index.cjs +1 -0
  103. package/index.d.ts +1 -0
  104. package/package.json +43 -0
  105. package/src/__mocks__/subscription.ts +803 -0
  106. package/src/components/FluxLogo.tsx +52 -0
  107. package/src/components/StandardPage.tsx +32 -0
  108. package/src/debug.ts +36 -0
  109. package/src/index.ts +3 -0
  110. package/src/templates/SubscriptionAgreement/Confirmation.tsx +49 -0
  111. package/src/templates/SubscriptionAgreement/CoverPage.tsx +52 -0
  112. package/src/templates/SubscriptionAgreement/CoverPageSection.tsx +25 -0
  113. package/src/templates/SubscriptionAgreement/Details.tsx +127 -0
  114. package/src/templates/SubscriptionAgreement/Footer.tsx +37 -0
  115. package/src/templates/SubscriptionAgreement/Header.tsx +37 -0
  116. package/src/templates/SubscriptionAgreement/LabelValue.tsx +19 -0
  117. package/src/templates/SubscriptionAgreement/SubscriptionAgreementPage.tsx +24 -0
  118. package/src/templates/SubscriptionAgreement/TermsOfUse.tsx +30 -0
  119. package/src/templates/SubscriptionAgreement/TermsOfUseSubSection.tsx +44 -0
  120. package/src/templates/SubscriptionAgreement/index.tsx +66 -0
  121. package/src/templates/SubscriptionAgreement/translations.ts +664 -0
  122. package/src/templates/SubscriptionAgreement/utils.ts +7 -0
  123. package/src/templates/index.ts +1 -0
  124. package/src/theme/colors.ts +180 -0
  125. package/src/theme/index.ts +1 -0
  126. package/src/types.ts +1 -0
  127. package/src/utils.ts +10 -0
  128. package/src/watch.ts +16 -0
  129. package/tsconfig.json +13 -0
  130. package/tsconfig.tsbuildinfo +1 -0
package/dist/debug.js ADDED
@@ -0,0 +1,198 @@
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 _ts_generator(thisArg, body) {
31
+ var f, y, t, g, _ = {
32
+ label: 0,
33
+ sent: function() {
34
+ if (t[0] & 1) throw t[1];
35
+ return t[1];
36
+ },
37
+ trys: [],
38
+ ops: []
39
+ };
40
+ return g = {
41
+ next: verb(0),
42
+ "throw": verb(1),
43
+ "return": verb(2)
44
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
45
+ return this;
46
+ }), g;
47
+ function verb(n) {
48
+ return function(v) {
49
+ return step([
50
+ n,
51
+ v
52
+ ]);
53
+ };
54
+ }
55
+ function step(op) {
56
+ if (f) throw new TypeError("Generator is already executing.");
57
+ while(_)try {
58
+ 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;
59
+ if (y = 0, t) op = [
60
+ op[0] & 2,
61
+ t.value
62
+ ];
63
+ switch(op[0]){
64
+ case 0:
65
+ case 1:
66
+ t = op;
67
+ break;
68
+ case 4:
69
+ _.label++;
70
+ return {
71
+ value: op[1],
72
+ done: false
73
+ };
74
+ case 5:
75
+ _.label++;
76
+ y = op[1];
77
+ op = [
78
+ 0
79
+ ];
80
+ continue;
81
+ case 7:
82
+ op = _.ops.pop();
83
+ _.trys.pop();
84
+ continue;
85
+ default:
86
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
87
+ _ = 0;
88
+ continue;
89
+ }
90
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
91
+ _.label = op[1];
92
+ break;
93
+ }
94
+ if (op[0] === 6 && _.label < t[1]) {
95
+ _.label = t[1];
96
+ t = op;
97
+ break;
98
+ }
99
+ if (t && _.label < t[2]) {
100
+ _.label = t[2];
101
+ _.ops.push(op);
102
+ break;
103
+ }
104
+ if (t[2]) _.ops.pop();
105
+ _.trys.pop();
106
+ continue;
107
+ }
108
+ op = body.call(thisArg, _);
109
+ } catch (e) {
110
+ op = [
111
+ 6,
112
+ e
113
+ ];
114
+ y = 0;
115
+ } finally{
116
+ f = t = 0;
117
+ }
118
+ if (op[0] & 5) throw op[1];
119
+ return {
120
+ value: op[0] ? op[1] : void 0,
121
+ done: true
122
+ };
123
+ }
124
+ }
125
+ import { loadAllEnv } from '@driveflux/env';
126
+ import { subscription } from './__mocks__/subscription.js';
127
+ import { generateSubscriptionAgreementPdf } from './templates/SubscriptionAgreement/index.js';
128
+ var debugSubscriptionAgreement = function() {
129
+ var _ref = _async_to_generator(function() {
130
+ return _ts_generator(this, function(_state) {
131
+ switch(_state.label){
132
+ case 0:
133
+ if (!subscription) {
134
+ console.error('no such subscription');
135
+ return [
136
+ 2
137
+ ];
138
+ }
139
+ return [
140
+ 4,
141
+ generateSubscriptionAgreementPdf({
142
+ subscription: subscription
143
+ }, "".concat(process.cwd(), "/output/subscription-agreement.pdf"))
144
+ ];
145
+ case 1:
146
+ _state.sent();
147
+ return [
148
+ 2
149
+ ];
150
+ }
151
+ });
152
+ });
153
+ return function debugSubscriptionAgreement() {
154
+ return _ref.apply(this, arguments);
155
+ };
156
+ }();
157
+ //! put all the debugging functions here
158
+ var debugCases = [
159
+ debugSubscriptionAgreement()
160
+ ];
161
+ var debug = function() {
162
+ var _ref = _async_to_generator(function() {
163
+ var results;
164
+ return _ts_generator(this, function(_state) {
165
+ switch(_state.label){
166
+ case 0:
167
+ loadAllEnv();
168
+ return [
169
+ 4,
170
+ Promise.allSettled(debugCases)
171
+ ];
172
+ case 1:
173
+ results = _state.sent();
174
+ if (results.some(function(res) {
175
+ return res.status === 'rejected';
176
+ })) {
177
+ results.forEach(function(res, i) {
178
+ if (res.status === 'rejected') {
179
+ console.error("debug no ".concat(i + 1, " error:"), res.reason);
180
+ }
181
+ });
182
+ return [
183
+ 2
184
+ ];
185
+ }
186
+ console.log('Generated all PDFs successfully!');
187
+ console.log("You can view them in the 'output' folder!");
188
+ return [
189
+ 2
190
+ ];
191
+ }
192
+ });
193
+ });
194
+ return function debug() {
195
+ return _ref.apply(this, arguments);
196
+ };
197
+ }();
198
+ debug();
@@ -0,0 +1,4 @@
1
+ export * from './templates/index.js';
2
+ export * from './types.js';
3
+ export * from './utils.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './templates/index.js';
2
+ export * from './types.js';
3
+ export * from './utils.js';
@@ -0,0 +1,10 @@
1
+ import { SubscriptionWithUser, SubscriptionWithVehicle } from '@driveflux/db/types';
2
+ import { FC } from 'react';
3
+ import { SubscriptionAgreementTranslation } from './translations.js';
4
+ type Props = {
5
+ tConfirmation: SubscriptionAgreementTranslation['confirmation'];
6
+ subscription: SubscriptionWithUser & SubscriptionWithVehicle;
7
+ };
8
+ declare const Confirmation: FC<Props>;
9
+ export default Confirmation;
10
+ //# sourceMappingURL=Confirmation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Confirmation.d.ts","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/Confirmation.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAGnF,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAG1B,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAA;AAEpE,KAAK,KAAK,GAAG;IACX,aAAa,EAAE,gCAAgC,CAAC,cAAc,CAAC,CAAA;IAC/D,YAAY,EAAE,oBAAoB,GAAG,uBAAuB,CAAA;CAC7D,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,KAAK,CAgC3B,CAAA;AAED,eAAe,YAAY,CAAA"}
@@ -0,0 +1,80 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { userName } from '@driveflux/db/models/user';
3
+ import { Image, Text, View } from '@react-pdf/renderer';
4
+ import { format } from 'date-fns';
5
+ import { colors } from '../../theme/index.js';
6
+ import LabelValue from './LabelValue.js';
7
+ var Confirmation = function(param) {
8
+ var tConfirmation = param.tConfirmation, subscription = param.subscription;
9
+ var _subscription_signature, _subscription_user_identification;
10
+ if (!((_subscription_signature = subscription.signature) === null || _subscription_signature === void 0 ? void 0 : _subscription_signature.signature)) {
11
+ throw new Error('Missing signature');
12
+ }
13
+ var border = "1px solid ".concat(colors.primary2);
14
+ return /*#__PURE__*/ _jsxs(View, {
15
+ style: {
16
+ borderLeft: border,
17
+ borderRight: border,
18
+ borderBottom: border
19
+ },
20
+ children: [
21
+ /*#__PURE__*/ _jsx(View, {
22
+ style: {
23
+ backgroundColor: colors.primary1,
24
+ borderTop: border,
25
+ padding: 8
26
+ },
27
+ children: /*#__PURE__*/ _jsx(Text, {
28
+ style: {
29
+ fontWeight: 'bold',
30
+ textTransform: 'uppercase',
31
+ letterSpacing: 1
32
+ },
33
+ children: tConfirmation.title
34
+ })
35
+ }),
36
+ /*#__PURE__*/ _jsxs(View, {
37
+ style: {
38
+ padding: 8,
39
+ paddingBottom: 16,
40
+ rowGap: 8,
41
+ borderTop: border
42
+ },
43
+ children: [
44
+ /*#__PURE__*/ _jsx(Text, {
45
+ children: tConfirmation.agreementText(subscription.businessId ? 'business' : 'member')
46
+ }),
47
+ /*#__PURE__*/ _jsx(View, {
48
+ style: {
49
+ height: 160,
50
+ alignItems: 'flex-start'
51
+ },
52
+ children: /*#__PURE__*/ _jsx(Image, {
53
+ src: subscription.signature.signature
54
+ })
55
+ }),
56
+ /*#__PURE__*/ _jsxs(View, {
57
+ style: {
58
+ rowGap: 8
59
+ },
60
+ children: [
61
+ /*#__PURE__*/ _jsx(LabelValue, {
62
+ label: tConfirmation.name,
63
+ value: userName(subscription.user)
64
+ }),
65
+ /*#__PURE__*/ _jsx(LabelValue, {
66
+ label: tConfirmation.idOrPassportNo,
67
+ value: (_subscription_user_identification = subscription.user.identification) === null || _subscription_user_identification === void 0 ? void 0 : _subscription_user_identification.number
68
+ }),
69
+ /*#__PURE__*/ _jsx(LabelValue, {
70
+ label: tConfirmation.date,
71
+ value: subscription.signature.signedAt ? format(subscription.signature.signedAt, 'dd-MM-yyyy hh:mm a') : undefined
72
+ })
73
+ ]
74
+ })
75
+ ]
76
+ })
77
+ ]
78
+ });
79
+ };
80
+ export default Confirmation;
@@ -0,0 +1,12 @@
1
+ import { User } from '@driveflux/db';
2
+ import { FC } from 'react';
3
+ import { SubscriptionAgreementTranslation } from './translations.js';
4
+ type Props = {
5
+ tTitle: SubscriptionAgreementTranslation['title'];
6
+ tCover: SubscriptionAgreementTranslation['cover'];
7
+ signedAt: Date;
8
+ user: User;
9
+ };
10
+ declare const CoverPage: FC<Props>;
11
+ export default CoverPage;
12
+ //# sourceMappingURL=CoverPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CoverPage.d.ts","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/CoverPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAIpC,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAI1B,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAA;AAEpE,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,gCAAgC,CAAC,OAAO,CAAC,CAAA;IACjD,MAAM,EAAE,gCAAgC,CAAC,OAAO,CAAC,CAAA;IACjD,QAAQ,EAAE,IAAI,CAAA;IACd,IAAI,EAAE,IAAI,CAAA;CACX,CAAA;AAED,QAAA,MAAM,SAAS,EAAE,EAAE,CAAC,KAAK,CAgCxB,CAAA;AAED,eAAe,SAAS,CAAA"}
@@ -0,0 +1,95 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { userName } from '@driveflux/db/models/user';
3
+ import { Text, View } from '@react-pdf/renderer';
4
+ import { format } from 'date-fns';
5
+ import { colors } from '../../theme/colors.js';
6
+ import CoverPageSection from './CoverPageSection.js';
7
+ import LabelValue from './LabelValue.js';
8
+ var CoverPage = function(param) {
9
+ var tTitle = param.tTitle, tCover = param.tCover, signedAt = param.signedAt, user = param.user;
10
+ var _user_identification;
11
+ return /*#__PURE__*/ _jsxs(View, {
12
+ style: {
13
+ flex: 1,
14
+ paddingVertical: 80,
15
+ justifyContent: 'space-between'
16
+ },
17
+ children: [
18
+ /*#__PURE__*/ _jsx(Text, {
19
+ style: {
20
+ fontWeight: 'bold',
21
+ fontSize: 40,
22
+ textTransform: 'uppercase',
23
+ flex: 1
24
+ },
25
+ children: tTitle
26
+ }),
27
+ /*#__PURE__*/ _jsxs(View, {
28
+ style: {
29
+ padding: 16,
30
+ rowGap: 32,
31
+ border: "1px solid ".concat(colors.primary2),
32
+ fontSize: 10
33
+ },
34
+ children: [
35
+ /*#__PURE__*/ _jsx(CoverPageSection, {
36
+ title: tCover.effectiveDate,
37
+ children: /*#__PURE__*/ _jsxs(View, {
38
+ style: {
39
+ flexDirection: 'row',
40
+ columnGap: 4
41
+ },
42
+ children: [
43
+ /*#__PURE__*/ _jsx(Text, {
44
+ style: {
45
+ textDecoration: 'underline'
46
+ },
47
+ children: format(signedAt, 'do')
48
+ }),
49
+ /*#__PURE__*/ _jsx(Text, {
50
+ children: tCover.of
51
+ }),
52
+ /*#__PURE__*/ _jsx(Text, {
53
+ style: {
54
+ textDecoration: 'underline'
55
+ },
56
+ children: format(signedAt, 'MMM')
57
+ }),
58
+ /*#__PURE__*/ _jsx(Text, {
59
+ children: format(signedAt, 'yyyy')
60
+ })
61
+ ]
62
+ })
63
+ }),
64
+ /*#__PURE__*/ _jsxs(CoverPageSection, {
65
+ title: tCover.agreementBetween,
66
+ children: [
67
+ /*#__PURE__*/ _jsx(LabelValue, {
68
+ label: tCover.name,
69
+ value: userName(user)
70
+ }),
71
+ /*#__PURE__*/ _jsx(LabelValue, {
72
+ label: tCover.idOrPassportNo,
73
+ value: (_user_identification = user.identification) === null || _user_identification === void 0 ? void 0 : _user_identification.number
74
+ })
75
+ ]
76
+ }),
77
+ /*#__PURE__*/ _jsx(Text, {
78
+ style: {
79
+ fontSize: 8,
80
+ fontWeight: 'bold',
81
+ color: colors.primary3,
82
+ textTransform: 'uppercase',
83
+ letterSpacing: 1
84
+ },
85
+ children: tCover.and
86
+ }),
87
+ /*#__PURE__*/ _jsx(Text, {
88
+ children: "FLUX Sdn Bhd (1264766-H)"
89
+ })
90
+ ]
91
+ })
92
+ ]
93
+ });
94
+ };
95
+ export default CoverPage;
@@ -0,0 +1,7 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ type Props = {
3
+ title: string;
4
+ };
5
+ declare const CoverPageSection: FC<PropsWithChildren<Props>>;
6
+ export default CoverPageSection;
7
+ //# sourceMappingURL=CoverPageSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CoverPageSection.d.ts","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/CoverPageSection.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAG7C,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AACD,QAAA,MAAM,gBAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAelD,CAAA;AAED,eAAe,gBAAgB,CAAA"}
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Text, View } from '@react-pdf/renderer';
3
+ import { colors } from '../../theme/colors.js';
4
+ var CoverPageSection = function(param) {
5
+ var title = param.title, children = param.children;
6
+ return /*#__PURE__*/ _jsxs(View, {
7
+ style: {
8
+ rowGap: 16
9
+ },
10
+ children: [
11
+ /*#__PURE__*/ _jsx(Text, {
12
+ style: {
13
+ fontSize: 8,
14
+ fontWeight: 'bold',
15
+ color: colors.primary3,
16
+ textTransform: 'uppercase',
17
+ letterSpacing: 1
18
+ },
19
+ children: "".concat(title, ":")
20
+ }),
21
+ children
22
+ ]
23
+ });
24
+ };
25
+ export default CoverPageSection;
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+ import { SubscriptionForAgreement } from './index.js';
3
+ import { SubscriptionAgreementTranslation } from './translations.js';
4
+ type Props = {
5
+ tDetails: SubscriptionAgreementTranslation['details'];
6
+ subscription: SubscriptionForAgreement;
7
+ };
8
+ declare const Details: FC<Props>;
9
+ export default Details;
10
+ //# sourceMappingURL=Details.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Details.d.ts","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/Details.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,EAAE,EAAW,MAAM,OAAO,CAAA;AAGnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAA;AAEpE,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,gCAAgC,CAAC,SAAS,CAAC,CAAA;IACrD,YAAY,EAAE,wBAAwB,CAAA;CACvC,CAAA;AAED,QAAA,MAAM,OAAO,EAAE,EAAE,CAAC,KAAK,CA0EtB,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -0,0 +1,146 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { userName } from '@driveflux/db/models/user';
3
+ import { format } from '@driveflux/time';
4
+ import { Text, View } from '@react-pdf/renderer';
5
+ import { useMemo } from 'react';
6
+ import { colors } from '../../theme/index.js';
7
+ import LabelValue from './LabelValue.js';
8
+ var Details = function(param) {
9
+ var tDetails = param.tDetails, subscription = param.subscription;
10
+ var details = useMemo(function() {
11
+ var _subscription_user_identification, _subscription_vehicle, _subscription_vehicle1, _subscription_vehicle2, _subscription_vehicle3, _subscription_schedule, _subscription_schedule1;
12
+ return {
13
+ member: [
14
+ {
15
+ key: tDetails.member.name,
16
+ value: userName(subscription.user)
17
+ },
18
+ {
19
+ key: tDetails.member.idOrPassportNo,
20
+ value: (_subscription_user_identification = subscription.user.identification) === null || _subscription_user_identification === void 0 ? void 0 : _subscription_user_identification.number
21
+ }
22
+ ],
23
+ vehicle: [
24
+ {
25
+ key: tDetails.vehicle.make,
26
+ value: (_subscription_vehicle = subscription.vehicle) === null || _subscription_vehicle === void 0 ? void 0 : _subscription_vehicle.make
27
+ },
28
+ {
29
+ key: tDetails.vehicle.model,
30
+ value: (_subscription_vehicle1 = subscription.vehicle) === null || _subscription_vehicle1 === void 0 ? void 0 : _subscription_vehicle1.vehicleModel
31
+ },
32
+ {
33
+ key: tDetails.vehicle.year,
34
+ value: (_subscription_vehicle2 = subscription.vehicle) === null || _subscription_vehicle2 === void 0 ? void 0 : _subscription_vehicle2.year
35
+ },
36
+ {
37
+ key: tDetails.vehicle.plateNo,
38
+ value: (_subscription_vehicle3 = subscription.vehicle) === null || _subscription_vehicle3 === void 0 ? void 0 : _subscription_vehicle3.registrationNumber
39
+ }
40
+ ],
41
+ subscription: [
42
+ {
43
+ key: tDetails.subscription.subscriptionPlan,
44
+ value: getPlanTranslation(subscription.plan)
45
+ },
46
+ {
47
+ key: tDetails.subscription.mileagePackage,
48
+ value: getFullMileagePackageTranslation(subscription.mileagePackage)
49
+ },
50
+ {
51
+ key: tDetails.subscription.startDate,
52
+ value: subscription.startedAt ? format(subscription.startedAt, 'dd-MM-yyyy') : undefined
53
+ },
54
+ {
55
+ key: tDetails.subscription.endDate,
56
+ value: subscription.endedAt ? format(subscription.endedAt, 'dd-MM-yyyy') : ((_subscription_schedule = subscription.schedule) === null || _subscription_schedule === void 0 ? void 0 : _subscription_schedule.endAt) ? format((_subscription_schedule1 = subscription.schedule) === null || _subscription_schedule1 === void 0 ? void 0 : _subscription_schedule1.endAt, 'dd-MM-yyyy') : undefined
57
+ }
58
+ ]
59
+ };
60
+ }, []);
61
+ var border = "1px solid ".concat(colors.primary2);
62
+ return /*#__PURE__*/ _jsxs(View, {
63
+ style: {
64
+ borderLeft: border,
65
+ borderRight: border
66
+ },
67
+ children: [
68
+ /*#__PURE__*/ _jsx(View, {
69
+ style: {
70
+ backgroundColor: colors.primary1,
71
+ borderTop: border,
72
+ padding: 8
73
+ },
74
+ children: /*#__PURE__*/ _jsx(Text, {
75
+ style: {
76
+ fontWeight: 'bold',
77
+ textTransform: 'uppercase',
78
+ letterSpacing: 1
79
+ },
80
+ children: tDetails.agreement
81
+ })
82
+ }),
83
+ Object.keys(details).map(function(key, i) {
84
+ return /*#__PURE__*/ _jsxs(View, {
85
+ style: {
86
+ padding: 8,
87
+ paddingBottom: 16,
88
+ rowGap: 8,
89
+ borderTop: border
90
+ },
91
+ children: [
92
+ /*#__PURE__*/ _jsx(Text, {
93
+ style: {
94
+ textTransform: 'uppercase',
95
+ color: colors.primary2,
96
+ fontSize: 8,
97
+ letterSpacing: 1
98
+ },
99
+ children: "".concat(key, " details")
100
+ }),
101
+ details[key].map(function(line) {
102
+ return /*#__PURE__*/ _jsx(LabelValue, {
103
+ label: line.key,
104
+ value: line.value
105
+ }, line.key);
106
+ })
107
+ ]
108
+ }, key);
109
+ })
110
+ ]
111
+ });
112
+ };
113
+ export default Details;
114
+ // TODO: replace this with dump's once the package is ready
115
+ var getPlanTranslation = function(plan, vehicleType) {
116
+ switch(plan){
117
+ case 'plan60':
118
+ return vehicleType === 'motorcycle' ? '60 Months' : '60 Months (Basic)';
119
+ case 'plan36':
120
+ return '36 Months';
121
+ case 'plan24':
122
+ return '24 Months';
123
+ case 'plan12':
124
+ return '12 Months';
125
+ case 'plan1':
126
+ return 'Monthly (Ultra)';
127
+ case 'planWeekly':
128
+ return 'Weekly';
129
+ default:
130
+ return 'Unknown Plan';
131
+ }
132
+ };
133
+ var getFullMileagePackageTranslation = function(plan) {
134
+ switch(plan){
135
+ case 'lite':
136
+ return 'Lite - 1,250KM';
137
+ case 'standard':
138
+ return 'Standard - 2,000KM';
139
+ case 'plus':
140
+ return 'Plus - 2,750KM';
141
+ case 'unlimited':
142
+ return 'Unlimited';
143
+ default:
144
+ return 'Unknown Mileage Package';
145
+ }
146
+ };
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+ import { SubscriptionAgreementTranslation } from './translations.js';
3
+ type Props = {
4
+ tComputerGenerated: SubscriptionAgreementTranslation['computerGenerated'];
5
+ tPage: SubscriptionAgreementTranslation['page'];
6
+ tOf: SubscriptionAgreementTranslation['of'];
7
+ };
8
+ declare const Footer: FC<Props>;
9
+ export default Footer;
10
+ //# sourceMappingURL=Footer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/Footer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAE1B,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAA;AAEpE,KAAK,KAAK,GAAG;IACX,kBAAkB,EAAE,gCAAgC,CAAC,mBAAmB,CAAC,CAAA;IACzE,KAAK,EAAE,gCAAgC,CAAC,MAAM,CAAC,CAAA;IAC/C,GAAG,EAAE,gCAAgC,CAAC,IAAI,CAAC,CAAA;CAC5C,CAAA;AAED,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,KAAK,CAuBrB,CAAA;AAED,eAAe,MAAM,CAAA"}