@leaddreamer/inventorylogic 0.0.3-beta.84 → 0.0.3-beta.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +270 -270
- package/business/Product/{GoogleMerchantAPI.js → googleMerchantAPI.js} +3 -3
- package/business/Product/index.js +9 -9
- package/business/Product/{Squarespace.js → squarespace.js} +10 -10
- package/business/Product/{SquarespaceSample.js → squarespaceSample.js} +1 -1
- package/package.json +1 -1
- /package/business/Product/{GoogleMarchantMarkup.js → googleMarchantMarkup.js} +0 -0
- /package/business/Product/{SampleJSON.json → sampleJSON.json} +0 -0
package/README.md
CHANGED
|
@@ -60,10 +60,10 @@ Unified structure as a sub-record of fan, organization, or CityManager accounts<
|
|
|
60
60
|
<dt><a href="#module_GoogleProduct">GoogleProduct</a></dt>
|
|
61
61
|
<dd><p>Typedefs, constants, support functions and database operations related to Products</p>
|
|
62
62
|
</dd>
|
|
63
|
-
<dt><a href="#
|
|
63
|
+
<dt><a href="#module_Product">Product</a></dt>
|
|
64
64
|
<dd><p>Typedefs, constants, support functions and database operations related to Products</p>
|
|
65
65
|
</dd>
|
|
66
|
-
<dt><a href="#
|
|
66
|
+
<dt><a href="#module_SquarespaceProduct">SquarespaceProduct</a></dt>
|
|
67
67
|
<dd><p>Typedefs, constants, support functions and database operations related to Products</p>
|
|
68
68
|
</dd>
|
|
69
69
|
<dt><a href="#module_User">User</a></dt>
|
|
@@ -1839,9 +1839,9 @@ Typedefs, constants, support functions and database operations related to Produc
|
|
|
1839
1839
|
|
|
1840
1840
|
* [GoogleProduct](#module_GoogleProduct)
|
|
1841
1841
|
* _static_
|
|
1842
|
-
* [.
|
|
1842
|
+
* [.googleAPIProductMap](#module_GoogleProduct.googleAPIProductMap) : <code>GoogleProductAPI</code>
|
|
1843
1843
|
* _inner_
|
|
1844
|
-
* [~
|
|
1844
|
+
* [~googleProductAPIField(field, InventoryProduct)](#module_GoogleProduct..googleProductAPIField)
|
|
1845
1845
|
* [~SKU](#module_GoogleProduct..SKU) : <code>string</code>
|
|
1846
1846
|
* [~Name](#module_GoogleProduct..Name) : <code>string</code>
|
|
1847
1847
|
* [~ImageObject](#module_GoogleProduct..ImageObject) : <code>object</code>
|
|
@@ -1866,13 +1866,13 @@ Typedefs, constants, support functions and database operations related to Produc
|
|
|
1866
1866
|
* [~QAObject](#module_GoogleProduct..QAObject) : <code>object</code>
|
|
1867
1867
|
* [~GoogleProductAPI](#module_GoogleProduct..GoogleProductAPI) : <code>object</code>
|
|
1868
1868
|
|
|
1869
|
-
<a name="module_GoogleProduct.
|
|
1869
|
+
<a name="module_GoogleProduct.googleAPIProductMap"></a>
|
|
1870
1870
|
|
|
1871
|
-
### GoogleProduct.
|
|
1871
|
+
### GoogleProduct.googleAPIProductMap : <code>GoogleProductAPI</code>
|
|
1872
1872
|
**Kind**: static constant of [<code>GoogleProduct</code>](#module_GoogleProduct)
|
|
1873
|
-
<a name="module_GoogleProduct..
|
|
1873
|
+
<a name="module_GoogleProduct..googleProductAPIField"></a>
|
|
1874
1874
|
|
|
1875
|
-
### GoogleProduct~
|
|
1875
|
+
### GoogleProduct~googleProductAPIField(field, InventoryProduct)
|
|
1876
1876
|
**Kind**: inner method of [<code>GoogleProduct</code>](#module_GoogleProduct)
|
|
1877
1877
|
|
|
1878
1878
|
| Param | Type |
|
|
@@ -2235,9 +2235,9 @@ Typedefs, constants, support functions and database operations related to Produc
|
|
|
2235
2235
|
|
|
2236
2236
|
* [GoogleProduct](#module_GoogleProduct)
|
|
2237
2237
|
* _static_
|
|
2238
|
-
* [.
|
|
2238
|
+
* [.googleAPIProductMap](#module_GoogleProduct.googleAPIProductMap) : <code>GoogleProductAPI</code>
|
|
2239
2239
|
* _inner_
|
|
2240
|
-
* [~
|
|
2240
|
+
* [~googleProductAPIField(field, InventoryProduct)](#module_GoogleProduct..googleProductAPIField)
|
|
2241
2241
|
* [~SKU](#module_GoogleProduct..SKU) : <code>string</code>
|
|
2242
2242
|
* [~Name](#module_GoogleProduct..Name) : <code>string</code>
|
|
2243
2243
|
* [~ImageObject](#module_GoogleProduct..ImageObject) : <code>object</code>
|
|
@@ -2262,13 +2262,13 @@ Typedefs, constants, support functions and database operations related to Produc
|
|
|
2262
2262
|
* [~QAObject](#module_GoogleProduct..QAObject) : <code>object</code>
|
|
2263
2263
|
* [~GoogleProductAPI](#module_GoogleProduct..GoogleProductAPI) : <code>object</code>
|
|
2264
2264
|
|
|
2265
|
-
<a name="module_GoogleProduct.
|
|
2265
|
+
<a name="module_GoogleProduct.googleAPIProductMap"></a>
|
|
2266
2266
|
|
|
2267
|
-
### GoogleProduct.
|
|
2267
|
+
### GoogleProduct.googleAPIProductMap : <code>GoogleProductAPI</code>
|
|
2268
2268
|
**Kind**: static constant of [<code>GoogleProduct</code>](#module_GoogleProduct)
|
|
2269
|
-
<a name="module_GoogleProduct..
|
|
2269
|
+
<a name="module_GoogleProduct..googleProductAPIField"></a>
|
|
2270
2270
|
|
|
2271
|
-
### GoogleProduct~
|
|
2271
|
+
### GoogleProduct~googleProductAPIField(field, InventoryProduct)
|
|
2272
2272
|
**Kind**: inner method of [<code>GoogleProduct</code>](#module_GoogleProduct)
|
|
2273
2273
|
|
|
2274
2274
|
| Param | Type |
|
|
@@ -2623,253 +2623,6 @@ a Google Product record
|
|
|
2623
2623
|
| shipping_width | <code>Text</code> | The width of the product used to calculate the shipping cost by dimensional weight |
|
|
2624
2624
|
| shipping_height | <code>Text</code> | The height of the product used to calculate the shipping cost by dimensional weight |
|
|
2625
2625
|
|
|
2626
|
-
<a name="module_SquarespaceProduct"></a>
|
|
2627
|
-
|
|
2628
|
-
## SquarespaceProduct
|
|
2629
|
-
Typedefs, constants, support functions and database operations related to Products
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
* [SquarespaceProduct](#module_SquarespaceProduct)
|
|
2633
|
-
* [~recursiveMapWalk(thisObject, labels)](#module_SquarespaceProduct..recursiveMapWalk)
|
|
2634
|
-
* [~AttributeList](#module_SquarespaceProduct..AttributeList) : <code>Array.String</code>
|
|
2635
|
-
* [~AttributeValue](#module_SquarespaceProduct..AttributeValue) : <code>object</code>
|
|
2636
|
-
* [~ProductImage](#module_SquarespaceProduct..ProductImage) : <code>object</code>
|
|
2637
|
-
* [~CurrencyDescription](#module_SquarespaceProduct..CurrencyDescription) : <code>object</code>
|
|
2638
|
-
* [~MonetaryValue](#module_SquarespaceProduct..MonetaryValue) : <code>object</code>
|
|
2639
|
-
* [~FullProductPricing](#module_SquarespaceProduct..FullProductPricing) : <code>object</code>
|
|
2640
|
-
* [~ProductDimensionsUnit](#module_SquarespaceProduct..ProductDimensionsUnit) : <code>object</code>
|
|
2641
|
-
* [~ProductDimensions](#module_SquarespaceProduct..ProductDimensions) : <code>object</code>
|
|
2642
|
-
* [~ProductWeightUnitEnum](#module_SquarespaceProduct..ProductWeightUnitEnum) : <code>"KILOGRAM"</code> \| <code>"POUND"</code>
|
|
2643
|
-
* [~ProductWeight](#module_SquarespaceProduct..ProductWeight) : <code>object</code>
|
|
2644
|
-
* [~ProductMeasurements](#module_SquarespaceProduct..ProductMeasurements) : <code>object</code>
|
|
2645
|
-
* [~ProductStock](#module_SquarespaceProduct..ProductStock) : <code>object</code>
|
|
2646
|
-
* [~MetaData](#module_SquarespaceProduct..MetaData) : <code>object</code>
|
|
2647
|
-
* [~ProductTypeV2Enum](#module_SquarespaceProduct..ProductTypeV2Enum) : <code>"PHYSICAL"</code> \| <code>"SERVICE"</code> \| <code>"GIFT\_CARD"</code> \| <code>"DIGITAL"</code>
|
|
2648
|
-
* [~PhysicalProductVariant](#module_SquarespaceProduct..PhysicalProductVariant) : <code>object</code>
|
|
2649
|
-
* [~PhysicalProduct](#module_SquarespaceProduct..PhysicalProduct) : <code>object</code>
|
|
2650
|
-
|
|
2651
|
-
<a name="module_SquarespaceProduct..recursiveMapWalk"></a>
|
|
2652
|
-
|
|
2653
|
-
### SquarespaceProduct~recursiveMapWalk(thisObject, labels)
|
|
2654
|
-
Uses an array of object member labels to insert a value into an object
|
|
2655
|
-
|
|
2656
|
-
**Kind**: inner method of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2657
|
-
|
|
2658
|
-
| Param | Type |
|
|
2659
|
-
| --- | --- |
|
|
2660
|
-
| thisObject | <code>object</code> |
|
|
2661
|
-
| labels | <code>Array.string</code> |
|
|
2662
|
-
|
|
2663
|
-
<a name="module_SquarespaceProduct..AttributeList"></a>
|
|
2664
|
-
|
|
2665
|
-
### SquarespaceProduct~AttributeList : <code>Array.String</code>
|
|
2666
|
-
A list of attributes for a product
|
|
2667
|
-
|
|
2668
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2669
|
-
<a name="module_SquarespaceProduct..AttributeValue"></a>
|
|
2670
|
-
|
|
2671
|
-
### SquarespaceProduct~AttributeValue : <code>object</code>
|
|
2672
|
-
Array of attribute name/value pairs
|
|
2673
|
-
|
|
2674
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2675
|
-
**Properties**
|
|
2676
|
-
|
|
2677
|
-
| Name | Type | Description |
|
|
2678
|
-
| --- | --- | --- |
|
|
2679
|
-
| AttibuteName | <code>string</code> | attribute name from attribute list |
|
|
2680
|
-
| value | <code>string</code> | value for the particular attribute |
|
|
2681
|
-
|
|
2682
|
-
<a name="module_SquarespaceProduct..ProductImage"></a>
|
|
2683
|
-
|
|
2684
|
-
### SquarespaceProduct~ProductImage : <code>object</code>
|
|
2685
|
-
Image Descriptor
|
|
2686
|
-
|
|
2687
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2688
|
-
**Properties**
|
|
2689
|
-
|
|
2690
|
-
| Name | Type | Description |
|
|
2691
|
-
| --- | --- | --- |
|
|
2692
|
-
| altText | <code>string</code> | alt text for the image - SEO etc |
|
|
2693
|
-
| availableFormats | <code>Array.string</code> | Available image sizes. |
|
|
2694
|
-
| id | <code>string</code> | unique id for this productImage |
|
|
2695
|
-
| orderIndex | <code>integer</code> | Position of the image in the product's image list. |
|
|
2696
|
-
| originalSize | <code>object</code> | Image size when first uploaded. |
|
|
2697
|
-
| URL | <code>string</code> | Absolute URL of the image hosted on Squarespace. |
|
|
2698
|
-
|
|
2699
|
-
<a name="module_SquarespaceProduct..CurrencyDescription"></a>
|
|
2700
|
-
|
|
2701
|
-
### SquarespaceProduct~CurrencyDescription : <code>object</code>
|
|
2702
|
-
Currency Description ISO 4217 currency code
|
|
2703
|
-
|
|
2704
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2705
|
-
**Properties**
|
|
2706
|
-
|
|
2707
|
-
| Name | Type |
|
|
2708
|
-
| --- | --- |
|
|
2709
|
-
| currencyCode | <code>string</code> |
|
|
2710
|
-
| defaultFractionDigits | <code>integer</code> |
|
|
2711
|
-
| displayName | <code>string</code> |
|
|
2712
|
-
| numericCodeAsString | <code>string</code> |
|
|
2713
|
-
| symbol | <code>string</code> |
|
|
2714
|
-
|
|
2715
|
-
<a name="module_SquarespaceProduct..MonetaryValue"></a>
|
|
2716
|
-
|
|
2717
|
-
### SquarespaceProduct~MonetaryValue : <code>object</code>
|
|
2718
|
-
Monetary Value Specification
|
|
2719
|
-
|
|
2720
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2721
|
-
**Properties**
|
|
2722
|
-
|
|
2723
|
-
| Name | Type | Description |
|
|
2724
|
-
| --- | --- | --- |
|
|
2725
|
-
| | <code>CurrencyDescription</code> | |
|
|
2726
|
-
| value | <code>decimal</code> | Decimal monetary value |
|
|
2727
|
-
|
|
2728
|
-
<a name="module_SquarespaceProduct..FullProductPricing"></a>
|
|
2729
|
-
|
|
2730
|
-
### SquarespaceProduct~FullProductPricing : <code>object</code>
|
|
2731
|
-
Pricing Object
|
|
2732
|
-
|
|
2733
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2734
|
-
**Properties**
|
|
2735
|
-
|
|
2736
|
-
| Name | Type |
|
|
2737
|
-
| --- | --- |
|
|
2738
|
-
| basePrice | <code>MonetaryValue</code> |
|
|
2739
|
-
| onSale | <code>boolean</code> |
|
|
2740
|
-
| salePrice | <code>MonetaryValue</code> |
|
|
2741
|
-
|
|
2742
|
-
<a name="module_SquarespaceProduct..ProductDimensionsUnit"></a>
|
|
2743
|
-
|
|
2744
|
-
### SquarespaceProduct~ProductDimensionsUnit : <code>object</code>
|
|
2745
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2746
|
-
**Properties**
|
|
2747
|
-
|
|
2748
|
-
| Name | Type |
|
|
2749
|
-
| --- | --- |
|
|
2750
|
-
| name | <code>Text</code> |
|
|
2751
|
-
| value | <code>Text</code> |
|
|
2752
|
-
|
|
2753
|
-
<a name="module_SquarespaceProduct..ProductDimensions"></a>
|
|
2754
|
-
|
|
2755
|
-
### SquarespaceProduct~ProductDimensions : <code>object</code>
|
|
2756
|
-
Dimensions Object
|
|
2757
|
-
|
|
2758
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2759
|
-
**Properties**
|
|
2760
|
-
|
|
2761
|
-
| Name | Type |
|
|
2762
|
-
| --- | --- |
|
|
2763
|
-
| height | <code>float</code> |
|
|
2764
|
-
| width | <code>float</code> |
|
|
2765
|
-
| length | <code>float</code> |
|
|
2766
|
-
| unit | <code>ProductDimensionsUnit</code> |
|
|
2767
|
-
|
|
2768
|
-
<a name="module_SquarespaceProduct..ProductWeightUnitEnum"></a>
|
|
2769
|
-
|
|
2770
|
-
### SquarespaceProduct~ProductWeightUnitEnum : <code>"KILOGRAM"</code> \| <code>"POUND"</code>
|
|
2771
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2772
|
-
<a name="module_SquarespaceProduct..ProductWeight"></a>
|
|
2773
|
-
|
|
2774
|
-
### SquarespaceProduct~ProductWeight : <code>object</code>
|
|
2775
|
-
Weight Object
|
|
2776
|
-
|
|
2777
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2778
|
-
**Properties**
|
|
2779
|
-
|
|
2780
|
-
| Name | Type |
|
|
2781
|
-
| --- | --- |
|
|
2782
|
-
| unit | <code>"KILOGRAM"</code> \| <code>"POUND"</code> |
|
|
2783
|
-
| value | <code>float</code> |
|
|
2784
|
-
|
|
2785
|
-
<a name="module_SquarespaceProduct..ProductMeasurements"></a>
|
|
2786
|
-
|
|
2787
|
-
### SquarespaceProduct~ProductMeasurements : <code>object</code>
|
|
2788
|
-
Measurements of the variant when it's shipped. Present for PHYSICAL products only.
|
|
2789
|
-
|
|
2790
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2791
|
-
**Properties**
|
|
2792
|
-
|
|
2793
|
-
| Name | Type |
|
|
2794
|
-
| --- | --- |
|
|
2795
|
-
| dimensions | <code>ProductDimensions</code> |
|
|
2796
|
-
| weight | <code>ProductWeight</code> |
|
|
2797
|
-
|
|
2798
|
-
<a name="module_SquarespaceProduct..ProductStock"></a>
|
|
2799
|
-
|
|
2800
|
-
### SquarespaceProduct~ProductStock : <code>object</code>
|
|
2801
|
-
Available stock for the variant. Present for PHYSICAL products only.
|
|
2802
|
-
|
|
2803
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2804
|
-
**Properties**
|
|
2805
|
-
|
|
2806
|
-
| Name | Type |
|
|
2807
|
-
| --- | --- |
|
|
2808
|
-
| quantity | <code>integer</code> |
|
|
2809
|
-
| unlimited | <code>boolean</code> |
|
|
2810
|
-
|
|
2811
|
-
<a name="module_SquarespaceProduct..MetaData"></a>
|
|
2812
|
-
|
|
2813
|
-
### SquarespaceProduct~MetaData : <code>object</code>
|
|
2814
|
-
Meta Information for SEO
|
|
2815
|
-
|
|
2816
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2817
|
-
**Properties**
|
|
2818
|
-
|
|
2819
|
-
| Name | Type |
|
|
2820
|
-
| --- | --- |
|
|
2821
|
-
| title | <code>string</code> |
|
|
2822
|
-
| description | <code>string</code> |
|
|
2823
|
-
|
|
2824
|
-
<a name="module_SquarespaceProduct..ProductTypeV2Enum"></a>
|
|
2825
|
-
|
|
2826
|
-
### SquarespaceProduct~ProductTypeV2Enum : <code>"PHYSICAL"</code> \| <code>"SERVICE"</code> \| <code>"GIFT\_CARD"</code> \| <code>"DIGITAL"</code>
|
|
2827
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2828
|
-
<a name="module_SquarespaceProduct..PhysicalProductVariant"></a>
|
|
2829
|
-
|
|
2830
|
-
### SquarespaceProduct~PhysicalProductVariant : <code>object</code>
|
|
2831
|
-
variant record (including inventory and pricing)
|
|
2832
|
-
|
|
2833
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2834
|
-
**Properties**
|
|
2835
|
-
|
|
2836
|
-
| Name | Type | Description |
|
|
2837
|
-
| --- | --- | --- |
|
|
2838
|
-
| attributes | <code>Array.AttributeValue</code> | array of attribute/value pairs for a variant |
|
|
2839
|
-
| gtin | <code>string</code> | Global Trade Item Number |
|
|
2840
|
-
| id | <code>string</code> | unique ID for product variant |
|
|
2841
|
-
| image | <code>ProductImage</code> | Image associated with this variant |
|
|
2842
|
-
| mpn | <code>string</code> | manufacturer part number |
|
|
2843
|
-
| shippingMeasurements | <code>ProductMeasurements</code> | |
|
|
2844
|
-
| sku | <code>string</code> | |
|
|
2845
|
-
| stock | <code>ProductStock</code> | |
|
|
2846
|
-
|
|
2847
|
-
<a name="module_SquarespaceProduct..PhysicalProduct"></a>
|
|
2848
|
-
|
|
2849
|
-
### SquarespaceProduct~PhysicalProduct : <code>object</code>
|
|
2850
|
-
a Square product record
|
|
2851
|
-
|
|
2852
|
-
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
2853
|
-
**Properties**
|
|
2854
|
-
|
|
2855
|
-
| Name | Type | Description |
|
|
2856
|
-
| --- | --- | --- |
|
|
2857
|
-
| createdOn | <code>dateTime</code> | |
|
|
2858
|
-
| id | <code>string</code> | Id of document (redundant for convenience) |
|
|
2859
|
-
| modifiedOn | <code>dateTime</code> | |
|
|
2860
|
-
| storePageId | <code>string</code> | |
|
|
2861
|
-
| type | <code>"PHYSICAL"</code> \| <code>"SERVICE"</code> \| <code>"GIFT\_CARD"</code> \| <code>"DIGITAL"</code> | |
|
|
2862
|
-
| description | <code>string</code> | Basic description of the product |
|
|
2863
|
-
| images | <code>Array.ProductImage</code> | Image associated with this variant |
|
|
2864
|
-
| isVisible | <code>boolean</code> | |
|
|
2865
|
-
| name | <code>string</code> | name for the Product |
|
|
2866
|
-
| seoOptions | <code>MetaData</code> | |
|
|
2867
|
-
| tags | <code>Array.string</code> | |
|
|
2868
|
-
| URL | <code>string</code> | |
|
|
2869
|
-
| urlSlug | <code>string</code> | |
|
|
2870
|
-
| variantAttributes | <code>Array.string</code> | |
|
|
2871
|
-
| variants | <code>Array.PhysicalProductVariant</code> | |
|
|
2872
|
-
|
|
2873
2626
|
<a name="module_Product"></a>
|
|
2874
2627
|
|
|
2875
2628
|
## Product
|
|
@@ -2881,9 +2634,9 @@ Typedefs, constants, support functions and database operations related to Produc
|
|
|
2881
2634
|
* [.createProduct(user)](#module_Product.createProduct) ⇒ <code>Promise.<void></code>
|
|
2882
2635
|
* [.makeProductFromChild(child)](#module_Product.makeProductFromChild) ⇒ <code>Record</code>
|
|
2883
2636
|
* _inner_
|
|
2884
|
-
* [~
|
|
2885
|
-
* [~
|
|
2886
|
-
* [~
|
|
2637
|
+
* [~productDefault](#module_Product..productDefault) : <code>Product</code>
|
|
2638
|
+
* [~productDataForm](#module_Product..productDataForm) : <code>Product</code>
|
|
2639
|
+
* [~productDefaultForm](#module_Product..productDefaultForm) : <code>Product</code>
|
|
2887
2640
|
* [~updateProduct(product, user)](#module_Product..updateProduct) ⇒ <code>promise.LineItem</code>
|
|
2888
2641
|
* [~summarizeProduct(product)](#module_Product..summarizeProduct) ⇒ <code>string</code>
|
|
2889
2642
|
* [~Recipe_Data](#module_Product..Recipe_Data) : <code>object</code>
|
|
@@ -2934,23 +2687,23 @@ Creates a new Blank Product
|
|
|
2934
2687
|
| --- | --- | --- |
|
|
2935
2688
|
| child | <code>Record</code> | a record assumed to be a leaf/child |
|
|
2936
2689
|
|
|
2937
|
-
<a name="module_Product..
|
|
2690
|
+
<a name="module_Product..productDefault"></a>
|
|
2938
2691
|
|
|
2939
|
-
### Product~
|
|
2692
|
+
### Product~productDefault : <code>Product</code>
|
|
2940
2693
|
**Kind**: inner constant of [<code>Product</code>](#module_Product)
|
|
2941
2694
|
**Default**: <code>{"platformIds":"","platformData":"","name":null,"short_name":null,"description":null,"short_description":null,"google_product_category":null,"product_type":null,"brand":"","demographics":"","attributes":"","recipe":"","mediaObject":"","mobileInfo":null,"isVisible":true,"type":"PHYSICAL","seoOptions":"","tags":"","materials":"","patterns":"","URL":null,"urlSlug":null,"variantAttributes":"","variants":""}</code>
|
|
2942
2695
|
**Read only**: true
|
|
2943
|
-
<a name="module_Product..
|
|
2696
|
+
<a name="module_Product..productDataForm"></a>
|
|
2944
2697
|
|
|
2945
|
-
### Product~
|
|
2698
|
+
### Product~productDataForm : <code>Product</code>
|
|
2946
2699
|
Form to create test data
|
|
2947
2700
|
|
|
2948
2701
|
**Kind**: inner constant of [<code>Product</code>](#module_Product)
|
|
2949
2702
|
**Default**: <code>{"Id":"","refPath":null,"name":"","description":"","sku":"","markups":"","projectQ":""}</code>
|
|
2950
2703
|
**Read only**: true
|
|
2951
|
-
<a name="module_Product..
|
|
2704
|
+
<a name="module_Product..productDefaultForm"></a>
|
|
2952
2705
|
|
|
2953
|
-
### Product~
|
|
2706
|
+
### Product~productDefaultForm : <code>Product</code>
|
|
2954
2707
|
Form to enter MINIMAL product data to start creation
|
|
2955
2708
|
|
|
2956
2709
|
**Kind**: inner constant of [<code>Product</code>](#module_Product)
|
|
@@ -3364,6 +3117,253 @@ a product record
|
|
|
3364
3117
|
| variantAttributes | <code>Array.string</code> | |
|
|
3365
3118
|
| variants | <code>Array.PhysicalProductVariant</code> | |
|
|
3366
3119
|
|
|
3120
|
+
<a name="module_SquarespaceProduct"></a>
|
|
3121
|
+
|
|
3122
|
+
## SquarespaceProduct
|
|
3123
|
+
Typedefs, constants, support functions and database operations related to Products
|
|
3124
|
+
|
|
3125
|
+
|
|
3126
|
+
* [SquarespaceProduct](#module_SquarespaceProduct)
|
|
3127
|
+
* [~recursiveMapWalk(thisObject, labels)](#module_SquarespaceProduct..recursiveMapWalk)
|
|
3128
|
+
* [~AttributeList](#module_SquarespaceProduct..AttributeList) : <code>Array.String</code>
|
|
3129
|
+
* [~AttributeValue](#module_SquarespaceProduct..AttributeValue) : <code>object</code>
|
|
3130
|
+
* [~ProductImage](#module_SquarespaceProduct..ProductImage) : <code>object</code>
|
|
3131
|
+
* [~CurrencyDescription](#module_SquarespaceProduct..CurrencyDescription) : <code>object</code>
|
|
3132
|
+
* [~MonetaryValue](#module_SquarespaceProduct..MonetaryValue) : <code>object</code>
|
|
3133
|
+
* [~FullProductPricing](#module_SquarespaceProduct..FullProductPricing) : <code>object</code>
|
|
3134
|
+
* [~ProductDimensionsUnit](#module_SquarespaceProduct..ProductDimensionsUnit) : <code>object</code>
|
|
3135
|
+
* [~ProductDimensions](#module_SquarespaceProduct..ProductDimensions) : <code>object</code>
|
|
3136
|
+
* [~ProductWeightUnitEnum](#module_SquarespaceProduct..ProductWeightUnitEnum) : <code>"KILOGRAM"</code> \| <code>"POUND"</code>
|
|
3137
|
+
* [~ProductWeight](#module_SquarespaceProduct..ProductWeight) : <code>object</code>
|
|
3138
|
+
* [~ProductMeasurements](#module_SquarespaceProduct..ProductMeasurements) : <code>object</code>
|
|
3139
|
+
* [~ProductStock](#module_SquarespaceProduct..ProductStock) : <code>object</code>
|
|
3140
|
+
* [~MetaData](#module_SquarespaceProduct..MetaData) : <code>object</code>
|
|
3141
|
+
* [~ProductTypeV2Enum](#module_SquarespaceProduct..ProductTypeV2Enum) : <code>"PHYSICAL"</code> \| <code>"SERVICE"</code> \| <code>"GIFT\_CARD"</code> \| <code>"DIGITAL"</code>
|
|
3142
|
+
* [~PhysicalProductVariant](#module_SquarespaceProduct..PhysicalProductVariant) : <code>object</code>
|
|
3143
|
+
* [~PhysicalProduct](#module_SquarespaceProduct..PhysicalProduct) : <code>object</code>
|
|
3144
|
+
|
|
3145
|
+
<a name="module_SquarespaceProduct..recursiveMapWalk"></a>
|
|
3146
|
+
|
|
3147
|
+
### SquarespaceProduct~recursiveMapWalk(thisObject, labels)
|
|
3148
|
+
Uses an array of object member labels to insert a value into an object
|
|
3149
|
+
|
|
3150
|
+
**Kind**: inner method of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3151
|
+
|
|
3152
|
+
| Param | Type |
|
|
3153
|
+
| --- | --- |
|
|
3154
|
+
| thisObject | <code>object</code> |
|
|
3155
|
+
| labels | <code>Array.string</code> |
|
|
3156
|
+
|
|
3157
|
+
<a name="module_SquarespaceProduct..AttributeList"></a>
|
|
3158
|
+
|
|
3159
|
+
### SquarespaceProduct~AttributeList : <code>Array.String</code>
|
|
3160
|
+
A list of attributes for a product
|
|
3161
|
+
|
|
3162
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3163
|
+
<a name="module_SquarespaceProduct..AttributeValue"></a>
|
|
3164
|
+
|
|
3165
|
+
### SquarespaceProduct~AttributeValue : <code>object</code>
|
|
3166
|
+
Array of attribute name/value pairs
|
|
3167
|
+
|
|
3168
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3169
|
+
**Properties**
|
|
3170
|
+
|
|
3171
|
+
| Name | Type | Description |
|
|
3172
|
+
| --- | --- | --- |
|
|
3173
|
+
| AttibuteName | <code>string</code> | attribute name from attribute list |
|
|
3174
|
+
| value | <code>string</code> | value for the particular attribute |
|
|
3175
|
+
|
|
3176
|
+
<a name="module_SquarespaceProduct..ProductImage"></a>
|
|
3177
|
+
|
|
3178
|
+
### SquarespaceProduct~ProductImage : <code>object</code>
|
|
3179
|
+
Image Descriptor
|
|
3180
|
+
|
|
3181
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3182
|
+
**Properties**
|
|
3183
|
+
|
|
3184
|
+
| Name | Type | Description |
|
|
3185
|
+
| --- | --- | --- |
|
|
3186
|
+
| altText | <code>string</code> | alt text for the image - SEO etc |
|
|
3187
|
+
| availableFormats | <code>Array.string</code> | Available image sizes. |
|
|
3188
|
+
| id | <code>string</code> | unique id for this productImage |
|
|
3189
|
+
| orderIndex | <code>integer</code> | Position of the image in the product's image list. |
|
|
3190
|
+
| originalSize | <code>object</code> | Image size when first uploaded. |
|
|
3191
|
+
| URL | <code>string</code> | Absolute URL of the image hosted on Squarespace. |
|
|
3192
|
+
|
|
3193
|
+
<a name="module_SquarespaceProduct..CurrencyDescription"></a>
|
|
3194
|
+
|
|
3195
|
+
### SquarespaceProduct~CurrencyDescription : <code>object</code>
|
|
3196
|
+
Currency Description ISO 4217 currency code
|
|
3197
|
+
|
|
3198
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3199
|
+
**Properties**
|
|
3200
|
+
|
|
3201
|
+
| Name | Type |
|
|
3202
|
+
| --- | --- |
|
|
3203
|
+
| currencyCode | <code>string</code> |
|
|
3204
|
+
| defaultFractionDigits | <code>integer</code> |
|
|
3205
|
+
| displayName | <code>string</code> |
|
|
3206
|
+
| numericCodeAsString | <code>string</code> |
|
|
3207
|
+
| symbol | <code>string</code> |
|
|
3208
|
+
|
|
3209
|
+
<a name="module_SquarespaceProduct..MonetaryValue"></a>
|
|
3210
|
+
|
|
3211
|
+
### SquarespaceProduct~MonetaryValue : <code>object</code>
|
|
3212
|
+
Monetary Value Specification
|
|
3213
|
+
|
|
3214
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3215
|
+
**Properties**
|
|
3216
|
+
|
|
3217
|
+
| Name | Type | Description |
|
|
3218
|
+
| --- | --- | --- |
|
|
3219
|
+
| | <code>CurrencyDescription</code> | |
|
|
3220
|
+
| value | <code>decimal</code> | Decimal monetary value |
|
|
3221
|
+
|
|
3222
|
+
<a name="module_SquarespaceProduct..FullProductPricing"></a>
|
|
3223
|
+
|
|
3224
|
+
### SquarespaceProduct~FullProductPricing : <code>object</code>
|
|
3225
|
+
Pricing Object
|
|
3226
|
+
|
|
3227
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3228
|
+
**Properties**
|
|
3229
|
+
|
|
3230
|
+
| Name | Type |
|
|
3231
|
+
| --- | --- |
|
|
3232
|
+
| basePrice | <code>MonetaryValue</code> |
|
|
3233
|
+
| onSale | <code>boolean</code> |
|
|
3234
|
+
| salePrice | <code>MonetaryValue</code> |
|
|
3235
|
+
|
|
3236
|
+
<a name="module_SquarespaceProduct..ProductDimensionsUnit"></a>
|
|
3237
|
+
|
|
3238
|
+
### SquarespaceProduct~ProductDimensionsUnit : <code>object</code>
|
|
3239
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3240
|
+
**Properties**
|
|
3241
|
+
|
|
3242
|
+
| Name | Type |
|
|
3243
|
+
| --- | --- |
|
|
3244
|
+
| name | <code>Text</code> |
|
|
3245
|
+
| value | <code>Text</code> |
|
|
3246
|
+
|
|
3247
|
+
<a name="module_SquarespaceProduct..ProductDimensions"></a>
|
|
3248
|
+
|
|
3249
|
+
### SquarespaceProduct~ProductDimensions : <code>object</code>
|
|
3250
|
+
Dimensions Object
|
|
3251
|
+
|
|
3252
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3253
|
+
**Properties**
|
|
3254
|
+
|
|
3255
|
+
| Name | Type |
|
|
3256
|
+
| --- | --- |
|
|
3257
|
+
| height | <code>float</code> |
|
|
3258
|
+
| width | <code>float</code> |
|
|
3259
|
+
| length | <code>float</code> |
|
|
3260
|
+
| unit | <code>ProductDimensionsUnit</code> |
|
|
3261
|
+
|
|
3262
|
+
<a name="module_SquarespaceProduct..ProductWeightUnitEnum"></a>
|
|
3263
|
+
|
|
3264
|
+
### SquarespaceProduct~ProductWeightUnitEnum : <code>"KILOGRAM"</code> \| <code>"POUND"</code>
|
|
3265
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3266
|
+
<a name="module_SquarespaceProduct..ProductWeight"></a>
|
|
3267
|
+
|
|
3268
|
+
### SquarespaceProduct~ProductWeight : <code>object</code>
|
|
3269
|
+
Weight Object
|
|
3270
|
+
|
|
3271
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3272
|
+
**Properties**
|
|
3273
|
+
|
|
3274
|
+
| Name | Type |
|
|
3275
|
+
| --- | --- |
|
|
3276
|
+
| unit | <code>"KILOGRAM"</code> \| <code>"POUND"</code> |
|
|
3277
|
+
| value | <code>float</code> |
|
|
3278
|
+
|
|
3279
|
+
<a name="module_SquarespaceProduct..ProductMeasurements"></a>
|
|
3280
|
+
|
|
3281
|
+
### SquarespaceProduct~ProductMeasurements : <code>object</code>
|
|
3282
|
+
Measurements of the variant when it's shipped. Present for PHYSICAL products only.
|
|
3283
|
+
|
|
3284
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3285
|
+
**Properties**
|
|
3286
|
+
|
|
3287
|
+
| Name | Type |
|
|
3288
|
+
| --- | --- |
|
|
3289
|
+
| dimensions | <code>ProductDimensions</code> |
|
|
3290
|
+
| weight | <code>ProductWeight</code> |
|
|
3291
|
+
|
|
3292
|
+
<a name="module_SquarespaceProduct..ProductStock"></a>
|
|
3293
|
+
|
|
3294
|
+
### SquarespaceProduct~ProductStock : <code>object</code>
|
|
3295
|
+
Available stock for the variant. Present for PHYSICAL products only.
|
|
3296
|
+
|
|
3297
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3298
|
+
**Properties**
|
|
3299
|
+
|
|
3300
|
+
| Name | Type |
|
|
3301
|
+
| --- | --- |
|
|
3302
|
+
| quantity | <code>integer</code> |
|
|
3303
|
+
| unlimited | <code>boolean</code> |
|
|
3304
|
+
|
|
3305
|
+
<a name="module_SquarespaceProduct..MetaData"></a>
|
|
3306
|
+
|
|
3307
|
+
### SquarespaceProduct~MetaData : <code>object</code>
|
|
3308
|
+
Meta Information for SEO
|
|
3309
|
+
|
|
3310
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3311
|
+
**Properties**
|
|
3312
|
+
|
|
3313
|
+
| Name | Type |
|
|
3314
|
+
| --- | --- |
|
|
3315
|
+
| title | <code>string</code> |
|
|
3316
|
+
| description | <code>string</code> |
|
|
3317
|
+
|
|
3318
|
+
<a name="module_SquarespaceProduct..ProductTypeV2Enum"></a>
|
|
3319
|
+
|
|
3320
|
+
### SquarespaceProduct~ProductTypeV2Enum : <code>"PHYSICAL"</code> \| <code>"SERVICE"</code> \| <code>"GIFT\_CARD"</code> \| <code>"DIGITAL"</code>
|
|
3321
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3322
|
+
<a name="module_SquarespaceProduct..PhysicalProductVariant"></a>
|
|
3323
|
+
|
|
3324
|
+
### SquarespaceProduct~PhysicalProductVariant : <code>object</code>
|
|
3325
|
+
variant record (including inventory and pricing)
|
|
3326
|
+
|
|
3327
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3328
|
+
**Properties**
|
|
3329
|
+
|
|
3330
|
+
| Name | Type | Description |
|
|
3331
|
+
| --- | --- | --- |
|
|
3332
|
+
| attributes | <code>Array.AttributeValue</code> | array of attribute/value pairs for a variant |
|
|
3333
|
+
| gtin | <code>string</code> | Global Trade Item Number |
|
|
3334
|
+
| id | <code>string</code> | unique ID for product variant |
|
|
3335
|
+
| image | <code>ProductImage</code> | Image associated with this variant |
|
|
3336
|
+
| mpn | <code>string</code> | manufacturer part number |
|
|
3337
|
+
| shippingMeasurements | <code>ProductMeasurements</code> | |
|
|
3338
|
+
| sku | <code>string</code> | |
|
|
3339
|
+
| stock | <code>ProductStock</code> | |
|
|
3340
|
+
|
|
3341
|
+
<a name="module_SquarespaceProduct..PhysicalProduct"></a>
|
|
3342
|
+
|
|
3343
|
+
### SquarespaceProduct~PhysicalProduct : <code>object</code>
|
|
3344
|
+
a Square product record
|
|
3345
|
+
|
|
3346
|
+
**Kind**: inner typedef of [<code>SquarespaceProduct</code>](#module_SquarespaceProduct)
|
|
3347
|
+
**Properties**
|
|
3348
|
+
|
|
3349
|
+
| Name | Type | Description |
|
|
3350
|
+
| --- | --- | --- |
|
|
3351
|
+
| createdOn | <code>dateTime</code> | |
|
|
3352
|
+
| id | <code>string</code> | Id of document (redundant for convenience) |
|
|
3353
|
+
| modifiedOn | <code>dateTime</code> | |
|
|
3354
|
+
| storePageId | <code>string</code> | |
|
|
3355
|
+
| type | <code>"PHYSICAL"</code> \| <code>"SERVICE"</code> \| <code>"GIFT\_CARD"</code> \| <code>"DIGITAL"</code> | |
|
|
3356
|
+
| description | <code>string</code> | Basic description of the product |
|
|
3357
|
+
| images | <code>Array.ProductImage</code> | Image associated with this variant |
|
|
3358
|
+
| isVisible | <code>boolean</code> | |
|
|
3359
|
+
| name | <code>string</code> | name for the Product |
|
|
3360
|
+
| seoOptions | <code>MetaData</code> | |
|
|
3361
|
+
| tags | <code>Array.string</code> | |
|
|
3362
|
+
| URL | <code>string</code> | |
|
|
3363
|
+
| urlSlug | <code>string</code> | |
|
|
3364
|
+
| variantAttributes | <code>Array.string</code> | |
|
|
3365
|
+
| variants | <code>Array.PhysicalProductVariant</code> | |
|
|
3366
|
+
|
|
3367
3367
|
<a name="module_User"></a>
|
|
3368
3368
|
|
|
3369
3369
|
## User
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
/**
|
|
149
149
|
* @type {GoogleProductAPI}
|
|
150
150
|
*/
|
|
151
|
-
export const
|
|
151
|
+
export const googleAPIProductMap = {
|
|
152
152
|
//id needs programmatic processing
|
|
153
153
|
id: "variants[index].sku", //id of Product also used as sku
|
|
154
154
|
title: "name", //title (name) of Product
|
|
@@ -217,11 +217,11 @@ export const GoogleAPIProductMap = {
|
|
|
217
217
|
* @param {string} field
|
|
218
218
|
* @param {Product} InventoryProduct
|
|
219
219
|
*/
|
|
220
|
-
function
|
|
220
|
+
function googleProductAPIField(field, InventoryProduct) {
|
|
221
221
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
const
|
|
224
|
+
const googleProductCategory = {
|
|
225
225
|
"Animals & Pet Supplies": {
|
|
226
226
|
index: 1,
|
|
227
227
|
"Live Animals": {
|
|
@@ -291,7 +291,7 @@ import { typedRecordFromChild } from "../Utilities/index.js"
|
|
|
291
291
|
* @type {Product}
|
|
292
292
|
* @default
|
|
293
293
|
*/
|
|
294
|
-
const
|
|
294
|
+
const productDefault = {
|
|
295
295
|
platformIds: {
|
|
296
296
|
squarespaceId: null,
|
|
297
297
|
googleMerchantId: null,
|
|
@@ -355,7 +355,7 @@ const ProductDefault = {
|
|
|
355
355
|
* @type {Product}
|
|
356
356
|
* @default
|
|
357
357
|
*/
|
|
358
|
-
const
|
|
358
|
+
const productDataForm = {
|
|
359
359
|
Id: `string.uuid`,
|
|
360
360
|
refPath: null,
|
|
361
361
|
name: `commerce.product`,
|
|
@@ -372,7 +372,7 @@ const ProductDataForm = {
|
|
|
372
372
|
* @type {Product}
|
|
373
373
|
* @default
|
|
374
374
|
*/
|
|
375
|
-
const
|
|
375
|
+
const productDefaultForm = {
|
|
376
376
|
Id: `hidden`,
|
|
377
377
|
refPath: `hidden`,
|
|
378
378
|
name: "text",
|
|
@@ -380,10 +380,10 @@ const ProductDefaultForm = {
|
|
|
380
380
|
sku: "text",
|
|
381
381
|
};
|
|
382
382
|
|
|
383
|
-
Forms.Base[PRODUCT] =
|
|
384
|
-
Forms.BaseForm[PRODUCT] =
|
|
385
|
-
Forms.CreateForm[PRODUCT] =
|
|
386
|
-
Forms.Data[PRODUCT] =
|
|
383
|
+
Forms.Base[PRODUCT] = productDefault;
|
|
384
|
+
Forms.BaseForm[PRODUCT] = productDefaultForm;
|
|
385
|
+
Forms.CreateForm[PRODUCT] = productDefaultForm;
|
|
386
|
+
Forms.Data[PRODUCT] = productDataForm;
|
|
387
387
|
Forms.Summarize[PRODUCT] = summarizeProduct;
|
|
388
388
|
Forms.Save[PRODUCT] = updateProduct;
|
|
389
389
|
Forms.SearchBy[PRODUCT] = "name";
|
|
@@ -447,5 +447,5 @@ export function makeProductFromChild(child) {
|
|
|
447
447
|
return typedRecordFromChild(child, PRODUCT);
|
|
448
448
|
}
|
|
449
449
|
|
|
450
|
-
export * from "./
|
|
451
|
-
export * from "./
|
|
450
|
+
export * from "./googleMerchantAPI.js";
|
|
451
|
+
export * from "./squarespace.js"
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
//import { PRODUCT, MARKUPS, ISBN_LENGTH } from "../boilerplate/index.js";
|
|
8
8
|
|
|
9
9
|
//import {SampleJSON, feedSample} from "./SquarespaceSample.js"
|
|
10
|
-
import
|
|
10
|
+
import sampleJSON from './sampleJSON.json' with { type: 'json' };
|
|
11
11
|
import feedSample from './feedSample.json' with { type: 'json' };
|
|
12
12
|
//////////////////////////////////////////////////////////////////////
|
|
13
13
|
// Constants
|
|
@@ -153,7 +153,7 @@ import feedSample from './feedSample.json' with { type: 'json' };
|
|
|
153
153
|
//////////////////////////////////////////////////////////////////////
|
|
154
154
|
// utilities
|
|
155
155
|
|
|
156
|
-
const
|
|
156
|
+
const squarespaceVariantMap = {
|
|
157
157
|
"id": {target: "platformIds.SquarespaceId"},
|
|
158
158
|
"sku": {target: "sku"},
|
|
159
159
|
"image": {target: "image"},
|
|
@@ -166,7 +166,7 @@ const SquarespaceVariantMap = {
|
|
|
166
166
|
//other fields not used
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
-
const
|
|
169
|
+
const squarespaceProductMap = {
|
|
170
170
|
"id": {target: "platformIds.SquarespaceId"},
|
|
171
171
|
"type": {target:"product_type"},
|
|
172
172
|
"name": {target: "name"},
|
|
@@ -187,19 +187,19 @@ const SquarespaceProductMap = {
|
|
|
187
187
|
"isVisible": {target: "isVisible"},
|
|
188
188
|
};
|
|
189
189
|
|
|
190
|
-
function
|
|
190
|
+
function jsonToItemMapping(itemJSON, itemMap) {
|
|
191
191
|
const incomingItem = JSON.parse(itemJSON);
|
|
192
|
-
return
|
|
192
|
+
return itemToItemMapping(incomingItem, itemMap);
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
export function
|
|
195
|
+
export function jsonProductFeedToItemMapping(feedJSON) {
|
|
196
196
|
const incomingFeed = JSON.parse(feedJSON);
|
|
197
197
|
return incomingFeed.products.map(product => {
|
|
198
|
-
return
|
|
198
|
+
return itemToItemMapping(product, SquarespaceProductMap);
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
function
|
|
202
|
+
function itemToItemMapping(incomingItem, itemMap) {
|
|
203
203
|
|
|
204
204
|
let properties = Object.getOwnPropertyNames(incomingItem);
|
|
205
205
|
let outputItem = properties.reduce((outbound, property) => {
|
|
@@ -208,7 +208,7 @@ function ItemToItemMapping(incomingItem, itemMap) {
|
|
|
208
208
|
let saveValue = Array.isArray(incomingItem[property])
|
|
209
209
|
? incomingItem[property].map((entry) => {
|
|
210
210
|
return formatter
|
|
211
|
-
?
|
|
211
|
+
? itemToItemMapping(entry, formatter)
|
|
212
212
|
: entry;
|
|
213
213
|
})
|
|
214
214
|
: incomingItem[property];
|
|
@@ -240,5 +240,5 @@ function recursiveMapWalk(thisObject, labels, value) {
|
|
|
240
240
|
};
|
|
241
241
|
|
|
242
242
|
export function squarespaceFeedTest () {
|
|
243
|
-
return
|
|
243
|
+
return jsonProductFeedToItemMapping(feedSample);
|
|
244
244
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const sampleJSON = '{"id":"69fa54e8f691fe20c13bc732","type":"PHYSICAL","name":"Stack : : short gemstone earrings","description":"Bob","storePageId":"694b2289b16b8d02d4bdaaba","url":"https://sirlinhalljewelry.com/shop/p/stack-earrings-26050500","urlSlug":"p/stack-earrings-26050500","images":[{"id":"69fa5769cfa3e81e12d7c224","altText":"PXL_20260505_201834132.jpg","orderIndex":0,"url":"https://images.squarespace-cdn.com/content/v1/694b2288b16b8d02d4bdaa0c/2bf39ac2-a49b-4820-a211-961d6a0722ef/PXL_20260505_201834132.jpg","originalSize":{"width":480,"height":480},"availableFormats":[]},{"id":"69fa5769f691fe20c13bc9f8","altText":"PXL_20260505_201739701.jpg","orderIndex":1,"url":"https://images.squarespace-cdn.com/content/v1/694b2288b16b8d02d4bdaa0c/8d5186e3-e5a1-43bb-9714-77a939b8bc40/PXL_20260505_201739701.jpg","originalSize":{"width":480,"height":480},"availableFormats":[]},{"id":"69fa5769cfa3e81e12d7c225","altText":"PXL_20260505_201915047.jpg","orderIndex":2,"url":"https://images.squarespace-cdn.com/content/v1/694b2288b16b8d02d4bdaa0c/ff61c7e8-a03b-442e-81b2-db67241d85ec/PXL_20260505_201915047.jpg","originalSize":{"width":480,"height":480},"availableFormats":[]},{"id":"69fa5769f691fe20c13bc9f9","altText":"PXL_20260505_202122912.jpg","orderIndex":3,"url":"https://images.squarespace-cdn.com/content/v1/694b2288b16b8d02d4bdaa0c/357dfd2f-1bce-4687-b57b-1ff53209d970/PXL_20260505_202122912.jpg","originalSize":{"width":480,"height":480},"availableFormats":[]},{"id":"69fa5769a3780355a2edfbb0","altText":"PXL_20260505_202100350.jpg","orderIndex":4,"url":"https://images.squarespace-cdn.com/content/v1/694b2288b16b8d02d4bdaa0c/4fcf4192-dbe3-477a-90e7-be0c553f4c5b/PXL_20260505_202100350.jpg","originalSize":{"width":480,"height":480},"availableFormats":[]},{"id":"69fa5769cfa3e81e12d7c226","altText":"PXL_20260505_201947380.jpg","orderIndex":5,"url":"https://images.squarespace-cdn.com/content/v1/694b2288b16b8d02d4bdaa0c/fba1dcf8-8526-47ab-ab7f-be2ab37a1dbd/PXL_20260505_201947380.jpg","originalSize":{"width":480,"height":480},"availableFormats":[]}],"tags":[],"seoOptions":{"title":"Stack short gemstone and pearl earrings","description":"Tucson designer Lisa Sirlin-Halls Stack earrings are quick grabs of a bit of neutral with a pop of color when you want earrings for a casual day look."},"createdOn":"2026-05-05T20:36:56.235Z","modifiedOn":"2026-05-05T20:48:35.104Z","variants":[{"id":"fdb09e8d-467c-412e-a355-f6a40a24af24","sku":"26050101","image":null,"pricing":{"basePrice":{"currency":"USD","value":"68.00"},"salePrice":{"currency":"USD","value":"0.00"},"onSale":false},"stock":{"quantity":1,"unlimited":false},"attributes":{"Color":"Blue with Labradorite"},"shippingMeasurements":{"weight":{"unit":"POUND","value":0.0625},"dimensions":{"unit":"INCH","length":9,"width":6,"height":0.5}},"gtin":null,"mpn":null},{"id":"61c47a68-5acb-4d74-b18b-83ac27e49aeb","sku":"26050102","image":null,"pricing":{"basePrice":{"currency":"USD","value":"68.00"},"salePrice":{"currency":"USD","value":"0.00"},"onSale":false},"stock":{"quantity":1,"unlimited":false},"attributes":{"Color":"Silver with Black Onyx"},"shippingMeasurements":{"weight":{"unit":"POUND","value":0.0625},"dimensions":{"unit":"INCH","length":9,"width":6,"height":0.5}},"gtin":null,"mpn":null},{"id":"4b1ca060-8d0e-4e20-9863-cb37324da85d","sku":"26050103","image":null,"pricing":{"basePrice":{"currency":"USD","value":"68.00"},"salePrice":{"currency":"USD","value":"0.00"},"onSale":false},"stock":{"quantity":1,"unlimited":false},"attributes":{"Color":"Champagne yellow and Pearl"},"shippingMeasurements":{"weight":{"unit":"POUND","value":0.0625},"dimensions":{"unit":"INCH","length":9,"width":6,"height":0.5}},"gtin":null,"mpn":null}],"variantAttributes":["Color"],"isVisible":true}';
|
|
2
2
|
|
|
3
3
|
export const feedSample = {
|
|
4
4
|
"products": [
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|