@driveflux/pdf 1.6.70 → 1.7.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 (76) hide show
  1. package/dist/__mocks__/quotation.js +11 -10
  2. package/dist/__mocks__/subscription.d.ts +0 -2
  3. package/dist/__mocks__/subscription.d.ts.map +1 -1
  4. package/dist/__mocks__/subscription.js +140 -408
  5. package/dist/__mocks__/subscription.js.map +1 -1
  6. package/dist/components/FluxLogo.js +3 -62
  7. package/dist/components/StandardPage.d.ts.map +1 -1
  8. package/dist/components/StandardPage.js +8 -107
  9. package/dist/components/StandardPage.js.map +1 -1
  10. package/dist/debug.js +30 -223
  11. package/dist/debug.js.map +1 -1
  12. package/dist/index.js +1 -0
  13. package/dist/templates/QuotationPdf/CustomerSubscriptionSection.js +27 -145
  14. package/dist/templates/QuotationPdf/GFV.js +12 -49
  15. package/dist/templates/QuotationPdf/Header.js +5 -63
  16. package/dist/templates/QuotationPdf/Pricing.d.ts.map +1 -1
  17. package/dist/templates/QuotationPdf/Pricing.js +208 -574
  18. package/dist/templates/QuotationPdf/Pricing.js.map +1 -1
  19. package/dist/templates/QuotationPdf/QuotationPdfPage.js +3 -23
  20. package/dist/templates/QuotationPdf/SectionBoxNew.js +4 -34
  21. package/dist/templates/QuotationPdf/TermsSection.js +5 -42
  22. package/dist/templates/QuotationPdf/VehiclePhotos.js +24 -54
  23. package/dist/templates/QuotationPdf/index.js +11 -198
  24. package/dist/templates/QuotationPdf/translations.d.ts.map +1 -1
  25. package/dist/templates/QuotationPdf/translations.js +23 -34
  26. package/dist/templates/QuotationPdf/translations.js.map +1 -1
  27. package/dist/templates/QuotationPdf/utils.js +29 -59
  28. package/dist/templates/SubscriptionAgreement/Confirmation.d.ts +0 -2
  29. package/dist/templates/SubscriptionAgreement/Confirmation.d.ts.map +1 -1
  30. package/dist/templates/SubscriptionAgreement/Confirmation.js +11 -66
  31. package/dist/templates/SubscriptionAgreement/Confirmation.js.map +1 -1
  32. package/dist/templates/SubscriptionAgreement/CoverPage.d.ts +1 -3
  33. package/dist/templates/SubscriptionAgreement/CoverPage.d.ts.map +1 -1
  34. package/dist/templates/SubscriptionAgreement/CoverPage.js +11 -94
  35. package/dist/templates/SubscriptionAgreement/CoverPage.js.map +1 -1
  36. package/dist/templates/SubscriptionAgreement/CoverPageSection.js +5 -16
  37. package/dist/templates/SubscriptionAgreement/Details.d.ts.map +1 -1
  38. package/dist/templates/SubscriptionAgreement/Details.js +46 -140
  39. package/dist/templates/SubscriptionAgreement/Details.js.map +1 -1
  40. package/dist/templates/SubscriptionAgreement/Footer.js +6 -48
  41. package/dist/templates/SubscriptionAgreement/Header.js +5 -35
  42. package/dist/templates/SubscriptionAgreement/LabelValue.js +3 -25
  43. package/dist/templates/SubscriptionAgreement/SubscriptionAgreementPage.js +3 -26
  44. package/dist/templates/SubscriptionAgreement/TermsOfUse.d.ts +2 -2
  45. package/dist/templates/SubscriptionAgreement/TermsOfUse.d.ts.map +1 -1
  46. package/dist/templates/SubscriptionAgreement/TermsOfUse.js +4 -97
  47. package/dist/templates/SubscriptionAgreement/TermsOfUse.js.map +1 -1
  48. package/dist/templates/SubscriptionAgreement/TermsOfUseSubSection.d.ts.map +1 -1
  49. package/dist/templates/SubscriptionAgreement/TermsOfUseSubSection.js +9 -98
  50. package/dist/templates/SubscriptionAgreement/TermsOfUseSubSection.js.map +1 -1
  51. package/dist/templates/SubscriptionAgreement/index.d.ts +1 -5
  52. package/dist/templates/SubscriptionAgreement/index.d.ts.map +1 -1
  53. package/dist/templates/SubscriptionAgreement/index.js +15 -254
  54. package/dist/templates/SubscriptionAgreement/index.js.map +1 -1
  55. package/dist/templates/SubscriptionAgreement/translations.d.ts +0 -6
  56. package/dist/templates/SubscriptionAgreement/translations.d.ts.map +1 -1
  57. package/dist/templates/SubscriptionAgreement/translations.js +192 -199
  58. package/dist/templates/SubscriptionAgreement/translations.js.map +1 -1
  59. package/dist/templates/SubscriptionAgreement/types.d.ts +1 -2
  60. package/dist/templates/SubscriptionAgreement/types.d.ts.map +1 -1
  61. package/dist/templates/SubscriptionAgreement/types.js +2 -1
  62. package/dist/templates/SubscriptionAgreement/utils.d.ts +0 -3
  63. package/dist/templates/SubscriptionAgreement/utils.d.ts.map +1 -1
  64. package/dist/templates/SubscriptionAgreement/utils.js +5 -36
  65. package/dist/templates/SubscriptionAgreement/utils.js.map +1 -1
  66. package/dist/templates/index.js +1 -0
  67. package/dist/theme/colors.js +63 -44
  68. package/dist/theme/index.js +1 -0
  69. package/dist/types.js +2 -1
  70. package/dist/utils.js +16 -166
  71. package/dist/watch.js +4 -3
  72. package/package.json +19 -19
  73. package/dist/__mocks__/tou.d.ts +0 -10
  74. package/dist/__mocks__/tou.d.ts.map +0 -1
  75. package/dist/__mocks__/tou.js +0 -22
  76. package/dist/__mocks__/tou.js.map +0 -1
@@ -1,103 +1,14 @@
1
- function _array_like_to_array(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
5
- }
6
- function _array_without_holes(arr) {
7
- if (Array.isArray(arr)) return _array_like_to_array(arr);
8
- }
9
- function _iterable_to_array(iter) {
10
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
11
- }
12
- function _non_iterable_spread() {
13
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
14
- }
15
- function _to_consumable_array(arr) {
16
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
17
- }
18
- function _unsupported_iterable_to_array(o, minLen) {
19
- if (!o) return;
20
- if (typeof o === "string") return _array_like_to_array(o, minLen);
21
- var n = Object.prototype.toString.call(o).slice(8, -1);
22
- if (n === "Object" && o.constructor) n = o.constructor.name;
23
- if (n === "Map" || n === "Set") return Array.from(n);
24
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
25
- }
26
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
27
2
  import { Text, View } from '@react-pdf/renderer';
28
3
  import { useMemo } from 'react';
29
- import { renderMarkdown } from './utils.js';
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;
4
+ const TermsOfUseSubSection = ({ indices, subSection }) => {
5
+ const { indicesString, paddingLeft } = useMemo(() => ({
6
+ indicesString: indices.reduce((prev, curr, i) => `${prev}${curr}${i === indices.length - 1 ? '' : '.'}`, ''),
7
+ paddingLeft: Math.max(indices.length - 2, 0) * 16,
8
+ }), [indices.length, indices.reduce]);
9
+ return typeof subSection === 'string' ? (_jsxs(View, { style: { flexDirection: 'row', paddingLeft, columnGap: 16 }, children: [_jsx(Text, { style: { fontWeight: 'bold' }, children: indicesString }), _jsx(Text, { style: { textAlign: 'justify', flex: 1 }, children: subSection })] }, indicesString)) : 'subSections' in subSection ? (_jsxs(View, { style: { gap: 16 }, children: [_jsxs(View, { style: { flexDirection: 'row', paddingLeft, columnGap: 16 }, children: [_jsx(Text, { style: { fontWeight: 'bold' }, children: indicesString }), _jsx(Text, { style: { textAlign: 'justify', flex: 1 }, children: subSection.paragraph })] }, indicesString), subSection.subSections.map((subSection, i) => (_jsx(TermsOfUseSubSection, { indices: [...indices, i + 1], subSection: subSection }, `${indices}.${
10
+ // biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
11
+ i}`)))] }, indicesString)) : null;
102
12
  };
103
13
  export default TermsOfUseSubSection;
14
+ //# sourceMappingURL=TermsOfUseSubSection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TermsOfUseSubSection.js","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/TermsOfUseSubSection.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,OA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KpB,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,EAC5B,UAAU,EAAE,UAAU,IALjB,GAAG,OAAO,IAAI;YAClB,8DAA8D;YAC9D,CACD,EAAE,CAGD,CACF,CAAC,KAnBQ,aAAa,CAoBjB,CACP,CAAC,CAAC,CAAC,IAAI,CAAA;AACT,CAAC,CAAA;AAED,eAAe,oBAAoB,CAAA"}
@@ -1,13 +1,9 @@
1
- import type { SubscriptionSignature } from '@driveflux/db';
2
- import type { TermsOfUseSettings } from '@driveflux/db/types/helpers';
3
1
  import type { PdfTemplatesSupportedLocales } from '../../types.js';
4
2
  import type { SubscriptionForAgreement } from './types.js';
5
3
  type Options = {
6
4
  locale?: PdfTemplatesSupportedLocales;
7
5
  subscription: SubscriptionForAgreement;
8
- termsOfUse: TermsOfUseSettings;
9
- signature: SubscriptionSignature;
10
6
  };
11
- export declare const generateSubscriptionAgreementPdf: ({ locale, subscription, termsOfUse, signature }: Options, fileName?: string) => Promise<Buffer<ArrayBufferLike>>;
7
+ export declare const generateSubscriptionAgreementPdf: ({ locale, subscription }: Options, fileName?: string) => Promise<Buffer<ArrayBufferLike>>;
12
8
  export {};
13
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAGrE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AAQlE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAE1D,KAAK,OAAO,GAAG;IACd,MAAM,CAAC,EAAE,4BAA4B,CAAA;IACrC,YAAY,EAAE,wBAAwB,CAAA;IACtC,UAAU,EAAE,kBAAkB,CAAA;IAC9B,SAAS,EAAE,qBAAqB,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,gCAAgC,GAC5C,iDAAwD,OAAO,EAC/D,WAAW,MAAM,qCAcjB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AAQlE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAE1D,KAAK,OAAO,GAAG;IACd,MAAM,CAAC,EAAE,4BAA4B,CAAA;IACrC,YAAY,EAAE,wBAAwB,CAAA;CACtC,CAAA;AACD,eAAO,MAAM,gCAAgC,GAC5C,0BAAiC,OAAO,EACxC,WAAW,MAAM,qCAajB,CAAA"}
@@ -1,179 +1,3 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
- try {
3
- var info = gen[key](arg);
4
- var value = info.value;
5
- } catch (error) {
6
- reject(error);
7
- return;
8
- }
9
- if (info.done) {
10
- resolve(value);
11
- } else {
12
- Promise.resolve(value).then(_next, _throw);
13
- }
14
- }
15
- function _async_to_generator(fn) {
16
- return function() {
17
- var self = this, args = arguments;
18
- return new Promise(function(resolve, reject) {
19
- var gen = fn.apply(self, args);
20
- function _next(value) {
21
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
- }
23
- function _throw(err) {
24
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
- }
26
- _next(undefined);
27
- });
28
- };
29
- }
30
- function _define_property(obj, key, value) {
31
- if (key in obj) {
32
- Object.defineProperty(obj, key, {
33
- value: value,
34
- enumerable: true,
35
- configurable: true,
36
- writable: true
37
- });
38
- } else {
39
- obj[key] = value;
40
- }
41
- return obj;
42
- }
43
- function _object_spread(target) {
44
- for(var i = 1; i < arguments.length; i++){
45
- var source = arguments[i] != null ? arguments[i] : {};
46
- var ownKeys = Object.keys(source);
47
- if (typeof Object.getOwnPropertySymbols === "function") {
48
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
49
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
50
- }));
51
- }
52
- ownKeys.forEach(function(key) {
53
- _define_property(target, key, source[key]);
54
- });
55
- }
56
- return target;
57
- }
58
- function ownKeys(object, enumerableOnly) {
59
- var keys = Object.keys(object);
60
- if (Object.getOwnPropertySymbols) {
61
- var symbols = Object.getOwnPropertySymbols(object);
62
- if (enumerableOnly) {
63
- symbols = symbols.filter(function(sym) {
64
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
65
- });
66
- }
67
- keys.push.apply(keys, symbols);
68
- }
69
- return keys;
70
- }
71
- function _object_spread_props(target, source) {
72
- source = source != null ? source : {};
73
- if (Object.getOwnPropertyDescriptors) {
74
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
75
- } else {
76
- ownKeys(Object(source)).forEach(function(key) {
77
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
78
- });
79
- }
80
- return target;
81
- }
82
- function _ts_generator(thisArg, body) {
83
- var f, y, t, g, _ = {
84
- label: 0,
85
- sent: function() {
86
- if (t[0] & 1) throw t[1];
87
- return t[1];
88
- },
89
- trys: [],
90
- ops: []
91
- };
92
- return g = {
93
- next: verb(0),
94
- "throw": verb(1),
95
- "return": verb(2)
96
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
97
- return this;
98
- }), g;
99
- function verb(n) {
100
- return function(v) {
101
- return step([
102
- n,
103
- v
104
- ]);
105
- };
106
- }
107
- function step(op) {
108
- if (f) throw new TypeError("Generator is already executing.");
109
- while(_)try {
110
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
111
- if (y = 0, t) op = [
112
- op[0] & 2,
113
- t.value
114
- ];
115
- switch(op[0]){
116
- case 0:
117
- case 1:
118
- t = op;
119
- break;
120
- case 4:
121
- _.label++;
122
- return {
123
- value: op[1],
124
- done: false
125
- };
126
- case 5:
127
- _.label++;
128
- y = op[1];
129
- op = [
130
- 0
131
- ];
132
- continue;
133
- case 7:
134
- op = _.ops.pop();
135
- _.trys.pop();
136
- continue;
137
- default:
138
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
139
- _ = 0;
140
- continue;
141
- }
142
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
143
- _.label = op[1];
144
- break;
145
- }
146
- if (op[0] === 6 && _.label < t[1]) {
147
- _.label = t[1];
148
- t = op;
149
- break;
150
- }
151
- if (t && _.label < t[2]) {
152
- _.label = t[2];
153
- _.ops.push(op);
154
- break;
155
- }
156
- if (t[2]) _.ops.pop();
157
- _.trys.pop();
158
- continue;
159
- }
160
- op = body.call(thisArg, _);
161
- } catch (e) {
162
- op = [
163
- 6,
164
- e
165
- ];
166
- y = 0;
167
- } finally{
168
- f = t = 0;
169
- }
170
- if (op[0] & 5) throw op[1];
171
- return {
172
- value: op[0] ? op[1] : void 0,
173
- done: true
174
- };
175
- }
176
- }
177
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
178
2
  import { Document } from '@react-pdf/renderer';
179
3
  import { useMemo } from 'react';
@@ -184,88 +8,25 @@ import Details from './Details.js';
184
8
  import SubscriptionAgreementPage from './SubscriptionAgreementPage.js';
185
9
  import TermsOfUse from './TermsOfUse.js';
186
10
  import { useTranslations } from './translations.js';
187
- export var generateSubscriptionAgreementPdf = /*#__PURE__*/ function() {
188
- var _ref = _async_to_generator(function(param, fileName) {
189
- var _param_locale, locale, subscription, termsOfUse, 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;
11
+ export const generateSubscriptionAgreementPdf = async ({ locale = 'en', subscription }, fileName) => {
12
+ if (!subscription.signature) {
13
+ throw new Error('Signature not found');
14
+ }
15
+ return await toPdf(_jsx(SubscriptionAgreement, { locale: locale, signature: subscription.signature, subscription: subscription }), fileName);
16
+ };
17
+ const SubscriptionAgreement = ({ locale = 'en', signature, subscription, }) => {
220
18
  if (!signature.signedAt) {
221
- throw new Error("Missing 'signature.signedAt'");
19
+ throw new Error(`Missing 'signature.signedAt'`);
222
20
  }
223
- var useT = useTranslations(locale);
224
- var pageProps = useMemo(function() {
21
+ const useT = useTranslations(locale);
22
+ const pageProps = useMemo(() => {
225
23
  return {
226
24
  t: useT,
227
25
  userId: subscription.userId,
228
- subscriptionId: subscription.id
26
+ subscriptionId: subscription.id,
229
27
  };
230
- }, [
231
- subscription.userId,
232
- subscription.id,
233
- useT
234
- ]);
235
- var 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
- });
28
+ }, [subscription.userId, subscription.id, useT]);
29
+ const { t } = pageProps;
30
+ return (_jsxs(Document, { title: t.title, language: locale, children: [_jsx(SubscriptionAgreementPage, { ...pageProps, children: _jsx(CoverPage, { tTitle: t.title, tCover: t.cover, signedAt: signature.signedAt, user: subscription.user }) }), _jsx(SubscriptionAgreementPage, { ...pageProps, children: _jsx(TermsOfUse, { t: t.termsOfUse }) }), _jsxs(SubscriptionAgreementPage, { ...pageProps, children: [_jsx(Details, { tDetails: t.details, subscription: subscription }), _jsx(Confirmation, { tConfirmation: t.confirmation, subscription: subscription })] })] }));
271
31
  };
32
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAW,OAAO,EAAE,MAAM,OAAO,CAAA;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,YAAY,MAAM,mBAAmB,CAAA;AAC5C,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,yBAAyB,MAAM,gCAAgC,CAAA;AACtE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AC,UAAU,GAAI,GACJ,EAC5B,MAAC,yBAAyB,OAAK,SAAS,aACvC,KAAC,OAAO,IAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,YAAY,EAAE,YAAY,GAAI,EAC5D,KAAC,YAAY,IACZ,aAAa,EAAE,CAAC,CAAC,YAAY,EAC7B,YAAY,EAAE,YAAY,GACzB,IACyB,IAClB,CACX,CAAA;AACF,CAAC,CAAA"}
@@ -10,8 +10,6 @@ declare const enTranslation: {
10
10
  and: string;
11
11
  name: string;
12
12
  idOrPassportNo: string;
13
- companyName: string;
14
- companyNo: string;
15
13
  };
16
14
  termsOfUse: {
17
15
  title: string;
@@ -47,10 +45,6 @@ declare const enTranslation: {
47
45
  name: string;
48
46
  idOrPassportNo: string;
49
47
  };
50
- business: {
51
- name: string;
52
- companyNo: string;
53
- };
54
48
  vehicle: {
55
49
  make: string;
56
50
  model: string;
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/translations.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAwqBS,QAAQ,GAAG,UAAU;;;;;CAMhD,CAAA;AACD,MAAM,MAAM,gCAAgC,GAAG,OAAO,aAAa,CAAA;AAEnE,eAAO,MAAM,eAAe,GAC3B,QAAQ,IAAI,KACV,gCAKF,CAAA"}
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/translations.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAkqBS,QAAQ,GAAG,UAAU;;;;;CAMhD,CAAA;AACD,MAAM,MAAM,gCAAgC,GAAG,OAAO,aAAa,CAAA;AAEnE,eAAO,MAAM,eAAe,GAC3B,QAAQ,IAAI,KACV,gCAKF,CAAA"}