@artisan-commerce/builders 0.7.0-canary.72 → 0.7.0-canary.73
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/dist/bundle.cjs +261 -117
- package/dist/bundle.cjs.map +1 -1
- package/dist/bundle.d.ts +58 -32
- package/dist/bundle.mjs +261 -117
- package/dist/bundle.mjs.map +1 -1
- package/dist/bundle.umd.js +261 -117
- package/dist/bundle.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/bundle.cjs
CHANGED
|
@@ -1300,109 +1300,245 @@ var __spreadValues$9 = (a, b) => {
|
|
|
1300
1300
|
return a;
|
|
1301
1301
|
};
|
|
1302
1302
|
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1303
|
-
const
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1303
|
+
const buildMasivoCustomer = (overrides) => {
|
|
1304
|
+
return __spreadValues$9({
|
|
1305
|
+
name: genWord(),
|
|
1306
|
+
tier_id: "eac25bef-c6de-4906-8d99-014b5950132f",
|
|
1307
|
+
email: `${genWord()}@${genWord()}.com`,
|
|
1308
|
+
gender: chooseRandom(["MALE", "FEMALE", "NOT_SPECIFIED"]),
|
|
1309
|
+
id: `${genNumericId()}`,
|
|
1310
|
+
metadata: {},
|
|
1311
|
+
registration_date: "2024-11-15T00:00:00+00:00",
|
|
1312
|
+
status: "ACTIVE",
|
|
1313
|
+
dob: "2010-11-15T00:00:00+00:00",
|
|
1314
|
+
metrics: buildCustomerMetrics()
|
|
1315
|
+
}, overrides);
|
|
1316
|
+
};
|
|
1317
|
+
const buildCustomerMetrics = (overrides) => {
|
|
1318
|
+
return __spreadValues$9({
|
|
1319
|
+
last_month: buildMetrics(),
|
|
1320
|
+
last_quarter: buildMetrics(),
|
|
1321
|
+
last_year: buildMetrics(),
|
|
1322
|
+
last_semester: buildMetrics(),
|
|
1323
|
+
this_month: buildMetrics(),
|
|
1324
|
+
this_quarter: buildMetrics(),
|
|
1325
|
+
this_semester: buildMetrics(),
|
|
1326
|
+
this_year: buildMetrics(),
|
|
1327
|
+
lifetime: buildMetrics()
|
|
1328
|
+
}, overrides);
|
|
1329
|
+
};
|
|
1330
|
+
const buildMetrics = (overrides) => {
|
|
1331
|
+
return __spreadValues$9({
|
|
1332
|
+
from: genDate().toString(),
|
|
1333
|
+
to: genDate().toString(),
|
|
1334
|
+
last_visit: null,
|
|
1335
|
+
number_of_purchases: genNumber(),
|
|
1336
|
+
spend_total: genNumber(),
|
|
1337
|
+
tier_id: genId()
|
|
1338
|
+
}, overrides);
|
|
1339
|
+
};
|
|
1340
|
+
const buildMasivoWallet = (overrides) => {
|
|
1341
|
+
return __spreadValues$9({
|
|
1342
|
+
id: `${genNumericId()}`,
|
|
1343
|
+
owner_id: `${genNumericId()}`,
|
|
1344
|
+
totals: [buildWalletTotal(), buildWalletTotal()],
|
|
1345
|
+
lines: [buildWalletLine(), buildWalletLine()]
|
|
1346
|
+
}, overrides);
|
|
1347
|
+
};
|
|
1348
|
+
const buildMasivoInfo = (override, customerOverrides, walletOverrides) => {
|
|
1349
|
+
return __spreadValues$9({
|
|
1350
|
+
customer: buildMasivoCustomer(customerOverrides),
|
|
1351
|
+
wallet: buildMasivoWallet(walletOverrides)
|
|
1352
|
+
}, override);
|
|
1353
|
+
};
|
|
1354
|
+
const buildWalletMedia = (overrides) => {
|
|
1355
|
+
return __spreadValues$9({
|
|
1356
|
+
thumbnail_url: genURL(),
|
|
1357
|
+
cover_url: genURL()
|
|
1358
|
+
}, overrides);
|
|
1359
|
+
};
|
|
1360
|
+
const buildWalletAttribute = (overrides) => {
|
|
1361
|
+
return __spreadValues$9({
|
|
1362
|
+
conversion_factor: genNumber(1),
|
|
1363
|
+
action: chooseRandom(["ADD_PRODUCT", "REPLACE_PRODUCT"]),
|
|
1364
|
+
discount_type: chooseRandom(["fixed", "percentage"]),
|
|
1365
|
+
discount_value: genNumber(10),
|
|
1366
|
+
new_amount: genNumber(20),
|
|
1367
|
+
replace_amount: genNumber(20),
|
|
1368
|
+
replace_product_id: genId(),
|
|
1369
|
+
new_product_id: genId(),
|
|
1370
|
+
item_id: genId(),
|
|
1371
|
+
type: chooseRandom(["order", "shipping", "product"])
|
|
1372
|
+
}, overrides);
|
|
1373
|
+
};
|
|
1374
|
+
const buildMasivoConditionBase = (overrides) => {
|
|
1375
|
+
return __spreadValues$9({
|
|
1376
|
+
invalidMessage: genWord(4),
|
|
1377
|
+
primitive: chooseRandom(["int", "char", "bool"]),
|
|
1378
|
+
type: chooseRandom([
|
|
1379
|
+
"Current date",
|
|
1380
|
+
"Registration",
|
|
1381
|
+
"Birthday",
|
|
1382
|
+
"Customer number of purchases",
|
|
1383
|
+
"Customer has made a purchase",
|
|
1384
|
+
"Customer points balance",
|
|
1385
|
+
"Customer spend total",
|
|
1386
|
+
"Customer total spend",
|
|
1387
|
+
"Ordered at store",
|
|
1388
|
+
"Ordered in channel",
|
|
1389
|
+
"Payment method",
|
|
1390
|
+
"Order includes product",
|
|
1391
|
+
"Order value",
|
|
1392
|
+
"Order includes tag",
|
|
1393
|
+
"Product includes tag",
|
|
1394
|
+
"Shipping includes tag"
|
|
1395
|
+
]),
|
|
1396
|
+
operator: chooseRandom([
|
|
1397
|
+
"greater than",
|
|
1398
|
+
"greater than or equal to",
|
|
1399
|
+
"less than",
|
|
1400
|
+
"less than or equal to",
|
|
1401
|
+
"equal to",
|
|
1402
|
+
"not equal to",
|
|
1403
|
+
"is",
|
|
1404
|
+
"is not",
|
|
1405
|
+
"falls within period",
|
|
1406
|
+
"occurred",
|
|
1407
|
+
"occurred in the last",
|
|
1408
|
+
"occurred more than"
|
|
1409
|
+
])
|
|
1410
|
+
}, overrides);
|
|
1411
|
+
};
|
|
1412
|
+
const buildMasivoCondition = (overrides) => {
|
|
1413
|
+
return __spreadValues$9(__spreadProps$4(__spreadValues$9({}, buildMasivoConditionBase()), {
|
|
1414
|
+
value: genWord(4),
|
|
1415
|
+
reward_id: genId(),
|
|
1416
|
+
allDay: genBiasBoolean(0.2),
|
|
1417
|
+
startDate: genDate().toString(),
|
|
1418
|
+
endDate: genDate().toString(),
|
|
1419
|
+
repeat: chooseRandom([
|
|
1420
|
+
"NONE",
|
|
1421
|
+
"DAILY",
|
|
1422
|
+
"WEEKLY",
|
|
1423
|
+
"FORTNIGHTLY",
|
|
1424
|
+
"MONTHLY",
|
|
1425
|
+
"WEEK_OF_MONTH"
|
|
1426
|
+
]),
|
|
1427
|
+
reporting_period: chooseRandom([
|
|
1428
|
+
"MONTHLY",
|
|
1429
|
+
"QUARTERLY",
|
|
1430
|
+
"YEARLY",
|
|
1431
|
+
"SEMESTERLY"
|
|
1432
|
+
])
|
|
1433
|
+
}), overrides);
|
|
1310
1434
|
};
|
|
1311
|
-
const
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
}
|
|
1334
|
-
const
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
conditions: [],
|
|
1356
|
-
media: {
|
|
1357
|
-
thumbnail_url: null,
|
|
1358
|
-
cover_url: null
|
|
1359
|
-
},
|
|
1360
|
-
type: "POINTS",
|
|
1361
|
-
status: "ACTIVE",
|
|
1362
|
-
brand_id: null,
|
|
1363
|
-
attributes: {
|
|
1364
|
-
conversion_factor: 0.025
|
|
1365
|
-
}
|
|
1366
|
-
},
|
|
1367
|
-
total: 200,
|
|
1368
|
-
expiration_date: "2025-11-16T04:59:59.999Z"
|
|
1369
|
-
}
|
|
1370
|
-
];
|
|
1371
|
-
const buildLoyaltyLines = () => [
|
|
1372
|
-
{
|
|
1373
|
-
reward_id: "71fd5647-d580-4d2d-b7dd-7800f639206b",
|
|
1374
|
-
campaign_id: "8cf83574-a9b0-4578-8cb8-bd8340acb7d2",
|
|
1375
|
-
brand_id: "0001",
|
|
1376
|
-
issued_at: "2024-11-15T17:03:27.1s43Z",
|
|
1377
|
-
expiration_date: "2025-11-16T04:59:59.999Z",
|
|
1378
|
-
amount: 200,
|
|
1379
|
-
reward: buildLoyaltyWalletTotals()[0].reward
|
|
1380
|
-
}
|
|
1381
|
-
];
|
|
1382
|
-
const buildLoyaltyWalletAccumulation = (override) => {
|
|
1435
|
+
const buildWalletReward = (overrides) => {
|
|
1436
|
+
return __spreadValues$9({
|
|
1437
|
+
id: genId(),
|
|
1438
|
+
name: genWord(4),
|
|
1439
|
+
description: genWord(12),
|
|
1440
|
+
conditions: [],
|
|
1441
|
+
media: buildWalletMedia(),
|
|
1442
|
+
type: chooseRandom(["DISCOUNT", "POINTS", "GIFT_CARD", "PRODUCT"]),
|
|
1443
|
+
status: "ACTIVE",
|
|
1444
|
+
brand_id: null,
|
|
1445
|
+
attributes: buildWalletAttribute({
|
|
1446
|
+
conversion_factor: 0.025
|
|
1447
|
+
})
|
|
1448
|
+
}, overrides);
|
|
1449
|
+
};
|
|
1450
|
+
const buildWalletTotal = (overrides) => {
|
|
1451
|
+
return __spreadValues$9({
|
|
1452
|
+
reward_id: genId(),
|
|
1453
|
+
reward: buildWalletReward(),
|
|
1454
|
+
total: genNumber(200),
|
|
1455
|
+
expiration_date: genDate().toString()
|
|
1456
|
+
}, overrides);
|
|
1457
|
+
};
|
|
1458
|
+
const buildWalletLine = (overrides) => {
|
|
1459
|
+
return __spreadValues$9({
|
|
1460
|
+
brand_id: genId(),
|
|
1461
|
+
reward_id: genId(),
|
|
1462
|
+
campaign_id: genId(),
|
|
1463
|
+
expiration_date: genDate().toString(),
|
|
1464
|
+
issued_at: genDate().toString(),
|
|
1465
|
+
reservation_expires_at: genDate().toString(),
|
|
1466
|
+
amount: genNumber(200),
|
|
1467
|
+
reward: buildWalletReward()
|
|
1468
|
+
}, overrides);
|
|
1469
|
+
};
|
|
1470
|
+
const buildRedeemableBenefit = (overrides) => {
|
|
1471
|
+
return __spreadValues$9(__spreadValues$9({
|
|
1472
|
+
brand_id: genId(),
|
|
1473
|
+
campaign_id: genId(),
|
|
1474
|
+
issued_at: genDate().toString(),
|
|
1475
|
+
amount: genNumber(200)
|
|
1476
|
+
}, buildWalletTotal()), overrides);
|
|
1477
|
+
};
|
|
1478
|
+
const buildLoyaltyAccumulation = (override) => {
|
|
1383
1479
|
if (override)
|
|
1384
1480
|
return override;
|
|
1385
|
-
const [line] =
|
|
1386
|
-
const [total] =
|
|
1481
|
+
const [line] = [buildWalletLine()];
|
|
1482
|
+
const [total] = [buildWalletTotal()];
|
|
1387
1483
|
const { reward } = total;
|
|
1388
1484
|
return __spreadProps$4(__spreadValues$9({}, line), { reward });
|
|
1389
1485
|
};
|
|
1486
|
+
const buildMasivoTier = (overrides) => {
|
|
1487
|
+
return __spreadValues$9({
|
|
1488
|
+
id: genId(),
|
|
1489
|
+
name: `${genWord()} ${genWord()}`,
|
|
1490
|
+
status: "ACTIVE",
|
|
1491
|
+
level: genNumber(12),
|
|
1492
|
+
description: genParagraph(1),
|
|
1493
|
+
entry_conditions: [[buildMasivoCondition()]],
|
|
1494
|
+
exit_conditions: [[buildMasivoCondition()]],
|
|
1495
|
+
template_id: genId()
|
|
1496
|
+
}, overrides);
|
|
1497
|
+
};
|
|
1498
|
+
const buildExtendedLoyaltyInfo = (overrides) => {
|
|
1499
|
+
return __spreadValues$9(__spreadProps$4(__spreadValues$9({}, buildMasivoInfo()), {
|
|
1500
|
+
accumulations: [buildLoyaltyAccumulation()],
|
|
1501
|
+
redemptions: []
|
|
1502
|
+
}), overrides);
|
|
1503
|
+
};
|
|
1504
|
+
const buildCodesSummary = (overrides) => {
|
|
1505
|
+
return __spreadValues$9({
|
|
1506
|
+
codes: [genWord(1), genWord(1), genWord(1)],
|
|
1507
|
+
left: genNumber(70),
|
|
1508
|
+
used: genNumber(30),
|
|
1509
|
+
total: genNumber(100)
|
|
1510
|
+
}, overrides);
|
|
1511
|
+
};
|
|
1512
|
+
const buildCodeFormat = (overrides) => {
|
|
1513
|
+
return __spreadValues$9({
|
|
1514
|
+
case_sensitive: genBiasBoolean(0.3),
|
|
1515
|
+
exclude_characters: genWord(1),
|
|
1516
|
+
include_characters: genWord(1),
|
|
1517
|
+
template: genWord(10)
|
|
1518
|
+
}, overrides);
|
|
1519
|
+
};
|
|
1520
|
+
const buildCouponCampaignAttributes = (overrides) => {
|
|
1521
|
+
return __spreadValues$9({
|
|
1522
|
+
code_format: buildCodeFormat(),
|
|
1523
|
+
codes_summary: buildCodesSummary(),
|
|
1524
|
+
max_redemptions_per_code: genNumber(3),
|
|
1525
|
+
max_redemptions_per_code_per_customer: genNumber(5)
|
|
1526
|
+
}, overrides);
|
|
1527
|
+
};
|
|
1390
1528
|
const buildLoyaltyCampaign = (overrides) => {
|
|
1391
|
-
|
|
1392
|
-
return overrides;
|
|
1393
|
-
return {
|
|
1529
|
+
return __spreadValues$9({
|
|
1394
1530
|
id: genId(),
|
|
1395
1531
|
name: `${genWord()} ${genWord()}`,
|
|
1396
1532
|
description: genParagraph(1),
|
|
1397
|
-
brand_id:
|
|
1533
|
+
brand_id: genId(),
|
|
1398
1534
|
start_date: genDate().toString(),
|
|
1399
1535
|
end_date: null,
|
|
1400
|
-
rules:
|
|
1401
|
-
type: "COUPONS",
|
|
1536
|
+
rules: [buildCampaignRule(), buildCampaignRule()],
|
|
1537
|
+
type: chooseRandom(["COUPONS", "BEHAVIOR"]),
|
|
1402
1538
|
funded_by: null,
|
|
1403
1539
|
labels: [chooseRandom(["Domicilio", "Restaurantes"])],
|
|
1404
|
-
budget: 1e3,
|
|
1405
|
-
divide_budget_in: "total",
|
|
1540
|
+
budget: genNumber(1e3),
|
|
1541
|
+
divide_budget_in: chooseRandom(["daily", "weekly", "monthly", "total"]),
|
|
1406
1542
|
content: {
|
|
1407
1543
|
Title: {
|
|
1408
1544
|
name: genWord(),
|
|
@@ -1417,41 +1553,49 @@ const buildLoyaltyCampaign = (overrides) => {
|
|
|
1417
1553
|
},
|
|
1418
1554
|
template_id: genId(),
|
|
1419
1555
|
metadata: {},
|
|
1420
|
-
attributes:
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
};
|
|
1556
|
+
attributes: buildCouponCampaignAttributes(),
|
|
1557
|
+
status: chooseRandom(["RUNNING", "PAUSED", "SCHEDULED", "FINISHED"])
|
|
1558
|
+
}, overrides);
|
|
1559
|
+
};
|
|
1560
|
+
const buildMasivoEffect = (overrides) => {
|
|
1561
|
+
return __spreadValues$9({
|
|
1562
|
+
amount: genNumber(200),
|
|
1563
|
+
type: chooseRandom(["DISCOUNT", "POINTS", "GIFT_CARD", "PRODUCT"]),
|
|
1564
|
+
reward_id: genId(),
|
|
1565
|
+
reward: buildWalletReward(),
|
|
1566
|
+
tier_id: genId(),
|
|
1567
|
+
expiration_date: genDate().toString(),
|
|
1568
|
+
multiplier: chooseRandom(["Order value"])
|
|
1569
|
+
}, overrides);
|
|
1570
|
+
};
|
|
1571
|
+
const buildCampaignRule = (overrides) => {
|
|
1572
|
+
return __spreadValues$9({ conditions: [], effects: [] }, overrides);
|
|
1437
1573
|
};
|
|
1438
|
-
const buildCampaignRule = () => ({
|
|
1439
|
-
conditions: [],
|
|
1440
|
-
effects: []
|
|
1441
|
-
});
|
|
1442
1574
|
|
|
1443
1575
|
var masivo_builder = /*#__PURE__*/Object.freeze({
|
|
1444
1576
|
__proto__: null,
|
|
1445
1577
|
buildCampaignRule: buildCampaignRule,
|
|
1578
|
+
buildCodeFormat: buildCodeFormat,
|
|
1579
|
+
buildCodesSummary: buildCodesSummary,
|
|
1580
|
+
buildCouponCampaignAttributes: buildCouponCampaignAttributes,
|
|
1446
1581
|
buildCustomerMetrics: buildCustomerMetrics,
|
|
1582
|
+
buildExtendedLoyaltyInfo: buildExtendedLoyaltyInfo,
|
|
1583
|
+
buildLoyaltyAccumulation: buildLoyaltyAccumulation,
|
|
1447
1584
|
buildLoyaltyCampaign: buildLoyaltyCampaign,
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1585
|
+
buildMasivoCondition: buildMasivoCondition,
|
|
1586
|
+
buildMasivoConditionBase: buildMasivoConditionBase,
|
|
1587
|
+
buildMasivoCustomer: buildMasivoCustomer,
|
|
1588
|
+
buildMasivoEffect: buildMasivoEffect,
|
|
1589
|
+
buildMasivoInfo: buildMasivoInfo,
|
|
1590
|
+
buildMasivoTier: buildMasivoTier,
|
|
1591
|
+
buildMasivoWallet: buildMasivoWallet,
|
|
1592
|
+
buildMetrics: buildMetrics,
|
|
1593
|
+
buildRedeemableBenefit: buildRedeemableBenefit,
|
|
1594
|
+
buildWalletAttribute: buildWalletAttribute,
|
|
1595
|
+
buildWalletLine: buildWalletLine,
|
|
1596
|
+
buildWalletMedia: buildWalletMedia,
|
|
1597
|
+
buildWalletReward: buildWalletReward,
|
|
1598
|
+
buildWalletTotal: buildWalletTotal
|
|
1455
1599
|
});
|
|
1456
1600
|
|
|
1457
1601
|
var __defProp$8 = Object.defineProperty;
|