@drawbridge/drawbridge-utils 0.0.3 → 0.0.4

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/index.js CHANGED
@@ -1,190 +1,183 @@
1
- var __getOwnPropNames = Object.getOwnPropertyNames;
2
- var __commonJS = (cb, mod) => function __require() {
3
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
- };
1
+ // index.js
2
+ import { code, data } from "currency-codes";
5
3
 
6
4
  // lib/constants.js
7
- var require_constants = __commonJS({
8
- "lib/constants.js"(exports2, module2) {
9
- var font = {
10
- family: "Roboto Flex",
11
- transform: "none",
12
- weight: "regular"
13
- };
14
- module2.exports = {
15
- action: {
16
- usage: {
17
- actions: 0
18
- }
19
- },
20
- brand: {
21
- style: {
22
- body: font,
23
- heading: font
24
- },
25
- totals: {
26
- campaigns: 0
27
- }
28
- },
29
- campaign: {
30
- agreements: {
31
- marketing: {
32
- enabled: false,
33
- label: "I agree to the marketing terms and conditions",
34
- link: null
35
- },
36
- terms: {
37
- enabled: false,
38
- label: "I agree to the terms and conditions",
39
- link: null
40
- }
41
- },
42
- defaults: {
43
- active: "Enter",
44
- confirmation: "Submission was successful",
45
- inactive: "Submissions are closed",
46
- email: "You were selected"
47
- },
48
- notifications: {
49
- draw: {
50
- subject: "You have been selected",
51
- body: "Thanks for being part of our giveaway"
52
- }
53
- },
54
- settings: {
55
- submissionLeadPrimaryKey: "email",
56
- submissionEntryMaximum: 1,
57
- submissionEntryFilter: "campaign",
58
- submissionEntryHighscore: false,
59
- submissionEntryLimit: 1
60
- },
61
- status: "drafted",
62
- totals: {
63
- advertisements: 0,
64
- affiliates: 0,
65
- draws: 0,
66
- exports: 0,
67
- entries: 0,
68
- fields: 2,
69
- integrations: 1,
70
- leads: 0,
71
- links: 0,
72
- pages: 0,
73
- prizes: 0,
74
- ranges: 0,
75
- submissions: 0
76
- },
77
- type: "giveaway"
5
+ var font = {
6
+ family: "Roboto Flex",
7
+ transform: "none",
8
+ weight: "regular"
9
+ };
10
+ var constants_default = {
11
+ action: {
12
+ usage: {
13
+ actions: 0
14
+ }
15
+ },
16
+ brand: {
17
+ style: {
18
+ body: font,
19
+ heading: font
20
+ },
21
+ totals: {
22
+ campaigns: 0
23
+ }
24
+ },
25
+ campaign: {
26
+ agreements: {
27
+ marketing: {
28
+ enabled: false,
29
+ label: "I agree to the marketing terms and conditions",
30
+ link: null
78
31
  },
32
+ terms: {
33
+ enabled: false,
34
+ label: "I agree to the terms and conditions",
35
+ link: null
36
+ }
37
+ },
38
+ defaults: {
39
+ active: "Enter",
40
+ confirmation: "Submission was successful",
41
+ inactive: "Submissions are closed",
42
+ email: "You were selected"
43
+ },
44
+ notifications: {
79
45
  draw: {
80
- status: "qualified",
81
- totals: {
82
- notifications: 0
83
- }
84
- },
85
- member: {
86
- status: "pending"
87
- },
88
- organization: {
89
- errors: [],
90
- totals: {
91
- affiliates: 0,
92
- brands: 0,
93
- campaigns: 0,
94
- leads: 0,
95
- draws: 0,
96
- entries: 0,
97
- invitations: 0,
98
- invoices: 0,
99
- members: 0,
100
- ranges: 0,
101
- pages: 0,
102
- prizes: 0,
103
- storage: 0,
104
- submissions: 0,
105
- subscriptions: 0,
106
- usage: 0
107
- }
108
- },
109
- page: {
110
- domains: [],
111
- status: "drafted",
112
- totals: {
113
- leads: 0,
114
- entries: 0,
115
- submissions: 0
116
- }
117
- },
118
- prize: {
119
- inventory: 0,
120
- remaining: 0,
121
- shipping: false,
122
- status: "drafted",
123
- totals: {
124
- draws: 0
125
- }
126
- },
127
- range: {
128
- totals: {
129
- leads: 0,
130
- entries: 0,
131
- submissions: 0
132
- }
133
- },
134
- referrer: {
135
- totals: {
136
- originizations: 0,
137
- subscriptions: 0,
138
- users: 0
139
- }
140
- },
141
- template: {
142
- page: {
143
- style: {
144
- body: font,
145
- heading: font
146
- }
147
- }
148
- },
149
- usage: {
150
- totals: {
151
- actions: 0,
152
- affiliates: 0,
153
- brands: 0,
154
- campaigns: 0,
155
- connections: 0,
156
- entries: 0,
157
- files: 0,
158
- members: 0,
159
- orders: 0,
160
- pages: 0,
161
- revenue: 0,
162
- storage: 0,
163
- submissions: 0,
164
- workflows: 0
165
- }
166
- },
167
- user: {
168
- access: {
169
- ai: false
170
- },
171
- image: null,
172
- totals: {
173
- inbox: 0,
174
- invitations: 0,
175
- messages: 0,
176
- methods: 0,
177
- organizations: 1,
178
- teams: 0
179
- }
46
+ subject: "You have been selected",
47
+ body: "Thanks for being part of our giveaway"
180
48
  }
181
- };
49
+ },
50
+ settings: {
51
+ submissionLeadPrimaryKey: "email",
52
+ submissionEntryMaximum: 1,
53
+ submissionEntryFilter: "campaign",
54
+ submissionEntryHighscore: false,
55
+ submissionEntryLimit: 1
56
+ },
57
+ status: "drafted",
58
+ totals: {
59
+ advertisements: 0,
60
+ affiliates: 0,
61
+ draws: 0,
62
+ exports: 0,
63
+ entries: 0,
64
+ fields: 2,
65
+ integrations: 1,
66
+ leads: 0,
67
+ links: 0,
68
+ pages: 0,
69
+ prizes: 0,
70
+ ranges: 0,
71
+ submissions: 0
72
+ },
73
+ type: "giveaway"
74
+ },
75
+ draw: {
76
+ status: "qualified",
77
+ totals: {
78
+ notifications: 0
79
+ }
80
+ },
81
+ member: {
82
+ status: "pending"
83
+ },
84
+ organization: {
85
+ errors: [],
86
+ totals: {
87
+ affiliates: 0,
88
+ brands: 0,
89
+ campaigns: 0,
90
+ leads: 0,
91
+ draws: 0,
92
+ entries: 0,
93
+ invitations: 0,
94
+ invoices: 0,
95
+ members: 0,
96
+ ranges: 0,
97
+ pages: 0,
98
+ prizes: 0,
99
+ storage: 0,
100
+ submissions: 0,
101
+ subscriptions: 0,
102
+ usage: 0
103
+ }
104
+ },
105
+ page: {
106
+ domains: [],
107
+ status: "drafted",
108
+ totals: {
109
+ leads: 0,
110
+ entries: 0,
111
+ submissions: 0
112
+ }
113
+ },
114
+ prize: {
115
+ inventory: 0,
116
+ remaining: 0,
117
+ shipping: false,
118
+ status: "drafted",
119
+ totals: {
120
+ draws: 0
121
+ }
122
+ },
123
+ range: {
124
+ totals: {
125
+ leads: 0,
126
+ entries: 0,
127
+ submissions: 0
128
+ }
129
+ },
130
+ referrer: {
131
+ totals: {
132
+ originizations: 0,
133
+ subscriptions: 0,
134
+ users: 0
135
+ }
136
+ },
137
+ template: {
138
+ page: {
139
+ style: {
140
+ body: font,
141
+ heading: font
142
+ }
143
+ }
144
+ },
145
+ usage: {
146
+ totals: {
147
+ actions: 0,
148
+ affiliates: 0,
149
+ brands: 0,
150
+ campaigns: 0,
151
+ connections: 0,
152
+ entries: 0,
153
+ files: 0,
154
+ members: 0,
155
+ orders: 0,
156
+ pages: 0,
157
+ revenue: 0,
158
+ storage: 0,
159
+ submissions: 0,
160
+ workflows: 0
161
+ }
162
+ },
163
+ user: {
164
+ access: {
165
+ ai: false
166
+ },
167
+ image: null,
168
+ totals: {
169
+ inbox: 0,
170
+ invitations: 0,
171
+ messages: 0,
172
+ methods: 0,
173
+ organizations: 1,
174
+ teams: 0
175
+ }
182
176
  }
183
- });
177
+ };
184
178
 
185
179
  // index.js
186
- var { code, data } = require("currency-codes");
187
- var constants = require_constants();
180
+ var constants = constants_default;
188
181
  var infinite = 1e300;
189
182
  var isInfinite = (value) => value === infinite;
190
183
  var megabyte = 1024 * 1024;
@@ -347,7 +340,7 @@ var currencies = data.map((item) => ({
347
340
  value: item.code
348
341
  }));
349
342
  var currency = (val) => code(val);
350
- module.exports = {
343
+ export {
351
344
  bytesToGB,
352
345
  bytesToMB,
353
346
  capitalize,
package/package.json CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "type": "module",
2
3
  "dependencies": {
3
4
  "currency-codes": "2.2.0",
4
5
  "tsup": "8.5.1",
@@ -7,21 +8,21 @@
7
8
  "exports": {
8
9
  ".": {
9
10
  "types": "./dist/index.d.ts",
10
- "import": "./dist/index.mjs",
11
- "require": "./dist/index.js"
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs"
12
13
  },
13
14
  "./encrypt": {
14
15
  "types": "./dist/encrypt.d.ts",
15
- "import": "./dist/encrypt.mjs",
16
- "require": "./dist/encrypt.js"
16
+ "import": "./dist/encrypt.js",
17
+ "require": "./dist/encrypt.cjs"
17
18
  }
18
19
  },
19
20
  "files": [
20
21
  "dist"
21
22
  ],
22
23
  "license": "ISC",
23
- "main": "dist/index.js",
24
- "module": "dist/index.mjs",
24
+ "main": "dist/index.cjs",
25
+ "module": "dist/index.js",
25
26
  "name": "@drawbridge/drawbridge-utils",
26
27
  "publishConfig": {
27
28
  "access": "public"
@@ -30,5 +31,5 @@
30
31
  "build": "tsup && npm publish"
31
32
  },
32
33
  "types": "dist/index.d.ts",
33
- "version": "0.0.3"
34
+ "version": "0.0.4"
34
35
  }
@@ -1,15 +0,0 @@
1
- var __getOwnPropNames = Object.getOwnPropertyNames;
2
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
3
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
4
- }) : x)(function(x) {
5
- if (typeof require !== "undefined") return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
- var __commonJS = (cb, mod) => function __require2() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
-
12
- export {
13
- __require,
14
- __commonJS
15
- };
package/dist/encrypt.mjs DELETED
@@ -1,43 +0,0 @@
1
- import {
2
- __commonJS,
3
- __require
4
- } from "./chunk-EBO3CZXG.mjs";
5
-
6
- // encrypt.js
7
- var require_encrypt = __commonJS({
8
- "encrypt.js"(exports, module) {
9
- var crypto = __require("crypto");
10
- var ALGORITHM = "aes-256-gcm";
11
- var getKey = () => Buffer.from(process.env.ENCRYPTION_KEY, "hex");
12
- var encrypt = (value) => {
13
- const iv = crypto.randomBytes(12);
14
- const cipher = crypto.createCipheriv(ALGORITHM, getKey(), iv);
15
- const data = Buffer.concat([
16
- cipher.update(JSON.stringify(value), "utf8"),
17
- cipher.final()
18
- ]);
19
- const tag = cipher.getAuthTag();
20
- return [iv, tag, data].map((b) => b.toString("hex")).join(":");
21
- };
22
- var decrypt = (value) => {
23
- if (typeof value !== "string") return value;
24
- const [ivHex, tagHex, dataHex] = value.split(":");
25
- const decipher = crypto.createDecipheriv(
26
- ALGORITHM,
27
- getKey(),
28
- Buffer.from(ivHex, "hex")
29
- );
30
- decipher.setAuthTag(Buffer.from(tagHex, "hex"));
31
- const result = Buffer.concat([
32
- decipher.update(Buffer.from(dataHex, "hex")),
33
- decipher.final()
34
- ]);
35
- return JSON.parse(result.toString("utf8"));
36
- };
37
- module.exports = {
38
- decrypt,
39
- encrypt
40
- };
41
- }
42
- });
43
- export default require_encrypt();