@odus/checkout 1.12.0 → 1.14.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 (45) hide show
  1. package/dist/api/getCheckoutDetails.query.d.ts.map +1 -1
  2. package/dist/checkout.es.js +210 -167
  3. package/dist/components/checkout/form/Form.d.ts +17 -0
  4. package/dist/components/checkout/form/Form.d.ts.map +1 -1
  5. package/dist/components/checkout/form/FormComponentManager.d.ts +6 -1
  6. package/dist/components/checkout/form/FormComponentManager.d.ts.map +1 -1
  7. package/dist/components/checkout/form/PaymentMethods.d.ts +2 -0
  8. package/dist/components/checkout/form/PaymentMethods.d.ts.map +1 -1
  9. package/dist/components/payment-methods/applePay/ApplePayButton.d.ts +5 -0
  10. package/dist/components/payment-methods/applePay/ApplePayButton.d.ts.map +1 -1
  11. package/dist/core/api/CheckoutAPI.service.d.ts.map +1 -1
  12. package/dist/core/vgs/VGSCollectService.d.ts +6 -0
  13. package/dist/core/vgs/VGSCollectService.d.ts.map +1 -1
  14. package/dist/core/vgs/vgsCsp.d.ts +17 -0
  15. package/dist/core/vgs/vgsCsp.d.ts.map +1 -0
  16. package/dist/elements/ApplePayElement.d.ts +3 -0
  17. package/dist/elements/ApplePayElement.d.ts.map +1 -1
  18. package/dist/elements/BaseElement.d.ts +15 -0
  19. package/dist/elements/BaseElement.d.ts.map +1 -1
  20. package/dist/elements/CardElement.d.ts +10 -3
  21. package/dist/elements/CardElement.d.ts.map +1 -1
  22. package/dist/elements/OdusElements.d.ts +9 -0
  23. package/dist/elements/OdusElements.d.ts.map +1 -1
  24. package/dist/elements/card/VgsCardAdapter.d.ts +2 -0
  25. package/dist/elements/card/VgsCardAdapter.d.ts.map +1 -1
  26. package/dist/elements.es.js +304 -248
  27. package/dist/phone.js +10 -14
  28. package/dist/services/checkout/Checkout.service.d.ts +2 -0
  29. package/dist/services/checkout/Checkout.service.d.ts.map +1 -1
  30. package/dist/services/checkout/CheckoutForm.service.d.ts +3 -0
  31. package/dist/services/checkout/CheckoutForm.service.d.ts.map +1 -1
  32. package/dist/services/telemetry/CheckoutReadiness.service.d.ts +88 -0
  33. package/dist/services/telemetry/CheckoutReadiness.service.d.ts.map +1 -0
  34. package/dist/services/telemetry/Telemetry.service.d.ts +6 -0
  35. package/dist/services/telemetry/Telemetry.service.d.ts.map +1 -1
  36. package/dist/shared.js +1335 -1026
  37. package/dist/types/api/ApiError.type.d.ts +3 -0
  38. package/dist/types/api/ApiError.type.d.ts.map +1 -1
  39. package/dist/types/telemetry/TelemetryEvents.type.d.ts +189 -1
  40. package/dist/types/telemetry/TelemetryEvents.type.d.ts.map +1 -1
  41. package/dist/utils/helpers/failureCause.util.d.ts +24 -0
  42. package/dist/utils/helpers/failureCause.util.d.ts.map +1 -0
  43. package/dist/utils/helpers/stageFailure.util.d.ts +35 -0
  44. package/dist/utils/helpers/stageFailure.util.d.ts.map +1 -0
  45. package/package.json +2 -2
package/dist/phone.js CHANGED
@@ -815,7 +815,7 @@ var s = (e, t, n) => {
815
815
  [
816
816
  "(\\d{3})(\\d{3,7})",
817
817
  "$1-$2",
818
- ["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],
818
+ ["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28)|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],
819
819
  "0$1"
820
820
  ],
821
821
  [
@@ -1256,7 +1256,7 @@ var s = (e, t, n) => {
1256
1256
  0,
1257
1257
  0,
1258
1258
  [
1259
- ["(?:2(?:04|[23]6|[48]9|5[07]|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\d{6}", [10]],
1259
+ ["(?:2(?:04|[23]6|[48]9|5[07]|[67]3)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\d{6}", [10]],
1260
1260
  ["", [10]],
1261
1261
  ["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}", [10]],
1262
1262
  ["900[2-9]\\d{6}", [10]],
@@ -3147,9 +3147,9 @@ var s = (e, t, n) => {
3147
3147
  "(\\d{2})(\\d{4})(\\d{4})",
3148
3148
  "$1 $2 $3",
3149
3149
  [
3150
- "11|2[02]|33|4[04]|79[1-7]|80[2-46]",
3151
- "11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])",
3152
- "11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"
3150
+ "11|2[02]|33|4[04]|79[1-6]|80[2-46]",
3151
+ "11|2[02]|33|4[04]|79[1-6]|80(?:[2-4]|6[0-589])",
3152
+ "11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9]))|80(?:[2-4]|6[0-589])"
3153
3153
  ],
3154
3154
  "0$1",
3155
3155
  1
@@ -5642,7 +5642,7 @@ var s = (e, t, n) => {
5642
5642
  [[
5643
5643
  "(\\d{2})(\\d{5})",
5644
5644
  "$1 $2",
5645
- ["6[89]|7|8[4-9]|9(?:[1-8]|9[0-8])"]
5645
+ ["6[89]|7|8[4-9]|9(?:[0-8]|9[0-8])"]
5646
5646
  ]]
5647
5647
  ],
5648
5648
  SC: [
@@ -6831,7 +6831,7 @@ var s = (e, t, n) => {
6831
6831
  [
6832
6832
  "(\\d{3})(\\d{3})(\\d{3})",
6833
6833
  "$1 $2 $3",
6834
- ["[357-9]"],
6834
+ ["[1357-9]"],
6835
6835
  "0$1",
6836
6836
  1
6837
6837
  ],
@@ -7058,7 +7058,7 @@ var s = (e, t, n) => {
7058
7058
  ZW: [
7059
7059
  "263",
7060
7060
  "00",
7061
- "(?:13|8\\d{4})\\d{5}|[235-8]\\d{8}|[2-689]\\d{6}",
7061
+ "(?:13|8\\d{4})\\d{5}|[235-8]\\d{8}|[23568]\\d{6}",
7062
7062
  [
7063
7063
  7,
7064
7064
  9,
@@ -7077,12 +7077,6 @@ var s = (e, t, n) => {
7077
7077
  ["2(?:0[45]|[27]|48)|37|675|(?:55|68)[78]"],
7078
7078
  "0$1"
7079
7079
  ],
7080
- [
7081
- "(\\d)(\\d{3})(\\d{2,4})",
7082
- "$1 $2 $3",
7083
- ["[49]"],
7084
- "0$1"
7085
- ],
7086
7080
  [
7087
7081
  "(\\d{3})(\\d{4})",
7088
7082
  "$1 $2",
@@ -9817,6 +9811,7 @@ var Mr = "9", Nr = V(Mr, 15), Pr = /[- ]/, G = !0, Fr = G && function() {
9817
9811
  {
9818
9812
  key: "createTemplateForFormat",
9819
9813
  value: function(e, t) {
9814
+ /* istanbul ignore if */
9820
9815
  if (!(G && e.pattern().indexOf("|") >= 0)) {
9821
9816
  var n = this.getTemplateForFormat(e, t);
9822
9817
  if (n) return this.setNationalNumberTemplate(n, t), !0;
@@ -10043,6 +10038,7 @@ var Zr = "[" + w + C + "]+", Qr = RegExp("^" + Zr + "$", "i"), $r = "(?:[" + T +
10043
10038
  if (!this.hasExtractedNationalSignificantNumber) return this.extractNationalSignificantNumber(e, n);
10044
10039
  if (this.couldPossiblyExtractAnotherNationalSignificantNumber) {
10045
10040
  var r = Fe(e, this.metadata), i = r.nationalPrefix, a = r.nationalNumber, o = r.carrierCode;
10041
+ /* istanbul ignore if */
10046
10042
  if (a !== t) return this.onExtractedNationalNumber(i, o, a, e, n), !0;
10047
10043
  }
10048
10044
  }
@@ -9,6 +9,8 @@ declare class Checkout {
9
9
  private formManager;
10
10
  private stateManager;
11
11
  private sessionId;
12
+ private readiness;
13
+ private associationSequence;
12
14
  constructor(config: CheckoutConfig);
13
15
  private validateConfig;
14
16
  mount(containerId: string): this;
@@ -1 +1 @@
1
- {"version":3,"file":"Checkout.service.d.ts","sourceRoot":"","sources":["../../../src/services/checkout/Checkout.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACf,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAiC7D,cAAM,QAAQ;IACZ,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,EAAE,cAAc;IA2ClC,OAAO,CAAC,cAAc;IA4Bf,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAmDhC,OAAO,IAAI,IAAI;IAwBtB;;;;;;OAMG;YACW,YAAY;IA0E1B;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IA0C7B,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,gBAAgB;IASjB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IASnC,UAAU,IAAI,IAAI;IASlB,MAAM,CAAC,KAAK,EAAE;QAAE,UAAU,CAAC,EAAE,UAAU,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAmB3D,gBAAgB,CAC3B,SAAS,EAAE,MAA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AE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC;IAsIT,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI;CAGjE;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { Appearance, Environment, InitialValues } from '../../types/checkout/CheckoutConfig.type';
2
2
  import { ApplePayData, FormData } from '../../types/common/FormData.type';
3
3
  import { Locale } from '../../types/common/Locale.type';
4
+ import { CheckoutLoadOutcome, SubmitStageResult } from '../../types/telemetry/TelemetryEvents.type';
4
5
  type FormOptions = {
5
6
  locale?: Locale | null;
6
7
  apiKey: string;
@@ -8,6 +9,8 @@ type FormOptions = {
8
9
  environment: Environment;
9
10
  appearance?: Appearance;
10
11
  onLoadingStateChange?: (isLoading: boolean) => void;
12
+ onLoadOutcome?: (outcome: CheckoutLoadOutcome) => void;
13
+ onSubmitOutcome?: (result: SubmitStageResult) => void;
11
14
  paymentId?: string;
12
15
  checkoutKey?: string;
13
16
  checkoutDetails?: {
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutForm.service.d.ts","sourceRoot":"","sources":["../../../src/services/checkout/CheckoutForm.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACd,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAE7D,KAAK,WAAW,GAAG;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB,EAAE,OAAO,CAAC;IAC9B,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,oBAAoB,CAAC,EAAE,CAAC,SAAS,EAAE,OAA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B,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,uBAAuB,EAAE;QACvB,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;KACpC,EACD,eAAe,EAAE;QACf,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;KACrB,EACD,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC;CAqBjB"}
1
+ {"version":3,"file":"CheckoutForm.service.d.ts","sourceRoot":"","sources":["../../../src/services/checkout/CheckoutForm.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACd,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,4CAA4C,CAAC;AAEpD,KAAK,WAAW,GAAG;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB,EAAE,OAAO,CAAC;IAC9B,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,oBAAoB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACpD,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACvD,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC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uB,EAAE;QACvB,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;KACpC,EACD,eAAe,EAAE;QACf,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;KACrB,EACD,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC;CAqBjB"}
@@ -0,0 +1,88 @@
1
+ import { CheckoutLoadFailureReason, CheckoutLoadOutcome, ReadinessOutcome, StageFailure, SubmitStageResult } from '../../types/telemetry/TelemetryEvents.type';
2
+ /**
3
+ * How long a shopper waits for the checkout before the readiness stage ends
4
+ * as `deadline`. It is longer than the 10-second iframe timeout, so that a
5
+ * card failure reports its own reason first. The value is provisional: the
6
+ * objective (#5947) sets it, and changing it is a definition change.
7
+ */
8
+ export declare const READINESS_DEADLINE_MS = 30000;
9
+ type ReadinessFailure = StageFailure<CheckoutLoadFailureReason>;
10
+ /**
11
+ * Sends one readiness outcome per SDK instance, the first submit after it,
12
+ * and the load times — so that the readiness ratio and the load times cannot
13
+ * disagree on what "ready" or "failed" means.
14
+ *
15
+ * The readiness stage starts when the merchant gives the checkout a payment,
16
+ * or when our own code fails first. It ends at the first of:
17
+ *
18
+ * - `ready` — the checkout is associated and on the page, and the caller
19
+ * says that everything it drew is ready.
20
+ * - `failed` — a failure that is ours. A later retry does not undo it.
21
+ * - `deadline` — nothing else happened in time. A failure that is not ours
22
+ * (a `401`, a missing container) does not end the stage, because the
23
+ * merchant may retry; it is carried by the deadline instead.
24
+ * - `left` — the page closed, or the merchant destroyed the checkout.
25
+ *
26
+ * The wait, and so the deadline, starts once the shopper can see the checkout:
27
+ * the later of the stage start and the first mount.
28
+ */
29
+ export declare class CheckoutReadiness {
30
+ private readonly _constructedAt;
31
+ private readonly _deadlineMs;
32
+ private _mountedAt?;
33
+ private _associatedAt?;
34
+ private _stageStarted;
35
+ private _waitStartedAt?;
36
+ private _deadlineTimer?;
37
+ private _paymentId?;
38
+ /**
39
+ * Failures that are not ours and have not recovered, one per reason. Each
40
+ * recovers on its own, and the newest one left names the outcome.
41
+ */
42
+ private readonly _notOurs;
43
+ private _outcome?;
44
+ private _submitReported;
45
+ private readonly _onPageHide;
46
+ constructor({ deadlineMs }?: {
47
+ deadlineMs?: number | undefined;
48
+ });
49
+ /** The readiness outcome, once it is sent. */
50
+ get outcome(): ReadinessOutcome | undefined;
51
+ markMounted(): void;
52
+ /** The association answered, and the answer was usable. */
53
+ markAssociated(): void;
54
+ /** The merchant called `associatePayment()` with a payment and a key. */
55
+ start(paymentId: string): void;
56
+ /** Adapts the outcome that the form and the card element report. */
57
+ settle(outcome: CheckoutLoadOutcome): void;
58
+ /**
59
+ * Counts only once the checkout is both mounted and associated, because
60
+ * before that the shopper cannot pay whatever the card block says.
61
+ */
62
+ ready(): void;
63
+ /** A failure that is ours. It ends the stage, and starts one if needed. */
64
+ fail(failure: ReadinessFailure): void;
65
+ /** A failure that is not ours. The deadline or `left` carries it. */
66
+ exclude(failure: ReadinessFailure): void;
67
+ private _latestNotOurs;
68
+ /** The shopper can no longer wait: the page closed, or the checkout is gone. */
69
+ leave(): void;
70
+ /**
71
+ * Sends the first submit of a session that was ready. A later submit, and
72
+ * a submit in a session that was not ready, sends nothing.
73
+ */
74
+ reportSubmit(result: SubmitStageResult): void;
75
+ private _beginStage;
76
+ private _startWait;
77
+ private _finish;
78
+ /**
79
+ * `checkout.load_time` runs from the SDK constructor to the outcome.
80
+ * `form.render_time` runs from the later of the first mount and the first
81
+ * usable association answer, so it leaves out the API round trip and the
82
+ * time the merchant took to call either. A load that ended before it was
83
+ * mounted and associated never started to render, so it has no render time.
84
+ */
85
+ private _sendLoadTimes;
86
+ }
87
+ export {};
88
+ //# sourceMappingURL=CheckoutReadiness.service.d.ts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K,IAAI,IAAI;IASb,2EAA2E;IAC3E,IAAI,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAerC,qEAAqE;IACrE,OAAO,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAQxC,OAAO,CAAC,cAAc;IAItB,gFAAgF;IAChF,KAAK,IAAI,IAAI;IAcb;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAoB7C,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,UAAU;IAqBlB,OAAO,CAAC,OAAO;IA6Bf;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;CA0BvB"}
@@ -22,6 +22,7 @@ type TelemetryClient = {
22
22
  setView: (view: {
23
23
  name: string;
24
24
  }) => void;
25
+ flush: () => void;
25
26
  };
26
27
  export declare const initializeTelemetry: (config: TelemetryConfig) => TelemetryClient | null;
27
28
  export declare const getTelemetryInstance: () => TelemetryClient | null;
@@ -29,6 +30,11 @@ export declare const pushError: (error: Error, context?: Record<string, string>)
29
30
  export declare const pushEvent: (name: string, attributes?: Record<string, string>) => void;
30
31
  export declare const pushMeasurement: (name: string, value: number, unit?: string, context?: Record<string, string>) => void;
31
32
  export declare const pushLog: (message: string, level?: "info" | "warn" | "error", context?: Record<string, string>) => void;
33
+ /**
34
+ * Sends what is buffered now, instead of at the next batch. The page may be
35
+ * closing, and the transport has already flushed for that.
36
+ */
37
+ export declare const flushTelemetry: () => void;
32
38
  export declare const setView: (name: string) => void;
33
39
  export {};
34
40
  //# sourceMappingURL=Telemetry.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Telemetry.service.d.ts","sourceRoot":"","sources":["../../../src/services/telemetry/Telemetry.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAI5E,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEzD,KAAK,eAAe,GAAG;IACrB,WAAW,EAA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