addio-admin-sdk 1.7.122 → 1.7.124
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/.env +6 -5
- package/.github/workflows/{publish_coverage.yam_ → run_unit_test.yaml} +10 -31
- package/changelog.md +8 -12
- package/dist/Interfaces/TCG/index.d.ts +1 -0
- package/dist/Interfaces/TCG/index.js.map +1 -1
- package/dist/lib/Queue/index.d.ts +40 -0
- package/dist/lib/Queue/index.js +255 -0
- package/dist/lib/Queue/index.js.map +1 -0
- package/dist/rules/GR/constants/products.js +1 -0
- package/dist/rules/GR/constants/products.js.map +1 -1
- package/dist/rules/GR/utils/cart.d.ts +1 -1
- package/dist/rules/GR/utils/cart.js +5 -5
- package/dist/rules/GR/utils/cart.js.map +1 -1
- package/dist/rules/GR/utils/expedition.js +12 -10
- package/dist/rules/GR/utils/expedition.js.map +1 -1
- package/dist/rules/GR/utils/products.d.ts +7 -0
- package/dist/rules/GR/utils/products.js +14 -2
- package/dist/rules/GR/utils/products.js.map +1 -1
- package/dist/services/g2/utils.js +1 -1
- package/dist/services/g2/utils.js.map +1 -1
- package/dist/utils/algolia.d.ts +41 -1
- package/dist/utils/file.d.ts +1 -0
- package/package.json +4 -4
- package/.claude/settings.local.json +0 -7
package/.env
CHANGED
|
@@ -2,13 +2,14 @@ NEXT_PUBLIC_FIREBASE_CONFIG_API_KEY_DEV='AIzaSyBNtwzdIe2__HJD23S87RIbWbIqKQVtFiw
|
|
|
2
2
|
NEXT_PUBLIC_FIREBASE_CONFIG_API_KEY_PROD='AIzaSyDK6WQZkCrsMGunAPHn9KkdCGPky4hTgL4'
|
|
3
3
|
NEXT_PUBLIC_MESSAGING_SENDER_ID_DEV='188490998694'
|
|
4
4
|
NEXT_PUBLIC_MESSAGING_SENDER_ID_PROD='725873016982'
|
|
5
|
-
NEXT_PUBLIC_FIREBASE_APP_ID_DEV='1:188490998694:web:eecd719e7b18f38d272567'
|
|
6
5
|
NEXT_PUBLIC_FIREBASE_APP_ID_PROD='1:725873016982:web:9b1f6d77819909e19102b7'
|
|
6
|
+
NEXT_PUBLIC_FIREBASE_APP_ID_DEV='1:188490998694:web:eecd719e7b18f38d272567'
|
|
7
7
|
NEXT_PUBLIC_MEASUREMENT_ID_DEV='G-4BB66ZRTWZ'
|
|
8
8
|
NEXT_PUBLIC_MEASUREMENT_ID_PROD='G-BB8HHZ466R'
|
|
9
|
+
|
|
9
10
|
NEXT_PUBLIC_SERVICE_DATABASE_READ_PROVIDER=nobase
|
|
10
|
-
NEXT_PUBLIC_SERVICE_DATABASE_WRITE_PROVIDER=nobase
|
|
11
|
+
NEXT_PUBLIC_SERVICE_DATABASE_WRITE_PROVIDER=nobase
|
|
11
12
|
NEXT_PUBLIC_SERVICE_DATABASE_URL=https://db-test.addiocommerce.com/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
NEXT_PUBLIC_API_URL=https://api-test.addiocommerce.com/v1
|
|
14
|
+
NEXT_PUBLIC_SERVICE_DATABASE_TOKEN='337043a374-6f0be-5eb26-05be550631'
|
|
15
|
+
LOCAL_FIRESTORE=false
|
|
@@ -1,32 +1,18 @@
|
|
|
1
1
|
# A workflow for deploying the Unit Tests coverage report to GitHub Pages
|
|
2
|
-
name:
|
|
2
|
+
name: Run unit test
|
|
3
3
|
|
|
4
4
|
on:
|
|
5
|
-
# Runs on
|
|
6
|
-
|
|
5
|
+
# Runs on PR targeting the default branch
|
|
6
|
+
pull_request:
|
|
7
7
|
branches:
|
|
8
8
|
- master
|
|
9
9
|
|
|
10
|
-
# Allows you to run this workflow manually from the Actions tab
|
|
11
|
-
workflow_dispatch:
|
|
12
|
-
|
|
13
|
-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
14
10
|
permissions:
|
|
15
11
|
contents: read
|
|
16
|
-
pages: write
|
|
17
|
-
id-token: write
|
|
18
|
-
|
|
19
|
-
# Allow one concurrent deployment
|
|
20
|
-
concurrency:
|
|
21
|
-
group: 'pages'
|
|
22
|
-
cancel-in-progress: true
|
|
23
12
|
|
|
24
13
|
jobs:
|
|
25
14
|
# Single deploy job since we're just deploying
|
|
26
|
-
|
|
27
|
-
environment:
|
|
28
|
-
name: github-pages
|
|
29
|
-
url: ${{ steps.deployment.outputs.page_url }}
|
|
15
|
+
run_tests:
|
|
30
16
|
runs-on: ubuntu-latest
|
|
31
17
|
env:
|
|
32
18
|
FIREBASE_CONFIG_API_KEY_DEV: ${{ secrets.FIREBASE_CONFIG_API_KEY_DEV }}
|
|
@@ -38,8 +24,11 @@ jobs:
|
|
|
38
24
|
MEASUREMENT_ID_DEV: ${{secrets.MEASUREMENT_ID_DEV}}
|
|
39
25
|
MEASUREMENT_ID_PROD: ${{secrets.MEASUREMENT_ID_PROD}}
|
|
40
26
|
SERVICE_DATABASE_TOKEN: ${{secrets.SERVICE_DATABASE_TOKEN}}
|
|
27
|
+
strategy:
|
|
28
|
+
matrix:
|
|
29
|
+
node-version: [20.x]
|
|
41
30
|
steps:
|
|
42
|
-
- name: Checkout, yarn, run tests
|
|
31
|
+
- name: Checkout, yarn, run tests
|
|
43
32
|
uses: actions/checkout@v3
|
|
44
33
|
- run: |
|
|
45
34
|
yarn
|
|
@@ -52,18 +41,8 @@ jobs:
|
|
|
52
41
|
echo "NEXT_PUBLIC_MEASUREMENT_ID_DEV=$MEASUREMENT_ID_DEV" >> .env
|
|
53
42
|
echo "NEXT_PUBLIC_MEASUREMENT_ID_PROD=$MEASUREMENT_ID_PROD" >> .env
|
|
54
43
|
echo "NEXT_PUBLIC_SERVICE_DATABASE_READ_PROVIDER=nobase" >> .env
|
|
55
|
-
echo "NEXT_PUBLIC_SERVICE_DATABASE_WRITE_PROVIDER=nobase
|
|
44
|
+
echo "NEXT_PUBLIC_SERVICE_DATABASE_WRITE_PROVIDER=nobase" >> .env
|
|
56
45
|
echo "NEXT_PUBLIC_SERVICE_DATABASE_URL=https://db-test.addiocommerce.com/" >> .env
|
|
57
46
|
echo "NEXT_PUBLIC_SERVICE_DATABASE_TOKEN=$SERVICE_DATABASE_TOKEN" >> .env
|
|
58
47
|
echo "NEXT_PUBLIC_API_URL=https://api-test.addiocommerce.com/v1" >> .env
|
|
59
|
-
yarn test
|
|
60
|
-
- name: Setup Pages
|
|
61
|
-
uses: actions/configure-pages@v2
|
|
62
|
-
- name: Upload artifact
|
|
63
|
-
uses: actions/upload-pages-artifact@v1
|
|
64
|
-
with:
|
|
65
|
-
# Upload the coverage directory from the repository
|
|
66
|
-
path: './coverage'
|
|
67
|
-
- name: Deploy to GitHub Pages
|
|
68
|
-
id: deployment
|
|
69
|
-
uses: actions/deploy-pages@v1
|
|
48
|
+
yarn test
|
package/changelog.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
### 155 - 2 sku gazon (pickup et livraison)
|
|
4
4
|
|
|
5
|
+
- **Added**
|
|
6
|
+
- New function utils `checkIfIsNonSpecialityGrass`
|
|
7
|
+
- **Changed**
|
|
8
|
+
- Updated all places where `kentucky` or `prestige` sku was compared to hardcoded variable. Now also checks product_slug
|
|
9
|
+
- **Fixed**
|
|
10
|
+
|
|
11
|
+
### 155 - 2 sku gazon (pickup et livraison)
|
|
12
|
+
|
|
5
13
|
- **Added**
|
|
6
14
|
- **Changed**
|
|
7
15
|
- Updated `InventoryStock` component, so that we can always mark a product as infinite stock even if it has multiple variants.
|
|
@@ -407,7 +415,6 @@
|
|
|
407
415
|
|
|
408
416
|
- **Added**
|
|
409
417
|
- **Changed**
|
|
410
|
-
|
|
411
418
|
- #1 : Adjusted isDegel constant to check if date is before May 1st 2023 instead of may 19
|
|
412
419
|
|
|
413
420
|
- **Fixed**
|
|
@@ -419,7 +426,6 @@
|
|
|
419
426
|
- **Addeed**
|
|
420
427
|
|
|
421
428
|
- **Changed**
|
|
422
|
-
|
|
423
429
|
- #1 : Ajusted logic in check for **FRSBETON** in `applyFeesToCart` so percentage is taken from regular_price of decli in product. [expedition.ts](https://github.com/ciaoqc/gng-tb-admin-sdk/pull/247/files#diff-556ea399f45c634dee0f5906657743ead25fbdd3da46df6303f655e5c6f7b748R1515)
|
|
424
430
|
- #2 : Still for **FRSBETON**, when calculating fee price before adding to cart, percent of fee at time when applyFeesToCart is called is stored in props regular_price.price_type as a string. Will be used to show correct percent applied in OrderGR. [expedition.ts](https://github.com/ciaoqc/gng-tb-admin-sdk/pull/247/files#diff-556ea399f45c634dee0f5906657743ead25fbdd3da46df6303f655e5c6f7b748R1544)
|
|
425
431
|
|
|
@@ -432,7 +438,6 @@
|
|
|
432
438
|
- **Addeed**
|
|
433
439
|
|
|
434
440
|
- **Changed**
|
|
435
|
-
|
|
436
441
|
- #1 : Ajusted logic in check for degel fee in `applyFeesToCart` to exclude when **cartContainsVrac** is true. [expedition.ts](https://github.com/ciaoqc/gng-tb-admin-sdk/pull/238/files#diff-556ea399f45c634dee0f5906657743ead25fbdd3da46df6303f655e5c6f7b748R1748)
|
|
437
442
|
|
|
438
443
|
- **Fixed**
|
|
@@ -444,7 +449,6 @@
|
|
|
444
449
|
- **Addeed**
|
|
445
450
|
|
|
446
451
|
- **Changed**
|
|
447
|
-
|
|
448
452
|
- #1 : Ajusted logic in check for degel fee in `applyFeesToCart` to exclude when **cartContainsSample** is true. [expedition.ts](https://github.com/ciaoqc/gng-tb-admin-sdk/pull/225/files#diff-556ea399f45c634dee0f5906657743ead25fbdd3da46df6303f655e5c6f7b748R1746)
|
|
449
453
|
|
|
450
454
|
- **Fixed**
|
|
@@ -464,12 +468,10 @@
|
|
|
464
468
|
#### GR business rules
|
|
465
469
|
|
|
466
470
|
- **Added**
|
|
467
|
-
|
|
468
471
|
- #1 : Create new utils functions that check if _surcharge-jour-meme-gazon_ fee should be checked and applied : `checkForSameGrassDayFee` + `checkIfShouldApplySameDayGrassFee`. [expedition.ts](https://github.com/ciaoqc/gng-tb-admin-sdk/pull/190/files#diff-556ea399f45c634dee0f5906657743ead25fbdd3da46df6303f655e5c6f7b748R770)
|
|
469
472
|
- #2 : Added unit tests to test new functions [expeditions.tests.ts](https://github.com/ciaoqc/gng-tb-admin-sdk/pull/190/files#diff-556ea399f45c634dee0f5906657743ead25fbdd3da46df6303f655e5c6f7b748R770)
|
|
470
473
|
|
|
471
474
|
- **Changed**
|
|
472
|
-
|
|
473
475
|
- #1 : Ajusted logic in `applyFeesToCart` in section about _surcharge-jour-meme-gazon_ fee to follow logic [expedition.ts](https://github.com/ciaoqc/gng-tb-admin-sdk/pull/190/files#diff-556ea399f45c634dee0f5906657743ead25fbdd3da46df6303f655e5c6f7b748R1130-R1146) :
|
|
474
476
|
- If cart is created via web (not POS), applies only to Pro customers
|
|
475
477
|
- Applies if chosen date is before min date calculated for expedition type
|
|
@@ -483,7 +485,6 @@
|
|
|
483
485
|
#### GR business rules
|
|
484
486
|
|
|
485
487
|
- **Added**
|
|
486
|
-
|
|
487
488
|
- #1 : Added constant `includedFreeShippingBrands` in Sample section. [data.ts](https://github.com/ciaoqc/gng-tb-admin-sdk/pull/189/files#diff-0312e13e35307cdf18ba75199c0e90ae222c61c14ed3ee9479b9da985b491196R60)
|
|
488
489
|
- #2 : Ajusted logic in `checkIfShouldRemoveSampleShippingFee` to check included brand array instead of only Oaks brand + Added Bolduc brand to included brands. [expedition.ts](https://github.com/ciaoqc/gng-tb-admin-sdk/pull/189/files#diff-556ea399f45c634dee0f5906657743ead25fbdd3da46df6303f655e5c6f7b748R1763)
|
|
489
490
|
|
|
@@ -498,11 +499,9 @@
|
|
|
498
499
|
- **Added**
|
|
499
500
|
|
|
500
501
|
- **Changed**
|
|
501
|
-
|
|
502
502
|
- #1 : Changed sku for grass shipping (lowest tier) in `applyFeesToCart`. [expedition.ts]
|
|
503
503
|
|
|
504
504
|
- **Fixed**
|
|
505
|
-
|
|
506
505
|
- #1 : Ajusted logic in `handleAddGrassItemsCart`. If new install product is needed (because of a grass qty change), adds all associated items (min-facturable, frais mobilisation, etc.) so props is_upsell_of_sku is updated with correct sku + removes all subItems of previous installation item. [cart.ts]
|
|
507
506
|
|
|
508
507
|
## [ 23-02-2023 ]
|
|
@@ -510,11 +509,9 @@
|
|
|
510
509
|
#### GR business rules
|
|
511
510
|
|
|
512
511
|
- **Added**
|
|
513
|
-
|
|
514
512
|
- #1 : Added new function `handleGrassProductQtyRoundForShipping` that finds all items found in cart that should use new rounded grass Qte and returns rounded value + array of items to update [products.ts](https://github.com/ciaoqc/gng-tb-admin-sdk/commit/ea44ba2c22f035e9fddb81d2d1b883a1533f52c6#diff-c393ee846c0511ea4b925dca7545cbe475bdbcb91d44387fa2602b4c7a4dbd38R675)
|
|
515
513
|
|
|
516
514
|
- **Changed**
|
|
517
|
-
|
|
518
515
|
- #1 : Added logic for new grass delivery zone (`zone-ile-orleans`) in function `applyFeesToCart` [expedition.ts](https://github.com/ciaoqc/gng-tb-admin-sdk/commit/ea44ba2c22f035e9fddb81d2d1b883a1533f52c6#diff-556ea399f45c634dee0f5906657743ead25fbdd3da46df6303f655e5c6f7b748R1620)
|
|
519
516
|
- #2 : Ajusted logic in `checkIfShouldRemoveSampleShippingFee` function. Now Tena products are identified with the FAMILY attribute and are not included in free shipping [expedition.ts](https://github.com/ciaoqc/gng-tb-admin-sdk/commit/ea44ba2c22f035e9fddb81d2d1b883a1533f52c6#diff-556ea399f45c634dee0f5906657743ead25fbdd3da46df6303f655e5c6f7b748R1726)
|
|
520
517
|
- #3 : Prestige is now a non-speciality grass. Multiple checks in code were ajusted in consequence :
|
|
@@ -529,7 +526,6 @@
|
|
|
529
526
|
## [ 15-12-2022 ]
|
|
530
527
|
|
|
531
528
|
- **Added**
|
|
532
|
-
|
|
533
529
|
- #1 : New utils function `checkIfNoDeliveryDateIsNormal` [expedition.ts](https://github.com/ciaoqc/gr-business-rules/commit/638b48a2ad0555f59ff32133802e3912efdae7a8#diff-dc096a2d0f80e37b71a9d25d7640f5aac74ecb752889f8b9f990a2879e88890fR2008)
|
|
534
530
|
|
|
535
531
|
- **Changed**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Interfaces/TCG/index.ts"],"names":[],"mappings":";;;AA8FA,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAChC,0CAAiB,CAAA;IACjB,0CAAiB,CAAA;IACjB,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;AACtB,CAAC,EALW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAKhC;AAED,IAAY,iBAYX;AAZD,WAAY,iBAAiB;IAC5B,sCAAiB,CAAA;IACjB,kCAAa,CAAA;IACb,kCAAa,CAAA;IACb,0CAAqB,CAAA;IACrB,2CAAsB,CAAA;IACtB,0DAAqC,CAAA;IACrC,sCAAiB,CAAA;IACjB,4CAAuB,CAAA;IACvB,8DAAyC,CAAA;IACzC,kDAA6B,CAAA;IAC7B,oEAA+C,CAAA;AAChD,CAAC,EAZW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAY5B;AAED,IAAY,iBAMX;AAND,WAAY,iBAAiB;IAC5B,0CAAqB,CAAA;IACrB,gDAA2B,CAAA;IAC3B,0CAAqB,CAAA;IACrB,oCAAe,CAAA;IACf,8CAAyB,CAAA;AAC1B,CAAC,EANW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAM5B;AAED;;;GAGG;AACH,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IACrC,mDAAqB,CAAA;IACrB,yDAA2B,CAAA;IAC3B,mDAAqB,CAAA;AACtB,CAAC,EAJW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAIrC;AAEY,QAAA,6BAA6B,GAAsD;IAC/F,CAAC,0BAA0B,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC,MAAM;IAC7D,CAAC,0BAA0B,CAAC,SAAS,CAAC,EAAE,EAAE;IAC1C,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,EAAE;CACrC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src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mB,CAAA;AACpB,CAAC,EAJW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAI9B;AACD,aAAa"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Space from '../Space';
|
|
2
|
+
export default class Queue {
|
|
3
|
+
private _space;
|
|
4
|
+
constructor(space: Space);
|
|
5
|
+
last: () => Promise<QueueItem>;
|
|
6
|
+
first: () => Promise<QueueItem>;
|
|
7
|
+
lastX: (numberOfReturnedItems: number) => Promise<QueueItem[]>;
|
|
8
|
+
firstX: (numberOfReturnedItems: number) => Promise<QueueItem[]>;
|
|
9
|
+
}
|
|
10
|
+
export declare enum QueueItemTypeEnum {
|
|
11
|
+
PRODUCT_CREATE = 0,
|
|
12
|
+
PRODUCT_UPDATE = 1,
|
|
13
|
+
PRODUCT_DELETE = 2,
|
|
14
|
+
INVENTORY_UPDATE = 3,
|
|
15
|
+
CLIENT_CREATE = 4,
|
|
16
|
+
CLIENT_UPDATE = 5,
|
|
17
|
+
CLIENT_DELETE = 6
|
|
18
|
+
}
|
|
19
|
+
export declare enum QueueExternalService {
|
|
20
|
+
QUICKBOOKS = 0,
|
|
21
|
+
SAGE = 1,
|
|
22
|
+
ACOMBA = 2
|
|
23
|
+
}
|
|
24
|
+
export declare enum QueueDirection {
|
|
25
|
+
FROM_OUTTER = 0,
|
|
26
|
+
TO_OUTTER = 1
|
|
27
|
+
}
|
|
28
|
+
export declare class QueueItem {
|
|
29
|
+
private _space;
|
|
30
|
+
private _type;
|
|
31
|
+
private _added_at;
|
|
32
|
+
private _id;
|
|
33
|
+
private _service;
|
|
34
|
+
private _direction;
|
|
35
|
+
private _details?;
|
|
36
|
+
private _progress;
|
|
37
|
+
constructor(space: Space, type: QueueItemTypeEnum, added_at: Date, id: string, service: QueueExternalService, direction: QueueDirection, rest: any);
|
|
38
|
+
private _triggerExec;
|
|
39
|
+
private _getOperation;
|
|
40
|
+
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
39
|
+
var t = {};
|
|
40
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
41
|
+
t[p] = s[p];
|
|
42
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
43
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
44
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
45
|
+
t[p[i]] = s[p[i]];
|
|
46
|
+
}
|
|
47
|
+
return t;
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.QueueItem = exports.QueueDirection = exports.QueueExternalService = exports.QueueItemTypeEnum = void 0;
|
|
54
|
+
var DatabaseService_1 = __importDefault(require("../../services/database/DatabaseService"));
|
|
55
|
+
var console_1 = require("../../utils/console");
|
|
56
|
+
var Product_1 = __importDefault(require("../Product"));
|
|
57
|
+
var Queue = (function () {
|
|
58
|
+
function Queue(space) {
|
|
59
|
+
var _this = this;
|
|
60
|
+
this.last = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
61
|
+
var lastReq, _a, type, added_at, id, service, direction, rest;
|
|
62
|
+
return __generator(this, function (_b) {
|
|
63
|
+
switch (_b.label) {
|
|
64
|
+
case 0:
|
|
65
|
+
if (!!!this._space)
|
|
66
|
+
throw new Error("Space must be defined");
|
|
67
|
+
return [4, DatabaseService_1.default.getDocuments(this._space.documents.queue(), {
|
|
68
|
+
orderBy: 'added_at',
|
|
69
|
+
order: 'desc',
|
|
70
|
+
limit: 1
|
|
71
|
+
})];
|
|
72
|
+
case 1:
|
|
73
|
+
lastReq = _b.sent();
|
|
74
|
+
if (lastReq.length == 0)
|
|
75
|
+
throw new Error("Can't access last, may be empty");
|
|
76
|
+
if (lastReq[0].exists || !!!lastReq[0].data)
|
|
77
|
+
throw new Error("Can't access last, may be empty");
|
|
78
|
+
_a = lastReq[0].data, type = _a.type, added_at = _a.added_at, id = _a.id, service = _a.service, direction = _a.direction, rest = __rest(_a, ["type", "added_at", "id", "service", "direction"]);
|
|
79
|
+
return [2, new QueueItem(this._space, type, added_at, id, service, direction, rest)];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}); };
|
|
83
|
+
this.first = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
84
|
+
var firstReq, _a, type, added_at, id, service, direction, rest;
|
|
85
|
+
return __generator(this, function (_b) {
|
|
86
|
+
switch (_b.label) {
|
|
87
|
+
case 0:
|
|
88
|
+
if (!!!this._space)
|
|
89
|
+
throw new Error("Space must be defined");
|
|
90
|
+
return [4, DatabaseService_1.default.getDocuments(this._space.documents.queue(), {
|
|
91
|
+
orderBy: 'added_at',
|
|
92
|
+
order: 'asc',
|
|
93
|
+
limit: 1
|
|
94
|
+
})];
|
|
95
|
+
case 1:
|
|
96
|
+
firstReq = _b.sent();
|
|
97
|
+
if (firstReq.length == 0)
|
|
98
|
+
throw new Error("Can't access first, may be empty");
|
|
99
|
+
if (firstReq[0].exists || !!!firstReq[0].data)
|
|
100
|
+
throw new Error("Can't access last, may be empty");
|
|
101
|
+
_a = firstReq[0].data, type = _a.type, added_at = _a.added_at, id = _a.id, service = _a.service, direction = _a.direction, rest = __rest(_a, ["type", "added_at", "id", "service", "direction"]);
|
|
102
|
+
return [2, new QueueItem(this._space, type, added_at, id, service, direction, rest)];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}); };
|
|
106
|
+
this.lastX = function (numberOfReturnedItems) { return __awaiter(_this, void 0, void 0, function () {
|
|
107
|
+
var lastReq;
|
|
108
|
+
var _this = this;
|
|
109
|
+
return __generator(this, function (_a) {
|
|
110
|
+
switch (_a.label) {
|
|
111
|
+
case 0:
|
|
112
|
+
if (!!!this._space)
|
|
113
|
+
throw new Error("Space must be defined");
|
|
114
|
+
return [4, DatabaseService_1.default.getDocuments(this._space.documents.queue(), {
|
|
115
|
+
orderBy: 'added_at',
|
|
116
|
+
order: 'desc',
|
|
117
|
+
limit: numberOfReturnedItems
|
|
118
|
+
})];
|
|
119
|
+
case 1:
|
|
120
|
+
lastReq = _a.sent();
|
|
121
|
+
if (lastReq.length == 0)
|
|
122
|
+
throw new Error("Can't access last, may be empty");
|
|
123
|
+
if (lastReq[0].exists || !!!lastReq[0].data)
|
|
124
|
+
throw new Error("Can't access last, may be empty");
|
|
125
|
+
return [2, lastReq.map(function (d) {
|
|
126
|
+
var _a = d.data, type = _a.type, added_at = _a.added_at, id = _a.id, service = _a.service, direction = _a.direction, rest = __rest(_a, ["type", "added_at", "id", "service", "direction"]);
|
|
127
|
+
return new QueueItem(_this._space, type, added_at, id, service, direction, rest);
|
|
128
|
+
})];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}); };
|
|
132
|
+
this.firstX = function (numberOfReturnedItems) { return __awaiter(_this, void 0, void 0, function () {
|
|
133
|
+
var firstReq;
|
|
134
|
+
var _this = this;
|
|
135
|
+
return __generator(this, function (_a) {
|
|
136
|
+
switch (_a.label) {
|
|
137
|
+
case 0:
|
|
138
|
+
if (!!!this._space)
|
|
139
|
+
throw new Error("Space must be defined");
|
|
140
|
+
return [4, DatabaseService_1.default.getDocuments(this._space.documents.queue(), {
|
|
141
|
+
orderBy: 'added_at',
|
|
142
|
+
order: 'asc',
|
|
143
|
+
limit: numberOfReturnedItems
|
|
144
|
+
})];
|
|
145
|
+
case 1:
|
|
146
|
+
firstReq = _a.sent();
|
|
147
|
+
if (firstReq.length == 0)
|
|
148
|
+
throw new Error("Can't access first, may be empty");
|
|
149
|
+
if (firstReq[0].exists || !!!firstReq[0].data)
|
|
150
|
+
throw new Error("Can't access last, may be empty");
|
|
151
|
+
return [2, firstReq.map(function (d) {
|
|
152
|
+
var _a = d.data, type = _a.type, added_at = _a.added_at, id = _a.id, service = _a.service, direction = _a.direction, rest = __rest(_a, ["type", "added_at", "id", "service", "direction"]);
|
|
153
|
+
return new QueueItem(_this._space, type, added_at, id, service, direction, rest);
|
|
154
|
+
})];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}); };
|
|
158
|
+
this._space = space;
|
|
159
|
+
}
|
|
160
|
+
return Queue;
|
|
161
|
+
}());
|
|
162
|
+
exports.default = Queue;
|
|
163
|
+
var QueueItemTypeEnum;
|
|
164
|
+
(function (QueueItemTypeEnum) {
|
|
165
|
+
QueueItemTypeEnum[QueueItemTypeEnum["PRODUCT_CREATE"] = 0] = "PRODUCT_CREATE";
|
|
166
|
+
QueueItemTypeEnum[QueueItemTypeEnum["PRODUCT_UPDATE"] = 1] = "PRODUCT_UPDATE";
|
|
167
|
+
QueueItemTypeEnum[QueueItemTypeEnum["PRODUCT_DELETE"] = 2] = "PRODUCT_DELETE";
|
|
168
|
+
QueueItemTypeEnum[QueueItemTypeEnum["INVENTORY_UPDATE"] = 3] = "INVENTORY_UPDATE";
|
|
169
|
+
QueueItemTypeEnum[QueueItemTypeEnum["CLIENT_CREATE"] = 4] = "CLIENT_CREATE";
|
|
170
|
+
QueueItemTypeEnum[QueueItemTypeEnum["CLIENT_UPDATE"] = 5] = "CLIENT_UPDATE";
|
|
171
|
+
QueueItemTypeEnum[QueueItemTypeEnum["CLIENT_DELETE"] = 6] = "CLIENT_DELETE";
|
|
172
|
+
})(QueueItemTypeEnum = exports.QueueItemTypeEnum || (exports.QueueItemTypeEnum = {}));
|
|
173
|
+
var QueueExternalService;
|
|
174
|
+
(function (QueueExternalService) {
|
|
175
|
+
QueueExternalService[QueueExternalService["QUICKBOOKS"] = 0] = "QUICKBOOKS";
|
|
176
|
+
QueueExternalService[QueueExternalService["SAGE"] = 1] = "SAGE";
|
|
177
|
+
QueueExternalService[QueueExternalService["ACOMBA"] = 2] = "ACOMBA";
|
|
178
|
+
})(QueueExternalService = exports.QueueExternalService || (exports.QueueExternalService = {}));
|
|
179
|
+
var QueueDirection;
|
|
180
|
+
(function (QueueDirection) {
|
|
181
|
+
QueueDirection[QueueDirection["FROM_OUTTER"] = 0] = "FROM_OUTTER";
|
|
182
|
+
QueueDirection[QueueDirection["TO_OUTTER"] = 1] = "TO_OUTTER";
|
|
183
|
+
})(QueueDirection = exports.QueueDirection || (exports.QueueDirection = {}));
|
|
184
|
+
var QueueItem = (function () {
|
|
185
|
+
function QueueItem(space, type, added_at, id, service, direction, rest) {
|
|
186
|
+
var _this = this;
|
|
187
|
+
this._triggerExec = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
188
|
+
var operation, _a, _b, _c, _d, error_1;
|
|
189
|
+
return __generator(this, function (_e) {
|
|
190
|
+
switch (_e.label) {
|
|
191
|
+
case 0:
|
|
192
|
+
_e.trys.push([0, 5, , 6]);
|
|
193
|
+
operation = this._getOperation(this._type);
|
|
194
|
+
if (!!!!this._details) return [3, 2];
|
|
195
|
+
_a = this;
|
|
196
|
+
_b = _a._progress;
|
|
197
|
+
return [4, operation()];
|
|
198
|
+
case 1:
|
|
199
|
+
_a._progress = _b + _e.sent();
|
|
200
|
+
return [3, 4];
|
|
201
|
+
case 2:
|
|
202
|
+
_c = this;
|
|
203
|
+
_d = _c._progress;
|
|
204
|
+
return [4, operation(this._details)];
|
|
205
|
+
case 3:
|
|
206
|
+
_c._progress = _d + _e.sent();
|
|
207
|
+
_e.label = 4;
|
|
208
|
+
case 4: return [3, 6];
|
|
209
|
+
case 5:
|
|
210
|
+
error_1 = _e.sent();
|
|
211
|
+
(0, console_1.errorMessage)("Error while processing queue ".concat(error_1, " - ").concat(JSON.stringify(error_1)));
|
|
212
|
+
return [3, 6];
|
|
213
|
+
case 6: return [2];
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}); };
|
|
217
|
+
this._getOperation = function (type) { return __awaiter(_this, void 0, void 0, function () {
|
|
218
|
+
var _this = this;
|
|
219
|
+
return __generator(this, function (_a) {
|
|
220
|
+
switch (type) {
|
|
221
|
+
case QueueItemTypeEnum.CLIENT_CREATE:
|
|
222
|
+
case QueueItemTypeEnum.CLIENT_DELETE:
|
|
223
|
+
case QueueItemTypeEnum.CLIENT_UPDATE:
|
|
224
|
+
case QueueItemTypeEnum.PRODUCT_CREATE:
|
|
225
|
+
return [2, this._space.addProduct];
|
|
226
|
+
case QueueItemTypeEnum.PRODUCT_DELETE:
|
|
227
|
+
return [2, function () {
|
|
228
|
+
return new Product_1.default(_this._details, DatabaseService_1.default.asCollectionObject(_this._space.getRef().path, _this._space.getRef().id + '/products'), "External service ".concat(_this._service.toString())).delete;
|
|
229
|
+
}];
|
|
230
|
+
case QueueItemTypeEnum.PRODUCT_UPDATE:
|
|
231
|
+
return [2, function () {
|
|
232
|
+
return new Product_1.default({ id: _this._details.id }, DatabaseService_1.default.asCollectionObject(_this._space.getRef().path, _this._space.getRef().id + '/products'), "External service ".concat(_this._service.toString())).save;
|
|
233
|
+
}];
|
|
234
|
+
case QueueItemTypeEnum.INVENTORY_UPDATE:
|
|
235
|
+
default:
|
|
236
|
+
return [2, function () { }];
|
|
237
|
+
}
|
|
238
|
+
return [2];
|
|
239
|
+
});
|
|
240
|
+
}); };
|
|
241
|
+
this._space = space;
|
|
242
|
+
this._type = type;
|
|
243
|
+
this._added_at = added_at;
|
|
244
|
+
this._id = id;
|
|
245
|
+
this._service = service;
|
|
246
|
+
this._direction = direction;
|
|
247
|
+
this._details = rest;
|
|
248
|
+
this._progress = '';
|
|
249
|
+
if (direction === QueueDirection.FROM_OUTTER)
|
|
250
|
+
this._triggerExec();
|
|
251
|
+
}
|
|
252
|
+
return QueueItem;
|
|
253
|
+
}());
|
|
254
|
+
exports.QueueItem = QueueItem;
|
|
255
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/Queue/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4FAAqE;AACrE,+CAAkD;AAClD,uDAAgC;AAGhC;IAGC,eAAmB,KAAY;QAA/B,iBAEC;QAEM,SAAI,GAAG;;;;;wBACb,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM;4BAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;wBAE5C,WAAM,yBAAe,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE;gCACjF,OAAO,EAAE,UAAU;gCACnB,KAAK,EAAE,MAAM;gCACb,KAAK,EAAE,CAAC;6BACR,CAAC,EAAA;;wBAJI,OAAO,GAAG,SAId;wBAEF,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC;4BAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;wBAC3E,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;4BAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;wBAEzF,KAAsD,OAAO,CAAC,CAAC,CAAC,CAAC,IAAW,EAA1E,IAAI,UAAA,EAAE,QAA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|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.otherGrassSubQuestions = exports.installationProductsSlugs = exports.sodDeliverySkus = exports.allInclusiveCategory = exports.installationAllInclusiveSku = exports.installationProSpecSkus = exports.prestige = exports.kentucky = void 0;
|
|
4
|
+
// NOTE - Now grasses can have a different sku if pickup or shipping! Where kentucky and prestige constants used, logic ajusted to also check product slug for now
|
|
4
5
|
exports.kentucky = !!process.env.IS_TEST_ENV ? '010010000' : '010010000-1';
|
|
5
6
|
exports.prestige = !!process.env.IS_TEST_ENV ? '010090000' : '010090000-1';
|
|
6
7
|
exports.installationProSpecSkus = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../../../src/rules/GR/constants/products.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../../../src/rules/GR/constants/products.ts"],"names":[],"mappings":";;;AAEA,kKAAkK;AACrJ,QAAA,QAAQ,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAA;AAClE,QAAA,QAAQ,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa,CAAA;AAElE,QAAA,uBAAuB,GAA8B;IACjE,QAAQ,EAAE,WAAW;IACrB,cAAc,EAAE,WAAW;IAC3B,YAAY,EAAE,WAAW;IACzB,MAAM,EAAE,WAAW;IACnB,sBAAsB,EAAE,WAAW;CACnC,CAAA;AAED,qCAAqC;AACxB,QAAA,2BAA2B,GAAG,WAAW,CAAA;AAEtD,uEAAuE;AAC1D,QAAA,oBAAoB,GAAG,QAAQ,CAAA;AAE5C,4CAA4C;AAC/B,QAAA,eAAe,GAAsB,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAAA;AAE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DAAgD;KACjE;CACD,CAAA"}
|
|
@@ -92,4 +92,4 @@ export declare const getClientNumberForCart: (cartData: ICart | undefined, space
|
|
|
92
92
|
isQuote?: boolean;
|
|
93
93
|
checkIfEscPaApplied?: boolean;
|
|
94
94
|
}) => string;
|
|
95
|
-
export declare const getLabelForCartType: (value: CartGeneralTypeEnum | CartContentTypeEnum) =>
|
|
95
|
+
export declare const getLabelForCartType: (value: CartGeneralTypeEnum | CartContentTypeEnum) => CartGeneralTypeEnum.BOOKING | CartGeneralTypeEnum.BOOKING_BETON | "Installation" | "Retour palettes" | "Accessoires seulement" | "Béton" | "Échantillons" | "Gazon" | "Vrac" | "Mixte";
|
|
@@ -60,7 +60,7 @@ const handleAddGrassItemsCart = async (cart, chosenDeclination, parentProduct, i
|
|
|
60
60
|
}
|
|
61
61
|
if (!!isPro && !!customPriceList) {
|
|
62
62
|
chosenDeclination = (0, g2_1.checkForCustomPriceEquivalent)(chosenDeclination, customPriceList, {
|
|
63
|
-
removeTierPricing: chosenDeclination.sku
|
|
63
|
+
removeTierPricing: chosenDeclination.sku == products_2.kentucky || chosenDeclination.parent_slug === 'kentucky'
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
// --------------------------------------------------------------------------------
|
|
@@ -78,7 +78,7 @@ const handleAddGrassItemsCart = async (cart, chosenDeclination, parentProduct, i
|
|
|
78
78
|
let baseGrass = parentProduct;
|
|
79
79
|
// --------------------------------------------------------------------------------
|
|
80
80
|
// If gazon de spécialité, il aura en upsell le gazon de base (Kentucky)...
|
|
81
|
-
// (parent_slug: kentucky, sku (declinaison): 010010000)
|
|
81
|
+
// (parent_slug: kentucky, sku (declinaison): 010010000) // NOTE - Sku peut varier!!
|
|
82
82
|
if (!!prodUpsell && !!prodUpsell.find((anUpsell) => anUpsell.recommendation_sku === products_2.kentucky)) {
|
|
83
83
|
const baseGrassProd = kentuckyBaseGrass;
|
|
84
84
|
if (!!baseGrassProd)
|
|
@@ -98,7 +98,7 @@ const handleAddGrassItemsCart = async (cart, chosenDeclination, parentProduct, i
|
|
|
98
98
|
continue;
|
|
99
99
|
if (!!isPro && !!customPriceList) {
|
|
100
100
|
sameDecli = (0, g2_1.checkForCustomPriceEquivalent)(sameDecli, customPriceList, {
|
|
101
|
-
removeTierPricing: sameDecli.sku ===
|
|
101
|
+
removeTierPricing: sameDecli.sku == 'kentucky' || sameDecli.parent_slug === 'kentucky'
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
const anUpsellProduct = Object.assign(Object.assign(Object.assign(Object.assign({}, sameDecli), { parent_slug: anUpsell.recommendation_parent_slug, recommended_qte: anUpsell.recommendation_qty, recommended_sku: anUpsell.recommendation_sku, matching_qte: !!anUpsell.matching_qty, auto_add: anUpsell.auto_add, actual_qte: anUpsell.actual_qty }), (!!anUpsell.is_recommendation ? { is_recommendation: true } : {})), (!!anUpsell.show_recommendation_msg ? { show_recommendation_msg: true } : {}));
|
|
@@ -229,7 +229,7 @@ const handleAddGrassItemsCart = async (cart, chosenDeclination, parentProduct, i
|
|
|
229
229
|
itemsToDelete = [...itemsToDelete, ...(0, products_1.getAllInstallFromItems)(cart.items).map((i) => i.sku)];
|
|
230
230
|
// Restore price of kentucky when overriden by all-inclusive installation
|
|
231
231
|
if (!!isPro && !!(0, products_1.getInstallationAllInclusiveFromPriceList)(customPriceList)) {
|
|
232
|
-
const kentuckyIdx = cart.items.findIndex((i) => !!i.price_override && i.sku === products_2.kentucky);
|
|
232
|
+
const kentuckyIdx = cart.items.findIndex((i) => !!i.price_override && (i.sku === products_2.kentucky || i.parent_slug == 'kentucky'));
|
|
233
233
|
if (kentuckyIdx !== -1) {
|
|
234
234
|
const kentuckyItem = cart.items[kentuckyIdx];
|
|
235
235
|
itemsToUpdate = itemsToUpdate.filter((u) => u.sku !== kentuckyItem.sku);
|
|
@@ -735,7 +735,7 @@ const getClientNumberForCart = (cartData, space, options = {}) => {
|
|
|
735
735
|
const atLeastOneEscPaApplied = cartData.items.some((i) => (0, g2_1.isEscompteSuppItem)(i.sku)) ||
|
|
736
736
|
(!!grassBank &&
|
|
737
737
|
(paFoundInCart.banks_used || []).some((b) => b.bank_type_id == grassBank.id) &&
|
|
738
|
-
cartData.items.some((i) => i.sku == products_2.kentucky));
|
|
738
|
+
cartData.items.some((i) => i.sku == products_2.kentucky || i.parent_slug == 'kentucky'));
|
|
739
739
|
isPA = atLeastOneEscPaApplied;
|
|
740
740
|
}
|
|
741
741
|
// a. If pro customer, return pro ID + PA if promise banks applied
|