@documedis/react-components 1.0.0-RC.3 → 1.0.0-RC.4

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.
@@ -4,7 +4,7 @@ interface PrescriptionSignReactProps {
4
4
  environment: Environment;
5
5
  chmed: string;
6
6
  sessionToken?: string;
7
- shouldGeneratePdf?: boolean;
7
+ generatePdf?: boolean;
8
8
  }
9
9
  /**
10
10
  * Props for the usePrescriptionSign hook
@@ -34,9 +34,9 @@ export type UsePrescriptionSigningProps = {
34
34
  * Optional callback invoked when prescription signing succeeds.
35
35
  * Receives the signed CHMED data as a base64-encoded string.
36
36
  * Optionally receives the generatedPdf if the option
37
- * shouldGeneratePdf is set to true.
37
+ * generatePdf is set to true.
38
38
  *
39
- * @see shouldGeneratePdf
39
+ * @see generatePdf
40
40
  */
41
41
  onSuccess?: (signedCHMED: string, generatedPdf?: string) => void;
42
42
  /**
@@ -47,7 +47,7 @@ export type UsePrescriptionSigningProps = {
47
47
  /**
48
48
  * Flag to generate PDF after signing.
49
49
  */
50
- shouldGeneratePdf: boolean;
50
+ generatePdf: boolean;
51
51
  };
52
52
  /**
53
53
  * Props for the PrescriptionSign React component
@@ -4,7 +4,7 @@ import { UsePrescriptionSigningProps } from './types';
4
4
  */
5
5
  export interface UsePrescriptionSignReturn {
6
6
  /** Function to initiate the signing process with CHMED data */
7
- start: (encodedCHMED: string, shouldGeneratePdf: boolean) => void;
7
+ start: (encodedCHMED: string, generatePdf: boolean) => void;
8
8
  /** Function to terminate the signing process at any time */
9
9
  interrupt: () => void;
10
10
  /** Raw XState machine state (for advanced usage) */
package/index.mjs CHANGED
@@ -16778,13 +16778,16 @@ const bF = "opener_origin", wF = "st", Tx = {
16778
16778
  }
16779
16779
  }
16780
16780
  }, kF = Wc(({ input: o, sendBack: n }) => {
16781
- const i = window.location.origin, l = Tx.addOriginParam(
16781
+ const i = window.location.origin;
16782
+ let l = Tx.addOriginParam(
16782
16783
  `${o.hinClient.backendUrl}/login/popup/hin`,
16783
16784
  btoa(i)
16784
- ), f = Tx.addSessionTokenParam(
16785
+ );
16786
+ o.sessionToken && o.sessionToken.length > 0 && (l = Tx.addSessionTokenParam(
16785
16787
  l,
16786
- o.sessionToken || ""
16787
- ), h = window.open(f.toString(), "_blank");
16788
+ o.sessionToken
16789
+ ));
16790
+ const f = l, h = window.open(f.toString(), "_blank");
16788
16791
  if (h)
16789
16792
  n({
16790
16793
  type: "OPEN_POPUP",
@@ -17275,7 +17278,7 @@ const bF = "opener_origin", wF = "st", Tx = {
17275
17278
  const i = await o.hinClient.signPrescription(
17276
17279
  o.sessionToken,
17277
17280
  n,
17278
- o.shouldGeneratePdf
17281
+ o.generatePdf
17279
17282
  );
17280
17283
  return {
17281
17284
  signedPrescription: i.SignedPrescriptionData,
@@ -17339,7 +17342,7 @@ const bF = "opener_origin", wF = "st", Tx = {
17339
17342
  encodedCHMED: void 0,
17340
17343
  signedCHMED: void 0,
17341
17344
  generatedPdf: void 0,
17342
- shouldGeneratePdf: !1,
17345
+ generatePdf: o.generatePdf,
17343
17346
  sessionToken: o.sessionToken,
17344
17347
  accessToken: o.accessToken,
17345
17348
  hinClient: new vF({
@@ -17356,7 +17359,7 @@ const bF = "opener_origin", wF = "st", Tx = {
17356
17359
  target: "Started",
17357
17360
  actions: gi(({ event: o }) => ({
17358
17361
  encodedCHMED: o.encodedCHMED,
17359
- shouldGeneratePdf: o.shouldGeneratePdf
17362
+ generatePdf: o.generatePdf
17360
17363
  }))
17361
17364
  }
17362
17365
  }
@@ -17371,7 +17374,7 @@ const bF = "opener_origin", wF = "st", Tx = {
17371
17374
  generatedPdf: void 0,
17372
17375
  popupRef: null,
17373
17376
  error: void 0,
17374
- shouldGeneratePdf: !1
17377
+ generatePdf: !1
17375
17378
  })
17376
17379
  },
17377
17380
  states: {
@@ -17696,7 +17699,7 @@ const bF = "opener_origin", wF = "st", Tx = {
17696
17699
  hinClient: o.hinClient,
17697
17700
  sessionToken: o.sessionToken,
17698
17701
  recover: n.recoverable || !1,
17699
- shouldGeneratePdf: o.shouldGeneratePdf
17702
+ generatePdf: o.generatePdf
17700
17703
  }),
17701
17704
  onDone: {
17702
17705
  target: "Success",
@@ -17808,11 +17811,11 @@ const FF = (o) => o.replace(/-./g, (n) => n.charAt(1).toUpperCase()), SR = (o) =
17808
17811
  i[f] = y;
17809
17812
  break;
17810
17813
  case "boolean":
17811
- i[l] = y === "" || y === "true";
17814
+ i[f] = y === "" || y === "true";
17812
17815
  break;
17813
17816
  case "number":
17814
17817
  const w = Number(y);
17815
- isNaN(w) || (i[l] = w);
17818
+ isNaN(w) || (i[f] = w);
17816
17819
  break;
17817
17820
  }
17818
17821
  }), i;
@@ -45108,7 +45111,7 @@ const X3 = ({
45108
45111
  sessionToken: l,
45109
45112
  environment: o,
45110
45113
  accessToken: n,
45111
- shouldGeneratePdf: f
45114
+ generatePdf: f
45112
45115
  }
45113
45116
  }), k = me.useCallback(
45114
45117
  (U, ee) => {
@@ -45128,7 +45131,7 @@ const X3 = ({
45128
45131
  document.dispatchEvent(re);
45129
45132
  return;
45130
45133
  }
45131
- w({ type: "START", encodedCHMED: U, shouldGeneratePdf: ee });
45134
+ w({ type: "START", encodedCHMED: U, generatePdf: ee });
45132
45135
  },
45133
45136
  [w]
45134
45137
  ), x = me.useCallback(() => {
@@ -45235,6 +45238,8 @@ Z3(() => MouseEvent);
45235
45238
  const ej = (o) => o.replace(/[A-Z]/g, (n) => `-${n.toLowerCase()}`), tj = (o) => {
45236
45239
  const n = {};
45237
45240
  return Object.entries(o).forEach(([i, l]) => {
45241
+ if (l == null)
45242
+ return;
45238
45243
  const f = ej(i);
45239
45244
  n[f] = String(l);
45240
45245
  }), n;
@@ -46238,17 +46243,17 @@ function Dj(o) {
46238
46243
  onSessionTokenUpdate: f,
46239
46244
  onSuccess: h,
46240
46245
  onError: y,
46241
- shouldGeneratePdf: w
46246
+ generatePdf: w
46242
46247
  } = o, [b, k, x] = Tj(kR, {
46243
46248
  input: {
46244
46249
  sessionToken: l,
46245
46250
  environment: n,
46246
46251
  accessToken: i,
46247
- shouldGeneratePdf: w
46252
+ generatePdf: w
46248
46253
  }
46249
46254
  }), _ = Ld(
46250
46255
  (T, N) => {
46251
- k({ type: "START", encodedCHMED: T, shouldGeneratePdf: N });
46256
+ k({ type: "START", encodedCHMED: T, generatePdf: N });
46252
46257
  },
46253
46258
  [k]
46254
46259
  ), E = Ld(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@documedis/react-components",
3
- "version": "1.0.0-RC.3",
3
+ "version": "1.0.0-RC.4",
4
4
  "description": "React components for Documedis healthcare applications - prescription signing, pharmacy selection, and more",
5
5
  "keywords": [
6
6
  "react",