@chargebee/chargebee-apps-libs 0.0.1

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 (49) hide show
  1. package/LICENSE +24 -0
  2. package/README.md +97 -0
  3. package/SECURITY.md +8 -0
  4. package/config/README.md +83 -0
  5. package/config/allowed-modules.json +24 -0
  6. package/dist/config/config-loader.d.ts +24 -0
  7. package/dist/config/config-loader.js +95 -0
  8. package/dist/index.d.ts +4 -0
  9. package/dist/index.js +21 -0
  10. package/dist/libs/port-service.d.ts +18 -0
  11. package/dist/libs/port-service.js +27 -0
  12. package/dist/logger/cb-public-logger.d.ts +59 -0
  13. package/dist/logger/cb-public-logger.js +158 -0
  14. package/dist/sandbox/public-sandbox-wrapper.d.ts +41 -0
  15. package/dist/sandbox/public-sandbox-wrapper.js +208 -0
  16. package/package.json +44 -0
  17. package/templates/serverless-node-starter-app/.env +4 -0
  18. package/templates/serverless-node-starter-app/README.md +290 -0
  19. package/templates/serverless-node-starter-app/handler/handler.js +34 -0
  20. package/templates/serverless-node-starter-app/jsconfig.json +35 -0
  21. package/templates/serverless-node-starter-app/manifest.json +15 -0
  22. package/templates/serverless-node-starter-app/test_data/customer_created.json +51 -0
  23. package/templates/serverless-node-starter-app/test_data/invoice_generated.json +112 -0
  24. package/templates/serverless-node-starter-app/test_data/subscription_created.json +173 -0
  25. package/templates/serverless-node-starter-app/types/types.d.ts +45 -0
  26. package/templates/serverless-node-starter-app-with-iparams/.env +4 -0
  27. package/templates/serverless-node-starter-app-with-iparams/README.md +717 -0
  28. package/templates/serverless-node-starter-app-with-iparams/handler/handler.js +39 -0
  29. package/templates/serverless-node-starter-app-with-iparams/iparams.json +41 -0
  30. package/templates/serverless-node-starter-app-with-iparams/iparams.local.json +9 -0
  31. package/templates/serverless-node-starter-app-with-iparams/jsconfig.json +35 -0
  32. package/templates/serverless-node-starter-app-with-iparams/manifest.json +15 -0
  33. package/templates/serverless-node-starter-app-with-iparams/test_data/customer_created.json +51 -0
  34. package/templates/serverless-node-starter-app-with-iparams/test_data/invoice_generated.json +112 -0
  35. package/templates/serverless-node-starter-app-with-iparams/test_data/subscription_created.json +173 -0
  36. package/templates/serverless-node-starter-app-with-iparams/types/types.d.ts +63 -0
  37. package/ui/README.md +118 -0
  38. package/ui/web/assets/css/main.css +1121 -0
  39. package/ui/web/assets/images/Chargebee-logo.png +0 -0
  40. package/ui/web/assets/js/main.js +61 -0
  41. package/ui/web/assets/js/modules/api.js +97 -0
  42. package/ui/web/assets/js/modules/constants.js +33 -0
  43. package/ui/web/assets/js/modules/editors.js +41 -0
  44. package/ui/web/assets/js/modules/events.js +195 -0
  45. package/ui/web/assets/js/modules/form-utils.js +70 -0
  46. package/ui/web/assets/js/modules/iparams-inputs.js +495 -0
  47. package/ui/web/assets/js/modules/iparams.js +82 -0
  48. package/ui/web/assets/js/modules/ui-utils.js +87 -0
  49. package/ui/web/index.html +164 -0
@@ -0,0 +1,51 @@
1
+ {
2
+ "api_version": "v2",
3
+ "content": {
4
+ "customer": {
5
+ "allow_direct_debit": false,
6
+ "auto_collection": "on",
7
+ "billing_address": {
8
+ "country": "US",
9
+ "object": "billing_address",
10
+ "validation_status": "not_validated"
11
+ },
12
+ "card_status": "no_card",
13
+ "channel": "web",
14
+ "company": "Example",
15
+ "created_at": 1755783294,
16
+ "created_from_ip": "54.88.235.200",
17
+ "deleted": false,
18
+ "email": "johndoe@example.com",
19
+ "excess_payments": 0,
20
+ "first_name": "John",
21
+ "id": "AzqUAXUuVzllT3Zr",
22
+ "last_name": "Doe",
23
+ "mrr": 0,
24
+ "net_term_days": 0,
25
+ "object": "customer",
26
+ "phone": "123 456 7890",
27
+ "pii_cleared": "active",
28
+ "preferred_currency_code": "USD",
29
+ "promotional_credits": 0,
30
+ "refundable_credits": 0,
31
+ "resource_version": 1755783294193,
32
+ "taxability": "taxable",
33
+ "unbilled_charges": 0,
34
+ "updated_at": 1755783294
35
+ }
36
+ },
37
+ "event_type": "customer_created",
38
+ "id": "ev_AzqUAXUuVzlmf3Zs",
39
+ "object": "event",
40
+ "occurred_at": 1755783294,
41
+ "source": "admin_console",
42
+ "user": "foo@bar.com",
43
+ "webhook_status": "scheduled",
44
+ "webhooks": [
45
+ {
46
+ "id": "whv2_169zTyUkn2tgg2fOQ",
47
+ "object": "webhook",
48
+ "webhook_status": "scheduled"
49
+ }
50
+ ]
51
+ }
@@ -0,0 +1,112 @@
1
+ {
2
+ "api_version": "v2",
3
+ "content": {
4
+ "invoice": {
5
+ "adjustment_credit_notes": [],
6
+ "amount_adjusted": 0,
7
+ "amount_due": 0,
8
+ "amount_paid": 0,
9
+ "amount_to_collect": 0,
10
+ "applied_credits": [],
11
+ "base_currency_code": "USD",
12
+ "billing_address": {
13
+ "company": "Example",
14
+ "country": "US",
15
+ "first_name": "John",
16
+ "last_name": "Doe",
17
+ "object": "billing_address",
18
+ "validation_status": "not_validated"
19
+ },
20
+ "channel": "web",
21
+ "credits_applied": 0,
22
+ "currency_code": "USD",
23
+ "customer_id": "AzqUAXUuVzllT3Zr",
24
+ "date": 1755783502,
25
+ "deleted": false,
26
+ "due_date": 1755783502,
27
+ "dunning_attempts": [],
28
+ "exchange_rate": 1,
29
+ "first_invoice": true,
30
+ "generated_at": 1755783502,
31
+ "has_advance_charges": false,
32
+ "id": "93",
33
+ "is_gifted": false,
34
+ "issued_credit_notes": [],
35
+ "line_items": [
36
+ {
37
+ "amount": 0,
38
+ "customer_id": "AzqUAXUuVzllT3Zr",
39
+ "date_from": 1755783502,
40
+ "date_to": 1758461902,
41
+ "description": "Plan-Free",
42
+ "discount_amount": 0,
43
+ "entity_id": "cbdemo_free",
44
+ "entity_type": "plan",
45
+ "id": "li_AzZTN3UuW0e4m3il",
46
+ "is_taxed": false,
47
+ "item_level_discount_amount": 0,
48
+ "object": "line_item",
49
+ "pricing_model": "flat_fee",
50
+ "quantity": 1,
51
+ "subscription_id": "AzZTN3UuW0e4B3ij",
52
+ "tax_amount": 0,
53
+ "tax_exempt_reason": "tax_not_configured",
54
+ "unit_amount": 0
55
+ }
56
+ ],
57
+ "linked_orders": [],
58
+ "linked_payments": [],
59
+ "net_term_days": 0,
60
+ "new_sales_amount": 0,
61
+ "object": "invoice",
62
+ "paid_at": 1755783502,
63
+ "price_type": "tax_exclusive",
64
+ "recurring": true,
65
+ "resource_version": 1755783502991,
66
+ "round_off_amount": 0,
67
+ "site_details_at_creation": {
68
+ "organization_address": {
69
+ "city": "Hyderabad",
70
+ "country_code": "IN",
71
+ "line1": "asfdgdhfjgfgf",
72
+ "organization_name": "Chargebee",
73
+ "phone": "01234565543",
74
+ "state": "Andaman and Nicobar Islands",
75
+ "state_code": "AN",
76
+ "zip": "500028"
77
+ },
78
+ "timezone": "Universal"
79
+ },
80
+ "status": "paid",
81
+ "sub_total": 0,
82
+ "subscription_id": "AzZTN3UuW0e4B3ij",
83
+ "tax": 0,
84
+ "tax_origin": {
85
+ "country": "IN"
86
+ },
87
+ "term_finalized": true,
88
+ "total": 0,
89
+ "updated_at": 1755783502,
90
+ "write_off_amount": 0
91
+ }
92
+ },
93
+ "event_type": "invoice_generated",
94
+ "id": "ev_AzZTN3UuW0e7G3in",
95
+ "object": "event",
96
+ "occurred_at": 1755783503,
97
+ "source": "admin_console",
98
+ "user": "manideep@chargebee.com",
99
+ "webhook_status": "scheduled",
100
+ "webhooks": [
101
+ {
102
+ "id": "whv2_AzZX7CUVnj5rB1ZHq",
103
+ "object": "webhook",
104
+ "webhook_status": "disabled"
105
+ },
106
+ {
107
+ "id": "whv2_169zTyUkn2tgg2fOQ",
108
+ "object": "webhook",
109
+ "webhook_status": "scheduled"
110
+ }
111
+ ]
112
+ }
@@ -0,0 +1,173 @@
1
+ {
2
+ "api_version": "v2",
3
+ "content": {
4
+ "customer": {
5
+ "allow_direct_debit": false,
6
+ "auto_collection": "on",
7
+ "billing_address": {
8
+ "country": "US",
9
+ "object": "billing_address",
10
+ "validation_status": "not_validated"
11
+ },
12
+ "card_status": "no_card",
13
+ "channel": "web",
14
+ "company": "Example",
15
+ "created_at": 1755783294,
16
+ "created_from_ip": "54.88.235.200",
17
+ "deleted": false,
18
+ "email": "johndoe@example.com",
19
+ "excess_payments": 0,
20
+ "first_name": "John",
21
+ "id": "AzqUAXUuVzllT3Zr",
22
+ "last_name": "Doe",
23
+ "mrr": 0,
24
+ "net_term_days": 0,
25
+ "object": "customer",
26
+ "phone": "123 456 7890",
27
+ "pii_cleared": "active",
28
+ "preferred_currency_code": "USD",
29
+ "promotional_credits": 0,
30
+ "refundable_credits": 0,
31
+ "resource_version": 1755783294193,
32
+ "taxability": "taxable",
33
+ "unbilled_charges": 0,
34
+ "updated_at": 1755783294
35
+ },
36
+ "invoice": {
37
+ "adjustment_credit_notes": [],
38
+ "amount_adjusted": 0,
39
+ "amount_due": 0,
40
+ "amount_paid": 0,
41
+ "amount_to_collect": 0,
42
+ "applied_credits": [],
43
+ "base_currency_code": "USD",
44
+ "billing_address": {
45
+ "company": "Example",
46
+ "country": "US",
47
+ "first_name": "John",
48
+ "last_name": "Doe",
49
+ "object": "billing_address",
50
+ "validation_status": "not_validated"
51
+ },
52
+ "channel": "web",
53
+ "credits_applied": 0,
54
+ "currency_code": "USD",
55
+ "customer_id": "AzqUAXUuVzllT3Zr",
56
+ "date": 1755783502,
57
+ "deleted": false,
58
+ "due_date": 1755783502,
59
+ "dunning_attempts": [],
60
+ "exchange_rate": 1,
61
+ "first_invoice": true,
62
+ "generated_at": 1755783502,
63
+ "has_advance_charges": false,
64
+ "id": "93",
65
+ "is_gifted": false,
66
+ "issued_credit_notes": [],
67
+ "line_items": [
68
+ {
69
+ "amount": 0,
70
+ "customer_id": "AzqUAXUuVzllT3Zr",
71
+ "date_from": 1755783502,
72
+ "date_to": 1758461902,
73
+ "description": "Plan-Free",
74
+ "discount_amount": 0,
75
+ "entity_id": "cbdemo_free",
76
+ "entity_type": "plan",
77
+ "id": "li_AzZTN3UuW0e4m3il",
78
+ "is_taxed": false,
79
+ "item_level_discount_amount": 0,
80
+ "object": "line_item",
81
+ "pricing_model": "flat_fee",
82
+ "quantity": 1,
83
+ "subscription_id": "AzZTN3UuW0e4B3ij",
84
+ "tax_amount": 0,
85
+ "tax_exempt_reason": "tax_not_configured",
86
+ "unit_amount": 0
87
+ }
88
+ ],
89
+ "linked_orders": [],
90
+ "linked_payments": [],
91
+ "net_term_days": 0,
92
+ "new_sales_amount": 0,
93
+ "object": "invoice",
94
+ "paid_at": 1755783502,
95
+ "price_type": "tax_exclusive",
96
+ "recurring": true,
97
+ "resource_version": 1755783502991,
98
+ "round_off_amount": 0,
99
+ "site_details_at_creation": {
100
+ "organization_address": {
101
+ "city": "Hyderabad",
102
+ "country_code": "IN",
103
+ "line1": "asfdgdhfjgfgf",
104
+ "organization_name": "Chargebee",
105
+ "phone": "01234565543",
106
+ "state": "Andaman and Nicobar Islands",
107
+ "state_code": "AN",
108
+ "zip": "500028"
109
+ },
110
+ "timezone": "Universal"
111
+ },
112
+ "status": "paid",
113
+ "sub_total": 0,
114
+ "subscription_id": "AzZTN3UuW0e4B3ij",
115
+ "tax": 0,
116
+ "tax_origin": {
117
+ "country": "IN"
118
+ },
119
+ "term_finalized": true,
120
+ "total": 0,
121
+ "updated_at": 1755783502,
122
+ "write_off_amount": 0
123
+ },
124
+ "subscription": {
125
+ "activated_at": 1755783502,
126
+ "billing_period": 1,
127
+ "billing_period_unit": "month",
128
+ "channel": "web",
129
+ "created_at": 1755783502,
130
+ "created_from_ip": "54.88.235.200",
131
+ "currency_code": "USD",
132
+ "current_term_end": 1758461902,
133
+ "current_term_start": 1755783502,
134
+ "customer_id": "AzqUAXUuVzllT3Zr",
135
+ "deleted": false,
136
+ "due_invoices_count": 0,
137
+ "has_scheduled_advance_invoices": false,
138
+ "has_scheduled_changes": false,
139
+ "id": "AzZTN3UuW0e4B3ij",
140
+ "mrr": 0,
141
+ "next_billing_at": 1758461902,
142
+ "object": "subscription",
143
+ "plan_amount": 0,
144
+ "plan_free_quantity": 0,
145
+ "plan_id": "cbdemo_free",
146
+ "plan_quantity": 1,
147
+ "plan_unit_price": 0,
148
+ "resource_version": 1755783503004,
149
+ "started_at": 1755783502,
150
+ "status": "active",
151
+ "updated_at": 1755783503
152
+ }
153
+ },
154
+ "event_type": "subscription_created",
155
+ "id": "ev_AzZTN3UuW0e7V3io",
156
+ "object": "event",
157
+ "occurred_at": 1755783503,
158
+ "source": "admin_console",
159
+ "user": "manideep@chargebee.com",
160
+ "webhook_status": "scheduled",
161
+ "webhooks": [
162
+ {
163
+ "id": "whv2_AzZX7CUVnj5rB1ZHq",
164
+ "object": "webhook",
165
+ "webhook_status": "scheduled"
166
+ },
167
+ {
168
+ "id": "whv2_169zTyUkn2tgg2fOQ",
169
+ "object": "webhook",
170
+ "webhook_status": "scheduled"
171
+ }
172
+ ]
173
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Type definitions for Chargebee Apps applications
3
+ * This file provides TypeScript types for common structures used in Chargebee apps
4
+ */
5
+
6
+ /**
7
+ * Event record structure for Chargebee webhook events
8
+ * This represents the actual structure of Chargebee webhook events
9
+ * Note: Event types are dynamically generated by Chargebee
10
+ * Examples include: 'customer_created', 'subscription_created', 'subscription_renewed', etc.
11
+ */
12
+ export interface EventRecord {
13
+ /** API version */
14
+ api_version: string;
15
+ /** Event content containing the actual data */
16
+ content: Record<string, any>;
17
+ /** Type of the event (e.g., 'customer_created', 'subscription_created') */
18
+ event_type: string;
19
+ /** Unique identifier for the event */
20
+ id: string;
21
+ /** Object type */
22
+ object: string;
23
+ /** Timestamp when the event occurred */
24
+ occurred_at: number;
25
+ /** Source of the event */
26
+ source: string;
27
+ /** Webhook status */
28
+ webhook_status: string;
29
+ /** Array of webhook configurations */
30
+ webhooks: Array<{
31
+ id: string;
32
+ object: string;
33
+ webhook_status: string;
34
+ }>;
35
+ }
36
+
37
+ /**
38
+ * Argument passed to every event handler.
39
+ *
40
+ * Your handler receives one argument: payload. Use payload.event to read the
41
+ * event (id, event_type, content, etc.). This template has no iparams.
42
+ */
43
+ export interface HandlerPayload {
44
+ event: EventRecord;
45
+ }
@@ -0,0 +1,4 @@
1
+ # Only these three variables are supported. Replace values for local development only. Do not add new vars.
2
+ MKPLC_CB_READ_ONLY_API=REPLACE_WITH_READ_ONLY_API_KEY
3
+ MKPLC_CB_READ_WRITE_API=REPLACE_WITH_READ_WRITE_API_KEY
4
+ MKPLC_SITE_DOMAIN=REPLACE_WITH_SITE_DOMAIN