Skip to content

Commit 731d26f

Browse files
authored
Merge pull request #731 from gruntwork-io/apt-1875-extract-product-data
[APT-1875] Extract product data into yaml
2 parents 2a15cd8 + b819c7e commit 731d26f

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

_data/products.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
AWS:
2+
key: standard_subscription
3+
stripeProductId: prod_KZH5PYGPzdh5nu
4+
ProSupport:
5+
key: pro_support
6+
stripeProductId: prod_KZHA5WMpiNsnOs
7+
RefArch:
8+
key: setup_deployment
9+
stripeProductId: prod_KZHHUK5LUuYRFl
10+
CIS:
11+
key: setup_compliance
12+
stripeProductId: prod_KZH9VxdizHvbqI
13+
Users:
14+
key: standard_users
15+
stripeProductId: prod_KZH7Hb6FqIPOcl

_includes/scripts.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script>
22
window.pricing = {{ site.data.pricing | jsonify }}
3+
window.products = {{ site.data.products | jsonify }}
34
</script>
45
<script src="{{ site.assets_base_url }}js/main.js"></script>
56
{% if page.custom_js %} {% for js_file in page.custom_js %}

assets/js/checkout.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ $(function () {
1919
// the live strip product IDs
2020

2121
const productToButtonNameMap = {
22-
prod_KZH5PYGPzdh5nu: "standard_subscription",
23-
prod_KZHA5WMpiNsnOs: "pro_support",
24-
prod_KZHHUK5LUuYRFl: "setup_deployment",
25-
prod_KZH9VxdizHvbqI: "setup_compliance",
22+
[products.AWS.stripeProductId]: products.AWS.key,
23+
[products.ProSupport.stripeProductId]: products.ProSupport.key,
24+
[products.RefArch.stripeProductId]: products.RefArch.key,
25+
[products.CIS.stripeProductId]: products.CIS.key,
2626
};
2727

2828
// Note: This is currently set to the default user product price in Stripe's TEST area.
2929
const defaultUsersProduct = {
30-
productId: "prod_KZH7Hb6FqIPOcl",
30+
productId: products.Users.stripeProductId,
3131
quantity: 20,
3232
};
3333

3434
const defaultSubscription = {
35-
productId: "prod_KZH5PYGPzdh5nu",
35+
productId: products.AWS.stripeProductId,
3636
quantity: 1,
3737
};
3838

pages/checkout/_add-ons.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ <h1 class="addon-amount">$1,950</h1>
3737
<p>
3838
<a
3939
class="btn btn-primary addon-button"
40-
name="pro_support"
40+
name="{{site.data.products.ProSupport.key}}"
4141
data-addon-action-type="Add"
42-
data-product-id="price_1Ju8buDJ1uFWlBkU0QALdhIM"
42+
data-product-id="{{site.data.products.ProSupport.stripeProductId}}"
4343
>Add to Subscription
4444
<i class="fa fa-angle-double-right fa-lg" aria-hidden="true"></i
4545
></a>
@@ -64,9 +64,9 @@ <h1 class="addon-amount" id="addon-amount-refarch">$4,950</h1>
6464
<p id="refarch-button-default" hidden>
6565
<a
6666
class="btn btn-primary addon-button"
67-
name="setup_deployment"
67+
name="{{site.data.products.RefArch.key}}"
6868
data-addon-action-type="Add"
69-
data-product-id="price_1Ju8iYDJ1uFWlBkUxBFauxac"
69+
data-product-id="{{site.data.products.RefArch.stripeProductId}}"
7070
>Add to Subscription
7171
<i class="fa fa-angle-double-right fa-lg" aria-hidden="true"></i
7272
></a>
@@ -91,9 +91,9 @@ <h1 class="addon-amount" id="addon-amount-cis">$1,245</h1>
9191
<p id="cis-button-default" hidden>
9292
<a
9393
class="btn btn-primary addon-button"
94-
name="setup_compliance"
94+
name="{{site.data.products.CIS.key}}"
9595
data-addon-action-type="Add"
96-
data-product-id="price_1Ju8akDJ1uFWlBkUGsewsTJU"
96+
data-product-id="{{site.data.products.CIS.stripeProductId}}"
9797
>Add to Subscription
9898
<i
9999
class="fa fa-angle-double-right fa-lg"

0 commit comments

Comments
 (0)