@artisan-commerce/builders 0.7.0-canary.72 → 0.7.0-canary.74
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 +262 -117
- package/dist/bundle.cjs.map +1 -1
- package/dist/bundle.d.ts +58 -32
- package/dist/bundle.mjs +262 -117
- package/dist/bundle.mjs.map +1 -1
- package/dist/bundle.umd.js +262 -117
- package/dist/bundle.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/bundle.cjs
CHANGED
|
@@ -1300,109 +1300,246 @@ 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
|
-
|
|
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
|
+
alerts: []
|
|
1477
|
+
}, buildWalletTotal()), overrides);
|
|
1478
|
+
};
|
|
1479
|
+
const buildLoyaltyAccumulation = (override) => {
|
|
1383
1480
|
if (override)
|
|
1384
1481
|
return override;
|
|
1385
|
-
const [line] =
|
|
1386
|
-
const [total] =
|
|
1482
|
+
const [line] = [buildWalletLine()];
|
|
1483
|
+
const [total] = [buildWalletTotal()];
|
|
1387
1484
|
const { reward } = total;
|
|
1388
1485
|
return __spreadProps$4(__spreadValues$9({}, line), { reward });
|
|
1389
1486
|
};
|
|
1487
|
+
const buildMasivoTier = (overrides) => {
|
|
1488
|
+
return __spreadValues$9({
|
|
1489
|
+
id: genId(),
|
|
1490
|
+
name: `${genWord()} ${genWord()}`,
|
|
1491
|
+
status: "ACTIVE",
|
|
1492
|
+
level: genNumber(12),
|
|
1493
|
+
description: genParagraph(1),
|
|
1494
|
+
entry_conditions: [[buildMasivoCondition()]],
|
|
1495
|
+
exit_conditions: [[buildMasivoCondition()]],
|
|
1496
|
+
template_id: genId()
|
|
1497
|
+
}, overrides);
|
|
1498
|
+
};
|
|
1499
|
+
const buildExtendedLoyaltyInfo = (overrides) => {
|
|
1500
|
+
return __spreadValues$9(__spreadProps$4(__spreadValues$9({}, buildMasivoInfo()), {
|
|
1501
|
+
accumulations: [buildLoyaltyAccumulation()],
|
|
1502
|
+
redemptions: []
|
|
1503
|
+
}), overrides);
|
|
1504
|
+
};
|
|
1505
|
+
const buildCodesSummary = (overrides) => {
|
|
1506
|
+
return __spreadValues$9({
|
|
1507
|
+
codes: [genWord(1), genWord(1), genWord(1)],
|
|
1508
|
+
left: genNumber(70),
|
|
1509
|
+
used: genNumber(30),
|
|
1510
|
+
total: genNumber(100)
|
|
1511
|
+
}, overrides);
|
|
1512
|
+
};
|
|
1513
|
+
const buildCodeFormat = (overrides) => {
|
|
1514
|
+
return __spreadValues$9({
|
|
1515
|
+
case_sensitive: genBiasBoolean(0.3),
|
|
1516
|
+
exclude_characters: genWord(1),
|
|
1517
|
+
include_characters: genWord(1),
|
|
1518
|
+
template: genWord(10)
|
|
1519
|
+
}, overrides);
|
|
1520
|
+
};
|
|
1521
|
+
const buildCouponCampaignAttributes = (overrides) => {
|
|
1522
|
+
return __spreadValues$9({
|
|
1523
|
+
code_format: buildCodeFormat(),
|
|
1524
|
+
codes_summary: buildCodesSummary(),
|
|
1525
|
+
max_redemptions_per_code: genNumber(3),
|
|
1526
|
+
max_redemptions_per_code_per_customer: genNumber(5)
|
|
1527
|
+
}, overrides);
|
|
1528
|
+
};
|
|
1390
1529
|
const buildLoyaltyCampaign = (overrides) => {
|
|
1391
|
-
|
|
1392
|
-
return overrides;
|
|
1393
|
-
return {
|
|
1530
|
+
return __spreadValues$9({
|
|
1394
1531
|
id: genId(),
|
|
1395
1532
|
name: `${genWord()} ${genWord()}`,
|
|
1396
1533
|
description: genParagraph(1),
|
|
1397
|
-
brand_id:
|
|
1534
|
+
brand_id: genId(),
|
|
1398
1535
|
start_date: genDate().toString(),
|
|
1399
1536
|
end_date: null,
|
|
1400
|
-
rules:
|
|
1401
|
-
type: "COUPONS",
|
|
1537
|
+
rules: [buildCampaignRule(), buildCampaignRule()],
|
|
1538
|
+
type: chooseRandom(["COUPONS", "BEHAVIOR"]),
|
|
1402
1539
|
funded_by: null,
|
|
1403
1540
|
labels: [chooseRandom(["Domicilio", "Restaurantes"])],
|
|
1404
|
-
budget: 1e3,
|
|
1405
|
-
divide_budget_in: "total",
|
|
1541
|
+
budget: genNumber(1e3),
|
|
1542
|
+
divide_budget_in: chooseRandom(["daily", "weekly", "monthly", "total"]),
|
|
1406
1543
|
content: {
|
|
1407
1544
|
Title: {
|
|
1408
1545
|
name: genWord(),
|
|
@@ -1417,41 +1554,49 @@ const buildLoyaltyCampaign = (overrides) => {
|
|
|
1417
1554
|
},
|
|
1418
1555
|
template_id: genId(),
|
|
1419
1556
|
metadata: {},
|
|
1420
|
-
attributes:
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
};
|
|
1557
|
+
attributes: buildCouponCampaignAttributes(),
|
|
1558
|
+
status: chooseRandom(["RUNNING", "PAUSED", "SCHEDULED", "FINISHED"])
|
|
1559
|
+
}, overrides);
|
|
1560
|
+
};
|
|
1561
|
+
const buildMasivoEffect = (overrides) => {
|
|
1562
|
+
return __spreadValues$9({
|
|
1563
|
+
amount: genNumber(200),
|
|
1564
|
+
type: chooseRandom(["DISCOUNT", "POINTS", "GIFT_CARD", "PRODUCT"]),
|
|
1565
|
+
reward_id: genId(),
|
|
1566
|
+
reward: buildWalletReward(),
|
|
1567
|
+
tier_id: genId(),
|
|
1568
|
+
expiration_date: genDate().toString(),
|
|
1569
|
+
multiplier: chooseRandom(["Order value"])
|
|
1570
|
+
}, overrides);
|
|
1571
|
+
};
|
|
1572
|
+
const buildCampaignRule = (overrides) => {
|
|
1573
|
+
return __spreadValues$9({ conditions: [], effects: [] }, overrides);
|
|
1437
1574
|
};
|
|
1438
|
-
const buildCampaignRule = () => ({
|
|
1439
|
-
conditions: [],
|
|
1440
|
-
effects: []
|
|
1441
|
-
});
|
|
1442
1575
|
|
|
1443
1576
|
var masivo_builder = /*#__PURE__*/Object.freeze({
|
|
1444
1577
|
__proto__: null,
|
|
1445
1578
|
buildCampaignRule: buildCampaignRule,
|
|
1579
|
+
buildCodeFormat: buildCodeFormat,
|
|
1580
|
+
buildCodesSummary: buildCodesSummary,
|
|
1581
|
+
buildCouponCampaignAttributes: buildCouponCampaignAttributes,
|
|
1446
1582
|
buildCustomerMetrics: buildCustomerMetrics,
|
|
1583
|
+
buildExtendedLoyaltyInfo: buildExtendedLoyaltyInfo,
|
|
1584
|
+
buildLoyaltyAccumulation: buildLoyaltyAccumulation,
|
|
1447
1585
|
buildLoyaltyCampaign: buildLoyaltyCampaign,
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1586
|
+
buildMasivoCondition: buildMasivoCondition,
|
|
1587
|
+
buildMasivoConditionBase: buildMasivoConditionBase,
|
|
1588
|
+
buildMasivoCustomer: buildMasivoCustomer,
|
|
1589
|
+
buildMasivoEffect: buildMasivoEffect,
|
|
1590
|
+
buildMasivoInfo: buildMasivoInfo,
|
|
1591
|
+
buildMasivoTier: buildMasivoTier,
|
|
1592
|
+
buildMasivoWallet: buildMasivoWallet,
|
|
1593
|
+
buildMetrics: buildMetrics,
|
|
1594
|
+
buildRedeemableBenefit: buildRedeemableBenefit,
|
|
1595
|
+
buildWalletAttribute: buildWalletAttribute,
|
|
1596
|
+
buildWalletLine: buildWalletLine,
|
|
1597
|
+
buildWalletMedia: buildWalletMedia,
|
|
1598
|
+
buildWalletReward: buildWalletReward,
|
|
1599
|
+
buildWalletTotal: buildWalletTotal
|
|
1455
1600
|
});
|
|
1456
1601
|
|
|
1457
1602
|
var __defProp$8 = Object.defineProperty;
|