@leaddreamer/inventorylogic 0.0.3-beta.48 → 0.0.3-beta.53
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 +1225 -28
- package/business/Product/GoogleMarchantMarkup.js +252 -0
- package/business/Product/GoogleMerchantAPI.js +343 -0
- package/business/Product/Squarespace.js +505 -0
- package/business/Product/index.js +125 -27
- package/dist/InventoryLogic.0a417df6.js +2 -0
- package/dist/InventoryLogic.76c282a4.js +2 -0
- package/dist/InventoryLogic.b8b0ac74.js +2 -0
- package/dist/InventoryLogic.ca8dec8b.js +2 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typedefs, constants, support functions and database operations related to Products
|
|
3
|
+
* @module SquarespaceProduct
|
|
4
|
+
*/
|
|
5
|
+
import { Forms, fillForm } from "@leaddreamer/staticforms";
|
|
6
|
+
|
|
7
|
+
import { PRODUCT, MARKUPS, ISBN_LENGTH } from "../boilerplate/index.js";
|
|
8
|
+
|
|
9
|
+
//////////////////////////////////////////////////////////////////////
|
|
10
|
+
// Constants
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A list of attributes for a product
|
|
14
|
+
* @typedef {Array.String} AttributeList
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Array of attribute name/value pairs
|
|
19
|
+
* @typedef {object} AttributeValue
|
|
20
|
+
* @property {string} AttibuteName attribute name from attribute list
|
|
21
|
+
* @property {string} value value for the particular attribute
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Image Descriptor
|
|
26
|
+
* @typedef {object} ProductImage
|
|
27
|
+
* @property {string} altText alt text for the image - SEO etc
|
|
28
|
+
* @property {Array.string} availableFormats Available image sizes.
|
|
29
|
+
* @property {string} id unique id for this productImage
|
|
30
|
+
* @property {integer} orderIndex Position of the image in the product's image list.
|
|
31
|
+
* @property {object} originalSize Image size when first uploaded.
|
|
32
|
+
* @property {string} URL Absolute URL of the image hosted on Squarespace.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Currency Description ISO 4217 currency code
|
|
37
|
+
* @typedef {object} CurrencyDescription
|
|
38
|
+
* @property {string} currencyCode
|
|
39
|
+
* @property {integer} defaultFractionDigits
|
|
40
|
+
* @property {string} displayName
|
|
41
|
+
* @property {string} numericCodeAsString
|
|
42
|
+
* @property {string} symbol
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Monetary Value Specification
|
|
47
|
+
* @typedef {object} MonetaryValue
|
|
48
|
+
* @property {CurrencyDescription}
|
|
49
|
+
* @property {decimal} value Decimal monetary value
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Pricing Object
|
|
54
|
+
* @typedef {object} FullProductPricing
|
|
55
|
+
* @property {MonetaryValue} basePrice
|
|
56
|
+
* @property {boolean} onSale
|
|
57
|
+
* @property {MonetaryValue} salePrice
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @typedef {object} ProductDimensionsUnit
|
|
62
|
+
* @property {Text} name
|
|
63
|
+
* @property {Text} value
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Dimensions Object
|
|
68
|
+
* @typedef {object} ProductDimensions
|
|
69
|
+
* @property {float} height
|
|
70
|
+
* @property {float} width
|
|
71
|
+
* @property {float} length
|
|
72
|
+
* @property {ProductDimensionsUnit} unit
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @typedef {"KILOGRAM" | "POUND"} ProductWeightUnitEnum
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Weight Object
|
|
81
|
+
* @typedef {object} ProductWeight
|
|
82
|
+
* @property {"KILOGRAM" | "POUND"} unit
|
|
83
|
+
* @property {float} value
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Measurements of the variant when it's shipped. Present for PHYSICAL products only.
|
|
88
|
+
* @typedef {object} ProductMeasurements
|
|
89
|
+
* @property {ProductDimensions} dimensions
|
|
90
|
+
* @property {ProductWeight} weight
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Available stock for the variant. Present for PHYSICAL products only.
|
|
95
|
+
* @typedef {object} ProductStock
|
|
96
|
+
* @property {integer} quantity
|
|
97
|
+
* @property {boolean} unlimited
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* variant record (including inventory and pricing)
|
|
103
|
+
* @typedef {object} PhysicalProductVariant
|
|
104
|
+
* @property {Array.AttributeValue} attributes array of attribute/value pairs for a variant
|
|
105
|
+
* @property {string} gtin Global Trade Item Number
|
|
106
|
+
* @property {string} id unique ID for product variant
|
|
107
|
+
* @property {ProductImage} image Image associated with this variant
|
|
108
|
+
* @property {string} mpn manufacturer part number
|
|
109
|
+
* @property {ProductMeasurements} shippingMeasurements
|
|
110
|
+
* @property {string} sku
|
|
111
|
+
* @property {ProductStock} stock
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Meta Information for SEO
|
|
116
|
+
* @typedef {object} MetaData
|
|
117
|
+
* @property {string} title
|
|
118
|
+
* @property {string} description
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @typedef {"PHYSICAL" | "SERVICE" | "GIFT_CARD" | "DIGITAL"} ProductTypeV2Enum
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* a Square product record
|
|
127
|
+
* @typedef {object} PhysicalProduct
|
|
128
|
+
* @property {dateTime} createdOn
|
|
129
|
+
* @property {?string} id Id of document (redundant for convenience)
|
|
130
|
+
* @property {dateTime} modifiedOn
|
|
131
|
+
* @property {string} storePageId
|
|
132
|
+
* @property {"PHYSICAL" | "SERVICE" | "GIFT_CARD" | "DIGITAL"} type
|
|
133
|
+
* @property {string} description Basic description of the product
|
|
134
|
+
* @property {Array.ProductImage} images Image associated with this variant
|
|
135
|
+
* @property {boolean} isVisible
|
|
136
|
+
* @property {string} name name for the Product
|
|
137
|
+
* @property {MetaData} seoOptions
|
|
138
|
+
* @property {Array.string} tags
|
|
139
|
+
* @property {string} URL
|
|
140
|
+
* @property {string} urlSlug
|
|
141
|
+
* @property {Array.string} variantAttributes
|
|
142
|
+
* @property {Array.PhysicalProductVariant} variants
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @readonly
|
|
147
|
+
* @constant
|
|
148
|
+
* @type {PhysicalProduct}
|
|
149
|
+
* @default
|
|
150
|
+
*/
|
|
151
|
+
const PhysicalProductDefault = {
|
|
152
|
+
created: null,
|
|
153
|
+
id: null,
|
|
154
|
+
modified: null,
|
|
155
|
+
storePageId: "",
|
|
156
|
+
type: PHYSICAL,
|
|
157
|
+
description: null,
|
|
158
|
+
images: [],
|
|
159
|
+
isVisible: true,
|
|
160
|
+
name: `A Product`,
|
|
161
|
+
seoOptions: {
|
|
162
|
+
title: "",
|
|
163
|
+
description: "",
|
|
164
|
+
},
|
|
165
|
+
tags: [],
|
|
166
|
+
url: "",
|
|
167
|
+
urlSlug: "",
|
|
168
|
+
variantAttributes: [],
|
|
169
|
+
variants: [
|
|
170
|
+
{
|
|
171
|
+
attributes: [],
|
|
172
|
+
gtin: "",
|
|
173
|
+
id: "",
|
|
174
|
+
image: {},
|
|
175
|
+
mpn: "",
|
|
176
|
+
shippingMeasurements: {
|
|
177
|
+
dimensions: {
|
|
178
|
+
height: 0,
|
|
179
|
+
width: 0,
|
|
180
|
+
length: 0,
|
|
181
|
+
height: 0,
|
|
182
|
+
unit: INCH,
|
|
183
|
+
},
|
|
184
|
+
weight: {
|
|
185
|
+
value: 0,
|
|
186
|
+
unit: POUND,
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
sku: "",
|
|
190
|
+
stock: {
|
|
191
|
+
quantity: 0,
|
|
192
|
+
unlimited: false,
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
/**
|
|
200
|
+
* @readonly
|
|
201
|
+
* @constant
|
|
202
|
+
* @type {PhysicalProduct}
|
|
203
|
+
* @default
|
|
204
|
+
*/
|
|
205
|
+
const PhysicalProductMap = {
|
|
206
|
+
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* @readonly
|
|
211
|
+
* @constant
|
|
212
|
+
* @type {Product}
|
|
213
|
+
* @default
|
|
214
|
+
*/
|
|
215
|
+
const ProductDataForm = {
|
|
216
|
+
Id: `string.uuid`,
|
|
217
|
+
refPath: null,
|
|
218
|
+
name: `commerce.product`,
|
|
219
|
+
description: `commerce.productDescription`,
|
|
220
|
+
sku: `commerce.isbn:${ISBN_LENGTH}`,
|
|
221
|
+
markups: `subrecord:${MARKUPS}`,
|
|
222
|
+
projectQ: `checkbox`
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* @readonly
|
|
227
|
+
* @constant
|
|
228
|
+
* @type {Product}
|
|
229
|
+
* @default
|
|
230
|
+
*/
|
|
231
|
+
const ProductDefaultForm = {
|
|
232
|
+
Id: `hidden`,
|
|
233
|
+
refPath: `hidden`,
|
|
234
|
+
name: "text",
|
|
235
|
+
description: "textarea",
|
|
236
|
+
sku: "text",
|
|
237
|
+
markups: `subrecord:${MARKUPS}`,
|
|
238
|
+
projectQ: `checkbox`,
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
Forms.Base[PRODUCT] = ProductDefault;
|
|
242
|
+
Forms.BaseForm[PRODUCT] = ProductDefaultForm;
|
|
243
|
+
Forms.CreateForm[PRODUCT] = ProductDefaultForm;
|
|
244
|
+
Forms.Data[PRODUCT] = ProductDataForm;
|
|
245
|
+
Forms.Summarize[PRODUCT] = summarizeProduct;
|
|
246
|
+
Forms.Save[PRODUCT] = updateProduct;
|
|
247
|
+
Forms.SearchBy[PRODUCT] = "name";
|
|
248
|
+
|
|
249
|
+
//////////////////////////////////////////////////////////////////////
|
|
250
|
+
// business operations
|
|
251
|
+
|
|
252
|
+
//////////////////////////////////////////////////////////////////////
|
|
253
|
+
// record operations
|
|
254
|
+
|
|
255
|
+
//////////////////////////////////////////////////////////////////////
|
|
256
|
+
// utilities
|
|
257
|
+
|
|
258
|
+
const SampleJSON = {
|
|
259
|
+
"id": "69fa54e8f691fe20c13bc732",
|
|
260
|
+
"type": "PHYSICAL",
|
|
261
|
+
"name": "Stack : : short gemstone earrings",
|
|
262
|
+
"description": "<p style=\"white-space:pre-wrap;\" data-rte-preserve-empty=\"true\">About an inch long, my Stack earrings are quick grabs of a bit of neutral with a pop of color when you want earrings for a casual day look. Choose your favorite palette or ping me with your own color combinations and ideas!</p><p style=\"white-space:pre-wrap;\" data-rte-preserve-empty=\"true\"><span>:: great gift!<br />:: 1.25 inches<br />:: limited edition<br />:: ships 4-7 days from purchase<br />:: handcrafted in tucson, arizona</span></p>",
|
|
263
|
+
"storePageId": "694b2289b16b8d02d4bdaaba",
|
|
264
|
+
"url": "https://sirlinhalljewelry.com/shop/p/stack-earrings-26050500",
|
|
265
|
+
"urlSlug": "p/stack-earrings-26050500",
|
|
266
|
+
"images": [
|
|
267
|
+
{
|
|
268
|
+
"id": "69fa5769cfa3e81e12d7c224",
|
|
269
|
+
"altText": "PXL_20260505_201834132.jpg",
|
|
270
|
+
"orderIndex": 0,
|
|
271
|
+
"url": "https://images.squarespace-cdn.com/content/v1/694b2288b16b8d02d4bdaa0c/2bf39ac2-a49b-4820-a211-961d6a0722ef/PXL_20260505_201834132.jpg",
|
|
272
|
+
"originalSize": {
|
|
273
|
+
"width": 480,
|
|
274
|
+
"height": 480
|
|
275
|
+
},
|
|
276
|
+
"availableFormats": []
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"id": "69fa5769f691fe20c13bc9f8",
|
|
280
|
+
"altText": "PXL_20260505_201739701.jpg",
|
|
281
|
+
"orderIndex": 1,
|
|
282
|
+
"url": "https://images.squarespace-cdn.com/content/v1/694b2288b16b8d02d4bdaa0c/8d5186e3-e5a1-43bb-9714-77a939b8bc40/PXL_20260505_201739701.jpg",
|
|
283
|
+
"originalSize": {
|
|
284
|
+
"width": 480,
|
|
285
|
+
"height": 480
|
|
286
|
+
},
|
|
287
|
+
"availableFormats": []
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"id": "69fa5769cfa3e81e12d7c225",
|
|
291
|
+
"altText": "PXL_20260505_201915047.jpg",
|
|
292
|
+
"orderIndex": 2,
|
|
293
|
+
"url": "https://images.squarespace-cdn.com/content/v1/694b2288b16b8d02d4bdaa0c/ff61c7e8-a03b-442e-81b2-db67241d85ec/PXL_20260505_201915047.jpg",
|
|
294
|
+
"originalSize": {
|
|
295
|
+
"width": 480,
|
|
296
|
+
"height": 480
|
|
297
|
+
},
|
|
298
|
+
"availableFormats": []
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"id": "69fa5769f691fe20c13bc9f9",
|
|
302
|
+
"altText": "PXL_20260505_202122912.jpg",
|
|
303
|
+
"orderIndex": 3,
|
|
304
|
+
"url": "https://images.squarespace-cdn.com/content/v1/694b2288b16b8d02d4bdaa0c/357dfd2f-1bce-4687-b57b-1ff53209d970/PXL_20260505_202122912.jpg",
|
|
305
|
+
"originalSize": {
|
|
306
|
+
"width": 480,
|
|
307
|
+
"height": 480
|
|
308
|
+
},
|
|
309
|
+
"availableFormats": []
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"id": "69fa5769a3780355a2edfbb0",
|
|
313
|
+
"altText": "PXL_20260505_202100350.jpg",
|
|
314
|
+
"orderIndex": 4,
|
|
315
|
+
"url": "https://images.squarespace-cdn.com/content/v1/694b2288b16b8d02d4bdaa0c/4fcf4192-dbe3-477a-90e7-be0c553f4c5b/PXL_20260505_202100350.jpg",
|
|
316
|
+
"originalSize": {
|
|
317
|
+
"width": 480,
|
|
318
|
+
"height": 480
|
|
319
|
+
},
|
|
320
|
+
"availableFormats": []
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"id": "69fa5769cfa3e81e12d7c226",
|
|
324
|
+
"altText": "PXL_20260505_201947380.jpg",
|
|
325
|
+
"orderIndex": 5,
|
|
326
|
+
"url": "https://images.squarespace-cdn.com/content/v1/694b2288b16b8d02d4bdaa0c/fba1dcf8-8526-47ab-ab7f-be2ab37a1dbd/PXL_20260505_201947380.jpg",
|
|
327
|
+
"originalSize": {
|
|
328
|
+
"width": 480,
|
|
329
|
+
"height": 480
|
|
330
|
+
},
|
|
331
|
+
"availableFormats": []
|
|
332
|
+
}
|
|
333
|
+
],
|
|
334
|
+
"tags": [],
|
|
335
|
+
"seoOptions": {
|
|
336
|
+
"title": "Stack short gemstone and pearl earrings",
|
|
337
|
+
"description": "Tucson designer Lisa Sirlin-Hall's Stack earrings are quick grabs of a bit of neutral with a pop of color when you want earrings for a casual day look."
|
|
338
|
+
},
|
|
339
|
+
"createdOn": "2026-05-05T20:36:56.235Z",
|
|
340
|
+
"modifiedOn": "2026-05-05T20:48:35.104Z",
|
|
341
|
+
"variants": [
|
|
342
|
+
{
|
|
343
|
+
"id": "fdb09e8d-467c-412e-a355-f6a40a24af24",
|
|
344
|
+
"sku": "26050101",
|
|
345
|
+
"image": null,
|
|
346
|
+
"pricing": {
|
|
347
|
+
"basePrice": {
|
|
348
|
+
"currency": "USD",
|
|
349
|
+
"value": "68.00"
|
|
350
|
+
},
|
|
351
|
+
"salePrice": {
|
|
352
|
+
"currency": "USD",
|
|
353
|
+
"value": "0.00"
|
|
354
|
+
},
|
|
355
|
+
"onSale": false
|
|
356
|
+
},
|
|
357
|
+
"stock": {
|
|
358
|
+
"quantity": 1,
|
|
359
|
+
"unlimited": false
|
|
360
|
+
},
|
|
361
|
+
"attributes": {
|
|
362
|
+
"Color": "Blue with Labradorite"
|
|
363
|
+
},
|
|
364
|
+
"shippingMeasurements": {
|
|
365
|
+
"weight": {
|
|
366
|
+
"unit": "POUND",
|
|
367
|
+
"value": 0.0625
|
|
368
|
+
},
|
|
369
|
+
"dimensions": {
|
|
370
|
+
"unit": "INCH",
|
|
371
|
+
"length": 9.0,
|
|
372
|
+
"width": 6.0,
|
|
373
|
+
"height": 0.5
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
"gtin": null,
|
|
377
|
+
"mpn": null
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"id": "61c47a68-5acb-4d74-b18b-83ac27e49aeb",
|
|
381
|
+
"sku": "26050102",
|
|
382
|
+
"image": null,
|
|
383
|
+
"pricing": {
|
|
384
|
+
"basePrice": {
|
|
385
|
+
"currency": "USD",
|
|
386
|
+
"value": "68.00"
|
|
387
|
+
},
|
|
388
|
+
"salePrice": {
|
|
389
|
+
"currency": "USD",
|
|
390
|
+
"value": "0.00"
|
|
391
|
+
},
|
|
392
|
+
"onSale": false
|
|
393
|
+
},
|
|
394
|
+
"stock": {
|
|
395
|
+
"quantity": 1,
|
|
396
|
+
"unlimited": false
|
|
397
|
+
},
|
|
398
|
+
"attributes": {
|
|
399
|
+
"Color": "Silver with Black Onyx"
|
|
400
|
+
},
|
|
401
|
+
"shippingMeasurements": {
|
|
402
|
+
"weight": {
|
|
403
|
+
"unit": "POUND",
|
|
404
|
+
"value": 0.0625
|
|
405
|
+
},
|
|
406
|
+
"dimensions": {
|
|
407
|
+
"unit": "INCH",
|
|
408
|
+
"length": 9.0,
|
|
409
|
+
"width": 6.0,
|
|
410
|
+
"height": 0.5
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
"gtin": null,
|
|
414
|
+
"mpn": null
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"id": "4b1ca060-8d0e-4e20-9863-cb37324da85d",
|
|
418
|
+
"sku": "26050103",
|
|
419
|
+
"image": null,
|
|
420
|
+
"pricing": {
|
|
421
|
+
"basePrice": {
|
|
422
|
+
"currency": "USD",
|
|
423
|
+
"value": "68.00"
|
|
424
|
+
},
|
|
425
|
+
"salePrice": {
|
|
426
|
+
"currency": "USD",
|
|
427
|
+
"value": "0.00"
|
|
428
|
+
},
|
|
429
|
+
"onSale": false
|
|
430
|
+
},
|
|
431
|
+
"stock": {
|
|
432
|
+
"quantity": 1,
|
|
433
|
+
"unlimited": false
|
|
434
|
+
},
|
|
435
|
+
"attributes": {
|
|
436
|
+
"Color": "Champagne yellow and Pearl"
|
|
437
|
+
},
|
|
438
|
+
"shippingMeasurements": {
|
|
439
|
+
"weight": {
|
|
440
|
+
"unit": "POUND",
|
|
441
|
+
"value": 0.0625
|
|
442
|
+
},
|
|
443
|
+
"dimensions": {
|
|
444
|
+
"unit": "INCH",
|
|
445
|
+
"length": 9.0,
|
|
446
|
+
"width": 6.0,
|
|
447
|
+
"height": 0.5
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
"gtin": null,
|
|
451
|
+
"mpn": null
|
|
452
|
+
}
|
|
453
|
+
],
|
|
454
|
+
"variantAttributes": [
|
|
455
|
+
"Color"
|
|
456
|
+
],
|
|
457
|
+
"isVisible": true,
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
const SquarespaceProductMap = {
|
|
461
|
+
"id": "platformIds.SquarespaceId",
|
|
462
|
+
"type": "PHYSICAL",
|
|
463
|
+
"name": "name",
|
|
464
|
+
"description": "description",
|
|
465
|
+
"storePageId": "platformData.squarespaceData.storePageId",
|
|
466
|
+
"url": "URL",
|
|
467
|
+
"urlSlug": "urlSlug",
|
|
468
|
+
"images": [
|
|
469
|
+
"images[index]",
|
|
470
|
+
],
|
|
471
|
+
"tags": "attributes.tags",
|
|
472
|
+
"seoOptions": "seoOptions",
|
|
473
|
+
"createdOn": "attributes.createdOn",
|
|
474
|
+
"modifiedOn": "attributes.modifiedOn",
|
|
475
|
+
"variants": [squarespaceVariantMapping],
|
|
476
|
+
"variantAttributes": "variantAttributes",
|
|
477
|
+
"isVisible": "isVisible",
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
function squarespaceJSONtoProductMapping(productJSON) {
|
|
481
|
+
const incomingProduct = JSON.parse(productJSON);
|
|
482
|
+
let storageProduct = {};
|
|
483
|
+
let properties = Object.getOwnPropertyNames(incomingProduct);
|
|
484
|
+
console.log(properties);
|
|
485
|
+
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
squarespaceJSONtoProductMapping(SampleJSON);
|
|
489
|
+
|
|
490
|
+
const SquarespaceVariantMap = {
|
|
491
|
+
"id": "id",
|
|
492
|
+
"sku": "sku",
|
|
493
|
+
"image": "image",
|
|
494
|
+
"pricing": "price",
|
|
495
|
+
"stock": "stock",
|
|
496
|
+
"attributes": "attributes",
|
|
497
|
+
"shippingMeasurements": "shippingMeasurements",
|
|
498
|
+
"gtin": "gtin",
|
|
499
|
+
"mpn": "mpn",
|
|
500
|
+
//other fields not used
|
|
501
|
+
};
|
|
502
|
+
|
|
503
|
+
async function squarespaceVariantMapping(product){
|
|
504
|
+
|
|
505
|
+
};
|