2020-02-18 23:06:37 +00:00
/ * *
* External dependencies
* /
import { _ _ } from '@wordpress/i18n' ;
2020-04-08 15:03:39 +00:00
import {
SHIPPING _METHODS _EXIST ,
WC _BLOCKS _ASSET _URL ,
2020-04-14 06:01:59 +00:00
SHIPPING _ENABLED ,
2020-04-08 15:03:39 +00:00
} from '@woocommerce/block-settings' ;
2020-02-18 23:06:37 +00:00
/ * *
* Internal dependencies
* /
2020-03-13 13:41:59 +00:00
import { previewShippingRates } from './shipping-rates' ;
2020-04-08 15:03:39 +00:00
2020-02-18 23:06:37 +00:00
// Sample data for cart block.
// This closely resembles the data returned from the Store API /cart endpoint.
2020-06-16 09:38:19 +00:00
// https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/main/src/RestApi/StoreApi#cart-api
2020-02-18 23:06:37 +00:00
export const previewCart = {
2020-03-13 13:41:59 +00:00
coupons : [ ] ,
2020-04-07 15:41:22 +00:00
shipping _rates : SHIPPING _METHODS _EXIST ? previewShippingRates : [ ] ,
2020-02-18 23:06:37 +00:00
items : [
{
key : '1' ,
id : 1 ,
quantity : 2 ,
name : _ _ ( 'Beanie' , 'woo-gutenberg-products-block' ) ,
short _description : _ _ (
'Warm hat for winter' ,
'woo-gutenberg-products-block'
) ,
description :
'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.' ,
sku : 'woo-beanie' ,
permalink : 'https://example.org' ,
low _stock _remaining : 2 ,
2020-03-10 15:14:05 +00:00
backorders _allowed : false ,
2020-07-14 15:25:53 +00:00
show _backorder _badge : false ,
2020-03-10 15:14:05 +00:00
sold _individually : false ,
2020-02-18 23:06:37 +00:00
images : [
{
id : 10 ,
2020-04-08 15:03:39 +00:00
src : WC _BLOCKS _ASSET _URL + 'img/beanie.jpg' ,
thumbnail : WC _BLOCKS _ASSET _URL + 'img/beanie.jpg' ,
2020-02-18 23:06:37 +00:00
srcset : '' ,
sizes : '' ,
name : '' ,
alt : '' ,
} ,
] ,
variation : [
{
attribute : _ _ ( 'Color' , 'woo-gutenberg-products-block' ) ,
value : _ _ ( 'Yellow' , 'woo-gutenberg-products-block' ) ,
} ,
{
attribute : _ _ ( 'Size' , 'woo-gutenberg-products-block' ) ,
value : _ _ ( 'Small' , 'woo-gutenberg-products-block' ) ,
} ,
] ,
2020-02-25 12:17:13 +00:00
prices : {
currency _code : 'USD' ,
currency _symbol : '$' ,
currency _minor _unit : 2 ,
currency _decimal _separator : '.' ,
currency _thousand _separator : ',' ,
currency _prefix : '$' ,
currency _suffix : '' ,
price : '800' ,
regular _price : '800' ,
sale _price : '800' ,
2020-03-17 15:34:33 +00:00
raw _prices : {
precision : 6 ,
price : '8000000' ,
regular _price : '8000000' ,
sale _price : '8000000' ,
} ,
2020-02-25 12:17:13 +00:00
} ,
2020-02-18 23:06:37 +00:00
totals : {
currency _code : 'USD' ,
currency _symbol : '$' ,
currency _minor _unit : 2 ,
currency _decimal _separator : '.' ,
currency _thousand _separator : ',' ,
currency _prefix : '$' ,
currency _suffix : '' ,
2020-02-25 12:17:13 +00:00
line _subtotal : '1600' ,
2020-02-18 23:06:37 +00:00
line _subtotal _tax : '0' ,
2020-02-25 12:17:13 +00:00
line _total : '1600' ,
2020-02-18 23:06:37 +00:00
line _total _tax : '0' ,
} ,
} ,
{
key : '2' ,
id : 2 ,
quantity : 1 ,
name : _ _ ( 'Cap' , 'woo-gutenberg-products-block' ) ,
short _description : _ _ (
'Lightweight baseball cap' ,
'woo-gutenberg-products-block'
) ,
description :
'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.' ,
sku : 'woo-cap' ,
permalink : 'https://example.org' ,
2020-03-10 15:14:05 +00:00
backorders _allowed : false ,
2020-07-14 15:25:53 +00:00
show _backorder _badge : false ,
2020-03-10 15:14:05 +00:00
sold _individually : false ,
2020-02-18 23:06:37 +00:00
images : [
{
id : 11 ,
2020-04-08 15:03:39 +00:00
src : WC _BLOCKS _ASSET _URL + 'img/cap.jpg' ,
thumbnail : WC _BLOCKS _ASSET _URL + 'img/cap.jpg' ,
2020-02-18 23:06:37 +00:00
srcset : '' ,
sizes : '' ,
name : '' ,
alt : '' ,
} ,
] ,
variation : [
{
attribute : _ _ ( 'Color' , 'woo-gutenberg-products-block' ) ,
value : _ _ ( 'Orange' , 'woo-gutenberg-products-block' ) ,
} ,
] ,
2020-02-25 12:17:13 +00:00
prices : {
currency _code : 'USD' ,
currency _symbol : '$' ,
currency _minor _unit : 2 ,
currency _decimal _separator : '.' ,
currency _thousand _separator : ',' ,
currency _prefix : '$' ,
currency _suffix : '' ,
price : '1400' ,
regular _price : '1600' ,
sale _price : '1400' ,
2020-03-17 15:34:33 +00:00
raw _prices : {
precision : 6 ,
price : '14000000' ,
regular _price : '16000000' ,
sale _price : '14000000' ,
} ,
2020-02-25 12:17:13 +00:00
} ,
2020-02-18 23:06:37 +00:00
totals : {
currency _code : 'USD' ,
currency _symbol : '$' ,
currency _minor _unit : 2 ,
currency _decimal _separator : '.' ,
currency _thousand _separator : ',' ,
currency _prefix : '$' ,
currency _suffix : '' ,
2020-02-25 12:17:13 +00:00
line _subtotal : '1400' ,
2020-02-18 23:06:37 +00:00
line _subtotal _tax : '0' ,
line _total : '1400' ,
line _total _tax : '0' ,
} ,
} ,
] ,
2020-03-17 12:11:30 +00:00
items _count : 3 ,
2020-03-13 13:41:59 +00:00
items _weight : 0 ,
2020-04-09 14:01:11 +00:00
needs _payment : true ,
2020-04-14 06:01:59 +00:00
needs _shipping : SHIPPING _ENABLED ,
2020-02-18 23:06:37 +00:00
totals : {
2020-03-13 13:41:59 +00:00
currency _code : 'USD' ,
currency _symbol : '$' ,
2020-02-18 23:06:37 +00:00
currency _minor _unit : 2 ,
2020-03-13 13:41:59 +00:00
currency _decimal _separator : '.' ,
currency _thousand _separator : ',' ,
currency _prefix : '$' ,
currency _suffix : '' ,
2020-02-25 12:17:13 +00:00
total _items : '3000' ,
2020-02-18 23:06:37 +00:00
total _items _tax : '0' ,
total _fees : '0' ,
total _fees _tax : '0' ,
total _discount : '0' ,
total _discount _tax : '0' ,
2020-04-08 15:03:39 +00:00
total _shipping : '200' ,
2020-02-18 23:06:37 +00:00
total _shipping _tax : '0' ,
total _tax : '0' ,
2020-04-08 15:03:39 +00:00
total _price : '3200' ,
2020-03-13 13:41:59 +00:00
tax _lines : [ ] ,
2020-02-18 23:06:37 +00:00
} ,
} ;