@cling-se/widget 0.5.3 → 0.7.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.
@@ -1,102 +0,0 @@
1
- import { d, f as c, h as l, n as r } from "./main.21e6cfa7.js";
2
- const m = {
3
- name: "DocumentSendReminderModal",
4
- props: {
5
- document: {
6
- type: Object,
7
- required: !0
8
- }
9
- },
10
- data() {
11
- return {
12
- clientsToSend: []
13
- };
14
- },
15
- computed: {
16
- ...d({
17
- feature: "application/feature"
18
- })
19
- },
20
- created() {
21
- const { events: n = [], clients: e = [] } = this.document || {}, s = n.reduce((t, { code: i, data: o }) => i === "sent" && o && o.clients && o.clients.length ? [...t, ...o.clients.map(({ id: a }) => a)] : t, []);
22
- this.clientsToSend = e.filter(({ id: t }) => s.includes(t)), this.feature("sms") || this.clientsToSend.forEach((t, i) => {
23
- this.isTypeActive("sms", t) && this.setDeliveryMethod("sms", i);
24
- }), this.clientsToSend.forEach((t, i) => {
25
- (!!t.answer || t.documentRole === "recipient") && ["sms", "email"].forEach((o) => {
26
- this.isTypeActive(o, t) && this.setDeliveryMethod(o, i);
27
- });
28
- });
29
- },
30
- methods: {
31
- ...c({
32
- sendDocumentReminder: l.SEND_REMINDER_DOCUMENT2
33
- }),
34
- async submit() {
35
- await this.sendDocumentReminder({
36
- id: this.document.id,
37
- body: {
38
- clients: this.clientsToSend
39
- }
40
- }), this.$emit("close");
41
- },
42
- canSendType(n, e) {
43
- return !!e[n === "sms" ? "cellphone" : "email"];
44
- },
45
- isTypeActive(n, e) {
46
- return e.deliveryTypes.includes(n) && this.canSendType(n, e);
47
- },
48
- setDeliveryMethod(n, e) {
49
- const s = this.clientsToSend[e].deliveryTypes.findIndex((t) => t === n);
50
- s > -1 ? this.clientsToSend[e].deliveryTypes.splice(s, 1) : this.clientsToSend[e].deliveryTypes.push(n);
51
- }
52
- }
53
- };
54
- var u = function() {
55
- var e = this, s = e._self._c;
56
- return s("div", { staticClass: "bg-white rounded-xl p-8" }, [s("div", { staticClass: "mb-6 text-lg font-semibold", domProps: { textContent: e._s(e.$t("send", { thing: e.$t("reminder") })) } }), e._l(e.clientsToSend, function(t, i) {
57
- return s("div", { key: i, staticClass: "border border-gray-200 p-2 rounded-lg mb-3" }, [s("div", { staticClass: "mb-2 pl-1" }, [s("div", { staticClass: "font-medium text-sm" }, [e._v(e._s(t.name || t.companyName))]), t.answer ? s("div", { staticClass: "text-gray-500 text-xs", domProps: { textContent: e._s(e.$t("components:account.documentForm.send.reminders.alreadySigned").capitalize()) } }) : t.documentRole === "recipient" ? s("div", { staticClass: "text-gray-500 text-xs", domProps: { textContent: e._s(e.$t("components:account.documentForm.send.reminders.cannotSign").capitalize()) } }) : e._e()]), s("div", { staticClass: "flex" }, [s("div", { staticClass: "py-1.5 pl-1.5 rounded-md bg-gray-100 border border-gray-200 items-center flex mr-2" }, [s("CCheckbox", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: { ...!e.canSendType("sms", t) && { content: e.$t("missing", { thing: e.$t("phoneNumber") }) } }, expression: "{ ...(!canSendType('sms', client) && { content: $t('missing', { thing: $t('phoneNumber') }) }) }" }], staticClass: "font-medium mr-2", attrs: { value: e.isTypeActive("sms", t), size: "tiny", disabled: !e.feature("sms") || !e.canSendType("sms", t) }, on: { input: function(o) {
58
- return e.setDeliveryMethod("sms", i);
59
- } } }, [e._v(" " + e._s(e.$t("sms")) + " ")])], 1), s("div", { staticClass: "py-1.5 pl-1.5 pr-2.5 rounded-md bg-gray-100 border border-gray-200 items-center flex" }, [s("CCheckbox", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: { ...!e.canSendType("email", t) && { content: e.$t("missing", { thing: e.$t("email") }) } }, expression: "{ ...(!canSendType('email', client) && { content: $t('missing', { thing: $t('email') }) }) }" }], staticClass: "font-medium", attrs: { value: e.isTypeActive("email", t), size: "tiny", disabled: !e.canSendType("email", t) }, on: { input: function(o) {
60
- return e.setDeliveryMethod("email", i);
61
- } } }, [e._v(" " + e._s(e.$t("email").capitalize()) + " ")])], 1)])]);
62
- }), s("CButton", { staticClass: "font-semibold mt-8", attrs: { type: "secondary", size: "small", taller: "", icon: "send", wide: "" }, on: { click: e.submit } }, [e._v(" " + e._s(e.$t("send", { thing: e.$t("reminder") })) + " ")])], 2);
63
- }, p = [], v = /* @__PURE__ */ r(
64
- m,
65
- u,
66
- p,
67
- !1,
68
- null,
69
- null,
70
- null,
71
- null
72
- );
73
- const y = v.exports, h = {
74
- props: {
75
- document: {
76
- type: Object,
77
- required: !0
78
- }
79
- },
80
- components: {
81
- DocumentSendReminderModal: y
82
- }
83
- };
84
- var _ = function() {
85
- var e = this, s = e._self._c;
86
- return s("DocumentSendReminderModal", { attrs: { document: e.document }, on: { close: function(t) {
87
- return e.$router.push("/");
88
- } } });
89
- }, f = [], T = /* @__PURE__ */ r(
90
- h,
91
- _,
92
- f,
93
- !1,
94
- null,
95
- null,
96
- null,
97
- null
98
- );
99
- const g = T.exports;
100
- export {
101
- g as default
102
- };
@@ -1,378 +0,0 @@
1
- import { n as p, i as g, J as f, d as x } from "./main.21e6cfa7.js";
2
- const $ = {
3
- name: "DynamicLink",
4
- props: {
5
- template: {
6
- type: String,
7
- required: !0
8
- }
9
- },
10
- computed: {
11
- transformed() {
12
- return { template: this.template };
13
- }
14
- }
15
- };
16
- var v = function() {
17
- var e = this, t = e._self._c;
18
- return t(e.transformed, { tag: "component" });
19
- }, b = [], C = /* @__PURE__ */ p(
20
- $,
21
- v,
22
- b,
23
- !1,
24
- null,
25
- null,
26
- null,
27
- null
28
- );
29
- const k = C.exports, S = {
30
- name: "EventItem",
31
- components: {
32
- DynamicLink: k
33
- },
34
- props: {
35
- title: {
36
- type: String,
37
- default: ""
38
- },
39
- template: {
40
- type: String,
41
- default: ""
42
- },
43
- content: {
44
- type: [String, Array],
45
- default: ""
46
- },
47
- createdAt: {
48
- type: String,
49
- default: ""
50
- },
51
- icon: {
52
- type: String,
53
- default: "square"
54
- },
55
- compact: {
56
- type: Boolean,
57
- default: !1
58
- },
59
- loading: {
60
- type: Boolean,
61
- default: !1
62
- },
63
- color: {
64
- type: String,
65
- default: "gray",
66
- validator: (n) => ["blue", "teal", "orange", "green", "red", "purple", "gray", "primary"].indexOf(n) !== -1
67
- },
68
- isFuture: {
69
- type: Boolean,
70
- default: !1
71
- },
72
- size: {
73
- type: String,
74
- default: ""
75
- }
76
- },
77
- computed: {
78
- date() {
79
- return g(f(this.createdAt)) ? this.$formatDate(this.createdAt, "Pp") : null;
80
- },
81
- dayOfMonth() {
82
- return g(f(this.createdAt)) ? this.$formatDate(this.createdAt, "d") : null;
83
- },
84
- month() {
85
- return g(f(this.createdAt)) ? this.$formatDate(this.createdAt, "MMM") : null;
86
- },
87
- iconClasses() {
88
- const n = {
89
- blue: "text-blue-600 bg-blue-50",
90
- teal: "text-cyan-600 bg-cyan-50",
91
- orange: "text-orange-600 bg-orange-50",
92
- green: "text-green-600 bg-green-50",
93
- red: "text-red-600 bg-red-50",
94
- purple: "text-purple-600 bg-purple-50",
95
- gray: "text-gray-500 bg-gray-100",
96
- primary: "text-primary-500 bg-primary-50"
97
- };
98
- return this.isFuture ? "bg-purple-100 text-purple-500" : n[this.color] || n.gray;
99
- },
100
- titleSize() {
101
- return this.size === "large" ? "text-base" : "text-sm";
102
- },
103
- textSize() {
104
- return this.size === "large" ? "text-[15px]" : "text-[13px]";
105
- },
106
- dateSize() {
107
- return this.size === "large" ? "text-sm" : "text-xs";
108
- }
109
- }
110
- };
111
- var D = function() {
112
- var e = this, t = e._self._c;
113
- return t("div", { staticClass: "flex flex-nowrap relative text-primary-500 cursor-default pb-5 ml-4 event before:content-[''] before:absolute before:w-px before:h-full before:bg-gray-300 before:-left-px before:top-4 last:before:hidden" }, [t("div", { staticClass: "m-0 h-[23px] relative", staticStyle: { "--bg": "#fff" } }, [t("div", { staticClass: "rounded-full absolute left-1/2 top-1/2 z-[1] w-7 h-7 flex items-center justify-center border-none bg-gray-100", class: e.iconClasses, staticStyle: { transform: "translate(-50%, calc(-50% + 8px))", "box-shadow": "0 0 0 2px var(--bg)" } }, [e.loading ? e._e() : t("BaseIcon", { attrs: { type: e.icon, size: "14" } })], 1)]), t("div", { staticClass: "ml-7 min-w-0 flex-grow flex flex-col pt-1" }, [e.loading ? [t("CSkeleton", { staticClass: "max-w-md text-gray-900 font-medium", class: e.titleSize, attrs: { width: "80%" } }), t("CSkeleton", { staticClass: "text-gray-600", class: e.textSize, attrs: { width: "40%" } }), t("CSkeleton", { staticClass: "text-center text-gray-500 text-xs inline-flex pt-0.5", class: e.dateSize, attrs: { hidden: "" } })] : e._e(), t("div", { staticClass: "max-w-md font-medium", class: [e.isFuture ? "text-gray-500" : "text-gray-700", e.titleSize] }, [e.template ? t("DynamicLink", { attrs: { template: e.template } }) : [e._v(e._s(e.title))]], 2), e.content ? t("div", { class: [e.isFuture ? "text-gray-400" : "text-gray-600", e.textSize] }, [t("div", { domProps: { innerHTML: e._s(e.content) } })]) : e._e(), t("div", { staticClass: "text-center text-gray-500 inline-flex pt-1", class: e.dateSize }, [t("div", { directives: [{ name: "tooltip", rawName: "v-tooltip", value: e.date, expression: "date" }] }, [e._v(e._s(e.dayOfMonth) + " " + e._s(e.month))])])], 2)]);
114
- }, w = [], z = /* @__PURE__ */ p(
115
- S,
116
- D,
117
- w,
118
- !1,
119
- null,
120
- null,
121
- null,
122
- null
123
- );
124
- const I = z.exports, M = {
125
- name: "DocumentTimeline",
126
- i18nOptions: {
127
- namespaces: "DocumentTimeline",
128
- messages: {
129
- en: {
130
- clientName: "Client",
131
- byName: "By {{- name}}",
132
- withBankId: "with BankID",
133
- propertyDesignation: "Request for property designation",
134
- viewed: "Viewed",
135
- viewedContent: "{{- name}} has viewed the document",
136
- signed: "Signed",
137
- denied: "denied",
138
- accepted: "accepted",
139
- statusChanged: "Document was",
140
- requestChange: "Manually marked as",
141
- mailOpened: "Email opened",
142
- mailOpenedContent: "{{email}} viewed",
143
- mailDropped: "Could not send email",
144
- smsDropped: "Could not send SMS",
145
- expired: "Expired",
146
- expiredContent: "Marked as declined - expiration date has passed"
147
- },
148
- sv: {
149
- clientName: "Kunden",
150
- byName: "Av {{- name}}",
151
- withBankId: "med BankID",
152
- propertyDesignation: "Beg\xE4ran om fastighetsbeteckning",
153
- viewed: "Granskat",
154
- viewedContent: "{{- name}} har visat dokumentet",
155
- signed: "Signerat",
156
- denied: "Nekat",
157
- accepted: "godk\xE4nt",
158
- statusChanged: "Dokumentet blev",
159
- requestChange: "Markerades manuellt som",
160
- mailOpened: "Mail visat",
161
- mailOpenedContent: "{{email}} visat",
162
- mailDropped: "E-post kunde inte skickas",
163
- smsDropped: "SMS kunde inte skickas",
164
- expired: "Upph\xF6rde att g\xE4lla",
165
- expiredContent: "Markerades som nekat f\xF6r att giltighetstiden har passerat"
166
- }
167
- }
168
- },
169
- components: {
170
- EventItem: I
171
- },
172
- props: {
173
- id: {
174
- type: String,
175
- required: !0
176
- }
177
- },
178
- computed: {
179
- ...x({
180
- docById: "documents2/byId",
181
- userById: "companyUsers/byId"
182
- }),
183
- document() {
184
- return this.docById(this.id);
185
- },
186
- events() {
187
- var i;
188
- const n = [
189
- this.formatEvent({
190
- code: "created",
191
- createdAt: (i = this.document) == null ? void 0 : i.createdAt
192
- })
193
- ], { events: e, scheduledFirstDelivery: t } = this.document || {};
194
- if ((t == null ? void 0 : t.status) === "active") {
195
- const r = t.deliveryTypes.join(
196
- ` ${this.$t("_common:and")} `
197
- );
198
- n.push({
199
- title: this.$t("_common:scheduledDelivery"),
200
- content: `${this.$t(
201
- "_common:via"
202
- )} ${r}, ${this.$formatDate(
203
- t.sendAt
204
- )}`,
205
- isFuture: !0,
206
- icon: "calendar",
207
- color: "primary"
208
- });
209
- }
210
- return e == null || e.forEach((r) => n.push(this.formatEvent(r))), n;
211
- }
212
- },
213
- methods: {
214
- formatEvent({ code: n, data: e, createdAt: t, children: i = [] }) {
215
- const {
216
- client: r = {},
217
- clients: u,
218
- email: c,
219
- status: d,
220
- counter: _,
221
- sendSource: h,
222
- companyUserId: y
223
- } = e || {}, m = _ || i.length + 1, o = r.name;
224
- return {
225
- created: () => ({
226
- title: this.$t("_common:created"),
227
- createdAt: t,
228
- icon: "folder",
229
- color: "primary"
230
- }),
231
- viewed: () => ({
232
- title: this.$t("viewed"),
233
- content: (o ? this.$t("viewedContent", { name: o }) : "") + (m ? ` ${this.$tc("_common:times", { count: m })}` : ""),
234
- createdAt: t,
235
- icon: "eye",
236
- color: "primary"
237
- }),
238
- accepted: () => {
239
- var a;
240
- const s = {
241
- title: this.$t("_common:status.signed"),
242
- content: o ? this.$t("byName", { name: o }) : "",
243
- createdAt: t,
244
- icon: "check",
245
- color: "primary"
246
- };
247
- return s.content && ((a = r.answerMethod) == null ? void 0 : a.accept) === "bankId" && (s.content += this.$t("withBankId")), s;
248
- },
249
- denied: () => ({
250
- title: this.$t("_common:status.denied"),
251
- content: o ? this.$t("byName", { name: o }) : "",
252
- createdAt: t,
253
- icon: "x",
254
- color: "primary"
255
- }),
256
- sent: () => {
257
- let s = this.$t("_common:sent");
258
- return ["reminder", "propertyDesignation"].includes(h) && (s = this.$t("_common:sentThing", {
259
- thing: h === "reminder" ? this.$t("_common:reminder") : this.$t("propertyDesignation")
260
- })), {
261
- title: s,
262
- content: u == null ? void 0 : u.map(
263
- (a) => ["email", "cellphone"].filter((l) => !!a[l]).map((l) => a[l]).join(` ${this.$t("_common:and")} `)
264
- ).reduce(
265
- (a, l) => a ? `${a}<div>${l}</div>` : `${this.$t("_common:to")}: ${l}`.capitalize(),
266
- ""
267
- ),
268
- createdAt: t,
269
- icon: h === "reminder" ? "bell" : "send",
270
- color: "primary"
271
- };
272
- },
273
- statusChanged: () => ["accepted", "denied"].includes(d) ? {
274
- title: `${this.$t("statusChanged")} ${this.$t(
275
- `_common:status.${d}`
276
- )}`,
277
- createdAt: t,
278
- icon: d === "accepted" ? "check" : "x",
279
- color: d === "accepted" ? "green" : "red"
280
- } : null,
281
- requestChange: () => {
282
- var a;
283
- const s = ((a = this.userById(y)) == null ? void 0 : a.fullName) || "";
284
- return {
285
- title: `${this.$t("requestChange")} ${this.$t(
286
- `_common:status.${d}`
287
- )}`,
288
- content: s && this.$t("byName", { name: s }),
289
- createdAt: t,
290
- icon: "tool",
291
- color: "primary"
292
- };
293
- },
294
- mailDelivered: () => ({
295
- title: this.$t("_common:sentThing", {
296
- thing: this.$t("_common:email").capitalize()
297
- }),
298
- content: c ? `${this.$t("_common:to")}: ${c}`.capitalize() : "",
299
- createdAt: t,
300
- icon: "inbox",
301
- color: "primary"
302
- }),
303
- mailOpened: () => ({
304
- title: this.$t("mailOpened"),
305
- content: `${this.$t("mailOpenedContent", { email: c })} ${m ? this.$tc("_common:times", { count: m }) : ""}`,
306
- createdAt: t,
307
- icon: "email",
308
- color: "primary"
309
- }),
310
- mailDropped: () => ({
311
- title: this.$t("mailDropped"),
312
- content: c ? this.$t("toEmail", { email: c }) : null,
313
- createdAt: t,
314
- icon: "alert-triangle",
315
- color: "orange"
316
- }),
317
- smsDropped: () => ({
318
- title: this.$t("smsDropped"),
319
- content: e ? `${this.$t("_common:to")}: ${e}`.capitalize() : "",
320
- createdAt: t,
321
- icon: "alert-triangle",
322
- color: "orange"
323
- }),
324
- expired: () => ({
325
- title: this.$t("expired"),
326
- content: this.$t("expiredContent"),
327
- createdAt: t,
328
- icon: "x",
329
- color: "red"
330
- })
331
- }[n]();
332
- }
333
- }
334
- };
335
- var B = function() {
336
- var e = this, t = e._self._c;
337
- return t("div", [t("div", { staticClass: "border-b mb-4 pb-4" }, [t("div", { staticClass: "mb-2" }, [t("div", { staticClass: "text-xs text-gray-600", domProps: { textContent: e._s(e.$t("_common:document").capitalize()) } }), t("div", { staticClass: "font-semibold text-lg" }, [e._v(e._s(e.document.name))])]), t("div", { staticClass: "inline-flex items-center rounded-full bg-gray-100 border-gray-200 -ml-2" }, [t("div", { staticClass: "text-xs text-gray-600 mr-1 py-1 pl-2", domProps: { textContent: e._s(e.$t("_common:status.status")) } }), t("div", { staticClass: "text-xs font-semibold py-1 px-2 bg-gray-300 rounded-r-full", domProps: { textContent: e._s(e.$t(`_common:status.${e.document.status}`)) } })])]), e._l(e.events, function(i, r) {
338
- return t("EventItem", { key: r, attrs: { title: i.title, content: i.content, createdAt: i.createdAt, icon: i.icon, color: i.color, "is-future": i.isFuture, size: "large" } });
339
- })], 2);
340
- }, O = [], E = /* @__PURE__ */ p(
341
- M,
342
- B,
343
- O,
344
- !1,
345
- null,
346
- null,
347
- null,
348
- null
349
- );
350
- const N = E.exports, T = {
351
- name: "DocTimeline",
352
- components: {
353
- DocumentTimeline: N
354
- },
355
- props: {
356
- id: {
357
- type: String,
358
- required: !0
359
- }
360
- }
361
- };
362
- var q = function() {
363
- var e = this, t = e._self._c;
364
- return t("div", { staticClass: "p-8" }, [t("DocumentTimeline", { attrs: { id: e.id } })], 1);
365
- }, F = [], P = /* @__PURE__ */ p(
366
- T,
367
- q,
368
- F,
369
- !1,
370
- null,
371
- null,
372
- null,
373
- null
374
- );
375
- const j = P.exports;
376
- export {
377
- j as default
378
- };