{"version":3,"file":"Review-UKRL5ojw.js","sources":["../../../app/javascript/assets/images/icons/star-1.svg","../../../app/javascript/modules/growthmentor/mentors/components/reviews/PinReviewButton.vue","../../../app/javascript/modules/growthmentor/mentors/components/reviews/ReviewAuthorLinkWrapper.vue"],"sourcesContent":["import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = {\n viewBox: \"0 0 16 16\",\n fill: \"none\"\n}\nconst _hoisted_2 = /*#__PURE__*/_createElementVNode(\"path\", { d: \"M8 .867l2.318 4.696 5.182.753-3.75 3.655.885 5.162L8 12.696l-4.635 2.437.885-5.162L.5 6.316l5.182-.753L8 .867z\" }, null, -1)\nconst _hoisted_3 = [\n _hoisted_2\n]\n\nexport function render(_ctx, _cache) {\n return (_openBlock(), _createElementBlock(\"svg\", _hoisted_1, [..._hoisted_3]))\n}\nexport default { render: render }","<template>\n <button\n class=\"tw-h-max tw-rounded-md tw-p-1 focus:tw-outline-none\"\n :class=\"[\n {\n '!tw-cursor-wait': form.processing,\n },\n limitHit\n ? '!tw-cursor-not-allowed tw-opacity-50'\n : 'focus:tw-ring focus:tw-ring-neutral-200',\n ]\"\n :tabindex=\"limitHit ? -1 : 1\"\n @click=\"pinReview\"\n v-tooltip=\"limitHit ? 'You\\'ve reached limit (3)' : ''\"\n >\n <StarIcon\n class=\"tw-h-4 tw-w-4 tw-transition-colors\"\n :class=\"[\n isPinned\n ? 'tw-fill-current tw-text-neutral-900 hover:tw-text-neutral-700'\n : 'tw-stroke-current tw-text-neutral-400 hover:tw-text-neutral-500',\n ]\"\n />\n </button>\n</template>\n\n<script setup>\nimport StarIcon from '@/assets/images/icons/star-1.svg'\nimport { useForm } from '@inertiajs/vue3'\nimport { usePermissionSystem } from '@/shared/composables/usePermissionSystem.js'\nimport { computed, inject } from 'vue'\n\nconst props = defineProps({\n id: {\n type: Number,\n required: true,\n },\n isPinned: {\n type: Boolean,\n default: false,\n },\n path: {\n type: String,\n required: true,\n },\n})\n\nconst { accessControl } = usePermissionSystem()\nconst form = useForm({})\nconst removeReviewFromFavorites = inject('removeReviewFromFavorites')\nconst addReviewToFavorites = inject('addReviewToFavorites')\n\nconst limitHit = computed(() => {\n return (\n accessControl.value.subscription.privileges.favoritedReviews.limitHit &&\n !props.isPinned\n )\n})\n\nconst pinReview = () => {\n if (form.processing || limitHit.value) {\n return\n }\n\n const options = {\n preserveScroll: true,\n only: ['mentor', 'errors', 'isFavoriteReviewsLimitHit', 'currentUser'],\n }\n\n if (props.isPinned) {\n form.delete(props.path, {\n ...options,\n onSuccess: () => {\n removeReviewFromFavorites(props.id)\n },\n })\n } else {\n form.post(props.path, {\n ...options,\n onSuccess: () => {\n addReviewToFavorites(props.id)\n },\n })\n }\n}\n</script>\n","<template>\n <div>\n <InertiaLink v-if=\"isProfileLinkAttached\" :href=\"profileLink\">\n <slot />\n </InertiaLink>\n <div v-else>\n <slot />\n </div>\n </div>\n</template>\n\n<script setup>\nimport { computed } from 'vue'\nimport { usePermissionSystem } from '@/shared/composables/usePermissionSystem.js'\n\nconst props = defineProps({\n review: {\n type: Object,\n default: () => ({}),\n },\n})\n\nconst { isUserLoggedIn } = usePermissionSystem()\n\nconst isProfileLinkAttached = computed(() => {\n return (\n props.review.authorPremiumOrMentor && props.review.isAuthorProfileComplete\n )\n})\n\nconst profileLink = computed(() => {\n if (!isUserLoggedIn.value && !props.review.isAuthorMentor) {\n return '/community'\n }\n\n return props.review.authorProfileUrl\n})\n</script>\n"],"names":["_hoisted_1","_hoisted_2","_createElementVNode","_hoisted_3","render","_ctx","_cache","_openBlock","_createElementBlock","StarIcon","props","__props","accessControl","usePermissionSystem","form","useForm","removeReviewFromFavorites","inject","addReviewToFavorites","limitHit","computed","pinReview","options","isUserLoggedIn","isProfileLinkAttached","profileLink"],"mappings":"gLAEA,MAAMA,EAAa,CACjB,QAAS,YACT,KAAM,MACR,EACMC,EAA0BC,EAAoB,OAAQ,CAAE,EAAG,kHAAoH,KAAM,EAAE,EACvLC,EAAa,CACjBF,CACF,EAEO,SAASG,EAAOC,EAAMC,EAAQ,CACnC,OAAQC,EAAY,EAAEC,EAAoB,MAAOR,EAAY,CAAC,GAAGG,CAAU,CAAC,CAC9E,CACA,MAAeM,EAAA,CAAE,OAAQL,CAAM,6JCkB/B,MAAMM,EAAQC,EAeR,CAAE,cAAAC,CAAe,EAAGC,EAAqB,EACzCC,EAAOC,EAAQ,EAAE,EACjBC,EAA4BC,EAAO,2BAA2B,EAC9DC,EAAuBD,EAAO,sBAAsB,EAEpDE,EAAWC,EAAS,IAEtBR,EAAc,MAAM,aAAa,WAAW,iBAAiB,UAC7D,CAACF,EAAM,QAEV,EAEKW,EAAY,IAAM,CACtB,GAAIP,EAAK,YAAcK,EAAS,MAC9B,OAGF,MAAMG,EAAU,CACd,eAAgB,GAChB,KAAM,CAAC,SAAU,SAAU,4BAA6B,aAAa,CACtE,EAEGZ,EAAM,SACRI,EAAK,OAAOJ,EAAM,KAAM,CACtB,GAAGY,EACH,UAAW,IAAM,CACfN,EAA0BN,EAAM,EAAE,CACnC,CACP,CAAK,EAEDI,EAAK,KAAKJ,EAAM,KAAM,CACpB,GAAGY,EACH,UAAW,IAAM,CACfJ,EAAqBR,EAAM,EAAE,CAC9B,CACP,CAAK,CAEL,wpBCrEA,MAAMA,EAAQC,EAOR,CAAE,eAAAY,CAAgB,EAAGV,EAAqB,EAE1CW,EAAwBJ,EAAS,IAEnCV,EAAM,OAAO,uBAAyBA,EAAM,OAAO,uBAEtD,EAEKe,EAAcL,EAAS,IACvB,CAACG,EAAe,OAAS,CAACb,EAAM,OAAO,eAClC,aAGFA,EAAM,OAAO,gBACrB"}