@artisan-commerce/builders 0.7.0-canary.49 → 0.7.0-canary.50
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.js +21 -19
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.d.ts +11 -12
- package/dist/bundle.esm.js +21 -20
- package/dist/bundle.esm.js.map +1 -1
- package/dist/bundle.umd.js +21 -19
- package/dist/bundle.umd.js.map +1 -1
- package/dist/noop.cjs.js +4 -0
- package/dist/noop.cjs.js.map +1 -1
- package/dist/noop.esm.js +4 -1
- package/dist/noop.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/bundle.umd.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
var btoa__default = /*#__PURE__*/_interopDefaultLegacy(btoa);
|
|
10
10
|
|
|
11
11
|
const genItems = (builder, quantity) => {
|
|
12
|
-
const num = quantity != null ? quantity :
|
|
12
|
+
const num = quantity != null ? quantity : faker.faker.datatype.number({ min: 1, max: 10 });
|
|
13
13
|
const items = [];
|
|
14
14
|
for (let i = 0; i < num; i++) {
|
|
15
15
|
items.push(builder());
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
if (bias > 1 || bias < 0) {
|
|
70
70
|
throw new Error(`Bias must be a number between 0 and 1. Value ${bias} is not valid`);
|
|
71
71
|
}
|
|
72
|
-
const random =
|
|
72
|
+
const random = faker.faker.datatype.number({ min: 0, max: 1, precision: 4 });
|
|
73
73
|
return random <= bias;
|
|
74
74
|
};
|
|
75
75
|
const genDocument = (digits) => {
|
|
@@ -125,16 +125,7 @@
|
|
|
125
125
|
}
|
|
126
126
|
return newId;
|
|
127
127
|
};
|
|
128
|
-
const chooseRandom =
|
|
129
|
-
return arr[Math.floor(Math.random() * arr.length)];
|
|
130
|
-
};
|
|
131
|
-
const chooseRandomEnum = (anEnum) => {
|
|
132
|
-
const enumValues = Object.keys(anEnum);
|
|
133
|
-
const randomIndex = Math.floor(Math.random() * enumValues.length);
|
|
134
|
-
const randomEnumKey = enumValues[randomIndex];
|
|
135
|
-
const randomEnumValue = anEnum[randomEnumKey];
|
|
136
|
-
return randomEnumValue;
|
|
137
|
-
};
|
|
128
|
+
const chooseRandom = faker.faker.helpers.arrayElement;
|
|
138
129
|
const genSymbol = chooseRandom(["$", "S/", "$b", "Bs"]);
|
|
139
130
|
const genIP = faker.faker.internet.ip;
|
|
140
131
|
|
|
@@ -178,7 +169,6 @@
|
|
|
178
169
|
genCountry: genCountry,
|
|
179
170
|
fillNumber: fillNumber,
|
|
180
171
|
chooseRandom: chooseRandom,
|
|
181
|
-
chooseRandomEnum: chooseRandomEnum,
|
|
182
172
|
genSymbol: genSymbol,
|
|
183
173
|
genIP: genIP,
|
|
184
174
|
genItems: genItems
|
|
@@ -426,7 +416,7 @@
|
|
|
426
416
|
}, overrides);
|
|
427
417
|
};
|
|
428
418
|
const genCatalogues = (quantity) => {
|
|
429
|
-
const num = quantity != null ? quantity :
|
|
419
|
+
const num = quantity != null ? quantity : genNumber({ min: 1, max: 10 });
|
|
430
420
|
let options = [...catalogueOptions];
|
|
431
421
|
const catalogues = [];
|
|
432
422
|
for (let i = 0; i < num; i++) {
|
|
@@ -516,7 +506,7 @@
|
|
|
516
506
|
addDirectlyToCart: genBiasBoolean(0.5),
|
|
517
507
|
coverUrl: "",
|
|
518
508
|
description: faker.faker.lorem.lines(2),
|
|
519
|
-
images: genCDNImages(
|
|
509
|
+
images: genCDNImages(genNumber({ min: 1, max: 5 })),
|
|
520
510
|
measure: "unit",
|
|
521
511
|
name: faker.faker.commerce.productName(),
|
|
522
512
|
outOfService: false,
|
|
@@ -562,7 +552,7 @@
|
|
|
562
552
|
}, overrides);
|
|
563
553
|
};
|
|
564
554
|
const genProductAnswers = (quantity, loop = 1) => {
|
|
565
|
-
const num = quantity != null ? quantity :
|
|
555
|
+
const num = quantity != null ? quantity : genNumber({ min: 1, max: 6 });
|
|
566
556
|
const productAnswers = [];
|
|
567
557
|
for (let i = 0; i < num; i++) {
|
|
568
558
|
const productAnswer = buildProductAnswer({}, loop);
|
|
@@ -591,7 +581,7 @@
|
|
|
591
581
|
}, overrides);
|
|
592
582
|
};
|
|
593
583
|
const genProductQuestions = (quantity, loop = 1) => {
|
|
594
|
-
const num = quantity != null ? quantity :
|
|
584
|
+
const num = quantity != null ? quantity : genNumber({ min: 1, max: 5 });
|
|
595
585
|
const productQuestions = [];
|
|
596
586
|
for (let i = 0; i < num; i++) {
|
|
597
587
|
const productQuestion = buildProductQuestion({}, loop);
|
|
@@ -626,7 +616,7 @@
|
|
|
626
616
|
}), overrides);
|
|
627
617
|
};
|
|
628
618
|
const genCartProductAnswers = (quantity) => {
|
|
629
|
-
const num = quantity != null ? quantity :
|
|
619
|
+
const num = quantity != null ? quantity : genNumber({ min: 1, max: 5 });
|
|
630
620
|
const cartProductAnswers = [];
|
|
631
621
|
for (let i = 0; i < num; i++) {
|
|
632
622
|
const cartProductAnswer = buildCartProductAnswer(i.toString());
|
|
@@ -1535,7 +1525,7 @@
|
|
|
1535
1525
|
}), overrides);
|
|
1536
1526
|
};
|
|
1537
1527
|
const genCartStores = (quantity) => {
|
|
1538
|
-
const num = quantity != null ? quantity :
|
|
1528
|
+
const num = quantity != null ? quantity : genNumber({ min: 1, max: 1 });
|
|
1539
1529
|
const cartStores = {};
|
|
1540
1530
|
for (let i = 0; i < num; i++) {
|
|
1541
1531
|
const cartStore = buildCartStore();
|
|
@@ -2610,6 +2600,18 @@
|
|
|
2610
2600
|
genCardInscriptions: genCardInscriptions
|
|
2611
2601
|
});
|
|
2612
2602
|
|
|
2603
|
+
const seed = (seed2) => {
|
|
2604
|
+
if (!faker.faker)
|
|
2605
|
+
throw new Error("Faker not found");
|
|
2606
|
+
return faker.faker.seed(seed2);
|
|
2607
|
+
};
|
|
2608
|
+
|
|
2609
|
+
var instance_utils = /*#__PURE__*/Object.freeze({
|
|
2610
|
+
__proto__: null,
|
|
2611
|
+
seed: seed
|
|
2612
|
+
});
|
|
2613
|
+
|
|
2614
|
+
exports.Builders = instance_utils;
|
|
2613
2615
|
exports.accountBuilders = account_builder;
|
|
2614
2616
|
exports.bannerBuilders = banner_builder;
|
|
2615
2617
|
exports.billingDataBuilders = billingData_builder;
|