@designcrowd/library.brand-page 5.16.44 → 5.16.46
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/lib/src/{CreatedOnBrandCrowd-de-de-TuSRObJQ.js → CreatedOnBrandCrowd-de-de-uiIr5kLt.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-BX3P38jt.js → CreatedOnBrandCrowd-en-us-ZxmDyB2L.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-CwpQMqO0.js → CreatedOnBrandCrowd-es-es-Dy0prqYb.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-C4u38Ym4.js → CreatedOnBrandCrowd-fr-ca-ptYivmhP.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-C4u38Ym4.js → CreatedOnBrandCrowd-fr-fr-ptYivmhP.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-B4-ro8pc.js → CreatedOnBrandCrowd-pt-br-CJ2KmyN9.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-B4-ro8pc.js → CreatedOnBrandCrowd-pt-pt-CJ2KmyN9.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-Cl4pKvXX.js → CreatedOnDcom-de-de-BOKzyd7W.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us--Zj-GmSd.js → CreatedOnDcom-en-us-DUn1EGFC.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-D7Kogzlt.js → CreatedOnDcom-es-es-CWmC3YRV.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-Br2Jrkb3.js → CreatedOnDcom-fr-ca-_UTCwQgn.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-CrO42IpU.js → CreatedOnDcom-fr-fr-DYUvSYKz.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-ClEMPT95.js → CreatedOnDcom-pt-br-o2kCzJWH.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-sYoiCgDC.js → CreatedOnDcom-pt-pt-JLuH_BY3.js} +1 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +2 -0
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +2 -0
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +2 -0
- package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.d.ts +2 -0
- package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +2 -0
- package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +2 -0
- package/lib/src/brand-page-maker/components/seo-settings/UseExistingDomainModal.mixin.d.ts +2 -0
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +2 -0
- package/lib/src/brand-page-maker/components/upgrade-to-premium-button/UpgradeToPremiumButton.mixin.d.ts +2 -0
- package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.d.ts +3 -0
- package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.js +2 -0
- package/lib/src/brand-page-maker/stores/user/user-store.js +1 -0
- package/lib/src/clients/ai-assistant-client.d.ts +113 -0
- package/lib/src/clients/ai-assistant-client.js +117 -0
- package/lib/src/constants/ui.d.ts +1 -0
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-pLG4c-nD.js → lib-CBpRmget.js} +2012 -2007
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.stories.js +1 -0
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +2 -0
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.d.ts +64 -0
- package/lib/src/shared/logo-settings/components/EditLogoSettings.mixin.js +11 -0
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +2 -0
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +3 -0
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +2 -0
- package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +2 -0
- package/lib/src/shared/side-bar/components/SideBar.mixin.d.ts +2 -0
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +2 -0
- package/package.json +2 -2
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +2 -0
- package/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.ts +3 -0
- package/src/brand-page-maker/stores/user/user-store.ts +1 -0
- package/src/clients/ai-assistant-client.ts +268 -0
- package/src/constants/ui.ts +1 -0
- package/src/shared/content-settings/components/content-settings/ContentSettings.stories.ts +1 -0
- package/src/shared/content-settings/components/generate-ai-button/GenerateAiButton.vue +7 -1
- package/src/shared/logo-settings/components/EditLogoSettings.mixin.ts +14 -0
- package/src/shared/logo-settings/components/EditLogoSettings.vue +1 -0
- package/src/shared/logo-settings/components/LogoTemplateSearch.vue +9 -13
|
@@ -273,6 +273,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
273
273
|
isSubsequentPublish: boolean;
|
|
274
274
|
isContextualUpgradeModalVisible: boolean;
|
|
275
275
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
276
|
+
requestVerificationToken?: string | undefined;
|
|
276
277
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
277
278
|
isUserDraft: (state: {
|
|
278
279
|
availableTaxes: any[];
|
|
@@ -334,6 +335,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
334
335
|
isSubsequentPublish: boolean;
|
|
335
336
|
isContextualUpgradeModalVisible: boolean;
|
|
336
337
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
338
|
+
requestVerificationToken?: string | undefined;
|
|
337
339
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
338
340
|
}, {
|
|
339
341
|
initialise(payload: import("../../stores/brandpage-container").InitialisePayload): void;
|
package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js
CHANGED
|
@@ -53,6 +53,7 @@ export const userFeatures = {
|
|
|
53
53
|
canUseGettyVideos: false,
|
|
54
54
|
canUseGoogleAdsense: false,
|
|
55
55
|
googleAdsenseEnabled: false,
|
|
56
|
+
canUseAITextGenerator: true,
|
|
56
57
|
};
|
|
57
58
|
export const BRAND_PAGE = {
|
|
58
59
|
styles: {
|
|
@@ -2026,6 +2027,7 @@ export const USER_FEATURES = Object.freeze({
|
|
|
2026
2027
|
canUseGettyVideos: true,
|
|
2027
2028
|
canUseGoogleAdsense: false,
|
|
2028
2029
|
googleAdsenseEnabled: true,
|
|
2030
|
+
canUseAITextGenerator: true,
|
|
2029
2031
|
});
|
|
2030
2032
|
export const INITIALISE_PAYLOAD = Object.freeze({
|
|
2031
2033
|
brandPage: BRAND_PAGE,
|
package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts
CHANGED
|
@@ -705,6 +705,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
705
705
|
isSubsequentPublish: boolean;
|
|
706
706
|
isContextualUpgradeModalVisible: boolean;
|
|
707
707
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
708
|
+
requestVerificationToken?: string | undefined;
|
|
708
709
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
709
710
|
isUserDraft: (state: {
|
|
710
711
|
availableTaxes: any[];
|
|
@@ -766,6 +767,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
766
767
|
isSubsequentPublish: boolean;
|
|
767
768
|
isContextualUpgradeModalVisible: boolean;
|
|
768
769
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
770
|
+
requestVerificationToken?: string | undefined;
|
|
769
771
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
770
772
|
}, {
|
|
771
773
|
initialise(payload: import("../../stores/brandpage-container").InitialisePayload): void;
|
|
@@ -71,6 +71,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
71
71
|
isSubsequentPublish: boolean;
|
|
72
72
|
isContextualUpgradeModalVisible: boolean;
|
|
73
73
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
74
|
+
requestVerificationToken?: string | undefined;
|
|
74
75
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
75
76
|
isUserDraft: (state: {
|
|
76
77
|
availableTaxes: any[];
|
|
@@ -132,6 +133,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
132
133
|
isSubsequentPublish: boolean;
|
|
133
134
|
isContextualUpgradeModalVisible: boolean;
|
|
134
135
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
136
|
+
requestVerificationToken?: string | undefined;
|
|
135
137
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
136
138
|
}, {
|
|
137
139
|
initialise(payload: import("../../stores/brandpage-container").InitialisePayload): void;
|
|
@@ -87,6 +87,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
87
87
|
isSubsequentPublish: boolean;
|
|
88
88
|
isContextualUpgradeModalVisible: boolean;
|
|
89
89
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
90
|
+
requestVerificationToken?: string | undefined;
|
|
90
91
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
91
92
|
isUserDraft: (state: {
|
|
92
93
|
availableTaxes: any[];
|
|
@@ -148,6 +149,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
148
149
|
isSubsequentPublish: boolean;
|
|
149
150
|
isContextualUpgradeModalVisible: boolean;
|
|
150
151
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
152
|
+
requestVerificationToken?: string | undefined;
|
|
151
153
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
152
154
|
}, {
|
|
153
155
|
initialise(payload: import("../../stores/brandpage-container").InitialisePayload): void;
|
|
@@ -92,6 +92,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
92
92
|
isSubsequentPublish: boolean;
|
|
93
93
|
isContextualUpgradeModalVisible: boolean;
|
|
94
94
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
95
|
+
requestVerificationToken?: string | undefined;
|
|
95
96
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
96
97
|
isUserDraft: (state: {
|
|
97
98
|
availableTaxes: any[];
|
|
@@ -153,6 +154,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
153
154
|
isSubsequentPublish: boolean;
|
|
154
155
|
isContextualUpgradeModalVisible: boolean;
|
|
155
156
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
157
|
+
requestVerificationToken?: string | undefined;
|
|
156
158
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
157
159
|
}, {
|
|
158
160
|
initialise(payload: import("../../stores/brandpage-container").InitialisePayload): void;
|
|
@@ -68,6 +68,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
68
68
|
isSubsequentPublish: boolean;
|
|
69
69
|
isContextualUpgradeModalVisible: boolean;
|
|
70
70
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
71
|
+
requestVerificationToken?: string | undefined;
|
|
71
72
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
72
73
|
isUserDraft: (state: {
|
|
73
74
|
availableTaxes: any[];
|
|
@@ -129,6 +130,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
129
130
|
isSubsequentPublish: boolean;
|
|
130
131
|
isContextualUpgradeModalVisible: boolean;
|
|
131
132
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
133
|
+
requestVerificationToken?: string | undefined;
|
|
132
134
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
133
135
|
}, {
|
|
134
136
|
initialise(payload: import("../../stores/brandpage-container").InitialisePayload): void;
|
|
@@ -143,6 +143,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
143
143
|
isSubsequentPublish: boolean;
|
|
144
144
|
isContextualUpgradeModalVisible: boolean;
|
|
145
145
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
146
|
+
requestVerificationToken?: string | undefined;
|
|
146
147
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
147
148
|
isUserDraft: (state: {
|
|
148
149
|
availableTaxes: any[];
|
|
@@ -204,6 +205,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
204
205
|
isSubsequentPublish: boolean;
|
|
205
206
|
isContextualUpgradeModalVisible: boolean;
|
|
206
207
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
208
|
+
requestVerificationToken?: string | undefined;
|
|
207
209
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
208
210
|
}, {
|
|
209
211
|
initialise(payload: import("../../stores/brandpage-container").InitialisePayload): void;
|
|
@@ -68,6 +68,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
68
68
|
isSubsequentPublish: boolean;
|
|
69
69
|
isContextualUpgradeModalVisible: boolean;
|
|
70
70
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
71
|
+
requestVerificationToken?: string | undefined;
|
|
71
72
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
72
73
|
isUserDraft: (state: {
|
|
73
74
|
availableTaxes: any[];
|
|
@@ -129,6 +130,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
129
130
|
isSubsequentPublish: boolean;
|
|
130
131
|
isContextualUpgradeModalVisible: boolean;
|
|
131
132
|
contextualUpgradeType: string | number | symbol | undefined;
|
|
133
|
+
requestVerificationToken?: string | undefined;
|
|
132
134
|
} & import("pinia").PiniaCustomStateProperties<import("../../stores").BrandPageContainerState>) => boolean;
|
|
133
135
|
}, {
|
|
134
136
|
initialise(payload: import("../../stores/brandpage-container").InitialisePayload): void;
|
|
@@ -51,6 +51,7 @@ export interface BrandPageContainerState {
|
|
|
51
51
|
isSubsequentPublish: boolean;
|
|
52
52
|
isContextualUpgradeModalVisible: boolean;
|
|
53
53
|
contextualUpgradeType: WebsiteContextUpgradeType | undefined;
|
|
54
|
+
requestVerificationToken?: string;
|
|
54
55
|
}
|
|
55
56
|
export type GettyVideoEditorViewModelResponse = {
|
|
56
57
|
assetId: string;
|
|
@@ -139,6 +140,7 @@ export declare const useBrandPageContainerStore: import("pinia").StoreDefinition
|
|
|
139
140
|
isSubsequentPublish: boolean;
|
|
140
141
|
isContextualUpgradeModalVisible: boolean;
|
|
141
142
|
contextualUpgradeType: WebsiteContextUpgradeType | undefined;
|
|
143
|
+
requestVerificationToken?: string | undefined;
|
|
142
144
|
} & import("pinia").PiniaCustomStateProperties<BrandPageContainerState>) => boolean;
|
|
143
145
|
isUserDraft: (state: {
|
|
144
146
|
availableTaxes: any[];
|
|
@@ -200,6 +202,7 @@ export declare const useBrandPageContainerStore: import("pinia").StoreDefinition
|
|
|
200
202
|
isSubsequentPublish: boolean;
|
|
201
203
|
isContextualUpgradeModalVisible: boolean;
|
|
202
204
|
contextualUpgradeType: WebsiteContextUpgradeType | undefined;
|
|
205
|
+
requestVerificationToken?: string | undefined;
|
|
203
206
|
} & import("pinia").PiniaCustomStateProperties<BrandPageContainerState>) => boolean;
|
|
204
207
|
}, {
|
|
205
208
|
initialise(payload: InitialisePayload): void;
|
|
@@ -67,6 +67,7 @@ export const useBrandPageContainerStore = defineStore('brandPageContainer', {
|
|
|
67
67
|
isSubsequentPublish: false,
|
|
68
68
|
isContextualUpgradeModalVisible: false,
|
|
69
69
|
contextualUpgradeType: undefined,
|
|
70
|
+
requestVerificationToken: undefined,
|
|
70
71
|
};
|
|
71
72
|
},
|
|
72
73
|
actions: {
|
|
@@ -123,6 +124,7 @@ export const useBrandPageContainerStore = defineStore('brandPageContainer', {
|
|
|
123
124
|
this.showPublishOptionModal = payload.showPublishOptionModal;
|
|
124
125
|
this.abTests = getAbTestResults(payload.abTests || {});
|
|
125
126
|
this.isSubsequentPublish = payload.isSubsequentPublish;
|
|
127
|
+
this.requestVerificationToken = payload.requestVerificationToken;
|
|
126
128
|
const logoStore = useLogoStore();
|
|
127
129
|
logoStore.initialise({
|
|
128
130
|
logoTemplateAsset: payload.logoTemplateAsset,
|
|
@@ -17,6 +17,7 @@ export const useBrandPageMakerUserStore = defineStore('brandPageMakerUser', {
|
|
|
17
17
|
canUsePremiumFontFamily: false,
|
|
18
18
|
maxNumOfPages: DEFAULT_MAX_NUM_OF_PAGES,
|
|
19
19
|
canUseGettyVideos: false,
|
|
20
|
+
canUseAITextGenerator: false,
|
|
20
21
|
canUseGoogleAdsense: false,
|
|
21
22
|
googleAdsenseEnabled: false,
|
|
22
23
|
},
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export interface AiAssistantMessage {
|
|
2
|
+
type: 'text' | 'image';
|
|
3
|
+
text?: string;
|
|
4
|
+
image_url?: {
|
|
5
|
+
url: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export interface AiAssistantToolCall {
|
|
9
|
+
toolId: string;
|
|
10
|
+
toolName: string;
|
|
11
|
+
input: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface AiAssistantToolCallOutput {
|
|
14
|
+
toolId: string;
|
|
15
|
+
success: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface CreateThreadRequest {
|
|
18
|
+
message: string;
|
|
19
|
+
agentType?: string;
|
|
20
|
+
elementIds?: string[];
|
|
21
|
+
designSnapshot?: string;
|
|
22
|
+
objectSnapshot?: string;
|
|
23
|
+
designMetadata?: Record<string, unknown>;
|
|
24
|
+
logoTemplateToken?: string;
|
|
25
|
+
logoDraftToken?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface SendMessageRequest {
|
|
28
|
+
message: string;
|
|
29
|
+
agentType?: string;
|
|
30
|
+
elementIds?: string[];
|
|
31
|
+
designSnapshot?: string;
|
|
32
|
+
objectSnapshot?: string;
|
|
33
|
+
designMetadata?: Record<string, unknown>;
|
|
34
|
+
logoTemplateToken?: string;
|
|
35
|
+
logoDraftToken?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface ToolSubmissionRequest {
|
|
38
|
+
runId: string;
|
|
39
|
+
toolCalls: AiAssistantToolCallOutput[];
|
|
40
|
+
message?: string;
|
|
41
|
+
agentType?: string;
|
|
42
|
+
elementIds?: string[];
|
|
43
|
+
designSnapshot?: string;
|
|
44
|
+
objectSnapshot?: string;
|
|
45
|
+
designMetadata?: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
export type AiAssistantResponseType = 'message' | 'tool_calls';
|
|
48
|
+
export interface AiAssistantResponse {
|
|
49
|
+
threadId: string;
|
|
50
|
+
runId?: string;
|
|
51
|
+
type: AiAssistantResponseType;
|
|
52
|
+
content: string | null;
|
|
53
|
+
toolCalls: AiAssistantToolCall[] | null;
|
|
54
|
+
totalPaidToolCalls: number;
|
|
55
|
+
timestamp: number;
|
|
56
|
+
}
|
|
57
|
+
export interface AiAssistantErrorResponse {
|
|
58
|
+
error: string;
|
|
59
|
+
errorCode?: string;
|
|
60
|
+
errorParams?: Record<string, unknown>;
|
|
61
|
+
}
|
|
62
|
+
export interface AiAssistantCreditInfo {
|
|
63
|
+
remaining: number;
|
|
64
|
+
usage: number;
|
|
65
|
+
}
|
|
66
|
+
export declare const getCreateThreadEndpoint: () => string;
|
|
67
|
+
export declare const getSendMessageEndpoint: (threadId: string) => string;
|
|
68
|
+
export declare const getToolSubmissionEndpoint: (threadId: string) => string;
|
|
69
|
+
export declare class AiAssistantClient {
|
|
70
|
+
private getRequestVerificationToken;
|
|
71
|
+
private getRequestHeaders;
|
|
72
|
+
private extractCreditInfo;
|
|
73
|
+
/**
|
|
74
|
+
* Create a new AI Assistant thread
|
|
75
|
+
*/
|
|
76
|
+
createThread(request: CreateThreadRequest): Promise<{
|
|
77
|
+
response: AiAssistantResponse;
|
|
78
|
+
creditInfo: AiAssistantCreditInfo;
|
|
79
|
+
}>;
|
|
80
|
+
/**
|
|
81
|
+
* Send a message to an existing thread
|
|
82
|
+
*/
|
|
83
|
+
sendMessage(threadId: string, request: SendMessageRequest): Promise<{
|
|
84
|
+
response: AiAssistantResponse;
|
|
85
|
+
creditInfo: AiAssistantCreditInfo;
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* Submit tool call outputs to a thread
|
|
89
|
+
*/
|
|
90
|
+
submitToolCallOutput(threadId: string, request: ToolSubmissionRequest): Promise<{
|
|
91
|
+
response: AiAssistantResponse;
|
|
92
|
+
creditInfo: AiAssistantCreditInfo;
|
|
93
|
+
}>;
|
|
94
|
+
/**
|
|
95
|
+
* Convenience method: Create thread or continue existing thread
|
|
96
|
+
* Useful for managing thread lifecycle in components
|
|
97
|
+
*/
|
|
98
|
+
sendPrompt(message: string, options?: {
|
|
99
|
+
threadId?: string;
|
|
100
|
+
agentType?: string;
|
|
101
|
+
elementIds?: string[];
|
|
102
|
+
designSnapshot?: string;
|
|
103
|
+
objectSnapshot?: string;
|
|
104
|
+
designMetadata?: Record<string, unknown>;
|
|
105
|
+
logoTemplateToken?: string;
|
|
106
|
+
logoDraftToken?: string;
|
|
107
|
+
}): Promise<{
|
|
108
|
+
response: AiAssistantResponse;
|
|
109
|
+
creditInfo: AiAssistantCreditInfo;
|
|
110
|
+
}>;
|
|
111
|
+
private handleError;
|
|
112
|
+
}
|
|
113
|
+
export declare const getInstance: () => AiAssistantClient;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import axios, {} from 'axios';
|
|
2
|
+
import { useBrandPageContainerStore } from '../brand-page-maker/stores/brandpage-container/brand-page-container-store';
|
|
3
|
+
// Endpoints - using relative URLs (same as design-template-client pattern)
|
|
4
|
+
export const getCreateThreadEndpoint = () => `/api/assistant/thread`;
|
|
5
|
+
export const getSendMessageEndpoint = (threadId) => `/api/assistant/thread/${threadId}`;
|
|
6
|
+
export const getToolSubmissionEndpoint = (threadId) => `/api/assistant/thread/${threadId}/tool-submission`;
|
|
7
|
+
export class AiAssistantClient {
|
|
8
|
+
getRequestVerificationToken() {
|
|
9
|
+
const brandPageContainerStore = useBrandPageContainerStore();
|
|
10
|
+
return brandPageContainerStore.requestVerificationToken || '';
|
|
11
|
+
}
|
|
12
|
+
getRequestHeaders() {
|
|
13
|
+
const token = this.getRequestVerificationToken();
|
|
14
|
+
return {
|
|
15
|
+
'Content-Type': 'application/json',
|
|
16
|
+
...(token && { RequestVerificationToken: token }),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
extractCreditInfo(headers) {
|
|
20
|
+
return {
|
|
21
|
+
remaining: parseInt(headers['x-ai-credit-remaining'] || '0', 10),
|
|
22
|
+
usage: parseInt(headers['x-ai-credit-usage'] || '0', 10),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create a new AI Assistant thread
|
|
27
|
+
*/
|
|
28
|
+
async createThread(request) {
|
|
29
|
+
try {
|
|
30
|
+
const response = await axios.post(getCreateThreadEndpoint(), request, {
|
|
31
|
+
withCredentials: true,
|
|
32
|
+
headers: this.getRequestHeaders(),
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
response: response.data,
|
|
36
|
+
creditInfo: this.extractCreditInfo(response.headers),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
this.handleError(error);
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Send a message to an existing thread
|
|
46
|
+
*/
|
|
47
|
+
async sendMessage(threadId, request) {
|
|
48
|
+
if (!threadId) {
|
|
49
|
+
throw new Error('threadId is required');
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const response = await axios.post(getSendMessageEndpoint(threadId), request, {
|
|
53
|
+
withCredentials: true,
|
|
54
|
+
headers: this.getRequestHeaders(),
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
response: response.data,
|
|
58
|
+
creditInfo: this.extractCreditInfo(response.headers),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
this.handleError(error);
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Submit tool call outputs to a thread
|
|
68
|
+
*/
|
|
69
|
+
async submitToolCallOutput(threadId, request) {
|
|
70
|
+
if (!threadId) {
|
|
71
|
+
throw new Error('threadId is required');
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const response = await axios.post(getToolSubmissionEndpoint(threadId), request, {
|
|
75
|
+
withCredentials: true,
|
|
76
|
+
headers: this.getRequestHeaders(),
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
response: response.data,
|
|
80
|
+
creditInfo: this.extractCreditInfo(response.headers),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
this.handleError(error);
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Convenience method: Create thread or continue existing thread
|
|
90
|
+
* Useful for managing thread lifecycle in components
|
|
91
|
+
*/
|
|
92
|
+
async sendPrompt(message, options = {}) {
|
|
93
|
+
const { threadId, ...requestOptions } = options;
|
|
94
|
+
const request = { message, ...requestOptions };
|
|
95
|
+
if (threadId) {
|
|
96
|
+
return this.sendMessage(threadId, request);
|
|
97
|
+
}
|
|
98
|
+
return this.createThread(request);
|
|
99
|
+
}
|
|
100
|
+
handleError(error) {
|
|
101
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
102
|
+
const errorData = error.response?.data;
|
|
103
|
+
const statusCode = error.response?.status;
|
|
104
|
+
if (statusCode === 429) {
|
|
105
|
+
console.error('AI Assistant: Insufficient credits', errorData?.errorCode);
|
|
106
|
+
}
|
|
107
|
+
else if (statusCode === 400) {
|
|
108
|
+
console.error('AI Assistant: Bad request', errorData?.error);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
console.error('AI Assistant error:', errorData?.error || error.message);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
let _instance;
|
|
117
|
+
export const getInstance = () => _instance ? _instance : (_instance = new AiAssistantClient());
|
package/lib/src/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bM as E, aA as T, b1 as s, ae as I, as as N, ar as S, ao as e, bC as A, bT as O, ck as C, cj as G, ci as D, cc as P, bb as t, ba as R, bY as L, bZ as M, c4 as o, bV as r, bX as b, bW as n, b_ as F, b$ as i, cb as l, c9 as g, az as B, ca as c, ah as Y, b6 as U, b8 as d, b7 as u, g as H, h as p, B as y, a8 as K, f as k, a9 as V, l as m, aw as X, a7 as h, bB as v, bU as W, aH as x, b3 as f, a$ as z, c7 as Z, c6 as w, C as j, be as Q, D as q, b as J, a as $, c2 as aa, bd as _a, b4 as Ea, b0 as Ta, cg as sa, ch as Ia, c5 as Na, bQ as Sa, am as ea, c8 as Aa, cd as Oa, bj as Ca, aT as Ga, bp as Da, F as Pa, ag as ta, af as Ra, k as La, aa as Ma, bg as oa, b2 as ra, a_ as ba, ac as na, at as Fa, n as ia, X as la, H as ga, ai as Ba, bN as ca, bk as Ya, bl as Ua, bL as da, br as ua, bt as Ha, bf as pa, L as ya, aS as Ka, by as ka, aY as Va, bx as ma, aB as Xa, ak as ha, c3 as va, ce as Wa, cf as xa, b5 as fa, N as za, aK as Za, aJ as wa, aL as ja, aF as Qa, aG as qa, aI as Ja, bn as $a, bu as a_, bh as __, r as E_, au as T_, av as s_, ap as I_, aq as N_, an as S_, ad as e_, o as A_, d as O_, R as C_, e as G_, bz as D_, ay as P_, bR as t_, bS as R_, c1 as L_, al as M_, bP as o_, S as r_, bA as b_, p as n_, t as F_, P as i_, aR as l_, bO as g_, bo as B_, bG as c_, bF as Y_, bI as U_, bD as d_, bJ as u_, bK as H_, bE as p_, bH as y_, aM as K_, aN as k_, bw as V_, bv as m_, aP as X_, aQ as h_, aV as v_, b9 as W_, aU as x_, aW as f_, U as z_, aj as Z_, aZ as w_, m as j_, q as Q_, bm as q_, ax as J_, bi as $_, bq as aE, bs as _E, bc as EE, z as TE, $ as sE, ab as IE, j as NE, c0 as SE, w as eE, y as AE, Y as OE, a6 as CE, aO as GE, aX as DE, aD as PE, u as tE, a4 as RE, x as LE, I as ME, aC as oE, i as rE, aE as bE, c as nE, v as FE, E as iE, A as lE, G as gE, a3 as BE, Z as cE, s as YE, a5 as UE, O as dE, J as uE, K as HE, a1 as pE, Q as yE, a0 as KE, T as kE, a2 as VE, W as mE, M as XE, V as hE } from "./lib-
|
|
1
|
+
import { bM as E, aA as T, b1 as s, ae as I, as as N, ar as S, ao as e, bC as A, bT as O, ck as C, cj as G, ci as D, cc as P, bb as t, ba as R, bY as L, bZ as M, c4 as o, bV as r, bX as b, bW as n, b_ as F, b$ as i, cb as l, c9 as g, az as B, ca as c, ah as Y, b6 as U, b8 as d, b7 as u, g as H, h as p, B as y, a8 as K, f as k, a9 as V, l as m, aw as X, a7 as h, bB as v, bU as W, aH as x, b3 as f, a$ as z, c7 as Z, c6 as w, C as j, be as Q, D as q, b as J, a as $, c2 as aa, bd as _a, b4 as Ea, b0 as Ta, cg as sa, ch as Ia, c5 as Na, bQ as Sa, am as ea, c8 as Aa, cd as Oa, bj as Ca, aT as Ga, bp as Da, F as Pa, ag as ta, af as Ra, k as La, aa as Ma, bg as oa, b2 as ra, a_ as ba, ac as na, at as Fa, n as ia, X as la, H as ga, ai as Ba, bN as ca, bk as Ya, bl as Ua, bL as da, br as ua, bt as Ha, bf as pa, L as ya, aS as Ka, by as ka, aY as Va, bx as ma, aB as Xa, ak as ha, c3 as va, ce as Wa, cf as xa, b5 as fa, N as za, aK as Za, aJ as wa, aL as ja, aF as Qa, aG as qa, aI as Ja, bn as $a, bu as a_, bh as __, r as E_, au as T_, av as s_, ap as I_, aq as N_, an as S_, ad as e_, o as A_, d as O_, R as C_, e as G_, bz as D_, ay as P_, bR as t_, bS as R_, c1 as L_, al as M_, bP as o_, S as r_, bA as b_, p as n_, t as F_, P as i_, aR as l_, bO as g_, bo as B_, bG as c_, bF as Y_, bI as U_, bD as d_, bJ as u_, bK as H_, bE as p_, bH as y_, aM as K_, aN as k_, bw as V_, bv as m_, aP as X_, aQ as h_, aV as v_, b9 as W_, aU as x_, aW as f_, U as z_, aj as Z_, aZ as w_, m as j_, q as Q_, bm as q_, ax as J_, bi as $_, bq as aE, bs as _E, bc as EE, z as TE, $ as sE, ab as IE, j as NE, c0 as SE, w as eE, y as AE, Y as OE, a6 as CE, aO as GE, aX as DE, aD as PE, u as tE, a4 as RE, x as LE, I as ME, aC as oE, i as rE, aE as bE, c as nE, v as FE, E as iE, A as lE, G as gE, a3 as BE, Z as cE, s as YE, a5 as UE, O as dE, J as uE, K as HE, a1 as pE, Q as yE, a0 as KE, T as kE, a2 as VE, W as mE, M as XE, V as hE } from "./lib-CBpRmget.js";
|
|
2
2
|
import { createPinia as WE, setActivePinia as xE } from "pinia";
|
|
3
3
|
export {
|
|
4
4
|
E as ABOUT_SECTION_SETTINGS_CONFIG,
|