orionplace-nuxt 0.3.0 → 0.5.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.
- package/README.md +51 -4
- package/bin/orionplace-nuxt.mjs +38 -7
- package/package.json +1 -1
- package/runtime/marketplace.mjs +12 -0
- package/src/install.mjs +5 -4
- package/src/project-readme.mjs +8 -3
- package/src/service.mjs +186 -0
- package/templates/app/components/orionplace/blog/BlogArticle.README.md +1 -1
- package/templates/app/components/orionplace/blog/BlogArticle.vue +78 -1
- package/templates/app/components/orionplace/legal/CookieNotice.README.md +34 -0
- package/templates/app/components/orionplace/legal/CookieNotice.vue +84 -0
- package/templates/app/components/orionplace/legal/StorefrontPrivacy.README.md +35 -0
- package/templates/app/components/orionplace/legal/StorefrontPrivacy.vue +124 -0
- package/templates/app/components/orionplace/products/ProductReviewImageViewer.README.md +3 -2
- package/templates/app/components/orionplace/products/ProductReviewImageViewer.vue +85 -11
- package/templates/app/components/orionplace/storefront/StorefrontFooter.vue +12 -0
- package/templates/app/components/orionplace/subscriptions/StorefrontTariff.vue +21 -1
- package/templates/app/components/orionplace/subscriptions/StorefrontTariffs.vue +23 -2
- package/templates/app/components/orionplace/tariffs/TariffCard.vue +13 -3
- package/templates/app/components/orionplace/tariffs/TariffCardPrices.README.md +1 -1
- package/templates/app/components/orionplace/tariffs/TariffCardPrices.vue +24 -4
- package/templates/app/composables/useOrionplaceSubscriptions.ts +43 -0
- package/templates/app/layouts/default.vue +7 -0
- package/templates/app/pages/privacy.vue +17 -0
- package/templates/app/stores/orionplaceCatalog.ts +20 -0
- package/templates/app/utils/orionplace/blogImageViewer.ts +84 -0
- package/templates/app/utils/orionplace/blogLabels.ts +4 -0
- package/templates/app/utils/orionplace/footerLabels.ts +2 -0
- package/templates/app/utils/orionplace/pageSeo.ts +10 -0
- package/templates/app/utils/orionplace/privacyLabels.ts +198 -0
- package/templates/app/utils/orionplace/reviewLabels.ts +4 -0
- package/templates/app/utils/orionplace/tariffLabels.ts +2 -0
- package/templates/app/utils/orionplace/tariffs.ts +49 -0
- package/templates/orionplace/COMPONENTS.md +13 -3
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, onMounted, ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
import { useOrionplaceSelectionsStore } from '@/stores/orionplaceSelections';
|
|
5
|
+
import {
|
|
6
|
+
COOKIE_NOTICE_STORAGE_KEY,
|
|
7
|
+
privacyLabels,
|
|
8
|
+
} from '@/utils/orionplace/privacyLabels';
|
|
9
|
+
import '@/components/orionplace/shared/features.css';
|
|
10
|
+
|
|
11
|
+
// The storefront sets only necessary cookies, so this is a notice, not a
|
|
12
|
+
// consent form. It appears after mounting and stays away once dismissed.
|
|
13
|
+
const props = withDefaults(defineProps<{ href?: string }>(), {
|
|
14
|
+
href: '/privacy#cookies',
|
|
15
|
+
});
|
|
16
|
+
const emit = defineEmits<{ navigate: [path: string] }>();
|
|
17
|
+
const selectionStore = useOrionplaceSelectionsStore();
|
|
18
|
+
const labels = computed(() => privacyLabels(selectionStore.localeCode).cookie);
|
|
19
|
+
const visible = ref(false);
|
|
20
|
+
|
|
21
|
+
function dismiss() {
|
|
22
|
+
visible.value = false;
|
|
23
|
+
try {
|
|
24
|
+
localStorage.setItem(COOKIE_NOTICE_STORAGE_KEY, '1');
|
|
25
|
+
} catch {
|
|
26
|
+
// Without storage the notice comes back on the next visit.
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function open(event: MouseEvent) {
|
|
31
|
+
if (
|
|
32
|
+
event.ctrlKey ||
|
|
33
|
+
event.metaKey ||
|
|
34
|
+
event.shiftKey ||
|
|
35
|
+
event.altKey ||
|
|
36
|
+
event.button !== 0
|
|
37
|
+
) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
emit('navigate', props.href);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
onMounted(() => {
|
|
45
|
+
try {
|
|
46
|
+
visible.value = localStorage.getItem(COOKIE_NOTICE_STORAGE_KEY) !== '1';
|
|
47
|
+
} catch {
|
|
48
|
+
visible.value = true;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<div
|
|
55
|
+
v-if="visible"
|
|
56
|
+
data-feature-part="CookieNotice"
|
|
57
|
+
role="region"
|
|
58
|
+
:aria-label="labels.label"
|
|
59
|
+
class="
|
|
60
|
+
op-feature fixed inset-x-3 bottom-3 z-40
|
|
61
|
+
flex flex-col items-stretch gap-3
|
|
62
|
+
border border-solid border-orionplace-border
|
|
63
|
+
bg-orionplace-surface p-4 shadow-lg
|
|
64
|
+
sm:left-auto sm:right-5 sm:bottom-5 sm:max-w-[560px]
|
|
65
|
+
sm:flex-row sm:items-center sm:gap-4
|
|
66
|
+
"
|
|
67
|
+
>
|
|
68
|
+
<p class="op-feature-copy op-feature-muted">
|
|
69
|
+
{{ labels.text }}
|
|
70
|
+
<a
|
|
71
|
+
:href="props.href"
|
|
72
|
+
class="whitespace-nowrap text-orionplace-text underline underline-offset-2"
|
|
73
|
+
@click="open"
|
|
74
|
+
>{{ labels.link }}</a>
|
|
75
|
+
</p>
|
|
76
|
+
<button
|
|
77
|
+
type="button"
|
|
78
|
+
class="op-feature-button op-feature-primary shrink-0"
|
|
79
|
+
@click="dismiss"
|
|
80
|
+
>
|
|
81
|
+
{{ labels.ok }}
|
|
82
|
+
</button>
|
|
83
|
+
</div>
|
|
84
|
+
</template>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# StorefrontPrivacy · Nuxt
|
|
2
|
+
|
|
3
|
+
The store's personal data policy with a cookies section and the operator's details.
|
|
4
|
+
|
|
5
|
+
The supplied storefront uses this component at `/privacy`; the footer links it.
|
|
6
|
+
[English guide](https://orionmarket.place/en/sandbox/components/nuxt/privacy-page) ·
|
|
7
|
+
[Russian guide](https://orionmarket.place/ru/sandbox/components/nuxt/privacy-page)
|
|
8
|
+
|
|
9
|
+
## Contract and dependencies
|
|
10
|
+
|
|
11
|
+
The page has no inputs and sends no requests. It lists which data the store
|
|
12
|
+
receives, why, who receives it, how long it is kept, the customer's rights and
|
|
13
|
+
the cookies the site sets. A contents list links every section; the cookies
|
|
14
|
+
section has the anchor `#cookies`, which the cookie notice opens. The operator
|
|
15
|
+
block shows the company name, tax ID, registration number, address and phone
|
|
16
|
+
from `store.init.contact`; empty values are left out.
|
|
17
|
+
|
|
18
|
+
The texts are in `app/utils/orionplace/privacyLabels.ts`, in Russian and
|
|
19
|
+
English. They describe the storefront as supplied: the `sessionid` and
|
|
20
|
+
`csrftoken` cookies and the notice's own local storage mark. A store that adds
|
|
21
|
+
analytics, chat widgets or other cookies lists them in the cookies section.
|
|
22
|
+
|
|
23
|
+
Source is maintained in
|
|
24
|
+
`app/components/orionplace/legal/StorefrontPrivacy.vue`; the primary interface is `app/interfaces/orionplace/appBase/appLoadCommon/IAppLoadCommonContact.ts`.
|
|
25
|
+
|
|
26
|
+
The configured Nuxt starter initializes Application Load and its named API client.
|
|
27
|
+
Component-source ZIPs contain imported children, types,
|
|
28
|
+
composables, labels and styles. The included `orionplace/COMPONENT-DOWNLOAD.md`
|
|
29
|
+
describes dependencies, theme and consumer configuration. Standalone file
|
|
30
|
+
copying requires the same dependencies. Links to storefront routes use the
|
|
31
|
+
pages supplied by the full starter.
|
|
32
|
+
|
|
33
|
+
## Endpoint coverage
|
|
34
|
+
|
|
35
|
+
None: the page reads the Application Load contact details.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
import { useOrionplaceStore } from '@/stores/orionplace';
|
|
5
|
+
import { useOrionplaceSelectionsStore } from '@/stores/orionplaceSelections';
|
|
6
|
+
import { contactLabels } from '@/utils/orionplace/contactLabels';
|
|
7
|
+
import { privacyLabels } from '@/utils/orionplace/privacyLabels';
|
|
8
|
+
import '@/components/orionplace/shared/features.css';
|
|
9
|
+
|
|
10
|
+
const store = useOrionplaceStore();
|
|
11
|
+
const selectionStore = useOrionplaceSelectionsStore();
|
|
12
|
+
const contact = computed(() => store.init?.contact);
|
|
13
|
+
const company = computed(
|
|
14
|
+
() =>
|
|
15
|
+
contact.value?.company_legal_name?.trim() ||
|
|
16
|
+
contact.value?.company_name?.trim() ||
|
|
17
|
+
'',
|
|
18
|
+
);
|
|
19
|
+
const labels = computed(() =>
|
|
20
|
+
privacyLabels(selectionStore.localeCode, company.value),
|
|
21
|
+
);
|
|
22
|
+
const fields = computed(() => contactLabels(selectionStore.localeCode));
|
|
23
|
+
// The operator's details as the platform sends them; empty rows are left out.
|
|
24
|
+
const details = computed(() =>
|
|
25
|
+
[
|
|
26
|
+
[fields.value.legalName, company.value],
|
|
27
|
+
[fields.value.taxId, contact.value?.company_tax_id],
|
|
28
|
+
[fields.value.registrationNumber, contact.value?.company_organization_id],
|
|
29
|
+
[fields.value.address, contact.value?.company_contact_address],
|
|
30
|
+
[fields.value.phone, contact.value?.company_contact_phone],
|
|
31
|
+
]
|
|
32
|
+
.map(([label, value]) => ({ label, value: value?.trim() ?? '' }))
|
|
33
|
+
.filter((row) => row.value),
|
|
34
|
+
);
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<section
|
|
39
|
+
data-feature-part="StorefrontPrivacy"
|
|
40
|
+
class="op-feature grid w-full @container"
|
|
41
|
+
>
|
|
42
|
+
<header
|
|
43
|
+
class="
|
|
44
|
+
grid gap-3
|
|
45
|
+
border-0 border-b border-solid border-orionplace-border
|
|
46
|
+
mb-8 pb-6 @min-[592px]:mb-12 @min-[592px]:pb-8
|
|
47
|
+
"
|
|
48
|
+
>
|
|
49
|
+
<h1 class="op-feature-title">{{ labels.title }}</h1>
|
|
50
|
+
<p class="op-feature-copy op-feature-muted max-w-2xl">{{ labels.lead }}</p>
|
|
51
|
+
</header>
|
|
52
|
+
|
|
53
|
+
<div
|
|
54
|
+
class="
|
|
55
|
+
grid items-start gap-10
|
|
56
|
+
@min-[960px]:grid-cols-[minmax(0,3fr)_minmax(0,9fr)] @min-[960px]:gap-16
|
|
57
|
+
"
|
|
58
|
+
>
|
|
59
|
+
<nav
|
|
60
|
+
:aria-label="labels.contents"
|
|
61
|
+
class="grid gap-3 @min-[960px]:sticky @min-[960px]:top-6"
|
|
62
|
+
>
|
|
63
|
+
<h2 class="op-feature-subtitle op-feature-muted">{{ labels.contents }}</h2>
|
|
64
|
+
<ol class="m-0 grid list-none gap-2 p-0">
|
|
65
|
+
<li
|
|
66
|
+
v-for="section in labels.sections"
|
|
67
|
+
:key="section.id"
|
|
68
|
+
>
|
|
69
|
+
<a
|
|
70
|
+
:href="`#${section.id}`"
|
|
71
|
+
class="
|
|
72
|
+
text-orionplace-text no-underline outline-none
|
|
73
|
+
hover:underline focus-visible:underline
|
|
74
|
+
"
|
|
75
|
+
>{{ section.title }}</a>
|
|
76
|
+
</li>
|
|
77
|
+
</ol>
|
|
78
|
+
</nav>
|
|
79
|
+
|
|
80
|
+
<article class="grid min-w-0 max-w-3xl gap-8">
|
|
81
|
+
<section
|
|
82
|
+
v-for="section in labels.sections"
|
|
83
|
+
:id="section.id"
|
|
84
|
+
:key="section.id"
|
|
85
|
+
class="grid scroll-mt-6 gap-3"
|
|
86
|
+
>
|
|
87
|
+
<h2 class="op-feature-subtitle">{{ section.title }}</h2>
|
|
88
|
+
<p
|
|
89
|
+
v-for="(line, index) in section.text"
|
|
90
|
+
:key="index"
|
|
91
|
+
class="op-feature-copy"
|
|
92
|
+
>
|
|
93
|
+
{{ line }}
|
|
94
|
+
</p>
|
|
95
|
+
</section>
|
|
96
|
+
|
|
97
|
+
<section
|
|
98
|
+
id="operator-details"
|
|
99
|
+
class="op-feature-panel grid gap-3"
|
|
100
|
+
>
|
|
101
|
+
<h2 class="op-feature-subtitle">{{ labels.operator }}</h2>
|
|
102
|
+
<dl
|
|
103
|
+
v-if="details.length"
|
|
104
|
+
class="m-0 grid gap-x-6 gap-y-2 @min-[592px]:grid-cols-[auto_1fr]"
|
|
105
|
+
>
|
|
106
|
+
<template
|
|
107
|
+
v-for="row in details"
|
|
108
|
+
:key="row.label"
|
|
109
|
+
>
|
|
110
|
+
<dt class="op-feature-muted">{{ row.label }}</dt>
|
|
111
|
+
<dd class="m-0 break-words">{{ row.value }}</dd>
|
|
112
|
+
</template>
|
|
113
|
+
</dl>
|
|
114
|
+
<p
|
|
115
|
+
v-else
|
|
116
|
+
class="op-feature-copy op-feature-muted"
|
|
117
|
+
>
|
|
118
|
+
{{ labels.operatorUnknown }}
|
|
119
|
+
</p>
|
|
120
|
+
</section>
|
|
121
|
+
</article>
|
|
122
|
+
</div>
|
|
123
|
+
</section>
|
|
124
|
+
</template>
|
|
@@ -4,7 +4,8 @@ The photos of one review, shown large on the page they were opened from.
|
|
|
4
4
|
|
|
5
5
|
The supplied storefront uses this component at `/product/:id` and
|
|
6
6
|
`/sellers?seller=<id>`, inside `ProductReviews`, and on `/product/:id` for the
|
|
7
|
-
product's own photos, inside `StorefrontProduct
|
|
7
|
+
product's own photos, inside `StorefrontProduct`, and on `/journal/:id` for the
|
|
8
|
+
images of an article, inside `BlogArticle`.
|
|
8
9
|
[English guide](https://orionmarket.place/en/sandbox/components/nuxt/product-review-image-viewer) ·
|
|
9
10
|
[Russian guide](https://orionmarket.place/ru/sandbox/components/nuxt/product-review-image-viewer)
|
|
10
11
|
|
|
@@ -25,7 +26,7 @@ around the viewer emit `close`; the parent removes the component, which
|
|
|
25
26
|
returns the focus to the photo that opened it. Changing the photo emits
|
|
26
27
|
`change` with its `id` and its position. A sideways swipe on the large photo
|
|
27
28
|
shows the next or previous one. `label` replaces the dialog name and `alt` the
|
|
28
|
-
photo text: the product page passes «Product photos» and the product name.
|
|
29
|
+
photo text: the product page passes «Product photos» and the product name. `captions` puts a caption under each photo and `wide` lets the viewer use up to 1600px of the screen width instead of 960px and adds full-size zoom: the magnifier button or a click on the image shows it at its own size, scrolling inside the viewer, and another photo opens fitted again; `BlogArticle` passes both for the images of an article.
|
|
29
30
|
|
|
30
31
|
While the viewer is open the page behind it does not scroll, and its scrollbar
|
|
31
32
|
space is kept, so opening and closing the viewer does not move the page. The
|
|
@@ -12,14 +12,18 @@
|
|
|
12
12
|
import OrionplaceImage from '@/components/orionplace/shared/OrionplaceImage.vue';
|
|
13
13
|
|
|
14
14
|
// `label` and `alt` name the product's own photos on the product page.
|
|
15
|
+
// `captions` are shown under each image (blog article images have them);
|
|
16
|
+
// `wide` lets screenshots and other detailed images use more of the screen.
|
|
15
17
|
const props = withDefaults(
|
|
16
18
|
defineProps<{
|
|
17
19
|
images: IProductFeedbackImage[];
|
|
18
20
|
index?: number;
|
|
19
21
|
label?: string;
|
|
20
22
|
alt?: string;
|
|
23
|
+
captions?: string[];
|
|
24
|
+
wide?: boolean;
|
|
21
25
|
}>(),
|
|
22
|
-
{ index: 0 },
|
|
26
|
+
{ index: 0, captions: () => [], wide: false },
|
|
23
27
|
);
|
|
24
28
|
const emit = defineEmits<{
|
|
25
29
|
change: [photo: { id: number; index: number }];
|
|
@@ -33,6 +37,13 @@
|
|
|
33
37
|
const active = ref(startIndex());
|
|
34
38
|
const current = computed(() => props.images[active.value]);
|
|
35
39
|
const several = computed(() => props.images.length > 1);
|
|
40
|
+
const caption = computed(() => props.captions[active.value]?.trim() ?? '');
|
|
41
|
+
// A wide viewer can show the image at its own size; the stage then scrolls.
|
|
42
|
+
const zoomed = ref(false);
|
|
43
|
+
|
|
44
|
+
function toggleZoom() {
|
|
45
|
+
zoomed.value = props.wide && !zoomed.value;
|
|
46
|
+
}
|
|
36
47
|
// The element that opened the viewer receives the focus back on close.
|
|
37
48
|
let opener: HTMLElement | undefined;
|
|
38
49
|
|
|
@@ -83,7 +94,7 @@
|
|
|
83
94
|
const start = swipeStart;
|
|
84
95
|
|
|
85
96
|
swipeStart = undefined;
|
|
86
|
-
if (!start || !touch || !several.value) {
|
|
97
|
+
if (!start || !touch || !several.value || zoomed.value) {
|
|
87
98
|
return;
|
|
88
99
|
}
|
|
89
100
|
select(
|
|
@@ -147,6 +158,11 @@
|
|
|
147
158
|
},
|
|
148
159
|
);
|
|
149
160
|
|
|
161
|
+
// Another photo opens fitted to the screen.
|
|
162
|
+
watch(active, () => {
|
|
163
|
+
zoomed.value = false;
|
|
164
|
+
});
|
|
165
|
+
|
|
150
166
|
onMounted(() => {
|
|
151
167
|
if (typeof document === 'undefined') {
|
|
152
168
|
return;
|
|
@@ -172,12 +188,13 @@
|
|
|
172
188
|
ref="dialog"
|
|
173
189
|
class="
|
|
174
190
|
m-auto box-border h-[calc(100dvh-32px)] max-h-none
|
|
175
|
-
w-[calc(100vw-32px)]
|
|
191
|
+
w-[calc(100vw-32px)]
|
|
176
192
|
overflow-hidden rounded-none p-0
|
|
177
193
|
border border-solid border-orionplace-border
|
|
178
194
|
bg-orionplace-surface font-orionplace text-orionplace-text
|
|
179
195
|
backdrop:bg-black/35 backdrop:backdrop-blur-[2px]
|
|
180
196
|
"
|
|
197
|
+
:class="wide ? 'max-w-[1600px]' : 'max-w-[960px]'"
|
|
181
198
|
:aria-label="label || labels.photoViewer"
|
|
182
199
|
data-feature-part="ProductReviewImageViewer"
|
|
183
200
|
data-review-image-viewer
|
|
@@ -192,7 +209,7 @@
|
|
|
192
209
|
<div
|
|
193
210
|
class="
|
|
194
211
|
@container/review-image-viewer
|
|
195
|
-
grid h-full grid-rows-[auto_minmax(0,1fr)
|
|
212
|
+
grid h-full grid-rows-[auto_minmax(0,1fr)_auto_auto]
|
|
196
213
|
"
|
|
197
214
|
>
|
|
198
215
|
<header
|
|
@@ -212,6 +229,41 @@
|
|
|
212
229
|
>
|
|
213
230
|
{{ active + 1 }} / {{ images.length }}
|
|
214
231
|
</p>
|
|
232
|
+
<button
|
|
233
|
+
v-if="wide"
|
|
234
|
+
type="button"
|
|
235
|
+
class="
|
|
236
|
+
ml-auto grid h-10 w-10 shrink-0 place-items-center
|
|
237
|
+
cursor-pointer border-0 bg-transparent p-0
|
|
238
|
+
text-orionplace-text
|
|
239
|
+
outline-none transition-colors motion-reduce:transition-none
|
|
240
|
+
hover:bg-orionplace-hover focus-visible:bg-orionplace-hover
|
|
241
|
+
"
|
|
242
|
+
:aria-label="zoomed ? labels.zoomOut : labels.zoomIn"
|
|
243
|
+
:aria-pressed="zoomed"
|
|
244
|
+
data-review-image-zoom
|
|
245
|
+
@click="toggleZoom"
|
|
246
|
+
>
|
|
247
|
+
<svg
|
|
248
|
+
viewBox="0 0 24 24"
|
|
249
|
+
class="h-5 w-5"
|
|
250
|
+
fill="none"
|
|
251
|
+
stroke="currentColor"
|
|
252
|
+
stroke-width="1.5"
|
|
253
|
+
aria-hidden="true"
|
|
254
|
+
>
|
|
255
|
+
<circle
|
|
256
|
+
cx="10.5"
|
|
257
|
+
cy="10.5"
|
|
258
|
+
r="6.5"
|
|
259
|
+
/>
|
|
260
|
+
<path d="m15.5 15.5 5 5M7.5 10.5h6" />
|
|
261
|
+
<path
|
|
262
|
+
v-if="!zoomed"
|
|
263
|
+
d="M10.5 7.5v6"
|
|
264
|
+
/>
|
|
265
|
+
</svg>
|
|
266
|
+
</button>
|
|
215
267
|
<button
|
|
216
268
|
type="button"
|
|
217
269
|
class="
|
|
@@ -234,18 +286,30 @@
|
|
|
234
286
|
p-4 @min-[606px]/review-image-viewer:px-20
|
|
235
287
|
select-none
|
|
236
288
|
"
|
|
237
|
-
:class="{ 'touch-pan-y': several }"
|
|
289
|
+
:class="{ 'touch-pan-y': several && !zoomed }"
|
|
238
290
|
data-review-image-stage
|
|
239
291
|
@touchstart.passive="startSwipe"
|
|
240
292
|
@touchend="endSwipe"
|
|
241
293
|
>
|
|
242
|
-
|
|
294
|
+
<!-- At full size the image scrolls inside the stage; the arrows stay in place. -->
|
|
295
|
+
<div
|
|
243
296
|
v-if="current"
|
|
244
|
-
:
|
|
245
|
-
:
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
297
|
+
:class="zoomed ? 'absolute inset-0 overflow-auto' : 'contents'"
|
|
298
|
+
:data-review-image-zoomed="zoomed || undefined"
|
|
299
|
+
>
|
|
300
|
+
<OrionplaceImage
|
|
301
|
+
:key="current.id"
|
|
302
|
+
:src="current.image"
|
|
303
|
+
:alt="photoLabel(active)"
|
|
304
|
+
:class="[
|
|
305
|
+
zoomed
|
|
306
|
+
? 'm-auto block h-auto w-auto max-h-none! max-w-none!'
|
|
307
|
+
: 'block h-full max-h-full w-full object-contain',
|
|
308
|
+
wide && (zoomed ? 'cursor-zoom-out' : 'cursor-zoom-in'),
|
|
309
|
+
]"
|
|
310
|
+
@click="toggleZoom"
|
|
311
|
+
/>
|
|
312
|
+
</div>
|
|
249
313
|
<template v-if="several">
|
|
250
314
|
<button
|
|
251
315
|
type="button"
|
|
@@ -285,6 +349,16 @@
|
|
|
285
349
|
</button>
|
|
286
350
|
</template>
|
|
287
351
|
</div>
|
|
352
|
+
<p
|
|
353
|
+
v-if="caption"
|
|
354
|
+
class="
|
|
355
|
+
m-0 px-4 pt-1 pb-3 text-center text-sm leading-6
|
|
356
|
+
text-orionplace-muted
|
|
357
|
+
"
|
|
358
|
+
data-review-image-caption
|
|
359
|
+
>
|
|
360
|
+
{{ caption }}
|
|
361
|
+
</p>
|
|
288
362
|
<ol
|
|
289
363
|
v-if="several"
|
|
290
364
|
class="
|
|
@@ -205,6 +205,18 @@
|
|
|
205
205
|
>
|
|
206
206
|
{{ copy.contact }}
|
|
207
207
|
</a>
|
|
208
|
+
<a
|
|
209
|
+
:href="route('/privacy')"
|
|
210
|
+
class="
|
|
211
|
+
w-fit
|
|
212
|
+
text-sm leading-6 text-orionplace-inverse-text no-underline
|
|
213
|
+
outline-none
|
|
214
|
+
hover:text-orionplace-inverse-muted
|
|
215
|
+
focus-visible:text-orionplace-inverse-muted
|
|
216
|
+
"
|
|
217
|
+
>
|
|
218
|
+
{{ copy.privacy }}
|
|
219
|
+
</a>
|
|
208
220
|
</nav>
|
|
209
221
|
</div>
|
|
210
222
|
<p
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
tariffMediaItems,
|
|
21
21
|
tariffPagePath,
|
|
22
22
|
} from '@/utils/orionplace/tariffPage';
|
|
23
|
+
import { tariffResumable } from '@/utils/orionplace/tariffs';
|
|
23
24
|
import {
|
|
24
25
|
getAvailableNestedValueFromObject,
|
|
25
26
|
plainText,
|
|
@@ -74,6 +75,18 @@
|
|
|
74
75
|
const tariff = computed(() =>
|
|
75
76
|
confirmed.value ? catalogStore.getTariff(props.tariffId) : undefined,
|
|
76
77
|
);
|
|
78
|
+
/*
|
|
79
|
+
* A trial chosen before sign-in opens again only once the customer's
|
|
80
|
+
* subscription records are known and the customer is new to this one;
|
|
81
|
+
* the backend refuses a trial to a returning customer.
|
|
82
|
+
*/
|
|
83
|
+
const resumable = computed(() =>
|
|
84
|
+
tariffResumable(
|
|
85
|
+
props.resume,
|
|
86
|
+
tariff.value,
|
|
87
|
+
catalogStore.usedSubscriptionsOf(store.profile?.id),
|
|
88
|
+
),
|
|
89
|
+
);
|
|
77
90
|
// The heading names the plan; `tariff_title` is its SEO page title.
|
|
78
91
|
const title = computed(
|
|
79
92
|
() =>
|
|
@@ -190,6 +203,7 @@
|
|
|
190
203
|
if (!confirmed.value) {
|
|
191
204
|
void load();
|
|
192
205
|
}
|
|
206
|
+
void account.loadUsed();
|
|
193
207
|
});
|
|
194
208
|
|
|
195
209
|
watch(media, () => {
|
|
@@ -201,7 +215,13 @@
|
|
|
201
215
|
}
|
|
202
216
|
});
|
|
203
217
|
watch(
|
|
204
|
-
() =>
|
|
218
|
+
() => store.profile?.id,
|
|
219
|
+
() => {
|
|
220
|
+
void account.loadUsed();
|
|
221
|
+
},
|
|
222
|
+
);
|
|
223
|
+
watch(
|
|
224
|
+
resumable,
|
|
205
225
|
(value) => {
|
|
206
226
|
if (
|
|
207
227
|
value?.tariff === props.tariffId &&
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, onMounted, ref } from 'vue';
|
|
2
|
+
import { computed, onMounted, ref, watch } from 'vue';
|
|
3
3
|
import { NuxtLink } from '#components';
|
|
4
4
|
import { useOrionplaceStore } from '@/stores/orionplace';
|
|
5
5
|
import { useOrionplaceCatalogStore } from '@/stores/orionplaceCatalog';
|
|
6
6
|
import { useOrionplaceSelectionsStore } from '@/stores/orionplaceSelections';
|
|
7
7
|
import { useOrionplaceSubscriptions } from '@/composables/useOrionplaceSubscriptions';
|
|
8
|
+
import { tariffResumable } from '@/utils/orionplace/tariffs';
|
|
8
9
|
import {
|
|
9
10
|
useOrionplaceFeatureApi,
|
|
10
11
|
useOrionplaceTask,
|
|
@@ -47,7 +48,20 @@
|
|
|
47
48
|
const busy = computed(() =>
|
|
48
49
|
Boolean(task.state.pending || account.task.state.pending),
|
|
49
50
|
);
|
|
50
|
-
|
|
51
|
+
/*
|
|
52
|
+
* The choice to reopen after sign-in. A trial waits for the customer's
|
|
53
|
+
* subscription records and opens only for a customer new to the record;
|
|
54
|
+
* the backend refuses a trial to a returning customer.
|
|
55
|
+
*/
|
|
56
|
+
const open = computed(() =>
|
|
57
|
+
guest.value
|
|
58
|
+
? undefined
|
|
59
|
+
: tariffResumable(
|
|
60
|
+
props.resume,
|
|
61
|
+
props.resume && catalogStore.getTariff(props.resume.tariff),
|
|
62
|
+
catalogStore.usedSubscriptionsOf(store.profile?.id),
|
|
63
|
+
),
|
|
64
|
+
);
|
|
51
65
|
// The plans this page shows: every loaded plan, or only the requested IDs.
|
|
52
66
|
const shown = computed(() => {
|
|
53
67
|
const data = catalogStore.tariffs?.data ?? [];
|
|
@@ -141,7 +155,14 @@
|
|
|
141
155
|
if (!catalogStore.tariffs || catalogStore.tariffsSnapshot) {
|
|
142
156
|
void load();
|
|
143
157
|
}
|
|
158
|
+
void account.loadUsed();
|
|
144
159
|
});
|
|
160
|
+
watch(
|
|
161
|
+
() => store.profile?.id,
|
|
162
|
+
() => {
|
|
163
|
+
void account.loadUsed();
|
|
164
|
+
},
|
|
165
|
+
);
|
|
145
166
|
</script>
|
|
146
167
|
<template>
|
|
147
168
|
<section
|
|
@@ -104,11 +104,13 @@
|
|
|
104
104
|
<script setup lang="ts">
|
|
105
105
|
import { computed, ref, watch } from 'vue';
|
|
106
106
|
import { NuxtLink } from '#components';
|
|
107
|
+
import { useOrionplaceStore } from '@/stores/orionplace';
|
|
107
108
|
import { useOrionplaceCatalogStore } from '@/stores/orionplaceCatalog';
|
|
108
109
|
import { useOrionplaceSelectionsStore } from '@/stores/orionplaceSelections';
|
|
109
110
|
import {
|
|
110
111
|
tariffIsOpen,
|
|
111
112
|
tariffSubscribeRequest,
|
|
113
|
+
tariffTrialOpen,
|
|
112
114
|
} from '@/utils/orionplace/tariffs';
|
|
113
115
|
import {
|
|
114
116
|
tariffDays,
|
|
@@ -164,6 +166,7 @@
|
|
|
164
166
|
select: [selection: ITariffSelection];
|
|
165
167
|
subscribe: [request: ITariffSubscribeRequest];
|
|
166
168
|
}>();
|
|
169
|
+
const store = useOrionplaceStore();
|
|
167
170
|
const catalogStore = useOrionplaceCatalogStore();
|
|
168
171
|
const selectionStore = useOrionplaceSelectionsStore();
|
|
169
172
|
const tariff = computed(() => catalogStore.getTariff(props.tariffId));
|
|
@@ -178,15 +181,22 @@
|
|
|
178
181
|
// The option chosen in the card; the dialog opens on it and keeps its own
|
|
179
182
|
// choice from there.
|
|
180
183
|
const optionId = ref<number>();
|
|
184
|
+
// No trial badge for a customer who already had this subscription record.
|
|
181
185
|
const trialBadge = computed(() => {
|
|
182
|
-
const
|
|
186
|
+
const value = tariff.value;
|
|
183
187
|
|
|
184
|
-
if (
|
|
188
|
+
if (
|
|
189
|
+
!value ||
|
|
190
|
+
!tariffTrialOpen(
|
|
191
|
+
value,
|
|
192
|
+
catalogStore.usedSubscriptionsOf(store.profile?.id),
|
|
193
|
+
)
|
|
194
|
+
) {
|
|
185
195
|
return '';
|
|
186
196
|
}
|
|
187
197
|
|
|
188
198
|
return tariffText(tariffLabels(selectionStore.localeCode).trialBadge, {
|
|
189
|
-
days: tariffDays(
|
|
199
|
+
days: tariffDays(value.trial_days, selectionStore.localeCode),
|
|
190
200
|
});
|
|
191
201
|
});
|
|
192
202
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TariffCardPrices · Nuxt
|
|
2
2
|
|
|
3
|
-
The period switcher, the price for the chosen period and the Subscribe and Try actions. A plan that only the store administrator assigns, or a plan that no longer accepts new subscriptions, shows a note instead of actions. The plan and its parent subscription each carry `is_new_subs_allowed` and `only_admin_can_subscribe`, and both have to allow the purchase.
|
|
3
|
+
The period switcher, the price for the chosen period and the Subscribe and Try actions. A plan that only the store administrator assigns, or a plan that no longer accepts new subscriptions, shows a note instead of actions. The plan and its parent subscription each carry `is_new_subs_allowed` and `only_admin_can_subscribe`, and both have to allow the purchase. A signed-in customer who already had the plan's subscription sees no Try action and no trial badge: the backend gives a trial once per subscription. The plan pages load the customer's records with `subscriptions_get`; until they arrive, the trial stays shown.
|
|
4
4
|
|
|
5
5
|
[English guide](https://orionmarket.place/en/sandbox/components/nuxt/tariff-prices) ·
|
|
6
6
|
[Russian guide](https://orionmarket.place/ru/sandbox/components/nuxt/tariff-prices)
|
|
@@ -116,6 +116,7 @@
|
|
|
116
116
|
</template>
|
|
117
117
|
<script setup lang="ts">
|
|
118
118
|
import { computed, useId } from 'vue';
|
|
119
|
+
import { useOrionplaceStore } from '@/stores/orionplace';
|
|
119
120
|
import { useOrionplaceCatalogStore } from '@/stores/orionplaceCatalog';
|
|
120
121
|
import { useOrionplaceSelectionsStore } from '@/stores/orionplaceSelections';
|
|
121
122
|
import { useOrionplaceSignIn } from '@/composables/useOrionplaceSignIn';
|
|
@@ -125,6 +126,7 @@
|
|
|
125
126
|
tariffMoney,
|
|
126
127
|
tariffPaidPeriods,
|
|
127
128
|
tariffReturnPath,
|
|
129
|
+
tariffTrialOpen,
|
|
128
130
|
} from '@/utils/orionplace/tariffs';
|
|
129
131
|
import {
|
|
130
132
|
tariffDays,
|
|
@@ -155,6 +157,7 @@
|
|
|
155
157
|
// The chosen paid period as its `tariff_cost_id`.
|
|
156
158
|
const selectedPeriod = defineModel<number>();
|
|
157
159
|
const emit = defineEmits<{ select: [selection: ITariffSelection] }>();
|
|
160
|
+
const store = useOrionplaceStore();
|
|
158
161
|
const catalogStore = useOrionplaceCatalogStore();
|
|
159
162
|
const selectionStore = useOrionplaceSelectionsStore();
|
|
160
163
|
const signIn = useOrionplaceSignIn();
|
|
@@ -194,11 +197,24 @@
|
|
|
194
197
|
paidPeriods.value.find((item) => item.price === selectedPeriod.value) ??
|
|
195
198
|
paidPeriods.value[0],
|
|
196
199
|
);
|
|
197
|
-
|
|
198
|
-
|
|
200
|
+
// A customer who already had this subscription record gets no trial.
|
|
201
|
+
const trialUsed = computed(() => {
|
|
202
|
+
const value = tariff.value;
|
|
199
203
|
|
|
200
|
-
return
|
|
204
|
+
return Boolean(
|
|
205
|
+
value &&
|
|
206
|
+
value.trial_days > 0 &&
|
|
207
|
+
!tariffTrialOpen(
|
|
208
|
+
value,
|
|
209
|
+
catalogStore.usedSubscriptionsOf(store.profile?.id),
|
|
210
|
+
),
|
|
211
|
+
);
|
|
201
212
|
});
|
|
213
|
+
const trialDuration = computed(() =>
|
|
214
|
+
tariff.value && !trialUsed.value && tariff.value.trial_days > 0
|
|
215
|
+
? duration(tariff.value.trial_days)
|
|
216
|
+
: '',
|
|
217
|
+
);
|
|
202
218
|
const actions = computed(() => {
|
|
203
219
|
const list: TariffPeriodAction[] = [];
|
|
204
220
|
|
|
@@ -237,7 +253,11 @@
|
|
|
237
253
|
return copy.value.closed;
|
|
238
254
|
}
|
|
239
255
|
|
|
240
|
-
|
|
256
|
+
if (actions.value.length) {
|
|
257
|
+
return '';
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return trialUsed.value ? copy.value.trialUsed : copy.value.noPeriods;
|
|
241
261
|
});
|
|
242
262
|
const actionClasses = `
|
|
243
263
|
box-border inline-flex h-11 w-full items-center justify-center px-6
|