@artisan-commerce/builders 0.7.0-canary.52 → 0.7.0-canary.54

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.
@@ -18,42 +18,60 @@ const genItems = (builder, quantity) => {
18
18
  return items;
19
19
  };
20
20
 
21
- const commonDocumentTypes = ["PASSPORT"];
22
- const ARDocumentTypes = [...commonDocumentTypes];
23
- const BODocumentTypes = [...commonDocumentTypes];
24
- const BRDocumentTypes = [...commonDocumentTypes];
25
- const CLDocumentTypes = [...commonDocumentTypes];
26
- const CODocumentTypes = [
27
- ...commonDocumentTypes,
21
+ const getCommonDocumentTypes = () => ["PASSPORT"];
22
+ const getARDocumentTypes = () => [
23
+ ...getCommonDocumentTypes()
24
+ ];
25
+ const getBODocumentTypes = () => [
26
+ ...getCommonDocumentTypes()
27
+ ];
28
+ const getBRDocumentTypes = () => [
29
+ ...getCommonDocumentTypes()
30
+ ];
31
+ const getCLDocumentTypes = () => [
32
+ ...getCommonDocumentTypes()
33
+ ];
34
+ const getCODocumentTypes = () => [
35
+ ...getCommonDocumentTypes(),
28
36
  "RUT",
29
37
  "NIT",
30
38
  "CE",
31
39
  "CC"
32
40
  ];
33
- const ECDocumentTypes = [
34
- ...commonDocumentTypes,
41
+ const getECDocumentTypes = () => [
42
+ ...getCommonDocumentTypes(),
35
43
  "CI",
36
44
  "RUC"
37
45
  ];
38
- const PYDocumentTypes = [...commonDocumentTypes];
39
- const PEDocumentTypes = [...commonDocumentTypes];
40
- const UYDocumentTypes = [...commonDocumentTypes];
41
- const VEDocumentTypes = [...commonDocumentTypes];
42
- const USDocumentTypes = [...commonDocumentTypes];
46
+ const getPYDocumentTypes = () => [
47
+ ...getCommonDocumentTypes()
48
+ ];
49
+ const getPEDocumentTypes = () => [
50
+ ...getCommonDocumentTypes()
51
+ ];
52
+ const getUYDocumentTypes = () => [
53
+ ...getCommonDocumentTypes()
54
+ ];
55
+ const getVEDocumentTypes = () => [
56
+ ...getCommonDocumentTypes()
57
+ ];
58
+ const getUSDocumentTypes = () => [
59
+ ...getCommonDocumentTypes()
60
+ ];
43
61
  const getPassword = (...args) => `!0_Oo${faker.faker.internet.password(...args)}`;
44
- const getUsername = faker.faker.internet.userName;
45
- const genId = faker.faker.datatype.uuid;
62
+ const getUsername = (...params) => faker.faker.internet.userName(...params);
63
+ const genId = (...params) => faker.faker.datatype.uuid(...params);
46
64
  const genNumericId = (...params) => +faker.faker.random.numeric(...params);
47
- const genWord = faker.faker.lorem.word;
48
- const genAddress = faker.faker.address.streetAddress;
49
- const genName = faker.faker.name.fullName;
50
- const genEmail = faker.faker.internet.email;
51
- const genCompanyName = faker.faker.company.name;
52
- const genParagraph = faker.faker.lorem.paragraph;
53
- const genTitle = () => faker.faker.lorem.slug(3);
54
- const genNumber = faker.faker.datatype.number;
55
- const getBoolean = faker.faker.datatype.boolean;
56
- const genCountryName = faker.faker.address.country;
65
+ const genWord = (...params) => faker.faker.lorem.word(...params);
66
+ const genAddress = (...params) => faker.faker.address.streetAddress(...params);
67
+ const genName = (...params) => faker.faker.name.fullName(...params);
68
+ const genEmail = (...params) => faker.faker.internet.email(...params);
69
+ const genCompanyName = (...params) => faker.faker.company.name(...params);
70
+ const genParagraph = (...params) => faker.faker.lorem.paragraph(...params);
71
+ const genTitle = (...params) => faker.faker.lorem.slug(...params);
72
+ const genNumber = (...params) => faker.faker.datatype.number(...params);
73
+ const getBoolean = (...params) => faker.faker.datatype.boolean(...params);
74
+ const genCountryName = (...params) => faker.faker.address.country(...params);
57
75
  const genRandomImage = (randomImageConfig) => {
58
76
  const { query = "product" } = randomImageConfig != null ? randomImageConfig : {};
59
77
  const { width = 300, height = 300 } = randomImageConfig != null ? randomImageConfig : {};
@@ -63,7 +81,7 @@ const genRandomImage = (randomImageConfig) => {
63
81
  return url;
64
82
  };
65
83
  const genWords = (words) => faker.faker.random.words(words);
66
- const genURL = faker.faker.internet.url;
84
+ const genURL = (...params) => faker.faker.internet.url(...params);
67
85
  const genDate = () => faker.faker.date.recent(7).toISOString();
68
86
  const genBase64 = () => btoa__default["default"](genWord());
69
87
  const genBiasBoolean = (bias) => {
@@ -83,27 +101,27 @@ const genDocument = (digits) => {
83
101
  const genDocumentType = (countryISOCode = "EC") => {
84
102
  switch (countryISOCode) {
85
103
  case "AR":
86
- return chooseRandom(ARDocumentTypes);
104
+ return chooseRandom(getARDocumentTypes());
87
105
  case "BO":
88
- return chooseRandom(BODocumentTypes);
106
+ return chooseRandom(getBODocumentTypes());
89
107
  case "BR":
90
- return chooseRandom(BRDocumentTypes);
108
+ return chooseRandom(getBRDocumentTypes());
91
109
  case "CL":
92
- return chooseRandom(CLDocumentTypes);
110
+ return chooseRandom(getCLDocumentTypes());
93
111
  case "CO":
94
- return chooseRandom(CODocumentTypes);
112
+ return chooseRandom(getCODocumentTypes());
95
113
  case "EC":
96
- return chooseRandom(ECDocumentTypes);
114
+ return chooseRandom(getECDocumentTypes());
97
115
  case "PY":
98
- return chooseRandom(PYDocumentTypes);
116
+ return chooseRandom(getPYDocumentTypes());
99
117
  case "PE":
100
- return chooseRandom(PEDocumentTypes);
118
+ return chooseRandom(getPEDocumentTypes());
101
119
  case "UY":
102
- return chooseRandom(UYDocumentTypes);
120
+ return chooseRandom(getUYDocumentTypes());
103
121
  case "VE":
104
- return chooseRandom(VEDocumentTypes);
122
+ return chooseRandom(getVEDocumentTypes());
105
123
  case "US":
106
- return chooseRandom(USDocumentTypes);
124
+ return chooseRandom(getUSDocumentTypes());
107
125
  default:
108
126
  throw new Error(`Builder genDocumentType: The given country ISO code "${countryISOCode}" is not a supported ISO code`);
109
127
  }
@@ -126,24 +144,24 @@ const fillNumber = (num, max) => {
126
144
  }
127
145
  return newId;
128
146
  };
129
- const chooseRandom = faker.faker.helpers.arrayElement;
130
- const genSymbol = chooseRandom(["$", "S/", "$b", "Bs"]);
131
- const genIP = faker.faker.internet.ip;
147
+ const chooseRandom = (array) => faker.faker.helpers.arrayElement(array);
148
+ const genSymbol = () => chooseRandom(["$", "S/", "$b", "Bs"]);
149
+ const genIP = (...params) => faker.faker.internet.ip(...params);
132
150
 
133
151
  var common_builder = /*#__PURE__*/Object.freeze({
134
152
  __proto__: null,
135
- commonDocumentTypes: commonDocumentTypes,
136
- ARDocumentTypes: ARDocumentTypes,
137
- BODocumentTypes: BODocumentTypes,
138
- BRDocumentTypes: BRDocumentTypes,
139
- CLDocumentTypes: CLDocumentTypes,
140
- CODocumentTypes: CODocumentTypes,
141
- ECDocumentTypes: ECDocumentTypes,
142
- PYDocumentTypes: PYDocumentTypes,
143
- PEDocumentTypes: PEDocumentTypes,
144
- UYDocumentTypes: UYDocumentTypes,
145
- VEDocumentTypes: VEDocumentTypes,
146
- USDocumentTypes: USDocumentTypes,
153
+ getCommonDocumentTypes: getCommonDocumentTypes,
154
+ getARDocumentTypes: getARDocumentTypes,
155
+ getBODocumentTypes: getBODocumentTypes,
156
+ getBRDocumentTypes: getBRDocumentTypes,
157
+ getCLDocumentTypes: getCLDocumentTypes,
158
+ getCODocumentTypes: getCODocumentTypes,
159
+ getECDocumentTypes: getECDocumentTypes,
160
+ getPYDocumentTypes: getPYDocumentTypes,
161
+ getPEDocumentTypes: getPEDocumentTypes,
162
+ getUYDocumentTypes: getUYDocumentTypes,
163
+ getVEDocumentTypes: getVEDocumentTypes,
164
+ getUSDocumentTypes: getUSDocumentTypes,
147
165
  getPassword: getPassword,
148
166
  getUsername: getUsername,
149
167
  genId: genId,
@@ -758,7 +776,7 @@ const buildCountryCurrency = (overrides = {}) => {
758
776
  return __spreadValues$b({
759
777
  id: genNumber({ min: 0, max: 999 }),
760
778
  name: chooseRandom(["USD", "EUR", "CHL"]),
761
- sign: genSymbol,
779
+ sign: genSymbol(),
762
780
  external_id: genId()
763
781
  }, overrides);
764
782
  };
@@ -1381,7 +1399,7 @@ const buildStore = (overrides = {}) => {
1381
1399
  isOpen: genBiasBoolean(0.99),
1382
1400
  maxOrderAmount: genNumber(50),
1383
1401
  minOrderAmount: genNumber(10),
1384
- orderSymbol: genSymbol,
1402
+ orderSymbol: genSymbol(),
1385
1403
  phone: genMobilPhone("593"),
1386
1404
  sponsored: genBiasBoolean(0.1),
1387
1405
  latitude: genNumber({ min: 0, max: 80, precision: 6 }),
@@ -1395,7 +1413,7 @@ const buildStore = (overrides = {}) => {
1395
1413
  isDefault: genBiasBoolean(0.1),
1396
1414
  active: genBiasBoolean(0.9),
1397
1415
  minOrder: genNumber(15),
1398
- minOrderSymbol: genSymbol,
1416
+ minOrderSymbol: genSymbol(),
1399
1417
  country: buildGenericStoreLocation(),
1400
1418
  location: buildStoreLocation(),
1401
1419
  catalogues: genCatalogues(),
@@ -1510,7 +1528,8 @@ const buildBillTotalNormalCategory = (overrides = {}) => {
1510
1528
  subtotalBeforeTaxes,
1511
1529
  taxTotal,
1512
1530
  total,
1513
- discounts: genDiscounts(1)
1531
+ discounts: genDiscounts(1),
1532
+ taxes: []
1514
1533
  }, overrides);
1515
1534
  };
1516
1535
  const buildBillTotal = (overrides = {}) => {
@@ -1559,7 +1578,7 @@ const buildShippingCost = (overrides = {}) => {
1559
1578
  netPrice: genNumber(100),
1560
1579
  productId: genNumber(100),
1561
1580
  subtotalBeforeTaxes: genNumber(100),
1562
- symbol: genSymbol,
1581
+ symbol: genSymbol(),
1563
1582
  taxTotal: genNumber(100),
1564
1583
  taxes: genShippingCostTaxes(),
1565
1584
  total: genNumber(100)
@@ -1634,10 +1653,10 @@ var __spreadValues$4 = (a, b) => {
1634
1653
  }
1635
1654
  return a;
1636
1655
  };
1637
- const genStreetName = faker.faker.address.street;
1638
- const genStreetNumber = faker.faker.address.zipCode;
1639
- const genLatitude = faker.faker.address.latitude;
1640
- const genLongitude = faker.faker.address.longitude;
1656
+ const genStreetName = (...params) => faker.faker.address.street(...params);
1657
+ const genStreetNumber = (...params) => faker.faker.address.zipCode(...params);
1658
+ const genLatitude = (...params) => faker.faker.address.latitude(...params);
1659
+ const genLongitude = (...params) => faker.faker.address.longitude(...params);
1641
1660
  const buildField = (overrides = {}) => {
1642
1661
  return __spreadValues$4({
1643
1662
  id: genWord(),
@@ -1981,7 +2000,7 @@ const buildOrderStoreAdditionalInfo = (overrides = {}) => {
1981
2000
  sponsored: genBiasBoolean(0.1),
1982
2001
  timezone: "",
1983
2002
  channel_name: faker.faker.name.jobTitle(),
1984
- order_symbol: genSymbol,
2003
+ order_symbol: genSymbol(),
1985
2004
  external_id: genId(),
1986
2005
  is_drinks_store: genBiasBoolean(0.3),
1987
2006
  max_order_amount: genNumber(100),
@@ -2116,7 +2135,7 @@ const buildOrderProductPriceCategory = (overrides = {}) => {
2116
2135
  subtotal_without_taxes: genNumber(30),
2117
2136
  subtotal_zero: 0,
2118
2137
  product_id: genNumber(99999),
2119
- symbol: genSymbol,
2138
+ symbol: genSymbol(),
2120
2139
  tax_calcs: buildTaxCalculations(),
2121
2140
  tax_total: genNumber(12),
2122
2141
  total: genNumber(50)