1 | import { CommonModule } from '@angular/common';
|
2 | import { Component, Input, NgModule, EventEmitter, Output, Injectable, ChangeDetectionStrategy, Pipe, ChangeDetectorRef, InjectionToken, Inject } from '@angular/core';
|
3 | import { MatCardModule, MatButtonModule, MatIconModule, MatMenuModule, MatChipsModule, MatTooltipModule, MatCheckboxModule, MatExpansionModule, MatInputModule, MatOptionModule, MatProgressSpinnerModule, MatSelectModule, MatListModule as MatListModule$1, MatDividerModule } from '@angular/material';
|
4 | import { ImageTransformationService, ImageTransformationModule } from '@vendasta/core/image-transformation';
|
5 | import { VaIconModule, VaBadgeModule, VaSafeHtmlModule, VaListModule, VaImageGalleryModule, VaBreadcrumbsModule, CheckboxFilterField, FilterSection, Filters, TabbedFilterField, FilterService, UIKitModule } from '@vendasta/uikit';
|
6 | import { DisplayPriceService, CoreSharedModule, formatDisplayPrice, formatBillingFrequency, Addon } from '@vendasta/core/shared';
|
7 | import { BehaviorSubject, combineLatest, of, ReplaySubject, merge, zip } from 'rxjs';
|
8 | import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
9 | import { map, switchMap, debounceTime, distinctUntilChanged, startWith, filter, take, skipWhile, shareReplay, tap } from 'rxjs/operators';
|
10 | import { Validators, FormControl, FormGroup, FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
11 | import { MatListModule } from '@angular/material/list';
|
12 | import { VaFormsModule } from '@vendasta/forms';
|
13 | import { BillingModel, buildBilledProductFromProductPricingAndAddon, BillingService, BillingModule } from '@vendasta/core/billing';
|
14 | import { FieldType, Field, CustomField, AddonKey, CommonField } from '@vendasta/sales-orders';
|
15 | import uuid from 'uuid/v4';
|
16 | import { MatProgressSpinnerModule as MatProgressSpinnerModule$1 } from '@angular/material/progress-spinner';
|
17 | import { isNullOrUndefined } from 'util';
|
18 | import { Categories, Pricing as Pricing$1, Currency } from '@vendasta/core/marketplace-packages';
|
19 | import { trigger, state, style, transition, animate } from '@angular/animations';
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | class En {
|
27 | }
|
28 | En.en = {
|
29 | "FRONTEND.STORE": {
|
30 | "TOTAL": "Total",
|
31 | "CONTACT_SALES": "Contact Sales",
|
32 | "FREE": "Free",
|
33 | "STARTING_AT": "Starting at",
|
34 | "ENABLED_UPPER": "ENABLED",
|
35 | "ENABLE_UPPER": "ENABLE",
|
36 | "MIN_TO_MAX": "{{minRange}} to {{maxRange}}",
|
37 | "PRODUCT_PRICING_WITH_FREQUENCY": "{{pricingTier}} accounts {{frequency}}",
|
38 | "COMMITMENT_WITH_RENEWAL": "*{{initial}} {{frequencyString}} minimum, renews for {{recurring}} {{frequencyString}} periods",
|
39 | "COMMITMENT": "${{initial}} ${{frequencyString}} commitment",
|
40 | "PRICING_FREQUENCIES": {
|
41 | "MONTH": "month",
|
42 | "YEAR": "year"
|
43 | },
|
44 | "REQUIRES_DESCRIPTOR": "(Requires {{requirementName}})",
|
45 | "ADMINISTRATIVE_QUESTIONS": "Administrative Questions",
|
46 | "AUTO_TITLE_TEXT": {
|
47 | "SOME_FIELDS_INVALID": "* Some fields are invalid and/or required but empty",
|
48 | "OPTIONAL_FIELDS_UNANSWERED": "Optional fields unanswered",
|
49 | "COMPLETE": "Complete"
|
50 | },
|
51 | "REQUIRES": "Requires",
|
52 | "ENABLED_WITH_PREREQUISITE": "Enabled with {{prerequisite}}",
|
53 | "PRICE_APPLIES_PER_UNIT": "Price applies per unit within a range",
|
54 | "PRICE_APPLIES_TO_ALL_UNITS": "Price applies to all units once range is met",
|
55 | "PRICING": "Pricing",
|
56 | "FAQS": "FAQs",
|
57 | "GALLERY": "Gallery",
|
58 | "FILES": "Files",
|
59 | "GET_IT_NOW": "Get It Now",
|
60 | "CONTAINS_NUM_ITEMS": "Contains {{itemCount}} items"
|
61 | }
|
62 | };
|
63 | if (false) {
|
64 |
|
65 | En.en;
|
66 | }
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 | class VaPricingComponent {
|
73 | |
74 |
|
75 |
|
76 |
|
77 | constructor(translateService, displayPriceService) {
|
78 | this.translateService = translateService;
|
79 | this.displayPriceService = displayPriceService;
|
80 | this.pricing = null;
|
81 | this.wrapFrequency = false;
|
82 | this.isAddon = false;
|
83 | this.hasVerifiedContract = false;
|
84 | this.highlightPrice = true;
|
85 | this.loaded = true;
|
86 | this.pricing$$ = new BehaviorSubject(null);
|
87 | this.billedProduct$$ = new BehaviorSubject(null);
|
88 | this.hasVerifiedContract$$ = new BehaviorSubject(false);
|
89 | this.translateService.setTranslation('en', En.en, true);
|
90 | this.isFree$ = combineLatest([this.pricing$, this.billedProduct$, this.hasVerifiedContract$]).pipe(map(( |
91 |
|
92 |
|
93 |
|
94 | ([pricing, billedProduct, hasVerifiedContract]) => {
|
95 |
|
96 | const isFreeHelper = ( |
97 |
|
98 |
|
99 |
|
100 | (prices) => {
|
101 | return prices ? prices.some(( |
102 |
|
103 |
|
104 |
|
105 | p => p.price === 0 || p.price === undefined)) : false;
|
106 | });
|
107 | if (hasVerifiedContract && billedProduct) {
|
108 | return billedProduct.pricingTiers.length === 1 ? isFreeHelper(billedProduct.pricingTiers) : false;
|
109 | }
|
110 | return !!pricing && isFreeHelper(pricing.prices);
|
111 | })));
|
112 | this.shouldContactSales$ = combineLatest([this.pricing$, this.billedProduct$, this.hasVerifiedContract$]).pipe(map(( |
113 |
|
114 |
|
115 |
|
116 | ([pricing, billedProduct, hasVerifiedContract]) => {
|
117 |
|
118 | const nestedPricesIsContactSales = ( |
119 |
|
120 |
|
121 |
|
122 | (prices) => {
|
123 | return prices && prices.length > 0 ? prices.some(( |
124 |
|
125 |
|
126 |
|
127 | p => p.price === null || p.price < 0)) : true;
|
128 | });
|
129 | if (hasVerifiedContract && billedProduct) {
|
130 | return nestedPricesIsContactSales(billedProduct.pricingTiers);
|
131 | }
|
132 | if (!pricing) {
|
133 | return true;
|
134 | }
|
135 | return nestedPricesIsContactSales(pricing.prices);
|
136 | })));
|
137 | this.isFlatPrice$ = this.billedProduct$.pipe(map(( |
138 |
|
139 |
|
140 |
|
141 | billedProduct => billedProduct.pricingTiers.length === 1)));
|
142 | this.pricingTierData$ = this.billedProduct$.pipe(switchMap(( |
143 |
|
144 |
|
145 |
|
146 | billedProduct => {
|
147 |
|
148 | const pricingTierObservables = billedProduct.pricingTiers.map(( |
149 |
|
150 |
|
151 |
|
152 | pricingTier => {
|
153 | return combineLatest(of(pricingTier.isStartingPrice), this.buildPricingTierString(pricingTier), this.buildPricingTierForProduct(pricingTier, billedProduct.billingFrequency), this.buildPricingTierForAddon(pricingTier), this.buildPriceStringForTier(pricingTier, billedProduct.billingFrequency, pricingTier.isStartingPrice), this.buildPriceStringForTier(pricingTier)).pipe(map(( |
154 |
|
155 |
|
156 |
|
157 | ([isStartingPrice, pricingTierString, pricingTierForProduct, pricingTierForAddon, priceStringForTier, priceStringForTierWithoutFreq]) => {
|
158 | return {
|
159 | isStartingPrice: isStartingPrice,
|
160 | pricingTierString: pricingTierString,
|
161 | pricingTierForProduct: pricingTierForProduct,
|
162 | pricingTierForAddon: pricingTierForAddon,
|
163 | priceStringForTier: priceStringForTier,
|
164 | priceStringForTierWithoutFreq: priceStringForTierWithoutFreq
|
165 | };
|
166 | })));
|
167 | }));
|
168 | return combineLatest(...pricingTierObservables);
|
169 | })));
|
170 | this.priceData$ = this.pricing$.pipe(switchMap(( |
171 |
|
172 |
|
173 |
|
174 | pricing => {
|
175 |
|
176 | const priceObservables = pricing.prices.map(( |
177 |
|
178 |
|
179 |
|
180 | price => {
|
181 | return combineLatest(of(price.isStartingPrice), this.buildPriceStringForPricing(price, pricing.currency, true, false), this.buildPriceStringForPricing(price, pricing.currency, false, true), this.buildFrequencyString(price.frequency)).pipe(map(( |
182 |
|
183 |
|
184 |
|
185 | ([isStartingPrice, priceStringForPricingWithoutFrequency, priceStringForPricingWithFrequency, frequencyString]) => {
|
186 | return {
|
187 | isStartingPrice: isStartingPrice,
|
188 | priceStringForPricingWithoutFrequency: priceStringForPricingWithoutFrequency,
|
189 | priceStringForPricingWithFrequency: priceStringForPricingWithFrequency,
|
190 | frequencyString: frequencyString
|
191 | };
|
192 | })));
|
193 | }));
|
194 | return combineLatest(...priceObservables);
|
195 | })));
|
196 | this.commitmentMessage$ = this.buildCommitmentMessage();
|
197 | }
|
198 | |
199 |
|
200 |
|
201 | get pricing$() {
|
202 | return this.pricing$$.asObservable();
|
203 | }
|
204 | |
205 |
|
206 |
|
207 | get billedProduct$() {
|
208 | return this.billedProduct$$.asObservable();
|
209 | }
|
210 | |
211 |
|
212 |
|
213 | get hasVerifiedContract$() {
|
214 | return this.hasVerifiedContract$$.asObservable();
|
215 | }
|
216 | |
217 |
|
218 |
|
219 |
|
220 | ngOnChanges(changes) {
|
221 | if (changes.hasOwnProperty('pricing')) {
|
222 | this.pricing$$.next(changes.pricing.currentValue);
|
223 | }
|
224 | if (changes.hasOwnProperty('billedProduct')) {
|
225 | this.billedProduct$$.next(changes.billedProduct.currentValue);
|
226 | }
|
227 | if (changes.hasOwnProperty('hasVerifiedContract')) {
|
228 | this.hasVerifiedContract$$.next(changes.hasVerifiedContract.currentValue);
|
229 | }
|
230 | }
|
231 | |
232 |
|
233 |
|
234 |
|
235 | buildPricingTierString(tier) {
|
236 |
|
237 | let max = String(tier.rangeMax);
|
238 | if (tier.rangeMax === -1) {
|
239 | max = '∞';
|
240 | if (tier.rangeMin === 0 || tier.rangeMin === 1) {
|
241 | return of('');
|
242 | }
|
243 | }
|
244 | return this.translateService.stream('FRONTEND.STORE.MIN_TO_MAX', { minRange: String(tier.rangeMin), maxRange: max });
|
245 | }
|
246 | |
247 |
|
248 |
|
249 |
|
250 |
|
251 | buildPricingTierForProduct(tier, frequency) {
|
252 | return combineLatest(this.buildPricingTierString(tier), this.buildFrequencyString(frequency)).pipe(switchMap(( |
253 |
|
254 |
|
255 |
|
256 | ([pricingTier, formattedFrequency]) => {
|
257 | if (pricingTier) {
|
258 | return this.translateService.stream('FRONTEND.STORE.PRODUCT_PRICING_WITH_FREQUENCY', {
|
259 | pricingTier: pricingTier,
|
260 | frequency: formattedFrequency
|
261 | });
|
262 | }
|
263 | return of(formattedFrequency);
|
264 | })));
|
265 | }
|
266 | |
267 |
|
268 |
|
269 |
|
270 | buildPricingTierForAddon(tier) {
|
271 | return this.buildPricingTierString(tier).pipe(map(( |
272 |
|
273 |
|
274 |
|
275 | pricingRange => pricingRange ? pricingRange : '')));
|
276 | }
|
277 | |
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 |
|
284 | buildPriceStringForPricing(price, currency, excludeFrequency, canIncludeStartingAtPrefix) {
|
285 | return this.displayPriceService.formatDisplayPrice(price.price, currency, ( ((excludeFrequency ? '' : price.frequency))), true, true, true, price.isStartingPrice && canIncludeStartingAtPrefix);
|
286 | }
|
287 | |
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 | buildPriceStringForTier(tier, frequency, isStartingPrice) {
|
294 | return this.displayPriceService.formatDisplayPrice(tier.price, this.billedProduct.currency, ( (frequency)), undefined, undefined, undefined, isStartingPrice);
|
295 | }
|
296 | |
297 |
|
298 |
|
299 |
|
300 | buildFrequencyString(frequency) {
|
301 | return this.displayPriceService.formatBillingFrequency(frequency);
|
302 | }
|
303 | |
304 |
|
305 |
|
306 | buildCommitmentMessage() {
|
307 | return combineLatest([
|
308 | this.translateService.stream('FRONTEND.STORE.PRICING_FREQUENCIES'),
|
309 | this.billedProduct$,
|
310 | this.pricing$,
|
311 | this.isFree$,
|
312 | this.shouldContactSales$
|
313 | ]).pipe(switchMap(( |
314 |
|
315 |
|
316 |
|
317 | ([frequencyTranslations, billedProduct, pricing, isFree, shouldContactSales]) => {
|
318 |
|
319 | const frequency = billedProduct ? billedProduct.billingFrequency.toString().toLowerCase() :
|
320 | pricing && pricing.prices.length > 0 ? pricing.prices[0].frequency.toLowerCase() : '';
|
321 |
|
322 | let frequencyString = '';
|
323 | if (frequency === 'yearly') {
|
324 | frequencyString = frequencyTranslations.YEAR;
|
325 | }
|
326 | else if (frequency === 'monthly') {
|
327 | frequencyString = frequencyTranslations.MONTH;
|
328 | }
|
329 | if (!frequencyString || isFree || shouldContactSales) {
|
330 | return of('');
|
331 | }
|
332 | if (billedProduct && billedProduct.commitment) {
|
333 |
|
334 | const initial = billedProduct.commitment.initial;
|
335 |
|
336 | const recurring = billedProduct.commitment.recurring;
|
337 | return this.translateService.stream('FRONTEND.STORE.COMMITMENT_WITH_RENEWAL', {
|
338 | initial: initial,
|
339 | frequencyString: frequencyString,
|
340 | recurring: recurring,
|
341 | });
|
342 | }
|
343 | return of('');
|
344 | })));
|
345 | }
|
346 | }
|
347 | VaPricingComponent.decorators = [
|
348 | { type: Component, args: [{
|
349 | selector: 'va-pricing',
|
350 | template: "<ng-container *ngIf=\"highlightPrice\">\n <highlight-pricing [pricing]=\"pricing\"\n [billedProduct]=\"billedProduct\"\n [highlightPrice]=\"highlightPrice\"\n [isAddon]=\"isAddon\"\n [hasVerifiedContract]=\"hasVerifiedContract\"\n [wrapFrequency]=\"wrapFrequency\"\n [loaded]=\"loaded\">\n </highlight-pricing>\n</ng-container>\n<ng-container *ngIf=\"!highlightPrice\">\n <table-pricing [pricing]=\"pricing\"\n [highlightPrice]=\"highlightPrice\"\n [billedProduct]=\"billedProduct\"\n [hasVerifiedContract]=\"hasVerifiedContract\"\n [loaded]=\"loaded\">\n </table-pricing>\n</ng-container>\n",
|
351 | styles: [""]
|
352 | }] }
|
353 | ];
|
354 |
|
355 | VaPricingComponent.ctorParameters = () => [
|
356 | { type: TranslateService },
|
357 | { type: DisplayPriceService }
|
358 | ];
|
359 | VaPricingComponent.propDecorators = {
|
360 | pricing: [{ type: Input }],
|
361 | billedProduct: [{ type: Input }],
|
362 | wrapFrequency: [{ type: Input }],
|
363 | isAddon: [{ type: Input }],
|
364 | hasVerifiedContract: [{ type: Input }],
|
365 | highlightPrice: [{ type: Input }],
|
366 | loaded: [{ type: Input }]
|
367 | };
|
368 | if (false) {
|
369 |
|
370 | VaPricingComponent.prototype.pricing;
|
371 |
|
372 | VaPricingComponent.prototype.billedProduct;
|
373 |
|
374 | VaPricingComponent.prototype.wrapFrequency;
|
375 |
|
376 | VaPricingComponent.prototype.isAddon;
|
377 |
|
378 | VaPricingComponent.prototype.hasVerifiedContract;
|
379 |
|
380 | VaPricingComponent.prototype.highlightPrice;
|
381 |
|
382 | VaPricingComponent.prototype.loaded;
|
383 |
|
384 | VaPricingComponent.prototype.pricing$$;
|
385 |
|
386 | VaPricingComponent.prototype.billedProduct$$;
|
387 |
|
388 | VaPricingComponent.prototype.hasVerifiedContract$$;
|
389 |
|
390 | VaPricingComponent.prototype.isFree$;
|
391 |
|
392 | VaPricingComponent.prototype.shouldContactSales$;
|
393 |
|
394 | VaPricingComponent.prototype.isFlatPrice$;
|
395 |
|
396 | VaPricingComponent.prototype.pricingTierData$;
|
397 |
|
398 | VaPricingComponent.prototype.priceData$;
|
399 |
|
400 | VaPricingComponent.prototype.commitmentMessage$;
|
401 | |
402 |
|
403 |
|
404 |
|
405 | VaPricingComponent.prototype.translateService;
|
406 | |
407 |
|
408 |
|
409 |
|
410 | VaPricingComponent.prototype.displayPriceService;
|
411 | }
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 | class HighlightPricingComponent extends VaPricingComponent {
|
418 | }
|
419 | HighlightPricingComponent.decorators = [
|
420 | { type: Component, args: [{
|
421 | selector: 'highlight-pricing',
|
422 | template: "<ng-container *ngIf=\"loaded; else loading\">\n <div class=\"no-price\" *ngIf=\"shouldContactSales$ | async; else dontContactSales\">\n {{ 'FRONTEND.STORE.CONTACT_SALES' | translate }}\n </div>\n <ng-template #dontContactSales>\n <div class=\"no-price\" *ngIf=\"isFree$ | async; else notFree\">\n <b>{{ 'FRONTEND.STORE.FREE' | translate }}</b>\n </div>\n <ng-template #notFree>\n <ng-container *ngIf=\"!isAddon\">\n <ng-container *ngIf=\"hasVerifiedContract && billedProduct; else usePricing\">\n <div *ngFor=\"let tier of pricingTierData$ | async\" class=\"price-box\">\n <span>\n <span *ngIf=\"tier.isStartingPrice\" class=\"starting-at\">{{ 'FRONTEND.STORE.STARTING_AT' | translate }}</span>\n <b class=\"price-number\">{{ tier.priceStringForTierWithoutFreq }}</b>\n </span>\n <span class=\"tier-billing-freq\" [ngClass]=\"{'va-wrap': wrapFrequency}\">\n {{ tier.pricingTierForProduct }}\n </span>\n </div>\n </ng-container>\n <ng-template #usePricing>\n <ng-container *ngIf=\"pricing?.prices\">\n <div *ngFor=\"let price of priceData$ | async; let i = index\" class=\"price-box\">\n <span>\n <span *ngIf=\"price.isStartingPrice\" class=\"starting-at\">{{ 'FRONTEND.STORE.STARTING_AT' | translate }}</span>\n <b class=\"price-number\">\n <ng-container *ngIf=\"i == 1\">+</ng-container>\n {{ price.priceStringForPricingWithoutFrequency }}\n </b>\n </span>\n <span *ngIf=\"price.frequencyString\" class=\"billing-freq\" [ngClass]=\"{'va-wrap': wrapFrequency}\">\n {{ price.frequencyString }}\n </span>\n </div>\n </ng-container>\n </ng-template>\n </ng-container>\n <ng-container *ngIf=\"isAddon\">\n <div *ngIf=\"hasVerifiedContract && billedProduct; else useAddonPricing\">\n <div *ngFor=\"let tier of pricingTierData$ | async\" class=\"price-box\">\n <span class=\"addon-billing-freq\">\n {{ tier.pricingTierForAddon }}\n </span>\n <span>\n <span *ngIf=\"tier.isStartingPrice\" class=\"starting-at\">{{ 'FRONTEND.STORE.STARTING_AT' | translate }}</span>\n <b class=\"price-number\">\n {{ tier.priceStringForTier }}\n </b>\n </span>\n </div>\n </div>\n <ng-template #useAddonPricing>\n <div class=\"price-box\">\n <span *ngIf=\"pricing?.prices[0].frequency\" class=\"addon-billing-freq\">\n {{ (priceData$ | async)[0]?.frequencyString }}\n </span>\n <span>\n <span *ngIf=\"pricing?.prices[0]?.isStartingPrice\" class=\"starting-at\">\n {{ 'FRONTEND.STORE.STARTING_AT' | translate }}\n </span>\n <b class=\"price-number\">\n {{ (priceData$ | async)[0]?.priceStringForPricingWithoutFrequency }}\n </b>\n </span>\n </div>\n </ng-template>\n </ng-container>\n <div class=\"commitment\" *ngIf=\"billedProduct && billedProduct.commitment && billedProduct.commitment.initial > 1\">\n {{ commitmentMessage$ | async }}\n </div>\n </ng-template>\n </ng-template>\n</ng-container>\n<ng-template #loading>\n <div class=\"stencil-pricing stencil-shimmer\"></div>\n</ng-template>\n",
|
423 | styles: [":host{color:#9e9e9e}.starting-at{margin-right:5px}.price-box{display:-webkit-box;display:flex;-webkit-box-align:baseline;align-items:baseline;-webkit-box-orient:horizontal;-webkit-box-direction:reverse;flex-direction:row-reverse}.no-price{text-align:center}b{color:#212121;font-size:20px}@media screen and (max-width:600px){.no-price,.price-box,b{font-size:16px}}.billing-freq{text-transform:capitalize;-webkit-box-flex:1;flex:1}.tier-billing-freq{-webkit-box-flex:1;flex:1}.addon-billing-freq{padding-left:5px}.va-wrap{display:block}.stencil-pricing{height:1em}.commitment{color:#9e9e9e;font-size:12px;font-style:italic}"]
|
424 | }] }
|
425 | ];
|
426 |
|
427 |
|
428 |
|
429 |
|
430 |
|
431 | class TablePricingComponent extends VaPricingComponent {
|
432 | }
|
433 | TablePricingComponent.decorators = [
|
434 | { type: Component, args: [{
|
435 | selector: 'table-pricing',
|
436 | template: "<ng-container *ngIf=\"loaded; else loading\">\n <div *ngIf=\"hasVerifiedContract && billedProduct; else usePricing\">\n <div class=\"price-container\" *ngIf=\"isFlatPrice$ | async; else notFlatPrice\">\n <div class=\"price\">\n {{ (pricingTierData$ | async)[0]?.priceStringForTier }}\n </div>\n </div>\n <ng-template #notFlatPrice>\n <div class=\"price-container--tiered\" *ngIf=\"!(isFlatPrice$ | async)\">\n <div class=\"pricing-tier\" *ngFor=\"let tier of pricingTierData$ | async\">\n <div class=\"pricing-tier__range\">{{ tier.pricingTierString }}</div>\n <div class=\"pricing-tier__price\">\n {{ tier.priceStringForTier }}\n </div>\n </div>\n </div>\n </ng-template>\n <div class=\"commitment\" *ngIf=\"billedProduct && billedProduct.commitment && billedProduct.commitment.initial > 1\">\n {{ commitmentMessage$ | async }}\n </div>\n </div>\n <ng-template #usePricing>\n <div class=\"gray-font\">\n <ng-container *ngIf=\"shouldContactSales$ | async; else dontContactSales\">\n {{ 'FRONTEND.STORE.CONTACT_SALES' | translate }}\n </ng-container>\n <ng-template #dontContactSales>\n <ng-container *ngIf=\"isFree$ | async; else notFree\">\n {{ 'FRONTEND.STORE.FREE' | translate }}\n </ng-container>\n <ng-template #notFree>\n {{ (priceData$ | async)[0].priceStringForPricingWithFrequency }}\n <div class=\"commitment\" *ngIf=\"billedProduct && billedProduct.commitment && billedProduct.commitment.initial > 1\">\n {{ commitmentMessage$ | async }}\n </div>\n </ng-template>\n </ng-template>\n </div>\n </ng-template>\n</ng-container>\n<ng-template #loading>\n <div class=\"stencil-pricing stencil-shimmer\"></div>\n</ng-template>\n",
|
437 | styles: [":host{color:#616161}.price-container--tiered{font-size:12px;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;display:-webkit-box;display:flex;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.price-container--tiered .pricing-tier{border-bottom:1px solid #e0e0e0;padding:5px 0;display:-webkit-box;display:flex}.price-container--tiered .pricing-tier:first-child{padding-top:0}.price-container--tiered .pricing-tier:last-child{padding-bottom:0;border-bottom:none}.price-container--tiered .pricing-tier .pricing-tier__range{padding-right:20px;-webkit-box-flex:1;flex:1}.stencil-pricing{height:1em}.commitment{color:#9e9e9e;font-size:12px;font-style:italic}"]
|
438 | }] }
|
439 | ];
|
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 | class VaPricingModule {
|
446 | }
|
447 | VaPricingModule.decorators = [
|
448 | { type: NgModule, args: [{
|
449 | imports: [
|
450 | CommonModule,
|
451 | CoreSharedModule,
|
452 | TranslateModule
|
453 | ],
|
454 | declarations: [VaPricingComponent, HighlightPricingComponent, TablePricingComponent],
|
455 | exports: [VaPricingComponent]
|
456 | },] }
|
457 | ];
|
458 |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 | class StoreCardComponent {
|
464 | |
465 |
|
466 |
|
467 |
|
468 | constructor(imageTransformationService, translateService) {
|
469 | this.imageTransformationService = imageTransformationService;
|
470 | this.translateService = translateService;
|
471 | this.purchasedClicked = new EventEmitter();
|
472 | this.cardClicked = new EventEmitter();
|
473 | this.descriptionClicked = new EventEmitter();
|
474 | this.bannerClicked = new EventEmitter();
|
475 | this.translateService.setTranslation('en', En.en, true);
|
476 | }
|
477 | |
478 |
|
479 |
|
480 | getBannerColorForName() {
|
481 |
|
482 |
|
483 | const COLOR_CODES = [
|
484 | '#EF5350', '#42A5F5', '#66BB6A', '#FFA726', '#AB47BC', '#FFCA28', '#EC407A', '#26C6DA',
|
485 | '#FF7B57'
|
486 | ];
|
487 |
|
488 | let nameSum = 0;
|
489 |
|
490 | const defaultColor = '#808080';
|
491 | if (!this.item.name) {
|
492 | return defaultColor;
|
493 | }
|
494 | for (let i = 0; i < this.item.name.length; i++) {
|
495 | nameSum += this.item.name[i].charCodeAt(0);
|
496 | }
|
497 |
|
498 | const index = nameSum % COLOR_CODES.length;
|
499 | return COLOR_CODES[index];
|
500 | }
|
501 | |
502 |
|
503 |
|
504 |
|
505 | getSrcsetHeaderUrls(imageUrl) {
|
506 | return this.imageTransformationService.getSrcSetForImage(imageUrl, [680, 1360, 2720]);
|
507 | }
|
508 | }
|
509 | StoreCardComponent.decorators = [
|
510 | { type: Component, args: [{
|
511 | selector: 'va-store-card',
|
512 | template: `
|
513 | <mat-card class="hover-card" *ngIf="item" (click)="cardClicked.emit(item)">
|
514 | <div class="hover-area">
|
515 | <div class="product-banner" (click)="bannerClicked.emit(item)"
|
516 | [style.background-color]="item.headerImageUrl ? '': getBannerColorForName()">
|
517 | <img class="img-container" *ngIf="item.headerImageUrl"
|
518 | [src]="item.headerImageUrl" [srcset]="getSrcsetHeaderUrls(item.headerImageUrl)">
|
519 | </div>
|
520 |
|
521 | <div class="description" (click)="descriptionClicked.emit(item)">
|
522 | <mat-card-header>
|
523 | <va-icon mat-card-avatar [diameter]="40" [name]="item.name" [iconUrl]="item.iconUrl"></va-icon>
|
524 | <mat-card-title>{{item.name}}</mat-card-title>
|
525 | <mat-card-subtitle>
|
526 | <ng-container *ngIf="item.pricing; else formatted">
|
527 | <va-pricing [pricing]="item.pricing"
|
528 | [highlightPrice]="false"></va-pricing>
|
529 | </ng-container>
|
530 | <ng-template #formatted>{{item.formattedPrice}}</ng-template>
|
531 | </mat-card-subtitle>
|
532 | </mat-card-header>
|
533 | <mat-card-content> {{ item.tagline }}
|
534 | </mat-card-content>
|
535 | </div>
|
536 |
|
537 | <button *ngIf="item.purchased !== undefined"
|
538 | mat-button color="primary" class="enabled-indicator" (click)="purchasedClicked.emit(item)" [disabled]="item.purchased">
|
539 | <i *ngIf="!item.purchased" class="material-icons">add</i>
|
540 | <i *ngIf="item.purchased" class="material-icons" style="color: #39B74A">check</i>
|
541 | <span>{{ (item.purchased ? 'FRONTEND.STORE.ENABLED_UPPER' : 'FRONTEND.STORE.ENABLE_UPPER') | translate }}</span>
|
542 | </button>
|
543 | </div>
|
544 | </mat-card>
|
545 | `,
|
546 | styles: [":host{position:relative}::ng-deep .mat-card-header-text{width:100%}mat-card.hover-card{overflow:hidden;padding:0;margin-bottom:0}mat-card.hover-card mat-card-subtitle,mat-card.hover-card mat-card-title{margin:0 80px 0 0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}mat-card.hover-card mat-card-subtitle{font-size:12px;margin-top:4px}.hover-area{position:relative;cursor:pointer}.product-banner{max-height:133px;overflow:hidden;display:-webkit-box;display:flex;width:100%;height:100px;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center}.product-banner img{max-width:100%}@media screen and (min-width:480px){.hover-area{padding-top:55%}.hover-area:hover .description{top:0}.hover-area:hover .enabled-indicator span{width:70px}.product-banner{max-height:none;position:absolute;height:60%;top:0}}.description{box-sizing:border-box;padding:10px 16px 0;overflow:hidden;background:#fff;color:#212121;-webkit-transition:.3s;transition:.3s}.description:after{content:'';display:block;width:100%;height:40%;position:absolute;bottom:0;left:0;background:-webkit-gradient(linear,left top,left bottom,color-stop(40%,rgba(255,255,255,0)),color-stop(70%,#fff));background:linear-gradient(rgba(255,255,255,0) 40%,#fff 70%)}mat-card-header{box-sizing:border-box;padding-bottom:16px;margin:0;height:40%;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center}mat-card-content{min-height:40px;max-height:80px;padding:16px;margin:0 -16px;border-top:1px solid #e0e0e0;font-size:12px}.enabled-indicator{position:absolute;right:8px;bottom:8px}.enabled-indicator span{display:inline-block;width:70px;overflow:hidden;-webkit-transition:.3s;transition:.3s}@media screen and (min-width:480px){.description{position:absolute;top:60%;width:100%;height:100%}.description:after{height:70%}mat-card-content{min-height:0;max-height:none}.enabled-indicator span{width:0}}button[mat-button]{padding:0 8px;min-width:0}mat-card-actions{position:relative;padding:8px!important;margin:0!important;text-align:right;border-top:1px solid #e0e0e0;background-color:#fff;color:#212121}.status{font-size:14px}.img-container{height:100%;width:100%}"]
|
547 | }] }
|
548 | ];
|
549 |
|
550 | StoreCardComponent.ctorParameters = () => [
|
551 | { type: ImageTransformationService },
|
552 | { type: TranslateService }
|
553 | ];
|
554 | StoreCardComponent.propDecorators = {
|
555 | item: [{ type: Input }],
|
556 | purchasedClicked: [{ type: Output }],
|
557 | cardClicked: [{ type: Output }],
|
558 | descriptionClicked: [{ type: Output }],
|
559 | bannerClicked: [{ type: Output }]
|
560 | };
|
561 | if (false) {
|
562 |
|
563 | StoreCardComponent.prototype.item;
|
564 |
|
565 | StoreCardComponent.prototype.purchasedClicked;
|
566 |
|
567 | StoreCardComponent.prototype.cardClicked;
|
568 |
|
569 | StoreCardComponent.prototype.descriptionClicked;
|
570 |
|
571 | StoreCardComponent.prototype.bannerClicked;
|
572 | |
573 |
|
574 |
|
575 |
|
576 | StoreCardComponent.prototype.imageTransformationService;
|
577 | |
578 |
|
579 |
|
580 |
|
581 | StoreCardComponent.prototype.translateService;
|
582 | }
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 | class StoreCardModule {
|
589 | }
|
590 | StoreCardModule.decorators = [
|
591 | { type: NgModule, args: [{
|
592 | imports: [
|
593 | CommonModule,
|
594 | VaIconModule,
|
595 | MatCardModule,
|
596 | MatButtonModule,
|
597 | MatIconModule,
|
598 | MatMenuModule,
|
599 | ImageTransformationModule,
|
600 | VaPricingModule,
|
601 | TranslateModule
|
602 | ],
|
603 | declarations: [StoreCardComponent],
|
604 | exports: [StoreCardComponent]
|
605 | },] }
|
606 | ];
|
607 |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 | class StoreComponent {
|
613 | constructor() {
|
614 | this.items = [];
|
615 | this.searchable = true;
|
616 | this.itemClicked = new EventEmitter();
|
617 | }
|
618 | |
619 |
|
620 |
|
621 | get filteredItems() {
|
622 | if (this.filterTerm) {
|
623 | return this.items.filter(( |
624 |
|
625 |
|
626 |
|
627 | pkg => pkg.name.toLowerCase().indexOf(this.filterTerm.toLowerCase()) !== -1));
|
628 | }
|
629 | return this.items;
|
630 | }
|
631 | }
|
632 | StoreComponent.decorators = [
|
633 | { type: Component, args: [{
|
634 | selector: 'va-store',
|
635 | template: `
|
636 | <div class="toolbar">
|
637 | <div *ngIf="searchable" class="table-controls-row">
|
638 | <va-search-box (update)="filterTerm = $event"></va-search-box>
|
639 | </div>
|
640 | </div>
|
641 | <div class="row row-gutters">
|
642 | <div *ngFor="let item of filteredItems" class="col-flex">
|
643 | <va-store-card [item]="item" (cardClicked)="this.itemClicked.emit(item)"></va-store-card>
|
644 | </div>
|
645 | </div>
|
646 | `,
|
647 | styles: [".flex-row{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row}.toolbar{padding:0;background-color:#fff;color:#616161}.toolbar .disabled{cursor:default}.toolbar .disabled mat-icon{cursor:default;color:#9e9e9e}.toolbar va-search-box{margin-right:10px;width:350px}.toolbar .table-controls-row{padding:0 10px 10px;display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-box-align:center;align-items:center}.toolbar .table-controls-row:first-of-type{padding-top:10px}.top-border{border-top:1px solid #fff}.selected{background-color:#fff}.row{display:-webkit-box;display:flex;flex-wrap:wrap}.row+.row-gutters{margin-top:0}.row-gutters{margin-top:-20px;margin-left:-20px}.row-gutters>.col-flex{padding-top:20px;padding-left:20px}.col-flex{position:relative;max-width:100%;box-sizing:border-box;-webkit-box-flex:0;flex:0 0 auto;width:100%}@media screen and (min-width:480px){.col-flex{width:50%}}@media screen and (min-width:1200px){.col-flex{width:33.333333%}}"]
|
648 | }] }
|
649 | ];
|
650 | StoreComponent.propDecorators = {
|
651 | items: [{ type: Input }],
|
652 | searchable: [{ type: Input }],
|
653 | itemClicked: [{ type: Output }]
|
654 | };
|
655 | if (false) {
|
656 |
|
657 | StoreComponent.prototype.items;
|
658 |
|
659 | StoreComponent.prototype.searchable;
|
660 |
|
661 | StoreComponent.prototype.itemClicked;
|
662 |
|
663 | StoreComponent.prototype.filterTerm;
|
664 | }
|
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 | class DropDownFormSectionComponent {
|
671 | |
672 |
|
673 |
|
674 | constructor(translateService) {
|
675 | this.translateService = translateService;
|
676 | this.startOpen = false;
|
677 | this.displayAutoTitle = false;
|
678 | this.titleText = '';
|
679 | this.displayAutoDescription = true;
|
680 | this.descriptionText = '';
|
681 | this.editingHint = '';
|
682 | this.expandable = true;
|
683 | this.autoDescriptionText = '';
|
684 | this.iconName = 'help_outline';
|
685 | this.subscriptions = [];
|
686 | this.uniqueIndex = 1;
|
687 | this.autoTitleText = '';
|
688 | this.translateService.setTranslation('en', En.en, true);
|
689 | }
|
690 | |
691 |
|
692 |
|
693 | ngOnInit() {
|
694 |
|
695 | const allFieldsHidden = this.fields.reduce(( |
696 |
|
697 |
|
698 |
|
699 |
|
700 |
|
701 |
|
702 | (p, c, i, a) => p && c.hidden), true);
|
703 | if (allFieldsHidden) {
|
704 | this.expandable = false;
|
705 | }
|
706 | while (this.parentForm.controls.hasOwnProperty(this.titleText + this.uniqueIndex)) {
|
707 | this.uniqueIndex += 1;
|
708 | }
|
709 | this.parentForm.addControl(this.titleText + this.uniqueIndex, this.toFormGroup(this.fields));
|
710 |
|
711 | const form = ( (this.parentForm.controls[this.titleText + this.uniqueIndex]));
|
712 | for (const key in form.controls) {
|
713 | if (form.controls.hasOwnProperty(key)) {
|
714 | if (this.prepopulatedData != null && this.prepopulatedData.hasOwnProperty(key)) {
|
715 | form.controls[key].setValue(this.prepopulatedData[key]);
|
716 | }
|
717 | }
|
718 | }
|
719 | this.subscriptions.push(combineLatest([
|
720 | form.statusChanges,
|
721 | this.translateService.stream('FRONTEND.STORE.AUTO_TITLE_TEXT')
|
722 | ]).subscribe(( |
723 |
|
724 |
|
725 |
|
726 | ([change, autoTitleText]) => {
|
727 |
|
728 | let missingFields = false;
|
729 | for (const control in form.controls) {
|
730 | if (!form.controls[control].value || (form.controls[control].value.constructor === Array && !form.controls[control].value[0])) {
|
731 | this.iconName = 'help_outline';
|
732 | missingFields = true;
|
733 | if (change === 'INVALID') {
|
734 | this.autoTitleText = autoTitleText.SOME_FIELDS_INVALID;
|
735 | if (form.controls[control].dirty || form.controls[control].touched) {
|
736 | this.iconName = 'warning';
|
737 | break;
|
738 | }
|
739 | }
|
740 | else {
|
741 | this.autoTitleText = autoTitleText.OPTIONAL_FIELDS_UNANSWERED;
|
742 | }
|
743 | }
|
744 | }
|
745 | if (!missingFields) {
|
746 | this.iconName = 'check_circle';
|
747 | this.autoTitleText = autoTitleText.COMPLETE;
|
748 | }
|
749 | })));
|
750 | if (this.displayAutoDescription) {
|
751 | this.subscriptions.push(form.valueChanges.subscribe(( |
752 |
|
753 |
|
754 |
|
755 | changes => {
|
756 |
|
757 | let description = '';
|
758 | for (const key in changes) {
|
759 | if (changes.hasOwnProperty(key) && changes[key] != null && changes[key].length > 0) {
|
760 | if (changes[key][0].name) {
|
761 | for (const fileKey in changes[key]) {
|
762 | if (changes[key][fileKey] != null) {
|
763 | description += changes[key][fileKey].name;
|
764 | description += ', ';
|
765 | }
|
766 | }
|
767 | }
|
768 | else {
|
769 | description += changes[key];
|
770 | description += ', ';
|
771 | }
|
772 | }
|
773 | }
|
774 | this.autoDescriptionText = description.substring(0, description.length - 2);
|
775 | })));
|
776 | }
|
777 | form.updateValueAndValidity({ onlySelf: false, emitEvent: true });
|
778 | }
|
779 | |
780 |
|
781 |
|
782 |
|
783 | toFormGroup(formFields) {
|
784 |
|
785 | const group = {};
|
786 | formFields.forEach(( |
787 |
|
788 |
|
789 |
|
790 | field => {
|
791 |
|
792 | let validations;
|
793 | if (!field.required || field.hidden) {
|
794 | validations = field.validator;
|
795 | }
|
796 | else if (field.controlType === 'checkbox') {
|
797 | validations = [Validators.requiredTrue, field.validator];
|
798 | }
|
799 | else {
|
800 | validations = [Validators.required, field.validator];
|
801 | }
|
802 |
|
803 | const formControl = new FormControl({ value: field.value, disabled: field.disabled }, validations);
|
804 | group[field.id] = formControl;
|
805 | this.subscriptions.push(formControl.valueChanges.subscribe(( |
806 |
|
807 |
|
808 |
|
809 | value => (field.value = value))));
|
810 | }));
|
811 | return new FormGroup(group);
|
812 | }
|
813 | |
814 |
|
815 |
|
816 | ngOnDestroy() {
|
817 | this.subscriptions.forEach(( |
818 |
|
819 |
|
820 |
|
821 | subscription => subscription.unsubscribe()));
|
822 | }
|
823 | }
|
824 | DropDownFormSectionComponent.decorators = [
|
825 | { type: Component, args: [{
|
826 | selector: 'va-dropdown-form-section',
|
827 | template: `
|
828 | <mat-expansion-panel *ngIf="expandable || expandable == undefined" [expanded]="startOpen">
|
829 | <mat-expansion-panel-header [collapsedHeight]="'*'" [expandedHeight]="'*'">
|
830 | <div class="dropdown-form-header">
|
831 | <mat-icon
|
832 | [ngClass]="{invalid: iconName=='warning', valid: iconName=='check_circle', question: iconName=='help_outline'}">
|
833 | {{ iconName }}
|
834 | </mat-icon>
|
835 | <mat-panel-title *ngIf="!displayAutoTitle">
|
836 | {{ titleText }}
|
837 | </mat-panel-title>
|
838 | <mat-panel-title *ngIf="displayAutoTitle"
|
839 | [ngClass]="{valid: iconName=='check_circle', invalid: iconName=='warning'}">
|
840 | <div class="title"> {{ titleText }}</div>
|
841 | <div *ngIf="titleText && autoTitleText"> </div>
|
842 | <div><ng-container><i> {{autoTitleText}} </i></ng-container></div>
|
843 | </mat-panel-title>
|
844 | <mat-panel-description *ngIf="displayAutoDescription" [ngClass]="{invalid: iconName=='warning'}">
|
845 | {{ autoDescriptionText }}
|
846 | </mat-panel-description>
|
847 | <mat-panel-description *ngIf="!displayAutoDescription" [ngClass]="{invalid: iconName=='warning'}">
|
848 | <i> {{descriptionText}} </i>
|
849 | </mat-panel-description>
|
850 | </div>
|
851 | </mat-expansion-panel-header>
|
852 | <div class="expansion-panel-body">
|
853 | <va-field *ngFor="let field of fields" [field]="field"
|
854 | [form]="parentForm.controls[titleText + uniqueIndex]"
|
855 | ></va-field>
|
856 | <p *ngIf="editingHint != ''" class="editing-hint"><i>{{ editingHint }}</i></p>
|
857 | </div>
|
858 | </mat-expansion-panel>
|
859 | `,
|
860 | styles: [":host-context(va-dropdown-form-section){font-size:14px}:host-context(va-dropdown-form-section) .expansion-panel-body{margin-top:-10px;display:block}@media screen and (min-width:600px){:host-context(va-dropdown-form-section) .expansion-panel-body{width:60%}}.mat-expanded,.mat-expansion-panel{-webkit-transition:margin .4s;transition:margin .4s}mat-expansion-panel-header{min-height:48px;padding:12px 24px}.dropdown-form-header{width:90%;display:-webkit-box;display:flex}mat-panel-description{align-self:center;-webkit-box-flex:inherit;flex:inherit;display:initial;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}mat-panel-description.invalid{color:#c62828}mat-icon{margin-right:7px;-ms-grid-row-align:center;align-self:center}mat-icon.valid{color:#4caf50}mat-icon.invalid{color:#c62828}mat-icon.question{color:#9e9e9e}mat-panel-title{align-self:center;-webkit-box-flex:0;flex:none;margin-right:20px;display:-webkit-box;display:flex;max-width:100%}mat-panel-title div{display:-webkit-box;display:flex}mat-panel-title.valid{color:#4caf50}mat-panel-title.invalid{color:#c62828}.editing-hint{color:#9e9e9e}.title{color:#212121}.not-expandable-card{background:#fff;cursor:default;font-size:15px;display:-webkit-box;display:flex;height:48px;-webkit-box-align:center;align-items:center;box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)}.not-expandable-card .not-expandable-icon{margin-left:24px}.not-expandable-card .not-expandable-header{display:-webkit-box;display:flex}.not-expandable-card .not-expandable-description{margin-left:22px}.not-expandable-card .valid{color:#4caf50}"]
|
861 | }] }
|
862 | ];
|
863 |
|
864 | DropDownFormSectionComponent.ctorParameters = () => [
|
865 | { type: TranslateService }
|
866 | ];
|
867 | DropDownFormSectionComponent.propDecorators = {
|
868 | prepopulatedData: [{ type: Input }],
|
869 | startOpen: [{ type: Input }],
|
870 | parentForm: [{ type: Input }],
|
871 | displayAutoTitle: [{ type: Input }],
|
872 | titleText: [{ type: Input }],
|
873 | displayAutoDescription: [{ type: Input }],
|
874 | descriptionText: [{ type: Input }],
|
875 | fields: [{ type: Input }],
|
876 | editingHint: [{ type: Input }],
|
877 | expandable: [{ type: Input }]
|
878 | };
|
879 | if (false) {
|
880 |
|
881 | DropDownFormSectionComponent.prototype.prepopulatedData;
|
882 |
|
883 | DropDownFormSectionComponent.prototype.startOpen;
|
884 |
|
885 | DropDownFormSectionComponent.prototype.parentForm;
|
886 |
|
887 | DropDownFormSectionComponent.prototype.displayAutoTitle;
|
888 |
|
889 | DropDownFormSectionComponent.prototype.titleText;
|
890 |
|
891 | DropDownFormSectionComponent.prototype.displayAutoDescription;
|
892 |
|
893 | DropDownFormSectionComponent.prototype.descriptionText;
|
894 |
|
895 | DropDownFormSectionComponent.prototype.fields;
|
896 |
|
897 | DropDownFormSectionComponent.prototype.editingHint;
|
898 |
|
899 | DropDownFormSectionComponent.prototype.expandable;
|
900 |
|
901 | DropDownFormSectionComponent.prototype.autoDescriptionText;
|
902 |
|
903 | DropDownFormSectionComponent.prototype.iconName;
|
904 |
|
905 | DropDownFormSectionComponent.prototype.subscriptions;
|
906 |
|
907 | DropDownFormSectionComponent.prototype.uniqueIndex;
|
908 |
|
909 | DropDownFormSectionComponent.prototype.autoTitleText;
|
910 | |
911 |
|
912 |
|
913 |
|
914 | DropDownFormSectionComponent.prototype.translateService;
|
915 | }
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 | class FieldComponent {
|
922 | |
923 |
|
924 |
|
925 | get isValid() {
|
926 | return this.form.controls[this.field.id].valid || this.form.controls[this.field.id].pristine;
|
927 | }
|
928 | |
929 |
|
930 |
|
931 |
|
932 | showCheckboxError(field) {
|
933 | return this.form.controls[field].errors && this.form.controls[field].errors.required && this.form.controls[field].touched;
|
934 | }
|
935 | }
|
936 | FieldComponent.decorators = [
|
937 | { type: Component, args: [{
|
938 | selector: 'va-field',
|
939 | template: "<ng-container [ngSwitch]=\"field.controlType\" [formGroup]=\"form\">\n <div *ngIf=\"!field.hidden\" [ngClass]=\"{'for-office-use-only': field.forOfficeUseOnly}\">\n <span *ngIf=\"field.forOfficeUseOnly\" class=\"office-text\">*For Office Use Only</span>\n\n <ng-container *ngSwitchCase=\"'dropdown'\">\n <ng-container *ngIf=\"!field.allowMultiples\">\n <mat-form-field class=\"form-field-container\">\n <mat-select matInput [formControlName]=\"field.id\" [id]=\"field.id\" [placeholder]=\"field.getLabel()\">\n <mat-option *ngFor=\"let option of field.options\" [value]=\"option.value\">{{ option.label }}</mat-option>\n </mat-select>\n <mat-hint *ngIf=\"field.description\"> {{ field.description }} </mat-hint>\n </mat-form-field>\n </ng-container>\n <ng-container *ngIf=\"field.allowMultiples\">\n <va-input-tags class=\"form-field-container\" [id]=\"field.id\" [formControlName]=\"field.id\"\n [placeholder]=\"field.getLabel()\"\n [tooltip]=\"field.description\"\n [required]=\"field.required\"\n [options]=\"field.options\"\n [allowDuplicates]=\"field.allowDuplicates\"\n [maxFields]=\"field.maxChoices\">\n </va-input-tags>\n </ng-container>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'textbox'\">\n <mat-form-field class=\"form-field-container\">\n <span matPrefix *ngIf=\"field.prefix\"> {{ field.prefix}} </span>\n <input matInput [type]=\"field.textboxType\" [id]=\"field.id\" [formControlName]=\"field.id\" [placeholder]=\"field.getLabel()\" [pattern]=\"field.regexValidator || ''\"\n [readonly]=\"field.displayOnly\" [ngClass]=\"{'display-only': field.displayOnly}\">\n <span matSuffix *ngIf=\"field.suffix\"> {{ field.suffix }} </span>\n <mat-hint *ngIf=\"field.description\"> {{ field.description }} </mat-hint>\n <mat-error *ngIf=\"form.controls[field.id].hasError('pattern')\"> {{field.regexErrorMessage}} </mat-error>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'checkbox'\">\n <div class=\"form-field-container checkbox\">\n <mat-checkbox [formControlName]=\"field.id\" [id]=\"field.id\" ngControlDefault></mat-checkbox>\n <div class=\"checkbox-placeholder\"> {{field.label}}</div>\n <mat-error *ngIf=\"showCheckboxError(field.id)\" class=\"checkboxError\"> *Required </mat-error>\n </div>\n <div class=\"checkbox-description\" *ngIf=\"field.description\">{{ field.description }}</div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'textarea'\">\n <mat-form-field class=\"form-field-container\">\n <textarea matInput [formControlName]=\"field.id\" [placeholder]=\"field.getLabel()\" [id]=\"field.id\"></textarea>\n <mat-hint *ngIf=\"field.description\"> {{ field.description }} </mat-hint>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'file'\">\n <div class=\"form-field-container\">\n <file-group-uploader [uploadUrl]=\"field.uploadUrl\" [label]=\"field.getLabel()\" [description]=\"field.description\" [formGroup]=\"form\" [formControlName]=\"field.id\"\n [numFiles]=\"field.numFiles\" class=\"form-field-container\"></file-group-uploader>\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'vbcuser'\">\n <mat-form-field class=\"form-field-container\">\n <mat-select matInput [formControlName]=\"field.id\" [id]=\"field.id\" [placeholder]=\"field.getLabel()\">\n <mat-option *ngFor=\"let option of field.options\" [value]=\"option.value\" [disabled]=\"option.disabled\">{{ option.label }}</mat-option>\n </mat-select>\n <mat-hint *ngIf=\"field.description\"> {{ field.description }} </mat-hint>\n </mat-form-field>\n </ng-container>\n </div>\n</ng-container>\n",
|
940 | styles: [".form-field-container{font-size:16px;width:100%;margin:10px 0}.checkbox{display:-webkit-box;display:flex;padding:5px 0;color:rgba(0,0,0,.54);margin-top:24px}.checkbox .checkbox-placeholder{margin-left:10px}.checkbox-description{margin-top:-14px;margin-left:32px;color:rgba(0,0,0,.54);font-size:12px}.for-office-use-only{position:relative}.office-text{font-size:8px;position:absolute;right:5px}.display-only{color:rgba(0,0,0,.38)}.checkboxError{padding-left:16px}"]
|
941 | }] }
|
942 | ];
|
943 | FieldComponent.propDecorators = {
|
944 | field: [{ type: Input }],
|
945 | form: [{ type: Input }]
|
946 | };
|
947 | if (false) {
|
948 |
|
949 | FieldComponent.prototype.field;
|
950 |
|
951 | FieldComponent.prototype.form;
|
952 | }
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 | class FieldService {
|
959 | |
960 |
|
961 |
|
962 |
|
963 | createFormControl(field) {
|
964 | if (field.required) {
|
965 | return new FormControl(field.value, Validators.required);
|
966 | }
|
967 | else {
|
968 | return new FormControl(field.value);
|
969 | }
|
970 | }
|
971 | |
972 |
|
973 |
|
974 |
|
975 |
|
976 | toFormGroup(formFields, subscriptions) {
|
977 |
|
978 | const group = {};
|
979 | formFields.forEach(( |
980 |
|
981 |
|
982 |
|
983 | field => {
|
984 |
|
985 | let formControl;
|
986 | if (field.controlType === 'checkbox') {
|
987 | formControl = new FormControl(field.value);
|
988 | }
|
989 | else {
|
990 | formControl = this.createFormControl(field);
|
991 | }
|
992 | group[field.id] = formControl;
|
993 | if (subscriptions) {
|
994 | subscriptions.push(formControl.valueChanges.subscribe(( |
995 |
|
996 |
|
997 |
|
998 | value => (field.value = value))));
|
999 | }
|
1000 | }));
|
1001 | return new FormGroup(group);
|
1002 | }
|
1003 | }
|
1004 | FieldService.decorators = [
|
1005 | { type: Injectable }
|
1006 | ];
|
1007 |
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 | class VaHeaderContainerComponent {
|
1013 | |
1014 |
|
1015 |
|
1016 | constructor(translateService) {
|
1017 | this.translateService = translateService;
|
1018 | this.loaded = true;
|
1019 | this.showEnableAddon = false;
|
1020 | this.prerequisiteSelected = new EventEmitter();
|
1021 | this.actionSelected = new EventEmitter();
|
1022 | this.primaryPricingActionSelected = new EventEmitter();
|
1023 | this.pricingActionSelected = new EventEmitter();
|
1024 | this.translateService.setTranslation('en', En.en, true);
|
1025 | }
|
1026 | |
1027 |
|
1028 |
|
1029 | onActionSelected() {
|
1030 | this.actionSelected.emit();
|
1031 | }
|
1032 | |
1033 |
|
1034 |
|
1035 | onPrerequisiteSelected() {
|
1036 | this.prerequisiteSelected.emit();
|
1037 | }
|
1038 | |
1039 |
|
1040 |
|
1041 |
|
1042 | showPricingModel(billedProduct) {
|
1043 | return billedProduct && [BillingModel.Tiered, BillingModel.Stairstep].includes(billedProduct.billingModel);
|
1044 | }
|
1045 | |
1046 |
|
1047 |
|
1048 |
|
1049 | getPricingModelTooltips(billingModel) {
|
1050 | switch (billingModel) {
|
1051 | case BillingModel.Stairstep:
|
1052 | return this.translateService.stream('FRONTEND.STORE.PRICE_APPLIES_PER_UNIT');
|
1053 | case BillingModel.Tiered:
|
1054 | return this.translateService.stream('FRONTEND.STORE.PRICE_APPLIES_TO_ALL_UNITS');
|
1055 | default:
|
1056 | return of('');
|
1057 | }
|
1058 | }
|
1059 | }
|
1060 | VaHeaderContainerComponent.decorators = [
|
1061 | { type: Component, args: [{
|
1062 | selector: 'va-header-container',
|
1063 | template: "<div class=\"header-container\">\n <div class=\"product-overview\">\n <div class=\"product-id\">\n\n <va-icon [iconUrl]=\"iconUrl\" [name]=\"title\" [diameter]=\"120\"></va-icon>\n\n <div class=\"product-id-text\">\n\n <h1 [ngClass]=\"{'stencil-title stencil-shimmer': !title, 'product-title': title}\">\n {{ title }}\n </h1>\n\n <span [ngClass]=\"{'stencil-tagline stencil-shimmer': !title && !tagline, 'tagline': tagline}\">\n {{ tagline }}\n </span>\n\n <div *ngIf=\"prerequisite\" class=\"prerequisite\">\n <span class=\"requires-text\">{{ 'FRONTEND.STORE.REQUIRES' | translate }}</span>\n <span>{{ prerequisite }}</span>\n </div>\n\n <mat-chip-list>\n <mat-chip *ngFor=\"let chip of chipLabels\">{{ chip }}</mat-chip>\n </mat-chip-list>\n\n </div>\n </div>\n\n <div class=\"pricing\">\n\n <button *ngIf=\"showAction && !showEnableAddon\" mat-raised-button class=\"app-enable-button\" [disabled]=\"!actionEnabled\" (click)=\"onActionSelected()\">\n {{ actionLabel }}\n </button>\n\n <button *ngIf=\"showEnableAddon && !showAction\" mat-raised-button class=\"app-enable-button\" [disabled]=\"!showEnableAddon\" (click)=\"onActionSelected()\">\n {{ actionLabel }}\n </button>\n\n <div *ngIf=\"prerequisiteLabel && !showEnableAddon\" class=\"addon-enable\" (click)=\"onPrerequisiteSelected()\">\n {{ 'FRONTEND.STORE.ENABLED_WITH_PREREQUISITE' | translate: {prerequisite: prerequisiteLabel } }}\n </div>\n\n <div *ngIf=\"showPricing\" class=\"price-box\">\n <div *ngIf=\"pricing?.prices?.length\" class=\"wholesale-price\">{{ pricingLabel }}\n <div *ngIf=\"showPricingModel(billedProduct) && hasVerifiedContract\"\n class=\"pricing-model\"\n [matTooltip]=\"getPricingModelTooltips(billedProduct.billingModel) | async\">({{ billedProduct.billingModel }})\n </div>\n </div>\n <va-pricing [pricing]=\"pricing\"\n [billedProduct]=\"billedProduct\"\n [hasVerifiedContract]=\"hasVerifiedContract\"\n [loaded]=\"loaded\"></va-pricing>\n </div>\n\n <p *ngIf=\"pricingActionEnabled\" class=\"pricing-action-container\">\n <a (click)=\"primaryPricingActionSelected.emit()\">{{ primaryPricingActionLabel }}</a>\n <a (click)=\"pricingActionSelected.emit()\">{{ pricingActionLabel }}</a>\n </p>\n\n </div>\n\n </div>\n</div>\n",
|
1064 | styles: [":host{font-size:16px}.product-title{font-size:24px}.product-overview{display:-webkit-box;display:flex;flex-wrap:wrap;border-bottom:1px solid #e0e0e0}.product-overview h1{margin:0;font-weight:400;line-height:1.2}.product-overview mat-chip{margin-bottom:3px}.product-id{display:-webkit-box;display:flex;width:100%;padding:24px;-webkit-box-flex:1;flex-grow:1}.product-id va-icon{margin-right:20px}@media screen and (max-width:600px){.product-id va-icon ::ng-deep .va-icon-container{width:40px!important;height:40px!important}.product-id va-icon ::ng-deep .va-icon-container span{line-height:40px!important;font-size:15px!important}}.product-id .product-id-text{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-pack:center;justify-content:center}.product-id span{overflow:hidden}.product-id .tagline{color:#616161;margin:.5em 0 1em;font-size:16px}@media screen and (min-width:600px){.product-title{font-size:32px}.product-id .tagline{font-size:20px}.product-id{width:66%;padding-right:20px}}.product-id .prerequisite{margin:.5em 0 1em;font-size:14px}.product-id .requires-text{color:#9e9e9e}.inline-link{display:-webkit-inline-box!important;display:inline-flex!important;color:#1e88e5;cursor:pointer;padding-top:5px}.pricing{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;width:100%;padding:0 24px 24px;color:#616161}@media screen and (min-width:600px){.pricing{width:34%;padding-top:24px;padding-left:20px}}.pricing span{display:block}.pricing span:nth-child(2){margin:.5em 0 1em}.pricing .price{font-size:24px;font-weight:700;line-height:1;color:#4caf50}.pricing .price-box{padding-top:10px}.pricing .pricing-action-container{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;margin:8px 0}.pricing .pricing-action-container mat-icon{vertical-align:middle;margin-right:6px}.pricing .pricing-action-container a{cursor:pointer;margin:5px 0}.pricing .pricing-model{display:inline-block;font-size:.8rem;color:#9e9e9e;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.app-enable-button{height:inherit;color:#fff;background-color:#4caf50;font-size:20px;padding:14px 16px;line-height:1}.addon-enable{height:inherit;background-color:#e0e0e0;font-size:14px;padding:14px 16px;line-height:1;color:#1e88e5;cursor:pointer;text-align:center}.wholesale-price{margin-top:0;padding-bottom:8px;margin-bottom:4px;border-bottom:1px solid #e0e0e0}.stencil-title{height:32px;width:200px;margin-bottom:5px!important}.stencil-tagline{height:32px;width:250px}"]
|
1065 | }] }
|
1066 | ];
|
1067 |
|
1068 | VaHeaderContainerComponent.ctorParameters = () => [
|
1069 | { type: TranslateService }
|
1070 | ];
|
1071 | VaHeaderContainerComponent.propDecorators = {
|
1072 | iconUrl: [{ type: Input }],
|
1073 | title: [{ type: Input }],
|
1074 | tagline: [{ type: Input }],
|
1075 | prerequisite: [{ type: Input }],
|
1076 | chipLabels: [{ type: Input }],
|
1077 | pricing: [{ type: Input }],
|
1078 | billedProduct: [{ type: Input }],
|
1079 | loaded: [{ type: Input }],
|
1080 | hasVerifiedContract: [{ type: Input }],
|
1081 | pricingLabel: [{ type: Input }],
|
1082 | primaryPricingActionLabel: [{ type: Input }],
|
1083 | pricingActionLabel: [{ type: Input }],
|
1084 | pricingActionEnabled: [{ type: Input }],
|
1085 | actionEnabled: [{ type: Input }],
|
1086 | actionLabel: [{ type: Input }],
|
1087 | showAction: [{ type: Input }],
|
1088 | showPricing: [{ type: Input }],
|
1089 | showEnableAddon: [{ type: Input }],
|
1090 | prerequisiteLabel: [{ type: Input }],
|
1091 | prerequisiteSelected: [{ type: Output }],
|
1092 | actionSelected: [{ type: Output }],
|
1093 | primaryPricingActionSelected: [{ type: Output }],
|
1094 | pricingActionSelected: [{ type: Output }]
|
1095 | };
|
1096 | if (false) {
|
1097 |
|
1098 | VaHeaderContainerComponent.prototype.iconUrl;
|
1099 |
|
1100 | VaHeaderContainerComponent.prototype.title;
|
1101 |
|
1102 | VaHeaderContainerComponent.prototype.tagline;
|
1103 |
|
1104 | VaHeaderContainerComponent.prototype.prerequisite;
|
1105 |
|
1106 | VaHeaderContainerComponent.prototype.chipLabels;
|
1107 |
|
1108 | VaHeaderContainerComponent.prototype.pricing;
|
1109 |
|
1110 | VaHeaderContainerComponent.prototype.billedProduct;
|
1111 |
|
1112 | VaHeaderContainerComponent.prototype.loaded;
|
1113 |
|
1114 | VaHeaderContainerComponent.prototype.hasVerifiedContract;
|
1115 |
|
1116 | VaHeaderContainerComponent.prototype.pricingLabel;
|
1117 |
|
1118 | VaHeaderContainerComponent.prototype.primaryPricingActionLabel;
|
1119 |
|
1120 | VaHeaderContainerComponent.prototype.pricingActionLabel;
|
1121 |
|
1122 | VaHeaderContainerComponent.prototype.pricingActionEnabled;
|
1123 |
|
1124 | VaHeaderContainerComponent.prototype.actionEnabled;
|
1125 |
|
1126 | VaHeaderContainerComponent.prototype.actionLabel;
|
1127 |
|
1128 | VaHeaderContainerComponent.prototype.showAction;
|
1129 |
|
1130 | VaHeaderContainerComponent.prototype.showPricing;
|
1131 |
|
1132 | VaHeaderContainerComponent.prototype.showEnableAddon;
|
1133 |
|
1134 | VaHeaderContainerComponent.prototype.prerequisiteLabel;
|
1135 |
|
1136 | VaHeaderContainerComponent.prototype.prerequisiteSelected;
|
1137 |
|
1138 | VaHeaderContainerComponent.prototype.actionSelected;
|
1139 |
|
1140 | VaHeaderContainerComponent.prototype.primaryPricingActionSelected;
|
1141 |
|
1142 | VaHeaderContainerComponent.prototype.pricingActionSelected;
|
1143 | |
1144 |
|
1145 |
|
1146 |
|
1147 | VaHeaderContainerComponent.prototype.translateService;
|
1148 | }
|
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 |
|
1154 | class VaHeaderContainerModule {
|
1155 | }
|
1156 | VaHeaderContainerModule.decorators = [
|
1157 | { type: NgModule, args: [{
|
1158 | imports: [
|
1159 | CommonModule,
|
1160 | MatIconModule,
|
1161 | VaPricingModule,
|
1162 | VaIconModule,
|
1163 | MatChipsModule,
|
1164 | MatButtonModule,
|
1165 | MatTooltipModule,
|
1166 | TranslateModule
|
1167 | ],
|
1168 | declarations: [VaHeaderContainerComponent],
|
1169 | exports: [VaHeaderContainerComponent]
|
1170 | },] }
|
1171 | ];
|
1172 |
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 | class OrderFormSectionData {
|
1178 | }
|
1179 | if (false) {
|
1180 |
|
1181 | OrderFormSectionData.prototype.parentForm;
|
1182 |
|
1183 | OrderFormSectionData.prototype.titleText;
|
1184 |
|
1185 | OrderFormSectionData.prototype.subtitleText;
|
1186 |
|
1187 | OrderFormSectionData.prototype.descriptionText;
|
1188 |
|
1189 | OrderFormSectionData.prototype.iconUrl;
|
1190 |
|
1191 | OrderFormSectionData.prototype.primarySection;
|
1192 |
|
1193 | OrderFormSectionData.prototype.subsections;
|
1194 | }
|
1195 |
|
1196 |
|
1197 |
|
1198 |
|
1199 |
|
1200 | class OrderFormSectionComponent {
|
1201 | constructor() { }
|
1202 | |
1203 |
|
1204 |
|
1205 | ngOnInit() {
|
1206 |
|
1207 |
|
1208 | const topSection = this.getTopSection();
|
1209 | if (topSection) {
|
1210 | topSection.startOpen = true;
|
1211 | }
|
1212 | }
|
1213 | |
1214 |
|
1215 |
|
1216 | getTopSection() {
|
1217 | if (!this.data) {
|
1218 | return null;
|
1219 | }
|
1220 | if (this.data.primarySection) {
|
1221 | return this.data.primarySection;
|
1222 | }
|
1223 | if (this.data.subsections && this.data.subsections.length > 0) {
|
1224 | return this.data.subsections[0];
|
1225 | }
|
1226 | return null;
|
1227 | }
|
1228 | }
|
1229 | OrderFormSectionComponent.decorators = [
|
1230 | { type: Component, args: [{
|
1231 | selector: 'va-order-form-section',
|
1232 | template: "<div>\n <mat-card class=\"va-order-form-section-header mat-card\">\n <div class=\"product-overview\">\n <div class=\"product-id\">\n <va-icon [iconUrl]=\"data.iconUrl\" [name]=\"data.titleText\" [diameter]=\"45\"></va-icon>\n <div class=\"product-id-text\">\n <h1 class=\"product-title\">{{ data.titleText }}</h1>\n <span *ngIf=\"data.subtitleText\" class=\"tagline\">{{ data.subtitleText }}</span>\n </div>\n </div>\n <div class=\"description\" *ngIf=\"data.descriptionText\">\n <span>{{ data.descriptionText }}</span>\n </div>\n </div>\n </mat-card>\n <va-dropdown-form-section class=\"va-primary-form-section\" *ngIf=\"data.primarySection\"\n [titleText]=\"data.primarySection.titleText\"\n [editingHint]=\"data.primarySection.editingHint\"\n [displayAutoDescription]=\"data.primarySection.displayAutoDescription\"\n [descriptionText]=\"data.primarySection.descriptionText\"\n [displayAutoTitle]=\"data.primarySection.displayAutoTitle\"\n [prepopulatedData]=\"data.primarySection.prepopulatedData\"\n [parentForm]=\"data.parentForm\"\n [fields]=\"data.primarySection.fields\"\n [startOpen]=\"data.primarySection.startOpen\"\n [expandable]=\"data.primarySection.expandable\">\n </va-dropdown-form-section>\n <ng-container *ngIf=\"data.subsections?.length > 0\">\n <va-dropdown-form-section class=\"va-secondary-form-section\" *ngFor=\"let addon of data.subsections\"\n [titleText]=\"addon.titleText\"\n [editingHint]=\"addon.editingHint\"\n [displayAutoDescription]=\"addon.displayAutoDescription\"\n [descriptionText]=\"addon.descriptionText\"\n [displayAutoTitle]=\"addon.displayAutoTitle\"\n [prepopulatedData]=\"addon.prepopulatedData\"\n [parentForm]=\"data.parentForm\"\n [fields]=\"addon.fields\"\n [startOpen]=\"addon.startOpen\"\n [expandable]=\"addon.expandable\">\n </va-dropdown-form-section>\n </ng-container>\n <ng-container *ngIf=\"!data.primarySection && !(data.subsections?.length > 0)\">\n <mat-card class=\"not-expandable-card\">\n <ng-content></ng-content>\n </mat-card>\n </ng-container>\n</div>\n",
|
1233 | styles: [":host{font-size:16px}mat-card.va-order-form-section-header{margin-bottom:0;border-bottom-color:#e0e0e0;border-bottom-width:1px;box-shadow:0 0 1px -2px rgba(0,0,0,.2),0 0 2px 0 rgba(0,0,0,.14),0 0 5px 0 rgba(0,0,0,.12)}.product-title{font-size:16px}va-mat-card{margin-bottom:24px}.product-overview{display:-webkit-box;display:flex;flex-wrap:wrap}.product-overview h1{margin:0;font-weight:700}.product-id{display:-webkit-box;display:flex;width:100%;-webkit-box-flex:1;flex-grow:1}.product-id va-icon{margin-right:20px}@media screen and (max-width:600px){.product-id va-icon ::ng-deep .va-icon-container{width:40px!important;height:40px!important}}.product-id .product-id-text{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-pack:center;justify-content:center}.product-id span{display:block;overflow:hidden}.product-id .tagline{color:#616161;margin-top:8px;font-size:16px}@media screen and (min-width:600px){.product-id{width:66%;padding-right:16px}}.description{padding-top:16px;width:100%;color:#616161}"]
|
1234 | }] }
|
1235 | ];
|
1236 |
|
1237 | OrderFormSectionComponent.ctorParameters = () => [];
|
1238 | OrderFormSectionComponent.propDecorators = {
|
1239 | data: [{ type: Input }]
|
1240 | };
|
1241 | if (false) {
|
1242 |
|
1243 | OrderFormSectionComponent.prototype.data;
|
1244 | }
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 | class DropDownFormSectionData {
|
1251 | constructor() {
|
1252 |
|
1253 | this.expandable = true;
|
1254 |
|
1255 | }
|
1256 | }
|
1257 | if (false) {
|
1258 |
|
1259 | DropDownFormSectionData.prototype.prepopulatedData;
|
1260 |
|
1261 | DropDownFormSectionData.prototype.startOpen;
|
1262 |
|
1263 | DropDownFormSectionData.prototype.parentForm;
|
1264 |
|
1265 | DropDownFormSectionData.prototype.displayAutoTitle;
|
1266 |
|
1267 | DropDownFormSectionData.prototype.titleText;
|
1268 |
|
1269 | DropDownFormSectionData.prototype.displayAutoDescription;
|
1270 |
|
1271 | DropDownFormSectionData.prototype.descriptionText;
|
1272 |
|
1273 | DropDownFormSectionData.prototype.fields;
|
1274 |
|
1275 | DropDownFormSectionData.prototype.editingHint;
|
1276 |
|
1277 | DropDownFormSectionData.prototype.expandable;
|
1278 | }
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 | function OrderLabelsInterface() { }
|
1288 | if (false) {
|
1289 |
|
1290 | OrderLabelsInterface.prototype.commonForm;
|
1291 | }
|
1292 |
|
1293 |
|
1294 |
|
1295 | function OrderFormInterface() { }
|
1296 | if (false) {
|
1297 |
|
1298 | OrderFormInterface.prototype.appId;
|
1299 |
|
1300 | OrderFormInterface.prototype.addonId;
|
1301 |
|
1302 | OrderFormInterface.prototype.commonForm;
|
1303 |
|
1304 | OrderFormInterface.prototype.commonFormRequiredFields;
|
1305 |
|
1306 | OrderFormInterface.prototype.customFields;
|
1307 | }
|
1308 |
|
1309 |
|
1310 |
|
1311 | function IncludedCommonFormFieldsInterface() { }
|
1312 | if (false) {
|
1313 |
|
1314 | IncludedCommonFormFieldsInterface.prototype.businessName;
|
1315 |
|
1316 | IncludedCommonFormFieldsInterface.prototype.businessAddress;
|
1317 |
|
1318 | IncludedCommonFormFieldsInterface.prototype.businessPhoneNumber;
|
1319 |
|
1320 | IncludedCommonFormFieldsInterface.prototype.businessAccountGroupId;
|
1321 |
|
1322 | IncludedCommonFormFieldsInterface.prototype.businessWebsite;
|
1323 |
|
1324 | IncludedCommonFormFieldsInterface.prototype.salespersonName;
|
1325 |
|
1326 | IncludedCommonFormFieldsInterface.prototype.salespersonPhoneNumber;
|
1327 |
|
1328 | IncludedCommonFormFieldsInterface.prototype.salespersonEmail;
|
1329 |
|
1330 | IncludedCommonFormFieldsInterface.prototype.contactName;
|
1331 |
|
1332 | IncludedCommonFormFieldsInterface.prototype.contactPhoneNumber;
|
1333 |
|
1334 | IncludedCommonFormFieldsInterface.prototype.contactEmail;
|
1335 | }
|
1336 |
|
1337 |
|
1338 |
|
1339 | function CommonFormSectionInterface() { }
|
1340 | if (false) {
|
1341 |
|
1342 | CommonFormSectionInterface.prototype.fields;
|
1343 |
|
1344 | CommonFormSectionInterface.prototype.sectionName;
|
1345 |
|
1346 | CommonFormSectionInterface.prototype.populatedData;
|
1347 | }
|
1348 |
|
1349 |
|
1350 |
|
1351 | function AddonKeyInterface() { }
|
1352 | if (false) {
|
1353 |
|
1354 | AddonKeyInterface.prototype.addonId;
|
1355 |
|
1356 | AddonKeyInterface.prototype.appId;
|
1357 | }
|
1358 |
|
1359 |
|
1360 |
|
1361 | function CommonFormFieldInterface() { }
|
1362 | if (false) {
|
1363 |
|
1364 | CommonFormFieldInterface.prototype.productIds;
|
1365 |
|
1366 | CommonFormFieldInterface.prototype.addonKeys;
|
1367 | }
|
1368 |
|
1369 |
|
1370 |
|
1371 | function CommonFieldIdsInterface() { }
|
1372 | if (false) {
|
1373 |
|
1374 | CommonFieldIdsInterface.prototype.fieldId;
|
1375 |
|
1376 | CommonFieldIdsInterface.prototype.required;
|
1377 | }
|
1378 |
|
1379 |
|
1380 |
|
1381 | function CommonFormData() { }
|
1382 | if (false) {
|
1383 |
|
1384 | CommonFormData.prototype.contact_email;
|
1385 |
|
1386 | CommonFormData.prototype.contact_name;
|
1387 |
|
1388 | CommonFormData.prototype.contact_phone_number;
|
1389 |
|
1390 | CommonFormData.prototype.business_account_group_id;
|
1391 |
|
1392 | CommonFormData.prototype.business_name;
|
1393 |
|
1394 | CommonFormData.prototype.business_address;
|
1395 |
|
1396 | CommonFormData.prototype.business_phone_number;
|
1397 |
|
1398 | CommonFormData.prototype.business_website;
|
1399 |
|
1400 | CommonFormData.prototype.salesperson_name;
|
1401 |
|
1402 | CommonFormData.prototype.salesperson_email;
|
1403 |
|
1404 | CommonFormData.prototype.salesperson_phone_number;
|
1405 | }
|
1406 | class ProductOrderFormSectionData extends OrderFormSectionData {
|
1407 | }
|
1408 | if (false) {
|
1409 |
|
1410 | ProductOrderFormSectionData.prototype.productId;
|
1411 |
|
1412 | ProductOrderFormSectionData.prototype.subsections;
|
1413 | }
|
1414 | class AddonDropDownFormSectionData extends DropDownFormSectionData {
|
1415 | }
|
1416 | if (false) {
|
1417 |
|
1418 | AddonDropDownFormSectionData.prototype.productId;
|
1419 |
|
1420 | AddonDropDownFormSectionData.prototype.addonId;
|
1421 | }
|
1422 |
|
1423 |
|
1424 |
|
1425 | function ProductInfoInterface() { }
|
1426 | if (false) {
|
1427 |
|
1428 | ProductInfoInterface.prototype.productId;
|
1429 |
|
1430 | ProductInfoInterface.prototype.name;
|
1431 |
|
1432 | ProductInfoInterface.prototype.tagline;
|
1433 |
|
1434 | ProductInfoInterface.prototype.icon;
|
1435 |
|
1436 | ProductInfoInterface.prototype.addonInfo;
|
1437 | }
|
1438 |
|
1439 |
|
1440 |
|
1441 | function AddonInfoInterface() { }
|
1442 | if (false) {
|
1443 |
|
1444 | AddonInfoInterface.prototype.addonId;
|
1445 |
|
1446 | AddonInfoInterface.prototype.name;
|
1447 | }
|
1448 |
|
1449 |
|
1450 |
|
1451 | function CustomFieldsAnswers() { }
|
1452 | if (false) {
|
1453 |
|
1454 | CustomFieldsAnswers.prototype.productID;
|
1455 |
|
1456 | CustomFieldsAnswers.prototype.addonKey;
|
1457 |
|
1458 | CustomFieldsAnswers.prototype.customFieldsAnswers;
|
1459 | }
|
1460 |
|
1461 |
|
1462 |
|
1463 | function CustomFieldsAnswer() { }
|
1464 | if (false) {
|
1465 |
|
1466 | CustomFieldsAnswer.prototype.fieldId;
|
1467 |
|
1468 | CustomFieldsAnswer.prototype.answer;
|
1469 | }
|
1470 |
|
1471 |
|
1472 |
|
1473 | function OrderFormOptionsInterface() { }
|
1474 | if (false) {
|
1475 |
|
1476 | OrderFormOptionsInterface.prototype.bypassRequiredQuestions;
|
1477 |
|
1478 | OrderFormOptionsInterface.prototype.readOnly;
|
1479 |
|
1480 | OrderFormOptionsInterface.prototype.showOfficeUseQuestions;
|
1481 | }
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 |
|
1487 | class OrderFormService {
|
1488 | constructor() {
|
1489 | }
|
1490 | |
1491 |
|
1492 |
|
1493 |
|
1494 |
|
1495 | static extractRequiredCommonFieldIds(orderForm) {
|
1496 | if (!orderForm || !orderForm.commonFormRequiredFields) {
|
1497 | return [];
|
1498 | }
|
1499 | return Object.keys(orderForm.commonFormRequiredFields).filter(( |
1500 |
|
1501 |
|
1502 |
|
1503 | k => orderForm.commonFormRequiredFields[k]));
|
1504 | }
|
1505 | |
1506 |
|
1507 |
|
1508 |
|
1509 |
|
1510 | static buildCommonFieldIds(orderForms) {
|
1511 |
|
1512 | const commonFieldIdsMap = new Map();
|
1513 | for (const key in OrderFormService.camelToSnakeCaseMap) {
|
1514 | if (key) {
|
1515 | commonFieldIdsMap.set(key, {
|
1516 | fieldId: key,
|
1517 | required: false,
|
1518 | });
|
1519 | }
|
1520 | }
|
1521 | orderForms.map(( |
1522 |
|
1523 |
|
1524 |
|
1525 | orderForm => {
|
1526 |
|
1527 | const requiredCommonFieldIds = this.extractRequiredCommonFieldIds(orderForm);
|
1528 | requiredCommonFieldIds.map(( |
1529 |
|
1530 |
|
1531 |
|
1532 | fieldId => {
|
1533 |
|
1534 | const commonFieldId = commonFieldIdsMap.get(fieldId);
|
1535 | commonFieldId.required = true;
|
1536 | commonFieldIdsMap.set(fieldId, commonFieldId);
|
1537 | }));
|
1538 | }));
|
1539 | return Array.from(commonFieldIdsMap.values());
|
1540 | }
|
1541 | |
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 |
|
1547 |
|
1548 |
|
1549 | static fillCommonFormSections(fieldIds, commonData, labels, options) {
|
1550 |
|
1551 | const commonFormSections = OrderFormService.buildCommonOrderFormFields(fieldIds, labels, options);
|
1552 | return commonFormSections.map(( |
1553 |
|
1554 |
|
1555 |
|
1556 | section => (Object.assign({}, section, { populatedData: commonData }))));
|
1557 | }
|
1558 | |
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 |
|
1565 | static buildCommonOrderFormFields(fieldIds, labels, options) {
|
1566 |
|
1567 | const businessSection = {
|
1568 | sectionName: labels.commonForm.businessSectionTitle || 'Business',
|
1569 | fields: []
|
1570 | };
|
1571 |
|
1572 | const salespersonSection = {
|
1573 | sectionName: labels.commonForm.salespersonSectionTitle || 'Salesperson',
|
1574 | fields: []
|
1575 | };
|
1576 |
|
1577 | const contactSection = {
|
1578 | sectionName: labels.commonForm.contactSectionTitle || 'Contact',
|
1579 | fields: []
|
1580 | };
|
1581 | for (const field of fieldIds) {
|
1582 |
|
1583 | const fieldLabel = this.getLabelForFieldId(field.fieldId, labels);
|
1584 |
|
1585 | const commonFormField = new TextboxField({
|
1586 | id: OrderFormService.camelToSnakeCaseMap[field.fieldId],
|
1587 | label: fieldLabel,
|
1588 | textboxType: 'text'
|
1589 | });
|
1590 | commonFormField.displayOnly = commonFormField.id === 'business_account_group_id';
|
1591 | commonFormField.disabled = options.readOnly;
|
1592 | if (!options.bypassRequiredQuestions) {
|
1593 | commonFormField.required = field.required;
|
1594 | }
|
1595 | if (field.fieldId.startsWith('contact')) {
|
1596 | contactSection.fields.push(commonFormField);
|
1597 | }
|
1598 | if (field.fieldId.startsWith('business')) {
|
1599 | businessSection.fields.push(commonFormField);
|
1600 | }
|
1601 | if (field.fieldId.startsWith('salesperson')) {
|
1602 | if (!options.showOfficeUseQuestions) {
|
1603 | commonFormField.hidden = true;
|
1604 | }
|
1605 | salespersonSection.fields.push(commonFormField);
|
1606 | }
|
1607 | }
|
1608 | return [businessSection, contactSection, salespersonSection].filter(( |
1609 |
|
1610 |
|
1611 |
|
1612 | section => section.fields ? section.fields.length > 0 : false));
|
1613 | }
|
1614 | |
1615 |
|
1616 |
|
1617 |
|
1618 |
|
1619 |
|
1620 | static getLabelForFieldId(fieldId, labels) {
|
1621 | return labels.commonForm[fieldId] || '';
|
1622 | }
|
1623 | |
1624 |
|
1625 |
|
1626 |
|
1627 |
|
1628 | static buildOrderFormSectionData(parentForm) {
|
1629 |
|
1630 | const section = new AddonDropDownFormSectionData();
|
1631 | section.displayAutoTitle = true;
|
1632 | section.descriptionText = '';
|
1633 | section.displayAutoDescription = false;
|
1634 | section.parentForm = parentForm;
|
1635 | return section;
|
1636 | }
|
1637 | |
1638 |
|
1639 |
|
1640 |
|
1641 |
|
1642 |
|
1643 |
|
1644 |
|
1645 |
|
1646 | static buildCustomOrderFormFields(customFields, fileUploadUrl, users, answers, options) {
|
1647 |
|
1648 | const fieldTypeMap = {
|
1649 | text: TextboxField,
|
1650 | textbox: TextboxField,
|
1651 | dropdown: DropdownField,
|
1652 | checkbox: CheckboxField,
|
1653 | file: FileUploadGroupField,
|
1654 | textarea: TextareaField,
|
1655 | vbcuser: VBCUserField
|
1656 | };
|
1657 | return customFields
|
1658 | .filter(( |
1659 |
|
1660 |
|
1661 |
|
1662 | field => {
|
1663 | return fieldTypeMap[field.type];
|
1664 | }))
|
1665 | .map(( |
1666 |
|
1667 |
|
1668 |
|
1669 | field => {
|
1670 |
|
1671 | const fieldClass = fieldTypeMap[field.type];
|
1672 |
|
1673 | const result = (( |
1674 |
|
1675 |
|
1676 | function () {
|
1677 | switch (fieldClass) {
|
1678 | case VBCUserField:
|
1679 |
|
1680 | const fieldConfig = ( ({
|
1681 | description: field.description,
|
1682 | id: field.id,
|
1683 | required: field.required,
|
1684 | type: field.type,
|
1685 | label: field.label,
|
1686 | forOfficeUseOnly: field.forOfficeUseOnly,
|
1687 | hidden: field.hidden,
|
1688 | users: users
|
1689 | }));
|
1690 | return new VBCUserField(fieldConfig);
|
1691 | case FileUploadGroupField:
|
1692 |
|
1693 | const uploadField = ( (field));
|
1694 | uploadField.uploadUrl = fileUploadUrl;
|
1695 | return new FileUploadGroupField(uploadField);
|
1696 | default:
|
1697 | return new fieldClass(field);
|
1698 | }
|
1699 | }))();
|
1700 | result.id = OrderFormService.encodeCustomFieldId(field.id);
|
1701 | if (!options.showOfficeUseQuestions) {
|
1702 | result.hidden = result.forOfficeUseOnly ? true : result.hidden;
|
1703 | }
|
1704 | result.required = options.bypassRequiredQuestions ? false : result.required;
|
1705 | result.disabled = options.readOnly ? options.readOnly : result.disabled;
|
1706 | if (answers) {
|
1707 |
|
1708 | const ca = answers.find(( |
1709 |
|
1710 |
|
1711 |
|
1712 | a => a.fieldId === field.id));
|
1713 | if (ca) {
|
1714 | try {
|
1715 | result.value = JSON.parse(ca.answer);
|
1716 | }
|
1717 | catch (error) {
|
1718 | result.value = ca.answer;
|
1719 | }
|
1720 | }
|
1721 | }
|
1722 | return result;
|
1723 | }));
|
1724 | }
|
1725 |
|
1726 |
|
1727 |
|
1728 | |
1729 |
|
1730 |
|
1731 |
|
1732 |
|
1733 | static encodeCustomFieldId(fieldId) {
|
1734 |
|
1735 | const id = uuid();
|
1736 | return `${id}#${fieldId}`;
|
1737 | }
|
1738 | |
1739 |
|
1740 |
|
1741 |
|
1742 |
|
1743 | static decodeCustomFieldId(fieldId) {
|
1744 | return fieldId.replace(new RegExp('(.*#)'), '');
|
1745 | }
|
1746 | |
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 | static mapFieldType(fieldType) {
|
1752 | switch (fieldType) {
|
1753 | case 'textbox':
|
1754 | return FieldType.TEXT;
|
1755 | case 'textarea':
|
1756 | return FieldType.TEXTAREA;
|
1757 | case 'checkbox':
|
1758 | return FieldType.CHECKBOX;
|
1759 | case 'dropdown':
|
1760 | return FieldType.DROPDOWN;
|
1761 | case 'file':
|
1762 | return FieldType.FILE;
|
1763 | case 'vbcuser':
|
1764 | return FieldType.VBCUSER;
|
1765 | default:
|
1766 | return FieldType.NOT_SPECIFIED;
|
1767 | }
|
1768 | }
|
1769 | |
1770 |
|
1771 |
|
1772 |
|
1773 |
|
1774 | static orderFieldToSalesOrderField(fieldBase) {
|
1775 | return new Field({
|
1776 | fieldId: OrderFormService.decodeCustomFieldId(fieldBase.id),
|
1777 | fieldType: OrderFormService.mapFieldType(fieldBase.controlType),
|
1778 | label: fieldBase.label,
|
1779 | description: fieldBase.description || '',
|
1780 | prefix: fieldBase.prefix || '',
|
1781 | suffix: fieldBase.suffix || '',
|
1782 | regexValidator: fieldBase.regexValidator || '',
|
1783 | regexErrorMessage: fieldBase.regexErrorMessage || '',
|
1784 | answer: fieldBase.value ? JSON.stringify(fieldBase.value) : 'null'
|
1785 | });
|
1786 | }
|
1787 | |
1788 |
|
1789 |
|
1790 |
|
1791 |
|
1792 | static productOrderFormToCustomFields(orderFormData) {
|
1793 |
|
1794 | const primaryCustomField = new CustomField();
|
1795 | primaryCustomField.productId = orderFormData.productId;
|
1796 | primaryCustomField.fields = orderFormData.primarySection
|
1797 | ? orderFormData.primarySection.fields.map(( |
1798 |
|
1799 |
|
1800 |
|
1801 | field => this.orderFieldToSalesOrderField(field)))
|
1802 | : [];
|
1803 |
|
1804 | const secondaryCustomFields = orderFormData.subsections.map(( |
1805 |
|
1806 |
|
1807 |
|
1808 | subsection => {
|
1809 |
|
1810 | const customField = new CustomField();
|
1811 | if (subsection.addonId) {
|
1812 | customField.addonKey = new AddonKey({
|
1813 | appId: subsection.productId,
|
1814 | addonId: subsection.addonId
|
1815 | });
|
1816 | }
|
1817 | else {
|
1818 | customField.productId = orderFormData.productId;
|
1819 | }
|
1820 | customField.fields = subsection.fields.map(( |
1821 |
|
1822 |
|
1823 |
|
1824 | field => this.orderFieldToSalesOrderField(field)));
|
1825 | return customField;
|
1826 | }));
|
1827 | return [].concat(primaryCustomField, secondaryCustomFields);
|
1828 | }
|
1829 | |
1830 |
|
1831 |
|
1832 |
|
1833 |
|
1834 |
|
1835 |
|
1836 | static getCommonFormSections(orderForms, commonData, labels, options) {
|
1837 |
|
1838 | const fieldIds = OrderFormService.buildCommonFieldIds(orderForms);
|
1839 | return OrderFormService.fillCommonFormSections(fieldIds, commonData, labels, options);
|
1840 | }
|
1841 | |
1842 |
|
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 | static getCustomFormSections(orderForms, products, parentForm, fileUploadUrl, users, answers, options) {
|
1852 |
|
1853 | const formSections = products.map(( |
1854 |
|
1855 |
|
1856 |
|
1857 | product => {
|
1858 |
|
1859 | const subsections = [];
|
1860 | (product.addonInfo || []).map(( |
1861 |
|
1862 |
|
1863 |
|
1864 | addon => {
|
1865 |
|
1866 | const addonOrderForms = orderForms.filter(( |
1867 |
|
1868 |
|
1869 |
|
1870 | o => o.addonId === addon.addonId));
|
1871 |
|
1872 | const addonAnswers = (answers || []).filter(( |
1873 |
|
1874 |
|
1875 |
|
1876 | a => a.addonKey &&
|
1877 | a.addonKey.appId === product.productId && a.addonKey.addonId === addon.addonId && a.productID === product.productId));
|
1878 | addonOrderForms.map(( |
1879 |
|
1880 |
|
1881 |
|
1882 |
|
1883 | (addonOrderForm, index) => {
|
1884 | if (addonOrderForm && addonOrderForm.customFields && addonOrderForm.customFields.length > 0) {
|
1885 |
|
1886 | const addonSection = OrderFormService.buildOrderFormSectionData(parentForm);
|
1887 |
|
1888 | const addonAnswersForThisSpecificFormIndex = (addonAnswers.length > index) ? addonAnswers[index].customFieldsAnswers : [];
|
1889 |
|
1890 | const formFields = OrderFormService.buildCustomOrderFormFields(addonOrderForm.customFields, fileUploadUrl, users, addonAnswersForThisSpecificFormIndex, options);
|
1891 | addonSection.expandable = true;
|
1892 | addonSection.titleText = addon.name;
|
1893 | addonSection.fields = formFields;
|
1894 | addonSection.productId = product.productId;
|
1895 | addonSection.addonId = addon.addonId;
|
1896 | subsections.push(addonSection);
|
1897 | }
|
1898 | }));
|
1899 | }));
|
1900 |
|
1901 | const foundOrderForms = orderForms.reduce(( |
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 | (orderFormsFound, o) => {
|
1907 | if (o.appId === product.productId && !o.addonId) {
|
1908 | orderFormsFound.push(o);
|
1909 | }
|
1910 | return orderFormsFound;
|
1911 | }), []);
|
1912 | const [primaryOrder, ...otherOrdersForSameProduct] = foundOrderForms;
|
1913 |
|
1914 | const productHasOrderForm = primaryOrder && primaryOrder.customFields && primaryOrder.customFields.length > 0;
|
1915 | if (subsections.length > 0 || productHasOrderForm) {
|
1916 |
|
1917 | const sectionData = new ProductOrderFormSectionData();
|
1918 | sectionData.productId = product.productId;
|
1919 | sectionData.parentForm = parentForm;
|
1920 | sectionData.titleText = product.name;
|
1921 | sectionData.subtitleText = product.tagline;
|
1922 | sectionData.descriptionText = '';
|
1923 | sectionData.iconUrl = product.icon;
|
1924 | if (productHasOrderForm) {
|
1925 |
|
1926 | const section = OrderFormService.buildOrderFormSectionData(parentForm);
|
1927 | section.titleText = product.name;
|
1928 |
|
1929 | let productAnswers = [];
|
1930 | if (answers) {
|
1931 | productAnswers = answers.filter(( |
1932 |
|
1933 |
|
1934 |
|
1935 | a => !a.addonKey && a.productID === product.productId));
|
1936 | }
|
1937 | const [firstProductAnswers, ...otherProductAnswers] = productAnswers;
|
1938 | section.fields = OrderFormService.buildCustomOrderFormFields(primaryOrder.customFields, fileUploadUrl, users, firstProductAnswers ? firstProductAnswers.customFieldsAnswers : [], options);
|
1939 | sectionData.primarySection = section;
|
1940 | otherOrdersForSameProduct.forEach(( |
1941 |
|
1942 |
|
1943 |
|
1944 |
|
1945 | (_, index) => {
|
1946 | |
1947 |
|
1948 |
|
1949 |
|
1950 |
|
1951 | const dupeSection = Object.assign({}, section);
|
1952 |
|
1953 | const answersForSpecificForm = (otherProductAnswers.length > index) ? otherProductAnswers[index].customFieldsAnswers : [];
|
1954 | dupeSection.fields = OrderFormService.buildCustomOrderFormFields(primaryOrder.customFields, fileUploadUrl, users, answersForSpecificForm, options);
|
1955 | subsections.unshift(dupeSection);
|
1956 | }));
|
1957 | }
|
1958 | sectionData.subsections = subsections;
|
1959 | return sectionData;
|
1960 | }
|
1961 | return null;
|
1962 | })).filter(( |
1963 |
|
1964 |
|
1965 |
|
1966 | s => !!s));
|
1967 | return formSections;
|
1968 | }
|
1969 | |
1970 |
|
1971 |
|
1972 |
|
1973 |
|
1974 |
|
1975 |
|
1976 |
|
1977 |
|
1978 | static getExtraFieldsSection(extraFields, parentForm, fileUploadUrl, users, answers, options) {
|
1979 | if (!extraFields || extraFields.length < 1) {
|
1980 | return null;
|
1981 | }
|
1982 |
|
1983 | const section = OrderFormService.buildOrderFormSectionData(parentForm);
|
1984 | section.fields = OrderFormService.buildCustomOrderFormFields(extraFields, fileUploadUrl, users, answers, options);
|
1985 | return section;
|
1986 | }
|
1987 | |
1988 |
|
1989 |
|
1990 |
|
1991 | static getCustomFieldsData(customFormSections) {
|
1992 |
|
1993 | const customFormData = customFormSections.reduce(( |
1994 |
|
1995 |
|
1996 |
|
1997 |
|
1998 | (acc, orderFormData) => {
|
1999 | acc = acc.concat(OrderFormService.productOrderFormToCustomFields(orderFormData));
|
2000 | return acc;
|
2001 | }), []);
|
2002 | return customFormData;
|
2003 | }
|
2004 | |
2005 |
|
2006 |
|
2007 |
|
2008 | static getCommonFieldsData(commonFormSections) {
|
2009 |
|
2010 | let commonFields = [];
|
2011 | if (commonFormSections) {
|
2012 | commonFields = commonFormSections.reduce(( |
2013 |
|
2014 |
|
2015 |
|
2016 |
|
2017 | (acc, group) => {
|
2018 |
|
2019 | const fields = group.fields.map(( |
2020 |
|
2021 |
|
2022 |
|
2023 | singleField => {
|
2024 |
|
2025 | const field = OrderFormService.orderFieldToSalesOrderField(singleField);
|
2026 | if (field.fieldId) {
|
2027 | return new CommonField({
|
2028 | field: field,
|
2029 | productIds: singleField.productIds,
|
2030 | addonKeys: singleField.addonKeys
|
2031 | });
|
2032 | }
|
2033 | }));
|
2034 | return acc.concat(fields);
|
2035 | }), []);
|
2036 | }
|
2037 | return commonFields;
|
2038 | }
|
2039 | |
2040 |
|
2041 |
|
2042 |
|
2043 | static getExtraFieldsData(extraFieldsSection) {
|
2044 |
|
2045 | let extraFieldsData = [];
|
2046 | if (!!extraFieldsSection) {
|
2047 | extraFieldsData = extraFieldsSection.fields.map(( |
2048 |
|
2049 |
|
2050 |
|
2051 | field => OrderFormService.orderFieldToSalesOrderField(field)));
|
2052 | }
|
2053 | return extraFieldsData;
|
2054 | }
|
2055 | }
|
2056 | OrderFormService.camelToSnakeCaseMap = {
|
2057 | 'contactName': 'contact_name',
|
2058 | 'contactEmail': 'contact_email',
|
2059 | 'contactPhoneNumber': 'contact_phone_number',
|
2060 | 'businessAccountGroupId': 'business_account_group_id',
|
2061 | 'businessName': 'business_name',
|
2062 | 'businessAddress': 'business_address',
|
2063 | 'businessPhoneNumber': 'business_phone_number',
|
2064 | 'businessWebsite': 'business_website',
|
2065 | 'salespersonName': 'salesperson_name',
|
2066 | 'salespersonEmail': 'salesperson_email',
|
2067 | 'salespersonPhoneNumber': 'salesperson_phone_number'
|
2068 | };
|
2069 | OrderFormService.decorators = [
|
2070 | { type: Injectable }
|
2071 | ];
|
2072 |
|
2073 | OrderFormService.ctorParameters = () => [];
|
2074 | if (false) {
|
2075 |
|
2076 | OrderFormService.camelToSnakeCaseMap;
|
2077 | }
|
2078 |
|
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 | class OrderFormComponent {
|
2084 | |
2085 |
|
2086 |
|
2087 | constructor(translateService) {
|
2088 | this.translateService = translateService;
|
2089 | this.dropdownOpen$$ = new BehaviorSubject(false);
|
2090 | this.dropdownOpen$ = this.dropdownOpen$$.asObservable();
|
2091 | this.translateService.setTranslation('en', En.en, true);
|
2092 | }
|
2093 | |
2094 |
|
2095 |
|
2096 | ngOnInit() {
|
2097 |
|
2098 | const options = new OrderFormOptions(this.orderFormOptions || {});
|
2099 | this.commonFormSections = OrderFormService.getCommonFormSections(this.orderForms, this.commonData, this.labels, options);
|
2100 | this.customFormSections = OrderFormService.getCustomFormSections(this.orderForms, this.productInfo, this.parentForm, this.fileUploadUrl, this.users, this.answers, options);
|
2101 |
|
2102 | this.extraFieldsSection = OrderFormService.getExtraFieldsSection(this.extraFields, this.parentForm, this.fileUploadUrl, this.users, this.extraFieldsAnswers, options);
|
2103 | }
|
2104 | |
2105 |
|
2106 |
|
2107 |
|
2108 | getCommonFormData() {
|
2109 | return OrderFormService.getCommonFieldsData(this.commonFormSections);
|
2110 | }
|
2111 | |
2112 |
|
2113 |
|
2114 |
|
2115 | getCustomFormData() {
|
2116 | return OrderFormService.getCustomFieldsData(this.customFormSections);
|
2117 | }
|
2118 | |
2119 |
|
2120 |
|
2121 |
|
2122 | getExtraFieldsData() {
|
2123 | return OrderFormService.getExtraFieldsData(this.extraFieldsSection);
|
2124 | }
|
2125 | |
2126 |
|
2127 |
|
2128 |
|
2129 |
|
2130 | changeReadOnly(readOnly) {
|
2131 | this.orderFormOptions.readOnly = readOnly;
|
2132 | readOnly ? this.parentForm.disable() : this.parentForm.enable();
|
2133 | }
|
2134 | |
2135 |
|
2136 |
|
2137 | openDropdown() {
|
2138 | this.dropdownOpen$$.next(true);
|
2139 | }
|
2140 | }
|
2141 | OrderFormComponent.decorators = [
|
2142 | { type: Component, args: [{
|
2143 | template: "<form [formGroup]=\"parentForm\">\n <!-- Common Fields -->\n <div *ngIf=\"commonFormSections?.length > 0\" class=\"common-form-container\">\n <mat-card class=\"common-form-header\">\n <mat-card-title class=\"common-form-header-title\">{{ labels.commonForm.headerTitle }}</mat-card-title>\n <div class=\"common-form-header-text\">{{ labels.commonForm.headerText }}</div>\n </mat-card>\n <va-dropdown-form-section\n *ngFor=\"let formSection of commonFormSections\"\n [parentForm]=\"parentForm\"\n [prepopulatedData]=\"formSection.populatedData\"\n [fields]=\"formSection.fields\"\n [titleText]=\"formSection.sectionName\"\n [startOpen]=\"dropdownOpen$ | async\"\n editingHint=\"{{ labels.commonForm.editingHint }}\"\n >\n </va-dropdown-form-section>\n <ng-container *ngIf=\"extraFieldsSection\">\n <va-dropdown-form-section\n [parentForm]=\"parentForm\"\n [prepopulatedData]=\"extraFieldsSection.prepopulatedData\"\n [fields]=\"extraFieldsSection.fields\"\n [displayAutoDescription]=false\n [startOpen]=\"true\"\n [titleText]=\"'FRONTEND.STORE.ADMINISTRATIVE_QUESTIONS' | translate\"\n >\n </va-dropdown-form-section>\n </ng-container>\n </div>\n\n <!--Custom Fields-->\n <div *ngIf=\"customFormSections?.length > 0\" class=\"custom-form-container\">\n <va-order-form-section *ngFor=\"let sectionData of customFormSections\" [data]=\"sectionData\"></va-order-form-section>\n </div>\n</form>\n",
|
2144 | providers: [],
|
2145 | selector: 'va-order-form',
|
2146 | styles: [".common-form-container{margin-bottom:16px}mat-card.common-form-header{margin-bottom:0;border-bottom-color:#fafafa;border-bottom-width:1px;box-shadow:0 0 1px -2px rgba(0,0,0,.2),0 0 2px 0 rgba(0,0,0,.14),0 0 5px 0 rgba(0,0,0,.12)}.common-form-header-text{font-size:15px;color:#9e9e9e}.common-form-header-title{margin-bottom:0;padding-bottom:15px}va-order-form-section{display:block;margin-bottom:16px}"]
|
2147 | }] }
|
2148 | ];
|
2149 |
|
2150 | OrderFormComponent.ctorParameters = () => [
|
2151 | { type: TranslateService }
|
2152 | ];
|
2153 | OrderFormComponent.propDecorators = {
|
2154 | commonData: [{ type: Input }],
|
2155 | answers: [{ type: Input }],
|
2156 | parentForm: [{ type: Input }],
|
2157 | fileUploadUrl: [{ type: Input }],
|
2158 | orderForms: [{ type: Input }],
|
2159 | productInfo: [{ type: Input }],
|
2160 | labels: [{ type: Input }],
|
2161 | users: [{ type: Input }],
|
2162 | extraFields: [{ type: Input }],
|
2163 | extraFieldsAnswers: [{ type: Input }],
|
2164 | orderFormOptions: [{ type: Input }]
|
2165 | };
|
2166 | if (false) {
|
2167 |
|
2168 | OrderFormComponent.prototype.commonData;
|
2169 |
|
2170 | OrderFormComponent.prototype.answers;
|
2171 |
|
2172 | OrderFormComponent.prototype.parentForm;
|
2173 |
|
2174 | OrderFormComponent.prototype.fileUploadUrl;
|
2175 |
|
2176 | OrderFormComponent.prototype.orderForms;
|
2177 |
|
2178 | OrderFormComponent.prototype.productInfo;
|
2179 |
|
2180 | OrderFormComponent.prototype.labels;
|
2181 |
|
2182 | OrderFormComponent.prototype.users;
|
2183 |
|
2184 | OrderFormComponent.prototype.extraFields;
|
2185 |
|
2186 | OrderFormComponent.prototype.extraFieldsAnswers;
|
2187 |
|
2188 | OrderFormComponent.prototype.orderFormOptions;
|
2189 |
|
2190 | OrderFormComponent.prototype.commonFormSections;
|
2191 |
|
2192 | OrderFormComponent.prototype.customFormSections;
|
2193 |
|
2194 | OrderFormComponent.prototype.extraFieldsSection;
|
2195 |
|
2196 | OrderFormComponent.prototype.dropdownOpen$$;
|
2197 |
|
2198 | OrderFormComponent.prototype.dropdownOpen$;
|
2199 | |
2200 |
|
2201 |
|
2202 |
|
2203 | OrderFormComponent.prototype.translateService;
|
2204 | }
|
2205 | class OrderFormOptions {
|
2206 | |
2207 |
|
2208 |
|
2209 | constructor(i) {
|
2210 | this.bypassRequiredQuestions = !!i.bypassRequiredQuestions;
|
2211 | this.readOnly = !!i.readOnly;
|
2212 | this.showOfficeUseQuestions = !!i.showOfficeUseQuestions;
|
2213 | }
|
2214 | }
|
2215 | if (false) {
|
2216 |
|
2217 | OrderFormOptions.prototype.bypassRequiredQuestions;
|
2218 |
|
2219 | OrderFormOptions.prototype.readOnly;
|
2220 |
|
2221 | OrderFormOptions.prototype.showOfficeUseQuestions;
|
2222 | }
|
2223 |
|
2224 |
|
2225 |
|
2226 |
|
2227 |
|
2228 |
|
2229 | const FILES = 'file';
|
2230 |
|
2231 | const DROP_DOWN = 'dropdown';
|
2232 |
|
2233 | const CHECK_BOX = 'checkbox';
|
2234 |
|
2235 | const TEXT_AREA = 'textarea';
|
2236 |
|
2237 | const TEXT_BOX = 'textbox';
|
2238 |
|
2239 | const BUSINESS_USER = 'vbcuser';
|
2240 |
|
2241 |
|
2242 |
|
2243 | function FieldBaseOptions() { }
|
2244 | if (false) {
|
2245 |
|
2246 | FieldBaseOptions.prototype.id;
|
2247 |
|
2248 | FieldBaseOptions.prototype.label;
|
2249 |
|
2250 | FieldBaseOptions.prototype.required;
|
2251 |
|
2252 | FieldBaseOptions.prototype.description;
|
2253 |
|
2254 | FieldBaseOptions.prototype.type;
|
2255 |
|
2256 | FieldBaseOptions.prototype.prefix;
|
2257 |
|
2258 | FieldBaseOptions.prototype.suffix;
|
2259 |
|
2260 | FieldBaseOptions.prototype.regexValidator;
|
2261 |
|
2262 | FieldBaseOptions.prototype.regexErrorMessage;
|
2263 |
|
2264 | FieldBaseOptions.prototype.disabled;
|
2265 |
|
2266 | FieldBaseOptions.prototype.forOfficeUseOnly;
|
2267 |
|
2268 | FieldBaseOptions.prototype.hidden;
|
2269 |
|
2270 | FieldBaseOptions.prototype.displayOnly;
|
2271 | }
|
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 | class FieldBase {
|
2277 | |
2278 |
|
2279 |
|
2280 | constructor(options) {
|
2281 | this.id = options.id;
|
2282 | this.label = options.label;
|
2283 | this.required = !!options.required;
|
2284 | this.description = options.description || null;
|
2285 | options.type = options.type === 'text' ? 'textbox' : options.type;
|
2286 | this.controlType = ( (options.type));
|
2287 | this.prefix = options.prefix;
|
2288 | this.suffix = options.suffix;
|
2289 | this.regexValidator = options.regexValidator;
|
2290 | this.regexErrorMessage = options.regexErrorMessage;
|
2291 | this.disabled = options.disabled || false;
|
2292 | this.validator = this.validatorBuilder();
|
2293 | this.forOfficeUseOnly = !!options.forOfficeUseOnly;
|
2294 | this.hidden = options.hidden;
|
2295 | this.displayOnly = options.displayOnly;
|
2296 | }
|
2297 | |
2298 |
|
2299 |
|
2300 | getLabel() {
|
2301 |
|
2302 | let fieldLabel = this.label;
|
2303 | if (this.required) {
|
2304 | fieldLabel += ' *';
|
2305 | }
|
2306 | return fieldLabel;
|
2307 | }
|
2308 | |
2309 |
|
2310 |
|
2311 |
|
2312 | validatorBuilder() {
|
2313 | return ( |
2314 |
|
2315 |
|
2316 |
|
2317 | (control) => {
|
2318 | return null;
|
2319 | });
|
2320 | }
|
2321 | }
|
2322 | if (false) {
|
2323 |
|
2324 | FieldBase.prototype.value;
|
2325 |
|
2326 | FieldBase.prototype.id;
|
2327 |
|
2328 | FieldBase.prototype.label;
|
2329 |
|
2330 | FieldBase.prototype.required;
|
2331 |
|
2332 | FieldBase.prototype.order;
|
2333 |
|
2334 | FieldBase.prototype.description;
|
2335 |
|
2336 | FieldBase.prototype.controlType;
|
2337 |
|
2338 | FieldBase.prototype.prefix;
|
2339 |
|
2340 | FieldBase.prototype.suffix;
|
2341 |
|
2342 | FieldBase.prototype.regexValidator;
|
2343 |
|
2344 | FieldBase.prototype.regexErrorMessage;
|
2345 |
|
2346 | FieldBase.prototype.disabled;
|
2347 |
|
2348 | FieldBase.prototype.validator;
|
2349 |
|
2350 | FieldBase.prototype.forOfficeUseOnly;
|
2351 |
|
2352 | FieldBase.prototype.hidden;
|
2353 |
|
2354 | FieldBase.prototype.displayOnly;
|
2355 | }
|
2356 |
|
2357 |
|
2358 |
|
2359 |
|
2360 |
|
2361 | class FieldBuilderComponent {
|
2362 | constructor() {
|
2363 | this.removeField = new EventEmitter(null);
|
2364 | }
|
2365 | |
2366 |
|
2367 |
|
2368 |
|
2369 |
|
2370 | static createDropDownOption(option, required) {
|
2371 | return new FormGroup({
|
2372 | label: new FormControl(option.label || option.value, required ? [Validators.required] : []),
|
2373 | value: new FormControl(option.value),
|
2374 | useValue: new FormControl(!!option.value)
|
2375 | });
|
2376 | }
|
2377 | |
2378 |
|
2379 |
|
2380 |
|
2381 | static createDropDownOptions(options) {
|
2382 | if (options === null || options === undefined) {
|
2383 | options = [];
|
2384 | }
|
2385 |
|
2386 | const orderFormFieldsGroupArray = options.map(( |
2387 |
|
2388 |
|
2389 |
|
2390 | option => FieldBuilderComponent.createDropDownOption(option, false)));
|
2391 | return new FormArray(orderFormFieldsGroupArray);
|
2392 | }
|
2393 | |
2394 |
|
2395 |
|
2396 |
|
2397 | static createOrderFormFieldGroup(orderFormField) {
|
2398 |
|
2399 | const orderFormFieldGroup = new FormGroup({
|
2400 | descriptionControl: new FormControl(orderFormField.description, []),
|
2401 | labelControl: new FormControl(orderFormField.label, [Validators.required]),
|
2402 | idControl: new FormControl(orderFormField.id, [Validators.required]),
|
2403 | requiredControl: new FormControl(orderFormField.required || false, []),
|
2404 | uploadUrlControl: new FormControl(orderFormField.uploadUrl, []),
|
2405 | prefixControl: new FormControl(orderFormField.prefix, []),
|
2406 | suffixControl: new FormControl(orderFormField.suffix, []),
|
2407 | regexValidatorControl: new FormControl(orderFormField.regexValidator, regexValidator()),
|
2408 | regexErrorMessageControl: new FormControl(orderFormField.regexErrorMessage, []),
|
2409 | typeControl: new FormControl(getFieldInterface(orderFormField.type), [Validators.required]),
|
2410 | allowMultiples: new FormControl(orderFormField.allowMultiples || false, []),
|
2411 | allowDuplicates: new FormControl(orderFormField.allowDuplicates || false, []),
|
2412 | maxChoices: new FormControl(orderFormField.maxChoices ? orderFormField.maxChoices : 1, [Validators.min(1), numberValidator()]),
|
2413 | forOfficeUseOnly: new FormControl(orderFormField.forOfficeUseOnly || false, [])
|
2414 | });
|
2415 | if (orderFormField.optionsWithLabels) {
|
2416 |
|
2417 | const optionsArray = FieldBuilderComponent.createDropDownOptions(orderFormField.optionsWithLabels);
|
2418 | orderFormFieldGroup.addControl('optionsFormArray', optionsArray);
|
2419 | }
|
2420 | else if (orderFormField.options) {
|
2421 |
|
2422 | const optionsArray = FieldBuilderComponent.createDropDownOptions(orderFormField.options.map(( |
2423 |
|
2424 |
|
2425 |
|
2426 | option => ({ label: option }))));
|
2427 | orderFormFieldGroup.addControl('optionsFormArray', optionsArray);
|
2428 | }
|
2429 | else {
|
2430 | orderFormFieldGroup.addControl('optionsFormArray', new FormArray([]));
|
2431 | }
|
2432 | return orderFormFieldGroup;
|
2433 | }
|
2434 | |
2435 |
|
2436 |
|
2437 | ngOnInit() {
|
2438 | if (!this.supportedFieldTypes || this.supportedFieldTypes.length < 1) {
|
2439 | this.supportedFieldTypes = FORM_FIELDS;
|
2440 | }
|
2441 | this.initForm();
|
2442 | }
|
2443 | |
2444 |
|
2445 |
|
2446 | initForm() {
|
2447 |
|
2448 | if (!this.orderFormFieldGroup.get('labelControl')) {
|
2449 | this.orderFormFieldGroup =
|
2450 | FieldBuilderComponent.createOrderFormFieldGroup({});
|
2451 | }
|
2452 | }
|
2453 | |
2454 |
|
2455 |
|
2456 | getOptionsArray() {
|
2457 | return ( (this.orderFormFieldGroup.get('optionsFormArray')));
|
2458 | }
|
2459 | |
2460 |
|
2461 |
|
2462 | getCurrentFieldInterface() {
|
2463 |
|
2464 | const formFieldTypeInterface = (( (this.orderFormFieldGroup.get('typeControl').value)));
|
2465 | return formFieldTypeInterface ? formFieldTypeInterface.id : null;
|
2466 | }
|
2467 | |
2468 |
|
2469 |
|
2470 |
|
2471 | removeOption(index) {
|
2472 |
|
2473 | const formArray = this.getOptionsArray();
|
2474 | formArray.removeAt(index);
|
2475 | }
|
2476 | |
2477 |
|
2478 |
|
2479 | addOption() {
|
2480 |
|
2481 | const fieldArray = this.getOptionsArray();
|
2482 | fieldArray.push(FieldBuilderComponent.createDropDownOption({ label: '' }, true));
|
2483 | }
|
2484 | |
2485 |
|
2486 |
|
2487 | getFormValues() {
|
2488 |
|
2489 | const obj = {};
|
2490 | obj.label = this.orderFormFieldGroup.get('labelControl').value;
|
2491 | obj.id = this.orderFormFieldGroup.get('idControl').value;
|
2492 |
|
2493 | const formFieldType = (( (this.orderFormFieldGroup.get('typeControl').value)));
|
2494 | obj.type = formFieldType ? formFieldType.id : null;
|
2495 |
|
2496 |
|
2497 | const optionsArray = (( (this.orderFormFieldGroup.get('optionsFormArray'))));
|
2498 | if (optionsArray && optionsArray.value) {
|
2499 | obj.options = optionsArray.value.map(( |
2500 |
|
2501 |
|
2502 |
|
2503 | option => option.value || option.label));
|
2504 | obj.optionsWithLabels = optionsArray.value.map(( |
2505 |
|
2506 |
|
2507 |
|
2508 | option => ({ label: option.label, value: option.value })));
|
2509 | }
|
2510 | obj.description = this.orderFormFieldGroup.get('descriptionControl').value;
|
2511 | obj.required = this.orderFormFieldGroup.get('requiredControl').value || false;
|
2512 | obj.uploadUrl = this.orderFormFieldGroup.get('uploadUrlControl').value;
|
2513 | obj.prefix = this.orderFormFieldGroup.get('prefixControl').value;
|
2514 | obj.suffix = this.orderFormFieldGroup.get('suffixControl').value;
|
2515 | obj.regexValidator = this.orderFormFieldGroup.get('regexValidatorControl').value;
|
2516 | obj.regexErrorMessage = this.orderFormFieldGroup.get('regexErrorMessageControl').value;
|
2517 | obj.allowMultiples = this.orderFormFieldGroup.get('allowMultiples').value || false;
|
2518 | obj.allowDuplicates = this.orderFormFieldGroup.get('allowDuplicates').value || false;
|
2519 | obj.maxChoices = this.orderFormFieldGroup.get('maxChoices').value || 1;
|
2520 | obj.forOfficeUseOnly = this.orderFormFieldGroup.get('forOfficeUseOnly').value || false;
|
2521 | return obj;
|
2522 | }
|
2523 | }
|
2524 | FieldBuilderComponent.decorators = [
|
2525 | { type: Component, args: [{
|
2526 | selector: 'va-field-builder',
|
2527 | template: "<div class=\"color-primary grab-mask order-form-field-form-container\" [formGroup]=\"orderFormFieldGroup\">\n <mat-form-field class=\"order-form-mat-form-field\">\n <mat-select matInput formControlName=\"typeControl\" placeholder=\"Type\" required novalidate>\n <mat-option *ngFor=\"let field of supportedFieldTypes\" [value]=\"field\">\n {{ field.name }}\n </mat-option>\n </mat-select>\n <mat-error *ngIf=\"'typeControl.invalid'\">Form Field type is Required</mat-error>\n </mat-form-field>\n <span class=\"options\">\n <mat-checkbox color=\"primary\" [formControlName]=\"'requiredControl'\"> Required</mat-checkbox>\n <mat-checkbox color=\"primary\" [formControlName]=\"'forOfficeUseOnly'\" class=\"underlined\" matTooltip=\"This question will not be shown to end users\"> For Office Use Only</mat-checkbox>\n </span>\n <!-- Options if drop down type is selected -->\n <ng-container *ngIf=\"getCurrentFieldInterface() && getCurrentFieldInterface() === 'dropdown'\">\n <div formArrayName=\"optionsFormArray\" *ngFor=\"let option of getOptionsArray().controls; let i = index;\">\n <div class=\"removable-form-field dropdown-option\">\n <mat-form-field class=\"dropdown-option-label\">\n <input matInput [formControl]=\"option.get('label')\" placeholder=\"Option\">\n </mat-form-field>\n <mat-form-field class=\"dropdown-option-value\" *ngIf=\"option.get('useValue').value\">\n <input matInput [formControl]=\"option.get('value')\" placeholder=\"Value\">\n </mat-form-field>\n <a class=\"dropdown-option-value\" (click)=\"option.get('useValue').setValue(true)\" *ngIf=\"!option.get('useValue').value\">+ Assign Value</a>\n <button mat-icon-button type=\"button\" color=\"primary\" (click)=\"removeOption(i)\">\n <mat-icon aria-label=\"Clear Button\">clear</mat-icon>\n </button>\n </div>\n </div>\n <div class=\"order-form-mat-form-field\">\n <a (click)=\"addOption()\">+ Option</a>\n </div>\n <div class=\"dropdown-config\">\n <mat-checkbox color=\"primary\" [formControlName]=\"'allowMultiples'\"> Allow Multiples</mat-checkbox>\n <ng-container *ngIf=\"orderFormFieldGroup.controls.allowMultiples.value\">\n <mat-checkbox class=\"required-checkbox\" color=\"primary\" [formControlName]=\"'allowDuplicates'\"> Allow Duplicates</mat-checkbox>\n <div>\n <mat-form-field class=\"order-form-mat-form-field\">\n <input matInput formControlName=\"maxChoices\" placeholder=\"Maximum Number of Choices\" required type=\"number\">\n <mat-hint>Must be greater than 0</mat-hint>\n <mat-error *ngIf=\"'maxChoices.invalid'\">Max Choices must be a number larger than 0</mat-error>\n </mat-form-field>\n </div>\n </ng-container>\n </div>\n </ng-container>\n <div>\n <mat-form-field class=\"order-form-mat-form-field\">\n <input matInput formControlName=\"labelControl\" placeholder=\"Label\" required novalidate>\n <mat-hint>Keep it short. Recommended: Max 140 characters</mat-hint>\n <mat-error *ngIf=\"'idControl.invalid'\">Label is Required</mat-error>\n </mat-form-field>\n </div>\n <!-- Prefix/suffix if textbox type is selected -->\n <ng-container *ngIf=\"getCurrentFieldInterface() && getCurrentFieldInterface() === 'textbox'\">\n <ng-container *ngIf=\"showSuffixes\">\n <mat-form-field>\n <input matInput formControlName=\"prefixControl\" placeholder=\"Prefix\">\n </mat-form-field>\n <mat-form-field>\n <input matInput formControlName=\"suffixControl\" placeholder=\"Suffix\">\n </mat-form-field>\n <div class=\"show-hide-text-button\"><a (click)=\"showSuffixes = !showSuffixes\">Hide Prefix/Suffix</a></div>\n </ng-container>\n <div *ngIf=\"!showSuffixes\" class=\"show-hide-text-button\">\n <a (click)=\"showSuffixes = !showSuffixes\">+ Prefix/Suffix</a>\n <div class=\"hidden-note\">- Values will apply even though currently hidden </div>\n </div>\n </ng-container>\n\n <div>\n <mat-form-field class=\"order-form-mat-form-field\">\n <input matInput formControlName=\"idControl\" placeholder=\"ID\" required>\n <mat-error *ngIf=\"'idControl.invalid'\">Id is Required</mat-error>\n <mat-hint>ID must be unique</mat-hint>\n </mat-form-field>\n </div>\n\n\n <!-- Upload url if file type is selected -->\n <ng-container *ngIf=\"getCurrentFieldInterface() && getCurrentFieldInterface() === 'file'\">\n <mat-form-field>\n <input matInput formControlName=\"uploadUrlControl\" placeholder=\"Upload URL\">\n </mat-form-field>\n </ng-container>\n\n\n <!-- Prefix/suffix if textbox type is selected -->\n <ng-container *ngIf=\"getCurrentFieldInterface() && getCurrentFieldInterface() === 'textbox'\">\n\n <!-- RegexValidator/RegexErrorMessage if textbox type is selected -->\n <ng-container *ngIf=\"showValidators\">\n <mat-form-field>\n <input matInput formControlName=\"regexValidatorControl\" placeholder=\"Regex Validator\">\n <mat-error *ngIf=\"'regexValidatorControl.invalid'\"> Must be a valid regular expression </mat-error>\n </mat-form-field>\n <mat-form-field>\n <input matInput formControlName=\"regexErrorMessageControl\" placeholder=\"Regex Error Message\">\n <mat-hint> Error displayed to the user when the regular expression is not matched </mat-hint>\n </mat-form-field>\n <div class=\"show-hide-text-button\">\n <a (click)=\"showValidators = !showValidators\">Hide Validation</a>\n </div>\n </ng-container>\n <div *ngIf=\"!showValidators\" class=\"show-hide-text-button\">\n <a (click)=\"showValidators = !showValidators\">+ Validation</a>\n <div class=\"hidden-note\"> - Values will apply even though currently hidden </div>\n </div>\n </ng-container>\n\n <!-- Optional description -->\n <div class=\"removable-form-field\">\n <mat-form-field>\n <input matInput formControlName=\"descriptionControl\" placeholder=\"Hint text\">\n <mat-hint>A short sentence to show below the field if you absolutely need extra instruction</mat-hint>\n </mat-form-field>\n </div>\n\n <div class=\"delete-field-section\">\n <button mat-icon-button type=\"button\" color=\"primary\" (click)=\"removeField.emit()\">\n Delete field\n <!-- <mat-icon aria-label=\"Clear Button\">clear</mat-icon> -->\n </button>\n </div>\n</div>\n",
|
2528 | changeDetection: ChangeDetectionStrategy.OnPush,
|
2529 | styles: [".show-hide-text-button{margin-bottom:2em;display:-webkit-box;display:flex}.show-hide-text-button .hidden-note{font-size:10px;margin-left:7px;color:#9e9e9e;-ms-grid-row-align:center;align-self:center}.options{padding-left:15px;width:15%;display:inline-block}.dropdown-option,mat-form-field{width:85%}.delete-field-section{text-align:right}.mat-icon-button{width:auto;color:rgba(0,0,0,.54)!important}.mat-icon-button:hover{color:#c62828!important}.dropdown-config{margin-top:17px}.dropdown-config mat-checkbox{margin-right:16px}.dropdown-option{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center}.dropdown-option-label{-webkit-box-flex:1;flex:1 1 auto;margin-right:16px}.dropdown-option-value{-webkit-box-flex:0;flex:0 1 33%}.underlined{border-bottom:1px dotted}"]
|
2530 | }] }
|
2531 | ];
|
2532 | FieldBuilderComponent.propDecorators = {
|
2533 | orderFormFieldGroup: [{ type: Input }],
|
2534 | supportedFieldTypes: [{ type: Input }],
|
2535 | removeField: [{ type: Output }]
|
2536 | };
|
2537 | if (false) {
|
2538 |
|
2539 | FieldBuilderComponent.prototype.orderFormFieldGroup;
|
2540 |
|
2541 | FieldBuilderComponent.prototype.supportedFieldTypes;
|
2542 |
|
2543 | FieldBuilderComponent.prototype.removeField;
|
2544 |
|
2545 | FieldBuilderComponent.prototype.showValidators;
|
2546 |
|
2547 | FieldBuilderComponent.prototype.showSuffixes;
|
2548 | }
|
2549 |
|
2550 |
|
2551 |
|
2552 |
|
2553 | function regexValidator() {
|
2554 | return ( |
2555 |
|
2556 |
|
2557 |
|
2558 | (control) => {
|
2559 | try {
|
2560 |
|
2561 | const _ = new RegExp(control.value || '');
|
2562 | }
|
2563 | catch (e) {
|
2564 | return { 'regex': true };
|
2565 | }
|
2566 | return null;
|
2567 | });
|
2568 | }
|
2569 |
|
2570 |
|
2571 |
|
2572 | function numberValidator() {
|
2573 | return ( |
2574 |
|
2575 |
|
2576 |
|
2577 | (control) => {
|
2578 |
|
2579 | const isNumber = /^\d+$/;
|
2580 | if (isNumber.test(control.value)) {
|
2581 | return null;
|
2582 | }
|
2583 | return { 'number': true };
|
2584 | });
|
2585 | }
|
2586 |
|
2587 |
|
2588 |
|
2589 | function FormFieldInterface() { }
|
2590 | if (false) {
|
2591 |
|
2592 | FormFieldInterface.prototype.id;
|
2593 |
|
2594 | FormFieldInterface.prototype.name;
|
2595 | }
|
2596 |
|
2597 | const FORM_FIELDS = [
|
2598 | { id: FILES, name: 'Files' }, { id: DROP_DOWN, name: 'Drop Down' },
|
2599 | { id: CHECK_BOX, name: 'Check Box' }, { id: TEXT_AREA, name: 'Text Area' },
|
2600 | { id: TEXT_BOX, name: 'Text Box' }, { id: BUSINESS_USER, name: 'End User' }
|
2601 | ];
|
2602 |
|
2603 |
|
2604 |
|
2605 |
|
2606 | function getFieldInterface(formFieldId) {
|
2607 | return getFormFieldInterfaceFromId((( (formFieldId))));
|
2608 | }
|
2609 |
|
2610 |
|
2611 |
|
2612 |
|
2613 | function getFormFieldInterfaceFromId(id) {
|
2614 | return FORM_FIELDS.find(( |
2615 |
|
2616 |
|
2617 |
|
2618 | (obj) => obj.id === id));
|
2619 | }
|
2620 |
|
2621 |
|
2622 |
|
2623 |
|
2624 |
|
2625 | class OrderItemListService {
|
2626 | |
2627 |
|
2628 |
|
2629 |
|
2630 | static getPriceSummary(items) {
|
2631 | if (!items) {
|
2632 | return { items: [], includesUndefinedPricing: false };
|
2633 | }
|
2634 |
|
2635 | let includesUndefinedPricing = false;
|
2636 |
|
2637 | const summaryItems = items.reduce(( |
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 | (currentArray, item) => {
|
2643 | if (item.pricing.prices.length <= 0) {
|
2644 | includesUndefinedPricing = true;
|
2645 | return currentArray;
|
2646 | }
|
2647 | item.pricing.prices.map(( |
2648 |
|
2649 |
|
2650 |
|
2651 | price => {
|
2652 | if (!price || price.price < 0) {
|
2653 | includesUndefinedPricing = true;
|
2654 | return;
|
2655 | }
|
2656 |
|
2657 | const freq = price.billingFrequency;
|
2658 |
|
2659 | const cur = item.pricing.currency;
|
2660 |
|
2661 | const existingCurIndex = currentArray.findIndex(( |
2662 |
|
2663 |
|
2664 |
|
2665 | summaryItem => summaryItem.currency === cur));
|
2666 |
|
2667 | let pricing = {
|
2668 | currency: cur,
|
2669 | prices: []
|
2670 | };
|
2671 | if (existingCurIndex > -1) {
|
2672 | pricing = currentArray[existingCurIndex];
|
2673 | }
|
2674 |
|
2675 | const existingFreqIndex = pricing.prices.findIndex(( |
2676 |
|
2677 |
|
2678 |
|
2679 | summaryItem => summaryItem.billingFrequency === freq));
|
2680 |
|
2681 | const quantifiedPrice = price.price !== null ? price.price * item.quantity : null;
|
2682 |
|
2683 | const quantifiedDiscount = (price.discountAmount || 0) * item.quantity;
|
2684 | if (existingFreqIndex > -1) {
|
2685 | pricing.prices[existingFreqIndex] = {
|
2686 | price: pricing.prices[existingFreqIndex].price + quantifiedPrice,
|
2687 | billingFrequency: freq,
|
2688 | discountAmount: pricing.prices[existingFreqIndex].discountAmount + quantifiedDiscount
|
2689 | };
|
2690 | }
|
2691 | else {
|
2692 | pricing.prices.push({
|
2693 | price: quantifiedPrice,
|
2694 | billingFrequency: freq,
|
2695 | discountAmount: quantifiedDiscount
|
2696 | });
|
2697 | }
|
2698 | if (existingCurIndex > -1) {
|
2699 | currentArray[existingCurIndex] = pricing;
|
2700 | }
|
2701 | else {
|
2702 | currentArray.push(pricing);
|
2703 | }
|
2704 | }));
|
2705 | return currentArray;
|
2706 | }), []);
|
2707 | return { items: summaryItems, includesUndefinedPricing: includesUndefinedPricing };
|
2708 | }
|
2709 | }
|
2710 |
|
2711 |
|
2712 |
|
2713 |
|
2714 |
|
2715 | class OrderItemListComponent {
|
2716 | |
2717 |
|
2718 |
|
2719 | constructor(translateService) {
|
2720 | this.translateService = translateService;
|
2721 | this.includesUndefinedPricing = false;
|
2722 | this.translateService.setTranslation('en', En.en, true);
|
2723 | }
|
2724 | |
2725 |
|
2726 |
|
2727 |
|
2728 | set orderItems(items) {
|
2729 | this.items = items || [];
|
2730 |
|
2731 | const summary = OrderItemListService.getPriceSummary(items);
|
2732 | this.summaryItems = summary.items;
|
2733 | this.includesUndefinedPricing = summary.includesUndefinedPricing;
|
2734 | }
|
2735 | |
2736 |
|
2737 |
|
2738 |
|
2739 | calculateTotalPrice(price) {
|
2740 | if (price.price === null) {
|
2741 | return null;
|
2742 | }
|
2743 |
|
2744 | const totalPrice = price.price - price.discountAmount;
|
2745 | if (!this.taxOptions) {
|
2746 | return totalPrice;
|
2747 | }
|
2748 |
|
2749 | const taxTotal = this.taxOptions.reduce(( |
2750 |
|
2751 |
|
2752 |
|
2753 |
|
2754 | (all, tax) => all + (tax.percentage * totalPrice)), 0);
|
2755 | return totalPrice + taxTotal;
|
2756 | }
|
2757 | |
2758 |
|
2759 |
|
2760 |
|
2761 | buildTaxLabel(tax) {
|
2762 |
|
2763 | const taxPercentage = Number(tax.percentage * 100).toFixed(2);
|
2764 | return `${tax.label} (${taxPercentage}%)`;
|
2765 | }
|
2766 | |
2767 |
|
2768 |
|
2769 | isFree() {
|
2770 |
|
2771 | const summaryTotal = this.summaryItems.reduce(( |
2772 |
|
2773 |
|
2774 |
|
2775 |
|
2776 | (all, item) => {
|
2777 |
|
2778 | const totalPrices = item.prices.reduce(( |
2779 |
|
2780 |
|
2781 |
|
2782 |
|
2783 | (acc, price) => acc + price.price), 0);
|
2784 | return all + totalPrices;
|
2785 | }), 0);
|
2786 | return summaryTotal === 0;
|
2787 | }
|
2788 | }
|
2789 | OrderItemListComponent.decorators = [
|
2790 | { type: Component, args: [{
|
2791 | selector: 'va-order-item-list',
|
2792 | template: "<div class=\"va-order-item-list\">\n <mat-list class=\"product-list\" *ngIf=\"items; else loading\">\n <ng-container *ngFor=\"let item of items\">\n <mat-list-item>\n <div class=\"list-item\">\n <div class=\"left-section\">\n <div class=\"icon-and-name\">\n <div class=\"icon-container\">\n <va-icon [diameter]=\"32\" [iconUrl]=\"item.icon\" [name]=\"item.name\"></va-icon>\n </div>\n <div>\n <div>\n {{ item.name }}\n <va-badge color=\"blue-solid\" *ngIf=\"item.editionName\">\n <span> {{ item.editionName }} </span>\n </va-badge>\n <span *ngIf=\"item.quantity > 1\"> ({{ item.quantity }})</span>\n </div>\n </div>\n </div>\n </div>\n <div class=\"right-section\" *ngIf=\"!hidePricing && item.pricing\">\n <ng-container *ngIf=\"item.pricing.prices?.length > 0\">\n <ng-container *ngFor=\"let price of item.pricing.prices\">\n <div matLine>\n <strong *ngIf=\"!price.discountAmount\">{{ price.price | price: item.pricing.currency }}</strong>\n <ng-container *ngIf=\"price.price && price.discountAmount > 0\">\n <span matTooltipPosition=\"left\" class=\"item-price-before-discount\"\n [matTooltip]=\"price.discountAmount | price: item.pricing.currency\">\n {{ price.price | price: item.pricing.currency }}\n </span>\n <strong>{{ price.price - price.discountAmount | price: item.pricing.currency }}</strong>\n </ng-container>\n </div>\n <div matLine class=\"tertiary-font-color\" *ngIf=\"price.price > 0\">\n {{ price.billingFrequency | formatBillingFrequency }}\n </div>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"item.pricing.prices?.length <= 0\">\n <mat-list-item class=\"summary-list-item\">\n <div matLine>\n <strong>{{ null | price: 'CAD' }}</strong>\n </div>\n </mat-list-item>\n </ng-container>\n </div>\n </div>\n </mat-list-item>\n <mat-divider></mat-divider>\n </ng-container>\n </mat-list>\n\n <div *ngIf=\"!hidePricing\">\n <div *ngIf=\"items; else loading\">\n <div class=\"total-header\">\n {{ 'FRONTEND.STORE.TOTAL' | translate }}\n </div>\n <mat-list class=\"summary-list\">\n <ng-container *ngIf=\"includesUndefinedPricing; else totalIsDefined\">\n <mat-list-item class=\"summary-list-item\">\n <div matLine>\n <strong>{{ null | price: 'CAD' }}</strong>\n </div>\n </mat-list-item>\n </ng-container>\n\n <ng-template #totalIsDefined>\n <ng-container *ngIf=\"isFree(); else totalNotFree\">\n <div class=\"summary-item-group\">\n <mat-list-item class=\"summary-list-item\">\n <div matLine>\n <strong>{{ 0 | price: 'USD' }}</strong>\n </div>\n </mat-list-item>\n </div>\n </ng-container>\n\n <ng-template #totalNotFree>\n <ng-container *ngFor=\"let item of summaryItems\">\n <div class=\"summary-item-group\" *ngFor=\"let price of item.prices\">\n <ng-container *ngIf=\"price.price > 0\">\n <div class=\"tax-calculation\">\n <mat-list-item class=\"summary-list-item tax-item\">\n <div matLine *ngIf=\"taxOptions\">\n <strong>{{ price.price - price.discountAmount | price: item.currency }}</strong>\n </div>\n </mat-list-item>\n <ng-container *ngFor=\"let tax of taxOptions\">\n <mat-list-item class=\"summary-list-item tax-item\">\n <div matLine class=\"tax-label\">\n <span>\n {{ buildTaxLabel(tax) }}\n </span>\n <strong>\n +{{ (price.price - price.discountAmount) * tax.percentage | price: item.currency }}\n </strong>\n </div>\n </mat-list-item>\n </ng-container>\n </div>\n\n <mat-list-item class=\"summary-list-item\" [ngClass]=\"{ 'result-item': (price.price > 0 && taxOptions) }\">\n <div matLine>\n <strong>{{ calculateTotalPrice(price) | price: item.currency }}</strong>\n </div>\n </mat-list-item>\n\n <mat-list-item class=\"summary-list-item\">\n <div matLine class=\"tertiary-font-color\">\n {{ price.billingFrequency | formatBillingFrequency }}\n </div>\n </mat-list-item>\n </ng-container>\n </div>\n </ng-container>\n\n </ng-template>\n </ng-template>\n </mat-list>\n </div>\n </div>\n\n <ng-template #loading>\n <div class=\"stencil-shimmer\"></div>\n </ng-template>\n\n</div>\n",
|
2793 | styles: ["::ng-deep .va-order-item-list .mat-list-item{height:auto!important}::ng-deep .va-order-item-list .mat-list .mat-list-item-content{padding:10px 0!important}::ng-deep .va-order-item-list .mat-list .summary-list-item .mat-list-item-content{padding:0!important}.product-list{padding:0;position:relative}.product-list .list-item{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:justify;justify-content:space-between;width:100%}.product-list .list-item .left-section .icon-and-name{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center}.product-list .list-item .left-section .icon-and-name .icon-container{margin-right:16px}.product-list .list-item .right-section{margin-left:1em;text-align:right;align-self:flex-start}.total-header{background-color:#616161;color:#fff;line-height:2;height:2em;font-weight:700;padding-right:14px;text-align:right}.summary-list{padding:8px 0;background-color:#f5f5f5}.summary-list .summary-list-item{padding-right:14px;text-align:right}.summary-list .summary-item-group{padding:10px 0}.summary-list .summary-list-item.tax-item{color:#9e9e9e;font-size:14px}.summary-list .summary-list-item.result-item{text-decoration:overline;padding-top:5px}.summary-list .tax-label{font-size:12px}.tertiary-font-color{color:#212121;font-size:14px!important}.stencil-shimmer{width:100%;min-height:20px;margin-bottom:4px}.item-price-before-discount{font-size:14px;margin-right:8px;color:#9e9e9e;text-decoration:line-through;border-bottom:1px dotted #9e9e9e}"]
|
2794 | }] }
|
2795 | ];
|
2796 |
|
2797 | OrderItemListComponent.ctorParameters = () => [
|
2798 | { type: TranslateService }
|
2799 | ];
|
2800 | OrderItemListComponent.propDecorators = {
|
2801 | taxOptions: [{ type: Input }],
|
2802 | hidePricing: [{ type: Input }],
|
2803 | orderItems: [{ type: Input }]
|
2804 | };
|
2805 | if (false) {
|
2806 |
|
2807 | OrderItemListComponent.prototype.items;
|
2808 |
|
2809 | OrderItemListComponent.prototype.summaryItems;
|
2810 |
|
2811 | OrderItemListComponent.prototype.includesUndefinedPricing;
|
2812 |
|
2813 | OrderItemListComponent.prototype.taxOptions;
|
2814 |
|
2815 | OrderItemListComponent.prototype.hidePricing;
|
2816 | |
2817 |
|
2818 |
|
2819 |
|
2820 | OrderItemListComponent.prototype.translateService;
|
2821 | }
|
2822 |
|
2823 |
|
2824 |
|
2825 |
|
2826 |
|
2827 | class PricePipe {
|
2828 | |
2829 |
|
2830 |
|
2831 |
|
2832 |
|
2833 |
|
2834 |
|
2835 |
|
2836 |
|
2837 | transform(value, currency, billingFrequency, isCents = true, translateZero = true, displaySymbol = true) {
|
2838 | return formatDisplayPrice(value, currency, billingFrequency, isCents, translateZero, displaySymbol);
|
2839 | }
|
2840 | }
|
2841 | PricePipe.decorators = [
|
2842 | { type: Pipe, args: [{ name: 'price' },] }
|
2843 | ];
|
2844 | class FormatBillingFrequencyPipe {
|
2845 | |
2846 |
|
2847 |
|
2848 |
|
2849 | transform(value) {
|
2850 | return formatBillingFrequency(value);
|
2851 | }
|
2852 | }
|
2853 | FormatBillingFrequencyPipe.decorators = [
|
2854 | { type: Pipe, args: [{ name: 'formatBillingFrequency' },] }
|
2855 | ];
|
2856 |
|
2857 |
|
2858 |
|
2859 |
|
2860 |
|
2861 | class VaOrderFormModule {
|
2862 | }
|
2863 | VaOrderFormModule.decorators = [
|
2864 | { type: NgModule, args: [{
|
2865 | imports: [
|
2866 | CommonModule,
|
2867 | FormsModule,
|
2868 | MatButtonModule,
|
2869 | MatCheckboxModule,
|
2870 | MatExpansionModule,
|
2871 | MatIconModule,
|
2872 | MatInputModule,
|
2873 | MatOptionModule,
|
2874 | MatProgressSpinnerModule,
|
2875 | MatSelectModule,
|
2876 | MatCardModule,
|
2877 | MatTooltipModule,
|
2878 | ReactiveFormsModule,
|
2879 | VaFormsModule,
|
2880 | VaHeaderContainerModule,
|
2881 | VaIconModule,
|
2882 | VaFormsModule,
|
2883 | VaBadgeModule,
|
2884 | MatListModule,
|
2885 | TranslateModule,
|
2886 | ],
|
2887 | declarations: [
|
2888 | DropDownFormSectionComponent,
|
2889 | FieldComponent,
|
2890 | OrderFormSectionComponent,
|
2891 | OrderFormComponent,
|
2892 | FieldBuilderComponent,
|
2893 | OrderItemListComponent,
|
2894 | PricePipe,
|
2895 | FormatBillingFrequencyPipe,
|
2896 | ],
|
2897 | exports: [
|
2898 | DropDownFormSectionComponent,
|
2899 | FieldComponent,
|
2900 | OrderFormSectionComponent,
|
2901 | OrderFormComponent,
|
2902 | FieldBuilderComponent,
|
2903 | OrderItemListComponent,
|
2904 | ],
|
2905 | providers: [
|
2906 | FieldService,
|
2907 | OrderFormService,
|
2908 | OrderItemListService,
|
2909 | ]
|
2910 | },] }
|
2911 | ];
|
2912 |
|
2913 |
|
2914 |
|
2915 |
|
2916 |
|
2917 | class StoreService {
|
2918 | |
2919 |
|
2920 |
|
2921 |
|
2922 | markFormsAsTouched(formGroup) {
|
2923 | for (const key in formGroup.controls) {
|
2924 | if (formGroup.controls[key] instanceof FormGroup) {
|
2925 | this.markFormsAsTouched(( (formGroup.controls[key])));
|
2926 | }
|
2927 | else {
|
2928 | (( (formGroup.controls[key]))).markAsTouched();
|
2929 | (( (formGroup.controls[key]))).updateValueAndValidity();
|
2930 | }
|
2931 | }
|
2932 | }
|
2933 | }
|
2934 | StoreService.decorators = [
|
2935 | { type: Injectable }
|
2936 | ];
|
2937 |
|
2938 |
|
2939 |
|
2940 |
|
2941 |
|
2942 | class File {
|
2943 | |
2944 |
|
2945 |
|
2946 | constructor(url) {
|
2947 | this.url = url;
|
2948 | this.url = url;
|
2949 | }
|
2950 | |
2951 |
|
2952 |
|
2953 | get name() {
|
2954 | return this.url ? this.url.substring(this.url.lastIndexOf('/') + 1, this.url.lastIndexOf('.')) : null;
|
2955 | }
|
2956 | |
2957 |
|
2958 |
|
2959 | get icon() {
|
2960 |
|
2961 | const ext = this.url ? this.url.substring(this.url.lastIndexOf('.') + 1) : null;
|
2962 | switch (ext) {
|
2963 | case 'pdf':
|
2964 | return 'icon-pdf';
|
2965 | case 'ppt':
|
2966 | return 'icon-ppt';
|
2967 | default:
|
2968 | return 'icon-docs';
|
2969 | }
|
2970 | }
|
2971 | }
|
2972 | if (false) {
|
2973 |
|
2974 | File.prototype.url;
|
2975 | }
|
2976 |
|
2977 |
|
2978 |
|
2979 |
|
2980 |
|
2981 |
|
2982 |
|
2983 |
|
2984 | function Pricing() { }
|
2985 | if (false) {
|
2986 |
|
2987 | Pricing.prototype.currency;
|
2988 |
|
2989 | Pricing.prototype.prices;
|
2990 | }
|
2991 |
|
2992 |
|
2993 |
|
2994 | function Price() { }
|
2995 | if (false) {
|
2996 |
|
2997 | Price.prototype.price;
|
2998 |
|
2999 | Price.prototype.frequency;
|
3000 |
|
3001 | Price.prototype.isStartingPrice;
|
3002 | }
|
3003 |
|
3004 | const CONTACT_SALES = -1;
|
3005 |
|
3006 |
|
3007 |
|
3008 |
|
3009 |
|
3010 | class Sellable {
|
3011 | |
3012 |
|
3013 |
|
3014 | get isFree() {
|
3015 | return this.pricing && this.pricing.prices ? this.pricing.prices.some(( |
3016 |
|
3017 |
|
3018 |
|
3019 | p => p.price === 0 || p.price === undefined)) : false;
|
3020 | }
|
3021 | |
3022 |
|
3023 |
|
3024 | get shouldContactSales() {
|
3025 | return this.pricing && this.pricing.prices ?
|
3026 | this.pricing.prices.some(( |
3027 |
|
3028 |
|
3029 |
|
3030 | p => p.price === null || p.price === CONTACT_SALES)) ||
|
3031 | this.pricing.prices.length === 0 : true;
|
3032 | }
|
3033 | |
3034 |
|
3035 |
|
3036 |
|
3037 | static getCapitalizeFirstLetter(inputString) {
|
3038 | return inputString ? inputString.charAt(0).toUpperCase() + inputString.slice(1) : null;
|
3039 | }
|
3040 | |
3041 |
|
3042 |
|
3043 | get formattedPricingList() {
|
3044 | if (this.pricing && this.pricing.prices && this.pricing.prices.length) {
|
3045 |
|
3046 | const hasCurrencyAndIsNotUSD = this.pricing.currency && this.pricing.currency !== 'USD';
|
3047 |
|
3048 | const currencyStr = hasCurrencyAndIsNotUSD ? this.pricing.currency : '';
|
3049 |
|
3050 | const currencySymbol = Sellable.getCurrencySymbol(this.pricing.currency);
|
3051 | return this.pricing.prices.map(( |
3052 |
|
3053 |
|
3054 |
|
3055 | price => {
|
3056 |
|
3057 | const frequencyStr = price.frequency ? '/ ' + Sellable.getCapitalizeFirstLetter(price.frequency) : '';
|
3058 |
|
3059 | const roundedPrice = ((price.price || 0) / 100.0).toFixed(2);
|
3060 |
|
3061 | const startingAtPrefix = price.isStartingPrice ? 'Starting at ' : '';
|
3062 |
|
3063 | const priceStr = `${startingAtPrefix}${currencySymbol}${roundedPrice} ${currencyStr} ${frequencyStr}`;
|
3064 | return (priceStr.trim().replace(/\s+/g, ' '));
|
3065 | }));
|
3066 | }
|
3067 | else {
|
3068 | return ['Contact Sales'];
|
3069 | }
|
3070 | }
|
3071 | |
3072 |
|
3073 |
|
3074 | get priceStrings() {
|
3075 | if (this.shouldContactSales) {
|
3076 | return ['Contact Sales'];
|
3077 | }
|
3078 | if (this.isFree) {
|
3079 | return ['Free'];
|
3080 | }
|
3081 | return this.formattedPricingList;
|
3082 | }
|
3083 | |
3084 |
|
3085 |
|
3086 | get formattedWholesalePrice() {
|
3087 | return this.priceStrings.join(' + ');
|
3088 | }
|
3089 | |
3090 |
|
3091 |
|
3092 |
|
3093 | static getCurrencySymbol(currency) {
|
3094 |
|
3095 | let currencySymbol = '$';
|
3096 | switch (currency) {
|
3097 | case 'EUR':
|
3098 | currencySymbol = '\u20AC';
|
3099 | break;
|
3100 | case 'GBP':
|
3101 | currencySymbol = '\u00A3';
|
3102 | break;
|
3103 | case 'CHF':
|
3104 | currencySymbol = 'Fr';
|
3105 | break;
|
3106 | case 'CNY':
|
3107 | currencySymbol = '\u00A5';
|
3108 | break;
|
3109 | case 'JPY':
|
3110 | currencySymbol = '\u00A5';
|
3111 | break;
|
3112 | case 'CZK':
|
3113 | currencySymbol = 'K\u010d';
|
3114 | break;
|
3115 | case 'INR':
|
3116 | currencySymbol = '\u20B9';
|
3117 | break;
|
3118 | case 'KHR':
|
3119 | currencySymbol = '\u17DB';
|
3120 | break;
|
3121 | case 'KRW':
|
3122 | currencySymbol = '\u20A9';
|
3123 | break;
|
3124 | case 'NOK':
|
3125 | currencySymbol = 'kr';
|
3126 | break;
|
3127 | case 'SEK':
|
3128 | currencySymbol = 'kr';
|
3129 | break;
|
3130 | case 'RUB':
|
3131 | currencySymbol = '\u20BD';
|
3132 | break;
|
3133 | case 'TRY':
|
3134 | currencySymbol = '\u20BA';
|
3135 | break;
|
3136 | case 'ZAR':
|
3137 | currencySymbol = 'R';
|
3138 | break;
|
3139 | default:
|
3140 | currencySymbol = '$';
|
3141 | break;
|
3142 | }
|
3143 | return currencySymbol;
|
3144 | }
|
3145 | }
|
3146 | if (false) {
|
3147 |
|
3148 | Sellable.prototype.pricing;
|
3149 | }
|
3150 |
|
3151 |
|
3152 |
|
3153 |
|
3154 |
|
3155 |
|
3156 | class CaseTransform {
|
3157 | |
3158 |
|
3159 |
|
3160 |
|
3161 | static snakeToCamelCase(value) {
|
3162 | return value ? value.replace(new RegExp(/_/g), ' ').replace(/\b\w/g, ( |
3163 |
|
3164 |
|
3165 |
|
3166 | l => l.toUpperCase()))
|
3167 | .replace(/\b\w/, ( |
3168 |
|
3169 |
|
3170 |
|
3171 | l => l.toLowerCase())).replace(/\s/g, '') : value;
|
3172 | }
|
3173 | |
3174 |
|
3175 |
|
3176 |
|
3177 | static lowerToTitleCase(value) {
|
3178 |
|
3179 |
|
3180 | const smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;
|
3181 | return value ? value.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, ( |
3182 |
|
3183 |
|
3184 |
|
3185 |
|
3186 |
|
3187 | function (match, index, title) {
|
3188 | if (index > 0 && index + match.length !== title.length &&
|
3189 | match.search(smallWords) > -1 && title.charAt(index - 2) !== ':' &&
|
3190 | (title.charAt(index + match.length) !== '-' || title.charAt(index - 1) === '-') &&
|
3191 | title.charAt(index - 1).search(/[^\s-]/) < 0) {
|
3192 | return match.toLowerCase();
|
3193 | }
|
3194 | if (match.substr(1).search(/[A-Z]|\../) > -1) {
|
3195 | return match;
|
3196 | }
|
3197 | return match.charAt(0).toUpperCase() + match.substr(1);
|
3198 | })) : value;
|
3199 | }
|
3200 | ;
|
3201 | }
|
3202 |
|
3203 |
|
3204 |
|
3205 |
|
3206 |
|
3207 |
|
3208 | const COLOR_CODES = [
|
3209 | '#EF5350', '#42A5F5', '#66BB6A', '#FFA726', '#AB47BC', '#FFCA28', '#EC407A', '#26C6DA',
|
3210 | '#FF7B57'
|
3211 | ];
|
3212 |
|
3213 | const DEFAULT_COLOR = '#808080';
|
3214 | class Product extends Sellable {
|
3215 | |
3216 |
|
3217 |
|
3218 | constructor(data) {
|
3219 | super();
|
3220 | this.addons = [];
|
3221 | data = data || {};
|
3222 | this.pricing = data.pricing;
|
3223 | this.productId = data.productId;
|
3224 | this.editionId = data.editionId;
|
3225 | this.editionName = data.editionName;
|
3226 | this.name = data.name;
|
3227 | this.description = data.description;
|
3228 | this.tagline = data.tagline;
|
3229 | this.iconUrl = data.iconUrl;
|
3230 | this.entryUrl = data.entryUrl;
|
3231 | this.screenshotUrls = data.screenshotUrls;
|
3232 | this.pdfUploadUrls = data.pdfUploadUrls;
|
3233 | this.lmiCategories = data.lmiCategories;
|
3234 | this.keySellingPoints = data.keySellingPoints;
|
3235 | this.faqs = data.faqs;
|
3236 | this.wholesalePrice = data.wholesalePrice;
|
3237 | this.currency = data.currency;
|
3238 | this.billingFrequency = data.billingFrequency;
|
3239 | this.isArchived = data.isArchived;
|
3240 | this.addons = data.addons;
|
3241 | this.restrictions = data.restrictions;
|
3242 | this.billingId = data.billingId;
|
3243 | if (data.hasOwnProperty('pdfUploadUrls')) {
|
3244 | this.files = this.pdfUploadUrls ? this.pdfUploadUrls.map(( |
3245 |
|
3246 |
|
3247 |
|
3248 | url => new File(url))) : null;
|
3249 | }
|
3250 | }
|
3251 | |
3252 |
|
3253 |
|
3254 |
|
3255 | static fromApi(data) {
|
3256 |
|
3257 | const newProduct = {};
|
3258 | data = data || {};
|
3259 | for (const key in data) {
|
3260 | if (data.hasOwnProperty(key)) {
|
3261 |
|
3262 | const newKey = CaseTransform.snakeToCamelCase(key);
|
3263 | newProduct[newKey] = data[key];
|
3264 | }
|
3265 | }
|
3266 | return new Product(newProduct);
|
3267 | }
|
3268 | |
3269 |
|
3270 |
|
3271 | get iconStyle() {
|
3272 | return this.iconUrl ? `url("${this.iconUrl}") no-repeat center / 100% 100%` : null;
|
3273 | }
|
3274 | |
3275 |
|
3276 |
|
3277 | get iconColor() {
|
3278 |
|
3279 | if (!this.name) {
|
3280 | return DEFAULT_COLOR;
|
3281 | }
|
3282 |
|
3283 | let nameSum = 0;
|
3284 | for (let i = 0; i < this.name.length; i++) {
|
3285 | nameSum += this.name[i].charCodeAt(0);
|
3286 | }
|
3287 |
|
3288 | const index = nameSum % COLOR_CODES.length;
|
3289 | return COLOR_CODES[index];
|
3290 | }
|
3291 | |
3292 |
|
3293 |
|
3294 | getLmiCategoryNames() {
|
3295 |
|
3296 | const lmiCategories = this.lmiCategories || [];
|
3297 | return lmiCategories.map(( |
3298 |
|
3299 |
|
3300 |
|
3301 | lmiCategory => CaseTransform.lowerToTitleCase(lmiCategory.toLowerCase().replace(/_/g, ' '))));
|
3302 | }
|
3303 | }
|
3304 | if (false) {
|
3305 |
|
3306 | Product.prototype.productId;
|
3307 |
|
3308 | Product.prototype.editionId;
|
3309 |
|
3310 | Product.prototype.editionName;
|
3311 |
|
3312 | Product.prototype.name;
|
3313 |
|
3314 | Product.prototype.description;
|
3315 |
|
3316 | Product.prototype.tagline;
|
3317 |
|
3318 | Product.prototype.iconUrl;
|
3319 |
|
3320 | Product.prototype.entryUrl;
|
3321 |
|
3322 | Product.prototype.screenshotUrls;
|
3323 |
|
3324 | Product.prototype.pdfUploadUrls;
|
3325 |
|
3326 | Product.prototype.lmiCategories;
|
3327 |
|
3328 | Product.prototype.keySellingPoints;
|
3329 |
|
3330 | Product.prototype.faqs;
|
3331 |
|
3332 | Product.prototype.wholesalePrice;
|
3333 |
|
3334 | Product.prototype.currency;
|
3335 |
|
3336 | Product.prototype.billingFrequency;
|
3337 |
|
3338 | Product.prototype.billingId;
|
3339 |
|
3340 | Product.prototype.isArchived;
|
3341 |
|
3342 | Product.prototype.addons;
|
3343 |
|
3344 | Product.prototype.files;
|
3345 |
|
3346 | Product.prototype.restrictions;
|
3347 | }
|
3348 | class ProductWithParent extends Product {
|
3349 | |
3350 |
|
3351 |
|
3352 |
|
3353 | static fromApi(data) {
|
3354 |
|
3355 | const newProduct = {};
|
3356 | data = data || {};
|
3357 | for (const key in data) {
|
3358 | if (data.hasOwnProperty(key)) {
|
3359 |
|
3360 | const newKey = CaseTransform.snakeToCamelCase(key);
|
3361 | newProduct[newKey] = data[key];
|
3362 | }
|
3363 | }
|
3364 | return new ProductWithParent(newProduct);
|
3365 | }
|
3366 | |
3367 |
|
3368 |
|
3369 | constructor(data) {
|
3370 | super(data);
|
3371 | this.parentId = data.parentId;
|
3372 | this.parentName = data.parentName;
|
3373 | this.parentIconUrl = data.parentIconUrl;
|
3374 | this.multipleActivations = data.multipleActivations || false;
|
3375 | }
|
3376 | }
|
3377 | if (false) {
|
3378 |
|
3379 | ProductWithParent.prototype.parentId;
|
3380 |
|
3381 | ProductWithParent.prototype.parentName;
|
3382 |
|
3383 | ProductWithParent.prototype.parentIconUrl;
|
3384 |
|
3385 | ProductWithParent.prototype.multipleActivations;
|
3386 | }
|
3387 |
|
3388 |
|
3389 |
|
3390 |
|
3391 |
|
3392 | class AddonDetailsComponent {
|
3393 | constructor() {
|
3394 | this.hasVerifiedContract = false;
|
3395 | this.loaded = true;
|
3396 | this.showPricing = true;
|
3397 | this.showEnableAddon = false;
|
3398 | this.actionEnabled = false;
|
3399 | this.prerequisiteSelected = new EventEmitter();
|
3400 | this.actionSelected = new EventEmitter();
|
3401 | }
|
3402 | |
3403 |
|
3404 |
|
3405 | onPrerequisiteSelected() {
|
3406 | this.prerequisiteSelected.emit();
|
3407 | }
|
3408 | |
3409 |
|
3410 |
|
3411 | onActionSelected() {
|
3412 | this.actionSelected.emit();
|
3413 | }
|
3414 | |
3415 |
|
3416 |
|
3417 |
|
3418 |
|
3419 | getPricing(product, addon) {
|
3420 | return {
|
3421 | currency: product.currency,
|
3422 | prices: [
|
3423 | {
|
3424 | price: addon.price,
|
3425 | frequency: addon.billingFrequency ? addon.billingFrequency : 'Monthly'
|
3426 | }
|
3427 | ]
|
3428 | };
|
3429 | }
|
3430 | |
3431 |
|
3432 |
|
3433 | get pricingLabel() {
|
3434 | return this.reseller ? 'Wholesale Pricing' : 'Pricing';
|
3435 | }
|
3436 | }
|
3437 | AddonDetailsComponent.decorators = [
|
3438 | { type: Component, args: [{
|
3439 | selector: 'addon-details',
|
3440 | template: "<div class=\"addon-page\">\n <va-header-container [iconUrl]=\"addon.icon\"\n [title]=\"addon.title\"\n [tagline]=\"addon.tagline\"\n [chipLabels]=\"product.getLmiCategoryNames()\"\n [pricing]=\"getPricing(product, addon)\"\n [pricingLabel]=\"pricingLabel\"\n [prerequisiteLabel]=\"product.name\"\n [billedProduct]=\"billedProduct\"\n [hasVerifiedContract]=\"hasVerifiedContract\"\n [loaded]=\"loaded\"\n [showPricing]=\"showPricing\"\n [actionLabel]=\"'Enable Add-on'\"\n [showEnableAddon]=\"showEnableAddon\"\n (actionSelected)=\"onActionSelected()\"\n (prerequisiteSelected)=\"onPrerequisiteSelected()\">\n </va-header-container>\n\n <div class=\"addon-details addon-content\">\n <ng-container *ngIf=\"reseller\">\n <div class=\"left-column\">\n <div *ngIf=\"addon.resellerMarketing?.description || addon.resellerMarketing?.keySellingPoints\">\n <va-selling-info [description]=\"addon.resellerMarketing?.description\"\n [keySellingPoints]=\"addon.resellerMarketing?.keySellingPoints\"></va-selling-info>\n </div>\n <section *ngIf=\"addon.resellerMarketing?.faqs?.length > 0 && addon.resellerMarketing?.faqs[0].question\">\n <h2 class=\"va-addon-title\">FAQs</h2>\n <va-faqs [faqs]=\"addon.resellerMarketing?.faqs\"></va-faqs>\n </section>\n </div>\n <div class=\"right-column\">\n <section *ngIf=\"addon.restrictions?.country?.whitelist\">\n <supported-countries [countryCodes]=\"addon.restrictions.country.whitelist\"></supported-countries>\n </section>\n <section *ngIf=\"addon.screenshots?.length > 0\">\n <h2 class=\"va-addon-title\">Gallery</h2>\n <va-image-gallery [imageUrls]=\"addon.screenshots\"></va-image-gallery>\n </section>\n <section *ngIf=\"addon.resellerMarketing?.files?.length > 0\">\n <h2 class=\"va-addon-title\">Files</h2>\n <va-files [files]=\"addon.resellerMarketingFiles\"></va-files>\n </section>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"!reseller\">\n <div class=\"left-column\">\n <div *ngIf=\"addon.endUserMarketing?.description || addon.endUserMarketing?.keySellingPoints\">\n <va-selling-info [description]=\"addon.endUserMarketing?.description\"\n [keySellingPoints]=\"addon.endUserMarketing?.keySellingPoints\"></va-selling-info>\n </div>\n <section *ngIf=\"addon.endUserMarketing?.faqs?.length > 0 && addon.endUserMarketing?.faqs[0].question\">\n <h2 class=\"va-addon-title\">FAQs</h2>\n <va-faqs [faqs]=\"addon.endUserMarketing?.faqs\"></va-faqs>\n </section>\n </div>\n\n <div class=\"right-column\">\n <section *ngIf=\"addon.restrictions?.country?.whitelist?.length > 0\">\n <supported-countries [countryCodes]=\"addon.restrictions.country.whitelist\"></supported-countries>\n </section>\n <section *ngIf=\"addon.screenshots?.length > 0\">\n <h2 class=\"va-addon-title\">Gallery</h2>\n <va-image-gallery [imageUrls]=\"addon.screenshots\"></va-image-gallery>\n </section>\n <section *ngIf=\"addon.endUserMarketing?.files?.length > 0\">\n <h2 class=\"va-addon-title\">Files</h2>\n <va-files [files]=\"addon.endUserMarketingFiles\"></va-files>\n </section>\n </div>\n </ng-container>\n </div>\n\n</div>\n",
|
3441 | styles: [":host{display:block;font-size:14px;line-height:1.4}:host *{box-sizing:border-box}.va-addon-title{font-size:32px;font-weight:300;margin-top:0;color:#212121}@media screen and (min-width:600px){.va-addon-title{font-size:32px}}img{max-width:100%}va-icon{display:inline-block}.addon-page{position:relative;margin:0 auto 20px;background:#fff;box-shadow:0 3px 10px rgba(33,33,33,.3);overflow:hidden;font-size:16px;color:#212121}.addon-page .item-amount{color:#999;font-size:14px;text-align:right;margin:0 24px 8px}section{padding:24px}.left-column{width:66%}@media screen and (max-width:600px){.left-column{width:100%}}.right-column{width:34%}.addon-content{display:-webkit-box;display:flex}@media screen and (max-width:600px){.right-column{width:100%}.addon-content{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}}"]
|
3442 | }] }
|
3443 | ];
|
3444 | AddonDetailsComponent.propDecorators = {
|
3445 | product: [{ type: Input }],
|
3446 | addon: [{ type: Input }],
|
3447 | reseller: [{ type: Input }],
|
3448 | billedProduct: [{ type: Input }],
|
3449 | hasVerifiedContract: [{ type: Input }],
|
3450 | loaded: [{ type: Input }],
|
3451 | showPricing: [{ type: Input }],
|
3452 | showEnableAddon: [{ type: Input }],
|
3453 | actionEnabled: [{ type: Input }],
|
3454 | prerequisiteSelected: [{ type: Output }],
|
3455 | actionSelected: [{ type: Output }]
|
3456 | };
|
3457 | if (false) {
|
3458 |
|
3459 | AddonDetailsComponent.prototype.product;
|
3460 |
|
3461 | AddonDetailsComponent.prototype.addon;
|
3462 |
|
3463 | AddonDetailsComponent.prototype.reseller;
|
3464 |
|
3465 | AddonDetailsComponent.prototype.billedProduct;
|
3466 |
|
3467 | AddonDetailsComponent.prototype.hasVerifiedContract;
|
3468 |
|
3469 | AddonDetailsComponent.prototype.loaded;
|
3470 |
|
3471 | AddonDetailsComponent.prototype.showPricing;
|
3472 |
|
3473 | AddonDetailsComponent.prototype.showEnableAddon;
|
3474 |
|
3475 | AddonDetailsComponent.prototype.actionEnabled;
|
3476 |
|
3477 | AddonDetailsComponent.prototype.prerequisiteSelected;
|
3478 |
|
3479 | AddonDetailsComponent.prototype.actionSelected;
|
3480 | }
|
3481 |
|
3482 |
|
3483 |
|
3484 |
|
3485 |
|
3486 | class VaFilesComponent {
|
3487 | }
|
3488 | VaFilesComponent.decorators = [
|
3489 | { type: Component, args: [{
|
3490 | selector: 'va-files',
|
3491 | template: `
|
3492 | <div class="va-files file-list-container" *ngFor="let file of files">
|
3493 | <mat-icon class="file-icon">insert_drive_file</mat-icon>
|
3494 | <a [href]="file.url" target="_blank">{{ file.name }}</a>
|
3495 | </div>`,
|
3496 | styles: [".va-files{display:-webkit-inline-box;display:inline-flex;margin-bottom:16px}.va-files a{color:#212121;font-size:16px;font-weight:700;-ms-grid-row-align:center;align-self:center;padding-left:8px;text-decoration:none}.va-files .file-icon{vertical-align:middle}.va-files .file-list-container{display:-webkit-box;display:flex}"]
|
3497 | }] }
|
3498 | ];
|
3499 | VaFilesComponent.propDecorators = {
|
3500 | files: [{ type: Input }]
|
3501 | };
|
3502 | if (false) {
|
3503 |
|
3504 | VaFilesComponent.prototype.files;
|
3505 | }
|
3506 |
|
3507 |
|
3508 |
|
3509 |
|
3510 |
|
3511 | class VaFilesModule {
|
3512 | }
|
3513 | VaFilesModule.decorators = [
|
3514 | { type: NgModule, args: [{
|
3515 | imports: [
|
3516 | CommonModule,
|
3517 | MatIconModule
|
3518 | ],
|
3519 | declarations: [VaFilesComponent],
|
3520 | exports: [VaFilesComponent]
|
3521 | },] }
|
3522 | ];
|
3523 |
|
3524 |
|
3525 |
|
3526 |
|
3527 |
|
3528 | class VaFaqsComponent {
|
3529 | constructor() {
|
3530 | this.openFaqs = [];
|
3531 | }
|
3532 | |
3533 |
|
3534 |
|
3535 |
|
3536 | toggleFaq(index) {
|
3537 | if (this.openFaqs.indexOf(index) >= 0) {
|
3538 | this.openFaqs.splice(this.openFaqs.indexOf(index), 1);
|
3539 | }
|
3540 | else {
|
3541 | this.openFaqs.push(index);
|
3542 | }
|
3543 | }
|
3544 | |
3545 |
|
3546 |
|
3547 |
|
3548 | isFaqOpen(index) {
|
3549 | return this.openFaqs.indexOf(index) >= 0;
|
3550 | }
|
3551 | |
3552 |
|
3553 |
|
3554 |
|
3555 | faqIcon(index) {
|
3556 | return this.isFaqOpen(index) ? 'keyboard_arrow_up' : 'keyboard_arrow_down';
|
3557 | }
|
3558 | }
|
3559 | VaFaqsComponent.decorators = [
|
3560 | { type: Component, args: [{
|
3561 | selector: 'va-faqs',
|
3562 | template: `
|
3563 | <div class="va-faq" *ngFor="let faq of faqs; let i = index;">
|
3564 | <div class="question" (click)="toggleFaq(i)">
|
3565 | <span>{{ faq.question }}</span>
|
3566 | <mat-icon>{{ faqIcon(i) }}</mat-icon>
|
3567 | </div>
|
3568 | <span class="answer" [ngClass]="{'show': isFaqOpen(i) }" [innerHtml]="faq.answer | vaSanitize"></span>
|
3569 | </div>`,
|
3570 | styles: [".va-faq{font-size:16px;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-pack:start;justify-content:flex-start;padding:12px 0;border-bottom:1px solid #e0e0e0}.va-faq:first-of-type{border-top:1px solid #e0e0e0}.va-faq .question{display:-webkit-box;display:flex;-webkit-box-pack:justify;justify-content:space-between;-webkit-box-align:center;align-items:center;color:#212121;cursor:pointer}.va-faq .answer{color:#616161;height:0;overflow:hidden}.va-faq .show{padding-top:12px;height:inherit}"]
|
3571 | }] }
|
3572 | ];
|
3573 | VaFaqsComponent.propDecorators = {
|
3574 | faqs: [{ type: Input }]
|
3575 | };
|
3576 | if (false) {
|
3577 |
|
3578 | VaFaqsComponent.prototype.faqs;
|
3579 |
|
3580 | VaFaqsComponent.prototype.openFaqs;
|
3581 | }
|
3582 |
|
3583 |
|
3584 |
|
3585 |
|
3586 |
|
3587 | class VaFaqsModule {
|
3588 | }
|
3589 | VaFaqsModule.decorators = [
|
3590 | { type: NgModule, args: [{
|
3591 | imports: [CommonModule, MatIconModule, VaSafeHtmlModule],
|
3592 | declarations: [VaFaqsComponent],
|
3593 | exports: [VaFaqsComponent]
|
3594 | },] }
|
3595 | ];
|
3596 |
|
3597 |
|
3598 |
|
3599 |
|
3600 |
|
3601 | class VaSellingInfoComponent {
|
3602 | |
3603 |
|
3604 |
|
3605 | get filterDescription() {
|
3606 |
|
3607 | const desc = this.description.replace(/max-width:\d*[^\"]/i, 'max-width:100%');
|
3608 | if ((desc.indexOf('"max-width:100%"') === -1) && (desc.indexOf('<iframe ') !== -1)) {
|
3609 |
|
3610 | const index = desc.indexOf('<iframe ') + 7;
|
3611 | return desc.substr(0, index) + ' style="max-width:100%"' + desc.substr(index);
|
3612 | }
|
3613 | return String(desc);
|
3614 | }
|
3615 | }
|
3616 | VaSellingInfoComponent.decorators = [
|
3617 | { type: Component, args: [{
|
3618 | selector: 'va-selling-info',
|
3619 | template: `
|
3620 | <section *ngIf="description" class="resize" [innerHtml]="filterDescription | vaSafeHtml"></section>
|
3621 | <section *ngIf="keySellingPoints && keySellingPoints.length > 0" class="key-selling-points">
|
3622 | <div *ngFor="let ksp of keySellingPoints" class="key-selling-point">
|
3623 | <mat-icon>check_circle</mat-icon>
|
3624 | {{ ksp }}
|
3625 | </div>
|
3626 | </section>
|
3627 | `,
|
3628 | styles: ["section{padding:24px}section ::ng-deep>:first-child{margin-top:0;padding-top:0}#description *{max-width:100%!important}.key-selling-point{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;padding-bottom:24px;font-size:16px}@media screen and (max-width:600px){.resize{font-size:16px}.key-selling-point{-webkit-box-align:start;align-items:flex-start}}.key-selling-point:last-of-type{padding-bottom:0}.key-selling-point mat-icon{color:#4caf50;font-size:32px;width:32px;height:32px;margin-right:20px}"]
|
3629 | }] }
|
3630 | ];
|
3631 | VaSellingInfoComponent.propDecorators = {
|
3632 | description: [{ type: Input }],
|
3633 | keySellingPoints: [{ type: Input }]
|
3634 | };
|
3635 | if (false) {
|
3636 |
|
3637 | VaSellingInfoComponent.prototype.description;
|
3638 |
|
3639 | VaSellingInfoComponent.prototype.keySellingPoints;
|
3640 | }
|
3641 |
|
3642 |
|
3643 |
|
3644 |
|
3645 |
|
3646 | class VaSellingInfoModule {
|
3647 | }
|
3648 | VaSellingInfoModule.decorators = [
|
3649 | { type: NgModule, args: [{
|
3650 | imports: [CommonModule, MatIconModule, VaSafeHtmlModule],
|
3651 | declarations: [VaSellingInfoComponent],
|
3652 | exports: [VaSellingInfoComponent]
|
3653 | },] }
|
3654 | ];
|
3655 |
|
3656 |
|
3657 |
|
3658 |
|
3659 |
|
3660 | class SupportedCountriesComponent {
|
3661 | }
|
3662 | SupportedCountriesComponent.decorators = [
|
3663 | { type: Component, args: [{
|
3664 | selector: 'supported-countries',
|
3665 | template: `
|
3666 | <span class="supported-text"> Supported Countries: </span>
|
3667 | <div class="flags">
|
3668 | <span *ngFor="let countryCode of countryCodes" matTooltip="{{countryCode}}" matTooltipPosition="below"
|
3669 | class="flag-icon flag-icon-{{countryCode.toLowerCase()}}">
|
3670 | </span>
|
3671 | </div>
|
3672 | `,
|
3673 | styles: [".flag-icon{margin-right:10px}.supported-text{margin-right:3px}.flags{display:inline-block}"]
|
3674 | }] }
|
3675 | ];
|
3676 | SupportedCountriesComponent.propDecorators = {
|
3677 | countryCodes: [{ type: Input }]
|
3678 | };
|
3679 | if (false) {
|
3680 |
|
3681 | SupportedCountriesComponent.prototype.countryCodes;
|
3682 | }
|
3683 |
|
3684 |
|
3685 |
|
3686 |
|
3687 |
|
3688 | class RestrictionsModule {
|
3689 | }
|
3690 | RestrictionsModule.decorators = [
|
3691 | { type: NgModule, args: [{
|
3692 | imports: [CommonModule, MatTooltipModule],
|
3693 | declarations: [SupportedCountriesComponent],
|
3694 | exports: [SupportedCountriesComponent]
|
3695 | },] }
|
3696 | ];
|
3697 |
|
3698 |
|
3699 |
|
3700 |
|
3701 |
|
3702 | class AddonModule {
|
3703 | }
|
3704 | AddonModule.decorators = [
|
3705 | { type: NgModule, args: [{
|
3706 | imports: [
|
3707 | CommonModule,
|
3708 | VaListModule,
|
3709 | VaImageGalleryModule,
|
3710 | VaIconModule,
|
3711 | VaPricingModule,
|
3712 | VaFilesModule,
|
3713 | VaFaqsModule,
|
3714 | VaSellingInfoModule,
|
3715 | VaHeaderContainerModule,
|
3716 | VaSafeHtmlModule,
|
3717 | MatProgressSpinnerModule$1,
|
3718 | VaBreadcrumbsModule,
|
3719 | RestrictionsModule
|
3720 | ],
|
3721 | exports: [AddonDetailsComponent],
|
3722 | declarations: [AddonDetailsComponent],
|
3723 | providers: [],
|
3724 | entryComponents: []
|
3725 | },] }
|
3726 | ];
|
3727 |
|
3728 |
|
3729 |
|
3730 |
|
3731 |
|
3732 | class DetailsStencilComponent {
|
3733 | }
|
3734 | DetailsStencilComponent.decorators = [
|
3735 | { type: Component, args: [{
|
3736 | selector: 'details-stencil',
|
3737 | template: `
|
3738 | <div class="details">
|
3739 |
|
3740 | <mat-card class="details-header">
|
3741 | <div class="details-column-0">
|
3742 | <div class="details-column-0-1">
|
3743 | <div class="details-icon stencil-shimmer"></div>
|
3744 | </div>
|
3745 | <div class="details-column-0-2">
|
3746 | <div class="details-title stencil-shimmer"></div>
|
3747 | <div class="details-title stencil-shimmer"></div>
|
3748 | </div>
|
3749 | </div>
|
3750 | <div class="details-column-1">
|
3751 | <div class="details-column-1-0 stencil-shimmer"></div>
|
3752 | <div class="details-column-1-1 stencil-shimmer"></div>
|
3753 | </div>
|
3754 | </mat-card>
|
3755 |
|
3756 | <mat-card>
|
3757 | <div class="details-box-large stencil-shimmer"></div>
|
3758 | </mat-card>
|
3759 |
|
3760 | <mat-card class="details-body">
|
3761 | <div class="details-body-column-0" >
|
3762 | <div class="details-icon-small stencil-shimmer"></div>
|
3763 | <div class="details-icon-small stencil-shimmer"></div>
|
3764 | <div class="details-icon-small stencil-shimmer"></div>
|
3765 | <div class="details-icon-small stencil-shimmer"></div>
|
3766 | <div class="details-icon-small stencil-shimmer"></div>
|
3767 | <div class="details-icon-small stencil-shimmer"></div>
|
3768 | <div class="details-icon-small stencil-shimmer"></div>
|
3769 | </div>
|
3770 | <div class="details-body-column-1">
|
3771 | <div class="details-line stencil-shimmer"></div>
|
3772 | <div class="details-line stencil-shimmer"></div>
|
3773 | <div class="details-line stencil-shimmer"></div>
|
3774 | <div class="details-line stencil-shimmer"></div>
|
3775 | <div class="details-line stencil-shimmer"></div>
|
3776 | <div class="details-line stencil-shimmer"></div>
|
3777 | <div class="details-line stencil-shimmer"></div>
|
3778 | </div>
|
3779 | <div class="details-body-column-2">
|
3780 | <div class="details-box stencil-shimmer"></div>
|
3781 | <div class="details-box stencil-shimmer"></div>
|
3782 | <div class="details-box stencil-shimmer"></div>
|
3783 | <div class="details-box stencil-shimmer"></div>
|
3784 | <div class="details-box stencil-shimmer"></div>
|
3785 | </div>
|
3786 | </mat-card>
|
3787 |
|
3788 | </div>
|
3789 | `,
|
3790 | styles: [".details{position:relative;margin:0 auto 20px;background:#fff;box-shadow:0 3px 10px rgba(33,33,33,.3);overflow:hidden;font-size:16px}.details-header{display:-webkit-box;display:flex;height:180px}.details-column-0{display:-webkit-box;display:flex;width:66%}@media screen and (max-width:600px){.details-column-0{width:100%}}.details-column-0-1{display:-webkit-box;display:flex;width:25%;min-width:120px}@media screen and (max-width:600px){.details-column-0-1{width:50%}}.details-icon{height:120px;width:120px;border-radius:50%}.details-title{margin:20px 0 20px 20px;height:32px;width:250px}@media screen and (max-width:600px){.details-title{width:120px}}.details-column-1{width:34%;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}@media screen and (max-width:1100px){.details-column-1{width:0}}.details-column-1-0{height:32px;margin:10px 0}.details-column-1-1{height:70px}@media screen and (max-width:600px){.details-column-1-0{width:0;margin:0}.details-column-1-1{height:0}}.details-box-large{display:-webkit-box;display:flex;width:650px;height:150px}@media screen and (max-width:1100px){.details-box-large{width:100%}}.details-body{display:-webkit-box;display:flex;height:500px;width:100%}.details-body-column-0{width:10%;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}@media screen and (max-width:600px){.details-body-column-0{width:0%}}.details-body-column-1{width:56%;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}@media screen and (max-width:600px){.details-body-column-1{width:100%}}.details-icon-small{margin-bottom:24px;display:-webkit-box;display:flex;height:32px;width:32px;border-radius:50%}.details-line{margin-bottom:24px;height:32px;width:400px}@media screen and (max-width:600px){.details-line{width:100%;margin-right:10px}}.details-body-column-2{width:34%;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}@media screen and (max-width:1100px){.details-body-column-2{width:0}}.details-box{height:70px;margin-bottom:10px}@media screen and (max-width:600px){.details-box{width:0;margin:0}}"]
|
3791 | }] }
|
3792 | ];
|
3793 |
|
3794 |
|
3795 |
|
3796 |
|
3797 |
|
3798 | class CardStencilComponent {
|
3799 | }
|
3800 | CardStencilComponent.decorators = [
|
3801 | { type: Component, args: [{
|
3802 | selector: 'card-stencil',
|
3803 | template: `
|
3804 | <div class="card-stencil-container">
|
3805 | <mat-card class="card-stencil">
|
3806 | <div class="card-stencil-header stencil-shimmer"></div>
|
3807 | <div class="card-stencil-footer">
|
3808 | <div class="card-stencil-circle stencil-shimmer"></div>
|
3809 | <div>
|
3810 | <div class="card-stencil-line-large stencil-shimmer"></div>
|
3811 | <div class="card-stencil-line-medium stencil-shimmer"></div>
|
3812 | </div>
|
3813 | </div>
|
3814 | </mat-card>
|
3815 | </div>
|
3816 | `,
|
3817 | styles: [".card-stencil-container{position:relative;width:100%;padding-bottom:100%;margin-bottom:-45%}.card-stencil{position:absolute;width:100%;height:55%;padding:0;margin-bottom:0}.card-stencil-header{display:-webkit-box;display:flex;height:60%}.card-stencil-footer{display:-webkit-box;display:flex;height:40%;-webkit-box-align:center;align-items:center}.card-stencil-circle{margin:0 16px;height:60px;width:60px;border-radius:50%}@media screen and (max-width:650px){.card-stencil-circle{width:45px;height:45px}}.card-stencil-line-large{height:20px;width:200px;margin-bottom:10px}@media screen and (max-width:650px){.card-stencil-line-large{width:100px;height:10px}}.card-stencil-line-medium{height:20px;width:160px}@media screen and (max-width:650px){.card-stencil-line-medium{width:80px;height:10px}}"]
|
3818 | }] }
|
3819 | ];
|
3820 |
|
3821 |
|
3822 |
|
3823 |
|
3824 |
|
3825 | class CardListStencilComponent {
|
3826 | constructor() {
|
3827 | this.numCards = 3;
|
3828 | this.cards = [];
|
3829 | }
|
3830 | |
3831 |
|
3832 |
|
3833 | ngOnInit() {
|
3834 | for (let n = 0; n < this.numCards; n++) {
|
3835 | this.cards.push(n);
|
3836 | }
|
3837 | }
|
3838 | }
|
3839 | CardListStencilComponent.decorators = [
|
3840 | { type: Component, args: [{
|
3841 | selector: 'card-stencil-list',
|
3842 | template: `
|
3843 | <div class="row row-gutters">
|
3844 | <div *ngFor="let _ of cards" class="col-flex">
|
3845 | <card-stencil></card-stencil>
|
3846 | </div>
|
3847 | </div>
|
3848 | `,
|
3849 | styles: [`
|
3850 | .row {
|
3851 | display: flex;
|
3852 | flex-wrap: wrap;
|
3853 | }
|
3854 |
|
3855 | .row + .row-gutters {
|
3856 | margin-top: 0;
|
3857 | }
|
3858 |
|
3859 | .row-gutters {
|
3860 | margin-top: -20px;
|
3861 | margin-left: -20px;
|
3862 | }
|
3863 |
|
3864 | .row-gutters > .col-flex {
|
3865 | padding-top: 20px;
|
3866 | padding-left: 20px;
|
3867 | }
|
3868 |
|
3869 | .col-flex {
|
3870 | position: relative;
|
3871 | max-width: 100%;
|
3872 | box-sizing: border-box;
|
3873 | flex: 0 0 auto;
|
3874 | width: 100%;
|
3875 | }
|
3876 |
|
3877 | @media screen and (min-width: 480px) {
|
3878 | .col-flex {
|
3879 | width: 50%;
|
3880 | }
|
3881 | }
|
3882 |
|
3883 | @media screen and (min-width: 1200px) {
|
3884 |
|
3885 | .col-flex {
|
3886 | width: 33.333333%;
|
3887 | }
|
3888 | }
|
3889 |
|
3890 | `]
|
3891 | }] }
|
3892 | ];
|
3893 | CardListStencilComponent.propDecorators = {
|
3894 | numCards: [{ type: Input }]
|
3895 | };
|
3896 | if (false) {
|
3897 |
|
3898 | CardListStencilComponent.prototype.numCards;
|
3899 |
|
3900 | CardListStencilComponent.prototype.cards;
|
3901 | }
|
3902 |
|
3903 |
|
3904 |
|
3905 |
|
3906 |
|
3907 | class SearchBarStencilComponent {
|
3908 | }
|
3909 | SearchBarStencilComponent.decorators = [
|
3910 | { type: Component, args: [{
|
3911 | selector: 'search-bar-stencil',
|
3912 | template: `
|
3913 | <div class="search-bar-stencil-container">
|
3914 | <div class="search-bar-stencil-line stencil-shimmer">
|
3915 | <div class="search-bar-stencil-icon"></div>
|
3916 | </div>
|
3917 | </div>
|
3918 | `,
|
3919 | styles: [`
|
3920 | .search-bar-stencil-container {
|
3921 | height: 52px;
|
3922 | display: flex;
|
3923 | align-content: center;
|
3924 | background-color: white;
|
3925 | border-radius: 2px;
|
3926 | }
|
3927 | .search-bar-stencil-line {
|
3928 | height: 30px;
|
3929 | width: 350px;
|
3930 | margin: auto 10px;
|
3931 | display: flex;
|
3932 | justify-content: flex-end;
|
3933 | }
|
3934 | .search-bar-stencil-icon {
|
3935 | background-color: white;
|
3936 | width: 20px;
|
3937 | height: 20px;
|
3938 | margin: auto 5px;
|
3939 | }
|
3940 | `]
|
3941 | }] }
|
3942 | ];
|
3943 |
|
3944 |
|
3945 |
|
3946 |
|
3947 |
|
3948 | class ListStencilComponent {
|
3949 | constructor() {
|
3950 | this.showHeader = true;
|
3951 | this.numRows = 3;
|
3952 | this.rowHeight = '51px';
|
3953 |
|
3954 | this.sidePadding = '17px';
|
3955 |
|
3956 | this.rows = [];
|
3957 | }
|
3958 | |
3959 |
|
3960 |
|
3961 | ngOnInit() {
|
3962 | for (let n = 0; n < this.numRows; n++) {
|
3963 | this.rows.push(n);
|
3964 | }
|
3965 |
|
3966 |
|
3967 |
|
3968 | this.listItemRowStyles = {
|
3969 | 'height': `${this.rowHeight}`,
|
3970 | 'padding': `0 ${this.sidePadding}`
|
3971 | };
|
3972 | }
|
3973 | }
|
3974 | ListStencilComponent.decorators = [
|
3975 | { type: Component, args: [{
|
3976 | selector: 'list-stencil',
|
3977 | template: `
|
3978 | <mat-card class="list-container">
|
3979 | <div *ngIf="showHeader" class="list-header stencil-shimmer" style=""></div>
|
3980 | <div *ngFor="let _ of rows">
|
3981 | <div class="list-item-row" [ngStyle]="listItemRowStyles">
|
3982 | <div class="stencil-shimmer" style="margin: 0; padding: 0; width: 100%; height: 80%;"></div>
|
3983 | </div>
|
3984 | </div>
|
3985 | </mat-card>
|
3986 | `,
|
3987 | styles: [`
|
3988 | .list-container { padding: 0; }
|
3989 | .list-header { height: 40px; }
|
3990 | .list-item-row { height: 50px; display: flex; justify-content: space-between; align-items: center; }
|
3991 | `]
|
3992 | }] }
|
3993 | ];
|
3994 | ListStencilComponent.propDecorators = {
|
3995 | showHeader: [{ type: Input }],
|
3996 | numRows: [{ type: Input }],
|
3997 | rowHeight: [{ type: Input }],
|
3998 | sidePadding: [{ type: Input }]
|
3999 | };
|
4000 | if (false) {
|
4001 |
|
4002 | ListStencilComponent.prototype.showHeader;
|
4003 |
|
4004 | ListStencilComponent.prototype.numRows;
|
4005 |
|
4006 | ListStencilComponent.prototype.rowHeight;
|
4007 |
|
4008 | ListStencilComponent.prototype.sidePadding;
|
4009 |
|
4010 | ListStencilComponent.prototype.rows;
|
4011 |
|
4012 | ListStencilComponent.prototype.listItemRowStyles;
|
4013 | }
|
4014 |
|
4015 |
|
4016 |
|
4017 |
|
4018 |
|
4019 | class StencilsModule {
|
4020 | }
|
4021 | StencilsModule.decorators = [
|
4022 | { type: NgModule, args: [{
|
4023 | imports: [CommonModule, MatCardModule, MatIconModule, MatInputModule, MatSelectModule, MatExpansionModule, MatCheckboxModule],
|
4024 | declarations: [DetailsStencilComponent, CardStencilComponent, CardListStencilComponent, SearchBarStencilComponent, ListStencilComponent],
|
4025 | exports: [DetailsStencilComponent, CardStencilComponent, CardListStencilComponent, SearchBarStencilComponent, ListStencilComponent]
|
4026 | },] }
|
4027 | ];
|
4028 |
|
4029 |
|
4030 |
|
4031 |
|
4032 |
|
4033 | class VaAddonListComponent {
|
4034 | |
4035 |
|
4036 |
|
4037 |
|
4038 | constructor(billingService, cdr) {
|
4039 | this.billingService = billingService;
|
4040 | this.cdr = cdr;
|
4041 | this.showPricing = true;
|
4042 | this._hasVerifiedContract = null;
|
4043 | this._canAccessContractPricing = null;
|
4044 | this.addonSelected = new EventEmitter();
|
4045 | this.billedProductsMap = new Map();
|
4046 | this.billedProductLoaded = new Map();
|
4047 | this.subscriptions = [];
|
4048 | }
|
4049 | |
4050 |
|
4051 |
|
4052 |
|
4053 | set addons(addons) {
|
4054 | this._addons = addons;
|
4055 | this.populateBilledProduct();
|
4056 | }
|
4057 | |
4058 |
|
4059 |
|
4060 |
|
4061 | set hasVerifiedContract(value) {
|
4062 | this._hasVerifiedContract = value;
|
4063 | this.populateBilledProduct();
|
4064 | }
|
4065 | |
4066 |
|
4067 |
|
4068 |
|
4069 | set canAccessContractPricing(value) {
|
4070 | this._canAccessContractPricing = value;
|
4071 | this.populateBilledProduct();
|
4072 | }
|
4073 | |
4074 |
|
4075 |
|
4076 | ngOnInit() {
|
4077 | this.populateBilledProduct();
|
4078 | }
|
4079 | |
4080 |
|
4081 |
|
4082 | populateBilledProduct() {
|
4083 | if (this.displayContractPricing()) {
|
4084 |
|
4085 | const billingIDs = this._addons.map(( |
4086 |
|
4087 |
|
4088 |
|
4089 | a => {
|
4090 | this.billedProductsMap.set(a.addonId, null);
|
4091 | this.billedProductLoaded.set(a.addonId, false);
|
4092 | return a.billingId;
|
4093 | }));
|
4094 | this.subscriptions.push(this.billingService.getMultiProductPricing(this.partnerID, billingIDs).subscribe(( |
4095 |
|
4096 |
|
4097 |
|
4098 | pricing => {
|
4099 | this._addons.forEach(( |
4100 |
|
4101 |
|
4102 |
|
4103 | addon => {
|
4104 |
|
4105 | const addonPricing = pricing[addon.billingId];
|
4106 | if (!addonPricing) {
|
4107 | return;
|
4108 | }
|
4109 |
|
4110 | const billedProduct = buildBilledProductFromProductPricingAndAddon(addon, addonPricing);
|
4111 | this.billedProductsMap.set(addon.addonId, billedProduct);
|
4112 | this.billedProductLoaded.set(addon.addonId, true);
|
4113 | }));
|
4114 | this.cdr.detectChanges();
|
4115 | })));
|
4116 | }
|
4117 | }
|
4118 | |
4119 |
|
4120 |
|
4121 |
|
4122 | onClick(addonId) {
|
4123 | this.addonSelected.emit(addonId);
|
4124 | }
|
4125 | |
4126 |
|
4127 |
|
4128 |
|
4129 | instanceOfPricing(object) {
|
4130 | if (typeof object === 'number') {
|
4131 | return false;
|
4132 | }
|
4133 | return object.currency !== undefined && object.prices !== undefined;
|
4134 | }
|
4135 | |
4136 |
|
4137 |
|
4138 |
|
4139 | getDisplayPricing(addon) {
|
4140 |
|
4141 | const price = addon.price;
|
4142 | if (price && this.instanceOfPricing(price)) {
|
4143 | return price;
|
4144 | }
|
4145 | return {
|
4146 | currency: addon.currency,
|
4147 | prices: [
|
4148 | {
|
4149 | price: addon.price,
|
4150 | frequency: addon.billingFrequency ? addon.billingFrequency : 'Monthly'
|
4151 | }
|
4152 | ]
|
4153 | };
|
4154 | }
|
4155 | |
4156 |
|
4157 |
|
4158 | noData() {
|
4159 | return isNullOrUndefined(this._hasVerifiedContract) || isNullOrUndefined(this._canAccessContractPricing);
|
4160 | }
|
4161 | |
4162 |
|
4163 |
|
4164 | displayContractPricing() {
|
4165 | return this._canAccessContractPricing && this._hasVerifiedContract;
|
4166 | }
|
4167 | |
4168 |
|
4169 |
|
4170 |
|
4171 | isBilledProductLoaded(addon) {
|
4172 | if (this.noData()) {
|
4173 | return false;
|
4174 | }
|
4175 | if (this.displayContractPricing()) {
|
4176 |
|
4177 | const value = this.billedProductLoaded.get(addon.addonId);
|
4178 | return value ? value : false;
|
4179 | }
|
4180 | return true;
|
4181 | }
|
4182 | |
4183 |
|
4184 |
|
4185 | ngOnDestroy() {
|
4186 | this.subscriptions.forEach(( |
4187 |
|
4188 |
|
4189 |
|
4190 | subscription => subscription.unsubscribe()));
|
4191 | }
|
4192 | }
|
4193 | VaAddonListComponent.decorators = [
|
4194 | { type: Component, args: [{
|
4195 | selector: 'va-addon-list',
|
4196 | template: "<mat-list *ngIf=\"_addons\" class=\"addon-list\">\n <mat-divider></mat-divider>\n <ng-container *ngFor=\"let addon of _addons\">\n <mat-list-item (click)=\"onClick(addon.addonId)\">\n <div class=\"addon-icon-title\">\n <img *ngIf=\"addon.icon;else noIcon\" class=\"addon-icon\" [src]=\"addon.icon\" mat-list-avatar/>\n <ng-template #noIcon>\n <mat-icon class=\"addon-default-icon\" mat-list-icon>add_circle</mat-icon>\n </ng-template>\n <div class=\"addon-title-tagline\">\n <p class=\"addon-title\" matLine>{{ addon.title }} </p>\n <p class=\"addon-tagline\" matLine>{{ addon.tagline }}</p>\n </div>\n </div>\n <div *ngIf=\"showPricing\" class=\"price-section\">\n <va-pricing\n [pricing]=\"getDisplayPricing(addon)\"\n [highlightPrice]=\"false\"\n [hasVerifiedContract]=\"_hasVerifiedContract\"\n [billedProduct]=\"billedProductsMap.get(addon.addonId)\"\n [loaded]=\"isBilledProductLoaded(addon)\">\n </va-pricing>\n </div>\n </mat-list-item>\n <mat-divider></mat-divider>\n </ng-container>\n</mat-list>\n",
|
4197 | styles: [":host{display:block}h2+:host{margin:-8px 0}:host ::ng-deep .mat-list-item.mat-2-line{height:auto!important}:host ::ng-deep .mat-list .mat-list-item .mat-list-item-content{padding:8px;-webkit-box-align:start;align-items:flex-start;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}@media screen and (min-width:800px){:host ::ng-deep .mat-list .mat-list-item .mat-list-item-content{-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row}}.addon-list{position:relative}.addon-default-icon{margin:0 5px;color:#4caf50}.addon-icon{width:32px;height:32px}.addon-icon-title{-webkit-box-flex:1;flex-grow:1;display:-webkit-box;display:flex;width:100%}@media screen and (min-width:800px){.addon-icon-title{width:auto}}.addon-title-tagline{padding:0 16px 10px 8px;-webkit-box-flex:1;flex-grow:1}.addon-title-tagline .addon-title{color:#212121;font-size:16px;line-height:1.2;margin:6px 0;white-space:normal}.addon-title-tagline .addon-tagline{color:#616161;font-size:14px;margin:0;white-space:normal}.price-section{min-width:10em;margin-top:6px;flex-shrink:0}mat-list-item:hover{background-color:#fafafa!important;cursor:pointer!important}"]
|
4198 | }] }
|
4199 | ];
|
4200 |
|
4201 | VaAddonListComponent.ctorParameters = () => [
|
4202 | { type: BillingService },
|
4203 | { type: ChangeDetectorRef }
|
4204 | ];
|
4205 | VaAddonListComponent.propDecorators = {
|
4206 | addons: [{ type: Input, args: ['addons',] }],
|
4207 | showPricing: [{ type: Input }],
|
4208 | partnerID: [{ type: Input }],
|
4209 | hasVerifiedContract: [{ type: Input, args: ['hasVerifiedContract',] }],
|
4210 | canAccessContractPricing: [{ type: Input, args: ['canAccessContractPricing',] }],
|
4211 | addonSelected: [{ type: Output }]
|
4212 | };
|
4213 | if (false) {
|
4214 |
|
4215 | VaAddonListComponent.prototype._addons;
|
4216 |
|
4217 | VaAddonListComponent.prototype.showPricing;
|
4218 |
|
4219 | VaAddonListComponent.prototype.partnerID;
|
4220 |
|
4221 | VaAddonListComponent.prototype._hasVerifiedContract;
|
4222 |
|
4223 | VaAddonListComponent.prototype._canAccessContractPricing;
|
4224 |
|
4225 | VaAddonListComponent.prototype.addonSelected;
|
4226 |
|
4227 | VaAddonListComponent.prototype.billedProductsMap;
|
4228 | |
4229 |
|
4230 |
|
4231 |
|
4232 | VaAddonListComponent.prototype.billedProductLoaded;
|
4233 | |
4234 |
|
4235 |
|
4236 |
|
4237 | VaAddonListComponent.prototype.subscriptions;
|
4238 | |
4239 |
|
4240 |
|
4241 |
|
4242 | VaAddonListComponent.prototype.billingService;
|
4243 | |
4244 |
|
4245 |
|
4246 |
|
4247 | VaAddonListComponent.prototype.cdr;
|
4248 | }
|
4249 |
|
4250 |
|
4251 |
|
4252 |
|
4253 |
|
4254 | class VaAddonListModule {
|
4255 | }
|
4256 | VaAddonListModule.decorators = [
|
4257 | { type: NgModule, args: [{
|
4258 | imports: [
|
4259 | BillingModule,
|
4260 | CommonModule,
|
4261 | MatIconModule,
|
4262 | MatListModule$1,
|
4263 | MatDividerModule,
|
4264 | VaPricingModule
|
4265 | ],
|
4266 | declarations: [VaAddonListComponent],
|
4267 | exports: [VaAddonListComponent]
|
4268 | },] }
|
4269 | ];
|
4270 |
|
4271 |
|
4272 |
|
4273 |
|
4274 |
|
4275 |
|
4276 |
|
4277 |
|
4278 | function HeimdallServiceTokenInterface() { }
|
4279 | if (false) {
|
4280 | |
4281 |
|
4282 |
|
4283 |
|
4284 |
|
4285 |
|
4286 |
|
4287 |
|
4288 | HeimdallServiceTokenInterface.prototype.track = function (category, action, label, value, dimensions) { };
|
4289 | }
|
4290 |
|
4291 | const HeimdallServiceToken = new InjectionToken('HeimdallService');
|
4292 | class HeimdallClient {
|
4293 | |
4294 |
|
4295 |
|
4296 | constructor(userEvents) {
|
4297 | this.userEvents = userEvents;
|
4298 | }
|
4299 | |
4300 |
|
4301 |
|
4302 |
|
4303 |
|
4304 |
|
4305 |
|
4306 |
|
4307 | track(category, action, label, value, dimensions) {
|
4308 | this.userEvents.track(category, action, label, value, dimensions);
|
4309 | }
|
4310 | }
|
4311 | HeimdallClient.decorators = [
|
4312 | { type: Injectable }
|
4313 | ];
|
4314 |
|
4315 | HeimdallClient.ctorParameters = () => [
|
4316 | { type: undefined, decorators: [{ type: Inject, args: [HeimdallServiceToken,] }] }
|
4317 | ];
|
4318 | if (false) {
|
4319 | |
4320 |
|
4321 |
|
4322 |
|
4323 | HeimdallClient.prototype.userEvents;
|
4324 | }
|
4325 | class HeimdallClientModule {
|
4326 | }
|
4327 | HeimdallClientModule.decorators = [
|
4328 | { type: NgModule, args: [{
|
4329 | providers: [HeimdallClient]
|
4330 | },] }
|
4331 | ];
|
4332 |
|
4333 |
|
4334 |
|
4335 |
|
4336 |
|
4337 |
|
4338 | const STOREFRONT_FILTER_NAME = 'Store Filters';
|
4339 |
|
4340 |
|
4341 |
|
4342 | function StorefrontCategory() { }
|
4343 | if (false) {
|
4344 |
|
4345 | StorefrontCategory.prototype.id;
|
4346 |
|
4347 | StorefrontCategory.prototype.name;
|
4348 |
|
4349 | StorefrontCategory.prototype.packageIds;
|
4350 | }
|
4351 | class StorefrontComponent {
|
4352 | |
4353 |
|
4354 |
|
4355 |
|
4356 |
|
4357 | constructor(userEvents, filterService, translateService) {
|
4358 | this.userEvents = userEvents;
|
4359 | this.filterService = filterService;
|
4360 | this.translateService = translateService;
|
4361 | this.useCustomCase = false;
|
4362 | this.categorySelected = new EventEmitter();
|
4363 | this.packageIdSelected = new EventEmitter();
|
4364 | this.getDataForCategory = new EventEmitter();
|
4365 | this.categories$$ = new BehaviorSubject([]);
|
4366 | this.packagesMap$$ = new BehaviorSubject(new Map());
|
4367 | this.searchTerm$$ = new BehaviorSubject('');
|
4368 | this.selectedCateoryId$$ = new BehaviorSubject('');
|
4369 | this.translateService.setTranslation('en', En.en, true);
|
4370 | }
|
4371 | |
4372 |
|
4373 |
|
4374 |
|
4375 | set categories(value) {
|
4376 | this.categories$$.next(value || []);
|
4377 | }
|
4378 | |
4379 |
|
4380 |
|
4381 |
|
4382 | set categoryIdToStoreItemListMap(value) {
|
4383 | this.packagesMap$$.next(value || new Map());
|
4384 | }
|
4385 | |
4386 |
|
4387 |
|
4388 | ngOnInit() {
|
4389 |
|
4390 | const lmiCategoryCheckboxList = LMI_CATEGORIES.map(( |
4391 |
|
4392 |
|
4393 |
|
4394 | (category) => {
|
4395 | return new CheckboxFilterField({
|
4396 | name: category.name,
|
4397 | id: category.categoryId,
|
4398 | value: false,
|
4399 | condition: ( |
4400 |
|
4401 |
|
4402 |
|
4403 | (item) => {
|
4404 |
|
4405 | let lmiCategories = [];
|
4406 | if (item.lmiCategories) {
|
4407 | lmiCategories = item.lmiCategories.map(( |
4408 |
|
4409 |
|
4410 |
|
4411 | (cat) => {
|
4412 | return Categories[cat].toLowerCase();
|
4413 | }));
|
4414 | }
|
4415 | return lmiCategories.indexOf(category.categoryId) > -1;
|
4416 | })
|
4417 | });
|
4418 | }));
|
4419 |
|
4420 | const lmiCategoryFilterSection = new FilterSection({
|
4421 | title: 'LMI Category',
|
4422 | type: 'or',
|
4423 | fields: lmiCategoryCheckboxList
|
4424 | });
|
4425 | this.lmiCategoryFilter = new Filters(STOREFRONT_FILTER_NAME, [
|
4426 | lmiCategoryFilterSection
|
4427 | ]);
|
4428 | this.filters$ = this.categories$$.pipe(map(( |
4429 |
|
4430 |
|
4431 |
|
4432 | categories => {
|
4433 |
|
4434 | const tabbedFilterField = new TabbedFilterField({
|
4435 | name: '',
|
4436 | value: null,
|
4437 | id: 'categorytab',
|
4438 | options: categories
|
4439 | });
|
4440 |
|
4441 | const filters = new Filters(STOREFRONT_FILTER_NAME, [
|
4442 | new FilterSection({
|
4443 | title: 'Categories',
|
4444 | type: 'or',
|
4445 | fields: [tabbedFilterField]
|
4446 | }),
|
4447 | lmiCategoryFilterSection
|
4448 | ]);
|
4449 | return filters;
|
4450 | })));
|
4451 | this.filterService.setFilters(this.lmiCategoryFilter);
|
4452 | this.searchTermSubscription = this.searchTerm$$.asObservable().pipe(debounceTime(300), distinctUntilChanged()).subscribe(( |
4453 |
|
4454 |
|
4455 |
|
4456 | searchTerm => this.userEvents.track('store', 'search-input', '', 1, { 'searchTerm': searchTerm })));
|
4457 |
|
4458 | const selectedLMIFilters$ = this.filterService.filters.fieldValuesObservable.pipe(startWith([]), map(( |
4459 |
|
4460 |
|
4461 | () => {
|
4462 | return this.lmiCategoryFilter.fields.filter(( |
4463 |
|
4464 |
|
4465 |
|
4466 | (item) => item.value));
|
4467 | })));
|
4468 | this.showLMIFilter$ = selectedLMIFilters$.pipe(filter(( |
4469 |
|
4470 |
|
4471 |
|
4472 | selectedLMIFilters => !!selectedLMIFilters)), take(1), map(( |
4473 |
|
4474 |
|
4475 |
|
4476 | selectedLMIFilters => selectedLMIFilters.length > 0)));
|
4477 | this.filteredItems$ = combineLatest(this.packagesMap$$, this.searchTerm$$, this.selectedCateoryId$$, selectedLMIFilters$).pipe(map(( |
4478 |
|
4479 |
|
4480 |
|
4481 | ([packages, searchTerm, selectedCategoryId, selectedLMIFilters]) => {
|
4482 |
|
4483 | let storeItems = [];
|
4484 | if (packages.size) {
|
4485 | storeItems = (selectedCategoryId ? packages.get(selectedCategoryId) : packages.get(Array.from(packages.keys())[0]));
|
4486 | }
|
4487 | storeItems = storeItems ? this.lmiCategoryFilter.applyFilters(storeItems) : [];
|
4488 | return searchTerm ? storeItems.filter(( |
4489 |
|
4490 |
|
4491 |
|
4492 | item => item.name.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1)) : storeItems;
|
4493 | })));
|
4494 | }
|
4495 | |
4496 |
|
4497 |
|
4498 | ngOnDestroy() {
|
4499 | this.searchTermSubscription.unsubscribe();
|
4500 | }
|
4501 | |
4502 |
|
4503 |
|
4504 |
|
4505 | onSearchTermChanged(term) {
|
4506 | this.searchTerm$$.next(term);
|
4507 | }
|
4508 | |
4509 |
|
4510 |
|
4511 |
|
4512 | onFieldValueChanged(filterField) {
|
4513 | if (!(filterField instanceof TabbedFilterField)) {
|
4514 | return;
|
4515 | }
|
4516 | this.selectedCateoryId$$.next(filterField.value.id);
|
4517 | this.categorySelected.emit(( (filterField.value)));
|
4518 |
|
4519 | const currentStoreItemsForSelectCategory = this.packagesMap$$.getValue().get(filterField.value.id);
|
4520 | if (!(currentStoreItemsForSelectCategory && currentStoreItemsForSelectCategory.length)) {
|
4521 | this.getDataForCategory.emit(( (filterField.value)));
|
4522 | }
|
4523 | }
|
4524 | |
4525 |
|
4526 |
|
4527 |
|
4528 | storeItemClicked(item) {
|
4529 | this.packageIdSelected.emit(item.id);
|
4530 | }
|
4531 | }
|
4532 | StorefrontComponent.decorators = [
|
4533 | { type: Component, args: [{
|
4534 | selector: 'va-storefront',
|
4535 | template: "<va-filter-container\n [filters]=\"filters$ | async\"\n (searchTermChanged)=\"onSearchTermChanged($event)\"\n (fieldValueChanged)=\"onFieldValueChanged($event)\"\n [theme]=\"'plain'\"\n [filterIsOpen]=\"showLMIFilter$ | async\"\n [useCustomCase]=\"useCustomCase\"\n >\n <va-store\n [items]=\"filteredItems$ | async\"\n [searchable]=\"false\"\n (itemClicked)=\"storeItemClicked($event)\"\n content>\n </va-store>\n</va-filter-container>\n",
|
4536 | styles: [".public-store-container{padding:20px}va-store{margin-top:20px;display:block}@media only screen and (device-width:375px) and (-webkit-device-pixel-ratio:2){::ng-deep va-filter-tabbed{width:280px}::ng-deep .filter-container .toolbar.toolbar{background:0 0}}@media only screen and (device-width:414px) and (-webkit-device-pixel-ratio:3){::ng-deep va-filter-tabbed{width:280px}::ng-deep .filter-container .toolbar.toolbar{background:0 0}}"]
|
4537 | }] }
|
4538 | ];
|
4539 |
|
4540 | StorefrontComponent.ctorParameters = () => [
|
4541 | { type: undefined, decorators: [{ type: Inject, args: [HeimdallServiceToken,] }] },
|
4542 | { type: FilterService },
|
4543 | { type: TranslateService }
|
4544 | ];
|
4545 | StorefrontComponent.propDecorators = {
|
4546 | categories: [{ type: Input }],
|
4547 | categoryIdToStoreItemListMap: [{ type: Input }],
|
4548 | useCustomCase: [{ type: Input }],
|
4549 | categorySelected: [{ type: Output }],
|
4550 | packageIdSelected: [{ type: Output }],
|
4551 | getDataForCategory: [{ type: Output }]
|
4552 | };
|
4553 | if (false) {
|
4554 |
|
4555 | StorefrontComponent.prototype.useCustomCase;
|
4556 |
|
4557 | StorefrontComponent.prototype.categorySelected;
|
4558 |
|
4559 | StorefrontComponent.prototype.packageIdSelected;
|
4560 |
|
4561 | StorefrontComponent.prototype.getDataForCategory;
|
4562 | |
4563 |
|
4564 |
|
4565 |
|
4566 | StorefrontComponent.prototype.categories$$;
|
4567 | |
4568 |
|
4569 |
|
4570 |
|
4571 | StorefrontComponent.prototype.packagesMap$$;
|
4572 | |
4573 |
|
4574 |
|
4575 |
|
4576 | StorefrontComponent.prototype.searchTerm$$;
|
4577 | |
4578 |
|
4579 |
|
4580 |
|
4581 | StorefrontComponent.prototype.selectedCateoryId$$;
|
4582 | |
4583 |
|
4584 |
|
4585 |
|
4586 | StorefrontComponent.prototype.lmiCategoryFilter;
|
4587 |
|
4588 | StorefrontComponent.prototype.filters$;
|
4589 |
|
4590 | StorefrontComponent.prototype.filteredItems$;
|
4591 |
|
4592 | StorefrontComponent.prototype.searchTermSubscription;
|
4593 |
|
4594 | StorefrontComponent.prototype.showLMIFilter$;
|
4595 | |
4596 |
|
4597 |
|
4598 |
|
4599 | StorefrontComponent.prototype.userEvents;
|
4600 | |
4601 |
|
4602 |
|
4603 |
|
4604 | StorefrontComponent.prototype.filterService;
|
4605 | |
4606 |
|
4607 |
|
4608 |
|
4609 | StorefrontComponent.prototype.translateService;
|
4610 | }
|
4611 |
|
4612 |
|
4613 |
|
4614 |
|
4615 |
|
4616 | class StoreModule {
|
4617 | }
|
4618 | StoreModule.decorators = [
|
4619 | { type: NgModule, args: [{
|
4620 | imports: [CommonModule, UIKitModule, MatCardModule, MatIconModule, MatInputModule, FormsModule, ReactiveFormsModule,
|
4621 | MatSelectModule, MatExpansionModule, MatCheckboxModule, StoreCardModule, VaOrderFormModule, AddonModule, StencilsModule,
|
4622 | VaPricingModule, VaAddonListModule, HeimdallClientModule],
|
4623 | declarations: [StoreComponent, StorefrontComponent],
|
4624 | providers: [StoreService, FilterService],
|
4625 | exports: [StoreComponent, StoreCardModule, VaOrderFormModule, StencilsModule, StorefrontComponent]
|
4626 | },] }
|
4627 | ];
|
4628 |
|
4629 |
|
4630 |
|
4631 |
|
4632 |
|
4633 |
|
4634 |
|
4635 |
|
4636 | function LmiCategory() { }
|
4637 | if (false) {
|
4638 |
|
4639 | LmiCategory.prototype.name;
|
4640 |
|
4641 | LmiCategory.prototype.categoryId;
|
4642 | }
|
4643 |
|
4644 | const LMI_CATEGORIES = [
|
4645 | { name: 'Listings', categoryId: 'listings' },
|
4646 | { name: 'Social', categoryId: 'social' },
|
4647 | { name: 'Reputation', categoryId: 'reputation' },
|
4648 | { name: 'SEO', categoryId: 'seo' },
|
4649 | { name: 'Website', categoryId: 'website' },
|
4650 | { name: 'Advertising', categoryId: 'advertising' },
|
4651 | { name: 'Content & Experience', categoryId: 'content_and_experience' }
|
4652 | ];
|
4653 |
|
4654 | const LMI_CATEGORY_MAP = LMI_CATEGORIES.reduce(( |
4655 |
|
4656 |
|
4657 |
|
4658 |
|
4659 | (previous, current) => {
|
4660 | previous[current.categoryId] = current;
|
4661 | return previous;
|
4662 | }), {});
|
4663 |
|
4664 | const LMI_CATEGORIES_BY_NAME = LMI_CATEGORIES.reduce(( |
4665 |
|
4666 |
|
4667 |
|
4668 |
|
4669 | (previous, current) => {
|
4670 | previous[current.name] = current;
|
4671 | return previous;
|
4672 | }), {});
|
4673 |
|
4674 |
|
4675 |
|
4676 |
|
4677 |
|
4678 | class VaSalespersonDetailsComponent {
|
4679 | constructor() {
|
4680 | this.showGetItNow = true;
|
4681 | this.getItNow = new EventEmitter();
|
4682 | }
|
4683 | |
4684 |
|
4685 |
|
4686 | onGetItNowSelected() {
|
4687 | this.getItNow.emit(this.salesperson);
|
4688 | }
|
4689 | |
4690 |
|
4691 |
|
4692 | get iconUrl() {
|
4693 | return this.salesperson && this.salesperson.photoUrlSecure ?
|
4694 | this.salesperson.photoUrlSecure :
|
4695 | 'https://vbc-frontend.storage-download.googleapis.com/salesperson-details/default_sales_person.jpg';
|
4696 | }
|
4697 | |
4698 |
|
4699 |
|
4700 | get name() {
|
4701 | return this.salesperson && this.salesperson.formattedName ?
|
4702 | this.salesperson.formattedName : '';
|
4703 | }
|
4704 | |
4705 |
|
4706 |
|
4707 | get title() {
|
4708 | return this.salesperson && this.salesperson.jobTitle ?
|
4709 | this.salesperson.jobTitle : '';
|
4710 | }
|
4711 | |
4712 |
|
4713 |
|
4714 | get email() {
|
4715 | return this.salesperson && this.salesperson.email ?
|
4716 | this.salesperson.email : '';
|
4717 | }
|
4718 | |
4719 |
|
4720 |
|
4721 | get cityAndState() {
|
4722 | return this.salesperson && this.salesperson.city && this.salesperson.state ?
|
4723 | this.salesperson.city + ', ' + this.salesperson.state : '';
|
4724 | }
|
4725 | }
|
4726 | VaSalespersonDetailsComponent.decorators = [
|
4727 | { type: Component, args: [{
|
4728 | selector: 'va-salesperson-details',
|
4729 | template: "<div class=\"container\">\n <div class=\"salesperson-contact-info\">\n\n <div class=\"salesperson-image\" *ngIf=\"salesperson\">\n <va-icon [iconUrl]=\"iconUrl\" [diameter]=\"60\"></va-icon>\n </div>\n\n <div>\n <div class=\"salesperson-name\">{{ name }}</div>\n <div>{{ title }}</div>\n <div>{{ cityAndState }}</div>\n <div><a href=\"mailto:{{ email }}\">{{ email }}</a></div>\n </div>\n\n <div *ngIf=\"!salesperson\" class=\"generic-contact\">\n Contact {{ brandName ? \"your \" + brandName : \"a\" }} representative today!\n </div>\n\n <div class=\"pricing\">\n <va-pricing [pricing]=\"packagePricing\" wrapFrequency=\"true\"></va-pricing>\n <div class=\"cta get-it-now-bottom-button\">\n <button mat-button *ngIf=\"salesperson && showGetItNow\" (click)=\"onGetItNowSelected()\" class=\"now-button\">\n Get it Now\n </button>\n </div>\n </div>\n </div>\n</div>\n",
|
4730 | styles: ["a{color:#1e88e5;text-decoration:none}.container{width:100%;margin:0 auto;background-color:#fff;box-shadow:1px 1px 1px 0 rgba(0,0,0,.2)}.salesperson-image{margin-right:20px}.salesperson-contact-info{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;padding:24px;font-size:14px;color:#9e9e9e}@media screen and (max-width:600px){.salesperson-contact-info{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;display:inline-block}}.salesperson-name{font-size:20px;font-weight:700;color:#212121}.generic-contact{margin-left:20px}.pricing{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-flex:1;flex-grow:1;-webkit-box-pack:end;justify-content:flex-end}.pricing ::ng-deep .price-box{-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row}.pricing ::ng-deep .price-number{margin-right:4px}@media screen and (min-width:600px){.pricing{padding-left:16px}}.pricing va-pricing{margin-right:20px}.now-button{font-size:14px;color:#fff;background-color:#4caf50}"]
|
4731 | }] }
|
4732 | ];
|
4733 | VaSalespersonDetailsComponent.propDecorators = {
|
4734 | salesperson: [{ type: Input }],
|
4735 | packagePricing: [{ type: Input }],
|
4736 | brandName: [{ type: Input }],
|
4737 | showGetItNow: [{ type: Input }],
|
4738 | getItNow: [{ type: Output }]
|
4739 | };
|
4740 | if (false) {
|
4741 |
|
4742 | VaSalespersonDetailsComponent.prototype.salesperson;
|
4743 |
|
4744 | VaSalespersonDetailsComponent.prototype.packagePricing;
|
4745 |
|
4746 | VaSalespersonDetailsComponent.prototype.brandName;
|
4747 |
|
4748 | VaSalespersonDetailsComponent.prototype.showGetItNow;
|
4749 |
|
4750 | VaSalespersonDetailsComponent.prototype.getItNow;
|
4751 | }
|
4752 |
|
4753 |
|
4754 |
|
4755 |
|
4756 |
|
4757 | class VaSalespersonDetailsModule {
|
4758 | }
|
4759 | VaSalespersonDetailsModule.decorators = [
|
4760 | { type: NgModule, args: [{
|
4761 | imports: [
|
4762 | CommonModule,
|
4763 | MatButtonModule,
|
4764 | MatIconModule,
|
4765 | VaIconModule,
|
4766 | VaPricingModule,
|
4767 | ],
|
4768 | declarations: [
|
4769 | VaSalespersonDetailsComponent
|
4770 | ],
|
4771 | exports: [
|
4772 | VaSalespersonDetailsComponent
|
4773 | ],
|
4774 | entryComponents: [
|
4775 | VaSalespersonDetailsComponent
|
4776 | ]
|
4777 | },] }
|
4778 | ];
|
4779 |
|
4780 |
|
4781 |
|
4782 |
|
4783 |
|
4784 | class Package extends Sellable {
|
4785 |
|
4786 | |
4787 |
|
4788 |
|
4789 |
|
4790 | static fromApi(data) {
|
4791 |
|
4792 | const newPackage = new Package();
|
4793 | if (!data.pricing && data.selling_price) {
|
4794 | data.pricing = {
|
4795 | currency: data.currency,
|
4796 | prices: [{
|
4797 | price: data.selling_price * 100,
|
4798 | frequency: data.billingFrequency,
|
4799 | isStartingPrice: false,
|
4800 | }]
|
4801 | };
|
4802 | }
|
4803 | Object.assign(newPackage, data);
|
4804 | if (!newPackage.name) {
|
4805 | newPackage.name = 'Untitled';
|
4806 | }
|
4807 | if (data.created) {
|
4808 | newPackage.createdDate = new Date(data.created);
|
4809 | }
|
4810 | if (data.updated) {
|
4811 | newPackage.updatedDate = new Date(data.updated);
|
4812 | }
|
4813 | return newPackage;
|
4814 | }
|
4815 | |
4816 |
|
4817 |
|
4818 | get isPackageFree() {
|
4819 | return this.isFree;
|
4820 | }
|
4821 | }
|
4822 | if (false) {
|
4823 |
|
4824 | Package.prototype.solution_id;
|
4825 |
|
4826 | Package.prototype.partner_id;
|
4827 |
|
4828 | Package.prototype.market_id;
|
4829 |
|
4830 | Package.prototype.name;
|
4831 |
|
4832 | Package.prototype.icon;
|
4833 |
|
4834 | Package.prototype.status;
|
4835 |
|
4836 | Package.prototype.tagline;
|
4837 |
|
4838 | Package.prototype.header_image_url;
|
4839 |
|
4840 | Package.prototype.content;
|
4841 |
|
4842 | Package.prototype.products;
|
4843 |
|
4844 | Package.prototype.addon_keys;
|
4845 |
|
4846 | Package.prototype.hide_product_icons_and_names;
|
4847 |
|
4848 | Package.prototype.hide_product_details;
|
4849 |
|
4850 | Package.prototype.createdDate;
|
4851 |
|
4852 | Package.prototype.updatedDate;
|
4853 |
|
4854 | Package.prototype.productOrder;
|
4855 | }
|
4856 |
|
4857 |
|
4858 |
|
4859 |
|
4860 |
|
4861 |
|
4862 |
|
4863 |
|
4864 |
|
4865 |
|
4866 | function orderProductsAndAddons(combined, order) {
|
4867 | if (!order || order.length === 0) {
|
4868 | return combined || [];
|
4869 | }
|
4870 | if (!combined || combined.length === 0) {
|
4871 | return [];
|
4872 | }
|
4873 |
|
4874 | const itemMap = (combined || []).reduce(( |
4875 |
|
4876 |
|
4877 |
|
4878 |
|
4879 | (m, curr) => {
|
4880 | m.set(getUniqueProductAddonId(curr), curr);
|
4881 | return m;
|
4882 | }), new Map());
|
4883 |
|
4884 | const combinedIdList = combined.map(getUniqueProductAddonId);
|
4885 |
|
4886 | const finalOrderedIds = combineProductOrderWithContainedProducts(order, combinedIdList);
|
4887 |
|
4888 | const orderedList = ( (finalOrderedIds.reduce(( |
4889 |
|
4890 |
|
4891 |
|
4892 |
|
4893 | (items, id) => {
|
4894 | items.push(itemMap.get(id));
|
4895 | return items;
|
4896 | }), [])));
|
4897 | return orderedList.filter(filterUniqueAndDefined);
|
4898 | }
|
4899 |
|
4900 |
|
4901 |
|
4902 |
|
4903 |
|
4904 |
|
4905 | function filterUniqueAndDefined(elem, pos, arr) {
|
4906 | return elem && arr.indexOf(elem) === pos;
|
4907 | }
|
4908 |
|
4909 |
|
4910 |
|
4911 |
|
4912 |
|
4913 | function combineProductOrderWithContainedProducts(productOrder, itemIds) {
|
4914 | if (itemIds == null || itemIds.length === 0) {
|
4915 | return [];
|
4916 | }
|
4917 | if (!productOrder || productOrder.length === 0) {
|
4918 | return itemIds.filter(filterUniqueAndDefined);
|
4919 | }
|
4920 | return productOrder
|
4921 | .filter(( |
4922 |
|
4923 |
|
4924 |
|
4925 | elem => itemIds.indexOf(elem) >= 0))
|
4926 | .concat(itemIds)
|
4927 | .filter(filterUniqueAndDefined);
|
4928 | }
|
4929 |
|
4930 |
|
4931 |
|
4932 |
|
4933 | function getUniqueProductAddonId(thing) {
|
4934 | return thing['addonId'] || thing['productId'];
|
4935 | }
|
4936 |
|
4937 |
|
4938 |
|
4939 |
|
4940 |
|
4941 | class VaPackageDetailsComponent {
|
4942 | constructor() {
|
4943 | this.showActionButton = true;
|
4944 | this.showPricing = true;
|
4945 | this.actionLabel = 'Get It Now';
|
4946 | this.getItNow = new EventEmitter();
|
4947 | this.standAloneProducts$$ = new BehaviorSubject([]);
|
4948 | this.products$ = new BehaviorSubject([]);
|
4949 | this.addons$ = new BehaviorSubject([]);
|
4950 | this.pkg$ = new ReplaySubject(1);
|
4951 | this.itemSelectedEvent$ = new ReplaySubject(1);
|
4952 | this.combinedItemsList$ = combineLatest(this.products$, this.addons$, ( |
4953 |
|
4954 |
|
4955 |
|
4956 |
|
4957 | (products, addons) => {
|
4958 | return ( ([].concat(products || []).concat(addons || [])));
|
4959 | }));
|
4960 | this.orderedItemsList$ = combineLatest(this.combinedItemsList$, this.pkg$, ( |
4961 |
|
4962 |
|
4963 |
|
4964 |
|
4965 | (combined, pkg) => {
|
4966 | return orderProductsAndAddons(combined, pkg ? pkg.productOrder || [] : []);
|
4967 | }));
|
4968 |
|
4969 | const nonEmptyCombinedItemsList = this.combinedItemsList$.pipe(skipWhile(( |
4970 |
|
4971 |
|
4972 |
|
4973 | items => !items || items.length === 0)), shareReplay(1));
|
4974 |
|
4975 |
|
4976 | const initialSelectedItem$ = nonEmptyCombinedItemsList.pipe(map(( |
4977 |
|
4978 |
|
4979 |
|
4980 | (_) => 0)), take(1));
|
4981 |
|
4982 | const mergedSelection = merge(initialSelectedItem$, this.itemSelectedEvent$);
|
4983 | this.selectedItem$ = combineLatest(mergedSelection, this.orderedItemsList$).pipe(map(( |
4984 |
|
4985 |
|
4986 |
|
4987 | ([index, items]) => {
|
4988 | return items[index];
|
4989 | })));
|
4990 | this.lmiCategories$ = this.products$.pipe(skipWhile(( |
4991 |
|
4992 |
|
4993 |
|
4994 | products => !products || products.length === 0)), map(( |
4995 |
|
4996 |
|
4997 |
|
4998 | products => {
|
4999 | return VaPackageDetailsComponent.getLmiCategories(products);
|
5000 | })));
|
5001 | this.productNameForSingleAddon$ = nonEmptyCombinedItemsList.pipe(map(( |
5002 |
|
5003 |
|
5004 |
|
5005 | items => {
|
5006 | return VaPackageDetailsComponent.getProductNameForSingleAddon(items);
|
5007 | })));
|
5008 | this.displayTagName$ = combineLatest(this.pkg$, this.combinedItemsList$).pipe(map(( |
5009 |
|
5010 |
|
5011 |
|
5012 | ([pkg, items]) => {
|
5013 | return VaPackageDetailsComponent.getDisplayTagline(pkg, items);
|
5014 | })));
|
5015 | }
|
5016 | |
5017 |
|
5018 |
|
5019 |
|
5020 | set standAloneProducts(standAloneProducts) {
|
5021 | this.standAloneProducts$$.next(standAloneProducts);
|
5022 | }
|
5023 | |
5024 |
|
5025 |
|
5026 |
|
5027 | set products(products) {
|
5028 | this.products$.next(products);
|
5029 | }
|
5030 | |
5031 |
|
5032 |
|
5033 |
|
5034 | set addons(addons) {
|
5035 | this.addons$.next(addons);
|
5036 | }
|
5037 | |
5038 |
|
5039 |
|
5040 |
|
5041 | set pkg(pkg) {
|
5042 | this.pkg$.next(pkg);
|
5043 | }
|
5044 | |
5045 |
|
5046 |
|
5047 |
|
5048 | static getLmiCategories(products) {
|
5049 |
|
5050 | let lmiCategories = [];
|
5051 | if (products) {
|
5052 | products.forEach(( |
5053 |
|
5054 |
|
5055 |
|
5056 | product => {
|
5057 | lmiCategories = lmiCategories.concat(product.getLmiCategoryNames());
|
5058 | }));
|
5059 | }
|
5060 | return new Set(lmiCategories);
|
5061 | }
|
5062 | |
5063 |
|
5064 |
|
5065 |
|
5066 |
|
5067 | static getDisplayTagline(pkg, items) {
|
5068 | if (pkg && pkg.tagline) {
|
5069 | return pkg.tagline;
|
5070 | }
|
5071 | else if (items && items.length === 1) {
|
5072 |
|
5073 | return items[0].tagline || '';
|
5074 | }
|
5075 | return '';
|
5076 | }
|
5077 | |
5078 |
|
5079 |
|
5080 |
|
5081 | static getProductNameForSingleAddon(items) {
|
5082 | if (items && items.length === 1 && items[0] instanceof Addon) {
|
5083 |
|
5084 | const addon = ( (items[0]));
|
5085 | return addon.productName;
|
5086 | }
|
5087 | }
|
5088 | |
5089 |
|
5090 |
|
5091 |
|
5092 | selectItem(i) {
|
5093 | this.itemSelectedEvent$.next(i);
|
5094 | }
|
5095 | |
5096 |
|
5097 |
|
5098 | emitGetItNow() {
|
5099 | this.getItNow.emit();
|
5100 | }
|
5101 | }
|
5102 | VaPackageDetailsComponent.decorators = [
|
5103 | { type: Component, args: [{
|
5104 | selector: 'va-package-details',
|
5105 | template: "<div *ngIf=\"pkg$ | async as pkg\" class=\"page\">\n <va-header-container [iconUrl]=\"pkg.icon\"\n [title]=\"pkg.name\"\n [tagline]=\"displayTagName$ | async\"\n [prerequisite]=\"productNameForSingleAddon$ | async\"\n [chipLabels]=\"lmiCategories$ | async\"\n [pricing]=\"pkg.pricing\"\n [pricingLabel]=\"'Pricing'\"\n [showAction]=\"showActionButton\"\n [showPricing]=\"showPricing\"\n [actionLabel]=\"actionLabel\"\n [actionEnabled]=true\n (actionSelected)=\"emitGetItNow()\"\n ></va-header-container>\n <ng-container *ngIf=\"pkg?.content\">\n <va-selling-info [description]=\"pkg.content\"></va-selling-info>\n </ng-container>\n\n <va-products-nav [items]=\"orderedItemsList$ | async\"\n [hideItemsNav]=\"pkg?.hide_product_icons_and_names\"\n (itemSelected)=\"selectItem($event)\"></va-products-nav>\n\n <ng-container *ngIf=\"selectedItem$ | async as selectedItem\">\n <div *ngIf=\"!pkg?.hide_product_details\" class=\"package-content\">\n <div class=\"left-column\">\n <section\n *ngIf=\"(selectedItem.endUserMarketing?.description || selectedItem.endUserMarketing?.keySellingPoints) ||\n (selectedItem.description || selectedItem.keySellingPoints)\">\n <va-selling-info [description]=\"selectedItem.endUserMarketing?.description || selectedItem.description\"\n [keySellingPoints]=\"selectedItem.endUserMarketing?.keySellingPoints || selectedItem.keySellingPoints\"></va-selling-info>\n </section>\n\n <section *ngIf=\"(selectedItem.endUserMarketing?.faqs?.length > 0\n && selectedItem.endUserMarketing?.faqs[0].question) || selectedItem.faqs?.length > 0\">\n <h2 class=\"va-component-title\">FAQs</h2>\n <va-faqs [faqs]=\"selectedItem.endUserMarketing?.faqs || selectedItem.faqs\"></va-faqs>\n </section>\n </div>\n\n <div class=\"right-column\">\n <section *ngIf=\"selectedItem.screenshotUrls?.length > 0 || selectedItem.screenshots?.length > 0\">\n <h2 class=\"va-component-title\">Gallery</h2>\n <va-image-gallery [imageUrls]=\"selectedItem.screenshotUrls || selectedItem.screenshots\"></va-image-gallery>\n </section>\n\n <section *ngIf=\"selectedItem.endUserMarketing?.files?.length > 0 || selectedItem.files?.length > 0\">\n <h2 class=\"va-component-title\">Files</h2>\n <va-files [files]=\"selectedItem.endUserMarketingFiles || selectedItem.files\"></va-files>\n </section>\n </div>\n </div>\n </ng-container>\n</div>\n",
|
5106 | styles: [":host{display:block;font-size:14px;line-height:1.4}:host *{box-sizing:border-box}.va-component-title{font-size:24px;font-weight:300;margin-top:0}@media screen and (min-width:600px){.va-component-title{font-size:32px}}img{max-width:100%}va-icon{display:inline-block}.page{position:relative;margin:0 auto 20px;background:#fff;color:#212121;box-shadow:0 3px 10px rgba(33,33,33,.3);overflow:hidden;font-size:16px}.page .item-amount{color:#9e9e9e;font-size:14px;text-align:right;margin:0 24px 8px}section{padding:24px}.left-column{width:66%}@media screen and (max-width:600px){.left-column{width:100%}}.right-column{width:34%}.package-content{display:-webkit-box;display:flex}@media screen and (max-width:600px){.right-column{width:100%}.package-content{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}}"]
|
5107 | }] }
|
5108 | ];
|
5109 |
|
5110 | VaPackageDetailsComponent.ctorParameters = () => [];
|
5111 | VaPackageDetailsComponent.propDecorators = {
|
5112 | showActionButton: [{ type: Input }],
|
5113 | showPricing: [{ type: Input }],
|
5114 | actionLabel: [{ type: Input }],
|
5115 | getItNow: [{ type: Output }],
|
5116 | standAloneProducts: [{ type: Input }],
|
5117 | products: [{ type: Input }],
|
5118 | addons: [{ type: Input }],
|
5119 | pkg: [{ type: Input }]
|
5120 | };
|
5121 | if (false) {
|
5122 |
|
5123 | VaPackageDetailsComponent.prototype.showActionButton;
|
5124 |
|
5125 | VaPackageDetailsComponent.prototype.showPricing;
|
5126 |
|
5127 | VaPackageDetailsComponent.prototype.actionLabel;
|
5128 |
|
5129 | VaPackageDetailsComponent.prototype.getItNow;
|
5130 |
|
5131 | VaPackageDetailsComponent.prototype.standAloneProducts$$;
|
5132 |
|
5133 | VaPackageDetailsComponent.prototype.products$;
|
5134 |
|
5135 | VaPackageDetailsComponent.prototype.addons$;
|
5136 |
|
5137 | VaPackageDetailsComponent.prototype.pkg$;
|
5138 |
|
5139 | VaPackageDetailsComponent.prototype.itemSelectedEvent$;
|
5140 |
|
5141 | VaPackageDetailsComponent.prototype.selectedItem$;
|
5142 |
|
5143 | VaPackageDetailsComponent.prototype.combinedItemsList$;
|
5144 |
|
5145 | VaPackageDetailsComponent.prototype.orderedItemsList$;
|
5146 |
|
5147 | VaPackageDetailsComponent.prototype.lmiCategories$;
|
5148 |
|
5149 | VaPackageDetailsComponent.prototype.productNameForSingleAddon$;
|
5150 |
|
5151 | VaPackageDetailsComponent.prototype.displayTagName$;
|
5152 | }
|
5153 |
|
5154 |
|
5155 |
|
5156 |
|
5157 |
|
5158 | class VaProductsNavComponent {
|
5159 | |
5160 |
|
5161 |
|
5162 | constructor(translateService) {
|
5163 | this.translateService = translateService;
|
5164 | this.itemSelected = new EventEmitter();
|
5165 | this.selectedIndex = 0;
|
5166 | this.pageMarker = 0;
|
5167 | this.translateService.setTranslation('en', En.en, true);
|
5168 | }
|
5169 | |
5170 |
|
5171 |
|
5172 |
|
5173 | onItemSelected(index) {
|
5174 | this.selectedIndex = index;
|
5175 | this.itemSelected.emit(index);
|
5176 | }
|
5177 | |
5178 |
|
5179 |
|
5180 |
|
5181 | moveSlides(slides) {
|
5182 |
|
5183 | const sliderWidth = Math.round(slides.offsetWidth / slides.children[0].clientWidth);
|
5184 |
|
5185 | const numSlides = Math.ceil(slides.children.length / sliderWidth);
|
5186 | if (numSlides === 0) {
|
5187 | return;
|
5188 | }
|
5189 |
|
5190 | const pageWidth = slides.offsetWidth;
|
5191 |
|
5192 | let move = 0;
|
5193 | if (this.pageMarker === -1) {
|
5194 | this.pageMarker = numSlides - 1;
|
5195 | move = pageWidth * this.pageMarker;
|
5196 | slides.style.left = `-${move}px`;
|
5197 | }
|
5198 | else if (this.pageMarker >= numSlides) {
|
5199 | slides.style.left = '0px';
|
5200 | this.pageMarker = 0;
|
5201 | }
|
5202 | else {
|
5203 | move = pageWidth * this.pageMarker;
|
5204 | slides.style.left = `-${move}px`;
|
5205 | }
|
5206 | }
|
5207 | |
5208 |
|
5209 |
|
5210 |
|
5211 | pageNext(slides) {
|
5212 | this.pageMarker++;
|
5213 | this.moveSlides(slides);
|
5214 | }
|
5215 | |
5216 |
|
5217 |
|
5218 |
|
5219 | pagePrev(slides) {
|
5220 | this.pageMarker--;
|
5221 | this.moveSlides(slides);
|
5222 | }
|
5223 | }
|
5224 | VaProductsNavComponent.decorators = [
|
5225 | { type: Component, args: [{
|
5226 | selector: 'va-products-nav',
|
5227 | template: "<p *ngIf=\"items?.length > 1\" class=\"item-amount\">{{ 'FRONTEND.STORE.CONTAINS_NUM_ITEMS' | translate: {itemCount: items.length} }}</p>\n<div class=\"wrapper\">\n <nav *ngIf=\"items && !hideItemsNav\" (swipeleft)=\"pageNext(slides)\" (swiperight)=\"pagePrev(slides)\">\n <div [ngClass]=\"{'hide-arrows': items && items.length < 5}\">\n <span class=\"prev\" (click)=\"pagePrev(slides)\"><mat-icon>keyboard_arrow_left</mat-icon></span>\n <span class=\"next\" (click)=\"pageNext(slides)\"><mat-icon>keyboard_arrow_right</mat-icon></span>\n </div>\n <ul class=\"slides\" #slides>\n <li *ngFor=\"let item of items; index as i;\" (click)=\"onItemSelected(i)\">\n <a [ngClass]=\"{'active': i === selectedIndex}\">\n <span class=\"icon-area\">\n <va-icon [iconUrl]=\"item.icon || item.iconUrl\" [name]=\"item.name || item.title\" [diameter]=\"80\"></va-icon>\n <va-icon *ngIf=\"item.addonId\" class=\"addon-indicator\" [iconUrl]=\"item.productIcon\" [name]=\"item.productName\" [diameter]=\"24\"></va-icon>\n </span>\n <p>{{ item.name || item.title }}</p>\n <div *ngIf=\"item.addonId\">\n <span class=\"requires-text\">{{ 'FRONTEND.STORE.REQUIRES' | translate }}</span>\n <span>{{item.productName}}</span>\n </div>\n </a>\n </li>\n </ul>\n </nav>\n</div>\n",
|
5228 | styles: ["nav{position:relative;width:350px;margin:0 auto;background:#fff;border:1px solid #e0e0e0;border-width:1px 0;overflow:hidden}nav ul{display:-webkit-box;display:flex;flex-wrap:nowrap;list-style:none;margin:0 50px;padding:0;position:relative;left:0;-webkit-transition:left .3s;transition:left .3s;word-break:break-word}nav li{min-width:100%;-webkit-box-flex:1;flex:1 0 25%;text-align:center;font-size:14px}nav li:first-child a{border-right:1px solid #e0e0e0}nav a{position:relative;display:block;height:100%;padding:20px;text-decoration:none;color:#212121;-webkit-transition:background .3s;transition:background .3s;-webkit-box-align:center;align-items:center;border-right:1px solid #e0e0e0;cursor:pointer}nav a:hover{background-color:rgba(255,255,255,.6)}nav a.active{background-color:#fff}nav a.active:after{content:'';display:block;position:absolute;bottom:-1px;left:0;width:100%;height:1px;background-color:#fff}nav p{margin-bottom:0}nav .icon img{width:80px;min-width:80px;height:80px}nav .next,nav .prev{position:absolute;height:100%;width:50px;top:0;background:rgba(33,33,33,.1);cursor:pointer;text-align:center;opacity:1;-webkit-transition:opacity .3s;transition:opacity .3s;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center;z-index:1}nav .next:not(.disabled):hover,nav .prev:not(.disabled):hover{background:rgba(33,33,33,.3)}nav .prev{left:0}nav .next{right:0}nav .disabled{cursor:default;opacity:0}@media screen and (min-width:600px){nav{width:auto;overflow:initial}nav li{min-width:0;width:25%;-webkit-box-flex:0;flex-grow:0}nav .hide-arrows{display:none}nav .hide-arrows+.slides{margin:0}}va-icon{display:inline-block}.item-amount{color:#9e9e9e;font-size:14px;text-align:right;margin:0 24px 8px}.wrapper{overflow:hidden}.requires-text{color:#9e9e9e}.icon-area{position:relative;display:inline-block}.addon-indicator{position:absolute;border:2px solid #fff;border-radius:50%;bottom:-2px;right:-2px}"]
|
5229 | }] }
|
5230 | ];
|
5231 |
|
5232 | VaProductsNavComponent.ctorParameters = () => [
|
5233 | { type: TranslateService }
|
5234 | ];
|
5235 | VaProductsNavComponent.propDecorators = {
|
5236 | items: [{ type: Input }],
|
5237 | hideItemsNav: [{ type: Input }],
|
5238 | itemSelected: [{ type: Output }]
|
5239 | };
|
5240 | if (false) {
|
5241 |
|
5242 | VaProductsNavComponent.prototype.items;
|
5243 |
|
5244 | VaProductsNavComponent.prototype.hideItemsNav;
|
5245 |
|
5246 | VaProductsNavComponent.prototype.itemSelected;
|
5247 |
|
5248 | VaProductsNavComponent.prototype.selectedIndex;
|
5249 |
|
5250 | VaProductsNavComponent.prototype.pageMarker;
|
5251 | |
5252 |
|
5253 |
|
5254 |
|
5255 | VaProductsNavComponent.prototype.translateService;
|
5256 | }
|
5257 |
|
5258 |
|
5259 |
|
5260 |
|
5261 |
|
5262 | class ProductsNavV2Component {
|
5263 | |
5264 |
|
5265 |
|
5266 | constructor(translateService) {
|
5267 | this.translateService = translateService;
|
5268 | this.itemSelected = new EventEmitter();
|
5269 | this.selected_id = '';
|
5270 | this.pageMarker = 0;
|
5271 | this.translateService.setTranslation('en', En.en, true);
|
5272 | }
|
5273 | |
5274 |
|
5275 |
|
5276 |
|
5277 | onItemSelected(id) {
|
5278 | this.selected_id = id;
|
5279 | this.itemSelected.emit(id);
|
5280 | }
|
5281 | |
5282 |
|
5283 |
|
5284 |
|
5285 | moveSlides(slides) {
|
5286 |
|
5287 | const sliderWidth = Math.round(slides.offsetWidth / slides.children[0].clientWidth);
|
5288 |
|
5289 | const numSlides = Math.ceil(slides.children.length / sliderWidth);
|
5290 | if (numSlides === 0) {
|
5291 | return;
|
5292 | }
|
5293 |
|
5294 | const pageWidth = slides.offsetWidth;
|
5295 |
|
5296 | let move = 0;
|
5297 | if (this.pageMarker === -1) {
|
5298 | this.pageMarker = numSlides - 1;
|
5299 | move = pageWidth * this.pageMarker;
|
5300 | slides.style.left = `-${move}px`;
|
5301 | }
|
5302 | else if (this.pageMarker >= numSlides) {
|
5303 | slides.style.left = '0px';
|
5304 | this.pageMarker = 0;
|
5305 | }
|
5306 | else {
|
5307 | move = pageWidth * this.pageMarker;
|
5308 | slides.style.left = `-${move}px`;
|
5309 | }
|
5310 | }
|
5311 | |
5312 |
|
5313 |
|
5314 |
|
5315 | pageNext(slides) {
|
5316 | this.pageMarker++;
|
5317 | this.moveSlides(slides);
|
5318 | }
|
5319 | |
5320 |
|
5321 |
|
5322 |
|
5323 | pagePrev(slides) {
|
5324 | this.pageMarker--;
|
5325 | this.moveSlides(slides);
|
5326 | }
|
5327 | }
|
5328 | ProductsNavV2Component.decorators = [
|
5329 | { type: Component, args: [{
|
5330 | selector: 'va-products-nav-v2',
|
5331 | template: "<p *ngIf=\"items?.length > 1\" class=\"item-amount\">{{ 'FRONTEND.STORE.CONTAINS_NUM_ITEMS' | translate: {itemCount: items.length} }}</p>\n<div class=\"wrapper\">\n <nav *ngIf=\"items && !hideItemsNav\" (swipeleft)=\"pageNext(slides)\" (swiperight)=\"pagePrev(slides)\">\n <div [ngClass]=\"{'hide-arrows': items && items.length < 5}\">\n <span class=\"prev\" (click)=\"pagePrev(slides)\"><mat-icon>keyboard_arrow_left</mat-icon></span>\n <span class=\"next\" (click)=\"pageNext(slides)\"><mat-icon>keyboard_arrow_right</mat-icon></span>\n </div>\n <ul class=\"slides\" #slides>\n <li *ngFor=\"let lineItem of items;\" (click)=\"onItemSelected(lineItem?.item?.id)\">\n <a [ngClass]=\"{'active': lineItem?.item?.id === selected_id}\">\n <span class=\"icon-area\">\n <va-icon [iconUrl]=\"lineItem?.item?.icon\" [name]=\"lineItem?.item?.name\" [diameter]=\"80\"></va-icon>\n <va-icon *ngIf=\"lineItem?.parent?.id\" class=\"addon-indicator\" [iconUrl]=\"lineItem?.parent?.icon\" [name]=\"lineItem?.parent?.name\"\n [diameter]=\"24\"></va-icon>\n </span>\n <div class=\"name-container\">\n <div>{{ lineItem?.item?.name }}</div>\n <div *ngIf=\"lineItem?.item?.editionName\" class=\"edition-name\">{{ lineItem.item.editionName }}</div>\n </div>\n <div *ngIf=\"lineItem?.parent?.id\">\n <span class=\"requires-text\">{{ 'FRONTEND.STORE.REQUIRES' | translate }} </span>\n <span>{{lineItem?.parent.name}}</span>\n </div>\n </a>\n </li>\n </ul>\n </nav>\n</div>\n",
|
5332 | styles: [".name-container{display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}.name-container va-badge{margin-top:12px;margin-left:6px}nav{position:relative;width:350px;margin:0 auto;background:#fff;border:1px solid #e0e0e0;border-width:1px 0;overflow:hidden}nav ul{display:-webkit-box;display:flex;flex-wrap:nowrap;list-style:none;margin:0 50px;padding:0;position:relative;left:0;-webkit-transition:left .3s;transition:left .3s;word-break:break-word}nav li{min-width:100%;-webkit-box-flex:1;flex:1 0 25%;text-align:center;font-size:14px}nav li:first-child a{border-right:1px solid #e0e0e0}nav a{position:relative;display:block;height:100%;padding:20px;text-decoration:none;color:#212121;-webkit-transition:background .3s;transition:background .3s;-webkit-box-align:center;align-items:center;border-right:1px solid #e0e0e0;cursor:pointer}nav a:hover{background-color:rgba(255,255,255,.6)}nav a.active{background-color:#fff}nav a.active:after{content:'';display:block;position:absolute;bottom:-1px;left:0;width:100%;height:1px;background-color:#fff}nav p{margin-bottom:0}nav .icon img{width:80px;min-width:80px;height:80px}nav .next,nav .prev{position:absolute;height:100%;width:50px;top:0;background:rgba(33,33,33,.1);cursor:pointer;text-align:center;opacity:1;-webkit-transition:opacity .3s;transition:opacity .3s;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center;z-index:1}nav .next:not(.disabled):hover,nav .prev:not(.disabled):hover{background:rgba(33,33,33,.3)}nav .prev{left:0}nav .next{right:0}nav .disabled{cursor:default;opacity:0}@media screen and (min-width:600px){nav{width:auto;overflow:initial}nav li{min-width:0;width:25%;-webkit-box-flex:0;flex-grow:0}nav .hide-arrows{display:none}nav .hide-arrows+.slides{margin:0}}va-icon{display:inline-block}.item-amount{color:#9e9e9e;font-size:14px;text-align:right;margin:0 24px 8px}.wrapper{overflow:hidden}.requires-text{color:#9e9e9e}.icon-area{position:relative;display:inline-block}.addon-indicator{position:absolute;border:2px solid #fff;border-radius:50%;bottom:-2px;right:-2px}.edition-name{color:#9e9e9e;font-style:italic;text-align:center;width:100%;font-size:16px;margin-bottom:4px}"]
|
5333 | }] }
|
5334 | ];
|
5335 |
|
5336 | ProductsNavV2Component.ctorParameters = () => [
|
5337 | { type: TranslateService }
|
5338 | ];
|
5339 | ProductsNavV2Component.propDecorators = {
|
5340 | items: [{ type: Input }],
|
5341 | hideItemsNav: [{ type: Input }],
|
5342 | itemSelected: [{ type: Output }]
|
5343 | };
|
5344 | if (false) {
|
5345 |
|
5346 | ProductsNavV2Component.prototype.items;
|
5347 |
|
5348 | ProductsNavV2Component.prototype.hideItemsNav;
|
5349 |
|
5350 | ProductsNavV2Component.prototype.itemSelected;
|
5351 |
|
5352 | ProductsNavV2Component.prototype.selected_id;
|
5353 |
|
5354 | ProductsNavV2Component.prototype.pageMarker;
|
5355 | |
5356 |
|
5357 |
|
5358 |
|
5359 | ProductsNavV2Component.prototype.translateService;
|
5360 | }
|
5361 |
|
5362 |
|
5363 |
|
5364 |
|
5365 |
|
5366 | class VaProductsNavModule {
|
5367 | }
|
5368 | VaProductsNavModule.decorators = [
|
5369 | { type: NgModule, args: [{
|
5370 | imports: [
|
5371 | CommonModule,
|
5372 | MatIconModule,
|
5373 | VaIconModule,
|
5374 | VaBadgeModule,
|
5375 | TranslateModule
|
5376 | ],
|
5377 | declarations: [VaProductsNavComponent, ProductsNavV2Component],
|
5378 | exports: [VaProductsNavComponent, ProductsNavV2Component]
|
5379 | },] }
|
5380 | ];
|
5381 |
|
5382 |
|
5383 |
|
5384 |
|
5385 |
|
5386 | class VaPackageDetailsModule {
|
5387 | }
|
5388 | VaPackageDetailsModule.decorators = [
|
5389 | { type: NgModule, args: [{
|
5390 | imports: [
|
5391 | VaImageGalleryModule, CommonModule, MatIconModule, VaSafeHtmlModule, VaIconModule,
|
5392 | VaPricingModule, MatButtonModule, VaFilesModule, VaFaqsModule, VaSellingInfoModule,
|
5393 | VaHeaderContainerModule, VaAddonListModule, VaProductsNavModule
|
5394 | ],
|
5395 | declarations: [VaPackageDetailsComponent],
|
5396 | exports: [VaPackageDetailsComponent],
|
5397 | entryComponents: [VaPackageDetailsComponent]
|
5398 | },] }
|
5399 | ];
|
5400 |
|
5401 |
|
5402 |
|
5403 |
|
5404 |
|
5405 | class PackageDetails {
|
5406 | |
5407 |
|
5408 |
|
5409 | get isPackageFree() {
|
5410 |
|
5411 | const isFreeHelper = ( |
5412 |
|
5413 |
|
5414 |
|
5415 | (prices) => {
|
5416 | return prices ? prices.some(( |
5417 |
|
5418 |
|
5419 |
|
5420 | p => p.price === 0 || p.price === undefined)) : false;
|
5421 | });
|
5422 | return this.pricing && isFreeHelper(this.pricing.prices);
|
5423 | }
|
5424 | }
|
5425 | if (false) {
|
5426 |
|
5427 | PackageDetails.prototype.solution_id;
|
5428 |
|
5429 | PackageDetails.prototype.partner_id;
|
5430 |
|
5431 | PackageDetails.prototype.market_id;
|
5432 |
|
5433 | PackageDetails.prototype.name;
|
5434 |
|
5435 | PackageDetails.prototype.icon;
|
5436 |
|
5437 | PackageDetails.prototype.status;
|
5438 |
|
5439 | PackageDetails.prototype.tagline;
|
5440 |
|
5441 | PackageDetails.prototype.header_image_url;
|
5442 |
|
5443 | PackageDetails.prototype.content;
|
5444 |
|
5445 | PackageDetails.prototype.hide_product_icons_and_names;
|
5446 |
|
5447 | PackageDetails.prototype.hide_product_details;
|
5448 |
|
5449 | PackageDetails.prototype.createdDate;
|
5450 |
|
5451 | PackageDetails.prototype.updatedDate;
|
5452 |
|
5453 | PackageDetails.prototype.pricing;
|
5454 |
|
5455 | PackageDetails.prototype.line_items;
|
5456 |
|
5457 | PackageDetails.prototype.market_action;
|
5458 | }
|
5459 |
|
5460 |
|
5461 |
|
5462 |
|
5463 |
|
5464 | function convertToPackageDetails(data, products) {
|
5465 | if (!data) {
|
5466 | return undefined;
|
5467 | }
|
5468 |
|
5469 | const newPackage = new PackageDetails();
|
5470 | if (!data.pricing) {
|
5471 | data.pricing = Pricing$1.fromProto({
|
5472 | currency: undefined,
|
5473 | prices: [{
|
5474 | price: 0,
|
5475 | frequency: undefined,
|
5476 | isStartingPrice: false,
|
5477 | }]
|
5478 | });
|
5479 | }
|
5480 | Object.assign(newPackage, data);
|
5481 | if (!newPackage.name) {
|
5482 | newPackage.name = 'Untitled';
|
5483 | }
|
5484 | if (data.created) {
|
5485 | newPackage.createdDate = new Date(data.created);
|
5486 | }
|
5487 | if (data.updated) {
|
5488 | newPackage.updatedDate = new Date(data.updated);
|
5489 | }
|
5490 | if (data.lineItems) {
|
5491 | newPackage.line_items = convertProtoLineItemsToStoreLineItems(data.lineItems, products);
|
5492 | }
|
5493 | if (typeof data.pricing.currency === 'number') {
|
5494 | newPackage.pricing.currency = Currency[data.pricing.currency];
|
5495 | }
|
5496 | return newPackage;
|
5497 | }
|
5498 |
|
5499 |
|
5500 |
|
5501 |
|
5502 |
|
5503 | function convertProtoLineItemsToStoreLineItems(protoLineItems, products) {
|
5504 | if (!protoLineItems || !protoLineItems.lineItems || protoLineItems.lineItems.length === 0 || !products || products.length === 0) {
|
5505 | return [];
|
5506 | }
|
5507 | return protoLineItems.lineItems.map(( |
5508 |
|
5509 |
|
5510 |
|
5511 | lineItem => {
|
5512 |
|
5513 | const product = products.find(( |
5514 |
|
5515 |
|
5516 |
|
5517 | p => p.productId === lineItem.id));
|
5518 |
|
5519 | let parent;
|
5520 | if (!!lineItem.parentId) {
|
5521 | parent = products.find(( |
5522 |
|
5523 |
|
5524 |
|
5525 | p => p.productId === lineItem.parentId));
|
5526 | }
|
5527 | return convertProtoLineItemToStoreLineItem(lineItem, product, parent);
|
5528 | }));
|
5529 | }
|
5530 |
|
5531 |
|
5532 |
|
5533 |
|
5534 |
|
5535 |
|
5536 | function convertProtoLineItemToStoreLineItem(protoLineItem, product, parentProduct) {
|
5537 | if (!product || !protoLineItem) {
|
5538 | return undefined;
|
5539 | }
|
5540 |
|
5541 | let files = [];
|
5542 | if (product.pdfUploadUrls && product.pdfUploadUrls.length > 0) {
|
5543 | files = product.pdfUploadUrls.map(( |
5544 |
|
5545 |
|
5546 |
|
5547 | url => new File(url)));
|
5548 | }
|
5549 |
|
5550 | const lineItem = ( ({
|
5551 | item: {
|
5552 | id: protoLineItem.id,
|
5553 | editionId: protoLineItem.editionId,
|
5554 | icon: product.iconUrl,
|
5555 | name: product.name,
|
5556 | editionName: '',
|
5557 | description: product.description,
|
5558 | keySellingPoints: product.keySellingPoints,
|
5559 | faqs: product.faqs,
|
5560 | files: files,
|
5561 | screenshotUrls: product.screenshotUrls,
|
5562 | lmiCategories: [],
|
5563 | },
|
5564 | quantity: protoLineItem.quantity,
|
5565 | parent: {}
|
5566 | }));
|
5567 | if (protoLineItem.parentId && parentProduct) {
|
5568 | lineItem.parent = {
|
5569 | id: protoLineItem.parentId,
|
5570 | editionId: '',
|
5571 | icon: parentProduct.iconUrl,
|
5572 | name: parentProduct.name,
|
5573 | editionName: '',
|
5574 | };
|
5575 | }
|
5576 | return lineItem;
|
5577 | }
|
5578 |
|
5579 |
|
5580 |
|
5581 |
|
5582 |
|
5583 | class VaPackageDetailsV2Component {
|
5584 | |
5585 |
|
5586 |
|
5587 | constructor(translateService) {
|
5588 | this.translateService = translateService;
|
5589 | this.showActionButton = true;
|
5590 | this.showPricing = true;
|
5591 | this.getItNow = new EventEmitter();
|
5592 | this.pkg$$ = new ReplaySubject(1);
|
5593 | this.itemSelectedEvent$$ = new BehaviorSubject('');
|
5594 | this.translateService.setTranslation('en', En.en, true);
|
5595 | this.orderedLineItems$ = this.pkg$$.pipe(map(( |
5596 |
|
5597 |
|
5598 |
|
5599 | pkg => pkg.line_items)), filter(( |
5600 |
|
5601 |
|
5602 |
|
5603 | items => !!items || items.length === 0)), shareReplay(1));
|
5604 | this.productNameForSingleAddon$ = this.orderedLineItems$.pipe(map(( |
5605 |
|
5606 |
|
5607 |
|
5608 | items => this.getParentsNameForItem(items))));
|
5609 | this.selectedItem$ = combineLatest([this.itemSelectedEvent$$, this.orderedLineItems$]).pipe(map(( |
5610 |
|
5611 |
|
5612 |
|
5613 | ([id, lineItems]) => lineItems.find(( |
5614 |
|
5615 |
|
5616 |
|
5617 | lineItem => lineItem.item.id === id)))));
|
5618 | this.lmiCategories$ = this.orderedLineItems$.pipe(map(( |
5619 |
|
5620 |
|
5621 |
|
5622 | (lis) => {
|
5623 |
|
5624 | const lmiMap = (lis || []).reduce(( |
5625 |
|
5626 |
|
5627 |
|
5628 |
|
5629 | (prev, li) => {
|
5630 | if (li && li.item) {
|
5631 | (li.item.lmiCategories || []).forEach(( |
5632 |
|
5633 |
|
5634 |
|
5635 | lmi => prev.set(lmi, lmi)));
|
5636 | }
|
5637 | return prev;
|
5638 | }), new Map());
|
5639 |
|
5640 | const lmiCats = [];
|
5641 | lmiMap.forEach(( |
5642 |
|
5643 |
|
5644 |
|
5645 |
|
5646 | (v, k) => {
|
5647 | lmiCats.push(k);
|
5648 | }));
|
5649 | return lmiCats;
|
5650 | })));
|
5651 |
|
5652 | this.orderedLineItems$.pipe(map(( |
5653 |
|
5654 |
|
5655 |
|
5656 | lineItems => lineItems[0])), tap(( |
5657 |
|
5658 |
|
5659 |
|
5660 | lineItem => this.selectItem(lineItem && lineItem.item ? lineItem.item.id : ''))), take(1)).subscribe();
|
5661 | }
|
5662 | |
5663 |
|
5664 |
|
5665 |
|
5666 | set pkg(pkg) {
|
5667 | this.pkg$$.next(pkg);
|
5668 | }
|
5669 | |
5670 |
|
5671 |
|
5672 | ngOnInit() {
|
5673 | if (!this.actionLabel) {
|
5674 | this.actionLabel = this.translateService.instant('FRONTEND.STORE.GET_IT_NOW');
|
5675 | }
|
5676 | }
|
5677 | |
5678 |
|
5679 |
|
5680 |
|
5681 | selectItem(id) {
|
5682 | this.itemSelectedEvent$$.next(id);
|
5683 | }
|
5684 | |
5685 |
|
5686 |
|
5687 | emitGetItNow() {
|
5688 | this.getItNow.emit();
|
5689 | }
|
5690 | |
5691 |
|
5692 |
|
5693 |
|
5694 | getParentsNameForItem(items) {
|
5695 | if (items && items.length === 1 && items[0]) {
|
5696 | return items[0].parent.name;
|
5697 | }
|
5698 | }
|
5699 | }
|
5700 | VaPackageDetailsV2Component.decorators = [
|
5701 | { type: Component, args: [{
|
5702 | selector: 'va-package-details-v2',
|
5703 | template: "<div *ngIf=\"pkg$$ | async as pkg\" class=\"page\">\n <va-header-container [iconUrl]=\"pkg.icon\"\n [title]=\"pkg.name\"\n [tagline]=\"pkg.tagline\"\n [prerequisite]=\"productNameForSingleAddon$ | async\"\n [chipLabels]=\"lmiCategories$ | async\"\n [pricing]=\"pkg.pricing\"\n [pricingLabel]=\"'FRONTEND.STORE.PRICING' | translate\"\n [showAction]=\"showActionButton\"\n [showPricing]=\"showPricing\"\n [actionLabel]=\"actionLabel\"\n [actionEnabled]=true\n (actionSelected)=\"emitGetItNow()\"\n ></va-header-container>\n\n <ng-container *ngIf=\"pkg?.content\">\n <va-selling-info [description]=\"pkg.content\"></va-selling-info>\n </ng-container>\n\n <va-products-nav-v2 [items]=\"orderedLineItems$ | async\"\n [hideItemsNav]=\"pkg?.hide_product_icons_and_names\"\n (itemSelected)=\"selectItem($event)\"></va-products-nav-v2>\n\n <ng-container *ngIf=\"selectedItem$ | async as selectedItem\">\n <div *ngIf=\"!pkg?.hide_product_details\" class=\"package-content\">\n <div class=\"left-column\">\n <section *ngIf=\"selectedItem?.item?.description || selectedItem?.item?.keySellingPoints\">\n <va-selling-info [description]=\"selectedItem?.item?.description\"\n [keySellingPoints]=\"selectedItem?.item?.keySellingPoints\"></va-selling-info>\n </section>\n\n <section *ngIf=\"selectedItem?.item?.faqs?.length > 0 && selectedItem?.item?.faqs[0].question\">\n <h2 class=\"va-component-title\">{{ 'FRONTEND.STORE.FAQS' | translate }}</h2>\n <va-faqs [faqs]=\"selectedItem.item.faqs\"></va-faqs>\n </section>\n </div>\n\n <div class=\"right-column\">\n <section *ngIf=\"selectedItem?.item?.screenshotUrls?.length > 0\">\n <h2 class=\"va-component-title\">{{ 'FRONTEND.STORE.GALLERY' | translate }}</h2>\n <va-image-gallery [imageUrls]=\"selectedItem.item.screenshotUrls\"></va-image-gallery>\n </section>\n\n <section *ngIf=\"selectedItem?.item?.files?.length > 0\">\n <h2 class=\"va-component-title\">{{ 'FRONTEND.STORE.FILES' | translate }}</h2>\n <va-files [files]=\"selectedItem.item.files\"></va-files>\n </section>\n </div>\n </div>\n </ng-container>\n</div>\n",
|
5704 | styles: [":host{display:block;font-size:14px;line-height:1.4}:host *{box-sizing:border-box}.va-component-title{font-size:24px;font-weight:300;margin-top:0}@media screen and (min-width:600px){.va-component-title{font-size:32px}}img{max-width:100%}va-icon{display:inline-block}.page{position:relative;margin:0 auto 20px;background:#fff;color:#212121;box-shadow:0 3px 10px rgba(33,33,33,.3);overflow:hidden;font-size:16px}.page .item-amount{color:#9e9e9e;font-size:14px;text-align:right;margin:0 24px 8px}section{padding:24px}.left-column{width:66%}@media screen and (max-width:600px){.left-column{width:100%}}.right-column{width:34%}.package-content{display:-webkit-box;display:flex}@media screen and (max-width:600px){.right-column{width:100%}.package-content{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}}"]
|
5705 | }] }
|
5706 | ];
|
5707 |
|
5708 | VaPackageDetailsV2Component.ctorParameters = () => [
|
5709 | { type: TranslateService }
|
5710 | ];
|
5711 | VaPackageDetailsV2Component.propDecorators = {
|
5712 | showActionButton: [{ type: Input }],
|
5713 | showPricing: [{ type: Input }],
|
5714 | actionLabel: [{ type: Input }],
|
5715 | pkg: [{ type: Input }],
|
5716 | getItNow: [{ type: Output }]
|
5717 | };
|
5718 | if (false) {
|
5719 |
|
5720 | VaPackageDetailsV2Component.prototype.showActionButton;
|
5721 |
|
5722 | VaPackageDetailsV2Component.prototype.showPricing;
|
5723 |
|
5724 | VaPackageDetailsV2Component.prototype.actionLabel;
|
5725 |
|
5726 | VaPackageDetailsV2Component.prototype.getItNow;
|
5727 |
|
5728 | VaPackageDetailsV2Component.prototype.pkg$$;
|
5729 |
|
5730 | VaPackageDetailsV2Component.prototype.itemSelectedEvent$$;
|
5731 |
|
5732 | VaPackageDetailsV2Component.prototype.selectedItem$;
|
5733 |
|
5734 | VaPackageDetailsV2Component.prototype.orderedLineItems$;
|
5735 |
|
5736 | VaPackageDetailsV2Component.prototype.productNameForSingleAddon$;
|
5737 |
|
5738 | VaPackageDetailsV2Component.prototype.lmiCategories$;
|
5739 | |
5740 |
|
5741 |
|
5742 |
|
5743 | VaPackageDetailsV2Component.prototype.translateService;
|
5744 | }
|
5745 |
|
5746 |
|
5747 |
|
5748 |
|
5749 |
|
5750 | class VaPackageDetailsV2Module {
|
5751 | }
|
5752 | VaPackageDetailsV2Module.decorators = [
|
5753 | { type: NgModule, args: [{
|
5754 | imports: [
|
5755 | VaImageGalleryModule,
|
5756 | CommonModule,
|
5757 | MatIconModule,
|
5758 | VaSafeHtmlModule,
|
5759 | VaIconModule,
|
5760 | VaPricingModule,
|
5761 | MatButtonModule,
|
5762 | VaFilesModule,
|
5763 | VaFaqsModule,
|
5764 | VaSellingInfoModule,
|
5765 | VaHeaderContainerModule,
|
5766 | VaAddonListModule,
|
5767 | VaProductsNavModule,
|
5768 | TranslateModule
|
5769 | ],
|
5770 | declarations: [VaPackageDetailsV2Component],
|
5771 | exports: [VaPackageDetailsV2Component],
|
5772 | entryComponents: [VaPackageDetailsV2Component]
|
5773 | },] }
|
5774 | ];
|
5775 |
|
5776 |
|
5777 |
|
5778 |
|
5779 |
|
5780 |
|
5781 |
|
5782 |
|
5783 | function SalesPackage() { }
|
5784 | if (false) {
|
5785 |
|
5786 | SalesPackage.prototype.formattedPrices;
|
5787 |
|
5788 | SalesPackage.prototype.packageId;
|
5789 |
|
5790 | SalesPackage.prototype.name;
|
5791 |
|
5792 | SalesPackage.prototype.icon;
|
5793 |
|
5794 | SalesPackage.prototype.productIds;
|
5795 |
|
5796 | SalesPackage.prototype.products;
|
5797 |
|
5798 | SalesPackage.prototype.addonsWithNoParent;
|
5799 |
|
5800 | SalesPackage.prototype.totalAddons;
|
5801 |
|
5802 | SalesPackage.prototype.activationStatus;
|
5803 | }
|
5804 |
|
5805 |
|
5806 |
|
5807 | function SalesProduct() { }
|
5808 | if (false) {
|
5809 |
|
5810 | SalesProduct.prototype.formattedPrices;
|
5811 |
|
5812 | SalesProduct.prototype.productId;
|
5813 |
|
5814 | SalesProduct.prototype.name;
|
5815 |
|
5816 | SalesProduct.prototype.icon;
|
5817 |
|
5818 | SalesProduct.prototype.tagline;
|
5819 |
|
5820 | SalesProduct.prototype.activationStatus;
|
5821 |
|
5822 | SalesProduct.prototype.editionId;
|
5823 |
|
5824 | SalesProduct.prototype.editionName;
|
5825 |
|
5826 | SalesProduct.prototype.addons;
|
5827 |
|
5828 | SalesProduct.prototype.parentInfo;
|
5829 | }
|
5830 |
|
5831 |
|
5832 |
|
5833 | function ProductParentInfo() { }
|
5834 | if (false) {
|
5835 |
|
5836 | ProductParentInfo.prototype.parentId;
|
5837 |
|
5838 | ProductParentInfo.prototype.parentName;
|
5839 |
|
5840 | ProductParentInfo.prototype.parentIconUrl;
|
5841 |
|
5842 | ProductParentInfo.prototype.multipleActivations;
|
5843 | }
|
5844 |
|
5845 |
|
5846 |
|
5847 | function SalesAddon() { }
|
5848 | if (false) {
|
5849 |
|
5850 | SalesAddon.prototype.parentId;
|
5851 |
|
5852 | SalesAddon.prototype.addonId;
|
5853 |
|
5854 | SalesAddon.prototype.name;
|
5855 |
|
5856 | SalesAddon.prototype.icon;
|
5857 |
|
5858 | SalesAddon.prototype.tagline;
|
5859 |
|
5860 | SalesAddon.prototype.parentName;
|
5861 |
|
5862 | SalesAddon.prototype.parentIcon;
|
5863 |
|
5864 | SalesAddon.prototype.multipleActivations;
|
5865 |
|
5866 | SalesAddon.prototype.activationStatus;
|
5867 | }
|
5868 |
|
5869 |
|
5870 |
|
5871 | function PackageItemActivationStatus() { }
|
5872 | if (false) {
|
5873 |
|
5874 | PackageItemActivationStatus.prototype.packageItemId;
|
5875 |
|
5876 | PackageItemActivationStatus.prototype.status;
|
5877 | }
|
5878 |
|
5879 | const ActivationStatus = {
|
5880 | SUCCESS: 0,
|
5881 | WARNING: 1,
|
5882 | ERROR: 2,
|
5883 | };
|
5884 | ActivationStatus[ActivationStatus.SUCCESS] = 'SUCCESS';
|
5885 | ActivationStatus[ActivationStatus.WARNING] = 'WARNING';
|
5886 | ActivationStatus[ActivationStatus.ERROR] = 'ERROR';
|
5887 |
|
5888 |
|
5889 |
|
5890 | function StatusNotificationItem() { }
|
5891 | if (false) {
|
5892 |
|
5893 | StatusNotificationItem.prototype.icon;
|
5894 |
|
5895 | StatusNotificationItem.prototype.text;
|
5896 |
|
5897 | StatusNotificationItem.prototype.status;
|
5898 | }
|
5899 |
|
5900 |
|
5901 |
|
5902 |
|
5903 |
|
5904 |
|
5905 | function buildSalesPackages(packages, products, addons) {
|
5906 | if (!packages || packages.length < 1) {
|
5907 | return [];
|
5908 | }
|
5909 | return packages.map(( |
5910 |
|
5911 |
|
5912 |
|
5913 | pkg => buildSalesPackageFromPackage(pkg, products, addons)));
|
5914 | }
|
5915 |
|
5916 |
|
5917 |
|
5918 |
|
5919 |
|
5920 |
|
5921 | function buildSalesPackageFromPackage(pkg, products, addons) {
|
5922 | if (!pkg) {
|
5923 | return null;
|
5924 | }
|
5925 |
|
5926 | const salesProducts = buildSalesProducts(pkg, products, addons);
|
5927 |
|
5928 |
|
5929 | const addonsWithNoParent = buildSalesAddonsWithNoParent(pkg, products, addons);
|
5930 | return createSalesPackage(pkg, salesProducts, addonsWithNoParent);
|
5931 | }
|
5932 |
|
5933 |
|
5934 |
|
5935 |
|
5936 |
|
5937 |
|
5938 | function buildSalesProducts(pkg, products, addons) {
|
5939 | if (!(products && products.length && pkg.products && pkg.products.length)) {
|
5940 | return [];
|
5941 | }
|
5942 |
|
5943 | const productMap = new Map();
|
5944 | products.forEach(( |
5945 |
|
5946 |
|
5947 |
|
5948 | product => productMap.set(product.productId, product)));
|
5949 | return pkg.products
|
5950 | .map(( |
5951 |
|
5952 |
|
5953 |
|
5954 | productId => {
|
5955 |
|
5956 | const productMatch = productMap.get(productId);
|
5957 |
|
5958 | const addonsInPackage = coerceAddonsForAddonKeys(addons, pkg.addon_keys);
|
5959 | return productMatch ? buildSalesProductFromProduct(productMatch, addonsInPackage) : null;
|
5960 | }))
|
5961 | .filter(( |
5962 |
|
5963 |
|
5964 |
|
5965 | productItem => productItem));
|
5966 | }
|
5967 |
|
5968 |
|
5969 |
|
5970 |
|
5971 |
|
5972 | function coerceAddonsForAddonKeys(addons, addonKeys) {
|
5973 | if (!addons || addons.length === 0 || !addonKeys || addonKeys.length === 0) {
|
5974 | return [];
|
5975 | }
|
5976 | return addons.reduce(( |
5977 |
|
5978 |
|
5979 |
|
5980 |
|
5981 | (addonsArray, addon) => {
|
5982 |
|
5983 | const key = addonKeys.find(( |
5984 |
|
5985 |
|
5986 |
|
5987 | k => k.addonId === addon.addonId));
|
5988 | if (key) {
|
5989 |
|
5990 | const quantity = key.quantity || 1;
|
5991 | for (let i = 0; i < quantity; i++) {
|
5992 | addonsArray.push(addon);
|
5993 | }
|
5994 | }
|
5995 | return addonsArray;
|
5996 | }), []);
|
5997 | }
|
5998 |
|
5999 |
|
6000 |
|
6001 |
|
6002 |
|
6003 |
|
6004 | function buildSalesAddonsWithNoParent(pkg, products, addons) {
|
6005 | if (!addons || addons.length < 1 || !pkg.addon_keys) {
|
6006 | return [];
|
6007 | }
|
6008 |
|
6009 | const productMap = new Map();
|
6010 | products.forEach(( |
6011 |
|
6012 |
|
6013 |
|
6014 | product => productMap.set(product.productId, product)));
|
6015 |
|
6016 | const addonsMap = new Map();
|
6017 | addons.forEach(( |
6018 |
|
6019 |
|
6020 |
|
6021 | addon => addonsMap.set(addon.addonId, addon)));
|
6022 |
|
6023 | const addonsWithNoParent = pkg.addon_keys.reduce(( |
6024 |
|
6025 |
|
6026 |
|
6027 |
|
6028 | (addonArray, addonKey) => {
|
6029 | if (pkg.products && pkg.products.some(( |
6030 |
|
6031 |
|
6032 |
|
6033 | productId => productId === addonKey.appId))) {
|
6034 | return addonArray || [];
|
6035 | }
|
6036 |
|
6037 | const parentProduct = productMap.get(addonKey.appId);
|
6038 |
|
6039 | const parentName = parentProduct ? parentProduct.name : null;
|
6040 |
|
6041 | const parentIcon = parentProduct ? parentProduct.iconUrl : null;
|
6042 |
|
6043 | const quantity = addonKey.quantity || 1;
|
6044 |
|
6045 | const addon = addonsMap.get(addonKey.addonId);
|
6046 | for (let i = 0; i < quantity; i++) {
|
6047 | addonArray.push(createSalesAddon(addon, parentName, parentIcon));
|
6048 | }
|
6049 | return addonArray;
|
6050 | }), []);
|
6051 | return addonsWithNoParent;
|
6052 | }
|
6053 |
|
6054 |
|
6055 |
|
6056 |
|
6057 |
|
6058 | function buildSalesProductFromProduct(product, addons) {
|
6059 | if (!product) {
|
6060 | return null;
|
6061 | }
|
6062 | if (!addons || addons.length < 1) {
|
6063 | return createSalesProduct(product, null);
|
6064 | }
|
6065 |
|
6066 | const productAddons = addons.filter(( |
6067 |
|
6068 |
|
6069 |
|
6070 | addon => addon.appId === product.productId));
|
6071 |
|
6072 | const salesAddons = createSalesAddons(productAddons);
|
6073 | return createSalesProduct(product, salesAddons);
|
6074 | }
|
6075 |
|
6076 |
|
6077 |
|
6078 |
|
6079 |
|
6080 |
|
6081 | function createSalesPackage(pkg, salesProducts, addonsWithNoParent) {
|
6082 |
|
6083 | let totalAddons = 0;
|
6084 | for (const key of pkg.addon_keys || []) {
|
6085 | totalAddons += key.quantity || 1;
|
6086 | }
|
6087 | return {
|
6088 | formattedPrices: pkg.priceStrings.join(', '),
|
6089 | packageId: pkg.solution_id,
|
6090 | name: pkg.name,
|
6091 | icon: pkg.icon,
|
6092 | productIds: pkg.products,
|
6093 | products: salesProducts || [],
|
6094 | addonsWithNoParent: addonsWithNoParent || [],
|
6095 | totalAddons: totalAddons
|
6096 | };
|
6097 | }
|
6098 |
|
6099 |
|
6100 |
|
6101 |
|
6102 |
|
6103 | function createSalesProduct(product, salesAddons) {
|
6104 |
|
6105 | let parentInfo;
|
6106 | if (product instanceof ProductWithParent) {
|
6107 | parentInfo = {
|
6108 | parentId: product.parentId,
|
6109 | parentName: product.parentName,
|
6110 | parentIconUrl: product.parentIconUrl,
|
6111 | multipleActivations: product.multipleActivations || false,
|
6112 | };
|
6113 | }
|
6114 | return {
|
6115 | formattedPrices: product.priceStrings.join(', '),
|
6116 | productId: product.productId,
|
6117 | name: product.name,
|
6118 | tagline: product.tagline || '',
|
6119 | icon: product.iconUrl,
|
6120 | addons: salesAddons || [],
|
6121 | editionId: product.editionId,
|
6122 | editionName: product.editionName,
|
6123 | parentInfo: parentInfo,
|
6124 | };
|
6125 | }
|
6126 |
|
6127 |
|
6128 |
|
6129 |
|
6130 | function createSalesAddons(addons) {
|
6131 | return addons.map(( |
6132 |
|
6133 |
|
6134 |
|
6135 | addon => createSalesAddon(addon)));
|
6136 | }
|
6137 |
|
6138 |
|
6139 |
|
6140 |
|
6141 |
|
6142 |
|
6143 | function createSalesAddon(addon, parentName, parentIcon) {
|
6144 | return {
|
6145 | parentId: addon.appId,
|
6146 | addonId: addon.addonId,
|
6147 | name: addon.title,
|
6148 | tagline: addon.tagline || '',
|
6149 | icon: addon.icon || '',
|
6150 | multipleActivations: addon.multipleActivations,
|
6151 | parentIcon: parentIcon || '',
|
6152 | parentName: parentName || ''
|
6153 | };
|
6154 | }
|
6155 |
|
6156 |
|
6157 |
|
6158 |
|
6159 |
|
6160 |
|
6161 |
|
6162 | function createSalesPackageWithStatus(pkg, products, addons, activationStatus) {
|
6163 | return {
|
6164 | formattedPrices: pkg.formattedPrices,
|
6165 | packageId: pkg.packageId,
|
6166 | name: pkg.name,
|
6167 | icon: pkg.icon,
|
6168 | productIds: pkg.productIds,
|
6169 | products: products || [],
|
6170 | addonsWithNoParent: addons || [],
|
6171 | activationStatus: activationStatus || null,
|
6172 | totalAddons: pkg.totalAddons
|
6173 | };
|
6174 | }
|
6175 |
|
6176 |
|
6177 |
|
6178 |
|
6179 |
|
6180 |
|
6181 | function createSalesProductWithStatus(product, addons, activationStatus) {
|
6182 | return {
|
6183 | formattedPrices: product.formattedPrices,
|
6184 | productId: product.productId,
|
6185 | name: product.name,
|
6186 | editionId: product.editionId,
|
6187 | editionName: product.editionName,
|
6188 | tagline: product.tagline,
|
6189 | icon: product.icon,
|
6190 | addons: addons || [],
|
6191 | activationStatus: activationStatus || null,
|
6192 | parentInfo: product.parentInfo || null,
|
6193 | };
|
6194 | }
|
6195 |
|
6196 |
|
6197 |
|
6198 |
|
6199 |
|
6200 | function createSalesAddonWithStatus(addon, activationStatus) {
|
6201 | return {
|
6202 | parentId: addon.parentId,
|
6203 | addonId: addon.addonId,
|
6204 | name: addon.name,
|
6205 | tagline: addon.tagline,
|
6206 | icon: addon.icon,
|
6207 | parentIcon: addon.parentIcon,
|
6208 | parentName: addon.parentName,
|
6209 | multipleActivations: addon.multipleActivations,
|
6210 | activationStatus: activationStatus || null
|
6211 | };
|
6212 | }
|
6213 |
|
6214 |
|
6215 |
|
6216 |
|
6217 |
|
6218 | function addStatusesToSalesPackages(salesPackages, statuses) {
|
6219 | if (!statuses || statuses.length === 0) {
|
6220 | return salesPackages;
|
6221 | }
|
6222 | return salesPackages.map(( |
6223 |
|
6224 |
|
6225 |
|
6226 | salesPackage => {
|
6227 |
|
6228 | const newProducts = salesPackage.products.map(( |
6229 |
|
6230 |
|
6231 |
|
6232 | product => addStatusesToSalesProduct(product, statuses)));
|
6233 |
|
6234 | const newAddonsWithNoParent = salesPackage.addonsWithNoParent.map(( |
6235 |
|
6236 |
|
6237 |
|
6238 | addon => {
|
6239 |
|
6240 | const status = findStatus(statuses, addon.addonId);
|
6241 | return addStatusesToSalesAddon(addon, status);
|
6242 | }));
|
6243 |
|
6244 | const productStatuses = newProducts
|
6245 | .map(( |
6246 |
|
6247 |
|
6248 |
|
6249 | product => product.activationStatus.status));
|
6250 |
|
6251 | const addonStatuses = newProducts
|
6252 | .map(( |
6253 |
|
6254 |
|
6255 |
|
6256 | product => product.addons ? product.addons.map(( |
6257 |
|
6258 |
|
6259 |
|
6260 | addon => addon.activationStatus.status)) : []))
|
6261 | .reduce(( |
6262 |
|
6263 |
|
6264 |
|
6265 |
|
6266 | (statusList, reducedList) => reducedList.concat(statusList)), []);
|
6267 |
|
6268 | const addonsWithNoParentStatuses = newAddonsWithNoParent
|
6269 | .map(( |
6270 |
|
6271 |
|
6272 |
|
6273 | addon => addon.activationStatus ? addon.activationStatus.status : null));
|
6274 |
|
6275 | const allStatuses = [...productStatuses, ...addonStatuses, ...addonsWithNoParentStatuses];
|
6276 |
|
6277 | const packageStatus = convertNumberToActivationStatus(Math.max(...allStatuses));
|
6278 |
|
6279 | const statusNotification = createStatusNotificationItemForPackage(packageStatus);
|
6280 | return createSalesPackageWithStatus(salesPackage, newProducts, newAddonsWithNoParent, statusNotification);
|
6281 | }));
|
6282 | }
|
6283 |
|
6284 |
|
6285 |
|
6286 |
|
6287 |
|
6288 | function addStatusesToSalesProduct(product, statuses) {
|
6289 | if (!statuses || statuses.length === 0) {
|
6290 | return product;
|
6291 | }
|
6292 |
|
6293 | const productStatus = findStatus(statuses, product.productId);
|
6294 |
|
6295 | const statusNotification = createStatusNotificationItemForPackageItem(productStatus);
|
6296 | if (!product.addons) {
|
6297 | return createSalesProductWithStatus(product, null, statusNotification);
|
6298 | }
|
6299 |
|
6300 | const newSalesAddons = product.addons.map(( |
6301 |
|
6302 |
|
6303 |
|
6304 | addon => {
|
6305 |
|
6306 | const addonStatus = findStatus(statuses, addon.addonId);
|
6307 | return addStatusesToSalesAddon(addon, addonStatus);
|
6308 | }));
|
6309 | return createSalesProductWithStatus(product, newSalesAddons, statusNotification);
|
6310 | }
|
6311 |
|
6312 |
|
6313 |
|
6314 |
|
6315 |
|
6316 | function addStatusesToSalesAddon(addon, status) {
|
6317 |
|
6318 | const addonStatusNotification = createStatusNotificationItemForPackageItem(status);
|
6319 | return createSalesAddonWithStatus(addon, addonStatusNotification);
|
6320 | }
|
6321 |
|
6322 |
|
6323 |
|
6324 |
|
6325 |
|
6326 | function findStatus(statuses, id) {
|
6327 | if (!statuses || statuses.length <= 0) {
|
6328 | return null;
|
6329 | }
|
6330 |
|
6331 | const statusIndex = statuses.findIndex(( |
6332 |
|
6333 |
|
6334 |
|
6335 | s => {
|
6336 | return s.packageItemId === id;
|
6337 | }));
|
6338 | if (statusIndex < 0) {
|
6339 | return null;
|
6340 | }
|
6341 |
|
6342 | const status = statuses[statusIndex].status;
|
6343 | statuses.splice(statusIndex, 1);
|
6344 | return status;
|
6345 | }
|
6346 |
|
6347 |
|
6348 |
|
6349 |
|
6350 | function createStatusNotificationItemForPackageItem(status) {
|
6351 | switch (status) {
|
6352 | case ActivationStatus.SUCCESS:
|
6353 | return { icon: 'check_circle', status: status, text: 'Activated' };
|
6354 | case ActivationStatus.WARNING:
|
6355 | return { icon: 'warning', status: status, text: 'Already Activated' };
|
6356 | default:
|
6357 | return { icon: 'error', status: status, text: 'Activation Errors' };
|
6358 | }
|
6359 | }
|
6360 |
|
6361 |
|
6362 |
|
6363 |
|
6364 | function createStatusNotificationItemForPackage(status) {
|
6365 | switch (status) {
|
6366 | case ActivationStatus.SUCCESS:
|
6367 | return { icon: 'check_circle', status: status, text: 'Activated' };
|
6368 | case ActivationStatus.WARNING:
|
6369 | return { icon: 'warning', status: status, text: 'Activation Warnings' };
|
6370 | default:
|
6371 | return { icon: 'error', status: status, text: 'Activation Errors Occured' };
|
6372 | }
|
6373 | }
|
6374 |
|
6375 |
|
6376 |
|
6377 |
|
6378 | function convertNumberToActivationStatus(number) {
|
6379 | switch (number) {
|
6380 | case 0:
|
6381 | return ActivationStatus.SUCCESS;
|
6382 | case 1:
|
6383 | return ActivationStatus.WARNING;
|
6384 | default:
|
6385 | return ActivationStatus.ERROR;
|
6386 | }
|
6387 | }
|
6388 |
|
6389 |
|
6390 |
|
6391 |
|
6392 |
|
6393 |
|
6394 | const ListIndent = {
|
6395 | INDENT_ZERO: 'indent-zero',
|
6396 | INDENT_ONE: 'indent-one',
|
6397 | INDENT_TWO: 'indent-two',
|
6398 | };
|
6399 | class VaPackageDropdownItemComponent {
|
6400 | constructor() {
|
6401 | this.enableDropdown = false;
|
6402 | this.indent = ListIndent.INDENT_ZERO;
|
6403 | this.itemToggled = new EventEmitter();
|
6404 | }
|
6405 | |
6406 |
|
6407 |
|
6408 | ngOnInit() {
|
6409 | }
|
6410 | |
6411 |
|
6412 |
|
6413 | toggleItem() {
|
6414 | this.itemToggled.emit(null);
|
6415 | }
|
6416 | |
6417 |
|
6418 |
|
6419 |
|
6420 | isActivatedStatus(status) {
|
6421 | return status === ActivationStatus.SUCCESS;
|
6422 | }
|
6423 | |
6424 |
|
6425 |
|
6426 |
|
6427 | isWarningStatus(status) {
|
6428 | return status === ActivationStatus.WARNING;
|
6429 | }
|
6430 | |
6431 |
|
6432 |
|
6433 |
|
6434 | isErrorStatus(status) {
|
6435 | return status === ActivationStatus.ERROR;
|
6436 | }
|
6437 | }
|
6438 | VaPackageDropdownItemComponent.decorators = [
|
6439 | { type: Component, args: [{
|
6440 | selector: 'va-package-dropdown-item',
|
6441 | template: "<mat-list-item [ngClass]=\"indent\" class=\"va-dropdown-list-item\">\n <va-icon *ngIf=\"!secondaryIconUrl && !secondaryIconName; else dualIcon\" mat-list-avatar [name]=\"title\" [iconUrl]=\"iconUrl\" [diameter]=\"40\"></va-icon>\n <h3 mat-line class=\"va-dropdown-list-item__title\">{{ title }}\n <va-badge *ngIf=\"titleBadge\" small color=\"blue-solid\" class=\"va-dropdown-list-item__title-badge\">{{ titleBadge }}</va-badge>\n <span *ngIf=\"titleDescriptor\" class=\"va-dropdown-list-item__title-descriptor\">{{ titleDescriptor }}</span>\n </h3>\n <p class=\"package-dropdown-font\" mat-line>{{subtitle}}</p>\n\n <span *ngIf=\"!statusItem\" class=\"va-dropdown-list-item__layout\">\n <p class=\"va-dropdown-list-item__layout va-dropdown-list-item__notice\">{{ description }}</p>\n <ng-container *ngIf=\"enableDropdown; then dropdownButton\"></ng-container>\n </span>\n\n <span *ngIf=\"statusItem\" class=\"va-dropdown-list-item__layout va-dropdown-list-item__status\">\n <div [ngClass]=\"{\n 'activated': isActivatedStatus(statusItem.status),\n 'warning': isWarningStatus(statusItem.status),\n 'error': isErrorStatus(statusItem.status)}\">\n <mat-icon>{{statusItem.icon}}</mat-icon>\n </div>\n <p class=\"va-dropdown-list-item__notice\"\n [ngClass]=\"{\n 'activated': isActivatedStatus(statusItem.status),\n 'warning': isWarningStatus(statusItem.status),\n 'error': isErrorStatus(statusItem.status)}\">\n {{ statusItem.text }}\n </p>\n <ng-container *ngIf=\"enableDropdown; then dropdownButton\"></ng-container>\n </span>\n</mat-list-item>\n\n\n<ng-template #dropdownButton>\n <button *ngIf=\"enableDropdown\" mat-icon-button type=\"button\" (click)=\"toggleItem()\">\n <mat-icon mat-list-icon\n class=\"dropdown-icon\"\n [ngClass]=\"{'dropdown-icon-rotate-up': !toggleValue, 'dropdown-icon-rotate-down': toggleValue}\">\n keyboard_arrow_down\n </mat-icon>\n </button>\n</ng-template>\n\n<ng-template #dualIcon>\n <div class=\"dual-icon\">\n <va-icon mat-list-avatar [iconUrl]=\"iconUrl\" [name]=\"title\" [diameter]=\"40\"></va-icon>\n <va-icon mat-list-avatar class=\"secondary-icon\" [iconUrl]=\"secondaryIconUrl\" [diameter]=\"20\" [name]=\"secondaryIconName\"></va-icon>\n </div>\n</ng-template>\n",
|
6442 | styles: [".va-dropdown-list-item{border-bottom:1px solid rgba(0,0,0,.12)}mat-list-item .va-dropdown-list-item__title{font-weight:700}.va-dropdown-list-item__title-badge{padding-bottom:4px}.indent-one{padding-left:30px}.va-dropdown-list-item__title-descriptor{font-size:11px;font-weight:700;font-style:italic}.indent-two{padding-left:30px}.indent-two .mat-list-avatar{margin-left:40px}.dual-icon{position:relative;display:inline-block;-webkit-box-ordinal-group:0;order:-1;margin-right:16px}.dual-icon .secondary-icon{position:absolute;border-radius:50%;bottom:-24px;right:-24px}.va-dropdown-list-item__layout{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-box-align:center;align-items:center}.va-dropdown-list-item__layout .va-dropdown-list-item__notice{width:-webkit-max-content;width:-moz-max-content;width:max-content;font-style:italic}@media screen and (max-width:500px){.va-dropdown-list-item__layout p{display:none}}.va-dropdown-list-item__layout mat-icon{padding:0}.va-dropdown-list-item__layout button{padding:0;min-width:0}.va-dropdown-list-item__layout button .dropdown-icon{color:rgba(0,0,0,.54)}.va-dropdown-list-item__layout button .dropdown-icon-rotate-down{-webkit-transform:rotate(180deg);transform:rotate(180deg);-webkit-transition:.4s;transition:.4s;pointer-events:none}.va-dropdown-list-item__layout button .dropdown-icon-rotate-up{-webkit-transform:rotate(0);transform:rotate(0);-webkit-transition:.4s;transition:.4s;pointer-events:none}.va-dropdown-list-item__status{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-box-align:center;align-items:center}.va-dropdown-list-item__status p{padding-left:6px;font-size:14px;white-space:nowrap}.va-dropdown-list-item__status .activated{color:#4caf50}.va-dropdown-list-item__status .warning{color:#ffa000}.va-dropdown-list-item__status .error{color:#c62828}", ".package-dropdown-font,.product-dropdown-font{color:rgba(0,0,0,.54);font-size:14px;font-weight:400}.package-list-container{border-top:1px solid rgba(0,0,0,.12);padding:0}.package-list-container mat-list{padding:0}.package-dropdown-stencil-display{display:-webkit-box;display:flex;width:100%;-webkit-box-flex:1;flex-grow:1}.package-dropdown-stencil-display va-icon{margin-right:20px}.package-dropdown-stencil-display .stencil-text{width:inherit;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-pack:center;justify-content:center}.package-dropdown-stencil-display .stencil-text .stencil-title{height:32px;width:40%;margin-bottom:5px!important;margin-top:0!important}.package-dropdown-stencil-display .stencil-text .stencil-tagline{height:32px;width:inherit}.product-or-addon-list{background-color:rgba(0,0,0,.04);overflow:hidden}"]
|
6443 | }] }
|
6444 | ];
|
6445 | VaPackageDropdownItemComponent.propDecorators = {
|
6446 | title: [{ type: Input }],
|
6447 | titleBadge: [{ type: Input }],
|
6448 | titleDescriptor: [{ type: Input }],
|
6449 | iconUrl: [{ type: Input }],
|
6450 | secondaryIconUrl: [{ type: Input }],
|
6451 | secondaryIconName: [{ type: Input }],
|
6452 | subtitle: [{ type: Input }],
|
6453 | statusItem: [{ type: Input }],
|
6454 | enableDropdown: [{ type: Input }],
|
6455 | indent: [{ type: Input }],
|
6456 | toggleValue: [{ type: Input }],
|
6457 | description: [{ type: Input }],
|
6458 | itemToggled: [{ type: Output }]
|
6459 | };
|
6460 | if (false) {
|
6461 |
|
6462 | VaPackageDropdownItemComponent.prototype.title;
|
6463 |
|
6464 | VaPackageDropdownItemComponent.prototype.titleBadge;
|
6465 |
|
6466 | VaPackageDropdownItemComponent.prototype.titleDescriptor;
|
6467 |
|
6468 | VaPackageDropdownItemComponent.prototype.iconUrl;
|
6469 |
|
6470 | VaPackageDropdownItemComponent.prototype.secondaryIconUrl;
|
6471 |
|
6472 | VaPackageDropdownItemComponent.prototype.secondaryIconName;
|
6473 |
|
6474 | VaPackageDropdownItemComponent.prototype.subtitle;
|
6475 |
|
6476 | VaPackageDropdownItemComponent.prototype.statusItem;
|
6477 |
|
6478 | VaPackageDropdownItemComponent.prototype.enableDropdown;
|
6479 |
|
6480 | VaPackageDropdownItemComponent.prototype.indent;
|
6481 |
|
6482 | VaPackageDropdownItemComponent.prototype.toggleValue;
|
6483 |
|
6484 | VaPackageDropdownItemComponent.prototype.description;
|
6485 |
|
6486 | VaPackageDropdownItemComponent.prototype.itemToggled;
|
6487 | }
|
6488 |
|
6489 |
|
6490 |
|
6491 |
|
6492 |
|
6493 |
|
6494 |
|
6495 |
|
6496 | function OrderLengthsForToggling() { }
|
6497 | if (false) {
|
6498 |
|
6499 | OrderLengthsForToggling.prototype.packages;
|
6500 |
|
6501 | OrderLengthsForToggling.prototype.products;
|
6502 | }
|
6503 | class VaPackageDropdownComponent {
|
6504 | |
6505 |
|
6506 |
|
6507 | constructor(translateService) {
|
6508 | this.translateService = translateService;
|
6509 |
|
6510 | this.singularDropdown = false;
|
6511 |
|
6512 | this.hidePricing = false;
|
6513 | this.packageProductIndent = ListIndent.INDENT_ONE;
|
6514 | this.packageAddonWithoutProductIndent = ListIndent.INDENT_ONE;
|
6515 | this.packageAddonWithProductIndent = ListIndent.INDENT_TWO;
|
6516 | this.productAddonIndent = ListIndent.INDENT_ONE;
|
6517 | this.packages$$ = new ReplaySubject(1);
|
6518 | this.products$$ = new ReplaySubject(1);
|
6519 | this.standAloneProducts$$ = new ReplaySubject(1);
|
6520 | this.statuses$$ = new BehaviorSubject([]);
|
6521 | this.addons$$ = new ReplaySubject(1);
|
6522 | this.orderItemLengths$$ = new BehaviorSubject(( ({
|
6523 | packages: 0,
|
6524 | products: 0
|
6525 | })));
|
6526 | this.packageToggles = [];
|
6527 | this.productToggles = [];
|
6528 | this.translateService.setTranslation('en', En.en, true);
|
6529 | }
|
6530 |
|
6531 | |
6532 |
|
6533 |
|
6534 |
|
6535 | set packages(packages) {
|
6536 | this.packages$$.next(packages);
|
6537 | }
|
6538 |
|
6539 | |
6540 |
|
6541 |
|
6542 |
|
6543 | set products(products) {
|
6544 | this.products$$.next(products);
|
6545 | }
|
6546 |
|
6547 | |
6548 |
|
6549 |
|
6550 |
|
6551 | set standAloneProducts(standAloneProducts) {
|
6552 | this.standAloneProducts$$.next(standAloneProducts);
|
6553 | }
|
6554 |
|
6555 | |
6556 |
|
6557 |
|
6558 |
|
6559 | set statuses(statuses) {
|
6560 | this.statuses$$.next(statuses);
|
6561 | }
|
6562 |
|
6563 | |
6564 |
|
6565 |
|
6566 |
|
6567 | set addons(addons) {
|
6568 | this.addons$$.next(addons);
|
6569 | }
|
6570 | |
6571 |
|
6572 |
|
6573 | ngOnInit() {
|
6574 |
|
6575 | const packages$ = this.packages$$.pipe(filter(( |
6576 |
|
6577 |
|
6578 |
|
6579 | packages => packages !== null)));
|
6580 |
|
6581 | const products$ = this.products$$.pipe(filter(( |
6582 |
|
6583 |
|
6584 |
|
6585 | products => products !== null)));
|
6586 |
|
6587 | const addons$ = this.addons$$.pipe(filter(( |
6588 |
|
6589 |
|
6590 |
|
6591 | addons => addons !== null)));
|
6592 |
|
6593 | const salesPackage$ = zip(packages$, products$, addons$).pipe(tap(( |
6594 |
|
6595 |
|
6596 |
|
6597 | ([packages, products, _]) => {
|
6598 | this.orderItemLengths$$.next(( ({
|
6599 | packages: packages.length,
|
6600 | products: products.length
|
6601 | })));
|
6602 | })), map(( |
6603 |
|
6604 |
|
6605 |
|
6606 | ([packages, products, addons]) => buildSalesPackages(packages, products, addons))));
|
6607 | this.salesPackages$ = combineLatest(salesPackage$, this.statuses$$).pipe(map(( |
6608 |
|
6609 |
|
6610 |
|
6611 | ([salesPackages, statuses]) => addStatusesToSalesPackages(salesPackages, statuses))), startWith([]));
|
6612 | this.salesProducts$ = combineLatest(this.standAloneProducts$$, this.statuses$$).pipe(filter(( |
6613 |
|
6614 |
|
6615 |
|
6616 | ([products, _]) => products !== null)), map(( |
6617 |
|
6618 |
|
6619 |
|
6620 | ([products, statuses]) => {
|
6621 | return products.map(( |
6622 |
|
6623 |
|
6624 |
|
6625 | p => {
|
6626 |
|
6627 | const addons = p.addons || null;
|
6628 |
|
6629 | const salesProducts = buildSalesProductFromProduct(p, addons);
|
6630 | return addStatusesToSalesProduct(salesProducts, statuses);
|
6631 | }));
|
6632 | })), startWith([]));
|
6633 | this.templateData$ = combineLatest(this.salesPackages$, this.salesProducts$).pipe(map(( |
6634 |
|
6635 |
|
6636 |
|
6637 | ([packages, products]) => ({ packages: packages, products: products }))));
|
6638 | }
|
6639 | |
6640 |
|
6641 |
|
6642 | openAllDropdowns() {
|
6643 | for (let x = 0; x < this.orderItemLengths$$.getValue().packages; x++) {
|
6644 | this.packageToggles[x] = true;
|
6645 | }
|
6646 | for (let x = 0; x < this.orderItemLengths$$.getValue().products; x++) {
|
6647 | this.productToggles[x] = true;
|
6648 | }
|
6649 | }
|
6650 | |
6651 |
|
6652 |
|
6653 |
|
6654 | togglePackage(indexToToggle) {
|
6655 | if (this.singularDropdown) {
|
6656 |
|
6657 | const openedIndex = this.packageToggles.findIndex(( |
6658 |
|
6659 |
|
6660 |
|
6661 | value => value === true));
|
6662 | if (openedIndex !== indexToToggle) {
|
6663 | this.packageToggles[openedIndex] = false;
|
6664 | }
|
6665 |
|
6666 | const productOpenedIndex = this.productToggles.findIndex(( |
6667 |
|
6668 |
|
6669 |
|
6670 | value => value === true));
|
6671 | if (productOpenedIndex > -1) {
|
6672 | this.productToggles[productOpenedIndex] = false;
|
6673 | }
|
6674 | }
|
6675 | this.packageToggles[indexToToggle] = !this.packageToggles[indexToToggle];
|
6676 | }
|
6677 | |
6678 |
|
6679 |
|
6680 |
|
6681 | toggleProduct(indexToToggle) {
|
6682 | if (this.singularDropdown) {
|
6683 |
|
6684 | const openedIndex = this.productToggles.findIndex(( |
6685 |
|
6686 |
|
6687 |
|
6688 | value => value === true));
|
6689 | if (openedIndex !== indexToToggle) {
|
6690 | this.productToggles[openedIndex] = false;
|
6691 | }
|
6692 |
|
6693 | const packageOpenedIndex = this.packageToggles.findIndex(( |
6694 |
|
6695 |
|
6696 |
|
6697 | value => value === true));
|
6698 | if (packageOpenedIndex > -1) {
|
6699 | this.packageToggles[packageOpenedIndex] = false;
|
6700 | }
|
6701 | }
|
6702 | this.productToggles[indexToToggle] = !this.productToggles[indexToToggle];
|
6703 | }
|
6704 | |
6705 |
|
6706 |
|
6707 |
|
6708 | standAloneProductDescription(product) {
|
6709 | if (product.addons && product.addons.length > 0) {
|
6710 |
|
6711 | let description = `Contains ${product.addons.length}`;
|
6712 | description = product.addons.length === 1 ? `${description} Addon` : `${description} Addons`;
|
6713 | return description;
|
6714 | }
|
6715 | return '';
|
6716 | }
|
6717 | |
6718 |
|
6719 |
|
6720 |
|
6721 | standAloneProductWithParentDescription(product) {
|
6722 | if (!product.parentInfo) {
|
6723 | return '';
|
6724 | }
|
6725 | return `(Requires ${product.parentInfo.parentName})`;
|
6726 | }
|
6727 | |
6728 |
|
6729 |
|
6730 |
|
6731 | packageDescription(pkg) {
|
6732 |
|
6733 | const hasProducts = pkg.products && pkg.products.length > 0;
|
6734 | if (!hasProducts && pkg.totalAddons === 0) {
|
6735 | return 'No Items in Package';
|
6736 | }
|
6737 |
|
6738 | let description = '';
|
6739 |
|
6740 | const hasOneProduct = pkg.products && pkg.products.length === 1;
|
6741 | if (hasProducts || pkg.totalAddons > 0) {
|
6742 | description = 'Contains ';
|
6743 | }
|
6744 | if (hasProducts) {
|
6745 | description = `${description} ${pkg.products.length}`;
|
6746 | description = hasOneProduct ? `${description} Product` : `${description} Products`;
|
6747 | }
|
6748 | if (hasProducts && pkg.totalAddons > 0) {
|
6749 | description = `${description} & ${pkg.totalAddons}`;
|
6750 | description = pkg.totalAddons === 1 ? `${description} Addon` : `${description} Addons`;
|
6751 | }
|
6752 | return description;
|
6753 | }
|
6754 | }
|
6755 | VaPackageDropdownComponent.decorators = [
|
6756 | { type: Component, args: [{
|
6757 | selector: 'va-package-dropdown',
|
6758 | animations: [
|
6759 | trigger('listAnimationStart', [
|
6760 | state('void', style({ height: '0px' })),
|
6761 | state('*', style({ height: '*' })),
|
6762 | transition('void => *', [animate('0.25s ease')]),
|
6763 | transition('* => void', [animate('0.25s ease')])
|
6764 | ])
|
6765 | ],
|
6766 | template: "<ng-container *ngIf=\"templateData$ | async as data\">\n <mat-card class=\"package-list-container\" *ngIf=\"data.products?.length > 0 || data.packages?.length > 0 else loading\">\n <mat-list>\n <div class=\"package-list\" *ngFor=\"let package of data.packages; let packageIndex = index\">\n\n <va-package-dropdown-item\n [title]=\"package.name\"\n [iconUrl]=\"package.icon\"\n [subtitle]=\"hidePricing ? '' : package.formattedPrices\"\n [statusItem]=\"package.activationStatus\"\n [description]=\"packageDescription(package)\"\n [enableDropdown]=\"package.products?.length > 0 || package.addonsWithNoParent?.length > 0\"\n [toggleValue]=\"packageToggles[packageIndex]\"\n (itemToggled)=\"togglePackage(packageIndex)\"\n ></va-package-dropdown-item>\n\n <mat-list class=\"product-or-addon-list package-dropdown-font\" *ngIf=\"packageToggles[packageIndex]\"\n [@listAnimationStart]>\n <div *ngFor=\"let product of package.products\">\n <va-package-dropdown-item\n [title]=\"product.name\"\n [subtitle]=\"product.tagline\"\n [titleBadge]=\"product.editionName\"\n [iconUrl]=\"product.icon\"\n [statusItem]=\"product.activationStatus\"\n [indent]=\"packageProductIndent\"\n ></va-package-dropdown-item>\n\n <va-package-dropdown-item\n *ngFor=\"let addon of product.addons\"\n [title]=\"addon.name\"\n [subtitle]=\"addon.tagline\"\n [iconUrl]=\"addon.icon\"\n [statusItem]=\"addon.activationStatus\"\n [indent]=\"packageAddonWithProductIndent\"\n ></va-package-dropdown-item>\n </div>\n\n <va-package-dropdown-item\n *ngFor=\"let addon of package.addonsWithNoParent\"\n [title]=\"addon.name\"\n [titleDescriptor]=\"'FRONTEND.STORE.REQUIRES_DESCRIPTOR' | translate: {requirementName: addon.parentName}\"\n [subtitle]=\"addon.tagline\"\n [iconUrl]=\"addon.icon\"\n [secondaryIconUrl]=\"addon.parentIcon\"\n [secondaryIconName]=\"addon.parentName\"\n [statusItem]=\"addon.activationStatus\"\n [indent]=\"packageAddonWithoutProductIndent\"\n ></va-package-dropdown-item>\n </mat-list>\n </div>\n\n <div class=\"product-list\" *ngFor=\"let product of data.products; let productIndex = index\">\n <va-package-dropdown-item\n [title]=\"product.name\"\n [titleBadge]=\"product.editionName\"\n [titleDescriptor]=\"standAloneProductWithParentDescription(product)\"\n [iconUrl]=\"product.icon\"\n [subtitle]=\"hidePricing ? '' : product.formattedPrices\"\n [secondaryIconUrl]=\"product.parentInfo?.parentIconUrl\"\n [secondaryIconName]=\"product.parentInfo?.parentName\"\n [statusItem]=\"product.activationStatus\"\n [description]=\"standAloneProductDescription(product)\"\n [enableDropdown]=\"product.addons?.length > 0\"\n [toggleValue]=\"productToggles[productIndex]\"\n (itemToggled)=\"toggleProduct(productIndex)\"\n ></va-package-dropdown-item>\n\n <mat-list class=\"product-or-addon-list product-dropdown-font\" *ngIf=\"productToggles[productIndex]\"\n [@listAnimationStart]>\n <va-package-dropdown-item\n *ngFor=\"let addon of product.addons\"\n [title]=\"addon.name\"\n [subtitle]=\"addon.tagline\"\n [iconUrl]=\"addon.icon\"\n [statusItem]=\"addon.activationStatus\"\n [indent]=\"productAddonIndent\"\n ></va-package-dropdown-item>\n </mat-list>\n </div>\n\n </mat-list>\n </mat-card>\n</ng-container>\n\n<ng-template #loading>\n <mat-card>\n <div class=\"package-dropdown-stencil-display\">\n <va-icon [iconUrl]=\"\"></va-icon>\n <div class=\"stencil-text\">\n <h1 class=\"stencil-title stencil-shimmer\"></h1>\n <span class=\"stencil-tagline stencil-shimmer\"></span>\n </div>\n </div>\n </mat-card>\n</ng-template>\n",
|
6767 | styles: [".package-dropdown-font,.product-dropdown-font{color:rgba(0,0,0,.54);font-size:14px;font-weight:400}.package-list-container{border-top:1px solid rgba(0,0,0,.12);padding:0}.package-list-container mat-list{padding:0}.package-dropdown-stencil-display{display:-webkit-box;display:flex;width:100%;-webkit-box-flex:1;flex-grow:1}.package-dropdown-stencil-display va-icon{margin-right:20px}.package-dropdown-stencil-display .stencil-text{width:inherit;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-pack:center;justify-content:center}.package-dropdown-stencil-display .stencil-text .stencil-title{height:32px;width:40%;margin-bottom:5px!important;margin-top:0!important}.package-dropdown-stencil-display .stencil-text .stencil-tagline{height:32px;width:inherit}.product-or-addon-list{background-color:rgba(0,0,0,.04);overflow:hidden}"]
|
6768 | }] }
|
6769 | ];
|
6770 |
|
6771 | VaPackageDropdownComponent.ctorParameters = () => [
|
6772 | { type: TranslateService }
|
6773 | ];
|
6774 | VaPackageDropdownComponent.propDecorators = {
|
6775 | packages: [{ type: Input }],
|
6776 | products: [{ type: Input }],
|
6777 | standAloneProducts: [{ type: Input }],
|
6778 | statuses: [{ type: Input }],
|
6779 | addons: [{ type: Input }],
|
6780 | singularDropdown: [{ type: Input }],
|
6781 | hidePricing: [{ type: Input }]
|
6782 | };
|
6783 | if (false) {
|
6784 |
|
6785 | VaPackageDropdownComponent.prototype.singularDropdown;
|
6786 |
|
6787 | VaPackageDropdownComponent.prototype.hidePricing;
|
6788 |
|
6789 | VaPackageDropdownComponent.prototype.packageProductIndent;
|
6790 |
|
6791 | VaPackageDropdownComponent.prototype.packageAddonWithoutProductIndent;
|
6792 |
|
6793 | VaPackageDropdownComponent.prototype.packageAddonWithProductIndent;
|
6794 |
|
6795 | VaPackageDropdownComponent.prototype.productAddonIndent;
|
6796 |
|
6797 | VaPackageDropdownComponent.prototype.packages$$;
|
6798 |
|
6799 | VaPackageDropdownComponent.prototype.products$$;
|
6800 |
|
6801 | VaPackageDropdownComponent.prototype.standAloneProducts$$;
|
6802 |
|
6803 | VaPackageDropdownComponent.prototype.statuses$$;
|
6804 |
|
6805 | VaPackageDropdownComponent.prototype.addons$$;
|
6806 |
|
6807 | VaPackageDropdownComponent.prototype.orderItemLengths$$;
|
6808 |
|
6809 | VaPackageDropdownComponent.prototype.templateData$;
|
6810 |
|
6811 | VaPackageDropdownComponent.prototype.salesPackages$;
|
6812 |
|
6813 | VaPackageDropdownComponent.prototype.salesProducts$;
|
6814 |
|
6815 | VaPackageDropdownComponent.prototype.packageToggles;
|
6816 |
|
6817 | VaPackageDropdownComponent.prototype.productToggles;
|
6818 | |
6819 |
|
6820 |
|
6821 |
|
6822 | VaPackageDropdownComponent.prototype.translateService;
|
6823 | }
|
6824 |
|
6825 |
|
6826 |
|
6827 |
|
6828 |
|
6829 | class VaPackageDropdownModule {
|
6830 | }
|
6831 | VaPackageDropdownModule.decorators = [
|
6832 | { type: NgModule, args: [{
|
6833 | imports: [
|
6834 | CommonModule,
|
6835 | MatButtonModule,
|
6836 | MatCardModule,
|
6837 | MatListModule$1,
|
6838 | MatIconModule,
|
6839 | VaIconModule,
|
6840 | VaBadgeModule,
|
6841 | TranslateModule
|
6842 | ],
|
6843 | declarations: [VaPackageDropdownComponent, VaPackageDropdownItemComponent],
|
6844 | exports: [VaPackageDropdownComponent],
|
6845 | entryComponents: [VaPackageDropdownComponent]
|
6846 | },] }
|
6847 | ];
|
6848 |
|
6849 |
|
6850 |
|
6851 |
|
6852 |
|
6853 | class VaProductDetailsComponent {
|
6854 | constructor() {
|
6855 | this.hasVerifiedContract = false;
|
6856 | this.canAccessContractPricing = false;
|
6857 | this.showActionButton = false;
|
6858 | this.showPricing = false;
|
6859 | this.showPricingAction = false;
|
6860 | this.loaded = true;
|
6861 | this.enableClicked = new EventEmitter();
|
6862 | this.addonSelected = new EventEmitter();
|
6863 | this.primaryPricingActionSelected = new EventEmitter();
|
6864 | this.pricingActionSelected = new EventEmitter();
|
6865 | }
|
6866 | |
6867 |
|
6868 |
|
6869 | getAddons() {
|
6870 | if (!this._addons) {
|
6871 | this._addons = this.product.addons.map(( |
6872 |
|
6873 |
|
6874 |
|
6875 | (addon) => Addon.fromApi(addon)));
|
6876 | }
|
6877 | return this._addons;
|
6878 | }
|
6879 | |
6880 |
|
6881 |
|
6882 | getActionLabel() {
|
6883 | if (this.product.isArchived) {
|
6884 | return 'Enable';
|
6885 | }
|
6886 | return 'Enabled';
|
6887 | }
|
6888 | |
6889 |
|
6890 |
|
6891 | get price() {
|
6892 |
|
6893 |
|
6894 | let prices = [];
|
6895 | if (this.product.wholesalePrice !== CONTACT_SALES && this.product.wholesalePrice != null) {
|
6896 | prices = [{
|
6897 | price: this.product.wholesalePrice,
|
6898 | frequency: this.product.billingFrequency
|
6899 | }];
|
6900 | }
|
6901 | return {
|
6902 | currency: this.product.currency,
|
6903 | prices: prices
|
6904 | };
|
6905 | }
|
6906 | |
6907 |
|
6908 |
|
6909 |
|
6910 | onAddonSelected(addonId) {
|
6911 | this.addonSelected.emit(addonId);
|
6912 | }
|
6913 | }
|
6914 | VaProductDetailsComponent.decorators = [
|
6915 | { type: Component, args: [{
|
6916 | selector: 'va-product-details',
|
6917 | template: "<div class=\"page\">\n <va-header-container [iconUrl]=\"product.iconUrl\"\n [title]=\"product.name\"\n [tagline]=\"product.tagline\"\n [chipLabels]=\"product.getLmiCategoryNames()\"\n [pricing]=\"price\"\n [pricingLabel]=\"'Wholesale Price'\"\n [primaryPricingActionLabel]=\"primaryPricingActionLabel\"\n [pricingActionLabel]=\"pricingActionLabel\"\n [pricingActionEnabled]=\"showPricingAction\"\n [actionLabel]=\"getActionLabel()\"\n [actionEnabled]=\"product.isArchived\"\n [showAction]=\"showActionButton\"\n [showPricing]=\"showPricing\"\n [billedProduct]=\"billedProduct\"\n [hasVerifiedContract]=\"hasVerifiedContract\"\n [loaded]=\"loaded\"\n (primaryPricingActionSelected)=\"primaryPricingActionSelected.emit()\"\n (pricingActionSelected)=\"pricingActionSelected.emit()\"\n (actionSelected)=\"enableClicked.emit()\">\n </va-header-container>\n <div class=\"product-details product-content\">\n <div class=\"left-column\">\n <ng-container *ngIf=\"product.description || product.keySellingPoints\">\n <va-selling-info [description]=\"product.description\"\n [keySellingPoints]=\"product.keySellingPoints\"></va-selling-info>\n </ng-container>\n <section *ngIf=\"product.addons?.length > 0\">\n <h2 class=\"va-component-title\">Add-Ons</h2>\n <va-addon-list (addonSelected)=\"onAddonSelected($event)\"\n [addons]=\"getAddons()\"\n [showPricing]=\"showPricing\"\n [hasVerifiedContract]=\"hasVerifiedContract\"\n [canAccessContractPricing]=\"canAccessContractPricing\"\n [partnerID]=\"partnerID\">\n </va-addon-list>\n </section>\n\n <section *ngIf=\"product.faqs?.length > 0\">\n <h2 class=\"va-component-title\">FAQs</h2>\n <va-faqs [faqs]=\"product.faqs\"></va-faqs>\n </section>\n </div>\n\n <div class=\"right-column\">\n <section *ngIf=\"product.restrictions?.country?.whitelist?.length > 0\">\n <supported-countries [countryCodes]=\"product.restrictions.country.whitelist\"></supported-countries>\n </section>\n\n <section *ngIf=\"product.screenshotUrls?.length > 0\">\n <h2 class=\"va-component-title\">Gallery</h2>\n <va-image-gallery [imageUrls]=\"product.screenshotUrls\"></va-image-gallery>\n </section>\n\n <section *ngIf=\"product.files?.length > 0\">\n <h2 class=\"va-component-title\">Files</h2>\n <va-files [files]=\"product.files\"></va-files>\n </section>\n </div>\n </div>\n</div>\n",
|
6918 | styles: [":host{display:block;font-size:14px;line-height:1.4}:host *{box-sizing:border-box}.va-component-title{font-size:24px;font-weight:300;margin-top:0}@media screen and (min-width:600px){.va-component-title{font-size:32px}}img{max-width:100%}va-icon{display:inline-block}.sales-person-details{max-height:430px;overflow:hidden}.page{position:relative;margin:0 auto 20px;background:#fff;color:#212121;box-shadow:0 3px 10px rgba(33,33,33,.3);overflow:hidden;font-size:16px}.page .item-amount{color:#9e9e9e;font-size:14px;text-align:right;margin:0 24px 8px}section{padding:24px}.left-column{width:66%}@media screen and (max-width:600px){.left-column{width:100%}}.right-column{width:34%}.product-content{display:-webkit-box;display:flex}@media screen and (max-width:600px){.right-column{width:100%}.product-content{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}}"]
|
6919 | }] }
|
6920 | ];
|
6921 | VaProductDetailsComponent.propDecorators = {
|
6922 | product: [{ type: Input }],
|
6923 | billedProduct: [{ type: Input }],
|
6924 | hasVerifiedContract: [{ type: Input }],
|
6925 | canAccessContractPricing: [{ type: Input }],
|
6926 | showActionButton: [{ type: Input }],
|
6927 | showPricing: [{ type: Input }],
|
6928 | primaryPricingActionLabel: [{ type: Input }],
|
6929 | pricingActionLabel: [{ type: Input }],
|
6930 | showPricingAction: [{ type: Input }],
|
6931 | loaded: [{ type: Input }],
|
6932 | partnerID: [{ type: Input }],
|
6933 | enableClicked: [{ type: Output }],
|
6934 | addonSelected: [{ type: Output }],
|
6935 | primaryPricingActionSelected: [{ type: Output }],
|
6936 | pricingActionSelected: [{ type: Output }]
|
6937 | };
|
6938 | if (false) {
|
6939 |
|
6940 | VaProductDetailsComponent.prototype.product;
|
6941 |
|
6942 | VaProductDetailsComponent.prototype.billedProduct;
|
6943 |
|
6944 | VaProductDetailsComponent.prototype.hasVerifiedContract;
|
6945 |
|
6946 | VaProductDetailsComponent.prototype.canAccessContractPricing;
|
6947 |
|
6948 | VaProductDetailsComponent.prototype.showActionButton;
|
6949 |
|
6950 | VaProductDetailsComponent.prototype.showPricing;
|
6951 |
|
6952 | VaProductDetailsComponent.prototype.primaryPricingActionLabel;
|
6953 |
|
6954 | VaProductDetailsComponent.prototype.pricingActionLabel;
|
6955 |
|
6956 | VaProductDetailsComponent.prototype.showPricingAction;
|
6957 |
|
6958 | VaProductDetailsComponent.prototype.loaded;
|
6959 |
|
6960 | VaProductDetailsComponent.prototype.partnerID;
|
6961 |
|
6962 | VaProductDetailsComponent.prototype.enableClicked;
|
6963 |
|
6964 | VaProductDetailsComponent.prototype.addonSelected;
|
6965 |
|
6966 | VaProductDetailsComponent.prototype.primaryPricingActionSelected;
|
6967 |
|
6968 | VaProductDetailsComponent.prototype.pricingActionSelected;
|
6969 | |
6970 |
|
6971 |
|
6972 |
|
6973 | VaProductDetailsComponent.prototype._addons;
|
6974 | }
|
6975 |
|
6976 |
|
6977 |
|
6978 |
|
6979 |
|
6980 | class VaProductDetailsModule {
|
6981 | }
|
6982 | VaProductDetailsModule.decorators = [
|
6983 | { type: NgModule, args: [{
|
6984 | imports: [
|
6985 | VaImageGalleryModule, CommonModule, VaIconModule,
|
6986 | VaPricingModule, VaFilesModule, VaFaqsModule, VaSellingInfoModule,
|
6987 | VaHeaderContainerModule, VaSafeHtmlModule, VaAddonListModule, RestrictionsModule
|
6988 | ],
|
6989 | declarations: [VaProductDetailsComponent],
|
6990 | exports: [VaProductDetailsComponent],
|
6991 | entryComponents: [VaProductDetailsComponent]
|
6992 | },] }
|
6993 | ];
|
6994 |
|
6995 |
|
6996 |
|
6997 |
|
6998 |
|
6999 | class ResellerItem {
|
7000 | |
7001 |
|
7002 |
|
7003 | constructor(data) {
|
7004 | this.quantity = 1;
|
7005 | data = data || {};
|
7006 | Object.assign(this, data);
|
7007 | }
|
7008 | }
|
7009 | if (false) {
|
7010 |
|
7011 | ResellerItem.prototype.appId;
|
7012 |
|
7013 | ResellerItem.prototype.addonId;
|
7014 |
|
7015 | ResellerItem.prototype.name;
|
7016 |
|
7017 | ResellerItem.prototype.icon;
|
7018 |
|
7019 | ResellerItem.prototype.tagline;
|
7020 |
|
7021 | ResellerItem.prototype.headerImage;
|
7022 |
|
7023 | ResellerItem.prototype.currency;
|
7024 |
|
7025 | ResellerItem.prototype.price;
|
7026 |
|
7027 | ResellerItem.prototype.billingFrequency;
|
7028 |
|
7029 | ResellerItem.prototype.lmiCategories;
|
7030 |
|
7031 | ResellerItem.prototype.enabled;
|
7032 |
|
7033 | ResellerItem.prototype.isCustom;
|
7034 |
|
7035 | ResellerItem.prototype.orderForm;
|
7036 |
|
7037 | ResellerItem.prototype.quantity;
|
7038 |
|
7039 | ResellerItem.prototype.allowMultipleActivations;
|
7040 |
|
7041 | ResellerItem.prototype.usesCustomizationForm;
|
7042 |
|
7043 | ResellerItem.prototype.usesActivationSpecificEntryUrl;
|
7044 |
|
7045 | ResellerItem.prototype.entryUrl;
|
7046 |
|
7047 | ResellerItem.prototype.restrictions;
|
7048 |
|
7049 | ResellerItem.prototype.activationRequiresApproval;
|
7050 |
|
7051 | ResellerItem.prototype.billingId;
|
7052 |
|
7053 | ResellerItem.prototype.usesEditions;
|
7054 |
|
7055 | ResellerItem.prototype.editionIds;
|
7056 |
|
7057 | ResellerItem.prototype.suggestedRetailPrice;
|
7058 |
|
7059 | ResellerItem.prototype.editionId;
|
7060 |
|
7061 | ResellerItem.prototype.trialConfiguration;
|
7062 | }
|
7063 |
|
7064 |
|
7065 |
|
7066 |
|
7067 |
|
7068 | class CheckboxField extends FieldBase {
|
7069 | constructor() {
|
7070 | super(...arguments);
|
7071 | this.controlType = 'checkbox';
|
7072 | }
|
7073 | }
|
7074 | if (false) {
|
7075 |
|
7076 | CheckboxField.prototype.controlType;
|
7077 | }
|
7078 |
|
7079 |
|
7080 |
|
7081 |
|
7082 |
|
7083 |
|
7084 |
|
7085 |
|
7086 | function Option() { }
|
7087 | if (false) {
|
7088 |
|
7089 | Option.prototype.value;
|
7090 |
|
7091 | Option.prototype.label;
|
7092 |
|
7093 | Option.prototype.disabled;
|
7094 | }
|
7095 |
|
7096 |
|
7097 |
|
7098 | function DropDownFieldOptions() { }
|
7099 | if (false) {
|
7100 |
|
7101 | DropDownFieldOptions.prototype.options;
|
7102 |
|
7103 | DropDownFieldOptions.prototype.allowMultiples;
|
7104 |
|
7105 | DropDownFieldOptions.prototype.allowDuplicates;
|
7106 |
|
7107 | DropDownFieldOptions.prototype.maxChoices;
|
7108 | }
|
7109 | class DropdownField extends FieldBase {
|
7110 | |
7111 |
|
7112 |
|
7113 | constructor(options) {
|
7114 | super(options);
|
7115 | this.controlType = 'dropdown';
|
7116 | this.options = [];
|
7117 | if (!!options.options && options.options.length > 0) {
|
7118 |
|
7119 |
|
7120 | if (typeof options.options[0] === 'string') {
|
7121 | if (options.allowMultiples) {
|
7122 |
|
7123 | this.options = options.options.map(( |
7124 |
|
7125 |
|
7126 |
|
7127 | (o) => ({ value: o, name: o })));
|
7128 | }
|
7129 | else {
|
7130 |
|
7131 | this.options = options.options.map(( |
7132 |
|
7133 |
|
7134 |
|
7135 | (o) => ({ value: o, label: o })));
|
7136 | }
|
7137 | }
|
7138 | else {
|
7139 | if (options.allowMultiples) {
|
7140 |
|
7141 | this.options = options.options.map(( |
7142 |
|
7143 |
|
7144 |
|
7145 | (o) => ({ value: o.value, name: o.label })));
|
7146 | }
|
7147 | else {
|
7148 |
|
7149 | this.options = options.options;
|
7150 | }
|
7151 | }
|
7152 | }
|
7153 | this.allowMultiples = !!options.allowMultiples;
|
7154 | this.allowDuplicates = !!options.allowDuplicates;
|
7155 | this.maxChoices = options.maxChoices ? options.maxChoices : 1;
|
7156 | this.validator = this.validatorBuilder();
|
7157 | }
|
7158 | |
7159 |
|
7160 |
|
7161 |
|
7162 | validatorBuilder() {
|
7163 |
|
7164 | const maxChoices = this.maxChoices;
|
7165 | return ( |
7166 |
|
7167 |
|
7168 |
|
7169 | (control) => {
|
7170 | if (Array.isArray(control.value) && maxChoices && control.value.length > maxChoices) {
|
7171 | return { overMaxChoices: true };
|
7172 | }
|
7173 | });
|
7174 | }
|
7175 | }
|
7176 | if (false) {
|
7177 |
|
7178 | DropdownField.prototype.controlType;
|
7179 |
|
7180 | DropdownField.prototype.options;
|
7181 |
|
7182 | DropdownField.prototype.allowMultiples;
|
7183 |
|
7184 | DropdownField.prototype.allowDuplicates;
|
7185 |
|
7186 | DropdownField.prototype.maxChoices;
|
7187 | }
|
7188 |
|
7189 |
|
7190 |
|
7191 |
|
7192 |
|
7193 |
|
7194 | const DEFAULT_NUM_FILES = 5;
|
7195 |
|
7196 |
|
7197 |
|
7198 | function FileUploadGroupFieldOptions() { }
|
7199 | if (false) {
|
7200 |
|
7201 | FileUploadGroupFieldOptions.prototype.fileType;
|
7202 |
|
7203 | FileUploadGroupFieldOptions.prototype.uploadUrl;
|
7204 |
|
7205 | FileUploadGroupFieldOptions.prototype.numFiles;
|
7206 | }
|
7207 | class FileUploadGroupField extends FieldBase {
|
7208 | |
7209 |
|
7210 |
|
7211 | constructor(options) {
|
7212 | super(options);
|
7213 | this.controlType = 'file';
|
7214 | if (!options.uploadUrl) {
|
7215 | throw new Error('uploadUrl is required.');
|
7216 | }
|
7217 | this.fileType = options.fileType || 'image';
|
7218 | this.numFiles = options.numFiles || DEFAULT_NUM_FILES;
|
7219 | this.uploadUrl = options.uploadUrl;
|
7220 | this.value = [];
|
7221 | }
|
7222 | }
|
7223 | if (false) {
|
7224 |
|
7225 | FileUploadGroupField.prototype.controlType;
|
7226 |
|
7227 | FileUploadGroupField.prototype.fileType;
|
7228 |
|
7229 | FileUploadGroupField.prototype.uploadUrl;
|
7230 |
|
7231 | FileUploadGroupField.prototype.numFiles;
|
7232 | }
|
7233 |
|
7234 |
|
7235 |
|
7236 |
|
7237 |
|
7238 | class TextareaField extends FieldBase {
|
7239 | constructor() {
|
7240 | super(...arguments);
|
7241 | this.controlType = 'textarea';
|
7242 | }
|
7243 | }
|
7244 | if (false) {
|
7245 |
|
7246 | TextareaField.prototype.controlType;
|
7247 | }
|
7248 |
|
7249 |
|
7250 |
|
7251 |
|
7252 |
|
7253 |
|
7254 |
|
7255 |
|
7256 | function TextBoxFieldOptions() { }
|
7257 | if (false) {
|
7258 |
|
7259 | TextBoxFieldOptions.prototype.textboxType;
|
7260 |
|
7261 | TextBoxFieldOptions.prototype.prefix;
|
7262 |
|
7263 | TextBoxFieldOptions.prototype.suffix;
|
7264 |
|
7265 | TextBoxFieldOptions.prototype.displayOnly;
|
7266 | }
|
7267 | class TextboxField extends FieldBase {
|
7268 | |
7269 |
|
7270 |
|
7271 | constructor(options) {
|
7272 | super(options);
|
7273 | this.controlType = 'textbox';
|
7274 | this.textboxType = options.textboxType || 'text';
|
7275 | this.prefix = options.prefix || '';
|
7276 | this.suffix = options.suffix || '';
|
7277 | this.regexValidator = options.regexValidator || '';
|
7278 | this.regexErrorMessage = options.regexErrorMessage || '';
|
7279 | this.displayOnly = options.displayOnly || false;
|
7280 | }
|
7281 | }
|
7282 | if (false) {
|
7283 |
|
7284 | TextboxField.prototype.controlType;
|
7285 |
|
7286 | TextboxField.prototype.textboxType;
|
7287 |
|
7288 | TextboxField.prototype.prefix;
|
7289 |
|
7290 | TextboxField.prototype.suffix;
|
7291 |
|
7292 | TextboxField.prototype.regexValidator;
|
7293 |
|
7294 | TextboxField.prototype.regexErrorMessage;
|
7295 |
|
7296 | TextboxField.prototype.displayOnly;
|
7297 | }
|
7298 |
|
7299 |
|
7300 |
|
7301 |
|
7302 |
|
7303 |
|
7304 |
|
7305 |
|
7306 | function User() { }
|
7307 | if (false) {
|
7308 |
|
7309 | User.prototype.userId;
|
7310 |
|
7311 | User.prototype.email;
|
7312 |
|
7313 | User.prototype.firstName;
|
7314 |
|
7315 | User.prototype.lastName;
|
7316 | }
|
7317 |
|
7318 |
|
7319 |
|
7320 | function VBCUserFieldOptions() { }
|
7321 | if (false) {
|
7322 |
|
7323 | VBCUserFieldOptions.prototype.users;
|
7324 | }
|
7325 | class VBCUserField extends DropdownField {
|
7326 | |
7327 |
|
7328 |
|
7329 | constructor(options) {
|
7330 | super({
|
7331 | id: options.id,
|
7332 | label: options.label,
|
7333 | required: options.required,
|
7334 | description: options.description,
|
7335 | options: getOptions(options.users),
|
7336 | disabled: options.disabled,
|
7337 | forOfficeUseOnly: options.forOfficeUseOnly
|
7338 | });
|
7339 | this.controlType = 'vbcuser';
|
7340 | }
|
7341 | }
|
7342 | if (false) {
|
7343 |
|
7344 | VBCUserField.prototype.controlType;
|
7345 | }
|
7346 |
|
7347 |
|
7348 |
|
7349 |
|
7350 | function getOptions(vbcUsers) {
|
7351 | if (vbcUsers && vbcUsers.length > 0) {
|
7352 | vbcUsers.sort(compareUsersByEmail);
|
7353 | return vbcUsers.map(( |
7354 |
|
7355 |
|
7356 |
|
7357 | user => {
|
7358 |
|
7359 | const labelString = createLabelString(user.firstName, user.lastName, user.email);
|
7360 | if (user.userId && user.email && user.firstName && user.lastName) {
|
7361 | return {
|
7362 | label: labelString,
|
7363 | value: JSON.stringify({ firstName: user.firstName, lastName: user.lastName, email: user.email, id: user.userId })
|
7364 | };
|
7365 | }
|
7366 | return { label: labelString, value: '', disabled: true };
|
7367 | }));
|
7368 | }
|
7369 | return [{ label: 'No Users — Please add one to this account', value: '', disabled: true }];
|
7370 | }
|
7371 |
|
7372 |
|
7373 |
|
7374 |
|
7375 |
|
7376 | function compareUsersByEmail(a, b) {
|
7377 | if (a == null) {
|
7378 | return -1;
|
7379 | }
|
7380 | if (b == null) {
|
7381 | return 1;
|
7382 | }
|
7383 | return a.email.localeCompare(b.email);
|
7384 | }
|
7385 |
|
7386 |
|
7387 |
|
7388 |
|
7389 |
|
7390 |
|
7391 | function createLabelString(firstName, lastName, email) {
|
7392 |
|
7393 | let returnString = '';
|
7394 | returnString += firstName ? firstName + ' ' : '';
|
7395 | returnString += lastName ? lastName + ' ' : '';
|
7396 | returnString += email ? `(${email})` : '';
|
7397 | return returnString;
|
7398 | }
|
7399 |
|
7400 |
|
7401 |
|
7402 |
|
7403 |
|
7404 |
|
7405 |
|
7406 |
|
7407 |
|
7408 |
|
7409 |
|
7410 |
|
7411 |
|
7412 |
|
7413 |
|
7414 |
|
7415 |
|
7416 |
|
7417 |
|
7418 |
|
7419 |
|
7420 | export { ActivationStatus, AddonDetailsComponent, AddonDropDownFormSectionData, AddonModule, BUSINESS_USER, CHECK_BOX, CONTACT_SALES, CardListStencilComponent, CardStencilComponent, CaseTransform, CheckboxField, DROP_DOWN, DetailsStencilComponent, DropDownFormSectionComponent, DropDownFormSectionData, DropdownField, FILES, FORM_FIELDS, FieldBase, FieldBuilderComponent, FieldComponent, FieldService, File, FileUploadGroupField, HeimdallServiceToken, LMI_CATEGORIES, LMI_CATEGORIES_BY_NAME, LMI_CATEGORY_MAP, ListStencilComponent, OrderFormComponent, OrderFormSectionComponent, OrderFormSectionData, Package, PackageDetails, Product, ProductOrderFormSectionData, ProductWithParent, ProductsNavV2Component, ResellerItem, RestrictionsModule, STOREFRONT_FILTER_NAME, SearchBarStencilComponent, StencilsModule, StoreCardComponent, StoreCardModule, StoreComponent, StoreModule, StoreService, StorefrontComponent, TEXT_AREA, TEXT_BOX, TextareaField, TextboxField, VBCUserField, VaAddonListComponent, VaAddonListModule, VaFaqsComponent, VaFaqsModule, VaFilesComponent, VaFilesModule, VaHeaderContainerComponent, VaHeaderContainerModule, VaOrderFormModule, VaPackageDetailsComponent, VaPackageDetailsModule, VaPackageDetailsV2Component, VaPackageDetailsV2Module, VaPackageDropdownComponent, VaPackageDropdownModule, VaPricingComponent, VaPricingModule, VaProductDetailsComponent, VaProductDetailsModule, VaProductsNavComponent, VaProductsNavModule, VaSalespersonDetailsComponent, VaSalespersonDetailsModule, VaSellingInfoComponent, VaSellingInfoModule, combineProductOrderWithContainedProducts, convertToPackageDetails, getUniqueProductAddonId, orderProductsAndAddons, HeimdallClient as ɵb, HeimdallClientModule as ɵc, HighlightPricingComponent as ɵd, TablePricingComponent as ɵe, OrderItemListComponent as ɵf, PricePipe as ɵg, FormatBillingFrequencyPipe as ɵh, OrderFormService as ɵi, OrderItemListService as ɵj, SupportedCountriesComponent as ɵk, VaPackageDetailsV2Component as ɵl, Sellable as ɵm, VaPackageDropdownItemComponent as ɵn };
|
7421 |
|