@icvdeveloper/common-module 0.0.126 → 0.0.128

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/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "v3plus-common-module",
3
3
  "configKey": "v3plusCommonModule",
4
- "version": "0.0.126"
4
+ "version": "0.0.128"
5
5
  }
@@ -8,6 +8,18 @@ export type countdownTimerClassObj = {
8
8
  unitContainer?: string | null;
9
9
  unit?: string | null;
10
10
  };
11
+ export type affiliatePageClassObj = {
12
+ container?: string | null;
13
+ headerContainer?: string | null;
14
+ headerNameContainer?: string | null;
15
+ headerNameElement?: string | null;
16
+ headerContactContainer?: string | null;
17
+ headerSocialContainer?: string | null;
18
+ htmlHeaderContainer?: string | null;
19
+ biographyContainer?: string | null;
20
+ contentContainer?: string | null;
21
+ affiliateContentBox?: string | null;
22
+ };
11
23
  export type sponsorClassObj = {
12
24
  container?: string | null;
13
25
  sponsorContainer?: string | null;
@@ -1,17 +1,329 @@
1
1
  <script lang="ts" setup>
2
2
  import { toRefs } from "vue";
3
- import { Affiliate } from "../../models/affiliate";
4
- import { Sponsor } from "../../models/conference";
3
+ import { get } from "lodash-es";
4
+ import { useApi } from "../../composables/useApi";
5
+ import { Affiliate } from "../../models/conference";
6
+ import { affiliatePageClassObj } from "../../@types/components";
7
+ import { useClassBinding } from "../../composables/useClassBinding";
8
+
5
9
 
6
10
  type Props = {
7
- affiliate: Affiliate | Sponsor;
11
+ affiliateId: string;
12
+ classObject?: affiliatePageClassObj;
13
+ };
14
+
15
+ const props = withDefaults(defineProps<Props>(), {
16
+ classObject: () => {
17
+ return {
18
+ container: "",
19
+ headerContainer: "",
20
+ headerNameContainer: "",
21
+ headerNameElement: "",
22
+ headerContactContainer: "",
23
+ headerSocialContainer: "",
24
+ htmlHeaderContainer: "",
25
+ biographyContainer: "",
26
+ contentContainer: "",
27
+ affiliateContentBox: "flex flex-col w-full h-full overflow-y-auto p-4 border border-slate-300",
28
+ };
29
+ },
30
+ });
31
+
32
+ // data
33
+ const { affiliateId } = toRefs(props);
34
+ const { classBinding } = useClassBinding();
35
+ const affiliate = ref<Affiliate>({documents:[],links:[],videos:[]});
36
+ const showVideoModal = ref<boolean>(false);
37
+ const modalVideoTitle = ref<string>("");
38
+ const modalVideoUrl = ref<string>("");
39
+
40
+ // computed
41
+ const contentCount = computed((): number => {
42
+ let hasDocuments = (affiliate.value.documents.length > 0) ? 1 : 0;
43
+ let hasVideos = (affiliate.value.videos.length > 0) ? 1 : 0;
44
+ let hasLinks = (affiliate.value.links.length > 0) ? 1 : 0;
45
+ return hasDocuments + hasVideos + hasLinks;
46
+ });
47
+ const hasContactInfo = computed((): boolean => {
48
+ return (
49
+ affiliate.value.contact_photo ||
50
+ affiliate.value.contact_name ||
51
+ affiliate.value.contact_title ||
52
+ affiliate.value.contact_phone ||
53
+ affiliate.value.contact_email
54
+ );
55
+ });
56
+ const showLeftBottomBox = computed((): boolean => {
57
+ return (hasContactInfo.value || getAffiliateContentItem('custom_box_1'));
58
+ });
59
+
60
+ // methods
61
+ const fireAnalytics = (type: string) => {
62
+ let event = 'affiliate-' + affiliate.value.name + '-' + type;
63
+ this.$analyticsPlugin.click(event, event);
64
+ };
65
+
66
+ const getAffiliateContentItem = (_item: string) => {
67
+ let itemVal = get(affiliate.value, 'affiliate_content.'+_item);
68
+ if (itemVal == undefined || itemVal == '') { return null; }
69
+ return itemVal;
70
+ };
71
+
72
+ const getAffiliateContent = () => {
73
+ return new Promise((resolve, reject) => {
74
+ const request = useApi();
75
+ request(
76
+ `/affiliates/${affiliateId.value}?with=affiliate_content,documents,videos,links`
77
+ )
78
+ .then((response) => {
79
+ affiliate.value = response.data;
80
+ })
81
+ .catch((error) => {
82
+ reject(error);
83
+ });
84
+ });
85
+ };
86
+
87
+ const getStreamingVideoUrl = (_videoUrl: string): string => {
88
+ let tmpUrl = 'https://cdn.v3mediaportal.com/streaming-player/iframe-player.htm?';
89
+ tmpUrl += 'cs=' + encodeURIComponent(_videoUrl);
90
+ tmpUrl += '&ar=16:9&f=video&as=false';
91
+ return tmpUrl;
92
+ };
93
+
94
+ const openVideoModal = (_title: string, _videoUrl: string) => {
95
+ fireAnalytics('video-' + _title);
96
+ let tmpUrl = getStreamingVideoUrl(_videoUrl);
97
+ modalVideoUrl.value = tmpUrl;
98
+ modalVideoTitle.value = _title;
99
+ showVideoModal.value = true;
8
100
  };
9
101
 
10
- const props = defineProps<Props>();
102
+ // on mount
103
+ onMounted(() => {
104
+ getAffiliateContent();
105
+ });
11
106
 
12
- const { affiliate } = toRefs(props);
13
107
  </script>
14
108
 
15
109
  <template>
16
- <div class="flex w-full flex-col"></div>
110
+ <div
111
+ :class="
112
+ classBinding(
113
+ classObject,
114
+ 'container',
115
+ 'flex w-full flex-col'
116
+ )
117
+ "
118
+ >
119
+
120
+ <div v-if="getAffiliateContentItem('html_vanity_page')" v-html="getAffiliateContentItem('html_vanity_page')">
121
+ </div>
122
+
123
+ <div v-else>
124
+
125
+ <div :class="classBinding(
126
+ classObject,
127
+ 'headerContainer',
128
+ 'flex flex-col md:flex-row w-full pb-6 border-b border-solid border-grey-light'
129
+ )">
130
+ <div v-if="affiliate.photo" class="mb-6 md:mb-0">
131
+ <img :src="affiliate.photo" />
132
+ </div>
133
+ <div
134
+ v-if="!affiliate.photo"
135
+ :class="classBinding(
136
+ classObject,
137
+ 'headerNameContainer',
138
+ 'flex w-full justify-center md:justify-start'
139
+ )"
140
+ >
141
+ <h1 :class="classBinding(classObject, 'headerNameElement', 'font-light mb-0 body-color-4 self-end')">{{affiliate.name}}</h1>
142
+ </div>
143
+ <div
144
+ v-if="getAffiliateContentItem('contact_in_header') == 1"
145
+ :class="classBinding(classObject, 'headerContactContainer', 'w-full text-center md:text-right')"
146
+ >
147
+ <p>
148
+ <span v-if="affiliate.contact_address">{{affiliate.contact_address}}<br/></span>
149
+ <span v-if="affiliate.contact_location">{{affiliate.contact_location}}<br/></span>
150
+ <span v-if="affiliate.website"><a @click="fireAnalytics('website')" class="affiliate-website" :href="affiliate.website" target="_blank">{{affiliate.website}}</a><br/></span>
151
+ </p>
152
+ <span :class="classBinding(classObject, 'headerSocialContainer', 'flex justify-center md:justify-end')">
153
+ <a @click="fireAnalytics('twitter')" v-if="affiliate.twitter_url" :href="affiliate.twitter_url" target="_blank" class="affiliate-twitter" :aria-label="affiliate.name + ` Twitter Page`">
154
+ <span class="presenter-icon"><CommonSvgIcon icon="twitter"></CommonSvgIcon></span>
155
+ </a>
156
+ <a @click="fireAnalytics('facebook')" v-if="affiliate.facebook_url" :href="affiliate.facebook_url" target="_blank" class="affiliate-facebook" :aria-label="affiliate.name + ` Facebook Page`">
157
+ <span class="presenter-icon "><CommonSvgIcon icon="facebook"></CommonSvgIcon></span>
158
+ </a>
159
+ <a @click="fireAnalytics('linked_in')" v-if="affiliate.linkedin_url" :href="affiliate.linkedin_url" target="_blank" class="affiliate-linkedin" :aria-label="affiliate.name + ` LinkedIn Page`">
160
+ <span class="presenter-icon"><CommonSvgIcon icon="linkedin"></CommonSvgIcon></span>
161
+ </a>
162
+ <a @click="fireAnalytics('youtube')" v-if="affiliate.youtube_url" :href="affiliate.youtube_url" target="_blank" class="affiliate-youtube" :aria-label="affiliate.name + ` YouTube Page`">
163
+ <span class="presenter-icon"><CommonSvgIcon icon="youtube"></CommonSvgIcon></span>
164
+ </a>
165
+ </span>
166
+ </div>
167
+ </div>
168
+
169
+ <div
170
+ v-if="getAffiliateContentItem('html_header')"
171
+ v-html="getAffiliateContentItem('html_header')"
172
+ :class="classBinding(classObject, 'htmlHeaderContainer', 'w-full mt-5 text-center md:text-left')"
173
+ ></div>
174
+ <div
175
+ v-if="affiliate.biography"
176
+ v-html="affiliate.biography"
177
+ :class="classBinding(classObject, 'biographyContainer', 'w-full mt-5 text-center md:text-left')"
178
+ ></div>
179
+ <div
180
+ v-if="contentCount>0"
181
+ class="grid-container-responsive"
182
+ :class="classBinding(classObject, 'contentContainer', 'w-full mt-5 md:max-h-300')"
183
+ >
184
+
185
+ <div v-if="affiliate.documents.length>0">
186
+ <div :class="classBinding(classObject, 'affiliateContentBox', '')">
187
+ <h3 class="mb-3">Documents</h3>
188
+ <span v-for="document in affiliate.documents" :key="document.id">
189
+ <div class="mb-2"><a @click="fireAnalytics('document-' + document.name)" class="affiliate-document" :href="document.url" target="_blank">{{ document.name }}</a></div>
190
+ </span>
191
+ </div>
192
+ </div>
193
+ <div v-if="affiliate.videos.length>0">
194
+ <div :class="classBinding(classObject, 'affiliateContentBox', '')">
195
+ <div v-if="affiliate.videos.length == 1 && getAffiliateContentItem('embed_video') == 1">
196
+ <iframe
197
+ :src="getStreamingVideoUrl(affiliate.videos[0].url)"
198
+ width="100%"
199
+ style="max-width: 300px; margin:auto;"
200
+ scrolling="no"
201
+ frameborder="0"
202
+ marginheight="0"
203
+ marginwidth="0"
204
+ allowfullscreen="">
205
+ </iframe>
206
+ </div>
207
+ <div v-else>
208
+ <h3 class="mb-3">Videos</h3>
209
+ <input name="affiliateName" type="hidden" id="affiliateName" :value="affiliate.name">
210
+ <span v-for="video in affiliate.videos" :key="video.id">
211
+ <div class="mb-2"><a href="javascript:null" class="affiliate-video-trigger" @click="openVideoModal(video.name, video.url)">{{ video.name }}</a></div>
212
+ </span>
213
+ </div>
214
+ </div>
215
+ </div>
216
+ <div v-if="affiliate.links.length>0">
217
+ <div :class="classBinding(classObject, 'affiliateContentBox', '')">
218
+ <h3 class="mb-3">Links</h3>
219
+ <span v-for="link in affiliate.links" :key="link.id">
220
+ <div class="mb-2"><a @click="fireAnalytics('external_link-' + link.name)" :href="link.url" class="affiliate-link" target="_blank">{{ link.name }}</a></div>
221
+ </span>
222
+ </div>
223
+ </div>
224
+
225
+ </div>
226
+ <div class="grid-container-responsive mt-5">
227
+ <div v-if="showLeftBottomBox" :class="classBinding(classObject, 'affiliateContentBox', '')">
228
+ <div v-if="getAffiliateContentItem('custom_box_1')" v-html="getAffiliateContentItem('custom_box_1')"></div>
229
+ <div v-else-if="hasContactInfo">
230
+ <div class="flex flex-col md:flex-row">
231
+ <div v-if="affiliate.contact_photo" class="mr-4 w-1/3 mb-3 md:mb-0 self-center md:self-start">
232
+ <img :src="affiliate.contact_photo" class="w-full" />
233
+ </div>
234
+ <div class="text-center md:text-left">
235
+ <p>Contact:</p>
236
+ <p>
237
+ <span v-if="affiliate.contact_name">{{affiliate.contact_name}}<br/></span>
238
+ <span v-if="affiliate.contact_title">{{affiliate.contact_title}}<br/></span>
239
+ <span v-if="affiliate.contact_phone">Phone: {{affiliate.contact_phone}}<br/></span>
240
+ <span v-if="affiliate.contact_email">
241
+ <a @click="fireAnalytics('contact_email')" class="affiliate-email" :href="'mailto:' + affiliate.contact_email">
242
+ {{affiliate.contact_email}}
243
+ </a><br />
244
+ </span>
245
+ </p>
246
+ </div>
247
+ </div>
248
+ </div>
249
+ </div>
250
+
251
+ <div :class="classBinding(classObject, 'affiliateContentBox', '')">
252
+ <div v-if="getAffiliateContentItem('custom_box_2')" v-html="getAffiliateContentItem('custom_box_2')"></div>
253
+ <div v-else class="text-center md:text-right">
254
+ <p>
255
+ <span v-if="affiliate.contact_address">{{affiliate.contact_address}}<br/></span>
256
+ <span v-if="affiliate.contact_location">{{affiliate.contact_location}}<br/></span>
257
+ <span v-if="affiliate.website"><a @click="fireAnalytics('website')" class="affiliate-website" :href="affiliate.website" target="_blank">{{affiliate.website}}</a><br/></span>
258
+ </p>
259
+ <span class="flex justify-center" :class="{'md:justify-end':hasContactInfo}">
260
+ <a @click="fireAnalytics('twitter')" v-if="affiliate.twitter_url" :href="affiliate.twitter_url" target="_blank" class="affiliate-twitter" :aria-label="affiliate.name + ` Twitter Page`">
261
+ <span class="presenter-icon"><CommonSvgIcon icon="twitter"></CommonSvgIcon></span>
262
+ </a>
263
+ <a @click="fireAnalytics('facebook')" v-if="affiliate.facebook_url" :href="affiliate.facebook_url" target="_blank" class="affiliate-facebook" :aria-label="affiliate.name + ` Facebook Page`">
264
+ <span class="presenter-icon "><CommonSvgIcon icon="facebook"></CommonSvgIcon></span>
265
+ </a>
266
+ <a @click="fireAnalytics('linked_in')" v-if="affiliate.linkedin_url" :href="affiliate.linkedin_url" target="_blank" class="affiliate-linkedin" :aria-label="affiliate.name + ` LinkedIn Page`">
267
+ <span class="presenter-icon"><CommonSvgIcon icon="linkedin"></CommonSvgIcon></span>
268
+ </a>
269
+ <a @click="fireAnalytics('youtube')" v-if="affiliate.youtube_url" :href="affiliate.youtube_url" target="_blank" class="affiliate-youtube" :aria-label="affiliate.name + ` YouTube Page`">
270
+ <span class="presenter-icon"><CommonSvgIcon icon="youtube"></CommonSvgIcon></span>
271
+ </a>
272
+ </span>
273
+ </div>
274
+ </div>
275
+ </div>
276
+ </div>
277
+
278
+ <CommonModal :visible="showVideoModal" modal-size="lg" @clicked="showVideoModal = false" class="video-dialog">
279
+ <template #modal-title>
280
+ <div class="p-1 pb-2">
281
+ {{ modalVideoTitle }}
282
+ </div>
283
+ </template>
284
+ <template #modal-body>
285
+ <div class="video-modal-body">
286
+ <iframe
287
+ class='video-frame'
288
+ :src="modalVideoUrl"
289
+ width="640"
290
+ height="360"
291
+ scrolling="no"
292
+ frameborder="0"
293
+ marginheight="0"
294
+ marginwidth="0"
295
+ allowfullscreen="">
296
+ </iframe>
297
+ </div>
298
+ </template>
299
+ </CommonModal>
300
+
301
+ </div>
302
+
17
303
  </template>
304
+
305
+ <style scoped>
306
+ .grid-container-responsive {
307
+ display: grid;
308
+ grid-template-columns: 1fr;
309
+ grid-column-gap: 20px;
310
+ grid-row-gap: 20px;
311
+ }
312
+ @media (min-width: 768px) {
313
+ .grid-container-responsive {
314
+ grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
315
+ }
316
+ }
317
+ .video-dialog >>> .modal-box {
318
+ width: 704px;
319
+ }
320
+ .video-frame {
321
+ display: block;
322
+ width: 640px;
323
+ margin-left: auto;
324
+ margin-right: auto;
325
+ padding-left: auto;
326
+ padding-right: auto;
327
+ }
328
+ </style>
329
+
@@ -41,8 +41,8 @@ const updateSession = () => {
41
41
 
42
42
  const inputs = {
43
43
  method: "PATCH",
44
- resource_type: loggableType,
45
- resource_id: loggableId,
44
+ resource_type: loggableType.value,
45
+ resource_id: loggableId.value,
46
46
  };
47
47
  const url = `session-logs/${sessionId}`;
48
48
  const request = useApi();
@@ -4,11 +4,13 @@ export const useApi = () => {
4
4
  const authStore = useAuthStore();
5
5
  const commonModule = useV3plusCommonModule();
6
6
  const headers = {
7
- "X-Portal-Token": commonModule.options.portalHash
7
+ "X-Portal-Token": commonModule.options.portalHash,
8
+ "Accept": "application/json"
8
9
  };
9
10
  if (useAuthStore().isLoggedIn) {
10
11
  headers.Authorization = `Bearer ${authStore.user.token}`;
11
12
  }
13
+ ;
12
14
  return $fetch.create({
13
15
  baseURL: commonModule.options.apiUrl,
14
16
  headers
@@ -1,3 +1,6 @@
1
+ import { Document } from "./document";
2
+ import { Link } from "./link";
3
+ import { Video } from "./video";
1
4
  export declare enum ConferenceState {
2
5
  LIVE = "live",
3
6
  MIXED = "mixed",
@@ -47,6 +50,27 @@ export type Group = {
47
50
  price?: number;
48
51
  registration_message?: string | null;
49
52
  };
53
+ export type Affiliate = {
54
+ id?: number;
55
+ name?: string;
56
+ label?: string;
57
+ photo?: string;
58
+ vanity?: boolean;
59
+ website?: string;
60
+ level?: number;
61
+ role?: string;
62
+ documents?: Array<Document>;
63
+ links?: Array<Link>;
64
+ videos?: Array<Video>;
65
+ affiliate_content?: {
66
+ html_vanity_page?: string;
67
+ contact_in_header?: number;
68
+ html_header?: string;
69
+ embed_video?: number;
70
+ custom_box_1?: string;
71
+ custom_box_2?: string;
72
+ };
73
+ };
50
74
  export type Sponsor = {
51
75
  id?: number;
52
76
  name?: string;
@@ -0,0 +1,7 @@
1
+ export type Document = {
2
+ id?: number;
3
+ name?: string;
4
+ url?: string;
5
+ description?: string | null;
6
+ meta?: string | null;
7
+ };
@@ -0,0 +1,6 @@
1
+ export type Link = {
2
+ id?: number;
3
+ name?: string;
4
+ url?: string;
5
+ description?: string | null;
6
+ };
File without changes
@@ -0,0 +1,6 @@
1
+ export type Video = {
2
+ id?: number;
3
+ name?: string;
4
+ url?: string;
5
+ description?: string | null;
6
+ };
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icvdeveloper/common-module",
3
- "version": "0.0.126",
3
+ "version": "0.0.128",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1 +0,0 @@
1
- export type Affiliate = {};