addio-admin-sdk 1.7.39 → 1.7.41-canary-1

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.
Files changed (62) hide show
  1. package/addio-sdk-doc.md +499 -406
  2. package/changelog.md +11 -0
  3. package/dist/Interfaces/Algolia/index.d.ts +14 -5
  4. package/dist/Interfaces/Cart/index.d.ts +2 -0
  5. package/dist/Interfaces/Cart/index.js.map +1 -1
  6. package/dist/Interfaces/Indexed/Product/index.js +1 -1
  7. package/dist/Interfaces/Indexed/Product/index.js.map +1 -1
  8. package/dist/Interfaces/Product/IInventoryItem.d.ts +10 -10
  9. package/dist/Interfaces/Space/index.d.ts +16 -0
  10. package/dist/Interfaces/Space/index.js +21 -2
  11. package/dist/Interfaces/Space/index.js.map +1 -1
  12. package/dist/Interfaces/TransferRequest/index.d.ts +53 -17
  13. package/dist/Interfaces/TransferRequest/index.js +23 -16
  14. package/dist/Interfaces/TransferRequest/index.js.map +1 -1
  15. package/dist/Interfaces/Translation/index.d.ts +4 -0
  16. package/dist/Interfaces/Translation/index.js +3 -0
  17. package/dist/Interfaces/Translation/index.js.map +1 -1
  18. package/dist/lib/Cart/index.d.ts +12 -3
  19. package/dist/lib/Cart/index.js +288 -146
  20. package/dist/lib/Cart/index.js.map +1 -1
  21. package/dist/lib/Inventory/index.d.ts +20 -4
  22. package/dist/lib/Inventory/index.js +99 -49
  23. package/dist/lib/Inventory/index.js.map +1 -1
  24. package/dist/lib/Shipment/index.js +0 -1
  25. package/dist/lib/Shipment/index.js.map +1 -1
  26. package/dist/lib/Space/index.d.ts +19 -3
  27. package/dist/lib/Space/index.js +367 -248
  28. package/dist/lib/Space/index.js.map +1 -1
  29. package/dist/lib/TransferRequest/index.d.ts +90 -5
  30. package/dist/lib/TransferRequest/index.js +991 -112
  31. package/dist/lib/TransferRequest/index.js.map +1 -1
  32. package/dist/rules/GR/utils/cart.js +2 -4
  33. package/dist/rules/GR/utils/cart.js.map +1 -1
  34. package/dist/rules/GR/utils/expedition.js.map +1 -1
  35. package/dist/rules/GR/utils/invoices.d.ts +9 -1
  36. package/dist/rules/GR/utils/invoices.js +23 -9
  37. package/dist/rules/GR/utils/invoices.js.map +1 -1
  38. package/dist/rules/GR/utils/products.d.ts +13 -5
  39. package/dist/rules/GR/utils/products.js +77 -34
  40. package/dist/rules/GR/utils/products.js.map +1 -1
  41. package/dist/rules/GR/utils/upsells.js +1 -1
  42. package/dist/rules/GR/utils/upsells.js.map +1 -1
  43. package/dist/services/database/DatabaseService.js.map +1 -1
  44. package/dist/utils/cart.d.ts +26 -1
  45. package/dist/utils/cart.js +128 -12
  46. package/dist/utils/cart.js.map +1 -1
  47. package/dist/utils/context.d.ts +1 -0
  48. package/dist/utils/context.js +19 -1
  49. package/dist/utils/context.js.map +1 -1
  50. package/dist/utils/inventories.d.ts +17 -4
  51. package/dist/utils/inventories.js +99 -115
  52. package/dist/utils/inventories.js.map +1 -1
  53. package/dist/utils/locale.d.ts +1 -1
  54. package/dist/utils/locale.js +1 -1
  55. package/dist/utils/locale.js.map +1 -1
  56. package/dist/utils/products.d.ts +6 -0
  57. package/dist/utils/products.js +7 -1
  58. package/dist/utils/products.js.map +1 -1
  59. package/dist/utils/transferRequests.d.ts +3 -0
  60. package/dist/utils/transferRequests.js +12 -1
  61. package/dist/utils/transferRequests.js.map +1 -1
  62. package/package.json +1 -1
package/addio-sdk-doc.md CHANGED
@@ -177,7 +177,7 @@ Returns the items to add, update and delete, as well as other cart info to set a
177
177
  <dd><p>Returns the information regarding the payment incentive promo if found in cart's discount_rules</p></dd>
178
178
  <dt><a href="#unitShortDict">unitShortDict</a> ⇒ <code>ILang</code></dt>
179
179
  <dd><p>Returns the dictionnary containing the shortened version of unit labels in multiple languages</p></dd>
180
- <dt><a href="#getInventoryUnitQuantity">getInventoryUnitQuantity</a></dt>
180
+ <dt><a href="#getConvertedUnitQuantity">getConvertedUnitQuantity</a></dt>
181
181
  <dd><p>Constructs object with detailled inventory quantities by unit (based on other_units for product)</p></dd>
182
182
  <dt><a href="#getQty">getQty</a></dt>
183
183
  <dd><p>Calculates inventory unit quantity for function getQty</p></dd>
@@ -242,42 +242,49 @@ As of now, checks for Algolia and Addio Search</p></dd>
242
242
  <a name="Brand"></a>
243
243
 
244
244
  ## Brand
245
+
245
246
  <p>Brand class</p>
246
247
 
247
248
  **Kind**: global class
248
249
  <a name="Catalogue"></a>
249
250
 
250
251
  ## Catalogue
252
+
251
253
  <p>Catalogue class</p>
252
254
 
253
255
  **Kind**: global class
254
256
  <a name="Customer"></a>
255
257
 
256
258
  ## Customer
259
+
257
260
  <p>Customer class</p>
258
261
 
259
262
  **Kind**: global class
260
263
  <a name="Discount"></a>
261
264
 
262
265
  ## Discount
266
+
263
267
  <p>Brand class</p>
264
268
 
265
269
  **Kind**: global class
266
270
  <a name="Invoice"></a>
267
271
 
268
272
  ## ~~Invoice~~
269
- ***Deprecated***
273
+
274
+ **_Deprecated_**
270
275
 
271
276
  **Kind**: global class
272
277
  <a name="Order"></a>
273
278
 
274
279
  ## ~~Order~~
275
- ***Deprecated***
280
+
281
+ **_Deprecated_**
276
282
 
277
283
  **Kind**: global class
278
284
  <a name="Org"></a>
279
285
 
280
286
  ## Org
287
+
281
288
  <p>Class Org - Organization
282
289
  Represent an organization created by a user. An organization can have multiple space.</p>
283
290
 
@@ -285,48 +292,53 @@ Represent an organization created by a user. An organization can have multiple s
285
292
  <a name="new_Org_new"></a>
286
293
 
287
294
  ### new Org(org, org_ref, user)
288
- <p>Organization constructor</p>
289
295
 
296
+ <p>Organization constructor</p>
290
297
 
291
- | Param | Description |
292
- | --- | --- |
293
- | org | <p>Organization to construct</p> |
298
+ | Param | Description |
299
+ | ------- | ------------------------------------ |
300
+ | org | <p>Organization to construct</p> |
294
301
  | org_ref | <p>Reference to the organization</p> |
295
- | user | <p>Authfificated user</p> |
302
+ | user | <p>Authfificated user</p> |
296
303
 
297
304
  <a name="Product"></a>
298
305
 
299
306
  ## Product
307
+
300
308
  <p>Product class</p>
301
309
 
302
310
  **Kind**: global class
303
311
  <a name="PurchaseOrder"></a>
304
312
 
305
313
  ## PurchaseOrder
314
+
306
315
  <p>Brand class</p>
307
316
 
308
317
  **Kind**: global class
309
318
  <a name="Service"></a>
310
319
 
311
320
  ## Service
321
+
312
322
  <p>Service class</p>
313
323
 
314
324
  **Kind**: global class
315
325
  <a name="Service+add"></a>
316
326
 
317
327
  ### service.add(newService) ⇒
328
+
318
329
  <p>Add a new service</p>
319
330
 
320
331
  **Kind**: instance method of [<code>Service</code>](#Service)
321
- **Returns**: <p>IAddServiceResponse</p>
332
+ **Returns**: <p>IAddServiceResponse</p>
322
333
 
323
- | Param | Description |
324
- | --- | --- |
334
+ | Param | Description |
335
+ | ---------- | ------------------------------------ |
325
336
  | newService | <p>IService: new service to add.</p> |
326
337
 
327
338
  <a name="Space"></a>
328
339
 
329
340
  ## Space
341
+
330
342
  <p>Class Space
331
343
  A Space represent a company.</p>
332
344
 
@@ -334,24 +346,26 @@ A Space represent a company.</p>
334
346
  <a name="User"></a>
335
347
 
336
348
  ## User
349
+
337
350
  <p>User class</p>
338
351
 
339
352
  **Kind**: global class
340
353
  <a name="new_User_new"></a>
341
354
 
342
355
  ### new User(options, version, orgID)
343
- <p>Fetch user from database for current org</p>
344
356
 
357
+ <p>Fetch user from database for current org</p>
345
358
 
346
- | Param | Description |
347
- | --- | --- |
359
+ | Param | Description |
360
+ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
348
361
  | options | <p>Parameters for database query. Only one will be checked at a time, in order of &quot;importance&quot; : email &gt; username &gt; external_id.</p> |
349
- | version | <p>The app version to check</p> |
350
- | orgID | <p>Optionnal, but must be provided if function is called from the backend (used to find user's organization).</p> |
362
+ | version | <p>The app version to check</p> |
363
+ | orgID | <p>Optionnal, but must be provided if function is called from the backend (used to find user's organization).</p> |
351
364
 
352
365
  <a name="ProsprSearch"></a>
353
366
 
354
367
  ## ProsprSearch
368
+
355
369
  <p>À NOTER - Prospr est l'ancien nom du ecomm, est depuis devenu Addio.
356
370
  Il faudra éventuellement faire le refactoring nécessaire pour remplacer toutes les appelations,
357
371
  mais en attendant, c'est normal qu'il y ait les deux noms à différents endroits.</p>
@@ -360,6 +374,7 @@ mais en attendant, c'est normal qu'il y ait les deux noms à différents endroit
360
374
  <a name="CustomerTypeEnum"></a>
361
375
 
362
376
  ## CustomerTypeEnum
377
+
363
378
  <p>ICustomer interface</p>
364
379
  <p>Représente un client (customer). Un client peut:</p>
365
380
  <ul>
@@ -371,6 +386,7 @@ mais en attendant, c'est normal qu'il y ait les deux noms à différents endroit
371
386
  <a name="getDefaultDiscountRule"></a>
372
387
 
373
388
  ## getDefaultDiscountRule
389
+
374
390
  <p>Exemple:</p>
375
391
  <p>Product = 5.00$</p>
376
392
  <p>Discount rule:
@@ -387,883 +403,951 @@ If applied to cart:
387
403
  <a name="installationProductsSlugs"></a>
388
404
 
389
405
  ## installationProductsSlugs
406
+
390
407
  <p>Contains all necessary elements for extra questions if adding grass product to cart</p>
391
408
 
392
409
  **Kind**: global variable
393
410
  <a name="getConcreteCartInfo"></a>
394
411
 
395
412
  ## getConcreteCartInfo
413
+
396
414
  <ul>
397
415
  <li>Create the essential info needed when checking a grass type product for cart</li>
398
416
  </ul>
399
417
 
400
- **Kind**: global variable
418
+ **Kind**: global variable
401
419
 
402
420
  | Param |
403
- | --- |
404
- | item |
421
+ | ----- |
422
+ | item |
405
423
 
406
424
  <a name="getMinDateOffset"></a>
407
425
 
408
426
  ## getMinDateOffset
427
+
409
428
  <p>compares date with blockedDates from DB and blocked days (currently hardcoded in function)</p>
410
429
 
411
- **Kind**: global variable
430
+ **Kind**: global variable
412
431
 
413
- | Param | Description |
414
- | --- | --- |
415
- | date | <p>Date to check</p> |
416
- | blockedDates | <p>Blocked dates from DB</p> |
417
- | expeditionMethod | <p>pickup or shipping</p> |
418
- | cartData | |
432
+ | Param | Description |
433
+ | ---------------- | ---------------------------- |
434
+ | date | <p>Date to check</p> |
435
+ | blockedDates | <p>Blocked dates from DB</p> |
436
+ | expeditionMethod | <p>pickup or shipping</p> |
437
+ | cartData | |
419
438
 
420
439
  <a name="shouldDisableDate"></a>
421
440
 
422
441
  ## shouldDisableDate
442
+
423
443
  <p>checks if type of cart corresponds to a blockedDates array and if array has dates defined</p>
424
444
 
425
- **Kind**: global variable
445
+ **Kind**: global variable
426
446
 
427
- | Param |
428
- | --- |
429
- | cartData |
430
- | blockedDates |
447
+ | Param |
448
+ | ------------ |
449
+ | cartData |
450
+ | blockedDates |
431
451
 
432
452
  <a name="installationFeePalletTier"></a>
433
453
 
434
454
  ## installationFeePalletTier
455
+
435
456
  <p>Calculates fees that should be applied to provided cart, and fetches them from database or fee array if provided.
436
457
  Returns the items to add, update and delete, as well as other cart info to set after fees.
437
458
  ** Optimized version possible, where address zones and distance are calculated before and properties are sent directly to function
438
459
  ** Optimized version reverted, logic found in commit here : [#2087b32](https://github.com/ciaoqc/gng-tb-admin-sdk/commit/2087b3207df9e5916a979b8bb255abc2a4c1dac6)</p>
439
460
 
440
- **Kind**: global variable
441
-
442
- | Param |
443
- | --- |
444
- | fetchProduct |
445
- | getIfAddressIsInsideZones |
446
- | getDistanceFromAddress |
447
- | cart |
448
- | expeditionMethod |
449
- | grassProduct |
450
- | concreteOrder |
451
- | cartContainsInstallation |
452
- | cartContainsVrac |
453
- | isPro |
454
- | addOnePalletToPickup |
455
- | cartContainsSample |
456
- | saveToShippingPayload |
457
- | deliveryAddress |
458
- | locale |
459
- | expeditionDate |
460
- | equipmentPickupOnSite |
461
- | cartContainsOnlyAccessories |
462
- | pickupStore |
463
- | allStores |
464
- | customPriceList |
465
- | useFeeArray |
461
+ **Kind**: global variable
462
+
463
+ | Param |
464
+ | --------------------------- |
465
+ | fetchProduct |
466
+ | getIfAddressIsInsideZones |
467
+ | getDistanceFromAddress |
468
+ | cart |
469
+ | expeditionMethod |
470
+ | grassProduct |
471
+ | concreteOrder |
472
+ | cartContainsInstallation |
473
+ | cartContainsVrac |
474
+ | isPro |
475
+ | addOnePalletToPickup |
476
+ | cartContainsSample |
477
+ | saveToShippingPayload |
478
+ | deliveryAddress |
479
+ | locale |
480
+ | expeditionDate |
481
+ | equipmentPickupOnSite |
482
+ | cartContainsOnlyAccessories |
483
+ | pickupStore |
484
+ | allStores |
485
+ | customPriceList |
486
+ | useFeeArray |
466
487
 
467
488
  <a name="applyFeesToCart"></a>
468
489
 
469
490
  ## applyFeesToCart
491
+
470
492
  <p>Checks if sample shipping fee should be removed from cart depending on cart items found in cart.
471
493
  ** Optimized version possible using brand name instead of brand id, removing async check.
472
494
  ** Optimized version reverted, logic found in commit here : [#2087b32](https://github.com/ciaoqc/gng-tb-admin-sdk/commit/2087b3207df9e5916a979b8bb255abc2a4c1dac6)</p>
473
495
 
474
- **Kind**: global variable
496
+ **Kind**: global variable
475
497
 
476
- | Param |
477
- | --- |
478
- | fetchProduct |
479
- | cart |
480
- | locale |
481
- | useFeeArray |
498
+ | Param |
499
+ | ------------ |
500
+ | fetchProduct |
501
+ | cart |
502
+ | locale |
503
+ | useFeeArray |
482
504
 
483
505
  <a name="calculateShippingForVrac"></a>
484
506
 
485
507
  ## calculateShippingForVrac ⇒
508
+
486
509
  <p>checks if cart expired using the updated_at date stored in the shipping_payload</p>
487
510
 
488
511
  **Kind**: global variable
489
- **Returns**: <p>boolean</p>
512
+ **Returns**: <p>boolean</p>
490
513
 
491
- | Param |
492
- | --- |
493
- | cartData |
494
- | grassProduct |
495
- | concreteOrder |
496
- | isPro |
497
- | isSample |
514
+ | Param |
515
+ | ------------- |
516
+ | cartData |
517
+ | grassProduct |
518
+ | concreteOrder |
519
+ | isPro |
520
+ | isSample |
498
521
 
499
522
  <a name="transformG2CustomerToCustomer"></a>
500
523
 
501
524
  ## transformG2CustomerToCustomer
525
+
502
526
  <p>Verifies if customer exists in G2.</p>
503
527
 
504
- **Kind**: global variable
528
+ **Kind**: global variable
505
529
 
506
- | Param | Description |
507
- | --- | --- |
530
+ | Param | Description |
531
+ | ---------- | ------------------------------- |
508
532
  | customerID | <p>Customer ID for G2 fetch</p> |
509
- | space | <p>Space Object</p> |
510
- | org | <p>Org Object</p> |
533
+ | space | <p>Space Object</p> |
534
+ | org | <p>Org Object</p> |
511
535
 
512
536
  <a name="checkIfCustomerExistsInG2"></a>
513
537
 
514
538
  ## checkIfCustomerExistsInG2
539
+
515
540
  <p>Updates customer in database with new info found in G2.</p>
516
541
 
517
- **Kind**: global variable
542
+ **Kind**: global variable
518
543
 
519
- | Param | Description |
520
- | --- | --- |
521
- | customerID | <p>Customer ID for G2 fetch</p> |
522
- | space | <p>Space Object</p> |
523
- | org | <p>Org Object</p> |
524
- | addToDB | <p>if updated customer should be saved to database (defaults to true)</p> |
544
+ | Param | Description |
545
+ | -------------- | ---------------------------------------------------------------------------- |
546
+ | customerID | <p>Customer ID for G2 fetch</p> |
547
+ | space | <p>Space Object</p> |
548
+ | org | <p>Org Object</p> |
549
+ | addToDB | <p>if updated customer should be saved to database (defaults to true)</p> |
525
550
  | skipEmailCheck | <p>if check for unique email should be skiped or not (defaults to false)</p> |
526
551
 
527
552
  <a name="getCustomPriceList"></a>
528
553
 
529
554
  ## getCustomPriceList
555
+
530
556
  <p>Get promise to purchase additionnal escompte equivalent from customPriceList for specific cart item</p>
531
557
 
532
- **Kind**: global variable
558
+ **Kind**: global variable
533
559
 
534
- | Param | Description |
535
- | --- | --- |
560
+ | Param | Description |
561
+ | --------------- | ------------------------------------------ |
536
562
  | customPriceList | <p>The pro customers custom price list</p> |
537
- | item | <p>The cart item to check</p> |
563
+ | item | <p>The cart item to check</p> |
538
564
 
539
565
  <a name="getFittingUnits"></a>
540
566
 
541
567
  ## getFittingUnits ⇒
568
+
542
569
  <p>Returns string corresponding to provided cart's type.</p>
543
570
 
544
571
  **Kind**: global variable
545
- **Returns**: <p>a string containing the order type</p>
572
+ **Returns**: <p>a string containing the order type</p>
546
573
 
547
- | Param | Description |
548
- | --- | --- |
549
- | cartData | <p>Corresponding cart</p> |
550
- | frOnly | <p>If true, forces french string,</p> |
574
+ | Param | Description |
575
+ | -------- | --------------------------------------------------------------------------- |
576
+ | cartData | <p>Corresponding cart</p> |
577
+ | frOnly | <p>If true, forces french string,</p> |
551
578
  | slugSafe | <p>If true, will always return a slug-safe string (with string_to_slug)</p> |
552
579
 
553
580
  <a name="getProductSellUnitLabel"></a>
554
581
 
555
582
  ## getProductSellUnitLabel ⇒ <code>string</code>
583
+
556
584
  <p>Returns the plural unit label for a specific slug</p>
557
585
 
558
586
  **Kind**: global variable
559
- **Returns**: <code>string</code> - <p>The plural unit label</p>
587
+ **Returns**: <code>string</code> - <p>The plural unit label</p>
560
588
 
561
- | Param | Type | Description |
562
- | --- | --- | --- |
563
- | unitSlug | <code>string</code> | <p>The slug of the unit for which we want to get the label</p> |
564
- | locale | <code>string</code> \| <code>undefined</code> | <p>The language in which we want to get the label</p> |
565
- | returnUnitForSlugs | <code>Array.&lt;string&gt;</code> | <p>The slugs for which we want to return a default value, in this case the unit slug for unit</p> |
589
+ | Param | Type | Description |
590
+ | ------------------ | --------------------------------------------- | ------------------------------------------------------------------------------------------------- |
591
+ | unitSlug | <code>string</code> | <p>The slug of the unit for which we want to get the label</p> |
592
+ | locale | <code>string</code> \| <code>undefined</code> | <p>The language in which we want to get the label</p> |
593
+ | returnUnitForSlugs | <code>Array.&lt;string&gt;</code> | <p>The slugs for which we want to return a default value, in this case the unit slug for unit</p> |
566
594
 
567
595
  <a name="getDescriptionString"></a>
568
596
 
569
597
  ## getDescriptionString
598
+
570
599
  <p>Returns rounded product quantities depending on current value, value of secondary input if existant and sale unit per command step ratio found in product.</p>
571
600
 
572
- **Kind**: global variable
601
+ **Kind**: global variable
573
602
 
574
- | Param | Type | Description |
575
- | --- | --- | --- |
576
- | value | <code>number</code> | <p>Current quantity as entered by user in first input</p> |
577
- | otherUnits | <code>Array.&lt;IFilledDimensionUnits&gt;</code> \| <code>undefined</code> | <p>FilledDimensionUnits found in product (possibly undefined)</p> |
578
- | value2 | <code>number</code> \| <code>undefined</code> | <p>Current quantity as entered by user in second input (possibly undefined)</p> |
579
- | targetIsSecondaryInput | <code>boolean</code> | <p>If action was triggered from secondary input (defaults to false)</p> |
603
+ | Param | Type | Description |
604
+ | ---------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
605
+ | value | <code>number</code> | <p>Current quantity as entered by user in first input</p> |
606
+ | otherUnits | <code>Array.&lt;IFilledDimensionUnits&gt;</code> \| <code>undefined</code> | <p>FilledDimensionUnits found in product (possibly undefined)</p> |
607
+ | value2 | <code>number</code> \| <code>undefined</code> | <p>Current quantity as entered by user in second input (possibly undefined)</p> |
608
+ | targetIsSecondaryInput | <code>boolean</code> | <p>If action was triggered from secondary input (defaults to false)</p> |
580
609
 
581
610
  <a name="splitOnDashes"></a>
582
611
 
583
612
  ## splitOnDashes ⇒ <code>Array.&lt;string&gt;</code>
613
+
584
614
  <p>Get product name as array. Array created mostly by splitting name on dash symbol (and variations).</p>
585
615
 
586
616
  **Kind**: global variable
587
617
  **Returns**: <code>Array.&lt;string&gt;</code> - <ul>
618
+
588
619
  <li>Position 0 is the &quot;commum section&quot; of the name, and position 1 should contain all specifics (ex. color, size, etc...)</li>
589
- </ul>
620
+ </ul>
590
621
 
591
- | Param | Type |
592
- | --- | --- |
593
- | product | <code>IIndexedVariationAlgolia</code> \| <code>IIndexedProduct</code> |
594
- | locale | <code>string</code> \| <code>undefined</code> |
622
+ | Param | Type |
623
+ | ------- | --------------------------------------------------------------------- |
624
+ | product | <code>IIndexedVariationAlgolia</code> \| <code>IIndexedProduct</code> |
625
+ | locale | <code>string</code> \| <code>undefined</code> |
595
626
 
596
627
  <a name="getProdName"></a>
597
628
 
598
629
  ## getProdName
630
+
599
631
  <p>Function getParentProductCategoryGroup</p>
600
632
 
601
- **Kind**: global variable
633
+ **Kind**: global variable
602
634
 
603
- | Param | Description |
604
- | --- | --- |
605
- | prod | <p>Product to check</p> |
635
+ | Param | Description |
636
+ | ----- | ----------------------- |
637
+ | prod | <p>Product to check</p> |
606
638
 
607
639
  <a name="getParentProductCategoryGroup"></a>
608
640
 
609
641
  ## getParentProductCategoryGroup
642
+
610
643
  <p>Function getProductFormOptions - Returns all AttributeValues for product to construct options in add to cart form</p>
611
644
 
612
- **Kind**: global variable
645
+ **Kind**: global variable
613
646
 
614
- | Param | Description |
615
- | --- | --- |
616
- | product | <p>Product to check</p> |
647
+ | Param | Description |
648
+ | ---------- | ---------------------------------------------- |
649
+ | product | <p>Product to check</p> |
617
650
  | attributes | <p>Array of IAttributes to fetch info from</p> |
618
651
 
619
652
  <a name="getProductFormOptions"></a>
620
653
 
621
654
  ## getProductFormOptions ⇒
655
+
622
656
  <p>Checks if product is of type by checking TYPE attribute value. Works with indexed product or cart item.</p>
623
657
 
624
658
  **Kind**: global variable
625
- **Returns**: <p>boolean</p>
659
+ **Returns**: <p>boolean</p>
626
660
 
627
- | Param |
628
- | --- |
629
- | product |
630
- | type |
631
- | excludeUndefined |
661
+ | Param |
662
+ | ---------------- |
663
+ | product |
664
+ | type |
665
+ | excludeUndefined |
632
666
 
633
667
  <a name="checkIfProductIsInstallation"></a>
634
668
 
635
669
  ## checkIfProductIsInstallation
670
+
636
671
  <p>Returns array of installation items found in provided array</p>
637
672
 
638
- **Kind**: global variable
673
+ **Kind**: global variable
639
674
 
640
- | Param | Description |
641
- | --- | --- |
675
+ | Param | Description |
676
+ | ----- | ----------------------------------------------------------- |
642
677
  | items | <p>Array of cart items or IIndexedDeclinations to check</p> |
643
678
 
644
679
  <a name="getAllInstallFromItems"></a>
645
680
 
646
681
  ## getAllInstallFromItems
682
+
647
683
  <ul>
648
684
  <li>Returns items with only one apparent grass product (used for detail customers).
649
685
  ** FOR DISPLAY PURPOSES ONLY - Always save grass products separatly in ICart **</li>
650
686
  </ul>
651
687
 
652
- **Kind**: global variable
688
+ **Kind**: global variable
653
689
 
654
- | Param | Description |
655
- | --- | --- |
690
+ | Param | Description |
691
+ | -------------- | --------------------------------------------------------------------- |
656
692
  | recursiveItems | <p>ICartItems with subitems (object created for display purposes)</p> |
657
693
 
658
694
  <a name="getGrassSubQuestionsByType"></a>
659
695
 
660
696
  ## getGrassSubQuestionsByType ⇒
697
+
661
698
  <p>For grass products. Over 1480pi2, if installation, quantities are rounded to rolls (10pi2) if pickup, and to half pal. if shipping</p>
662
699
 
663
700
  **Kind**: global variable
664
- **Returns**: <p>quantity rounded to rolls with items to change or undefined</p>
701
+ **Returns**: <p>quantity rounded to rolls with items to change or undefined</p>
665
702
 
666
- | Param |
667
- | --- |
668
- | grassProduct |
669
- | cartData |
703
+ | Param |
704
+ | ------------ |
705
+ | grassProduct |
706
+ | cartData |
670
707
 
671
708
  <a name="handleGrassProductQtyRoundForShipping"></a>
672
709
 
673
710
  ## handleGrassProductQtyRoundForShipping
711
+
674
712
  <p>Returns rounded grass quantity depending on current qty, if customer selected installation and pallet unit (if defined)</p>
675
713
 
676
- **Kind**: global variable
714
+ **Kind**: global variable
677
715
 
678
- | Param | Type | Description |
679
- | --- | --- | --- |
680
- | currentQte | <code>number</code> | <p>Current quantity as entered by user in input</p> |
681
- | isShipping | <code>boolean</code> | <p>Whether customer has selected installation option</p> |
682
- | palUnit | <code>IFilledDimensionUnits</code> \| <code>undefined</code> | <p>Pallet FilledDimensionUnit (possibly undefined)</p> |
716
+ | Param | Type | Description |
717
+ | ---------- | ------------------------------------------------------------ | -------------------------------------------------------- |
718
+ | currentQte | <code>number</code> | <p>Current quantity as entered by user in input</p> |
719
+ | isShipping | <code>boolean</code> | <p>Whether customer has selected installation option</p> |
720
+ | palUnit | <code>IFilledDimensionUnits</code> \| <code>undefined</code> | <p>Pallet FilledDimensionUnit (possibly undefined)</p> |
683
721
 
684
722
  <a name="getConcreteQteText"></a>
685
723
 
686
724
  ## getConcreteQteText
725
+
687
726
  <p>returns all items in cart where attribute AVAILABILITY contains wanted type.</p>
688
727
 
689
- **Kind**: global variable
728
+ **Kind**: global variable
690
729
 
691
- | Param |
692
- | --- |
693
- | cartData |
694
- | availabilityType |
730
+ | Param |
731
+ | ---------------- |
732
+ | cartData |
733
+ | availabilityType |
695
734
 
696
735
  <a name="getConcreteItemsByAvailability"></a>
697
736
 
698
737
  ## getConcreteItemsByAvailability ⇒
738
+
699
739
  <p>Function getVracType - constructs vrac helper object is cart contains vrac or vrac associated items.</p>
700
740
 
701
741
  **Kind**: global variable
702
- **Returns**: <p>IVracType object containing vrac_type enum value and vrac_store_ids where vrac items are available</p>
742
+ **Returns**: <p>IVracType object containing vrac_type enum value and vrac_store_ids where vrac items are available</p>
703
743
 
704
- | Param |
705
- | --- |
706
- | stores |
707
- | cartData |
708
- | getInventoryItemCallback |
744
+ | Param |
745
+ | ------------------------ |
746
+ | stores |
747
+ | cartData |
748
+ | getInventoryItemCallback |
709
749
 
710
750
  <a name="fetchFeesBeforeCart"></a>
711
751
 
712
752
  ## fetchFeesBeforeCart
753
+
713
754
  <p>Check if pro custom promo info should be shown for customer for a specific product.</p>
714
755
 
715
- **Kind**: global variable
756
+ **Kind**: global variable
716
757
 
717
- | Param |
718
- | --- |
719
- | userData |
720
- | isPro |
721
- | product |
722
- | customMinPrice |
758
+ | Param |
759
+ | -------------- |
760
+ | userData |
761
+ | isPro |
762
+ | product |
763
+ | customMinPrice |
723
764
 
724
765
  <a name="calculateUpsellQte"></a>
725
766
 
726
767
  ## calculateUpsellQte
768
+
727
769
  <ul>
728
770
  <li>checks all upsells in product and returns those where associated quantities are found.</li>
729
771
  </ul>
730
772
 
731
- **Kind**: global variable
773
+ **Kind**: global variable
732
774
 
733
- | Param | Description |
734
- | --- | --- |
735
- | upsellProducts | <p>All upsells in product</p> |
736
- | cartItems | <p>All current cart items</p> |
737
- | checkQte | <p>If all upsells should be checked for quantity</p> |
738
- | alwaysShow | <p>If upsell should be considered even if it already exists in cart as item</p> |
775
+ | Param | Description |
776
+ | -------------- | ------------------------------------------------------------------------------- |
777
+ | upsellProducts | <p>All upsells in product</p> |
778
+ | cartItems | <p>All current cart items</p> |
779
+ | checkQte | <p>If all upsells should be checked for quantity</p> |
780
+ | alwaysShow | <p>If upsell should be considered even if it already exists in cart as item</p> |
739
781
 
740
782
  <a name="getUpsellsToQuantify"></a>
741
783
 
742
784
  ## getUpsellsToQuantify
785
+
743
786
  <ul>
744
787
  <li>Returns upsell equivalence text</li>
745
788
  </ul>
746
789
 
747
- **Kind**: global variable
790
+ **Kind**: global variable
748
791
 
749
- | Param | Description |
750
- | --- | --- |
751
- | upsellsToQuantify | <p>All upsells to show in text</p> |
752
- | qte | <p>Associated product quantity</p> |
753
- | specificProduct | <p>If upsell shown is a specific products</p> |
754
- | isMulti | <p>If upsell if shared by more than one item in cart</p> |
755
- | locale | <p>locale of string to return</p> |
792
+ | Param | Description |
793
+ | ----------------- | -------------------------------------------------------- |
794
+ | upsellsToQuantify | <p>All upsells to show in text</p> |
795
+ | qte | <p>Associated product quantity</p> |
796
+ | specificProduct | <p>If upsell shown is a specific products</p> |
797
+ | isMulti | <p>If upsell if shared by more than one item in cart</p> |
798
+ | locale | <p>locale of string to return</p> |
756
799
 
757
800
  <a name="getGeneralUpsellQteText"></a>
758
801
 
759
802
  ## getGeneralUpsellQteText
803
+
760
804
  <ul>
761
805
  <li>Returns quantity stinrg and upsell name to show in Upsell Quantity indicator</li>
762
806
  </ul>
763
807
 
764
- **Kind**: global variable
808
+ **Kind**: global variable
765
809
 
766
- | Param | Description |
767
- | --- | --- |
768
- | upsell | <p>Upsell to show qyantity for</p> |
810
+ | Param | Description |
811
+ | ---------- | ----------------------------------------------------------- |
812
+ | upsell | <p>Upsell to show qyantity for</p> |
769
813
  | productQte | <p>Quantity of associated product for ratio calculation</p> |
770
- | locale | <p>locale of string to return</p> |
814
+ | locale | <p>locale of string to return</p> |
771
815
 
772
816
  <a name="checkIfCartContainsException"></a>
773
817
 
774
818
  ## checkIfCartContainsException
819
+
775
820
  <p>Function getCartItemsFromProdUpsells</p>
776
821
 
777
- **Kind**: global variable
822
+ **Kind**: global variable
778
823
 
779
- | Param | Type | Description |
780
- | --- | --- | --- |
781
- | qte | <code>number</code> | <p>Quantity of product to which upsell is associated</p> |
782
- | currentSku | <code>string</code> | <p>Sku of the declination selected by user for the product to which upsell is associated</p> |
783
- | prodUpsell | <code>Array.&lt;IProductRecommendation&gt;</code> | <p>Array of upsells found in product</p> |
784
- | getProduct | | <p>Callback function to fetch product from DB</p> |
785
- | locale | <code>string</code> | <p>locale for product fetch (defaults to 'fr')</p> |
824
+ | Param | Type | Description |
825
+ | ---------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------- |
826
+ | qte | <code>number</code> | <p>Quantity of product to which upsell is associated</p> |
827
+ | currentSku | <code>string</code> | <p>Sku of the declination selected by user for the product to which upsell is associated</p> |
828
+ | prodUpsell | <code>Array.&lt;IProductRecommendation&gt;</code> | <p>Array of upsells found in product</p> |
829
+ | getProduct | | <p>Callback function to fetch product from DB</p> |
830
+ | locale | <code>string</code> | <p>locale for product fetch (defaults to 'fr')</p> |
786
831
 
787
832
  <a name="mockCustomPriceList"></a>
788
833
 
789
834
  ## mockCustomPriceList
835
+
790
836
  <p>Takes in a function and checks for error</p>
791
837
 
792
- **Kind**: global variable
838
+ **Kind**: global variable
793
839
 
794
- | Param | Type | Description |
795
- | --- | --- | --- |
796
- | method | <code>function</code> | <p>The function to check</p> |
797
- | params | <code>Array.&lt;any&gt;</code> | <p>The array of function parameters</p> |
798
- | message | <code>string</code> | <p>Optional message to match with error message</p> |
840
+ | Param | Type | Description |
841
+ | ------- | ------------------------------ | --------------------------------------------------- |
842
+ | method | <code>function</code> | <p>The function to check</p> |
843
+ | params | <code>Array.&lt;any&gt;</code> | <p>The array of function parameters</p> |
844
+ | message | <code>string</code> | <p>Optional message to match with error message</p> |
799
845
 
800
846
  <a name="getRandomValue"></a>
801
847
 
802
848
  ## getRandomValue ⇒
849
+
803
850
  <p>Get an object property value</p>
804
851
 
805
852
  **Kind**: global variable
806
- **Returns**: <p>the property value</p>
853
+ **Returns**: <p>the property value</p>
807
854
 
808
- | Param | Description |
809
- | --- | --- |
810
- | obj | <p>The object to scan</p> |
855
+ | Param | Description |
856
+ | ----- | -------------------------------------- |
857
+ | obj | <p>The object to scan</p> |
811
858
  | props | <p>The path of the property to get</p> |
812
859
 
813
860
  <a name="getObjectProperty"></a>
814
861
 
815
862
  ## getObjectProperty ⇒
863
+
816
864
  <p>Set an object property to an anonymized value if it exists</p>
817
865
 
818
866
  **Kind**: global variable
819
- **Returns**: <p>The object with the edited value</p>
867
+ **Returns**: <p>The object with the edited value</p>
820
868
 
821
- | Param | Description |
822
- | --- | --- |
823
- | obj | <p>The object to look into</p> |
824
- | props | <p>The property path</p> |
825
- | type | <p>The property type used to shuffle the data</p> |
869
+ | Param | Description |
870
+ | ----- | ------------------------------------------------- |
871
+ | obj | <p>The object to look into</p> |
872
+ | props | <p>The property path</p> |
873
+ | type | <p>The property type used to shuffle the data</p> |
826
874
 
827
875
  <a name="setObjectProperty"></a>
828
876
 
829
877
  ## setObjectProperty ⇒
878
+
830
879
  <p>Anonymise the customer data if in test env</p>
831
880
 
832
881
  **Kind**: global variable
833
- **Returns**: <p>The new customer data</p>
882
+ **Returns**: <p>The new customer data</p>
834
883
 
835
- | Param | Description |
836
- | --- | --- |
837
- | c | <p>The customer data</p> |
884
+ | Param | Description |
885
+ | ----- | ------------------------ |
886
+ | c | <p>The customer data</p> |
838
887
 
839
888
  <a name="getCurrentProvince"></a>
840
889
 
841
890
  ## getCurrentProvince ⇒
891
+
842
892
  <p>Constructs and returns data for indexed cart (algolia or addio)</p>
843
893
 
844
894
  **Kind**: global variable
845
- **Returns**: <IIndexedCart>
895
+ **Returns**: <IIndexedCart>
846
896
 
847
- | Param | Description |
848
- | --- | --- |
849
- | cartData | <p>Current cart data</p> |
850
- | space | <p>Space object</p> |
851
- | setPaidAtIfUndefined | <p>Optionnal - If true, will set paid_at with current date</p> |
852
- | customer | <p>Optionnal - If defined, adds info based on customer to indexedCart</p> |
897
+ | Param | Description |
898
+ | -------------------- | ------------------------------------------------------------------------- |
899
+ | cartData | <p>Current cart data</p> |
900
+ | space | <p>Space object</p> |
901
+ | setPaidAtIfUndefined | <p>Optionnal - If true, will set paid_at with current date</p> |
902
+ | customer | <p>Optionnal - If defined, adds info based on customer to indexedCart</p> |
853
903
 
854
904
  <a name="getCartPromo"></a>
855
905
 
856
906
  ## getCartPromo
907
+
857
908
  <p>Check if current cart promos applied contain a promo_code type promotion</p>
858
909
 
859
- **Kind**: global variable
910
+ **Kind**: global variable
860
911
 
861
- | Param |
862
- | --- |
863
- | cartData |
912
+ | Param |
913
+ | -------- |
914
+ | cartData |
864
915
 
865
916
  <a name="shouldCheckPromoCode"></a>
866
917
 
867
918
  ## shouldCheckPromoCode
919
+
868
920
  <p>Check if a discount rule applies to a specific declination</p>
869
921
 
870
- **Kind**: global variable
922
+ **Kind**: global variable
871
923
 
872
- | Param | Description |
873
- | --- | --- |
924
+ | Param | Description |
925
+ | ------------- | --------------------------------- |
874
926
  | discount_rule | <p>The discount rule to check</p> |
875
- | declination | <p>The declination to compare</p> |
927
+ | declination | <p>The declination to compare</p> |
876
928
 
877
929
  <a name="shouldApplyRuleToDeclination"></a>
878
930
 
879
931
  ## shouldApplyRuleToDeclination
932
+
880
933
  <p>Check if a specific rule of a discount rule is respected</p>
881
934
 
882
- **Kind**: global variable
935
+ **Kind**: global variable
883
936
 
884
- | Param | Description |
885
- | --- | --- |
886
- | ruleDetail | <p>The rule details object to check</p> |
887
- | cartValue | <p>The value to compare with rule specifications</p> |
937
+ | Param | Description |
938
+ | ---------- | ---------------------------------------------------- |
939
+ | ruleDetail | <p>The rule details object to check</p> |
940
+ | cartValue | <p>The value to compare with rule specifications</p> |
888
941
 
889
942
  <a name="getResultRuleDetail"></a>
890
943
 
891
944
  ## getResultRuleDetail
945
+
892
946
  <p>Check if rule applied to product attributes is respected for specific declination attributes</p>
893
947
 
894
- **Kind**: global variable
948
+ **Kind**: global variable
895
949
 
896
- | Param | Description |
897
- | --- | --- |
898
- | attributeAndValues | <p>The rule details object to check</p> |
950
+ | Param | Description |
951
+ | ------------------------ | --------------------------------------------- |
952
+ | attributeAndValues | <p>The rule details object to check</p> |
899
953
  | arrDeclinationAttributes | <p>The declinations attributes to compare</p> |
900
954
 
901
955
  <a name="getCartPromoType"></a>
902
956
 
903
957
  ## getCartPromoType
958
+
904
959
  <p>Check if promo code can be applied to a specific cart</p>
905
960
 
906
- **Kind**: global variable
961
+ **Kind**: global variable
907
962
 
908
- | Param | Description |
909
- | --- | --- |
910
- | cart | <p>The cart to check</p> |
963
+ | Param | Description |
964
+ | --------- | ------------------------------------------------- |
965
+ | cart | <p>The cart to check</p> |
911
966
  | promoCode | <p>The discount rule with promo code to check</p> |
912
967
 
913
968
  <a name="checkPromoCodeEligibility"></a>
914
969
 
915
970
  ## checkPromoCodeEligibility
971
+
916
972
  <p>Returns tier pricing step that should be applied for provided quantity, or undefined if none should apply</p>
917
973
 
918
- **Kind**: global variable
974
+ **Kind**: global variable
919
975
 
920
- | Param | Description |
921
- | --- | --- |
976
+ | Param | Description |
977
+ | ------------------ | ---------------------------------------------- |
922
978
  | tierPricingToCheck | <p>the indexed tier-pricing array to check</p> |
923
- | qte | |
979
+ | qte | |
924
980
 
925
981
  <a name="getTierPricingToApply"></a>
926
982
 
927
983
  ## getTierPricingToApply
984
+
928
985
  <p>Converts tier-pricing found in discount_rule to IIndexedTierPricing.</p>
929
986
 
930
- **Kind**: global variable
987
+ **Kind**: global variable
931
988
 
932
- | Param | Description |
933
- | --- | --- |
934
- | discountRule | <p>the tier-pricing tier discountRule to check</p> |
935
- | price | <p>declinations regular price from which tier-pricing result is calculated</p> |
936
- | space | |
937
- | decimals | <p>the amount of decimals to show on tier-pricing result</p> |
989
+ | Param | Description |
990
+ | ------------ | ------------------------------------------------------------------------------ |
991
+ | discountRule | <p>the tier-pricing tier discountRule to check</p> |
992
+ | price | <p>declinations regular price from which tier-pricing result is calculated</p> |
993
+ | space | |
994
+ | decimals | <p>the amount of decimals to show on tier-pricing result</p> |
938
995
 
939
996
  <a name="applyTierPricing"></a>
940
997
 
941
998
  ## applyTierPricing
999
+
942
1000
  <p>Calculate new discount_price object for cart item base on qte and tier_pricing</p>
943
1001
 
944
- **Kind**: global variable
1002
+ **Kind**: global variable
945
1003
 
946
- | Param | Description |
947
- | --- | --- |
948
- | item | <p>the item to check</p> |
949
- | setOriginalPrice | <p>if original_amount should be set instead of discount_price.amount</p> |
950
- | originalDecli | <p>Optionnal. The IIndexedDeclination used to construct the cart item originally.</p> |
1004
+ | Param | Description |
1005
+ | ---------------- | ------------------------------------------------------------------------------------- |
1006
+ | item | <p>the item to check</p> |
1007
+ | setOriginalPrice | <p>if original_amount should be set instead of discount_price.amount</p> |
1008
+ | originalDecli | <p>Optionnal. The IIndexedDeclination used to construct the cart item originally.</p> |
951
1009
 
952
1010
  <a name="getNewDiscountPriceFromTierPricing"></a>
953
1011
 
954
1012
  ## getNewDiscountPriceFromTierPricing
1013
+
955
1014
  <p>Get discounted price after applying discount rules to a provided price</p>
956
1015
 
957
- **Kind**: global variable
1016
+ **Kind**: global variable
958
1017
 
959
- | Param | Description |
960
- | --- | --- |
961
- | discount_rules | <p>The discount rules to apply</p> |
962
- | amount | <p>The initial amount on which to apply discounts</p> |
963
- | space | |
1018
+ | Param | Description |
1019
+ | -------------- | ----------------------------------------------------- |
1020
+ | discount_rules | <p>The discount rules to apply</p> |
1021
+ | amount | <p>The initial amount on which to apply discounts</p> |
1022
+ | space | |
964
1023
 
965
1024
  <a name="applyDiscountRulesOnProduct"></a>
966
1025
 
967
1026
  ## applyDiscountRulesOnProduct
1027
+
968
1028
  <p>Get result of discount rule discount on a provided amount</p>
969
1029
 
970
- **Kind**: global variable
1030
+ **Kind**: global variable
971
1031
 
972
- | Param | Description |
973
- | --- | --- |
974
- | initial | <p>The price on which to apply the discount</p> |
975
- | discountResultObj | <p>The discount rule result object</p> |
1032
+ | Param | Description |
1033
+ | ----------------- | ----------------------------------------------- |
1034
+ | initial | <p>The price on which to apply the discount</p> |
1035
+ | discountResultObj | <p>The discount rule result object</p> |
976
1036
 
977
1037
  <a name="applyDiscountToPrice"></a>
978
1038
 
979
1039
  ## applyDiscountToPrice ⇒
1040
+
980
1041
  <p>Get sku(s) affected by a promo as an array of strings</p>
981
1042
 
982
1043
  **Kind**: global variable
983
- **Returns**: <p>And array of strings</p>
1044
+ **Returns**: <p>And array of strings</p>
984
1045
 
985
- | Param | Description |
986
- | --- | --- |
1046
+ | Param | Description |
1047
+ | -------------- | ----------------------------------------------------- |
987
1048
  | valueToConvert | <p>The sku or sku array associated with the promo</p> |
988
1049
 
989
1050
  <a name="getSkuArrayForPromo"></a>
990
1051
 
991
1052
  ## getSkuArrayForPromo ⇒
1053
+
992
1054
  <p>Returns a list of all skus where promo applied to specific products should apply. Check for both amount/percent_sku and amount/percent_category options.</p>
993
1055
 
994
1056
  **Kind**: global variable
995
- **Returns**: <p>An array of strings</p>
1057
+ **Returns**: <p>An array of strings</p>
996
1058
 
997
- | Param | Description |
998
- | --- | --- |
999
- | cartItems | <p>The current cart items</p> |
1000
- | promoToCheck | <p>The promo to check</p> |
1059
+ | Param | Description |
1060
+ | ------------ | ----------------------------- |
1061
+ | cartItems | <p>The current cart items</p> |
1062
+ | promoToCheck | <p>The promo to check</p> |
1001
1063
 
1002
1064
  <a name="getResultAppliedDiscountSkus"></a>
1003
1065
 
1004
1066
  ## getResultAppliedDiscountSkus ⇒
1067
+
1005
1068
  <p>Creates array of all category level slugs for a cart item.</p>
1006
1069
 
1007
1070
  **Kind**: global variable
1008
- **Returns**: <p>An array of strings</p>
1071
+ **Returns**: <p>An array of strings</p>
1009
1072
 
1010
- | Param | Description |
1011
- | --- | --- |
1073
+ | Param | Description |
1074
+ | -------------- | ------------------------------------------- |
1012
1075
  | itemCategories | <p>Value found in props cart.categories</p> |
1013
1076
 
1014
1077
  <a name="getItemCategorySlugArray"></a>
1015
1078
 
1016
1079
  ## getItemCategorySlugArray
1080
+
1017
1081
  <p>Apply all valid discounts found in a specific cart's discount_rules props to cart</p>
1018
1082
 
1019
- **Kind**: global variable
1083
+ **Kind**: global variable
1020
1084
 
1021
- | Param | Description |
1022
- | --- | --- |
1023
- | cart | <p>The cart to check</p> |
1024
- | isMultiPromo | |
1085
+ | Param | Description |
1086
+ | ------------- | --------------------------------------------------------------------------------- |
1087
+ | cart | <p>The cart to check</p> |
1088
+ | isMultiPromo | |
1025
1089
  | forceShipping | <p>If cart should be considered as a shipping cart, even if is_pickup is true</p> |
1026
1090
 
1027
1091
  <a name="applyDiscountToCart"></a>
1028
1092
 
1029
1093
  ## applyDiscountToCart
1094
+
1030
1095
  <p>Get the ICartPromoApplied object for a specified discount_rule. Only works for promos that do not apply to products of certain categories/skus.</p>
1031
1096
 
1032
- **Kind**: global variable
1097
+ **Kind**: global variable
1033
1098
 
1034
1099
  | Param |
1035
- | --- |
1036
- | cart |
1037
- | discount |
1100
+ | -------getConvertedUnitQuantity
1101
+ | cart |
1102
+ | discount |
1038
1103
 
1039
1104
  <a name="getStandardCartPromoFromDiscount"></a>
1040
1105
 
1041
1106
  ## getStandardCartPromoFromDiscount ⇒
1107
+
1042
1108
  <p>Calculates the cumulative subtotal for all service/fee type items in cart, including any applied promos. Usefull when calculating a promo's amount when all fees and services should be excluded.</p>
1043
1109
 
1044
1110
  **Kind**: global variable
1045
- **Returns**: <p>A number</p>
1111
+ **Returns**: <p>A number</p>
1046
1112
 
1047
- | Param | Description |
1048
- | --- | --- |
1049
- | cartData | <p>The cartData to check</p> |
1113
+ | Param | Description |
1114
+ | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
1115
+ | cartData | <p>The cartData to check</p> |
1050
1116
  | allCurrentAppliedToItemPromos | <p>All currently active cartPromos that apply to items in cart. Sent seperatly in case local state is different from current cartData.</p> |
1051
1117
 
1052
1118
  <a name="checkIfCouldApplyIncentivePromo"></a>
1053
1119
 
1054
1120
  ## checkIfCouldApplyIncentivePromo
1121
+
1055
1122
  <p>Calculates amount to be removed for payment incentive type promos.</p>
1056
1123
 
1057
- **Kind**: global variable
1124
+ **Kind**: global variable
1058
1125
 
1059
- | Param | Description |
1060
- | --- | --- |
1061
- | cartData | |
1126
+ | Param | Description |
1127
+ | ------------------ | ---------------------------------------------------------------------------------------------------------- |
1128
+ | cartData | |
1062
1129
  | checkDiscountRules | <p>Optionnal. If cart discount_rules should be checked if cart_promos_applied does not have promo yet.</p> |
1063
1130
 
1064
1131
  <a name="getAfterTaxesPromosTotalAmount"></a>
1065
1132
 
1066
1133
  ## getAfterTaxesPromosTotalAmount
1134
+
1067
1135
  <p>Returns cart_promos_applied corresponding to payment incentive, if found. Can also check in discount_rules if props provided</p>
1068
1136
 
1069
- **Kind**: global variable
1137
+ **Kind**: global variable
1070
1138
 
1071
- | Param | Description |
1072
- | --- | --- |
1073
- | cartData | |
1139
+ | Param | Description |
1140
+ | ------------------ | ------------------------------------------------------------------------------------------------------------- |
1141
+ | cartData | |
1074
1142
  | checkDiscountRules | <p>Optionnal. If the function should check in cart discount_rules if nothing found in cart_promos_applied</p> |
1075
1143
 
1076
1144
  <a name="getAfterTaxesPromoInCart"></a>
1077
1145
 
1078
1146
  ## getAfterTaxesPromoInCart
1147
+
1079
1148
  <p>Returns the information regarding the payment incentive promo if found in cart's discount_rules</p>
1080
1149
 
1081
- **Kind**: global variable
1150
+ **Kind**: global variable
1082
1151
 
1083
- | Param |
1084
- | --- |
1085
- | cartData |
1152
+ | Param |
1153
+ | -------- |
1154
+ | cartData |
1086
1155
 
1087
1156
  <a name="unitShortDict"></a>
1088
1157
 
1089
1158
  ## unitShortDict ⇒ <code>ILang</code>
1159
+
1090
1160
  <p>Returns the dictionnary containing the shortened version of unit labels in multiple languages</p>
1091
1161
 
1092
1162
  **Kind**: global variable
1093
- **Returns**: <code>ILang</code> - <p>The dictionnary containing the shortened unit label in multiple languages</p>
1163
+ **Returns**: <code>ILang</code> - <p>The dictionnary containing the shortened unit label in multiple languages</p>
1094
1164
 
1095
- | Param | Type | Description |
1096
- | --- | --- | --- |
1097
- | slug | <code>string</code> | <p>The slug for which we want to get the shortened dictionnary</p> |
1165
+ | Param | Type | Description |
1166
+ | ------------------ | --------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
1167
+ | slug | <code>string</code> | <p>The slug for which we want to get the shortened dictionnary</p> |
1098
1168
  | returnUnitForSlugs | <code>Array.&lt;string&gt;</code> | <p>An array of slugs that we want to return a default dictionnary for, in this case the unit dictionnary for unit</p> |
1099
1169
 
1100
- <a name="getInventoryUnitQuantity"></a>
1170
+ <a name="getConvertedUnitQuantity"></a>
1171
+
1172
+ ## getConvertedUnitQuantity
1101
1173
 
1102
- ## getInventoryUnitQuantity
1103
1174
  <p>Constructs object with detailled inventory quantities by unit (based on other_units for product)</p>
1104
1175
 
1105
- **Kind**: global variable
1176
+ **Kind**: global variable
1106
1177
 
1107
- | Param | Description |
1108
- | --- | --- |
1109
- | other_units | |
1110
- | inventoryQuantity | |
1111
- | isGrass | |
1178
+ | Param | Description |
1179
+ | --------------------- | ---------------- |
1180
+ | other_units | |
1181
+ | inventoryQuantity | |
1182
+ | isGrass | |
1112
1183
  | showNegativeInventory | <p>optionnal</p> |
1113
1184
 
1114
1185
  <a name="getQty"></a>
1115
1186
 
1116
1187
  ## getQty
1188
+
1117
1189
  <p>Calculates inventory unit quantity for function getQty</p>
1118
1190
 
1119
- **Kind**: global variable
1191
+ **Kind**: global variable
1120
1192
 
1121
- | Param |
1122
- | --- |
1123
- | value |
1124
- | isUnitFittingUnit |
1125
- | isNegativeQty |
1193
+ | Param |
1194
+ | ----------------- |
1195
+ | value |
1196
+ | isUnitFittingUnit |
1197
+ | isNegativeQty |
1126
1198
 
1127
1199
  <a name="recursiveCheckObject"></a>
1128
1200
 
1129
1201
  ## recursiveCheckObject ⇒
1202
+
1130
1203
  <p>Updates value of object by checking recursivly.</p>
1131
1204
 
1132
1205
  **Kind**: global variable
1133
- **Returns**: <p>updated object</p>
1206
+ **Returns**: <p>updated object</p>
1134
1207
 
1135
- | Param | Description |
1136
- | --- | --- |
1137
- | allValues | <p>Full value object</p> |
1138
- | newValue | <p>New value to update</p> |
1208
+ | Param | Description |
1209
+ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1210
+ | allValues | <p>Full value object</p> |
1211
+ | newValue | <p>New value to update</p> |
1139
1212
  | propsToCheck | <p>Full key string associated to value to update, with nested keys seperated by dots (.). If the value to update is nested in an array, use square brackets with index between (ex. first_key.second_key[2].third_key)</p> |
1140
1213
 
1141
1214
  <a name="getOrderedPromises"></a>
1142
1215
 
1143
1216
  ## getOrderedPromises ⇒
1217
+
1144
1218
  <p>Checks list of promises for applicable banks based on space bank types.</p>
1145
1219
 
1146
1220
  **Kind**: global variable
1147
- **Returns**: <p>An array of applicable banks. If no bank is active for a type, is not returned in array. If active bank of type is in a inactive promise, is returned with props pa_is_active: false.</p>
1221
+ **Returns**: <p>An array of applicable banks. If no bank is active for a type, is not returned in array. If active bank of type is in a inactive promise, is returned with props pa_is_active: false.</p>
1148
1222
 
1149
- | Param | Description |
1150
- | --- | --- |
1151
- | promisesToCheck | <p>The promise list to check</p> |
1152
- | possibleBanks | <p>the possible bank types (usually found in space data)</p> |
1223
+ | Param | Description |
1224
+ | --------------- | ------------------------------------------------------------ |
1225
+ | promisesToCheck | <p>The promise list to check</p> |
1226
+ | possibleBanks | <p>the possible bank types (usually found in space data)</p> |
1153
1227
 
1154
1228
  <a name="checkForApplicableBanks"></a>
1155
1229
 
1156
1230
  ## checkForApplicableBanks
1231
+
1157
1232
  <p>Returns if a promise is currently active. Promise is active if it is not archived, and if current date is same or after starting_date, and before ending_date (if defined).</p>
1158
1233
 
1159
- **Kind**: global variable
1234
+ **Kind**: global variable
1160
1235
 
1161
- | Param | Description |
1162
- | --- | --- |
1236
+ | Param | Description |
1237
+ | ------- | -------------------------------- |
1163
1238
  | promise | <p>the promise data to check</p> |
1164
1239
 
1165
1240
  <a name="checkIfOtherBankOfSameTypeIsActive"></a>
1166
1241
 
1167
1242
  ## checkIfOtherBankOfSameTypeIsActive
1243
+
1168
1244
  <p>Returns translated name for a provided bank type ID.</p>
1169
1245
 
1170
- **Kind**: global variable
1246
+ **Kind**: global variable
1171
1247
 
1172
- | Param | Description |
1173
- | --- | --- |
1174
- | allBankTypes | <p>The current bank types for space</p> |
1175
- | bankTypeID | <p>The bank type ID for which we want a name</p> |
1176
- | locale | <p>Optionnal. Defaults to 'fr'</p> |
1248
+ | Param | Description |
1249
+ | ------------ | ------------------------------------------------ |
1250
+ | allBankTypes | <p>The current bank types for space</p> |
1251
+ | bankTypeID | <p>The bank type ID for which we want a name</p> |
1252
+ | locale | <p>Optionnal. Defaults to 'fr'</p> |
1177
1253
 
1178
1254
  <a name="getBankTypeName"></a>
1179
1255
 
1180
1256
  ## getBankTypeName
1257
+
1181
1258
  <p>Calculates the remaining amount for a specific promise's bank</p>
1182
1259
 
1183
- **Kind**: global variable
1260
+ **Kind**: global variable
1184
1261
 
1185
- | Param | Description |
1186
- | --- | --- |
1187
- | initialBankAmount | <p>the initial amount of the bank</p> |
1188
- | bankHistory | <p>array of all history entries for bank. Will be ordered by date before deducing amounts.</p> |
1262
+ | Param | Description |
1263
+ | ----------------- | ---------------------------------------------------------------------------------------------- |
1264
+ | initialBankAmount | <p>the initial amount of the bank</p> |
1265
+ | bankHistory | <p>array of all history entries for bank. Will be ordered by date before deducing amounts.</p> |
1189
1266
 
1190
1267
  <a name="getIndexedByCustomerPromiseValues"></a>
1191
1268
 
1192
1269
  ## getIndexedByCustomerPromiseValues ⇒
1270
+
1193
1271
  <p>Returns the most recently emptied bank of a given type</p>
1194
1272
 
1195
1273
  **Kind**: global variable
1196
- **Returns**: <p>An IBank with a promise_unique_id</p>
1274
+ **Returns**: <p>An IBank with a promise_unique_id</p>
1197
1275
 
1198
- | Param | Description |
1199
- | --- | --- |
1276
+ | Param | Description |
1277
+ | ------------------ | ------------------------------------------------------------- |
1200
1278
  | allCustomerPAsData | <p>the array of all promises to purchase we want to check</p> |
1201
- | type | <p>the bank_type_id to check</p> |
1202
- | promiseUniqueID | <p>the current promise unique id</p> |
1279
+ | type | <p>the bank_type_id to check</p> |
1280
+ | promiseUniqueID | <p>the current promise unique id</p> |
1203
1281
 
1204
1282
  <a name="getIndexServices"></a>
1205
1283
 
1206
1284
  ## getIndexServices
1285
+
1207
1286
  <p>Save new entry objects to provided search index services</p>
1208
1287
 
1209
- **Kind**: global variable
1288
+ **Kind**: global variable
1210
1289
 
1211
- | Param | Description |
1212
- | --- | --- |
1213
- | services | <p>the services to check for save</p> |
1214
- | newEntry | <p>the object to save</p> |
1290
+ | Param | Description |
1291
+ | ------------- | --------------------------------------------------------------- |
1292
+ | services | <p>the services to check for save</p> |
1293
+ | newEntry | <p>the object to save</p> |
1215
1294
  | processLogStr | <p>the string to add to the log shown with service response</p> |
1216
1295
 
1217
1296
  <a name="saveNewEntryToIndex"></a>
1218
1297
 
1219
1298
  ## saveNewEntryToIndex
1299
+
1220
1300
  <p>Save a partial object entry to provided search index services.</p>
1221
1301
 
1222
- **Kind**: global variable
1302
+ **Kind**: global variable
1223
1303
 
1224
- | Param | Description |
1225
- | --- | --- |
1226
- | services | <p>the services to check for save</p> |
1227
- | partialNewEntry | <p>the object to save</p> |
1228
- | processLogStr | <p>the string to add to the log shown with service response</p> |
1304
+ | Param | Description |
1305
+ | ---------------- | --------------------------------------------------------------------------------------- |
1306
+ | services | <p>the services to check for save</p> |
1307
+ | partialNewEntry | <p>the object to save</p> |
1308
+ | processLogStr | <p>the string to add to the log shown with service response</p> |
1229
1309
  | createIfNoExists | <p>= Optionnal. If should create entry if it does not already exist in search index</p> |
1230
1310
 
1231
1311
  <a name="partialSaveNewEntryToIndex"></a>
1232
1312
 
1233
1313
  ## partialSaveNewEntryToIndex
1314
+
1234
1315
  <p>Returns an object with base info needed to call Algolia/AddioSearch with search query.</p>
1235
1316
 
1236
- **Kind**: global variable
1317
+ **Kind**: global variable
1237
1318
 
1238
1319
  | Param |
1239
- | --- |
1240
- | space |
1320
+ | ----- |
1321
+ | space |
1241
1322
 
1242
1323
  <a name="getFetchInfoAlgoliaAddioSearch"></a>
1243
1324
 
1244
1325
  ## getFetchInfoAlgoliaAddioSearch
1326
+
1245
1327
  <p>Fetch entries from either algolia or AddioSearch (prospr) for a provided index. Client-side only!</p>
1246
1328
 
1247
- **Kind**: global variable
1329
+ **Kind**: global variable
1248
1330
 
1249
- | Param |
1250
- | --- |
1251
- | param0 |
1331
+ | Param |
1332
+ | ------ |
1333
+ | param0 |
1252
1334
 
1253
1335
  <a name="fetchEntriesAlgoliaAddioSearch"></a>
1254
1336
 
1255
1337
  ## fetchEntriesAlgoliaAddioSearch
1338
+
1256
1339
  <p>Returns search result from active search index service. Server-side friendly!</p>
1257
1340
 
1258
- **Kind**: global variable
1341
+ **Kind**: global variable
1259
1342
 
1260
- | Param | Description |
1261
- | --- | --- |
1343
+ | Param | Description |
1344
+ | ---------- | ------------------------------------------------------------------------------------------------------ |
1262
1345
  | parameters | <p>Parsed parameters of IQueryProps. Space and indice must be provided, other props are optionnal.</p> |
1263
1346
 
1264
1347
  <a name="isTestEnv"></a>
1265
1348
 
1266
1349
  ## isTestEnv
1350
+
1267
1351
  <p>TBSDK - SDK Manager</p>
1268
1352
  <p>Client SDK to access TheBEAST eCommerce</p>
1269
1353
 
@@ -1271,110 +1355,119 @@ Returns the items to add, update and delete, as well as other cart info to set a
1271
1355
  <a name="spaceInitData"></a>
1272
1356
 
1273
1357
  ## spaceInitData
1358
+
1274
1359
  <p>Use this object to change which space is being tested!</p>
1275
1360
 
1276
1361
  **Kind**: global constant
1277
1362
  <a name="getMinDatePicker"></a>
1278
1363
 
1279
1364
  ## getMinDatePicker()
1365
+
1280
1366
  <p>Sets the minimum shipping day for delivery</p>
1281
1367
 
1282
1368
  **Kind**: global function
1283
1369
  <a name="getProductSellUnitLabel"></a>
1284
1370
 
1285
1371
  ## getProductSellUnitLabel(otherUnits, locale, returnUnitForSlugs) ⇒ <code>string</code>
1372
+
1286
1373
  <p>Returns sell unit label in correct language for a specific product's other_units</p>
1287
1374
 
1288
1375
  **Kind**: global function
1289
- **Returns**: <code>string</code> - <p>The sell unit label in the correct language</p>
1376
+ **Returns**: <code>string</code> - <p>The sell unit label in the correct language</p>
1290
1377
 
1291
- | Param | Type | Default | Description |
1292
- | --- | --- | --- | --- |
1293
- | otherUnits | <code>Array.&lt;IFilledDimensionUnits&gt;</code> \| <code>undefined</code> | | <p>The unit array we have to check to get the sell unit</p> |
1294
- | locale | <code>string</code> \| <code>undefined</code> | <code>&quot;fr&quot;</code> | <p>The language in which we want to return the label</p> |
1295
- | returnUnitForSlugs | <code>Array.&lt;string&gt;</code> | | <p>An array of the slugs we want to return the unit label for</p> |
1378
+ | Param | Type | Default | Description |
1379
+ | ------------------ | -------------------------------------------------------------------------- | --------------------------- | ----------------------------------------------------------------- |
1380
+ | otherUnits | <code>Array.&lt;IFilledDimensionUnits&gt;</code> \| <code>undefined</code> | | <p>The unit array we have to check to get the sell unit</p> |
1381
+ | locale | <code>string</code> \| <code>undefined</code> | <code>&quot;fr&quot;</code> | <p>The language in which we want to return the label</p> |
1382
+ | returnUnitForSlugs | <code>Array.&lt;string&gt;</code> | | <p>An array of the slugs we want to return the unit label for</p> |
1296
1383
 
1297
1384
  <a name="splitOnDashes"></a>
1298
1385
 
1299
1386
  ## splitOnDashes(stringToSplit) ⇒ <code>Array.&lt;string&gt;</code>
1300
- **Kind**: global function
1301
1387
 
1302
- | Param | Type | Description |
1303
- | --- | --- | --- |
1304
- | stringToSplit | <code>string</code> | |
1388
+ **Kind**: global function
1389
+
1390
+ | Param | Type | Description |
1391
+ | ---------------------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
1392
+ | stringToSplit | <code>string</code> | |
1305
1393
  | dummyStringToReplace.currentValue, | <code>string</code> | <p>optionnal, default : '%%-%%'. Used to provide general replace values for a specific string. Is applied to both sections of the splitted string.</p> |
1306
- | dummyStringToReplace.newValue, | <code>string</code> | <p>optionnal, default : ' - '. Used to provide general replace values for a specific string. Is applied to both sections of the splitted string.</p> |
1394
+ | dummyStringToReplace.newValue, | <code>string</code> | <p>optionnal, default : ' - '. Used to provide general replace values for a specific string. Is applied to both sections of the splitted string.</p> |
1307
1395
 
1308
1396
  <a name="getRandomValue"></a>
1309
1397
 
1310
1398
  ## getRandomValue(val, type) ⇒
1399
+
1311
1400
  <p>Replace a value with anonymized value</p>
1312
1401
 
1313
1402
  **Kind**: global function
1314
- **Returns**: <p>the new value</p>
1403
+ **Returns**: <p>the new value</p>
1315
1404
 
1316
- | Param | Description |
1317
- | --- | --- |
1318
- | val | <p>The original value</p> |
1319
- | type | <p>The type of data</p> |
1405
+ | Param | Description |
1406
+ | ----- | ------------------------- |
1407
+ | val | <p>The original value</p> |
1408
+ | type | <p>The type of data</p> |
1320
1409
 
1321
1410
  <a name="getCartPromo"></a>
1322
1411
 
1323
1412
  ## getCartPromo(cartData)
1413
+
1324
1414
  <p>Get formatted array of cart promos applied to a specific cart</p>
1325
1415
 
1326
- **Kind**: global function
1416
+ **Kind**: global function
1327
1417
 
1328
- | Param |
1329
- | --- |
1330
- | cartData |
1418
+ | Param |
1419
+ | -------- |
1420
+ | cartData |
1331
1421
 
1332
1422
  <a name="_checkRuleApplicationArray"></a>
1333
1423
 
1334
1424
  ## \_checkRuleApplicationArray(checkedRulesApplicationArray) ⇒
1425
+
1335
1426
  <p>Checks if discount rule should be applied to cart based on each rule verification results.</p>
1336
1427
 
1337
1428
  **Kind**: global function
1338
- **Returns**: <p>A boolean</p>
1429
+ **Returns**: <p>A boolean</p>
1339
1430
 
1340
- | Param | Description |
1341
- | --- | --- |
1431
+ | Param | Description |
1432
+ | ---------------------------- | ------------------------------------------------------------------------------------------------------ |
1342
1433
  | checkedRulesApplicationArray | <p>Array where each position is a verified rule result (condition with passed of failed (boolean))</p> |
1343
1434
 
1344
1435
  <a name="checkIfCouldApplyIncentivePromo"></a>
1345
1436
 
1346
1437
  ## checkIfCouldApplyIncentivePromo(cartData, skipCheckFor) ⇒
1438
+
1347
1439
  <p>Checks if an incentive discount could (in theory) by added to provided cart, by checking found incentive discount's rule array.</p>
1348
1440
 
1349
1441
  **Kind**: global function
1350
- **Returns**: <p>a boolean</p>
1442
+ **Returns**: <p>a boolean</p>
1351
1443
 
1352
- | Param | Description |
1353
- | --- | --- |
1354
- | cartData | <p>The cart to check (checks discount_rules for incentive)</p> |
1355
- | skipCheckFor | <p>If certain rules should be ignore for check</p> |
1444
+ | Param | Description |
1445
+ | ------------ | -------------------------------------------------------------- |
1446
+ | cartData | <p>The cart to check (checks discount_rules for incentive)</p> |
1447
+ | skipCheckFor | <p>If certain rules should be ignore for check</p> |
1356
1448
 
1357
1449
  <a name="getOrderedPromises"></a>
1358
1450
 
1359
1451
  ## getOrderedPromises(promises)
1452
+
1360
1453
  <p>Get ordered array of promise data objects by starting date.</p>
1361
1454
 
1362
- **Kind**: global function
1455
+ **Kind**: global function
1363
1456
 
1364
- | Param |
1365
- | --- |
1366
- | promises |
1457
+ | Param |
1458
+ | -------- |
1459
+ | promises |
1367
1460
 
1368
1461
  <a name="getIndexServices"></a>
1369
1462
 
1370
1463
  ## getIndexServices(space, partialIndexID)
1464
+
1371
1465
  <p>Returns objet with possible index service instances
1372
1466
  As of now, checks for Algolia and Addio Search</p>
1373
1467
 
1374
- **Kind**: global function
1375
-
1376
- | Param | Description |
1377
- | --- | --- |
1378
- | space | <p>the spaceObj to check</p> |
1379
- | partialIndexID | <p>the partial index ID to consult for search, excluding the env. variable (prod_ or test_ will be added in function). ** Important to use index ID, not table ID!</p> |
1468
+ **Kind**: global function
1380
1469
 
1470
+ | Param | Description |
1471
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1472
+ | space | <p>the spaceObj to check</p> |
1473
+ | partialIndexID | <p>the partial index ID to consult for search, excluding the env. variable (prod* or test* will be added in function). \*\* Important to use index ID, not table ID!</p> |