@driveflux/pdf 1.6.67 → 1.6.68
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.
- package/dist/templates/SubscriptionAgreement/CoverPage.js +93 -10
- package/dist/templates/SubscriptionAgreement/Details.js +129 -51
- package/dist/templates/SubscriptionAgreement/index.js +254 -16
- package/dist/templates/SubscriptionAgreement/translations.js +195 -194
- package/dist/templates/SubscriptionAgreement/types.js +1 -2
- package/package.json +2 -2
|
@@ -5,24 +5,107 @@ import { format } from 'date-fns';
|
|
|
5
5
|
import { colors } from '../../theme/colors.js';
|
|
6
6
|
import CoverPageSection from './CoverPageSection.js';
|
|
7
7
|
import LabelValue from './LabelValue.js';
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
var CoverPage = function(param) {
|
|
9
|
+
var tTitle = param.tTitle, tCover = param.tCover, signedAt = param.signedAt, user = param.user, payerType = param.payerType, business = param.business;
|
|
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: {
|
|
10
20
|
fontWeight: 'bold',
|
|
11
21
|
fontSize: 40,
|
|
12
22
|
textTransform: 'uppercase',
|
|
13
|
-
flex: 1
|
|
14
|
-
},
|
|
23
|
+
flex: 1
|
|
24
|
+
},
|
|
25
|
+
children: tTitle
|
|
26
|
+
}),
|
|
27
|
+
/*#__PURE__*/ _jsxs(View, {
|
|
28
|
+
style: {
|
|
15
29
|
padding: 16,
|
|
16
30
|
rowGap: 32,
|
|
17
|
-
border:
|
|
18
|
-
fontSize: 10
|
|
19
|
-
},
|
|
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
|
+
payerType === 'business' && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
68
|
+
children: [
|
|
69
|
+
/*#__PURE__*/ _jsx(LabelValue, {
|
|
70
|
+
label: tCover.companyName,
|
|
71
|
+
value: business === null || business === void 0 ? void 0 : business.name
|
|
72
|
+
}),
|
|
73
|
+
/*#__PURE__*/ _jsx(LabelValue, {
|
|
74
|
+
label: tCover.companyNo,
|
|
75
|
+
value: business === null || business === void 0 ? void 0 : business.registrationNumber
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
}),
|
|
79
|
+
payerType === 'user' && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
80
|
+
children: [
|
|
81
|
+
/*#__PURE__*/ _jsx(LabelValue, {
|
|
82
|
+
label: tCover.name,
|
|
83
|
+
value: userName(user)
|
|
84
|
+
}),
|
|
85
|
+
/*#__PURE__*/ _jsx(LabelValue, {
|
|
86
|
+
label: tCover.idOrPassportNo,
|
|
87
|
+
value: (_user_identification = user.identification) === null || _user_identification === void 0 ? void 0 : _user_identification.number
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
}),
|
|
93
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
94
|
+
style: {
|
|
20
95
|
fontSize: 8,
|
|
21
96
|
fontWeight: 'bold',
|
|
22
97
|
color: colors.primary3,
|
|
23
98
|
textTransform: 'uppercase',
|
|
24
|
-
letterSpacing: 1
|
|
25
|
-
},
|
|
99
|
+
letterSpacing: 1
|
|
100
|
+
},
|
|
101
|
+
children: tCover.and
|
|
102
|
+
}),
|
|
103
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
104
|
+
children: "FLUX Sdn Bhd (1264766-H)"
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
});
|
|
26
110
|
};
|
|
27
111
|
export default CoverPage;
|
|
28
|
-
//# sourceMappingURL=CoverPage.js.map
|
|
@@ -1,105 +1,184 @@
|
|
|
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
|
+
}
|
|
1
53
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
54
|
import { userName } from '@driveflux/db/models/user';
|
|
3
55
|
import { format } from '@driveflux/time';
|
|
4
56
|
import { Text, View } from '@react-pdf/renderer';
|
|
5
57
|
import { colors } from '../../theme/index.js';
|
|
6
58
|
import LabelValue from './LabelValue.js';
|
|
7
|
-
|
|
8
|
-
|
|
59
|
+
var Details = function(param) {
|
|
60
|
+
var tDetails = param.tDetails, subscription = param.subscription;
|
|
61
|
+
var _subscription_vehicle, _subscription_vehicle1, _subscription_vehicle2, _subscription_vehicle3, _subscription_vehicle4, _subscription_schedule, _subscription_schedule1;
|
|
62
|
+
var details = {};
|
|
9
63
|
if (subscription.payerType === 'business') {
|
|
64
|
+
var _subscription_business;
|
|
10
65
|
details.business = [
|
|
11
66
|
{
|
|
12
67
|
key: tDetails.business.name,
|
|
13
|
-
value: subscription
|
|
68
|
+
value: subscription === null || subscription === void 0 ? void 0 : subscription.businessName
|
|
14
69
|
},
|
|
15
70
|
{
|
|
16
71
|
key: tDetails.business.companyNo,
|
|
17
|
-
value: subscription
|
|
18
|
-
}
|
|
72
|
+
value: subscription === null || subscription === void 0 ? void 0 : (_subscription_business = subscription.business) === null || _subscription_business === void 0 ? void 0 : _subscription_business.registrationNumber
|
|
73
|
+
}
|
|
19
74
|
];
|
|
20
|
-
}
|
|
21
|
-
|
|
75
|
+
} else {
|
|
76
|
+
var _subscription_user_identification;
|
|
22
77
|
details.member = [
|
|
23
78
|
{
|
|
24
79
|
key: tDetails.member.name,
|
|
25
|
-
value: userName(subscription.user)
|
|
80
|
+
value: userName(subscription.user)
|
|
26
81
|
},
|
|
27
82
|
{
|
|
28
83
|
key: tDetails.member.idOrPassportNo,
|
|
29
|
-
value: subscription.user.identification
|
|
30
|
-
}
|
|
84
|
+
value: (_subscription_user_identification = subscription.user.identification) === null || _subscription_user_identification === void 0 ? void 0 : _subscription_user_identification.number
|
|
85
|
+
}
|
|
31
86
|
];
|
|
32
87
|
}
|
|
33
|
-
details = {
|
|
34
|
-
...details,
|
|
88
|
+
details = _object_spread_props(_object_spread({}, details), {
|
|
35
89
|
vehicle: [
|
|
36
90
|
{
|
|
37
91
|
key: tDetails.vehicle.make,
|
|
38
|
-
value: subscription.vehicle
|
|
92
|
+
value: (_subscription_vehicle = subscription.vehicle) === null || _subscription_vehicle === void 0 ? void 0 : _subscription_vehicle.make
|
|
39
93
|
},
|
|
40
94
|
{
|
|
41
95
|
key: tDetails.vehicle.model,
|
|
42
|
-
value:
|
|
96
|
+
value: "".concat((_subscription_vehicle1 = subscription.vehicle) === null || _subscription_vehicle1 === void 0 ? void 0 : _subscription_vehicle1.vehicleModel, " ").concat((_subscription_vehicle2 = subscription.vehicle) === null || _subscription_vehicle2 === void 0 ? void 0 : _subscription_vehicle2.variant)
|
|
43
97
|
},
|
|
44
98
|
{
|
|
45
99
|
key: tDetails.vehicle.year,
|
|
46
|
-
value: subscription.vehicle
|
|
100
|
+
value: (_subscription_vehicle3 = subscription.vehicle) === null || _subscription_vehicle3 === void 0 ? void 0 : _subscription_vehicle3.year
|
|
47
101
|
},
|
|
48
102
|
{
|
|
49
103
|
key: tDetails.vehicle.plateNo,
|
|
50
|
-
value: subscription.vehicle
|
|
51
|
-
}
|
|
104
|
+
value: (_subscription_vehicle4 = subscription.vehicle) === null || _subscription_vehicle4 === void 0 ? void 0 : _subscription_vehicle4.registrationNumber
|
|
105
|
+
}
|
|
52
106
|
],
|
|
53
107
|
subscription: [
|
|
54
108
|
{
|
|
55
109
|
key: tDetails.subscription.subscriptionPlan,
|
|
56
|
-
value: getPlanTranslation(subscription.plan)
|
|
110
|
+
value: getPlanTranslation(subscription.plan)
|
|
57
111
|
},
|
|
58
112
|
{
|
|
59
113
|
key: tDetails.subscription.mileagePackage,
|
|
60
|
-
value: getFullMileagePackageTranslation(subscription.mileagePackage)
|
|
114
|
+
value: getFullMileagePackageTranslation(subscription.mileagePackage)
|
|
61
115
|
},
|
|
62
116
|
{
|
|
63
117
|
key: tDetails.subscription.startDate,
|
|
64
|
-
value: subscription.startedAt
|
|
65
|
-
? format(subscription.startedAt, 'dd-MM-yyyy')
|
|
66
|
-
: undefined,
|
|
118
|
+
value: subscription.startedAt ? format(subscription.startedAt, 'dd-MM-yyyy') : undefined
|
|
67
119
|
},
|
|
68
120
|
{
|
|
69
121
|
key: tDetails.subscription.endDate,
|
|
70
|
-
value: subscription.endedAt
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
122
|
+
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
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
var border = "1px solid ".concat(colors.primary2);
|
|
127
|
+
return /*#__PURE__*/ _jsxs(View, {
|
|
128
|
+
style: {
|
|
129
|
+
borderLeft: border,
|
|
130
|
+
borderRight: border
|
|
131
|
+
},
|
|
132
|
+
children: [
|
|
133
|
+
/*#__PURE__*/ _jsx(View, {
|
|
134
|
+
style: {
|
|
80
135
|
backgroundColor: colors.primary1,
|
|
81
136
|
borderTop: border,
|
|
82
|
-
padding: 8
|
|
83
|
-
},
|
|
137
|
+
padding: 8
|
|
138
|
+
},
|
|
139
|
+
children: /*#__PURE__*/ _jsx(Text, {
|
|
140
|
+
style: {
|
|
84
141
|
fontWeight: 'bold',
|
|
85
142
|
textTransform: 'uppercase',
|
|
86
|
-
letterSpacing: 1
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
143
|
+
letterSpacing: 1
|
|
144
|
+
},
|
|
145
|
+
children: tDetails.agreement
|
|
146
|
+
})
|
|
147
|
+
}),
|
|
148
|
+
Object.keys(details).map(function(key, i) {
|
|
149
|
+
return /*#__PURE__*/ _jsxs(View, {
|
|
150
|
+
style: {
|
|
151
|
+
padding: 8,
|
|
152
|
+
paddingBottom: 16,
|
|
153
|
+
rowGap: 8,
|
|
154
|
+
borderTop: border
|
|
155
|
+
},
|
|
156
|
+
children: [
|
|
157
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
158
|
+
style: {
|
|
159
|
+
textTransform: 'uppercase',
|
|
160
|
+
color: colors.primary2,
|
|
161
|
+
fontSize: 8,
|
|
162
|
+
letterSpacing: 1
|
|
163
|
+
},
|
|
164
|
+
children: "".concat(key, " details")
|
|
165
|
+
}),
|
|
166
|
+
details[key].map(function(line) {
|
|
167
|
+
return /*#__PURE__*/ _jsx(LabelValue, {
|
|
168
|
+
label: line.key,
|
|
169
|
+
value: line.value
|
|
170
|
+
}, line.key);
|
|
171
|
+
})
|
|
172
|
+
]
|
|
173
|
+
}, key);
|
|
174
|
+
})
|
|
175
|
+
]
|
|
176
|
+
});
|
|
98
177
|
};
|
|
99
178
|
export default Details;
|
|
100
179
|
// TODO: replace this with dump's once the package is ready
|
|
101
|
-
|
|
102
|
-
switch
|
|
180
|
+
var getPlanTranslation = function(plan, vehicleType) {
|
|
181
|
+
switch(plan){
|
|
103
182
|
case 'plan60':
|
|
104
183
|
return vehicleType === 'motorcycle' ? '60 Months' : '60 Months (Basic)';
|
|
105
184
|
case 'plan36':
|
|
@@ -116,8 +195,8 @@ const getPlanTranslation = (plan, vehicleType) => {
|
|
|
116
195
|
return 'Unknown Plan';
|
|
117
196
|
}
|
|
118
197
|
};
|
|
119
|
-
|
|
120
|
-
switch
|
|
198
|
+
var getFullMileagePackageTranslation = function(plan) {
|
|
199
|
+
switch(plan){
|
|
121
200
|
case 'lite':
|
|
122
201
|
return 'Lite - 1,250KM';
|
|
123
202
|
case 'standard':
|
|
@@ -130,4 +209,3 @@ const getFullMileagePackageTranslation = (plan) => {
|
|
|
130
209
|
return 'Unknown Mileage Package';
|
|
131
210
|
}
|
|
132
211
|
};
|
|
133
|
-
//# sourceMappingURL=Details.js.map
|
|
@@ -1,3 +1,179 @@
|
|
|
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
|
+
}
|
|
1
177
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
178
|
import { Document } from '@react-pdf/renderer';
|
|
3
179
|
import { useMemo } from 'react';
|
|
@@ -8,26 +184,88 @@ import Details from './Details.js';
|
|
|
8
184
|
import SubscriptionAgreementPage from './SubscriptionAgreementPage.js';
|
|
9
185
|
import TermsOfUse from './TermsOfUse.js';
|
|
10
186
|
import { useTranslations } from './translations.js';
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
187
|
+
export var generateSubscriptionAgreementPdf = /*#__PURE__*/ function() {
|
|
188
|
+
var _ref = _async_to_generator(function(param, fileName) {
|
|
189
|
+
var _param_locale, locale, subscription, termsOfUse, signature;
|
|
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, signature = param.signature;
|
|
194
|
+
if (!signature) {
|
|
195
|
+
throw new Error('Signature not found');
|
|
196
|
+
}
|
|
197
|
+
return [
|
|
198
|
+
4,
|
|
199
|
+
toPdf(/*#__PURE__*/ _jsx(SubscriptionAgreement, {
|
|
200
|
+
locale: locale,
|
|
201
|
+
signature: 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;
|
|
18
220
|
if (!signature.signedAt) {
|
|
19
|
-
throw new Error(
|
|
221
|
+
throw new Error("Missing 'signature.signedAt'");
|
|
20
222
|
}
|
|
21
|
-
|
|
22
|
-
|
|
223
|
+
var useT = useTranslations(locale);
|
|
224
|
+
var pageProps = useMemo(function() {
|
|
23
225
|
return {
|
|
24
226
|
t: useT,
|
|
25
227
|
userId: subscription.userId,
|
|
26
|
-
subscriptionId: subscription.id
|
|
228
|
+
subscriptionId: subscription.id
|
|
27
229
|
};
|
|
28
|
-
}, [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
230
|
+
}, [
|
|
231
|
+
subscription.userId,
|
|
232
|
+
subscription.id,
|
|
233
|
+
useT
|
|
234
|
+
]);
|
|
235
|
+
var payerType = subscription.payerType;
|
|
236
|
+
var t = pageProps.t;
|
|
237
|
+
return /*#__PURE__*/ _jsxs(Document, {
|
|
238
|
+
title: t.title,
|
|
239
|
+
language: locale,
|
|
240
|
+
children: [
|
|
241
|
+
/*#__PURE__*/ _jsx(SubscriptionAgreementPage, _object_spread_props(_object_spread({}, pageProps), {
|
|
242
|
+
children: /*#__PURE__*/ _jsx(CoverPage, {
|
|
243
|
+
tTitle: t.title,
|
|
244
|
+
tCover: t.cover,
|
|
245
|
+
signedAt: signature.signedAt,
|
|
246
|
+
user: subscription.user,
|
|
247
|
+
business: subscription.business,
|
|
248
|
+
payerType: payerType
|
|
249
|
+
})
|
|
250
|
+
})),
|
|
251
|
+
/*#__PURE__*/ _jsx(SubscriptionAgreementPage, _object_spread_props(_object_spread({}, pageProps), {
|
|
252
|
+
children: /*#__PURE__*/ _jsx(TermsOfUse, {
|
|
253
|
+
termsOfUse: termsOfUse
|
|
254
|
+
})
|
|
255
|
+
})),
|
|
256
|
+
/*#__PURE__*/ _jsxs(SubscriptionAgreementPage, _object_spread_props(_object_spread({}, pageProps), {
|
|
257
|
+
children: [
|
|
258
|
+
/*#__PURE__*/ _jsx(Details, {
|
|
259
|
+
tDetails: t.details,
|
|
260
|
+
subscription: subscription
|
|
261
|
+
}),
|
|
262
|
+
/*#__PURE__*/ _jsx(Confirmation, {
|
|
263
|
+
tConfirmation: t.confirmation,
|
|
264
|
+
subscription: subscription,
|
|
265
|
+
signature: signature
|
|
266
|
+
})
|
|
267
|
+
]
|
|
268
|
+
}))
|
|
269
|
+
]
|
|
270
|
+
});
|
|
32
271
|
};
|
|
33
|
-
//# sourceMappingURL=index.js.map
|