Thu Aug 13 2020
Copied to clipboard! Copy reply
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • 313
  • 314
  • 315
  • 316
  • 317
  • 318
  • 319
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 331
  • 332
  • 333
  • 334
  • 335
  • 336
  • 337
  • 338
  • 339
  • 340
  • 341
  • 342
  • 343
  • 344
  • 345
  • 346
  • 347
  • 348
  • 349
  • 350
  • 351
  • 352
  • 353
  • 354
  • 355
  • 356
  • 357
  • 358
  • 359
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • 366
  • 367
  • 368
  • 369
  • 370
  • 371
  • 372
  • 373
  • 374
  • 375
  • 376
  • 377
  • 378
  • 379
  • 380
  • 381
  • 382
  • 383
  • 384
  • 385
  • 386
  • 387
  • 388
  • 389
  • 390
  • 391
  • 392
  • 393
  • 394
  • 395
  • 396
  • 397
  • 398
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 408
  • 409
  • 410
  • 411
  • 412
  • 413
  • 414
  • 415
  • 416
  • 417
  • 418
  • 419
  • 420
  • 421
  • 422
  • 423
  • 424
  • 425
  • 426
  • 427
  • 428
  • 429
  • 430
  • 431
  • 432
  • 433
  • 434
  • 435
  • 436
  • 437
  • 438
  • 439
  • 440
  • 441
  • 442
  • 443
  • 444
  • 445
  • 446
  • 447
  • 448
  • 449
  • 450
  • 451
  • 452
  • 453
  • 454
  • 455
  • 456
  • 457
  • 458
  • 459
  • 460
  • 461
  • 462
  • 463
  • 464
  • 465
  • 466
  • 467
  • 468
  • 469
  • 470
  • 471
  • 472
  • 473
  • 474
  • 475
  • 476
  • 477
  • 478
  • 479
  • 480
  • 481
  • 482
  • 483
  • 484
  • 485
  • 486
  • 487
  • 488
  • 489
  • 490
  • 491
  • 492
  • 493
  • 494
  • 495
  • 496
  • 497
  • 498
  • 499
  • 500
  • 501
  • 502
  • 503
  • 504
  • 505
  • 506
  • 507
  • 508
  • 509
  • 510
  • 511
  • 512
  • 513
  • 514
  • 515
  • 516
  • 517
  • 518
  • 519
  • 520
  • 521
  • 522
  • 523
  • 524
  • 525
  • 526
  • 527
  • 528
  • 529
  • 530
  • 531
  • 532
  • 533
  • 534
  • 535
  • 536
  • 537
  • 538
  • 539
  • 540
  • 541
  • 542
  • 543
  • 544
  • 545
  • 546
  • 547
  • 548
  • 549
  • 550
  • 551
  • 552
  • 553
  • 554
  • 555
  • 556
  • 557
  • 558
  • 559
  • 560
  • 561
  • 562
  • 563
  • 564
  • 565
  • 566
  • 567
  • 568
  • 569
  • 570
  • 571
  • 572
  • 573
  • 574
  • 575
  • 576
  • 577
  • 578
  • 579
  • 580
  • 581
  • 582
  • 583
  • 584
  • 585
  • 586
  • 587
  • 588
  • 589
  • 590
  • 591
  • 592
  • 593
  • 594
  • 595
  • 596
  • 597
  • 598
  • 599
  • 600
  • 601
  • 602
  • 603
  • 604
  • 605
  • 606
  • 607
  • 608
  • 609
  • 610
  • 611
  • 612
  • 613
  • 614
  • 615
  • 616
  • 617
  • 618
  • 619
  • 620
  • 621
  • 622
  • 623
  • 624
  • 625
  • 626
  • 627
  • 628
  • 629
  • 630
  • 631
  • 632
  • 633
  • 634
  • 635
  • 636
  • 637
  • 638
  • 639
  • 640
  • 641
  • 642
  • 643
  • 644
  • 645
  • 646
  • 647
  • 648
  • 649
  • 650
  • 651
  • 652
  • 653
  • 654
  • 655
  • 656
  • 657
  • 658
  • 659
  • 660
  • 661
  • 662
  • 663
  • 664
  • 665
  • 666
  • 667
  • 668
  • 669
  • 670
  • 671
  • 672
  • 673
  • 674
  • 675
  • 676
  • 677
  • 678
  • 679
  • 680
  • 681
  • 682
  • 683
  • 684
  • 685
  • 686
  • 687
  • 688
  • 689
  • 690
  • 691
  • 692
  • 693
  • 694
  • 695
  • 696
  • 697
  • 698
  • 699
  • 700
  • 701
  • 702
  • 703
  • 704
  • 705
  • 706
  • 707
  • 708
  • 709
  • 710
  • 711
  • 712
  • 713
  • 714
  • 715
  • 716
  • 717
  • 718
  • 719
  • 720
  • 721
  • 722
  • 723
  • 724
  • 725
  • 726
  • 727
  • 728
  • 729
  • 730
  • 731
  • 732
  • 733
  • 734
  • 735
  • 736
  • 737
  • 738
  • 739
  • 740
  • 741
  • 742
  • 743
  • 744
  • 745
  • 746
  • 747
  • 748
  • 749
  • 750
  • 751
  • 752
  • 753
  • 754
  • 755
  • 756
  • 757
  • 758
  • 759
  • 760
  • 761
  • 762
  • 763
  • 764
  • 765
  • 766
  • 767
  • 768
  • 769
  • 770
  • 771
  • 772
  • 773
  • 774
  • 775
  • 776
  • 777
  • 778
  • 779
  • 780
  • 781
  • 782
  • 783
  • 784
  • 785
  • 786
  • 787
  • 788
  • 789
  • 790
  • 791
  • 792
  • 793
  • 794
  • 795
  • 796
  • 797
  • 798
  • 799
  • 800
  • 801
  • 802
  • 803
  • 804
  • 805
  • 806
  • 807
  • 808
  • 809
  • 810
  • 811
  • 812
  • 813
  • 814
  • 815
  • 816
  • 817
  • 818
  • 819
  • 820
  • 821
  • 822
  • 823
  • 824
  • 825
  • 826
  • 827
  • 828
  • 829
  • 830
  • 831
  • 832
  • 833
  • 834
  • 835
  • 836
  • 837
  • 838
  • 839
  • 840
  • 841
  • 842
  • 843
  • 844
  • 845
  • 846
  • 847
  • 848
  • 849
<template>
  <div class="product-wrap" :data-level="this.level">
    <div class="ribbontext mobile" v-if="productRibbonText">
      <span>{{ productRibbonText }}</span>
    </div>

    <section class :class="`product ${theme}`" :data-level="this.level">
      <div class="ribbontext desktop" v-show="productRibbonText">
        <span>{{ productRibbonText }}</span>
      </div>

      <div class="header" :class="{ es: $store.state.locale == 'es' }">
        <div v-html="productName" class="name"></div>
        <div class="subname" v-if="subname" v-html="subname"></div>
      </div>

      <div class="body" :class="{ es: $store.state.locale == 'es' }">
        <div class="offertext" v-show="productOfferText">{{ productOfferText }}</div>
        <div class="pricing">
          <div class="dollar" :class="{ es: $store.state.locale == 'es' }">
            <span>$</span>
            <span>{{ dollars }}</span>
          </div>
          <div class="cents-wrap">
            <div class="cents" v-show="cents">.{{ cents }}</div>
            <div class="parcel" :class="$store.state.locale">{{ productXpay ? content.due : parcelText }}</div>
          </div>
        </div>
        <!--/ end .pricing -->

        <!-- msrp text shown underneath the price -->
        <div class="original-price" v-if="!productShowFullPrice">
          <span class="msrp" v-show="msrp != price">${{ this.msrp }}</span>
          <span class="price">${{ productXpay ? price : computedPrice }}</span>
          <span v-if="!productXpay">{{ content.due }}</span>
        </div>

        <!-- With fullprice=1, we display  `Regular $<strikethrough msrp>` -->
        <div class="original-price" v-else>
          <span class="msrp" :style="{ visibility: price == msrp ? 'hidden' : 'visible' }">${{ this.msrp }}</span>
        </div>
      </div>
      <!-- /end .body -->

      <div class="footer">
        <a :href="productCartLink" class="add-to-cart" @click="onAddToCartClick">{{ content.cta }}</a>
      </div>
    </section>
    <div class="offertext-mobile" v-show="productOfferText">{{ productOfferText }}</div>
  </div>
</template>

<script>
/**
 * This is a single product box. It shows one product.
 * Media queries regarding layout should be done on the page
 * that is including this component.
 *
 * Query params override settings from Airtable.
 *
 * Current accepted URL params: *
 *
 * ?showfull=1
 *    Will show full price in every product instead of monthly
 *
 * ?pn={_24_:_buy 24 get 24 months free!_}
 *    Will update the product name for 24m.
 *
 * ?ribbontext={_24_:_best offer!_}
 *    Ribbon text is the text on top of the product box
 *
 * ?offertext={_24_:_offer ends soon_}
 *    The text hat is inside the (usually green) box
 *    between the product name and price.
 *
 * ?xpay=3
 *    Will format 24m cart link to apply 3-pay in cart.
 *    Note this can also be 5 pay. ie, xpay={24:5}.
 *    It will also divide price by the X amount to show
 *    in the html.
 *
 *
 */

export default {
  async fetch() {
    this.content = await import(`~/data/components/ProductBox/${this.$store.state.locale}.yaml`);
  },

  /* Props passed from parent. ie,
    <ProductBox  v-for="(product, key) in products"
      :msrp="product.msrp"
      :price="product.price"
      :level="product.lvl"
      :name="productName && productName[product.lvl] || product.name"
      :cartLink="product.cart"
      :showFullPrice="Boolean($route.query.fullprice || fullPrice)"
      :bonusMonths="bonusMonth"
      :xpay="parseInt($route.query.xpay) || xpay"
      :email="$route.query.email"
      :ribbonText="ribbonText && ribbonText[product.lvl]"
      :offerText="offerText && offerText[product.lvl]"
      :products="productList"
      :iframeCart=true
      :metadata=product.metadata
      :key="key"
    />
  */

  props: {
    // MSRP price of this product
    msrp: {
      type: Number,
      required: true,
    },

    // Sale price of this product
    price: {
      type: Number,
      required: true,
    },

    // The level of this product (6, 12, 24, etc)
    level: {
      type: String,
      required: true,
    },

    // The Magento cart url
    cartLink: {
      type: String,
      required: true,
    },

    // The name of this product. If blank, this component will
    // use the level as its name. Can be overwritten by url
    name: {
      type: String,
      required: false,
    },

    // If true, price will be showed as a whole, not monthly.
    // Can be overwritten by url
    showFullPrice: {
      type: Boolean,
      required: false,
      default: false,
    },

    // Should be a number: 3 or 5
    xpay: {
      type: Number,
      required: false,
      default: null,
    },

    // Bonus month this product becomes.
    // Can be overwritten by url
    bonusMonth: {
      type: Boolean,
      required: false,
      default: false,
    },

    // Text to show in the ribbon area
    // Can be overwritten by url
    ribbonText: {
      type: [String, Object],
      required: false,
      default: null,
    },

    // Text to show in the offer area
    // Can be overwritten by url
    offerText: {
      type: [String, Object],
      required: false,
      default: null,
    },

    // Email that gets passed to cart, if present.
    email: { type: String, required: false, default: null },

    // An array of all products. This is currently not in use.
    products: {
      type: Array,
      required: false,
      default: null,
    },

    // Shows cart inside iframe instead of redirecting to cart
    iframeCart: {
      type: Boolean,
      required: false,
      default: true,
    },

    // Product metadata, in case we need it.
    metadata: {
      type: Object,
      required: false,
      default: () => {},
    },

    // Products filter. We use this to know what parent component is showing,
    // so that we can put 'Best Value' on top of longest duration product
    // https://github.com/vuejs/vue/issues/1032#issuecomment-120212888
    productFilter: {
      type: Array,
      required: false,
      default: () => [],
    },
  },

  data() {
    return {
      content: "",
      dollars: null,
      cents: null,
      theme: null,
      subname: null,
      parcel: null,

      // What we'll be dividing prices by to calculate monthly. use level by default
      divideBy: this.level,

      // Text displayed next to price - TODO store this in Airtable somewhere

      // These will be used in the <template>. We use these instead of the
      // props passed because Vue doesn't want you to mutate props. So
      // when a url param requires a prop to be changed, we must
      // use one of these data values instead of mutating the prop
      // directly. Just remember, don't try to mutate props.
      productShowFullPrice: this.showFullPrice,
      productOfferText: this.offerText,
      productRibbonText: this.ribbonText,
      productXpay: this.xpay,
      productName: this.name,
      productCartLink: this.cartLink,
      isiFrameVisible: false,
    };
  },

  computed: {
    computedPrice() {
      // Makes it so if price (cents) are 2 digits - only if there are cents.
      // So instead of 199.5, it'll show 199.50
      let price =
        this.price.toString().indexOf(".") !== -1
          ? this.price.toLocaleString("en", { minimumFractionDigits: 2 })
          : this.price.toString();

      if (this.productXpay) {
        price = (Math.ceil((parseFloat(this.price, 10) / parseInt(this.productXpay, 10)) * 100) / 100)
          .toFixed(2)
          .split(".");
        price = price[1] === "00" ? price[0] : price.join(".");
      }

      return price;
    },
    language() {
      return this.$store.getters.getSelectedLanguage();
    },

    parcelText() {
      if ((/lifetime/gi.test(this.level) && !this.productXpay) || this.productShowFullPrice) {
        return this.content["once"];
      }
      return this.content["per-month"];
    },
  },

  watch: {
    // Watch for language changes. On changes,
    language() {
      this.createSubname();
      //this.formatCartLink()
    },

    // Watch cart link for changes. On changes,
    // determine if we need to format for xpay or not,
    // and keep email in it.
    cartLink() {
      this.formatCartLink();
    },
  },

  mounted() {
    /***************************************************************
     * Here we will handle the prop values that can be
     * overwritten/set by url parameters
     ***************************************************************/
    if (this.$route.query.productname) {
      try {
        const level = this.level.replace("-u", "");
        const productnameObj = JSON.parse(this.$route.query.productname.replace(/_/g, '"'));
        const textValue = productnameObj[level];
        if (textValue) {
          this.productName = textValue;
        }
      } catch (e) {
        console.warn("Could not parse ribbon text parameter.");
        console.log(e);
      }
    }

    if (this.$route.query.offertext) {
      try {
        // Remove "-u" from level, if there.
        const level = this.level.replace("-u", "");
        const offertextObj = JSON.parse(this.$route.query.offertext.replace(/_/g, '"'));
        const textValue = offertextObj[level];
        if (textValue) {
          this.productOfferText = textValue;
        }
      } catch (e) {
        console.warn("Could not parse offer text parameter.");
        console.log(e);
      }
    }

    if (this.$route.query.ribbontext) {
      try {
        // Remove "-u" from level, if there.
        const level = this.level.replace("-u", "");
        const ribbontextObj = JSON.parse(this.$route.query.ribbontext.replace(/_/g, '"'));
        const textValue = ribbontextObj[level];
        if (textValue) {
          this.productRibbonText = textValue;
        }
      } catch (e) {
        console.warn("Could not parse ribbon text parameter.");
        console.log(e);
      }
    }

    // Add "Best Value" to longest product, if `productRibbonText` isn't set.
    if (!this.productRibbonText && this.productFilter[this.productFilter.length - 1] === this.level) {
      const ribbonTextMap = {
        en: "Best Value!",
        es: "Mejor Oferta!",
      };
      this.productRibbonText = ribbonTextMap[this.$store.state.locale];
    }
  },

  created() {
    // Create string of text under product names
    this.createSubname();

    // Changes productCartLink if we have 3pay
    this.formatCartLink();

    // Can't have monthly price for lifetime products.
    if (/lifetime/gi.test(this.level)) {
      this.productShowFullPrice = true;
      this.divideBy = 1;
    }

    if (this.productXpay) {
      this.productShowFullPrice = false;
      this.divideBy = this.productXpay;
    }

    // Determine our monthly price: price/level
    const monthly = (Math.ceil((parseFloat(this.price, 10) / parseInt(this.divideBy, 10)) * 100) / 100)
      .toFixed(2)
      .split(".");

    // Set our dollars and cents for html view
    this.dollars = monthly[0];
    this.cents = monthly[1] === undefined ? "00" : monthly[1];
    this.cents = this.cents === "00" ? null : this.cents;

    // If showFullPrice is true, don't show monthly pricing
    if (this.productShowFullPrice) {
      this.dollars = this.computedPrice.toString().split(".")[0];
      this.cents = this.computedPrice.toString().split(".")[1] || "";
    }
  },

  methods: {
    onAddToCartClick(e) {
      if (this.iframeCart) {
        e.preventDefault();
        this.$store.commit("CART_TOGGLE", true);
        this.$bus.$emit("SET_CART_IFRAME", e.target.href); //
      }
    },

    /**
     * Updates subName
     * This is ran on `created()` hook, and whenever
     * this.cartLink changes - it's being watch()'ed
     */
    createSubname() {
      const isHomeschool = this.$route.params.pathMatch.slice(-3) === "-hs" ? true : false;
      const isUnlimited = this.metadata.languages !== "single" ? true : false;

      //if (this.metadata.languages == 'single') {
      if (!isUnlimited && !isHomeschool) {
        // If not unlimited, `subName` is the language name
        let name = this.language.name;
        if (this.language.region) {
          name += `<div>(${this.language.region})</div>`;
        }
        this.subname = name;
      }

      //if (this.metadata.languages == 'unlimited') {
      if ((isHomeschool || isUnlimited) && this.productName) {
        // If it is unlimited, subName is 'Unlimited Languages'
        // If there's already a subname, exit - or else errors will cause
        // when attempting all the string manipulation in this function
        if (this.subname) {
          return;
        }

        // Either returns something like ["24", "months", "unlimited", "languages"]
        // or ["Lifetime", "unlimited", "languages"]

        const split = this.productName.split(" ");

        if (split.length === 3) {
          this.productName = split[0];
          this.subname = split.slice(1, 3).join(" ");
        } else {
          // ie, "24 months"

          this.productName = `${split[0]} ${split[1]}`;
          this.subname = split.slice(2, 4).join(" ");
          if (this.$store.state.locale === "es" && split.length === 5) {
            // 'de por vida idiomas ilimitados'
            this.productName = split.splice(0, 3).join(" ");
            this.subname = split.join(" ");
          }
        }
      }
    },

    /**
     * Updates the cart link if we have 3 pay.
     * This is ran on `created()` hook, and whenever
     * this.cartLink changes - it's being watch()'ed
     */
    formatCartLink() {
      if (this.xpay) {
        // If ?xpay is in url, overwrite whatever was passed via props.
        //this.productXpay = this.$route.query.xpay ? this.$route.query.xpay : this.xpay

        // Format cart link. A normal cart link looks like this:
        // https://secure.rosettastone.com/us_en_store_view/checkout/cart/add/sku/90291/category_id/esp/
        // We make it look like this:
        // https://secure.rosettastone.com/us_en_store_view/checkout/cart/add/sku/90291/category_id/esp/pp/3/
        try {
          this.productCartLink = this.cartLink.replace(/category_id\/.{3}/, "$&/pp/" + this.productXpay);
        } catch (e) {
          console.warn(`Error converting cartlink for ${this.level}`);
          console.log(e);
          this.productCartLink = this.cartLink;
        }
      } else {
        this.productCartLink = this.cartLink;
      }

      // If email was passed
      if (this.email) {
        if (this.productCartLink.indexOf("?") !== -1) {
          this.productCartLink = this.productCartLink.split("?");
          this.productCartLink[0] += `email=${this.email}`;
          this.productCartLink = this.productCartLink.join("?");
        } else {
          this.productCartLink += `email=${this.email}`;
        }
      }
    },
  },
};
</script>

<style lang="stylus">
.subname {
  margin-top: 2px;
  text-transform: capitalize;
  font-weight: 400;

  div {
    display: inline-block;
    padding-left: 5px;

    @media (max-width: 668px) {
      padding-left: 0;
    }
  }
}
</style>
<style lang="stylus" scoped>
.product-wrap {
  display: flex;
  width: 100%;
  max-width: 238px;
  flex-direction: column;
}

.product {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  border-radius: 7px;
  background: #fff;
  width: 100%;
  position: relative;
  font-family: effra;
}

.ribbontext {
  background: #262626;
  color: #fff;
  font-weight: 700;
  text-align: center;
  padding: 8px 0;
  width: 100%;
  position: absolute;
  top: -22px;
  left: 0;
  border-top-right-radius: 7px;
  border-top-left-radius: 7px;
  display: flex;
  justify-content: center;
  order: 0;

  &.mobile {
    display: none;
  }
}

.header {
  order: 1;
  background: linear-gradient(0.25turn, #EDDE5D, #F09819);
  padding: 1.66em 0;
  text-align: center;
  border-top-right-radius: 7px;
  border-top-left-radius: 7px;
  font-weight: 700;
  font-size: 20px;

  .name {
    text-transform: uppercase;
    letter-spacing: 1px;
  }
}

// Special offer per product
.offertext {
  background: #437414;
  color: #fff;
  // position relative
  top: -23px;
  padding: 7px 3px;
  width: 85%;
  font-size: 85%;
  min-height: 15px;
  position: absolute;
  font-weight: bold;
}

.offertext-mobile {
  display: none;
}

.body {
  order: 2;
  text-align: center;
  border-bottom-right-radius: 7px;
  border-bottom-left-radius: 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  // box-shadow 0 8px 30px rgba(0,0,0,.3)
  padding-top: 19px;
}

.pricing {
  padding: 1em 0 15px;
  display: flex;
  justify-content: center;
  margin-top: -20px; // same px as we shifted offer-banner up
  font-size: 36px;
  font-weight: 400;
  align-items: baseline;

  .dollar {
    span:first-of-type {
      font-size: 100%;
      position: relative;
      top: -21px;
      right: -6px;
    }
    span:last-of-type {
      font-size: 1.9em;
    }
  }
  .cents-wrap {
    display: flex;
    flex-direction: column;
    line-height: 12px;
    position: relative;
    top: -20px;
  }
  @media $phone {
    .dollar {
      span:first-of-type {
        top: -8px;
        right: -5px;
      }
    }
    .cents-wrap {
      top: -10px;
    }
  }
}

.cents {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  font-size: 50%;
  font-weight: 400;
  top: -9px;
  left: -15px;

  @media (max-width: 668px) {
    font-size: 70% !important;
    top: -3px;
  }

  // /month
  & > span {
    font-size: 24px;
  }
}

.parcel {
  color: rgb(85, 85, 85);
  font-weight: 400;
  font-size: 55%;
  padding-left: 7px;
  &.es {
    // because "un solo pago" is way longer than "once"
    font-size: 45%
  }
}

.original-price {
  font-size: 16px;

  & > span {
    padding-right: 2px;
  }
}

.msrp {
  color: red;
  text-decoration: line-through;
}

.footer {
  display: flex;
  order: 4;
}

a.add-to-cart {
  background: #3f93d3;
  border: 2px dashed #3f93d3;
  border-radius: 8px;
  text-align: center;
  color: #fff;
  padding: 12.5px 40px;
  text-decoration: none;
  margin: 25px auto 1.5em auto;
  font-weight: 700;
  transition: all 0.14s;
  position: relative;
  display: flex;
}

[data-level='6-hs'],
[data-level='3'] {
  .header {
    background: #262626;
    color: #eee;
  }
}

@media (max-width: 668px) {
  .product-wrap {
    max-width: none;
    margin-bottom: 1em;
  }

  .product {
    flex-basis: 100%;
    margin: 0;
    max-width: none;
    display: flex;
    border-radius: 0;
    box-shadow: none;
    border: none;
    justify-content: space-between;
    background: none;
  }

  .ribbontext {
    &.mobile {
      display: block;
      position: static;
      width: 115px;
    }

    &.desktop {
      display: none;
    }
  }

  .header {
    padding-left: 10px;
    width: 115px;
    align-self: center;
    height: 100%;
    box-sizing: border-box;
    border-radius: 0;
    text-align: left;
    padding: 10px;
    border-bottom-left-radius: 8px;
    border-top-left-radius: 8px;

    .name {
      text-align: left;
      letter-spacing: normal;
      font-size: 15px;
    }

    .subname {
      margin-top: 4px;
      font-size: 70%;

      div {
        display: block;
      }
    }

    &.es {
      max-width: 110px;
    }
  }

  .offertext {
    display: none;
  }

  .offertext-mobile {
    display: block;
    color: #fff;
    background: #01a13a;
    padding: 5px;
    text-align: center;
    margin-top: -1px;
  }

  .body {
    display: flex;
    padding: 0 11px;
    justify-content: center;
    flex-grow: 1;
    align-items: baseline;
    border: 1px solid #444;
    border-radius: 0;
    background: #fff;
    border-right: none;

    &.es {
      padding: 0 5px;
    }
  }

  .pricing {
    padding: 0;
    margin: 0;
    font-size: 16px;

    &.es {
      font-size: 15px;
    }
  }

  .monthly {
    display: flex;
    font-weight: 700;
    font-size: 70%;
  }

  .dollar {
    letter-spacing: 1px;

    &.es {
      letter-spacing: 0;
    }
  }

  .cents {
    font-size: 78%;
    letter-spacing: 1px;
    position: relative;
    // top -3px
  }

  .parcel {
    font-size: 16px;
    padding-left: 4px;
  }

  .original-price {
    font-size: 0.7em;
    padding-top: 0.5em;
    color: #555;
    display: flex;
    align-self: center;
  }

  .price {
    font-weight: bold;
  }

  .footer {
    a.add-to-cart {
      padding: 0 13px;
      border-radius: 0;
      font-size: 90%;
      margin: 0;
      align-items: center;
      box-sizing: border-box;
      border-bottom-right-radius: 8px;
      border-top-right-radius: 8px;
    }
  }
}
</style>