@mhosaic/feedback 0.20.0 → 0.22.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.
@@ -4817,6 +4817,9 @@ function mountWidget(options) {
4817
4817
  }
4818
4818
 
4819
4819
  // src/core.ts
4820
+ function defaultQaPosition() {
4821
+ return { right: 24 + (48 - 24) / 2, bottom: 24 + 48 + 12 };
4822
+ }
4820
4823
  function createFeedback(config) {
4821
4824
  const env = config.env ?? "prod";
4822
4825
  const locale = config.locale ?? (typeof navigator !== "undefined" ? navigator.language : void 0);
@@ -4877,8 +4880,8 @@ function createFeedback(config) {
4877
4880
  capture_method: captureMethod,
4878
4881
  technical_context
4879
4882
  };
4880
- if ("0.20.0") {
4881
- payload.widget_version = "0.20.0";
4883
+ if ("0.22.0") {
4884
+ payload.widget_version = "0.22.0";
4882
4885
  }
4883
4886
  if (manualScreenshot) payload.screenshot = manualScreenshot;
4884
4887
  if (values.synthetic) payload.synthetic = true;
@@ -4924,6 +4927,22 @@ function createFeedback(config) {
4924
4927
  // live so identity set after createFeedback() is reflected.
4925
4928
  checkVisibility: (externalId) => api.checkVisibility(externalId, user?.email)
4926
4929
  });
4930
+ let qaHandle;
4931
+ let qaDisposed = false;
4932
+ if (config.qaMeter?.source) {
4933
+ const qa = config.qaMeter;
4934
+ const qaLocale = qa.locale ?? (String(locale ?? "").toLowerCase().startsWith("fr") ? "fr" : "en");
4935
+ void import("./qa-meter.mjs").then(({ createQaMeter }) => {
4936
+ if (qaDisposed) return;
4937
+ qaHandle = createQaMeter({
4938
+ source: qa.source,
4939
+ size: qa.size ?? "sm",
4940
+ position: qa.position ?? defaultQaPosition(),
4941
+ locale: qaLocale,
4942
+ ...qa.getCurrentPage && { getCurrentPage: qa.getCurrentPage }
4943
+ });
4944
+ });
4945
+ }
4927
4946
  const instance = {
4928
4947
  show() {
4929
4948
  handle.open();
@@ -4952,6 +4971,8 @@ function createFeedback(config) {
4952
4971
  metadata = { ...metadata, ...kv };
4953
4972
  },
4954
4973
  shutdown() {
4974
+ qaDisposed = true;
4975
+ qaHandle?.dispose();
4955
4976
  handle.dispose();
4956
4977
  capture.dispose();
4957
4978
  host.remove();
@@ -4971,4 +4992,4 @@ function createFeedback(config) {
4971
4992
  export {
4972
4993
  createFeedback
4973
4994
  };
4974
- //# sourceMappingURL=chunk-YV7LMW22.mjs.map
4995
+ //# sourceMappingURL=chunk-6OAG72JW.mjs.map