@carrierllc/sdk 0.2.1 → 0.2.2
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 +1 -1
- package/dist/client.d.ts +11 -1
- package/dist/client.js +7 -0
- package/dist/data/operations.json +130 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/operation-ids.d.ts +1 -1
- package/dist/storefront-labels.d.ts +44 -0
- package/dist/storefront-labels.js +168 -0
- package/dist/storefront-write.d.ts +79 -0
- package/dist/storefront-write.js +157 -0
- package/dist/types.d.ts +44 -0
- package/dist/version.d.ts +2 -2
- package/dist/version.js +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -35,4 +35,4 @@ const agentTools = restTools(carrier)
|
|
|
35
35
|
|
|
36
36
|
`new Mcp(token, { auth: "bearer" })` sends an OAuth access token or a Clerk organization API key. The default sends `?TOKEN=` to `https://mcp.carrier.llc/mcp`. `Cli` never invokes a shell. Catalog entries marked `internal` do not accept a customer API key.
|
|
37
37
|
|
|
38
|
-
`npm install @carrierllc/sdk@0.2.
|
|
38
|
+
`npm install @carrierllc/sdk@0.2.2` installs this surface. `0.1.0` only creates connectivity intents and products. The published tarball is the compiled `dist` output, including the generated operation catalog.
|
package/dist/client.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { OperationId } from "./operation-ids.js";
|
|
9
9
|
import { type CallParams } from "./operations.js";
|
|
10
|
-
import type { ConnectivityIntent, ConnectivityPlan, IdempotentRequest, IntentCreateParams, ProductCreateParams } from "./types.js";
|
|
10
|
+
import type { ConnectivityIntent, ConnectivityPlan, HostedStorefront, IdempotentRequest, IntentCreateParams, ProductCreateParams, StorefrontCreateParams, StorefrontPlanParams, StorefrontUpdateParams } from "./types.js";
|
|
11
11
|
export interface CarrierOptions {
|
|
12
12
|
/** Defaults to https://api.carrier.llc. No trailing slash required. */
|
|
13
13
|
baseUrl?: string;
|
|
@@ -24,6 +24,16 @@ export declare class Carrier {
|
|
|
24
24
|
readonly products: {
|
|
25
25
|
create: (body: ProductCreateParams, options: IdempotentRequest) => Promise<ConnectivityPlan>;
|
|
26
26
|
};
|
|
27
|
+
readonly storefronts: {
|
|
28
|
+
list: () => Promise<{
|
|
29
|
+
data: HostedStorefront[];
|
|
30
|
+
}>;
|
|
31
|
+
create: (body: StorefrontCreateParams, options: IdempotentRequest) => Promise<HostedStorefront>;
|
|
32
|
+
update: (id: string, body: StorefrontUpdateParams) => Promise<HostedStorefront>;
|
|
33
|
+
upsertPlan: (id: string, body: StorefrontPlanParams) => Promise<{
|
|
34
|
+
slug: string;
|
|
35
|
+
}>;
|
|
36
|
+
};
|
|
27
37
|
constructor(apiKey: string, options?: CarrierOptions);
|
|
28
38
|
/** Call any operation id from the public OpenAPI document. */
|
|
29
39
|
call(operationId: OperationId, params?: CallParams): Promise<unknown>;
|
package/dist/client.js
CHANGED
|
@@ -15,6 +15,7 @@ export class Carrier {
|
|
|
15
15
|
fetchImpl;
|
|
16
16
|
intents;
|
|
17
17
|
products;
|
|
18
|
+
storefronts;
|
|
18
19
|
constructor(apiKey, options = {}) {
|
|
19
20
|
if (apiKey.trim() === "") {
|
|
20
21
|
throw new CarrierError(400, "invalid_api_key", "A Carrier API key is required.");
|
|
@@ -28,6 +29,12 @@ export class Carrier {
|
|
|
28
29
|
this.products = {
|
|
29
30
|
create: (body, request) => this.post("/v1/connectivity/products", body, request.idempotencyKey),
|
|
30
31
|
};
|
|
32
|
+
this.storefronts = {
|
|
33
|
+
list: () => this.request("GET", "/v1/storefronts", {}),
|
|
34
|
+
create: (body, request) => this.post("/v1/storefronts", body, request.idempotencyKey),
|
|
35
|
+
update: (id, body) => this.request("PATCH", `/v1/storefronts/${encodeURIComponent(id)}`, { body }),
|
|
36
|
+
upsertPlan: (id, body) => this.request("POST", `/v1/storefronts/${encodeURIComponent(id)}/plans`, { body }),
|
|
37
|
+
};
|
|
31
38
|
}
|
|
32
39
|
/** Call any operation id from the public OpenAPI document. */
|
|
33
40
|
async call(operationId, params = {}) {
|
|
@@ -2500,6 +2500,28 @@
|
|
|
2500
2500
|
"queryParams": [],
|
|
2501
2501
|
"headerParams": []
|
|
2502
2502
|
},
|
|
2503
|
+
{
|
|
2504
|
+
"id": "list_storefront_buyer_orders",
|
|
2505
|
+
"method": "GET",
|
|
2506
|
+
"path": "/api/orders",
|
|
2507
|
+
"tag": "Storefront",
|
|
2508
|
+
"summary": "List eSIMs one buyer paid for on one shop",
|
|
2509
|
+
"security": "storefront",
|
|
2510
|
+
"body": false,
|
|
2511
|
+
"bodyRequired": false,
|
|
2512
|
+
"pathParams": [],
|
|
2513
|
+
"queryParams": [
|
|
2514
|
+
{
|
|
2515
|
+
"name": "storefront",
|
|
2516
|
+
"required": true
|
|
2517
|
+
},
|
|
2518
|
+
{
|
|
2519
|
+
"name": "email",
|
|
2520
|
+
"required": true
|
|
2521
|
+
}
|
|
2522
|
+
],
|
|
2523
|
+
"headerParams": []
|
|
2524
|
+
},
|
|
2503
2525
|
{
|
|
2504
2526
|
"id": "get_storefront_order",
|
|
2505
2527
|
"method": "GET",
|
|
@@ -2515,6 +2537,114 @@
|
|
|
2515
2537
|
"required": true
|
|
2516
2538
|
}
|
|
2517
2539
|
],
|
|
2540
|
+
"queryParams": [
|
|
2541
|
+
{
|
|
2542
|
+
"name": "storefront",
|
|
2543
|
+
"required": false
|
|
2544
|
+
}
|
|
2545
|
+
],
|
|
2546
|
+
"headerParams": []
|
|
2547
|
+
},
|
|
2548
|
+
{
|
|
2549
|
+
"id": "get_hosted_storefront",
|
|
2550
|
+
"method": "GET",
|
|
2551
|
+
"path": "/api/hosted/{slug}",
|
|
2552
|
+
"tag": "Storefront",
|
|
2553
|
+
"summary": "Published hosted storefront, including its sellable plans",
|
|
2554
|
+
"security": "public",
|
|
2555
|
+
"body": false,
|
|
2556
|
+
"bodyRequired": false,
|
|
2557
|
+
"pathParams": [
|
|
2558
|
+
{
|
|
2559
|
+
"name": "slug",
|
|
2560
|
+
"required": true
|
|
2561
|
+
}
|
|
2562
|
+
],
|
|
2563
|
+
"queryParams": [],
|
|
2564
|
+
"headerParams": []
|
|
2565
|
+
},
|
|
2566
|
+
{
|
|
2567
|
+
"id": "list_storefronts",
|
|
2568
|
+
"method": "GET",
|
|
2569
|
+
"path": "/v1/storefronts",
|
|
2570
|
+
"tag": "Storefront",
|
|
2571
|
+
"summary": "List hosted storefronts for the caller's organization",
|
|
2572
|
+
"security": "bearer",
|
|
2573
|
+
"body": false,
|
|
2574
|
+
"bodyRequired": false,
|
|
2575
|
+
"pathParams": [],
|
|
2576
|
+
"queryParams": [],
|
|
2577
|
+
"headerParams": []
|
|
2578
|
+
},
|
|
2579
|
+
{
|
|
2580
|
+
"id": "create_storefront",
|
|
2581
|
+
"method": "POST",
|
|
2582
|
+
"path": "/v1/storefronts",
|
|
2583
|
+
"tag": "Storefront",
|
|
2584
|
+
"summary": "Create a hosted storefront",
|
|
2585
|
+
"security": "bearer",
|
|
2586
|
+
"body": true,
|
|
2587
|
+
"bodyRequired": true,
|
|
2588
|
+
"pathParams": [],
|
|
2589
|
+
"queryParams": [],
|
|
2590
|
+
"headerParams": [
|
|
2591
|
+
{
|
|
2592
|
+
"name": "Idempotency-Key",
|
|
2593
|
+
"required": true
|
|
2594
|
+
}
|
|
2595
|
+
]
|
|
2596
|
+
},
|
|
2597
|
+
{
|
|
2598
|
+
"id": "get_storefront",
|
|
2599
|
+
"method": "GET",
|
|
2600
|
+
"path": "/v1/storefronts/{id}",
|
|
2601
|
+
"tag": "Storefront",
|
|
2602
|
+
"summary": "Read one hosted storefront owned by the caller",
|
|
2603
|
+
"security": "bearer",
|
|
2604
|
+
"body": false,
|
|
2605
|
+
"bodyRequired": false,
|
|
2606
|
+
"pathParams": [
|
|
2607
|
+
{
|
|
2608
|
+
"name": "id",
|
|
2609
|
+
"required": true
|
|
2610
|
+
}
|
|
2611
|
+
],
|
|
2612
|
+
"queryParams": [],
|
|
2613
|
+
"headerParams": []
|
|
2614
|
+
},
|
|
2615
|
+
{
|
|
2616
|
+
"id": "update_storefront",
|
|
2617
|
+
"method": "PATCH",
|
|
2618
|
+
"path": "/v1/storefronts/{id}",
|
|
2619
|
+
"tag": "Storefront",
|
|
2620
|
+
"summary": "Update a hosted storefront. Omitted fields are left as they are.",
|
|
2621
|
+
"security": "bearer",
|
|
2622
|
+
"body": true,
|
|
2623
|
+
"bodyRequired": true,
|
|
2624
|
+
"pathParams": [
|
|
2625
|
+
{
|
|
2626
|
+
"name": "id",
|
|
2627
|
+
"required": true
|
|
2628
|
+
}
|
|
2629
|
+
],
|
|
2630
|
+
"queryParams": [],
|
|
2631
|
+
"headerParams": []
|
|
2632
|
+
},
|
|
2633
|
+
{
|
|
2634
|
+
"id": "upsert_storefront_plan",
|
|
2635
|
+
"method": "POST",
|
|
2636
|
+
"path": "/v1/storefronts/{id}/plans",
|
|
2637
|
+
"tag": "Storefront",
|
|
2638
|
+
"summary": "Create or replace a plan on a hosted storefront. product_id copies a connectivity plan owned by the caller.",
|
|
2639
|
+
"security": "bearer",
|
|
2640
|
+
"body": true,
|
|
2641
|
+
"bodyRequired": true,
|
|
2642
|
+
"pathParams": [
|
|
2643
|
+
{
|
|
2644
|
+
"name": "id",
|
|
2645
|
+
"required": true
|
|
2646
|
+
}
|
|
2647
|
+
],
|
|
2518
2648
|
"queryParams": [],
|
|
2519
2649
|
"headerParams": []
|
|
2520
2650
|
},
|
package/dist/index.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export { DEFAULT_MCP_URL, Mcp, PROTOCOL_VERSION, type McpOptions } from "./mcp.j
|
|
|
7
7
|
export type { OperationId } from "./operation-ids.js";
|
|
8
8
|
export type { CallParams } from "./operations.js";
|
|
9
9
|
export { SDK_VERSION } from "./version.js";
|
|
10
|
-
export
|
|
10
|
+
export { isStorefrontPlanError, logoFileDataUrl, logoReference, majorToCents, parseCountryInput, parseDataGb, parseValidityDays, parseWholeNumber, completePlanInput, storefrontBrandPatch, storefrontPlanBody, hostedStorefrontUrl, storefrontSlugFrom, type ExistingStorefrontBrand, type StorefrontBrandInput, type StorefrontPlanBody, type StorefrontPlanInput, type StoredPlanIdentity, } from "./storefront-write.js";
|
|
11
|
+
export type { ConnectivityEsim, ConnectivityIntent, ConnectivityPlan, HostedStorefront, IdempotentRequest, IntentCreateParams, IntentStatus, PlanPrice, ProductCreateParams, StorefrontCreateParams, StorefrontPlanParams, StorefrontUpdateParams, } from "./types.js";
|
package/dist/index.js
CHANGED
|
@@ -5,3 +5,4 @@ export { Carrier } from "./client.js";
|
|
|
5
5
|
export { CarrierError } from "./error.js";
|
|
6
6
|
export { DEFAULT_MCP_URL, Mcp, PROTOCOL_VERSION } from "./mcp.js";
|
|
7
7
|
export { SDK_VERSION } from "./version.js";
|
|
8
|
+
export { isStorefrontPlanError, logoFileDataUrl, logoReference, majorToCents, parseCountryInput, parseDataGb, parseValidityDays, parseWholeNumber, completePlanInput, storefrontBrandPatch, storefrontPlanBody, hostedStorefrontUrl, storefrontSlugFrom, } from "./storefront-write.js";
|
package/dist/operation-ids.d.ts
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
*
|
|
3
3
|
* Generated by sdks/generate.py. Do not edit by hand.
|
|
4
4
|
*/
|
|
5
|
-
export type OperationId = "list_reseller_accounts" | "get_reseller_info" | "esim_status_per_account" | "list_sponsors" | "list_steering_lists" | "get_subscriber" | "list_subscribers" | "create_subscriber" | "get_sim_provider_status" | "change_sim_status" | "get_subscriber_location" | "hlr_get_bitrate" | "hlr_set_bitrate" | "list_subscriber_packages" | "assign_package" | "clean_all_packages" | "list_package_templates" | "create_package_template" | "list_location_zones" | "create_location_zone" | "list_detailed_location_zones" | "list_destination_prefixes" | "subscriber_usage" | "subscriber_network_events" | "subscriber_active_period" | "get_tariff" | "list_network_profiles" | "modify_subscriber_balance" | "modify_subscriber_status" | "modify_subscriber_contact_info" | "set_subscriber_traffic_restrictions" | "modify_subscriber_steering_list" | "move_subscriber_range_to_account" | "assign_recurring_package" | "modify_package_limits" | "modify_package_expiry" | "modify_package_status" | "stop_resume_recurring_package" | "modify_account_balance" | "delete_subscriber_package" | "modify_template_core" | "modify_template_recurring" | "modify_template_throttling" | "send_sms" | "fleet_health" | "churn_risk" | "audit_network_coverage" | "diagnose_subscriber" | "detect_usage_anomalies" | "optimize_package" | "marketing_intelligence" | "high_cost_subscribers" | "high_cost_subscribers_method_guard" | "detect_country_entry" | "list_intelligence_schedules" | "create_intelligence_schedule" | "delete_intelligence_schedule" | "run_intelligence_schedule" | "get_intelligence_schedule_report" | "get_intelligence_share" | "operator_billing_connect_begin" | "operator_billing_connect_oauth_begin" | "operator_billing_connect_oauth_complete" | "operator_billing_connect_status" | "operator_billing_connect_dashboard_link" | "operator_billing_list_payouts" | "operator_billing_create_manual_payout" | "operator_billing_get_payout_schedule" | "operator_billing_update_payout_schedule" | "operator_billing_list_fees" | "operator_billing_list_refunds" | "operator_billing_create_refund" | "operator_billing_list_disputes" | "operator_billing_submit_dispute_evidence" | "operator_billing_list_fraud_reviews" | "operator_billing_approve_fraud_review" | "operator_billing_decline_fraud_review" | "operator_billing_list_value_lists" | "operator_billing_add_value_list_item" | "operator_identity_status" | "operator_identity_create_session" | "operator_identity_update_session" | "operator_list_promotions" | "operator_create_promotion" | "signup_start" | "signup_verify" | "create_api_key" | "get_onboarding_state" | "onboarding_save_org" | "onboarding_connect_ocs_token" | "onboarding_start_managed_account" | "onboarding_save_plan" | "onboarding_skip_plan" | "onboarding_test_esim" | "onboarding_complete" | "operator_billing_stripe_webhook" | "receive_bridge4ip_webhook" | "affect_subscriber_phone_number" | "modify_subscriber_mobile_plan" | "modify_subscriber_voip_plan" | "push_steering_to_subscriber" | "modify_subscriber_package_active_period" | "get_subscriber_location_by_cell_id" | "reset_subscriber_gz_counter" | "list_destination_lists" | "list_subscriber_voip_tariff" | "list_voip_tariff_rule" | "change_network_profile_of_location_zone" | "carrier_webhook_config" | "ai_chat" | "ai_insights" | "ai_quota" | "list_invoice_periods" | "get_billing_config" | "update_billing_config" | "stripe_connect_begin" | "stripe_connect_status" | "list_invoices" | "create_invoice" | "get_invoice" | "update_invoice" | "void_invoice" | "get_invoice_document" | "list_connectivity_plans" | "list_connectivity_products" | "create_connectivity_product" | "get_connectivity_product" | "list_connectivity_intents" | "create_connectivity_intent" | "get_connectivity_intent" | "confirm_connectivity_intent" | "create_connectivity_webhook_endpoint" | "list_connectivity_webhook_endpoints" | "delete_connectivity_webhook_endpoint" | "list_connectivity_events" | "get_connectivity_event" | "create_connectivity_usage_record" | "list_connectivity_usage_records" | "retry_connectivity_event" | "issue_esim_from_inventory" | "rollback_esim_issuance" | "subscriber_country_history" | "get_subscriber_notes" | "add_subscriber_note" | "put_subscriber_notes" | "observe_connectivity_event" | "ingest_connectivity_usage" | "ingest_cdr_events" | "aggregate_cdr" | "list_storefront_templates" | "get_storefront_order" | "health_check";
|
|
5
|
+
export type OperationId = "list_reseller_accounts" | "get_reseller_info" | "esim_status_per_account" | "list_sponsors" | "list_steering_lists" | "get_subscriber" | "list_subscribers" | "create_subscriber" | "get_sim_provider_status" | "change_sim_status" | "get_subscriber_location" | "hlr_get_bitrate" | "hlr_set_bitrate" | "list_subscriber_packages" | "assign_package" | "clean_all_packages" | "list_package_templates" | "create_package_template" | "list_location_zones" | "create_location_zone" | "list_detailed_location_zones" | "list_destination_prefixes" | "subscriber_usage" | "subscriber_network_events" | "subscriber_active_period" | "get_tariff" | "list_network_profiles" | "modify_subscriber_balance" | "modify_subscriber_status" | "modify_subscriber_contact_info" | "set_subscriber_traffic_restrictions" | "modify_subscriber_steering_list" | "move_subscriber_range_to_account" | "assign_recurring_package" | "modify_package_limits" | "modify_package_expiry" | "modify_package_status" | "stop_resume_recurring_package" | "modify_account_balance" | "delete_subscriber_package" | "modify_template_core" | "modify_template_recurring" | "modify_template_throttling" | "send_sms" | "fleet_health" | "churn_risk" | "audit_network_coverage" | "diagnose_subscriber" | "detect_usage_anomalies" | "optimize_package" | "marketing_intelligence" | "high_cost_subscribers" | "high_cost_subscribers_method_guard" | "detect_country_entry" | "list_intelligence_schedules" | "create_intelligence_schedule" | "delete_intelligence_schedule" | "run_intelligence_schedule" | "get_intelligence_schedule_report" | "get_intelligence_share" | "operator_billing_connect_begin" | "operator_billing_connect_oauth_begin" | "operator_billing_connect_oauth_complete" | "operator_billing_connect_status" | "operator_billing_connect_dashboard_link" | "operator_billing_list_payouts" | "operator_billing_create_manual_payout" | "operator_billing_get_payout_schedule" | "operator_billing_update_payout_schedule" | "operator_billing_list_fees" | "operator_billing_list_refunds" | "operator_billing_create_refund" | "operator_billing_list_disputes" | "operator_billing_submit_dispute_evidence" | "operator_billing_list_fraud_reviews" | "operator_billing_approve_fraud_review" | "operator_billing_decline_fraud_review" | "operator_billing_list_value_lists" | "operator_billing_add_value_list_item" | "operator_identity_status" | "operator_identity_create_session" | "operator_identity_update_session" | "operator_list_promotions" | "operator_create_promotion" | "signup_start" | "signup_verify" | "create_api_key" | "get_onboarding_state" | "onboarding_save_org" | "onboarding_connect_ocs_token" | "onboarding_start_managed_account" | "onboarding_save_plan" | "onboarding_skip_plan" | "onboarding_test_esim" | "onboarding_complete" | "operator_billing_stripe_webhook" | "receive_bridge4ip_webhook" | "affect_subscriber_phone_number" | "modify_subscriber_mobile_plan" | "modify_subscriber_voip_plan" | "push_steering_to_subscriber" | "modify_subscriber_package_active_period" | "get_subscriber_location_by_cell_id" | "reset_subscriber_gz_counter" | "list_destination_lists" | "list_subscriber_voip_tariff" | "list_voip_tariff_rule" | "change_network_profile_of_location_zone" | "carrier_webhook_config" | "ai_chat" | "ai_insights" | "ai_quota" | "list_invoice_periods" | "get_billing_config" | "update_billing_config" | "stripe_connect_begin" | "stripe_connect_status" | "list_invoices" | "create_invoice" | "get_invoice" | "update_invoice" | "void_invoice" | "get_invoice_document" | "list_connectivity_plans" | "list_connectivity_products" | "create_connectivity_product" | "get_connectivity_product" | "list_connectivity_intents" | "create_connectivity_intent" | "get_connectivity_intent" | "confirm_connectivity_intent" | "create_connectivity_webhook_endpoint" | "list_connectivity_webhook_endpoints" | "delete_connectivity_webhook_endpoint" | "list_connectivity_events" | "get_connectivity_event" | "create_connectivity_usage_record" | "list_connectivity_usage_records" | "retry_connectivity_event" | "issue_esim_from_inventory" | "rollback_esim_issuance" | "subscriber_country_history" | "get_subscriber_notes" | "add_subscriber_note" | "put_subscriber_notes" | "observe_connectivity_event" | "ingest_connectivity_usage" | "ingest_cdr_events" | "aggregate_cdr" | "list_storefront_templates" | "list_storefront_buyer_orders" | "get_storefront_order" | "get_hosted_storefront" | "list_storefronts" | "create_storefront" | "get_storefront" | "update_storefront" | "upsert_storefront_plan" | "health_check";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Labels a brand can type. The API still stores gigabytes, whole days,
|
|
3
|
+
* minor currency units, and two-letter country codes.
|
|
4
|
+
*/
|
|
5
|
+
export type LabelResult = {
|
|
6
|
+
ok: true;
|
|
7
|
+
value: number;
|
|
8
|
+
} | {
|
|
9
|
+
ok: false;
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function parseDataGb(raw: string): LabelResult;
|
|
13
|
+
export declare function parseValidityDays(raw: string): LabelResult;
|
|
14
|
+
/** Stripe minor units. Yen is already the minor unit, so 1000 JPY stays 1000. */
|
|
15
|
+
export declare function majorToCents(input: string, currency?: string): {
|
|
16
|
+
ok: true;
|
|
17
|
+
cents: number;
|
|
18
|
+
} | {
|
|
19
|
+
ok: false;
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function parseCountryInput(raw: string): {
|
|
23
|
+
ok: true;
|
|
24
|
+
regions: string[];
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
message: string;
|
|
28
|
+
};
|
|
29
|
+
/** Turns a small picture file into the data URL the shop stores. */
|
|
30
|
+
export declare function logoFileDataUrl(bytes: Uint8Array): {
|
|
31
|
+
ok: true;
|
|
32
|
+
url: string;
|
|
33
|
+
} | {
|
|
34
|
+
ok: false;
|
|
35
|
+
message: string;
|
|
36
|
+
};
|
|
37
|
+
/** Keeps an https address or a picture data URL. Drops SVG and script addresses. */
|
|
38
|
+
export declare function logoReference(value: string): {
|
|
39
|
+
ok: true;
|
|
40
|
+
url: string;
|
|
41
|
+
} | {
|
|
42
|
+
ok: false;
|
|
43
|
+
message: string;
|
|
44
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Labels a brand can type. The API still stores gigabytes, whole days,
|
|
3
|
+
* minor currency units, and two-letter country codes.
|
|
4
|
+
*/
|
|
5
|
+
const regionNames = new Intl.DisplayNames(["en"], { type: "region" });
|
|
6
|
+
const PREFERRED = new Set(["CW", "BF", "BJ", "MM", "CD", "RS", "DE", "FR", "GB", "VU", "ZW", "RU", "TL", "VN", "YE"]);
|
|
7
|
+
const NAME_TO_CODE = new Map();
|
|
8
|
+
for (let first = 65; first <= 90; first += 1) {
|
|
9
|
+
for (let second = 65; second <= 90; second += 1) {
|
|
10
|
+
const code = String.fromCharCode(first, second);
|
|
11
|
+
const label = regionLabel(code);
|
|
12
|
+
if (!label)
|
|
13
|
+
continue;
|
|
14
|
+
const key = label.toLowerCase();
|
|
15
|
+
const current = NAME_TO_CODE.get(key);
|
|
16
|
+
if (!current || PREFERRED.has(code))
|
|
17
|
+
NAME_TO_CODE.set(key, code);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
NAME_TO_CODE.set("uk", "GB");
|
|
21
|
+
const CODE_ALIASES = { UK: "GB" };
|
|
22
|
+
export function parseDataGb(raw) {
|
|
23
|
+
if (raw.trim().toLowerCase() === "unlimited")
|
|
24
|
+
return { ok: true, value: 0 };
|
|
25
|
+
return parseAmount(raw, /gigabytes?|gbs?|gb/gi, "Enter data like 1, 1 GB, or Unlimited.", 10_000, false);
|
|
26
|
+
}
|
|
27
|
+
export function parseValidityDays(raw) {
|
|
28
|
+
return parseAmount(raw, /days?/gi, "Enter validity like 7 or 7 days.", 3650, true);
|
|
29
|
+
}
|
|
30
|
+
const ZERO_DECIMAL = new Set([
|
|
31
|
+
"BIF", "CLP", "DJF", "GNF", "JPY", "KMF", "KRW", "MGA", "PYG", "RWF",
|
|
32
|
+
"UGX", "VND", "VUV", "XAF", "XOF", "XPF",
|
|
33
|
+
]);
|
|
34
|
+
/** Stripe minor units. Yen is already the minor unit, so 1000 JPY stays 1000. */
|
|
35
|
+
export function majorToCents(input, currency = "EUR") {
|
|
36
|
+
const text = input.trim();
|
|
37
|
+
if (ZERO_DECIMAL.has(currency.trim().toUpperCase())) {
|
|
38
|
+
if (!/^\d+$/.test(text))
|
|
39
|
+
return { ok: false, message: "Enter a whole number, such as 1000." };
|
|
40
|
+
const cents = Number(text);
|
|
41
|
+
if (!Number.isSafeInteger(cents) || cents <= 0)
|
|
42
|
+
return { ok: false, message: "Enter a price above zero." };
|
|
43
|
+
return { ok: true, cents };
|
|
44
|
+
}
|
|
45
|
+
const match = /^(\d+)(?:\.(\d{1,2}))?$/.exec(text);
|
|
46
|
+
if (!match)
|
|
47
|
+
return { ok: false, message: "Enter a price like 9.00." };
|
|
48
|
+
const major = Number(match[1]);
|
|
49
|
+
const fraction = (match[2] ?? "").padEnd(2, "0");
|
|
50
|
+
const cents = major * 100 + Number(fraction);
|
|
51
|
+
if (!Number.isSafeInteger(cents) || cents <= 0)
|
|
52
|
+
return { ok: false, message: "Enter a price above zero." };
|
|
53
|
+
return { ok: true, cents };
|
|
54
|
+
}
|
|
55
|
+
export function parseCountryInput(raw) {
|
|
56
|
+
const regions = [];
|
|
57
|
+
const parts = raw.split(",").map((part) => part.trim()).filter((part) => part !== "");
|
|
58
|
+
for (const part of parts) {
|
|
59
|
+
const added = codesFor(part);
|
|
60
|
+
if (!added)
|
|
61
|
+
return { ok: false, message: "Countries are names, such as France, or codes such as FR." };
|
|
62
|
+
for (const code of added) {
|
|
63
|
+
if (regions.length >= 40)
|
|
64
|
+
break;
|
|
65
|
+
if (!regions.includes(code))
|
|
66
|
+
regions.push(code);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return { ok: true, regions };
|
|
70
|
+
}
|
|
71
|
+
function parseAmount(raw, unit, message, max, whole) {
|
|
72
|
+
const text = raw.trim().replace(unit, "").trim();
|
|
73
|
+
if (text === "" || !/^\d+(\.\d+)?$/.test(text))
|
|
74
|
+
return { ok: false, message };
|
|
75
|
+
const value = Number(text);
|
|
76
|
+
if (!Number.isFinite(value) || value < 0 || value > max)
|
|
77
|
+
return { ok: false, message };
|
|
78
|
+
if (whole && !Number.isInteger(value))
|
|
79
|
+
return { ok: false, message };
|
|
80
|
+
return { ok: true, value };
|
|
81
|
+
}
|
|
82
|
+
function codesFor(part) {
|
|
83
|
+
const tokens = part.split(/\s+/).filter((token) => token !== "");
|
|
84
|
+
if (tokens.length > 1 && tokens.every((token) => /^[A-Za-z]{2}$/.test(token))) {
|
|
85
|
+
return tokens.map((token) => canonical(token));
|
|
86
|
+
}
|
|
87
|
+
if (/^[A-Za-z]{2}$/.test(part))
|
|
88
|
+
return [canonical(part)];
|
|
89
|
+
const code = NAME_TO_CODE.get(part.toLowerCase());
|
|
90
|
+
return code ? [code] : null;
|
|
91
|
+
}
|
|
92
|
+
function canonical(code) {
|
|
93
|
+
const upper = code.toUpperCase();
|
|
94
|
+
return CODE_ALIASES[upper] ?? upper;
|
|
95
|
+
}
|
|
96
|
+
const LOGO_DATA = /^data:image\/(png|jpeg|webp|gif);base64,[A-Za-z0-9+/]+={0,2}$/;
|
|
97
|
+
const LOGO_MAX_CHARS = 100_000;
|
|
98
|
+
const LOGO_MAX_BYTES = 70 * 1024;
|
|
99
|
+
/** Turns a small picture file into the data URL the shop stores. */
|
|
100
|
+
export function logoFileDataUrl(bytes) {
|
|
101
|
+
const mime = logoMime(bytes);
|
|
102
|
+
if (!mime || bytes.byteLength < 1 || bytes.byteLength > LOGO_MAX_BYTES) {
|
|
103
|
+
return { ok: false, message: "Use a PNG, JPEG, WebP, or GIF under 70 KB, or an https address." };
|
|
104
|
+
}
|
|
105
|
+
const url = `data:${mime};base64,${toBase64(bytes)}`;
|
|
106
|
+
if (url.length > LOGO_MAX_CHARS || !LOGO_DATA.test(url)) {
|
|
107
|
+
return { ok: false, message: "Use a PNG, JPEG, WebP, or GIF under 70 KB, or an https address." };
|
|
108
|
+
}
|
|
109
|
+
return { ok: true, url };
|
|
110
|
+
}
|
|
111
|
+
/** Keeps an https address or a picture data URL. Drops SVG and script addresses. */
|
|
112
|
+
export function logoReference(value) {
|
|
113
|
+
const trimmed = value.trim();
|
|
114
|
+
if (trimmed.startsWith("data:")) {
|
|
115
|
+
if (trimmed.length <= LOGO_MAX_CHARS && LOGO_DATA.test(trimmed))
|
|
116
|
+
return { ok: true, url: trimmed };
|
|
117
|
+
return { ok: false, message: "Use a PNG, JPEG, WebP, or GIF under 70 KB, or an https address." };
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
const url = new URL(trimmed);
|
|
121
|
+
if (url.protocol === "https:")
|
|
122
|
+
return { ok: true, url: url.toString() };
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return { ok: false, message: "Use a PNG, JPEG, WebP, or GIF under 70 KB, or an https address." };
|
|
126
|
+
}
|
|
127
|
+
return { ok: false, message: "Use a PNG, JPEG, WebP, or GIF under 70 KB, or an https address." };
|
|
128
|
+
}
|
|
129
|
+
function toBase64(bytes) {
|
|
130
|
+
let binary = "";
|
|
131
|
+
for (const byte of bytes)
|
|
132
|
+
binary += String.fromCharCode(byte);
|
|
133
|
+
return btoa(binary);
|
|
134
|
+
}
|
|
135
|
+
function logoMime(bytes) {
|
|
136
|
+
if (bytes.length >= 8 && bytes[0] === 0x89 && bytes[1] === 0x50 && bytes[2] === 0x4e && bytes[3] === 0x47) {
|
|
137
|
+
return "image/png";
|
|
138
|
+
}
|
|
139
|
+
if (bytes.length >= 3 && bytes[0] === 0xff && bytes[1] === 0xd8 && bytes[2] === 0xff)
|
|
140
|
+
return "image/jpeg";
|
|
141
|
+
if (bytes.length >= 6 && bytes[0] === 0x47 && bytes[1] === 0x49 && bytes[2] === 0x46)
|
|
142
|
+
return "image/gif";
|
|
143
|
+
if (bytes.length >= 12 &&
|
|
144
|
+
bytes[0] === 0x52 &&
|
|
145
|
+
bytes[1] === 0x49 &&
|
|
146
|
+
bytes[2] === 0x46 &&
|
|
147
|
+
bytes[3] === 0x46 &&
|
|
148
|
+
bytes[8] === 0x57 &&
|
|
149
|
+
bytes[9] === 0x45 &&
|
|
150
|
+
bytes[10] === 0x42 &&
|
|
151
|
+
bytes[11] === 0x50) {
|
|
152
|
+
return "image/webp";
|
|
153
|
+
}
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
function regionLabel(code) {
|
|
157
|
+
if (!/^[A-Z]{2}$/.test(code))
|
|
158
|
+
return undefined;
|
|
159
|
+
try {
|
|
160
|
+
const label = regionNames.of(code);
|
|
161
|
+
if (!label || label.toUpperCase() === code)
|
|
162
|
+
return undefined;
|
|
163
|
+
return label;
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bodies for the hosted storefront write API.
|
|
3
|
+
* A theme or copy object replaces that object, so a color change is merged
|
|
4
|
+
* onto the store already saved before it is sent.
|
|
5
|
+
*/
|
|
6
|
+
export { logoFileDataUrl, logoReference, majorToCents, parseCountryInput, parseDataGb, parseValidityDays, } from "./storefront-labels.js";
|
|
7
|
+
export interface StorefrontBrandInput {
|
|
8
|
+
accent?: string;
|
|
9
|
+
accentDark?: string;
|
|
10
|
+
bg?: string;
|
|
11
|
+
text?: string;
|
|
12
|
+
logoUrl?: string;
|
|
13
|
+
hero?: string;
|
|
14
|
+
tagline?: string;
|
|
15
|
+
supportEmail?: string;
|
|
16
|
+
legalName?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface StorefrontPlanInput {
|
|
19
|
+
productId?: string;
|
|
20
|
+
slug?: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
priceCents?: number;
|
|
23
|
+
currency?: string;
|
|
24
|
+
templateId?: number;
|
|
25
|
+
dataGb?: number;
|
|
26
|
+
validityDays?: number;
|
|
27
|
+
regions?: string[];
|
|
28
|
+
description?: string;
|
|
29
|
+
active?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface ExistingStorefrontBrand {
|
|
32
|
+
theme?: Record<string, unknown>;
|
|
33
|
+
copy?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
export interface StorefrontPlanBody {
|
|
36
|
+
product_id?: string;
|
|
37
|
+
slug?: string;
|
|
38
|
+
name?: string;
|
|
39
|
+
price_cents?: number;
|
|
40
|
+
currency?: string;
|
|
41
|
+
ocs_package_template_id?: number;
|
|
42
|
+
data_gb?: number;
|
|
43
|
+
validity_days?: number;
|
|
44
|
+
regions?: string[];
|
|
45
|
+
description?: string;
|
|
46
|
+
active?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export declare function storefrontBrandPatch(input: StorefrontBrandInput, existing?: ExistingStorefrontBrand): {
|
|
49
|
+
theme?: Record<string, unknown>;
|
|
50
|
+
copy?: Record<string, unknown>;
|
|
51
|
+
};
|
|
52
|
+
export interface StoredPlanIdentity {
|
|
53
|
+
slug: string;
|
|
54
|
+
name: string;
|
|
55
|
+
currency: string;
|
|
56
|
+
ocs_package_template_id: number;
|
|
57
|
+
}
|
|
58
|
+
/** Fill slug, name, currency, and template id from a saved plan so a price change can omit them. */
|
|
59
|
+
export declare function completePlanInput(input: StorefrontPlanInput, plans: StoredPlanIdentity[]): StorefrontPlanInput;
|
|
60
|
+
export declare function storefrontPlanBody(input: StorefrontPlanInput): StorefrontPlanBody | {
|
|
61
|
+
error: string;
|
|
62
|
+
} | null;
|
|
63
|
+
export declare function isStorefrontPlanError(value: StorefrontPlanBody | {
|
|
64
|
+
error: string;
|
|
65
|
+
} | null): value is {
|
|
66
|
+
error: string;
|
|
67
|
+
};
|
|
68
|
+
/** Whole numbers from CLI flags. An omitted flag stays omitted. */
|
|
69
|
+
export declare function parseWholeNumber(value: string | undefined, label: string): {
|
|
70
|
+
ok: true;
|
|
71
|
+
value: number | undefined;
|
|
72
|
+
} | {
|
|
73
|
+
ok: false;
|
|
74
|
+
message: string;
|
|
75
|
+
};
|
|
76
|
+
/** "Acme Mobile" becomes acme-mobile. Reserved or empty input returns "". */
|
|
77
|
+
/** Public shop address for a hosted slug. Custom domains are not part of this address. */
|
|
78
|
+
export declare function hostedStorefrontUrl(slug: string): string;
|
|
79
|
+
export declare function storefrontSlugFrom(raw: string): string;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bodies for the hosted storefront write API.
|
|
3
|
+
* A theme or copy object replaces that object, so a color change is merged
|
|
4
|
+
* onto the store already saved before it is sent.
|
|
5
|
+
*/
|
|
6
|
+
export { logoFileDataUrl, logoReference, majorToCents, parseCountryInput, parseDataGb, parseValidityDays, } from "./storefront-labels.js";
|
|
7
|
+
const THEME_FIELDS = [
|
|
8
|
+
["accent", "accent"],
|
|
9
|
+
["accentDark", "accentDark"],
|
|
10
|
+
["bg", "bg"],
|
|
11
|
+
["text", "text"],
|
|
12
|
+
["logoUrl", "logoUrl"],
|
|
13
|
+
];
|
|
14
|
+
const COPY_FIELDS = [
|
|
15
|
+
["hero", "hero"],
|
|
16
|
+
["tagline", "tagline"],
|
|
17
|
+
["supportEmail", "supportEmail"],
|
|
18
|
+
["legalName", "legalName"],
|
|
19
|
+
];
|
|
20
|
+
export function storefrontBrandPatch(input, existing) {
|
|
21
|
+
const theme = overlay(existing?.theme, input, THEME_FIELDS);
|
|
22
|
+
const copy = overlay(existing?.copy, input, COPY_FIELDS);
|
|
23
|
+
return {
|
|
24
|
+
...(theme ? { theme } : {}),
|
|
25
|
+
...(copy ? { copy } : {}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** Fill slug, name, currency, and template id from a saved plan so a price change can omit them. */
|
|
29
|
+
export function completePlanInput(input, plans) {
|
|
30
|
+
if ((input.productId?.trim() ?? "") !== "")
|
|
31
|
+
return input;
|
|
32
|
+
const touched = [
|
|
33
|
+
input.slug,
|
|
34
|
+
input.name,
|
|
35
|
+
input.priceCents,
|
|
36
|
+
input.currency,
|
|
37
|
+
input.templateId,
|
|
38
|
+
input.dataGb,
|
|
39
|
+
input.validityDays,
|
|
40
|
+
input.regions,
|
|
41
|
+
input.description,
|
|
42
|
+
input.active,
|
|
43
|
+
].some((value) => value !== undefined);
|
|
44
|
+
if (!touched)
|
|
45
|
+
return input;
|
|
46
|
+
const slug = input.slug?.trim();
|
|
47
|
+
const match = slug ? plans.find((plan) => plan.slug === slug) : plans.length === 1 ? plans[0] : undefined;
|
|
48
|
+
if (!match) {
|
|
49
|
+
const currency = sharedCurrency(plans);
|
|
50
|
+
if (!input.currency && currency)
|
|
51
|
+
return { ...input, currency };
|
|
52
|
+
return input;
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
...input,
|
|
56
|
+
slug: input.slug ?? match.slug,
|
|
57
|
+
name: input.name ?? match.name,
|
|
58
|
+
currency: input.currency ?? match.currency,
|
|
59
|
+
templateId: input.templateId ?? match.ocs_package_template_id,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function sharedCurrency(plans) {
|
|
63
|
+
const codes = new Set(plans.map((plan) => plan.currency.trim().toUpperCase()).filter((code) => code !== ""));
|
|
64
|
+
if (codes.size !== 1)
|
|
65
|
+
return undefined;
|
|
66
|
+
return [...codes][0];
|
|
67
|
+
}
|
|
68
|
+
export function storefrontPlanBody(input) {
|
|
69
|
+
const productId = input.productId?.trim() ?? "";
|
|
70
|
+
if (productId !== "") {
|
|
71
|
+
const body = { product_id: productId };
|
|
72
|
+
if (input.priceCents !== undefined)
|
|
73
|
+
body.price_cents = input.priceCents;
|
|
74
|
+
if (input.active !== undefined)
|
|
75
|
+
body.active = input.active;
|
|
76
|
+
return body;
|
|
77
|
+
}
|
|
78
|
+
const touched = [
|
|
79
|
+
input.slug,
|
|
80
|
+
input.name,
|
|
81
|
+
input.priceCents,
|
|
82
|
+
input.currency,
|
|
83
|
+
input.templateId,
|
|
84
|
+
input.dataGb,
|
|
85
|
+
input.validityDays,
|
|
86
|
+
input.regions,
|
|
87
|
+
input.description,
|
|
88
|
+
input.active,
|
|
89
|
+
].some((value) => value !== undefined);
|
|
90
|
+
if (!touched)
|
|
91
|
+
return null;
|
|
92
|
+
if (!input.slug || !input.name || input.priceCents === undefined || !input.currency || input.templateId === undefined) {
|
|
93
|
+
return { error: "A plan needs a slug, name, price in minor units, currency, and OCS template id." };
|
|
94
|
+
}
|
|
95
|
+
const body = {
|
|
96
|
+
slug: input.slug,
|
|
97
|
+
name: input.name,
|
|
98
|
+
price_cents: input.priceCents,
|
|
99
|
+
currency: input.currency,
|
|
100
|
+
ocs_package_template_id: input.templateId,
|
|
101
|
+
};
|
|
102
|
+
if (input.dataGb !== undefined)
|
|
103
|
+
body.data_gb = input.dataGb;
|
|
104
|
+
if (input.validityDays !== undefined)
|
|
105
|
+
body.validity_days = input.validityDays;
|
|
106
|
+
if (input.regions !== undefined)
|
|
107
|
+
body.regions = input.regions;
|
|
108
|
+
if (input.description !== undefined)
|
|
109
|
+
body.description = input.description;
|
|
110
|
+
if (input.active !== undefined)
|
|
111
|
+
body.active = input.active;
|
|
112
|
+
return body;
|
|
113
|
+
}
|
|
114
|
+
export function isStorefrontPlanError(value) {
|
|
115
|
+
return value !== null && "error" in value;
|
|
116
|
+
}
|
|
117
|
+
/** Whole numbers from CLI flags. An omitted flag stays omitted. */
|
|
118
|
+
export function parseWholeNumber(value, label) {
|
|
119
|
+
if (value === undefined)
|
|
120
|
+
return { ok: true, value: undefined };
|
|
121
|
+
if (!/^\d+$/.test(value))
|
|
122
|
+
return { ok: false, message: `${label} must be a whole number.` };
|
|
123
|
+
return { ok: true, value: Number(value) };
|
|
124
|
+
}
|
|
125
|
+
function overlay(base, input, fields) {
|
|
126
|
+
const patch = {};
|
|
127
|
+
let touched = false;
|
|
128
|
+
for (const [field, jsonKey] of fields) {
|
|
129
|
+
const value = input[field];
|
|
130
|
+
if (typeof value !== "string" || value.trim() === "")
|
|
131
|
+
continue;
|
|
132
|
+
patch[jsonKey] = value.trim();
|
|
133
|
+
touched = true;
|
|
134
|
+
}
|
|
135
|
+
if (!touched)
|
|
136
|
+
return undefined;
|
|
137
|
+
return { ...(base ?? {}), ...patch };
|
|
138
|
+
}
|
|
139
|
+
const RESERVED_SLUGS = new Set(["www", "app", "api", "stores", "checkout", "dashboard", "admin", "mail"]);
|
|
140
|
+
/** "Acme Mobile" becomes acme-mobile. Reserved or empty input returns "". */
|
|
141
|
+
/** Public shop address for a hosted slug. Custom domains are not part of this address. */
|
|
142
|
+
export function hostedStorefrontUrl(slug) {
|
|
143
|
+
return `https://${slug}.stores.carrier.llc`;
|
|
144
|
+
}
|
|
145
|
+
export function storefrontSlugFrom(raw) {
|
|
146
|
+
const folded = raw
|
|
147
|
+
.trim()
|
|
148
|
+
.toLowerCase()
|
|
149
|
+
.normalize("NFKD")
|
|
150
|
+
.replace(/[\u0300-\u036f]/g, "")
|
|
151
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
152
|
+
.replace(/^-+|-+$/g, "");
|
|
153
|
+
const clipped = folded.slice(0, 40).replace(/-+$/g, "");
|
|
154
|
+
if (RESERVED_SLUGS.has(clipped))
|
|
155
|
+
return "";
|
|
156
|
+
return /^[a-z0-9](?:[a-z0-9-]{0,38}[a-z0-9])?$/.test(clipped) ? clipped : "";
|
|
157
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -52,3 +52,47 @@ export interface ProductCreateParams {
|
|
|
52
52
|
export interface IdempotentRequest {
|
|
53
53
|
idempotencyKey: string;
|
|
54
54
|
}
|
|
55
|
+
export interface HostedStorefront {
|
|
56
|
+
id: string;
|
|
57
|
+
object: "storefront";
|
|
58
|
+
slug: string;
|
|
59
|
+
name: string;
|
|
60
|
+
status: "draft" | "published";
|
|
61
|
+
url: string;
|
|
62
|
+
updated_at: number;
|
|
63
|
+
theme?: Record<string, unknown>;
|
|
64
|
+
copy?: Record<string, unknown>;
|
|
65
|
+
plans?: Array<{
|
|
66
|
+
slug: string;
|
|
67
|
+
name: string;
|
|
68
|
+
currency: string;
|
|
69
|
+
ocs_package_template_id: number;
|
|
70
|
+
}>;
|
|
71
|
+
}
|
|
72
|
+
export interface StorefrontPlanParams {
|
|
73
|
+
slug?: string;
|
|
74
|
+
name?: string;
|
|
75
|
+
price_cents?: number;
|
|
76
|
+
currency?: string;
|
|
77
|
+
ocs_package_template_id?: number;
|
|
78
|
+
product_id?: string;
|
|
79
|
+
description?: string;
|
|
80
|
+
data_gb?: number;
|
|
81
|
+
validity_days?: number;
|
|
82
|
+
regions?: string[];
|
|
83
|
+
active?: boolean;
|
|
84
|
+
}
|
|
85
|
+
export interface StorefrontCreateParams {
|
|
86
|
+
slug: string;
|
|
87
|
+
name: string;
|
|
88
|
+
status?: "draft" | "published";
|
|
89
|
+
theme?: Record<string, unknown>;
|
|
90
|
+
copy?: Record<string, unknown>;
|
|
91
|
+
}
|
|
92
|
+
export interface StorefrontUpdateParams {
|
|
93
|
+
slug?: string;
|
|
94
|
+
name?: string;
|
|
95
|
+
status?: "draft" | "published";
|
|
96
|
+
theme?: Record<string, unknown>;
|
|
97
|
+
copy?: Record<string, unknown>;
|
|
98
|
+
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Published version. Keep this equal to package.json. */
|
|
2
|
-
export declare const SDK_VERSION = "0.2.
|
|
3
|
-
export declare const USER_AGENT = "@carrierllc/sdk/0.2.
|
|
2
|
+
export declare const SDK_VERSION = "0.2.2";
|
|
3
|
+
export declare const USER_AGENT = "@carrierllc/sdk/0.2.2";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carrierllc/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "TypeScript client for the Carrier API, MCP server, and CLI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./storefront-write": {
|
|
15
|
+
"types": "./dist/storefront-write.d.ts",
|
|
16
|
+
"import": "./dist/storefront-write.js"
|
|
13
17
|
}
|
|
14
18
|
},
|
|
15
19
|
"files": [
|