@numerum-tech/yeriasdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +864 -0
  2. package/dist/core/action-grid-view.d.ts +57 -0
  3. package/dist/core/action-grid-view.d.ts.map +1 -0
  4. package/dist/core/action-grid-view.js +112 -0
  5. package/dist/core/action-grid-view.js.map +1 -0
  6. package/dist/core/action-list-view.d.ts +39 -0
  7. package/dist/core/action-list-view.d.ts.map +1 -0
  8. package/dist/core/action-list-view.js +77 -0
  9. package/dist/core/action-list-view.js.map +1 -0
  10. package/dist/core/base/base-action-view.d.ts +82 -0
  11. package/dist/core/base/base-action-view.d.ts.map +1 -0
  12. package/dist/core/base/base-action-view.js +143 -0
  13. package/dist/core/base/base-action-view.js.map +1 -0
  14. package/dist/core/base-view.d.ts +105 -0
  15. package/dist/core/base-view.d.ts.map +1 -0
  16. package/dist/core/base-view.js +426 -0
  17. package/dist/core/base-view.js.map +1 -0
  18. package/dist/core/card-view.d.ts +24 -0
  19. package/dist/core/card-view.d.ts.map +1 -0
  20. package/dist/core/card-view.js +127 -0
  21. package/dist/core/card-view.js.map +1 -0
  22. package/dist/core/carousel-view.d.ts +22 -0
  23. package/dist/core/carousel-view.d.ts.map +1 -0
  24. package/dist/core/carousel-view.js +99 -0
  25. package/dist/core/carousel-view.js.map +1 -0
  26. package/dist/core/form-view.d.ts +165 -0
  27. package/dist/core/form-view.d.ts.map +1 -0
  28. package/dist/core/form-view.js +365 -0
  29. package/dist/core/form-view.js.map +1 -0
  30. package/dist/core/jsonapp.d.ts +263 -0
  31. package/dist/core/jsonapp.d.ts.map +1 -0
  32. package/dist/core/jsonapp.js +528 -0
  33. package/dist/core/jsonapp.js.map +1 -0
  34. package/dist/core/key-store.d.ts +51 -0
  35. package/dist/core/key-store.d.ts.map +1 -0
  36. package/dist/core/key-store.js +138 -0
  37. package/dist/core/key-store.js.map +1 -0
  38. package/dist/core/map-view.d.ts +45 -0
  39. package/dist/core/map-view.d.ts.map +1 -0
  40. package/dist/core/map-view.js +318 -0
  41. package/dist/core/map-view.js.map +1 -0
  42. package/dist/core/media-view.d.ts +20 -0
  43. package/dist/core/media-view.d.ts.map +1 -0
  44. package/dist/core/media-view.js +75 -0
  45. package/dist/core/media-view.js.map +1 -0
  46. package/dist/core/message-view.d.ts +53 -0
  47. package/dist/core/message-view.d.ts.map +1 -0
  48. package/dist/core/message-view.js +109 -0
  49. package/dist/core/message-view.js.map +1 -0
  50. package/dist/core/notification.d.ts +17 -0
  51. package/dist/core/notification.d.ts.map +1 -0
  52. package/dist/core/notification.js +33 -0
  53. package/dist/core/notification.js.map +1 -0
  54. package/dist/core/qr-display-view.d.ts +32 -0
  55. package/dist/core/qr-display-view.d.ts.map +1 -0
  56. package/dist/core/qr-display-view.js +66 -0
  57. package/dist/core/qr-display-view.js.map +1 -0
  58. package/dist/core/qr-scan-view.d.ts +148 -0
  59. package/dist/core/qr-scan-view.d.ts.map +1 -0
  60. package/dist/core/qr-scan-view.js +259 -0
  61. package/dist/core/qr-scan-view.js.map +1 -0
  62. package/dist/core/reader-view.d.ts +73 -0
  63. package/dist/core/reader-view.d.ts.map +1 -0
  64. package/dist/core/reader-view.js +285 -0
  65. package/dist/core/reader-view.js.map +1 -0
  66. package/dist/core/timeline-view.d.ts +16 -0
  67. package/dist/core/timeline-view.d.ts.map +1 -0
  68. package/dist/core/timeline-view.js +68 -0
  69. package/dist/core/timeline-view.js.map +1 -0
  70. package/dist/errors/index.d.ts +276 -0
  71. package/dist/errors/index.d.ts.map +1 -0
  72. package/dist/errors/index.js +431 -0
  73. package/dist/errors/index.js.map +1 -0
  74. package/dist/index.d.ts +26 -0
  75. package/dist/index.d.ts.map +1 -0
  76. package/dist/index.js +103 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/types/index.d.ts +576 -0
  79. package/dist/types/index.d.ts.map +1 -0
  80. package/dist/types/index.js +48 -0
  81. package/dist/types/index.js.map +1 -0
  82. package/dist/utils/fileFormats.d.ts +52 -0
  83. package/dist/utils/fileFormats.d.ts.map +1 -0
  84. package/dist/utils/fileFormats.js +198 -0
  85. package/dist/utils/fileFormats.js.map +1 -0
  86. package/dist/utils/logger.d.ts +38 -0
  87. package/dist/utils/logger.d.ts.map +1 -0
  88. package/dist/utils/logger.js +109 -0
  89. package/dist/utils/logger.js.map +1 -0
  90. package/dist/utils/validators.d.ts +48 -0
  91. package/dist/utils/validators.d.ts.map +1 -0
  92. package/dist/utils/validators.js +445 -0
  93. package/dist/utils/validators.js.map +1 -0
  94. package/package.json +65 -0
@@ -0,0 +1,53 @@
1
+ import { BaseView } from './base-view';
2
+ import { SubmitAction, HttpMethod } from '../types';
3
+ export type MessageSeverity = 'info' | 'success' | 'warning' | 'error';
4
+ export interface MessageContent {
5
+ title: string;
6
+ intro: string;
7
+ body: string;
8
+ severity: MessageSeverity;
9
+ confirm: SubmitAction;
10
+ cancel?: SubmitAction;
11
+ canDismiss: boolean;
12
+ meta?: Record<string, unknown>;
13
+ }
14
+ export declare class MessageView extends BaseView {
15
+ constructor(viewId: string, title: string, processId?: string);
16
+ /**
17
+ * Définit le texte d'introduction
18
+ */
19
+ setIntro(intro: string): this;
20
+ /**
21
+ * Définit le corps principal du message
22
+ */
23
+ setBody(body: string): this;
24
+ /**
25
+ * Définit la sévérité du message (info, success, warning, error)
26
+ */
27
+ setSeverity(severity: MessageSeverity): this;
28
+ /**
29
+ * Configure l'action principale (OK)
30
+ */
31
+ setPrimaryAction(text: string, method?: HttpMethod, confirmMessage?: string): this;
32
+ /**
33
+ * Alias de compatibilité avec l'ancienne API
34
+ */
35
+ submitButton(text: string, method?: HttpMethod, confirmMessage?: string): this;
36
+ /**
37
+ * Configure l'action secondaire (Cancel / Reject)
38
+ */
39
+ setSecondaryAction(text: string, method?: HttpMethod, confirmMessage?: string): this;
40
+ /**
41
+ * Supprime l'action secondaire si elle existe
42
+ */
43
+ clearSecondaryAction(): this;
44
+ /**
45
+ * Définit si le message peut être fermé sans action
46
+ */
47
+ setDismissible(dismissible?: boolean): this;
48
+ /**
49
+ * Ajoute des métadonnées spécifiques au message
50
+ */
51
+ setMetadata(metadata: Record<string, unknown>): this;
52
+ }
53
+ //# sourceMappingURL=message-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-view.d.ts","sourceRoot":"","sources":["../../src/core/message-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGpD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEvE,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,qBAAa,WAAY,SAAQ,QAAQ;gBACzB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IAwB7D;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAS3B;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAK5C;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,UAAmB,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAc1F;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,UAAmB,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAItF;;OAEG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,UAAmB,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAc5F;;OAEG;IACH,oBAAoB,IAAI,IAAI;IAK5B;;OAEG;IACH,cAAc,CAAC,WAAW,GAAE,OAAc,GAAG,IAAI;IAKjD;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAKvD"}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MessageView = void 0;
4
+ const base_view_1 = require("./base-view");
5
+ const errors_1 = require("../errors");
6
+ class MessageView extends base_view_1.BaseView {
7
+ constructor(viewId, title, processId) {
8
+ super({
9
+ id: viewId,
10
+ type: 'Message',
11
+ processId,
12
+ metadata: {
13
+ version: '1.0.0',
14
+ createdAt: new Date()
15
+ }
16
+ });
17
+ this.content = {
18
+ title,
19
+ intro: '',
20
+ body: '',
21
+ severity: 'info',
22
+ confirm: {
23
+ text: 'OK',
24
+ method: 'POST'
25
+ },
26
+ canDismiss: false
27
+ };
28
+ }
29
+ /**
30
+ * Définit le texte d'introduction
31
+ */
32
+ setIntro(intro) {
33
+ return this.setIntroText('intro', intro);
34
+ }
35
+ /**
36
+ * Définit le corps principal du message
37
+ */
38
+ setBody(body) {
39
+ if (!body || body.trim().length === 0) {
40
+ throw new errors_1.InvalidParameterError('body', body, 'Message body cannot be empty');
41
+ }
42
+ this.content.body = body.trim();
43
+ return this;
44
+ }
45
+ /**
46
+ * Définit la sévérité du message (info, success, warning, error)
47
+ */
48
+ setSeverity(severity) {
49
+ this.content.severity = severity;
50
+ return this;
51
+ }
52
+ /**
53
+ * Configure l'action principale (OK)
54
+ */
55
+ setPrimaryAction(text, method = 'POST', confirmMessage) {
56
+ if (!text || text.trim().length === 0) {
57
+ throw new errors_1.InvalidParameterError('text', text, 'Primary action text cannot be empty');
58
+ }
59
+ this.content.confirm = {
60
+ text: text.trim(),
61
+ method,
62
+ confirmMessage
63
+ };
64
+ return this;
65
+ }
66
+ /**
67
+ * Alias de compatibilité avec l'ancienne API
68
+ */
69
+ submitButton(text, method = 'POST', confirmMessage) {
70
+ return this.setPrimaryAction(text, method, confirmMessage);
71
+ }
72
+ /**
73
+ * Configure l'action secondaire (Cancel / Reject)
74
+ */
75
+ setSecondaryAction(text, method = 'POST', confirmMessage) {
76
+ if (!text || text.trim().length === 0) {
77
+ throw new errors_1.InvalidParameterError('text', text, 'Secondary action text cannot be empty');
78
+ }
79
+ this.content.cancel = {
80
+ text: text.trim(),
81
+ method,
82
+ confirmMessage
83
+ };
84
+ return this;
85
+ }
86
+ /**
87
+ * Supprime l'action secondaire si elle existe
88
+ */
89
+ clearSecondaryAction() {
90
+ this.content.cancel = undefined;
91
+ return this;
92
+ }
93
+ /**
94
+ * Définit si le message peut être fermé sans action
95
+ */
96
+ setDismissible(dismissible = true) {
97
+ this.content.canDismiss = dismissible;
98
+ return this;
99
+ }
100
+ /**
101
+ * Ajoute des métadonnées spécifiques au message
102
+ */
103
+ setMetadata(metadata) {
104
+ this.content.meta = { ...metadata };
105
+ return this;
106
+ }
107
+ }
108
+ exports.MessageView = MessageView;
109
+ //# sourceMappingURL=message-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-view.js","sourceRoot":"","sources":["../../src/core/message-view.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AAEvC,sCAAkD;AAelD,MAAa,WAAY,SAAQ,oBAAQ;IACrC,YAAY,MAAc,EAAE,KAAa,EAAE,SAAkB;QACzD,KAAK,CAAC;YACF,EAAE,EAAE,MAAM;YACV,IAAI,EAAE,SAAS;YACf,SAAS;YACT,QAAQ,EAAE;gBACN,OAAO,EAAE,OAAO;gBAChB,SAAS,EAAE,IAAI,IAAI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AC;IAED;;OAEG;IACH,YAAY,CAAC,IAAY,EAAE,SAAqB,MAAM,EAAE,cAAuB;QAC3E,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,kBAAkB,CAAC,IAAY,EAAE,SAAqB,MAAM,EAAE,cAAuB;QACjF,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,8BAAqB,CAAC,MAAM,EAAE,IAAI,EAAE,uCAAuC,CAAC,CAAC;QAC3F,CAAC;QAEA,IAAI,CAAC,OAA0B,CAAC,MAAM,GAAG;YACtC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;YACjB,MAAM;YACN,cAAc;SACjB,CAAC;QAEF,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,oBAAoB;QACf,IAAI,CAAC,OAA0B,CAAC,MAAM,GAAG,SAAS,CAAC;QACpD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,cAAuB,IAAI;QACrC,IAAI,CAAC,OAA0B,CAAC,UAAU,GAAG,WAAW,CAAC;QAC1D,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,QAAiC;QACxC,IAAI,CAAC,OAA0B,CAAC,IAAI,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;QACxD,OAAO,IAAI,CAAC;IAChB,CAAC;CAEJ;AArHD,kCAqHC"}
@@ -0,0 +1,17 @@
1
+ import { NotificationPayload } from '../types';
2
+ export declare class Notification {
3
+ private userId;
4
+ private message;
5
+ constructor(userId: string, title: string, body: string, link?: string);
6
+ /**
7
+ * Sets the optional in-app navigation link
8
+ * @param link - Link URL (e.g., "/profile" or "app://view/123")
9
+ * @returns this for chaining
10
+ */
11
+ setLink(link: string): this;
12
+ /**
13
+ * Returns the notification payload as JSON
14
+ */
15
+ toJSON(): NotificationPayload;
16
+ }
17
+ //# sourceMappingURL=notification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../src/core/notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGpE,qBAAa,YAAY;IACrB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAsB;gBAEzB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;IAQtE;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK3B;;OAEG;IACH,MAAM,IAAI,mBAAmB;CAMhC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Notification = void 0;
4
+ const errors_1 = require("../errors");
5
+ class Notification {
6
+ constructor(userId, title, body, link) {
7
+ if (!userId || !title || !body) {
8
+ throw new errors_1.MissingRequiredParameterError('userId, title, and body');
9
+ }
10
+ this.userId = userId;
11
+ this.message = { title, body, link };
12
+ }
13
+ /**
14
+ * Sets the optional in-app navigation link
15
+ * @param link - Link URL (e.g., "/profile" or "app://view/123")
16
+ * @returns this for chaining
17
+ */
18
+ setLink(link) {
19
+ this.message.link = link;
20
+ return this;
21
+ }
22
+ /**
23
+ * Returns the notification payload as JSON
24
+ */
25
+ toJSON() {
26
+ return {
27
+ userId: this.userId,
28
+ message: this.message
29
+ };
30
+ }
31
+ }
32
+ exports.Notification = Notification;
33
+ //# sourceMappingURL=notification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification.js","sourceRoot":"","sources":["../../src/core/notification.ts"],"names":[],"mappings":";;;AACA,sCAA0D;AAE1D,MAAa,YAAY;IAIrB,YAAY,MAAc,EAAE,KAAa,EAAE,IAAY,EAAE,IAAa;QAClE,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;YAC7B,MAAM,IAAI,sCAA6B,CAAC,yBAAyB,CAAC,CAAC;QACvE,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,IAAY;QAChB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,MAAM;QACF,OAAO;YACH,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;SACxB,CAAC;IACN,CAAC;CACJ;AA/BD,oCA+BC"}
@@ -0,0 +1,32 @@
1
+ import { BaseView } from './base-view';
2
+ import { SubmitAction, QRConfig, HttpMethod } from '../types';
3
+ export interface QRDisplayContent {
4
+ title: string;
5
+ intro: string;
6
+ submit?: SubmitAction;
7
+ qrImage: string;
8
+ qrTitle: string;
9
+ qrDescription: string;
10
+ qrConfig?: QRConfig;
11
+ }
12
+ export declare class QRDisplayView extends BaseView {
13
+ constructor(viewId: string, title: string, processId?: string);
14
+ /**
15
+ * Définit l'introduction
16
+ */
17
+ setIntro(intro: string): this;
18
+ /**
19
+ * Defines the submit button for QR display actions
20
+ * Convention: Mobile app POSTs action to {service.baseUrl}/{viewId}
21
+ * Common use cases: Share, Export, etc.
22
+ *
23
+ * @param text - Button text (e.g., "Share", "Export")
24
+ * @param method - HTTP method (default: POST)
25
+ */
26
+ submitButton(text: string, method?: HttpMethod): this;
27
+ /**
28
+ * Sets the QR code to display (replaces any existing QR code)
29
+ */
30
+ setQRCode(qrImage: string, title: string, description: string, config?: QRConfig): this;
31
+ }
32
+ //# sourceMappingURL=qr-display-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qr-display-view.d.ts","sourceRoot":"","sources":["../../src/core/qr-display-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG9D,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACvB;AAED,qBAAa,aAAc,SAAQ,QAAQ;gBAC3B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IAqB7D;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B;;;;;;;OAOG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,UAAmB,GAAG,IAAI;IAS7D;;OAEG;IACH,SAAS,CACL,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,QAAQ,GAClB,IAAI;CAkBV"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QRDisplayView = void 0;
4
+ const base_view_1 = require("./base-view");
5
+ const errors_1 = require("../errors");
6
+ class QRDisplayView extends base_view_1.BaseView {
7
+ constructor(viewId, title, processId) {
8
+ super({
9
+ id: viewId,
10
+ type: 'QRDisplay',
11
+ processId,
12
+ metadata: {
13
+ version: '1.0.0',
14
+ createdAt: new Date()
15
+ }
16
+ });
17
+ this.content = {
18
+ title,
19
+ intro: '',
20
+ submit: undefined,
21
+ qrImage: '',
22
+ qrTitle: '',
23
+ qrDescription: ''
24
+ };
25
+ }
26
+ /**
27
+ * Définit l'introduction
28
+ */
29
+ setIntro(intro) {
30
+ return this.setIntroText('intro', intro);
31
+ }
32
+ /**
33
+ * Defines the submit button for QR display actions
34
+ * Convention: Mobile app POSTs action to {service.baseUrl}/{viewId}
35
+ * Common use cases: Share, Export, etc.
36
+ *
37
+ * @param text - Button text (e.g., "Share", "Export")
38
+ * @param method - HTTP method (default: POST)
39
+ */
40
+ submitButton(text, method = 'POST') {
41
+ this.content.submit = {
42
+ text,
43
+ method
44
+ };
45
+ return this;
46
+ }
47
+ /**
48
+ * Sets the QR code to display (replaces any existing QR code)
49
+ */
50
+ setQRCode(qrImage, title, description, config) {
51
+ if (!qrImage || !title || !description) {
52
+ throw new errors_1.MissingRequiredParameterError('qrImage, title, and description');
53
+ }
54
+ // Validation de l'URL ou base64
55
+ if (!(qrImage.startsWith('http') || qrImage.startsWith('data:image/'))) {
56
+ throw new errors_1.InvalidParameterError('qrImage', qrImage, 'Invalid QR image. Provide a valid URL or base64 string.');
57
+ }
58
+ this.content.qrImage = qrImage;
59
+ this.content.qrTitle = title;
60
+ this.content.qrDescription = description;
61
+ this.content.qrConfig = config;
62
+ return this;
63
+ }
64
+ }
65
+ exports.QRDisplayView = QRDisplayView;
66
+ //# sourceMappingURL=qr-display-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qr-display-view.js","sourceRoot":"","sources":["../../src/core/qr-display-view.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AAEvC,sCAAiF;AAYjF,MAAa,aAAc,SAAQ,oBAAQ;IACvC,YAAY,MAAc,EAAE,KAAa,EAAE,SAAkB;QACzD,KAAK,CAAC;YACF,EAAE,EAAE,MAAM;YACV,IAAI,EAAE,WAAW;YACjB,SAAS;YACT,QAAQ,EAAE;gBACN,OAAO,EAAE,OAAO;gBAChB,SAAS,EAAE,IAAI,IAAI,EAAE;aACxB;SACJ,CAAC,CA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
+ /**
3
+ * QRScanView - A view for scanning QR codes
4
+ *
5
+ * **Design Principles:**
6
+ * - Mobile app handles ALL scanner implementation (camera, torch, focus, formats, UI)
7
+ * - View only describes what to scan and where to submit
8
+ * - Convention: Field name is ALWAYS "qrData" (not configurable)
9
+ * - Auto-submit by default: scan → immediately POST { qrData: "ABC123" }
10
+ * - Submit button disables auto-submit for manual confirmation workflows
11
+ *
12
+ * **Submission Convention:**
13
+ * - Auto-submit: POST {service.baseUrl}/{viewId} with { qrData: "scanned-value" }
14
+ * - With button: User scans, previews, clicks button to submit
15
+ *
16
+ * @example
17
+ * // Simple: Auto-submit after scan
18
+ * const view = new QRScanView('scan-ticket', 'Scan Your Ticket')
19
+ * .setIntro('Point camera at the QR code on your ticket');
20
+ * // → Scans, immediately POSTs { qrData: "ABC123" } to {baseUrl}/scan-ticket
21
+ *
22
+ * @example
23
+ * // Manual confirmation workflow
24
+ * const view = new QRScanView('verify-product', 'Verify Product')
25
+ * .setIntro('Scan the product barcode')
26
+ * .enablePreview(true, 'Product Code')
27
+ * .submitButton('Verify Product');
28
+ * // → Scans, shows preview, user clicks "Verify Product" to submit
29
+ *
30
+ * @example
31
+ * // With validation
32
+ * const view = new QRScanView('scan-invoice', 'Scan Invoice')
33
+ * .setIntro('Scan the invoice QR code')
34
+ * .setValidation(/^INV-\d{6}$/, 'Invalid invoice format')
35
+ * .submitButton('Process Invoice');
36
+ * // → Scans, validates pattern, shows preview, submits on button click
37
+ */
38
+ export declare class QRScanView extends BaseView {
39
+ constructor(viewId: string, title: string, processId?: string);
40
+ /**
41
+ * Sets instructional text shown to the user
42
+ *
43
+ * @param intro - Instructions like "Point your camera at the QR code"
44
+ * @returns this for chaining
45
+ *
46
+ * @example
47
+ * view.setIntro('Scan the code on your membership card');
48
+ */
49
+ setIntro(intro: string): this;
50
+ /**
51
+ * Configures a submit button for manual confirmation
52
+ * **IMPORTANT**: Automatically disables auto-submit when button is added
53
+ * **Note**: QRScan submissions are always POST (convention-based security)
54
+ *
55
+ * @param text - Button text like "Confirm", "Process", "Submit"
56
+ * @param confirmMessage - Optional confirmation dialog
57
+ * @returns this for chaining
58
+ *
59
+ * @example
60
+ * view.submitButton('Verify Code');
61
+ * // User must click button after scanning
62
+ *
63
+ * @example
64
+ * view.submitButton('Process', 'Are you sure?');
65
+ */
66
+ submitButton(text: string, confirmMessage?: string): this;
67
+ /**
68
+ * Sets simple validation rules for scanned data
69
+ * **IMPORTANT**: Mobile app validates client-side for UX, but server MUST re-validate for security
70
+ *
71
+ * @param errorMessage - Error message shown on validation failure
72
+ * @param format - Data format: 'text' (any), 'number' (digits only), 'url' (http/https), 'email' (has @ and .)
73
+ * @param minLength - Minimum length (includes prefix if startsWith is set)
74
+ * @param maxLength - Maximum length (includes prefix if startsWith is set)
75
+ * @param startsWith - Required prefix (exempt from format validation)
76
+ * @returns this for chaining
77
+ *
78
+ * @example
79
+ * // Numeric code with exact length
80
+ * view.setValidation('Code must be 6 digits', 'number', 6, 6);
81
+ * // Accepts: "123456", "000001"
82
+ *
83
+ * @example
84
+ * // Prefix + format + length range
85
+ * view.setValidation('Invalid invoice', 'number', 10, 15, 'INV-');
86
+ * // Accepts: "INV-123456" (10-15 chars total, digits after INV-)
87
+ *
88
+ * @example
89
+ * // Email format
90
+ * view.setValidation('Invalid email format', 'email');
91
+ * // Accepts: "user@example.com" (simple check: has @ and .)
92
+ *
93
+ * @example
94
+ * // URL format
95
+ * view.setValidation('Invalid URL', 'url');
96
+ * // Accepts: "https://example.com" (starts with http:// or https://)
97
+ *
98
+ * @example
99
+ * // Just prefix, any content after
100
+ * view.setValidation('Must start with TICKET-', undefined, undefined, undefined, 'TICKET-');
101
+ * // Accepts: "TICKET-ABC123", "TICKET-XYZ"
102
+ *
103
+ * @example
104
+ * // Length range without format
105
+ * view.setValidation('Code must be 8-20 characters', undefined, 8, 20);
106
+ */
107
+ setValidation(errorMessage: string, format?: 'text' | 'number' | 'url' | 'email', minLength?: number, maxLength?: number, startsWith?: string): this;
108
+ /**
109
+ * Enables preview mode where scanned value is shown before submission
110
+ * **Note**: Requires submit button to be set
111
+ *
112
+ * @param editable - Allow user to manually edit the scanned value
113
+ * @param label - Field label in preview (default: "Scanned Code")
114
+ * @returns this for chaining
115
+ *
116
+ * @example
117
+ * view.enablePreview(true, 'Barcode')
118
+ * .submitButton('Confirm');
119
+ */
120
+ enablePreview(editable?: boolean, label?: string): this;
121
+ /**
122
+ * Disables preview mode
123
+ * @returns this for chaining
124
+ */
125
+ disablePreview(): this;
126
+ /**
127
+ * Explicitly enables or disables auto-submit
128
+ * **Note**: Auto-submit is automatically disabled when submitButton() is called
129
+ *
130
+ * @param enabled - Enable auto-submit (default: true)
131
+ * @returns this for chaining
132
+ *
133
+ * @example
134
+ * // Explicit auto-submit
135
+ * view.setAutoSubmit(true); // Scan → immediate POST
136
+ *
137
+ * @example
138
+ * // Disable auto-submit without button (rare case)
139
+ * view.setAutoSubmit(false);
140
+ */
141
+ setAutoSubmit(enabled?: boolean): this;
142
+ /**
143
+ * Validates the view configuration before serving
144
+ * @internal
145
+ */
146
+ validate(): import('../types').ValidationResult;
147
+ }
148
+ //# sourceMappingURL=qr-scan-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qr-scan-view.d.ts","sourceRoot":"","sources":["../../src/core/qr-scan-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,UAAW,SAAQ,QAAQ;gBACxB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IAkB7D;;;;;;;;OAQG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAiBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;IACH,aAAa,CACT,YAAY,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,EAC5C,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,GACpB,IAAI;IAkDP;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,QAAQ,GAAE,OAAe,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAU9D;;;OAGG;IACH,cAAc,IAAI,IAAI;IAKtB;;;;;;;;;;;;;;OAcG;IACH,aAAa,CAAC,OAAO,GAAE,OAAc,GAAG,IAAI;IAS5C;;;OAGG;IACM,QAAQ,IAAI,OAAO,UAAU,EAAE,gBAAgB;CAyB3D"}