@activepieces/piece-chargebee 0.0.2 → 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/package.json +7 -12
- package/src/index.js +13 -57
- package/src/index.d.ts +0 -5
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/cancel-subscription.d.ts +0 -21
- package/src/lib/actions/cancel-subscription.d.ts.map +0 -1
- package/src/lib/actions/cancel-subscription.js +0 -168
- package/src/lib/actions/cancel-subscription.js.map +0 -1
- package/src/lib/actions/create-customer.d.ts +0 -29
- package/src/lib/actions/create-customer.d.ts.map +0 -1
- package/src/lib/actions/create-customer.js +0 -169
- package/src/lib/actions/create-customer.js.map +0 -1
- package/src/lib/actions/create-subscription.d.ts +0 -20
- package/src/lib/actions/create-subscription.d.ts.map +0 -1
- package/src/lib/actions/create-subscription.js +0 -119
- package/src/lib/actions/create-subscription.js.map +0 -1
- package/src/lib/actions/get-customer.d.ts +0 -7
- package/src/lib/actions/get-customer.d.ts.map +0 -1
- package/src/lib/actions/get-customer.js +0 -32
- package/src/lib/actions/get-customer.js.map +0 -1
- package/src/lib/auth.d.ts +0 -5
- package/src/lib/auth.d.ts.map +0 -1
- package/src/lib/auth.js +0 -46
- package/src/lib/auth.js.map +0 -1
- package/src/lib/common/client.d.ts +0 -15
- package/src/lib/common/client.d.ts.map +0 -1
- package/src/lib/common/client.js +0 -64
- package/src/lib/common/client.js.map +0 -1
- package/src/lib/common/webhook.d.ts +0 -4
- package/src/lib/common/webhook.d.ts.map +0 -1
- package/src/lib/common/webhook.js +0 -48
- package/src/lib/common/webhook.js.map +0 -1
- package/src/lib/triggers/customer-created.d.ts +0 -15
- package/src/lib/triggers/customer-created.d.ts.map +0 -1
- package/src/lib/triggers/customer-created.js +0 -68
- package/src/lib/triggers/customer-created.js.map +0 -1
- package/src/lib/triggers/invoice-generated.d.ts +0 -15
- package/src/lib/triggers/invoice-generated.d.ts.map +0 -1
- package/src/lib/triggers/invoice-generated.js +0 -61
- package/src/lib/triggers/invoice-generated.js.map +0 -1
- package/src/lib/triggers/payment-failed.d.ts +0 -15
- package/src/lib/triggers/payment-failed.d.ts.map +0 -1
- package/src/lib/triggers/payment-failed.js +0 -92
- package/src/lib/triggers/payment-failed.js.map +0 -1
- package/src/lib/triggers/payment-succeeded.d.ts +0 -15
- package/src/lib/triggers/payment-succeeded.d.ts.map +0 -1
- package/src/lib/triggers/payment-succeeded.js +0 -92
- package/src/lib/triggers/payment-succeeded.js.map +0 -1
- package/src/lib/triggers/subscription-cancelled.d.ts +0 -15
- package/src/lib/triggers/subscription-cancelled.d.ts.map +0 -1
- package/src/lib/triggers/subscription-cancelled.js +0 -84
- package/src/lib/triggers/subscription-cancelled.js.map +0 -1
- package/src/lib/triggers/subscription-changed.d.ts +0 -15
- package/src/lib/triggers/subscription-changed.d.ts.map +0 -1
- package/src/lib/triggers/subscription-changed.js +0 -84
- package/src/lib/triggers/subscription-changed.js.map +0 -1
- package/src/lib/triggers/subscription-created.d.ts +0 -15
- package/src/lib/triggers/subscription-created.d.ts.map +0 -1
- package/src/lib/triggers/subscription-created.js +0 -84
- package/src/lib/triggers/subscription-created.js.map +0 -1
- package/src/lib/triggers/subscription-renewed.d.ts +0 -15
- package/src/lib/triggers/subscription-renewed.d.ts.map +0 -1
- package/src/lib/triggers/subscription-renewed.js +0 -84
- package/src/lib/triggers/subscription-renewed.js.map +0 -1
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cancelSubscription = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const auth_1 = require("../auth");
|
|
8
|
-
const client_1 = require("../common/client");
|
|
9
|
-
exports.cancelSubscription = (0, pieces_framework_1.createAction)({
|
|
10
|
-
name: 'cancel_subscription',
|
|
11
|
-
auth: auth_1.chargebeeAuth,
|
|
12
|
-
displayName: 'Cancel Subscription',
|
|
13
|
-
description: 'Cancel a Chargebee subscription immediately, at end of term, or on a specific date.',
|
|
14
|
-
props: {
|
|
15
|
-
subscription_id: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'Subscription ID',
|
|
17
|
-
required: true,
|
|
18
|
-
}),
|
|
19
|
-
cancel_option: pieces_framework_1.Property.StaticDropdown({
|
|
20
|
-
displayName: 'Cancel Option',
|
|
21
|
-
description: 'When to cancel the subscription. Not applicable when the subscription has a contract term — use Contract Term Cancel Option instead.',
|
|
22
|
-
required: false,
|
|
23
|
-
options: {
|
|
24
|
-
options: [
|
|
25
|
-
{ label: 'Immediately', value: 'immediately' },
|
|
26
|
-
{ label: 'End of Term', value: 'end_of_term' },
|
|
27
|
-
{ label: 'Specific Date', value: 'specific_date' },
|
|
28
|
-
{ label: 'End of Billing Term', value: 'end_of_billing_term' },
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
}),
|
|
32
|
-
cancel_at: pieces_framework_1.Property.Number({
|
|
33
|
-
displayName: 'Cancel At (Unix Seconds)',
|
|
34
|
-
description: 'UTC timestamp in seconds for when to cancel. Required when Cancel Option is "Specific Date".',
|
|
35
|
-
required: false,
|
|
36
|
-
}),
|
|
37
|
-
cancel_reason_code: pieces_framework_1.Property.ShortText({
|
|
38
|
-
displayName: 'Cancel Reason Code',
|
|
39
|
-
description: 'Reason code from Settings > Configure Chargebee > Reason Codes > Subscriptions > Subscription Cancellation. Case-sensitive.',
|
|
40
|
-
required: false,
|
|
41
|
-
}),
|
|
42
|
-
credit_option_for_current_term_charges: pieces_framework_1.Property.StaticDropdown({
|
|
43
|
-
displayName: 'Credit Option for Current Term Charges',
|
|
44
|
-
description: 'How to handle credits for current term charges when canceling immediately.',
|
|
45
|
-
required: false,
|
|
46
|
-
options: {
|
|
47
|
-
options: [
|
|
48
|
-
{ label: 'None', value: 'none' },
|
|
49
|
-
{ label: 'Prorate', value: 'prorate' },
|
|
50
|
-
{ label: 'Full', value: 'full' },
|
|
51
|
-
],
|
|
52
|
-
},
|
|
53
|
-
}),
|
|
54
|
-
unbilled_charges_option: pieces_framework_1.Property.StaticDropdown({
|
|
55
|
-
displayName: 'Unbilled Charges Option',
|
|
56
|
-
description: 'How to handle unbilled charges when canceling immediately.',
|
|
57
|
-
required: false,
|
|
58
|
-
options: {
|
|
59
|
-
options: [
|
|
60
|
-
{ label: 'Invoice', value: 'invoice' },
|
|
61
|
-
{ label: 'Delete', value: 'delete' },
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
}),
|
|
65
|
-
contract_term_cancel_option: pieces_framework_1.Property.StaticDropdown({
|
|
66
|
-
displayName: 'Contract Term Cancel Option',
|
|
67
|
-
description: 'Required when the subscription has a contract term. Determines when to cancel the subscription and contract term.',
|
|
68
|
-
required: false,
|
|
69
|
-
options: {
|
|
70
|
-
options: [
|
|
71
|
-
{ label: 'Terminate Immediately', value: 'terminate_immediately' },
|
|
72
|
-
{ label: 'End of Contract Term', value: 'end_of_contract_term' },
|
|
73
|
-
{ label: 'Specific Date', value: 'specific_date' },
|
|
74
|
-
{
|
|
75
|
-
label: 'End of Subscription Billing Term',
|
|
76
|
-
value: 'end_of_subscription_billing_term',
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
},
|
|
80
|
-
}),
|
|
81
|
-
account_receivables_handling: pieces_framework_1.Property.StaticDropdown({
|
|
82
|
-
displayName: 'Account Receivables Handling',
|
|
83
|
-
description: 'How to handle past due invoices when canceling immediately.',
|
|
84
|
-
required: false,
|
|
85
|
-
options: {
|
|
86
|
-
options: [
|
|
87
|
-
{ label: 'No Action', value: 'no_action' },
|
|
88
|
-
{
|
|
89
|
-
label: 'Schedule Payment Collection',
|
|
90
|
-
value: 'schedule_payment_collection',
|
|
91
|
-
},
|
|
92
|
-
{ label: 'Write Off', value: 'write_off' },
|
|
93
|
-
],
|
|
94
|
-
},
|
|
95
|
-
}),
|
|
96
|
-
refundable_credits_handling: pieces_framework_1.Property.StaticDropdown({
|
|
97
|
-
displayName: 'Refundable Credits Handling',
|
|
98
|
-
description: 'How to handle refundable credits when canceling immediately.',
|
|
99
|
-
required: false,
|
|
100
|
-
options: {
|
|
101
|
-
options: [
|
|
102
|
-
{ label: 'No Action', value: 'no_action' },
|
|
103
|
-
{ label: 'Schedule Refund', value: 'schedule_refund' },
|
|
104
|
-
],
|
|
105
|
-
},
|
|
106
|
-
}),
|
|
107
|
-
invoice_date: pieces_framework_1.Property.Number({
|
|
108
|
-
displayName: 'Invoice Date (Unix Seconds)',
|
|
109
|
-
description: 'Document date displayed on the invoice PDF. Defaults to the current date. Provide to backdate the invoice.',
|
|
110
|
-
required: false,
|
|
111
|
-
}),
|
|
112
|
-
decommissioned: pieces_framework_1.Property.Checkbox({
|
|
113
|
-
displayName: 'Decommission',
|
|
114
|
-
description: 'When true, all subscription operations will be disabled except deletion. This is irreversible.',
|
|
115
|
-
required: false,
|
|
116
|
-
}),
|
|
117
|
-
termination_fee_item_price_id: pieces_framework_1.Property.ShortText({
|
|
118
|
-
displayName: 'Termination Fee Item Price ID',
|
|
119
|
-
description: 'The unique ID of the charge item price representing the termination fee. Used only when the subscription has a contract term.',
|
|
120
|
-
required: false,
|
|
121
|
-
}),
|
|
122
|
-
termination_fee_quantity: pieces_framework_1.Property.Number({
|
|
123
|
-
displayName: 'Termination Fee Quantity',
|
|
124
|
-
description: 'Quantity for the termination fee. Applicable only for quantity-based item prices.',
|
|
125
|
-
required: false,
|
|
126
|
-
}),
|
|
127
|
-
termination_fee_unit_price: pieces_framework_1.Property.Number({
|
|
128
|
-
displayName: 'Termination Fee Unit Price (cents)',
|
|
129
|
-
description: 'The termination fee in cents. For quantity-based items, this is the fee per unit.',
|
|
130
|
-
required: false,
|
|
131
|
-
}),
|
|
132
|
-
termination_fee_service_period_days: pieces_framework_1.Property.Number({
|
|
133
|
-
displayName: 'Termination Fee Service Period (Days)',
|
|
134
|
-
description: 'Service period of the termination fee in days, starting from the current date.',
|
|
135
|
-
required: false,
|
|
136
|
-
}),
|
|
137
|
-
},
|
|
138
|
-
run(context) {
|
|
139
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
140
|
-
const { subscription_id, cancel_option, cancel_at, cancel_reason_code, credit_option_for_current_term_charges, unbilled_charges_option, contract_term_cancel_option, account_receivables_handling, refundable_credits_handling, invoice_date, decommissioned, termination_fee_item_price_id, termination_fee_quantity, termination_fee_unit_price, termination_fee_service_period_days, } = context.propsValue;
|
|
141
|
-
const body = (0, client_1.cleanObject)({
|
|
142
|
-
cancel_option,
|
|
143
|
-
cancel_at,
|
|
144
|
-
cancel_reason_code,
|
|
145
|
-
credit_option_for_current_term_charges,
|
|
146
|
-
unbilled_charges_option,
|
|
147
|
-
contract_term_cancel_option,
|
|
148
|
-
account_receivables_handling,
|
|
149
|
-
refundable_credits_handling,
|
|
150
|
-
invoice_date,
|
|
151
|
-
decommissioned,
|
|
152
|
-
'subscription_items[item_price_id][0]': termination_fee_item_price_id,
|
|
153
|
-
'subscription_items[quantity][0]': termination_fee_quantity,
|
|
154
|
-
'subscription_items[unit_price][0]': termination_fee_unit_price,
|
|
155
|
-
'subscription_items[service_period_days][0]': termination_fee_service_period_days,
|
|
156
|
-
});
|
|
157
|
-
return yield (0, client_1.chargebeeRequest)({
|
|
158
|
-
site: context.auth.props.site,
|
|
159
|
-
apiKey: context.auth.props.api_key,
|
|
160
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
161
|
-
path: `/subscriptions/${encodeURIComponent(subscription_id)}/cancel_for_items`,
|
|
162
|
-
contentType: 'application/x-www-form-urlencoded',
|
|
163
|
-
body,
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
|
-
//# sourceMappingURL=cancel-subscription.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"c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KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EACJ,eAAe,EACf,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,sCAAsC,EACtC,uBAAuB,EACvB,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,EAC3B,YAAY,EACZ,cAAc,EACd,6BAA6B,EAC7B,wBAAwB,EACxB,0BAA0B,EAC1B,mCAAmC,GACpC,GAAG,OAAO,CAAC,UAAU,CAAC;YAEvB,MAAM,IAAI,GAAG,IAAA,oBAAW,EAAC;gBACvB,aAAa;gBACb,SAAS;gBACT,kBAAkB;gBAClB,sCAAsC;gBACtC,uBAAuB;gBACvB,2BAA2B;gBAC3B,4BAA4B;gBAC5B,2BAA2B;gBAC3B,YAAY;gBACZ,cAAc;gBACd,sCAAsC,EAAE,6BAA6B;gBACrE,iCAAiC,EAAE,wBAAwB;gBAC3D,mCAAmC,EAAE,0BAA0B;gBAC/D,4CAA4C,EAC1C,mCAAmC;aACtC,CAAC,CAAC;YAEH,OAAO,MAAM,IAAA,yBAAgB,EAAC;gBAC5B,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI;gBAC7B,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO;gBAClC,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,eAAe,CAAC,mBAAmB;gBAC9E,WAAW,EAAE,mCAAmC;gBAChD,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export declare const createCustomer: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
}>, {
|
|
5
|
-
id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
-
first_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
-
last_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
-
email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
-
company: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
-
phone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
-
locale: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
-
preferred_currency_code: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
-
auto_collection: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
14
|
-
net_term_days: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
15
|
-
allow_direct_debit: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
16
|
-
vat_number: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
17
|
-
taxability: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
18
|
-
invoice_notes: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
19
|
-
meta_data: import("@activepieces/pieces-framework").ObjectProperty<false>;
|
|
20
|
-
billing_address_first_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
21
|
-
billing_address_last_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
22
|
-
billing_address_line1: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
23
|
-
billing_address_line2: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
24
|
-
billing_address_city: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
25
|
-
billing_address_state: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
26
|
-
billing_address_zip: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
27
|
-
billing_address_country: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
28
|
-
}>;
|
|
29
|
-
//# sourceMappingURL=create-customer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-customer.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-customer.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsLzB,CAAC"}
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCustomer = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const auth_1 = require("../auth");
|
|
8
|
-
const client_1 = require("../common/client");
|
|
9
|
-
exports.createCustomer = (0, pieces_framework_1.createAction)({
|
|
10
|
-
name: 'create_customer',
|
|
11
|
-
auth: auth_1.chargebeeAuth,
|
|
12
|
-
displayName: 'Create Customer',
|
|
13
|
-
description: 'Create a customer in Chargebee.',
|
|
14
|
-
props: {
|
|
15
|
-
id: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'Customer ID',
|
|
17
|
-
description: 'Optional custom customer identifier.',
|
|
18
|
-
required: false,
|
|
19
|
-
}),
|
|
20
|
-
first_name: pieces_framework_1.Property.ShortText({
|
|
21
|
-
displayName: 'First Name',
|
|
22
|
-
required: false,
|
|
23
|
-
}),
|
|
24
|
-
last_name: pieces_framework_1.Property.ShortText({
|
|
25
|
-
displayName: 'Last Name',
|
|
26
|
-
required: false,
|
|
27
|
-
}),
|
|
28
|
-
email: pieces_framework_1.Property.ShortText({
|
|
29
|
-
displayName: 'Email',
|
|
30
|
-
required: false,
|
|
31
|
-
}),
|
|
32
|
-
company: pieces_framework_1.Property.ShortText({
|
|
33
|
-
displayName: 'Company',
|
|
34
|
-
required: false,
|
|
35
|
-
}),
|
|
36
|
-
phone: pieces_framework_1.Property.ShortText({
|
|
37
|
-
displayName: 'Phone',
|
|
38
|
-
required: false,
|
|
39
|
-
}),
|
|
40
|
-
locale: pieces_framework_1.Property.ShortText({
|
|
41
|
-
displayName: 'Locale',
|
|
42
|
-
description: 'For example: en-US, fr-CA.',
|
|
43
|
-
required: false,
|
|
44
|
-
}),
|
|
45
|
-
preferred_currency_code: pieces_framework_1.Property.ShortText({
|
|
46
|
-
displayName: 'Preferred Currency Code',
|
|
47
|
-
description: 'ISO 4217 currency code (e.g. USD, EUR). Requires Multi-currency pricing to be enabled.',
|
|
48
|
-
required: false,
|
|
49
|
-
}),
|
|
50
|
-
auto_collection: pieces_framework_1.Property.StaticDropdown({
|
|
51
|
-
displayName: 'Auto Collection',
|
|
52
|
-
description: 'Whether invoices should be automatically charged when possible.',
|
|
53
|
-
required: false,
|
|
54
|
-
options: {
|
|
55
|
-
options: [
|
|
56
|
-
{ label: 'On', value: 'on' },
|
|
57
|
-
{ label: 'Off', value: 'off' },
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
}),
|
|
61
|
-
net_term_days: pieces_framework_1.Property.Number({
|
|
62
|
-
displayName: 'Net Term Days',
|
|
63
|
-
description: 'Number of days within which the customer must pay their invoices.',
|
|
64
|
-
required: false,
|
|
65
|
-
}),
|
|
66
|
-
allow_direct_debit: pieces_framework_1.Property.Checkbox({
|
|
67
|
-
displayName: 'Allow Direct Debit',
|
|
68
|
-
description: 'Whether the customer can pay via Direct Debit.',
|
|
69
|
-
required: false,
|
|
70
|
-
}),
|
|
71
|
-
vat_number: pieces_framework_1.Property.ShortText({
|
|
72
|
-
displayName: 'VAT Number',
|
|
73
|
-
description: 'The VAT/tax registration number for the customer.',
|
|
74
|
-
required: false,
|
|
75
|
-
}),
|
|
76
|
-
taxability: pieces_framework_1.Property.StaticDropdown({
|
|
77
|
-
displayName: 'Taxability',
|
|
78
|
-
description: 'Specifies if the customer is liable for tax.',
|
|
79
|
-
required: false,
|
|
80
|
-
options: {
|
|
81
|
-
options: [
|
|
82
|
-
{ label: 'Taxable', value: 'taxable' },
|
|
83
|
-
{ label: 'Exempt', value: 'exempt' },
|
|
84
|
-
],
|
|
85
|
-
},
|
|
86
|
-
}),
|
|
87
|
-
invoice_notes: pieces_framework_1.Property.LongText({
|
|
88
|
-
displayName: 'Invoice Notes',
|
|
89
|
-
description: 'A customer-facing note added to all invoices for this customer.',
|
|
90
|
-
required: false,
|
|
91
|
-
}),
|
|
92
|
-
meta_data: pieces_framework_1.Property.Object({
|
|
93
|
-
displayName: 'Metadata',
|
|
94
|
-
description: 'Key-value pairs to store extra information on the customer.',
|
|
95
|
-
required: false,
|
|
96
|
-
}),
|
|
97
|
-
billing_address_first_name: pieces_framework_1.Property.ShortText({
|
|
98
|
-
displayName: 'Billing Address: First Name',
|
|
99
|
-
required: false,
|
|
100
|
-
}),
|
|
101
|
-
billing_address_last_name: pieces_framework_1.Property.ShortText({
|
|
102
|
-
displayName: 'Billing Address: Last Name',
|
|
103
|
-
required: false,
|
|
104
|
-
}),
|
|
105
|
-
billing_address_line1: pieces_framework_1.Property.ShortText({
|
|
106
|
-
displayName: 'Billing Address: Line 1',
|
|
107
|
-
required: false,
|
|
108
|
-
}),
|
|
109
|
-
billing_address_line2: pieces_framework_1.Property.ShortText({
|
|
110
|
-
displayName: 'Billing Address: Line 2',
|
|
111
|
-
required: false,
|
|
112
|
-
}),
|
|
113
|
-
billing_address_city: pieces_framework_1.Property.ShortText({
|
|
114
|
-
displayName: 'Billing Address: City',
|
|
115
|
-
required: false,
|
|
116
|
-
}),
|
|
117
|
-
billing_address_state: pieces_framework_1.Property.ShortText({
|
|
118
|
-
displayName: 'Billing Address: State',
|
|
119
|
-
required: false,
|
|
120
|
-
}),
|
|
121
|
-
billing_address_zip: pieces_framework_1.Property.ShortText({
|
|
122
|
-
displayName: 'Billing Address: ZIP / Postal Code',
|
|
123
|
-
required: false,
|
|
124
|
-
}),
|
|
125
|
-
billing_address_country: pieces_framework_1.Property.ShortText({
|
|
126
|
-
displayName: 'Billing Address: Country',
|
|
127
|
-
description: 'Two-letter ISO 3166-1 alpha-2 country code (e.g. US, GB).',
|
|
128
|
-
required: false,
|
|
129
|
-
}),
|
|
130
|
-
},
|
|
131
|
-
run(context) {
|
|
132
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
133
|
-
const { id, first_name, last_name, email, company, phone, locale, preferred_currency_code, auto_collection, net_term_days, allow_direct_debit, vat_number, taxability, invoice_notes, meta_data, billing_address_first_name, billing_address_last_name, billing_address_line1, billing_address_line2, billing_address_city, billing_address_state, billing_address_zip, billing_address_country, } = context.propsValue;
|
|
134
|
-
return yield (0, client_1.chargebeeRequest)({
|
|
135
|
-
site: context.auth.props.site,
|
|
136
|
-
apiKey: context.auth.props.api_key,
|
|
137
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
138
|
-
path: '/customers',
|
|
139
|
-
contentType: 'application/x-www-form-urlencoded',
|
|
140
|
-
body: (0, client_1.cleanObject)({
|
|
141
|
-
id,
|
|
142
|
-
first_name,
|
|
143
|
-
last_name,
|
|
144
|
-
email,
|
|
145
|
-
company,
|
|
146
|
-
phone,
|
|
147
|
-
locale,
|
|
148
|
-
preferred_currency_code,
|
|
149
|
-
auto_collection,
|
|
150
|
-
net_term_days,
|
|
151
|
-
allow_direct_debit,
|
|
152
|
-
vat_number,
|
|
153
|
-
taxability,
|
|
154
|
-
invoice_notes,
|
|
155
|
-
meta_data: meta_data ? JSON.stringify(meta_data) : undefined,
|
|
156
|
-
'billing_address[first_name]': billing_address_first_name,
|
|
157
|
-
'billing_address[last_name]': billing_address_last_name,
|
|
158
|
-
'billing_address[line1]': billing_address_line1,
|
|
159
|
-
'billing_address[line2]': billing_address_line2,
|
|
160
|
-
'billing_address[city]': billing_address_city,
|
|
161
|
-
'billing_address[state]': billing_address_state,
|
|
162
|
-
'billing_address[zip]': billing_address_zip,
|
|
163
|
-
'billing_address[country]': billing_address_country,
|
|
164
|
-
}),
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
},
|
|
168
|
-
});
|
|
169
|
-
//# sourceMappingURL=create-customer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-customer.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-customer.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AAExE,kCAAwC;AACxC,6CAAiE;AAEpD,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,oBAAa;IACnB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,iCAAiC;IAC9C,KAAK,EAAE;QACL,EAAE,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrB,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,sCAAsC;YACnD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,uBAAuB,EAAE,2BAAQ,CAAC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UAAU,EACV,UAAU,EACV,aAAa,EACb,SAAS,EACT,0BAA0B,EAC1B,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,GACxB,GAAG,OAAO,CAAC,UAAU,CAAC;YAEvB,OAAO,MAAM,IAAA,yBAAgB,EAAC;gBAC5B,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI;gBAC7B,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO;gBAClC,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,IAAI,EAAE,YAAY;gBAClB,WAAW,EAAE,mCAAmC;gBAChD,IAAI,EAAE,IAAA,oBAAW,EAAC;oBAChB,EAAE;oBACF,UAAU;oBACV,SAAS;oBACT,KAAK;oBACL,OAAO;oBACP,KAAK;oBACL,MAAM;oBACN,uBAAuB;oBACvB,eAAe;oBACf,aAAa;oBACb,kBAAkB;oBAClB,UAAU;oBACV,UAAU;oBACV,aAAa;oBACb,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS;oBAC5D,6BAA6B,EAAE,0BAA0B;oBACzD,4BAA4B,EAAE,yBAAyB;oBACvD,wBAAwB,EAAE,qBAAqB;oBAC/C,wBAAwB,EAAE,qBAAqB;oBAC/C,uBAAuB,EAAE,oBAAoB;oBAC7C,wBAAwB,EAAE,qBAAqB;oBAC/C,sBAAsB,EAAE,mBAAmB;oBAC3C,0BAA0B,EAAE,uBAAuB;iBACpD,CAAC;aACH,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare const createSubscription: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
}>, {
|
|
5
|
-
customer_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
item_price_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
quantity: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
8
|
-
auto_collection: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
9
|
-
billing_cycles: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
10
|
-
trial_end: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
11
|
-
start_date: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
12
|
-
coupon_ids: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
-
po_number: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
14
|
-
invoice_notes: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
15
|
-
payment_source_id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
16
|
-
invoice_immediately: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
17
|
-
net_term_days: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
18
|
-
meta_data: import("@activepieces/pieces-framework").ObjectProperty<false>;
|
|
19
|
-
}>;
|
|
20
|
-
//# sourceMappingURL=create-subscription.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-subscription.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-subscription.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;EAsI7B,CAAC"}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSubscription = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const auth_1 = require("../auth");
|
|
8
|
-
const client_1 = require("../common/client");
|
|
9
|
-
exports.createSubscription = (0, pieces_framework_1.createAction)({
|
|
10
|
-
name: 'create_subscription',
|
|
11
|
-
auth: auth_1.chargebeeAuth,
|
|
12
|
-
displayName: 'Create Subscription',
|
|
13
|
-
description: 'Create a subscription for an existing customer using a Chargebee item price.',
|
|
14
|
-
props: {
|
|
15
|
-
customer_id: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'Customer ID',
|
|
17
|
-
required: true,
|
|
18
|
-
}),
|
|
19
|
-
item_price_id: pieces_framework_1.Property.ShortText({
|
|
20
|
-
displayName: 'Item Price ID',
|
|
21
|
-
description: 'The Chargebee item price ID to subscribe the customer to.',
|
|
22
|
-
required: true,
|
|
23
|
-
}),
|
|
24
|
-
quantity: pieces_framework_1.Property.Number({
|
|
25
|
-
displayName: 'Quantity',
|
|
26
|
-
required: false,
|
|
27
|
-
}),
|
|
28
|
-
auto_collection: pieces_framework_1.Property.StaticDropdown({
|
|
29
|
-
displayName: 'Auto Collection',
|
|
30
|
-
description: 'Whether to automatically charge the customer. Defaults to the customer setting.',
|
|
31
|
-
required: false,
|
|
32
|
-
options: {
|
|
33
|
-
options: [
|
|
34
|
-
{ label: 'On', value: 'on' },
|
|
35
|
-
{ label: 'Off', value: 'off' },
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
}),
|
|
39
|
-
billing_cycles: pieces_framework_1.Property.Number({
|
|
40
|
-
displayName: 'Billing Cycles',
|
|
41
|
-
description: 'Number of billing cycles before the subscription ends. Defaults to the item price setting.',
|
|
42
|
-
required: false,
|
|
43
|
-
}),
|
|
44
|
-
trial_end: pieces_framework_1.Property.Number({
|
|
45
|
-
displayName: 'Trial End (Unix Seconds)',
|
|
46
|
-
description: 'UTC timestamp in seconds when the trial period ends. Set to 0 for no trial.',
|
|
47
|
-
required: false,
|
|
48
|
-
}),
|
|
49
|
-
start_date: pieces_framework_1.Property.Number({
|
|
50
|
-
displayName: 'Start Date (Unix Seconds)',
|
|
51
|
-
description: 'UTC timestamp in seconds when the subscription starts. Defaults to now. Provide a past value to backdate.',
|
|
52
|
-
required: false,
|
|
53
|
-
}),
|
|
54
|
-
coupon_ids: pieces_framework_1.Property.ShortText({
|
|
55
|
-
displayName: 'Coupon ID',
|
|
56
|
-
description: 'A coupon ID or code to apply to this subscription.',
|
|
57
|
-
required: false,
|
|
58
|
-
}),
|
|
59
|
-
po_number: pieces_framework_1.Property.ShortText({
|
|
60
|
-
displayName: 'PO Number',
|
|
61
|
-
description: 'Purchase order number to associate with this subscription.',
|
|
62
|
-
required: false,
|
|
63
|
-
}),
|
|
64
|
-
invoice_notes: pieces_framework_1.Property.LongText({
|
|
65
|
-
displayName: 'Invoice Notes',
|
|
66
|
-
description: 'Customer-facing note added to all invoices for this subscription.',
|
|
67
|
-
required: false,
|
|
68
|
-
}),
|
|
69
|
-
payment_source_id: pieces_framework_1.Property.ShortText({
|
|
70
|
-
displayName: 'Payment Source ID',
|
|
71
|
-
description: 'ID of the payment source to attach to this subscription.',
|
|
72
|
-
required: false,
|
|
73
|
-
}),
|
|
74
|
-
invoice_immediately: pieces_framework_1.Property.Checkbox({
|
|
75
|
-
displayName: 'Invoice Immediately',
|
|
76
|
-
description: 'Invoice any charges raised at creation time immediately rather than adding them to unbilled charges.',
|
|
77
|
-
required: false,
|
|
78
|
-
}),
|
|
79
|
-
net_term_days: pieces_framework_1.Property.Number({
|
|
80
|
-
displayName: 'Net Term Days',
|
|
81
|
-
description: 'Number of days within which invoices for this subscription must be paid (Net D). Must match a value configured in Chargebee.',
|
|
82
|
-
required: false,
|
|
83
|
-
}),
|
|
84
|
-
meta_data: pieces_framework_1.Property.Object({
|
|
85
|
-
displayName: 'Metadata',
|
|
86
|
-
description: 'Key-value pairs to store extra information on the subscription.',
|
|
87
|
-
required: false,
|
|
88
|
-
}),
|
|
89
|
-
},
|
|
90
|
-
run(context) {
|
|
91
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
const { customer_id, item_price_id, quantity, auto_collection, billing_cycles, trial_end, start_date, coupon_ids, po_number, invoice_notes, payment_source_id, invoice_immediately, net_term_days, meta_data, } = context.propsValue;
|
|
93
|
-
const body = (0, client_1.cleanObject)({
|
|
94
|
-
auto_collection,
|
|
95
|
-
billing_cycles,
|
|
96
|
-
trial_end,
|
|
97
|
-
start_date,
|
|
98
|
-
'coupon_ids[0]': coupon_ids,
|
|
99
|
-
po_number,
|
|
100
|
-
invoice_notes,
|
|
101
|
-
payment_source_id,
|
|
102
|
-
invoice_immediately,
|
|
103
|
-
net_term_days,
|
|
104
|
-
meta_data: meta_data ? JSON.stringify(meta_data) : undefined,
|
|
105
|
-
'subscription_items[item_price_id][0]': item_price_id,
|
|
106
|
-
'subscription_items[quantity][0]': quantity,
|
|
107
|
-
});
|
|
108
|
-
return yield (0, client_1.chargebeeRequest)({
|
|
109
|
-
site: context.auth.props.site,
|
|
110
|
-
apiKey: context.auth.props.api_key,
|
|
111
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
112
|
-
path: `/customers/${customer_id}/subscription_for_items`,
|
|
113
|
-
contentType: 'application/x-www-form-urlencoded',
|
|
114
|
-
body,
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
},
|
|
118
|
-
});
|
|
119
|
-
//# sourceMappingURL=create-subscription.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-subscription.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-subscription.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AAExE,kCAAwC;AACxC,6CAAiE;AAEpD,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,oBAAa;IACnB,WAAW,EAAE,qBAAqB;IAClC,WAAW,EACT,8EAA8E;IAChF,KAAK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AC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS;gBAC5D,sCAAsC,EAAE,aAAa;gBACrD,iCAAiC,EAAE,QAAQ;aAC5C,CAAC,CAAC;YAEH,OAAO,MAAM,IAAA,yBAAgB,EAAC;gBAC5B,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI;gBAC7B,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO;gBAClC,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,IAAI,EAAE,cAAc,WAAW,yBAAyB;gBACxD,WAAW,EAAE,mCAAmC;gBAChD,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const getCustomer: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
}>, {
|
|
5
|
-
customer_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=get-customer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-customer.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-customer.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW;;;;;EAqBtB,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCustomer = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const auth_1 = require("../auth");
|
|
8
|
-
const client_1 = require("../common/client");
|
|
9
|
-
exports.getCustomer = (0, pieces_framework_1.createAction)({
|
|
10
|
-
name: 'get_customer',
|
|
11
|
-
auth: auth_1.chargebeeAuth,
|
|
12
|
-
displayName: 'Get Customer',
|
|
13
|
-
description: 'Retrieve a customer from Chargebee by ID.',
|
|
14
|
-
props: {
|
|
15
|
-
customer_id: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'Customer ID',
|
|
17
|
-
required: true,
|
|
18
|
-
}),
|
|
19
|
-
},
|
|
20
|
-
run(context) {
|
|
21
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const { customer_id } = context.propsValue;
|
|
23
|
-
return yield (0, client_1.chargebeeRequest)({
|
|
24
|
-
site: context.auth.props.site,
|
|
25
|
-
apiKey: context.auth.props.api_key,
|
|
26
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
27
|
-
path: `/customers/${encodeURIComponent(customer_id)}`,
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
//# sourceMappingURL=get-customer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-customer.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-customer.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AAExE,kCAAwC;AACxC,6CAAoD;AAEvC,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,oBAAa;IACnB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,2CAA2C;IACxD,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE3C,OAAO,MAAM,IAAA,yBAAgB,EAAC;gBAC5B,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI;gBAC7B,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO;gBAClC,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,cAAc,kBAAkB,CAAC,WAAW,CAAC,EAAE;aACtD,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
|
package/src/lib/auth.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const chargebeeAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
site: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
api_key: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
}>;
|
|
5
|
-
//# sourceMappingURL=auth.d.ts.map
|
package/src/lib/auth.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;;EAwCxB,CAAC"}
|