fuze-store-shared 1.0.0

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/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # fuze-store-shared
2
+ Fuze Store helpers and types
@@ -0,0 +1,4 @@
1
+ export * from './types/invoice';
2
+ export * from './types/plan';
3
+ export * from './types/subscription';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types/invoice"), exports);
18
+ __exportStar(require("./types/plan"), exports);
19
+ __exportStar(require("./types/subscription"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,+CAA6B;AAC7B,uDAAqC"}
@@ -0,0 +1,63 @@
1
+ export interface InvoiceStatus {
2
+ id: string;
3
+ code: "PAID" | "PENDING";
4
+ }
5
+ export interface Invoice {
6
+ id: string;
7
+ /**
8
+ * The reference identifier that connects to payments service
9
+ */
10
+ reference: string | null;
11
+ /**
12
+ * The first day of your billing cycle
13
+ */
14
+ billingStartDate: string;
15
+ /**
16
+ * The last day of your billing cycle
17
+ */
18
+ billingEndDate: string;
19
+ /**
20
+ * Total amount of your billings (base fee, store sales fee, etc)
21
+ */
22
+ totalAmount: number;
23
+ /**
24
+ * Filename of the invoice document
25
+ */
26
+ filename: string;
27
+ /**
28
+ * Currency code (e.g., USD, EUR)
29
+ */
30
+ currency: string;
31
+ /**
32
+ * ISO 8601 formatted date-time string
33
+ */
34
+ createdAt: string;
35
+ /**
36
+ * ISO 8601 formatted date-time string
37
+ */
38
+ updatedAt: string;
39
+ /**
40
+ * Status of invoice
41
+ */
42
+ status?: InvoiceStatus;
43
+ /**
44
+ * List of payments associated with this invoice
45
+ */
46
+ payments?: InvoicePayment[];
47
+ }
48
+ export interface InvoicePayment {
49
+ amount: number;
50
+ createdAt: string;
51
+ currency: string;
52
+ id: string;
53
+ paymentMethodId: string | null;
54
+ pspReference: string | null;
55
+ reference: string | null;
56
+ updatedAt: string;
57
+ status?: InvoicePaymentStatus;
58
+ }
59
+ export interface InvoicePaymentStatus {
60
+ id: string;
61
+ code: "PAID" | "PENDING" | "FAILED" | "UNKNOWN";
62
+ }
63
+ //# sourceMappingURL=invoice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice.d.ts","sourceRoot":"","sources":["../../src/types/invoice.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,SAAS,CAAE;CAC3B;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;CACjD"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=invoice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice.js","sourceRoot":"","sources":["../../src/types/invoice.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ export type PlanCode = 'FREE' | 'BASIC' | 'STARTER' | 'STANDARD' | 'PREMIUM';
2
+ export type Plan = {
3
+ id: string;
4
+ name: string;
5
+ baseFee: number;
6
+ description: string;
7
+ salesThreshold: number;
8
+ commissionRate: number;
9
+ currency: string;
10
+ code: PlanCode;
11
+ features: Record<string, string | number | boolean>;
12
+ };
13
+ //# sourceMappingURL=plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/types/plan.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAE,SAAS,CAAC;AAE5E,MAAM,MAAM,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAC,MAAM,GAAC,OAAO,CAAC,CAAC;CACjD,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/types/plan.ts"],"names":[],"mappings":""}
@@ -0,0 +1,54 @@
1
+ import { Invoice } from './invoice';
2
+ import { Plan } from './plan';
3
+ export type Subscription = {
4
+ id: string;
5
+ /**
6
+ * The reference identifier that connects to payments service
7
+ */
8
+ reference: string | null;
9
+ /**
10
+ * The default payment id where you billed
11
+ */
12
+ paymentMethodId: string | null;
13
+ /**
14
+ * Start date of billing
15
+ */
16
+ startDate: string | null;
17
+ /**
18
+ * End date of billing
19
+ */
20
+ endDate: string | null;
21
+ /**
22
+ * Expiry date of subscription
23
+ */
24
+ expiresAt: string | null;
25
+ /**
26
+ * Status of subscription
27
+ */
28
+ status: 'ACTIVE' | 'PENDING' | 'CANCELED';
29
+ /**
30
+ * Creation timestamp
31
+ */
32
+ createdAt: string;
33
+ /**
34
+ * Last update timestamp
35
+ */
36
+ updatedAt: string | null;
37
+ /**
38
+ * Subscribed Plan
39
+ */
40
+ plan?: Plan;
41
+ /**
42
+ * The date for subscribing to new plan
43
+ */
44
+ scheduleChangeDate: string | null;
45
+ /**
46
+ * The new plan to be subscribed on next billing
47
+ */
48
+ newPlan?: Plan;
49
+ /**
50
+ * list of subscription invoices
51
+ */
52
+ invoices?: Invoice[];
53
+ };
54
+ //# sourceMappingURL=subscription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/types/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;IAC1C;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ;;OAEG;IACH,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CAKtB,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=subscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../src/types/subscription.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "fuze-store-shared",
3
+ "version": "1.0.0",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "repository": "https://github.com/Fuze-Store/fuze-store-shared.git",
7
+ "author": "kimdelrosario006 <KDelRosario@jaycar.com.au>",
8
+ "license": "MIT",
9
+ "scripts": {
10
+ "build": "tsc"
11
+ },
12
+ "devDependencies": {
13
+ "typescript": "^5.9.3"
14
+ }
15
+ }
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from './types/invoice';
2
+ export * from './types/plan';
3
+ export * from './types/subscription';
4
+
@@ -0,0 +1,67 @@
1
+
2
+ export interface InvoiceStatus {
3
+ id: string;
4
+ code: "PAID" | "PENDING" ;
5
+ }
6
+
7
+ export interface Invoice {
8
+ id: string;
9
+ /**
10
+ * The reference identifier that connects to payments service
11
+ */
12
+ reference: string | null;
13
+ /**
14
+ * The first day of your billing cycle
15
+ */
16
+ billingStartDate: string;
17
+ /**
18
+ * The last day of your billing cycle
19
+ */
20
+ billingEndDate: string;
21
+ /**
22
+ * Total amount of your billings (base fee, store sales fee, etc)
23
+ */
24
+ totalAmount: number;
25
+ /**
26
+ * Filename of the invoice document
27
+ */
28
+ filename: string;
29
+ /**
30
+ * Currency code (e.g., USD, EUR)
31
+ */
32
+ currency: string;
33
+ /**
34
+ * ISO 8601 formatted date-time string
35
+ */
36
+ createdAt: string;
37
+ /**
38
+ * ISO 8601 formatted date-time string
39
+ */
40
+ updatedAt: string;
41
+ /**
42
+ * Status of invoice
43
+ */
44
+ status?: InvoiceStatus;
45
+ /**
46
+ * List of payments associated with this invoice
47
+ */
48
+ payments?: InvoicePayment[];
49
+ }
50
+
51
+ export interface InvoicePayment {
52
+ amount: number;
53
+ createdAt: string;
54
+ currency: string;
55
+ id: string;
56
+ paymentMethodId: string | null;
57
+ pspReference: string | null;
58
+ reference: string | null;
59
+ updatedAt: string;
60
+ status?: InvoicePaymentStatus;
61
+ }
62
+
63
+ export interface InvoicePaymentStatus {
64
+ id: string;
65
+ code: "PAID" | "PENDING" | "FAILED" | "UNKNOWN";
66
+ }
67
+
@@ -0,0 +1,14 @@
1
+
2
+ export type PlanCode = 'FREE' | 'BASIC' | 'STARTER' | 'STANDARD' |'PREMIUM';
3
+
4
+ export type Plan = {
5
+ id: string;
6
+ name: string;
7
+ baseFee: number;
8
+ description: string;
9
+ salesThreshold: number;
10
+ commissionRate: number;
11
+ currency: string;
12
+ code: PlanCode;
13
+ features: Record<string, string|number|boolean>;
14
+ };
@@ -0,0 +1,58 @@
1
+ import { Invoice } from './invoice';
2
+ import { Plan } from './plan';
3
+
4
+ export type Subscription = {
5
+ id: string;
6
+ /**
7
+ * The reference identifier that connects to payments service
8
+ */
9
+ reference: string | null;
10
+ /**
11
+ * The default payment id where you billed
12
+ */
13
+ paymentMethodId: string | null;
14
+ /**
15
+ * Start date of billing
16
+ */
17
+ startDate: string | null;
18
+ /**
19
+ * End date of billing
20
+ */
21
+ endDate: string | null;
22
+ /**
23
+ * Expiry date of subscription
24
+ */
25
+ expiresAt: string | null;
26
+ /**
27
+ * Status of subscription
28
+ */
29
+ status: 'ACTIVE' | 'PENDING' | 'CANCELED';
30
+ /**
31
+ * Creation timestamp
32
+ */
33
+ createdAt: string;
34
+ /**
35
+ * Last update timestamp
36
+ */
37
+ updatedAt: string | null;
38
+ /**
39
+ * Subscribed Plan
40
+ */
41
+ plan?: Plan;
42
+ /**
43
+ * The date for subscribing to new plan
44
+ */
45
+ scheduleChangeDate: string | null;
46
+ /**
47
+ * The new plan to be subscribed on next billing
48
+ */
49
+ newPlan?: Plan;
50
+ /**
51
+ * list of subscription invoices
52
+ */
53
+ invoices?: Invoice[];
54
+ // /**
55
+ // * list of active coupon redemptions
56
+ // */
57
+ // activeRedemptions?: CouponRedemption[];
58
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ // Visit https://aka.ms/tsconfig to read more about this file
3
+ "compilerOptions": {
4
+ // File Layout
5
+ // "rootDir": "./src",
6
+ "outDir": "./dist",
7
+
8
+ // Environment Settings
9
+ // See also https://aka.ms/tsconfig/module
10
+ "module": "nodenext",
11
+ "target": "esnext",
12
+ "types": [],
13
+ // For nodejs:
14
+ // "lib": ["esnext"],
15
+ // "types": ["node"],
16
+ // and npm install -D @types/node
17
+
18
+ // Other Outputs
19
+ "sourceMap": true,
20
+ "declaration": true,
21
+ "declarationMap": true,
22
+
23
+ // Stricter Typechecking Options
24
+ "noUncheckedIndexedAccess": true,
25
+ "exactOptionalPropertyTypes": true,
26
+
27
+ // Style Options
28
+ // "noImplicitReturns": true,
29
+ // "noImplicitOverride": true,
30
+ // "noUnusedLocals": true,
31
+ // "noUnusedParameters": true,
32
+ // "noFallthroughCasesInSwitch": true,
33
+ // "noPropertyAccessFromIndexSignature": true,
34
+
35
+ // Recommended Options
36
+ "strict": true,
37
+ "jsx": "react-jsx",
38
+ // "verbatimModuleSyntax": true,
39
+ "isolatedModules": true,
40
+ "noUncheckedSideEffectImports": true,
41
+ "moduleDetection": "force",
42
+ "skipLibCheck": true,
43
+ },
44
+ "include": ["src"]
45
+ }