cloudcommerce 0.0.32 → 0.0.36

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/action.yml +4 -0
  3. package/package.json +6 -6
  4. package/packages/__skeleton/package.json +4 -1
  5. package/packages/__skeleton/src/{index.js → index.ts} +0 -0
  6. package/packages/__skeleton/tsconfig.json +3 -0
  7. package/packages/api/{tests/fetch-polyfill.js → fetch-polyfill.js} +0 -0
  8. package/packages/api/lib/index.d.ts +2 -112
  9. package/packages/api/lib/types.d.ts +1 -1
  10. package/packages/api/package.json +1 -1
  11. package/packages/api/src/types.ts +4 -0
  12. package/packages/api/tests/index.test.ts +1 -1
  13. package/packages/apps/discounts/lib/index.js +4 -0
  14. package/packages/apps/discounts/lib/index.js.map +1 -0
  15. package/packages/apps/discounts/package.json +4 -1
  16. package/packages/apps/discounts/src/index.ts +7 -0
  17. package/packages/apps/discounts/tsconfig.json +3 -0
  18. package/packages/cli/lib/index.js +11 -2
  19. package/packages/cli/package.json +1 -1
  20. package/packages/cli/src/index.ts +12 -3
  21. package/packages/firebase/lib/config.d.ts +15 -0
  22. package/packages/firebase/lib/config.js +3 -0
  23. package/packages/firebase/lib/config.js.map +1 -1
  24. package/packages/firebase/lib/defaults.d.ts +4 -0
  25. package/packages/firebase/lib/env.d.ts +8 -0
  26. package/packages/firebase/lib/handlers/check-store-events.d.ts +2 -0
  27. package/packages/firebase/lib/{methods → handlers}/check-store-events.js +10 -0
  28. package/packages/firebase/lib/handlers/check-store-events.js.map +1 -0
  29. package/packages/firebase/lib/index.d.ts +5 -0
  30. package/packages/firebase/lib/index.js +5 -4
  31. package/packages/firebase/lib/index.js.map +1 -1
  32. package/packages/firebase/lib/types.d.ts +6 -0
  33. package/packages/firebase/lib/types.js +2 -0
  34. package/packages/firebase/lib/types.js.map +1 -0
  35. package/packages/firebase/package.json +4 -1
  36. package/packages/firebase/src/config.ts +3 -0
  37. package/packages/firebase/src/{methods → handlers}/check-store-events.ts +11 -0
  38. package/packages/firebase/src/index.ts +5 -5
  39. package/packages/firebase/src/types.ts +11 -0
  40. package/packages/firebase/tsconfig.json +4 -1
  41. package/packages/modules/CHANGELOG.md +1 -0
  42. package/packages/modules/README.md +1 -0
  43. package/packages/modules/lib/firebase/index.js +15 -0
  44. package/packages/modules/lib/firebase/index.js.map +1 -0
  45. package/packages/modules/lib/index.js +21 -0
  46. package/packages/modules/lib/index.js.map +1 -0
  47. package/packages/modules/package.json +33 -0
  48. package/packages/modules/schemas/@checkout.cjs +1015 -0
  49. package/packages/modules/schemas/apply_discount.cjs +324 -0
  50. package/packages/modules/schemas/calculate_shipping.cjs +666 -0
  51. package/packages/modules/schemas/create_transaction.cjs +1001 -0
  52. package/packages/modules/schemas/list_payments.cjs +852 -0
  53. package/packages/modules/scripts/build-types.sh +33 -0
  54. package/packages/modules/src/firebase/index.ts +15 -0
  55. package/packages/modules/src/index.ts +21 -0
  56. package/packages/modules/tsconfig.json +3 -0
  57. package/packages/storefront/package.json +2 -2
  58. package/packages/types/CHANGELOG.md +1 -0
  59. package/packages/types/README.md +1 -0
  60. package/packages/types/index.ts +66 -0
  61. package/packages/types/modules/@checkout:params.d.ts +920 -0
  62. package/packages/types/modules/apply_discount:params.d.ts +154 -0
  63. package/packages/types/modules/apply_discount:response.d.ts +71 -0
  64. package/packages/types/modules/calculate_shipping:params.d.ts +275 -0
  65. package/packages/types/modules/calculate_shipping:response.d.ts +402 -0
  66. package/packages/types/modules/create_transaction:params.d.ts +515 -0
  67. package/packages/types/modules/create_transaction:response.d.ts +261 -0
  68. package/packages/types/modules/list_payments:params.d.ts +323 -0
  69. package/packages/types/modules/list_payments:response.d.ts +266 -0
  70. package/packages/types/package.json +21 -0
  71. package/pnpm-lock.yaml +505 -274
  72. package/packages/firebase/lib/methods/check-store-events.js.map +0 -1
@@ -0,0 +1,324 @@
1
+ /* eslint-disable quote-props, comma-dangle, array-bracket-spacing */
2
+
3
+ const schema = {
4
+ 'description': 'Triggered to validate and apply discount value, must return discount and conditions',
5
+ 'type': 'object',
6
+ 'additionalProperties': false,
7
+ 'properties': {
8
+ 'discount_coupon': {
9
+ 'type': 'string',
10
+ 'maxLength': 255,
11
+ 'description': 'Text of discount coupon applied by customer'
12
+ },
13
+ 'items': {
14
+ 'type': 'array',
15
+ 'maxItems': 3000,
16
+ 'items': {
17
+ 'type': 'object',
18
+ 'additionalProperties': false,
19
+ 'required': [ 'product_id', 'quantity', 'price' ],
20
+ 'properties': {
21
+ 'product_id': {
22
+ 'type': 'string',
23
+ 'pattern': '^[a-f0-9]{24}$',
24
+ 'description': 'Product ID'
25
+ },
26
+ 'variation_id': {
27
+ 'type': 'string',
28
+ 'pattern': '^[a-f0-9]{24}$',
29
+ 'description': 'ID to specify the variation added to cart, if product has variations'
30
+ },
31
+ 'sku': {
32
+ 'type': 'string',
33
+ 'minLength': 2,
34
+ 'maxLength': 100,
35
+ 'pattern': '^[A-Za-z0-9-_.]+$',
36
+ 'description': 'Product or variation unique reference code'
37
+ },
38
+ 'name': {
39
+ 'type': 'string',
40
+ 'maxLength': 255,
41
+ 'description': 'Product or variation full name, or other label for this cart item'
42
+ },
43
+ 'quantity': {
44
+ 'type': 'number',
45
+ // 'multipleOf': 0.0001,
46
+ 'minimum': 0,
47
+ 'maximum': 9999999,
48
+ 'description': 'Item quantity in cart'
49
+ },
50
+ 'currency_id': {
51
+ 'type': 'string',
52
+ 'pattern': '^[A-Z]{3}$',
53
+ 'default': 'BRL',
54
+ 'description': 'Designator of currency according to ISO 4217 (3 uppercase letters)'
55
+ },
56
+ 'currency_symbol': {
57
+ 'type': 'string',
58
+ 'maxLength': 20,
59
+ 'default': 'R$',
60
+ 'description': 'Graphic symbol used as a shorthand for currency\'s name'
61
+ },
62
+ 'price': {
63
+ 'type': 'number',
64
+ // 'multipleOf': 0.00001,
65
+ 'minimum': 0,
66
+ 'maximum': 999999999,
67
+ 'description': 'Product sale price specifically for this cart'
68
+ },
69
+ 'final_price': {
70
+ 'type': 'number',
71
+ // 'multipleOf': 0.00001,
72
+ 'minimum': 0,
73
+ 'maximum': 999999999,
74
+ 'description': 'Final item price including additions due to customizations and gift wrap'
75
+ }
76
+ },
77
+ 'description': 'One of the cart items'
78
+ },
79
+ 'description': 'Products composing the cart'
80
+ },
81
+ 'currency_id': {
82
+ 'type': 'string',
83
+ 'pattern': '^[A-Z]{3}$',
84
+ 'default': 'BRL',
85
+ 'description': 'Designator of currency according to ISO 4217 (3 uppercase letters)'
86
+ },
87
+ 'currency_symbol': {
88
+ 'type': 'string',
89
+ 'maxLength': 20,
90
+ 'default': 'R$',
91
+ 'description': 'Graphic symbol used as a shorthand for currency\'s name'
92
+ },
93
+ 'amount': {
94
+ 'type': 'object',
95
+ 'additionalProperties': false,
96
+ 'required': [ 'total' ],
97
+ 'properties': {
98
+ 'total': {
99
+ 'type': 'number',
100
+ // 'multipleOf': 0.00001,
101
+ 'minimum': 0,
102
+ 'maximum': 9999999999,
103
+ 'description': 'Order total amount'
104
+ },
105
+ 'subtotal': {
106
+ 'type': 'number',
107
+ // 'multipleOf': 0.00001,
108
+ 'minimum': 0,
109
+ 'maximum': 9999999999,
110
+ 'description': 'The sum of all items prices'
111
+ },
112
+ 'freight': {
113
+ 'type': 'number',
114
+ // 'multipleOf': 0.00001,
115
+ 'minimum': 0,
116
+ 'maximum': 9999999999,
117
+ 'description': 'Order freight cost'
118
+ },
119
+ 'discount': {
120
+ 'type': 'number',
121
+ // 'multipleOf': 0.00001,
122
+ 'minimum': 0,
123
+ 'maximum': 9999999999,
124
+ 'description': 'Applied discount value'
125
+ },
126
+ 'tax': {
127
+ 'type': 'number',
128
+ // 'multipleOf': 0.00001,
129
+ 'minimum': 0,
130
+ 'maximum': 9999999999,
131
+ 'description': 'The sum of all the taxes applied to the order'
132
+ },
133
+ 'extra': {
134
+ 'type': 'number',
135
+ // 'multipleOf': 0.00001,
136
+ 'minimum': 0,
137
+ 'maximum': 9999999999,
138
+ 'description': 'Sum of optional extra costs applied'
139
+ }
140
+ },
141
+ 'description': 'Object with sums of values'
142
+ },
143
+ 'utm': {
144
+ 'type': 'object',
145
+ 'additionalProperties': false,
146
+ 'properties': {
147
+ 'source': {
148
+ 'type': 'string',
149
+ 'maxLength': 100,
150
+ 'description': 'Parameter "utm_source", the referrer: (e.g. google, newsletter)'
151
+ },
152
+ 'medium': {
153
+ 'type': 'string',
154
+ 'maxLength': 100,
155
+ 'description': 'Parameter "utm_medium", the marketing medium: (e.g. cpc, banner, email)'
156
+ },
157
+ 'campaign': {
158
+ 'type': 'string',
159
+ 'maxLength': 200,
160
+ 'description': 'Parameter "utm_campaign", the product, promo code, or slogan (e.g. spring_sale)'
161
+ },
162
+ 'term': {
163
+ 'type': 'string',
164
+ 'maxLength': 100,
165
+ 'description': 'Parameter "utm_term", identifies the paid keywords'
166
+ },
167
+ 'content': {
168
+ 'type': 'string',
169
+ 'maxLength': 255,
170
+ 'description': 'Parameter "utm_content", used to differentiate ads'
171
+ }
172
+ },
173
+ 'description': 'UTM campaign HTTP parameters'
174
+ },
175
+ 'affiliate_code': {
176
+ 'type': 'string',
177
+ 'maxLength': 200,
178
+ 'description': 'Code to identify the affiliate that referred the customer'
179
+ },
180
+ 'channel_id': {
181
+ 'type': 'integer',
182
+ 'min': 10000,
183
+ 'max': 4294967295,
184
+ 'description': 'Channel unique identificator'
185
+ },
186
+ 'channel_type': {
187
+ 'type': 'string',
188
+ 'maxLength': 20,
189
+ 'enum': [ 'ecommerce', 'mobile', 'pdv', 'button', 'facebook', 'chatbot' ],
190
+ 'default': 'ecommerce',
191
+ 'description': 'Channel type or source'
192
+ },
193
+ 'domain': {
194
+ 'type': 'string',
195
+ 'minLength': 4,
196
+ 'maxLength': 100,
197
+ 'pattern': '^[0-9a-z-.]+$',
198
+ 'description': 'Store domain name (numbers and lowercase letters, eg.: www.myshop.sample)'
199
+ },
200
+ 'lang': {
201
+ 'type': 'string',
202
+ 'pattern': '^[a-z]{2}(_[a-z]{2})?$',
203
+ 'description': 'Language two letters code, sometimes with region, eg.: pt_br, fr, en_us'
204
+ },
205
+ 'customer': {
206
+ 'type': 'object',
207
+ 'additionalProperties': false,
208
+ 'properties': {
209
+ '_id': {
210
+ 'type': [ 'null', 'string' ],
211
+ 'pattern': '^[a-f0-9]{24}$',
212
+ 'description': 'Customer ID'
213
+ },
214
+ 'display_name': {
215
+ 'type': 'string',
216
+ 'maxLength': 50,
217
+ 'description': 'The name of this Customer, suitable for display'
218
+ }
219
+ },
220
+ 'description': 'Customer object summary'
221
+ }
222
+ }
223
+ };
224
+
225
+ exports.params = schema;
226
+
227
+ exports.response = {
228
+ 'description': `Response - ${schema.description}`,
229
+ 'type': 'object',
230
+ 'additionalProperties': false,
231
+ 'properties': {
232
+ 'available_extra_discount': {
233
+ 'type': 'object',
234
+ 'required': [ 'value' ],
235
+ 'additionalProperties': false,
236
+ 'properties': {
237
+ 'min_amount': {
238
+ 'type': 'integer',
239
+ 'minimum': 1,
240
+ 'maximum': 999999999,
241
+ 'description': 'Minimum amount to apply the discount'
242
+ },
243
+ 'label': {
244
+ 'type': 'string',
245
+ 'maxLength': 50,
246
+ 'description': 'Name of discount campaign'
247
+ },
248
+ 'type': {
249
+ 'type': 'string',
250
+ 'enum': [ 'percentage', 'fixed' ],
251
+ 'default': 'percentage',
252
+ 'description': 'Discount type'
253
+ },
254
+ 'value': {
255
+ 'type': 'number',
256
+ // 'multipleOf': 0.0001,
257
+ 'minimum': 0,
258
+ 'maximum': 99999999,
259
+ 'description': 'Discount value, percentage or fixed'
260
+ }
261
+ },
262
+ 'description': 'Available but not yet applied discount campaign'
263
+ },
264
+ 'discount_rule': {
265
+ 'type': 'object',
266
+ 'required': [ 'extra_discount' ],
267
+ 'additionalProperties': false,
268
+ 'properties': {
269
+ 'label': {
270
+ 'type': 'string',
271
+ 'maxLength': 100,
272
+ 'description': 'Name of the discount rule, can be the coupon or campaign name'
273
+ },
274
+ 'description': {
275
+ 'type': 'string',
276
+ 'maxLength': 1000,
277
+ 'description': 'Additional text description for the discount rule'
278
+ },
279
+ 'extra_discount': {
280
+ 'type': 'object',
281
+ 'required': [ 'value' ],
282
+ 'additionalProperties': false,
283
+ 'properties': {
284
+ 'value': {
285
+ 'type': 'number',
286
+ // 'multipleOf': 0.00001,
287
+ 'minimum': 0.01,
288
+ 'maximum': 9999999999,
289
+ 'description': 'Extra discount value'
290
+ },
291
+ 'flags': {
292
+ 'type': 'array',
293
+ 'uniqueItems': true,
294
+ 'maxItems': 10,
295
+ 'items': {
296
+ 'type': 'string',
297
+ 'maxLength': 20,
298
+ 'description': 'Flag title'
299
+ },
300
+ 'description': 'Flags to associate additional info'
301
+ }
302
+ },
303
+ 'description': 'Extra discount to apply on checkout'
304
+ }
305
+ },
306
+ 'description': 'Matched discount rule for current UTM campaign or coupon'
307
+ },
308
+ 'invalid_coupon_message': {
309
+ 'type': 'string',
310
+ 'maxLength': 255,
311
+ 'description': 'Short message for curtomer if coupon/campaign tried is invalid'
312
+ },
313
+ 'freebie_product_ids': {
314
+ 'type': 'array',
315
+ 'maxItems': 3000,
316
+ 'items': {
317
+ 'type': 'string',
318
+ 'pattern': '^[a-f0-9]{24}$',
319
+ 'description': 'Product ID'
320
+ },
321
+ 'description': 'List of available freebie (gift) products'
322
+ }
323
+ }
324
+ };