File size: 6,108 Bytes
1e92f2d |
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 |
import * as MockData from '../';
import type {
PricedAPIPlanFree,
PricedAPIPlanPaidAnnually,
PricedAPIPlanPaidMonthly,
DetailsAPIResponse,
APIPlanDetail,
} from '../../types';
/**
* For the sake of testing, only a few plans are mocked:
* - Free plan
* - Premium plan (annually and monthly billed)
*/
//==============================================================================
// Mock TypeScript interfaces
// (allow us to use real-ish APIs data without TypeScript complaining about
// extra props that are otherwise ignored in this data-store)
//==============================================================================
interface MockPricedAPIPlanFree extends PricedAPIPlanFree {
[ key: string ]: unknown;
}
interface MockAPIPlanDetail extends APIPlanDetail {
[ key: string ]: unknown;
}
interface MockDetailsAPIResponse extends DetailsAPIResponse {
plans: MockAPIPlanDetail[];
[ key: string ]: unknown;
}
interface MockPricedAPIPlanPaidAnnually extends PricedAPIPlanPaidAnnually {
[ key: string ]: unknown;
}
interface MockPricedAPIPlanPaidMonthly extends PricedAPIPlanPaidMonthly {
[ key: string ]: unknown;
}
// All plans details (from APIs)
export const API_PLAN_DETAILS: MockDetailsAPIResponse = {
groups: [
{
slug: 'personal',
name: 'Personal',
},
],
plans: [
{
support_priority: 1,
support_name: 'free',
groups: [ 'personal' ],
products: [
{
plan_id: 1,
},
],
name: 'WordPress.com Free',
short_name: 'Free',
nonlocalized_short_name: 'Free',
tagline: 'Mock free plan',
description:
'If you just want to start creating, get a free site and be on your way to publishing in less than five minutes.',
features: [ 'subdomain' ],
highlighted_features: [ 'Free plan highlighted feature' ],
storage: '3 GB',
icon: 'https://s0.wordpress.com/i/store/mobile/plans-free.png',
},
{
support_priority: 4,
support_name: 'premium',
groups: [ 'business' ],
products: [
{
plan_id: 1003,
},
{
plan_id: 1013,
},
],
name: 'WordPress.com Premium',
short_name: 'Premium',
nonlocalized_short_name: 'Premium',
tagline: 'Mock premium plan',
description:
'Build a unique website with advanced design tools, CSS editing, lots of space for audio and video, and the ability to monetize your site with ads.',
features: [ 'custom-domain', 'support-live', 'recurring-payments', 'wordads' ],
highlighted_features: [
MockData.API_FEATURE_CUSTOM_DOMAIN.name,
MockData.API_FEATURE_LIVE_SUPPORT.name,
'Premium plan highlighted feature',
],
storage: '13 GB',
icon: 'https://s0.wordpress.com/i/store/mobile/plans-premium.png',
},
],
features_by_type: [
MockData.API_FEATURES_BY_TYPE_GENERAL,
MockData.API_FEATURES_BY_TYPE_COMMERCE,
MockData.API_FEATURES_BY_TYPE_MARKETING,
],
features: [
MockData.API_FEATURE_CUSTOM_DOMAIN,
MockData.API_FEATURE_LIVE_SUPPORT,
MockData.API_FEATURE_PRIORITY_SUPPORT,
MockData.API_FEATURE_RECURRING_PAYMENTS,
MockData.API_FEATURE_WORDADS,
],
};
// Individual plan (from APIs)
export const API_PLAN_PRICE_FREE: MockPricedAPIPlanFree = {
product_id: 1,
product_name: 'WordPress.com Free',
meta: null,
cost: 0,
blog_id: null,
path_slug: 'free',
product_slug: 'free_plan',
description: '',
bill_period: -1,
product_type: 'bundle',
available: 'yes',
multi: 0,
bd_slug: 'wp-free-plan',
bd_variation_slug: 'wp-bundles',
outer_slug: null,
extra: null,
capability: 'manage_options',
product_name_short: 'Free',
icon: 'https://s0.wordpress.com/i/store/plan-free.png',
icon_active: 'https://s0.wordpress.com/i/store/plan-free-active.png',
bill_period_label: 'for life',
price: '€0',
formatted_price: '€0',
product_display_price: '<abbr title="Euros">€</abbr>0',
orig_cost_integer: 0,
raw_price: 0,
raw_price_integer: 0,
tagline: 'Perfect for anyone creating a basic blog or site',
currency_code: 'EUR',
features_highlight: [
{
items: [ 'free-blog', 'space', 'support' ],
},
],
};
export const API_PLAN_PRICE_PREMIUM_ANNUALLY: MockPricedAPIPlanPaidAnnually = {
product_id: 1003,
product_name: 'WordPress.com Premium',
meta: null,
cost: 96,
blog_id: null,
path_slug: 'premium',
product_slug: 'value_bundle',
description: '',
bill_period: 365,
product_type: 'bundle',
available: 'yes',
multi: 0,
bd_slug: 'wp-bundles',
bd_variation_slug: 'wp-value-bundle',
outer_slug: null,
extra: '',
capability: 'manage_options',
product_name_short: 'Premium',
icon: 'https://s0.wordpress.com/i/store/plan-premium.png',
icon_active: 'https://s0.wordpress.com/i/store/plan-premium-active.png',
bundle_product_ids: [
9, 12, 45, 15, 5, 49, 50, 6, 46, 54, 56, 57, 58, 59, 60, 62, 63, 64, 65, 66, 67, 68, 72, 73, 74,
76, 75, 16,
],
bill_period_label: 'per year',
price: '€96',
formatted_price: '€96',
product_display_price: '<abbr title="Euros">€</abbr>96',
orig_cost_integer: 9600,
raw_price: 96,
raw_price_integer: 9600,
tagline: 'Perfect for bloggers, creatives, and other professionals',
currency_code: 'EUR',
features_highlight: [
{
items: [
'custom-design',
'videopress',
'support',
'space',
'custom-domain',
'no-adverts/no-adverts.php',
],
},
{
title: 'Included with all plans',
items: [ 'free-blog' ],
},
],
};
export const API_PLAN_PRICE_PREMIUM_MONTHLY: MockPricedAPIPlanPaidMonthly = {
product_id: 1013,
product_name: 'WordPress.com Premium',
meta: null,
cost: 14,
blog_id: null,
product_slug: 'value_bundle_monthly',
description: '',
bill_period: 31,
product_type: 'bundle',
available: 'yes',
multi: 0,
bd_slug: 'wp-bundles',
bd_variation_slug: 'wp-value-bundle-monthly',
outer_slug: null,
extra: null,
capability: 'manage_options',
product_name_short: 'Premium',
bundle_product_ids: [ 9, 12, 45, 15, 6, 16, 49, 50 ],
bill_period_label: 'per month',
price: '€14',
formatted_price: '€14',
product_display_price: '<abbr title="Euros">€</abbr>14',
orig_cost_integer: 1400,
raw_price: 14,
raw_price_integer: 1400,
tagline: null,
currency_code: 'EUR',
};
|