{"version":3,"file":"useLocalizedDayjs-ac174546.js","sources":["../../src/components/ui/ThCard.vue","../../src/components/ui/ThCardBody.vue","../../src/components/ui/ThNotification.vue","../../src/components/UnexpectedErrorNotification.vue","../../src/composables/useLocalizedDayjs.ts"],"sourcesContent":["<script setup lang=\"ts\"></script>\n\n<template>\n  <div class=\"rounded-md border border-gray-400 bg-white text-gray-800 overflow-hidden text-sm\">\n    <slot />\n  </div>\n</template>\n","<script setup lang=\"ts\"></script>\n\n<template>\n  <div class=\"p-4\">\n    <slot />\n  </div>\n</template>\n","<script lang=\"ts\" setup>\nimport { ThIcon } from '@/components/ui'\nimport { computed } from 'vue'\n\nexport interface ThNotificationProps {\n  color: 'info' | 'error' | 'success' | 'warning'\n  isDismissable?: boolean\n  title?: string\n  text?: string\n  actionLabel?: string\n}\n\nconst props = defineProps<ThNotificationProps>()\n\ndefineEmits<{\n  dismiss: [payload: void]\n  'click:action': [payload: void]\n}>()\n\nconst icon = computed(() => {\n  const { color } = props\n\n  if (color === 'info' || color === 'error') {\n    return 'Warning'\n  } else if (color === 'warning') {\n    return 'WarningTriangle'\n  }\n\n  return 'CircleCheck'\n})\n</script>\n\n<template>\n  <div\n    role=\"alert\"\n    :class=\"[\n      'px-4 py-3.5 text-sm text-dark flex border rounded-md items-center text-left',\n      {\n        'bg-pink-25 border-warning': color === 'warning',\n        'bg-red-25 border-error': color === 'error',\n        'bg-slate-300 border-info text-dark': color === 'info'\n      }\n    ]\"\n  >\n    <div class=\"flex items-center mr-auto\">\n      <span\n        class=\"mr-3\"\n        :class=\"{\n          'text-warning': color === 'warning',\n          'text-error': color === 'error',\n          'text-info': color === 'info'\n        }\"\n      >\n        <ThIcon :is=\"icon\" />\n      </span>\n\n      <div>\n        <h4 class=\"font-semibold inline mr-1\">\n          <slot name=\"title\">{{ title }}</slot>\n        </h4>\n\n        <p class=\"inline\" v-if=\"text || $slots.text\">\n          <slot name=\"text\">{{ text }}</slot>\n        </p>\n      </div>\n\n      <div v-if=\"actionLabel\">\n        <button\n          class=\"px-4 text-sm font-medium text-primary whitespace-nowrap\"\n          @click=\"$emit('click:action')\"\n          type=\"button\"\n        >\n          {{ actionLabel }}\n        </button>\n      </div>\n    </div>\n\n    <button\n      class=\"flex items-center justify-center w-7 h-7 rounded ml-2 text-dark\"\n      @click=\"$emit('dismiss')\"\n      v-if=\"isDismissable\"\n      type=\"button\"\n    >\n      <ThIcon is=\"Xmark\" />\n    </button>\n  </div>\n</template>\n","<script setup lang=\"ts\">\nimport { ThNotification } from '@/components/ui'\nimport { useI18n } from '@/plugins/i18n'\nconst { t } = useI18n()\n</script>\n\n<template>\n  <ThNotification\n    data-testid=\"unexpected-error-notification\"\n    color=\"error\"\n    :title=\"t('common.errors.unexpected_error.title')\"\n    :text=\"t('common.errors.unexpected_error.description')\"\n  />\n</template>\n","import { useDayjs } from '@/plugins/dayjs'\nimport { useConfigurationStore } from '@/stores/useConfigurationStore'\nimport { computed } from 'vue'\n/**\n * Returns a dayjs wrapper which creates dates in the merchant's timezone\n */\nexport function useLocalizedDayjs() {\n  const dayjs = useDayjs()\n  const store = useConfigurationStore()\n  const merchantTimezone = computed(() => store.general.default_timezone)\n\n  function localizedDayjs(...args: Parameters<typeof dayjs>) {\n    return dayjs(...args).tz(merchantTimezone.value)\n  }\n\n  Object.assign(localizedDayjs, dayjs)\n\n  return localizedDayjs as typeof dayjs\n}\n"],"names":["_sfc_render","_ctx","_cache","_openBlock","_createElementBlock","_hoisted_1","icon","computed","color","props","t","useI18n","useLocalizedDayjs","dayjs","useDayjs","store","useConfigurationStore","merchantTimezone","localizedDayjs","args"],"mappings":"wnBAGE,SAAAA,EAAAC,EAAAC,EAAA,QACUC,EAAA,EAAAC,EAAA,MAAAC,EAAA,0ECDV,SAAAL,EAAAC,EAAAC,EAAA,QACUC,EAAA,EAAAC,EAAA,MAAAC,EAAA,mUCeNC,EAAOC,EAAS,IAAM,CACpB,KAAA,CAAE,MAAAC,CAAU,EAAAC,EAEd,OAAAD,IAAU,QAAUA,IAAU,QACzB,UACEA,IAAU,UACZ,kBAGF,aAAA,CACR,8jCC1BK,KAAA,CAAE,EAAAE,GAAMC,mOCGP,SAASC,GAAoB,CAClC,MAAMC,EAAQC,IACRC,EAAQC,IACRC,EAAmBV,EAAS,IAAMQ,EAAM,QAAQ,gBAAgB,EAEtE,SAASG,KAAkBC,EAAgC,CACzD,OAAON,EAAM,GAAGM,CAAI,EAAE,GAAGF,EAAiB,KAAK,CACjD,CAEO,cAAA,OAAOC,EAAgBL,CAAK,EAE5BK,CACT"}