1import { u as useData } from "./chunk-Ch88nc1G.js"; 2import { s as submitReview } from "./chunk-_qSR0waU.js"; 3import { j as defineComponent, l as toValue, r as ref, c as computed, Q as ApiError, _ as _export_sfc, e as createElementBlock, F as Fragment, f as createBaseVNode, h as toDisplayString, y as createCommentVNode, x as renderList, N as withDirectives, R as vModelText, o as openBlock, v as normalizeClass } from "./chunk-Cy-M6TJt.js"; 4/* empty css */ 5const _sfc_main = /* @__PURE__ */ defineComponent({ 6 __name: "+Page", 7 setup(__props, { expose: __expose }) { 8 __expose(); 9 const { token, tokenInfo } = toValue(useData()); 10 const RATING_HINTS = [ 11 "Click to rate", 12 "1 star. Poor.", 13 "2 stars. Not good enough.", 14 "3 stars. OK.", 15 "4 stars. Good!", 16 "5 stars. Excellent!" 17 ]; 18 const rating = ref(0); 19 const username = ref(""); 20 const comment = ref(""); 21 const submitting = ref(false); 22 const submitted = ref(false); 23 const error = ref(""); 24 const productUrl = ref(tokenInfo.productUrl); 25 const ratingHint = computed(() => RATING_HINTS[rating.value] ?? RATING_HINTS[0]); 26 const canSubmit = computed( 27 () => rating.value >= 1 && username.value.trim().length > 0 && comment.value.trim().length > 0 28 ); 29 async function submit() { 30 if (!canSubmit.value || submitting.value) { 31 return; 32 } 33 submitting.value = true; 34 error.value = ""; 35 try { 36 const result = await submitReview({ 37 token, 38 rating: rating.value, 39 username: username.value.trim(), 40 comment: comment.value.trim() 41 }); 42 productUrl.value = result.productUrl || tokenInfo.productUrl; 43 submitted.value = true; 44 } catch (e) { 45 error.value = e instanceof ApiError && e.status === 410 ? "This review link has already been used." : "Something went wrong. Please try again."; 46 } finally { 47 submitting.value = false; 48 } 49 } 50 const __returned__ = { token, tokenInfo, RATING_HINTS, rating, username, comment, submitting, submitted, error, productUrl, ratingHint, canSubmit, submit }; 51 Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true }); 52 return __returned__; 53 } 54}); 55const _hoisted_1 = { class: "rmc-review-form container" }; 56const _hoisted_2 = { class: "rmc-review-form__product" }; 57const _hoisted_3 = { class: "rmc-review-form__product-name" }; 58const _hoisted_4 = { 59 key: 0, 60 class: "rmc-review-form__product-model" 61}; 62const _hoisted_5 = { class: "rmc-review-form__stars" }; 63const _hoisted_6 = { class: "rmc-review-form__stars-row" }; 64const _hoisted_7 = ["aria-label", "aria-pressed", "onClick"]; 65const _hoisted_8 = { class: "rmc-review-form__hint" }; 66const _hoisted_9 = { class: "rmc-review-form__counter" }; 67const _hoisted_10 = { 68 key: 0, 69 class: "rmc-review-form__error", 70 role: "alert" 71}; 72const _hoisted_11 = { class: "rmc-review-form__actions" }; 73const _hoisted_12 = ["href"]; 74const _hoisted_13 = ["disabled"]; 75const _hoisted_14 = { 76 key: 1, 77 class: "rmc-review-form__thanks" 78}; 79const _hoisted_15 = ["href"]; 80function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { 81 return openBlock(), createElementBlock("div", _hoisted_1, [ 82 !$setup.submitted ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ 83 _cache[3] || (_cache[3] = createBaseVNode("h1", { class: "rmc-review-form__title" }, "How would you rate this product?", -1)), 84 createBaseVNode("p", _hoisted_2, [ 85 createBaseVNode("span", _hoisted_3, toDisplayString($setup.tokenInfo.productName), 1), 86 $setup.tokenInfo.modelNumber ? (openBlock(), createElementBlock("span", _hoisted_4, " Model: #" + toDisplayString($setup.tokenInfo.modelNumber), 1)) : createCommentVNode("", true) 87 ]), 88 createBaseVNode("fieldset", _hoisted_5, [ 89 _cache[2] || (_cache[2] = createBaseVNode("legend", { class: "rmc-review-form__label" }, "Your rating", -1)), 90 createBaseVNode("div", _hoisted_6, [ 91 (openBlock(), createElementBlock(Fragment, null, renderList(5, (star) => { 92 return createBaseVNode("button", { 93 key: star, 94 type: "button", 95 class: normalizeClass(["rmc-review-form__star", { "rmc-review-form__star--on": star <= $setup.rating }]), 96 "aria-label": `${star} star${star > 1 ? "s" : ""}`, 97 "aria-pressed": star === $setup.rating, 98 onClick: ($event) => $setup.rating = star 99 }, " â ", 10, _hoisted_7); 100 }), 64)) 101 ]), 102 createBaseVNode("p", _hoisted_8, toDisplayString($setup.ratingHint), 1) 103 ]), 104 _cache[4] || (_cache[4] = createBaseVNode("label", { 105 class: "rmc-review-form__label", 106 for: "review-username" 107 }, "Full name", -1)), 108 withDirectives(createBaseVNode("input", { 109 id: "review-username", 110 "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.username = $event), 111 type: "text", 112 class: "rmc-review-form__input", 113 maxlength: "100", 114 placeholder: "Full Name" 115 }, null, 512), [ 116 [vModelText, $setup.username] 117 ]), 118 _cache[5] || (_cache[5] = createBaseVNode("label", { 119 class: "rmc-review-form__label", 120 for: "review-comment" 121 }, "Your review", -1)), 122 withDirectives(createBaseVNode("textarea", { 123 id: "review-comment", 124 "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $setup.comment = $event), 125 class: "rmc-review-form__input", 126 rows: "5", 127 maxlength: "2000", 128 placeholder: "Write your comment here..." 129 }, null, 512), [ 130 [vModelText, $setup.comment] 131 ]), 132 createBaseVNode("p", _hoisted_9, toDisplayString($setup.comment.length) + " / 2000", 1), 133 $setup.error ? (openBlock(), createElementBlock("p", _hoisted_10, toDisplayString($setup.error), 1)) : createCommentVNode("", true), 134 createBaseVNode("div", _hoisted_11, [ 135 createBaseVNode("a", { 136 href: $setup.tokenInfo.productUrl, 137 class: "rmc-review-form__cancel" 138 }, "Cancel", 8, _hoisted_12), 139 createBaseVNode("button", { 140 type: "button", 141 class: "rmc-review-form__submit", 142 disabled: !$setup.canSubmit || $setup.submitting, 143 onClick: $setup.submit 144 }, toDisplayString($setup.submitting ? "Submittingâ¦" : "Submit"), 9, _hoisted_13) 145 ]) 146 ], 64)) : (openBlock(), createElementBlock("div", _hoisted_14, [ 147 _cache[6] || (_cache[6] = createBaseVNode("h1", { class: "rmc-review-form__title" }, "Thanks for sharing!", -1)), 148 _cache[7] || (_cache[7] = createBaseVNode("p", null, " Your contribution helps everyone make better decisions about products to get. Your review will appear once it has been reviewed by our team. ", -1)), 149 createBaseVNode("a", { 150 href: $setup.productUrl, 151 class: "rmc-review-form__submit" 152 }, "Done", 8, _hoisted_15) 153 ])) 154 ]); 155} 156const _Page = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-eb13ab31"], ["__file", "+Page.vue"]]); 157const import4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ 158 __proto__: null, 159 default: _Page 160}, Symbol.toStringTag, { value: "Module" })); 161export { 162 import4 as i 163};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.