LoadPersonalization (LoadPersonalization)
Loads personalization popup for a given ready//see params/options object (upload_redirect_url) if you are supporting user uploaded designs Melco.LoadPersonalization(Username, ReadyToken, callback [optional], popupMode [optional])
Parameters
Name | Type | Default | Required | Description |
---|---|---|---|---|
UserName | string | true | LiveDesignerFusion Login Name. | |
ReadyToken | string | true | Ready Token Defined in ready creation process. | |
callback | method | null | false | Function to call just before the popup is rendered (if you require changes to the default settings). |
popupMode | string | popup | false | Display mode type:
|
skipcontrols | boolean | false | false | If you are using the embed mode, this boolean value specifies whether Fusion should implment the controls or whether you will implement the controls manually.
|
CultureName | method | en-US | false | Culture Name i.e. en_US etc. Cultures are not supported. This paremeter is for future implementation. |
params | object | null | false | option object to set various settings See object for more details |
params
Name | Type | Default | Required | Description |
---|---|---|---|---|
personalizer | string | false | This parameter is used to assign any uploaded assets to unique identifier i.e. if personalization allows user uploaded designs then uploaded designs will be associated with identifier to retrieve or search designs later on. maximumallowed character length is 100 characters and anything loner than that will be truncated. | |
upload_formats | string | ofm,dst,png, gif,bmp,jpg, jpeg,eps,ai, svg | false | comma separated list of file format. It will apply client side validation before on file before processing. It's just check the file extension not quality of the file. |
upload_max_size | numeric | 10000000 (10MB) | false | This setting is only applicable for user uploaded designs. This value will be applied to validate the file size before sendig file to server for processing. Requires value in byte format. if you want to set the value as 1 KB then pass this value as 1024 |
upload_min_size | numeric | 1 Byte | false | This setting is only applicable for user uploaded designs. This value will be applied to validate the file size before sendig file to server for processing. Requires value in byte format. if you want to set the value as 1 KB then pass this value as 1024 |
upload_redirect_url | string | false |
Redirect url is required to support file upload functionality in non html5 supported browsers (IE8 and IE9 etc.). This value will be ignored if browser supports html5.
Implement the below Setup for proper functioning of this feature 1. Html Page : Create html page in your website by copying the contents from this page. Page name can be any 2. Property Value : Pass value of this property as location of html page created in step 1. If you websites is http://example.com and you created page on the root of the website as redirect.html then you will pass value of property as http://example.com/redirect.html |
|
messages | Objects Array | null | false | Objects List/Array of messages displayed to end user during personalization process. Each object should contain two properties "name" of the key and "text" of the message. List of supported keys upload_invalid_file : if user try to upload not supported file format. upload_max_size : if user try to upload file more than allowed size. upload_min_size : if user try to upload file less than required size. upload_error : if error occured during upload process other than listed above . |
carousel_animation | boolean | false | false | Application is changing selection to apply default values or parameters. This parameter defines the behaviour of animation i.e. if default font, color or design is outside the current carousel view then passing value as true will animate the selection and false will set selection without any animation |
Output / Result
CompletePersonalization (CompletePersonalization)
Callback variable for when a user hits the done button after personalization in popup mode or when EmbedPersonalizationFinished() completes successfully in embed mode.
CompletePersonalization (CompletePersonalization)
Melco.CompletePersonalization = function(result) { // Do stuff here... }
Output / Result
Expected Response |
---|
{ "success": "true", "Data": { "Token": "0c9c8d60976c4c7e927b293a7a2ee4cf", "Color": { "Name": "" }, "Elements": [ { "Type": "L", "ServiceID": 1, "ElementID": 18879, "ElementName": "Text1", "AlphabetName": "Marker", "FileName": "Marker.OFA", "Text": "Melco", "Stitches": 1812, "Colors": [ { "Type": "", "HeightMM": 0, "WidthMM": 0, "SupplierCode": "0001", "R": 0, "G": 130, "B": 255, "Manufacturer": "CSD", "ThreadCode": "8", "ThreadName": "Light Blue" } ], "Width": 107.8, "Height": 30.4, "Visible": -1 }, { "Type": "G", "Height": 78.2, "Width": 90.1, "ReferenceID": "C002397", "Elements": [ { "Type": "L", "ServiceID": 1, "ElementID": 18878, "ElementName": "Text1", "AlphabetName": "Marker", "FileName": "Marker.OFA", "Text": "Text", "Stitches": 1185, "Colors": [ { "Type": "", "HeightMM": 0, "WidthMM": 0, "SupplierCode": "0001", "R": 0, "G": 130, "B": 255, "Manufacturer": "CSD", "ThreadCode": "8", "ThreadName": "Light Blue" } ], "Width": 74.8, "Height": 25.9, "Visible": -1 }, { "Type": "D", "ServiceID": 1, "ElementID": 18877, "ElementName": "Design1", "DesignName": "HEART", "FileName": "HEART.ofm", "Stitches": 1623, "Colors": [ { "Type": "e", "HeightMM": 0, "WidthMM": 0, "SupplierCode": null, "R": 241, "G": 255, "B": 82, "Manufacturer": "ARC Poly", "ThreadCode": "21", "ThreadName": null }, { "Type": "e", "HeightMM": 0, "WidthMM": 0, "SupplierCode": null, "R": 207, "G": 76, "B": 63, "Manufacturer": "ARC Poly", "ThreadCode": "3016", "ThreadName": null } ], "Width": 90.1, "Height": 78.2, "Visible": -1 } ], "Name": "DesignText" } ] } } |
Properties
Name | Type | Description |
---|---|---|
Token | string | The instance token is required to retrieve any data related to this Personalization (i.e. a merged image, the fulfillment file, etc.). Upon calling CompletePersonalization, you should save this Token value to your database. |
Color | object | The Color object with Product and BlankColor information selected in the Personalization popup. See object for more details |
Elements | array/list |
List/Array of personalized / personalizable elements on the Product/Blank. This will be recursive object for composition i.e. if type is other than G
then object will contain all the element properties but if the element type is G (Composition) then object will contain composition
properties and will contain array of all the elements See object for more details |
Color
Name | Type | Description |
---|---|---|
ColorID | The ColorID selected in the Personalization popup. | |
Name | string | The Color name selected in the Personalization popup. |
Elements
Name | Type | Description |
---|---|---|
Type | string | Element Type L, D, G (L=Lettering, D=Design, G=Group of Elements). |
ReferenceID | string | Unique Identifier for group. This element will be only available for group type elements |
Name | string | Group Name, defined during group creation process. This element will be only available for grouped elements i.e. compositions |
Elements | object array | Only available for 'G' type elements. Each object in the array supports all the properties and methods available for each element type (Design, Lettering). |
ServiceID | int | Embellishment / Service ID (1 = Embroidery, 2 = Printing). |
ElementID | int | The unique identifier for the element. |
ElementName | string | Element Name defined during the element creation process. |
DesignName | string | The design file name (available only for design elements). |
AlphabetName | string | The selected alphabet/font name, for example, Block, Arial (available only for lettering type elements). |
FileName | string | The file name of the selected alphabet/font. For example, Block.ofa, Arial.ttf, disney.ofm or football.eps. |
Text | string | The text entetred by the user. The default text will be returned if the text input is hidden or if the text is not changed by the user (available for only lettering type elements). |
Stitches | int | The number of embroidery stitches. 0 will be returned for print text and designs. |
Width | float | The element width in millimeters. This will be in pixels for graphic designs (i.e. .png, .jpeg). This is available for designs only. |
Height | float | The element height in millimeters. This will be in pixels for graphic designs (i.e. .png, .jpeg). This is available for designs only. |
Visible | int | Returns element visibility overrides by JavaScript API, it returns following values 0 false 1 true -1 No change inherited from ready |
Colors | object | List of Colors in the Lettering object See object for more details |
Colors
Name | Type | Description |
---|---|---|
ColorID | int | Identity / Unique identifier for the color. |
Name | string | The display name of the color. |
Manufacturer | string | The name of the thread manufacturer. Blank string for print colors. |
ThreadCode | string | The code or thread number of the embroidery thread. Blank string for print colors. |
R | int | Color R value. |
G | int | Color G value. |
B | int | Color B value. |
Type | string | The type of element layer. This is only available for embroidery designs. Possible values: a = applique, e = embroidery, s = sequin. |
HeightMM | float | If the type attribute is "a", this will contain the height of the applique layer in millimeters. Otherwise, this will return 0. Available only for embroidery designs. |
WidthMM | float | If the type attribute is "a", this will contain the width of the applique layer in millimeters. Otherwise, this will return 0. Available only for embroidery designs. |
Properties
Name | Type | Description |
---|---|---|
Token | string | The instance token is required to retrieve any data related to this Personalization (i.e. a merged image, the fulfillment file, etc.). Upon calling CompletePersonalization, you should save this Token value to your database. |
Color | object | The Color object with Product and BlankColor information selected in the Personalization popup. See object for more details |
Elements | array/list |
List/Array of personalized / personalizable elements on the Product/Blank. This will be recursive object for composition i.e. if type is other than G
then object will contain all the element properties but if the element type is G (Composition) then object will contain composition
properties and will contain array of all the elements See object for more details |
Color
Name | Type | Description |
---|---|---|
Colorid | The ColorID selected in the Personalization popup. | |
Name | string | The Color name selected in the Personalization popup. |
Elements
Name | Type | Description |
---|---|---|
Type | string | Element Type L, D, G (L=Lettering, D=Design, G=Group of Elements). |
ReferenceID | string | Unique Identifier for group. This element will be only available for group type elements |
Name | string | Group Name, defined during group creation process. This element will be only available for grouped elements i.e. compositions |
Elements | object array | Only available for 'G' type elements. Each object in the array supports all the properties and methods available for each element type (Design, Lettering). |
ServiceID | int | Embellishment / Service ID (1 = Embroidery, 2 = Printing). |
ElementID | int | The unique identifier for the element. |
ElementName | string | Element Name defined during the element creation process. |
DesignName | string | The design file name (available only for design elements). |
AlphabetName | string | The selected alphabet/font name, for example, Block, Arial (available only for lettering type elements). |
FileName | string | The file name of the selected alphabet/font. For example, Block.ofa, Arial.ttf, disney.ofm or football.eps. |
Text | string | The text entetred by the user. The default text will be returned if the text input is hidden or if the text is not changed by the user (available for only lettering type elements). |
Stitches | int | The number of embroidery stitches. 0 will be returned for print text and designs. |
Width | float | The element width in millimeters. This will be in pixels for graphic designs (i.e. .png, .jpeg). This is available for designs only. |
Height | float | The element height in millimeters. This will be in pixels for graphic designs (i.e. .png, .jpeg). This is available for designs only. |
Visible | int | Returns element visibility overrides by JavaScript API, it returns following values 0 false 1 true -1 No change inherited from ready |
Colors | object | List of Colors in the Lettering object See object for more details |
Colors
Name | Type | Description |
---|---|---|
Colorid | int | Identity / Unique identifier for the color. |
Name | string | The display name of the color. |
Manufacturer | string | The name of the thread manufacturer. Blank string for print colors. |
Threadcode | string | The code or thread number of the embroidery thread. Blank string for print colors. |
R | int | Color R value. |
G | int | Color G value. |
B | int | Color B value. |
Type | string | The type of element layer. This is only available for embroidery designs. Possible values: a = applique, e = embroidery, s = sequin. |
Heightmm | float | If the type attribute is "a", this will contain the height of the applique layer in millimeters. Otherwise, this will return 0. Available only for embroidery designs. |
Widthmm | float | If the type attribute is "a", this will contain the width of the applique layer in millimeters. Otherwise, this will return 0. Available only for embroidery designs. |
Methods
Name | Return Type | Description |
---|---|---|
GetStitchCount | int | Returns the number of stitches for this element. It will return 0 (zero) for print text or designs. |
GetColorCount | int | Returns the number of colors for this element. |
GetUniqueColors | int | Returns the object with each unique color for this element (unique based on RGB value).
|
GetWidth | float | Returns the element width in millimeters. |
GetHeight | float | Returns the element height in millimeters. |
CancelPersonalization (CancelPersonalization)
Callback variable/function when user hits cancel button. Only available when using popup mode.
CancelPersonalization (CancelPersonalization)
Melco.CancelPersonalization = function() { // Do stuff here... }
Output / Result
EditPersonalization (EditPersonalization)
Function to load the popup with a previous personalization instance token.
EditPersonalization (EditPersonalization)
Melco.EditPersonalization(Username, ReadyToken, InstanceToken, callback [optional]);
Parameters
Name | Type | Default | Required | Description |
---|---|---|---|---|
UserName | string | true | LiveDesignerFusion Login Name. | |
ReadyToken | string | true | The ready Token defined during the ready creation process. | |
InstanceToken | string | true | The instance Token previously passed to CompletePersonalization. | |
callback | method | null | false | Function to call just before the popup is rendered (if you require changes to the default settings). |
CultureName | method | en-US | false | Culture Name i.e. en_US etc. Cultures are not supported. This paremeter is for future implementation. |
popupMode | string | popup | false | Display mode type:
|
params | object | null | false | Properties object with following available properties
|
Output / Result
LoadTokenStitchPlayer (LoadTokenStitchPlayer)
Loads personalization stitch player for a given token
LoadTokenStitchPlayer (LoadTokenStitchPlayer)
Melco.LoadTokenStitchPlayer(username, containerID,token,fullfillmentindex,options [optional)
Parameters
Name | Type | Default | Required | Description |
---|---|---|---|---|
username | string | true | LiveDesignerFusion Login Name. | |
containerID | string | true | ID of the conatiner(div) where you want to add stitch player. | |
token | string | true | Personalization token (alpha numeric string) | |
fullfillmentindex | int | 0 | true | This is the index of the personalization, you want to play in the stitch player. This index is linked to index in the GetFullfillmentDetails and applicable for tokens with multiple compositions/elements on the same/different views. |
options | object | null | false | display properties: example:{width: 400,height: 400,autoplay: true,speed:50}
|
Output / Result
LoadCompositionStitchPlayer (LoadCompositionStitchPlayer)
Loads personalization stitch player for a given composition
LoadCompositionStitchPlayer (LoadCompositionStitchPlayer)
Melco.LoadCompositionStitchPlayer(username, containerID,compositionReferenceID,options [optional)
Parameters
Name | Type | Default | Required | Description |
---|---|---|---|---|
username | string | true | LiveDesignerFusion Login Name. | |
containerID | string | true | ID of the conatiner(div) where you want to add stitch player. | |
compositionReferenceID | string | true | Composition ReferenceID. comsposition unique identifier (alpha numeric string). | |
options | object | null | false | display properties: example:{width: 400,height: 400,autoplay: true,speed:50}
|
Output / Result
LoadDesignStitchPlayer (LoadDesignStitchPlayer)
Loads personalization stitch player for a given composition
LoadDesignStitchPlayer (LoadDesignStitchPlayer)
Melco.LoadDesignStitchPlayer(username, containerID,designReferenceID,options [optional)
Parameters
Name | Type | Default | Required | Description |
---|---|---|---|---|
username | string | true | LiveDesignerFusion Login Name. | |
containerID | string | true | ID of the conatiner(div) where you want to add stitch player. | |
designReferenceID | string | true | Design ReferenceID. Design unique identifier (alpha numeric string). | |
options | object | null | false | display properties: example:{width: 400,height: 400,autoplay: true,speed:50}
|
Output / Result
SetDefaultElementDesign (SetDefaultElementDesign)
Function to override the default design for a selectable design element. This must be called in the callback function passed to LoadPersonalization or EditPersonalization and this will only work for designs available in the selected design collection.
SetDefaultElementDesign (SetDefaultElementDesign)
Melco.SetDefaultElementDesign(ElementName, DesignReferenceID);
Parameters
Name | Type | Default | Required | Description |
---|---|---|---|---|
ElementName | string | true | The element's name entered into name field in Fusion Admin. | |
DesignReferenceID | string | true | The ReferenceID of the design you'd like to set. |
Output / Result
SetDefaultElementText (SetDefaultElementText)
[Deprecated] Function to override the default text for a lettering element. This must be called in a callback function passed to LoadPersonalization or
EditPersonalization. This method only supports chaging first line of text i.e. if Text element contains multiple text line then calling
this method will change only first line.Refer SetDefaultTextElement for more options.
SetDefaultElementText (SetDefaultElementText)
Melco.SetDefaultElementText(ElementName, Text);
Parameters
Name | Type | Default | Required | Description |
---|---|---|---|---|
ElementName | string | true | The element's name entered into the name field in Fusion Admin. | |
Text | string | true | The default text you'd like to set. |
Output / Result
SetDefaultTextElement (SetDefaultTextElement)
Function to override the default lettering element. This must be called in a callback function passed to LoadPersonalization or
EditPersonalization.
SetDefaultTextElement (SetDefaultTextElement)
Melco.SetDefaultTextElement({ element_name: "Text1", text: new Array("Melco", "Embroidery"), on_error: function (err) { alert(err.message); }, on_success: function () { alert('Success'); //logic to perform some activity } });
Parameters (properties object)
Name | Type | Default | Required | Description |
---|---|---|---|---|
element_name | string | true | The element's name entered into the name field in Fusion Admin during ready/composition creation process. | |
text | array | true | array of text elements. | |
on_error | function | false | callback function to handle error response. it return error object. | |
on_success | function | false | callback function to handle success response. |
Output / Result
SetTextElement (SetTextElement)
Function to set the lettering element properties when implementing controls manually.
SetTextElement (SetTextElement)
Melco.SetTextElement({ element_name: "Text1", text: new Array("Melco", "Embroidery"), on_error: function (err) { alert(err.message); }, on_success: function () { alert('Success'); //logic to perform some activity } });
Parameters (options/properties object)
Name | Type | Default | Required | Description |
---|---|---|---|---|
element_name | string | true | The element's name entered into the name field in Fusion Admin during ready/composition creation process. | |
text | array | true | array of text elements. | |
on_error | function | false | callback function to handle error response. it return error object. | |
on_success | function | false | callback function to handle success response. |
Output / Result
SetDefaultElementColor (SetDefaultElementColor)
Function to override default text for a lettering element (Must be called in callback function passed to LoadPersonalization or EditPersonalization.
SetDefaultElementColor (SetDefaultElementColor)
Melco.SetDefaultElementColor(ElementName,ColorName);
Parameters
Name | Type | Default | Required | Description |
---|---|---|---|---|
ElementName | string | true | The element's name entered into name field in fusion admin | |
ColorName | string | true | The default Color you'd like to set, if you'd like to set to RGB color use html hex notation (ie #ff0000 for red) |
Output / Result
SetDefaultElementFont (SetDefaultElementFont)
Function to override the default font for a lettering element. This must be called in a callback function passed to LoadPersonalization or EditPersonalization.
SetDefaultElementFont (SetDefaultElementFont)
Melco.SetDefaultElementFont(ElementName, FontName);
Parameters
Name | Type | Default | Required | Description |
---|---|---|---|---|
ElementName | string | true | The element's name entered into name field in Fusion Admin. | |
FontName | string | true | The Font you'd like to set. |
Output / Result
SetDefaultBlankColor (SetDefaultBlankColor)
Function to override the default color for a blank. This must be called in a callback function passed to LoadPersonalization or EditPersonalization.
SetDefaultBlankColor (SetDefaultBlankColor)
Melco.SetDefaultBlankColor(ColorName);
Parameters
Name | Type | Default | Required | Description |
---|---|---|---|---|
ColorName | string | true | The Color you'd like to set. |
Output / Result
GetElementList (GetElementList)
This function gets a list of elements included in a Ready. This must be called in the callback function and passed to LoadPersonalization or EditPersonalization.
GetElementList (GetElementList)
Melco.GetElementList();
Output / Result
GetBlankColorList (GetBlankColorList)
This function gets a list of blank colors in the Ready. The returned array contains a subarray called views which is list of Views for a given color. This must be called in a callback function passed to LoadPersonalization or EditPersonalization.
GetBlankColorList (GetBlankColorList)
Melco.GetBlankColorList();
Output / Result
RemoveBlankColor (RemoveBlankColor)
Function removes a Blank Color in Ready. (Must be called in callback function passed to LoadPersonalization or EditPersonalization)
RemoveBlankColor (RemoveBlankColor)
Melco.RemoveBlankColor(ColorName);
Parameters
Name | Type | Default | Required | Description |
---|---|---|---|---|
ColorName | string | true | The Name of the blank color, entered in the Fusion Admin, to remove. |
Output / Result
GetReadyTags (GetReadyTags)
This function gets a list of Tags assigned to a Ready. This must be called in a callback function passed to LoadPersonalization or EditPersonalization.
GetReadyTags (GetReadyTags)
Melco.GetReadyTags();
Output / Result
GetBlankTags (GetBlankTags)
This function gets a list of Tags assigned to a Blank. This must be called in a callback function passed to LoadPersonalization or EditPersonalization.
GetBlankTags (GetBlankTags)
Melco.GetBlankTags();
Output / Result
SetDefaultElement (SetDefaultElement)
This function gives you the ability to override the default visibility of elements before loading the interface.
In the future, this function may allow you to override other element properties in addition to visibility (i.e. text, etc.).
This function must be called in a callback function passed to LoadPersonalization or
EditPersonalization.
SetDefaultElement (SetDefaultElement)
Melco.SetDefaultElement({ show: { option: 'only', // only, all, invert: (required) visible: true, // true, false: (required) value to show/hide element_name: 'Front', // element_name as defined in the ready creation process is_composition: true // true, false: is this element a composition }, on_error: function (err) { alert('on_error function callbak: ' + err.message); }, on_success: function () { alert('on_success function callback'); } });
Parameters (options/properties object)
Name | Type | Default | Required | Description |
---|---|---|---|---|
show | options / properties object | true | Show or hide elements. Available properties:
|
|
on_error | function | false | callback function to handle error response. it return error object. | |
on_success | function | false | callback function to handle success response. |